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-2026 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
36#ifdef _MSC_VER
37#pragma warning(push)
38#pragma warning(disable: 4355) // mask warning about "this" in initializers
39#endif
42 myMoveElementCrossing(new GNEMoveElementCrossing(this)),
43 myTemplateNBCrossing(new NBNode::Crossing(nullptr, {}, 0, false, 0, 0, {})) {
44}
45
46
47GNECrossing::GNECrossing(GNEJunction* junction, std::vector<NBEdge*> crossingEdges) :
48 GNENetworkElement(junction->getNet(), junction->getNBNode()->getCrossing(crossingEdges)->id, SUMO_TAG_CROSSING),
49 myMoveElementCrossing(new GNEMoveElementCrossing(this)),
50 myCrossingEdges(crossingEdges),
51 myTemplateNBCrossing(nullptr) {
52 // set parent
53 setParent<GNEJunction*>(junction);
54}
55#ifdef _MSC_VER
56#pragma warning(pop)
57#endif
58
59
65
66
71
72
77
78
79const Parameterised*
83
84
85bool
89
90
91std::string
93 return TL("Crossing's edges don't support pedestrians");
94}
95
96
97const PositionVector&
99 const auto crossing = getNBCrossing();
100 return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
101}
102
103
104void
106 const auto crossing = getNBCrossing();
107 // update crossing geometry
108 myCrossingGeometry.updateGeometry(crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape);
109}
110
111
114 // currently unused
115 return Position(0, 0);
116}
117
118
119bool
121 return false;
122}
123
124
125bool
127 return false;
128}
129
130
131bool
133 // check opened popup
134 if (myNet->getViewNet()->getPopup()) {
135 return myNet->getViewNet()->getPopup()->getGLObject() == this;
136 }
137 return false;
138}
139
140
141bool
143 return false;
144}
145
146
147bool
149 // get edit modes
150 const auto& editModes = myNet->getViewNet()->getEditModes();
151 // check if we're in select mode
152 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
154 } else {
155 return false;
156 }
157}
158
159
160bool
162 return false;
163}
164
165
166bool
168 // get edit modes
169 const auto& editModes = myNet->getViewNet()->getEditModes();
170 // check if we're in select mode
171 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
173 } else {
174 return false;
175 }
176}
177
178
179bool
181 // get edit modes
182 const auto& editModes = myNet->getViewNet()->getEditModes();
183 // check if we're in move mode
184 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
185 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
186 // check if we're editing this network element
188 if (editedNetworkElement) {
189 return editedNetworkElement == this;
190 } else {
191 // only move the first element
193 }
194 } else {
195 return false;
196 }
197}
198
199
200const std::vector<NBEdge*>&
204
205
210 } else {
211 return getParentJunctions().front()->getNBNode()->getCrossing(myCrossingEdges);
212 }
213}
214
215
216void
218 // continue depending of drawCrossing flag
219 if (checkDrawCrossing(s)) {
220 // get NBCrossing
221 const auto NBCrossing = getNBCrossing();
222 // get scaling depending if attribute carrier is selected
223 const double crossingExaggeration = s.junctionSize.getExaggeration(s, this, 1);
224 // get width
225 const double crossingWidth = NBCrossing->width * 0.5 * crossingExaggeration;
226 // get detail level
227 const auto d = s.getDetailLevel(crossingExaggeration);
228 // check if draw geometry
230 // draw crossing
231 drawCrossing(s, d, NBCrossing, crossingWidth, crossingExaggeration);
232 // draw TLS Links No
233 drawTLSLinkNo(s, NBCrossing);
234 // draw crossing name
235 if (s.cwaEdgeName.show(this)) {
237 }
238 // draw lock icon
240 // draw dotted contour depending if we're editing the custom shape
242 if (editedNetworkElement && (editedNetworkElement == this)) {
243 // draw dotted contour geometry points
245 crossingExaggeration, s.dottedContourSettings.segmentWidthSmall);
246 } else {
247 // draw dotted contour
249 }
250 }
251 // calculate contour
252 calculateCrossingContour(s, d, crossingWidth, crossingExaggeration);
253 }
254}
255
256
260
261
262void
266
267
268void
270 // check if draw
271 if (s.drawLinkTLIndex.show(getParentJunctions().front())) {
272 // push matrix
274 // move to GLO_Crossing
275 glTranslated(0, 0, GLO_CROSSING + 0.5);
276 // make a copy of shape
277 PositionVector shape = crossing->shape;
278 // extrapolate
279 shape.extrapolate(0.5); // draw on top of the walking area
280 // get link indexes
281 const int linkNo = crossing->tlLinkIndex;
282 const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
283 // draw link indexes
284 GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
286 // push matrix
288 }
289}
290
291
294 if (myShapeEdited) {
295 return getShapeEditedPopUpMenu(app, parent, getNBCrossing()->customShape);
296 } else {
297 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
298 // build common options
300 // check if we're in supermode network
302 // create menu commands
303 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("Set custom crossing shape"), nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
304 // check if menu commands has to be disabled
307 mcCustomShape->disable();
308 }
309 }
310 return ret;
311 }
312}
313
314
319
320
321void
322GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
323 // nothing to update
324}
325
326
327std::string
329 const auto crossing = getNBCrossing();
330 switch (key) {
331 case SUMO_ATTR_ID:
332 // get attribute requires a special case
333 if (crossing) {
334 return crossing->id;
335 } else {
336 return "Temporal Unreferenced";
337 }
338 case SUMO_ATTR_WIDTH:
339 return toString(crossing->customWidth);
341 return crossing->priority ? "true" : "false";
342 case SUMO_ATTR_EDGES:
343 return toString(crossing->edges);
345 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
347 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
348 case SUMO_ATTR_SHAPE:
350 return toString(crossing->customShape);
351 default:
352 return getCommonAttribute(key);
353 }
354}
355
356
357double
361
362
367
368
371 switch (key) {
372 case SUMO_ATTR_SHAPE:
374 return getNBCrossing()->customShape;
375 default:
377 }
378}
379
380
381void
382GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
383 if (value == getAttribute(key)) {
384 return; //avoid needless changes, later logic relies on the fact that attributes have changed
385 }
386 switch (key) {
387 case SUMO_ATTR_ID:
388 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
389 case SUMO_ATTR_EDGES:
390 case SUMO_ATTR_WIDTH:
394 case SUMO_ATTR_SHAPE:
396 GNEChange_Attribute::changeAttribute(this, key, value, undoList, true);
397 break;
398 default:
399 setCommonAttribute(key, value, undoList);
400 break;
401 }
402}
403
404
405bool
407 switch (key) {
408 case SUMO_ATTR_ID:
409 // id isn't editable
410 return false;
413 return (getNBCrossing()->tlID != "");
414 default:
415 return true;
416 }
417}
418
419
420bool
421GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
422 const auto crossing = getNBCrossing();
423 switch (key) {
424 case SUMO_ATTR_ID:
425 return false;
426 case SUMO_ATTR_EDGES:
427 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
428 // parse edges and save their IDs in a set
429 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
430 EdgeVector nbEdges;
431 for (const auto& edge : parsedEdges) {
432 nbEdges.push_back(edge->getNBEdge());
433 }
434 std::sort(nbEdges.begin(), nbEdges.end());
435 //
436 EdgeVector originalEdges = crossing->edges;
437 std::sort(originalEdges.begin(), originalEdges.end());
438 // return true if we're setting the same edges
439 if (toString(nbEdges) == toString(originalEdges)) {
440 return true;
441 } else {
442 return !getParentJunctions().front()->getNBNode()->checkCrossingDuplicated(nbEdges);
443 }
444 } else {
445 return false;
446 }
447 case SUMO_ATTR_WIDTH:
448 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
450 return canParse<bool>(value);
453 // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
454 return (isAttributeEnabled(key) &&
455 canParse<int>(value)
456 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
457 && getParentJunctions().front()->getNBNode()->getControllingTLS().size() > 0
458 && (*getParentJunctions().front()->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
459 case SUMO_ATTR_SHAPE:
461 // empty shapes are allowed
462 return canParse<PositionVector>(value);
463 default:
464 return isValid(key, value);
465 }
466}
467
468
469bool
471 const auto crossing = getNBCrossing();
472 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
473 return true;
474 } else {
475 return false;
476 }
477}
478
479
480bool
481GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
482 for (auto i : edges) {
483 if (checkEdgeBelong(i)) {
484 return true;
485 }
486 }
487 return false;
488}
489
490// ===========================================================================
491// private
492// ===========================================================================
493
494bool
496 // don't draw in supermode data
498 return false;
499 }
500 // check shape rotations
502 return false;
503 }
504 // check shape lengths
505 if (myCrossingGeometry.getShapeLengths().empty()) {
506 return false;
507 }
509}
510
511
512void
514 const NBNode::Crossing* crossing, const double width, const double exaggeration) const {
515 // don't draw crossing in TLS Mode
518 // get color
519 RGBColor crossingColor = getCrossingColor(s, crossing);
520 // push layer matrix
522 // translate to front
524 // set color
525 GLHelper::setColor(crossingColor);
526 // draw depending of level of detail
528 drawCrossingDetailed(width, exaggeration);
529 } else {
531 }
532 // draw shape points only in Network supermode
535 // color
536 const RGBColor darkerColor = crossingColor.changedBrightness(-32);
537 // draw on top of of the white area between the rails
538 glTranslated(0, 0, 0.2);
539 // set color
540 GLHelper::setColor(darkerColor);
541 // draw shape
543 // draw geometry points
547 }
548 // pop layer matrix
550 }
551}
552
553
556 if (myShapeEdited) {
558 } else if (drawUsingSelectColor()) {
560 } else if (!crossing->valid) {
562 } else if (crossing->priority) {
565 return s.laneColorer.getSchemes()[0].getColor(8);
566 } else {
568 }
569}
570
571
572void
573GNECrossing::drawCrossingDetailed(const double width, const double exaggeration) const {
574 // get length and spacing
575 const double length = 0.5 * exaggeration;
576 const double spacing = 1.0 * exaggeration;
577 // push rail matrix
579 // draw on top of of the white area between the rails
580 glTranslated(0, 0, 0.1);
581 for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
582 // push draw matrix
584 // translate and rotate
585 glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
586 glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
587 // draw crossing depending if isn't being drawn for selecting
588 for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
589 glBegin(GL_QUADS);
590 glVertex2d(-width, -t);
591 glVertex2d(-width, -t - length);
592 glVertex2d(width, -t - length);
593 glVertex2d(width, -t);
594 glEnd();
595 }
596 // pop draw matrix
598 }
599 // pop rail matrix
601}
602
603
604void
606 const double width, const double exaggeration) const {
607 // first check if junction parent was inserted with full boundary
609 // check if calculate contour for geometry points
610 if (myShapeEdited) {
613 } else {
614 // in move mode, add to selected object if this is the edited element
615 const auto& editModes = myNet->getViewNet()->getEditModes();
616 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
618 // calculate contour and
620 width, exaggeration, true, true, 0, nullptr, getParentJunctions().front(), addToSelectedObjects);
621 }
622 }
623}
624
625
626void
627GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
628 const auto crossing = getNBCrossing();
629 switch (key) {
630 case SUMO_ATTR_ID:
631 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
632 case SUMO_ATTR_EDGES: {
633 // obtain GNEEdges
634 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
635 // remove NBEdges of crossing
636 crossing->edges.clear();
637 // set NBEdge of every GNEEdge into Crossing Edges
638 for (auto i : edges) {
639 crossing->edges.push_back(i->getNBEdge());
640 }
641 // sort new edges
642 std::sort(crossing->edges.begin(), crossing->edges.end());
643 // change myCrossingEdges by the new edges
644 myCrossingEdges = crossing->edges;
645 // update geometry of parent junction
646 getParentJunctions().front()->updateGeometry();
647 break;
648 }
649 case SUMO_ATTR_WIDTH:
650 // Change width an refresh element
651 crossing->customWidth = parse<double>(value);
652 break;
654 crossing->priority = parse<bool>(value);
655 break;
657 crossing->customTLIndex = parse<int>(value);
658 // make new value visible immediately
659 crossing->tlLinkIndex = crossing->customTLIndex;
660 break;
662 crossing->customTLIndex2 = parse<int>(value);
663 // make new value visible immediately
664 crossing->tlLinkIndex2 = crossing->customTLIndex2;
665 break;
666 case SUMO_ATTR_SHAPE:
668 // set custom shape
669 crossing->customShape = parse<PositionVector>(value);
670 break;
671 default:
672 setCommonAttribute(key, value);
673 break;
674 }
675 // Crossing are a special case and we need ot update geometry of junction instead of crossing
676 if ((getParentJunctions().size() > 0) && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
677 getParentJunctions().front()->updateGeometry();
678 }
679 // invalidate demand path calculator
681}
682
683/****************************************************************************/
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:49
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
GNECrossing(GNENet *net)
default constructor
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.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
draw TLS Link Number
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
bool isNetworkElementValid() const override
check if current network element is valid to be written into XML
GUIGeometry myCrossingGeometry
crossing geometry
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
void updateGLObject() override
update GLObject (geometry, ID, etc.)
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)
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
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
bool isAttributeEnabled(SumoXMLAttr key) const override
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
bool checkDrawOverContour() const override
check if draw over contour (orange)
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
std::string getNetworkElementProblem() const override
return a string with the current network element problem
RGBColor getCrossingColor(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
get crossing color
bool checkDrawToContour() const override
check if draw from contour (magenta)
void deleteGLObject() override
delete element
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:773
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
Definition GNENet.cpp:397
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:198
GNEUndoList * getUndoList() const
get undo list(used for simplify code)
Definition GNENet.cpp:156
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
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)
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 GUIVisualizationSettings &s, const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings junctionSize
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
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
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool constantSizeSelected
whether only selected objects shall be drawn with constant
bool show(const GUIGlObject *o) const
whether to show the text