Eclipse SUMO - Simulation of Urban MObility
GNEWalk.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing walks in Netedit
19 /****************************************************************************/
20 #include <config.h>
21 
24 #include <netedit/GNENet.h>
25 #include <netedit/GNEUndoList.h>
26 #include <netedit/GNEViewNet.h>
28 
29 #include "GNEWalk.h"
30 #include "GNERoute.h"
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
36 
37 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, double arrivalPosition) :
39 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {personParent}, {}),
40 myArrivalPosition(arrivalPosition) {
41  // compute walk
42  computePath();
43 }
44 
45 
46 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop, double arrivalPosition) :
48 {}, {fromEdge}, {}, {toBusStop}, {}, {}, {personParent}, {}),
49 myArrivalPosition(arrivalPosition) {
50  // compute walk
51  computePath();
52 }
53 
54 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEEdge* toEdge, double arrivalPosition) :
56 {}, {toEdge}, {}, {fromBusStop}, {}, {}, {personParent}, {}),
57 myArrivalPosition(arrivalPosition) {
58  // compute walk
59  computePath();
60 }
61 
62 
63 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEAdditional* toBusStop, double arrivalPosition) :
65 {}, {}, {}, {fromBusStop, toBusStop}, {}, {}, {personParent}, {}),
66 myArrivalPosition(arrivalPosition) {
67  // compute walk
68  computePath();
69 }
70 
71 
72 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, std::vector<GNEEdge*> edges, double arrivalPosition) :
73  GNEDemandElement(personParent, net, GLO_WALK, GNE_TAG_WALK_EDGES,
74 {}, {edges}, {}, {}, {}, {}, {personParent}, {}),
75 myArrivalPosition(arrivalPosition) {
76  // compute walk
77  computePath();
78 }
79 
80 
81 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEDemandElement* route, double arrivalPosition) :
82  GNEDemandElement(personParent, net, GLO_WALK, GNE_TAG_WALK_ROUTE,
83 {}, {}, {}, {}, {}, {}, {personParent, route}, {}),
84 myArrivalPosition(arrivalPosition) {
85  // compute walk
86  computePath();
87 }
88 
89 
91 
92 
95  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
96  // build header
97  buildPopupHeader(ret, app);
98  // build menu command for center button and copy cursor position to clipboard
100  buildPositionCopyEntry(ret, false);
101  // buld menu commands for names
102  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
103  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
104  new FXMenuSeparator(ret);
105  // build selection and show parameters menu
108  // show option to open demand element dialog
109  if (myTagProperty.hasDialog()) {
110  GUIDesigns::buildFXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
111  new FXMenuSeparator(ret);
112  }
113  GUIDesigns::buildFXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
114  return ret;
115 }
116 
117 
118 void
120  // open tag
121  device.openTag(SUMO_TAG_WALK);
122  // write attributes depending of walk type
125  } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
127  } else {
128  // check if we have to write "from" attributes
129  if (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr) {
130  // write "to" attributes depending of start and end
132  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
133  } else if (myTagProperty.personPlanStartBusStop()) {
134  device.writeAttr(SUMO_ATTR_FROM, getParentAdditionals().front()->getID());
135  }
136  }
137  // write "to" attributes depending of start and end
139  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
140  } else if (myTagProperty.personPlanStartBusStop()) {
142  }
143  }
144  // only write arrivalPos if is different of -1
145  if (myArrivalPosition != -1) {
147  }
148  // write parameters
149  writeParams(device);
150  // close tag
151  device.closeTag();
152 }
153 
154 
155 bool
158  // check if route parent is valid
159  return getParentDemandElements().at(1)->isDemandElementValid();
160  } else if (getParentEdges().size() == 2) {
161  if (getParentEdges().at(0) == getParentEdges().at(1)) {
162  // from and to are the same edges, then path is valid
163  return true;
164  } else {
165  // check if exist a route between parent edges
167  }
168  } else if (getPath().size() > 0) {
169  // if path edges isn't empty, then there is a valid route
170  return true;
171  } else {
172  return false;
173  }
174 }
175 
176 
177 std::string
180  return "";
181  } else if (getParentEdges().size() == 0) {
182  return ("A walk need at least one edge");
183  } else {
184  // check if exist at least a connection between every edge
185  for (int i = 1; i < (int)getParentEdges().size(); i++) {
186  if (myNet->getPathCalculator()->consecutiveEdgesConnected(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
187  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
188  }
189  }
190  // there is connections bewteen all edges, then all ok
191  return "";
192  }
193 }
194 
195 
196 void
198  // currently the only solution is removing Walk
199 }
200 
201 
204  return getParentDemandElements().front()->getVClass();
205 }
206 
207 
208 const RGBColor&
210  return getParentDemandElements().front()->getColor();
211 }
212 
213 
214 void
216  // only start geometry moving if arrival position isn't -1
217  if (myArrivalPosition != -1) {
218  // always save original position over view
220  // save arrival position
222  // save current centering boundary
224  }
225 }
226 
227 
228 void
230  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
232  // reset myMovingGeometryBoundary
234  }
235 }
236 
237 
238 void
240  // only move if myArrivalPosition isn't -1
241  if (myArrivalPosition != -1) {
242  // Calculate new position using old position
244  newPosition.add(offset);
245  // filtern position using snap to active grid
246  newPosition = myNet->getViewNet()->snapToActiveGrid(newPosition);
247  // obtain lane shape (to improve code legibility)
248  const PositionVector& laneShape = getParentEdges().back()->getLanes().front()->getLaneShape();
249  // calculate offset lane
250  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myWalkMove.originalViewPosition, false);
251  // Update arrival Position
252  myArrivalPosition = parse<double>(myWalkMove.firstOriginalLanePosition) + offsetLane;
253  // Update geometry
254  updateGeometry();
255  }
256 }
257 
258 
259 void
261  // only commit geometry moving if myArrivalPosition isn't -1
262  if (myArrivalPosition != -1) {
263  undoList->p_begin("arrivalPos of " + getTagStr());
265  undoList->p_end();
266  }
267 }
268 
269 
270 void
272  // calculate person plan start and end positions
274  // calculate geometry path depending if is a Walk over route
276  // calculate edge geometry path using parent route
278  } else {
279  // calculate edge geometry path using path
281  }
282  // update child demand elementss
283  for (const auto& i : getChildDemandElements()) {
284  i->updateGeometry();
285  }
286 }
287 
288 
289 void
291  // update lanes depending of walk tag
296  {});
300  getParentAdditionals().back()->getParentLanes().front(),
301  {});
304  getParentAdditionals().front()->getParentLanes().front(),
306  {});
309  getParentAdditionals().front()->getParentLanes().front(),
310  getParentAdditionals().back()->getParentLanes().front(),
311  {});
312  } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
313  // calculate consecutive path using parent edges
315  } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
320  }
321  // update geometry
322  updateGeometry();
323 }
324 
325 
326 void
328  // update lanes depending of walk tag
330  resetPathLanes(getVClass(), true,
333  {});
335  resetPathLanes(getVClass(), true,
337  getParentAdditionals().back()->getParentLanes().front(),
338  {});
340  resetPathLanes(getVClass(), true,
341  getParentAdditionals().front()->getParentLanes().front(),
343  {});
345  resetPathLanes(getVClass(), true,
346  getParentAdditionals().front()->getParentLanes().front(),
347  getParentAdditionals().back()->getParentLanes().front(),
348  {});
349  } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
350  // due walk edges don't need to calculate a dijkstra path, just calculate consecutive path lanes again
352  } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
353  resetPathLanes(getVClass(), true,
357  }
358  // update geometry
359  updateGeometry();
360 }
361 
362 
363 Position
365  return Position();
366 }
367 
368 
369 std::string
371  return getParentDemandElements().front()->getID();
372 }
373 
374 
375 Boundary
377  Boundary walkBoundary;
378  // return the combination of all parent edges's boundaries
379  for (const auto& i : getParentEdges()) {
380  walkBoundary.add(i->getCenteringBoundary());
381  }
382  // check if is valid
383  if (walkBoundary.isInitialised()) {
384  return walkBoundary;
385  } else {
386  return Boundary(-0.1, -0.1, 0.1, 0.1);
387  }
388 }
389 
390 
391 void
392 GNEWalk::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
393  // only split geometry of WalkEdges
395  // obtain new list of walk edges
396  std::string newWalkEdges = getNewListOfParents(originalElement, newElement);
397  // update walk edges
398  if (newWalkEdges.size() > 0) {
399  setAttribute(SUMO_ATTR_EDGES, newWalkEdges, undoList);
400  }
401  }
402 }
403 
404 
405 void
407  // Walks are drawn in drawPartialGL
408 }
409 
410 
411 void
412 GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const {
413  // draw person plan over lane
414  drawPersonPlanPartialLane(s, lane, offsetFront, s.widthSettings.walk, s.colorSettings.walk);
415 }
416 
417 
418 void
419 GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const {
420  // draw person plan over junction
421  drawPersonPlanPartialJunction(s, fromLane, toLane, offsetFront, s.widthSettings.walk, s.colorSettings.walk);
422 }
423 
424 
425 std::string
427  switch (key) {
428  // Common person plan attributes
429  case SUMO_ATTR_ID:
430  return getParentDemandElements().front()->getID();
431  case SUMO_ATTR_FROM:
432  return getParentEdges().front()->getID();
433  case SUMO_ATTR_TO:
434  return getParentEdges().back()->getID();
436  return getParentAdditionals().front()->getID();
437  case GNE_ATTR_TO_BUSSTOP:
438  return getParentAdditionals().back()->getID();
439  case SUMO_ATTR_EDGES:
440  return parseIDs(getParentEdges());
441  case SUMO_ATTR_ROUTE:
442  return getParentDemandElements().at(1)->getID();
443  // specific person plan attributes
445  if (myArrivalPosition == -1) {
446  return "";
447  } else {
448  return toString(myArrivalPosition);
449  }
450  case GNE_ATTR_SELECTED:
452  case GNE_ATTR_PARAMETERS:
453  return getParametersStr();
454  case GNE_ATTR_PARENT:
455  return getParentDemandElements().front()->getID();
456  default:
457  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
458  }
459 }
460 
461 
462 double
464  switch (key) {
466  if (myArrivalPosition != -1) {
467  return myArrivalPosition;
468  } else {
469  return (getLastAllowedVehicleLane()->getLaneShape().length() - POSITION_EPS);
470  }
471  default:
472  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
473  }
474 }
475 
476 
477 void
478 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
479  if (value == getAttribute(key)) {
480  return; //avoid needless changes, later logic relies on the fact that attributes have changed
481  }
482  switch (key) {
483  // Common person plan attributes
484  case SUMO_ATTR_FROM:
485  case SUMO_ATTR_TO:
487  case GNE_ATTR_TO_BUSSTOP:
488  case SUMO_ATTR_EDGES:
489  case SUMO_ATTR_ROUTE:
490  // specific person plan attributes
492  case GNE_ATTR_SELECTED:
493  case GNE_ATTR_PARAMETERS:
494  undoList->p_add(new GNEChange_Attribute(this, key, value));
495  break;
496  default:
497  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
498  }
499 }
500 
501 
502 bool
503 GNEWalk::isValid(SumoXMLAttr key, const std::string& value) {
504  switch (key) {
505  // Common person plan attributes
506  case SUMO_ATTR_FROM:
507  case SUMO_ATTR_TO:
508  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrieveEdge(value, false) != nullptr);
510  case GNE_ATTR_TO_BUSSTOP:
511  return (myNet->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
512  case SUMO_ATTR_EDGES:
513  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
514  // all edges exist, then check if compounds a valid route
515  return GNERoute::isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
516  } else {
517  return false;
518  }
519  case SUMO_ATTR_ROUTE:
520  return (myNet->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
521  // specific person plan attributes
523  if (value.empty()) {
524  return true;
525  } else if (canParse<double>(value)) {
526  const double parsedValue = canParse<double>(value);
527  if ((parsedValue < 0) || (parsedValue > getLastAllowedVehicleLane()->getLaneShape().length())) {
528  return false;
529  } else {
530  return true;
531  }
532  } else {
533  return false;
534  }
535  case GNE_ATTR_SELECTED:
536  return canParse<bool>(value);
537  case GNE_ATTR_PARAMETERS:
538  return Parameterised::areParametersValid(value);
539  default:
540  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
541  }
542 }
543 
544 
545 void
547  //
548 }
549 
550 
551 void
553  //
554 }
555 
556 
557 bool
559  return true;
560 }
561 
562 
563 std::string
565  return getTagStr();
566 }
567 
568 
569 std::string
572  return "walk: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
574  return "walk: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
576  return "walk: " + getParentAdditionals().front()->getID() + " -> " + getParentEdges().back()->getID();
578  return "walk: " + getParentAdditionals().front()->getID() + " -> " + getParentAdditionals().back()->getID();
579  } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
580  return "walk: " + getParentEdges().front()->getID() + " ... " + getParentEdges().back()->getID();
581  } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
582  return "walk: " + getParentDemandElements().at(1)->getID();
583  } else {
584  throw ("Invalid walk tag");
585  }
586 }
587 
588 
589 const std::map<std::string, std::string>&
591  return getParametersMap();
592 }
593 
594 // ===========================================================================
595 // private
596 // ===========================================================================
597 
598 void
599 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value) {
600  switch (key) {
601  // Common person plan attributes
602  case SUMO_ATTR_FROM:
603  // change first edge
604  replaceFirstParentEdge(value);
605  // compute person trip
606  computePath();
607  break;
608  case SUMO_ATTR_TO:
609  // change last edge
610  replaceLastParentEdge(value);
611  // compute person trip
612  computePath();
613  break;
616  // compute person trip
617  computePath();
618  break;
619  case GNE_ATTR_TO_BUSSTOP:
620  // -> check this
621  if (getParentAdditionals().size() > 1) {
623  } else {
625  }
626  // compute person trip
627  computePath();
628  break;
629  case SUMO_ATTR_EDGES:
631  updateGeometry();
632  break;
633  case SUMO_ATTR_ROUTE:
635  updateGeometry();
636  break;
637  // specific person plan attributes
639  if (value.empty()) {
640  myArrivalPosition = -1;
641  } else {
642  myArrivalPosition = parse<double>(value);
643  }
644  updateGeometry();
645  break;
646  case GNE_ATTR_SELECTED:
647  if (parse<bool>(value)) {
649  } else {
651  }
652  break;
653  case GNE_ATTR_PARAMETERS:
654  setParametersStr(value);
655  break;
656  default:
657  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
658  }
659 }
660 
661 
662 void
663 GNEWalk::setEnabledAttribute(const int /*enabledAttributes*/) {
664  //
665 }
666 
667 
668 /****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:403
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:411
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:401
@ GLO_WALK
a walk
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ GNE_TAG_WALK_BUSSTOP_BUSSTOP
@ SUMO_TAG_WALK
@ GNE_TAG_WALK_EDGES
@ SUMO_TAG_BUS_STOP
A bus stop.
@ GNE_TAG_WALK_EDGE_EDGE
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ GNE_TAG_WALK_BUSSTOP_EDGE
@ GNE_TAG_WALK_EDGE_BUSSTOP
@ GNE_TAG_WALK_ROUTE
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_FROM_BUSSTOP
from busStop (used by personPlans)
@ SUMO_ATTR_BUS_STOP
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_TO_BUSSTOP
to busStop (used by personPlans)
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_ROUTE
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:215
void reset()
Resets the boundary.
Definition: Boundary.cpp:65
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
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
FXIcon * getIcon() const
get FXIcon associated to this AC
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
An Element which don't belongs to GNENet but has influency in the simulation.
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry (also called "stacked geometry")
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void drawPersonPlanPartialLane(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
GNEGeometry::ExtremeGeometry calculatePersonPlanLaneStartEndPos() const
calculate extreme geometry
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
void drawPersonPlanPartialJunction(const GUIVisualizationSettings &s, const GNELane *fromLane, const GNELane *toLane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial junction
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
std::vector< GNEEdge * > calculatePath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra path between a list of partial edges
bool consecutiveEdgesConnected(const SUMOVehicleClass vClass, const GNEEdge *from, const GNEEdge *to) const
check if exist a path between the two given consecutives edges for the given VClass
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
Definition: GNENet.cpp:1141
GNENetHelper::PathCalculator * getPathCalculator()
obtain instance of PathCalculator
Definition: GNENet.cpp:136
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2316
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2435
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
void calculatePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
calculate path lanes (Dijkstra)
void calculateConsecutivePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, const std::vector< GNEEdge * > &edges)
calculate consecutive path lanes (used by routes)
const std::vector< GNEPathElements::PathElement > & getPath() const
get path edges
void resetPathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
reset path lanes
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition: GNERoute.cpp:513
bool personPlanStartEdge() const
return true if tag correspond to a person plan that starts in an edge
bool personPlanStartBusStop() const
return true if tag correspond to a person plan that starts in a busStop
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:364
DemandElementMove myWalkMove
variable for move walks
Definition: GNEWalk.h:255
SUMOVehicleClass getVClass() const
Definition: GNEWalk.cpp:203
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:558
void invalidatePath()
invalidate path
Definition: GNEWalk.cpp:327
double myArrivalPosition
arrival position
Definition: GNEWalk.h:258
void endGeometryMoving()
end geometry movement
Definition: GNEWalk.cpp:229
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:376
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEWalk.cpp:392
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEWalk.cpp:663
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:564
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:570
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:552
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEWalk.cpp:590
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:271
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:94
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:197
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:503
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:546
GNEWalk(GNENet *net, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, double arrivalPosition)
parameter constructor for person edge->edge
Definition: GNEWalk.cpp:37
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:406
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEWalk.cpp:239
void computePath()
compute path
Definition: GNEWalk.cpp:290
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:463
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNEWalk.cpp:478
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEWalk.cpp:156
~GNEWalk()
destructor
Definition: GNEWalk.cpp:90
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:370
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:426
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEWalk.cpp:260
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:209
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:178
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
Definition: GNEWalk.cpp:412
void startGeometryMoving()
Definition: GNEWalk.cpp:215
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:119
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
Stores the information about how to visualize structures.
GUIVisualizationWidthSettings widthSettings
width settings
GUIVisualizationColorSettings colorSettings
color settings
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:124
A list of positions.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Position originalViewPosition
value for saving first original position over lane before moving
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
struct for variables used in Geometry extremes
Definition: GNEGeometry.h:58
static void calculateLaneGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEPathElements::PathElement > &path, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between lanes
static const RGBColor walk
color for walks
static const double walk
width for walks