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()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
156  (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
157  // check if we're editing this network element
159  if (editedNetworkElement) {
160  return editedNetworkElement == this;
161  } else {
162  // only move the first element
164  }
165  } else {
166  return false;
167  }
168 }
169 
170 
173  // edit depending if shape is being edited
174  if (isShapeEdited()) {
175  // calculate move shape operation
176  return calculateMoveShapeOperation(this, getCrossingShape(), false);
177  } else {
178  return nullptr;
179  }
180 }
181 
182 
183 void
184 GNECrossing::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
185  // edit depending if shape is being edited
186  if (isShapeEdited()) {
187  // get original shape
189  // check shape size
190  if (shape.size() > 2) {
191  // obtain index
192  int index = shape.indexOfClosest(clickedPosition);
193  // get snap radius
195  // check if we have to create a new index
196  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
197  // remove geometry point
198  shape.erase(shape.begin() + index);
199  // commit new shape
200  undoList->begin(this, TLF("remove geometry point of %", getTagStr()));
202  undoList->end();
203  }
204  }
205  }
206 }
207 
208 
211  return myParentJunction;
212 }
213 
214 
215 const std::vector<NBEdge*>&
217  return myCrossingEdges;
218 }
219 
220 
223  if (myTemplateNBCrossing) {
224  return myTemplateNBCrossing;
225  } else {
227  }
228 }
229 
230 
231 void
233  // continue depending of drawCrossing flag
234  if (checkDrawCrossing(s)) {
235  // get NBCrossing
236  const auto NBCrossing = getNBCrossing();
237  // get scaling depending if attribute carrier is selected
238  const double crossingExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
239  // get width
240  const double crossingWidth = NBCrossing->width * 0.5 * crossingExaggeration;
241  // get detail level
242  const auto d = s.getDetailLevel(crossingExaggeration);
243  // check if draw geometry
244  if (!s.drawForViewObjectsHandler) {
245  // draw crossing
246  drawCrossing(s, d, NBCrossing, crossingWidth, crossingExaggeration);
247  // draw TLS Links No
248  drawTLSLinkNo(s, NBCrossing);
249  // draw crossing name
250  if (s.cwaEdgeName.show(this)) {
252  }
253  // draw lock icon
255  // draw dotted contour depending if we're editing the custom shape
257  if (editedNetworkElement && (editedNetworkElement == this)) {
258  // draw dotted contour geometry points
260  crossingExaggeration, s.dottedContourSettings.segmentWidthSmall);
261  } else {
262  // draw dotted contour
264  }
265  }
266  // calculate contour
267  calculateCrossingContour(s, d, crossingWidth, crossingExaggeration);
268  }
269 }
270 
271 
274 }
275 
276 
277 void
279  updateGeometry();
280 }
281 
282 
283 void
285  // check if draw
287  // push matrix
289  // move to GLO_Crossing
290  glTranslated(0, 0, GLO_CROSSING + 0.5);
291  // make a copy of shape
292  PositionVector shape = crossing->shape;
293  // extrapolate
294  shape.extrapolate(0.5); // draw on top of the walking area
295  // get link indexes
296  const int linkNo = crossing->tlLinkIndex;
297  const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
298  // draw link indexes
299  GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
300  GLHelper::drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex, s.scale);
301  // push matrix
303  }
304 }
305 
306 
309  if (myShapeEdited) {
310  return getShapeEditedPopUpMenu(app, parent, getNBCrossing()->customShape);
311  } else {
312  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
313  buildPopupHeader(ret, app);
316  // build selection and show parameters menu
319  // build position copy entry
320  buildPositionCopyEntry(ret, app);
321  // check if we're in supermode network
323  // create menu commands
324  FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("Set custom crossing shape"), nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
325  // check if menu commands has to be disabled
327  if ((editMode == NetworkEditMode::NETWORK_CONNECT) || (editMode == NetworkEditMode::NETWORK_TLS) || (editMode == NetworkEditMode::NETWORK_CREATE_EDGE)) {
328  mcCustomShape->disable();
329  }
330  }
331  return ret;
332  }
333 }
334 
335 
336 Boundary
339 }
340 
341 
342 void
343 GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
344  // nothing to update
345 }
346 
347 
348 std::string
350  const auto crossing = getNBCrossing();
351  switch (key) {
352  case SUMO_ATTR_ID:
353  // get attribute requires a special case
354  if (crossing) {
355  return crossing->id;
356  } else {
357  return "Temporal Unreferenced";
358  }
359  case SUMO_ATTR_WIDTH:
360  return toString(crossing->customWidth);
361  case SUMO_ATTR_PRIORITY:
362  return crossing->priority ? "true" : "false";
363  case SUMO_ATTR_EDGES:
364  return toString(crossing->edges);
366  return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
368  return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
369  case SUMO_ATTR_SHAPE:
371  return toString(crossing->customShape);
372  case GNE_ATTR_SELECTED:
374  case GNE_ATTR_PARAMETERS:
375  return crossing->getParametersStr();
376  default:
377  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
378  }
379 }
380 
381 
384  switch (key) {
385  case SUMO_ATTR_SHAPE:
387  return getNBCrossing()->customShape;
388  default:
389  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
390  }
391 }
392 
393 
394 void
395 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
396  if (value == getAttribute(key)) {
397  return; //avoid needless changes, later logic relies on the fact that attributes have changed
398  }
399  switch (key) {
400  case SUMO_ATTR_ID:
401  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
402  case SUMO_ATTR_EDGES:
403  case SUMO_ATTR_WIDTH:
404  case SUMO_ATTR_PRIORITY:
407  case SUMO_ATTR_SHAPE:
409  case GNE_ATTR_SELECTED:
410  case GNE_ATTR_PARAMETERS:
411  GNEChange_Attribute::changeAttribute(this, key, value, undoList, true);
412  break;
413  default:
414  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
415  }
416 }
417 
418 
419 bool
421  switch (key) {
422  case SUMO_ATTR_ID:
423  // id isn't editable
424  return false;
427  return (getNBCrossing()->tlID != "");
428  default:
429  return true;
430  }
431 }
432 
433 
434 bool
435 GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
436  const auto crossing = getNBCrossing();
437  switch (key) {
438  case SUMO_ATTR_ID:
439  return false;
440  case SUMO_ATTR_EDGES:
441  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
442  // parse edges and save their IDs in a set
443  std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
444  EdgeVector nbEdges;
445  for (auto i : parsedEdges) {
446  nbEdges.push_back(i->getNBEdge());
447  }
448  std::sort(nbEdges.begin(), nbEdges.end());
449  //
450  EdgeVector originalEdges = crossing->edges;
451  std::sort(originalEdges.begin(), originalEdges.end());
452  // return true if we're setting the same edges
453  if (toString(nbEdges) == toString(originalEdges)) {
454  return true;
455  } else {
457  }
458  } else {
459  return false;
460  }
461  case SUMO_ATTR_WIDTH:
462  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // can not be 0, or -1 (it means default)
463  case SUMO_ATTR_PRIORITY:
464  return canParse<bool>(value);
467  // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting indices
468  return (isAttributeEnabled(key) &&
469  canParse<int>(value)
470  && (parse<double>(value) >= 0 || parse<double>(value) == -1)
471  && myParentJunction->getNBNode()->getControllingTLS().size() > 0
472  && (*myParentJunction->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
473  case SUMO_ATTR_SHAPE:
475  // empty shapes are allowed
476  return canParse<PositionVector>(value);
477  case GNE_ATTR_SELECTED:
478  return canParse<bool>(value);
479  case GNE_ATTR_PARAMETERS:
480  return Parameterised::areParametersValid(value);
481  default:
482  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
483  }
484 }
485 
486 
487 const Parameterised::Map&
489  return getNBCrossing()->getParametersMap();
490 }
491 
492 
493 bool
495  const auto crossing = getNBCrossing();
496  if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
497  return true;
498  } else {
499  return false;
500  }
501 }
502 
503 
504 bool
505 GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
506  for (auto i : edges) {
507  if (checkEdgeBelong(i)) {
508  return true;
509  }
510  }
511  return false;
512 }
513 
514 // ===========================================================================
515 // private
516 // ===========================================================================
517 
518 bool
520  // don't draw in supermode data
522  return false;
523  }
524  // check shape rotations
525  if (myCrossingGeometry.getShapeRotations().empty()) {
526  return false;
527  }
528  // check shape lengths
529  if (myCrossingGeometry.getShapeLengths().empty()) {
530  return false;
531  }
533 }
534 
535 
536 void
538  const NBNode::Crossing* crossing, const double width, const double exaggeration) const {
539  // don't draw crossing in TLS Mode
541  // get color
542  RGBColor crossingColor = getCrossingColor(s, crossing);
543  // push layer matrix
545  // translate to front
547  // set color
548  GLHelper::setColor(crossingColor);
549  // draw depending of level of detail
551  drawCrossingDetailed(width, exaggeration);
552  } else {
554  }
555  // draw shape points only in Network supemode
558  // color
559  const RGBColor darkerColor = crossingColor.changedBrightness(-32);
560  // draw on top of of the white area between the rails
561  glTranslated(0, 0, 0.2);
562  // set color
563  GLHelper::setColor(darkerColor);
564  // draw shape
566  // draw geometry points
570  }
571  // pop layer matrix
573  }
574 }
575 
576 
577 RGBColor
579  if (myShapeEdited) {
580  return s.colorSettings.editShapeColor;
581  } else if (drawUsingSelectColor()) {
583  } else if (!crossing->valid) {
585  } else if (crossing->priority) {
588  return s.laneColorer.getSchemes()[0].getColor(8);
589  } else {
590  return s.colorSettings.crossingColor;
591  }
592 }
593 
594 
595 void
596 GNECrossing::drawCrossingDetailed(const double width, const double exaggeration) const {
597  // geet lenght and spacing
598  const double length = 0.5 * exaggeration;
599  const double spacing = 1.0 * exaggeration;
600  // push rail matrix
602  // draw on top of of the white area between the rails
603  glTranslated(0, 0, 0.1);
604  for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
605  // push draw matrix
607  // translate and rotate
608  glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
609  glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
610  // draw crossing depending if isn't being drawn for selecting
611  for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
612  glBegin(GL_QUADS);
613  glVertex2d(-width, -t);
614  glVertex2d(-width, -t - length);
615  glVertex2d(width, -t - length);
616  glVertex2d(width, -t);
617  glEnd();
618  }
619  // pop draw matrix
621  }
622  // pop rail matrix
624 }
625 
626 
627 void
629  const double width, const double exaggeration) const {
630  // first check if junction parent was inserted with full boundary
632  // check if calculate contour for geometry points
633  if (myShapeEdited) {
636  exaggeration, true);
637  } else {
638  // calculate contour
639  myNetworkElementContour.calculateContourExtrudedShape(s, d, this, myCrossingGeometry.getShape(), width, exaggeration, true, true, 0);
640  }
641  }
642 }
643 
644 
645 void
646 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
647  const auto crossing = getNBCrossing();
648  switch (key) {
649  case SUMO_ATTR_ID:
650  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
651  case SUMO_ATTR_EDGES: {
652  // obtain GNEEdges
653  std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
654  // remove NBEdges of crossing
655  crossing->edges.clear();
656  // set NBEdge of every GNEEdge into Crossing Edges
657  for (auto i : edges) {
658  crossing->edges.push_back(i->getNBEdge());
659  }
660  // sort new edges
661  std::sort(crossing->edges.begin(), crossing->edges.end());
662  // change myCrossingEdges by the new edges
663  myCrossingEdges = crossing->edges;
664  // update geometry of parent junction
666  break;
667  }
668  case SUMO_ATTR_WIDTH:
669  // Change width an refresh element
670  crossing->customWidth = parse<double>(value);
671  // update boundary
672  if (myParentJunction) {
674  }
675  break;
676  case SUMO_ATTR_PRIORITY:
677  crossing->priority = parse<bool>(value);
678  break;
680  crossing->customTLIndex = parse<int>(value);
681  // make new value visible immediately
682  crossing->tlLinkIndex = crossing->customTLIndex;
683  break;
685  crossing->customTLIndex2 = parse<int>(value);
686  // make new value visible immediately
687  crossing->tlLinkIndex2 = crossing->customTLIndex2;
688  break;
689  case SUMO_ATTR_SHAPE:
691  // set custom shape
692  crossing->customShape = parse<PositionVector>(value);
693  // update boundary
694  if (myParentJunction) {
696  }
697  break;
698  case GNE_ATTR_SELECTED:
699  if (parse<bool>(value)) {
701  } else {
703  }
704  break;
705  case GNE_ATTR_PARAMETERS:
706  crossing->setParametersStr(value);
707  break;
708  default:
709  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
710  }
711  // Crossing are a special case and we need ot update geometry of junction instead of crossing
712  if (myParentJunction && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
714  }
715  // invalidate path calculator
717 }
718 
719 
720 void
722  // set custom shape
723  getNBCrossing()->customShape = moveResult.shapeToUpdate;
724  // update geometry
725  updateGeometry();
726 }
727 
728 
729 void
731  // commit new shape
732  undoList->begin(this, TLF("moving % of %", toString(SUMO_ATTR_CUSTOMSHAPE), getTagStr()));
734  undoList->end();
735 }
736 
737 /****************************************************************************/
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:1286
@ 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_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, const GUIVisualizationTextSettings &settings, const double scale)
draw text and the end of shape
Definition: GLHelper.cpp:838
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:347
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double 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 drawDottedContourGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius, const double scale, const double lineWidth) const
draw dotted contour for geometry points
Definition: GNEContour.cpp:307
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:203
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:200
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
PositionVector getAttributePositionVector(SumoXMLAttr key) const
GUIGeometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:206
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:209
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:753
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:329
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:135
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2136
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
GUIGLObjectPopupMenu * getShapeEditedPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, const PositionVector &shape)
get shape edited popup menu
bool isShapeEdited() const
check if shape is being edited
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
const GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:723
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
Definition: GNEViewNet.cpp:759
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:735
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
Definition: GNEViewNet.cpp:477
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:553
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
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
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:3866
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition: NBNode.cpp:2850
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
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool editingElevation() const
check if we're editing elevation
RGBColor selectedCrossingColor
crossings selection color
static const RGBColor crossingPriorityColor
color for priority crossing
static const RGBColor crossingInvalidColor
color for invalid crossing
static const RGBColor crossingColor
color for crossings
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double crossingGeometryPointRadius
moving crossing geometry point radius
bool show(const GUIGlObject *o) const
whether to show the text