From 5b04b4e227e1237d98ea8f14648fe33e67219835 Mon Sep 17 00:00:00 2001 From: Pablo Alvarez Lopez Date: Wed, 15 Jan 2025 10:43:49 +0100 Subject: [PATCH] Fixed error in GNEJunction due new virtual attribute. Refs #16018 --- src/netedit/GNENet.cpp | 6 ++---- src/netedit/elements/network/GNEJunction.cpp | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/netedit/GNENet.cpp b/src/netedit/GNENet.cpp index c9575a8af408..da6ca681acce 100644 --- a/src/netedit/GNENet.cpp +++ b/src/netedit/GNENet.cpp @@ -1115,8 +1115,6 @@ GNENet::addReversedEdge(GNEEdge* edge, const bool disconnected, GNEUndoList* und void GNENet::mergeJunctions(GNEJunction* moved, GNEJunction* target, GNEUndoList* undoList) { undoList->begin(moved, TL("merge junctions")); - // place moved junction in the same position of target junction - moved->setAttribute(GNE_ATTR_POSITION_MERGED, target->getAttribute(SUMO_ATTR_POSITION), undoList); // deleting edges changes in the underlying EdgeVector so we have to make a copy const EdgeVector incomingNBEdges = moved->getNBNode()->getIncomingEdges(); for (const auto& incomingNBEdge : incomingNBEdges) { @@ -1125,7 +1123,7 @@ GNENet::mergeJunctions(GNEJunction* moved, GNEJunction* target, GNEUndoList* und if (edge->getFromJunction() == target) { deleteEdge(edge, undoList, false); } else { - GNEChange_Attribute::changeAttribute(edge, SUMO_ATTR_TO, target->getID(), undoList); + edge->setAttribute(SUMO_ATTR_TO, target->getID(), undoList); } } // deleting edges changes in the underlying EdgeVector so we have to make a copy @@ -1136,7 +1134,7 @@ GNENet::mergeJunctions(GNEJunction* moved, GNEJunction* target, GNEUndoList* und if (edge->getToJunction() == target) { deleteEdge(edge, undoList, false); } else { - GNEChange_Attribute::changeAttribute(edge, SUMO_ATTR_FROM, target->getID(), undoList); + edge->setAttribute(SUMO_ATTR_FROM, target->getID(), undoList); } } // deleted moved junction diff --git a/src/netedit/elements/network/GNEJunction.cpp b/src/netedit/elements/network/GNEJunction.cpp index 3b7c9f919c34..2c7b5ebe01fd 100644 --- a/src/netedit/elements/network/GNEJunction.cpp +++ b/src/netedit/elements/network/GNEJunction.cpp @@ -1324,6 +1324,7 @@ GNEJunction::getAttribute(SumoXMLAttr key) const { case SUMO_ATTR_ID: return getMicrosimID(); case SUMO_ATTR_POSITION: + case GNE_ATTR_POSITION_MERGED: return toString(myNBNode->getPosition()); case SUMO_ATTR_TYPE: return toString(myNBNode->getType()); @@ -1912,7 +1913,8 @@ GNEJunction::setAttribute(SumoXMLAttr key, const std::string& value) { myNBNode->reinit(myNBNode->getPosition(), type); break; } - case SUMO_ATTR_POSITION: { + case SUMO_ATTR_POSITION: + case GNE_ATTR_POSITION_MERGED: { // set new position in NBNode updating edge boundaries moveJunctionGeometry(parse(value), true); // mark this connections and all of the junction's Neighbours as deprecated