Skip to content

Commit

Permalink
renaming weak to vulnerable and using function #12
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Sep 12, 2024
1 parent b048803 commit 9044091
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<double>::max()) {
return next;
Expand Down
5 changes: 2 additions & 3 deletions src/netbuild/NBNodeCont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/utils/common/SUMOVehicleClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
24 changes: 12 additions & 12 deletions src/utils/common/SUMOVehicleClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 9044091

Please sign in to comment.