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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing person trips in Netedit
19 /****************************************************************************/
20 #include <config.h>
21 
24 #include <netedit/GNENet.h>
25 #include <netedit/GNEUndoList.h>
26 #include <netedit/GNEViewNet.h>
29 
30 #include "GNEPersonTrip.h"
31 #include "GNERouteHandler.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
37 
38 GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
39  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
41 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {personParent}, {}),
42 myArrivalPosition(arrivalPosition),
43 myVTypes(types),
44 myModes(modes) {
45  // compute person trip
46  computePath();
47 }
48 
49 
50 GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
51  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
53 {}, {fromEdge}, {}, {toBusStop}, {}, {}, {personParent}, {}),
54 myArrivalPosition(arrivalPosition),
55 myVTypes(types),
56 myModes(modes) {
57  // compute person trip
58  computePath();
59 }
60 
61 GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEEdge* toEdge,
62  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
64 {}, {toEdge}, {}, {fromBusStop}, {}, {}, {personParent}, {}),
65 myArrivalPosition(arrivalPosition),
66 myVTypes(types),
67 myModes(modes) {
68  // compute person trip
69  computePath();
70 }
71 
72 
73 GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEAdditional* toBusStop,
74  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
76 {}, {}, {}, {fromBusStop, toBusStop}, {}, {}, {personParent}, {}),
77 myArrivalPosition(arrivalPosition),
78 myVTypes(types),
79 myModes(modes) {
80  // compute person trip
81  computePath();
82 }
83 
84 
86 
87 
90  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
91  // build header
92  buildPopupHeader(ret, app);
93  // build menu command for center button and copy cursor position to clipboard
95  buildPositionCopyEntry(ret, false);
96  // buld menu commands for names
97  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
98  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
99  new FXMenuSeparator(ret);
100  // build selection and show parameters menu
103  // show option to open demand element dialog
104  if (myTagProperty.hasDialog()) {
105  GUIDesigns::buildFXMenuCommand(ret, "Open " + getTagStr() + " Dialog", getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
106  new FXMenuSeparator(ret);
107  }
108  GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
109  return ret;
110 }
111 
112 
113 void
115  // open tag
117  // check if we have to write "from" attributes
118  if (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr) {
119  // write "to" attributes depending of start and end
121  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
122  } else if (myTagProperty.personPlanStartBusStop()) {
123  device.writeAttr(SUMO_ATTR_FROM, getParentAdditionals().front()->getID());
124  }
125  }
126  // write "to" attributes depending of start and end
128  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
129  } else if (myTagProperty.personPlanStartBusStop()) {
131  }
132  // write modes
133  if (myModes.size() > 0) {
135  }
136  // write vTypes
137  if (myVTypes.size() > 0) {
139  }
140  // only write arrivalPos if is different of -1
141  if (myArrivalPosition != -1) {
143  }
144  // write parameters
145  writeParams(device);
146  // close tag
147  device.closeTag();
148 }
149 
150 
151 bool
153  if ((getParentEdges().size() == 2) && (getParentEdges().at(0) == getParentEdges().at(1))) {
154  // from and to are the same edges
155  return true;
156  } else if (getPath().size() > 0) {
157  // if path edges isn't empty, then there is a valid route
158  return true;
159  } else {
160  return false;
161  }
162 }
163 
164 
165 std::string
167  if (getParentEdges().size() == 0) {
168  return ("A person trip need at least one edge");
169  } else {
170  // check if exist at least a connection between every edge
171  for (int i = 1; i < (int)getParentEdges().size(); i++) {
172  if (myNet->getPathCalculator()->consecutiveEdgesConnected(getParentDemandElements().front()->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
173  return ("Edge '" + getParentEdges().at((int)i - 1)->getID() + "' and edge '" + getParentEdges().at(i)->getID() + "' aren't consecutives");
174  }
175  }
176  // there is connections bewteen all edges, then all ok
177  return "";
178  }
179 }
180 
181 
182 void
184  // currently the only solution is removing PersonTrip
185 }
186 
187 
190  return getParentDemandElements().front()->getVClass();
191 }
192 
193 
194 const RGBColor&
196  return getParentDemandElements().front()->getColor();
197 }
198 
199 
200 void
202  // only start geometry moving if arrival position isn't -1
203  if (myArrivalPosition != -1) {
204  // always save original position over view
206  // save arrival position
208  // save current centering boundary
210  }
211 }
212 
213 
214 void
216  // check that myArrivalPosition isn't -1 and endGeometryMoving was called only once
218  // reset myMovingGeometryBoundary
220  }
221 }
222 
223 
224 void
226  // only move if myArrivalPosition isn't -1
227  if (myArrivalPosition != -1) {
228  // Calculate new position using old position
230  newPosition.add(offset);
231  // filtern position using snap to active grid
232  newPosition = myNet->getViewNet()->snapToActiveGrid(newPosition);
233  // obtain lane shape (to improve code legibility)
234  const PositionVector& laneShape = getParentEdges().back()->getLanes().front()->getLaneShape();
235  // calculate offset lane
236  double offsetLane = laneShape.nearest_offset_to_point2D(newPosition, false) - laneShape.nearest_offset_to_point2D(myPersonTripMove.originalViewPosition, false);
237  // Update arrival Position
238  myArrivalPosition = parse<double>(myPersonTripMove.firstOriginalLanePosition) + offsetLane;
239  // Update geometry
240  updateGeometry();
241  }
242 }
243 
244 
245 void
247  // only commit geometry moving if myArrivalPosition isn't -1
248  if (myArrivalPosition != -1) {
249  undoList->p_begin("arrivalPos of " + getTagStr());
251  undoList->p_end();
252  }
253 }
254 
255 
256 void
258  // calculate person plan start and end positions
260  // calculate edge geometry path using path
262  // update child demand elementss
263  for (const auto& i : getChildDemandElements()) {
264  i->updateGeometry();
265  }
266 }
267 
268 
269 void
271  // update lanes depending of walk tag
276  {});
280  getParentAdditionals().back()->getParentLanes().front(),
281  {});
284  getParentAdditionals().front()->getParentLanes().front(),
286  {});
289  getParentAdditionals().front()->getParentLanes().front(),
290  getParentAdditionals().back()->getParentLanes().front(),
291  {});
292  }
293  // update geometry
294  updateGeometry();
295 }
296 
297 
298 void
300  // update lanes depending of walk tag
302  resetPathLanes(getVClass(), true,
305  {});
307  resetPathLanes(getVClass(), true,
309  getParentAdditionals().back()->getParentLanes().front(),
310  {});
312  resetPathLanes(getVClass(), true,
313  getParentAdditionals().front()->getParentLanes().front(),
315  {});
317  resetPathLanes(getVClass(), true,
318  getParentAdditionals().front()->getParentLanes().front(),
319  getParentAdditionals().back()->getParentLanes().front(),
320  {});
321  }
322  // update geometry
323  updateGeometry();
324 }
325 
326 
327 Position
329  return Position();
330 }
331 
332 
333 std::string
335  return getParentDemandElements().front()->getID();
336 }
337 
338 
339 Boundary
341  Boundary personTripBoundary;
342  // return the combination of all parent edges's boundaries
343  for (const auto& i : getParentEdges()) {
344  personTripBoundary.add(i->getCenteringBoundary());
345  }
346  // check if is valid
347  if (personTripBoundary.isInitialised()) {
348  return personTripBoundary;
349  } else {
350  return Boundary(-0.1, -0.1, 0.1, 0.1);
351  }
352 }
353 
354 
355 void
356 GNEPersonTrip::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
357  // geometry of this element cannot be splitted
358 }
359 
360 
361 void
363  // PersonTrips are drawn in drawPartialGL
364 }
365 
366 
367 void
368 GNEPersonTrip::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const {
369  // draw person plan over lane
371 }
372 
373 
374 void
375 GNEPersonTrip::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const {
376  // draw person plan over junction
377  drawPersonPlanPartialJunction(s, fromLane, toLane, offsetFront, s.widthSettings.personTrip, s.colorSettings.personTrip);
378 }
379 
380 
381 std::string
383  switch (key) {
384  // Common person plan attributes
385  case SUMO_ATTR_ID:
386  return getParentDemandElements().front()->getID();
387  case SUMO_ATTR_FROM:
388  return getParentEdges().front()->getID();
389  case SUMO_ATTR_TO:
390  return getParentEdges().back()->getID();
392  return getParentAdditionals().front()->getID();
393  case GNE_ATTR_TO_BUSSTOP:
394  return getParentAdditionals().back()->getID();
395  // specific person plan attributes
396  case SUMO_ATTR_MODES:
397  return joinToString(myModes, " ");
398  case SUMO_ATTR_VTYPES:
399  return joinToString(myVTypes, " ");
401  if (myArrivalPosition == -1) {
402  return "";
403  } else {
404  return toString(myArrivalPosition);
405  }
406  case GNE_ATTR_SELECTED:
408  case GNE_ATTR_PARAMETERS:
409  return getParametersStr();
410  case GNE_ATTR_PARENT:
411  return getParentDemandElements().front()->getID();
412  default:
413  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
414  }
415 }
416 
417 
418 double
420  switch (key) {
422  if (myArrivalPosition != -1) {
423  return myArrivalPosition;
424  } else {
425  return (getLastAllowedVehicleLane()->getLaneShape().length() - POSITION_EPS);
426  }
427  default:
428  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
429  }
430 }
431 
432 
433 void
434 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
435  if (value == getAttribute(key)) {
436  return; //avoid needless changes, later logic relies on the fact that attributes have changed
437  }
438  switch (key) {
439  // Common person plan attributes
440  case SUMO_ATTR_FROM:
441  case SUMO_ATTR_TO:
443  case GNE_ATTR_TO_BUSSTOP:
444  // specific person plan attributes
445  case SUMO_ATTR_MODES:
446  case SUMO_ATTR_VTYPES:
448  case GNE_ATTR_SELECTED:
449  case GNE_ATTR_PARAMETERS:
450  undoList->p_add(new GNEChange_Attribute(this, key, value));
451  break;
452  default:
453  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
454  }
455 }
456 
457 
458 bool
459 GNEPersonTrip::isValid(SumoXMLAttr key, const std::string& value) {
460  switch (key) {
461  // Common person plan attributes
462  case SUMO_ATTR_FROM:
463  case SUMO_ATTR_TO:
464  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrieveEdge(value, false) != nullptr);
466  case GNE_ATTR_TO_BUSSTOP:
467  return (myNet->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
468  // specific person plan attributes
469  case SUMO_ATTR_MODES: {
470  SVCPermissions dummyModeSet;
471  std::string dummyError;
472  return SUMOVehicleParameter::parsePersonModes(value, myTagProperty.getTagStr(), getID(), dummyModeSet, dummyError);
473  }
474  case SUMO_ATTR_VTYPES:
475  return canParse<std::vector<std::string> >(value);
477  if (value.empty()) {
478  return true;
479  } else if (canParse<double>(value)) {
480  const double parsedValue = canParse<double>(value);
481  if ((parsedValue < 0) || (parsedValue > getLastAllowedVehicleLane()->getLaneShape().length())) {
482  return false;
483  } else {
484  return true;
485  }
486  } else {
487  return false;
488  }
489  case GNE_ATTR_SELECTED:
490  return canParse<bool>(value);
491  case GNE_ATTR_PARAMETERS:
492  return Parameterised::areParametersValid(value);
493  default:
494  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
495  }
496 }
497 
498 
499 void
501  //
502 }
503 
504 
505 void
507  //
508 }
509 
510 
511 bool
513  return true;
514 }
515 
516 
517 std::string
519  return getTagStr();
520 }
521 
522 
523 std::string
526  return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
528  return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
530  return "personTrip: " + getParentAdditionals().front()->getID() + " -> " + getParentEdges().back()->getID();
532  return "personTrip: " + getParentAdditionals().front()->getID() + " -> " + getParentAdditionals().back()->getID();
533  } else {
534  throw ("Invalid personTrip tag");
535  }
536 }
537 
538 
539 const std::map<std::string, std::string>&
541  return getParametersMap();
542 }
543 
544 // ===========================================================================
545 // private
546 // ===========================================================================
547 
548 void
549 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value) {
550  switch (key) {
551  // Common person plan attributes
552  case SUMO_ATTR_FROM:
553  // change first edge
554  replaceFirstParentEdge(value);
555  // compute person trip
556  computePath();
557  break;
558  case SUMO_ATTR_TO:
559  // change last edge
560  replaceLastParentEdge(value);
561  // compute person trip
562  computePath();
563  break;
566  // compute person trip
567  computePath();
568  break;
569  case GNE_ATTR_TO_BUSSTOP:
570  // -> check this
571  if (getParentAdditionals().size() > 1) {
573  } else {
575  }
576  // compute person trip
577  computePath();
578  break;
579  // specific person plan attributes
580  case SUMO_ATTR_MODES:
581  myModes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
582  break;
583  case SUMO_ATTR_VTYPES:
584  myVTypes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
585  break;
587  if (value.empty()) {
588  myArrivalPosition = -1;
589  } else {
590  myArrivalPosition = parse<double>(value);
591  }
592  updateGeometry();
593  break;
594  case GNE_ATTR_SELECTED:
595  if (parse<bool>(value)) {
597  } else {
599  }
600  break;
601  case GNE_ATTR_PARAMETERS:
602  setParametersStr(value);
603  break;
604  default:
605  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
606  }
607 }
608 
609 
610 void
611 GNEPersonTrip::setEnabledAttribute(const int /*enabledAttributes*/) {
612  //
613 }
614 
615 
616 /****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:403
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:411
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:401
@ GLO_PERSONTRIP
a person trip
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ GNE_TAG_PERSONTRIP_EDGE_EDGE
@ GNE_TAG_RIDE_BUSSTOP_BUSSTOP
@ GNE_TAG_PERSONTRIP_BUSSTOP_EDGE
@ SUMO_TAG_BUS_STOP
A bus stop.
@ GNE_TAG_RIDE_BUSSTOP_EDGE
@ GNE_TAG_RIDE_EDGE_EDGE
@ GNE_TAG_PERSONTRIP_EDGE_BUSSTOP
@ GNE_TAG_RIDE_EDGE_BUSSTOP
@ GNE_TAG_PERSONTRIP_BUSSTOP_BUSSTOP
@ SUMO_TAG_PERSONTRIP
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_FROM_BUSSTOP
from busStop (used by personPlans)
@ SUMO_ATTR_BUS_STOP
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_MODES
@ SUMO_ATTR_VTYPES
@ GNE_ATTR_TO_BUSSTOP
to busStop (used by personPlans)
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_ID
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:250
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:215
void reset()
Resets the boundary.
Definition: Boundary.cpp:65
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
FXIcon * getIcon() const
get FXIcon associated to this AC
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
An Element which don't belongs to GNENet but has influency in the simulation.
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry (also called "stacked geometry")
void drawPersonPlanPartialLane(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
GNEGeometry::ExtremeGeometry calculatePersonPlanLaneStartEndPos() const
calculate extreme geometry
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
void drawPersonPlanPartialJunction(const GUIVisualizationSettings &s, const GNELane *fromLane, const GNELane *toLane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial junction
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
bool consecutiveEdgesConnected(const SUMOVehicleClass vClass, const GNEEdge *from, const GNEEdge *to) const
check if exist a path between the two given consecutives edges for the given VClass
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
Definition: GNENet.cpp:1141
GNENetHelper::PathCalculator * getPathCalculator()
obtain instance of PathCalculator
Definition: GNENet.cpp:136
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2316
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
void calculatePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
calculate path lanes (Dijkstra)
const std::vector< GNEPathElements::PathElement > & getPath() const
get path edges
void resetPathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
reset path lanes
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void computePath()
compute path
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
double myArrivalPosition
arrival position
void endGeometryMoving()
end geometry movement
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Position getPositionInView() const
Returns position of additional in view.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
bool isAttributeEnabled(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
std::vector< std::string > myModes
valid line or modes
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
DemandElementMove myPersonTripMove
variable for move person trips
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void startGeometryMoving()
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
const RGBColor & getColor() const
get color
void invalidatePath()
invalidate path
std::vector< std::string > myVTypes
valid line or vehicle types
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
std::string getParentName() const
Returns the name of the parent object.
double getAttributeDouble(SumoXMLAttr key) const
~GNEPersonTrip()
destructor
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
SUMOVehicleClass getVClass() const
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNEPersonTrip(GNENet *net, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, double arrivalPosition, const std::vector< std::string > &types, const std::vector< std::string > &modes)
parameter constructor for person edge->edge
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
bool personPlanStartEdge() const
return true if tag correspond to a person plan that starts in an edge
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool personPlanStartBusStop() const
return true if tag correspond to a person plan that starts in a busStop
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
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:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
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.
Stores the information about how to visualize structures.
GUIVisualizationWidthSettings widthSettings
width settings
GUIVisualizationColorSettings colorSettings
color settings
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:124
A list of positions.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
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.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Position originalViewPosition
value for saving first original position over lane before moving
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
struct for variables used in Geometry extremes
Definition: GNEGeometry.h:58
static void calculateLaneGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEPathElements::PathElement > &path, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between lanes
static const RGBColor personTrip
color for personStops
static const double personTrip
width for person trips