Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
21#include <netedit/GNENet.h>
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
32
33#include "GNECrossing.h"
34
35// ===========================================================================
36// method definitions
37// ===========================================================================
38
41 myTemplateNBCrossing(new NBNode::Crossing(nullptr, {}, 0, false, 0, 0, {})) {
42}
43
44
45GNECrossing::GNECrossing(GNEJunction* junction, std::vector<NBEdge*> crossingEdges) :
46 GNENetworkElement(junction->getNet(), junction->getNBNode()->getCrossing(crossingEdges)->id, SUMO_TAG_CROSSING),
47 myCrossingEdges(crossingEdges),
48 myTemplateNBCrossing(nullptr) {
49 // set parent
50 setParent<GNEJunction*>(junction);
51}
52
53
59
60
61bool
65
66
67std::string
69 return TL("Crossing's edges don't support pedestrians");
70}
71
72
73const PositionVector&
75 const auto crossing = getNBCrossing();
76 return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
77}
78
79
80void
82 const auto crossing = getNBCrossing();
83 // update crossing geometry
84 myCrossingGeometry.updateGeometry(crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape);
85}
86
87
90 // currently unused
91 return Position(0, 0);
92}
93
94
95bool
97 return false;
98}
99
100
101bool
103 return false;
104}
105
106
107bool
109 // check opened popup
110 if (myNet->getViewNet()->getPopup()) {
111 return myNet->getViewNet()->getPopup()->getGLObject() == this;
112 }
113 return false;
114}
115
116
117bool
119 return false;
120}
121
122
123bool
125 // get edit modes
126 const auto& editModes = myNet->getViewNet()->getEditModes();
127 // check if we're in select mode
128 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
130 } else {
131 return false;
132 }
133}
134
135
136bool
138 return false;
139}
140
141
142bool
144 // get edit modes
145 const auto& editModes = myNet->getViewNet()->getEditModes();
146 // check if we're in select mode
147 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
149 } else {
150 return false;
151 }
152}
153
154
155bool
157 // get edit modes
158 const auto& editModes = myNet->getViewNet()->getEditModes();
159 // check if we're in move mode
160 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
161 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
162 // check if we're editing this network element
164 if (editedNetworkElement) {
165 return editedNetworkElement == this;
166 } else {
167 // only move the first element
169 }
170 } else {
171 return false;
172 }
173}
174
175
178 // edit depending if shape is being edited
179 if (isShapeEdited()) {
180 // calculate move shape operation
181 return calculateMoveShapeOperation(this, getCrossingShape(), false);
182 } else {
183 return nullptr;
184 }
185}
186
187
188void
189GNECrossing::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
190 // edit depending if shape is being edited
191 if (isShapeEdited()) {
192 // get original shape
194 // check shape size
195 if (shape.size() > 2) {
196 // obtain index
197 int index = shape.indexOfClosest(clickedPosition);
198 // get snap radius
200 // check if we have to create a new index
201 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
202 // remove geometry point
203 shape.erase(shape.begin() + index);
204 // commit new shape
205 undoList->begin(this, TLF("remove geometry point of %", getTagStr()));
207 undoList->end();
208 }
209 }
210 }
211}
212
213
214const std::vector<NBEdge*>&
218
219
224 } else {
225 return getParentJunctions().front()->getNBNode()->getCrossing(myCrossingEdges);
226 }
227}
228
229
230void
232 // continue depending of drawCrossing flag
233 if (checkDrawCrossing(s)) {
234 // get NBCrossing
235 const auto NBCrossing = getNBCrossing();
236 // get scaling depending if attribute carrier is selected
237 const double crossingExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
238 // get width
239 const double crossingWidth = NBCrossing->width * 0.5 * crossingExaggeration;
240 // get detail level
241 const auto d = s.getDetailLevel(crossingExaggeration);
242 // check if draw geometry
244 // draw crossing
245 drawCrossing(s, d, NBCrossing, crossingWidth, crossingExaggeration);
246 // draw TLS Links No
247 drawTLSLinkNo(s, NBCrossing);
248 // draw crossing name
249 if (s.cwaEdgeName.show(this)) {
251 }
252 // draw lock icon
254 // draw dotted contour depending if we're editing the custom shape
256 if (editedNetworkElement && (editedNetworkElement == this)) {
257 // draw dotted contour geometry points
259 crossingExaggeration, s.dottedContourSettings.segmentWidthSmall);
260 } else {
261 // draw dotted contour
263 }
264 }
265 // calculate contour
266 calculateCrossingContour(s, d, crossingWidth, crossingExaggeration);
267 }
268}
269
270
274
275
276void
280
281
282void
284 // check if draw
285 if (s.drawLinkTLIndex.show(getParentJunctions().front())) {
286 // push matrix
288 // move to GLO_Crossing
289 glTranslated(0, 0, GLO_CROSSING + 0.5);
290 // make a copy of shape
291 PositionVector shape = crossing->shape;
292 // extrapolate
293 shape.extrapolate(0.5); // draw on top of the walking area
294 // get link indexes
295 const int linkNo = crossing->tlLinkIndex;
296 const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
297 // draw link indexes
298 GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
300 // push matrix
302 }
303}
304
305
308 if (myShapeEdited) {
309 return getShapeEditedPopUpMenu(app, parent, getNBCrossing()->customShape);
310 } else {
311 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
312 // build common options
314 // check if we're in supermode network
316 // create menu commands
317 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("Set custom crossing shape"), nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
318 // check if menu commands has to be disabled
321 mcCustomShape->disable();
322 }
323 }
324 return ret;
325 }
326}
327
328
333
334
335void
336GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
337 // nothing to update
338}
339
340
341std::string
343 const auto crossing = getNBCrossing();
344 switch (key) {
345 case SUMO_ATTR_ID:
346 // get attribute requires a special case
347 if (crossing) {
348 return crossing->id;
349 } else {
350 return "Temporal Unreferenced";
351 }
352 case SUMO_ATTR_WIDTH:
353 return toString(crossing->customWidth);
355 return crossing->priority ? "true" : "false";
356 case SUMO_ATTR_EDGES:
357 return toString(crossing->edges);
359 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
361 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
362 case SUMO_ATTR_SHAPE:
364 return toString(crossing->customShape);
365 default:
366 return getCommonAttribute(crossing, key);
367 }
368}
369
370
373 switch (key) {
374 case SUMO_ATTR_SHAPE:
376 return getNBCrossing()->customShape;
377 default:
378 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
379 }
380}
381
382
383void
384GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
385 if (value == getAttribute(key)) {
386 return; //avoid needless changes, later logic relies on the fact that attributes have changed
387 }
388 switch (key) {
389 case SUMO_ATTR_ID:
390 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
391 case SUMO_ATTR_EDGES:
392 case SUMO_ATTR_WIDTH:
396 case SUMO_ATTR_SHAPE:
398 GNEChange_Attribute::changeAttribute(this, key, value, undoList, true);
399 break;
400 default:
401 setCommonAttribute(key, value, undoList);
402 break;
403 }
404}
405
406
407bool
409 switch (key) {
410 case SUMO_ATTR_ID:
411 // id isn't editable
412 return false;
415 return (getNBCrossing()->tlID != "");
416 default:
417 return true;
418 }
419}
420
421
422bool
423GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
424 const auto crossing = getNBCrossing();
425 switch (key) {
426 case SUMO_ATTR_ID:
427 return false;
428 case SUMO_ATTR_EDGES:
429 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
430 // parse edges and save their IDs in a set
431 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
432 EdgeVector nbEdges;
433 for (const auto& edge : parsedEdges) {
434 nbEdges.push_back(edge->getNBEdge());
435 }
436 std::sort(nbEdges.begin(), nbEdges.end());
437 //
438 EdgeVector originalEdges = crossing->edges;
439 std::sort(originalEdges.begin(), originalEdges.end());
440 // return true if we're setting the same edges
441 if (toString(nbEdges) == toString(originalEdges)) {
442 return true;
443 } else {
444 return !getParentJunctions().front()->getNBNode()->checkCrossingDuplicated(nbEdges);
445 }
446 } else {
447 return false;
448 }
449 case SUMO_ATTR_WIDTH:
450 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
452 return canParse<bool>(value);
455 // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
456 return (isAttributeEnabled(key) &&
457 canParse<int>(value)
458 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
459 && getParentJunctions().front()->getNBNode()->getControllingTLS().size() > 0
460 && (*getParentJunctions().front()->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
461 case SUMO_ATTR_SHAPE:
463 // empty shapes are allowed
464 return canParse<PositionVector>(value);
465 default:
466 return isValid(key, value);
467 }
468}
469
470
475
476
477bool
479 const auto crossing = getNBCrossing();
480 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
481 return true;
482 } else {
483 return false;
484 }
485}
486
487
488bool
489GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
490 for (auto i : edges) {
491 if (checkEdgeBelong(i)) {
492 return true;
493 }
494 }
495 return false;
496}
497
498// ===========================================================================
499// private
500// ===========================================================================
501
502bool
504 // don't draw in supermode data
506 return false;
507 }
508 // check shape rotations
510 return false;
511 }
512 // check shape lengths
513 if (myCrossingGeometry.getShapeLengths().empty()) {
514 return false;
515 }
517}
518
519
520void
522 const NBNode::Crossing* crossing, const double width, const double exaggeration) const {
523 // don't draw crossing in TLS Mode
525 // get color
526 RGBColor crossingColor = getCrossingColor(s, crossing);
527 // push layer matrix
529 // translate to front
531 // set color
532 GLHelper::setColor(crossingColor);
533 // draw depending of level of detail
535 drawCrossingDetailed(width, exaggeration);
536 } else {
538 }
539 // draw shape points only in Network supemode
542 // color
543 const RGBColor darkerColor = crossingColor.changedBrightness(-32);
544 // draw on top of of the white area between the rails
545 glTranslated(0, 0, 0.2);
546 // set color
547 GLHelper::setColor(darkerColor);
548 // draw shape
550 // draw geometry points
554 }
555 // pop layer matrix
557 }
558}
559
560
563 if (myShapeEdited) {
565 } else if (drawUsingSelectColor()) {
567 } else if (!crossing->valid) {
569 } else if (crossing->priority) {
572 return s.laneColorer.getSchemes()[0].getColor(8);
573 } else {
575 }
576}
577
578
579void
580GNECrossing::drawCrossingDetailed(const double width, const double exaggeration) const {
581 // geet lenght and spacing
582 const double length = 0.5 * exaggeration;
583 const double spacing = 1.0 * exaggeration;
584 // push rail matrix
586 // draw on top of of the white area between the rails
587 glTranslated(0, 0, 0.1);
588 for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
589 // push draw matrix
591 // translate and rotate
592 glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
593 glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
594 // draw crossing depending if isn't being drawn for selecting
595 for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
596 glBegin(GL_QUADS);
597 glVertex2d(-width, -t);
598 glVertex2d(-width, -t - length);
599 glVertex2d(width, -t - length);
600 glVertex2d(width, -t);
601 glEnd();
602 }
603 // pop draw matrix
605 }
606 // pop rail matrix
608}
609
610
611void
613 const double width, const double exaggeration) const {
614 // first check if junction parent was inserted with full boundary
616 // check if calculate contour for geometry points
617 if (myShapeEdited) {
620 } else {
621 // in move mode, add to selected object if this is the edited element
622 const auto& editModes = myNet->getViewNet()->getEditModes();
623 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
625 // calculate contour and
627 width, exaggeration, true, true, 0, nullptr, getParentJunctions().front(), addToSelectedObjects);
628 }
629 }
630}
631
632
633void
634GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
635 const auto crossing = getNBCrossing();
636 switch (key) {
637 case SUMO_ATTR_ID:
638 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
639 case SUMO_ATTR_EDGES: {
640 // obtain GNEEdges
641 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
642 // remove NBEdges of crossing
643 crossing->edges.clear();
644 // set NBEdge of every GNEEdge into Crossing Edges
645 for (auto i : edges) {
646 crossing->edges.push_back(i->getNBEdge());
647 }
648 // sort new edges
649 std::sort(crossing->edges.begin(), crossing->edges.end());
650 // change myCrossingEdges by the new edges
651 myCrossingEdges = crossing->edges;
652 // update geometry of parent junction
653 getParentJunctions().front()->updateGeometry();
654 break;
655 }
656 case SUMO_ATTR_WIDTH:
657 // Change width an refresh element
658 crossing->customWidth = parse<double>(value);
659 break;
661 crossing->priority = parse<bool>(value);
662 break;
664 crossing->customTLIndex = parse<int>(value);
665 // make new value visible immediately
666 crossing->tlLinkIndex = crossing->customTLIndex;
667 break;
669 crossing->customTLIndex2 = parse<int>(value);
670 // make new value visible immediately
671 crossing->tlLinkIndex2 = crossing->customTLIndex2;
672 break;
673 case SUMO_ATTR_SHAPE:
675 // set custom shape
676 crossing->customShape = parse<PositionVector>(value);
677 break;
678 default:
679 setCommonAttribute(crossing, key, value);
680 break;
681 }
682 // Crossing are a special case and we need ot update geometry of junction instead of crossing
683 if ((getParentJunctions().size() > 0) && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
684 getParentJunctions().front()->updateGeometry();
685 }
686 // invalidate demand path calculator
688}
689
690
691void
693 // set custom shape
695 // update geometry
697}
698
699
700void
702 // commit new shape
703 undoList->begin(this, TLF("moving % of %", toString(SUMO_ATTR_CUSTOMSHAPE), getTagStr()));
705 undoList->end();
706}
707
708/****************************************************************************/
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:305
#define TLF(string,...)
Definition MsgHandler.h:307
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:830
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
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
std::string getCommonAttribute(const Parameterised *parameterised, 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
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
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
std::string getAttribute(SumoXMLAttr key) const
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
bool checkDrawCrossing(const GUIVisualizationSettings &s) const
check if draw crossing
bool checkDrawDeleteContourSmall() const
check if draw delete contour small (pink/white)
std::vector< NBEdge * > myCrossingEdges
Crossing Edges (It works as ID because a junction can only ONE Crossing with the same edges)
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
const Parameterised::Map & getACParametersMap() const
get parameters map
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 updateGeometry()
update pre-computed geometry information
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
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
bool checkDrawToContour() const
check if draw from contour (magenta)
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
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
PositionVector getAttributePositionVector(SumoXMLAttr key) const
GUIGeometry myCrossingGeometry
crossing geometry
bool isAttributeEnabled(SumoXMLAttr key) const
bool checkDrawSelectContour() const
check if draw select contour (blue)
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
bool checkDrawFromContour() const
check if draw from contour (green)
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
std::string getNetworkElementProblem() const
return a string with the current network element problem
const PositionVector & getCrossingShape() const
get Crossing shape
bool checkDrawOverContour() const
check if draw over contour (orange)
~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.
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
RGBColor getCrossingColor(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
get crossing color
void drawCrossingDetailed(const double width, const double exaggeration) const
draw crossing with hight detail
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
bool checkDrawMoveContour() const
check if draw move contour (red)
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:829
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
GNEMoveOperation * calculateMoveShapeOperation(const GUIGlObject *obj, const PositionVector originalShape, const bool maintainShapeClosed)
calculate move shape operation
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
Definition GNENet.cpp:372
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:176
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2194
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
bool isShapeEdited() const
check if shape is being edited
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
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...
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
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
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 crosings 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
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
int indexOfClosest(const Position &p, bool twoD=false) const
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