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 /****************************************************************************/
14 // A class for visualizing walks in Netedit
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
26 #include <netedit/GNENet.h>
27 #include <netedit/GNEUndoList.h>
28 #include <netedit/GNEViewNet.h>
29 #include <netedit/GNEViewParent.h>
35 
36 #include "GNEWalk.h"
37 
38 
39 // ===========================================================================
40 // method definitions
41 // ===========================================================================
42 
43 GNEWalk::GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, double arrivalPosition) :
44  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_WALK_EDGES), viewNet, GLO_WALK, SUMO_TAG_WALK_EDGES, {
45  edges
46 }, {}, {}, {}, {personParent}, {}, {}, {}, {}, {}),
48 myArrivalPosition(arrivalPosition) {
49 }
50 
51 
52 GNEWalk::GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, const std::vector<GNEEdge*>& via,
53  double arrivalPosition) :
54  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_WALK_FROMTO), viewNet, GLO_WALK, SUMO_TAG_WALK_FROMTO, {
55  fromEdge, toEdge
56 }, {}, {}, {}, {personParent}, {}, {}, {}, {}, {}),
58 myArrivalPosition(arrivalPosition) {
59  // set via parameter without updating references
60  replaceMiddleParentEdges(this, via, false);
61  // compute walk
62  computePath();
63 }
64 
65 
66 GNEWalk::GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* busStop, const std::vector<GNEEdge*>& via) :
67  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_WALK_BUSSTOP), viewNet, GLO_WALK, SUMO_TAG_WALK_BUSSTOP, {
68  fromEdge
69 }, {}, {}, {busStop}, {personParent}, {}, {}, {}, {}, {}),
71 myArrivalPosition(-1) {
72  // set via parameter without updating references
73  replaceMiddleParentEdges(this, via, false);
74  // compute walk
75  computePath();
76 }
77 
78 
79 GNEWalk::GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEDemandElement* routeParent, double arrivalPosition) :
80  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_WALK_ROUTE), viewNet, GLO_WALK, SUMO_TAG_WALK_ROUTE,
81 {}, {}, {}, {}, {personParent, routeParent}, {}, {}, {}, {}, {}),
83 myArrivalPosition(arrivalPosition) {
84 }
85 
86 
88 
89 
92  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
93  // build header
94  buildPopupHeader(ret, app);
95  // build menu command for center button and copy cursor position to clipboard
97  buildPositionCopyEntry(ret, false);
98  // buld menu commands for names
99  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
100  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
101  new FXMenuSeparator(ret);
102  // build selection and show parameters menu
105  // show option to open demand element dialog
106  if (myTagProperty.hasDialog()) {
107  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
108  new FXMenuSeparator(ret);
109  }
110  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
111  return ret;
112 }
113 
114 
115 void
117  // open tag
118  device.openTag(SUMO_TAG_WALK);
119  // write attributes depending of walk type
122  } else if (myTagProperty.getTag() == SUMO_TAG_WALK_EDGES) {
124  } else {
125  // only write From attribute if this is the first Person Plan
126  if (getParentDemandElements().front()->getChildDemandElements().front() == this) {
127  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
128  }
129  // check if write busStop or edge to
130  if (getParentAdditionals().size() > 0) {
132  } else {
133  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
134  }
135  }
136  // only write arrivalPos if is different of -1
137  if (myArrivalPosition != -1) {
139  }
140  // write parameters
141  writeParams(device);
142  // close tag
143  device.closeTag();
144 }
145 
146 
147 bool
150  return true;
151  } else if (getParentEdges().size() == 0) {
152  return false;
153  } else if (getParentEdges().size() == 1) {
154  return true;
155  } else {
156  // check if exist at least a connection between every edge
157  for (int i = 1; i < (int)getParentEdges().size(); i++) {
158  if (getRouteCalculatorInstance()->areEdgesConsecutives(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
159  return false;
160  }
161  }
162  // there is connections bewteen all edges, then return true
163  return true;
164  }
165 }
166 
167 
168 std::string
171  return "";
172  } else if (getParentEdges().size() == 0) {
173  return ("A walk need at least one edge");
174  } else {
175  // check if exist at least a connection between every edge
176  for (int i = 1; i < (int)getParentEdges().size(); i++) {
177  if (getRouteCalculatorInstance()->areEdgesConsecutives(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
178  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
179  }
180  }
181  // there is connections bewteen all edges, then all ok
182  return "";
183  }
184 }
185 
186 
187 void
189  // currently the only solution is removing Walk
190 }
191 
192 
193 GNEEdge*
195  if (getParentDemandElements().size() == 2) {
196  // obtain position and rotation of first edge route
197  return getParentDemandElements().at(1)->getFromEdge();
198  } else {
199  return getParentEdges().front();
200  }
201 }
202 
203 
204 GNEEdge*
206  if (getParentDemandElements().size() == 2) {
207  // obtain position and rotation of first edge route
208  return getParentDemandElements().at(1)->getToEdge();
209  } else {
210  return getParentEdges().back();
211  }
212 }
213 
214 
217  return getParentDemandElements().front()->getVClass();
218 }
219 
220 
221 const RGBColor&
223  return getParentDemandElements().front()->getColor();
224 }
225 
226 
227 void
229  // only start geometry moving if arrival position isn't -1
230  if (myArrivalPosition != -1) {
231  // always save original position over view
233  // save arrival position
235  // save current centering boundary
237  }
238 }
239 
240 
241 void
243  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
245  // reset myMovingGeometryBoundary
247  }
248 }
249 
250 
251 void
253  // only move if myArrivalPosition isn't -1
254  if (myArrivalPosition != -1) {
255  // Calculate new position using old position
257  newPosition.add(offset);
258  // filtern position using snap to active grid
259  newPosition = myViewNet->snapToActiveGrid(newPosition);
260  // obtain lane shape (to improve code legibility)
261  const PositionVector& laneShape = getParentEdges().back()->getLanes().front()->getLaneShape();
262  // calculate offset lane
263  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myWalkMove.originalViewPosition, false);
264  std::cout << offsetLane << std::endl;
265  // Update arrival Position
266  myArrivalPosition = parse<double>(myWalkMove.firstOriginalLanePosition) + offsetLane;
267  // Update geometry
268  updateGeometry();
269  }
270 }
271 
272 
273 void
275  // only commit geometry moving if myArrivalPosition isn't -1
276  if (myArrivalPosition != -1) {
277  undoList->p_begin("arrivalPos of " + getTagStr());
279  undoList->p_end();
280  }
281 }
282 
283 
284 void
286  // declare depart and arrival pos lane
287  double departPosLane = -1;
288  double arrivalPosLane = -1;
289  // declare start and end positions
290  Position startPos = Position::INVALID;
291  Position endPos = Position::INVALID;
292  // calculate person plan start and end lanepositions
293  calculatePersonPlanLaneStartEndPos(departPosLane, arrivalPosLane);
294  // calculate person plan start and end positions
295  calculatePersonPlanPositionStartEndPos(startPos, endPos);
296  // calculate geometry path depending if is a Walk over route
298  // use edges of route parent
300  getFirstAllowedVehicleLane(), getLastAllowedVehicleLane(), departPosLane, arrivalPosLane, startPos, endPos);
301  } else if (getPathEdges().empty()) {
303  getFirstAllowedVehicleLane(), getLastAllowedVehicleLane(), departPosLane, arrivalPosLane, startPos, endPos);
304  } else {
306  getFirstAllowedVehicleLane(), getLastAllowedVehicleLane(), departPosLane, arrivalPosLane, startPos, endPos);
307  }
308  // update child demand elementss
309  for (const auto& i : getChildDemandElements()) {
310  i->updateGeometry();
311  }
312 }
313 
314 
315 void
317  // declare depart and arrival pos lane
318  double departPosLane = -1;
319  double arrivalPosLane = -1;
320  // declare start and end positions
321  Position startPos = Position::INVALID;
322  Position endPos = Position::INVALID;
323  // calculate person plan start and end lanepositions
324  calculatePersonPlanLaneStartEndPos(departPosLane, arrivalPosLane);
325  // calculate person plan start and end positions
326  calculatePersonPlanPositionStartEndPos(startPos, endPos);
327  // udpate geometry path
328  GNEGeometry::updateGeometricPath(myDemandElementSegmentGeometry, edge, departPosLane, arrivalPosLane, startPos, endPos);
329  // update child demand elementss
330  for (const auto& i : getChildDemandElements()) {
331  i->updatePartialGeometry(edge);
332  }
333 }
334 
335 
336 void
339  // calculate route and update routeEdges
340  replacePathEdges(this, getRouteCalculatorInstance()->calculateDijkstraRoute(getParentDemandElements().at(0)->getVClass(), getParentEdges()));
341  } else if (myTagProperty.getTag() == SUMO_TAG_WALK_BUSSTOP) {
342  // declare a from-via-busStop edges vector
343  std::vector<GNEEdge*> fromViaBusStopEdges = getParentEdges();
344  // add busStop edge
345  fromViaBusStopEdges.push_back(getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
346  // calculate route and update routeEdges
347  replacePathEdges(this, getRouteCalculatorInstance()->calculateDijkstraRoute(getParentDemandElements().at(0)->getVClass(), fromViaBusStopEdges));
348  }
349  // update geometry
350  updateGeometry();
351 }
352 
353 
354 void
357  // calculate route and update routeEdges
359  } else if (myTagProperty.getTag() == SUMO_TAG_WALK_BUSSTOP) {
360  // declare a from-via-busStop edges vector
361  std::vector<GNEEdge*> fromViaBusStopEdges = getParentEdges();
362  // add busStop edge
363  fromViaBusStopEdges.push_back(getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
364  // calculate route and update routeEdges
365  replacePathEdges(this, fromViaBusStopEdges);
366  }
367  // update geometry
368  updateGeometry();
369 }
370 
371 
372 Position
374  return Position();
375 }
376 
377 
378 std::string
380  return myViewNet->getNet()->getMicrosimID();
381 }
382 
383 
384 Boundary
386  Boundary walkBoundary;
387  // return the combination of all parent edges's boundaries
388  for (const auto& i : getParentEdges()) {
389  walkBoundary.add(i->getCenteringBoundary());
390  }
391  // check if is valid
392  if (walkBoundary.isInitialised()) {
393  return walkBoundary;
394  } else {
395  return Boundary(-0.1, -0.1, 0.1, 0.1);
396  }
397 }
398 
399 
400 void
401 GNEWalk::splitEdgeGeometry(const double /*splitPosition*/, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList) {
402  // only split geometry of WalkEdges
404  (originalElement->getTagProperty().getTag() == SUMO_TAG_EDGE) &&
405  (originalElement->getTagProperty().getTag() == SUMO_TAG_EDGE)) {
406  // obtain new list of walk edges
407  std::string newWalkEdges = getNewListOfParents(originalElement, newElement);
408  // update walk edges
409  if (newWalkEdges.size() > 0) {
410  setAttribute(SUMO_ATTR_EDGES, newWalkEdges, undoList);
411  }
412  }
413 }
414 
415 
416 void
418  // Walks are drawn in GNEEdges
419 }
420 
421 
422 void
424  if (!myViewNet) {
425  throw ProcessError("ViewNet cannot be nullptr");
426  } else {
428  // add object of list into selected objects
430  if (changeFlag) {
431  mySelected = true;
432  }
433  }
434 }
435 
436 
437 void
439  if (!myViewNet) {
440  throw ProcessError("ViewNet cannot be nullptr");
441  } else {
443  // remove object of list of selected objects
445  if (changeFlag) {
446  mySelected = false;
447 
448  }
449  }
450 }
451 
452 
453 std::string
455  switch (key) {
456  case SUMO_ATTR_ID:
457  return getDemandElementID();
458  case SUMO_ATTR_FROM:
459  return getParentEdges().front()->getID();
460  case SUMO_ATTR_TO:
461  return getParentEdges().back()->getID();
462  case SUMO_ATTR_VIA:
463  return toString(getMiddleParentEdges());
464  case SUMO_ATTR_EDGES:
465  return parseIDs(getParentEdges());
466  case SUMO_ATTR_ROUTE:
467  return getParentDemandElements().at(1)->getID();
468  case SUMO_ATTR_BUS_STOP:
469  return getParentAdditionals().front()->getID();
471  if (myArrivalPosition == -1) {
472  return "";
473  } else {
474  return toString(myArrivalPosition);
475  }
476  case GNE_ATTR_SELECTED:
478  case GNE_ATTR_PARAMETERS:
479  return getParametersStr();
480  case GNE_ATTR_PARENT:
481  return getParentDemandElements().front()->getID();
482  default:
483  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
484  }
485 }
486 
487 
488 double
490  switch (key) {
492  if (myArrivalPosition != -1) {
493  return myArrivalPosition;
494  } else {
495  return (getLastAllowedVehicleLane()->getLaneShape().length() - POSITION_EPS);
496  }
497  default:
498  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
499  }
500 }
501 
502 
503 void
504 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
505  if (value == getAttribute(key)) {
506  return; //avoid needless changes, later logic relies on the fact that attributes have changed
507  }
508  switch (key) {
509  case SUMO_ATTR_FROM:
510  case SUMO_ATTR_TO:
511  case SUMO_ATTR_VIA:
512  case SUMO_ATTR_EDGES:
513  case SUMO_ATTR_ROUTE:
514  case SUMO_ATTR_BUS_STOP:
516  case GNE_ATTR_SELECTED:
517  case GNE_ATTR_PARAMETERS:
518  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
519  break;
520  default:
521  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
522  }
523 }
524 
525 
526 bool
527 GNEWalk::isValid(SumoXMLAttr key, const std::string& value) {
528  switch (key) {
529  case SUMO_ATTR_FROM:
530  case SUMO_ATTR_TO:
531  return SUMOXMLDefinitions::isValidNetID(value) && (myViewNet->getNet()->retrieveEdge(value, false) != nullptr);
532  case SUMO_ATTR_VIA:
533  if (value.empty()) {
534  return true;
535  } else {
536  return canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), value, false);
537  }
538  case SUMO_ATTR_EDGES:
539  if (canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), value, false)) {
540  // all edges exist, then check if compounds a valid route
541  return GNEDemandElement::isRouteValid(parse<std::vector<GNEEdge*> >(myViewNet->getNet(), value), false);
542  } else {
543  return false;
544  }
545  case SUMO_ATTR_BUS_STOP:
546  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
547  case SUMO_ATTR_ROUTE:
548  return (myViewNet->getNet()->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
550  if (value.empty()) {
551  return true;
552  } else if (canParse<double>(value)) {
553  const double parsedValue = canParse<double>(value);
554  if ((parsedValue < 0) || (parsedValue > getLastAllowedVehicleLane()->getLaneShape().length())) {
555  return false;
556  } else {
557  return true;
558  }
559  } else {
560  return false;
561  }
562  case GNE_ATTR_SELECTED:
563  return canParse<bool>(value);
564  case GNE_ATTR_PARAMETERS:
565  return Parameterised::areParametersValid(value);
566  default:
567  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
568  }
569 }
570 
571 
572 void
574  //
575 }
576 
577 
578 void
580  //
581 }
582 
583 
584 bool
586  return true;
587 }
588 
589 
590 std::string
592  return getTagStr();
593 }
594 
595 
596 std::string
599  return "walk: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
600  } else if (myTagProperty.getTag() == SUMO_TAG_WALK_BUSSTOP) {
601  return "walk: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().front()->getID();
602  } else {
603  return "walk: " + getParentDemandElements().at(1)->getID();
604  }
605 }
606 
607 // ===========================================================================
608 // private
609 // ===========================================================================
610 
611 void
612 GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value) {
613  switch (key) {
614  // Specific of Trips and flow
615  case SUMO_ATTR_FROM: {
616  // update first edge
618  // compute walk
619  computePath();
620  break;
621  }
622  case SUMO_ATTR_TO: {
623  // update last edge
625  // compute walk
626  computePath();
627  break;
628  }
629  case SUMO_ATTR_VIA: {
630  // update via
631  replaceMiddleParentEdges(this, parse<std::vector<GNEEdge*> >(myViewNet->getNet(), value), true);
632  // compute walk
633  computePath();
634  break;
635  }
636  case SUMO_ATTR_EDGES:
637  replaceParentEdges(this, value);
638  updateGeometry();
639  break;
640  case SUMO_ATTR_ROUTE:
641  replaceParentDemandElement(this, value, 1);
642  updateGeometry();
643  break;
644  case SUMO_ATTR_BUS_STOP:
645  replaceParentAdditional(this, value, 0);
646  // compute walk
647  computePath();
648  break;
650  if (value.empty()) {
651  myArrivalPosition = -1;
652  } else {
653  myArrivalPosition = parse<double>(value);
654  }
655  updateGeometry();
656  break;
657  case GNE_ATTR_SELECTED:
658  if (parse<bool>(value)) {
660  } else {
662  }
663  break;
664  case GNE_ATTR_PARAMETERS:
665  setParametersStr(value);
666  break;
667  default:
668  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
669  }
670 }
671 
672 
673 void
674 GNEWalk::setEnabledAttribute(const int /*enabledAttributes*/) {
675  //
676 }
677 
678 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
GNEViewParent::getSelectorFrame
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Definition: GNEViewParent.cpp:186
GNEDemandElement::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Definition: GNEDemandElement.h:376
SUMO_TAG_WALK_FROMTO
@ SUMO_TAG_WALK_FROMTO
Definition: SUMOXMLDefinitions.h:307
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEWalk::computePath
void computePath()
compute path
Definition: GNEWalk.cpp:337
GNEHierarchicalParentElements::replaceMiddleParentEdges
void replaceMiddleParentEdges(GNEDemandElement *elementChild, const std::vector< GNEEdge * > &newMiddleEdges, const bool updateChildReferences)
replace middle (via) parent edges
Definition: GNEHierarchicalParentElements.cpp:372
GNEDemandElement::getLastAllowedVehicleLane
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
Definition: GNEDemandElement.cpp:512
GNENet::retrieveAdditional
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2183
GNEAttributeCarrier::getIcon
FXIcon * getIcon() const
get FXIcon associated to this AC
Definition: GNEAttributeCarrier.cpp:1279
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
Parameterised::getParametersStr
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
Definition: Parameterised.cpp:112
GNEAdditional.h
GNEHierarchicalParentElements::replaceParentEdges
void replaceParentEdges(GNEShape *elementChild, const std::string &newEdgeIDs)
replace the parent edges of a shape
Definition: GNEHierarchicalParentElements.cpp:276
GNEGeometry::calculateEdgeGeometricPath
static void calculateEdgeGeometricPath(const GNEAttributeCarrier *AC, GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEEdge * > &edges, const SUMOVehicleClass vClass, GNELane *fromLane, GNELane *toLane, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
calculate route between edges
Definition: GNEGeometry.cpp:591
GNEHierarchicalParentElements::getPathEdges
const std::vector< GNEEdge * > & getPathEdges() const
get path edges
Definition: GNEHierarchicalParentElements.cpp:203
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:788
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
GNEHierarchicalParentElements::replaceLastParentEdge
void replaceLastParentEdge(GNEDemandElement *elementChild, GNEEdge *newLastEdge)
replace the last parent edge (used by demand elements)
Definition: GNEHierarchicalParentElements.cpp:397
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:42
GNEHierarchicalParentElements::replacePathEdges
void replacePathEdges(GNEDemandElement *elementChild, const std::vector< GNEEdge * > &routeEdges)
replace edge route Parents
Definition: GNEHierarchicalParentElements.cpp:414
GNEHierarchicalParentElements::replaceFirstParentEdge
void replaceFirstParentEdge(GNEDemandElement *elementChild, GNEEdge *newFirstEdge)
replace the first parent edge (used by demand elements)
Definition: GNEHierarchicalParentElements.cpp:356
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNEDemandElement::getRouteCalculatorInstance
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
Definition: GNEDemandElement.cpp:280
GNEDemandElement::DemandElementMove::firstOriginalLanePosition
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:67
GNEWalk::GNEWalk
GNEWalk(GNEViewNet *viewNet, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, double arrivalPosition)
parameter constructor for walkEdges
Definition: GNEWalk.cpp:43
GNEWalk::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEWalk.cpp:454
GNEHierarchicalChildElements::getChildDemandElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
Definition: GNEHierarchicalChildElements.cpp:296
GNEWalk::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEWalk.cpp:252
GNEWalk::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEWalk.cpp:274
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEHierarchicalParentElements::getParentEdges
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
Definition: GNEHierarchicalParentElements.cpp:181
GNEWalk::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEWalk.cpp:674
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:79
Position::INVALID
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:284
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:597
SUMO_TAG_WALK_ROUTE
@ SUMO_TAG_WALK_ROUTE
Definition: SUMOXMLDefinitions.h:309
GNEWalk::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:585
GNEWalk::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEWalk.cpp:401
GUIGlobalSelection.h
GNEDemandElement::getFirstAllowedVehicleLane
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
Definition: GNEDemandElement.cpp:476
GNENet::retrieveDemandElement
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2316
GNEHierarchicalParentElements::getParentLanes
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
Definition: GNEHierarchicalParentElements.cpp:235
GNEViewNet
Definition: GNEViewNet.h:42
MID_OPEN_ADDITIONAL_DIALOG
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:392
SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_ARRIVALPOS
Definition: SUMOXMLDefinitions.h:437
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
MID_COPY_NAME
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:382
GNEWalk::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEWalk.cpp:216
GNEDemandElement::DemandElementMove::originalViewPosition
Position originalViewPosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:64
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNEWalk::myWalkMove
DemandElementMove myWalkMove
variable for move walks
Definition: GNEWalk.h:237
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:196
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:523
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:154
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
GUIAppEnum.h
SUMO_ATTR_TO
@ SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:640
GNEDemandElement::myDemandElementSegmentGeometry
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
Definition: GNEDemandElement.h:382
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
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:131
GNEWalk::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:116
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNEHierarchicalParentElements::getParentAdditionals
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
Definition: GNEHierarchicalParentElements.cpp:85
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:817
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
SUMO_TAG_WALK_EDGES
@ SUMO_TAG_WALK_EDGES
Definition: SUMOXMLDefinitions.h:306
RGBColor
Definition: RGBColor.h:39
Boundary::reset
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
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:148
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:527
GNEWalk::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:91
GNEAttributeCarrier::getTagProperty
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Definition: GNEAttributeCarrier.cpp:1273
GNEHierarchicalParentElements::getParentDemandElements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
Definition: GNEHierarchicalParentElements.cpp:114
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:113
GNEWalk::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:489
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
GNEWalk::getColor
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:222
GNEWalk::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:591
GNEWalk::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEWalk.cpp:438
GNEViewNet.h
SUMO_ATTR_ROUTE
@ SUMO_ATTR_ROUTE
Definition: SUMOXMLDefinitions.h:440
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
SUMO_ATTR_EDGES
@ SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GLO_WALK
@ GLO_WALK
a walk
Definition: GUIGlObjectTypes.h:125
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
GNE_ATTR_PARAMETERS
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:989
ProcessError
Definition: UtilExceptions.h:39
GNEDemandElement::calculatePersonPlanPositionStartEndPos
void calculatePersonPlanPositionStartEndPos(Position &startPos, Position &endPos) const
calculate personPlan start and end positions
Definition: GNEDemandElement.cpp:440
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEHierarchicalParentElements::getMiddleParentEdges
std::vector< GNEEdge * > getMiddleParentEdges() const
get middle (via) parent edges
Definition: GNEHierarchicalParentElements.cpp:187
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:785
GNEWalk::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:573
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:552
GNEGeometry::updateGeometricPath
static void updateGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const GNEEdge *edge, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
calculate route between edges
Definition: GNEGeometry.cpp:719
GNEWalk::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEWalk.cpp:316
GNEWalk::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:373
GNENetElement
Definition: GNENetElement.h:43
GNEWalk::startGeometryMoving
void startGeometryMoving()
Definition: GNEWalk.cpp:228
GNEWalk::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:285
GNELane.h
GNEHierarchicalParentElements::replaceParentAdditional
void replaceParentAdditional(GNEShape *shapeTobeChanged, const std::string &newParentAdditionalID, int additionalParentIndex)
replace the parent additional of a shape
Definition: GNEHierarchicalParentElements.cpp:489
GNEAttributeCarrier::canParse
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
Definition: GNEAttributeCarrier.h:636
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:504
GNEHierarchicalParentElements::getNewListOfParents
std::string getNewListOfParents(const GNENetElement *currentElement, const GNENetElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
Definition: GNEHierarchicalParentElements.cpp:120
GNEWalk.h
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
SUMO_ATTR_FROM
@ SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
GNEAttributeCarrier::parse
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
GNEWalk::~GNEWalk
~GNEWalk()
destructor
Definition: GNEWalk.cpp:87
Parameterised::setParametersStr
void setParametersStr(const std::string &paramsString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
Definition: Parameterised.cpp:139
GNEViewParent.h
GNEWalk::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:423
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEDemandElement::calculatePersonPlanLaneStartEndPos
void calculatePersonPlanLaneStartEndPos(double &startPos, double &endPos) const
calculate personPlan start and end positions over lanes
Definition: GNEDemandElement.cpp:400
SUMO_TAG_BUS_STOP
@ SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:97
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:133
GNESelectorFrame.h
GNEWalk::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:579
GNEWalk::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNEWalk.h:240
SUMO_ATTR_VIA
@ SUMO_ATTR_VIA
Definition: SUMOXMLDefinitions.h:723
GUIMainWindow
Definition: GUIMainWindow.h:46
Parameterised::areParametersValid
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
Definition: Parameterised.cpp:166
InvalidArgument
Definition: UtilExceptions.h:56
SUMO_TAG_WALK
@ SUMO_TAG_WALK
Definition: SUMOXMLDefinitions.h:298
SUMOXMLDefinitions::isValidNetID
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Definition: SUMOXMLDefinitions.cpp:967
GNEWalk::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEWalk.cpp:205
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
GNEWalk::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:188
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:33
GNEDemandElement::getDemandElementID
const std::string & getDemandElementID() const
returns DemandElement ID
Definition: GNEDemandElement.cpp:369
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
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:266
GNEDemandElement::isRouteValid
static bool isRouteValid(const std::vector< GNEEdge * > &edges, bool report)
check if a route is valid
Definition: GNEDemandElement.cpp:334
GNEAttributeCarrier::TagProperties::hasDialog
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
Definition: GNEAttributeCarrier.cpp:846
SUMO_TAG_WALK_BUSSTOP
@ SUMO_TAG_WALK_BUSSTOP
Definition: SUMOXMLDefinitions.h:308
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1069
SUMO_TAG_ROUTE
@ SUMO_TAG_ROUTE
begin/end of the description of a route
Definition: SUMOXMLDefinitions.h:125
GNEWalk::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEWalk.cpp:242
GNEHierarchicalParentElements::replaceParentDemandElement
void replaceParentDemandElement(GNEShape *shapeTobeChanged, const std::string &newParentDemandElementID, int demandElementParentIndex)
replace the parent demand element of a shape
Definition: GNEHierarchicalParentElements.cpp:540
config.h
GNEWalk::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEWalk.cpp:355
Position::add
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:126
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:216
GNE_ATTR_SELECTED
@ GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
StringTokenizer.h
GNEWalk::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:417
GNESelectorFrame::LockGLObjectTypes::removeLockedObject
void removeLockedObject(const GUIGlObjectType type)
set object unselected
Definition: GNESelectorFrame.cpp:573
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
GNEUndoList
Definition: GNEUndoList.h:48
GNEWalk::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:385
MID_COPY_TYPED_NAME
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:384
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
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:169
SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_BUS_STOP
Definition: SUMOXMLDefinitions.h:769
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:72
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEWalk::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEWalk.cpp:194
GNEDemandElement::DemandElementMove::movingGeometryBoundary
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition: GNEDemandElement.h:61
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
GNEChange_Attribute.h
GNENet.h
GNEWalk::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:379
GUISelectedStorage::deselect
void deselect(GUIGlID id)
Deselects the object with the given id.
Definition: GUISelectedStorage.cpp:130
GNEViewNet::getViewParent
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:1008
GNESelectorFrame::getLockGLObjectTypes
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition: GNESelectorFrame.cpp:459
GNEUndoList.h
GNE_ATTR_PARENT
@ GNE_ATTR_PARENT
parent of an additional element
Definition: SUMOXMLDefinitions.h:987
GNESelectorFrame::LockGLObjectTypes::addedLockedObject
void addedLockedObject(const GUIGlObjectType type)
set object selected
Definition: GNESelectorFrame.cpp:567