Eclipse SUMO - Simulation of Urban MObility
GNECrossing.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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>
26 #include <utils/gui/div/GLHelper.h>
31 
32 #include "GNECrossing.h"
33 
34 
35 // ===========================================================================
36 // method definitions
37 // ===========================================================================
38 GNECrossing::GNECrossing(GNEJunction* parentJunction, std::vector<NBEdge*> crossingEdges) :
39  GNENetworkElement(parentJunction->getNet(), parentJunction->getNBNode()->getCrossing(crossingEdges)->id,
41 {}, {}, {}, {}, {}, {}, {}, {}),
42 myParentJunction(parentJunction),
43 myCrossingEdges(crossingEdges) {
44  // update centering boundary without updating grid
45  updateCenteringBoundary(false);
46 }
47 
48 
50 
51 
52 const PositionVector&
55  if (crossing) {
56  return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
57  } else {
58  throw ProcessError("Crossing doesn't exist");
59  }
60 }
61 
62 
63 void
65  // rebuild crossing and walking areas form node parent
67  // update crossing geometry
68  myCrossingGeometry.updateGeometry(crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape);
69 }
70 
71 
74  // currently unused
75  return Position(0, 0);
76 }
77 
78 
80 GNECrossing::getMoveOperation(const double shapeOffset) {
81  // edit depending if shape is being edited
82  if (isShapeEdited()) {
83  // get original shape
84  const PositionVector originalShape = getCrossingShape();
85  // declare shape to move
86  PositionVector shapeToMove = originalShape;
87  // first check if in the given shapeOffset there is a geometry point
88  const Position positionAtOffset = shapeToMove.positionAtOffset2D(shapeOffset);
89  // check if position is valid
90  if (positionAtOffset == Position::INVALID) {
91  return nullptr;
92  } else {
93  // obtain index
94  const int index = originalShape.indexOfClosest(positionAtOffset);
95  // declare new index
96  int newIndex = index;
97  // get snap radius
99  // check if we have to create a new index
100  if (positionAtOffset.distanceSquaredTo2D(shapeToMove[index]) > (snap_radius * snap_radius)) {
101  newIndex = shapeToMove.insertAtClosest(positionAtOffset, true);
102  }
103  // return move operation for edit shape
104  return new GNEMoveOperation(this, originalShape, {index}, shapeToMove, {newIndex});
105  }
106  } else {
107  return nullptr;
108  }
109 }
110 
111 
112 void
113 GNECrossing::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
114  // edit depending if shape is being edited
115  if (isShapeEdited()) {
116  // get original shape
118  // check shape size
119  if (shape.size() > 2) {
120  // obtain index
121  int index = shape.indexOfClosest(clickedPosition);
122  // get snap radius
124  // check if we have to create a new index
125  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
126  // remove geometry point
127  shape.erase(shape.begin() + index);
128  // commit new shape
129  undoList->p_begin("remove geometry point of " + getTagStr());
130  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_CUSTOMSHAPE, toString(shape)));
131  undoList->p_end();
132  }
133  }
134  }
135 }
136 
137 
140  return myParentJunction;
141 }
142 
143 
144 const std::vector<NBEdge*>&
146  return myCrossingEdges;
147 }
148 
149 
153 }
154 
155 
156 void
158  // declare flag for drawing crossing
159  bool drawCrossing = s.drawCrossingsAndWalkingareas;
160  // don't draw in supermode data
162  drawCrossing = false;
163  }
164  // check shape rotations
165  if (myCrossingGeometry.getShapeRotations().empty()) {
166  drawCrossing = false;
167  }
168  // check shape lengths
169  if (myCrossingGeometry.getShapeLengths().empty()) {
170  drawCrossing = false;
171  }
172  // check zoom
173  if (s.scale < 3.0) {
174  drawCrossing = false;
175  }
176  // continue depending of drawCrossing flag
177  if (drawCrossing) {
178  // get NBCrossing
179  const auto NBCrossing = myParentJunction->getNBNode()->getCrossing(myCrossingEdges);
180  // draw crossing checking whether it is not too small if isn't being drawn for selecting
181  const double selectionScale = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
182  // set default values
183  const double length = 0.5 * selectionScale;
184  const double spacing = 1.0 * selectionScale;
185  const double halfWidth = NBCrossing->width * 0.5 * selectionScale;
186  // get color
187  RGBColor crossingColor;
188  // first check if we're editing shape
189  if (myShapeEdited) {
190  crossingColor = s.colorSettings.editShape;
191  } else if (drawUsingSelectColor()) {
192  crossingColor = s.colorSettings.selectedCrossingColor;
193  } else if (!NBCrossing->valid) {
194  crossingColor = s.colorSettings.crossingInvalid;
195  } else if (NBCrossing->priority) {
196  crossingColor = s.colorSettings.crossingPriority;
198  crossingColor = s.laneColorer.getSchemes()[0].getColor(8);
199  } else {
200  crossingColor = s.colorSettings.crossing;
201  }
202  // check that current mode isn't TLS
204  // push name
205  glPushName(getGlID());
206  // push layer matrix
207  glPushMatrix();
208  // translate to front
210  // set color
211  GLHelper::setColor(crossingColor);
212  // draw depending of selection
214  // just drawn a box line
216  } else {
217  // push rail matrix
218  glPushMatrix();
219  // draw on top of of the white area between the rails
220  glTranslated(0, 0, 0.1);
221  for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
222  // push draw matrix
223  glPushMatrix();
224  // translate and rotate
225  glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
226  glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
227  // draw crossing depending if isn't being drawn for selecting
228  for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
229  glBegin(GL_QUADS);
230  glVertex2d(-halfWidth, -t);
231  glVertex2d(-halfWidth, -t - length);
232  glVertex2d(halfWidth, -t - length);
233  glVertex2d(halfWidth, -t);
234  glEnd();
235  }
236  // pop draw matrix
237  glPopMatrix();
238  }
239  // pop rail matrix
240  glPopMatrix();
241  }
242  // draw shape points only in Network supemode
244  // color
245  const RGBColor darkerColor = crossingColor.changedBrightness(-32);
246  // draw geometry points
248  // draw moving hint
250  }
251  // pop layer matrix
252  glPopMatrix();
253  // pop name
254  glPopName();
255  }
256  // link indices must be drawn in all edit modes if isn't being drawn for selecting
258  drawTLSLinkNo(s, NBCrossing);
259  }
260  // check if dotted contour has to be drawn (not useful at high zoom)
263  }
264  // check if dotted contour has to be drawn (not useful at high zoom)
265  if (s.drawDottedContour() || (myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
267  }
268  }
269 }
270 
271 
272 void
274  // push matrix
275  glPushMatrix();
276  // move to GLO_Crossing
277  glTranslated(0, 0, GLO_CROSSING + 0.5);
278  // make a copy of shape
279  PositionVector shape = crossing->shape;
280  // extrapolate
281  shape.extrapolate(0.5); // draw on top of the walking area
282  // get link indexes
283  const int linkNo = crossing->tlLinkIndex;
284  const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
285  // draw link indexes
286  GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
287  GLHelper::drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex, s.scale);
288  // push matrix
289  glPopMatrix();
290 }
291 
292 
295  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
296  buildPopupHeader(ret, app);
299  // build selection and show parameters menu
302  // build position copy entry
303  buildPositionCopyEntry(ret, false);
304  // check if we're in supermode network
306  // create menu commands
307  FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom crossing shape", nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
308  // check if menu commands has to be disabled
310  if ((editMode == NetworkEditMode::NETWORK_CONNECT) || (editMode == NetworkEditMode::NETWORK_TLS) || (editMode == NetworkEditMode::NETWORK_CREATE_EDGE)) {
311  mcCustomShape->disable();
312  }
313  }
314  return ret;
315 }
316 
317 
318 void
319 GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
321  if (crossing) {
322  if (crossing->customShape.size() > 0) {
323  myBoundary = crossing->customShape.getBoxBoundary();
324  myBoundary.grow(10);
325  } else if (crossing->shape.size() > 0) {
326  myBoundary = crossing->shape.getBoxBoundary();
327  myBoundary.grow(10);
328  } else {
330  }
331  } else {
332  // in other case use boundary of parent junction
334  }
335 }
336 
337 
338 std::string
340  auto crossing = myParentJunction->getNBNode()->getCrossing(myCrossingEdges, (key != SUMO_ATTR_ID));
341  switch (key) {
342  case SUMO_ATTR_ID:
343  // get attribute requires a special case
344  if (crossing) {
345  return crossing->id;
346  } else {
347  return "Temporal Unreferenced";
348  }
349  case SUMO_ATTR_WIDTH:
350  return toString(crossing->customWidth);
351  case SUMO_ATTR_PRIORITY:
352  return crossing->priority ? "true" : "false";
353  case SUMO_ATTR_EDGES:
354  return toString(crossing->edges);
356  return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
358  return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
360  return toString(crossing->customShape);
361  case GNE_ATTR_SELECTED:
363  case GNE_ATTR_PARAMETERS:
364  return crossing->getParametersStr();
365  default:
366  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
367  }
368 }
369 
370 
371 void
372 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
373  if (value == getAttribute(key)) {
374  return; //avoid needless changes, later logic relies on the fact that attributes have changed
375  }
376  switch (key) {
377  case SUMO_ATTR_ID:
378  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
379  case SUMO_ATTR_EDGES:
380  case SUMO_ATTR_WIDTH:
381  case SUMO_ATTR_PRIORITY:
385  case GNE_ATTR_SELECTED:
386  case GNE_ATTR_PARAMETERS:
387  undoList->add(new GNEChange_Attribute(this, key, value), true);
388  break;
389  default:
390  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
391  }
392 }
393 
394 
395 bool
397  switch (key) {
398  case SUMO_ATTR_ID:
399  // id isn't editable
400  return false;
404  default:
405  return true;
406  }
407 }
408 
409 
410 bool
411 GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
413  switch (key) {
414  case SUMO_ATTR_ID:
415  return false;
416  case SUMO_ATTR_EDGES:
417  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
418  // parse edges and save their IDs in a set
419  std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
420  EdgeVector nbEdges;
421  for (auto i : parsedEdges) {
422  nbEdges.push_back(i->getNBEdge());
423  }
424  std::sort(nbEdges.begin(), nbEdges.end());
425  //
426  EdgeVector originalEdges = crossing->edges;
427  std::sort(originalEdges.begin(), originalEdges.end());
428  // return true if we're setting the same edges
429  if (toString(nbEdges) == toString(originalEdges)) {
430  return true;
431  } else {
433  }
434  } else {
435  return false;
436  }
437  case SUMO_ATTR_WIDTH:
438  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // kann NICHT 0 sein, oder -1 (bedeutet default)
439  case SUMO_ATTR_PRIORITY:
440  return canParse<bool>(value);
443  // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting idnices
444  return (isAttributeEnabled(key) &&
445  canParse<int>(value)
446  && (parse<double>(value) >= 0 || parse<double>(value) == -1)
447  && myParentJunction->getNBNode()->getControllingTLS().size() > 0
448  && (*myParentJunction->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
449  case SUMO_ATTR_CUSTOMSHAPE: {
450  // empty shapes are allowed
451  return canParse<PositionVector>(value);
452  }
453  case GNE_ATTR_SELECTED:
454  return canParse<bool>(value);
455  case GNE_ATTR_PARAMETERS:
456  return Parameterised::areParametersValid(value);
457  default:
458  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
459  }
460 }
461 
462 
463 const std::map<std::string, std::string>&
466 }
467 
468 
469 bool
472  if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
473  return true;
474  } else {
475  return false;
476  }
477 }
478 
479 
480 bool
481 GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
482  for (auto i : edges) {
483  if (checkEdgeBelong(i)) {
484  return true;
485  }
486  }
487  return false;
488 }
489 
490 // ===========================================================================
491 // private
492 // ===========================================================================
493 
494 void
495 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
497  switch (key) {
498  case SUMO_ATTR_ID:
499  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
500  case SUMO_ATTR_EDGES: {
501  // obtain GNEEdges
502  std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
503  // remove NBEdges of crossing
504  crossing->edges.clear();
505  // set NBEdge of every GNEEdge into Crossing Edges
506  for (auto i : edges) {
507  crossing->edges.push_back(i->getNBEdge());
508  }
509  // sort new edges
510  std::sort(crossing->edges.begin(), crossing->edges.end());
511  // change myCrossingEdges by the new edges
512  myCrossingEdges = crossing->edges;
513  // update geometry of parent junction
515  break;
516  }
517  case SUMO_ATTR_WIDTH:
518  // Change width an refresh element
519  crossing->customWidth = parse<double>(value);
520  // update boundary
522  break;
523  case SUMO_ATTR_PRIORITY:
524  crossing->priority = parse<bool>(value);
525  break;
527  crossing->customTLIndex = parse<int>(value);
528  // make new value visible immediately
529  crossing->tlLinkIndex = crossing->customTLIndex;
530  break;
532  crossing->customTLIndex2 = parse<int>(value);
533  // make new value visible immediately
534  crossing->tlLinkIndex2 = crossing->customTLIndex2;
535  break;
536  case SUMO_ATTR_CUSTOMSHAPE: {
537  // set custom shape
538  crossing->customShape = parse<PositionVector>(value);
539  // update boundary
541  break;
542  }
543  case GNE_ATTR_SELECTED:
544  if (parse<bool>(value)) {
546  } else {
548  }
549  break;
550  case GNE_ATTR_PARAMETERS:
551  crossing->setParametersStr(value);
552  break;
553  default:
554  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
555  }
556  // Crossing are a special case and we need ot update geometry of junction instead of crossing
557  if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
559  }
560 }
561 
562 
563 void
565  // set custom shape
567  // update geometry
568  updateGeometry();
569 }
570 
571 
572 void
574  // commit new shape
575  undoList->p_begin("moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
576  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_CUSTOMSHAPE, toString(moveResult.shapeToUpdate)));
577  undoList->p_end();
578 }
579 
580 /****************************************************************************/
NetworkEditMode
@brie enum for network edit modes
@ 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 junction shape
Definition: GUIAppEnum.h:1014
@ GLO_CROSSING
a tl-logic
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
@ 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:44
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:446
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:580
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:181
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)
Definition: GNECrossing.h:146
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:64
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNECrossing.cpp:73
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
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNECrossing.cpp:80
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:143
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEJunction * getParentJunction() const
get parent Junction
GNECrossing(GNEJunction *parentJunction, std::vector< NBEdge * > edges)
Constructor.
Definition: GNECrossing.cpp:38
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
GNEGeometry::Geometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:149
const PositionVector & getCrossingShape() const
Definition: GNECrossing.cpp:53
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:49
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
bool isValid(SumoXMLAttr key, const std::string &value)
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:399
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, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
Definition: GNEGeometry.cpp:81
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
void updateGeometry()
update pre-computed geometry information (including crossings)
Definition: GNEJunction.cpp:92
NBNode * getNBNode() const
Return net build node.
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
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 p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:467
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
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.
GUIGlID getGlID() const
Returns the numerical id of the object.
const std::vector< T > & getSchemes() const
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
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
bool drawDottedContour() const
check if dotted contour can be drawn
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 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:129
int tlLinkIndex
the traffic light index of this crossing (if controlled)
Definition: NBNode.h:154
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBNode.h:160
PositionVector customShape
optional customShape for this crossing
Definition: NBNode.h:152
PositionVector shape
The crossing's shape.
Definition: NBNode.h:138
int tlLinkIndex2
Definition: NBNode.h:155
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition: NBNode.cpp:3270
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition: NBNode.cpp:2532
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:322
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:246
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:282
A list of positions.
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
int indexOfClosest(const Position &p) const
index of the closest position to p
PositionVector reverse() const
reverse position vector
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:145
static void drawGeometryPoints(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration)
draw geometry points
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration)
draw dotted contour for the given shape (used by additionals)
static void drawMovingHint(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
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 const RGBColor crossingInvalid
color for invalid crossing
static const RGBColor crossing
color for crossings
RGBColor selectedCrossingColor
crossings selection color
static const RGBColor editShape
color for edited shapes (Junctions, crossings and connections)
static const RGBColor crossingPriority
color for priority crossing
static const double crossingGeometryPointRadius
moving crossing geometry point radius