From 39a468ec655cd12d41c88c74d84cf9af3c2627ac Mon Sep 17 00:00:00 2001 From: Michael Behrisch Date: Thu, 11 Jan 2024 19:14:46 +0100 Subject: [PATCH] fixing duarouter problems with parameterized plan items #14198 --- src/router/ROPerson.h | 3 ++- src/router/RORouteHandler.cpp | 2 ++ src/utils/vehicle/SUMORouteHandler.cpp | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/router/ROPerson.h b/src/router/ROPerson.h index e8eda4a6c2fe..3e081f44bf7e 100644 --- a/src/router/ROPerson.h +++ b/src/router/ROPerson.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -79,7 +80,7 @@ class ROPerson : public RORoutable { * @brief Every person has a plan comprising of multiple planItems * */ - class PlanItem { + class PlanItem : public Parameterised { public: /// @brief Destructor virtual ~PlanItem() {} diff --git a/src/router/RORouteHandler.cpp b/src/router/RORouteHandler.cpp index 25c4e897c3c8..94af13ac8894 100644 --- a/src/router/RORouteHandler.cpp +++ b/src/router/RORouteHandler.cpp @@ -1289,6 +1289,7 @@ RORouteHandler::addPersonTrip(const SUMOSAXAttributes& attrs) { const std::string originStopID = myActivePlan->empty() ? "" : myActivePlan->back()->getStopDest(); ROPerson::addTrip(*myActivePlan, myVehicleParameter->id, from, to, modeSet, types, departPos, originStopID, arrivalPos, busStopID, walkFactor, group); + myParamStack.push_back(myActivePlan->back()); } } @@ -1333,6 +1334,7 @@ RORouteHandler::addWalk(const SUMOSAXAttributes& attrs) { retrieveStoppingPlace(attrs, errorSuffix, stoppingPlaceID); if (ok) { ROPerson::addWalk(*myActivePlan, myActiveRoute, duration, speed, departPos, arrivalPos, stoppingPlaceID); + myParamStack.push_back(myActivePlan->back()); } } else { addPersonTrip(attrs); diff --git a/src/utils/vehicle/SUMORouteHandler.cpp b/src/utils/vehicle/SUMORouteHandler.cpp index 938994e1cbd5..993fd47b27ec 100644 --- a/src/utils/vehicle/SUMORouteHandler.cpp +++ b/src/utils/vehicle/SUMORouteHandler.cpp @@ -294,7 +294,9 @@ SUMORouteHandler::myEndElement(int element) { break; case SUMO_TAG_PERSONTRIP: case SUMO_TAG_WALK: - myParamStack.pop_back(); + if (myParamStack.size() == 2) { + myParamStack.pop_back(); + } break; case SUMO_TAG_INTERVAL: myBeginDefault = string2time(OptionsCont::getOptions().getString("begin"));