@@ -72,21 +72,51 @@ GNEConnection::updateGeometry() {
72
72
// Get shape of from and to lanes
73
73
const NBEdge::Connection& nbCon = getNBEdgeConnection ();
74
74
// obtain lane shapes
75
- const auto & laneShapeFrom = getParentLanes ().front ()->getLaneShape ();
76
- const auto & laneShapeTo = getParentLanes ().back ()->getLaneShape ();
75
+ PositionVector laneShapeFrom = getParentLanes ().front ()->getLaneShape ();
76
+ PositionVector laneShapeTo = getParentLanes ().back ()->getLaneShape ();
77
77
// Calculate shape of connection depending of the size of Junction shape
78
78
if (nbCon.customShape .size () > 0 ) {
79
79
myConnectionGeometry.updateGeometry (nbCon.customShape );
80
80
} else if (nbCon.shape .size () > 1 ) {
81
81
PositionVector connectionShape;
82
82
if ((nbCon.shape .length () < 3 ) && !nbCon.haveVia ) {
83
+ // apply offset to lane shape if we're in lane spread function center
84
+ if (getParentLanes ().front ()->getParentEdge ()->getNBEdge ()->getLaneSpreadFunction () == LaneSpreadFunction::CENTER) {
85
+ laneShapeFrom.move2side (0.3 );
86
+ }
87
+ if (getParentLanes ().back ()->getParentEdge ()->getNBEdge ()->getLaneSpreadFunction () == LaneSpreadFunction::CENTER) {
88
+ laneShapeTo.move2side (0.3 );
89
+ }
90
+ // check if this connetion is a turn around
91
+ bool turnAround = false ;
92
+ const auto fromOppositeEdges = getParentLanes ().front ()->getParentEdge ()->getOppositeEdges ();
93
+ for (const auto & edge : fromOppositeEdges) {
94
+ if (edge == getParentLanes ().back ()->getParentEdge ()) {
95
+ turnAround = true ;
96
+ break ;
97
+ }
98
+ }
99
+ // add from lane shape one step before
83
100
if (laneShapeFrom.length () > 1 ) {
84
- connectionShape.push_back (laneShapeFrom.positionAtOffset (laneShapeFrom.length () - 1 ));
101
+ // set lenght depending of turn arounds
102
+ if (turnAround) {
103
+ connectionShape.push_back (laneShapeFrom.positionAtOffset (laneShapeFrom.length () - 0.5 ));
104
+ } else {
105
+ connectionShape.push_back (laneShapeFrom.positionAtOffset (laneShapeFrom.length () - 1 ));
106
+ }
85
107
}
108
+ // add from lane shape
86
109
connectionShape.push_back (laneShapeFrom.back ());
110
+ // add to lane shape
87
111
connectionShape.push_back (laneShapeTo.front ());
112
+ // add to lane shape one step after
88
113
if (laneShapeTo.length () > 1 ) {
89
- connectionShape.push_back (laneShapeTo.positionAtOffset (1 ));
114
+ // set lenght depending of turn arounds
115
+ if (turnAround) {
116
+ connectionShape.push_back (laneShapeTo.positionAtOffset (0.5 ));
117
+ } else {
118
+ connectionShape.push_back (laneShapeTo.positionAtOffset (1 ));
119
+ }
90
120
}
91
121
} else {
92
122
connectionShape = nbCon.shape ;
@@ -711,6 +741,10 @@ GNEConnection::drawConnection(const GUIVisualizationSettings& s, const GUIVisual
711
741
RGBColor connectionColor = getConnectionColor (s);
712
742
// Push layer matrix
713
743
GLHelper::pushMatrix ();
744
+ // move top if is selected
745
+ if (mySelected) {
746
+ glTranslated (0 , 0 , 0.2 );
747
+ }
714
748
// translate to front
715
749
if (myNet->getViewNet ()->getEditNetworkElementShapes ().getEditedNetworkElement () == this ) {
716
750
drawInLayer (GLO_CONNECTION, 200 );
@@ -760,9 +794,9 @@ GNEConnection::drawConnectionArrows(const GUIVisualizationSettings& s, const GUI
760
794
GLHelper::setColor (color.changedBrightness (51 ));
761
795
// draw triangles
762
796
for (int i = 1 ; i < (int )superposedGeometry.getShape ().size (); i++) {
763
- const auto posA = superposedGeometry.getShape ()[i - 1 ];
764
- const auto posB = superposedGeometry.getShape ()[i];
765
- GLHelper::drawTriangleAtEnd (posA, posB, (double ) 1 , (double ) .2 );
797
+ const auto & posA = superposedGeometry.getShape ()[i - 1 ];
798
+ const auto & posB = superposedGeometry.getShape ()[i];
799
+ GLHelper::drawTriangleAtEnd (posA, posB, (double ) . 2 , (double ) .1 );
766
800
}
767
801
// Pop matrix
768
802
GLHelper::popMatrix ();
0 commit comments