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}, {}, {}, {}, {}, {}),
56 myArrivalPosition(-1) {
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 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:181
GNEViewParent::getSelectorFrame
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Definition: GNEViewParent.cpp:185
GNEDemandElement::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Definition: GNEDemandElement.h:469
SUMO_TAG_WALK_FROMTO
Definition: SUMOXMLDefinitions.h:308
GNEWalk::GNEWalk
GNEWalk(GNEViewNet *viewNet, GNEDemandElement *personParent, SumoXMLTag walkTag, const std::vector< GNEEdge * > &edges, double arrivalPosition)
parameter constructor
Definition: GNEWalk.cpp:44
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNENet::retrieveAdditional
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2133
GNEAttributeCarrier::getIcon
FXIcon * getIcon() const
get FXIcon associated to this AC
Definition: GNEAttributeCarrier.cpp:1177
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEAdditional.h
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:795
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1187
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GNEDemandElement::getRouteCalculatorInstance
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
Definition: GNEDemandElement.cpp:435
GNEDemandElement::DemandElementMove::firstOriginalLanePosition
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:163
GNEWalk::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEWalk.cpp:346
GNEWalk::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEWalk.cpp:237
GNEWalk::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEWalk.cpp:259
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GNEWalk::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEWalk.cpp:610
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:80
GNEHierarchicalElementParents::changeAdditionalParent
void changeAdditionalParent(GNEShape *shapeTobeChanged, const std::string &newAdditionalParentID, int additionalParentIndex)
change additional parent of a shape
Definition: GNEHierarchicalElementParents.cpp:480
GNEAttributeCarrier::parseIDs
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
GNEWalk::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:464
StringTokenizer::hasNext
bool hasNext()
returns the information whether further substrings exist
Definition: StringTokenizer.cpp:95
SUMO_TAG_WALK_ROUTE
Definition: SUMOXMLDefinitions.h:310
GNEWalk::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:452
GUIGlobalSelection.h
GNEWalk::compute
void compute()
compute demand element
Definition: GNEWalk.cpp:207
GNEAttributeCarrier::isGenericParametersValid
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
Definition: GNEAttributeCarrier.cpp:1354
GNENet::retrieveDemandElement
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2266
StringTokenizer::next
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
Definition: StringTokenizer.cpp:100
GNEViewNet
Definition: GNEViewNet.h:43
GNEHierarchicalElementParents::getEdgeParents
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
Definition: GNEHierarchicalElementParents.cpp:150
MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:379
SUMO_ATTR_ARRIVALPOS
Definition: SUMOXMLDefinitions.h:438
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:379
MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:369
GNEWalk::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEWalk.cpp:476
GNEWalk::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEWalk.cpp:195
GNEDemandElement::DemandElementMove::originalViewPosition
Position originalViewPosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:160
PositionVector
A list of positions.
Definition: PositionVector.h:46
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GNEWalk::myWalkMove
DemandElementMove myWalkMove
variable for move walks
Definition: GNEWalk.h:226
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GUISUMOAbstractView::snapToActiveGrid
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.
Definition: GUISUMOAbstractView.cpp:194
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:521
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:254
GUIAppEnum.h
SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:638
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:132
GNEWalk::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:97
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
PositionVector::nearest_offset_to_point2D
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Definition: PositionVector.cpp:809
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
SUMO_TAG_WALK_EDGES
Definition: SUMOXMLDefinitions.h:307
RGBColor
Definition: RGBColor.h:40
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:105
Boundary::reset
void reset()
Resets the boundary.
Definition: Boundary.cpp:67
GNEWalk::isDemandElementValid
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
GNEWalk::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:408
GNEWalk::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:72
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:114
GNEWalk::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:375
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
GNEWalk::getColor
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:201
StringTokenizer
Definition: StringTokenizer.h:62
GNEWalk::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:458
GNEWalk::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEWalk.cpp:330
GNEViewNet.h
SUMO_ATTR_ROUTE
Definition: SUMOXMLDefinitions.h:441
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:428
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GLO_WALK
a walk
Definition: GUIGlObjectTypes.h:126
ProcessError
Definition: UtilExceptions.h:40
GNEHierarchicalElementParents::changeDemandElementParent
void changeDemandElementParent(GNEShape *shapeTobeChanged, const std::string &newDemandElementParentID, int demandElementParentIndex)
change first demand element parent of a shape
Definition: GNEHierarchicalElementParents.cpp:531
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:79
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:792
GNEWalk::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:446
SUMOXMLDefinitions::isValidGenericParameterKey
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1034
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:555
GNEWalk::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:281
GNEWalk::startGeometryMoving
void startGeometryMoving()
Definition: GNEWalk.cpp:213
GNEWalk::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:270
GNELane.h
SUMOXMLDefinitions::isValidGenericParameterValue
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1041
GNEWalk::setAttribute
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
GNEWalk.h
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:208
SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:637
GNEWalk::~GNEWalk
~GNEWalk()
destructor
Definition: GNEWalk.cpp:68
GNEViewParent.h
GNEWalk::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:315
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:240
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
GNE_ATTR_GENERIC
generic attribute
Definition: SUMOXMLDefinitions.h:986
SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:98
GNEDemandElement::RouteCalculator::areEdgesConsecutives
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
Definition: GNEDemandElement.cpp:282
GNESelectorFrame.h
GNEWalk::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNEWalk.h:232
GNEHierarchicalElementParents::getDemandElementParents
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementParents.cpp:115
SUMO_ATTR_VIA
Definition: SUMOXMLDefinitions.h:720
GUIMainWindow
Definition: GUIMainWindow.h:47
GNEHierarchicalElementParents::getAdditionalParents
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementParents.cpp:86
GNEWalk::myVia
std::vector< std::string > myVia
List of the via-edges that Person must visit.
Definition: GNEWalk.h:229
InvalidArgument
Definition: UtilExceptions.h:57
SUMO_TAG_WALK
Definition: SUMOXMLDefinitions.h:299
SUMOXMLDefinitions::isValidNetID
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Definition: SUMOXMLDefinitions.cpp:964
GNEWalk::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEWalk.cpp:491
GNEWalk::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEWalk.cpp:184
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:249
GNEWalk::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:167
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:34
GNEDemandElement::getDemandElementID
const std::string & getDemandElementID() const
returns DemandElement ID
Definition: GNEDemandElement.cpp:524
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:217
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:267
GNEAttributeCarrier::TagProperties::hasDialog
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
Definition: GNEAttributeCarrier.cpp:844
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:45
SUMO_TAG_WALK_BUSSTOP
Definition: SUMOXMLDefinitions.h:309
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1020
GNEWalk::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEWalk.cpp:502
SUMO_TAG_ROUTE
begin/end of the description of a route
Definition: SUMOXMLDefinitions.h:126
Parameterised::clearParameter
void clearParameter()
Clears the parameter map.
Definition: Parameterised.cpp:99
GNEWalk::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEWalk.cpp:227
config.h
Position::add
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:127
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
GNEDemandElement::RouteCalculator::calculateDijkstraRoute
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra route between a list of partial edges
Definition: GNEDemandElement.cpp:225
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:968
StringTokenizer.h
GNEWalk::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:309
GNESelectorFrame::LockGLObjectTypes::removeLockedObject
void removeLockedObject(const GUIGlObjectType type)
set object unselected
Definition: GNESelectorFrame.cpp:574
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1165
GNEUndoList
Definition: GNEUndoList.h:49
GNEWalk::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:293
MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:371
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEHierarchicalElementParents::changeEdgeParents
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
Definition: GNEHierarchicalElementParents.cpp:340
GNEWalk::getDemandElementProblem
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
SUMO_ATTR_BUS_STOP
Definition: SUMOXMLDefinitions.h:766
GNEHierarchicalElementChildren::getDemandElementChildren
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementChildren.cpp:297
GNEUndoList::p_begin
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
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNEWalk::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEWalk.cpp:173
GNEDemandElement::DemandElementMove::movingGeometryBoundary
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition: GNEDemandElement.h:157
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:164
GNEChange_Attribute.h
GNENet.h
GNEWalk::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:287
GUISelectedStorage::deselect
void deselect(GUIGlID id)
Deselects the object with the given id.
Definition: GUISelectedStorage.cpp:131
GNEViewNet::getViewParent
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
GNESelectorFrame::getLockGLObjectTypes
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition: GNESelectorFrame.cpp:460
GNEUndoList.h
GNE_ATTR_PARENT
parent of an additional element
Definition: SUMOXMLDefinitions.h:984
GNESelectorFrame::LockGLObjectTypes::addedLockedObject
void addedLockedObject(const GUIGlObjectType type)
set object selected
Definition: GNESelectorFrame.cpp:568