Skip to content

Commit

Permalink
Updated all updateCenteringBoundary() additional functions. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 3f8431d commit e3aa453
Show file tree
Hide file tree
Showing 28 changed files with 31 additions and 100 deletions.
6 changes: 1 addition & 5 deletions src/netedit/elements/additional/GNEAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ GNEAccess::getPositionInView() const {

void
GNEAccess::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to update
}


Expand Down
6 changes: 5 additions & 1 deletion src/netedit/elements/additional/GNEAdditional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ GNEAdditional::getExaggeration(const GUIVisualizationSettings& s) const {

Boundary
GNEAdditional::getCenteringBoundary() const {
return myAdditionalBoundary;
if (myAdditionalBoundary.isInitialised()) {
return myAdditionalBoundary;
} else {
return myContour.getContourBoundary();
}
}


Expand Down
2 changes: 0 additions & 2 deletions src/netedit/elements/additional/GNEBusStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ GNEBusStop::GNEBusStop(SumoXMLTag tag, const std::string& id, GNELane* lane, GNE
myPersonCapacity(personCapacity),
myParkingLength(parkingLength),
myColor(color) {
// update centering boundary without updating grid
updateCenteringBoundary(false);
}


Expand Down
6 changes: 1 addition & 5 deletions src/netedit/elements/additional/GNECalibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,7 @@ GNECalibrator::getPositionInView() const {

void
GNECalibrator::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to update
}


Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNECalibratorFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ GNECalibratorFlow::getPositionInView() const {

void
GNECalibratorFlow::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to update
}


Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNEClosingLaneReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ GNEClosingLaneReroute::getPositionInView() const {

void
GNEClosingLaneReroute::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to update
}


Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNEClosingReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ GNEClosingReroute::getPositionInView() const {

void
GNEClosingReroute::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to update
}


Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNEDestProbReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ GNEDestProbReroute::getPositionInView() const {

void
GNEDestProbReroute::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to update
}


Expand Down
6 changes: 1 addition & 5 deletions src/netedit/elements/additional/GNEDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ GNEDetector::getPositionInView() const {

void
GNEDetector::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to update
}

void
Expand Down
6 changes: 0 additions & 6 deletions src/netedit/elements/additional/GNELaneAreaDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ myTimeThreshold(timeThreshold),
mySpeedThreshold(speedThreshold),
myJamThreshold(jamThreshold),
myTrafficLight(trafficLight) {
// update centering boundary without updating grid
updateCenteringBoundary(false);
}


Expand All @@ -78,8 +76,6 @@ GNELaneAreaDetector::GNELaneAreaDetector(const std::string& id, std::vector<GNEL
mySpeedThreshold(speedThreshold),
myJamThreshold(jamThreshold),
myTrafficLight(trafficLight) {
// update centering boundary without updating grid
updateCenteringBoundary(false);
}


Expand Down Expand Up @@ -268,8 +264,6 @@ GNELaneAreaDetector::updateGeometry() {
} else {
// Cut shape using as delimitators fixed start position and fixed end position
myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(), getStartGeometryPositionOverLane(), getEndGeometryPositionOverLane(), myMoveElementLateralOffset);
// update centering boundary without updating grid
updateCenteringBoundary(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,8 @@ GNEMultiEntryExitDetector::updateCenteringBoundary(const bool updateGrid) {
updateGeometry();
// add shape boundary
myAdditionalBoundary = myAdditionalGeometry.getShape().getBoxBoundary();
// add positions of all childrens
for (const auto& additionalChildren : getChildAdditionals()) {
myAdditionalBoundary.add(additionalChildren->getPositionInView());
}
// grow
myAdditionalBoundary.grow(10);
myAdditionalBoundary.grow(5);
// add additional into RTREE again
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
6 changes: 1 addition & 5 deletions src/netedit/elements/additional/GNEOverheadWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,7 @@ GNEOverheadWire::getPositionInView() const {

void
GNEOverheadWire::updateCenteringBoundary(const bool /* updateGrid */) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to update
}


Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEPOI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ GNEPOI::updateCenteringBoundary(const bool updateGrid) {
// add position (this POI)
myAdditionalBoundary.add(*this);
// grow boundary
myAdditionalBoundary.grow(10 + std::max(getWidth() * 0.5, getHeight() * 0.5));
myAdditionalBoundary.grow(5 + std::max(getWidth() * 0.5, getHeight() * 0.5));
// add object into net
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNEParkingAreaReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ GNEParkingAreaReroute::getPositionInView() const {

void
GNEParkingAreaReroute::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to update
}


Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEParkingSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ GNEParkingSpace::updateCenteringBoundary(const bool updateGrid) {
myAdditionalBoundary.grow(myShapeLength.length2D());
myAdditionalBoundary.grow(myShapeWidth.length2D());
// grow
myAdditionalBoundary.grow(10);
myAdditionalBoundary.grow(5);
// add additional into RTREE again
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ GNEPoly::updateCenteringBoundary(const bool updateGrid) {
// use shape as boundary
myAdditionalBoundary = myShape.getBoxBoundary();
// grow boundary
myAdditionalBoundary.grow(10);
myAdditionalBoundary.grow(5);
// add object into net
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNERerouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ GNERerouter::updateCenteringBoundary(const bool updateGrid) {
myAdditionalBoundary.add(rerouterElement->getPositionInView());
// special case for parking area rerouter
if (rerouterElement->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
myAdditionalBoundary.add(rerouterElement->getParentAdditionals().at(1)->getPositionInView());
myAdditionalBoundary.add(rerouterElement->getParentAdditionals().at(1)->getCenteringBoundary());
}
}
}
// grow
myAdditionalBoundary.grow(10);
myAdditionalBoundary.grow(5);
// add additional into RTREE again
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNERerouterInterval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ GNERerouterInterval::getPositionInView() const {

void
GNERerouterInterval::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to do
}


Expand Down
6 changes: 1 addition & 5 deletions src/netedit/elements/additional/GNERerouterSymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ GNERerouterSymbol::getPositionInView() const {

void
GNERerouterSymbol::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to do
}


Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNERouteProbReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ GNERouteProbReroute::updateGeometry() {

void
GNERouteProbReroute::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to do
}


Expand Down
6 changes: 1 addition & 5 deletions src/netedit/elements/additional/GNERouteProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@ GNERouteProbe::getPositionInView() const {

void
GNERouteProbe::updateCenteringBoundary(const bool /*pdateGrid*/) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to do
}


Expand Down
13 changes: 1 addition & 12 deletions src/netedit/elements/additional/GNEStoppingPlace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,7 @@ GNEStoppingPlace::getPositionInView() const {

void
GNEStoppingPlace::updateCenteringBoundary(const bool /*updateGrid*/) {
if (!isTemplate()) {
// update geometry
updateGeometry();
// add shape boundary
myAdditionalBoundary = myAdditionalGeometry.getShape().getBoxBoundary();
// grow with "width"
if (myTagProperty.hasAttribute(SUMO_ATTR_WIDTH)) {
myAdditionalBoundary.grow(getAttributeDouble(SUMO_ATTR_WIDTH));
}
// grow
myAdditionalBoundary.grow(10);
}
// nothing to do
}


Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNETAZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ GNETAZ::updateCenteringBoundary(const bool updateGrid) {
myAdditionalBoundary.add(myTAZCenter);
}
// grow boundary
myAdditionalBoundary.grow(10);
myAdditionalBoundary.grow(5);
// add object into net
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNETractionSubstation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ GNETractionSubstation::updateCenteringBoundary(const bool updateGrid) {
// add shape boundary
myAdditionalBoundary = myAdditionalGeometry.getShape().getBoxBoundary();
// grow
myAdditionalBoundary.grow(10);
myAdditionalBoundary.grow(5);
// add additional into RTREE again
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
6 changes: 1 addition & 5 deletions src/netedit/elements/additional/GNEVaporizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ GNEVaporizer::getPositionInView() const {

void
GNEVaporizer::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to do
}


Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNEVariableSpeedSign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@ GNEVariableSpeedSign::updateCenteringBoundary(const bool updateGrid) {
// add positions of all childrens (symbols and steps)
for (const auto& additionalChildren : getChildAdditionals()) {
myAdditionalBoundary.add(additionalChildren->getPositionInView());
// also update centering boundary
additionalChildren->updateCenteringBoundary(false);
}
// grow
myAdditionalBoundary.grow(10);
myAdditionalBoundary.grow(5);
// add additional into RTREE again
if (updateGrid) {
myNet->addGLObjectIntoGrid(this);
Expand Down
4 changes: 1 addition & 3 deletions src/netedit/elements/additional/GNEVariableSpeedSignStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ GNEVariableSpeedSignStep::getPositionInView() const {

void
GNEVariableSpeedSignStep::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
myAdditionalBoundary.add(getPositionInView());
myAdditionalBoundary.grow(5);
// nothing to do
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ GNEVariableSpeedSignSymbol::updateGeometry() {

void
GNEVariableSpeedSignSymbol::updateCenteringBoundary(const bool /*updateGrid*/) {
myAdditionalBoundary.reset();
// add center
myAdditionalBoundary.add(getPositionInView());
// grow
myAdditionalBoundary.grow(10);
// nothing to do
}


Expand Down

0 comments on commit e3aa453

Please sign in to comment.