Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEPerson.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// Representation of persons in netedit
19/****************************************************************************/
20#include <cmath>
22#include <netedit/GNENet.h>
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
33
34#include "GNEPerson.h"
35#include "GNERouteHandler.h"
36
37
38// ===========================================================================
39// FOX callback mapping
40// ===========================================================================
44
48
49// Object implementation
50FXIMPLEMENT(GNEPerson::GNEPersonPopupMenu, GUIGLObjectPopupMenu, personPopupMenuMap, ARRAYNUMBER(personPopupMenuMap))
51FXIMPLEMENT(GNEPerson::GNESelectedPersonsPopupMenu, GUIGLObjectPopupMenu, selectedPersonsPopupMenuMap, ARRAYNUMBER(selectedPersonsPopupMenuMap))
52
53// ===========================================================================
54// GNEPerson::GNEPersonPopupMenu
55// ===========================================================================
56
58 GUIGLObjectPopupMenu(app, parent, *person),
59 myPerson(person),
60 myTransformToPerson(nullptr),
61 myTransformToPersonFlow(nullptr) {
62 // build header
63 myPerson->buildPopupHeader(this, app);
64 // build menu command for center button and copy cursor position to clipboard
65 myPerson->buildCenterPopupEntry(this);
66 myPerson->buildPositionCopyEntry(this, app);
67 // buld menu commands for names
68 GUIDesigns::buildFXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
69 GUIDesigns::buildFXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
70 new FXMenuSeparator(this);
71 // build selection and show parameters menu
72 myPerson->getNet()->getViewNet()->buildSelectionACPopupEntry(this, myPerson);
73 myPerson->buildShowParamsPopupEntry(this);
74 // add transform functions only in demand mode
75 if (myPerson->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
76 // create menu pane for transform operations
77 FXMenuPane* transformOperation = new FXMenuPane(this);
78 this->insertMenuPaneChild(transformOperation);
79 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
80 // Create menu comands for all transformations
81 myTransformToPerson = GUIDesigns::buildFXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(GUIIcon::PERSON), this, MID_GNE_PERSON_TRANSFORM);
82 myTransformToPersonFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "PersonFlow", GUIIconSubSys::getIcon(GUIIcon::PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
83 // check what menu command has to be disabled
84 if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSON) {
85 myTransformToPerson->disable();
86 } else if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSONFLOW) {
87 myTransformToPersonFlow->disable();
88 }
89 }
90}
91
92
94
95
96long
97GNEPerson::GNEPersonPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
98 if (obj == myTransformToPerson) {
100 } else if (obj == myTransformToPersonFlow) {
102 }
103 return 1;
104}
105
106
107// ===========================================================================
108// GNEPerson::GNESelectedPersonsPopupMenu
109// ===========================================================================
110
111GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent) :
112 GUIGLObjectPopupMenu(app, parent, *person),
113 myPersonTag(person->getTagProperty().getTag()),
114 mySelectedPersons(selectedPerson),
115 myTransformToPerson(nullptr),
116 myTransformToPersonFlow(nullptr) {
117 // build header
118 person->buildPopupHeader(this, app);
119 // build menu command for center button and copy cursor position to clipboard
120 person->buildCenterPopupEntry(this);
121 person->buildPositionCopyEntry(this, app);
122 // buld menu commands for names
123 GUIDesigns::buildFXMenuCommand(this, ("Copy " + person->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
124 GUIDesigns::buildFXMenuCommand(this, ("Copy " + person->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
125 new FXMenuSeparator(this);
126 // build selection and show parameters menu
127 person->getNet()->getViewNet()->buildSelectionACPopupEntry(this, person);
128 person->buildShowParamsPopupEntry(this);
129 // add transform functions only in demand mode
131 // create menu pane for transform operations
132 FXMenuPane* transformOperation = new FXMenuPane(this);
133 this->insertMenuPaneChild(transformOperation);
134 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
135 // Create menu comands for all transformations
138 }
139}
140
141
143
144
145long
147 // iterate over all selected persons
148 for (const auto& i : mySelectedPersons) {
149 if ((obj == myTransformToPerson) &&
150 (i->getTagProperty().getTag() == myPersonTag)) {
152 } else if ((obj == myTransformToPersonFlow) &&
153 (i->getTagProperty().getTag() == myPersonTag)) {
155 }
156 }
157 return 1;
158}
159
160// ===========================================================================
161// member method definitions
162// ===========================================================================
163
166 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}) {
167 // reset default values
168 resetDefaultValues();
169 // set end and vehPerHours
170 toggleAttribute(SUMO_ATTR_END, 1);
171 toggleAttribute(SUMO_ATTR_PERSONSPERHOUR, 1);
172}
173
174
176 GNEDemandElement(personparameters.id, net, (tag == SUMO_TAG_PERSONFLOW) ? GLO_PERSONFLOW : GLO_PERSON, tag,
178 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {pType}, {}),
179SUMOVehicleParameter(personparameters) {
180 // set manually vtypeID (needed for saving)
181 vtypeid = pType->getID();
182 // adjust default flow attributes
184}
185
186
188
189
192 // check first person plan
193 if (getChildDemandElements().front()->getTagProperty().isStopPerson()) {
194 return nullptr;
195 } else {
196 // get lane
197 const GNELane* lane = getChildDemandElements().front()->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
198 // declare departPos
199 double posOverLane = 0;
200 if (canParse<double>(getDepartPos())) {
201 posOverLane = parse<double>(getDepartPos());
202 }
203 // return move operation
204 return new GNEMoveOperation(this, lane, posOverLane, false);
205 }
206}
207
208
209std::string
211 // obtain depart
212 std::string departStr = depart < 0 ? "0.00" : time2string(depart);
213 // we need to handle depart as a tuple of 20 numbers (format: 000000...00<departTime>)
214 departStr.reserve(20 - departStr.size());
215 // add 0s at the beginning of departStr until we have 20 numbers
216 for (int i = (int)departStr.size(); i < 20; i++) {
217 departStr.insert(departStr.begin(), '0');
218 }
219 return departStr;
220}
221
222
223void
225 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
227 // unset VType parameter
228 parametersSet &= ~VEHPARS_VTYPE_SET;
229 // write person attributes (VType will not be written)
231 // set VType parameter again
233 } else {
234 // write person attributes, including VType
236 }
237 // write specific flow attributes
239 // write routeFlow values depending if it was set
242 }
245 }
248 }
251 }
254 }
257 }
258 }
259 // write parameters
260 writeParams(device);
261 // write child demand elements associated to this person (Rides, Walks...)
262 for (const auto& i : getChildDemandElements()) {
263 i->writeDemandElement(device);
264 }
265 // close person tag
266 device.closeTag();
267}
268
269
272 if (getChildDemandElements().size() == 0) {
273 return Problem::NO_PLANS;
274 } else {
275 return Problem::OK;
276 }
277}
278
279
280std::string
282 if (getChildDemandElements().size() == 0) {
283 return "Person needs at least one plan";
284 } else {
285 return "";
286 }
287}
288
289
290void
292 // nothing to fix
293}
294
295
298 return getParentDemandElements().front()->getVClass();
299}
300
301
302const RGBColor&
304 return color;
305}
306
307
308void
310 // only update geometry of childrens
311 for (const auto& demandElement : getChildDemandElements()) {
312 demandElement->updateGeometry();
313 }
314}
315
316
321
322
325 // return a GNEPersonPopupMenu
326 return new GNEPersonPopupMenu(this, app, parent);
327}
328
329
330std::string
332 return getParentDemandElements().front()->getID();
333}
334
335
336double
338 return s.personSize.getExaggeration(s, this, 80);
339}
340
341
344 Boundary personBoundary;
345 if (getChildDemandElements().size() > 0) {
346 if (getChildDemandElements().front()->getTagProperty().isStopPerson()) {
347 // use boundary of stop center
348 return getChildDemandElements().front()->getCenteringBoundary();
349 } else {
350 personBoundary.add(getPositionInView());
351 }
352 } else {
353 personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
354 }
355 personBoundary.grow(20);
356 return personBoundary;
357}
358
359
360void
361GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
362 // geometry of this element cannot be splitted
363}
364
365
366void
368 bool drawPerson = true;
369 const auto personColor = setColor(s);
370 // check if person can be drawn
371 if (personColor.alpha() == 0) {
372 drawPerson = false;
374 drawPerson = false;
376 drawPerson = false;
378 drawPerson = false;
379 } else if (getChildDemandElements().empty()) {
380 drawPerson = false;
381 }
382 // continue if person can be drawn
383 if (drawPerson) {
384 // obtain exaggeration (and add the special personExaggeration)
385 const double exaggeration = getExaggeration(s) + s.detailSettings.personExaggeration;
386 // obtain width and length
387 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
388 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
389 // obtain diameter around person (used to calculate distance bewteen cursor and person)
390 const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
391 // obtain img file
392 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
393 // obtain position
394 const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
395 // check if person can be drawn
396 if (!(s.drawForPositionSelection && (personPosition.distanceSquaredTo(myNet->getViewNet()->getPositionInformation()) > distanceSquared))) {
397 // push GL ID
399 // push draw matrix
401 // Start with the drawing of the area traslating matrix to origin
403 // translate and rotate
404 glTranslated(personPosition.x(), personPosition.y(), 0);
405 glRotated(90, 0, 0, 1);
406 // set person color
407 GLHelper::setColor(personColor);
408 // set scale
409 glScaled(exaggeration, exaggeration, 1);
410 // draw person depending of detail level
411 if (s.personQuality >= 2) {
413 } else if (s.personQuality == 1) {
414 GUIBasePersonHelper::drawAction_drawAsCenteredCircle(length / 2, width / 2, s.scale * exaggeration);
415 } else if (s.personQuality == 0) {
417 }
418 // pop matrix
420 // draw stack label
421 if (myStackedLabelNumber > 0) {
422 drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
423 } else if ((getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
425 // declare counter for stacked persons over stops
426 int stackedCounter = 0;
427 // get stoppingPlace
428 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
429 // get stacked persons
430 for (const auto& stopPerson : stoppingPlace->getChildDemandElements()) {
431 if ((stopPerson->getTagProperty().getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
432 (stopPerson->getTagProperty().getTag() == GNE_TAG_STOPPERSON_TRAINSTOP)) {
433 // get person parent
434 const auto personParent = stopPerson->getParentDemandElements().front();
435 // check if the stop if the first person plan parent
436 if (stopPerson->getPreviousChildDemandElement(personParent) == nullptr) {
437 stackedCounter++;
438 }
439 }
440 }
441 // if we have more than two stacked elements, draw label
442 if (stackedCounter > 1) {
443 drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
444 }
445 }
446 // draw flow label
447 if (myTagProperty.isFlow()) {
448 drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s));
449 }
450 // draw line between junctions if person plan isn't valid
451 for (const auto& personPlan : getChildDemandElements()) {
452 if (personPlan->getTagProperty().isPersonPlan() && (personPlan->getParentJunctions().size() > 0) && !myNet->getPathManager()->isPathValid(personPlan)) {
453 drawJunctionLine(personPlan);
454 }
455 }
456 // pop name
458 // draw name
459 drawName(personPosition, s.scale, s.personName, s.angle);
460 if (s.personValue.show(this)) {
461 Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
462 const double value = getColorValue(s, s.personColorer.getActive());
463 GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
464 }
465 // draw lock icon
466 GNEViewNetHelper::LockIcon::drawLockIcon(this, getType(), personPosition, exaggeration);
467 // check if mouse is over element
468 mouseWithinGeometry(personPosition, 0.5, 0.5, 0, 0, 0);
469 // inspect contour
471 // draw using drawDottedSquaredShape
472 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::INSPECT, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
473 }
474 // front element contour
475 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
476 // draw using drawDottedSquaredShape
477 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::FRONT, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
478 }
479 // delete contour
480 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
481 // draw using drawDottedSquaredShape
482 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::REMOVE, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
483 }
484 // select contour
485 if (myNet->getViewNet()->drawSelectContour(this, this)) {
486 // draw using drawDottedSquaredShape
487 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::SELECT, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
488 }
489 }
490 }
491}
492
493
494void
496 // compute all person plan children (because aren't computed in "computeDemandElements()")
497 for (const auto& demandElement : getChildDemandElements()) {
498 demandElement->computePathElement();
499 }
500}
501
502
503void
504GNEPerson::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*lane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
505 // Stops don't use drawPartialGL
506}
507
508
509void
510GNEPerson::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*fromLane*/, const GNELane* /*toLane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
511 // Stops don't use drawPartialGL
512}
513
514
515GNELane*
517 // use path lane of first person plan
518 return getChildDemandElements().front()->getFirstPathLane();
519}
520
521
522GNELane*
524 // use path lane of first person plan
525 return getChildDemandElements().front()->getLastPathLane();
526}
527
528
529std::string
531 // declare string error
532 std::string error;
533 switch (key) {
534 case SUMO_ATTR_ID:
535 return getMicrosimID();
536 case SUMO_ATTR_TYPE:
537 return getTypeParent()->getID();
538 case SUMO_ATTR_COLOR:
540 return toString(color);
541 } else {
543 }
546 return getDepartPos();
547 } else {
549 }
550 // Specific of persons
551 case SUMO_ATTR_DEPART:
552 case SUMO_ATTR_BEGIN:
554 return "triggered";
556 return "containerTriggered";
558 return "now";
560 return "split";
562 return "begin";
563 } else {
564 return time2string(depart);
565 }
566 // Specific of personFlows
567 case SUMO_ATTR_END:
570 return toString(3600 / STEPS2TIME(repetitionOffset));
571 case SUMO_ATTR_PERIOD:
572 case GNE_ATTR_POISSON:
574 case SUMO_ATTR_PROB:
576 case SUMO_ATTR_NUMBER:
578 //
582 return getParametersStr();
583 default:
584 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
585 }
586}
587
588
589double
591 switch (key) {
592 case SUMO_ATTR_DEPART:
593 case SUMO_ATTR_BEGIN:
594 return STEPS2TIME(depart);
597 return departPos;
598 } else {
599 return 0;
600 }
601 default:
602 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
603 }
604}
605
606
609 switch (key) {
610 case SUMO_ATTR_DEPARTPOS: {
611 // get person plan
612 const GNEDemandElement* personPlan = getChildDemandElements().front();
613 // first check if first person plan is a stop
614 if (personPlan->getTagProperty().isStopPerson()) {
615 return personPlan->getPositionInView();
616 } else if (personPlan->getParentJunctions().size() > 0) {
617 return personPlan->getParentJunctions().front()->getPositionInView();
618 } else {
619 // declare lane lane
620 GNELane* lane = nullptr;
621 // update lane
622 if (personPlan->getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
623 lane = personPlan->getParentDemandElements().at(1)->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
624 } else {
625 lane = personPlan->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
626 }
627 // get position over lane shape
628 if (departPos <= 0) {
629 return lane->getLaneShape().front();
630 } else if (departPos >= lane->getLaneShape().length2D()) {
631 return lane->getLaneShape().back();
632 } else {
634 }
635 }
636 }
637 default:
638 throw InvalidArgument(getTagStr() + " doesn't have a Position attribute of type '" + toString(key) + "'");
639 }
640}
641
642
643void
644GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
645 switch (key) {
646 case SUMO_ATTR_ID:
647 case SUMO_ATTR_TYPE:
648 case SUMO_ATTR_COLOR:
650 // Specific of persons
651 case SUMO_ATTR_DEPART:
652 case SUMO_ATTR_BEGIN:
653 // Specific of personFlows
654 case SUMO_ATTR_END:
655 case SUMO_ATTR_NUMBER:
657 case SUMO_ATTR_PERIOD:
658 case GNE_ATTR_POISSON:
659 case SUMO_ATTR_PROB:
660 //
663 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
664 break;
665 default:
666 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
667 }
668}
669
670
671bool
672GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
673 // declare string error
674 std::string error;
675 switch (key) {
676 case SUMO_ATTR_ID:
677 if (value == getID()) {
678 return true;
679 } else if (SUMOXMLDefinitions::isValidVehicleID(value)) {
680 return (demandElementExist(value, {SUMO_TAG_PERSON, SUMO_TAG_PERSONFLOW}) == false);
681 } else {
682 return false;
683 }
684 case SUMO_ATTR_TYPE:
687 } else {
688 return false;
689 }
690 case SUMO_ATTR_COLOR:
691 return canParse<RGBColor>(value);
692 case SUMO_ATTR_DEPARTPOS: {
693 double dummyDepartPos;
694 DepartPosDefinition dummyDepartPosProcedure;
695 parseDepartPos(value, toString(SUMO_TAG_PERSON), id, dummyDepartPos, dummyDepartPosProcedure, error);
696 // if error is empty, given value is valid
697 return error.empty();
698 }
699 // Specific of persons
700 case SUMO_ATTR_DEPART:
701 case SUMO_ATTR_BEGIN: {
702 SUMOTime dummyDepart;
703 DepartDefinition dummyDepartProcedure;
704 parseDepart(value, toString(SUMO_TAG_PERSON), id, dummyDepart, dummyDepartProcedure, error);
705 // if error is empty, given value is valid
706 return error.empty();
707 }
708 // Specific of personflows
709 case SUMO_ATTR_END:
710 if (canParse<double>(value)) {
711 return (parse<double>(value) >= 0);
712 } else {
713 return false;
714 }
716 if (canParse<double>(value)) {
717 return (parse<double>(value) > 0);
718 } else {
719 return false;
720 }
721 case SUMO_ATTR_PERIOD:
722 case GNE_ATTR_POISSON:
723 if (canParse<double>(value)) {
724 return (parse<double>(value) > 0);
725 } else {
726 return false;
727 }
728 case SUMO_ATTR_PROB:
729 if (canParse<double>(value)) {
730 const double prob = parse<double>(value);
731 return ((prob >= 0) && (prob <= 1));
732 } else {
733 return false;
734 }
735 case SUMO_ATTR_NUMBER:
736 if (canParse<int>(value)) {
737 return (parse<int>(value) >= 0);
738 } else {
739 return false;
740 }
741 //
743 return canParse<bool>(value);
746 default:
747 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
748 }
749}
750
751
752void
754 switch (key) {
755 case SUMO_ATTR_END:
756 case SUMO_ATTR_NUMBER:
758 case SUMO_ATTR_PERIOD:
759 case GNE_ATTR_POISSON:
760 case SUMO_ATTR_PROB:
761 undoList->add(new GNEChange_EnableAttribute(this, key, true, parametersSet), true);
762 return;
763 default:
764 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
765 }
766}
767
768
769void
771 switch (key) {
772 case SUMO_ATTR_END:
773 case SUMO_ATTR_NUMBER:
775 case SUMO_ATTR_PERIOD:
776 case GNE_ATTR_POISSON:
777 case SUMO_ATTR_PROB:
778 undoList->add(new GNEChange_EnableAttribute(this, key, false, parametersSet), true);
779 return;
780 default:
781 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
782 }
783}
784
785
786bool
788 switch (key) {
789 case SUMO_ATTR_END:
790 return (parametersSet & VEHPARS_END_SET) != 0;
791 case SUMO_ATTR_NUMBER:
792 return (parametersSet & VEHPARS_NUMBER_SET) != 0;
794 return (parametersSet & VEHPARS_VPH_SET) != 0;
795 case SUMO_ATTR_PERIOD:
796 return (parametersSet & VEHPARS_PERIOD_SET) != 0;
797 case GNE_ATTR_POISSON:
798 return (parametersSet & VEHPARS_POISSON_SET) != 0;
799 case SUMO_ATTR_PROB:
800 return (parametersSet & VEHPARS_PROB_SET) != 0;
801 default:
802 return true;
803 }
804}
805
806
807std::string
809 return getTagStr();
810}
811
812
813std::string
815 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
816}
817
818
823
824// ===========================================================================
825// protected
826// ===========================================================================
827
830 const GUIColorer& c = s.personColorer;
831 /*
832 if (!setFunctionalColor(c.getActive())) {
833 return c.getScheme().getColor(getColorValue(s, c.getActive()));
834 }
835 */
836 return c.getScheme().getColor(getColorValue(s, c.getActive()));
837}
838
839
840bool
841GNEPerson::setFunctionalColor(int /* activeScheme */) const {
842 /*
843 switch (activeScheme) {
844 case 0: {
845 if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
846 GLHelper::setColor(getParameter().color);
847 return true;
848 }
849 if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
850 GLHelper::setColor(getVehicleType().getColor());
851 return true;
852 }
853 return false;
854 }
855 case 2: {
856 if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
857 GLHelper::setColor(getParameter().color);
858 return true;
859 }
860 return false;
861 }
862 case 3: {
863 if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
864 GLHelper::setColor(getVehicleType().getColor());
865 return true;
866 }
867 return false;
868 }
869 case 8: { // color by angle
870 double hue = GeomHelper::naviDegree(getAngle());
871 GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.));
872 return true;
873 }
874 case 9: { // color randomly (by pointer)
875 const double hue = (long)this % 360; // [0-360]
876 const double sat = (((long)this / 360) % 67) / 100.0 + 0.33; // [0.33-1]
877 GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
878 return true;
879 }
880 default:
881 return false;
882 }
883 */
884 return false;
885}
886
887// ===========================================================================
888// private
889// ===========================================================================
890
892 personPlan(_personPlan),
893 edge(nullptr),
894 arrivalPos(-1) {
895}
896
897
899 personPlan(nullptr),
900 edge(nullptr),
901 arrivalPos(-1) {
902}
903
904
905void
906GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
907 // declare string error
908 std::string error;
909 switch (key) {
910 case SUMO_ATTR_ID:
911 // update microsimID
912 setMicrosimID(value);
913 // update id
914 id = value;
915 // Change IDs of all person plans children
916 for (const auto& personPlans : getChildDemandElements()) {
917 personPlans->setMicrosimID(getID());
918 }
919 break;
920 case SUMO_ATTR_TYPE:
921 if (getID().size() > 0) {
923 // set manually vtypeID (needed for saving)
924 vtypeid = value;
925 }
926 break;
927 case SUMO_ATTR_COLOR:
928 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
929 color = parse<RGBColor>(value);
930 // mark parameter as set
932 } else {
933 // set default value
934 color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
935 // unset parameter
936 parametersSet &= ~VEHPARS_COLOR_SET;
937 }
938 break;
940 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
942 // mark parameter as set
944 } else {
945 // set default value
947 // unset parameter
948 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
949 }
950 // compute person
952 break;
953 // Specific of persons
954 case SUMO_ATTR_DEPART:
955 case SUMO_ATTR_BEGIN: {
957 break;
958 }
959 // Specific of personFlows
960 case SUMO_ATTR_END:
961 repetitionEnd = string2time(value);
962 break;
964 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
965 break;
966 case SUMO_ATTR_PERIOD:
967 case GNE_ATTR_POISSON:
969 break;
970 case SUMO_ATTR_PROB:
971 repetitionProbability = parse<double>(value);
972 break;
973 case SUMO_ATTR_NUMBER:
974 repetitionNumber = parse<int>(value);
975 break;
976 //
978 if (parse<bool>(value)) {
980 } else {
982 }
983 break;
985 setParametersStr(value);
986 break;
987 default:
988 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
989 }
990}
991
992
993void
995 // set flow parameters
996 setFlowParameters(this, key, value);
997}
998
999
1001 // change departPos
1003 departPos = moveResult.newFirstPos;
1004 // update geometry
1006}
1007
1008
1009void
1011 undoList->begin(myTagProperty.getGUIIcon(), "departPos of " + getTagStr());
1012 // now set departPos
1013 setAttribute(SUMO_ATTR_DEPARTPOS, toString(moveResult.newFirstPos), undoList);
1014 undoList->end();
1015}
1016
1017/****************************************************************************/
FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[]
long long int SUMOTime
Definition GUI.h:36
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition GUIAppEnum.h:450
@ MID_GNE_PERSON_TRANSFORM
transform person to another person type (ej: person to personflow)
@ MID_COPY_NAME
Copy object name - popup entry.
Definition GUIAppEnum.h:448
@ GLO_MAX
empty max
@ GLO_PERSON
a person
@ GLO_PERSONFLOW
a person flow
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define STEPS2TIME(x)
Definition SUMOTime.h:55
#define TIME2STEPS(x)
Definition SUMOTime.h:57
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
const std::string DEFAULT_PEDTYPE_ID
@ PEDESTRIAN
render as a pedestrian
const int VEHPARS_PROB_SET
const int VEHPARS_VPH_SET
const int VEHPARS_END_SET
const int VEHPARS_COLOR_SET
const int VEHPARS_POISSON_SET
DepartPosDefinition
Possible ways to choose the departure position.
@ GIVEN
The position is given.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_NUMBER_SET
const int VEHPARS_PERIOD_SET
const int VEHPARS_VTYPE_SET
DepartDefinition
Possible ways to depart.
@ BEGIN
The departure is at simulation start.
@ NOW
The vehicle is discarded if emission fails (not fully implemented yet)
@ SPLIT
The departure is triggered by a train split.
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ GNE_TAG_STOPPERSON_BUSSTOP
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_PERSON
@ GNE_TAG_STOPPERSON_TRAINSTOP
@ GNE_TAG_WALK_ROUTE
@ SUMO_TAG_PERSONFLOW
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_NUMBER
@ SUMO_ATTR_DEPART
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ GNE_ATTR_POISSON
poisson definition (used in flow)
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_PROB
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSONSPERHOUR
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
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:300
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:583
static void pushName(unsigned int name)
push Name
Definition GLHelper.cpp:139
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void popName()
pop Name
Definition GLHelper.cpp:148
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition GLHelper.cpp:716
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_EnableAttribute
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
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * myNet
pointer to net
GNENet * getNet() const
get 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
void drawStackLabel(const int number, const std::string &element, const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw stack label
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void drawFlowLabel(const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw flow label
void drawJunctionLine(const GNEDemandElement *element) const
draw line between junctions
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEDemandElement * getTypeParent() const
get type parent (needed because first parent can be either type or typeDistribution)
bool demandElementExist(const std::string &id, const std::vector< SumoXMLTag > tags) const
check if the given demand element exist
int myStackedLabelNumber
stacked label number
virtual Position getPositionInView() const =0
Returns position of demand element in view.
Problem
enum class for demandElement problems
void adjustDefaultFlowAttributes(SUMOVehicleParameter *vehicleParameters)
adjust flow default attributes (called in vehicle/person/flow constructors)
void setFlowParameters(SUMOVehicleParameter *vehicleParameters, const SumoXMLAttr attribute, const bool value)
set flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers
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< GNEEdge * > & getParentEdges() const
get parent edges
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
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPathManager * getPathManager()
get path manager
Definition GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
PathElement()=delete
invalidate default constructor
bool isPathValid(const PathElement *pathElement) const
check if path element is valid
class used in GUIGLObjectPopupMenu for person transformations
Definition GNEPerson.h:37
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition GNEPerson.cpp:97
class used in GUIGLObjectPopupMenu for single person transformations
Definition GNEPerson.h:69
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition GNEPerson.h:98
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition GNEPerson.h:101
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEMoveOperation * getMoveOperation()
get move operation
Position getPositionInView() const
Returns position of demand element in view.
void updateGeometry()
update pre-computed geometry information
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
const RGBColor & getColor() const
get color
bool isAttributeEnabled(SumoXMLAttr key) const
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
GNELane * getLastPathLane() const
get last path lane
Position getAttributePosition(SumoXMLAttr key) const
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getBegin() const
get begin time of demand element
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEPerson()
destructor
SUMOVehicleClass getVClass() const
void computePathElement()
compute pathElement
std::string getParentName() const
Returns the name of the parent object.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
const Parameterised::Map & getACParametersMap() const
get parameters map
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
double getAttributeDouble(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
GNELane * getFirstPathLane() const
get first path lane
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
bool isFlow() const
return true if tag correspond to a flow element
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isStopPerson() const
return true if tag correspond to a person stop element
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
SumoXMLTag getXMLTag() const
get XML tag
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 add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static void drawAction_drawAsImage(const double angle, const double length, const double width, const std::string &file, const SUMOVehicleShape guiShape, const double exaggeration)
static void drawAction_drawAsCenteredCircle(const double length, const double width, double detail)
static void drawAction_drawAsTriangle(const double angle, const double length, const double width)
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
static void drawDottedSquaredShape(const GUIVisualizationSettings &s, const DottedContourType type, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual double getColorValue(const GUIVisualizationSettings &, int) const
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
T getColor(const double value) const
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings personValue
GUIVisualizationDetailSettings detailSettings
detail settings
int personQuality
The quality of person drawing.
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationSizeSettings personSize
GUIColorer personColorer
The person colorer.
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
Definition Position.h:249
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Structure representing possible vehicle parameter.
double repetitionProbability
The probability for emitting a vehicle per second.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
SumoXMLTag tag
The vehicle tag.
std::string vtypeid
The vehicle's type id.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
double departPos
(optional) The position the vehicle shall depart from
RGBColor color
The vehicle's color, TraCI may change this.
double arrivalPos
(optional) The position the vehicle shall arrive on
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error, const std::string &attr="departure")
Validates a given depart value.
bool wasSet(int what) const
Returns whether the given parameter was set.
std::string getDepartPos() const
obtain depart pos parameter in string format
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool showDemandElements() const
check if show demand elements checkbox is enabled
static const double personExaggeration
Exaggeration for persons (only used in netedit)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size