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);
373 return crossing->getParametersStr();
374 default:
375 return getCommonAttribute(key);
376 }
377}
378
379
382 switch (key) {
383 case SUMO_ATTR_SHAPE:
385 return getNBCrossing()->customShape;
386 default:
387 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
388 }
389}
390
391
392void
393GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
394 if (value == getAttribute(key)) {
395 return; //avoid needless changes, later logic relies on the fact that attributes have changed
396 }
397 switch (key) {
398 case SUMO_ATTR_ID:
399 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
400 case SUMO_ATTR_EDGES:
401 case SUMO_ATTR_WIDTH:
405 case SUMO_ATTR_SHAPE:
408 GNEChange_Attribute::changeAttribute(this, key, value, undoList, true);
409 break;
410 default:
411 setCommonAttribute(key, value, undoList);
412 break;
413 }
414}
415
416
417bool
419 switch (key) {
420 case SUMO_ATTR_ID:
421 // id isn't editable
422 return false;
425 return (getNBCrossing()->tlID != "");
426 default:
427 return true;
428 }
429}
430
431
432bool
433GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
434 const auto crossing = getNBCrossing();
435 switch (key) {
436 case SUMO_ATTR_ID:
437 return false;
438 case SUMO_ATTR_EDGES:
439 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
440 // parse edges and save their IDs in a set
441 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
442 EdgeVector nbEdges;
443 for (auto i : parsedEdges) {
444 nbEdges.push_back(i->getNBEdge());
445 }
446 std::sort(nbEdges.begin(), nbEdges.end());
447 //
448 EdgeVector originalEdges = crossing->edges;
449 std::sort(originalEdges.begin(), originalEdges.end());
450 // return true if we're setting the same edges
451 if (toString(nbEdges) == toString(originalEdges)) {
452 return true;
453 } else {
455 }
456 } else {
457 return false;
458 }
459 case SUMO_ATTR_WIDTH:
460 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
462 return canParse<bool>(value);
465 // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
466 return (isAttributeEnabled(key) &&
467 canParse<int>(value)
468 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
470 && (*myParentJunction->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
471 case SUMO_ATTR_SHAPE:
473 // empty shapes are allowed
474 return canParse<PositionVector>(value);
477 default:
478 return isValid(key, value);
479 }
480}
481
482
487
488
489bool
491 const auto crossing = getNBCrossing();
492 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
493 return true;
494 } else {
495 return false;
496 }
497}
498
499
500bool
501GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
502 for (auto i : edges) {
503 if (checkEdgeBelong(i)) {
504 return true;
505 }
506 }
507 return false;
508}
509
510// ===========================================================================
511// private
512// ===========================================================================
513
514bool
516 // don't draw in supermode data
518 return false;
519 }
520 // check shape rotations
522 return false;
523 }
524 // check shape lengths
525 if (myCrossingGeometry.getShapeLengths().empty()) {
526 return false;
527 }
529}
530
531
532void
534 const NBNode::Crossing* crossing, const double width, const double exaggeration) const {
535 // don't draw crossing in TLS Mode
537 // get color
538 RGBColor crossingColor = getCrossingColor(s, crossing);
539 // push layer matrix
541 // translate to front
543 // set color
544 GLHelper::setColor(crossingColor);
545 // draw depending of level of detail
547 drawCrossingDetailed(width, exaggeration);
548 } else {
550 }
551 // draw shape points only in Network supemode
554 // color
555 const RGBColor darkerColor = crossingColor.changedBrightness(-32);
556 // draw on top of of the white area between the rails
557 glTranslated(0, 0, 0.2);
558 // set color
559 GLHelper::setColor(darkerColor);
560 // draw shape
562 // draw geometry points
566 }
567 // pop layer matrix
569 }
570}
571
572
575 if (myShapeEdited) {
577 } else if (drawUsingSelectColor()) {
579 } else if (!crossing->valid) {
581 } else if (crossing->priority) {
584 return s.laneColorer.getSchemes()[0].getColor(8);
585 } else {
587 }
588}
589
590
591void
592GNECrossing::drawCrossingDetailed(const double width, const double exaggeration) const {
593 // geet lenght and spacing
594 const double length = 0.5 * exaggeration;
595 const double spacing = 1.0 * exaggeration;
596 // push rail matrix
598 // draw on top of of the white area between the rails
599 glTranslated(0, 0, 0.1);
600 for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
601 // push draw matrix
603 // translate and rotate
604 glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
605 glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
606 // draw crossing depending if isn't being drawn for selecting
607 for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
608 glBegin(GL_QUADS);
609 glVertex2d(-width, -t);
610 glVertex2d(-width, -t - length);
611 glVertex2d(width, -t - length);
612 glVertex2d(width, -t);
613 glEnd();
614 }
615 // pop draw matrix
617 }
618 // pop rail matrix
620}
621
622
623void
625 const double width, const double exaggeration) const {
626 // first check if junction parent was inserted with full boundary
628 // check if calculate contour for geometry points
629 if (myShapeEdited) {
632 } else {
633 // in move mode, add to selected object if this is the edited element
634 const auto& editModes = myNet->getViewNet()->getEditModes();
635 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
637 // calculate contour and
639 width, exaggeration, true, true, 0, nullptr, myParentJunction, addToSelectedObjects);
640 }
641 }
642}
643
644
645void
646GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
647 const auto crossing = getNBCrossing();
648 switch (key) {
649 case SUMO_ATTR_ID:
650 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
651 case SUMO_ATTR_EDGES: {
652 // obtain GNEEdges
653 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
654 // remove NBEdges of crossing
655 crossing->edges.clear();
656 // set NBEdge of every GNEEdge into Crossing Edges
657 for (auto i : edges) {
658 crossing->edges.push_back(i->getNBEdge());
659 }
660 // sort new edges
661 std::sort(crossing->edges.begin(), crossing->edges.end());
662 // change myCrossingEdges by the new edges
663 myCrossingEdges = crossing->edges;
664 // update geometry of parent junction
666 break;
667 }
668 case SUMO_ATTR_WIDTH:
669 // Change width an refresh element
670 crossing->customWidth = parse<double>(value);
671 // update boundary
672 if (myParentJunction) {
674 }
675 break;
677 crossing->priority = parse<bool>(value);
678 break;
680 crossing->customTLIndex = parse<int>(value);
681 // make new value visible immediately
682 crossing->tlLinkIndex = crossing->customTLIndex;
683 break;
685 crossing->customTLIndex2 = parse<int>(value);
686 // make new value visible immediately
687 crossing->tlLinkIndex2 = crossing->customTLIndex2;
688 break;
689 case SUMO_ATTR_SHAPE:
691 // set custom shape
692 crossing->customShape = parse<PositionVector>(value);
693 // update boundary
694 if (myParentJunction) {
696 }
697 break;
699 crossing->setParametersStr(value);
700 break;
701 default:
702 setCommonAttribute(key, value);
703 break;
704 }
705 // Crossing are a special case and we need ot update geometry of junction instead of crossing
706 if (myParentJunction && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
708 }
709 // invalidate demand path calculator
711}
712
713
714void
716 // set custom shape
718 // update geometry
720}
721
722
723void
725 // commit new shape
726 undoList->begin(this, TLF("moving % of %", toString(SUMO_ATTR_CUSTOMSHAPE), getTagStr()));
728 undoList->end();
729}
730
731/****************************************************************************/
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: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:833
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)
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
std::string getCommonAttribute(SumoXMLAttr key) const
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
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:2163
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
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 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
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:3921
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition NBNode.cpp:2905
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