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.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>
26 #include <utils/gui/div/GLHelper.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),
43 myTemplateNBCrossing(new NBNode::Crossing(nullptr, {}, 0, false, 0, 0, {})) {
44  // reset default values
45  resetDefaultValues();
46 }
47 
48 GNECrossing::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), {}, {}, {}, {}, {}, {}),
51 myParentJunction(parentJunction),
52 myCrossingEdges(crossingEdges),
53 myTemplateNBCrossing(nullptr) {
54  // update centering boundary without updating grid
55  updateCenteringBoundary(false);
56 }
57 
58 
61  delete myTemplateNBCrossing;
62  }
63 }
64 
65 
66 bool
68  return getNBCrossing()->valid;
69 }
70 
71 
72 std::string
74  return TL("Crossing's edges don't support pedestrians");
75 }
76 
77 
78 const PositionVector&
80  const auto crossing = getNBCrossing();
81  return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
82 }
83 
84 
85 void
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 
100 bool
102  return false;
103 }
104 
105 
106 bool
108  return false;
109 }
110 
111 
112 bool
114  return false;
115 }
116 
117 
118 bool
120  return false;
121 }
122 
123 
124 bool
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 
137 bool
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 
150 bool
152  // get edit modes
153  const auto& editModes = myNet->getViewNet()->getEditModes();
154  // check if we're in move mode
155  if (!myNet->getViewNet()->isMovingElement() && editModes.isCurrentSupermodeNetwork() &&
156  (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
157  // only move the first element
159  } else {
160  return false;
161  }
162 }
163 
164 
167  // edit depending if shape is being edited
168  if (isShapeEdited()) {
169  // calculate move shape operation
170  return calculateMoveShapeOperation(this, getCrossingShape(), false);
171  } else {
172  return nullptr;
173  }
174 }
175 
176 
177 void
178 GNECrossing::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
179  // edit depending if shape is being edited
180  if (isShapeEdited()) {
181  // get original shape
183  // check shape size
184  if (shape.size() > 2) {
185  // obtain index
186  int index = shape.indexOfClosest(clickedPosition);
187  // get snap radius
189  // check if we have to create a new index
190  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
191  // remove geometry point
192  shape.erase(shape.begin() + index);
193  // commit new shape
194  undoList->begin(this, TLF("remove geometry point of %", getTagStr()));
196  undoList->end();
197  }
198  }
199  }
200 }
201 
202 
205  return myParentJunction;
206 }
207 
208 
209 const std::vector<NBEdge*>&
211  return myCrossingEdges;
212 }
213 
214 
217  if (myTemplateNBCrossing) {
218  return myTemplateNBCrossing;
219  } else {
221  }
222 }
223 
224 
225 void
227  // continue depending of drawCrossing flag
228  if (checkDrawCrossing(s)) {
229  // get NBCrossing
230  const auto NBCrossing = getNBCrossing();
231  // get scaling depending if attribute carrier is selected
232  const double crossingExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
233  // get width
234  const double crossingWidth = NBCrossing->width * 0.5 * crossingExaggeration;
235  // get detail level
236  const auto d = s.getDetailLevel(crossingExaggeration);
237  // check if draw geometry
238  if (!s.drawForViewObjectsHandler) {
239  // draw crossing
240  drawCrossing(s, d, NBCrossing, crossingWidth, crossingExaggeration);
241  // draw TLS Links No
242  drawTLSLinkNo(s, NBCrossing);
243  // draw crossing name
244  if (s.cwaEdgeName.show(this)) {
246  }
247  // draw lock icon
249  // draw dotted contour
251  }
252  // calculate contour
253  calculateCrossingContour(s, d, crossingWidth, crossingExaggeration);
254  }
255 }
256 
257 
260 }
261 
262 
263 void
265  updateGeometry();
266 }
267 
268 
269 void
271  // check if draw
273  // push matrix
275  // move to GLO_Crossing
276  glTranslated(0, 0, GLO_CROSSING + 0.5);
277  // make a copy of shape
278  PositionVector shape = crossing->shape;
279  // extrapolate
280  shape.extrapolate(0.5); // draw on top of the walking area
281  // get link indexes
282  const int linkNo = crossing->tlLinkIndex;
283  const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
284  // draw link indexes
285  GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
286  GLHelper::drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex, s.scale);
287  // push matrix
289  }
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, app);
304  // check if we're in supermode network
306  // create menu commands
307  FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("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 Boundary
321 }
322 
323 
324 void
325 GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
326  // nothing to update
327 }
328 
329 
330 std::string
332  const auto crossing = getNBCrossing();
333  switch (key) {
334  case SUMO_ATTR_ID:
335  // get attribute requires a special case
336  if (crossing) {
337  return crossing->id;
338  } else {
339  return "Temporal Unreferenced";
340  }
341  case SUMO_ATTR_WIDTH:
342  return toString(crossing->customWidth);
343  case SUMO_ATTR_PRIORITY:
344  return crossing->priority ? "true" : "false";
345  case SUMO_ATTR_EDGES:
346  return toString(crossing->edges);
348  return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
350  return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
352  return toString(crossing->customShape);
353  case GNE_ATTR_SELECTED:
355  case GNE_ATTR_PARAMETERS:
356  return crossing->getParametersStr();
357  default:
358  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
359  }
360 }
361 
362 
363 void
364 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
365  if (value == getAttribute(key)) {
366  return; //avoid needless changes, later logic relies on the fact that attributes have changed
367  }
368  switch (key) {
369  case SUMO_ATTR_ID:
370  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
371  case SUMO_ATTR_EDGES:
372  case SUMO_ATTR_WIDTH:
373  case SUMO_ATTR_PRIORITY:
377  case GNE_ATTR_SELECTED:
378  case GNE_ATTR_PARAMETERS:
379  GNEChange_Attribute::changeAttribute(this, key, value, undoList, true);
380  break;
381  default:
382  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
383  }
384 }
385 
386 
387 bool
389  switch (key) {
390  case SUMO_ATTR_ID:
391  // id isn't editable
392  return false;
395  return (getNBCrossing()->tlID != "");
396  default:
397  return true;
398  }
399 }
400 
401 
402 bool
403 GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
404  const auto crossing = getNBCrossing();
405  switch (key) {
406  case SUMO_ATTR_ID:
407  return false;
408  case SUMO_ATTR_EDGES:
409  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
410  // parse edges and save their IDs in a set
411  std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
412  EdgeVector nbEdges;
413  for (auto i : parsedEdges) {
414  nbEdges.push_back(i->getNBEdge());
415  }
416  std::sort(nbEdges.begin(), nbEdges.end());
417  //
418  EdgeVector originalEdges = crossing->edges;
419  std::sort(originalEdges.begin(), originalEdges.end());
420  // return true if we're setting the same edges
421  if (toString(nbEdges) == toString(originalEdges)) {
422  return true;
423  } else {
425  }
426  } else {
427  return false;
428  }
429  case SUMO_ATTR_WIDTH:
430  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
431  case SUMO_ATTR_PRIORITY:
432  return canParse<bool>(value);
435  // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
436  return (isAttributeEnabled(key) &&
437  canParse<int>(value)
438  && (parse<double>(value) >= 0 || parse<double>(value) == -1)
439  && myParentJunction->getNBNode()->getControllingTLS().size() > 0
440  && (*myParentJunction->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
441  case SUMO_ATTR_CUSTOMSHAPE: {
442  // empty shapes are allowed
443  return canParse<PositionVector>(value);
444  }
445  case GNE_ATTR_SELECTED:
446  return canParse<bool>(value);
447  case GNE_ATTR_PARAMETERS:
448  return Parameterised::areParametersValid(value);
449  default:
450  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
451  }
452 }
453 
454 
455 const Parameterised::Map&
457  return getNBCrossing()->getParametersMap();
458 }
459 
460 
461 bool
463  const auto crossing = getNBCrossing();
464  if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
465  return true;
466  } else {
467  return false;
468  }
469 }
470 
471 
472 bool
473 GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
474  for (auto i : edges) {
475  if (checkEdgeBelong(i)) {
476  return true;
477  }
478  }
479  return false;
480 }
481 
482 // ===========================================================================
483 // private
484 // ===========================================================================
485 
486 bool
488  // don't draw in supermode data
490  return false;
491  }
492  // check shape rotations
493  if (myCrossingGeometry.getShapeRotations().empty()) {
494  return false;
495  }
496  // check shape lengths
497  if (myCrossingGeometry.getShapeLengths().empty()) {
498  return false;
499  }
501 }
502 
503 
504 void
506  const NBNode::Crossing* crossing, const double width, const double exaggeration) const {
507  // don't draw crossing in TLS Mode
509  // get color
510  RGBColor crossingColor = getCrossingColor(s, crossing);
511  // push layer matrix
513  // translate to front
515  // set color
516  GLHelper::setColor(crossingColor);
517  // draw depending of level of detail
519  drawCrossingDetailed(width, exaggeration);
520  } else {
522  }
523  // draw shape points only in Network supemode
526  // color
527  const RGBColor darkerColor = crossingColor.changedBrightness(-32);
528  // draw geometry points
532  }
533  // pop layer matrix
535  }
536 }
537 
538 
539 RGBColor
541  if (myShapeEdited) {
542  return s.colorSettings.editShapeColor;
543  } else if (drawUsingSelectColor()) {
545  } else if (!crossing->valid) {
547  } else if (crossing->priority) {
550  return s.laneColorer.getSchemes()[0].getColor(8);
551  } else {
552  return s.colorSettings.crossingColor;
553  }
554 }
555 
556 
557 void
558 GNECrossing::drawCrossingDetailed(const double width, const double exaggeration) const {
559  // geet lenght and spacing
560  const double length = 0.5 * exaggeration;
561  const double spacing = 1.0 * exaggeration;
562  // push rail matrix
564  // draw on top of of the white area between the rails
565  glTranslated(0, 0, 0.1);
566  for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
567  // push draw matrix
569  // translate and rotate
570  glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
571  glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
572  // draw crossing depending if isn't being drawn for selecting
573  for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
574  glBegin(GL_QUADS);
575  glVertex2d(-width, -t);
576  glVertex2d(-width, -t - length);
577  glVertex2d(width, -t - length);
578  glVertex2d(width, -t);
579  glEnd();
580  }
581  // pop draw matrix
583  }
584  // pop rail matrix
586 }
587 
588 
589 void
591  const double width, const double exaggeration) const {
592  // first check if junction parent was inserted with full boundary
594  // calculate contour
595  myNetworkElementContour.calculateContourExtrudedShape(s, d, this, myCrossingGeometry.getShape(), width, exaggeration, true, true, 0);
596  // check if calculate contour for geometry points
597  if (myShapeEdited) {
600  exaggeration, true);
601  }
602  }
603 }
604 
605 
606 void
607 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
608  const auto crossing = getNBCrossing();
609  switch (key) {
610  case SUMO_ATTR_ID:
611  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
612  case SUMO_ATTR_EDGES: {
613  // obtain GNEEdges
614  std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
615  // remove NBEdges of crossing
616  crossing->edges.clear();
617  // set NBEdge of every GNEEdge into Crossing Edges
618  for (auto i : edges) {
619  crossing->edges.push_back(i->getNBEdge());
620  }
621  // sort new edges
622  std::sort(crossing->edges.begin(), crossing->edges.end());
623  // change myCrossingEdges by the new edges
624  myCrossingEdges = crossing->edges;
625  // update geometry of parent junction
627  break;
628  }
629  case SUMO_ATTR_WIDTH:
630  // Change width an refresh element
631  crossing->customWidth = parse<double>(value);
632  // update boundary
633  if (myParentJunction) {
635  }
636  break;
637  case SUMO_ATTR_PRIORITY:
638  crossing->priority = parse<bool>(value);
639  break;
641  crossing->customTLIndex = parse<int>(value);
642  // make new value visible immediately
643  crossing->tlLinkIndex = crossing->customTLIndex;
644  break;
646  crossing->customTLIndex2 = parse<int>(value);
647  // make new value visible immediately
648  crossing->tlLinkIndex2 = crossing->customTLIndex2;
649  break;
650  case SUMO_ATTR_CUSTOMSHAPE: {
651  // set custom shape
652  crossing->customShape = parse<PositionVector>(value);
653  // update boundary
654  if (myParentJunction) {
656  }
657  break;
658  }
659  case GNE_ATTR_SELECTED:
660  if (parse<bool>(value)) {
662  } else {
664  }
665  break;
666  case GNE_ATTR_PARAMETERS:
667  crossing->setParametersStr(value);
668  break;
669  default:
670  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
671  }
672  // Crossing are a special case and we need ot update geometry of junction instead of crossing
673  if (myParentJunction && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
675  }
676  // invalidate path calculator
678 }
679 
680 
681 void
683  // set custom shape
684  getNBCrossing()->customShape = moveResult.shapeToUpdate;
685  // update geometry
686  updateGeometry();
687 }
688 
689 
690 void
692  // commit new shape
693  undoList->begin(this, TLF("moving % of %", toString(SUMO_ATTR_CUSTOMSHAPE), getTagStr()));
695  undoList->end();
696 }
697 
698 /****************************************************************************/
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
Definition: GUIAppEnum.h:1282
@ 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:35
@ 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
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, const GUIVisualizationTextSettings &settings, const double scale)
draw text and the end of shape
Definition: GLHelper.cpp:838
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:347
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
Definition: GNEContour.cpp:88
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
Definition: GNEContour.cpp:192
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
Boundary getContourBoundary() const
get contour boundary
Definition: GNEContour.cpp:59
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)
Definition: GNECrossing.h:197
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
Definition: GNECrossing.cpp:67
void deleteGLObject()
delete element
GNECrossing(GNENet *net)
default constructor
Definition: GNECrossing.cpp:40
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:86
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.
Definition: GNECrossing.cpp:94
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
Definition: GNECrossing.h:194
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
GUIGeometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:200
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
Definition: GNECrossing.cpp:73
const PositionVector & getCrossingShape() const
get Crossing shape
Definition: GNECrossing.cpp:79
bool checkDrawOverContour() const
check if draw over contour (orange)
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:59
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
Definition: GNECrossing.h:203
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:683
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:328
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:134
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2055
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
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 attribute carrier or a pointer to nullptr
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:703
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:715
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool isMovingElement() const
check if an element is being moved
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
Definition: GNEViewNet.cpp:468
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:538
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
Definition: GUIDesigns.cpp:42
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
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:59
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.
Definition: GUIGlObject.h:156
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 checkBoundaryParentElement(const GUIGlObject *GLObject, const GUIGlObject *parent)
check boundary parent element
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationTextSettings cwaEdgeName
bool drawMovingGeometryPoint(const double exaggeration, const double radius) const
check if moving geometry point can be draw
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
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
int tlLinkIndex2
Definition: NBNode.h:163
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
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition: NBNode.cpp:3838
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition: NBNode.cpp:2841
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
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
Definition: Parameterised.h:45
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
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 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