Skip to content

Commit

Permalink
Fixed error in GNEJunction due new virtual attribute. Refs #16018
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Jan 15, 2025
1 parent d731dc3 commit 5b04b4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/netedit/GNENet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/netedit/elements/network/GNEJunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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<Position>(value), true);
// mark this connections and all of the junction's Neighbours as deprecated
Expand Down

0 comments on commit 5b04b4e

Please sign in to comment.