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-2022 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 
39  GNEDemandElement("", net, GLO_PERSONTRIP, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
40 {}, {}, {}, {}, {}, {}, {}, {}),
41 myArrivalPosition(0) {
42  // reset default values
44 }
45 
46 
47 GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
48  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
49  GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_EDGE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
50 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {personParent}, {}),
51 myArrivalPosition(arrivalPosition),
52 myVTypes(types),
53 myModes(modes) {
54 }
55 
56 
57 GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
58  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
59  GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_BUSSTOP, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
60 {}, {fromEdge}, {}, {toBusStop}, {}, {}, {personParent}, {}),
61 myArrivalPosition(arrivalPosition),
62 myVTypes(types),
63 myModes(modes) {
64 }
65 
66 
67 GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction,
68  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes) :
69  GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_JUNCTIONS, GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {
70  fromJunction, toJunction
71 }, {}, {}, {}, {}, {}, {personParent}, {}),
72 myArrivalPosition(arrivalPosition),
73 myVTypes(types),
74 myModes(modes) {
75 }
76 
77 
79 
80 
83  // avoid move person plan that ends in busStop
84  if ((getParentAdditionals().size() > 0) || (getParentJunctions().size() > 0)) {
85  return nullptr;
86  }
87  // get geometry end pos
88  const Position geometryEndPos = getPathElementArrivalPos();
89  // calculate circle width squared
91  // check if we clicked over a geometry end pos
92  if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= circleWidthSquared + 2) {
93  return new GNEMoveOperation(this, getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
94  } else {
95  return nullptr;
96  }
97 }
98 
99 
102  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
103  // build header
104  buildPopupHeader(ret, app);
105  // build menu command for center button and copy cursor position to clipboard
107  buildPositionCopyEntry(ret, false);
108  // buld menu commands for names
109  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
110  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
111  new FXMenuSeparator(ret);
112  // build selection and show parameters menu
115  // show option to open demand element dialog
116  if (myTagProperty.hasDialog()) {
117  GUIDesigns::buildFXMenuCommand(ret, "Open " + getTagStr() + " Dialog", getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
118  new FXMenuSeparator(ret);
119  }
120  GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
121  return ret;
122 }
123 
124 
125 void
127  // open tag
129  // check if from attribute is enabled
131  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
134  }
135  // write to depending if personplan ends in a busStop, edge or junction
136  if (getParentAdditionals().size() > 0) {
138  } else if (getParentEdges().size() > 0) {
139  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
140  } else {
142  }
143  // avoid writte arrival positions in person trip to busStop
145  // only write arrivalPos if is different of -1
146  if (myArrivalPosition != -1) {
148  }
149  }
150  // write modes
151  if (myModes.size() > 0) {
153  }
154  // write vTypes
155  if (myVTypes.size() > 0) {
157  }
158  // write parameters
159  writeParams(device);
160  // close tag
161  device.closeTag();
162 }
163 
164 
167  return isPersonPlanValid();
168 }
169 
170 
171 std::string
173  return getPersonPlanProblem();
174 }
175 
176 
177 void
179  // currently the only solution is removing PersonTrip
180 }
181 
182 
185  return getParentDemandElements().front()->getVClass();
186 }
187 
188 
189 const RGBColor&
191  return getParentDemandElements().front()->getColor();
192 }
193 
194 
195 void
197  // update child demand elementss
198  for (const auto& i : getChildDemandElements()) {
199  i->updateGeometry();
200  }
201 }
202 
203 
204 Position
206  return getParentEdges().front()->getPositionInView();
207 }
208 
209 
210 std::string
212  return getParentDemandElements().front()->getID();
213 }
214 
215 
216 double
218  return 1;
219 }
220 
221 
222 Boundary
224  Boundary personTripBoundary;
225  // return the combination of all parent edges's boundaries
226  for (const auto& i : getParentEdges()) {
227  personTripBoundary.add(i->getCenteringBoundary());
228  }
229  // check if is valid
230  if (personTripBoundary.isInitialised()) {
231  return personTripBoundary;
232  } else {
233  return Boundary(-0.1, -0.1, 0.1, 0.1);
234  }
235 }
236 
237 
238 void
239 GNEPersonTrip::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
240  // geometry of this element cannot be splitted
241 }
242 
243 
244 void
246  // force draw path
247  myNet->getPathManager()->forceDrawPath(s, this);
248  // special case for junction walks
249  if (getParentJunctions().size() > 0) {
250  // get person parent
251  const GNEDemandElement* personParent = getParentDemandElements().front();
252  if ((personParent->getChildDemandElements().size() > 0) && (personParent->getChildDemandElements().front() == this)) {
253  personParent->drawGL(s);
254  }
255  }
256 }
257 
258 
259 void
261  // avoid calculate for junctions
262  if (getParentJunctions().empty()) {
263  // calculate path
265  }
266  // update geometry
267  updateGeometry();
268 }
269 
270 
271 void
272 GNEPersonTrip::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
273  // draw person plan over lane
275 }
276 
277 
278 void
279 GNEPersonTrip::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
280  // draw person plan over junction
281  drawPersonPlanPartial(drawPersonPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.personTripWidth, s.colorSettings.personTripColor);
282 }
283 
284 
285 GNELane*
287  if (getParentJunctions().size() > 0) {
288  throw ProcessError("This personTrip use junctions");
289  } else {
290  return getParentEdges().front()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
291  }
292 }
293 
294 
295 GNELane*
297  // check if personPlan ends in a BusStop or junction
298  if (getParentJunctions().size() > 0) {
299  throw ProcessError("This personTrip use junctions");
300  } else if (getParentAdditionals().size() > 0) {
301  return getParentAdditionals().front()->getParentLanes().front();
302  } else {
303  return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
304  }
305 }
306 
307 
308 std::string
310  switch (key) {
311  // Common person plan attributes
312  case SUMO_ATTR_ID:
313  return getParentDemandElements().front()->getID();
314  case SUMO_ATTR_FROM:
315  return getParentEdges().front()->getID();
316  case SUMO_ATTR_TO:
317  return getParentEdges().back()->getID();
318  case GNE_ATTR_TO_BUSSTOP:
319  return getParentAdditionals().back()->getID();
321  return getParentJunctions().front()->getID();
323  return getParentJunctions().back()->getID();
324  // specific person plan attributes
325  case SUMO_ATTR_MODES:
326  return joinToString(myModes, " ");
327  case SUMO_ATTR_VTYPES:
328  return joinToString(myVTypes, " ");
331  return getParentAdditionals().front()->getAttribute(SUMO_ATTR_ENDPOS);
332  } else if (myArrivalPosition == -1) {
333  return "";
334  } else {
335  return toString(myArrivalPosition);
336  }
337  case GNE_ATTR_SELECTED:
339  case GNE_ATTR_PARAMETERS:
340  return getParametersStr();
341  case GNE_ATTR_PARENT:
342  return getParentDemandElements().front()->getID();
343  default:
344  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
345  }
346 }
347 
348 
349 double
351  switch (key) {
353  if (getParentJunctions().size() > 0) {
354  return 0;
355  } else if (myArrivalPosition != -1) {
356  return myArrivalPosition;
357  } else {
358  return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
359  }
360  default:
361  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
362  }
363 }
364 
365 
366 Position
368  switch (key) {
369  case SUMO_ATTR_ARRIVALPOS: {
370  if (getParentJunctions().size() > 0) {
371  return getParentJunctions().back()->getPositionInView();
372  } else {
373  // get lane shape
374  const PositionVector& laneShape = getLastPathLane()->getLaneShape();
375  // continue depending of arrival position
376  if (myArrivalPosition == 0) {
377  return laneShape.front();
378  } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
379  return laneShape.back();
380  } else {
381  return laneShape.positionAtOffset2D(myArrivalPosition);
382  }
383  }
384  }
385  default:
386  throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
387  }
388 }
389 
390 
391 void
392 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
393  switch (key) {
394  // Common person plan attributes
395  case SUMO_ATTR_FROM:
398  case SUMO_ATTR_MODES:
399  case SUMO_ATTR_VTYPES:
400  case GNE_ATTR_SELECTED:
401  case GNE_ATTR_PARAMETERS:
402  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
403  break;
404  // special case for "to" attributes
405  case SUMO_ATTR_TO:
406  case SUMO_ATTR_TOJUNCTION: {
407  // get next personPlan
408  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
409  // continue depending of nextPersonPlan
410  if (nextPersonPlan) {
411  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
412  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
413  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
414  undoList->end();
415  } else {
416  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
417  }
418  break;
419  }
420  case GNE_ATTR_TO_BUSSTOP: {
421  // get next person plan
422  GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
423  // continue depending of nextPersonPlan
424  if (nextPersonPlan) {
425  // obtain busStop
427  // change from attribute using edge ID
428  undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
429  nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
430  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
431  undoList->end();
432  } else {
433  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
434  }
435  break;
436  }
437  default:
438  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
439  }
440 }
441 
442 
443 bool
444 GNEPersonTrip::isValid(SumoXMLAttr key, const std::string& value) {
445  switch (key) {
446  // Common person plan attributes
447  case SUMO_ATTR_FROM:
448  case SUMO_ATTR_TO:
449  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
452  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveJunction(value, false) != nullptr);
453  case GNE_ATTR_TO_BUSSTOP:
454  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
455  // specific person plan attributes
456  case SUMO_ATTR_MODES: {
457  SVCPermissions dummyModeSet;
458  std::string dummyError;
459  return SUMOVehicleParameter::parsePersonModes(value, myTagProperty.getTagStr(), getID(), dummyModeSet, dummyError);
460  }
461  case SUMO_ATTR_VTYPES:
462  return canParse<std::vector<std::string> >(value);
464  if (value.empty()) {
465  return true;
466  } else if (canParse<double>(value)) {
467  const double parsedValue = canParse<double>(value);
468  if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
469  return false;
470  } else {
471  return true;
472  }
473  } else {
474  return false;
475  }
476  case GNE_ATTR_SELECTED:
477  return canParse<bool>(value);
478  case GNE_ATTR_PARAMETERS:
479  return Parameterised::areParametersValid(value);
480  default:
481  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
482  }
483 }
484 
485 
486 void
488  //
489 }
490 
491 
492 void
494  //
495 }
496 
497 
498 bool
500  switch (key) {
501  case SUMO_ATTR_FROM:
503  return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
504  default:
505  return true;
506  }
507 }
508 
509 
510 std::string
512  return getTagStr();
513 }
514 
515 
516 std::string
519  return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
521  return "personTrip: " + getParentJunctions().front()->getID() + " -> " + getParentJunctions().back()->getID();
523  return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().front()->getID();
524  } else {
525  throw ("Invalid personTrip tag");
526  }
527 }
528 
529 
530 const std::map<std::string, std::string>&
532  return getParametersMap();
533 }
534 
535 // ===========================================================================
536 // private
537 // ===========================================================================
538 
539 void
540 GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value) {
541  switch (key) {
542  // Common person plan attributes
543  case SUMO_ATTR_FROM:
544  // change first edge
545  replaceFirstParentEdge(value);
546  // compute person trip
548  break;
549  case SUMO_ATTR_TO:
550  // change last edge
551  replaceLastParentEdge(value);
552  // compute person trip
554  break;
555  case GNE_ATTR_TO_BUSSTOP:
557  // compute person trip
559  break;
561  // change first junction
563  // compute person trip
565  break;
567  // change last junction
569  // compute person trip
571  break;
572  // specific person plan attributes
573  case SUMO_ATTR_MODES:
574  myModes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
575  break;
576  case SUMO_ATTR_VTYPES:
577  myVTypes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
578  break;
580  if (value.empty()) {
581  myArrivalPosition = -1;
582  } else {
583  myArrivalPosition = parse<double>(value);
584  }
585  updateGeometry();
586  break;
587  case GNE_ATTR_SELECTED:
588  if (parse<bool>(value)) {
590  } else {
592  }
593  break;
594  case GNE_ATTR_PARAMETERS:
595  setParametersStr(value);
596  break;
597  default:
598  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
599  }
600 }
601 
602 
603 void
604 GNEPersonTrip::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
605  // nothing to toogle
606 }
607 
608 
609 void
611  // change both position
612  myArrivalPosition = moveResult.newFirstPos;
613  // update geometry
614  updateGeometry();
615 }
616 
617 
618 void
620  undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
621  // now adjust start position
622  setAttribute(SUMO_ATTR_ARRIVALPOS, toString(moveResult.newFirstPos), undoList);
623  undoList->end();
624 }
625 
626 /****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:413
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:423
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:411
@ GLO_PERSONTRIP
a person trip
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_PERSONTRIP_JUNCTIONS
@ GNE_TAG_PERSONTRIP_BUSSTOP
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_PERSONTRIP
@ GNE_TAG_PERSONTRIP_EDGE
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_FROMJUNCTION
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ENDPOS
@ 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
@ SUMO_ATTR_TOJUNCTION
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:269
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
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
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
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
void resetDefaultValues()
reset attribute carrier to their default values
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
An Element which don't belongs to GNENet but has influency in the simulation.
Problem isPersonPlanValid() const
check if person plan is valid
Position getPathElementArrivalPos() const
get path element arrival position
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
std::string getPersonPlanProblem() const
get person plan problem
void replaceFirstParentJunction(const std::string &value)
replace the first parent junction
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform demand element changes
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value)
replace additional parent
Problem
enum class for demandElement problems
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
static const double myPersonPlanArrivalPositionDiameter
person plans arrival position radius
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
bool drawPersonPlan() const
void replaceLastParentJunction(const std::string &value)
replace the last parent junction
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
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:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
move operation
move result
double newFirstPos
new first position
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
void forceDrawPath(const GUIVisualizationSettings &s, const PathElement *pathElement) const
force draw path (used carefully, ONLY when we're inspecting a path element, due slowdowns)
void calculatePathLanes(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNELane * > lanes)
calculate path lanes (using dijkstra, require path calculator updated)
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
double myArrivalPosition
arrival position
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
GNELane * getLastPathLane() const
get last path lane
GNEMoveOperation * getMoveOperation()
get move operation
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.
bool isAttributeEnabled(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
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.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Position getAttributePosition(SumoXMLAttr key) const
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
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
const RGBColor & getColor() const
get color
std::vector< std::string > myVTypes
valid line or vehicle types
std::string getParentName() const
Returns the name of the parent object.
double getAttributeDouble(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
~GNEPersonTrip()
destructor
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
SUMOVehicleClass getVClass() const
GNEPersonTrip(SumoXMLTag tag, GNENet *net)
default constructor
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void computePathElement()
compute pathElement
GNELane * getFirstPathLane() const
get first path lane
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
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 end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
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 getPositionInformation() const
Returns the cursor's x/y position within the network.
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:61
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:248
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, 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:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:257
A list of positions.
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
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
RGBColor personTripColor
color for stopPersons
double personTripWidth
width for person trips