Eclipse SUMO - Simulation of Urban MObility
GNEWalk.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 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(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop, double arrivalPosition) :
55 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge}, {}, {toBusStop}, {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) {
157 } else if (getParentEdges().size() > 0) {
158 device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
159 } else {
161 }
162 }
163 // avoid write arrival positions in walk to busStop
166 }
167 // close tag
168 device.closeTag();
169}
170
171
174 return isPersonPlanValid();
175}
176
177
178std::string
180 return getPersonPlanProblem();
181}
182
183
184void
186 // currently the only solution is removing Walk
187}
188
189
192 return getParentDemandElements().front()->getVClass();
193}
194
195
196const RGBColor&
198 return getParentDemandElements().front()->getColor();
199}
200
201
202void
204 // update child demand elementss
205 for (const auto& i : getChildDemandElements()) {
206 i->updateGeometry();
207 }
208}
209
210
213 if (getParentJunctions().size() > 0) {
214 return getParentJunctions().front()->getPositionInView();
215 } else if (getParentEdges().size() > 0) {
216 return getParentEdges().front()->getPositionInView();
217 } else {
218 return getParentDemandElements().at(1)->getPositionInView();
219 }
220}
221
222
223std::string
225 return getParentDemandElements().front()->getID();
226}
227
228
229double
231 return 1;
232}
233
234
237 Boundary walkBoundary;
238 // return the combination of all parent edges's boundaries
239 for (const auto& i : getParentEdges()) {
240 walkBoundary.add(i->getCenteringBoundary());
241 }
242 // check if is valid
243 if (walkBoundary.isInitialised()) {
244 return walkBoundary;
245 } else {
246 return Boundary(-0.1, -0.1, 0.1, 0.1);
247 }
248}
249
250
251void
252GNEWalk::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
253 // only split geometry of WalkEdges
255 // obtain new list of walk edges
256 std::string newWalkEdges = getNewListOfParents(originalElement, newElement);
257 // update walk edges
258 if (newWalkEdges.size() > 0) {
259 setAttribute(SUMO_ATTR_EDGES, newWalkEdges, undoList);
260 }
261 }
262}
263
264
265void
267 // force draw path
269 // special case for junction walks
270 if (getParentJunctions().size() > 0) {
271 // get person parent
272 const GNEDemandElement* personParent = getParentDemandElements().front();
273 if ((personParent->getChildDemandElements().size() > 0) && (personParent->getChildDemandElements().front() == this)) {
274 personParent->drawGL(s);
275 }
276 }
277}
278
279
280void
282 // avoid calculate for junctions
283 // calculate path depending of parents
284 if (getParentJunctions().size() > 0) {
285 // get previous personTrip
286 const auto previousParent = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
287 // calculate path
288 if (previousParent == nullptr) {
290 } else if (previousParent->getParentJunctions().size() > 0) {
291 myNet->getPathManager()->calculatePathJunctions(this, getVClass(), {previousParent->getParentJunctions().front(), getParentJunctions().back()});
292 } else {
293 myNet->getPathManager()->calculatePathJunctions(this, getVClass(), {previousParent->getLastPathLane()->getParentEdge()->getToJunction(), getParentJunctions().back()});
294 }
295 } else {
296 // declare lane vector
297 std::vector<GNELane*> lanes;
298 // update lanes depending of walk tag
300 // calculate consecutive path using parent edges
302 } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
303 // calculate consecutive path using route edges
305 } else if (getParentEdges().size() > 0) {
306 // get first and last person plane
307 lanes = {getFirstPathLane(), getLastPathLane()};
308 // calculate path
310 }
311 }
312 // update geometry
314}
315
316
317void
318GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
319 // draw person plan over lane
321}
322
323
324void
325GNEWalk::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
326 // draw person plan over junction
327 drawPersonPlanPartial(drawPersonPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.walkWidth, s.colorSettings.walkColor);
328}
329
330
331GNELane*
333 // check if this walk is over a route
335 return getParentDemandElements().at(1)->getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
336 } else if (getParentJunctions().size() > 0) {
337 throw ProcessError("This walk use junctions");
338 } else {
339 return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
340 }
341}
342
343
344GNELane*
346 // check if this walk is over a route
348 return getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
349 } else if (getParentAdditionals().size() > 0) {
350 return getParentAdditionals().front()->getParentLanes().front();
351 } else if (getParentJunctions().size() > 0) {
352 throw ProcessError("This walk use junctions");
353 } else {
354 return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
355 }
356}
357
358
359std::string
361 switch (key) {
362 // Common person plan attributes
363 case SUMO_ATTR_ID:
364 case GNE_ATTR_PARENT:
365 return getParentDemandElements().front()->getID();
366 case SUMO_ATTR_FROM:
368 return getParentDemandElements().at(1)->getParentEdges().front()->getID();
369 } else {
370 return getParentEdges().front()->getID();
371 }
372 case SUMO_ATTR_TO:
374 return getParentDemandElements().at(1)->getParentEdges().back()->getID();
375 } else {
376 return getParentEdges().back()->getID();
377 }
379 return getParentJunctions().front()->getID();
381 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
465 GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
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
480 GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
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 }
495 case SUMO_ATTR_EDGES: {
496 // get next person plan
497 GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
498 // continue depending of nextPersonPlan
499 if (nextPersonPlan) {
500 // obtain edges
501 const std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
502 // change from attribute using edge ID
503 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
504 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, edges.back()->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_ROUTE: {
513 // get next person plan
514 GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
515 // continue depending of nextPersonPlan
516 if (nextPersonPlan) {
517 // obtain route
519 // change from attribute using edge ID
520 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next personPlan");
521 nextPersonPlan->setAttribute(SUMO_ATTR_FROM, route->getParentEdges().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 default:
530 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
531 }
532}
533
534
535bool
536GNEWalk::isValid(SumoXMLAttr key, const std::string& value) {
537 switch (key) {
538 // Common person plan attributes
539 case SUMO_ATTR_FROM:
540 case SUMO_ATTR_TO:
542 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
543 } else {
544 return false;
545 }
548 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
550 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_BUS_STOP, value, false) != nullptr);
551 case SUMO_ATTR_EDGES:
552 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
553 // all edges exist, then check if compounds a valid route
554 return GNERoute::isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
555 } else {
556 return false;
557 }
558 case SUMO_ATTR_ROUTE:
559 return (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
560 // specific person plan attributes
562 if (value.empty()) {
563 return true;
564 } else if (canParse<double>(value)) {
565 if (isTemplate()) {
566 return true;
567 }
568 const double parsedValue = canParse<double>(value);
569 if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
570 return false;
571 } else {
572 return true;
573 }
574 } else {
575 return false;
576 }
578 return canParse<bool>(value);
579 case GNE_ATTR_PARENT:
580 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
581 return true;
582 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
583 return true;
584 } else {
585 return false;
586 }
587 default:
588 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
589 }
590}
591
592
593bool
595 switch (key) {
596 case SUMO_ATTR_FROM:
598 return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
599 default:
600 return true;
601 }
602}
603
604
605std::string
607 return getTagStr();
608}
609
610
611std::string
614 return "walk: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
616 return "walk: " + getParentJunctions().front()->getID() + " -> " + getParentJunctions().back()->getID();
617 } else if (myTagProperty.getTag() == GNE_TAG_WALK_BUSSTOP) {
618 return "walk: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
619 } else if (myTagProperty.getTag() == GNE_TAG_WALK_EDGES) {
620 return "walk: " + getParentEdges().front()->getID() + " ... " + getParentEdges().back()->getID();
621 } else if (myTagProperty.getTag() == GNE_TAG_WALK_ROUTE) {
622 return "walk: " + getParentDemandElements().at(1)->getID();
623 } else {
624 throw ("Invalid walk tag");
625 }
626}
627
628
631 return getParametersMap();
632}
633
634// ===========================================================================
635// private
636// ===========================================================================
637
638void
639GNEWalk::setAttribute(SumoXMLAttr key, const std::string& value) {
640 switch (key) {
641 // Common person plan attributes
642 case SUMO_ATTR_FROM:
643 // change first edge
645 // compute walk
647 break;
648 case SUMO_ATTR_TO:
649 // change last edge
651 // compute walk
653 break;
655 // change first junction
657 // compute walk
659 break;
661 // change last junction
663 // compute walk
665 break;
668 // compute walk
670 break;
671 case SUMO_ATTR_EDGES:
673 // compute walk
675 break;
676 case SUMO_ATTR_ROUTE:
678 // compute walk
680 break;
681 // specific person plan attributes
683 if (value.empty()) {
685 } else {
686 myArrivalPosition = parse<double>(value);
687 }
689 break;
691 if (parse<bool>(value)) {
693 } else {
695 }
696 break;
697 case GNE_ATTR_PARENT:
698 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) != nullptr) {
700 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) != nullptr) {
702 }
704 break;
705 default:
706 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
707 }
708}
709
710
711void
713 // change both position
714 myArrivalPosition = moveResult.newFirstPos;
715 // update geometry
717}
718
719
720void
722 undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
723 // now adjust start position
725 undoList->end();
726}
727
728/****************************************************************************/
@ 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:460
@ 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_JUNCTIONS
@ WALK_BUSSTOP
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
@ GNE_TAG_WALK_JUNCTIONS
@ SUMO_TAG_PERSON
@ GNE_TAG_WALK_EDGE
@ GNE_TAG_WALK_ROUTE
@ SUMO_TAG_PERSONFLOW
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_FROMJUNCTION
@ SUMO_ATTR_BUS_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.
Definition: GNEAdditional.h:48
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
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
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
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:142
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:132
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:138
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
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:754
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:474
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:212
SUMOVehicleClass getVClass() const
Definition: GNEWalk.cpp:191
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:594
double myArrivalPosition
arrival position
Definition: GNEWalk.h:244
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:236
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEWalk.cpp:252
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:606
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:612
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEWalk.cpp:332
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEWalk.cpp:318
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:203
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:185
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEWalk.cpp:230
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:536
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEWalk.cpp:87
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:266
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEWalk.cpp:712
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:173
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:630
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:224
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:360
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEWalk.cpp:721
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:197
void computePathElement()
compute pathElement
Definition: GNEWalk.cpp:281
GNELane * getLastPathLane() const
get last path lane
Definition: GNEWalk.cpp:345
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:179
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
Definition: GUIDesigns.cpp:42
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.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
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
Definition: Parameterised.h:45
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: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 isValidNetID(const std::string &value)
whether the given string is a valid id for a network element