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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing walks in Netedit
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
27 #include <netedit/GNENet.h>
28 #include <netedit/GNEUndoList.h>
29 #include <netedit/GNEViewNet.h>
30 #include <netedit/GNEViewParent.h>
36 
37 #include "GNEWalk.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
43 
44 GNEWalk::GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, SumoXMLTag walkTag, const std::vector<GNEEdge*>& edges, double arrivalPosition) :
45  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", walkTag), viewNet, GLO_WALK, walkTag,
46  edges, {}, {}, {}, {personParent}, {}, {}, {}, {}, {}),
47  Parameterised(),
48 myArrivalPosition(arrivalPosition) {
49 }
50 
51 
52 GNEWalk::GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, GNEAdditional* busStop) :
53  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_WALK_BUSSTOP), viewNet, GLO_WALK, SUMO_TAG_WALK_BUSSTOP,
54  edges, {}, {}, {busStop}, {personParent}, {}, {}, {}, {}, {}),
57 }
58 
59 
60 GNEWalk::GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEDemandElement* routeParent, double arrivalPosition) :
61  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_WALK_ROUTE), viewNet, GLO_WALK, SUMO_TAG_WALK_ROUTE,
62 {}, {}, {}, {}, {personParent, routeParent}, {}, {}, {}, {}, {}),
64 myArrivalPosition(arrivalPosition) {
65 }
66 
67 
69 
70 
73  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
74  // build header
75  buildPopupHeader(ret, app);
76  // build menu command for center button and copy cursor position to clipboard
78  buildPositionCopyEntry(ret, false);
79  // buld menu commands for names
80  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
81  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
82  new FXMenuSeparator(ret);
83  // build selection and show parameters menu
86  // show option to open demand element dialog
87  if (myTagProperty.hasDialog()) {
88  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
89  new FXMenuSeparator(ret);
90  }
91  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
92  return ret;
93 }
94 
95 
96 void
98  // open tag
99  device.openTag(SUMO_TAG_WALK);
100  // write attributes depending of walk type
103  } else if (myTagProperty.getTag() == SUMO_TAG_WALK_EDGES) {
105  } else {
106  // only write From attribute if this is the first Person Plan
107  if (getDemandElementParents().front()->getDemandElementChildren().front() == this) {
108  device.writeAttr(SUMO_ATTR_FROM, getEdgeParents().front()->getID());
109  }
110  // check if write busStop or edge to
111  if (getAdditionalParents().size() > 0) {
113  } else {
114  device.writeAttr(SUMO_ATTR_TO, getEdgeParents().back()->getID());
115  }
116  }
117  // only write arrivalPos if is different of -1
118  if (myArrivalPosition != -1) {
120  }
121  // close tag
122  device.closeTag();
123 }
124 
125 
126 bool
129  return true;
130  } else if (getEdgeParents().size() == 0) {
131  return false;
132  } else if (getEdgeParents().size() == 1) {
133  return true;
134  } else {
135  // check if exist at least a connection between every edge
136  for (int i = 1; i < (int)getEdgeParents().size(); i++) {
137  if (getRouteCalculatorInstance()->areEdgesConsecutives(getDemandElementParents().front()->getVClass(), getEdgeParents().at((int)i - 1), getEdgeParents().at(i)) == false) {
138  return false;
139  }
140  }
141  // there is connections bewteen all edges, then return true
142  return true;
143  }
144 }
145 
146 
147 std::string
150  return "";
151  } else if (getEdgeParents().size() == 0) {
152  return ("A walk need at least one edge");
153  } else {
154  // check if exist at least a connection between every edge
155  for (int i = 1; i < (int)getEdgeParents().size(); i++) {
156  if (getRouteCalculatorInstance()->areEdgesConsecutives(getDemandElementParents().front()->getVClass(), getEdgeParents().at((int)i - 1), getEdgeParents().at(i)) == false) {
157  return ("Edge '" + getEdgeParents().at((int)i - 1)->getID() + "' and edge '" + getEdgeParents().at(i)->getID() + "' aren't consecutives");
158  }
159  }
160  // there is connections bewteen all edges, then all ok
161  return "";
162  }
163 }
164 
165 
166 void
168  // currently the only solution is removing Walk
169 }
170 
171 
172 GNEEdge*
174  if (getDemandElementParents().size() == 2) {
175  // obtain position and rotation of first edge route
176  return getDemandElementParents().at(1)->getFromEdge();
177  } else {
178  return getEdgeParents().front();
179  }
180 }
181 
182 
183 GNEEdge*
185  if (getDemandElementParents().size() == 2) {
186  // obtain position and rotation of first edge route
187  return getDemandElementParents().at(1)->getToEdge();
188  } else {
189  return getEdgeParents().back();
190  }
191 }
192 
193 
196  return getDemandElementParents().front()->getVClass();
197 }
198 
199 
200 const RGBColor&
202  return getDemandElementParents().front()->getColor();
203 }
204 
205 
206 void
208  // Nothing to compute
209 }
210 
211 
212 void
214  // only start geometry moving if arrival position isn't -1
215  if (myArrivalPosition != -1) {
216  // always save original position over view
218  // save arrival position
220  // save current centering boundary
222  }
223 }
224 
225 
226 void
228  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
230  // reset myMovingGeometryBoundary
232  }
233 }
234 
235 
236 void
238  // only move if myArrivalPosition isn't -1
239  if (myArrivalPosition != -1) {
240  // Calculate new position using old position
242  newPosition.add(offset);
243  // filtern position using snap to active grid
244  newPosition = myViewNet->snapToActiveGrid(newPosition);
245  // obtain lane shape (to improve code legibility)
246  const PositionVector& laneShape = getEdgeParents().back()->getLanes().front()->getGeometry().shape;
247  // calculate offset lane
248  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myWalkMove.originalViewPosition, false);
249  std::cout << offsetLane << std::endl;
250  // Update arrival Position
251  myArrivalPosition = parse<double>(myWalkMove.firstOriginalLanePosition) + offsetLane;
252  // Update geometry
253  updateGeometry();
254  }
255 }
256 
257 
258 void
260  // only commit geometry moving if myArrivalPosition isn't -1
261  if (myArrivalPosition != -1) {
262  undoList->p_begin("arrivalPos of " + getTagStr());
264  undoList->p_end();
265  }
266 }
267 
268 
269 void
271  // update person parent
272  getDemandElementParents().front()->updateGeometry();
273  // update demand element childs
274  for (const auto& i : getDemandElementChildren()) {
275  i->updateGeometry();
276  }
277 }
278 
279 
280 Position
282  return Position();
283 }
284 
285 
286 std::string
288  return myViewNet->getNet()->getMicrosimID();
289 }
290 
291 
292 Boundary
294  Boundary walkBoundary;
295  // return the combination of all edge parents's boundaries
296  for (const auto& i : getEdgeParents()) {
297  walkBoundary.add(i->getCenteringBoundary());
298  }
299  // check if is valid
300  if (walkBoundary.isInitialised()) {
301  return walkBoundary;
302  } else {
303  return Boundary(-0.1, -0.1, 0.1, 0.1);
304  }
305 }
306 
307 
308 void
310  // Walks are drawn in GNEEdges
311 }
312 
313 
314 void
316  if (!myViewNet) {
317  throw ProcessError("ViewNet cannot be nullptr");
318  } else {
320  // add object of list into selected objects
322  if (changeFlag) {
323  mySelected = true;
324  }
325  }
326 }
327 
328 
329 void
331  if (!myViewNet) {
332  throw ProcessError("ViewNet cannot be nullptr");
333  } else {
335  // remove object of list of selected objects
337  if (changeFlag) {
338  mySelected = false;
339 
340  }
341  }
342 }
343 
344 
345 std::string
347  switch (key) {
348  case SUMO_ATTR_ID:
349  return getDemandElementID();
350  case SUMO_ATTR_FROM:
351  return getEdgeParents().front()->getID();
352  case SUMO_ATTR_TO:
353  return getEdgeParents().back()->getID();
354  case SUMO_ATTR_ROUTE:
355  return getDemandElementParents().at(1)->getID();
356  case SUMO_ATTR_VIA:
357  return toString(myVia);
358  case SUMO_ATTR_BUS_STOP:
359  return getAdditionalParents().front()->getID();
361  return toString(myArrivalPosition);
362  case GNE_ATTR_SELECTED:
364  case GNE_ATTR_GENERIC:
365  return getGenericParametersStr();
366  case GNE_ATTR_PARENT:
367  return getDemandElementParents().front()->getID();
368  default:
369  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
370  }
371 }
372 
373 
374 double
376  switch (key) {
378  return myArrivalPosition;
379  default:
380  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
381  }
382 }
383 
384 
385 void
386 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
387  if (value == getAttribute(key)) {
388  return; //avoid needless changes, later logic relies on the fact that attributes have changed
389  }
390  switch (key) {
391  case SUMO_ATTR_FROM:
392  case SUMO_ATTR_TO:
393  case SUMO_ATTR_VIA:
394  case SUMO_ATTR_ROUTE:
395  case SUMO_ATTR_BUS_STOP:
397  case GNE_ATTR_SELECTED:
398  case GNE_ATTR_GENERIC:
399  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
400  break;
401  default:
402  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
403  }
404 }
405 
406 
407 bool
408 GNEWalk::isValid(SumoXMLAttr key, const std::string& value) {
409  switch (key) {
410  case SUMO_ATTR_FROM:
411  case SUMO_ATTR_TO:
412  return SUMOXMLDefinitions::isValidNetID(value) && (myViewNet->getNet()->retrieveEdge(value, false) != nullptr);
413  case SUMO_ATTR_VIA:
414  if (value.empty()) {
415  return true;
416  } else {
417  return canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), value, false);
418  }
419  case SUMO_ATTR_BUS_STOP:
420  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
421  case SUMO_ATTR_ROUTE:
422  return (myViewNet->getNet()->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
424  if (canParse<double>(value)) {
425  double parsedValue = canParse<double>(value);
426  // a arrival pos with value -1 means that it will be ignored
427  if (parsedValue == -1) {
428  return true;
429  } else {
430  return parsedValue >= 0;
431  }
432  } else {
433  return false;
434  }
435  case GNE_ATTR_SELECTED:
436  return canParse<bool>(value);
437  case GNE_ATTR_GENERIC:
438  return isGenericParametersValid(value);
439  default:
440  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
441  }
442 }
443 
444 
445 void
447  //
448 }
449 
450 
451 bool
453  return true;
454 }
455 
456 
457 std::string
459  return getTagStr();
460 }
461 
462 
463 std::string
466  return "walk: " + getEdgeParents().front()->getID() + " -> " + getEdgeParents().back()->getID();
467  } else if (myTagProperty.getTag() == SUMO_TAG_WALK_BUSSTOP) {
468  return "walk: " + getEdgeParents().front()->getID() + " -> " + getAdditionalParents().front()->getID();
469  } else {
470  return "walk: " + getDemandElementParents().at(1)->getID();
471  }
472 }
473 
474 
475 std::string
477  std::string result;
478  // Generate an string using the following structure: "key1=value1|key2=value2|...
479  for (auto i : getParametersMap()) {
480  result += i.first + "=" + i.second + "|";
481  }
482  // remove the last "|"
483  if (!result.empty()) {
484  result.pop_back();
485  }
486  return result;
487 }
488 
489 
490 std::vector<std::pair<std::string, std::string> >
492  std::vector<std::pair<std::string, std::string> > result;
493  // iterate over parameters map and fill result
494  for (auto i : getParametersMap()) {
495  result.push_back(std::make_pair(i.first, i.second));
496  }
497  return result;
498 }
499 
500 
501 void
502 GNEWalk::setGenericParametersStr(const std::string& value) {
503  // clear parameters
504  clearParameter();
505  // separate value in a vector of string using | as separator
506  std::vector<std::string> parsedValues;
507  StringTokenizer stValues(value, "|", true);
508  while (stValues.hasNext()) {
509  parsedValues.push_back(stValues.next());
510  }
511  // check that parsed values (A=B)can be parsed in generic parameters
512  for (auto i : parsedValues) {
513  std::vector<std::string> parsedParameters;
514  StringTokenizer stParam(i, "=", true);
515  while (stParam.hasNext()) {
516  parsedParameters.push_back(stParam.next());
517  }
518  // Check that parsed parameters are exactly two and contains valid chracters
519  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
520  setParameter(parsedParameters.front(), parsedParameters.back());
521  }
522  }
523 }
524 
525 // ===========================================================================
526 // private
527 // ===========================================================================
528 
529 void
530 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value) {
531  switch (key) {
532  case SUMO_ATTR_FROM: {
533  // declare a from-via-to edges vector
534  std::vector<std::string> FromViaToEdges;
535  // add from edge
536  FromViaToEdges.push_back(value);
537  // add via edges
538  FromViaToEdges.insert(FromViaToEdges.end(), myVia.begin(), myVia.end());
539  // add to edge
540  FromViaToEdges.push_back(getEdgeParents().back()->getID());
541  // calculate route
542  std::vector<GNEEdge*> route = getRouteCalculatorInstance()->calculateDijkstraRoute(myViewNet->getNet(), getDemandElementParents().at(0)->getVClass(), FromViaToEdges);
543  // change edge parents
544  changeEdgeParents(this, toString(route));
545  break;
546  }
547  case SUMO_ATTR_TO: {
548  // declare a from-via-to edges vector
549  std::vector<std::string> FromViaToEdges;
550  // add from edge
551  FromViaToEdges.push_back(getEdgeParents().front()->getID());
552  // add via edges
553  FromViaToEdges.insert(FromViaToEdges.end(), myVia.begin(), myVia.end());
554  // add to edge
555  FromViaToEdges.push_back(value);
556  // calculate route
557  std::vector<GNEEdge*> route = getRouteCalculatorInstance()->calculateDijkstraRoute(myViewNet->getNet(), getDemandElementParents().at(0)->getVClass(), FromViaToEdges);
558  // change edge parents
559  changeEdgeParents(this, toString(route));
560  break;
561  }
562  case SUMO_ATTR_VIA: {
563  if (!value.empty()) {
564  // set new via edges
565  myVia = parse< std::vector<std::string> >(value);
566  } else {
567  // clear via
568  myVia.clear();
569  }
570  // declare a from-via-to edges vector
571  std::vector<std::string> FromViaToEdges;
572  // add from edge
573  FromViaToEdges.push_back(getEdgeParents().front()->getID());
574  // add via edges
575  FromViaToEdges.insert(FromViaToEdges.end(), myVia.begin(), myVia.end());
576  // add to edge
577  FromViaToEdges.push_back(getEdgeParents().back()->getID());
578  // calculate route
579  std::vector<GNEEdge*> route = getRouteCalculatorInstance()->calculateDijkstraRoute(myViewNet->getNet(), getDemandElementParents().at(0)->getVClass(), FromViaToEdges);
580  // change edge parents
581  changeEdgeParents(this, toString(route));
582  break;
583  }
584  case SUMO_ATTR_ROUTE:
585  changeDemandElementParent(this, value, 1);
586  break;
587  case SUMO_ATTR_BUS_STOP:
588  changeAdditionalParent(this, value, 0);
589  break;
591  myArrivalPosition = parse<double>(value);
592  break;
593  case GNE_ATTR_SELECTED:
594  if (parse<bool>(value)) {
596  } else {
598  }
599  break;
600  case GNE_ATTR_GENERIC:
602  break;
603  default:
604  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
605  }
606 }
607 
608 
609 void
610 GNEWalk::setEnabledAttribute(const int /*enabledAttributes*/) {
611  //
612 }
613 
614 /****************************************************************************/
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:287
Copy object name - popup entry.
Definition: GUIAppEnum.h:369
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge *> &partialEdges) const
calculate Dijkstra route between a list of partial edges
SumoXMLTag
Numbers representing SUMO-XML - element names.
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.
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEWalk.cpp:346
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNEWalk.cpp:259
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1020
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEWalk.cpp:237
void addedLockedObject(const GUIGlObjectType type)
set object selected
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute) ...
Definition: GNEWalk.cpp:610
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:127
void compute()
compute demand element
Definition: GNEWalk.cpp:207
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Stores the information about how to visualize structures.
void changeAdditionalParent(GNEShape *shapeTobeChanged, const std::string &newAdditionalParentID, int additionalParentIndex)
change additional parent of a shape
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:464
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
Position originalViewPosition
value for saving first original position over lane before moving
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:452
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
FXIcon * getIcon() const
get FXIcon associated to this AC
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:73
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool hasNext()
returns the information whether further substrings exist
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEWalk.cpp:476
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEWalk.cpp:195
generic attribute
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
begin/end of the description of a route
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:408
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
DemandElementMove myWalkMove
variable for move walks
Definition: GNEWalk.h:226
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2133
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:97
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEWalk.cpp:330
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEWalk.cpp:127
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:72
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2266
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:446
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:375
A list of positions.
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeLockedObject(const GUIGlObjectType type)
set object unselected
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:201
friend class GNEChange_Attribute
declare friend class
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:458
void changeDemandElementParent(GNEShape *shapeTobeChanged, const std::string &newDemandElementParentID, int demandElementParentIndex)
change first demand element parent of a shape
void startGeometryMoving()
Definition: GNEWalk.cpp:213
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
const std::string & getDemandElementID() const
returns DemandElement ID
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:270
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
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:386
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
~GNEWalk()
destructor
Definition: GNEWalk.cpp:68
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:281
double myArrivalPosition
arrival position
Definition: GNEWalk.h:232
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
std::vector< std::string > myVia
List of the via-edges that Person must visit.
Definition: GNEWalk.h:229
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEWalk.cpp:491
void reset()
Resets the boundary.
Definition: Boundary.cpp:67
void deselect(GUIGlID id)
Deselects the object with the given id.
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:315
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
const std::string & getTagStr() const
get tag assigned to this object in string format
element is selected
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
The popup menu of a globject.
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:379
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:309
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEWalk.cpp:184
Parameterised()
Constructor.
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children) ...
Definition: GNEWalk.cpp:167
GUIGlID getGlID() const
Returns the numerical id of the object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:293
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEWalk.cpp:502
void endGeometryMoving()
end geometry movement
Definition: GNEWalk.cpp:227
parent of an additional element
GNEWalk(GNEViewNet *viewNet, GNEDemandElement *personParent, SumoXMLTag walkTag, const std::vector< GNEEdge *> &edges, double arrivalPosition)
parameter constructor
Definition: GNEWalk.cpp:44
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:79
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
GUISelectedStorage gSelected
A global holder of selected objects.
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:371
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:148
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
GNEEdge * getFromEdge() const
Definition: GNEWalk.cpp:173
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
void clearParameter()
Clears the parameter map.