Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEWalk.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 walks in Netedit
19/****************************************************************************/
20#include <config.h>
21
24#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
28
29#include "GNEWalk.h"
30#include "GNERoute.h"
31
32
33// ===========================================================================
34// method definitions
35// ===========================================================================
36
39 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
40myArrivalPosition(0) {
41 // reset default values
43}
44
45
46GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, double arrivalPosition) :
48 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge, toEdge}, {}, {}, {personParent}, {}),
49myArrivalPosition(arrivalPosition) {
50}
51
52
53GNEWalk::GNEWalk(const bool isTrain, GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toAdditional, double arrivalPosition) :
55 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge}, {}, {toAdditional}, {personParent}, {}),
56myArrivalPosition(arrivalPosition) {
57}
58
59
60GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, std::vector<GNEEdge*> edges, double arrivalPosition) :
62 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {edges}, {}, {}, {personParent}, {}),
63myArrivalPosition(arrivalPosition) {
64}
65
66
67GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEDemandElement* route, double arrivalPosition) :
69 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {personParent, route}, {}),
70myArrivalPosition(arrivalPosition) {
71}
72
73
74GNEWalk::GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction, double arrivalPosition) :
76 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {
77 fromJunction, toJunction
78}, {}, {}, {}, {personParent}, {}),
79myArrivalPosition(arrivalPosition) {
80}
81
82
84
85
88 // avoid move person plan that ends in busStop or junction
89 if ((getParentAdditionals().size() > 0) || (getParentJunctions().size() > 0)) {
90 return nullptr;
91 }
92 // get geometry end pos
93 const Position geometryEndPos = getPathElementArrivalPos();
94 // calculate circle width squared
96 // check if we clicked over a geometry end pos
97 if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= ((circleWidthSquared + 2))) {
98 // continue depending of parent edges
99 if (getParentEdges().size() > 0) {
100 return new GNEMoveOperation(this, getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
101 } else {
102 return new GNEMoveOperation(this, getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
103 }
104 } else {
105 return nullptr;
106 }
107}
108
109
112 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
113 // build header
114 buildPopupHeader(ret, app);
115 // build menu command for center button and copy cursor position to clipboard
117 buildPositionCopyEntry(ret, app);
118 // buld menu commands for names
119 GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
120 GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
121 new FXMenuSeparator(ret);
122 // build selection and show parameters menu
125 // show option to open demand element dialog
126 if (myTagProperty.hasDialog()) {
127 GUIDesigns::buildFXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getACIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
128 new FXMenuSeparator(ret);
129 }
130 GUIDesigns::buildFXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
131 return ret;
132}
133
134
135void
137 // open tag
138 device.openTag(SUMO_TAG_WALK);
139 // write attributes depending of walk type
142 } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
144 } else {
145 // check if from attribute is enabled
147 // check if write edge or junction
148 if (getParentEdges().size() > 0) {
149 device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
150 } else if (getParentJunctions().size() > 0) {
152 }
153 }
154 // write to depending if personplan ends in a busStop, edge or junction
155 if (getParentAdditionals().size() > 0) {
156 if (getParentAdditionals().back()->getTagProperty().getTag() == SUMO_TAG_BUS_STOP) {
158 } else {
160 }
161 } else if (getParentEdges().size() > 0) {
162 device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
163 } else {
165 }
166 }
167 // avoid write arrival positions in walk to busStop
169 (myArrivalPosition > 0)) {
171 }
172 // close tag
173 device.closeTag();
174}
175
176
181
182
183std::string
187
188
189void
191 // currently the only solution is removing Walk
192}
193
194
197 return getParentDemandElements().front()->getVClass();
198}
199
200
201const RGBColor&
203 return getParentDemandElements().front()->getColor();
204}
205
206
207void
209 // update child demand elementss
210 for (const auto& i : getChildDemandElements()) {
211 i->updateGeometry();
212 }
213}
214
215
218 if (getParentJunctions().size() > 0) {
219 return getParentJunctions().front()->getPositionInView();
220 } else if (getParentEdges().size() > 0) {
221 return getParentEdges().front()->getPositionInView();
222 } else {
223 return getParentDemandElements().at(1)->getPositionInView();
224 }
225}
226
227
228std::string
230 return getParentDemandElements().front()->getID();
231}
232
233
236 Boundary walkBoundary;
237 // return the combination of all parent edges's boundaries
238 for (const auto& i : getParentEdges()) {
239 walkBoundary.add(i->getCenteringBoundary());
240 }
241 // check if is valid
242 if (walkBoundary.isInitialised()) {
243 return walkBoundary;
244 } else {
245 return Boundary(-0.1, -0.1, 0.1, 0.1);
246 }
247}
248
249
250void
251GNEWalk::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
252 // only split geometry of WalkEdges
254 // obtain new list of walk edges
255 std::string newWalkEdges = getNewListOfParents(originalElement, newElement);
256 // update walk edges
257 if (newWalkEdges.size() > 0) {
258 setAttribute(SUMO_ATTR_EDGES, newWalkEdges, undoList);
259 }
260 }
261}
262
263
264void
266 // force draw path
268 // special case for junction walks
269 if (getParentJunctions().size() > 0) {
270 // get person parent
271 const GNEDemandElement* personParent = getParentDemandElements().front();
272 if ((personParent->getChildDemandElements().size() > 0) && (personParent->getChildDemandElements().front() == this)) {
273 personParent->drawGL(s);
274 }
275 }
276}
277
278
279void
281 // avoid calculate for junctions
282 // calculate path depending of parents
283 if (getParentJunctions().size() > 0) {
284 // get previous personTrip
285 const auto previousParent = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
286 // calculate path
287 if (previousParent == nullptr) {
289 } else if (previousParent->getParentJunctions().size() > 0) {
290 myNet->getPathManager()->calculatePathJunctions(this, getVClass(), {previousParent->getParentJunctions().front(), getParentJunctions().back()});
291 } else {
292 myNet->getPathManager()->calculatePathJunctions(this, getVClass(), {previousParent->getLastPathLane()->getParentEdge()->getToJunction(), getParentJunctions().back()});
293 }
294 } else {
295 // declare lane vector
296 std::vector<GNELane*> lanes;
297 // update lanes depending of walk tag
299 // calculate consecutive path using parent edges
301 } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
302 // calculate consecutive path using route edges
304 } else if (getParentEdges().size() > 0) {
305 // get first and last person plane
306 lanes = {getFirstPathLane(), getLastPathLane()};
307 // calculate path
309 }
310 }
311 // update geometry
313}
314
315
316void
317GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
318 // draw person plan over lane
320}
321
322
323void
324GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
325 // draw person plan over junction
326 drawPersonPlanPartial(drawPersonPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.walkWidth, s.colorSettings.walkColor);
327}
328
329
330GNELane*
332 // check if this walk is over a route
334 return getParentDemandElements().at(1)->getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
335 } else if (getParentJunctions().size() > 0) {
336 throw ProcessError(TL("This walk use junctions"));
337 } else {
338 return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
339 }
340}
341
342
343GNELane*
345 // check if this walk is over a route
347 return getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
348 } else if (getParentAdditionals().size() > 0) {
349 return getParentAdditionals().front()->getParentLanes().front();
350 } else if (getParentJunctions().size() > 0) {
351 throw ProcessError(TL("This walk use junctions"));
352 } else {
353 return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
354 }
355}
356
357
358std::string
360 switch (key) {
361 // Common person plan attributes
362 case SUMO_ATTR_ID:
363 case GNE_ATTR_PARENT:
364 return getParentDemandElements().front()->getID();
365 case SUMO_ATTR_FROM:
367 return getParentDemandElements().at(1)->getParentEdges().front()->getID();
368 } else {
369 return getParentEdges().front()->getID();
370 }
371 case SUMO_ATTR_TO:
373 return getParentDemandElements().at(1)->getParentEdges().back()->getID();
374 } else {
375 return getParentEdges().back()->getID();
376 }
378 return getParentJunctions().front()->getID();
380 return getParentJunctions().back()->getID();
383 return getParentAdditionals().back()->getID();
384 case SUMO_ATTR_EDGES:
385 return parseIDs(getParentEdges());
386 case SUMO_ATTR_ROUTE:
387 return getParentDemandElements().at(1)->getID();
388 // specific person plan attributes
390 if (myArrivalPosition == -1) {
391 return "";
392 } else {
394 }
397 default:
398 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
399 }
400}
401
402
403double
405 switch (key) {
407 if (getParentJunctions().size() > 0) {
408 return 0;
409 } else if (myArrivalPosition != -1) {
410 return myArrivalPosition;
411 } else {
412 return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
413 }
414 default:
415 throw InvalidArgument(getTagStr() + " doesn't have a doubleattribute of type '" + toString(key) + "'");
416 }
417}
418
419
422 switch (key) {
424 if (getParentJunctions().size() > 0) {
425 return getParentJunctions().back()->getPositionInView();
426 } else {
427 // get lane shape
428 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
429 // continue depending of arrival position
430 if (myArrivalPosition == 0) {
431 return laneShape.front();
432 } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
433 return laneShape.back();
434 } else {
435 return laneShape.positionAtOffset2D(myArrivalPosition);
436 }
437 }
438 }
439 default:
440 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
441 }
442}
443
444
445void
446GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
447 switch (key) {
448 // Common person plan attributes
449 case SUMO_ATTR_FROM:
451 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
452 }
453 break;
457 case GNE_ATTR_PARENT:
458 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
459 break;
460 // special case for "to" attributes
461 case SUMO_ATTR_TO:
464 // get next personPlan
466 // continue depending of nextPersonPlan
467 if (nextPersonPlan) {
468 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
469 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
470 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
471 undoList->end();
472 } else {
473 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
474 }
475 }
476 break;
477 }
478 case GNE_ATTR_TO_BUSSTOP: {
479 // get next person plan
481 // continue depending of nextPersonPlan
482 if (nextPersonPlan) {
483 // obtain busStop
485 // change from attribute using edge ID
486 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
487 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, busStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
488 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
489 undoList->end();
490 } else {
491 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
492 }
493 break;
494 }
496 // get next person plan
498 // continue depending of nextPersonPlan
499 if (nextPersonPlan) {
500 // obtain trainStop
502 // change from attribute using edge ID
503 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
504 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, trainStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
505 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
506 undoList->end();
507 } else {
508 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
509 }
510 break;
511 }
512 case SUMO_ATTR_EDGES: {
513 // get next person plan
515 // continue depending of nextPersonPlan
516 if (nextPersonPlan) {
517 // obtain edges
518 const std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
519 // change from attribute using edge ID
520 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
521 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, edges.back()->getID(), undoList);
522 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
523 undoList->end();
524 } else {
525 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
526 }
527 break;
528 }
529 case SUMO_ATTR_ROUTE: {
530 // get next person plan
532 // continue depending of nextPersonPlan
533 if (nextPersonPlan) {
534 // obtain route
536 // change from attribute using edge ID
537 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
538 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, route->getParentEdges().back()->getID(), undoList);
539 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
540 undoList->end();
541 } else {
542 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
543 }
544 break;
545 }
546 default:
547 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
548 }
549}
550
551
552bool
553GNEWalk::isValid(SumoXMLAttr key, const std::string& value) {
554 switch (key) {
555 // Common person plan attributes
556 case SUMO_ATTR_FROM:
557 case SUMO_ATTR_TO:
559 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
560 } else {
561 return false;
562 }
565 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
567 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
569 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRAIN_STOP, value, false) != nullptr);
570 case SUMO_ATTR_EDGES:
571 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
572 // all edges exist, then check if compounds a valid route
573 return GNERoute::isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
574 } else {
575 return false;
576 }
577 case SUMO_ATTR_ROUTE:
578 return (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
579 // specific person plan attributes
581 if (value.empty()) {
582 return true;
583 } else if (canParse<double>(value)) {
584 if (isTemplate()) {
585 return true;
586 }
587 const double parsedValue = canParse<double>(value);
588 if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
589 return false;
590 } else {
591 return true;
592 }
593 } else {
594 return false;
595 }
597 return canParse<bool>(value);
598 case GNE_ATTR_PARENT:
599 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
600 return true;
601 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
602 return true;
603 } else {
604 return false;
605 }
606 default:
607 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
608 }
609}
610
611
612bool
614 switch (key) {
615 case SUMO_ATTR_FROM:
617 return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
618 default:
619 return true;
620 }
621}
622
623
624std::string
626 return getTagStr();
627}
628
629
630std::string
633 return "walk: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
635 return "walk: " + getParentJunctions().front()->getID() + " -> " + getParentJunctions().back()->getID();
637 return "walk: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
638 } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
639 return "walk: " + getParentEdges().front()->getID() + " ... " + getParentEdges().back()->getID();
640 } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
641 return "walk: " + getParentDemandElements().at(1)->getID();
642 } else {
643 throw ("Invalid walk tag");
644 }
645}
646
647
652
653// ===========================================================================
654// private
655// ===========================================================================
656
657void
658GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value) {
659 switch (key) {
660 // Common person plan attributes
661 case SUMO_ATTR_FROM:
662 // change first edge
664 // compute walk
666 break;
667 case SUMO_ATTR_TO:
668 // change last edge
670 // compute walk
672 break;
674 // change first junction
676 // compute walk
678 break;
680 // change last junction
682 // compute walk
684 break;
687 // compute walk
689 break;
692 // compute walk
694 break;
695 case SUMO_ATTR_EDGES:
697 // compute walk
699 break;
700 case SUMO_ATTR_ROUTE:
702 // compute walk
704 break;
705 // specific person plan attributes
707 if (value.empty()) {
709 } else {
710 myArrivalPosition = parse<double>(value);
711 }
713 break;
715 if (parse<bool>(value)) {
717 } else {
719 }
720 break;
721 case GNE_ATTR_PARENT:
722 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
724 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
726 }
728 break;
729 default:
730 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
731 }
732}
733
734
735void
737 // change both position
738 myArrivalPosition = moveResult.newFirstPos;
739 // update geometry
741}
742
743
744void
746 undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
747 // now adjust start position
749 undoList->end();
750}
751
752/****************************************************************************/
@ 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_WALK
a walk
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ WALK_TRAINSTOP
@ WALK_JUNCTIONS
@ WALK_BUSSTOP
#define TL(string)
Definition MsgHandler.h:287
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_WALK
@ GNE_TAG_WALK_EDGES
@ SUMO_TAG_BUS_STOP
A bus stop.
@ GNE_TAG_WALK_BUSSTOP
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ GNE_TAG_WALK_JUNCTIONS
@ SUMO_TAG_PERSON
@ GNE_TAG_WALK_TRAINSTOP
@ GNE_TAG_RIDE_TRAINSTOP
@ GNE_TAG_WALK_EDGE
@ GNE_TAG_RIDE_BUSSTOP
@ GNE_TAG_WALK_ROUTE
@ SUMO_TAG_PERSONFLOW
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_TO_TRAINSTOP
to trainStop (used by personPlans)
@ SUMO_ATTR_FROMJUNCTION
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_TRAIN_STOP
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_TO_BUSSTOP
to busStop (used by personPlans)
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_ROUTE
@ SUMO_ATTR_ID
@ SUMO_ATTR_TOJUNCTION
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
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
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
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
void resetDefaultValues()
reset attribute carrier to their default values
GNENet * myNet
pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
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 replaceDemandParentEdges(const std::string &value)
replace demand parent edges
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
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
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.
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 calculateConsecutivePathEdges(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEEdge * > edges)
calculate consecutive path edges
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)
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition GNERoute.cpp:758
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.
Position getPositionInView() const
Returns position of additional in view.
Definition GNEWalk.cpp:217
SUMOVehicleClass getVClass() const
Definition GNEWalk.cpp:196
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEWalk.cpp:613
double myArrivalPosition
arrival position
Definition GNEWalk.h:242
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEWalk.cpp:235
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEWalk.cpp:251
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEWalk.cpp:625
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEWalk.cpp:631
GNELane * getFirstPathLane() const
get first path lane
Definition GNEWalk.cpp:331
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition GNEWalk.cpp:317
void updateGeometry()
update pre-computed geometry information
Definition GNEWalk.cpp:208
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEWalk.cpp:421
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNEWalk.cpp:111
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEWalk.cpp:190
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEWalk.cpp:553
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEWalk.cpp:87
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEWalk.cpp:265
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNEWalk.cpp:736
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEWalk.cpp:404
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition GNEWalk.cpp:178
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition GNEWalk.cpp:446
~GNEWalk()
destructor
Definition GNEWalk.cpp:83
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNEWalk.cpp:649
std::string getParentName() const
Returns the name of the parent object.
Definition GNEWalk.cpp:229
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEWalk.cpp:359
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNEWalk.cpp:745
const RGBColor & getColor() const
get color
Definition GNEWalk.cpp:202
void computePathElement()
compute pathElement
Definition GNEWalk.cpp:280
GNELane * getLastPathLane() const
get last path lane
Definition GNEWalk.cpp:344
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEWalk.cpp:184
GNEWalk(SumoXMLTag tag, GNENet *net)
default constructor
Definition GNEWalk.cpp:37
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEWalk.cpp:136
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 isValidNetID(const std::string &value)
whether the given string is a valid id for a network element