Eclipse SUMO - Simulation of Urban MObility
GNELane.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A class for visualizing Lane geometry (adapted from GNELaneWrapper)
19/****************************************************************************/
20#include <config.h>
21
22#include <netedit/GNENet.h>
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
32#include <netbuild/NBEdgeCont.h>
40
41#include "GNELane.h"
42#include "GNEInternalLane.h"
43#include "GNEConnection.h"
44#include "GNEEdgeTemplate.h"
45
46// ===========================================================================
47// FOX callback mapping
48// ===========================================================================
49
50// Object implementation
51FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
52
53// ===========================================================================
54// method definitions
55// ===========================================================================
56
57// ---------------------------------------------------------------------------
58// GNELane::LaneDrawingConstants - methods
59// ---------------------------------------------------------------------------
60
62 selectionScale(lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectorFrameScale : 1),
63 exaggeration(selectionScale * s.laneWidthExaggeration),
64 halfWidth2(exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2)),
65 halfWidth(lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2) {
66 // start drawing lane checking whether it is not too small
67 //selectionScale = lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectionScale : 1;
68 //exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
69 // compute lane-marking intersection points)
70 //halfWidth2 = exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2);
71
72 // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen
73 //halfWidth = lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2;
74}
75
76
78 selectionScale(0),
79 exaggeration(0),
80 halfWidth2(0),
81 halfWidth(0) {
82}
83
84// ---------------------------------------------------------------------------
85// GNELane - methods
86// ---------------------------------------------------------------------------
87
88#ifdef _MSC_VER
89#pragma warning(push)
90/* Disable warning about using "this" in the constructor */
91#pragma warning(disable: 4355)
92#endif
93GNELane::GNELane(GNEEdge* edge, const int index) :
94 GNENetworkElement(edge->getNet(), edge->getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE,
95 GUIIconSubSys::getIcon(GUIIcon::LANE), {}, {}, {}, {}, {}, {}),
96 myParentEdge(edge),
97 myIndex(index),
98 mySpecialColor(nullptr),
99 mySpecialColorValue(-1),
100myLane2laneConnections(this) {
101 // update centering boundary without updating grid
102 updateCenteringBoundary(false);
103}
104
105
107 GNENetworkElement(nullptr, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE,
108 GUIIconSubSys::getIcon(GUIIcon::LANE), {}, {}, {}, {}, {}, {}),
109myParentEdge(nullptr),
110myIndex(-1),
111mySpecialColor(nullptr),
112mySpecialColorValue(-1),
113myLane2laneConnections(this) {
114}
115#ifdef _MSC_VER
116#pragma warning(pop)
117#endif
118
119
121
122
123GNEEdge*
125 return myParentEdge;
126}
127
128
129bool
132}
133
134
135const GUIGeometry&
137 return myLaneGeometry;
138}
139
140
141const PositionVector&
145 } else {
147 }
148}
149
150
151const std::vector<double>&
154}
155
156
157const std::vector<double>&
160}
161
162
163void
165 // Clear texture containers
168 // get lane shape and extend if is too short
169 auto laneShape = getLaneShape();
170 if (laneShape.length2D() < 1) {
171 laneShape.extrapolate2D(1 - laneShape.length2D());
172 }
173 // Obtain lane shape of NBEdge
175 // update connections
177 // update additionals children associated with this lane
178 for (const auto& additional : getParentAdditionals()) {
179 additional->updateGeometry();
180 }
181 // update additionals parents associated with this lane
182 for (const auto& additional : getChildAdditionals()) {
183 additional->updateGeometry();
184 }
185 // update partial demand elements parents associated with this lane
186 for (const auto& demandElement : getParentDemandElements()) {
187 demandElement->updateGeometry();
188 }
189 // update partial demand elements children associated with this lane
190 for (const auto& demandElement : getChildDemandElements()) {
191 demandElement->updateGeometry();
192 }
193 // Update geometry of parent generic datas that have this edge as parent
194 for (const auto& additionalParent : getParentGenericDatas()) {
195 additionalParent->updateGeometry();
196 }
197 // Update geometry of additionals generic datas vinculated to this edge
198 for (const auto& childAdditionals : getChildGenericDatas()) {
199 childAdditionals->updateGeometry();
200 }
201 // compute geometry of path elements elements vinculated with this lane (depending of showDemandElements)
203 for (const auto& childAdditional : getChildAdditionals()) {
204 childAdditional->computePathElement();
205 }
206 for (const auto& childDemandElement : getChildDemandElements()) {
207 childDemandElement->computePathElement();
208 }
209 for (const auto& childGenericData : getChildGenericDatas()) {
210 childGenericData->computePathElement();
211 }
212 }
213 // in Move mode, connections aren't updated
215 // Update incoming connections of this lane
216 const auto incomingConnections = getGNEIncomingConnections();
217 for (const auto& connection : incomingConnections) {
218 connection->updateGeometry();
219 }
220 // Update outgoings connections of this lane
221 const auto outGoingConnections = getGNEOutcomingConnections();
222 for (const auto& connection : outGoingConnections) {
223 connection->updateGeometry();
224 }
225 }
226 // if lane has enought length for show textures of restricted lanes
227 if ((getLaneShapeLength() > 4)) {
228 // if lane is restricted
230 // get values for position and rotation of icons
231 for (int i = 2; i < getLaneShapeLength() - 1; i += 15) {
234 }
235 }
236 }
237}
238
239
242 return getLaneShape().positionAtOffset2D(getLaneShape().length2D() * 0.5);
243}
244
245
248 // edit depending if shape is being edited
249 if (isShapeEdited()) {
250 // calculate move shape operation
253 } else {
254 return nullptr;
255 }
256}
257
258
259void
260GNELane::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
261 // edit depending if shape is being edited
262 if (isShapeEdited()) {
263 // get original shape
265 // check shape size
266 if (shape.size() > 2) {
267 // obtain index
268 int index = shape.indexOfClosest(clickedPosition);
269 // get snap radius
271 // check if we have to create a new index
272 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
273 // remove geometry point
274 shape.erase(shape.begin() + index);
275 // commit new shape
276 undoList->begin(GUIIcon::CROSSING, "remove geometry point of " + getTagStr());
278 undoList->end();
279 }
280 }
281 }
282}
283
284
285void
287 // first check that drawLinkJunctionIndex must be drawn
289 // get connections
290 const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
291 // get number of links
292 const int noLinks = (int)cons.size();
293 // only continue if there is links
294 if (noLinks > 0) {
295 // push link matrix
297 // move front
298 glTranslated(0, 0, GLO_TEXTNAME);
299 // calculate width
300 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
301 // get X1
302 double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
303 // iterate over links
304 for (int i = noLinks; --i >= 0;) {
305 // calculate x2
306 const double x2 = x1 - (double)(width / 2.);
307 // get link index
309 cons[s.lefthand ? noLinks - 1 - i : i]);
310 // draw link index
312 // update x1
313 x1 -= width;
314 }
315 // pop link matrix
317 }
318 }
319}
320
321
322void
324 // first check that drawLinkTLIndex must be drawn
326 // get connections
327 const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
328 // get numer of links
329 const int noLinks = (int)cons.size();
330 // only continue if there are links
331 if (noLinks > 0) {
332 // push link matrix
334 // move t front
335 glTranslated(0, 0, GLO_TEXTNAME);
336 // calculate width
337 const double w = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
338 // calculate x1
339 double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
340 // iterate over links
341 for (int i = noLinks; --i >= 0;) {
342 // calculate x2
343 const double x2 = x1 - (double)(w / 2.);
344 // get link number
345 const int linkNo = cons[s.lefthand ? noLinks - 1 - i : i].tlLinkIndex;
346 // draw link number
348 // update x1
349 x1 -= w;
350 }
351 // pop link matrix
353 }
354 }
355}
356
357
358void
360 // currently unused
361}
362
363
364void
365GNELane::drawArrows(const GUIVisualizationSettings& s, const bool spreadSuperposed) const {
367 // calculate begin, end and rotation
368 const Position& begin = myLaneGeometry.getShape()[-2];
369 const Position& end = myLaneGeometry.getShape().back();
370 const double rot = GUIGeometry::calculateRotation(begin, end);
371 // push arrow matrix
373 // move front (note: must draw on top of junction shape?
374 glTranslated(0, 0, 0.5);
375 // change color depending of spreadSuperposed
376 if (spreadSuperposed) {
378 } else {
380 }
381 // move to end
382 glTranslated(end.x(), end.y(), 0);
383 // rotate
384 glRotated(rot, 0, 0, 1);
385 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
386 if (width < SUMO_const_laneWidth) {
387 glScaled(width / SUMO_const_laneWidth, 1, 1);
388 }
389 // get destiny node
390 const NBNode* dest = myParentEdge->getNBEdge()->myTo;
391 // draw all links iterating over connections
392 for (const auto& connection : myParentEdge->getNBEdge()->myConnections) {
393 if (connection.fromLane == myIndex) {
394 // get link direction
395 LinkDirection dir = dest->getDirection(myParentEdge->getNBEdge(), connection.toEdge, s.lefthand);
396 // draw depending of link direction
397 switch (dir) {
399 GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
400 GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
401 break;
403 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
404 GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
405 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
406 break;
408 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
409 GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
410 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
411 break;
413 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
414 GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
415 GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
416 GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
417 break;
419 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
420 GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
421 GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
422 GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
423 break;
425 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
426 GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
427 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
428 break;
430 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
431 GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
432 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
433 break;
435 GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
436 GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
437 glTranslated(0, 5, 0);
438 GLHelper::drawOutlineCircle(0.9, 0.8, 32);
439 glTranslated(0, -5, 0);
440 break;
441 }
442 }
443 }
444 // pop arrow matrix
446 }
447}
448
449
450void
453 glTranslated(0, 0, 0.1); // must draw on top of junction shape
454 std::vector<NBEdge::Connection> connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
456 const Position& startPos = myLaneGeometry.getShape()[-1];
457 for (auto it : connections) {
458 const LinkState state = node->getLinkState(myParentEdge->getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
459 switch (state) {
461 glColor3d(1, 1, 0);
462 break;
464 glColor3d(0, 1, 1);
465 break;
466 case LINKSTATE_MAJOR:
467 glColor3d(1, 1, 1);
468 break;
469 case LINKSTATE_MINOR:
470 glColor3d(.4, .4, .4);
471 break;
472 case LINKSTATE_STOP:
473 glColor3d(.7, .4, .4);
474 break;
475 case LINKSTATE_EQUAL:
476 glColor3d(.7, .7, .7);
477 break;
479 glColor3d(.7, .7, 1);
480 break;
481 case LINKSTATE_ZIPPER:
482 glColor3d(.75, .5, 0.25);
483 break;
484 default:
485 throw ProcessError("Unexpected LinkState '" + toString(state) + "'");
486 }
487 const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
488 glBegin(GL_LINES);
489 glVertex2d(startPos.x(), startPos.y());
490 glVertex2d(endPos.x(), endPos.y());
491 glEnd();
492 GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
493 }
495}
496
497
498void
500 // get lane drawing constants
501 LaneDrawingConstants laneDrawingConstants(s, this);
502 // get lane color
503 const RGBColor color = setLaneColor(s);
504 // get flag for draw lane as railway
505 const bool drawRailway = drawAsRailway(s);
506 // we draw the lanes with reduced width so that the lane markings below are visible (this avoids artifacts at geometry corners without having to)
507 const bool spreadSuperposed = s.spreadSuperposed && drawRailway && myParentEdge->getNBEdge()->isBidiRail();
508 // Push edge parent name
510 // Push lane name
512 // Push layer matrix
514 // translate to front (note: Special case)
516 glTranslated(0, 0, GLO_DOTTEDCONTOUR_FRONT);
519 } else {
521 }
522 // recognize full transparency and simply don't draw
523 if ((color.alpha() == 0) || ((s.scale * laneDrawingConstants.exaggeration) < s.laneMinSize)) {
524 // Pop draw matrix 1
526 // Pop Lane Name
528 } else {
529 if ((s.scale * laneDrawingConstants.exaggeration) < 1.) {
530 // draw lane as line, depending of myShapeColors
531 if (myShapeColors.size() > 0) {
533 } else {
535 }
536 } else {
537 // Check if lane has to be draw as railway and if isn't being drawn for selecting
538 if (drawRailway && (!s.drawForRectangleSelection || spreadSuperposed)) {
539 // draw as railway
540 drawLaneAsRailway(s, laneDrawingConstants);
541 } else {
542 double offset = 0;
543 double widthFactor = 1;
544 if (s.spreadSuperposed && myParentEdge->getNBEdge()->getBidiEdge() != nullptr) {
545 widthFactor = 0.4; // create visible gap
546 offset = laneDrawingConstants.halfWidth * 0.5;
547 }
548 // draw as box lines
550 }
551 if (laneDrawingConstants.halfWidth != laneDrawingConstants.halfWidth2 && !spreadSuperposed) {
552 // Push matrix
554 // move back
555 glTranslated(0, 0, -0.1);
556 // set selected edge color
558 // draw again to show the selected edge
560 // Pop matrix
562 }
563 // only draw details depending of the scale and if isn't being drawn for selecting
564 if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
565 // draw markings
566 drawMarkings(s, laneDrawingConstants.exaggeration, drawRailway);
567 // Draw direction indicators
568 drawDirectionIndicators(s, laneDrawingConstants.exaggeration, drawRailway, spreadSuperposed);
569 }
570 // draw lane textures
571 drawTextures(s, laneDrawingConstants);
572 // draw start end shape points
574 // draw edge geometry points
576 }
577 // draw stopOffsets
578 const auto& laneStopOffset = myParentEdge->getNBEdge()->getLaneStruct(myIndex).laneStopOffset;
579 if (laneStopOffset.isDefined() && (laneStopOffset.getPermissions() & SVC_PASSENGER) != 0) {
580 drawLaneStopOffset(s, laneStopOffset.getOffset());
581 }
582 // Pop layer matrix
584 // only draw details depending of the scale and if isn't being drawn for selecting
585 if (((s.scale * laneDrawingConstants.exaggeration) >= 1.) && (s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
586 // Push layer matrix
588 // translate to front (note: Special case)
590 glTranslated(0, 0, GLO_DOTTEDCONTOUR_FRONT);
591 } else {
593 }
594 // draw arrows
595 drawArrows(s, spreadSuperposed);
596 // Pop layer matrix
598 }
599
600 // if shape is being edited, draw point and green line
601 if (myShapeEdited) {
602 // push shape edited matrix
604 // translate
606 // set selected edge color
608 // draw again to show the selected edge
610 // move front
611 glTranslated(0, 0, 1);
612 // color
613 const RGBColor darkerColor = s.colorSettings.editShapeColor.changedBrightness(-32);
614 // draw geometry points
617 // Pop shape edited matrix
619 }
620 // Pop lane Name
622 // Pop edge Name
624 // only draw links number depending of the scale and if isn't being drawn for selecting
625 if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
626 // draw link number
627 drawLinkNo(s);
628 // draw TLS link number
629 drawTLSLinkNo(s);
630 }
631 // draw lock icon
633 // check if mark lane (and their parent edge)
634 if ((gPostDrawing.markedLane == nullptr) &&
636 // mark lane and their parent edge
639 }
640 // check if mouse is over element
641 if (myParentEdge->getLanes().size() == 1) {
642 mouseWithinGeometry(getLaneShape(), laneDrawingConstants.halfWidth);
647 } else {
648 mouseWithinGeometry(getLaneShape(), laneDrawingConstants.halfWidth);
649 }
650 // check if dotted contours has to be drawn
651 if (!drawRailway) {
652 // inspect contour
656 }
657 // front contour
658 if ((myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
661 }
662 // orange contour
666 }
667 // delete contour
668 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
670 }
671 // select contour
672 if (myNet->getViewNet()->drawSelectContour(this, this)) {
674 }
675 }
676 // draw children
677 drawChildren(s);
678 // draw path additional elements
680 }
681}
682
683
684void
686 // Check if edge can be deleted
688 myNet->deleteLane(this, myNet->getViewNet()->getUndoList(), false);
689 }
690}
691
692
693void
696}
697
698
699void
701 // draw child additional
702 for (const auto& additional : getChildAdditionals()) {
703 // check that ParkingAreas aren't draw two times
704 additional->drawGL(s);
705 }
706 // draw child demand elements
707 for (const auto& demandElement : getChildDemandElements()) {
708 if (!demandElement->getTagProperty().isPlacedInRTree()) {
709 demandElement->drawGL(s);
710 }
711 }
712}
713
714
715void
716GNELane::drawMarkings(const GUIVisualizationSettings& s, const double exaggeration, const bool drawRailway) const {
717 if (s.laneShowBorders && (exaggeration == 1) && !drawRailway) {
718 const double myHalfLaneWidth = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
720 glTranslated(0, 0, 0.1);
721 // optionally draw inverse markings
722 bool haveChangeProhibitions = false;
727 3, 6, myHalfLaneWidth, cl, cr, s.lefthand, exaggeration);
728 haveChangeProhibitions = !(cl && cr);
729 }
732 if (haveChangeProhibitions) {
733 // highlightchange prohibitions
734 glTranslated(0, 0, -0.05);
736 const double offset = myHalfLaneWidth * exaggeration * (s.lefthand ? -1 : 1);
737 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), myLaneGeometry, (myHalfLaneWidth * 0.5) * exaggeration, offset);
738 glTranslated(0, 0, +0.05);
739 }
740 // draw white boundings and white markings
741 glTranslated(0, 0, -0.1);
745 }
746}
747
748
751 // first obtain edit mode (needed because certain Commands depend of current edit mode)
753 // get mouse position
754 const auto mousePosition = myNet->getViewNet()->getPositionInformation();
755 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
756 buildPopupHeader(ret, app);
758 // build copy names entry
759 if (editMode != NetworkEditMode::NETWORK_TLS) {
760 GUIDesigns::buildFXMenuCommand(ret, "Copy parent edge name to clipboard", nullptr, ret, MID_COPY_EDGE_NAME);
762 }
763 // stop if we're in data mode
765 return ret;
766 }
767 // build lane selection
770 } else {
772 }
773 // build edge selection
776 } else {
778 }
779 // stop if we're in data mode
781 return ret;
782 }
783 // add separator
784 new FXMenuSeparator(ret);
785 if (editMode != NetworkEditMode::NETWORK_TLS) {
786 // build show parameters menu
788 // build position copy entry
789 buildPositionCopyEntry(ret, app);
790 }
791 // check if we're in supermode network
793 // create end point
794 FXMenuCommand* resetEndPoints = GUIDesigns::buildFXMenuCommand(ret, "Reset edge end points", nullptr, &parent, MID_GNE_RESET_GEOMETRYPOINT);
795 // enable or disable reset end points
797 resetEndPoints->enable();
798 } else {
799 resetEndPoints->disable();
800 }
801 // check if we clicked over a geometry point
802 if ((editMode == NetworkEditMode::NETWORK_MOVE) && myParentEdge->clickedOverGeometryPoint(mousePosition)) {
803 GUIDesigns::buildFXMenuCommand(ret, "Set custom Geometry Point", nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
804 }
805 // add separator
806 new FXMenuSeparator(ret);
807 //build operations
808 if ((editMode != NetworkEditMode::NETWORK_CONNECT) && (editMode != NetworkEditMode::NETWORK_TLS)) {
809 // build edge operations
810 buildEdgeOperations(parent, ret);
811 // build lane operations
812 buildLaneOperations(parent, ret);
813 // build template operations
814 buildTemplateOperations(parent, ret);
815 // add separator
816 new FXMenuSeparator(ret);
817 // build rechable operations
818 buildRechableOperations(parent, ret);
819 } else if (editMode == NetworkEditMode::NETWORK_TLS) {
821 GUIDesigns::buildFXMenuCommand(ret, "Select state for all links from this edge:", nullptr, nullptr, 0);
822 const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
823 for (auto it : names) {
824 FXuint state = GNEInternalLane::LinkStateNames.get(it);
825 FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
828 }
829 }
830 } else {
831 FXMenuCommand* mc = GUIDesigns::buildFXMenuCommand(ret, "Additional options available in 'Inspect Mode'", nullptr, nullptr, 0);
832 mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
833 }
834 // build shape positions menu
835 if (editMode != NetworkEditMode::NETWORK_TLS) {
836 new FXMenuSeparator(ret);
837 // get lane shape
838 const auto& laneShape = myLaneGeometry.getShape();
839 // get variables
840 const double pos = laneShape.nearest_offset_to_point2D(mousePosition);
841 const Position firstAnglePos = laneShape.positionAtOffset2D(pos - 0.001);
842 const Position secondAnglePos = laneShape.positionAtOffset2D(pos);
843 const double angle = firstAnglePos.angleTo2D(secondAnglePos);
844
845 // build menu commands
846 GUIDesigns::buildFXMenuCommand(ret, "Shape pos: " + toString(pos), nullptr, nullptr, 0);
847 GUIDesigns::buildFXMenuCommand(ret, "Length pos: " + toString(pos * getLaneParametricLength() / getLaneShapeLength()), nullptr, nullptr, 0);
848 if (myParentEdge->getNBEdge()->getDistance() != 0) {
849 GUIDesigns::buildFXMenuCommand(ret, "Distance: " + toString(myParentEdge->getNBEdge()->getDistancAt(pos)), nullptr, nullptr, 0);
850 }
851 GUIDesigns::buildFXMenuCommand(ret, "Height: " + toString(firstAnglePos.z()), nullptr, nullptr, 0);
852 GUIDesigns::buildFXMenuCommand(ret, "Angle: " + toString((GeomHelper::naviDegree(angle))), nullptr, nullptr, 0);
853 }
854 }
855 return ret;
856}
857
858
859double
861 return s.addSize.getExaggeration(s, this);
862}
863
864
865void
866GNELane::updateCenteringBoundary(const bool /*updateGrid*/) {
869 } else {
871 }
872}
873
874
875int
877 return myIndex;
878}
879
880void
882 myIndex = index;
884}
885
886
887double
890}
891
892
893double
895 double laneParametricLength = myParentEdge->getNBEdge()->getLoadedLength();
896 if (laneParametricLength > 0) {
897 return laneParametricLength;
898 } else {
899 throw ProcessError("Lane Parametric Length cannot be never 0");
900 }
901}
902
903
904double
906 return myLaneGeometry.getShape().length();
907}
908
909
910bool
912 return myParentEdge->getNBEdge()->getPermissions(myIndex) == vclass;
913}
914
915
919}
920
921
922std::string
924 const NBEdge* edge = myParentEdge->getNBEdge();
925 switch (key) {
926 case SUMO_ATTR_ID:
927 return getMicrosimID();
928 case SUMO_ATTR_SPEED:
929 return toString(edge->getLaneSpeed(myIndex));
930 case SUMO_ATTR_ALLOW:
938 case SUMO_ATTR_WIDTH:
940 return "default";
941 } else {
942 return toString(edge->getLaneStruct(myIndex).width);
943 }
945 return toString(edge->getLaneStruct(myIndex).friction);
954 case SUMO_ATTR_TYPE:
955 return edge->getLaneStruct(myIndex).type;
956 case SUMO_ATTR_INDEX:
957 return toString(myIndex);
963 } else {
964 return "";
965 }
966 case GNE_ATTR_PARENT:
967 return myParentEdge->getID();
972 default:
973 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
974 }
975}
976
977std::string
979 std::string result = getAttribute(key);
980 if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
981 result += " " + getVehicleClassNames(SVCAll, true);
982 }
983 return result;
984}
985
986
987void
988GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
989 switch (key) {
990 case SUMO_ATTR_ID:
991 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
992 case SUMO_ATTR_SPEED:
993 case SUMO_ATTR_ALLOW:
997 case SUMO_ATTR_WIDTH:
1002 case GNE_ATTR_OPPOSITE:
1003 case SUMO_ATTR_TYPE:
1004 case SUMO_ATTR_INDEX:
1007 case GNE_ATTR_SELECTED:
1009 // no special handling
1010 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
1011 break;
1012 default:
1013 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1014 }
1015}
1016
1017
1018bool
1019GNELane::isValid(SumoXMLAttr key, const std::string& value) {
1020 switch (key) {
1021 case SUMO_ATTR_ID:
1022 case SUMO_ATTR_INDEX:
1023 return false;
1024 case SUMO_ATTR_SPEED:
1025 return canParse<double>(value);
1026 case SUMO_ATTR_ALLOW:
1027 case SUMO_ATTR_DISALLOW:
1030 return canParseVehicleClasses(value);
1031 case SUMO_ATTR_WIDTH:
1032 if (value.empty() || (value == "default")) {
1033 return true;
1034 } else {
1035 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
1036 }
1037 case SUMO_ATTR_FRICTION:
1039 return canParse<double>(value) && (parse<double>(value) >= 0);
1041 return canParse<bool>(value);
1042 case SUMO_ATTR_CUSTOMSHAPE: {
1043 // A lane shape can either be empty or have more than 1 element
1044 if (value.empty()) {
1045 return true;
1046 } else if (canParse<PositionVector>(value)) {
1047 return parse<PositionVector>(value).size() > 1;
1048 }
1049 return false;
1050 }
1051 case GNE_ATTR_OPPOSITE: {
1052 if (value.empty()) {
1053 return true;
1054 } else {
1055 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
1056 if (oppEdge == nullptr || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != value) {
1057 return false;
1058 }
1059 NBEdge* edge = myParentEdge->getNBEdge();
1060 if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) {
1061 WRITE_WARNING("Opposite lane '" + value + "' does not connect the same nodes as edge '" + edge->getID() + "'!");
1062 return false;
1063 }
1064 return true;
1065 }
1066 }
1067 case SUMO_ATTR_TYPE:
1068 return true;
1070 return canParse<double>(value) && (parse<double>(value) >= 0);
1072 return canParseVehicleClasses(value);
1073 case GNE_ATTR_SELECTED:
1074 return canParse<bool>(value);
1077 default:
1078 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1079 }
1080}
1081
1082
1083bool
1085 switch (key) {
1086 case SUMO_ATTR_ID:
1087 case SUMO_ATTR_INDEX:
1088 return false;
1089 default:
1090 return true;
1091 }
1092}
1093
1094
1095bool
1097 const NBEdge* edge = myParentEdge->getNBEdge();
1098 switch (key) {
1099 case SUMO_ATTR_WIDTH:
1101 default:
1102 return false;
1103 }
1104}
1105
1106
1107const Parameterised::Map&
1110}
1111
1112
1113void
1114GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
1115 mySpecialColor = color;
1116 mySpecialColorValue = colorValue;
1117}
1118
1119// ===========================================================================
1120// private
1121// ===========================================================================
1122
1123void
1124GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
1125 // get parent edge
1126 NBEdge* edge = myParentEdge->getNBEdge();
1127 // get template editor
1129 // check if we have to update template
1130 const bool updateTemplate = templateEditor->getEdgeTemplate() ? (templateEditor->getEdgeTemplate()->getID() == myParentEdge->getID()) : false;
1131 switch (key) {
1132 case SUMO_ATTR_ID:
1133 case SUMO_ATTR_INDEX:
1134 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
1135 case SUMO_ATTR_SPEED:
1136 edge->setSpeed(myIndex, parse<double>(value));
1137 break;
1138 case SUMO_ATTR_ALLOW:
1140 break;
1141 case SUMO_ATTR_DISALLOW:
1143 break;
1146 break;
1149 break;
1150 case SUMO_ATTR_WIDTH:
1151 if (value.empty() || (value == "default")) {
1153 } else {
1154 edge->setLaneWidth(myIndex, parse<double>(value));
1155 }
1156 // update edge parent boundary
1158 break;
1159 case SUMO_ATTR_FRICTION:
1160 edge->setFriction(myIndex, parse<double>(value));
1161 break;
1163 edge->setEndOffset(myIndex, parse<double>(value));
1164 break;
1166 edge->setAcceleration(myIndex, parse<bool>(value));
1167 break;
1168 case SUMO_ATTR_CUSTOMSHAPE: {
1169 // set new shape
1170 edge->setLaneShape(myIndex, parse<PositionVector>(value));
1171 // update edge parent boundary
1173 break;
1174 }
1175 case GNE_ATTR_OPPOSITE: {
1176 if (value != "") {
1177 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
1178 oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = getID();
1179 } else {
1180 // reset prior oppEdge if existing
1181 const std::string oldValue = myParentEdge->getNBEdge()->getLaneStruct(myIndex).oppositeID;
1182 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(oldValue.substr(0, oldValue.rfind("_")));
1183 if (oppEdge != nullptr) {
1184 oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = "";
1185 }
1186 }
1188 break;
1189 }
1190 case SUMO_ATTR_TYPE:
1191 edge->getLaneStruct(myIndex).type = value;
1192 break;
1194 edge->getLaneStruct(myIndex).laneStopOffset.setOffset(parse<double>(value));
1195 break;
1197 if (value.empty()) {
1199 } else {
1201 }
1202 break;
1203 case GNE_ATTR_SELECTED:
1204 if (parse<bool>(value)) {
1206 } else {
1208 }
1209 break;
1212 break;
1213 default:
1214 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1215 }
1216 // update template
1217 if (updateTemplate) {
1218 templateEditor->setEdgeTemplate(myParentEdge);
1219 }
1220 // invalidate path calculator
1222}
1223
1224
1225void
1227 // set custom shape
1229 // update geometry
1231}
1232
1233
1234void
1236 // commit new shape
1237 undoList->begin(GUIIcon::LANE, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1239 undoList->end();
1240}
1241
1242
1245 // get inspected attribute carriers
1246 const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
1247 // declare a RGBColor variable
1248 RGBColor color;
1249 // get inspected AC
1250 const GNEAttributeCarrier* inspectedAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1251 // we need to draw lanes with a special color if we're inspecting a Trip or Flow and this lane belongs to a via's edge.
1252 if (inspectedAC && (inspectedAC->isAttributeCarrierSelected() == false) &&
1253 ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TRIP) || (inspectedAC->getTagProperty().getTag() == SUMO_TAG_FLOW))) {
1254 // obtain attribute "via"
1255 std::vector<std::string> viaEdges = parse<std::vector<std::string> >(inspectedAC->getAttribute(SUMO_ATTR_VIA));
1256 // iterate over viaEdges
1257 for (const auto& edge : viaEdges) {
1258 // check if parent edge is in the via edges
1259 if (myParentEdge->getID() == edge) {
1260 // set green color in GLHelper and return it
1261 color = RGBColor::GREEN;
1262 }
1263 }
1264 }
1265 if (mySpecialColor != nullptr) {
1266 // If special color is enabled, set it
1267 color = *mySpecialColor;
1268 } else if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1269 // override with special colors (unless the color scheme is based on selection)
1271 } else if (myParentEdge->drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1272 // override with special colors (unless the color scheme is based on selection)
1274 } else {
1275 // Get normal lane color
1276 const GUIColorer& c = s.laneColorer;
1277 if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1278 color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1279 }
1280 }
1281 // special color for conflicted candidate edges
1283 // extra check for route frame
1286 }
1287 }
1288 // special color for special candidate edges
1290 // extra check for route frame
1293 }
1294 }
1295 // special color for candidate edges
1297 // extra check for route frame
1300 }
1301 }
1302 // special color for source candidate edges
1305 }
1306 // special color for target candidate edges
1309 }
1310 // special color for source candidate lanes
1311 if (mySourceCandidate) {
1313 }
1314 // special color for target candidate lanes
1315 if (myTargetCandidate) {
1317 }
1318 // special color for special candidate lanes
1319 if (mySpecialCandidate) {
1321 }
1322 // special color for possible candidate lanes
1323 if (myPossibleCandidate) {
1325 }
1326 // special color for conflicted candidate lanes
1329 }
1330 // set color in GLHelper
1331 GLHelper::setColor(color);
1332 return color;
1333}
1334
1335
1336bool
1337GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1338 switch (activeScheme) {
1339 case 6: {
1340 double hue = GeomHelper::naviDegree(myLaneGeometry.getShape().beginEndAngle()); // [0-360]
1341 col = RGBColor::fromHSV(hue, 1., 1.);
1342 return true;
1343 }
1344 default:
1345 return false;
1346 }
1347}
1348
1349
1350bool
1352 const int activeScheme = c.getActive();
1353 myShapeColors.clear();
1354 switch (activeScheme) {
1355 case 9: // color by height at segment start
1356 for (PositionVector::const_iterator ii = myLaneGeometry.getShape().begin(); ii != myLaneGeometry.getShape().end() - 1; ++ii) {
1357 myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1358 }
1359 col = c.getScheme().getColor(getColorValue(s, 8));
1360 return true;
1361 case 11: // color by inclination at segment start
1362 for (int ii = 1; ii < (int)myLaneGeometry.getShape().size(); ++ii) {
1363 const double inc = (myLaneGeometry.getShape()[ii].z() - myLaneGeometry.getShape()[ii - 1].z()) / MAX2(POSITION_EPS, myLaneGeometry.getShape()[ii].distanceTo2D(myLaneGeometry.getShape()[ii - 1]));
1364 myShapeColors.push_back(c.getScheme().getColor(inc));
1365 }
1366 col = c.getScheme().getColor(getColorValue(s, 10));
1367 return true;
1368 default:
1369 return false;
1370 }
1371}
1372
1373
1374double
1375GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1376 const SVCPermissions myPermissions = myParentEdge->getNBEdge()->getPermissions(myIndex);
1377 if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1378 return mySpecialColorValue;
1379 }
1380 switch (activeScheme) {
1381 case 0:
1382 switch (myPermissions) {
1383 case SVC_PEDESTRIAN:
1384 return 1;
1385 case SVC_BICYCLE:
1386 return 2;
1387 case 0:
1388 // forbidden road or green verge
1389 return myParentEdge->getNBEdge()->getPermissions() == 0 ? 10 : 3;
1390 case SVC_SHIP:
1391 return 4;
1392 case SVC_AUTHORITY:
1393 return 8;
1394 default:
1395 break;
1396 }
1398 return 9;
1399 } else if (isRailway(myPermissions)) {
1400 if ((myPermissions & SVC_BUS) != 0) {
1401 return 6;
1402 } else {
1403 return 5;
1404 }
1405 } else if ((myPermissions & SVC_PASSENGER) != 0) {
1406 if ((myPermissions & (SVC_RAIL_CLASSES & ~SVC_RAIL_FAST)) != 0 && (myPermissions & SVC_SHIP) == 0) {
1407 return 6;
1408 } else {
1409 return 0;
1410 }
1411 } else {
1412 return 7;
1413 }
1414 case 1:
1416 case 2:
1417 return (double)myPermissions;
1418 case 3:
1420 case 4:
1421 return myParentEdge->getNBEdge()->getNumLanes();
1422 case 5: {
1424 }
1425 // case 6: by angle (functional)
1426 case 7: {
1427 return myParentEdge->getNBEdge()->getPriority();
1428 }
1429 case 8: {
1430 // color by z of first shape point
1431 return myLaneGeometry.getShape()[0].z();
1432 }
1433 // case 9: by segment height
1434 case 10: {
1435 // color by incline
1436 return (myLaneGeometry.getShape()[-1].z() - myLaneGeometry.getShape()[0].z()) / myParentEdge->getNBEdge()->getLength();
1437 }
1438 // case 11: by segment incline
1439
1440 case 12: {
1441 // by numerical edge param value
1443 try {
1445 } catch (NumberFormatException&) {
1446 try {
1448 } catch (BoolFormatException&) {
1449 return -1;
1450 }
1451 }
1452 } else {
1454 }
1455 }
1456 case 13: {
1457 // by numerical lane param value
1459 try {
1461 } catch (NumberFormatException&) {
1462 try {
1464 } catch (BoolFormatException&) {
1465 return -1;
1466 }
1467 }
1468 } else {
1470 }
1471 }
1472 case 14: {
1473 return myParentEdge->getNBEdge()->getDistance();
1474 }
1475 case 15: {
1476 return fabs(myParentEdge->getNBEdge()->getDistance());
1477 }
1478 }
1479 return 0;
1480}
1481
1482
1483bool
1488}
1489
1490
1491void
1492GNELane::drawOverlappedRoutes(const int numRoutes) const {
1493 // get middle point and angle
1496 // Push route matrix
1498 // translate to front
1499 glTranslated(0, 0, GLO_ROUTE + 1);
1500 // get middle
1501 GLHelper::drawText(toString(numRoutes) + " routes", center, 0, 1.8, RGBColor::BLACK, angle + 90);
1502 // pop route matrix
1504
1505}
1506
1507
1508void
1509GNELane::drawLaneStopOffset(const GUIVisualizationSettings& s, const double offset) const {
1510 GNELane::LaneDrawingConstants laneDrawingConstants(s, this);
1511 const Position& end = getLaneShape().back();
1512 const Position& f = getLaneShape()[-2];
1513 const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
1516 glTranslated(end.x(), end.y(), 1);
1517 glRotated(rot, 0, 0, 1);
1518 glTranslated(0, offset, 0);
1519 glBegin(GL_QUADS);
1520 glVertex2d(-laneDrawingConstants.halfWidth, 0.0);
1521 glVertex2d(-laneDrawingConstants.halfWidth, 0.2);
1522 glVertex2d(laneDrawingConstants.halfWidth, 0.2);
1523 glVertex2d(laneDrawingConstants.halfWidth, 0.0);
1524 glEnd();
1526}
1527
1528
1529bool
1531 return isWaterway(myParentEdge->getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForRectangleSelection; // reusing the showRails setting
1532}
1533
1534
1535void
1536GNELane::drawDirectionIndicators(const GUIVisualizationSettings& s, double exaggeration, const bool drawAsRailway, const bool spreadSuperposed) const {
1537 // Draw direction indicators if the correspondient option is enabled
1538 if (s.showLaneDirection) {
1539 // improve visibility of superposed rail edges
1540 if (drawAsRailway) {
1541 setLaneColor(s);
1542 } else {
1543 glColor3d(0.3, 0.3, 0.3);
1544 }
1545 // get width and sideOffset
1546 const double width = MAX2(NUMERICAL_EPS, (myParentEdge->getNBEdge()->getLaneWidth(myIndex) * exaggeration * (spreadSuperposed ? 0.4 : 1)));
1547 const double sideOffset = spreadSuperposed ? width * -0.5 : 0;
1548 // push direction indicator matrix
1550 // move to front
1551 glTranslated(0, 0, 0.1);
1552 // iterate over shape
1553 for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
1554 // push triangle matrix
1556 // move front
1557 glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
1558 // rotate
1559 glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
1560 // calculate subwidth
1561 for (double subWidth = 0; subWidth < myLaneGeometry.getShapeLengths()[i]; subWidth += width) {
1562 // calculate length
1563 const double length = MIN2(width * 0.5, myLaneGeometry.getShapeLengths()[i] - subWidth);
1564 // draw triangle
1565 glBegin(GL_TRIANGLES);
1566 glVertex2d(sideOffset, -subWidth - length);
1567 glVertex2d(sideOffset - width * 0.25, -subWidth);
1568 glVertex2d(sideOffset + width * 0.25, -subWidth);
1569 glEnd();
1570 }
1571 // pop triangle matrix
1573 }
1574 // pop direction indicator matrix
1576 }
1577}
1578
1579
1580void
1582 // we draw the lanes with reduced width so that the lane markings below are visible
1583 // (this avoids artifacts at geometry corners without having to
1584 const bool spreadSuperposed = s.spreadSuperposed && myParentEdge->getNBEdge()->getBidiEdge() != nullptr;
1585 // get lane shape
1587 // get width
1588 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
1589 // draw as railway: assume standard gauge of 1435mm when lane width is not set
1590 // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
1591 // assume crosstie length of 181% gauge (2600mm for standard gauge)
1592 double halfGauge = 0.5 * (width == SUMO_const_laneWidth ? 1.4350 : width) * laneDrawingConstants.exaggeration;
1593 // check if we have to modify shape
1594 if (spreadSuperposed) {
1595 shape.move2side(halfGauge * 0.8);
1596 halfGauge *= 0.4;
1597 //std::cout << "spreadSuperposed " << getID() << " old=" << myLaneGeometry.getShape() << " new=" << shape << "\n";
1598 }
1599 // calculate constant
1600 const double halfInnerFeetWidth = halfGauge - 0.039 * laneDrawingConstants.exaggeration;
1601 const double halfRailWidth = halfInnerFeetWidth + 0.15 * laneDrawingConstants.exaggeration;
1602 const double halfCrossTieWidth = halfGauge * 1.81;
1603 // Draw lane geometry
1605 // Save current color
1606 RGBColor current = GLHelper::getColor();
1607 // Draw gray on top with reduced width (the area between the two tracks)
1608 glColor3d(0.8, 0.8, 0.8);
1609 // move
1610 glTranslated(0, 0, 0.1);
1611 // draw lane geometry again
1613 // Set current color back
1614 GLHelper::setColor(current);
1615 // Draw crossties
1616 GLHelper::drawCrossTies(shape, myLaneGeometry.getShapeRotations(), myLaneGeometry.getShapeLengths(), 0.26 * laneDrawingConstants.exaggeration, 0.6 * laneDrawingConstants.exaggeration, halfCrossTieWidth, s.drawForRectangleSelection);
1617 // check if dotted contours has to be drawn
1621 }
1622 if ((myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
1625 }
1626}
1627
1628
1629void
1630GNELane::drawTextures(const GUIVisualizationSettings& s, const LaneDrawingConstants& laneDrawingConstants) const {
1631 // check all conditions for drawing textures
1633 (myLaneRestrictedTexturePositions.size() > 0) &&
1634 s.drawDetail(s.detailSettings.laneTextures, laneDrawingConstants.exaggeration)) {
1635 // Declare default width of icon (3)
1636 double iconWidth = 1;
1637 // Obtain width of icon, if width of lane is different
1639 iconWidth = myParentEdge->getNBEdge()->getLaneStruct(myIndex).width / 3;
1640 }
1641 // Draw list of icons
1642 for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
1643 // Push draw matrix 2
1645 // Set white color
1646 glColor3d(1, 1, 1);
1647 // Translate matrix 2
1648 glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), 0.1);
1649 // Rotate matrix 2
1650 glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
1651 glRotated(90, 0, 0, 1);
1652 // draw texture box depending of type of restriction
1655 } else if (isRestricted(SVC_BICYCLE)) {
1657 } else if (isRestricted(SVC_BUS)) {
1659 }
1660 // Pop draw matrix 2
1662 }
1663 }
1664}
1665
1666
1667void
1669 // draw a Start/endPoints if lane has a custom shape
1671 GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1672 if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1673 // override with special colors (unless the color scheme is based on selection)
1675 }
1676 // obtain circle width and resolution
1677 double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1678 // Obtain exaggeration of the draw
1679 const double exaggeration = getExaggeration(s);
1680 // obtain custom shape
1682 // draw s depending of detail
1683 if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1684 // push start matrix
1686 // move to shape start position
1687 glTranslated(customShape.front().x(), customShape.front().y(), 0.1);
1688 // draw circle
1690 // check if we can draw "S"
1691 if (!s.drawForPositionSelection) {
1692 // move top
1693 glTranslated(0, 0, 0.1);
1694 // draw "S"
1695 GLHelper::drawText("S", Position(), 0.1, circleWidth, RGBColor::WHITE);
1696 }
1697 // pop start matrix
1699 }
1700 // draw line between junction and start position
1702 // move top
1703 glTranslated(0, 0, 0.1);
1704 // set line width
1705 glLineWidth(4);
1706 // draw line
1708 // pop line matrix
1710 // draw "e" depending of detail
1711 if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1712 // push start matrix
1714 // move to end position
1715 glTranslated(customShape.back().x(), customShape.back().y(), 0.1);
1716 // draw filled circle
1718 // check if we can draw "E"
1719 if (!s.drawForPositionSelection) {
1720 // move top
1721 glTranslated(0, 0, 0.1);
1722 // draw "E"
1723 GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1724 }
1725 // pop start matrix
1727 }
1728 // draw line between Junction and end position
1730 // move top
1731 glTranslated(0, 0, 0.1);
1732 // set line width
1733 glLineWidth(4);
1734 // draw line
1736 // pop line matrix
1738 }
1739}
1740
1741
1742std::string
1744 return myParentEdge->getID();
1745}
1746
1747
1748long
1749GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1750 myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1751 return 1;
1752}
1753
1754
1755std::vector<GNEConnection*>
1757 // Declare a vector to save incoming connections
1758 std::vector<GNEConnection*> incomingConnections;
1759 // Obtain incoming edges if junction source was already created
1760 GNEJunction* junctionSource = myParentEdge->getFromJunction();
1761 if (junctionSource) {
1762 // Iterate over incoming GNEEdges of junction
1763 for (auto i : junctionSource->getGNEIncomingEdges()) {
1764 // Iterate over connection of incoming edges
1765 for (auto j : i->getGNEConnections()) {
1766 if (j->getNBEdgeConnection().fromLane == getIndex()) {
1767 incomingConnections.push_back(j);
1768 }
1769 }
1770 }
1771 }
1772 return incomingConnections;
1773}
1774
1775
1776std::vector<GNEConnection*>
1778 // Obtain GNEConnection of parent edge
1779 const std::vector<GNEConnection*>& edgeConnections = myParentEdge->getGNEConnections();
1780 std::vector<GNEConnection*> outcomingConnections;
1781 // Obtain outgoing connections
1782 for (auto i : edgeConnections) {
1783 if (i->getNBEdgeConnection().fromLane == getIndex()) {
1784 outcomingConnections.push_back(i);
1785 }
1786 }
1787 return outcomingConnections;
1788}
1789
1790
1791void
1793 // update incoming connections of lane
1794 std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1795 for (auto i : incomingConnections) {
1796 i->updateID();
1797 }
1798 // update outcoming connections of lane
1799 std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1800 for (auto i : outcomingConnections) {
1801 i->updateID();
1802 }
1803}
1804
1805
1806double
1808 // factor should not be 0
1809 if (myParentEdge->getNBEdge()->getFinalLength() > 0) {
1810 return MAX2(POSITION_EPS, (getLaneShape().length() / myParentEdge->getNBEdge()->getFinalLength()));
1811 } else {
1812 return POSITION_EPS;
1813 };
1814}
1815
1816
1817void
1819 // Create basic commands
1820 std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1822 if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1823 edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
1824 }
1825 // create menu pane for edge operations
1826 FXMenuPane* edgeOperations = new FXMenuPane(ret);
1827 ret->insertMenuPaneChild(edgeOperations);
1828 if (edgeSelSize > 0) {
1829 new FXMenuCascade(ret, ("edge operations (" + toString(edgeSelSize) + " selected)").c_str(), nullptr, edgeOperations);
1830 } else {
1831 new FXMenuCascade(ret, "edge operations", nullptr, edgeOperations);
1832 }
1833 // create menu commands for all edge operations
1834 GUIDesigns::buildFXMenuCommand(edgeOperations, "Split edge here", nullptr, &parent, MID_GNE_EDGE_SPLIT);
1835 auto splitBothDirections = GUIDesigns::buildFXMenuCommand(edgeOperations, "Split edge in both directions here (no simmetric opposite edge)", nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
1836 // check if allow split edge in both directions
1837 splitBothDirections->disable();
1838 const auto oppositeEdges = myParentEdge->getOppositeEdges();
1839 if (oppositeEdges.size() == 0) {
1840 splitBothDirections->setText("Split edge in both directions here (no opposite edge)");
1841 } else {
1842 for (const auto& oppositeEdge : oppositeEdges) {
1843 // get reverse inner geometry
1844 const auto reverseGeometry = oppositeEdge->getNBEdge()->getInnerGeometry().reverse();
1845 if (reverseGeometry == myParentEdge->getNBEdge()->getInnerGeometry()) {
1846 splitBothDirections->enable();
1847 splitBothDirections->setText("Split edge in both directions here");
1848 }
1849 }
1850 }
1851 GUIDesigns::buildFXMenuCommand(edgeOperations, "Set geometry endpoint here (shift-click)", nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
1852 // restore geometry points depending of selection status
1854 if (edgeSelSize == 1) {
1855 GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore both geometry endpoints", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1856 } else {
1857 GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore geometry endpoints of all selected edges", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1858 }
1859 } else {
1860 GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore geometry endpoint (shift-click)", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1861 }
1862 GUIDesigns::buildFXMenuCommand(edgeOperations, "Reverse " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_REVERSE);
1863 auto reverse = GUIDesigns::buildFXMenuCommand(edgeOperations, "Add reverse direction for " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
1864 if (myParentEdge->getReverseEdge() != nullptr) {
1865 reverse->disable();
1866 }
1867 GUIDesigns::buildFXMenuCommand(edgeOperations, "Add reverse disconnected direction for " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED);
1868 GUIDesigns::buildFXMenuCommand(edgeOperations, "Reset lengths for " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_RESET_LENGTH);
1869 GUIDesigns::buildFXMenuCommand(edgeOperations, "Straighten " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
1870 GUIDesigns::buildFXMenuCommand(edgeOperations, "Smooth " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_SMOOTH);
1871 GUIDesigns::buildFXMenuCommand(edgeOperations, "Straighten elevation of " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
1872 GUIDesigns::buildFXMenuCommand(edgeOperations, "Smooth elevation of " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
1873}
1874
1875
1876void
1878 // Get icons
1879 FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_PEDESTRIAN);
1880 FXIcon* bikeIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BIKE);
1881 FXIcon* busIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BUS);
1882 FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEGREENVERGE);
1883 // declare number of selected lanes
1884 int numSelectedLanes = 0;
1885 // if lane is selected, calculate number of restricted lanes
1886 bool edgeHasSidewalk = false;
1887 bool edgeHasBikelane = false;
1888 bool edgeHasBuslane = false;
1889 bool differentLaneShapes = false;
1891 const auto selectedLanes = myNet->getAttributeCarriers()->getSelectedLanes();
1892 // update numSelectedLanes
1893 numSelectedLanes = (int)selectedLanes.size();
1894 // iterate over selected lanes
1895 for (const auto& selectedLane : selectedLanes) {
1896 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN)) {
1897 edgeHasSidewalk = true;
1898 }
1899 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BICYCLE)) {
1900 edgeHasBikelane = true;
1901 }
1902 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BUS)) {
1903 edgeHasBuslane = true;
1904 }
1905 if (selectedLane->myParentEdge->getNBEdge()->getLaneStruct(selectedLane->getIndex()).customShape.size() != 0) {
1906 differentLaneShapes = true;
1907 }
1908 }
1909 } else {
1910 edgeHasSidewalk = myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN);
1911 edgeHasBikelane = myParentEdge->hasRestrictedLane(SVC_BICYCLE);
1912 edgeHasBuslane = myParentEdge->hasRestrictedLane(SVC_BUS);
1913 differentLaneShapes = myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
1914 }
1915 // create menu pane for lane operations
1916 FXMenuPane* laneOperations = new FXMenuPane(ret);
1917 ret->insertMenuPaneChild(laneOperations);
1918 if (numSelectedLanes > 0) {
1919 new FXMenuCascade(ret, ("lane operations (" + toString(numSelectedLanes) + " selected)").c_str(), nullptr, laneOperations);
1920 } else {
1921 new FXMenuCascade(ret, "lane operations", nullptr, laneOperations);
1922 }
1923 GUIDesigns::buildFXMenuCommand(laneOperations, "Duplicate lane", nullptr, &parent, MID_GNE_LANE_DUPLICATE);
1924 GUIDesigns::buildFXMenuCommand(laneOperations, "Set custom lane shape", nullptr, &parent, MID_GNE_LANE_EDIT_SHAPE);
1925 FXMenuCommand* resetCustomShape = GUIDesigns::buildFXMenuCommand(laneOperations, "reset custom shape", nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
1926 if (!differentLaneShapes) {
1927 resetCustomShape->disable();
1928 }
1929 FXMenuCommand* resetOppositeLane = GUIDesigns::buildFXMenuCommand(laneOperations, "reset opposite lane", nullptr, &parent, MID_GNE_LANE_RESET_OPPOSITELANE);
1930 if (getAttribute(GNE_ATTR_OPPOSITE).empty()) {
1931 resetOppositeLane->disable();
1932 }
1933 // Create panel for lane operations and insert it in ret
1934 FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
1935 ret->insertMenuPaneChild(addSpecialLanes);
1936 FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
1937 ret->insertMenuPaneChild(removeSpecialLanes);
1938 FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
1939 ret->insertMenuPaneChild(transformSlanes);
1940 // Create menu comands for all add special lanes
1941 FXMenuCommand* addSidewalk = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
1942 FXMenuCommand* addBikelane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
1943 FXMenuCommand* addBuslane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_ADD_BUS);
1944 GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Greenverge (front)", greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
1945 GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Greenverge (back)", greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_BACK);
1946 // Create menu comands for all remove special lanes and disable it
1947 FXMenuCommand* removeSidewalk = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
1948 removeSidewalk->disable();
1949 FXMenuCommand* removeBikelane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
1950 removeBikelane->disable();
1951 FXMenuCommand* removeBuslane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
1952 removeBuslane->disable();
1953 FXMenuCommand* removeGreenVerge = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
1954 removeGreenVerge->disable();
1955 // Create menu comands for all transform special lanes and disable it
1956 FXMenuCommand* transformLaneToSidewalk = GUIDesigns::buildFXMenuCommand(transformSlanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
1957 FXMenuCommand* transformLaneToBikelane = GUIDesigns::buildFXMenuCommand(transformSlanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
1958 FXMenuCommand* transformLaneToBuslane = GUIDesigns::buildFXMenuCommand(transformSlanes, "Buslane", busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
1959 FXMenuCommand* transformLaneToGreenVerge = GUIDesigns::buildFXMenuCommand(transformSlanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
1960 // add menuCascade for lane operations
1961 new FXMenuCascade(laneOperations, ("add restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
1962 FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, ("remove restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
1963 new FXMenuCascade(laneOperations, ("transform to restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
1964 // Enable and disable options depending of current transform of the lane
1965 if (edgeHasSidewalk) {
1966 transformLaneToSidewalk->disable();
1967 addSidewalk->disable();
1968 removeSidewalk->enable();
1969 }
1970 if (edgeHasBikelane) {
1971 transformLaneToBikelane->disable();
1972 addBikelane->disable();
1973 removeBikelane->enable();
1974 }
1975 if (edgeHasBuslane) {
1976 transformLaneToBuslane->disable();
1977 addBuslane->disable();
1978 removeBuslane->enable();
1979 }
1981 transformLaneToGreenVerge->disable();
1982 removeGreenVerge->enable();
1983 }
1984 // Check if cascade menu must be disabled
1985 if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !isRestricted(SVC_IGNORING)) {
1986 cascadeRemoveSpecialLane->disable();
1987 }
1988 // for whatever reason, sonar complains in the next line that cascadeRemoveSpecialLane may leak, but fox does the cleanup
1989} // NOSONAR
1990
1991
1992void
1994 // Create basic commands
1995 std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1997 if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1998 edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
1999 }
2000 // create menu pane for edge operations
2001 FXMenuPane* edgeOperations = new FXMenuPane(ret);
2002 ret->insertMenuPaneChild(edgeOperations);
2003 if (edgeSelSize > 0) {
2004 new FXMenuCascade(ret, ("template operations (" + toString(edgeSelSize) + " selected)").c_str(), nullptr, edgeOperations);
2005 } else {
2006 new FXMenuCascade(ret, "template operations", nullptr, edgeOperations);
2007 }
2008 // create menu commands for all edge operations
2009 GUIDesigns::buildFXMenuCommand(edgeOperations, "Use edge as template", nullptr, &parent, MID_GNE_EDGE_USEASTEMPLATE);
2010 auto applyTemplate = GUIDesigns::buildFXMenuCommand(edgeOperations, "Apply template", nullptr, &parent, MID_GNE_EDGE_APPLYTEMPLATE);
2011 // check if disable apply template
2013 applyTemplate->disable();
2014 }
2015
2016}
2017
2018
2019void
2021 // addreachability menu
2022 FXMenuPane* reachableByClass = new FXMenuPane(ret);
2023 ret->insertMenuPaneChild(reachableByClass);
2024 if (myNet->isNetRecomputed()) {
2025 new FXMenuCascade(ret, "Select reachable", GUIIconSubSys::getIcon(GUIIcon::MODEVEHICLE), reachableByClass);
2026 for (const auto& vClass : SumoVehicleClassStrings.getStrings()) {
2027 GUIDesigns::buildFXMenuCommand(reachableByClass, vClass.c_str(), getVClassIcon(SumoVehicleClassStrings.get(vClass)), &parent, MID_REACHABILITY);
2028 }
2029 } else {
2030 FXMenuCommand* menuCommand = GUIDesigns::buildFXMenuCommand(ret, "Select reachable (compute junctions)", nullptr, nullptr, 0);
2031 menuCommand->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
2032 }
2033}
2034
2035/****************************************************************************/
2036
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_TLS
mode for editing tls
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_ADDSELECT_EDGE
Add edge to selected items - menu entry.
Definition: GUIAppEnum.h:779
@ MID_GNE_LANE_EDIT_SHAPE
edit lane shape
Definition: GUIAppEnum.h:1243
@ MID_GNE_LANE_TRANSFORM_BIKE
transform lane to bikelane
Definition: GUIAppEnum.h:1251
@ MID_GNE_EDGE_REVERSE
reverse an edge
Definition: GUIAppEnum.h:1153
@ MID_ADDSELECT
Add to selected items - menu entry.
Definition: GUIAppEnum.h:476
@ MID_GNE_LANE_ADD_BUS
add busLane
Definition: GUIAppEnum.h:1261
@ MID_GNE_REMOVESELECT_EDGE
Remove edge from selected items - Menu Entry.
Definition: GUIAppEnum.h:781
@ MID_GNE_EDGE_STRAIGHTEN_ELEVATION
interpolate z values linear between junctions
Definition: GUIAppEnum.h:1145
@ MID_GNE_EDGE_SMOOTH
smooth geometry
Definition: GUIAppEnum.h:1143
@ MID_GNE_LANE_RESET_CUSTOMSHAPE
reset custom shape
Definition: GUIAppEnum.h:1245
@ MID_GNE_EDGE_STRAIGHTEN
remove inner geometry
Definition: GUIAppEnum.h:1141
@ MID_GNE_LANE_TRANSFORM_BUS
transform lane to busLane
Definition: GUIAppEnum.h:1253
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:452
@ MID_GNE_LANE_DUPLICATE
duplicate a lane
Definition: GUIAppEnum.h:1241
@ MID_GNE_LANE_ADD_GREENVERGE_FRONT
add greenVerge front of current lane
Definition: GUIAppEnum.h:1263
@ MID_GNE_LANE_REMOVE_GREENVERGE
remove greenVerge
Definition: GUIAppEnum.h:1273
@ MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED
add reverse edge disconnected (used for for spreadtype center)
Definition: GUIAppEnum.h:1157
@ MID_GNE_EDGE_SPLIT_BIDI
split an edge
Definition: GUIAppEnum.h:1151
@ MID_GNE_LANE_REMOVE_BIKE
remove bikelane
Definition: GUIAppEnum.h:1269
@ MID_GNE_LANE_RESET_OPPOSITELANE
reset opposite lane
Definition: GUIAppEnum.h:1247
@ MID_REACHABILITY
show reachability from a given lane
Definition: GUIAppEnum.h:522
@ MID_GNE_EDGE_RESET_LENGTH
reset custom lengths
Definition: GUIAppEnum.h:1159
@ MID_GNE_LANE_REMOVE_BUS
remove busLane
Definition: GUIAppEnum.h:1271
@ MID_GNE_LANE_REMOVE_SIDEWALK
remove sidewalk
Definition: GUIAppEnum.h:1267
@ MID_GNE_EDGE_RESET_ENDPOINT
reset default geometry endpoints
Definition: GUIAppEnum.h:1139
@ MID_GNE_LANE_ADD_GREENVERGE_BACK
add greenVerge back of current lane
Definition: GUIAppEnum.h:1265
@ MID_GNE_EDGE_SMOOTH_ELEVATION
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:1147
@ MID_GNE_EDGE_ADD_REVERSE
add reverse edge
Definition: GUIAppEnum.h:1155
@ MID_GNE_EDGE_APPLYTEMPLATE
apply template
Definition: GUIAppEnum.h:1163
@ MID_GNE_EDGE_USEASTEMPLATE
use edge as tempalte
Definition: GUIAppEnum.h:1161
@ MID_GNE_LANE_ADD_SIDEWALK
add sidewalk
Definition: GUIAppEnum.h:1257
@ MID_GNE_RESET_GEOMETRYPOINT
reset geometry point
Definition: GUIAppEnum.h:954
@ MID_GNE_LANE_TRANSFORM_SIDEWALK
transform lane to sidewalk
Definition: GUIAppEnum.h:1249
@ MID_GNE_LANE_ADD_BIKE
add bikelane
Definition: GUIAppEnum.h:1259
@ MID_GNE_EDGE_SPLIT
split an edge
Definition: GUIAppEnum.h:1149
@ MID_GNE_LANE_TRANSFORM_GREENVERGE
transform lane to greenVerge
Definition: GUIAppEnum.h:1255
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
Definition: GUIAppEnum.h:952
@ MID_GNE_EDGE_EDIT_ENDPOINT
change default geometry endpoints
Definition: GUIAppEnum.h:1137
@ MID_REMOVESELECT
Remove from selected items - Menu Entry.
Definition: GUIAppEnum.h:478
@ GLO_DOTTEDCONTOUR_FRONT
dotted contour front element (used in NETEDIT)
@ GLO_ROUTE
a route
@ GLO_JUNCTION
a junction
@ GLO_LANE
a lane
@ GLO_LANEARROWS
lane details
@ GLO_TEXTNAME
text element (used in NETEDIT)
GUIPostDrawing gPostDrawing
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ LANE_PEDESTRIAN
@ LANEGREENVERGE
#define RAD2DEG(x)
Definition: GeomHelper.h:36
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
const SVCPermissions SVCAll
all VClasses are allowed
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_AUTHORITY
authorities vehicles
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
@ PARTLEFT
The link is a partial left direction.
@ RIGHT
The link is a (hard) right direction.
@ TURN
The link is a 180 degree turn.
@ LEFT
The link is a (hard) left direction.
@ STRAIGHT
The link is a straight direction.
@ TURN_LEFTHAND
The link is a 180 degree turn (left-hand network)
@ PARTRIGHT
The link is a partial right direction.
@ NODIR
The link has no direction (is a dead end link)
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
@ LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
@ LINKSTATE_STOP
This is an uncontrolled, minor link, has to stop.
@ LINKSTATE_EQUAL
This is an uncontrolled, right-before-left link.
@ LINKSTATE_ZIPPER
This is an uncontrolled, zipper-merge link.
@ LINKSTATE_TL_OFF_BLINKING
The link is controlled by a tls which is off and blinks, has to brake.
@ LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
@ LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_SPEED
@ GNE_ATTR_STOPOFFSET
stop offset (virtual, used by edge and lanes)
@ SUMO_ATTR_VIA
@ GNE_ATTR_OPPOSITE
neighboring lane, simplified lane attr instead of child element
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_STOPOEXCEPTION
stop exceptions (virtual, used by edge and lanes)
@ SUMO_ATTR_CHANGE_LEFT
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ENDOFFSET
@ SUMO_ATTR_ACCELERATION
@ SUMO_ATTR_CHANGE_RIGHT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_FRICTION
const double SUMO_const_laneWidth
Definition: StdDefs.h:48
T MIN2(T a, T b)
Definition: StdDefs.h:71
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:51
T MAX2(T a, T b)
Definition: StdDefs.h:77
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:421
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:583
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:498
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:558
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, const GUIVisualizationTextSettings &settings, const double scale)
draw text and the end of shape
Definition: GLHelper.cpp:767
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:139
static void drawOutlineCircle(double width, double iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:525
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:589
static void drawCrossTies(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double length, double spacing, double halfWidth, bool drawForSelection)
draw crossties for railroads or pedestrian crossings
Definition: GLHelper.cpp:785
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:277
static void popName()
pop Name
Definition: GLHelper.cpp:148
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
static void drawInverseMarkings(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double maxLength, double spacing, double halfWidth, bool cl, bool cr, bool lefthand, double scale)
@bried draw the space between markings (in road color)
Definition: GLHelper.cpp:830
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition: GLHelper.cpp:685
GNENetworkSelector * getLanesSelector() const
get edges selector
GNENetworkSelector * getEdgesSelector() const
get edges selector
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool myPossibleCandidate
flag to mark this element as possible candidate
bool mySpecialCandidate
flag to mark this element as special candidate
bool isSpecialCandidate() const
check if this element is a special candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isTargetCandidate() const
check if this element is a target candidate
bool isSourceCandidate() const
check if this element is a source candidate
bool isConflictedCandidate() const
check if this element is a conflicted candidate
bool myTargetCandidate
flag to mark this element as target candidate
bool myConflictedCandidate
flag to mark this element as conflicted candidate
bool mySourceCandidate
flag to mark this element as source candidate
struct for saving subordinated elements (Junction->Edge->Lane->(Additional | DemandElement)
ProtectElements * getProtectElements() const
get protect elements modul
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEEdge.cpp:348
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:481
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
Definition: GNEEdge.cpp:1555
bool clickedOverGeometryPoint(const Position &pos) const
return true if user clicked over a Geometry Point
Definition: GNEEdge.cpp:309
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:839
static const double SNAP_RADIUS
Definition: GNEEdge.h:271
bool hasCustomEndPoints() const
Definition: GNEEdge.cpp:277
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:2088
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
Definition: GNEEdge.cpp:404
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:77
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:845
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
void drawEdgeGeometryPoints(const GUIVisualizationSettings &s, const GNELane *lane) const
draw edge geometry points (note: This function is called by GNELane::drawGL(...)
Definition: GNEEdge.cpp:1348
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEGenericData * > & getParentGenericDatas() const
get parent demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
void setEdgeTemplate(const GNEEdge *edge)
set edge template
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
TemplateEditor * getTemplateEditor() const
get template editor
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
static const StringBijection< FXuint > LinkStateNames
long names for link states
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
bool isLogicValid()
whether this junction has a valid logic
Position getPositionInView() const
Returns position of hierarchical element in view.
NBNode * getNBNode() const
Return net build node.
class lane2lane connection geometry
FOX-declaration.
Definition: GNELane.h:52
const double exaggeration
exaggeration
Definition: GNELane.h:62
LaneDrawingConstants()
default constructor
Definition: GNELane.cpp:77
const double halfWidth
Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen.
Definition: GNELane.h:68
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNELane2laneConnection myLane2laneConnections
lane2lane connections
Definition: GNELane.h:283
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:142
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1749
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:917
~GNELane()
Destructor.
Definition: GNELane.cpp:120
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1743
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:923
void drawLinkRules(const GUIVisualizationSettings &s) const
draw link rules
Definition: GNELane.cpp:359
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:270
bool allowPedestrians() const
check if current lane allow pedestrians
Definition: GNELane.cpp:130
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:274
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNELane.cpp:241
bool isAttributeComputed(SumoXMLAttr key) const
Definition: GNELane.cpp:1096
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:1530
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1807
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNELane.cpp:1084
void updateGeometry()
update pre-computed geometry information
Definition: GNELane.cpp:164
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNELane.cpp:1226
GNEEdge * myParentEdge
parent edge (GNELanes cannot use hierarchical structures)
Definition: GNELane.h:255
void deleteGLObject()
delete element
Definition: GNELane.cpp:685
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition: GNELane.cpp:978
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNELane.cpp:750
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:876
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNELane.cpp:860
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNELane.cpp:260
GUIGeometry myLaneGeometry
lane geometry
Definition: GNELane.h:261
void drawStartEndShapePoints(const GUIVisualizationSettings &s) const
draw start and end shape points
Definition: GNELane.cpp:1668
void drawMarkings(const GUIVisualizationSettings &s, const double exaggeration, const bool drawRailway) const
draw lane markings
Definition: GNELane.cpp:716
void drawOverlappedRoutes(const int numRoutes) const
draw overlapped routes
Definition: GNELane.cpp:1492
void updateGLObject()
update GLObject (geometry, ID, etc.)
Definition: GNELane.cpp:694
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNELane.cpp:247
void buildLaneOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build lane operations contextual menu
Definition: GNELane.cpp:1877
GNELane()
FOX needs this.
Definition: GNELane.cpp:106
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1777
const std::vector< double > & getShapeRotations() const
get rotations of the single shape parts
Definition: GNELane.cpp:152
void drawTextures(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane textures
Definition: GNELane.cpp:1630
void buildTemplateOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build template oerations contextual menu
Definition: GNELane.cpp:1993
bool setMultiColor(const GUIVisualizationSettings &s, const GUIColorer &c, RGBColor &col) const
sets multiple colors according to the current scheme index and some lane function
Definition: GNELane.cpp:1351
void drawLaneAsRailway(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane as railway
Definition: GNELane.cpp:1581
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
Definition: GNELane.cpp:323
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNELane.cpp:1108
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:894
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition: GNELane.cpp:1244
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:1019
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1756
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GNELane.cpp:1484
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:911
int myIndex
The index of this lane.
Definition: GNELane.h:258
void drawDirectionIndicators(const GUIVisualizationSettings &s, double exaggeration, const bool drawAsRailway, const bool spreadSuperposed) const
direction indicators for lanes
Definition: GNELane.cpp:1536
void setIndex(int index)
Definition: GNELane.cpp:881
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:499
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:1114
const GUIGeometry & getLaneGeometry() const
Definition: GNELane.cpp:136
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNELane.cpp:866
double mySpecialColorValue
optional value that corresponds to which the special color corresponds
Definition: GNELane.h:277
void drawChildren(const GUIVisualizationSettings &s) const
draw children
Definition: GNELane.cpp:700
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:267
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNELane.cpp:1235
double getLaneShapeLength() const
returns the length of the lane's shape
Definition: GNELane.cpp:905
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:280
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:1375
bool setFunctionalColor(int activeScheme, RGBColor &col) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:1337
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition: GNELane.cpp:1792
void drawArrows(const GUIVisualizationSettings &s, const bool spreadSuperposed) const
draw arrows
Definition: GNELane.cpp:365
void buildRechableOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build rechable operations contextual menu
Definition: GNELane.cpp:2020
void drawLaneStopOffset(const GUIVisualizationSettings &s, const double offset) const
draw laneStopOffset
Definition: GNELane.cpp:1509
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:451
void buildEdgeOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build edge operations contextual menu
Definition: GNELane.cpp:1818
const std::vector< double > & getShapeLengths() const
get lengths of the single shape parts
Definition: GNELane.cpp:158
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition: GNELane.cpp:286
double getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:888
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:988
GNEEdge * getParentEdge() const
get parent edge
Definition: GNELane.cpp:124
GNEMoveOperation * calculateMoveShapeOperation(const PositionVector originalShape, const Position mousePosition, const double snapRadius, const bool onlyContour)
calculate move shape operation
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
std::vector< GNELane * > getSelectedLanes() const
get selected lanes
int getNumberOfSelectedEdges() const
get number of selected edges
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition: GNENet.cpp:556
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:132
bool isNetRecomputed() const
check if net require recomputing
Definition: GNENet.cpp:1382
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:138
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Definition: GNENet.cpp:1999
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
bool myShapeEdited
flag to check if element shape is being edited
bool isShapeEdited() const
check if shape is being edited
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
Boundary myBoundary
object boundary
bool isNetworkElementSelected(const GNENetworkElement *networkElement) const
check if the given networkElement is being selected
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void drawLanePathElements(const GUIVisualizationSettings &s, const GNELane *lane)
draw lane path elements
GNEPathCreator * getPathCreator() const
get path creator module
bool controlsEdge(GNEEdge *edge) const
whether the given edge is controlled by the currently edited tlDef
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:632
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:662
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:644
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
GNEAdditionalFrame * getAdditionalFrame() const
get frame for NETWORK_ADDITIONAL
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
GNERouteFrame * getRouteFrame() const
get frame for DEMAND_ROUTE
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedContourShape(const GUIVisualizationSettings &s, const DottedContourType type, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given shape (used by additionals)
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
static void drawGeometryPoints(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
draw geometry points
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
static double calculateRotation(const Position &first, const Position &second)
return angle between two points (used in geometric calculations)
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
static void drawLaneGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const std::vector< double > &rotations, const std::vector< double > &lengths, const std::vector< RGBColor > &colors, double width, const bool onlyContour=false, const double offset=0)
draw lane geometry (use their own function due colors)
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:141
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:154
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:102
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const GUIGlObject * markedLane
marked lane (used in create edge mode, for splitting)
const GUIGlObject * markedEdge
marked edge (used in create edge mode, for splitting)
const T getColor(const double value) const
const std::vector< T > & getSchemes() const
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
GUIVisualizationSizeSettings addSize
bool disableLaneIcons
whether drawing is performed in left-hand networks
GUIVisualizationTextSettings drawLinkJunctionIndex
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool showRails
Information whether rails shall be drawn.
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
bool lefthand
whether drawing is performed in left-hand networks
GUIVisualizationColorSettings colorSettings
color settings
static const RGBColor & getLinkColor(const LinkState &ls, bool realistic=false)
map from LinkState to color constants
double scale
information about a lane's width (temporary, used for a single view)
bool showLaneDirection
Whether to show direction indicators for lanes.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
GUIColorer laneColorer
The lane colorer.
bool laneShowBorders
Information whether lane borders shall be drawn.
double laneMinSize
The minimum visual lane width for drawing.
GUIVisualizationTextSettings drawLinkTLIndex
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
GUIColorer junctionColorer
The junction colorer.
std::string edgeParam
key for coloring by edge parameter
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:192
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:112
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:274
The representation of a single edge during network building.
Definition: NBEdge.h:92
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:2135
void setPermittedChanging(int lane, SVCPermissions changeLeft, SVCPermissions changeRight)
set allowed classes for changing to the left and right from the given lane
Definition: NBEdge.cpp:4128
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:599
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:4137
double getDistancAt(double pos) const
get distance at the given offset
Definition: NBEdge.cpp:4671
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:4100
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition: NBEdge.h:608
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4052
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:648
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:552
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1763
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1426
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:762
NBNode * myTo
Definition: NBEdge.h:1733
const std::string & getID() const
Definition: NBEdge.h:1526
bool allowsChangingRight(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4283
double getDistance() const
get distance
Definition: NBEdge.h:685
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3923
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:4084
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1241
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:526
void setFriction(int lane, double friction)
set lane specific friction (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4068
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3776
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:4092
const NBEdge * getBidiEdge() const
Definition: NBEdge.h:1512
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:545
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:533
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:357
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4006
bool allowsChangingLeft(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4277
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:1138
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:962
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:615
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:4469
Represents a single node (junction) during network building.
Definition: NBNode.h:66
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2294
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
Definition: NBNode.cpp:2229
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
Definition: NBNode.h:326
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3619
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double x() const
Returns the x-position.
Definition: Position.h:55
double z() const
Returns the z-position.
Definition: Position.h:65
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
Definition: Position.h:262
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
int indexOfClosest(const Position &p, bool twoD=false) const
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
Definition: RGBColor.h:192
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.cpp:92
static const RGBColor ORANGE
Definition: RGBColor.h:191
static const RGBColor CYAN
Definition: RGBColor.h:189
static const RGBColor GREEN
Definition: RGBColor.h:186
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:371
static const RGBColor BLACK
Definition: RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:200
void setOffset(const double offset)
set offset
bool isDefined() const
check if stopOffset was defined
void reset()
reset stopOffset
void setExceptions(const std::string permissions)
set exceptions (used in NETEDIT)
std::string getExceptions() const
get exceptions (used in NETEDIT)
double getOffset() const
get offset
std::vector< std::string > getStrings() const
T get(const std::string &str) const
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool editingElevation() const
check if we're editing elevation
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool selectEdges() const
check if select edges checkbox is enabled
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source
RGBColor selectedEdgeColor
edge selection color
RGBColor selectedLaneColor
lane selection color
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double laneTextures
details for lane textures
static const double geometryPointsText
details for Geometry Points Texts
static const double laneGeometryPointRadius
moving lane geometry point radius
static const double junctionBubbleRadius
junction bubble radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double width
This lane's width.
Definition: NBEdge.h:176
StopOffset laneStopOffset
stopOffsets.second - The stop offset for vehicles stopping at the lane's end. Applies if vClass is in...
Definition: NBEdge.h:173
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:189
double endOffset
This lane's offset to the intersection begin.
Definition: NBEdge.h:169
std::string type
the type of this lane
Definition: NBEdge.h:192
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:179
SVCPermissions changeRight
List of vehicle types that are allowed to change right from this lane.
Definition: NBEdge.h:166
double friction
The friction on this lane.
Definition: NBEdge.h:154
SVCPermissions changeLeft
List of vehicle types that are allowed to change Left from this lane.
Definition: NBEdge.h:163
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:182
PositionVector shape
The lane's shape.
Definition: NBEdge.h:148