diff --git a/src/netedit/elements/network/GNEJunction.cpp b/src/netedit/elements/network/GNEJunction.cpp index 188d897e87d..f235ba9ec3a 100644 --- a/src/netedit/elements/network/GNEJunction.cpp +++ b/src/netedit/elements/network/GNEJunction.cpp @@ -1034,6 +1034,7 @@ GNEJunction::getAttribute(SumoXMLAttr key) const { case SUMO_ATTR_ID: return getMicrosimID(); case SUMO_ATTR_POSITION: + case GNE_ATTR_SINGLE_POSITION: return toString(myNBNode->getPosition()); case SUMO_ATTR_TYPE: return toString(myNBNode->getType()); @@ -1102,6 +1103,7 @@ GNEJunction::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList switch (key) { case SUMO_ATTR_ID: case SUMO_ATTR_POSITION: + case GNE_ATTR_SINGLE_POSITION: case GNE_ATTR_MODIFICATION_STATUS: case SUMO_ATTR_SHAPE: case SUMO_ATTR_RADIUS: @@ -1244,6 +1246,7 @@ GNEJunction::isValid(SumoXMLAttr key, const std::string& value) { case SUMO_ATTR_TYPE: return SUMOXMLDefinitions::NodeTypes.hasString(value); case SUMO_ATTR_POSITION: + case GNE_ATTR_SINGLE_POSITION: return canParse(value); case SUMO_ATTR_SHAPE: // empty shapes are allowed @@ -1628,7 +1631,16 @@ GNEJunction::setAttribute(SumoXMLAttr key, const std::string& value) { } case SUMO_ATTR_POSITION: { // set new position in NBNode updating edge boundaries - moveJunctionGeometry(parse(value), true); + moveJunctionGeometry(parse(value), true, true); + // mark this connections and all of the junction's Neighbours as deprecated + markConnectionsDeprecated(true); + // update centering boundary and grid + updateCenteringBoundary(true); + break; + } + case GNE_ATTR_SINGLE_POSITION: { + // set new position in NBNode updating edge boundaries + moveJunctionGeometry(parse(value), false, false); // mark this connections and all of the junction's Neighbours as deprecated markConnectionsDeprecated(true); // update centering boundary and grid @@ -1723,7 +1735,7 @@ GNEJunction::setMoveShape(const GNEMoveResult& moveResult) { // set new shape myNBNode->setCustomShape(moveResult.shapeToUpdate); } else if (moveResult.shapeToUpdate.size() > 0) { - moveJunctionGeometry(moveResult.shapeToUpdate.front(), false); + moveJunctionGeometry(moveResult.shapeToUpdate.front(), false, true); } updateGeometry(); } @@ -1751,6 +1763,7 @@ GNEJunction::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoL undoList->end(); } else if (!myNet->getViewNet()->mergeJunctions(this, secondJunction)) { undoList->begin(GUIIcon::JUNCTION, "position of " + getTagStr()); + // undoList->changeAttribute(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(moveResult.shapeToUpdate.front()))); undoList->end(); } @@ -1842,14 +1855,16 @@ GNEJunction::checkMissingConnections() { void -GNEJunction::moveJunctionGeometry(const Position& pos, const bool updateEdgeBoundaries) { +GNEJunction::moveJunctionGeometry(const Position& pos, const bool updateEdgeBoundaries, const bool moveAdjacentEdges) { // obtain NBNode position const Position orig = myNBNode->getPosition(); // reinit NBNode myNBNode->reinit(pos, myNBNode->getType()); // set new position of adjacent edges - for (const auto& edge : getNBNode()->getEdges()) { - myNet->getAttributeCarriers()->retrieveEdge(edge->getID())->updateJunctionPosition(this, orig); + if (moveAdjacentEdges) { + for (const auto& edge : getNBNode()->getEdges()) { + myNet->getAttributeCarriers()->retrieveEdge(edge->getID())->updateJunctionPosition(this, orig); + } } // declare three sets with all affected GNEJunctions, GNEEdges and GNEConnections std::set affectedJunctions; diff --git a/src/netedit/elements/network/GNEJunction.h b/src/netedit/elements/network/GNEJunction.h index 1c6b70a9c08..14fc5e47f43 100644 --- a/src/netedit/elements/network/GNEJunction.h +++ b/src/netedit/elements/network/GNEJunction.h @@ -341,7 +341,7 @@ class GNEJunction : public GNENetworkElement, public GNECandidateElement { * @param[in] pos The new position * @note: those operations are not added to the undoList. */ - void moveJunctionGeometry(const Position& pos, const bool updateEdgeBoundaries); + void moveJunctionGeometry(const Position& pos, const bool updateEdgeBoundaries, const bool moveAdjacentEdges); /// @brief sets junction color depending on circumstances RGBColor setColor(const GUIVisualizationSettings& s, bool bubble) const; diff --git a/src/utils/xml/SUMOXMLDefinitions.cpp b/src/utils/xml/SUMOXMLDefinitions.cpp index 3fe9a3c0729..caae553e4ad 100644 --- a/src/utils/xml/SUMOXMLDefinitions.cpp +++ b/src/utils/xml/SUMOXMLDefinitions.cpp @@ -980,6 +980,7 @@ StringBijection::Entry SUMOXMLDefinitions::attrs[] = { { "stopIndex", GNE_ATTR_STOPINDEX }, { "pathStopIndex", GNE_ATTR_PATHSTOPINDEX }, { "additionalChildren", GNE_ATTR_ADDITIONALCHILDREN }, + { "singlePosition", GNE_ATTR_SINGLE_POSITION }, { "carriageLength", SUMO_ATTR_CARRIAGE_LENGTH }, { "locomotiveLength", SUMO_ATTR_LOCOMOTIVE_LENGTH }, diff --git a/src/utils/xml/SUMOXMLDefinitions.h b/src/utils/xml/SUMOXMLDefinitions.h index 7aae426ab4c..e9c2f5e3c69 100644 --- a/src/utils/xml/SUMOXMLDefinitions.h +++ b/src/utils/xml/SUMOXMLDefinitions.h @@ -1429,6 +1429,8 @@ enum SumoXMLAttr { GNE_ATTR_PATHSTOPINDEX, /// @brief check number of additional children (used in vTypeDistribution) GNE_ATTR_ADDITIONALCHILDREN, + /// @brief move single position (used during moving of selected junctions) + GNE_ATTR_SINGLE_POSITION, // @}