Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNELane.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 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>
42
43#include "GNELane.h"
44#include "GNEInternalLane.h"
45#include "GNEConnection.h"
46#include "GNEEdgeTemplate.h"
47
48// ===========================================================================
49// FOX callback mapping
50// ===========================================================================
51
52// Object implementation
53FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
54
55// ===========================================================================
56// method definitions
57// ===========================================================================
58
59// ---------------------------------------------------------------------------
60// GNELane::LaneDrawingConstants - methods
61// ---------------------------------------------------------------------------
62
64 selectionScale(lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectorFrameScale : 1),
65 exaggeration(selectionScale * s.laneWidthExaggeration),
66 halfWidth2(exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2)),
67 halfWidth(lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2) {
68 // start drawing lane checking whether it is not too small
69 //selectionScale = lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectionScale : 1;
70 //exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
71 // compute lane-marking intersection points)
72 //halfWidth2 = exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2);
73
74 // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen
75 //halfWidth = lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2;
76}
77
78
80 selectionScale(0),
81 exaggeration(0),
82 halfWidth2(0),
83 halfWidth(0) {
84}
85
86// ---------------------------------------------------------------------------
87// GNELane - methods
88// ---------------------------------------------------------------------------
89
90GNELane::GNELane(GNEEdge* edge, const int index) :
91 GNENetworkElement(edge->getNet(), edge->getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE,
92 GUIIconSubSys::getIcon(GUIIcon::LANE), {}, {}, {}, {}, {}, {}),
93 myParentEdge(edge),
94 myIndex(index),
95 mySpecialColor(nullptr),
96 mySpecialColorValue(-1),
97myLane2laneConnections(this) {
98 // update centering boundary without updating grid
99 updateCenteringBoundary(false);
100}
101
102
104 GNENetworkElement(nullptr, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE,
105 GUIIconSubSys::getIcon(GUIIcon::LANE), {}, {}, {}, {}, {}, {}),
106myParentEdge(nullptr),
107myIndex(-1),
108mySpecialColor(nullptr),
109mySpecialColorValue(-1),
110myLane2laneConnections(this) {
111}
112
113
115
116
117GNEEdge*
119 return myParentEdge;
120}
121
122
123bool
127
128
129const GUIGeometry&
131 return myLaneGeometry;
132}
133
134
135const PositionVector&
143
144
145const std::vector<double>&
149
150
151const std::vector<double>&
155
156
157void
159 // Clear texture containers
162 // get lane shape and extend if is too short
163 auto laneShape = getLaneShape();
164 if (laneShape.length2D() < 1) {
165 laneShape.extrapolate2D(1 - laneShape.length2D());
166 }
167 // Obtain lane shape of NBEdge
169 // update connections
171 // update additionals children associated with this lane
172 for (const auto& additional : getParentAdditionals()) {
173 additional->updateGeometry();
174 }
175 // update additionals parents associated with this lane
176 for (const auto& additional : getChildAdditionals()) {
177 additional->updateGeometry();
178 }
179 // update partial demand elements parents associated with this lane
180 for (const auto& demandElement : getParentDemandElements()) {
181 demandElement->updateGeometry();
182 }
183 // update partial demand elements children associated with this lane
184 for (const auto& demandElement : getChildDemandElements()) {
185 demandElement->updateGeometry();
186 }
187 // Update geometry of parent generic datas that have this edge as parent
188 for (const auto& additionalParent : getParentGenericDatas()) {
189 additionalParent->updateGeometry();
190 }
191 // Update geometry of additionals generic datas vinculated to this edge
192 for (const auto& childAdditionals : getChildGenericDatas()) {
193 childAdditionals->updateGeometry();
194 }
195 // compute geometry of path elements elements vinculated with this lane (depending of showDemandElements)
197 for (const auto& childAdditional : getChildAdditionals()) {
198 childAdditional->computePathElement();
199 }
200 for (const auto& childDemandElement : getChildDemandElements()) {
201 childDemandElement->computePathElement();
202 }
203 for (const auto& childGenericData : getChildGenericDatas()) {
204 childGenericData->computePathElement();
205 }
206 }
207 // in Move mode, connections aren't updated
209 // Update incoming connections of this lane
210 const auto incomingConnections = getGNEIncomingConnections();
211 for (const auto& connection : incomingConnections) {
212 connection->updateGeometry();
213 }
214 // Update outgoings connections of this lane
215 const auto outGoingConnections = getGNEOutcomingConnections();
216 for (const auto& connection : outGoingConnections) {
217 connection->updateGeometry();
218 }
219 }
220 // if lane has enought length for show textures of restricted lanes
221 if ((getLaneShapeLength() > 4)) {
222 // if lane is restricted
224 // get values for position and rotation of icons
225 for (int i = 2; i < getLaneShapeLength() - 1; i += 15) {
228 }
229 }
230 }
231}
232
233
236 return getLaneShape().positionAtOffset2D(getLaneShape().length2D() * 0.5);
237}
238
239
242 // edit depending if shape is being edited
243 if (isShapeEdited()) {
244 // calculate move shape operation
247 } else {
248 return nullptr;
249 }
250}
251
252
253void
254GNELane::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
255 // edit depending if shape is being edited
256 if (isShapeEdited()) {
257 // get original shape
259 // check shape size
260 if (shape.size() > 2) {
261 // obtain index
262 int index = shape.indexOfClosest(clickedPosition);
263 // get snap radius
265 // check if we have to create a new index
266 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
267 // remove geometry point
268 shape.erase(shape.begin() + index);
269 // commit new shape
270 undoList->begin(GUIIcon::CROSSING, "remove geometry point of " + getTagStr());
272 undoList->end();
273 }
274 }
275 }
276}
277
278
279void
281 // only draw links number depending of the scale and if isn't being drawn for selecting
282 if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
283 // first check that drawLinkJunctionIndex must be drawn
285 // get connections
286 const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
287 // get number of links
288 const int noLinks = (int)cons.size();
289 // only continue if there is links
290 if (noLinks > 0) {
291 // push link matrix
293 // move front
294 glTranslated(0, 0, GLO_TEXTNAME);
295 // calculate width
296 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
297 // get X1
298 double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
299 // iterate over links
300 for (int i = noLinks; --i >= 0;) {
301 // calculate x2
302 const double x2 = x1 - (double)(width / 2.);
303 // get link index
305 cons[s.lefthand ? noLinks - 1 - i : i]);
306 // draw link index
308 // update x1
309 x1 -= width;
310 }
311 // pop link matrix
313 }
314 }
315 // draw TLSLink No
317 // get connections
318 const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
319 // get numer of links
320 const int noLinks = (int)cons.size();
321 // only continue if there are links
322 if (noLinks > 0) {
323 // push link matrix
325 // move t front
326 glTranslated(0, 0, GLO_TEXTNAME);
327 // calculate width
328 const double w = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
329 // calculate x1
330 double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
331 // iterate over links
332 for (int i = noLinks; --i >= 0;) {
333 // calculate x2
334 const double x2 = x1 - (double)(w / 2.);
335 // get link number
336 const int linkNo = cons[s.lefthand ? noLinks - 1 - i : i].tlLinkIndex;
337 // draw link number
339 // update x1
340 x1 -= w;
341 }
342 // pop link matrix
344 }
345 }
346 }
347}
348
349
350void
351GNELane::drawArrows(const GUIVisualizationSettings& s, const bool spreadSuperposed) const {
353 // calculate begin, end and rotation
354 const Position& begin = myLaneGeometry.getShape()[-2];
355 const Position& end = myLaneGeometry.getShape().back();
356 const double rot = GUIGeometry::calculateRotation(begin, end);
357 // push arrow matrix
359 // move front (note: must draw on top of junction shape?
360 glTranslated(0, 0, 0.5);
361 // change color depending of spreadSuperposed
362 if (spreadSuperposed) {
364 } else {
366 }
367 // move to end
368 glTranslated(end.x(), end.y(), 0);
369 // rotate
370 glRotated(rot, 0, 0, 1);
371 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
372 if (width < SUMO_const_laneWidth) {
373 glScaled(width / SUMO_const_laneWidth, 1, 1);
374 }
375 // get destiny node
376 const NBNode* dest = myParentEdge->getNBEdge()->myTo;
377 // draw all links iterating over connections
378 for (const auto& connection : myParentEdge->getNBEdge()->myConnections) {
379 if (connection.fromLane == myIndex) {
380 // get link direction
381 LinkDirection dir = dest->getDirection(myParentEdge->getNBEdge(), connection.toEdge, s.lefthand);
382 // draw depending of link direction
383 switch (dir) {
385 GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
386 GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
387 break;
389 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
390 GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
391 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
392 break;
394 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
395 GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
396 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
397 break;
399 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
400 GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
401 GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
402 GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
403 break;
405 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
406 GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
407 GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
408 GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
409 break;
411 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
412 GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
413 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
414 break;
416 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
417 GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
418 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
419 break;
421 GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
422 GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
423 glTranslated(0, 5, 0);
424 GLHelper::drawOutlineCircle(0.9, 0.8, 32);
425 glTranslated(0, -5, 0);
426 break;
427 }
428 }
429 }
430 // pop arrow matrix
432 }
433}
434
435
436void
439 glTranslated(0, 0, 0.1); // must draw on top of junction shape
440 std::vector<NBEdge::Connection> connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
442 const Position& startPos = myLaneGeometry.getShape()[-1];
443 for (auto it : connections) {
444 const LinkState state = node->getLinkState(myParentEdge->getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
445 switch (state) {
447 glColor3d(1, 1, 0);
448 break;
450 glColor3d(0, 1, 1);
451 break;
452 case LINKSTATE_MAJOR:
453 glColor3d(1, 1, 1);
454 break;
455 case LINKSTATE_MINOR:
456 glColor3d(.4, .4, .4);
457 break;
458 case LINKSTATE_STOP:
459 glColor3d(.7, .4, .4);
460 break;
461 case LINKSTATE_EQUAL:
462 glColor3d(.7, .7, .7);
463 break;
465 glColor3d(.7, .7, 1);
466 break;
467 case LINKSTATE_ZIPPER:
468 glColor3d(.75, .5, 0.25);
469 break;
470 default:
471 throw ProcessError(TLF("Unexpected LinkState '%'", toString(state)));
472 }
473 const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
474 glBegin(GL_LINES);
475 glVertex2d(startPos.x(), startPos.y());
476 glVertex2d(endPos.x(), endPos.y());
477 glEnd();
478 GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
479 }
481}
482
483
484void
486 // get lane drawing constants
487 const LaneDrawingConstants laneDrawingConstants(s, this);
488 // get lane color
489 const RGBColor color = setLaneColor(s);
490 // avoid draw invisible elements
491 if (color.alpha() == 0) {
492 return;
493 }
494 // get flag for draw lane as railway
495 const bool drawRailway = drawAsRailway(s);
496 // we draw the lanes with reduced width so that the lane markings below are visible (this avoids artifacts at geometry corners without having to)
497 const bool spreadSuperposed = s.spreadSuperposed && drawRailway && myParentEdge->getNBEdge()->isBidiRail();
498 // Push edge parent name
500 // Push lane name
502 // Push layer matrix
504 // translate to front (note: Special case)
506 glTranslated(0, 0, GLO_FRONTELEMENT);
509 } else {
511 }
512 // recognize full transparency and simply don't draw
513 if ((color.alpha() == 0) || ((s.scale * laneDrawingConstants.exaggeration) < s.laneMinSize)) {
514 // Pop draw matrix 1
516 // Pop Lane Name
518 } else {
519 if ((s.scale * laneDrawingConstants.exaggeration) < 1.) {
520 // draw lane as line, depending of myShapeColors
521 if (myShapeColors.size() > 0) {
523 } else {
525 }
526 } else {
527 // Check if lane has to be draw as railway and if isn't being drawn for selecting
528 if (drawRailway && (!s.drawForRectangleSelection || spreadSuperposed)) {
529 // draw as railway
530 drawLaneAsRailway(s, laneDrawingConstants);
531 } else {
532 double offset = 0;
533 double widthFactor = 1;
534 if (s.spreadSuperposed && myParentEdge->getNBEdge()->getBidiEdge() != nullptr) {
535 widthFactor = 0.4; // create visible gap
536 offset = laneDrawingConstants.halfWidth * 0.5;
537 }
538 // draw as box lines
540 }
541 if (laneDrawingConstants.halfWidth != laneDrawingConstants.halfWidth2 && !spreadSuperposed) {
542 // Push matrix
544 // move back
545 glTranslated(0, 0, -0.1);
546 // set selected edge color
548 // draw again to show the selected edge
550 // Pop matrix
552 }
553 // only draw details depending of the scale and if isn't being drawn for selecting
554 if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
555 // draw markings
556 drawMarkings(s, laneDrawingConstants.exaggeration, drawRailway);
557 // Draw direction indicators
558 drawDirectionIndicators(s, laneDrawingConstants.exaggeration, drawRailway, spreadSuperposed);
559 }
560 // draw lane textures
561 drawTextures(s, laneDrawingConstants);
562 // draw start end shape points
564 }
565 // draw stopOffsets
566 const auto& laneStopOffset = myParentEdge->getNBEdge()->getLaneStruct(myIndex).laneStopOffset;
567 if (laneStopOffset.isDefined() && (laneStopOffset.getPermissions() & SVC_PASSENGER) != 0) {
568 drawLaneStopOffset(s, laneStopOffset.getOffset());
569 }
570 // Pop layer matrix
572 // draw lane arrows
573 drawLaneArrows(s, laneDrawingConstants.exaggeration, spreadSuperposed);
574 // draw shape edited
576 // Pop lane Name
578 // Pop edge Name
580 // draw link numbers
581 drawLinkNo(s);
582 // draw lock icon
584 // check if mouse is over element
585 checkMouseOverLane(laneDrawingConstants.halfWidth);
586 // draw dotted contours
587 drawDottedContours(s, drawRailway, laneDrawingConstants.halfWidth);
588 // draw children
589 drawChildren(s);
590 // draw path additional elements
592 }
593}
594
595
596void
598 // Check if edge can be deleted
600 myNet->deleteLane(this, myNet->getViewNet()->getUndoList(), false);
601 }
602}
603
604
605void
609
610
611void
613 // draw additional children
614 for (const auto& additional : getChildAdditionals()) {
615 // check that ParkingAreas aren't draw two times
616 additional->drawGL(s);
617 }
618 // draw demand element children
619 for (const auto& demandElement : getChildDemandElements()) {
620 if (!demandElement->getTagProperty().isPlacedInRTree()) {
621 demandElement->drawGL(s);
622 }
623 }
624}
625
626
627void
628GNELane::drawMarkings(const GUIVisualizationSettings& s, const double exaggeration, const bool drawRailway) const {
629 if (s.laneShowBorders && (exaggeration == 1) && !drawRailway) {
630 const double myHalfLaneWidth = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
632 glTranslated(0, 0, 0.1);
633 // optionally draw inverse markings
634 bool haveChangeProhibitions = false;
639 3, 6, myHalfLaneWidth, cl, cr, s.lefthand, exaggeration);
640 haveChangeProhibitions = !(cl && cr);
641 }
644 if (haveChangeProhibitions) {
645 // highlightchange prohibitions
646 glTranslated(0, 0, -0.05);
648 const double offset = myHalfLaneWidth * exaggeration * (s.lefthand ? -1 : 1);
649 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), myLaneGeometry, (myHalfLaneWidth * 0.5) * exaggeration, offset);
650 glTranslated(0, 0, +0.05);
651 }
652 // draw white boundings and white markings
653 glTranslated(0, 0, -0.1);
657 }
658}
659
660
663 // first obtain edit mode (needed because certain Commands depend of current edit mode)
665 // get mouse position
666 const auto mousePosition = myNet->getViewNet()->getPositionInformation();
667 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
668 buildPopupHeader(ret, app);
670 // build copy names entry
671 if (editMode != NetworkEditMode::NETWORK_TLS) {
672 GUIDesigns::buildFXMenuCommand(ret, TL("Copy parent edge name to clipboard"), nullptr, ret, MID_COPY_EDGE_NAME);
674 }
675 // stop if we're in data mode
677 return ret;
678 }
679 // build lane selection
682 } else {
684 }
685 // build edge selection
688 } else {
690 }
691 // stop if we're in data mode
693 return ret;
694 }
695 // add separator
696 new FXMenuSeparator(ret);
697 if (editMode != NetworkEditMode::NETWORK_TLS) {
698 // build show parameters menu
700 // build position copy entry
701 buildPositionCopyEntry(ret, app);
702 }
703 // check if we're in supermode network
705 // create end point
706 FXMenuCommand* resetEndPoints = GUIDesigns::buildFXMenuCommand(ret, TL("Reset edge end points"), nullptr, &parent, MID_GNE_RESET_GEOMETRYPOINT);
707 // enable or disable reset end points
709 resetEndPoints->enable();
710 } else {
711 resetEndPoints->disable();
712 }
713 // check if we clicked over a geometry point
714 if ((editMode == NetworkEditMode::NETWORK_MOVE) && myParentEdge->clickedOverGeometryPoint(mousePosition)) {
715 GUIDesigns::buildFXMenuCommand(ret, TL("Set custom Geometry Point"), nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
716 }
717 // add separator
718 new FXMenuSeparator(ret);
719 //build operations
720 if ((editMode != NetworkEditMode::NETWORK_CONNECT) && (editMode != NetworkEditMode::NETWORK_TLS)) {
721 // build edge operations
722 buildEdgeOperations(parent, ret);
723 // build lane operations
724 buildLaneOperations(parent, ret);
725 // build template operations
726 buildTemplateOperations(parent, ret);
727 // add separator
728 new FXMenuSeparator(ret);
729 // build rechable operations
730 buildRechableOperations(parent, ret);
731 } else if (editMode == NetworkEditMode::NETWORK_TLS) {
733 GUIDesigns::buildFXMenuCommand(ret, TL("Select state for all links from this edge:"), nullptr, nullptr, 0);
734 const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
735 for (auto it : names) {
736 FXuint state = GNEInternalLane::LinkStateNames.get(it);
737 FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
740 }
741 }
742 } else {
743 FXMenuCommand* mc = GUIDesigns::buildFXMenuCommand(ret, TL("Additional options available in 'Inspect Mode'"), nullptr, nullptr, 0);
744 mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
745 }
746 // build shape positions menu
747 if (editMode != NetworkEditMode::NETWORK_TLS) {
748 new FXMenuSeparator(ret);
749 // get lane shape
750 const auto& laneShape = myLaneGeometry.getShape();
751 // get variables
752 const double pos = laneShape.nearest_offset_to_point2D(mousePosition);
753 const Position firstAnglePos = laneShape.positionAtOffset2D(pos - 0.001);
754 const Position secondAnglePos = laneShape.positionAtOffset2D(pos);
755 const double angle = firstAnglePos.angleTo2D(secondAnglePos);
756
757 // build menu commands
758 GUIDesigns::buildFXMenuCommand(ret, TL("Shape pos: ") + toString(pos), nullptr, nullptr, 0);
759 GUIDesigns::buildFXMenuCommand(ret, TL("Length pos: ") + toString(pos * getLaneParametricLength() / getLaneShapeLength()), nullptr, nullptr, 0);
760 if (myParentEdge->getNBEdge()->getDistance() != 0) {
761 GUIDesigns::buildFXMenuCommand(ret, TL("Distance: ") + toString(myParentEdge->getNBEdge()->getDistancAt(pos)), nullptr, nullptr, 0);
762 }
763 GUIDesigns::buildFXMenuCommand(ret, TL("Height: ") + toString(firstAnglePos.z()), nullptr, nullptr, 0);
764 GUIDesigns::buildFXMenuCommand(ret, TL("Angle: ") + toString((GeomHelper::naviDegree(angle))), nullptr, nullptr, 0);
765 }
766 }
767 return ret;
768}
769
770
771double
773 return s.addSize.getExaggeration(s, this);
774}
775
776
777void
785
786
787int
789 return myIndex;
790}
791
792void
794 myIndex = index;
796}
797
798
799double
803
804
805double
807 double laneParametricLength = myParentEdge->getNBEdge()->getLoadedLength();
808 if (laneParametricLength > 0) {
809 return laneParametricLength;
810 } else {
811 throw ProcessError(TL("Lane Parametric Length cannot be never 0"));
812 }
813}
814
815
816double
820
821
822bool
826
827
832
833
834std::string
836 const NBEdge* edge = myParentEdge->getNBEdge();
837 switch (key) {
838 case SUMO_ATTR_ID:
839 return getMicrosimID();
840 case SUMO_ATTR_SPEED:
841 return toString(edge->getLaneSpeed(myIndex));
842 case SUMO_ATTR_ALLOW:
850 case SUMO_ATTR_WIDTH:
852 return "default";
853 } else {
854 return toString(edge->getLaneStruct(myIndex).width);
855 }
857 return toString(edge->getLaneStruct(myIndex).friction);
866 case SUMO_ATTR_TYPE:
867 return edge->getLaneStruct(myIndex).type;
868 case SUMO_ATTR_INDEX:
869 return toString(myIndex);
875 } else {
876 return "";
877 }
878 case GNE_ATTR_PARENT:
879 return myParentEdge->getID();
884 default:
885 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
886 }
887}
888
889std::string
891 std::string result = getAttribute(key);
892 if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
893 result += " " + getVehicleClassNames(SVCAll, true);
894 }
895 return result;
896}
897
898
899void
900GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
901 switch (key) {
902 case SUMO_ATTR_ID:
903 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
904 case SUMO_ATTR_SPEED:
905 case SUMO_ATTR_ALLOW:
909 case SUMO_ATTR_WIDTH:
915 case SUMO_ATTR_TYPE:
916 case SUMO_ATTR_INDEX:
921 // no special handling
922 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
923 break;
924 default:
925 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
926 }
927}
928
929
930bool
931GNELane::isValid(SumoXMLAttr key, const std::string& value) {
932 switch (key) {
933 case SUMO_ATTR_ID:
934 case SUMO_ATTR_INDEX:
935 return false;
936 case SUMO_ATTR_SPEED:
937 return canParse<double>(value);
938 case SUMO_ATTR_ALLOW:
942 return canParseVehicleClasses(value);
943 case SUMO_ATTR_WIDTH:
944 if (value.empty() || (value == "default")) {
945 return true;
946 } else {
947 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
948 }
951 return canParse<double>(value) && (parse<double>(value) >= 0);
953 return canParse<bool>(value);
955 // A lane shape can either be empty or have more than 1 element
956 if (value.empty()) {
957 return true;
958 } else if (canParse<PositionVector>(value)) {
959 return parse<PositionVector>(value).size() > 1;
960 }
961 return false;
962 }
963 case GNE_ATTR_OPPOSITE: {
964 if (value.empty()) {
965 return true;
966 } else {
967 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
968 if (oppEdge == nullptr || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != value) {
969 return false;
970 }
971 NBEdge* edge = myParentEdge->getNBEdge();
972 if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) {
973 WRITE_WARNINGF(TL("Opposite lane '%' does not connect the same nodes as edge '%'!"), value, edge->getID());
974 return false;
975 }
976 return true;
977 }
978 }
979 case SUMO_ATTR_TYPE:
980 return true;
982 return canParse<double>(value) && (parse<double>(value) >= 0);
984 return canParseVehicleClasses(value);
986 return canParse<bool>(value);
989 default:
990 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
991 }
992}
993
994
995bool
997 switch (key) {
998 case SUMO_ATTR_ID:
999 case SUMO_ATTR_INDEX:
1000 return false;
1001 default:
1002 return true;
1003 }
1004}
1005
1006
1007bool
1009 const NBEdge* edge = myParentEdge->getNBEdge();
1010 switch (key) {
1011 case SUMO_ATTR_WIDTH:
1013 default:
1014 return false;
1015 }
1016}
1017
1018
1019const Parameterised::Map&
1023
1024
1025void
1026GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
1027 mySpecialColor = color;
1028 mySpecialColorValue = colorValue;
1029}
1030
1031// ===========================================================================
1032// private
1033// ===========================================================================
1034
1035void
1036GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
1037 // get parent edge
1038 NBEdge* edge = myParentEdge->getNBEdge();
1039 // get template editor
1041 // check if we have to update template
1042 const bool updateTemplate = templateEditor->getEdgeTemplate() ? (templateEditor->getEdgeTemplate()->getID() == myParentEdge->getID()) : false;
1043 switch (key) {
1044 case SUMO_ATTR_ID:
1045 case SUMO_ATTR_INDEX:
1046 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
1047 case SUMO_ATTR_SPEED:
1048 edge->setSpeed(myIndex, parse<double>(value));
1049 break;
1050 case SUMO_ATTR_ALLOW:
1052 break;
1053 case SUMO_ATTR_DISALLOW:
1055 break;
1058 break;
1061 break;
1062 case SUMO_ATTR_WIDTH:
1063 if (value.empty() || (value == "default")) {
1065 } else {
1066 edge->setLaneWidth(myIndex, parse<double>(value));
1067 }
1068 // update edge parent boundary
1070 break;
1071 case SUMO_ATTR_FRICTION:
1072 edge->setFriction(myIndex, parse<double>(value));
1073 break;
1075 edge->setEndOffset(myIndex, parse<double>(value));
1076 break;
1078 edge->setAcceleration(myIndex, parse<bool>(value));
1079 break;
1080 case SUMO_ATTR_CUSTOMSHAPE: {
1081 // set new shape
1082 edge->setLaneShape(myIndex, parse<PositionVector>(value));
1083 // update edge parent boundary
1085 break;
1086 }
1087 case GNE_ATTR_OPPOSITE: {
1088 if (value != "") {
1089 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
1090 oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = getID();
1091 } else {
1092 // reset prior oppEdge if existing
1093 const std::string oldValue = myParentEdge->getNBEdge()->getLaneStruct(myIndex).oppositeID;
1094 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(oldValue.substr(0, oldValue.rfind("_")));
1095 if (oppEdge != nullptr) {
1096 oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = "";
1097 }
1098 }
1100 break;
1101 }
1102 case SUMO_ATTR_TYPE:
1103 edge->getLaneStruct(myIndex).type = value;
1104 break;
1106 edge->getLaneStruct(myIndex).laneStopOffset.setOffset(parse<double>(value));
1107 break;
1109 if (value.empty()) {
1111 } else {
1113 }
1114 break;
1115 case GNE_ATTR_SELECTED:
1116 if (parse<bool>(value)) {
1118 } else {
1120 }
1121 break;
1124 break;
1125 default:
1126 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1127 }
1128 // update template
1129 if (updateTemplate) {
1130 templateEditor->setEdgeTemplate(myParentEdge);
1131 }
1132 // invalidate path calculator
1134}
1135
1136
1137void
1139 // set custom shape
1141 // update geometry
1143}
1144
1145
1146void
1148 // commit new shape
1149 undoList->begin(GUIIcon::LANE, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1151 undoList->end();
1152}
1153
1154
1155void
1156GNELane::drawLaneArrows(const GUIVisualizationSettings& s, const double exaggeration, const bool spreadSuperposed) const {
1157 // only draw details depending of the scale and if isn't being drawn for selecting
1158 if (((s.scale * exaggeration) >= 1.) && (s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
1159 // Push layer matrix
1161 // translate to front (note: Special case)
1163 glTranslated(0, 0, GLO_FRONTELEMENT);
1164 } else {
1166 }
1167 // draw arrows
1168 drawArrows(s, spreadSuperposed);
1169 // Pop layer matrix
1171 }
1172}
1173
1174
1175void
1177 // if shape is being edited, draw point and green line
1178 if (myShapeEdited) {
1179 // push shape edited matrix
1181 // translate
1183 // set selected edge color
1185 // draw again to show the selected edge
1187 // move front
1188 glTranslated(0, 0, 1);
1189 // color
1190 const RGBColor darkerColor = s.colorSettings.editShapeColor.changedBrightness(-32);
1191 // draw geometry points
1194 // Pop shape edited matrix
1196 }
1197}
1198
1199
1200void
1201GNELane::checkMouseOverLane(const double laneWidth) const {
1202 bool withinGeometry = false;
1203 if (myParentEdge->getLanes().size() == 1) {
1204 withinGeometry = mouseWithinGeometry(getLaneShape(), laneWidth);
1206 withinGeometry = mouseWithinGeometry(getLaneShape(), laneWidth, myParentEdge->getGUIGlObject());
1208 withinGeometry = mouseWithinGeometry(getLaneShape(), laneWidth, myParentEdge->getGUIGlObject());
1209 } else {
1210 withinGeometry = mouseWithinGeometry(getLaneShape(), laneWidth);
1211 }
1212 // check if mark lane (and their parent edge)
1213 if (withinGeometry && (gPostDrawing.markedLane == nullptr)) {
1214 // mark lane and their parent edge
1215 gPostDrawing.markedLane = this;
1217 }
1218}
1219
1220
1221void
1222GNELane::drawDottedContours(const GUIVisualizationSettings& s, const bool drawRailway, const double laneWidth) const {
1223 // check if dotted contours has to be drawn
1224 if (!drawRailway) {
1225 // inspect contour
1229 }
1230 // front contour
1231 if ((myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
1234 }
1235 // orange contour
1239 }
1240 // delete contour
1241 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
1243 }
1244 // select contour
1245 if (myNet->getViewNet()->drawSelectContour(this, this)) {
1247 }
1248 }
1249}
1250
1251
1254 // get inspected attribute carriers
1255 const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
1256 // declare a RGBColor variable
1257 RGBColor color;
1258 // get inspected AC
1259 const GNEAttributeCarrier* inspectedAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1260 // 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.
1261 if (inspectedAC && (inspectedAC->isAttributeCarrierSelected() == false) &&
1262 ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TRIP) || (inspectedAC->getTagProperty().getTag() == SUMO_TAG_FLOW))) {
1263 // obtain attribute "via"
1264 std::vector<std::string> viaEdges = parse<std::vector<std::string> >(inspectedAC->getAttribute(SUMO_ATTR_VIA));
1265 // iterate over viaEdges
1266 for (const auto& edge : viaEdges) {
1267 // check if parent edge is in the via edges
1268 if (myParentEdge->getID() == edge) {
1269 // set green color in GLHelper and return it
1270 color = RGBColor::GREEN;
1271 }
1272 }
1273 }
1274 if (mySpecialColor != nullptr) {
1275 // If special color is enabled, set it
1276 color = *mySpecialColor;
1277 } else if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1278 // override with special colors (unless the color scheme is based on selection)
1280 } else if (myParentEdge->drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1281 // override with special colors (unless the color scheme is based on selection)
1283 } else {
1284 // Get normal lane color
1285 const GUIColorer& c = s.laneColorer;
1286 if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1287 color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1288 }
1289 }
1290 // special color for conflicted candidate edges
1292 // extra check for route frame
1295 }
1296 }
1297 // special color for special candidate edges
1299 // extra check for route frame
1302 }
1303 }
1304 // special color for candidate edges
1306 // extra check for route frame
1309 }
1310 }
1311 // special color for source candidate edges
1314 }
1315 // special color for target candidate edges
1318 }
1319 // special color for invalid candidate edges
1322 }
1323 // special color for source candidate lanes
1324 if (mySourceCandidate) {
1326 }
1327 // special color for target candidate lanes
1328 if (myTargetCandidate) {
1330 }
1331 // special color for special candidate lanes
1332 if (mySpecialCandidate) {
1334 }
1335 // special color for possible candidate lanes
1336 if (myPossibleCandidate) {
1338 }
1339 // special color for conflicted candidate lanes
1342 }
1343 // special color for invalid candidate lanes
1344 if (myInvalidCandidate) {
1346 }
1347 // set color in GLHelper
1348 GLHelper::setColor(color);
1349 return color;
1350}
1351
1352
1353bool
1354GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1355 switch (activeScheme) {
1356 case 6: {
1357 double hue = GeomHelper::naviDegree(myLaneGeometry.getShape().beginEndAngle()); // [0-360]
1358 col = RGBColor::fromHSV(hue, 1., 1.);
1359 return true;
1360 }
1361 default:
1362 return false;
1363 }
1364}
1365
1366
1367bool
1369 const int activeScheme = c.getActive();
1370 myShapeColors.clear();
1371 switch (activeScheme) {
1372 case 9: // color by height at segment start
1373 for (PositionVector::const_iterator ii = myLaneGeometry.getShape().begin(); ii != myLaneGeometry.getShape().end() - 1; ++ii) {
1374 myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1375 }
1376 col = c.getScheme().getColor(getColorValue(s, 8));
1377 return true;
1378 case 11: // color by inclination at segment start
1379 for (int ii = 1; ii < (int)myLaneGeometry.getShape().size(); ++ii) {
1380 const double inc = (myLaneGeometry.getShape()[ii].z() - myLaneGeometry.getShape()[ii - 1].z()) / MAX2(POSITION_EPS, myLaneGeometry.getShape()[ii].distanceTo2D(myLaneGeometry.getShape()[ii - 1]));
1381 myShapeColors.push_back(c.getScheme().getColor(inc));
1382 }
1383 col = c.getScheme().getColor(getColorValue(s, 10));
1384 return true;
1385 default:
1386 return false;
1387 }
1388}
1389
1390
1391double
1392GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1393 const SVCPermissions myPermissions = myParentEdge->getNBEdge()->getPermissions(myIndex);
1394 if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1395 return mySpecialColorValue;
1396 }
1397 switch (activeScheme) {
1398 case 0:
1399 switch (myPermissions) {
1400 case SVC_PEDESTRIAN:
1401 return 1;
1402 case SVC_BICYCLE:
1403 return 2;
1404 case 0:
1405 // forbidden road or green verge
1406 return myParentEdge->getNBEdge()->getPermissions() == 0 ? 10 : 3;
1407 case SVC_SHIP:
1408 return 4;
1409 case SVC_AUTHORITY:
1410 return 8;
1411 default:
1412 break;
1413 }
1415 return 9;
1416 } else if (isRailway(myPermissions)) {
1417 if ((myPermissions & SVC_BUS) != 0) {
1418 return 6;
1419 } else {
1420 return 5;
1421 }
1422 } else if ((myPermissions & SVC_PASSENGER) != 0) {
1423 if ((myPermissions & (SVC_RAIL_CLASSES & ~SVC_RAIL_FAST)) != 0 && (myPermissions & SVC_SHIP) == 0) {
1424 return 6;
1425 } else {
1426 return 0;
1427 }
1428 } else {
1429 return 7;
1430 }
1431 case 1:
1433 case 2:
1434 return (double)myPermissions;
1435 case 3:
1437 case 4:
1438 return myParentEdge->getNBEdge()->getNumLanes();
1439 case 5: {
1441 }
1442 // case 6: by angle (functional)
1443 case 7: {
1444 return myParentEdge->getNBEdge()->getPriority();
1445 }
1446 case 8: {
1447 // color by z of first shape point
1448 return myLaneGeometry.getShape()[0].z();
1449 }
1450 // case 9: by segment height
1451 case 10: {
1452 // color by incline
1453 return (myLaneGeometry.getShape()[-1].z() - myLaneGeometry.getShape()[0].z()) / myParentEdge->getNBEdge()->getLength();
1454 }
1455 // case 11: by segment incline
1456
1457 case 12: {
1458 // by numerical edge param value
1460 try {
1462 } catch (NumberFormatException&) {
1463 try {
1465 } catch (BoolFormatException&) {
1466 return -1;
1467 }
1468 }
1469 } else {
1471 }
1472 }
1473 case 13: {
1474 // by numerical lane param value
1476 try {
1478 } catch (NumberFormatException&) {
1479 try {
1481 } catch (BoolFormatException&) {
1482 return -1;
1483 }
1484 }
1485 } else {
1487 }
1488 }
1489 case 14: {
1490 return myParentEdge->getNBEdge()->getDistance();
1491 }
1492 case 15: {
1493 return fabs(myParentEdge->getNBEdge()->getDistance());
1494 }
1495 }
1496 return 0;
1497}
1498
1499
1500bool
1506
1507
1508void
1509GNELane::drawOverlappedRoutes(const int numRoutes) const {
1510 // get middle point and angle
1513 // Push route matrix
1515 // translate to front
1516 glTranslated(0, 0, GLO_ROUTE + 1);
1517 // get middle
1518 GLHelper::drawText(toString(numRoutes) + " routes", center, 0, 1.8, RGBColor::BLACK, angle + 90);
1519 // pop route matrix
1521
1522}
1523
1524
1525void
1526GNELane::drawLaneStopOffset(const GUIVisualizationSettings& s, const double offset) const {
1527 GNELane::LaneDrawingConstants laneDrawingConstants(s, this);
1528 const Position& end = getLaneShape().back();
1529 const Position& f = getLaneShape()[-2];
1530 const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
1533 glTranslated(end.x(), end.y(), 1);
1534 glRotated(rot, 0, 0, 1);
1535 glTranslated(0, offset, 0);
1536 glBegin(GL_QUADS);
1537 glVertex2d(-laneDrawingConstants.halfWidth, 0.0);
1538 glVertex2d(-laneDrawingConstants.halfWidth, 0.2);
1539 glVertex2d(laneDrawingConstants.halfWidth, 0.2);
1540 glVertex2d(laneDrawingConstants.halfWidth, 0.0);
1541 glEnd();
1543}
1544
1545
1546bool
1548 return isWaterway(myParentEdge->getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForRectangleSelection; // reusing the showRails setting
1549}
1550
1551
1552void
1553GNELane::drawDirectionIndicators(const GUIVisualizationSettings& s, double exaggeration, const bool drawAsRailway, const bool spreadSuperposed) const {
1554 // Draw direction indicators if the correspondient option is enabled
1555 if (s.showLaneDirection) {
1556 // improve visibility of superposed rail edges
1557 if (drawAsRailway) {
1558 setLaneColor(s);
1559 } else {
1560 glColor3d(0.3, 0.3, 0.3);
1561 }
1562 // get width and sideOffset
1563 const double width = MAX2(NUMERICAL_EPS, (myParentEdge->getNBEdge()->getLaneWidth(myIndex) * exaggeration * (spreadSuperposed ? 0.4 : 1)));
1564 const double sideOffset = spreadSuperposed ? width * -0.5 : 0;
1565 // push direction indicator matrix
1567 // move to front
1568 glTranslated(0, 0, 0.1);
1569 // iterate over shape
1570 for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
1571 // push triangle matrix
1573 // move front
1574 glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
1575 // rotate
1576 glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
1577 // calculate subwidth
1578 for (double subWidth = 0; subWidth < myLaneGeometry.getShapeLengths()[i]; subWidth += width) {
1579 // calculate length
1580 const double length = MIN2(width * 0.5, myLaneGeometry.getShapeLengths()[i] - subWidth);
1581 // draw triangle
1582 glBegin(GL_TRIANGLES);
1583 glVertex2d(sideOffset, -subWidth - length);
1584 glVertex2d(sideOffset - width * 0.25, -subWidth);
1585 glVertex2d(sideOffset + width * 0.25, -subWidth);
1586 glEnd();
1587 }
1588 // pop triangle matrix
1590 }
1591 // pop direction indicator matrix
1593 }
1594}
1595
1596
1597void
1599 // we draw the lanes with reduced width so that the lane markings below are visible
1600 // (this avoids artifacts at geometry corners without having to
1601 const bool spreadSuperposed = s.spreadSuperposed && myParentEdge->getNBEdge()->getBidiEdge() != nullptr;
1602 // get lane shape
1604 // get width
1605 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
1606 // draw as railway: assume standard gauge of 1435mm when lane width is not set
1607 // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
1608 // assume crosstie length of 181% gauge (2600mm for standard gauge)
1609 double halfGauge = 0.5 * (width == SUMO_const_laneWidth ? 1.4350 : width) * laneDrawingConstants.exaggeration;
1610 // check if we have to modify shape
1611 if (spreadSuperposed) {
1612 shape.move2side(halfGauge * 0.8);
1613 halfGauge *= 0.4;
1614 //std::cout << "spreadSuperposed " << getID() << " old=" << myLaneGeometry.getShape() << " new=" << shape << "\n";
1615 }
1616 // calculate constant
1617 const double halfInnerFeetWidth = halfGauge - 0.039 * laneDrawingConstants.exaggeration;
1618 const double halfRailWidth = halfInnerFeetWidth + 0.15 * laneDrawingConstants.exaggeration;
1619 const double halfCrossTieWidth = halfGauge * 1.81;
1620 // Draw lane geometry
1622 // Save current color
1623 RGBColor current = GLHelper::getColor();
1624 // Draw gray on top with reduced width (the area between the two tracks)
1625 glColor3d(0.8, 0.8, 0.8);
1626 // move
1627 glTranslated(0, 0, 0.1);
1628 // draw lane geometry again
1630 // Set current color back
1631 GLHelper::setColor(current);
1632 // Draw crossties
1633 GLHelper::drawCrossTies(shape, myLaneGeometry.getShapeRotations(), myLaneGeometry.getShapeLengths(), 0.26 * laneDrawingConstants.exaggeration, 0.6 * laneDrawingConstants.exaggeration, halfCrossTieWidth, s.drawForRectangleSelection);
1634 // check if dotted contours has to be drawn
1638 }
1639 if ((myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
1642 }
1643}
1644
1645
1646void
1647GNELane::drawTextures(const GUIVisualizationSettings& s, const LaneDrawingConstants& laneDrawingConstants) const {
1648 // check all conditions for drawing textures
1650 (myLaneRestrictedTexturePositions.size() > 0) &&
1651 s.drawDetail(s.detailSettings.laneTextures, laneDrawingConstants.exaggeration)) {
1652 // Declare default width of icon (3)
1653 double iconWidth = 1;
1654 // Obtain width of icon, if width of lane is different
1656 iconWidth = myParentEdge->getNBEdge()->getLaneStruct(myIndex).width / 3;
1657 }
1658 // Draw list of icons
1659 for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
1660 // Push draw matrix 2
1662 // Set white color
1663 glColor3d(1, 1, 1);
1664 // Translate matrix 2
1665 glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), 0.1);
1666 // Rotate matrix 2
1667 glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
1668 glRotated(90, 0, 0, 1);
1669 // draw texture box depending of type of restriction
1672 } else if (isRestricted(SVC_BICYCLE)) {
1674 } else if (isRestricted(SVC_BUS)) {
1676 }
1677 // Pop draw matrix 2
1679 }
1680 }
1681}
1682
1683
1684void
1686 // draw a Start/endPoints if lane has a custom shape
1688 GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1689 if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1690 // override with special colors (unless the color scheme is based on selection)
1692 }
1693 // obtain circle width and resolution
1694 double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1695 // Obtain exaggeration of the draw
1696 const double exaggeration = getExaggeration(s);
1697 // obtain custom shape
1699 // draw s depending of detail
1700 if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1701 // push start matrix
1703 // move to shape start position
1704 glTranslated(customShape.front().x(), customShape.front().y(), 0.1);
1705 // draw circle
1707 // check if we can draw "S"
1708 if (!s.drawForPositionSelection) {
1709 // move top
1710 glTranslated(0, 0, 0.1);
1711 // draw "S"
1712 GLHelper::drawText("S", Position(), 0.1, circleWidth, RGBColor::WHITE);
1713 }
1714 // pop start matrix
1716 }
1717 // draw line between junction and start position
1719 // move top
1720 glTranslated(0, 0, 0.1);
1721 // set line width
1722 glLineWidth(4);
1723 // draw line
1725 // pop line matrix
1727 // draw "e" depending of detail
1728 if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1729 // push start matrix
1731 // move to end position
1732 glTranslated(customShape.back().x(), customShape.back().y(), 0.1);
1733 // draw filled circle
1735 // check if we can draw "E"
1736 if (!s.drawForPositionSelection) {
1737 // move top
1738 glTranslated(0, 0, 0.1);
1739 // draw "E"
1740 GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1741 }
1742 // pop start matrix
1744 }
1745 // draw line between Junction and end position
1747 // move top
1748 glTranslated(0, 0, 0.1);
1749 // set line width
1750 glLineWidth(4);
1751 // draw line
1753 // pop line matrix
1755 }
1756}
1757
1758
1759std::string
1761 return myParentEdge->getID();
1762}
1763
1764
1765long
1766GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1767 myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1768 return 1;
1769}
1770
1771
1772std::vector<GNEConnection*>
1774 // Declare a vector to save incoming connections
1775 std::vector<GNEConnection*> incomingConnections;
1776 // Obtain incoming edges if junction source was already created
1777 GNEJunction* junctionSource = myParentEdge->getFromJunction();
1778 if (junctionSource) {
1779 // Iterate over incoming GNEEdges of junction
1780 for (auto i : junctionSource->getGNEIncomingEdges()) {
1781 // Iterate over connection of incoming edges
1782 for (auto j : i->getGNEConnections()) {
1783 if (j->getNBEdgeConnection().fromLane == getIndex()) {
1784 incomingConnections.push_back(j);
1785 }
1786 }
1787 }
1788 }
1789 return incomingConnections;
1790}
1791
1792
1793std::vector<GNEConnection*>
1795 // Obtain GNEConnection of parent edge
1796 const std::vector<GNEConnection*>& edgeConnections = myParentEdge->getGNEConnections();
1797 std::vector<GNEConnection*> outcomingConnections;
1798 // Obtain outgoing connections
1799 for (auto i : edgeConnections) {
1800 if (i->getNBEdgeConnection().fromLane == getIndex()) {
1801 outcomingConnections.push_back(i);
1802 }
1803 }
1804 return outcomingConnections;
1805}
1806
1807
1808void
1810 // update incoming connections of lane
1811 std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1812 for (auto i : incomingConnections) {
1813 i->updateID();
1814 }
1815 // update outcoming connections of lane
1816 std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1817 for (auto i : outcomingConnections) {
1818 i->updateID();
1819 }
1820}
1821
1822
1823double
1825 // factor should not be 0
1826 if (myParentEdge->getNBEdge()->getFinalLength() > 0) {
1827 return MAX2(POSITION_EPS, (getLaneShape().length() / myParentEdge->getNBEdge()->getFinalLength()));
1828 } else {
1829 return POSITION_EPS;
1830 };
1831}
1832
1833
1834void
1836 // Create basic commands
1837 std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1839 if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1840 edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
1841 }
1842 // create menu pane for edge operations
1843 FXMenuPane* edgeOperations = new FXMenuPane(ret);
1844 ret->insertMenuPaneChild(edgeOperations);
1845 if (edgeSelSize > 0) {
1846 new FXMenuCascade(ret, TLF("Edge operations (% selected)", toString(edgeSelSize)).c_str(), nullptr, edgeOperations);
1847 } else {
1848 new FXMenuCascade(ret, TL("Edge operations"), nullptr, edgeOperations);
1849 }
1850 // create menu commands for all edge operations
1851 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge here"), nullptr, &parent, MID_GNE_EDGE_SPLIT);
1852 auto splitBothDirections = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge in both directions here (no simmetric opposite edge)"), nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
1853 // check if allow split edge in both directions
1854 splitBothDirections->disable();
1855 const auto oppositeEdges = myParentEdge->getOppositeEdges();
1856 if (oppositeEdges.size() == 0) {
1857 splitBothDirections->setText(TL("Split edge in both directions here (no opposite edge)"));
1858 } else {
1859 for (const auto& oppositeEdge : oppositeEdges) {
1860 // get reverse inner geometry
1861 const auto reverseGeometry = oppositeEdge->getNBEdge()->getInnerGeometry().reverse();
1862 if (reverseGeometry == myParentEdge->getNBEdge()->getInnerGeometry()) {
1863 splitBothDirections->enable();
1864 splitBothDirections->setText(TL("Split edge in both directions here"));
1865 }
1866 }
1867 }
1868 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Set geometry endpoint here (shift-click)"), nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
1869 // restore geometry points depending of selection status
1871 if (edgeSelSize == 1) {
1872 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore both geometry endpoints"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1873 } else {
1874 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoints of all selected edges"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1875 }
1876 } else {
1877 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoint (shift-click)"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1878 }
1879 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reverse %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_REVERSE);
1880 auto reverse = GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
1881 if (myParentEdge->getReverseEdge() != nullptr) {
1882 reverse->disable();
1883 }
1884 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse disconnected direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED);
1885 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reset lengths for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_RESET_LENGTH);
1886 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
1887 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH);
1888 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
1889 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
1890}
1891
1892
1893void
1895 // Get icons
1896 FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_PEDESTRIAN);
1897 FXIcon* bikeIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BIKE);
1898 FXIcon* busIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BUS);
1899 FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEGREENVERGE);
1900 // declare number of selected lanes
1901 int numSelectedLanes = 0;
1902 // if lane is selected, calculate number of restricted lanes
1903 bool edgeHasSidewalk = false;
1904 bool edgeHasBikelane = false;
1905 bool edgeHasBuslane = false;
1906 bool differentLaneShapes = false;
1908 const auto selectedLanes = myNet->getAttributeCarriers()->getSelectedLanes();
1909 // update numSelectedLanes
1910 numSelectedLanes = (int)selectedLanes.size();
1911 // iterate over selected lanes
1912 for (const auto& selectedLane : selectedLanes) {
1913 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN)) {
1914 edgeHasSidewalk = true;
1915 }
1916 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BICYCLE)) {
1917 edgeHasBikelane = true;
1918 }
1919 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BUS)) {
1920 edgeHasBuslane = true;
1921 }
1922 if (selectedLane->myParentEdge->getNBEdge()->getLaneStruct(selectedLane->getIndex()).customShape.size() != 0) {
1923 differentLaneShapes = true;
1924 }
1925 }
1926 } else {
1927 edgeHasSidewalk = myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN);
1928 edgeHasBikelane = myParentEdge->hasRestrictedLane(SVC_BICYCLE);
1929 edgeHasBuslane = myParentEdge->hasRestrictedLane(SVC_BUS);
1930 differentLaneShapes = myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
1931 }
1932 // create menu pane for lane operations
1933 FXMenuPane* laneOperations = new FXMenuPane(ret);
1934 ret->insertMenuPaneChild(laneOperations);
1935 if (numSelectedLanes > 0) {
1936 new FXMenuCascade(ret, TLF("Lane operations (% selected)", toString(numSelectedLanes)).c_str(), nullptr, laneOperations);
1937 } else {
1938 new FXMenuCascade(ret, TL("Lane operations"), nullptr, laneOperations);
1939 }
1940 GUIDesigns::buildFXMenuCommand(laneOperations, TL("Duplicate lane"), nullptr, &parent, MID_GNE_LANE_DUPLICATE);
1941 GUIDesigns::buildFXMenuCommand(laneOperations, TL("Set custom lane shape"), nullptr, &parent, MID_GNE_LANE_EDIT_SHAPE);
1942 FXMenuCommand* resetCustomShape = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset custom shape"), nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
1943 if (!differentLaneShapes) {
1944 resetCustomShape->disable();
1945 }
1946 FXMenuCommand* resetOppositeLane = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset opposite lane"), nullptr, &parent, MID_GNE_LANE_RESET_OPPOSITELANE);
1947 if (getAttribute(GNE_ATTR_OPPOSITE).empty()) {
1948 resetOppositeLane->disable();
1949 }
1950 // Create panel for lane operations and insert it in ret
1951 FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
1952 ret->insertMenuPaneChild(addSpecialLanes);
1953 FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
1954 ret->insertMenuPaneChild(removeSpecialLanes);
1955 FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
1956 ret->insertMenuPaneChild(transformSlanes);
1957 // Create menu comands for all add special lanes
1958 FXMenuCommand* addSidewalk = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
1959 FXMenuCommand* addBikelane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
1960 FXMenuCommand* addBuslane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_ADD_BUS);
1961 // if parent edge is selected, always add greenverge in front
1963 GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
1964 } else {
1965 GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (front)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
1966 GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (back)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_BACK);
1967 }
1968 // Create menu comands for all remove special lanes and disable it
1969 FXMenuCommand* removeSidewalk = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
1970 removeSidewalk->disable();
1971 FXMenuCommand* removeBikelane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
1972 removeBikelane->disable();
1973 FXMenuCommand* removeBuslane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
1974 removeBuslane->disable();
1975 FXMenuCommand* removeGreenVerge = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
1976 removeGreenVerge->disable();
1977 // Create menu comands for all transform special lanes and disable it
1978 FXMenuCommand* transformLaneToSidewalk = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
1979 FXMenuCommand* transformLaneToBikelane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
1980 FXMenuCommand* transformLaneToBuslane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
1981 FXMenuCommand* transformLaneToGreenVerge = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
1982 // add menuCascade for lane operations
1983 new FXMenuCascade(laneOperations, TLF("Add restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
1984 FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, TLF("Remove restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
1985 new FXMenuCascade(laneOperations, TLF("Transform to restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
1986 // Enable and disable options depending of current transform of the lane
1987 if (edgeHasSidewalk) {
1988 transformLaneToSidewalk->disable();
1989 addSidewalk->disable();
1990 removeSidewalk->enable();
1991 }
1992 if (edgeHasBikelane) {
1993 transformLaneToBikelane->disable();
1994 addBikelane->disable();
1995 removeBikelane->enable();
1996 }
1997 if (edgeHasBuslane) {
1998 transformLaneToBuslane->disable();
1999 addBuslane->disable();
2000 removeBuslane->enable();
2001 }
2003 transformLaneToGreenVerge->disable();
2004 removeGreenVerge->enable();
2005 }
2006 // Check if cascade menu must be disabled
2007 if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !isRestricted(SVC_IGNORING)) {
2008 cascadeRemoveSpecialLane->disable();
2009 }
2010 // for whatever reason, sonar complains in the next line that cascadeRemoveSpecialLane may leak, but fox does the cleanup
2011} // NOSONAR
2012
2013
2014void
2016 // Create basic commands
2017 std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
2019 if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
2020 edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
2021 }
2022 // create menu pane for edge operations
2023 FXMenuPane* edgeOperations = new FXMenuPane(ret);
2024 ret->insertMenuPaneChild(edgeOperations);
2025 if (edgeSelSize > 0) {
2026 new FXMenuCascade(ret, TLF("Template operations (% selected)", toString(edgeSelSize)).c_str(), nullptr, edgeOperations);
2027 } else {
2028 new FXMenuCascade(ret, TL("Template operations"), nullptr, edgeOperations);
2029 }
2030 // create menu commands for all edge operations
2031 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Use edge as template"), nullptr, &parent, MID_GNE_EDGE_USEASTEMPLATE);
2032 auto applyTemplate = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Apply template"), nullptr, &parent, MID_GNE_EDGE_APPLYTEMPLATE);
2033 // check if disable apply template
2035 applyTemplate->disable();
2036 }
2037
2038}
2039
2040
2041void
2043 // addreachability menu
2044 FXMenuPane* reachableByClass = new FXMenuPane(ret);
2045 ret->insertMenuPaneChild(reachableByClass);
2046 if (myNet->isNetRecomputed()) {
2047 new FXMenuCascade(ret, TL("Select reachable"), GUIIconSubSys::getIcon(GUIIcon::MODEVEHICLE), reachableByClass);
2048 for (const auto& vClass : SumoVehicleClassStrings.getStrings()) {
2049 GUIDesigns::buildFXMenuCommand(reachableByClass, vClass.c_str(), VClassIcons::getVClassIcon(SumoVehicleClassStrings.get(vClass)), &parent, MID_REACHABILITY);
2050 }
2051 } else {
2052 FXMenuCommand* menuCommand = GUIDesigns::buildFXMenuCommand(ret, TL("Select reachable (compute junctions)"), nullptr, nullptr, 0);
2053 menuCommand->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
2054 }
2055}
2056
2057/****************************************************************************/
2058
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:817
@ MID_GNE_LANE_EDIT_SHAPE
edit lane shape
@ MID_GNE_LANE_TRANSFORM_BIKE
transform lane to bikelane
@ MID_GNE_EDGE_REVERSE
reverse an edge
@ MID_ADDSELECT
Add to selected items - menu entry.
Definition GUIAppEnum.h:478
@ MID_GNE_LANE_ADD_BUS
add busLane
@ MID_GNE_REMOVESELECT_EDGE
Remove edge from selected items - Menu Entry.
Definition GUIAppEnum.h:819
@ MID_GNE_EDGE_STRAIGHTEN_ELEVATION
interpolate z values linear between junctions
@ MID_GNE_EDGE_SMOOTH
smooth geometry
@ MID_GNE_LANE_RESET_CUSTOMSHAPE
reset custom shape
@ MID_GNE_EDGE_STRAIGHTEN
remove inner geometry
@ MID_GNE_LANE_TRANSFORM_BUS
transform lane to busLane
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition GUIAppEnum.h:452
@ MID_GNE_LANE_DUPLICATE
duplicate a lane
@ MID_GNE_LANE_ADD_GREENVERGE_FRONT
add greenVerge front of current lane
@ MID_GNE_LANE_REMOVE_GREENVERGE
remove greenVerge
@ MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED
add reverse edge disconnected (used for for spreadtype center)
@ MID_GNE_EDGE_SPLIT_BIDI
split an edge
@ MID_GNE_LANE_REMOVE_BIKE
remove bikelane
@ MID_GNE_LANE_RESET_OPPOSITELANE
reset opposite lane
@ MID_REACHABILITY
show reachability from a given lane
Definition GUIAppEnum.h:524
@ MID_GNE_EDGE_RESET_LENGTH
reset custom lengths
@ MID_GNE_LANE_REMOVE_BUS
remove busLane
@ MID_GNE_LANE_REMOVE_SIDEWALK
remove sidewalk
@ MID_GNE_EDGE_RESET_ENDPOINT
reset default geometry endpoints
@ MID_GNE_LANE_ADD_GREENVERGE_BACK
add greenVerge back of current lane
@ MID_GNE_EDGE_SMOOTH_ELEVATION
smooth elevation with regard to adjoining edges
@ MID_GNE_EDGE_ADD_REVERSE
add reverse edge
@ MID_GNE_EDGE_APPLYTEMPLATE
apply template
@ MID_GNE_EDGE_USEASTEMPLATE
use edge as tempalte
@ MID_GNE_LANE_ADD_SIDEWALK
add sidewalk
@ MID_GNE_RESET_GEOMETRYPOINT
reset geometry point
Definition GUIAppEnum.h:993
@ MID_GNE_LANE_TRANSFORM_SIDEWALK
transform lane to sidewalk
@ MID_GNE_LANE_ADD_BIKE
add bikelane
@ MID_GNE_EDGE_SPLIT
split an edge
@ MID_GNE_LANE_TRANSFORM_GREENVERGE
transform lane to greenVerge
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
Definition GUIAppEnum.h:991
@ MID_GNE_EDGE_EDIT_ENDPOINT
change default geometry endpoints
@ MID_REMOVESELECT
Remove from selected items - Menu Entry.
Definition GUIAppEnum.h:480
@ GLO_ROUTE
a route
@ GLO_JUNCTION
a junction
@ GLO_FRONTELEMENT
front element (used in netedit)
@ 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_WARNINGF(...)
Definition MsgHandler.h:271
#define TL(string)
Definition MsgHandler.h:287
#define TLF(string,...)
Definition MsgHandler.h:288
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 definition using from and to edges or a route
@ 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:76
const double SUMO_const_laneMarkWidth
Definition StdDefs.h:51
T MAX2(T a, T b)
Definition StdDefs.h:82
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
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 myInvalidCandidate
flag to mark this element as invalid candidate
bool isSpecialCandidate() const
check if this element is a special candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isInvalidCandidate() const
check if this element is a invalid 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:360
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:480
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
Definition GNEEdge.cpp:1541
bool clickedOverGeometryPoint(const Position &pos) const
return true if user clicked over a Geometry Point
Definition GNEEdge.cpp:319
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition GNEEdge.cpp:840
static const double SNAP_RADIUS
Definition GNEEdge.h:271
bool hasCustomEndPoints() const
Definition GNEEdge.cpp:287
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition GNEEdge.cpp:2075
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
Definition GNEEdge.cpp:416
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:846
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:82
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
const double exaggeration
exaggeration
Definition GNELane.h:62
LaneDrawingConstants()
default constructor
Definition GNELane.cpp:79
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:136
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition GNELane.cpp:1766
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition GNELane.cpp:829
~GNELane()
Destructor.
Definition GNELane.cpp:114
std::string getParentName() const
Returns the name of the parent object (if any)
Definition GNELane.cpp:1760
std::string getAttribute(SumoXMLAttr key) const
Definition GNELane.cpp:835
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:124
const RGBColor * mySpecialColor
optional special color
Definition GNELane.h:274
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition GNELane.cpp:235
bool isAttributeComputed(SumoXMLAttr key) const
Definition GNELane.cpp:1008
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition GNELane.cpp:1547
double getLengthGeometryFactor() const
get length geometry factor
Definition GNELane.cpp:1824
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNELane.cpp:996
void updateGeometry()
update pre-computed geometry information
Definition GNELane.cpp:158
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNELane.cpp:1138
GNEEdge * myParentEdge
parent edge (GNELanes cannot use hierarchical structures)
Definition GNELane.h:255
void deleteGLObject()
delete element
Definition GNELane.cpp:597
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition GNELane.cpp:890
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNELane.cpp:662
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:788
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNELane.cpp:772
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition GNELane.cpp:254
GUIGeometry myLaneGeometry
lane geometry
Definition GNELane.h:261
void drawShapeEdited(const GUIVisualizationSettings &s) const
draw shape edited
Definition GNELane.cpp:1176
void drawStartEndShapePoints(const GUIVisualizationSettings &s) const
draw start and end shape points
Definition GNELane.cpp:1685
void drawMarkings(const GUIVisualizationSettings &s, const double exaggeration, const bool drawRailway) const
draw lane markings
Definition GNELane.cpp:628
void drawOverlappedRoutes(const int numRoutes) const
draw overlapped routes
Definition GNELane.cpp:1509
void updateGLObject()
update GLObject (geometry, ID, etc.)
Definition GNELane.cpp:606
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNELane.cpp:241
void buildLaneOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build lane operations contextual menu
Definition GNELane.cpp:1894
GNELane()
FOX needs this.
Definition GNELane.cpp:103
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition GNELane.cpp:1794
const std::vector< double > & getShapeRotations() const
get rotations of the single shape parts
Definition GNELane.cpp:146
void drawTextures(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane textures
Definition GNELane.cpp:1647
void buildTemplateOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build template oerations contextual menu
Definition GNELane.cpp:2015
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:1368
void drawLaneAsRailway(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane as railway
Definition GNELane.cpp:1598
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNELane.cpp:1020
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition GNELane.cpp:806
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition GNELane.cpp:1253
bool isValid(SumoXMLAttr key, const std::string &value)
Definition GNELane.cpp:931
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition GNELane.cpp:1773
void checkMouseOverLane(const double laneWidth) const
check if mouse is over lane
Definition GNELane.cpp:1201
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition GNELane.cpp:1501
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition GNELane.cpp:823
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:1553
void setIndex(int index)
Definition GNELane.cpp:793
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNELane.cpp:485
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition GNELane.cpp:1026
const GUIGeometry & getLaneGeometry() const
Definition GNELane.cpp:130
void drawLaneArrows(const GUIVisualizationSettings &s, const double exaggeration, const bool spreadSuperposed) const
draw lane arrows
Definition GNELane.cpp:1156
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition GNELane.cpp:778
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:612
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:1147
double getLaneShapeLength() const
returns the length of the lane's shape
Definition GNELane.cpp:817
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:1392
bool setFunctionalColor(int activeScheme, RGBColor &col) const
sets the color according to the current scheme index and some lane function
Definition GNELane.cpp:1354
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition GNELane.cpp:1809
void drawArrows(const GUIVisualizationSettings &s, const bool spreadSuperposed) const
draw arrows
Definition GNELane.cpp:351
void buildRechableOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build rechable operations contextual menu
Definition GNELane.cpp:2042
void drawLaneStopOffset(const GUIVisualizationSettings &s, const double offset) const
draw laneStopOffset
Definition GNELane.cpp:1526
void drawLane2LaneConnections() const
draw lane to lane connections
Definition GNELane.cpp:437
void buildEdgeOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build edge operations contextual menu
Definition GNELane.cpp:1835
const std::vector< double > & getShapeLengths() const
get lengths of the single shape parts
Definition GNELane.cpp:152
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition GNELane.cpp:280
double getSpeed() const
returns the current speed of lane
Definition GNELane.cpp:800
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition GNELane.cpp:900
void drawDottedContours(const GUIVisualizationSettings &s, const bool drawRailway, const double laneWidth) const
draw dotted contours
Definition GNELane.cpp:1222
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:118
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:547
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:120
bool isNetRecomputed() const
check if net require recomputing
Definition GNENet.cpp:1412
GNEPathManager * getPathManager()
get path manager
Definition GNENet.cpp:132
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Definition GNENet.cpp:2042
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
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
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
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
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
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
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.
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 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.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
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.
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)
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)
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.
The representation of a single edge during network building.
Definition NBEdge.h:92
double getLaneSpeed(int lane) const
get lane speed
Definition NBEdge.cpp:2129
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:4223
double getLength() const
Returns the computed length of the edge.
Definition NBEdge.h:583
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition NBEdge.cpp:4232
double getDistancAt(double pos) const
get distance at the given offset
Definition NBEdge.cpp:4766
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:4195
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition NBEdge.h:592
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition NBEdge.cpp:4147
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition NBEdge.h:632
NBNode * getToNode() const
Returns the destination node of the edge.
Definition NBEdge.h:536
std::vector< Connection > myConnections
List of connections to following edges.
Definition NBEdge.h:1752
Lane & getLaneStruct(int lane)
Definition NBEdge.h:1415
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition NBEdge.cpp:729
NBNode * myTo
Definition NBEdge.h:1722
const std::string & getID() const
Definition NBEdge.h:1515
bool allowsChangingRight(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition NBEdge.cpp:4378
double getDistance() const
get distance
Definition NBEdge.h:669
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition NBEdge.cpp:4018
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition NBEdge.cpp:4179
int getNumLanes() const
Returns the number of lanes.
Definition NBEdge.h:510
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition NBEdge.cpp:1221
void setFriction(int lane, double friction)
set lane specific friction (negative lane implies set for all lanes)
Definition NBEdge.cpp:4163
std::string getLaneID(int lane) const
get lane ID
Definition NBEdge.cpp:3870
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition NBEdge.cpp:4187
const NBEdge * getBidiEdge() const
Definition NBEdge.h:1501
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition NBEdge.h:529
int getPriority() const
Returns the priority of the edge.
Definition NBEdge.h:517
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition NBEdge.h:341
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition NBEdge.cpp:4101
bool allowsChangingLeft(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition NBEdge.cpp:4372
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition NBEdge.h:1122
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition NBEdge.cpp:936
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition NBEdge.cpp:582
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition NBEdge.cpp:4564
Represents a single node (junction) during network building.
Definition NBNode.h:66
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:2315
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:334
LinkState getLinkState(const NBEdge *incoming, const NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition NBNode.cpp:2398
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition NBNode.cpp:3755
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
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:264
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 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
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
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 invalid
color for invalid elements
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