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 /****************************************************************************/
15 // A class for visualizing personTrips in Netedit
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <netedit/GNENet.h>
25 #include <netedit/GNEUndoList.h>
26 #include <netedit/GNEViewNet.h>
27 #include <netedit/GNEViewParent.h>
37 
38 #include "GNEPersonTrip.h"
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
44 
45 GNEPersonTrip::GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, const std::vector<std::string>& types,
46  const std::vector<std::string>& modes, double arrivalPosition) :
47  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_PERSONTRIP_FROMTO), viewNet, GLO_PERSONTRIP, SUMO_TAG_PERSONTRIP_FROMTO,
48  edges, {}, {}, {}, {personParent}, {}, {}, {}, {}, {}),
49  Parameterised(),
50  myVTypes(types),
51  myModes(modes),
52 myArrivalPosition(arrivalPosition) {
53 }
54 
55 
56 GNEPersonTrip::GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, GNEAdditional* busStop,
57  const std::vector<std::string>& types, const std::vector<std::string>& modes) :
58  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_PERSONTRIP_BUSSTOP), viewNet, GLO_PERSONTRIP, SUMO_TAG_PERSONTRIP_BUSSTOP,
59  edges, {}, {}, {busStop}, {personParent}, {}, {}, {}, {}, {}),
61 myVTypes(types),
62 myModes(modes),
63 myArrivalPosition(-1) {
64 }
65 
66 
68 
69 
72  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
73  // build header
74  buildPopupHeader(ret, app);
75  // build menu command for center button and copy cursor position to clipboard
77  buildPositionCopyEntry(ret, false);
78  // buld menu commands for names
79  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
80  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
81  new FXMenuSeparator(ret);
82  // build selection and show parameters menu
85  // show option to open demand element dialog
86  if (myTagProperty.hasDialog()) {
87  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
88  new FXMenuSeparator(ret);
89  }
90  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
91  return ret;
92 }
93 
94 
95 void
97  // open tag
99  // only write From attribute if this is the first Person Plan
100  if (getDemandElementParents().front()->getDemandElementChildren().front() == this) {
101  device.writeAttr(SUMO_ATTR_FROM, getEdgeParents().front()->getID());
102  }
103  // check if write busStop or edge to
104  if (getAdditionalParents().size() > 0) {
106  } else {
107  device.writeAttr(SUMO_ATTR_TO, getEdgeParents().back()->getID());
108  }
109  // write modes
110  if (myModes.size() > 0) {
112  }
113  // write vTypes
114  if (myVTypes.size() > 0) {
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
128  if (getEdgeParents().size() == 0) {
129  return false;
130  } else if (getEdgeParents().size() == 1) {
131  return true;
132  } else {
133  // check if exist at least a connection between every edge
134  for (int i = 1; i < (int)getEdgeParents().size(); i++) {
135  if (getRouteCalculatorInstance()->areEdgesConsecutives(getDemandElementParents().front()->getVClass(), getEdgeParents().at((int)i - 1), getEdgeParents().at(i)) == false) {
136  return false;
137  }
138  }
139  // there is connections bewteen all edges, then return true
140  return true;
141  }
142 }
143 
144 
145 std::string
147  if (getEdgeParents().size() == 0) {
148  return ("A personTrip need at least one edge");
149  } else {
150  // check if exist at least a connection between every edge
151  for (int i = 1; i < (int)getEdgeParents().size(); i++) {
152  if (getRouteCalculatorInstance()->areEdgesConsecutives(getDemandElementParents().front()->getVClass(), getEdgeParents().at((int)i - 1), getEdgeParents().at(i)) == false) {
153  return ("Edge '" + getEdgeParents().at((int)i - 1)->getID() + "' and edge '" + getEdgeParents().at(i)->getID() + "' aren't consecutives");
154  }
155  }
156  // there is connections bewteen all edges, then all ok
157  return "";
158  }
159 }
160 
161 
162 void
164  // currently the only solution is removing PersonTrip
165 }
166 
167 
168 GNEEdge*
170  return getEdgeParents().front();
171 }
172 
173 
174 GNEEdge*
176  return getEdgeParents().back();
177 }
178 
179 
182  return getDemandElementParents().front()->getVClass();
183 }
184 
185 
186 const RGBColor&
188  return getDemandElementParents().front()->getColor();
189 }
190 
191 
192 void
194  // Nothing to compute
195 }
196 
197 
198 void
200  // only start geometry moving if arrival position isn't -1
201  if (myArrivalPosition != -1) {
202  // always save original position over view
204  // save arrival position
206  // save current centering boundary
208  }
209 }
210 
211 
212 void
214  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
216  // reset myMovingGeometryBoundary
218  }
219 }
220 
221 
222 void
224  // only move if myArrivalPosition isn't -1
225  if (myArrivalPosition != -1) {
226  // Calculate new position using old position
228  newPosition.add(offset);
229  // filtern position using snap to active grid
230  newPosition = myViewNet->snapToActiveGrid(newPosition);
231  // obtain lane shape (to improve code legibility)
232  const PositionVector& laneShape = getEdgeParents().back()->getLanes().front()->getGeometry().shape;
233  // calculate offset lane
234  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myPersonTripMove.originalViewPosition, false); // Update arrival Position
235  myArrivalPosition = parse<double>(myPersonTripMove.firstOriginalLanePosition) + offsetLane;
236  // Update geometry
237  updateGeometry();
238  }
239 }
240 
241 
242 void
244  // only commit geometry moving if myArrivalPosition isn't -1
245  if (myArrivalPosition != -1) {
246  undoList->p_begin("arrivalPos of " + getTagStr());
248  undoList->p_end();
249  }
250 }
251 
252 void
254  getDemandElementParents().front()->updateGeometry();
255  // update demand element childs
256  for (const auto& i : getDemandElementChildren()) {
257  i->updateGeometry();
258  }
259 }
260 
261 
262 Position
264  return Position();
265 }
266 
267 
268 std::string
270  return myViewNet->getNet()->getMicrosimID();
271 }
272 
273 
274 Boundary
276  Boundary personTripBoundary;
277  // return the combination of all edge parents's boundaries
278  for (const auto& i : getEdgeParents()) {
279  personTripBoundary.add(i->getCenteringBoundary());
280  }
281  // check if is valid
282  if (personTripBoundary.isInitialised()) {
283  return personTripBoundary;
284  } else {
285  return Boundary(-0.1, -0.1, 0.1, 0.1);
286  }
287 }
288 
289 
290 void
292  // PersonTrips are drawn in GNEEdges
293 }
294 
295 
296 void
298  if (!myViewNet) {
299  throw ProcessError("ViewNet cannot be nullptr");
300  } else {
302  // add object of list into selected objects
304  if (changeFlag) {
305  mySelected = true;
306  }
307  }
308 }
309 
310 
311 void
313  if (!myViewNet) {
314  throw ProcessError("ViewNet cannot be nullptr");
315  } else {
317  // remove object of list of selected objects
319  if (changeFlag) {
320  mySelected = false;
321 
322  }
323  }
324 }
325 
326 
327 std::string
329  switch (key) {
330  case SUMO_ATTR_ID:
331  return getDemandElementID();
332  case SUMO_ATTR_FROM:
333  return getEdgeParents().front()->getID();
334  case SUMO_ATTR_TO:
335  return getEdgeParents().back()->getID();
336  case SUMO_ATTR_BUS_STOP:
337  return getAdditionalParents().front()->getID();
338  case SUMO_ATTR_MODES:
339  return joinToString(myModes, " ");
340  case SUMO_ATTR_VTYPES:
341  return joinToString(myVTypes, " ");
343  return toString(myArrivalPosition);
344  case GNE_ATTR_SELECTED:
346  case GNE_ATTR_GENERIC:
347  return getGenericParametersStr();
348  case GNE_ATTR_PARENT:
349  return getDemandElementParents().front()->getID();
350  default:
351  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
352  }
353 }
354 
355 
356 double
358  switch (key) {
360  return myArrivalPosition;
361  default:
362  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
363  }
364 }
365 
366 
367 void
368 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
369  if (value == getAttribute(key)) {
370  return; //avoid needless changes, later logic relies on the fact that attributes have changed
371  }
372  switch (key) {
373  case SUMO_ATTR_FROM:
374  case SUMO_ATTR_TO:
375  case SUMO_ATTR_BUS_STOP:
376  case SUMO_ATTR_MODES:
377  case SUMO_ATTR_VTYPES:
379  case GNE_ATTR_SELECTED:
380  case GNE_ATTR_GENERIC:
381  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
382  break;
383  default:
384  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
385  }
386 }
387 
388 
389 bool
390 GNEPersonTrip::isValid(SumoXMLAttr key, const std::string& value) {
391  switch (key) {
392  case SUMO_ATTR_FROM:
393  case SUMO_ATTR_TO:
394  return SUMOXMLDefinitions::isValidNetID(value) && (myViewNet->getNet()->retrieveEdge(value, false) != nullptr);
395  case SUMO_ATTR_BUS_STOP:
396  return (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
397  case SUMO_ATTR_MODES: {
398  SVCPermissions dummyModeSet;
399  std::string dummyError;
400  return SUMOVehicleParameter::parsePersonModes(value, myTagProperty.getTagStr(), getID(), dummyModeSet, dummyError);
401  }
402  case SUMO_ATTR_VTYPES:
403  return canParse<std::vector<std::string> >(value);
405  if (canParse<double>(value)) {
406  double parsedValue = canParse<double>(value);
407  // a arrival pos with value -1 means that it will be ignored
408  if (parsedValue == -1) {
409  return true;
410  } else {
411  return parsedValue >= 0;
412  }
413  } else {
414  return false;
415  }
416  case GNE_ATTR_SELECTED:
417  return canParse<bool>(value);
418  case GNE_ATTR_GENERIC:
419  return isGenericParametersValid(value);
420  default:
421  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
422  }
423 }
424 
425 
426 void
428  //
429 }
430 
431 
432 bool
434  return true;
435 }
436 
437 
438 std::string
440  return getTagStr();
441 }
442 
443 
444 std::string
447  return "personTrip: " + getEdgeParents().front()->getID() + " -> " + getEdgeParents().back()->getID();
448  } else {
449  return "personTrip: " + getEdgeParents().front()->getID() + " -> " + getAdditionalParents().front()->getID();
450  }
451 }
452 
453 
454 
455 std::string
457  std::string result;
458  // Generate an string using the following structure: "key1=value1|key2=value2|...
459  for (auto i : getParametersMap()) {
460  result += i.first + "=" + i.second + "|";
461  }
462  // remove the last "|"
463  if (!result.empty()) {
464  result.pop_back();
465  }
466  return result;
467 }
468 
469 
470 std::vector<std::pair<std::string, std::string> >
472  std::vector<std::pair<std::string, std::string> > result;
473  // iterate over parameters map and fill result
474  for (auto i : getParametersMap()) {
475  result.push_back(std::make_pair(i.first, i.second));
476  }
477  return result;
478 }
479 
480 
481 void
482 GNEPersonTrip::setGenericParametersStr(const std::string& value) {
483  // clear parameters
484  clearParameter();
485  // separate value in a vector of string using | as separator
486  std::vector<std::string> parsedValues;
487  StringTokenizer stValues(value, "|", true);
488  while (stValues.hasNext()) {
489  parsedValues.push_back(stValues.next());
490  }
491  // check that parsed values (A=B)can be parsed in generic parameters
492  for (auto i : parsedValues) {
493  std::vector<std::string> parsedParameters;
494  StringTokenizer stParam(i, "=", true);
495  while (stParam.hasNext()) {
496  parsedParameters.push_back(stParam.next());
497  }
498  // Check that parsed parameters are exactly two and contains valid chracters
499  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
500  setParameter(parsedParameters.front(), parsedParameters.back());
501  }
502  }
503 }
504 
505 // ===========================================================================
506 // private
507 // ===========================================================================
508 
509 void
510 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value) {
511  switch (key) {
512  case SUMO_ATTR_FROM: {
513  // declare a from-via-to edges vector
514  std::vector<std::string> FromViaToEdges;
515  // add from edge
516  FromViaToEdges.push_back(value);
517  // add to edge
518  FromViaToEdges.push_back(getEdgeParents().back()->getID());
519  // calculate route
520  std::vector<GNEEdge*> route = getRouteCalculatorInstance()->calculateDijkstraRoute(myViewNet->getNet(), getDemandElementParents().at(0)->getVClass(), FromViaToEdges);
521  // change edge parents
522  changeEdgeParents(this, toString(route));
523  break;
524  }
525  case SUMO_ATTR_TO: {
526  // declare a from-via-to edges vector
527  std::vector<std::string> FromViaToEdges;
528  // add from edge
529  FromViaToEdges.push_back(getEdgeParents().front()->getID());
530  // add to edge
531  FromViaToEdges.push_back(value);
532  // calculate route
533  std::vector<GNEEdge*> route = getRouteCalculatorInstance()->calculateDijkstraRoute(myViewNet->getNet(), getDemandElementParents().at(0)->getVClass(), FromViaToEdges);
534  // change edge parents
535  changeEdgeParents(this, toString(route));
536  break;
537  }
538  case SUMO_ATTR_BUS_STOP:
539  changeAdditionalParent(this, value, 0);
540  break;
541  case SUMO_ATTR_MODES:
542  myModes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
543  break;
544  case SUMO_ATTR_VTYPES:
545  myVTypes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
546  break;
548  myArrivalPosition = parse<double>(value);
549  break;
550  case GNE_ATTR_SELECTED:
551  if (parse<bool>(value)) {
553  } else {
555  }
556  break;
557  case GNE_ATTR_GENERIC:
559  break;
560  default:
561  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
562  }
563 }
564 
565 
566 void
567 GNEPersonTrip::setEnabledAttribute(const int /*enabledAttributes*/) {
568  //
569 }
570 
571 /****************************************************************************/
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
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
GNEPersonTrip::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEPersonTrip.cpp:297
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
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:527
GNEDemandElement::DemandElementMove::firstOriginalLanePosition
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEDemandElement.h:163
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GNEPersonTrip::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPersonTrip.cpp:275
GNEPersonTrip::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPersonTrip.cpp:263
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
StringTokenizer::hasNext
bool hasNext()
returns the information whether further substrings exist
Definition: StringTokenizer.cpp:95
GLO_PERSONTRIP
a person trip
Definition: GUIGlObjectTypes.h:128
GNEPersonTrip.h
GUIGlobalSelection.h
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
SUMO_TAG_PERSONTRIP
Definition: SUMOXMLDefinitions.h:297
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:368
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
GNEPersonTrip::myPersonTripMove
DemandElementMove myPersonTripMove
variable for move person trips
Definition: GNEPersonTrip.h:224
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
GNEPersonTrip::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPersonTrip.cpp:163
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:523
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
GNEPersonTrip::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEPersonTrip.cpp:312
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GNEPersonTrip::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPersonTrip.cpp:243
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
GNEPersonTrip::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPersonTrip.cpp:223
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
SUMOVehicleParameter.h
SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:638
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEPersonTrip::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPersonTrip.cpp:567
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
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
GNEPersonTrip::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:439
GNEPersonTrip::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPersonTrip.cpp:71
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
RGBColor
Definition: RGBColor.h:40
GNEPersonTrip::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEPersonTrip.cpp:169
GNEPersonTrip::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPersonTrip.cpp:482
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
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:114
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
StringTokenizer
Definition: StringTokenizer.h:62
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:390
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:127
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNEPersonTrip::myVTypes
std::vector< std::string > myVTypes
valid line or vehicle types
Definition: GNEPersonTrip.h:227
ProcessError
Definition: UtilExceptions.h:40
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEPersonTrip::startGeometryMoving
void startGeometryMoving()
Definition: GNEPersonTrip.cpp:199
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
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
SUMO_TAG_PERSONTRIP_BUSSTOP
Definition: SUMOXMLDefinitions.h:306
GNEPersonTrip::~GNEPersonTrip
~GNEPersonTrip()
destructor
Definition: GNEPersonTrip.cpp:67
GNEPersonTrip::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:328
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
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
GNEViewParent.h
GNEPersonTrip::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPersonTrip.cpp:291
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
GNEPersonTrip::compute
void compute()
compute demand element
Definition: GNEPersonTrip.cpp:193
GNE_ATTR_GENERIC
generic attribute
Definition: SUMOXMLDefinitions.h:986
SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:98
GNEPersonTrip::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEPersonTrip.cpp:213
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
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
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
SUMO_ATTR_VTYPES
Definition: SUMOXMLDefinitions.h:630
InvalidArgument
Definition: UtilExceptions.h:57
GNEPersonTrip::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPersonTrip.cpp:96
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
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:249
SUMO_TAG_PERSONTRIP_FROMTO
Definition: SUMOXMLDefinitions.h:305
GNEPersonTrip::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEPersonTrip.cpp:456
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
GNEPersonTrip::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonTrip.cpp:427
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:247
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
GNEPersonTrip::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPersonTrip.cpp:269
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
SUMO_ATTR_MODES
Definition: SUMOXMLDefinitions.h:651
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:45
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1020
Parameterised::clearParameter
void clearParameter()
Clears the parameter map.
Definition: Parameterised.cpp:99
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
GNEPersonTrip::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:445
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
GNEPersonTrip::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:433
GNEPersonTrip::myModes
std::vector< std::string > myModes
valid line or modes
Definition: GNEPersonTrip.h:230
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
GNEPersonTrip::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPersonTrip.cpp:181
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
GNEPersonTrip::getColor
const RGBColor & getColor() const
get color
Definition: GNEPersonTrip.cpp:187
GNEHierarchicalElementParents::changeEdgeParents
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
Definition: GNEHierarchicalElementParents.cpp:340
SUMO_ATTR_BUS_STOP
Definition: SUMOXMLDefinitions.h:766
GNEPersonTrip::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEPersonTrip.cpp:175
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
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
GNEPersonTrip::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPersonTrip.cpp:253
GNEPersonTrip::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:357
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:146
GNEChange_Attribute.h
GNENet.h
GNEPersonTrip::GNEPersonTrip
GNEPersonTrip(GNEViewNet *viewNet, GNEDemandElement *personParent, const std::vector< GNEEdge * > &edges, const std::vector< std::string > &types, const std::vector< std::string > &modes, double arrivalPosition)
parameter constructor
Definition: GNEPersonTrip.cpp:45
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
GNEPersonTrip::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEPersonTrip.cpp:471
GNEPersonTrip::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNEPersonTrip.h:233
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