Eclipse SUMO - Simulation of Urban MObility
GNEPerson.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// 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// ===========================================================================
41FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[] = {
43};
44
45FXDEFMAP(GNEPerson::GNESelectedPersonsPopupMenu) selectedPersonsPopupMenuMap[] = {
47};
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
320}
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 // check if person can be drawn
371 drawPerson = false;
373 drawPerson = false;
375 drawPerson = false;
376 } else if (getChildDemandElements().empty()) {
377 drawPerson = false;
378 }
379 // continue if person can be drawn
380 if (drawPerson) {
381 // obtain exaggeration (and add the special personExaggeration)
382 const double exaggeration = getExaggeration(s) + s.detailSettings.personExaggeration;
383 // obtain width and length
384 const double length = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_LENGTH);
385 const double width = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_WIDTH);
386 // obtain diameter around person (used to calculate distance bewteen cursor and person)
387 const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
388 // obtain img file
389 const std::string file = getParentDemandElements().at(0)->getAttribute(SUMO_ATTR_IMGFILE);
390 // obtain position
391 const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
392 // check if person can be drawn
393 if (!(s.drawForPositionSelection && (personPosition.distanceSquaredTo(myNet->getViewNet()->getPositionInformation()) > distanceSquared))) {
394 // push GL ID
396 // push draw matrix
398 // Start with the drawing of the area traslating matrix to origin
400 // translate and rotate
401 glTranslated(personPosition.x(), personPosition.y(), 0);
402 glRotated(90, 0, 0, 1);
403 // set person color
404 setColor(s);
405 // set scale
406 glScaled(exaggeration, exaggeration, 1);
407 // draw person depending of detail level
408 if (s.personQuality >= 2) {
410 } else if (s.personQuality == 1) {
411 GUIBasePersonHelper::drawAction_drawAsCenteredCircle(length / 2, width / 2, s.scale * exaggeration);
412 } else if (s.personQuality == 0) {
414 }
415 // pop matrix
417 // draw line between junctions if person plan isn't valid
418 for (const auto& personPlan : getChildDemandElements()) {
419 if (personPlan->getTagProperty().isPersonPlan() && (personPlan->getParentJunctions().size() > 0) && !myNet->getPathManager()->isPathValid(personPlan)) {
420 drawJunctionLine(personPlan);
421 }
422 }
423 // pop name
425 // draw name
426 drawName(personPosition, s.scale, s.personName, s.angle);
427 if (s.personValue.show(this)) {
428 Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
429 const double value = getColorValue(s, s.personColorer.getActive());
430 GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
431 }
432 // draw lock icon
433 GNEViewNetHelper::LockIcon::drawLockIcon(this, getType(), personPosition, exaggeration);
434 // check if mouse is over element
435 mouseWithinGeometry(personPosition, 0.5, 0.5, 0, 0, 0);
436 // inspect contour
438 // draw using drawDottedSquaredShape
439 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::INSPECT, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
440 }
441 // front element contour
442 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
443 // draw using drawDottedSquaredShape
444 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::FRONT, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
445 }
446 // delete contour
447 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
448 // draw using drawDottedSquaredShape
449 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::REMOVE, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
450 }
451 // select contour
452 if (myNet->getViewNet()->drawSelectContour(this, this)) {
453 // draw using drawDottedSquaredShape
454 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::SELECT, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
455 }
456 }
457 }
458}
459
460
461void
463 // compute all person plan children (because aren't computed in "computeDemandElements()")
464 for (const auto& demandElement : getChildDemandElements()) {
465 demandElement->computePathElement();
466 }
467}
468
469
470void
471GNEPerson::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*lane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
472 // Stops don't use drawPartialGL
473}
474
475
476void
477GNEPerson::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*fromLane*/, const GNELane* /*toLane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
478 // Stops don't use drawPartialGL
479}
480
481
482GNELane*
484 // use path lane of first person plan
485 return getChildDemandElements().front()->getFirstPathLane();
486}
487
488
489GNELane*
491 // use path lane of first person plan
492 return getChildDemandElements().front()->getLastPathLane();
493}
494
495
496std::string
498 // declare string error
499 std::string error;
500 switch (key) {
501 case SUMO_ATTR_ID:
502 return getMicrosimID();
503 case SUMO_ATTR_TYPE:
504 return getParentDemandElements().at(0)->getID();
505 case SUMO_ATTR_COLOR:
507 return toString(color);
508 } else {
510 }
513 return getDepartPos();
514 } else {
516 }
517 // Specific of persons
518 case SUMO_ATTR_DEPART:
519 case SUMO_ATTR_BEGIN:
521 return "triggered";
523 return "containerTriggered";
525 return "split";
527 return "now";
528 } else {
529 return time2string(depart);
530 }
531 // Specific of personFlows
532 case SUMO_ATTR_END:
535 return toString(3600 / STEPS2TIME(repetitionOffset));
536 case SUMO_ATTR_PERIOD:
537 case GNE_ATTR_POISSON:
539 case SUMO_ATTR_PROB:
541 case SUMO_ATTR_NUMBER:
543 //
547 return getParametersStr();
548 default:
549 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
550 }
551}
552
553
554double
556 switch (key) {
557 case SUMO_ATTR_DEPART:
558 case SUMO_ATTR_BEGIN:
559 return STEPS2TIME(depart);
562 return departPos;
563 } else {
564 return 0;
565 }
566 default:
567 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
568 }
569}
570
571
574 switch (key) {
575 case SUMO_ATTR_DEPARTPOS: {
576 // get person plan
577 const GNEDemandElement* personPlan = getChildDemandElements().front();
578 // first check if first person plan is a stop
579 if (personPlan->getTagProperty().isStopPerson()) {
580 return personPlan->getPositionInView();
581 } else if (personPlan->getParentJunctions().size() > 0) {
582 return personPlan->getParentJunctions().front()->getPositionInView();
583 } else {
584 // declare lane lane
585 GNELane* lane = nullptr;
586 // update lane
587 if (personPlan->getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
588 lane = personPlan->getParentDemandElements().at(1)->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
589 } else {
590 lane = personPlan->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
591 }
592 // get position over lane shape
593 if (departPos <= 0) {
594 return lane->getLaneShape().front();
595 } else if (departPos >= lane->getLaneShape().length2D()) {
596 return lane->getLaneShape().back();
597 } else {
599 }
600 }
601 }
602 default:
603 throw InvalidArgument(getTagStr() + " doesn't have a Position attribute of type '" + toString(key) + "'");
604 }
605}
606
607
608void
609GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
610 switch (key) {
611 case SUMO_ATTR_ID:
612 case SUMO_ATTR_TYPE:
613 case SUMO_ATTR_COLOR:
615 // Specific of persons
616 case SUMO_ATTR_DEPART:
617 case SUMO_ATTR_BEGIN:
618 // Specific of personFlows
619 case SUMO_ATTR_END:
620 case SUMO_ATTR_NUMBER:
622 case SUMO_ATTR_PERIOD:
623 case GNE_ATTR_POISSON:
624 case SUMO_ATTR_PROB:
625 //
628 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
629 break;
630 default:
631 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
632 }
633}
634
635
636bool
637GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
638 // declare string error
639 std::string error;
640 switch (key) {
641 case SUMO_ATTR_ID:
642 // Persons and personflows share namespace
644 (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) == nullptr) &&
646 return true;
647 } else {
648 return false;
649 }
650 case SUMO_ATTR_TYPE:
652 case SUMO_ATTR_COLOR:
653 return canParse<RGBColor>(value);
654 case SUMO_ATTR_DEPARTPOS: {
655 double dummyDepartPos;
656 DepartPosDefinition dummyDepartPosProcedure;
657 parseDepartPos(value, toString(SUMO_TAG_PERSON), id, dummyDepartPos, dummyDepartPosProcedure, error);
658 // if error is empty, given value is valid
659 return error.empty();
660 }
661 // Specific of persons
662 case SUMO_ATTR_DEPART:
663 case SUMO_ATTR_BEGIN: {
664 SUMOTime dummyDepart;
665 DepartDefinition dummyDepartProcedure;
666 parseDepart(value, toString(SUMO_TAG_PERSON), id, dummyDepart, dummyDepartProcedure, error);
667 // if error is empty, given value is valid
668 return error.empty();
669 }
670 // Specific of personflows
671 case SUMO_ATTR_END:
672 if (canParse<double>(value)) {
673 return (parse<double>(value) >= 0);
674 } else {
675 return false;
676 }
678 if (canParse<double>(value)) {
679 return (parse<double>(value) > 0);
680 } else {
681 return false;
682 }
683 case SUMO_ATTR_PERIOD:
684 case GNE_ATTR_POISSON:
685 if (canParse<double>(value)) {
686 return (parse<double>(value) > 0);
687 } else {
688 return false;
689 }
690 case SUMO_ATTR_PROB:
691 if (canParse<double>(value)) {
692 const double prob = parse<double>(value);
693 return ((prob >= 0) && (prob <= 1));
694 } else {
695 return false;
696 }
697 case SUMO_ATTR_NUMBER:
698 if (canParse<int>(value)) {
699 return (parse<int>(value) >= 0);
700 } else {
701 return false;
702 }
703 //
705 return canParse<bool>(value);
708 default:
709 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
710 }
711}
712
713
714void
716 switch (key) {
717 case SUMO_ATTR_END:
718 case SUMO_ATTR_NUMBER:
720 case SUMO_ATTR_PERIOD:
721 case GNE_ATTR_POISSON:
722 case SUMO_ATTR_PROB:
723 undoList->add(new GNEChange_EnableAttribute(this, key, true, parametersSet), true);
724 return;
725 default:
726 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
727 }
728}
729
730
731void
733 switch (key) {
734 case SUMO_ATTR_END:
735 case SUMO_ATTR_NUMBER:
737 case SUMO_ATTR_PERIOD:
738 case GNE_ATTR_POISSON:
739 case SUMO_ATTR_PROB:
740 undoList->add(new GNEChange_EnableAttribute(this, key, false, parametersSet), true);
741 return;
742 default:
743 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
744 }
745}
746
747
748bool
750 switch (key) {
751 case SUMO_ATTR_END:
752 return (parametersSet & VEHPARS_END_SET) != 0;
753 case SUMO_ATTR_NUMBER:
754 return (parametersSet & VEHPARS_NUMBER_SET) != 0;
756 return (parametersSet & VEHPARS_VPH_SET) != 0;
757 case SUMO_ATTR_PERIOD:
758 return (parametersSet & VEHPARS_PERIOD_SET) != 0;
759 case GNE_ATTR_POISSON:
760 return (parametersSet & VEHPARS_POISSON_SET) != 0;
761 case SUMO_ATTR_PROB:
762 return (parametersSet & VEHPARS_PROB_SET) != 0;
763 default:
764 return true;
765 }
766}
767
768
769std::string
771 return getTagStr();
772}
773
774
775std::string
777 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
778}
779
780
783 return getParametersMap();
784}
785
786// ===========================================================================
787// protected
788// ===========================================================================
789
790void
792 const GUIColorer& c = s.personColorer;
793 if (!setFunctionalColor(c.getActive())) {
795 }
796}
797
798
799bool
800GNEPerson::setFunctionalColor(int /* activeScheme */) const {
801 /*
802 switch (activeScheme) {
803 case 0: {
804 if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
805 GLHelper::setColor(getParameter().color);
806 return true;
807 }
808 if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
809 GLHelper::setColor(getVehicleType().getColor());
810 return true;
811 }
812 return false;
813 }
814 case 2: {
815 if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
816 GLHelper::setColor(getParameter().color);
817 return true;
818 }
819 return false;
820 }
821 case 3: {
822 if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
823 GLHelper::setColor(getVehicleType().getColor());
824 return true;
825 }
826 return false;
827 }
828 case 8: { // color by angle
829 double hue = GeomHelper::naviDegree(getAngle());
830 GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.));
831 return true;
832 }
833 case 9: { // color randomly (by pointer)
834 const double hue = (long)this % 360; // [0-360]
835 const double sat = (((long)this / 360) % 67) / 100.0 + 0.33; // [0.33-1]
836 GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
837 return true;
838 }
839 default:
840 return false;
841 }
842 */
843 return false;
844}
845
846// ===========================================================================
847// private
848// ===========================================================================
849
851 personPlan(_personPlan),
852 edge(nullptr),
853 arrivalPos(-1) {
854}
855
856
858 personPlan(nullptr),
859 edge(nullptr),
860 arrivalPos(-1) {
861}
862
863
864void
865GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
866 // declare string error
867 std::string error;
868 switch (key) {
869 case SUMO_ATTR_ID:
870 // update microsimID
871 setMicrosimID(value);
872 // update id
873 id = value;
874 // Change IDs of all person plans children
875 for (const auto& personPlans : getChildDemandElements()) {
876 personPlans->setMicrosimID(getID());
877 }
878 break;
879 case SUMO_ATTR_TYPE:
880 if (getID().size() > 0) {
882 // set manually vtypeID (needed for saving)
883 vtypeid = value;
884 }
885 break;
886 case SUMO_ATTR_COLOR:
887 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
888 color = parse<RGBColor>(value);
889 // mark parameter as set
891 } else {
892 // set default value
893 color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
894 // unset parameter
895 parametersSet &= ~VEHPARS_COLOR_SET;
896 }
897 break;
899 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
901 // mark parameter as set
903 } else {
904 // set default value
906 // unset parameter
907 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
908 }
909 // compute person
911 break;
912 // Specific of persons
913 case SUMO_ATTR_DEPART:
914 case SUMO_ATTR_BEGIN: {
916 break;
917 }
918 // Specific of personFlows
919 case SUMO_ATTR_END:
920 repetitionEnd = string2time(value);
921 break;
923 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
924 break;
925 case SUMO_ATTR_PERIOD:
926 case GNE_ATTR_POISSON:
928 break;
929 case SUMO_ATTR_PROB:
930 repetitionProbability = parse<double>(value);
931 break;
932 case SUMO_ATTR_NUMBER:
933 repetitionNumber = parse<int>(value);
934 break;
935 //
937 if (parse<bool>(value)) {
939 } else {
941 }
942 break;
944 setParametersStr(value);
945 break;
946 default:
947 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
948 }
949}
950
951
952void
954 // set flow parameters
955 setFlowParameters(this, key, value);
956}
957
958
959void GNEPerson::setMoveShape(const GNEMoveResult& moveResult) {
960 // change departPos
962 departPos = moveResult.newFirstPos;
963 // update geometry
965}
966
967
968void
970 undoList->begin(myTagProperty.getGUIIcon(), "departPos of " + getTagStr());
971 // now set departPos
973 undoList->end();
974}
975
976/****************************************************************************/
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)
Definition: GUIAppEnum.h:1285
@ 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
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define STEPS2TIME(x)
Definition: SUMOTime.h:54
#define TIME2STEPS(x)
Definition: SUMOTime.h:56
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.
@ 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
@ SUMO_TAG_PERSON
@ 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 drawJunctionLine(const GNEDemandElement *element) const
draw line between junctions
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:142
move operation
move result
double newFirstPos
new first position
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
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
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:93
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.
Definition: GNEPerson.cpp:111
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:146
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.
Definition: GNEPerson.cpp:367
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEPerson.cpp:471
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPerson.cpp:969
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEPerson.cpp:191
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:318
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:309
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEPerson.cpp:337
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:303
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:749
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEPerson.cpp:224
GNELane * getLastPathLane() const
get last path lane
Definition: GNEPerson.cpp:490
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEPerson.cpp:573
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:791
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:291
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:953
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPerson.cpp:959
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:800
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:776
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:210
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:715
~GNEPerson()
destructor
Definition: GNEPerson.cpp:187
SUMOVehicleClass getVClass() const
Definition: GNEPerson.cpp:297
void computePathElement()
compute pathElement
Definition: GNEPerson.cpp:462
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:331
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:637
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:361
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:732
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNEPerson.cpp:609
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEPerson.cpp:164
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:497
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEPerson.cpp:782
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:343
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:555
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:271
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEPerson.cpp:483
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:324
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:281
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:770
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
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
Definition: GNEViewNet.cpp:656
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:632
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
Definition: GNEViewNet.cpp:644
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.
Definition: GNEViewNet.cpp:474
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:650
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
Definition: GUIDesigns.cpp:42
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.
Definition: GUIGlObject.h:141
virtual double getColorValue(const GUIVisualizationSettings &, int) const
Definition: GUIGlObject.h:198
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 mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
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.
Definition: GUIGlObject.h:154
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.
Definition: GUIGlObject.h:102
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
const 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.
Definition: OptionsCont.cpp:59
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
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
Definition: Parameterised.h:45
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:247
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 isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
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