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-2023 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 "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
102 // edit depending if shape is being edited
103 if (isShapeEdited()) {
104 // calculate move shape operation
107 } else {
108 return nullptr;
109 }
110}
111
112
113void
114GNECrossing::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
115 // edit depending if shape is being edited
116 if (isShapeEdited()) {
117 // get original shape
119 // check shape size
120 if (shape.size() > 2) {
121 // obtain index
122 int index = shape.indexOfClosest(clickedPosition);
123 // get snap radius
125 // check if we have to create a new index
126 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
127 // remove geometry point
128 shape.erase(shape.begin() + index);
129 // commit new shape
130 undoList->begin(GUIIcon::CROSSING, "remove geometry point of " + getTagStr());
132 undoList->end();
133 }
134 }
135 }
136}
137
138
143
144
145const std::vector<NBEdge*>&
149
150
155 } else {
157 }
158}
159
160
161void
163 // check if draw start und end
164 const bool drawExtremeSymbols = myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
166 // declare flag for drawing crossing
167 bool drawCrossing = s.drawCrossingsAndWalkingareas;
168 // don't draw in supermode data
170 drawCrossing = false;
171 }
172 // check shape rotations
174 drawCrossing = false;
175 }
176 // check shape lengths
177 if (myCrossingGeometry.getShapeLengths().empty()) {
178 drawCrossing = false;
179 }
180 // check zoom
181 if (s.scale < 3.0) {
182 drawCrossing = false;
183 }
184 // continue depending of drawCrossing flag
185 if (drawCrossing) {
186 // get NBCrossing
187 const auto NBCrossing = getNBCrossing();
188 // draw crossing checking whether it is not too small if isn't being drawn for selecting
189 const double selectionScale = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
190 // set default values
191 const double length = 0.5 * selectionScale;
192 const double spacing = 1.0 * selectionScale;
193 const double halfWidth = NBCrossing->width * 0.5 * selectionScale;
194 // get color
195 RGBColor crossingColor;
196 // first check if we're editing shape
197 if (myShapeEdited) {
198 crossingColor = s.colorSettings.editShapeColor;
199 } else if (drawUsingSelectColor()) {
200 crossingColor = s.colorSettings.selectedCrossingColor;
201 } else if (!NBCrossing->valid) {
202 crossingColor = s.colorSettings.crossingInvalidColor;
203 } else if (NBCrossing->priority) {
204 crossingColor = s.colorSettings.crossingPriorityColor;
206 crossingColor = s.laneColorer.getSchemes()[0].getColor(8);
207 } else {
208 crossingColor = s.colorSettings.crossingColor;
209 }
210 // avoid draw invisible elements
211 if (crossingColor.alpha() != 0) {
212 // check that current mode isn't TLS
214 // push name
216 // push layer matrix
218 // translate to front
220 // set color
221 GLHelper::setColor(crossingColor);
222 // draw depending of selection
224 // just drawn a box line
226 } else {
227 // push rail matrix
229 // draw on top of of the white area between the rails
230 glTranslated(0, 0, 0.1);
231 for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
232 // push draw matrix
234 // translate and rotate
235 glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
236 glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
237 // draw crossing depending if isn't being drawn for selecting
238 for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
239 glBegin(GL_QUADS);
240 glVertex2d(-halfWidth, -t);
241 glVertex2d(-halfWidth, -t - length);
242 glVertex2d(halfWidth, -t - length);
243 glVertex2d(halfWidth, -t);
244 glEnd();
245 }
246 // pop draw matrix
248 }
249 // pop rail matrix
251 }
252 // draw shape points only in Network supemode
254 // color
255 const RGBColor darkerColor = crossingColor.changedBrightness(-32);
256 // draw geometry points
259 myNet->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
260 // draw moving hint
264 }
265 }
266 // pop layer matrix
268 // pop name
270 }
271 // link indices must be drawn in all edit modes if isn't being drawn for selecting
273 drawTLSLinkNo(s, NBCrossing);
274 }
275 // draw crosing name
276 if (s.cwaEdgeName.show(this)) {
278 }
279 // draw lock icon
281 }
282 // check if mouse is over element
284 // inspect contour
287 selectionScale, true, true);
288 }
289 // front contour
290 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
292 selectionScale, true, true);
293 }
294 // delete contour
295 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
297 selectionScale, true, true);
298 }
299 // delete contour
300 if (myNet->getViewNet()->drawSelectContour(this, this)) {
302 selectionScale, true, true);
303 }
304 }
305}
306
307
311
312
313void
317
318
319void
321 // push matrix
323 // move to GLO_Crossing
324 glTranslated(0, 0, GLO_CROSSING + 0.5);
325 // make a copy of shape
326 PositionVector shape = crossing->shape;
327 // extrapolate
328 shape.extrapolate(0.5); // draw on top of the walking area
329 // get link indexes
330 const int linkNo = crossing->tlLinkIndex;
331 const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
332 // draw link indexes
333 GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
335 // push matrix
337}
338
339
342 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
343 buildPopupHeader(ret, app);
346 // build selection and show parameters menu
349 // build position copy entry
350 buildPositionCopyEntry(ret, app);
351 // check if we're in supermode network
353 // create menu commands
354 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom crossing shape", nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
355 // check if menu commands has to be disabled
358 mcCustomShape->disable();
359 }
360 }
361 return ret;
362}
363
364
365void
366GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
367 const auto crossing = getNBCrossing();
368 if (crossing) {
369 if (crossing->customShape.size() > 0) {
370 myBoundary = crossing->customShape.getBoxBoundary();
371 myBoundary.grow(10);
372 } else if (crossing->shape.size() > 0) {
373 myBoundary = crossing->shape.getBoxBoundary();
374 myBoundary.grow(10);
375 } else {
377 }
378 } else {
379 // in other case use boundary of parent junction
381 }
382}
383
384
385std::string
387 const auto crossing = getNBCrossing();
388 switch (key) {
389 case SUMO_ATTR_ID:
390 // get attribute requires a special case
391 if (crossing) {
392 return crossing->id;
393 } else {
394 return "Temporal Unreferenced";
395 }
396 case SUMO_ATTR_WIDTH:
397 return toString(crossing->customWidth);
399 return crossing->priority ? "true" : "false";
400 case SUMO_ATTR_EDGES:
401 return toString(crossing->edges);
403 return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
405 return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
407 return toString(crossing->customShape);
411 return crossing->getParametersStr();
412 default:
413 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
414 }
415}
416
417
418void
419GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
420 if (value == getAttribute(key)) {
421 return; //avoid needless changes, later logic relies on the fact that attributes have changed
422 }
423 switch (key) {
424 case SUMO_ATTR_ID:
425 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
426 case SUMO_ATTR_EDGES:
427 case SUMO_ATTR_WIDTH:
434 undoList->add(new GNEChange_Attribute(this, key, value), true);
435 break;
436 default:
437 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
438 }
439}
440
441
442bool
444 switch (key) {
445 case SUMO_ATTR_ID:
446 // id isn't editable
447 return false;
450 return (getNBCrossing()->tlID != "");
451 default:
452 return true;
453 }
454}
455
456
457bool
458GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
459 const auto crossing = getNBCrossing();
460 switch (key) {
461 case SUMO_ATTR_ID:
462 return false;
463 case SUMO_ATTR_EDGES:
464 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
465 // parse edges and save their IDs in a set
466 std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
467 EdgeVector nbEdges;
468 for (auto i : parsedEdges) {
469 nbEdges.push_back(i->getNBEdge());
470 }
471 std::sort(nbEdges.begin(), nbEdges.end());
472 //
473 EdgeVector originalEdges = crossing->edges;
474 std::sort(originalEdges.begin(), originalEdges.end());
475 // return true if we're setting the same edges
476 if (toString(nbEdges) == toString(originalEdges)) {
477 return true;
478 } else {
480 }
481 } else {
482 return false;
483 }
484 case SUMO_ATTR_WIDTH:
485 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
487 return canParse<bool>(value);
490 // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
491 return (isAttributeEnabled(key) &&
492 canParse<int>(value)
493 && (parse<double>(value) >= 0 || parse<double>(value) == -1)
495 && (*myParentJunction->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
497 // empty shapes are allowed
498 return canParse<PositionVector>(value);
499 }
501 return canParse<bool>(value);
504 default:
505 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
506 }
507}
508
509
514
515
516bool
518 const auto crossing = getNBCrossing();
519 if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
520 return true;
521 } else {
522 return false;
523 }
524}
525
526
527bool
528GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
529 for (auto i : edges) {
530 if (checkEdgeBelong(i)) {
531 return true;
532 }
533 }
534 return false;
535}
536
537// ===========================================================================
538// private
539// ===========================================================================
540
541void
542GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
543 const auto crossing = getNBCrossing();
544 switch (key) {
545 case SUMO_ATTR_ID:
546 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
547 case SUMO_ATTR_EDGES: {
548 // obtain GNEEdges
549 std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
550 // remove NBEdges of crossing
551 crossing->edges.clear();
552 // set NBEdge of every GNEEdge into Crossing Edges
553 for (auto i : edges) {
554 crossing->edges.push_back(i->getNBEdge());
555 }
556 // sort new edges
557 std::sort(crossing->edges.begin(), crossing->edges.end());
558 // change myCrossingEdges by the new edges
559 myCrossingEdges = crossing->edges;
560 // update geometry of parent junction
562 break;
563 }
564 case SUMO_ATTR_WIDTH:
565 // Change width an refresh element
566 crossing->customWidth = parse<double>(value);
567 // update boundary
568 if (myParentJunction) {
570 }
571 break;
573 crossing->priority = parse<bool>(value);
574 break;
576 crossing->customTLIndex = parse<int>(value);
577 // make new value visible immediately
578 crossing->tlLinkIndex = crossing->customTLIndex;
579 break;
581 crossing->customTLIndex2 = parse<int>(value);
582 // make new value visible immediately
583 crossing->tlLinkIndex2 = crossing->customTLIndex2;
584 break;
586 // set custom shape
587 crossing->customShape = parse<PositionVector>(value);
588 // update boundary
589 if (myParentJunction) {
591 }
592 break;
593 }
595 if (parse<bool>(value)) {
597 } else {
599 }
600 break;
602 crossing->setParametersStr(value);
603 break;
604 default:
605 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
606 }
607 // Crossing are a special case and we need ot update geometry of junction instead of crossing
608 if (myParentJunction && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
610 }
611 // invalidate path calculator
613}
614
615
616void
618 // set custom shape
620 // update geometry
622}
623
624
625void
627 // commit new shape
628 undoList->begin(GUIIcon::CROSSING, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
630 undoList->end();
631}
632
633/****************************************************************************/
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_CROSSING_EDIT_SHAPE
edit crossing shape
@ GLO_CROSSING
a tl-logic
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
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_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
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:300
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:583
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:767
static void pushName(unsigned int name)
push Name
Definition GLHelper.cpp:139
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:329
static void popName()
pop Name
Definition GLHelper.cpp:148
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
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
std::string getAttribute(SumoXMLAttr key) const
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
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.)
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 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
GUIGeometry myCrossingGeometry
crossing geometry
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEJunction * getParentJunction() const
get parent Junction
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
std::string getNetworkElementProblem() const
return a string with the current network element problem
const PositionVector & getCrossingShape() const
~GNECrossing()
Destructor.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:480
void updateGeometry()
update pre-computed geometry information (including crossings)
NBNode * getNBNode() const
Return net build node.
GNEMoveOperation * calculateMoveShapeOperation(const PositionVector originalShape, const Position mousePosition, const double snapRadius, const bool onlyContour)
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:325
GNEPathManager * getPathManager()
get path manager
Definition GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
bool myShapeEdited
flag to check if element shape is being edited
bool isShapeEdited() const
check if shape is being edited
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Boundary myBoundary
object boundary
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...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEUndoList * getUndoList() const
get the undoList object
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
static void drawDottedContourShape(const GUIVisualizationSettings &s, const DottedContourType type, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given shape (used by additionals)
The popup menu of a globject.
static void drawGeometryPoints(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
draw geometry points
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
static void drawMovingHint(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
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.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
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)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationTextSettings cwaEdgeName
bool drawMovingGeometryPoint(const double exaggeration, const double radius) const
check if moving geometry point can be draw
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
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:160
PositionVector customShape
optional customShape for this crossing
Definition NBNode.h:158
PositionVector shape
The crossing's shape.
Definition NBNode.h:144
bool valid
whether this crossing is valid (and can be written to the net.xml). This is needed for netedit becaus...
Definition NBNode.h:168
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:334
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition NBNode.cpp:3686
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition NBNode.cpp:2829
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
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition RGBColor.cpp:92
static const RGBColor BLACK
Definition RGBColor.h:193
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
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, 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 crossingGeometryPointRadius
moving crossing geometry point radius
bool show(const GUIGlObject *o) const
whether to show the text