Eclipse SUMO - Simulation of Urban MObility
GNEPersonTrip.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 person trips 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>
36 
37 #include "GNEPersonTrip.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
43 
44 GNEPersonTrip::GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, const std::vector<GNEEdge*>& via,
45  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
46  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_PERSONTRIP_FROMTO), viewNet, GLO_PERSONTRIP, SUMO_TAG_PERSONTRIP_FROMTO, {
47  fromEdge, toEdge
48 }, {}, {}, {}, {personParent}, {}, {}, {}, {}, {}),
50 myArrivalPosition(arrivalPosition),
51 myVTypes(types),
52 myModes(modes) {
53  // set via parameter without updating references
54  replaceMiddleParentEdges(this, via, false);
55  // compute person trip
56  computePath();
57 }
58 
59 
60 GNEPersonTrip::GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* busStop, const std::vector<GNEEdge*>& via,
61  const std::vector<std::string>& types, const std::vector<std::string>& modes) :
62  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_PERSONTRIP_BUSSTOP), viewNet, GLO_PERSONTRIP, SUMO_TAG_PERSONTRIP_BUSSTOP, {
63  fromEdge
64 }, {}, {}, {busStop}, {personParent}, {}, {}, {}, {}, {}),
66 myArrivalPosition(-1),
67 myVTypes(types),
68 myModes(modes) {
69  // set via parameter without updating references
70  replaceMiddleParentEdges(this, via, false);
71  // compute person trip
72  computePath();
73 }
74 
75 
77 
78 
81  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
82  // build header
83  buildPopupHeader(ret, app);
84  // build menu command for center button and copy cursor position to clipboard
86  buildPositionCopyEntry(ret, false);
87  // buld menu commands for names
88  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
89  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
90  new FXMenuSeparator(ret);
91  // build selection and show parameters menu
94  // show option to open demand element dialog
95  if (myTagProperty.hasDialog()) {
96  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
97  new FXMenuSeparator(ret);
98  }
99  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
100  return ret;
101 }
102 
103 
104 void
106  // open tag
108  // only write From attribute if this is the first Person Plan
109  if (getParentDemandElements().front()->getChildDemandElements().front() == this) {
110  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
111  }
112  // check if write busStop or edge to
113  if (getParentAdditionals().size() > 0) {
115  } else {
116  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
117  }
118  // write modes
119  if (myModes.size() > 0) {
121  }
122  // write vTypes
123  if (myVTypes.size() > 0) {
125  }
126  // only write arrivalPos if is different of -1
127  if (myArrivalPosition != -1) {
129  }
130  // write parameters
131  writeParams(device);
132  // close tag
133  device.closeTag();
134 }
135 
136 
137 bool
139  if (getParentEdges().size() == 0) {
140  return false;
141  } else if (getParentEdges().size() == 1) {
142  return true;
143  } else {
144  // check if exist at least a connection between every edge
145  for (int i = 1; i < (int)getParentEdges().size(); i++) {
146  if (getRouteCalculatorInstance()->areEdgesConsecutives(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
147  return false;
148  }
149  }
150  // there is connections bewteen all edges, then return true
151  return true;
152  }
153 }
154 
155 
156 std::string
158  if (getParentEdges().size() == 0) {
159  return ("A person trip need at least one edge");
160  } else {
161  // check if exist at least a connection between every edge
162  for (int i = 1; i < (int)getParentEdges().size(); i++) {
163  if (getRouteCalculatorInstance()->areEdgesConsecutives(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
164  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
165  }
166  }
167  // there is connections bewteen all edges, then all ok
168  return "";
169  }
170 }
171 
172 
173 void
175  // currently the only solution is removing PersonTrip
176 }
177 
178 
179 GNEEdge*
181  if (getParentDemandElements().size() == 2) {
182  // obtain position and rotation of first edge route
183  return getParentDemandElements().at(1)->getFromEdge();
184  } else {
185  return getParentEdges().front();
186  }
187 }
188 
189 
190 GNEEdge*
192  if (getParentDemandElements().size() == 2) {
193  // obtain position and rotation of first edge route
194  return getParentDemandElements().at(1)->getToEdge();
195  } else {
196  return getParentEdges().back();
197  }
198 }
199 
200 
203  return getParentDemandElements().front()->getVClass();
204 }
205 
206 
207 const RGBColor&
209  return getParentDemandElements().front()->getColor();
210 }
211 
212 
213 void
215  // only start geometry moving if arrival position isn't -1
216  if (myArrivalPosition != -1) {
217  // always save original position over view
219  // save arrival position
221  // save current centering boundary
223  }
224 }
225 
226 
227 void
229  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
231  // reset myMovingGeometryBoundary
233  }
234 }
235 
236 
237 void
239  // only move if myArrivalPosition isn't -1
240  if (myArrivalPosition != -1) {
241  // Calculate new position using old position
243  newPosition.add(offset);
244  // filtern position using snap to active grid
245  newPosition = myViewNet->snapToActiveGrid(newPosition);
246  // obtain lane shape (to improve code legibility)
247  const PositionVector& laneShape = getParentEdges().back()->getLanes().front()->getLaneShape();
248  // calculate offset lane
249  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myPersonTripMove.originalViewPosition, false);
250  std::cout << offsetLane << std::endl;
251  // Update arrival Position
252  myArrivalPosition = parse<double>(myPersonTripMove.firstOriginalLanePosition) + offsetLane;
253  // Update geometry
254  updateGeometry();
255  }
256 }
257 
258 
259 void
261  // only commit geometry moving if myArrivalPosition isn't -1
262  if (myArrivalPosition != -1) {
263  undoList->p_begin("arrivalPos of " + getTagStr());
265  undoList->p_end();
266  }
267 }
268 
269 
270 void
272  // declare depart and arrival pos lane
273  double departPosLane = -1;
274  double arrivalPosLane = -1;
275  // declare start and end positions
276  Position startPos = Position::INVALID;
277  Position endPos = Position::INVALID;
278  // calculate person plan start and end lanepositions
279  calculatePersonPlanLaneStartEndPos(departPosLane, arrivalPosLane);
280  // calculate person plan start and end positions
281  calculatePersonPlanPositionStartEndPos(startPos, endPos);
282  // calculate geometry path
283  if (getPathEdges().size() > 0) {
285  getFirstAllowedVehicleLane(), getLastAllowedVehicleLane(), departPosLane, arrivalPosLane, startPos, endPos);
286  } else {
288  getFirstAllowedVehicleLane(), getLastAllowedVehicleLane(), departPosLane, arrivalPosLane, startPos, endPos);
289  }
290  // update child demand elementss
291  for (const auto& i : getChildDemandElements()) {
292  i->updateGeometry();
293  }
294 }
295 
296 
297 void
299  // declare depart and arrival pos lane
300  double departPosLane = -1;
301  double arrivalPosLane = -1;
302  // declare start and end positions
303  Position startPos = Position::INVALID;
304  Position endPos = Position::INVALID;
305  // calculate person plan start and end lanepositions
306  calculatePersonPlanLaneStartEndPos(departPosLane, arrivalPosLane);
307  // calculate person plan start and end positions
308  calculatePersonPlanPositionStartEndPos(startPos, endPos);
309  // calculate geometry path
310  GNEGeometry::updateGeometricPath(myDemandElementSegmentGeometry, edge, departPosLane, arrivalPosLane, startPos, endPos);
311  // update child demand elementss
312  for (const auto& i : getChildDemandElements()) {
313  i->updatePartialGeometry(edge);
314  }
315 }
316 
317 
318 void
321  // calculate route and update routeEdges
322  replacePathEdges(this, getRouteCalculatorInstance()->calculateDijkstraRoute(getParentDemandElements().at(0)->getVClass(), getParentEdges()));
324  // declare a from-via-busStop edges vector
325  std::vector<GNEEdge*> fromViaBusStopEdges = getParentEdges();
326  // add busStop edge
327  fromViaBusStopEdges.push_back(getParentAdditionals().front()->getParentLanes().front()->getParentEdge());
328  // calculate route and update routeEdges
329  replacePathEdges(this, getRouteCalculatorInstance()->calculateDijkstraRoute(getParentDemandElements().at(0)->getVClass(), fromViaBusStopEdges));
330  }
331  // update geometry
332  updateGeometry();
333 }
334 
335 
336 void
339  // calculate route and update routeEdges
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, fromViaBusStopEdges);
348  }
349  // update geometry
350  updateGeometry();
351 }
352 
353 
354 Position
356  return Position();
357 }
358 
359 
360 std::string
362  return myViewNet->getNet()->getMicrosimID();
363 }
364 
365 
366 Boundary
368  Boundary personTripBoundary;
369  // return the combination of all parent edges's boundaries
370  for (const auto& i : getParentEdges()) {
371  personTripBoundary.add(i->getCenteringBoundary());
372  }
373  // check if is valid
374  if (personTripBoundary.isInitialised()) {
375  return personTripBoundary;
376  } else {
377  return Boundary(-0.1, -0.1, 0.1, 0.1);
378  }
379 }
380 
381 
382 void
383 GNEPersonTrip::splitEdgeGeometry(const double /*splitPosition*/, const GNENetElement* /*originalElement*/, const GNENetElement* /*newElement*/, GNEUndoList* /*undoList*/) {
384  // geometry of this element cannot be splitted
385 }
386 
387 
388 void
390  // PersonTrips are drawn in GNEEdges
391 }
392 
393 
394 void
396  if (!myViewNet) {
397  throw ProcessError("ViewNet cannot be nullptr");
398  } else {
400  // add object of list into selected objects
402  if (changeFlag) {
403  mySelected = true;
404  }
405  }
406 }
407 
408 
409 void
411  if (!myViewNet) {
412  throw ProcessError("ViewNet cannot be nullptr");
413  } else {
415  // remove object of list of selected objects
417  if (changeFlag) {
418  mySelected = false;
419 
420  }
421  }
422 }
423 
424 
425 std::string
427  switch (key) {
428  case SUMO_ATTR_ID:
429  return getDemandElementID();
430  case SUMO_ATTR_FROM:
431  return getParentEdges().front()->getID();
432  case SUMO_ATTR_TO:
433  return getParentEdges().back()->getID();
434  case SUMO_ATTR_VIA:
435  return toString(getMiddleParentEdges());
436  case SUMO_ATTR_BUS_STOP:
437  return getParentAdditionals().front()->getID();
438  case SUMO_ATTR_MODES:
439  return joinToString(myModes, " ");
440  case SUMO_ATTR_VTYPES:
441  return joinToString(myVTypes, " ");
443  if (myArrivalPosition == -1) {
444  return "";
445  } else {
446  return toString(myArrivalPosition);
447  }
448  case GNE_ATTR_SELECTED:
450  case GNE_ATTR_PARAMETERS:
451  return getParametersStr();
452  case GNE_ATTR_PARENT:
453  return getParentDemandElements().front()->getID();
454  default:
455  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
456  }
457 }
458 
459 
460 double
462  switch (key) {
464  if (myArrivalPosition != -1) {
465  return myArrivalPosition;
466  } else {
467  return (getLastAllowedVehicleLane()->getLaneShape().length() - POSITION_EPS);
468  }
469  default:
470  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
471  }
472 }
473 
474 
475 void
476 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
477  if (value == getAttribute(key)) {
478  return; //avoid needless changes, later logic relies on the fact that attributes have changed
479  }
480  switch (key) {
481  case SUMO_ATTR_FROM:
482  case SUMO_ATTR_TO:
483  case SUMO_ATTR_VIA:
484  case SUMO_ATTR_BUS_STOP:
485  case SUMO_ATTR_MODES:
486  case SUMO_ATTR_VTYPES:
488  case GNE_ATTR_SELECTED:
489  case GNE_ATTR_PARAMETERS:
490  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
491  break;
492  default:
493  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
494  }
495 }
496 
497 
498 bool
499 GNEPersonTrip::isValid(SumoXMLAttr key, const std::string& value) {
500  switch (key) {
501  case SUMO_ATTR_FROM:
502  case SUMO_ATTR_TO:
503  return SUMOXMLDefinitions::isValidNetID(value) && (myViewNet->getNet()->retrieveEdge(value, false) != nullptr);
504  case SUMO_ATTR_VIA:
505  if (value.empty()) {
506  return true;
507  } else {
508  return canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), value, false);
509  }
510  case SUMO_ATTR_BUS_STOP:
511  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
512  case SUMO_ATTR_MODES: {
513  SVCPermissions dummyModeSet;
514  std::string dummyError;
515  return SUMOVehicleParameter::parsePersonModes(value, myTagProperty.getTagStr(), getID(), dummyModeSet, dummyError);
516  }
517  case SUMO_ATTR_VTYPES:
518  return canParse<std::vector<std::string> >(value);
520  if (value.empty()) {
521  return true;
522  } else if (canParse<double>(value)) {
523  const double parsedValue = canParse<double>(value);
524  if ((parsedValue < 0) || (parsedValue > getLastAllowedVehicleLane()->getLaneShape().length())) {
525  return false;
526  } else {
527  return true;
528  }
529  } else {
530  return false;
531  }
532  case GNE_ATTR_SELECTED:
533  return canParse<bool>(value);
534  case GNE_ATTR_PARAMETERS:
535  return Parameterised::areParametersValid(value);
536  default:
537  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
538  }
539 }
540 
541 
542 void
544  //
545 }
546 
547 
548 void
550  //
551 }
552 
553 
554 bool
556  return true;
557 }
558 
559 
560 std::string
562  return getTagStr();
563 }
564 
565 
566 std::string
569  return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
570  } else {
571  return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().front()->getID();
572  }
573 }
574 
575 // ===========================================================================
576 // private
577 // ===========================================================================
578 
579 void
580 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value) {
581  switch (key) {
582  // Specific of Trips and flow
583  case SUMO_ATTR_FROM: {
584  // change first edge
586  // compute person trip
587  computePath();
588  break;
589  }
590  case SUMO_ATTR_TO: {
591  // change last edge
593  // compute person trip
594  computePath();
595  break;
596  }
597  case SUMO_ATTR_VIA: {
598  // update via
599  replaceMiddleParentEdges(this, parse<std::vector<GNEEdge*> >(myViewNet->getNet(), value), true);
600  // compute person trip
601  computePath();
602  break;
603  }
604  case SUMO_ATTR_BUS_STOP:
605  replaceParentAdditional(this, value, 0);
606  // compute person trip
607  computePath();
608  break;
609  case SUMO_ATTR_MODES:
610  myModes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
611  break;
612  case SUMO_ATTR_VTYPES:
613  myVTypes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
614  break;
616  if (value.empty()) {
617  myArrivalPosition = -1;
618  } else {
619  myArrivalPosition = parse<double>(value);
620  }
621  updateGeometry();
622  break;
623  case GNE_ATTR_SELECTED:
624  if (parse<bool>(value)) {
626  } else {
628  }
629  break;
630  case GNE_ATTR_PARAMETERS:
631  setParametersStr(value);
632  break;
633  default:
634  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
635  }
636 }
637 
638 
639 void
640 GNEPersonTrip::setEnabledAttribute(const int /*enabledAttributes*/) {
641  //
642 }
643 
644 
645 /****************************************************************************/
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
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
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
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
GNEPersonTrip::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEPersonTrip.cpp:395
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
GNEAttributeCarrier::TagProperties::getTagStr
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
Definition: GNEAttributeCarrier.cpp:529
GNEDemandElement::DemandElementMove::firstOriginalLanePosition
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:67
GNEHierarchicalChildElements::getChildDemandElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
Definition: GNEHierarchicalChildElements.cpp:296
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEPersonTrip::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPersonTrip.cpp:367
GNEHierarchicalParentElements::getParentEdges
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
Definition: GNEHierarchicalParentElements.cpp:181
GNEPersonTrip::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPersonTrip.cpp:355
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
GLO_PERSONTRIP
a person trip
Definition: GUIGlObjectTypes.h:127
GNEPersonTrip.h
GUIGlobalSelection.h
GNEDemandElement::getFirstAllowedVehicleLane
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
Definition: GNEDemandElement.cpp:476
SUMO_TAG_PERSONTRIP
Definition: SUMOXMLDefinitions.h:296
GNEPersonTrip::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: GNEPersonTrip.cpp:476
GNEHierarchicalParentElements::getParentLanes
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
Definition: GNEHierarchicalParentElements.cpp:235
GNEViewNet
Definition: GNEViewNet.h:42
GNEPersonTrip::myPersonTripMove
DemandElementMove myPersonTripMove
variable for move person trips
Definition: GNEPersonTrip.h:226
MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:392
SUMO_ATTR_ARRIVALPOS
Definition: SUMOXMLDefinitions.h:437
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:382
GNEPersonTrip::GNEPersonTrip
GNEPersonTrip(GNEViewNet *viewNet, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, const std::vector< GNEEdge * > &via, double arrivalPosition, const std::vector< std::string > &types, const std::vector< std::string > &modes)
parameter constructor for person tripEdges
Definition: GNEPersonTrip.cpp:44
GNEPersonTrip::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPersonTrip.cpp:174
SUMOVehicleParameter::parsePersonModes
static bool parsePersonModes(const std::string &modes, const std::string &element, const std::string &id, SVCPermissions &modeSet, std::string &error)
Validates a given person modes value.
Definition: SUMOVehicleParameter.cpp:550
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
GNEPersonTrip::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEPersonTrip.cpp:410
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNEPersonTrip::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPersonTrip.cpp:260
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
GNEPersonTrip::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPersonTrip.cpp:238
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
SUMOVehicleParameter.h
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
GNEPersonTrip::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPersonTrip.cpp:640
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
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
GNEPersonTrip::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:561
GNEPersonTrip::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPersonTrip.cpp:80
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
RGBColor
Definition: RGBColor.h:39
GNEPersonTrip::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEPersonTrip.cpp:180
Boundary::reset
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
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
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
GNEPersonTrip::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPersonTrip.cpp:499
GNEViewNet.h
GNEPersonTrip::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPersonTrip.cpp:138
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:989
GNEPersonTrip::myVTypes
std::vector< std::string > myVTypes
valid line or vehicle types
Definition: GNEPersonTrip.h:232
GNEPersonTrip::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEPersonTrip.cpp:298
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
GNEPersonTrip::startGeometryMoving
void startGeometryMoving()
Definition: GNEPersonTrip.cpp:214
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
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
GNEPersonTrip::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPersonTrip.cpp:383
SUMO_TAG_PERSONTRIP_BUSSTOP
Definition: SUMOXMLDefinitions.h:305
GNENetElement
Definition: GNENetElement.h:43
GNEPersonTrip::~GNEPersonTrip
~GNEPersonTrip()
destructor
Definition: GNEPersonTrip.cpp:76
GNEPersonTrip::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:426
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
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
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....
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
GNEPersonTrip::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPersonTrip.cpp:389
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
A bus stop.
Definition: SUMOXMLDefinitions.h:97
GNEPersonTrip::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEPersonTrip.cpp:228
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
SUMO_ATTR_VIA
Definition: SUMOXMLDefinitions.h:723
GUIMainWindow
Definition: GUIMainWindow.h:46
GNEPersonTrip::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEPersonTrip.cpp:337
GNEPersonTrip::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonTrip.cpp:549
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
SUMO_ATTR_VTYPES
Definition: SUMOXMLDefinitions.h:632
InvalidArgument
Definition: UtilExceptions.h:56
GNEPersonTrip::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPersonTrip.cpp:105
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
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
SUMO_TAG_PERSONTRIP_FROMTO
Definition: SUMOXMLDefinitions.h:304
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
GNEPersonTrip::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonTrip.cpp:543
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:246
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
GNEPersonTrip::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPersonTrip.cpp:361
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_ATTR_MODES
Definition: SUMOXMLDefinitions.h:653
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1069
GNEPersonTrip::computePath
void computePath()
compute path
Definition: GNEPersonTrip.cpp:319
config.h
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
GNEPersonTrip::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:567
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
StringTokenizer.h
GNEPersonTrip::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:555
GNEPersonTrip::myModes
std::vector< std::string > myModes
valid line or modes
Definition: GNEPersonTrip.h:235
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
GNEPersonTrip::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPersonTrip.cpp:202
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
GNEPersonTrip::getColor
const RGBColor & getColor() const
get color
Definition: GNEPersonTrip.cpp:208
SUMO_ATTR_BUS_STOP
Definition: SUMOXMLDefinitions.h:769
GNEPersonTrip::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEPersonTrip.cpp:191
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
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
GNEPersonTrip::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPersonTrip.cpp:271
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
GNEPersonTrip::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:461
GNEPersonTrip::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPersonTrip.cpp:157
GNEChange_Attribute.h
GNENet.h
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
GNEPersonTrip::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNEPersonTrip.h:229
GNEUndoList.h
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