Skip to content

Commit

Permalink
Moved checkDrawMoveContour() function in every additional. Refs #14109
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 20, 2023
1 parent 4f52b88 commit 544ba52
Show file tree
Hide file tree
Showing 54 changed files with 484 additions and 16 deletions.
15 changes: 15 additions & 0 deletions src/netedit/elements/additional/GNEAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,21 @@ void GNEAccess::fixAdditionalProblem() {
}


bool
GNEAccess::checkDrawMoveContour() const {
// get edit modes
const auto& editModes = myNet->getViewNet()->getEditModes();
// check if we're in move mode
if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
// only move the first element
return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == this;
} else {
return false;
}
}


GNEEdge*
GNEAccess::getEdge() const {
return getParentLanes().front()->getParentEdge();
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ class GNEAccess : public GNEAdditional, public Parameterised {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name Functions related with geometry of element
/// @{

Expand Down
15 changes: 0 additions & 15 deletions src/netedit/elements/additional/GNEAdditional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,21 +355,6 @@ GNEAdditional::checkDrawSelectContour() const {
}


bool
GNEAdditional::checkDrawMoveContour() const {
// get edit modes
const auto& editModes = myNet->getViewNet()->getEditModes();
// check if we're in move mode
if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
// only move the first element
return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == this;
} else {
return false;
}
}


GUIGLObjectPopupMenu*
GNEAdditional::getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) {
GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEAdditional.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class GNEAdditional : public GNEPathManager::PathElement, public GNEHierarchical
bool checkDrawSelectContour() const;

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;
virtual bool checkDrawMoveContour() const = 0;

/// @}

Expand Down
15 changes: 15 additions & 0 deletions src/netedit/elements/additional/GNECalibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,21 @@ GNECalibrator::drawGL(const GUIVisualizationSettings& s) const {
}


bool
GNECalibrator::checkDrawMoveContour() const {
// get edit modes
const auto& editModes = myNet->getViewNet()->getEditModes();
// check if we're in move mode
if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
// only move the first element
return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == this;
} else {
return false;
}
}


void
GNECalibrator::openAdditionalDialog() {
// Open calibrator dialog
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNECalibrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ class GNECalibrator : public GNEAdditional, public Parameterised {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @brief open Calibrator Dialog
void openAdditionalDialog();

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/additional/GNECalibratorFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ GNECalibratorFlow::fixAdditionalProblem() {
}


bool
GNECalibratorFlow::checkDrawMoveContour() const {
return false;
}


GNEMoveOperation*
GNECalibratorFlow::getMoveOperation() {
// calibrators flow cannot be moved
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNECalibratorFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ class GNECalibratorFlow : public GNEAdditional, public SUMOVehicleParameter {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name Functions related with geometry of element
/// @{

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/additional/GNEClosingLaneReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ GNEClosingLaneReroute::fixAdditionalProblem() {
}


bool
GNEClosingLaneReroute::checkDrawMoveContour() const {
return false;
}


GNEMoveOperation*
GNEClosingLaneReroute::getMoveOperation() {
// GNEClosingLaneReroute cannot be moved
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEClosingLaneReroute.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ class GNEClosingLaneReroute : public GNEAdditional {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name Functions related with geometry of element
/// @{

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/additional/GNEClosingReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ GNEClosingReroute::fixAdditionalProblem() {
}


bool
GNEClosingReroute::checkDrawMoveContour() const {
return false;
}


GNEMoveOperation*
GNEClosingReroute::getMoveOperation() {
// GNEClosingReroutes cannot be moved
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEClosingReroute.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ class GNEClosingReroute : public GNEAdditional {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name Functions related with geometry of element
/// @{

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/additional/GNEDestProbReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ GNEDestProbReroute::fixAdditionalProblem() {
}


bool
GNEDestProbReroute::checkDrawMoveContour() const {
return false;
}


GNEMoveOperation*
GNEDestProbReroute::getMoveOperation() {
// GNEDestProbReroutes cannot be moved
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEDestProbReroute.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ class GNEDestProbReroute : public GNEAdditional {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name Functions related with geometry of element
/// @{

Expand Down
15 changes: 15 additions & 0 deletions src/netedit/elements/additional/GNEDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ GNEDetector::getPositionOverLane() const {
}


bool
GNEDetector::checkDrawMoveContour() const {
// get edit modes
const auto& editModes = myNet->getViewNet()->getEditModes();
// check if we're in move mode
if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
// only move the first element
return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == this;
} else {
return false;
}
}


GNELane*
GNEDetector::getLane() const {
return getParentLanes().front();
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ class GNEDetector : public GNEAdditional, public Parameterised {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @brief get lane
GNELane* getLane() const;

Expand Down
15 changes: 15 additions & 0 deletions src/netedit/elements/additional/GNEMultiEntryExitDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ GNEMultiEntryExitDetector::fixAdditionalProblem() {
}


bool
GNEMultiEntryExitDetector::checkDrawMoveContour() const {
// get edit modes
const auto& editModes = myNet->getViewNet()->getEditModes();
// check if we're in move mode
if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
// only move the first element
return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == this;
} else {
return false;
}
}


void
GNEMultiEntryExitDetector::updateGeometry() {
// update additional geometry
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEMultiEntryExitDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ class GNEMultiEntryExitDetector : public GNEAdditional, public Parameterised {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name Functions related with geometry of element
/// @{

Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/additional/GNEOverheadWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ GNEOverheadWire::fixAdditionalProblem() {
}


bool
GNEOverheadWire::checkDrawMoveContour() const {
return false;
}


void
GNEOverheadWire::updateGeometry() {
// compute path
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEOverheadWire.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ class GNEOverheadWire : public GNEAdditional, public Parameterised {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @brief update pre-computed geometry information
void updateGeometry();

Expand Down
15 changes: 15 additions & 0 deletions src/netedit/elements/additional/GNEPOI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,21 @@ GNEPOI::getGlID() const {
}


bool
GNEPOI::checkDrawMoveContour() const {
// get edit modes
const auto& editModes = myNet->getViewNet()->getEditModes();
// check if we're in move mode
if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
// only move the first element
return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == this;
} else {
return false;
}
}


std::string
GNEPOI::getParentName() const {
if (getParentLanes().size() > 0) {
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEPOI.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ class GNEPOI : public PointOfInterest, public GNEAdditional {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name inherited from GUIGlObject
/// @{
/**@brief Returns the name of the parent object
Expand Down
6 changes: 6 additions & 0 deletions src/netedit/elements/additional/GNEParkingAreaReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ GNEParkingAreaReroute::fixAdditionalProblem() {
}


bool
GNEParkingAreaReroute::checkDrawMoveContour() const {
return false;
}


GNEMoveOperation*
GNEParkingAreaReroute::getMoveOperation() {
// GNEParkingAreaReroutes cannot be moved
Expand Down
8 changes: 8 additions & 0 deletions src/netedit/elements/additional/GNEParkingAreaReroute.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ class GNEParkingAreaReroute : public GNEAdditional {

/// @}

/// @name Function related with contour drawing
/// @{

/// @brief check if draw move contour (red)
bool checkDrawMoveContour() const;

/// @}

/// @name Functions related with geometry of element
/// @{

Expand Down

0 comments on commit 544ba52

Please sign in to comment.