Skip to content

Commit

Permalink
Updated GNEJunction. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 751a679 commit 4bace3f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 32 deletions.
40 changes: 16 additions & 24 deletions src/netedit/elements/network/GNEJunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,10 @@ GNEJunction::GNEJunction(GNENet* net, NBNode* nbn, bool loaded) :
GNENetworkElement(net, nbn->getID(), GLO_JUNCTION, SUMO_TAG_JUNCTION,
GUIIconSubSys::getIcon(GUIIcon::JUNCTION), {}, {}, {}, {}, {}, {}),
myNBNode(nbn),
myJunctionInGrid(true),
myAmCreateEdgeSource(false),
myCircleContour(this),
myLogicStatus(loaded ? FEATURE_LOADED : FEATURE_GUESSED),
myAmResponsible(false),
myHasValidLogic(loaded),
myAmTLSSelected(false),
myColorForMissingConnections(false),
myTesselation(nbn->getID(), "", RGBColor::MAGENTA, nbn->getShape(), false, true, 0),
myExaggeration(1) {
myTesselation(nbn->getID(), "", RGBColor::MAGENTA, nbn->getShape(), false, true, 0) {
// update centering boundary without updating grid
updateCenteringBoundary(false);
}
Expand Down Expand Up @@ -664,19 +659,13 @@ GNEJunction::drawGL(const GUIVisualizationSettings& s) const {
}
// draw Junction childs
drawJunctionChildren(s, d);
// draw path additional elements
myNet->getPathManager()->drawJunctionPathElements(s, d, this);
// continue depending of shapes
if (junctionShape) {
// draw dotted contour
if (myNBNode->getShape().area() > 1) {
myContour.drawDottedContourClosed(s, d, myNBNode->getShape(), junctionExaggeration, true, s.dottedContourSettings.segmentWidth);
}
// draw dotted contour depending of shapes
if (junctionShape && (myNBNode->getShape().area() > 1)) {
myContour.drawDottedContourClosed(s, d, myNBNode->getShape(), junctionExaggeration, true, s.dottedContourSettings.segmentWidth);
}
if (junctionBubble) {
// draw dotted contour
myContour.drawDottedContourCircle(s, d, myNBNode->getCenter(), s.neteditSizeSettings.junctionBubbleRadius, junctionExaggeration,
s.dottedContourSettings.segmentWidth);
myCircleContour.drawDottedContourCircle(s, d, myNBNode->getCenter(), s.neteditSizeSettings.junctionBubbleRadius, junctionExaggeration,
s.dottedContourSettings.segmentWidth);
}
}
}
Expand Down Expand Up @@ -1652,14 +1641,9 @@ GNEJunction::drawJunctionAsShape(const GUIVisualizationSettings& s, const GUIVis
if (d <= GUIVisualizationSettings::Detail::DrawPolygonTesselation) {
// draw shape with high detail
myTesselation.drawTesselation(myTesselation.getShape());
} else if (d <= GUIVisualizationSettings::Detail::DrawPolygon) {
} else {
// draw shape
GLHelper::drawFilledPoly(myNBNode->getShape(), true);
} else if ((d <= GUIVisualizationSettings::Detail::DrawPolygonBoundary)){
// get shape boundary
const auto boundary = myNBNode->getShape().getBoxBoundary();
// draw rectangle
GLHelper::drawRectangle(myNBNode->getCenter(), boundary.getWidth(), boundary.getHeight());
}
// draw shape points only in Network supermode
if (myShapeEdited && myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
Expand Down Expand Up @@ -1733,13 +1717,15 @@ GNEJunction::drawJunctionChildren(const GUIVisualizationSettings& s, const GUIVi
for (const auto& crossing : myGNECrossings) {
crossing->drawGL(s);
}
// draw walking areas
for (const auto& walkingArea : myGNEWalkingAreas) {
walkingArea->drawGL(s);
}
// draw internalLanes
for (const auto& internalLanes : myInternalLanes) {
internalLanes->drawGL(s);
}
// draw connections
for (const auto& incomingEdge : myGNEIncomingEdges) {
for (const auto& connection : incomingEdge->getGNEConnections()) {
connection->drawGL(s);
Expand All @@ -1749,6 +1735,12 @@ GNEJunction::drawJunctionChildren(const GUIVisualizationSettings& s, const GUIVi
for (const auto& demandElement : getChildDemandElements()) {
demandElement->drawGL(s);
}
// draw child demand elements
for (const auto& demandElement : getChildDemandElements()) {
demandElement->drawGL(s);
}
// draw path additional elements
myNet->getPathManager()->drawJunctionPathElements(s, d, this);
}
}

Expand Down
15 changes: 9 additions & 6 deletions src/netedit/elements/network/GNEJunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ class GNEJunction : public GNENetworkElement, public GNECandidateElement {
Boundary myJunctionBoundary;

/// @brief flag for check if junction is currently in grid
bool myJunctionInGrid;
bool myJunctionInGrid = true;

/// @brief variable used for draw circle contours
GNEContour myCircleContour;

/// @brief vector with the (child) incomings GNEEdges vinculated with this junction
std::vector<GNEEdge*> myGNEIncomingEdges;
Expand All @@ -322,28 +325,28 @@ class GNEJunction : public GNENetworkElement, public GNECandidateElement {

/// @brief whether this junction is the first junction for a newly creatededge
/// @see GNEApplicationWindow::createEdgeSource)
bool myAmCreateEdgeSource;
bool myAmCreateEdgeSource = false;

/// @brief modification status of the junction logic (all connections across this junction)
std::string myLogicStatus;

/// @brief whether we are responsible for deleting myNBNode
bool myAmResponsible;
bool myAmResponsible = false;

/// @brief whether this junctions logic is valid
bool myHasValidLogic;

/// @brief whether this junction is selected in tls-mode
bool myAmTLSSelected;
bool myAmTLSSelected = false;

/// @brief whether this junction probably should have some connections but doesn't
bool myColorForMissingConnections;
bool myColorForMissingConnections = false;

/// @brief An object that stores the shape and its tesselation
mutable TesselatedPolygon myTesselation;

/// @brief exaggeration used in tesselation
mutable double myExaggeration;
mutable double myExaggeration = 1;

private:
/// @brief check if draw junction as bubble
Expand Down
2 changes: 0 additions & 2 deletions src/utils/gui/settings/GUIVisualizationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ class GUIVisualizationSettings {

Level1 = 1, // circle resolution = 8, polygons, no lane details
CircleResolution16 = 1,
DrawPolygon = 1,
VehicleBox = 1,
AdditionalDetails = 1, // stoppingPlace signs, EntryExit arrows...
GeometryPoint = 1,
Expand All @@ -573,7 +572,6 @@ class GUIVisualizationSettings {

Level4 = 4,
LaneSimpleOnlyFirst = 4,
DrawPolygonBoundary = 4,
};

/// @brief constructor
Expand Down

0 comments on commit 4bace3f

Please sign in to comment.