From 90440918dc6b152446285bd42865dcab104764a4 Mon Sep 17 00:00:00 2001 From: Michael Behrisch Date: Thu, 12 Sep 2024 08:54:39 +0200 Subject: [PATCH] renaming weak to vulnerable and using function #12 --- .../MSActuatedTrafficLightLogic.cpp | 4 ++-- src/netbuild/NBNodeCont.cpp | 5 ++-- src/utils/common/SUMOVehicleClass.cpp | 4 ++-- src/utils/common/SUMOVehicleClass.h | 24 +++++++++---------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp b/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp index 9bbe9803269d..c0e49f1a2d54 100644 --- a/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp +++ b/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp @@ -505,7 +505,7 @@ MSActuatedTrafficLightLogic::weakConflict(int tlIndex, const std::string& state) const MSJunctionLogic* logic = junction->getLogic(); //std::cout << " greenLink=" << i << " isFoe=" << logic->getFoesFor(linkIndex).test(foeIndex) << "\n"; if (logic->getFoesFor(linkIndex).test(foeIndex) - && (foe->getPermissions() & ~SVC_WEAK) != 0 // check1e + && (foe->getPermissions() & ~SVC_VULNERABLE) != 0 // check1e && &foe->getLaneBefore()->getEdge() != &link->getLaneBefore()->getEdge()) { // check1f //std::cout << " strongConflict " << tlIndex << " in phase " << state << " with link " << foe->getTLIndex() << "\n"; return false; @@ -1079,7 +1079,7 @@ MSActuatedTrafficLightLogic::decideNextPhaseCustom(bool mustSwitch) { const std::string& condition = mustSwitch ? phase->finalTarget : phase->earlyTarget; //std::cout << SIMTIME << " mustSwitch=" << mustSwitch << " condition=" << condition << "\n"; if (condition != "") { - // backward compatibility if a user redefined DEFAULT_CONDITION + // backward compatibility if a user redefined DEFAULT_CONDITION if (condition == DEFAULT_CONDITION && myConditions.count(DEFAULT_CONDITION) == 0) { if (gapControl() == std::numeric_limits::max()) { return next; diff --git a/src/netbuild/NBNodeCont.cpp b/src/netbuild/NBNodeCont.cpp index e6c4592b75bf..b05679675db2 100644 --- a/src/netbuild/NBNodeCont.cpp +++ b/src/netbuild/NBNodeCont.cpp @@ -643,7 +643,7 @@ NBNodeCont::generateNodeClusters(double maxDist, NodeClusters& into) const { if (length + dist < maxDist) { // don't add long "boring" appendages but always join the whole rail crossing or tls const bool trueGeomLike = s->geometryLike(); - if (trueGeomLike || geometryLikeForClass(s, SVC_WEAK | SVC_DELIVERY)) { + if (trueGeomLike || geometryLikeForClass(s, SVC_VULNERABLE | SVC_DELIVERY)) { const bool hasTLS = n->isTrafficLight() || s->isTrafficLight(); const double fullLength = e->getGeometry().length2D(); const double length2 = bothCrossing || hasTLS || trueGeomLike ? length : fullLength; @@ -999,8 +999,7 @@ NBNodeCont::pruneClusterFringe(NodeSet& cluster, double maxDist) const { || isRailway(e->getPermissions()) // join railway crossings || (clusterDist <= pedestrianFringeThreshold && (!pruneNoisyFringe - || ((e->getPermissions() & SVC_WEAK) != 0 && - (e->getPermissions() & ~SVC_WEAK) == 0) + || isForVulnerableModes(e->getPermissions()) // permit joining small opposite merges || getDiameter(cluster) < maxDist || cluster.size() == 2)) diff --git a/src/utils/common/SUMOVehicleClass.cpp b/src/utils/common/SUMOVehicleClass.cpp index 76389dd25e4e..e32d45f1561c 100644 --- a/src/utils/common/SUMOVehicleClass.cpp +++ b/src/utils/common/SUMOVehicleClass.cpp @@ -534,8 +534,8 @@ isSidewalk(SVCPermissions permissions) { bool -isForWeakModes(SVCPermissions permissions) { - return ((permissions & SVC_WEAK) != 0 && (permissions & ~SVC_WEAK) == 0); +isForVulnerableModes(SVCPermissions permissions) { + return ((permissions & SVC_VULNERABLE) != 0 && (permissions & ~SVC_VULNERABLE) == 0); } diff --git a/src/utils/common/SUMOVehicleClass.h b/src/utils/common/SUMOVehicleClass.h index fcf9f6f15478..fa4b64e4c5bd 100644 --- a/src/utils/common/SUMOVehicleClass.h +++ b/src/utils/common/SUMOVehicleClass.h @@ -225,7 +225,7 @@ enum SUMOVehicleClass : int64_t { | SVC_WHEELCHAIR | SVC_SCOOTER), /// @brief classes which (normally) do not drive on normal roads SVC_NON_ROAD = SVC_RAIL_CLASSES | SVC_SHIP | SVC_AIRCRAFT | SVC_DRONE | SVC_CONTAINER, - SVC_WEAK = SVC_PEDESTRIAN | SVC_WHEELCHAIR | SVC_BICYCLE | SVC_SCOOTER + SVC_VULNERABLE = SVC_PEDESTRIAN | SVC_WHEELCHAIR | SVC_BICYCLE | SVC_SCOOTER }; extern const SUMOVehicleClass SUMOVehicleClass_MAX; @@ -397,55 +397,55 @@ extern SUMOVehicleShape getVehicleShapeID(const std::string& name); /// @brief Checks whether the given string contains only known vehicle shape extern bool canParseVehicleShape(const std::string& shape); -/** @brief Returns whether an edge with the given permission is a railway edge +/** @brief Returns whether an edge with the given permissions is a railway edge * @param[in] permissions The permissions of the edge * @return Whether the edge is a railway edge */ extern bool isRailway(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission is a tram edge +/** @brief Returns whether an edge with the given permissions is a tram edge * @param[in] permissions The permissions of the edge * @return Whether the edge is a tram edge */ extern bool isTram(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission is a bicycle edge +/** @brief Returns whether an edge with the given permissions is a bicycle edge * @param[in] permissions The permissions of the edge * @return Whether the edge is a bicycle edge */ extern bool isBikepath(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission is a waterway edge +/** @brief Returns whether an edge with the given permissions is a waterway edge * @param[in] permissions The permissions of the edge * @return Whether the edge is a waterway edge */ extern bool isWaterway(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission is an airway edge +/** @brief Returns whether an edge with the given permissions is an airway edge * @param[in] permissions The permissions of the edge * @return Whether the edge is an airway edge */ extern bool isAirway(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission is a forbidden edge +/** @brief Returns whether an edge with the given permissions is a forbidden edge * @param[in] permissions The permissions of the edge * @return Whether the edge is forbidden */ extern bool isForbidden(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission is a sidewalk +/** @brief Returns whether an edge with the given permissions is a sidewalk * @param[in] permissions The permissions of the edge * @return Whether the edge is a sidewalk */ extern bool isSidewalk(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission is a sidewalk +/** @brief Returns whether an edge with the given permissions allows only vulnerable road users * @param[in] permissions The permissions of the edge - * @return Whether the edge is a sidewalk + * @return Whether the edge allows only a (non-empty) subset of SVC_PEDESTRIAN, SVC_WHEELCHAIR, SVC_BICYCLE, SVC_SCOOTER */ -extern bool isForWeakModes(SVCPermissions permissions); +extern bool isForVulnerableModes(SVCPermissions permissions); -/** @brief Returns whether an edge with the given permission forbids vehicles +/** @brief Returns whether an edge with the given permissions forbids vehicles * @param[in] permissions The permissions of the edge * @return Whether the edge is forbidden for vehicles */