Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEPersonTrip.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 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
40 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
41myArrivalPosition(0) {
42 // reset default values
44}
45
46
47GNEPersonTrip::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 const std::vector<std::string>& lines) :
51 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge, toEdge}, {}, {}, {personParent}, {}),
52myArrivalPosition(arrivalPosition),
53myVTypes(types),
54myModes(modes),
55myLines(lines) {
56}
57
58
59GNEPersonTrip::GNEPersonTrip(bool isTrain, GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toStoppingPlace,
60 double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
61 const std::vector<std::string>& lines) :
64 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge}, {}, {toStoppingPlace}, {personParent}, {}),
65myArrivalPosition(arrivalPosition),
66myVTypes(types),
67myModes(modes),
68myLines(lines) {
69}
70
71
72GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction,
73 double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
74 const std::vector<std::string>& lines) :
76 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {
77 fromJunction, toJunction
78}, {}, {}, {}, {personParent}, {}),
79myArrivalPosition(arrivalPosition),
80myVTypes(types),
81myModes(modes),
82myLines(lines) {
83}
84
85
87
88
91 // avoid move person plan that ends in busStop
92 if ((getParentAdditionals().size() > 0) || (getParentJunctions().size() > 0)) {
93 return nullptr;
94 }
95 // get geometry end pos
96 const Position geometryEndPos = getPathElementArrivalPos();
97 // calculate circle width squared
99 // check if we clicked over a geometry end pos
100 if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= circleWidthSquared + 2) {
101 return new GNEMoveOperation(this, getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
102 } else {
103 return nullptr;
104 }
105}
106
107
110 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
111 // build header
112 buildPopupHeader(ret, app);
113 // build menu command for center button and copy cursor position to clipboard
115 buildPositionCopyEntry(ret, app);
116 // buld menu commands for names
117 GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
118 GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
119 new FXMenuSeparator(ret);
120 // build selection and show parameters menu
123 // show option to open demand element dialog
124 if (myTagProperty.hasDialog()) {
125 GUIDesigns::buildFXMenuCommand(ret, "Open " + getTagStr() + " Dialog", getACIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
126 new FXMenuSeparator(ret);
127 }
128 GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
129 return ret;
130}
131
132
133void
135 // open tag
137 // check if from attribute is enabled
139 // check if write edge or junction
140 if (getParentEdges().size() > 0) {
141 device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
142 } else if (getParentJunctions().size() > 0) {
144 }
145 }
146 // write to depending if personplan ends in a busStop, edge or junction
147 if (getParentAdditionals().size() > 0) {
148 if (getParentAdditionals().back()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
150 } else {
152 }
153 } else if (getParentEdges().size() > 0) {
154 device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
155 } else {
157 }
158 // avoid write arrival positions in person trip to busStop
160 (myArrivalPosition > 0)) {
162 }
163 // write modes
164 if (myModes.size() > 0) {
166 }
167 // write lines
168 if (myLines.size() > 0) {
170 }
171 // write vTypes
172 if (myVTypes.size() > 0) {
174 }
175 // close tag
176 device.closeTag();
177}
178
179
184
185
186std::string
190
191
192void
194 // currently the only solution is removing PersonTrip
195}
196
197
200 return getParentDemandElements().front()->getVClass();
201}
202
203
204const RGBColor&
206 return getParentDemandElements().front()->getColor();
207}
208
209
210void
212 // update child demand elementss
213 for (const auto& i : getChildDemandElements()) {
214 i->updateGeometry();
215 }
216}
217
218
221 if (getParentJunctions().size() > 0) {
222 return getParentJunctions().front()->getPositionInView();
223 } else {
224 return getParentEdges().front()->getPositionInView();
225 }
226}
227
228
229std::string
231 return getParentDemandElements().front()->getID();
232}
233
234
237 Boundary personTripBoundary;
238 // return the combination of all parent edges's boundaries
239 for (const auto& i : getParentEdges()) {
240 personTripBoundary.add(i->getCenteringBoundary());
241 }
242 // check if is valid
243 if (personTripBoundary.isInitialised()) {
244 return personTripBoundary;
245 } else {
246 return Boundary(-0.1, -0.1, 0.1, 0.1);
247 }
248}
249
250
251void
252GNEPersonTrip::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
253 // geometry of this element cannot be splitted
254}
255
256
257void
259 // force draw path
261 // special case for junction walks
262 if (getParentJunctions().size() > 0) {
263 // get person parent
264 const GNEDemandElement* personParent = getParentDemandElements().front();
265 if ((personParent->getChildDemandElements().size() > 0) && (personParent->getChildDemandElements().front() == this)) {
266 personParent->drawGL(s);
267 }
268 }
269}
270
271
272void
274 // calculate path depending of parents
275 if (getParentJunctions().size() > 0) {
276 // get previous personTrip
277 const auto previousParent = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
278 // calculate path
279 if (previousParent == nullptr) {
281 } else if (previousParent->getParentJunctions().size() > 0) {
282 myNet->getPathManager()->calculatePathJunctions(this, getVClass(), {previousParent->getParentJunctions().front(), getParentJunctions().back()});
283 } else {
284 myNet->getPathManager()->calculatePathJunctions(this, getVClass(), {previousParent->getLastPathLane()->getParentEdge()->getToJunction(), getParentJunctions().back()});
285 }
286 } else {
287 // calculate path
289 }
290 // update geometry
292}
293
294
295void
296GNEPersonTrip::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
297 // draw person plan over lane
299}
300
301
302void
303GNEPersonTrip::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
304 // draw person plan over junction
305 drawPersonPlanPartial(drawPersonPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.personTripWidth, s.colorSettings.personTripColor);
306}
307
308
309GNELane*
311 if (getParentJunctions().size() > 0) {
312 throw ProcessError(TL("This personTrip use junctions"));
313 } else {
314 return getParentEdges().front()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
315 }
316}
317
318
319GNELane*
321 // check if personPlan ends in a BusStop or junction
322 if (getParentJunctions().size() > 0) {
323 throw ProcessError(TL("This personTrip use junctions"));
324 } else if (getParentAdditionals().size() > 0) {
325 return getParentAdditionals().front()->getParentLanes().front();
326 } else {
327 return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
328 }
329}
330
331
332std::string
334 switch (key) {
335 // Common person plan attributes
336 case SUMO_ATTR_ID:
337 case GNE_ATTR_PARENT:
338 return getParentDemandElements().front()->getID();
339 case SUMO_ATTR_FROM:
340 return getParentEdges().front()->getID();
341 case SUMO_ATTR_TO:
342 return getParentEdges().back()->getID();
345 return getParentAdditionals().back()->getID();
347 return getParentJunctions().front()->getID();
349 return getParentJunctions().back()->getID();
350 // specific person plan attributes
351 case SUMO_ATTR_MODES:
352 return joinToString(myModes, " ");
353 case SUMO_ATTR_VTYPES:
354 return joinToString(myVTypes, " ");
357 return getParentAdditionals().front()->getAttribute(SUMO_ATTR_ENDPOS);
358 } else if (myArrivalPosition == -1) {
359 return "";
360 } else {
362 }
363 case SUMO_ATTR_LINES:
364 return joinToString(myLines, " ");
367 default:
368 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
369 }
370}
371
372
373double
375 switch (key) {
377 if (getParentJunctions().size() > 0) {
378 return 0;
379 } else if (myArrivalPosition != -1) {
380 return myArrivalPosition;
381 } else {
382 return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
383 }
384 default:
385 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
386 }
387}
388
389
392 switch (key) {
394 if (getParentJunctions().size() > 0) {
395 return getParentJunctions().back()->getPositionInView();
396 } else {
397 // get lane shape
398 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
399 // continue depending of arrival position
400 if (myArrivalPosition == 0) {
401 return laneShape.front();
402 } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
403 return laneShape.back();
404 } else {
405 return laneShape.positionAtOffset2D(myArrivalPosition);
406 }
407 }
408 }
409 default:
410 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
411 }
412}
413
414
415void
416GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
417 switch (key) {
418 // Common person plan attributes
419 case SUMO_ATTR_FROM:
422 case SUMO_ATTR_MODES:
423 case SUMO_ATTR_VTYPES:
424 case SUMO_ATTR_LINES:
426 case GNE_ATTR_PARENT:
427 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
428 break;
429 // special case for "to" attributes
430 case SUMO_ATTR_TO:
432 // get next personPlan
434 // continue depending of nextPersonPlan
435 if (nextPersonPlan) {
436 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
437 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
438 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
439 undoList->end();
440 } else {
441 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
442 }
443 break;
444 }
445 case GNE_ATTR_TO_BUSSTOP: {
446 // get next person plan
448 // continue depending of nextPersonPlan
449 if (nextPersonPlan) {
450 // obtain busStop
452 // change from attribute using edge ID
453 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
454 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
455 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
456 undoList->end();
457 } else {
458 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
459 }
460 break;
461 }
463 // get next person plan
465 // continue depending of nextPersonPlan
466 if (nextPersonPlan) {
467 // obtain trainStop
469 // change from attribute using edge ID
470 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
471 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, trainStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
472 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
473 undoList->end();
474 } else {
475 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
476 }
477 break;
478 }
479 default:
480 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
481 }
482}
483
484
485bool
486GNEPersonTrip::isValid(SumoXMLAttr key, const std::string& value) {
487 switch (key) {
488 // Common person plan attributes
489 case SUMO_ATTR_FROM:
490 case SUMO_ATTR_TO:
491 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
494 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveJunction(value, false) != nullptr);
496 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
498 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRAIN_STOP, value, false) != nullptr);
499 // specific person plan attributes
500 case SUMO_ATTR_MODES: {
501 SVCPermissions dummyModeSet;
502 std::string dummyError;
503 return SUMOVehicleParameter::parsePersonModes(value, myTagProperty.getTagStr(), "", dummyModeSet, dummyError);
504 }
505 case SUMO_ATTR_VTYPES:
506 return canParse<std::vector<std::string> >(value);
508 if (value.empty()) {
509 return true;
510 } else if (canParse<double>(value)) {
511 if (isTemplate()) {
512 return true;
513 }
514 const double parsedValue = canParse<double>(value);
515 if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
516 return false;
517 } else {
518 return true;
519 }
520 } else {
521 return false;
522 }
523 case SUMO_ATTR_LINES:
524 return canParse<std::vector<std::string> >(value);
526 return canParse<bool>(value);
527 case GNE_ATTR_PARENT:
528 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
529 return true;
530 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
531 return true;
532 } else {
533 return false;
534 }
535 default:
536 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
537 }
538}
539
540
541bool
543 switch (key) {
544 case SUMO_ATTR_FROM:
546 return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
547 default:
548 return true;
549 }
550}
551
552
553std::string
555 return getTagStr();
556}
557
558
559std::string
562 return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
564 return "personTrip: " + getParentJunctions().front()->getID() + " -> " + getParentJunctions().back()->getID();
566 return "personTrip: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().front()->getID();
567 } else {
568 throw ("Invalid personTrip tag");
569 }
570}
571
572
577
578// ===========================================================================
579// private
580// ===========================================================================
581
582void
583GNEPersonTrip::setAttribute(SumoXMLAttr key, const std::string& value) {
584 switch (key) {
585 // Common person plan attributes
586 case SUMO_ATTR_FROM:
587 // change first edge
589 // compute person trip
591 break;
592 case SUMO_ATTR_TO:
593 // change last edge
595 // compute person trip
597 break;
600 // compute person trip
602 break;
605 // compute person trip
607 break;
609 // change first junction
611 // compute person trip
613 break;
615 // change last junction
617 // compute person trip
619 break;
620 // specific person plan attributes
621 case SUMO_ATTR_MODES:
622 myModes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
623 break;
624 case SUMO_ATTR_VTYPES:
625 myVTypes = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
626 break;
628 if (value.empty()) {
630 } else {
631 myArrivalPosition = parse<double>(value);
632 }
634 break;
635 case SUMO_ATTR_LINES:
636 myLines = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
637 break;
639 if (parse<bool>(value)) {
641 } else {
643 }
644 break;
645 case GNE_ATTR_PARENT:
646 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
648 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
650 }
652 break;
653 default:
654 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
655 }
656}
657
658
659void
661 // change both position
662 myArrivalPosition = moveResult.newFirstPos;
663 // update geometry
665}
666
667
668void
670 undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
671 // now adjust start position
673 undoList->end();
674}
675
676/****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition GUIAppEnum.h:450
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition GUIAppEnum.h:462
@ MID_COPY_NAME
Copy object name - popup entry.
Definition GUIAppEnum.h:448
@ GLO_PERSONTRIP
a person trip
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ PERSONTRIP_JUNCTIONS
@ PERSONTRIP_TRAINSTOP
@ PERSONTRIP_BUSSTOP
@ PERSONTRIP_FROMTO
#define TL(string)
Definition MsgHandler.h:287
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.
@ GNE_TAG_PERSONTRIP_TRAINSTOP
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONTRIP
@ GNE_TAG_RIDE_TRAINSTOP
@ GNE_TAG_PERSONTRIP_EDGE
@ GNE_TAG_RIDE_BUSSTOP
@ SUMO_TAG_PERSONFLOW
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LINES
@ GNE_ATTR_TO_TRAINSTOP
to trainStop (used by personPlans)
@ SUMO_ATTR_FROMJUNCTION
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_TRAIN_STOP
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ 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:283
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:78
bool isInitialised() const
check if Boundary is Initialised
Definition Boundary.cpp:216
An Element which don't belong to GNENet but has influence in the simulation.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
FXIcon * getACIcon() const
get FXIcon associated to this AC
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
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 belong to GNENet but has influence in the simulation.
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
Problem isPersonPlanValid() const
check if person plan is valid
Position getPathElementArrivalPos() const
get path element arrival position
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
void replaceFirstParentAdditional(SumoXMLTag tag, const std::string &value)
replace the first parent additional
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
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
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:136
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
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
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:120
GNEPathManager * getPathManager()
get path manager
Definition GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
void calculatePathJunctions(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEJunction * > junctions)
calculate path junctions (using dijkstra, require path calculator updated)
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
write 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
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)
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
SUMOVehicleClass getVClass() const
const Parameterised::Map & getACParametersMap() const
get parameters map
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
std::vector< std::string > myLines
valid line or vehicle ids or ANY
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.
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
The popup menu of a globject.
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.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual 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.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & 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:259
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