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-2024 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#include <config.h>
21
22#include <netedit/GNENet.h>
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
32
33#include "GNECrossing.h"
34
35
36// ===========================================================================
37// method definitions
38// ===========================================================================
39
41 GNENetworkElement(net, "", GLO_CROSSING, SUMO_TAG_CROSSING, GUIIconSubSys::getIcon(GUIIcon::CROSSING), {}, {}, {}, {}, {}, {}),
42 myParentJunction(nullptr),
43myTemplateNBCrossing(new NBNode::Crossing(nullptr, {}, 0, false, 0, 0, {})) {
44 // reset default values
45 resetDefaultValues();
46}
47
48GNECrossing::GNECrossing(GNEJunction* parentJunction, std::vector<NBEdge*> crossingEdges) :
49 GNENetworkElement(parentJunction->getNet(), parentJunction->getNBNode()->getCrossing(crossingEdges)->id, GLO_CROSSING,
50 SUMO_TAG_CROSSING, GUIIconSubSys::getIcon(GUIIcon::CROSSING), {}, {}, {}, {}, {}, {}),
51myParentJunction(parentJunction),
52myCrossingEdges(crossingEdges),
53myTemplateNBCrossing(nullptr) {
54 // update centering boundary without updating grid
55 updateCenteringBoundary(false);
56}
57
58
64
65
66bool
70
71
72std::string
74 return TL("Crossing's edges don't support pedestrians");
75}
76
77
78const PositionVector&
80 const auto crossing = getNBCrossing();
81 return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
82}
83
84
85void
87 const auto crossing = getNBCrossing();
88 // update crossing geometry
89 myCrossingGeometry.updateGeometry(crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape);
90}
91
92
95 // currently unused
96 return Position(0, 0);
97}
98
99
100bool
102 return false;
103}
104
105
106bool
108 return false;
109}
110
111
112bool
114 return false;
115}
116
117
118bool
120 return false;
121}
122
123
124bool
126 // get edit modes
127 const auto& editModes = myNet->getViewNet()->getEditModes();
128 // check if we're in select mode
129 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
131 } else {
132 return false;
133 }
134}
135
136
137bool
139 // get edit modes
140 const auto& editModes = myNet->getViewNet()->getEditModes();
141 // check if we're in select mode
142 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
144 } else {
145 return false;
146 }
147}
148
149
150bool
152 // get edit modes
153 const auto& editModes = myNet->getViewNet()->getEditModes();
154 // check if we're in move mode
155 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
156 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
157 // check if we're editing this network element
159 if (editedNetworkElement) {
160 return editedNetworkElement == this;
161 } else {
162 // only move the first element
164 }
165 } else {
166 return false;
167 }
168}
169
170
173 // edit depending if shape is being edited
174 if (isShapeEdited()) {
175 // calculate move shape operation
176 return calculateMoveShapeOperation(this, getCrossingShape(), false);
177 } else {
178 return nullptr;
179 }
180}
181
182
183void
184GNECrossing::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
185 // edit depending if shape is being edited
186 if (isShapeEdited()) {
187 // get original shape
189 // check shape size
190 if (shape.size() > 2) {
191 // obtain index
192 int index = shape.indexOfClosest(clickedPosition);
193 // get snap radius
195 // check if we have to create a new index
196 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
197 // remove geometry point
198 shape.erase(shape.begin() + index);
199 // commit new shape
200 undoList->begin(this, TLF("remove geometry point of %", getTagStr()));
202 undoList->end();
203 }
204 }
205 }
206}
207
208
213
214
215const std::vector<NBEdge*>&
219
220
225 } else {
227 }
228}
229
230
231void
233 // continue depending of drawCrossing flag
234 if (checkDrawCrossing(s)) {
235 // get NBCrossing
236 const auto NBCrossing = getNBCrossing();
237 // get scaling depending if attribute carrier is selected
238 const double crossingExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
239 // get width
240 const double crossingWidth = NBCrossing->width * 0.5 * crossingExaggeration;
241 // get detail level
242 const auto d = s.getDetailLevel(crossingExaggeration);
243 // check if draw geometry
245 // draw crossing
246 drawCrossing(s, d, NBCrossing, crossingWidth, crossingExaggeration);
247 // draw TLS Links No
248 drawTLSLinkNo(s, NBCrossing);
249 // draw crossing name
250 if (s.cwaEdgeName.show(this)) {
252 }
253 // draw lock icon
255 // draw dotted contour depending if we're editing the custom shape
257 if (editedNetworkElement && (editedNetworkElement == this)) {
258 // draw dotted contour geometry points
260 crossingExaggeration, s.dottedContourSettings.segmentWidthSmall);
261 } else {
262 // draw dotted contour
264 }
265 }
266 // calculate contour
267 calculateCrossingContour(s, d, crossingWidth, crossingExaggeration);
268 }
269}
270
271
275
276
277void
281
282
283void
285 // check if draw
287 // push matrix
289 // move to GLO_Crossing
290 glTranslated(0, 0, GLO_CROSSING + 0.5);
291 // make a copy of shape
292 PositionVector shape = crossing->shape;
293 // extrapolate
294 shape.extrapolate(0.5); // draw on top of the walking area
295 // get link indexes
296 const int linkNo = crossing->tlLinkIndex;
297 const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
298 // draw link indexes
299 GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
301 // push matrix
303 }
304}
305
306
309 if (myShapeEdited) {
310 return getShapeEditedPopUpMenu(app, parent, getNBCrossing()->customShape);
311 } else {
312 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
313 buildPopupHeader(ret, app);
316 // build selection and show parameters menu
319 // build position copy entry
320 buildPositionCopyEntry(ret, app);
321 // check if we're in supermode network
323 // create menu commands
324 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("Set custom crossing shape"), nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
325 // check if menu commands has to be disabled
328 mcCustomShape->disable();
329 }
330 }
331 return ret;
332 }
333}
334
335
340
341
342void
343GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
344 // nothing to update
345}
346
347
348std::string
350 const auto crossing = getNBCrossing();
351 switch (key) {
352 case SUMO_ATTR_ID:
353 // get attribute requires a special case
354 if (crossing) {
355 return crossing->id;
356 } else {
357 return "Temporal Unreferenced";
358 }
359 case SUMO_ATTR_WIDTH:
360 return toString(crossing->customWidth);
362 return crossing->priority ? "true" : "false";
363 case SUMO_ATTR_EDGES:
364 return toString(crossing->edges);
366 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
368 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
369 case SUMO_ATTR_SHAPE:
371 return toString(crossing->customShape);
375 return crossing->getParametersStr();
376 default:
377 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
378 }
379}
380
381
384 switch (key) {
385 case SUMO_ATTR_SHAPE:
387 return getNBCrossing()->customShape;
388 default:
389 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
390 }
391}
392
393
394void
395GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
396 if (value == getAttribute(key)) {
397 return; //avoid needless changes, later logic relies on the fact that attributes have changed
398 }
399 switch (key) {
400 case SUMO_ATTR_ID:
401 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
402 case SUMO_ATTR_EDGES:
403 case SUMO_ATTR_WIDTH:
407 case SUMO_ATTR_SHAPE:
411 GNEChange_Attribute::changeAttribute(this, key, value, undoList, true);
412 break;
413 default:
414 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
415 }
416}
417
418
419bool
421 switch (key) {
422 case SUMO_ATTR_ID:
423 // id isn't editable
424 return false;
427 return (getNBCrossing()->tlID != "");
428 default:
429 return true;
430 }
431}
432
433
434bool
435GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
436 const auto crossing = getNBCrossing();
437 switch (key) {
438 case SUMO_ATTR_ID:
439 return false;
440 case SUMO_ATTR_EDGES:
441 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
442 // parse edges and save their IDs in a set
443 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
444 EdgeVector nbEdges;
445 for (auto i : parsedEdges) {
446 nbEdges.push_back(i->getNBEdge());
447 }
448 std::sort(nbEdges.begin(), nbEdges.end());
449 //
450 EdgeVector originalEdges = crossing->edges;
451 std::sort(originalEdges.begin(), originalEdges.end());
452 // return true if we're setting the same edges
453 if (toString(nbEdges) == toString(originalEdges)) {
454 return true;
455 } else {
457 }
458 } else {
459 return false;
460 }
461 case SUMO_ATTR_WIDTH:
462 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
464 return canParse<bool>(value);
467 // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
468 return (isAttributeEnabled(key) &&
469 canParse<int>(value)
470 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
472 && (*myParentJunction->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
473 case SUMO_ATTR_SHAPE:
475 // empty shapes are allowed
476 return canParse<PositionVector>(value);
478 return canParse<bool>(value);
481 default:
482 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
483 }
484}
485
486
491
492
493bool
495 const auto crossing = getNBCrossing();
496 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
497 return true;
498 } else {
499 return false;
500 }
501}
502
503
504bool
505GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
506 for (auto i : edges) {
507 if (checkEdgeBelong(i)) {
508 return true;
509 }
510 }
511 return false;
512}
513
514// ===========================================================================
515// private
516// ===========================================================================
517
518bool
520 // don't draw in supermode data
522 return false;
523 }
524 // check shape rotations
526 return false;
527 }
528 // check shape lengths
529 if (myCrossingGeometry.getShapeLengths().empty()) {
530 return false;
531 }
533}
534
535
536void
538 const NBNode::Crossing* crossing, const double width, const double exaggeration) const {
539 // don't draw crossing in TLS Mode
541 // get color
542 RGBColor crossingColor = getCrossingColor(s, crossing);
543 // push layer matrix
545 // translate to front
547 // set color
548 GLHelper::setColor(crossingColor);
549 // draw depending of level of detail
551 drawCrossingDetailed(width, exaggeration);
552 } else {
554 }
555 // draw shape points only in Network supemode
558 // color
559 const RGBColor darkerColor = crossingColor.changedBrightness(-32);
560 // draw on top of of the white area between the rails
561 glTranslated(0, 0, 0.2);
562 // set color
563 GLHelper::setColor(darkerColor);
564 // draw shape
566 // draw geometry points
570 }
571 // pop layer matrix
573 }
574}
575
576
579 if (myShapeEdited) {
581 } else if (drawUsingSelectColor()) {
583 } else if (!crossing->valid) {
585 } else if (crossing->priority) {
588 return s.laneColorer.getSchemes()[0].getColor(8);
589 } else {
591 }
592}
593
594
595void
596GNECrossing::drawCrossingDetailed(const double width, const double exaggeration) const {
597 // geet lenght and spacing
598 const double length = 0.5 * exaggeration;
599 const double spacing = 1.0 * exaggeration;
600 // push rail matrix
602 // draw on top of of the white area between the rails
603 glTranslated(0, 0, 0.1);
604 for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
605 // push draw matrix
607 // translate and rotate
608 glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
609 glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
610 // draw crossing depending if isn't being drawn for selecting
611 for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
612 glBegin(GL_QUADS);
613 glVertex2d(-width, -t);
614 glVertex2d(-width, -t - length);
615 glVertex2d(width, -t - length);
616 glVertex2d(width, -t);
617 glEnd();
618 }
619 // pop draw matrix
621 }
622 // pop rail matrix
624}
625
626
627void
629 const double width, const double exaggeration) const {
630 // first check if junction parent was inserted with full boundary
632 // check if calculate contour for geometry points
633 if (myShapeEdited) {
636 } else {
637 // calculate contour
638 myNetworkElementContour.calculateContourExtrudedShape(s, d, this, myCrossingGeometry.getShape(), getType(), width, exaggeration, true, true, 0, nullptr);
639 }
640 }
641}
642
643
644void
645GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
646 const auto crossing = getNBCrossing();
647 switch (key) {
648 case SUMO_ATTR_ID:
649 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
650 case SUMO_ATTR_EDGES: {
651 // obtain GNEEdges
652 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
653 // remove NBEdges of crossing
654 crossing->edges.clear();
655 // set NBEdge of every GNEEdge into Crossing Edges
656 for (auto i : edges) {
657 crossing->edges.push_back(i->getNBEdge());
658 }
659 // sort new edges
660 std::sort(crossing->edges.begin(), crossing->edges.end());
661 // change myCrossingEdges by the new edges
662 myCrossingEdges = crossing->edges;
663 // update geometry of parent junction
665 break;
666 }
667 case SUMO_ATTR_WIDTH:
668 // Change width an refresh element
669 crossing->customWidth = parse<double>(value);
670 // update boundary
671 if (myParentJunction) {
673 }
674 break;
676 crossing->priority = parse<bool>(value);
677 break;
679 crossing->customTLIndex = parse<int>(value);
680 // make new value visible immediately
681 crossing->tlLinkIndex = crossing->customTLIndex;
682 break;
684 crossing->customTLIndex2 = parse<int>(value);
685 // make new value visible immediately
686 crossing->tlLinkIndex2 = crossing->customTLIndex2;
687 break;
688 case SUMO_ATTR_SHAPE:
690 // set custom shape
691 crossing->customShape = parse<PositionVector>(value);
692 // update boundary
693 if (myParentJunction) {
695 }
696 break;
698 if (parse<bool>(value)) {
700 } else {
702 }
703 break;
705 crossing->setParametersStr(value);
706 break;
707 default:
708 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
709 }
710 // Crossing are a special case and we need ot update geometry of junction instead of crossing
711 if (myParentJunction && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
713 }
714 // invalidate demand path calculator
716}
717
718
719void
721 // set custom shape
723 // update geometry
725}
726
727
728void
730 // commit new shape
731 undoList->begin(this, TLF("moving % of %", toString(SUMO_ATTR_CUSTOMSHAPE), getTagStr()));
733 undoList->end();
734}
735
736/****************************************************************************/
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
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
#define TL(string)
Definition MsgHandler.h:315
#define TLF(string,...)
Definition MsgHandler.h:317
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:654
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:838
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition GLHelper.cpp:347
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
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
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
void 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...)
Boundary getContourBoundary() const
get contour boundary
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
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
GNEJunction * myParentJunction
the parent junction of 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 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)
GNEJunction * getParentJunction() const
get parent Junction
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:781
void updateGeometry()
update pre-computed geometry information (including crossings)
NBNode * getNBNode() const
Return net build node.
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:345
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:145
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2155
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
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
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
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
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
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.
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.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
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)
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const GUIGlObject *parent, const double layer)
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
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
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
Definition NBNode.h:336
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition NBNode.cpp:3868
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition NBNode.cpp:2852
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
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