Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNECrossing.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-2025 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 Inner Lanes (used when editing traffic lights)
19/****************************************************************************/
20
23#include <netedit/GNENet.h>
29
30#include "GNECrossing.h"
31
32// ===========================================================================
33// method definitions
34// ===========================================================================
35
38 myMoveElementCrossing(new GNEMoveElementCrossing(this)),
39 myTemplateNBCrossing(new NBNode::Crossing(nullptr, {}, 0, false, 0, 0, {})) {
40}
41
42
43GNECrossing::GNECrossing(GNEJunction* junction, std::vector<NBEdge*> crossingEdges) :
44 GNENetworkElement(junction->getNet(), junction->getNBNode()->getCrossing(crossingEdges)->id, SUMO_TAG_CROSSING),
45 myMoveElementCrossing(new GNEMoveElementCrossing(this)),
46 myCrossingEdges(crossingEdges),
47 myTemplateNBCrossing(nullptr) {
48 // set parent
49 setParent<GNEJunction*>(junction);
50}
51
52
58
59
64
65
70
71
72const Parameterised*
76
77
78bool
82
83
84std::string
86 return TL("Crossing's edges don't support pedestrians");
87}
88
89
90const PositionVector&
92 const auto crossing = getNBCrossing();
93 return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
94}
95
96
97void
99 const auto crossing = getNBCrossing();
100 // update crossing geometry
101 myCrossingGeometry.updateGeometry(crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape);
102}
103
104
107 // currently unused
108 return Position(0, 0);
109}
110
111
112bool
114 return false;
115}
116
117
118bool
120 return false;
121}
122
123
124bool
126 // check opened popup
127 if (myNet->getViewNet()->getPopup()) {
128 return myNet->getViewNet()->getPopup()->getGLObject() == this;
129 }
130 return false;
131}
132
133
134bool
136 return false;
137}
138
139
140bool
142 // get edit modes
143 const auto& editModes = myNet->getViewNet()->getEditModes();
144 // check if we're in select mode
145 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
147 } else {
148 return false;
149 }
150}
151
152
153bool
155 return false;
156}
157
158
159bool
161 // get edit modes
162 const auto& editModes = myNet->getViewNet()->getEditModes();
163 // check if we're in select mode
164 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
166 } else {
167 return false;
168 }
169}
170
171
172bool
174 // get edit modes
175 const auto& editModes = myNet->getViewNet()->getEditModes();
176 // check if we're in move mode
177 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
178 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
179 // check if we're editing this network element
181 if (editedNetworkElement) {
182 return editedNetworkElement == this;
183 } else {
184 // only move the first element
186 }
187 } else {
188 return false;
189 }
190}
191
192
193const std::vector<NBEdge*>&
197
198
203 } else {
204 return getParentJunctions().front()->getNBNode()->getCrossing(myCrossingEdges);
205 }
206}
207
208
209void
211 // continue depending of drawCrossing flag
212 if (checkDrawCrossing(s)) {
213 // get NBCrossing
214 const auto NBCrossing = getNBCrossing();
215 // get scaling depending if attribute carrier is selected
216 const double crossingExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
217 // get width
218 const double crossingWidth = NBCrossing->width * 0.5 * crossingExaggeration;
219 // get detail level
220 const auto d = s.getDetailLevel(crossingExaggeration);
221 // check if draw geometry
223 // draw crossing
224 drawCrossing(s, d, NBCrossing, crossingWidth, crossingExaggeration);
225 // draw TLS Links No
226 drawTLSLinkNo(s, NBCrossing);
227 // draw crossing name
228 if (s.cwaEdgeName.show(this)) {
230 }
231 // draw lock icon
233 // draw dotted contour depending if we're editing the custom shape
235 if (editedNetworkElement && (editedNetworkElement == this)) {
236 // draw dotted contour geometry points
238 crossingExaggeration, s.dottedContourSettings.segmentWidthSmall);
239 } else {
240 // draw dotted contour
242 }
243 }
244 // calculate contour
245 calculateCrossingContour(s, d, crossingWidth, crossingExaggeration);
246 }
247}
248
249
253
254
255void
259
260
261void
263 // check if draw
264 if (s.drawLinkTLIndex.show(getParentJunctions().front())) {
265 // push matrix
267 // move to GLO_Crossing
268 glTranslated(0, 0, GLO_CROSSING + 0.5);
269 // make a copy of shape
270 PositionVector shape = crossing->shape;
271 // extrapolate
272 shape.extrapolate(0.5); // draw on top of the walking area
273 // get link indexes
274 const int linkNo = crossing->tlLinkIndex;
275 const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
276 // draw link indexes
277 GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
279 // push matrix
281 }
282}
283
284
287 if (myShapeEdited) {
288 return getShapeEditedPopUpMenu(app, parent, getNBCrossing()->customShape);
289 } else {
290 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
291 // build common options
293 // check if we're in supermode network
295 // create menu commands
296 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("Set custom crossing shape"), nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
297 // check if menu commands has to be disabled
300 mcCustomShape->disable();
301 }
302 }
303 return ret;
304 }
305}
306
307
312
313
314void
315GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
316 // nothing to update
317}
318
319
320std::string
322 const auto crossing = getNBCrossing();
323 switch (key) {
324 case SUMO_ATTR_ID:
325 // get attribute requires a special case
326 if (crossing) {
327 return crossing->id;
328 } else {
329 return "Temporal Unreferenced";
330 }
331 case SUMO_ATTR_WIDTH:
332 return toString(crossing->customWidth);
334 return crossing->priority ? "true" : "false";
335 case SUMO_ATTR_EDGES:
336 return toString(crossing->edges);
338 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
340 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
341 case SUMO_ATTR_SHAPE:
343 return toString(crossing->customShape);
344 default:
345 return getCommonAttribute(key);
346 }
347}
348
349
350double
354
355
360
361
364 switch (key) {
365 case SUMO_ATTR_SHAPE:
367 return getNBCrossing()->customShape;
368 default:
370 }
371}
372
373
374void
375GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
376 if (value == getAttribute(key)) {
377 return; //avoid needless changes, later logic relies on the fact that attributes have changed
378 }
379 switch (key) {
380 case SUMO_ATTR_ID:
381 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
382 case SUMO_ATTR_EDGES:
383 case SUMO_ATTR_WIDTH:
387 case SUMO_ATTR_SHAPE:
389 GNEChange_Attribute::changeAttribute(this, key, value, undoList, true);
390 break;
391 default:
392 setCommonAttribute(key, value, undoList);
393 break;
394 }
395}
396
397
398bool
400 switch (key) {
401 case SUMO_ATTR_ID:
402 // id isn't editable
403 return false;
406 return (getNBCrossing()->tlID != "");
407 default:
408 return true;
409 }
410}
411
412
413bool
414GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
415 const auto crossing = getNBCrossing();
416 switch (key) {
417 case SUMO_ATTR_ID:
418 return false;
419 case SUMO_ATTR_EDGES:
420 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
421 // parse edges and save their IDs in a set
422 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
423 EdgeVector nbEdges;
424 for (const auto& edge : parsedEdges) {
425 nbEdges.push_back(edge->getNBEdge());
426 }
427 std::sort(nbEdges.begin(), nbEdges.end());
428 //
429 EdgeVector originalEdges = crossing->edges;
430 std::sort(originalEdges.begin(), originalEdges.end());
431 // return true if we're setting the same edges
432 if (toString(nbEdges) == toString(originalEdges)) {
433 return true;
434 } else {
435 return !getParentJunctions().front()->getNBNode()->checkCrossingDuplicated(nbEdges);
436 }
437 } else {
438 return false;
439 }
440 case SUMO_ATTR_WIDTH:
441 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
443 return canParse<bool>(value);
446 // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
447 return (isAttributeEnabled(key) &&
448 canParse<int>(value)
449 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
450 && getParentJunctions().front()->getNBNode()->getControllingTLS().size() > 0
451 && (*getParentJunctions().front()->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
452 case SUMO_ATTR_SHAPE:
454 // empty shapes are allowed
455 return canParse<PositionVector>(value);
456 default:
457 return isValid(key, value);
458 }
459}
460
461
462bool
464 const auto crossing = getNBCrossing();
465 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
466 return true;
467 } else {
468 return false;
469 }
470}
471
472
473bool
474GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
475 for (auto i : edges) {
476 if (checkEdgeBelong(i)) {
477 return true;
478 }
479 }
480 return false;
481}
482
483// ===========================================================================
484// private
485// ===========================================================================
486
487bool
489 // don't draw in supermode data
491 return false;
492 }
493 // check shape rotations
495 return false;
496 }
497 // check shape lengths
498 if (myCrossingGeometry.getShapeLengths().empty()) {
499 return false;
500 }
502}
503
504
505void
507 const NBNode::Crossing* crossing, const double width, const double exaggeration) const {
508 // don't draw crossing in TLS Mode
510 // get color
511 RGBColor crossingColor = getCrossingColor(s, crossing);
512 // push layer matrix
514 // translate to front
516 // set color
517 GLHelper::setColor(crossingColor);
518 // draw depending of level of detail
520 drawCrossingDetailed(width, exaggeration);
521 } else {
523 }
524 // draw shape points only in Network supermode
527 // color
528 const RGBColor darkerColor = crossingColor.changedBrightness(-32);
529 // draw on top of of the white area between the rails
530 glTranslated(0, 0, 0.2);
531 // set color
532 GLHelper::setColor(darkerColor);
533 // draw shape
535 // draw geometry points
539 }
540 // pop layer matrix
542 }
543}
544
545
548 if (myShapeEdited) {
550 } else if (drawUsingSelectColor()) {
552 } else if (!crossing->valid) {
554 } else if (crossing->priority) {
557 return s.laneColorer.getSchemes()[0].getColor(8);
558 } else {
560 }
561}
562
563
564void
565GNECrossing::drawCrossingDetailed(const double width, const double exaggeration) const {
566 // get length and spacing
567 const double length = 0.5 * exaggeration;
568 const double spacing = 1.0 * exaggeration;
569 // push rail matrix
571 // draw on top of of the white area between the rails
572 glTranslated(0, 0, 0.1);
573 for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
574 // push draw matrix
576 // translate and rotate
577 glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
578 glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
579 // draw crossing depending if isn't being drawn for selecting
580 for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
581 glBegin(GL_QUADS);
582 glVertex2d(-width, -t);
583 glVertex2d(-width, -t - length);
584 glVertex2d(width, -t - length);
585 glVertex2d(width, -t);
586 glEnd();
587 }
588 // pop draw matrix
590 }
591 // pop rail matrix
593}
594
595
596void
598 const double width, const double exaggeration) const {
599 // first check if junction parent was inserted with full boundary
601 // check if calculate contour for geometry points
602 if (myShapeEdited) {
605 } else {
606 // in move mode, add to selected object if this is the edited element
607 const auto& editModes = myNet->getViewNet()->getEditModes();
608 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
610 // calculate contour and
612 width, exaggeration, true, true, 0, nullptr, getParentJunctions().front(), addToSelectedObjects);
613 }
614 }
615}
616
617
618void
619GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
620 const auto crossing = getNBCrossing();
621 switch (key) {
622 case SUMO_ATTR_ID:
623 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
624 case SUMO_ATTR_EDGES: {
625 // obtain GNEEdges
626 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
627 // remove NBEdges of crossing
628 crossing->edges.clear();
629 // set NBEdge of every GNEEdge into Crossing Edges
630 for (auto i : edges) {
631 crossing->edges.push_back(i->getNBEdge());
632 }
633 // sort new edges
634 std::sort(crossing->edges.begin(), crossing->edges.end());
635 // change myCrossingEdges by the new edges
636 myCrossingEdges = crossing->edges;
637 // update geometry of parent junction
638 getParentJunctions().front()->updateGeometry();
639 break;
640 }
641 case SUMO_ATTR_WIDTH:
642 // Change width an refresh element
643 crossing->customWidth = parse<double>(value);
644 break;
646 crossing->priority = parse<bool>(value);
647 break;
649 crossing->customTLIndex = parse<int>(value);
650 // make new value visible immediately
651 crossing->tlLinkIndex = crossing->customTLIndex;
652 break;
654 crossing->customTLIndex2 = parse<int>(value);
655 // make new value visible immediately
656 crossing->tlLinkIndex2 = crossing->customTLIndex2;
657 break;
658 case SUMO_ATTR_SHAPE:
660 // set custom shape
661 crossing->customShape = parse<PositionVector>(value);
662 break;
663 default:
664 setCommonAttribute(key, value);
665 break;
666 }
667 // Crossing are a special case and we need ot update geometry of junction instead of crossing
668 if ((getParentJunctions().size() > 0) && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
669 getParentJunctions().front()->updateGeometry();
670 }
671 // invalidate demand path calculator
673}
674
675/****************************************************************************/
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_SELECT
mode for selecting network elements
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_CROSSING_EDIT_SHAPE
edit crossing shape
@ GLO_CROSSING
a tl-logic
GUIViewObjectsHandler gViewObjectsHandler
#define TL(string)
Definition MsgHandler.h:304
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition NBCont.h:42
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_PRIORITY
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
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:824
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double getCommonAttributeDouble(SumoXMLAttr key) const
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
Position getCommonAttributePosition(SumoXMLAttr key) const
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
void drawDottedContourGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius, const double scale, const double lineWidth) const
draw dotted contour for geometry points
Boundary getContourBoundary() const
get contour boundary
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
bool checkDrawCrossing(const GUIVisualizationSettings &s) const
check if draw crossing
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
std::string getAttribute(SumoXMLAttr key) const override
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GNEMoveElementCrossing * myMoveElementCrossing
move element crossing
bool isNetworkElementValid() const
check if current network element is valid to be written into XML
void deleteGLObject()
delete element
GNECrossing(GNENet *net)
default constructor
void updateGLObject()
update GLObject (geometry, ID, etc.)
void drawCrossing(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const NBNode::Crossing *crossing, const double width, const double exaggeration) const
draw crossing
Position getPositionInView() const
Returns position of hierarchical element in view.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
draw TLS Link Number
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
Position getAttributePosition(SumoXMLAttr key) const override
bool checkDrawFromContour() const override
check if draw from contour (green)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool isValid(SumoXMLAttr key, const std::string &value) override
Parameterised * getParameters() override
get parameters associated with this crossing
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
PositionVector getAttributePositionVector(SumoXMLAttr key) const
GUIGeometry myCrossingGeometry
crossing geometry
bool isAttributeEnabled(SumoXMLAttr key) const
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this crossing
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
bool checkDrawSelectContour() const override
check if draw select contour (blue)
bool checkDrawMoveContour() const override
check if draw move contour (red)
std::string getNetworkElementProblem() const
return a string with the current network element problem
const PositionVector & getCrossingShape() const
get Crossing shape
void updateGeometry() override
update pre-computed geometry information
~GNECrossing()
Destructor.
void calculateCrossingContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width, const double exaggeration) const
calculate contour
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool checkDrawOverContour() const override
check if draw over contour (orange)
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
RGBColor getCrossingColor(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
get crossing color
bool checkDrawToContour() const override
check if draw from contour (magenta)
void drawCrossingDetailed(const double width, const double exaggeration) const
draw crossing with hight detail
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
double getAttributeDouble(SumoXMLAttr key) const override
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:753
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
Definition GNENet.cpp:370
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:174
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
GUIGLObjectPopupMenu * getShapeEditedPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, const PositionVector &shape)
get shape edited popup menu
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
The popup menu of a globject.
GUIGlObject * getGLObject() const
The object that belongs to this popup-menu.
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape, const RGBColor &color, const double radius, const double exaggeration, const bool editingElevation)
draw geometry points
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, bool addSeparator=true)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
const std::vector< T > & getSchemes() const
GUIGLObjectPopupMenu * getPopup() const
ge the current popup-menu
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
Stores the information about how to visualize structures.
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationTextSettings cwaEdgeName
bool drawMovingGeometryPoint(const double exaggeration, const double radius) const
check if moving geometry point can be draw
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
Setting bundles for optional drawing names with size and color.
GUIVisualizationTextSettings drawLinkTLIndex
bool drawCrossingsAndWalkingareas
whether crossings and walkingareas shall be drawn
double selectorFrameScale
the current selection scaling in netedit (set in SelectorFrame)
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
A definition of a pedestrian crossing.
Definition NBNode.h:135
int tlLinkIndex
the traffic light index of this crossing (if controlled)
Definition NBNode.h:162
PositionVector customShape
optional customShape for this crossing
Definition NBNode.h:160
PositionVector shape
The crossing's shape.
Definition NBNode.h:144
bool priority
whether the pedestrians have priority
Definition NBNode.h:158
bool valid
whether this crossing is valid (and can be written to the net.xml). This is needed for netedit becaus...
Definition NBNode.h:170
Represents a single node (junction) during network building.
Definition NBNode.h:66
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
PositionVector reverse() const
reverse position vector
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:200
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool editingElevation() const
check if we're editing elevation
RGBColor selectedCrossingColor
crossings selection color
static const RGBColor crossingPriorityColor
color for priority crossing
static const RGBColor crossingInvalidColor
color for invalid crossing
static const RGBColor crossingColor
color for crossings
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double crossingGeometryPointRadius
moving crossing geometry point radius
bool show(const GUIGlObject *o) const
whether to show the text