Skip to content

Commit

Permalink
default color for airway junctions, refs #14813
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 2, 2024
1 parent 3f7e589 commit 4ad79ae
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/guisim/GUIJunctionWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ GUIJunctionWrapper::GUIJunctionWrapper(MSJunction& junction, const std::string&
myIsInternal = myJunction.getType() == SumoXMLNodeType::INTERNAL;
myAmWaterway = myJunction.getIncoming().size() + myJunction.getOutgoing().size() > 0;
myAmRailway = myJunction.getIncoming().size() + myJunction.getOutgoing().size() > 0;
myAmAirway = myJunction.getIncoming().size() + myJunction.getOutgoing().size() > 0;
for (auto it = myJunction.getIncoming().begin(); it != myJunction.getIncoming().end() && (myAmWaterway || myAmRailway); ++it) {
if (!(*it)->isInternal()) {
if (!isWaterway((*it)->getPermissions())) {
Expand All @@ -74,6 +75,9 @@ GUIJunctionWrapper::GUIJunctionWrapper(MSJunction& junction, const std::string&
if (!isRailway((*it)->getPermissions())) {
myAmRailway = false;
}
if (!isAirway((*it)->getPermissions())) {
myAmAirway = false;
}
}
}
for (auto it = myJunction.getOutgoing().begin(); it != myJunction.getOutgoing().end() && (myAmWaterway || myAmRailway); ++it) {
Expand All @@ -84,6 +88,9 @@ GUIJunctionWrapper::GUIJunctionWrapper(MSJunction& junction, const std::string&
if (!isRailway((*it)->getPermissions())) {
myAmRailway = false;
}
if (!isAirway((*it)->getPermissions())) {
myAmAirway = false;
}
}
}
myTesselation.getShapeRef().closePolygon();
Expand Down Expand Up @@ -213,6 +220,8 @@ GUIJunctionWrapper::getColorValue(const GUIVisualizationSettings& /* s */, int a
return 1;
} else if (myAmRailway && MSNet::getInstance()->hasInternalLinks()) {
return 2;
} else if (myAmAirway) {
return 3;
} else {
return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/guisim/GUIJunctionWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class GUIJunctionWrapper : public GUIGlObject {
bool myAmWaterway;
/// @brief whether this junction has only railways as incoming and outgoing edges
bool myAmRailway;
/// @brief whether this junction has only airways as incoming and outgoing edges
bool myAmAirway;

/// @brief the associated traffic light or ""
const std::string myTLLID;
Expand Down
2 changes: 1 addition & 1 deletion src/guisim/GUILane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ GUILane::drawGL(const GUIVisualizationSettings& s) const {
// (this avoids artifacts at geometry corners without having to
// compute lane-marking intersection points)
double halfWidth = isInternal ? myQuarterLaneWidth : (myHalfLaneWidth - SUMO_const_laneMarkWidth / 2);
mustDrawMarkings = !isInternal && myPermissions != 0 && myPermissions != SVC_PEDESTRIAN && exaggeration == 1.0 && !isWaterway(myPermissions);
mustDrawMarkings = !isInternal && myPermissions != 0 && myPermissions != SVC_PEDESTRIAN && exaggeration == 1.0 && !isWaterway(myPermissions) && !isAirway(myPermissions);
const int cornerDetail = drawDetails && !isInternal ? (int)(s.scale * exaggeration) : 0;
double offset = halfWidth * MAX2(0., (exaggeration - 1)) * (MSGlobals::gLefthand ? -1 : 1);
if (spreadSuperposed) {
Expand Down
4 changes: 4 additions & 0 deletions src/utils/common/SUMOVehicleClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ isWaterway(SVCPermissions permissions) {
return permissions == SVC_SHIP;
}

bool
isAirway(SVCPermissions permissions) {
return permissions == SVC_AIRCRAFT || permissions == SVC_DRONE;
}

bool
isForbidden(SVCPermissions permissions) {
Expand Down
6 changes: 6 additions & 0 deletions src/utils/common/SUMOVehicleClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,12 @@ extern bool isBikepath(SVCPermissions permissions);
*/
extern bool isWaterway(SVCPermissions permissions);

/** @brief Returns whether an edge with the given permission 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
* @param[in] permissions The permissions of the edge
* @return Whether the edge is forbidden
Expand Down
1 change: 1 addition & 0 deletions src/utils/gui/settings/GUIVisualizationSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ GUIVisualizationSettings::initSumoGuiDefaults() {
scheme = GUIColorScheme("uniform", TL("uniform"), RGBColor::BLACK, "", true);
scheme.addColor(RGBColor(150, 200, 200), 1, TL("waterway"));
scheme.addColor(RGBColor(0, 0, 0, 0), 2, TL("railway"));
scheme.addColor(RGBColor(200, 240, 240), 3, TL("airway"));
junctionColorer.addScheme(scheme);
scheme = GUIColorScheme(SCHEME_NAME_SELECTION, RGBColor(128, 128, 128, 255), TL("unselected"), true, 0, COL_SCHEME_MISC);
scheme.addColor(RGBColor(0, 80, 180, 255), 1, TL("selected"));
Expand Down

0 comments on commit 4ad79ae

Please sign in to comment.