Skip to content

Commit

Permalink
Updated GNELane and GNEEdge. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 5a2e2b9 commit dfedc84
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/netedit/elements/GNEContour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ GNEContour::buildDottedContourExtruded(const GUIVisualizationSettings& s, const
myDottedGeometries->at(0) = GUIDottedGeometry(s, shape, false, true);
myDottedGeometries->at(2) = GUIDottedGeometry(s, shape.reverse(), false, true);
// move geometries top and bot
myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) - offset);
myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) + offset);
myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
// create left and right geometries
if (drawFirstExtrem) {
Expand Down Expand Up @@ -291,8 +291,8 @@ GNEContour::buildDottedContourEdge(const GUIVisualizationSettings& s, const GNEE
myDottedGeometries->at(0) = GUIDottedGeometry(s, topLane->getLaneGeometry().getShape(), false, true);
myDottedGeometries->at(2) = GUIDottedGeometry(s, botLane->getLaneGeometry().getShape().reverse(), false, true);
// move geometries top and bot
myDottedGeometries->at(0).moveShapeToSide(topLane->getDrawingConstants()->getDrawingWidth() * topLane->getDrawingConstants()->getExaggeration() * -1);
myDottedGeometries->at(2).moveShapeToSide(botLane->getDrawingConstants()->getDrawingWidth() * botLane->getDrawingConstants()->getExaggeration() * -1);
myDottedGeometries->at(0).moveShapeToSide((topLane->getDrawingConstants()->getDrawingWidth() * -1) + topLane->getDrawingConstants()->getOffset());
myDottedGeometries->at(2).moveShapeToSide((botLane->getDrawingConstants()->getDrawingWidth() * -1) - botLane->getDrawingConstants()->getOffset());
// create left and right geometries
if (drawFirstExtrem) {
myDottedGeometries->at(3) = GUIDottedGeometry(s, {
Expand Down
15 changes: 9 additions & 6 deletions src/netedit/elements/network/GNELane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,17 @@ GNELane::DrawingConstants::update(const GUIVisualizationSettings& s) {
// draw as railway: assume standard gauge of 1435mm when lane width is not set
myDrawingWidth = (laneWidth == SUMO_const_laneWidth ? 1.4350 : laneWidth) * myExaggeration;
// calculate internal drawing width
myInternalDrawingWidth = myDrawingWidth * 0.6;
myInternalDrawingWidth = myDrawingWidth * 0.8;
} else {
// calculate exaggerated drawing width
myDrawingWidth = laneWidth * myExaggeration * 0.5;
// calculate internal drawing width
myInternalDrawingWidth = myDrawingWidth - (2 * SUMO_const_laneMarkWidth);
}
// check if draw superposed
myDrawSuperposed = (s.spreadSuperposed && myLane->getParentEdge()->getNBEdge()->isBidiRail());
if (myDrawAsRailway || myDrawSuperposed) {
myDrawSuperposed = myDrawAsRailway || (s.spreadSuperposed && myLane->getParentEdge()->getNBEdge()->isBidiRail());
// adjust parameters depending of superposing
if (myDrawSuperposed) {
// apply offset
myOffset = myDrawingWidth * 0.5;
// reduce width
Expand Down Expand Up @@ -524,7 +525,7 @@ GNELane::drawTLSLinkNo(const GUIVisualizationSettings& s) const {


void
GNELane::drawLaneArrows(const GUIVisualizationSettings& s) const {
GNELane::drawArrows(const GUIVisualizationSettings& s) const {
if (s.showLinkDecals && myParentEdge->getToJunction()->isLogicValid()) {
// calculate begin, end and rotation
const Position& begin = myLaneGeometry.getShape()[-2];
Expand All @@ -546,8 +547,10 @@ GNELane::drawLaneArrows(const GUIVisualizationSettings& s) const {
glRotated(rot, 0, 0, 1);
const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
if (width < SUMO_const_laneWidth) {
glScaled(width / SUMO_const_laneWidth, 1, 1);
glScaled(myDrawingConstants->getDrawingWidth() / SUMO_const_laneWidth, 1, 1);
}
// apply offset
glTranslated(myDrawingConstants->getOffset(), 0, 0);
// get destiny node
const NBNode* dest = myParentEdge->getNBEdge()->myTo;
// draw all links iterating over connections
Expand Down Expand Up @@ -1340,7 +1343,7 @@ GNELane::drawLane(const GUIVisualizationSettings& s) const {
// draw lane textures
drawTextures(s);
// draw lane arrows
drawLaneArrows(s);
drawArrows(s);
// draw link numbers
drawLinkNo(s);
// draw TLS link numbers
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/network/GNELane.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class GNELane : public GNENetworkElement, public GNECandidateElement, public FXD
void drawTLSLinkNo(const GUIVisualizationSettings& s) const;

/// @brief draw lane arrows
void drawLaneArrows(const GUIVisualizationSettings& s) const;
void drawArrows(const GUIVisualizationSettings& s) const;

/// @brief draw lane to lane connections
void drawLane2LaneConnections() const;
Expand Down
14 changes: 7 additions & 7 deletions src/utils/gui/div/GLHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,9 +871,9 @@ GLHelper::drawCrossTies(const PositionVector& geom, const std::vector<double>& r
for (double t = 0; t < lengths[i]; t += spacing) {
glBegin(GL_QUADS);
glVertex2d(-halfWidth - offset, -t);
glVertex2d(-halfWidth- offset, -t - length);
glVertex2d(halfWidth- offset, -t - length);
glVertex2d(halfWidth- offset, -t);
glVertex2d(-halfWidth - offset, -t - length);
glVertex2d( halfWidth - offset, -t - length);
glVertex2d( halfWidth - offset, -t);
glEnd();
#ifdef CHECK_ELEMENTCOUNTER
myVertexCounter += 4;
Expand All @@ -882,10 +882,10 @@ GLHelper::drawCrossTies(const PositionVector& geom, const std::vector<double>& r
} else {
// only draw a single rectangle if it's being drawn only for selecting
glBegin(GL_QUADS);
glVertex2d(-halfWidth- offset, 0);
glVertex2d(-halfWidth- offset, -lengths.back());
glVertex2d(halfWidth- offset, -lengths.back());
glVertex2d(halfWidth- offset, 0);
glVertex2d(-halfWidth - offset, 0);
glVertex2d(-halfWidth - offset, -lengths.back());
glVertex2d( halfWidth - offset, -lengths.back());
glVertex2d( halfWidth - offset, 0);
glEnd();
#ifdef CHECK_ELEMENTCOUNTER
myVertexCounter += 4;
Expand Down

0 comments on commit dfedc84

Please sign in to comment.