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-2022 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 
41 {}, {}, {}, {}, {}, {}, {}, {}),
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, SUMO_TAG_CROSSING,
50 {}, {}, {}, {}, {}, {}, {}, {}),
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 const PositionVector&
68  const auto crossing = getNBCrossing();
69  return (crossing->customShape.size() > 0) ? crossing->customShape : crossing->shape;
70 }
71 
72 
73 void
75  const auto crossing = getNBCrossing();
76  // update crossing geometry
77  myCrossingGeometry.updateGeometry(crossing->customShape.size() > 0 ? crossing->customShape : crossing->shape);
78 }
79 
80 
83  // currently unused
84  return Position(0, 0);
85 }
86 
87 
90  // edit depending if shape is being edited
91  if (isShapeEdited()) {
92  // calculate move shape operation
95  } else {
96  return nullptr;
97  }
98 }
99 
100 
101 void
102 GNECrossing::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
103  // edit depending if shape is being edited
104  if (isShapeEdited()) {
105  // get original shape
107  // check shape size
108  if (shape.size() > 2) {
109  // obtain index
110  int index = shape.indexOfClosest(clickedPosition);
111  // get snap radius
113  // check if we have to create a new index
114  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
115  // remove geometry point
116  shape.erase(shape.begin() + index);
117  // commit new shape
118  undoList->begin(GUIIcon::CROSSING, "remove geometry point of " + getTagStr());
120  undoList->end();
121  }
122  }
123  }
124 }
125 
126 
129  return myParentJunction;
130 }
131 
132 
133 const std::vector<NBEdge*>&
135  return myCrossingEdges;
136 }
137 
138 
141  if (myTemplateNBCrossing) {
142  return myTemplateNBCrossing;
143  } else {
145  }
146 }
147 
148 
149 void
151  // check if draw start und end
152  const bool drawExtremeSymbols = myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
154  // declare flag for drawing crossing
155  bool drawCrossing = s.drawCrossingsAndWalkingareas;
156  // don't draw in supermode data
158  drawCrossing = false;
159  }
160  // check shape rotations
161  if (myCrossingGeometry.getShapeRotations().empty()) {
162  drawCrossing = false;
163  }
164  // check shape lengths
165  if (myCrossingGeometry.getShapeLengths().empty()) {
166  drawCrossing = false;
167  }
168  // check zoom
169  if (s.scale < 3.0) {
170  drawCrossing = false;
171  }
172  // continue depending of drawCrossing flag
173  if (drawCrossing) {
174  // get NBCrossing
175  const auto NBCrossing = getNBCrossing();
176  // draw crossing checking whether it is not too small if isn't being drawn for selecting
177  const double selectionScale = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
178  // set default values
179  const double length = 0.5 * selectionScale;
180  const double spacing = 1.0 * selectionScale;
181  const double halfWidth = NBCrossing->width * 0.5 * selectionScale;
182  // get color
183  RGBColor crossingColor;
184  // first check if we're editing shape
185  if (myShapeEdited) {
186  crossingColor = s.colorSettings.editShapeColor;
187  } else if (drawUsingSelectColor()) {
188  crossingColor = s.colorSettings.selectedCrossingColor;
189  } else if (!NBCrossing->valid) {
190  crossingColor = s.colorSettings.crossingInvalidColor;
191  } else if (NBCrossing->priority) {
192  crossingColor = s.colorSettings.crossingPriorityColor;
194  crossingColor = s.laneColorer.getSchemes()[0].getColor(8);
195  } else {
196  crossingColor = s.colorSettings.crossingColor;
197  }
198  // check that current mode isn't TLS
200  // push name
202  // push layer matrix
204  // translate to front
206  // set color
207  GLHelper::setColor(crossingColor);
208  // draw depending of selection
210  // just drawn a box line
212  } else {
213  // push rail matrix
215  // draw on top of of the white area between the rails
216  glTranslated(0, 0, 0.1);
217  for (int i = 0; i < (int)myCrossingGeometry.getShape().size() - 1; i++) {
218  // push draw matrix
220  // translate and rotate
221  glTranslated(myCrossingGeometry.getShape()[i].x(), myCrossingGeometry.getShape()[i].y(), 0.0);
222  glRotated(myCrossingGeometry.getShapeRotations()[i], 0, 0, 1);
223  // draw crossing depending if isn't being drawn for selecting
224  for (double t = 0; t < myCrossingGeometry.getShapeLengths()[i]; t += spacing) {
225  glBegin(GL_QUADS);
226  glVertex2d(-halfWidth, -t);
227  glVertex2d(-halfWidth, -t - length);
228  glVertex2d(halfWidth, -t - length);
229  glVertex2d(halfWidth, -t);
230  glEnd();
231  }
232  // pop draw matrix
234  }
235  // pop rail matrix
237  }
238  // draw shape points only in Network supemode
240  // color
241  const RGBColor darkerColor = crossingColor.changedBrightness(-32);
242  // draw geometry points
245  myNet->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
246  // draw moving hint
250  }
251  }
252  // pop layer matrix
254  // pop name
256  }
257  // link indices must be drawn in all edit modes if isn't being drawn for selecting
259  drawTLSLinkNo(s, NBCrossing);
260  }
261  // draw lock icon
263  // check if dotted contour has to be drawn (not useful at high zoom)
266  selectionScale, true, true);
267  }
268  // check if dotted contour has to be drawn (not useful at high zoom)
269  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
271  selectionScale, true, true);
272  }
273  }
274 }
275 
276 
277 void
279  // push matrix
281  // move to GLO_Crossing
282  glTranslated(0, 0, GLO_CROSSING + 0.5);
283  // make a copy of shape
284  PositionVector shape = crossing->shape;
285  // extrapolate
286  shape.extrapolate(0.5); // draw on top of the walking area
287  // get link indexes
288  const int linkNo = crossing->tlLinkIndex;
289  const int linkNo2 = crossing->tlLinkIndex2 > 0 ? crossing->tlLinkIndex2 : linkNo;
290  // draw link indexes
291  GLHelper::drawTextAtEnd(toString(linkNo2), shape, 0, s.drawLinkTLIndex, s.scale);
292  GLHelper::drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex, s.scale);
293  // push matrix
295 }
296 
297 
300  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
301  buildPopupHeader(ret, app);
304  // build selection and show parameters menu
307  // build position copy entry
308  buildPositionCopyEntry(ret, false);
309  // check if we're in supermode network
311  // create menu commands
312  FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom crossing shape", nullptr, &parent, MID_GNE_CROSSING_EDIT_SHAPE);
313  // check if menu commands has to be disabled
315  if ((editMode == NetworkEditMode::NETWORK_CONNECT) || (editMode == NetworkEditMode::NETWORK_TLS) || (editMode == NetworkEditMode::NETWORK_CREATE_EDGE)) {
316  mcCustomShape->disable();
317  }
318  }
319  return ret;
320 }
321 
322 
323 double
325  return 1;
326 }
327 
328 
329 void
330 GNECrossing::updateCenteringBoundary(const bool /*updateGrid*/) {
331  const auto crossing = getNBCrossing();
332  if (crossing) {
333  if (crossing->customShape.size() > 0) {
334  myBoundary = crossing->customShape.getBoxBoundary();
335  myBoundary.grow(10);
336  } else if (crossing->shape.size() > 0) {
337  myBoundary = crossing->shape.getBoxBoundary();
338  myBoundary.grow(10);
339  } else {
341  }
342  } else {
343  // in other case use boundary of parent junction
345  }
346 }
347 
348 
349 std::string
351  const auto crossing = getNBCrossing();
352  switch (key) {
353  case SUMO_ATTR_ID:
354  // get attribute requires a special case
355  if (crossing) {
356  return crossing->id;
357  } else {
358  return "Temporal Unreferenced";
359  }
360  case SUMO_ATTR_WIDTH:
361  return toString(crossing->customWidth);
362  case SUMO_ATTR_PRIORITY:
363  return crossing->priority ? "true" : "false";
364  case SUMO_ATTR_EDGES:
365  return toString(crossing->edges);
367  return toString(crossing->customTLIndex < 0 ? crossing->tlLinkIndex : crossing->customTLIndex);
369  return toString(crossing->customTLIndex2 < 0 ? crossing->tlLinkIndex2 : crossing->customTLIndex2);
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 
382 void
383 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
384  if (value == getAttribute(key)) {
385  return; //avoid needless changes, later logic relies on the fact that attributes have changed
386  }
387  switch (key) {
388  case SUMO_ATTR_ID:
389  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
390  case SUMO_ATTR_EDGES:
391  case SUMO_ATTR_WIDTH:
392  case SUMO_ATTR_PRIORITY:
396  case GNE_ATTR_SELECTED:
397  case GNE_ATTR_PARAMETERS:
398  undoList->add(new GNEChange_Attribute(this, key, value), true);
399  break;
400  default:
401  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
402  }
403 }
404 
405 
406 bool
408  switch (key) {
409  case SUMO_ATTR_ID:
410  // id isn't editable
411  return false;
414  return (getNBCrossing()->tlID != "");
415  default:
416  return true;
417  }
418 }
419 
420 
421 bool
423  return false;
424 }
425 
426 
427 bool
428 GNECrossing::isValid(SumoXMLAttr key, const std::string& value) {
429  const auto crossing = getNBCrossing();
430  switch (key) {
431  case SUMO_ATTR_ID:
432  return false;
433  case SUMO_ATTR_EDGES:
434  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
435  // parse edges and save their IDs in a set
436  std::vector<GNEEdge*> parsedEdges = parse<std::vector<GNEEdge*> >(myNet, value);
437  EdgeVector nbEdges;
438  for (auto i : parsedEdges) {
439  nbEdges.push_back(i->getNBEdge());
440  }
441  std::sort(nbEdges.begin(), nbEdges.end());
442  //
443  EdgeVector originalEdges = crossing->edges;
444  std::sort(originalEdges.begin(), originalEdges.end());
445  // return true if we're setting the same edges
446  if (toString(nbEdges) == toString(originalEdges)) {
447  return true;
448  } else {
450  }
451  } else {
452  return false;
453  }
454  case SUMO_ATTR_WIDTH:
455  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == -1)); // kann NICHT 0 sein, oder -1 (bedeutet default)
456  case SUMO_ATTR_PRIORITY:
457  return canParse<bool>(value);
460  // -1 means that tlLinkIndex2 takes on the same value as tlLinkIndex when setting idnices
461  return (isAttributeEnabled(key) &&
462  canParse<int>(value)
463  && (parse<double>(value) >= 0 || parse<double>(value) == -1)
464  && myParentJunction->getNBNode()->getControllingTLS().size() > 0
465  && (*myParentJunction->getNBNode()->getControllingTLS().begin())->getMaxValidIndex() >= parse<int>(value));
466  case SUMO_ATTR_CUSTOMSHAPE: {
467  // empty shapes are allowed
468  return canParse<PositionVector>(value);
469  }
470  case GNE_ATTR_SELECTED:
471  return canParse<bool>(value);
472  case GNE_ATTR_PARAMETERS:
473  return Parameterised::areParametersValid(value);
474  default:
475  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
476  }
477 }
478 
479 
480 const std::map<std::string, std::string>&
482  return getNBCrossing()->getParametersMap();
483 }
484 
485 
486 bool
488  const auto crossing = getNBCrossing();
489  if (std::find(crossing->edges.begin(), crossing->edges.end(), edge->getNBEdge()) != crossing->edges.end()) {
490  return true;
491  } else {
492  return false;
493  }
494 }
495 
496 
497 bool
498 GNECrossing::checkEdgeBelong(const std::vector<GNEEdge*>& edges) const {
499  for (auto i : edges) {
500  if (checkEdgeBelong(i)) {
501  return true;
502  }
503  }
504  return false;
505 }
506 
507 // ===========================================================================
508 // private
509 // ===========================================================================
510 
511 void
512 GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) {
513  const auto crossing = getNBCrossing();
514  switch (key) {
515  case SUMO_ATTR_ID:
516  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
517  case SUMO_ATTR_EDGES: {
518  // obtain GNEEdges
519  std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
520  // remove NBEdges of crossing
521  crossing->edges.clear();
522  // set NBEdge of every GNEEdge into Crossing Edges
523  for (auto i : edges) {
524  crossing->edges.push_back(i->getNBEdge());
525  }
526  // sort new edges
527  std::sort(crossing->edges.begin(), crossing->edges.end());
528  // change myCrossingEdges by the new edges
529  myCrossingEdges = crossing->edges;
530  // update geometry of parent junction
532  break;
533  }
534  case SUMO_ATTR_WIDTH:
535  // Change width an refresh element
536  crossing->customWidth = parse<double>(value);
537  // update boundary
538  if (myParentJunction) {
540  }
541  break;
542  case SUMO_ATTR_PRIORITY:
543  crossing->priority = parse<bool>(value);
544  break;
546  crossing->customTLIndex = parse<int>(value);
547  // make new value visible immediately
548  crossing->tlLinkIndex = crossing->customTLIndex;
549  break;
551  crossing->customTLIndex2 = parse<int>(value);
552  // make new value visible immediately
553  crossing->tlLinkIndex2 = crossing->customTLIndex2;
554  break;
555  case SUMO_ATTR_CUSTOMSHAPE: {
556  // set custom shape
557  crossing->customShape = parse<PositionVector>(value);
558  // update boundary
559  if (myParentJunction) {
561  }
562  break;
563  }
564  case GNE_ATTR_SELECTED:
565  if (parse<bool>(value)) {
567  } else {
569  }
570  break;
571  case GNE_ATTR_PARAMETERS:
572  crossing->setParametersStr(value);
573  break;
574  default:
575  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
576  }
577  // Crossing are a special case and we need ot update geometry of junction instead of crossing
578  if (myParentJunction && (key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
580  }
581  // invalidate path calculator
583 }
584 
585 
586 void
588  // set custom shape
589  getNBCrossing()->customShape = moveResult.shapeToUpdate;
590  // update geometry
591  updateGeometry();
592 }
593 
594 
595 void
597  // commit new shape
598  undoList->begin(GUIIcon::CROSSING, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
600  undoList->end();
601 }
602 
603 /****************************************************************************/
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_CROSSING_EDIT_SHAPE
edit junction shape
Definition: GUIAppEnum.h:1103
@ GLO_CROSSING
a tl-logic
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
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:507
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:691
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
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:277
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
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:159
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GNECrossing(GNENet *net)
default constructor
Definition: GNECrossing.cpp:39
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:74
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:82
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const NBNode::Crossing *crossing) const
draw TLS Link Number
bool checkEdgeBelong(GNEEdge *edges) const
return true if a edge belongs to crossing's edges
GNEJunction * myParentJunction
the parent junction of this crossing
Definition: GNECrossing.h:156
const std::vector< NBEdge * > & getCrossingEdges() const
get crossingEdges
GUIGeometry myCrossingGeometry
crossing geometry
Definition: GNECrossing.h:162
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEJunction * getParentJunction() const
get parent Junction
NBNode::Crossing * getNBCrossing() const
get referente to NBode::Crossing
const PositionVector & getCrossingShape() const
Definition: GNECrossing.cpp:67
~GNECrossing()
Destructor.
Definition: GNECrossing.cpp:59
bool isAttributeComputed(SumoXMLAttr key) const
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
NBNode::Crossing * myTemplateNBCrossing
template NBCrossing
Definition: GNECrossing.h:165
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
bool isValid(SumoXMLAttr key, const std::string &value)
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNECrossing.cpp:89
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:435
void updateGeometry()
update pre-computed geometry information (including crossings)
Definition: GNEJunction.cpp:95
NBNode * getNBNode() const
Return net build node.
GNEMoveOperation * calculateMoveShapeOperation(const PositionVector originalShape, const Position mousePosition, const double snapRadius, const bool onlyContour)
calculate move shape operation
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
bool myShapeEdited
flag to check if element shape is being edited
bool isShapeEdited() const
check if shape is being edited
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Boundary myBoundary
object boundary
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:513
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
The popup menu of a globject.
static void drawGeometryPoints(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
draw geometry points
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
static void drawMovingHint(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
void 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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
const std::vector< T > & getSchemes() const
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
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
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:3421
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition: NBNode.cpp:2672
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:324
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|....
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: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
PositionVector reverse() const
reverse position vector
static const RGBColor BLACK
Definition: RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:197
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool editingElevation() const
check if we're editing elevation
RGBColor selectedCrossingColor
crossings selection color
static const RGBColor crossingPriorityColor
color for priority crossing
static const RGBColor crossingInvalidColor
color for invalid crossing
static const RGBColor crossingColor
color for crossings
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double crossingGeometryPointRadius
moving crossing geometry point radius
bool show(const GUIGlObject *o) const
whether to show the text