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-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 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 
38  GNEDemandElement("", net, GLO_WALK, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
39 {}, {}, {}, {}, {}, {}, {}, {}),
40 myArrivalPosition(0) {
41  // reset default values
43 }
44 
45 
46 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, double arrivalPosition) :
47  GNEDemandElement(personParent, net, GLO_WALK, GNE_TAG_WALK_EDGE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
48 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {personParent}, {}),
49 myArrivalPosition(arrivalPosition) {
50 }
51 
52 
53 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop, double arrivalPosition) :
54  GNEDemandElement(personParent, net, GLO_WALK, GNE_TAG_WALK_BUSSTOP, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
55 {}, {fromEdge}, {}, {toBusStop}, {}, {}, {personParent}, {}),
56 myArrivalPosition(arrivalPosition) {
57 }
58 
59 
60 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, std::vector<GNEEdge*> edges, double arrivalPosition) :
61  GNEDemandElement(personParent, net, GLO_WALK, GNE_TAG_WALK_EDGES, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
62 {}, {edges}, {}, {}, {}, {}, {personParent}, {}),
63 myArrivalPosition(arrivalPosition) {
64 }
65 
66 
67 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEDemandElement* route, double arrivalPosition) :
68  GNEDemandElement(personParent, net, GLO_WALK, GNE_TAG_WALK_ROUTE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
69 {}, {}, {}, {}, {}, {}, {personParent, route}, {}),
70 myArrivalPosition(arrivalPosition) {
71 }
72 
73 
74 GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction, double arrivalPosition) :
75  GNEDemandElement(personParent, net, GLO_WALK, GNE_TAG_WALK_JUNCTIONS, GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {
76  fromJunction, toJunction
77 }, {}, {}, {}, {}, {}, {personParent}, {}),
78 myArrivalPosition(arrivalPosition) {
79 }
80 
81 
83 
84 
87  // avoid move person plan that ends in busStop or junction
88  if ((getParentAdditionals().size() > 0) || (getParentJunctions().size() > 0)) {
89  return nullptr;
90  }
91  // get geometry end pos
92  const Position geometryEndPos = getPathElementArrivalPos();
93  // calculate circle width squared
95  // check if we clicked over a geometry end pos
96  if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= ((circleWidthSquared + 2))) {
97  // continue depending of parent edges
98  if (getParentEdges().size() > 0) {
99  return new GNEMoveOperation(this, getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
100  } else {
101  return new GNEMoveOperation(this, getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
102  }
103  } else {
104  return nullptr;
105  }
106 }
107 
108 
111  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
112  // build header
113  buildPopupHeader(ret, app);
114  // build menu command for center button and copy cursor position to clipboard
116  buildPositionCopyEntry(ret, false);
117  // buld menu commands for names
118  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
119  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
120  new FXMenuSeparator(ret);
121  // build selection and show parameters menu
124  // show option to open demand element dialog
125  if (myTagProperty.hasDialog()) {
126  GUIDesigns::buildFXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
127  new FXMenuSeparator(ret);
128  }
129  GUIDesigns::buildFXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
130  return ret;
131 }
132 
133 
134 void
136  // open tag
137  device.openTag(SUMO_TAG_WALK);
138  // write attributes depending of walk type
141  } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
143  } else {
144  // check if from attribute is enabled
146  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
149  }
150  // write to depending if personplan ends in a busStop, edge or junction
151  if (getParentAdditionals().size() > 0) {
153  } else if (getParentEdges().size() > 0) {
154  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
155  } else {
157  }
158  }
159  // avoid writte arrival positions in walk to busStop
161  // only write arrivalPos if is different of -1
162  if (myArrivalPosition != -1) {
164  }
165  }
166  // write parameters
167  writeParams(device);
168  // close tag
169  device.closeTag();
170 }
171 
172 
175  return isPersonPlanValid();
176 }
177 
178 
179 std::string
181  return getPersonPlanProblem();
182 }
183 
184 
185 void
187  // currently the only solution is removing Walk
188 }
189 
190 
193  return getParentDemandElements().front()->getVClass();
194 }
195 
196 
197 const RGBColor&
199  return getParentDemandElements().front()->getColor();
200 }
201 
202 
203 void
205  // update child demand elementss
206  for (const auto& i : getChildDemandElements()) {
207  i->updateGeometry();
208  }
209 }
210 
211 
212 Position
214  if (getParentEdges().size() > 0) {
215  return getParentEdges().front()->getPositionInView();
216  } else {
217  return getParentDemandElements().at(1)->getPositionInView();
218  }
219 }
220 
221 
222 std::string
224  return getParentDemandElements().front()->getID();
225 }
226 
227 
228 double
230  return 1;
231 }
232 
233 
234 Boundary
236  Boundary walkBoundary;
237  // return the combination of all parent edges's boundaries
238  for (const auto& i : getParentEdges()) {
239  walkBoundary.add(i->getCenteringBoundary());
240  }
241  // check if is valid
242  if (walkBoundary.isInitialised()) {
243  return walkBoundary;
244  } else {
245  return Boundary(-0.1, -0.1, 0.1, 0.1);
246  }
247 }
248 
249 
250 void
251 GNEWalk::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
252  // only split geometry of WalkEdges
254  // obtain new list of walk edges
255  std::string newWalkEdges = getNewListOfParents(originalElement, newElement);
256  // update walk edges
257  if (newWalkEdges.size() > 0) {
258  setAttribute(SUMO_ATTR_EDGES, newWalkEdges, undoList);
259  }
260  }
261 }
262 
263 
264 void
266  // force draw path
267  myNet->getPathManager()->forceDrawPath(s, this);
268  // special case for junction walks
269  if (getParentJunctions().size() > 0) {
270  // get person parent
271  const GNEDemandElement* personParent = getParentDemandElements().front();
272  if ((personParent->getChildDemandElements().size() > 0) && (personParent->getChildDemandElements().front() == this)) {
273  personParent->drawGL(s);
274  }
275  }
276 }
277 
278 
279 void
281  // avoid calculate for junctions
282  if (getParentJunctions().empty()) {
283  // declare lane vector
284  std::vector<GNELane*> lanes;
285  // update lanes depending of walk tag
287  // calculate consecutive path using parent edges
289  } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
290  // calculate consecutive path using route edges
292  } else if (getParentEdges().size() > 0) {
293  // get first and last person plane
294  lanes = {getFirstPathLane(), getLastPathLane()};
295  // calculate path
296  myNet->getPathManager()->calculatePathLanes(this, getVClass(), lanes);
297  }
298  }
299  // update geometry
300  updateGeometry();
301 }
302 
303 
304 void
305 GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
306  // draw person plan over lane
307  drawPersonPlanPartial(drawPersonPlan(), s, lane, segment, offsetFront, s.widthSettings.walkWidth, s.colorSettings.walkColor);
308 }
309 
310 
311 void
312 GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
313  // draw person plan over junction
314  drawPersonPlanPartial(drawPersonPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.walkWidth, s.colorSettings.walkColor);
315 }
316 
317 
318 GNELane*
320  // check if this walk is over a route
322  return getParentDemandElements().at(1)->getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
323  } else if (getParentJunctions().size() > 0) {
324  throw ProcessError("This walk use junctions");
325  } else {
326  return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
327  }
328 }
329 
330 
331 GNELane*
333  // check if this walk is over a route
335  return getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
336  } else if (getParentAdditionals().size() > 0) {
337  return getParentAdditionals().front()->getParentLanes().front();
338  } else if (getParentJunctions().size() > 0) {
339  throw ProcessError("This walk use junctions");
340  } else {
341  return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
342  }
343 }
344 
345 
346 std::string
348  switch (key) {
349  // Common person plan attributes
350  case SUMO_ATTR_ID:
351  return getParentDemandElements().front()->getID();
352  case SUMO_ATTR_FROM:
354  return getParentDemandElements().at(1)->getParentEdges().front()->getID();
355  } else {
356  return getParentEdges().front()->getID();
357  }
358  case SUMO_ATTR_TO:
360  return getParentDemandElements().at(1)->getParentEdges().back()->getID();
361  } else {
362  return getParentEdges().back()->getID();
363  }
365  return getParentJunctions().front()->getID();
367  return getParentJunctions().back()->getID();
368  case GNE_ATTR_TO_BUSSTOP:
369  return getParentAdditionals().back()->getID();
370  case SUMO_ATTR_EDGES:
371  return parseIDs(getParentEdges());
372  case SUMO_ATTR_ROUTE:
373  return getParentDemandElements().at(1)->getID();
374  // specific person plan attributes
376  if (myArrivalPosition == -1) {
377  return "";
378  } else {
379  return toString(myArrivalPosition);
380  }
381  case GNE_ATTR_SELECTED:
383  case GNE_ATTR_PARAMETERS:
384  return getParametersStr();
385  case GNE_ATTR_PARENT:
386  return getParentDemandElements().front()->getID();
387  default:
388  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
389  }
390 }
391 
392 
393 double
395  switch (key) {
397  if (getParentJunctions().size() > 0) {
398  return 0;
399  } else if (myArrivalPosition != -1) {
400  return myArrivalPosition;
401  } else {
402  return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
403  }
404  default:
405  throw InvalidArgument(getTagStr() + " doesn't have a doubleattribute of type '" + toString(key) + "'");
406  }
407 }
408 
409 
410 Position
412  switch (key) {
413  case SUMO_ATTR_ARRIVALPOS: {
414  if (getParentJunctions().size() > 0) {
415  return getParentJunctions().back()->getPositionInView();
416  } else {
417  // get lane shape
418  const PositionVector& laneShape = getLastPathLane()->getLaneShape();
419  // continue depending of arrival position
420  if (myArrivalPosition == 0) {
421  return laneShape.front();
422  } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
423  return laneShape.back();
424  } else {
425  return laneShape.positionAtOffset2D(myArrivalPosition);
426  }
427  }
428  }
429  default:
430  throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
431  }
432 }
433 
434 
435 void
436 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
437  switch (key) {
438  // Common person plan attributes
439  case SUMO_ATTR_FROM:
441  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
442  }
443  break;
446  case GNE_ATTR_SELECTED:
447  case GNE_ATTR_PARAMETERS:
448  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
449  break;
450  // special case for "to" attributes
451  case SUMO_ATTR_TO:
452  case SUMO_ATTR_TOJUNCTION: {
454  // get next personPlan
455  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
456  // continue depending of nextPersonPlan
457  if (nextPersonPlan) {
458  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
459  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
460  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
461  undoList->end();
462  } else {
463  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
464  }
465  }
466  break;
467  }
468  case GNE_ATTR_TO_BUSSTOP: {
469  // get next person plan
470  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
471  // continue depending of nextPersonPlan
472  if (nextPersonPlan) {
473  // obtain busStop
475  // change from attribute using edge ID
476  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
477  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
478  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
479  undoList->end();
480  } else {
481  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
482  }
483  break;
484  }
485  case SUMO_ATTR_EDGES: {
486  // get next person plan
487  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
488  // continue depending of nextPersonPlan
489  if (nextPersonPlan) {
490  // obtain edges
491  const std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
492  // change from attribute using edge ID
493  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
494  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, edges.back()->getID(), undoList);
495  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
496  undoList->end();
497  } else {
498  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
499  }
500  break;
501  }
502  case SUMO_ATTR_ROUTE: {
503  // get next person plan
504  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
505  // continue depending of nextPersonPlan
506  if (nextPersonPlan) {
507  // obtain route
509  // change from attribute using edge ID
510  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
511  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, route->getParentEdges().back()->getID(), undoList);
512  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
513  undoList->end();
514  } else {
515  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
516  }
517  break;
518  }
519  default:
520  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
521  }
522 }
523 
524 
525 bool
526 GNEWalk::isValid(SumoXMLAttr key, const std::string& value) {
527  switch (key) {
528  // Common person plan attributes
529  case SUMO_ATTR_FROM:
530  case SUMO_ATTR_TO:
532  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
533  } else {
534  return false;
535  }
538  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
539  case GNE_ATTR_TO_BUSSTOP:
540  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
541  case SUMO_ATTR_EDGES:
542  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
543  // all edges exist, then check if compounds a valid route
544  return GNERoute::isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
545  } else {
546  return false;
547  }
548  case SUMO_ATTR_ROUTE:
549  return (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
550  // specific person plan attributes
552  if (value.empty()) {
553  return true;
554  } else if (canParse<double>(value)) {
555  const double parsedValue = canParse<double>(value);
556  if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
557  return false;
558  } else {
559  return true;
560  }
561  } else {
562  return false;
563  }
564  case GNE_ATTR_SELECTED:
565  return canParse<bool>(value);
566  case GNE_ATTR_PARAMETERS:
567  return Parameterised::areParametersValid(value);
568  default:
569  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
570  }
571 }
572 
573 
574 void
576  //
577 }
578 
579 
580 void
582  //
583 }
584 
585 
586 bool
588  switch (key) {
589  case SUMO_ATTR_FROM:
591  return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
592  default:
593  return true;
594  }
595 }
596 
597 
598 std::string
600  return getTagStr();
601 }
602 
603 
604 std::string
607  return "walk: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
608  } else if (myTagProperty.getTag() == GNE_TAG_WALK_JUNCTIONS) {
609  return "walk: " + getParentJunctions().front()->getID() + " -> " + getParentJunctions().back()->getID();
610  } else if (myTagProperty.getTag() == GNE_TAG_WALK_BUSSTOP) {
611  return "walk: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
612  } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
613  return "walk: " + getParentEdges().front()->getID() + " ... " + getParentEdges().back()->getID();
614  } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
615  return "walk: " + getParentDemandElements().at(1)->getID();
616  } else {
617  throw ("Invalid walk tag");
618  }
619 }
620 
621 
622 const std::map<std::string, std::string>&
624  return getParametersMap();
625 }
626 
627 // ===========================================================================
628 // private
629 // ===========================================================================
630 
631 void
632 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value) {
633  switch (key) {
634  // Common person plan attributes
635  case SUMO_ATTR_FROM:
636  // change first edge
637  replaceFirstParentEdge(value);
638  // compute walk
640  break;
641  case SUMO_ATTR_TO:
642  // change last edge
643  replaceLastParentEdge(value);
644  // compute walk
646  break;
648  // change first junction
650  // compute walk
652  break;
654  // change last junction
656  // compute walk
658  break;
659  case GNE_ATTR_TO_BUSSTOP:
661  // compute walk
663  break;
664  case SUMO_ATTR_EDGES:
666  // compute walk
668  break;
669  case SUMO_ATTR_ROUTE:
671  // compute walk
673  break;
674  // specific person plan attributes
676  if (value.empty()) {
677  myArrivalPosition = -1;
678  } else {
679  myArrivalPosition = parse<double>(value);
680  }
681  updateGeometry();
682  break;
683  case GNE_ATTR_SELECTED:
684  if (parse<bool>(value)) {
686  } else {
688  }
689  break;
690  case GNE_ATTR_PARAMETERS:
691  setParametersStr(value);
692  break;
693  default:
694  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
695  }
696 }
697 
698 
699 void
700 GNEWalk::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
701  // nothing to toogle
702 }
703 
704 
705 void
707  // change both position
708  myArrivalPosition = moveResult.newFirstPos;
709  // update geometry
710  updateGeometry();
711 }
712 
713 
714 void
715 GNEWalk::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
716  undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
717  // now adjust start position
718  setAttribute(SUMO_ATTR_ARRIVALPOS, toString(moveResult.newFirstPos), undoList);
719  undoList->end();
720 }
721 
722 /****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:413
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:423
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:411
@ GLO_WALK
a walk
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_WALK
@ GNE_TAG_WALK_EDGES
@ SUMO_TAG_BUS_STOP
A bus stop.
@ GNE_TAG_WALK_BUSSTOP
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ GNE_TAG_WALK_JUNCTIONS
@ GNE_TAG_WALK_EDGE
@ GNE_TAG_WALK_ROUTE
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_FROMJUNCTION
@ 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
@ SUMO_ATTR_TOJUNCTION
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
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
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
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
void resetDefaultValues()
reset attribute carrier to their default values
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
reference to tagProperty associated with this attribute carrier
An Element which don't belongs to GNENet but has influency in the simulation.
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
Problem isPersonPlanValid() const
check if person plan is valid
Position getPathElementArrivalPos() const
get path element arrival position
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
std::string getPersonPlanProblem() const
get person plan problem
void replaceFirstParentJunction(const std::string &value)
replace the first parent junction
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform demand element changes
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value)
replace additional parent
Problem
enum class for demandElement problems
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
static const double myPersonPlanArrivalPositionDiameter
person plans arrival position radius
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
bool drawPersonPlan() const
void replaceLastParentJunction(const std::string &value)
replace the last parent junction
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
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:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
move operation
move result
double newFirstPos
new first position
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
void calculateConsecutivePathEdges(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEEdge * > edges)
calculate consecutive path edges
void forceDrawPath(const GUIVisualizationSettings &s, const PathElement *pathElement) const
force draw path (used carefully, ONLY when we're inspecting a path element, due slowdowns)
void calculatePathLanes(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNELane * > lanes)
calculate path lanes (using dijkstra, require path calculator updated)
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition: GNERoute.cpp:725
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
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 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 changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:213
SUMOVehicleClass getVClass() const
Definition: GNEWalk.cpp:192
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:587
double myArrivalPosition
arrival position
Definition: GNEWalk.h:258
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:235
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEWalk.cpp:251
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:599
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:605
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEWalk.cpp:319
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:581
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEWalk.cpp:305
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEWalk.cpp:623
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:204
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEWalk.cpp:411
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:110
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:186
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNEWalk.cpp:229
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:526
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:575
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEWalk.cpp:86
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:265
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEWalk.cpp:706
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:394
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEWalk.cpp:174
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:436
~GNEWalk()
destructor
Definition: GNEWalk.cpp:82
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:223
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:347
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEWalk.cpp:715
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:198
void computePathElement()
compute pathElement
Definition: GNEWalk.cpp:280
GNELane * getLastPathLane() const
get last path lane
Definition: GNEWalk.cpp:332
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:180
GNEWalk(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEWalk.cpp:37
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:135
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEWalk.cpp:700
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
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 getPositionInformation() const
Returns the cursor's x/y position within the network.
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:61
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:248
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, 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:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:257
A list of positions.
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element