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>
27 #include <utils/gui/div/GLHelper.h>
32 
33 #include "GNEPerson.h"
34 #include "GNERouteHandler.h"
35 
36 
37 // ===========================================================================
38 // FOX callback mapping
39 // ===========================================================================
40 FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[] = {
42 };
43 
44 FXDEFMAP(GNEPerson::GNESelectedPersonsPopupMenu) selectedPersonsPopupMenuMap[] = {
46 };
47 
48 // Object implementation
49 FXIMPLEMENT(GNEPerson::GNEPersonPopupMenu, GUIGLObjectPopupMenu, personPopupMenuMap, ARRAYNUMBER(personPopupMenuMap))
50 FXIMPLEMENT(GNEPerson::GNESelectedPersonsPopupMenu, GUIGLObjectPopupMenu, selectedPersonsPopupMenuMap, ARRAYNUMBER(selectedPersonsPopupMenuMap))
51 
52 // ===========================================================================
53 // GNEPerson::GNEPersonPopupMenu
54 // ===========================================================================
55 
57  GUIGLObjectPopupMenu(app, parent, *person),
58  myPerson(person),
59  myTransformToPerson(nullptr),
60  myTransformToPersonFlow(nullptr) {
61  // build header
62  myPerson->buildPopupHeader(this, app);
63  // build menu command for center button and copy cursor position to clipboard
64  myPerson->buildCenterPopupEntry(this);
65  myPerson->buildPositionCopyEntry(this, false);
66  // buld menu commands for names
67  GUIDesigns::buildFXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
68  GUIDesigns::buildFXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
69  new FXMenuSeparator(this);
70  // build selection and show parameters menu
71  myPerson->getNet()->getViewNet()->buildSelectionACPopupEntry(this, myPerson);
72  myPerson->buildShowParamsPopupEntry(this);
73  // add transform functions only in demand mode
74  if (myPerson->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
75  // create menu pane for transform operations
76  FXMenuPane* transformOperation = new FXMenuPane(this);
77  this->insertMenuPaneChild(transformOperation);
78  new FXMenuCascade(this, "transform to", nullptr, transformOperation);
79  // Create menu comands for all transformations
80  myTransformToPerson = GUIDesigns::buildFXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(GUIIcon::PERSON), this, MID_GNE_PERSON_TRANSFORM);
81  myTransformToPersonFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "Person (embedded route)", GUIIconSubSys::getIcon(GUIIcon::PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
82  // check what menu command has to be disabled
83  if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSON) {
84  myTransformToPerson->disable();
85  } else if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSONFLOW) {
86  myTransformToPersonFlow->disable();
87  }
88  }
89 }
90 
91 
93 
94 
95 long
96 GNEPerson::GNEPersonPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
97  if (obj == myTransformToPerson) {
99  } else if (obj == myTransformToPersonFlow) {
101  }
102  return 1;
103 }
104 
105 
106 // ===========================================================================
107 // GNEPerson::GNESelectedPersonsPopupMenu
108 // ===========================================================================
109 
110 GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent) :
111  GUIGLObjectPopupMenu(app, parent, *person),
112  myPersonTag(person->getTagProperty().getTag()),
113  mySelectedPersons(selectedPerson),
114  myTransformToPerson(nullptr),
115  myTransformToPersonFlow(nullptr) {
116  // build header
117  person->buildPopupHeader(this, app);
118  // build menu command for center button and copy cursor position to clipboard
119  person->buildCenterPopupEntry(this);
120  person->buildPositionCopyEntry(this, false);
121  // buld menu commands for names
122  GUIDesigns::buildFXMenuCommand(this, ("Copy " + person->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
123  GUIDesigns::buildFXMenuCommand(this, ("Copy " + person->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
124  new FXMenuSeparator(this);
125  // build selection and show parameters menu
126  person->getNet()->getViewNet()->buildSelectionACPopupEntry(this, person);
127  person->buildShowParamsPopupEntry(this);
128  // add transform functions only in demand mode
129  if (person->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
130  // create menu pane for transform operations
131  FXMenuPane* transformOperation = new FXMenuPane(this);
132  this->insertMenuPaneChild(transformOperation);
133  new FXMenuCascade(this, "transform to", nullptr, transformOperation);
134  // Create menu comands for all transformations
137  }
138 }
139 
140 
142 
143 
144 long
146  // iterate over all selected persons
147  for (const auto& i : mySelectedPersons) {
148  if ((obj == myTransformToPerson) &&
149  (i->getTagProperty().getTag() == myPersonTag)) {
151  } else if ((obj == myTransformToPersonFlow) &&
152  (i->getTagProperty().getTag() == myPersonTag)) {
154  }
155  }
156  return 1;
157 }
158 
159 // ===========================================================================
160 // member method definitions
161 // ===========================================================================
162 
165 {}, {}, {}, {}, {}, {}, {}, {}) {
166  // reset default values
167  resetDefaultValues();
168 }
169 
170 
171 GNEPerson::GNEPerson(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters) :
172  GNEDemandElement(personparameters.id, net, (tag == SUMO_TAG_PERSONFLOW) ? GLO_PERSONFLOW : GLO_PERSON, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
173 {}, {}, {}, {}, {}, {}, {pType}, {}),
174 SUMOVehicleParameter(personparameters) {
175  // set manually vtypeID (needed for saving)
176  vtypeid = pType->getID();
177 }
178 
179 
181 
182 
185  // check first person plan
186  if (getChildDemandElements().front()->getTagProperty().isStopPerson()) {
187  return nullptr;
188  } else {
189  // get lane
190  const GNELane* lane = getChildDemandElements().front()->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
191  // declare departPos
192  double posOverLane = 0;
193  if (canParse<double>(getDepartPos())) {
194  posOverLane = parse<double>(getDepartPos());
195  }
196  // return move operation
197  return new GNEMoveOperation(this, lane, posOverLane, false);
198  }
199 }
200 
201 
202 std::string
204  // obtain depart depending if is a Person, trip or routeFlow
205  std::string departStr;
207  departStr = toString(depart);
208  } else {
209  departStr = getDepart();
210  }
211  // we need to handle depart as a tuple of 20 numbers (format: 000000...00<departTime>)
212  departStr.reserve(20 - departStr.size());
213  // add 0s at the beginning of departStr until we have 20 numbers
214  for (int i = (int)departStr.size(); i < 20; i++) {
215  departStr.insert(departStr.begin(), '0');
216  }
217  return departStr;
218 }
219 
220 
221 void
223  // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
225  // unset VType parameter
227  // write person attributes (VType will not be written)
229  // set VType parameter again
231  } else {
232  // write person attributes, including VType
234  }
235  // write specific flow attributes
237  // write routeFlow values depending if it was set
240  }
243  }
246  }
249  }
252  }
253  }
254  // write parameters
255  writeParams(device);
256  // write child demand elements associated to this person (Rides, Walks...)
257  for (const auto& i : getChildDemandElements()) {
258  i->writeDemandElement(device);
259  }
260  // close person tag
261  device.closeTag();
262 }
263 
264 
267  // a single person is always valid
268  return Problem::OK;
269 }
270 
271 
272 std::string
274  // A single person cannot habe problem (but their children)
275  return "";
276 }
277 
278 
279 void
281  // nothing to fix
282 }
283 
284 
287  return getParentDemandElements().front()->getVClass();
288 }
289 
290 
291 const RGBColor&
293  return color;
294 }
295 
296 
297 void
299  // only update geometry of childrens
300  for (const auto& demandElement : getChildDemandElements()) {
301  demandElement->updateGeometry();
302  }
303 }
304 
305 
306 Position
309 }
310 
311 
314  // return a GNEPersonPopupMenu
315  return new GNEPersonPopupMenu(this, app, parent);
316 }
317 
318 
319 std::string
321  return getParentDemandElements().front()->getID();
322 }
323 
324 
325 double
327  return s.personSize.getExaggeration(s, this, 80);
328 }
329 
330 
331 Boundary
333  Boundary personBoundary;
334  if (getChildDemandElements().size() > 0) {
335  if (getChildDemandElements().front()->getTagProperty().isStopPerson()) {
336  // use boundary of stop center
337  return getChildDemandElements().front()->getCenteringBoundary();
338  } else {
339  personBoundary.add(getPositionInView());
340  }
341  } else {
342  personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
343  }
344  personBoundary.grow(20);
345  return personBoundary;
346 }
347 
348 
349 void
350 GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
351  // geometry of this element cannot be splitted
352 }
353 
354 
355 void
357  bool drawPerson = true;
358  // check if person can be drawn
360  drawPerson = false;
362  drawPerson = false;
364  drawPerson = false;
365  } else if (getChildDemandElements().empty()) {
366  drawPerson = false;
367  }
368  // continue if person can be drawn
369  if (drawPerson) {
370  // obtain exaggeration (and add the special personExaggeration)
371  const double exaggeration = getExaggeration(s) + s.detailSettings.personExaggeration;
372  // obtain width and length
373  const double length = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_LENGTH);
374  const double width = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_WIDTH);
375  // obtain diameter around person (used to calculate distance bewteen cursor and person)
376  const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
377  // obtain img file
378  const std::string file = getParentDemandElements().at(0)->getAttribute(SUMO_ATTR_IMGFILE);
379  // obtain position
380  const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
381  // check if person can be drawn
382  if (!(s.drawForPositionSelection && (personPosition.distanceSquaredTo(myNet->getViewNet()->getPositionInformation()) > distanceSquared))) {
383  // push GL ID
385  // push draw matrix
387  // Start with the drawing of the area traslating matrix to origin
389  // translate and rotate
390  glTranslated(personPosition.x(), personPosition.y(), 0);
391  glRotated(90, 0, 0, 1);
392  // set person color
393  setColor(s);
394  // set scale
395  glScaled(exaggeration, exaggeration, 1);
396  // draw person depending of detail level
397  if (s.drawDetail(s.detailSettings.personShapes, exaggeration)) {
398  GUIBasePersonHelper::drawAction_drawAsImage(0, length, width, file, SUMOVehicleShape::PEDESTRIAN, exaggeration);
399  } else if (s.drawDetail(s.detailSettings.personCircles, exaggeration)) {
400  GUIBasePersonHelper::drawAction_drawAsCircle(length, width, s.scale * exaggeration);
401  } else if (s.drawDetail(s.detailSettings.personTriangles, exaggeration)) {
403  }
404  // pop matrix
406  // pop name
408  // draw name
409  drawName(personPosition, s.scale, s.personName, s.angle);
410  if (s.personValue.show(this)) {
411  Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
412  const double value = getColorValue(s, s.personColorer.getActive());
413  GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
414  }
415  // draw lock icon
416  GNEViewNetHelper::LockIcon::drawLockIcon(this, getType(), personPosition, exaggeration);
417  // check if dotted contours has to be drawn
419  // draw using drawDottedSquaredShape
420  GUIDottedGeometry::drawDottedSquaredShape(GUIDottedGeometry::DottedContourType::INSPECT, s, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
421  }
422  if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
423  // draw using drawDottedSquaredShape
424  GUIDottedGeometry::drawDottedSquaredShape(GUIDottedGeometry::DottedContourType::FRONT, s, personPosition, 0.5, 0.5, 0, 0, 0, exaggeration);
425  }
426  }
427  }
428 }
429 
430 
431 void
433  // compute all person plan children (because aren't computed in "computeDemandElements()")
434  for (const auto& demandElement : getChildDemandElements()) {
435  demandElement->computePathElement();
436  }
437 }
438 
439 
440 void
441 GNEPerson::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*lane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
442  // Stops don't use drawPartialGL
443 }
444 
445 
446 void
447 GNEPerson::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*fromLane*/, const GNELane* /*toLane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
448  // Stops don't use drawPartialGL
449 }
450 
451 
452 GNELane*
454  // use path lane of first person plan
455  return getChildDemandElements().front()->getFirstPathLane();
456 }
457 
458 
459 GNELane*
461  // use path lane of first person plan
462  return getChildDemandElements().front()->getLastPathLane();
463 }
464 
465 
466 std::string
468  // declare string error
469  std::string error;
470  switch (key) {
471  case SUMO_ATTR_ID:
472  return getID();
473  case SUMO_ATTR_TYPE:
474  return getParentDemandElements().at(0)->getID();
475  case SUMO_ATTR_COLOR:
476  if (wasSet(VEHPARS_COLOR_SET)) {
477  return toString(color);
478  } else {
480  }
481  case SUMO_ATTR_DEPARTPOS:
483  return getDepartPos();
484  } else {
486  }
487  // Specific of persons
488  case SUMO_ATTR_DEPART:
489  return toString(depart);
490  // Specific of personFlows
491  case SUMO_ATTR_BEGIN:
492  return time2string(depart);
493  case SUMO_ATTR_END:
494  return time2string(repetitionEnd);
496  return toString(3600 / STEPS2TIME(repetitionOffset));
497  case SUMO_ATTR_PERIOD:
499  case SUMO_ATTR_PROB:
501  case SUMO_ATTR_NUMBER:
502  return toString(repetitionNumber);
503  //
504  case GNE_ATTR_SELECTED:
506  case GNE_ATTR_PARAMETERS:
507  return getParametersStr();
508  default:
509  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
510  }
511 }
512 
513 
514 double
516  switch (key) {
517  case SUMO_ATTR_DEPARTPOS:
519  return departPos;
520  } else {
521  return 0;
522  }
523  default:
524  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
525  }
526 }
527 
528 
529 Position
531  switch (key) {
532  case SUMO_ATTR_DEPARTPOS: {
533  // get person plan
534  const GNEDemandElement* personPlan = getChildDemandElements().front();
535  // first check if first person plan is a stop
536  if (personPlan->getTagProperty().isStopPerson()) {
537  return personPlan->getPositionInView();
538  } else if (personPlan->getParentJunctions().size() > 0) {
539  return personPlan->getParentJunctions().front()->getPositionInView();
540  } else {
541  // declare lane lane
542  GNELane* lane = nullptr;
543  // update lane
544  if (personPlan->getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
545  lane = personPlan->getParentDemandElements().at(1)->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
546  } else {
547  lane = personPlan->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
548  }
549  // get position over lane shape
550  if (departPos <= 0) {
551  return lane->getLaneShape().front();
552  } else if (departPos >= lane->getLaneShape().length2D()) {
553  return lane->getLaneShape().back();
554  } else {
555  return lane->getLaneShape().positionAtOffset2D(departPos);
556  }
557  }
558  }
559  default:
560  throw InvalidArgument(getTagStr() + " doesn't have a Position attribute of type '" + toString(key) + "'");
561  }
562 }
563 
564 
565 void
566 GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
567  switch (key) {
568  case SUMO_ATTR_ID:
569  case SUMO_ATTR_TYPE:
570  case SUMO_ATTR_COLOR:
571  case SUMO_ATTR_DEPARTPOS:
572  // Specific of persons
573  case SUMO_ATTR_DEPART:
574  // Specific of personFlows
575  case SUMO_ATTR_BEGIN:
576  case SUMO_ATTR_END:
577  case SUMO_ATTR_NUMBER:
579  case SUMO_ATTR_PERIOD:
580  case SUMO_ATTR_PROB:
581  //
582  case GNE_ATTR_PARAMETERS:
583  case GNE_ATTR_SELECTED:
584  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
585  break;
586  default:
587  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
588  }
589 }
590 
591 
592 bool
593 GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
594  // declare string error
595  std::string error;
596  switch (key) {
597  case SUMO_ATTR_ID:
598  // Persons and personflows share namespace
600  (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) == nullptr) &&
601  (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) == nullptr)) {
602  return true;
603  } else {
604  return false;
605  }
606  case SUMO_ATTR_TYPE:
608  case SUMO_ATTR_COLOR:
609  return canParse<RGBColor>(value);
610  case SUMO_ATTR_DEPARTPOS: {
611  double dummyDepartPos;
612  DepartPosDefinition dummyDepartPosProcedure;
613  parseDepartPos(value, toString(SUMO_TAG_VEHICLE), id, dummyDepartPos, dummyDepartPosProcedure, error);
614  // if error is empty, given value is valid
615  return error.empty();
616  }
617  // Specific of persons
618  case SUMO_ATTR_DEPART: {
619  if (canParse<double>(value)) {
620  return (parse<double>(value) >= 0);
621  } else {
622  return false;
623  }
624  }
625  // Specific of personflows
626  case SUMO_ATTR_BEGIN:
627  if (canParse<double>(value)) {
628  return (parse<double>(value) >= 0);
629  } else {
630  return false;
631  }
632  case SUMO_ATTR_END:
633  if (value.empty()) {
634  return true;
635  } else if (canParse<double>(value)) {
636  return (parse<double>(value) >= 0);
637  } else {
638  return false;
639  }
641  if (value.empty()) {
642  return true;
643  } else if (canParse<double>(value)) {
644  return (parse<double>(value) > 0);
645  } else {
646  return false;
647  }
648  case SUMO_ATTR_PERIOD:
649  if (value.empty()) {
650  return true;
651  } else if (canParse<double>(value)) {
652  return (parse<double>(value) > 0);
653  } else {
654  return false;
655  }
656  case SUMO_ATTR_PROB:
657  if (value.empty()) {
658  return true;
659  } else if (canParse<double>(value)) {
660  return (parse<double>(value) >= 0);
661  } else {
662  return false;
663  }
664  case SUMO_ATTR_NUMBER:
665  if (canParse<int>(value)) {
666  return (parse<int>(value) >= 0);
667  } else {
668  return false;
669  }
670  //
671  case GNE_ATTR_SELECTED:
672  return canParse<bool>(value);
673  case GNE_ATTR_PARAMETERS:
674  return Parameterised::areParametersValid(value);
675  default:
676  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
677  }
678 }
679 
680 
681 void
683  switch (key) {
684  case SUMO_ATTR_END:
685  case SUMO_ATTR_NUMBER:
687  case SUMO_ATTR_PERIOD:
688  case SUMO_ATTR_PROB:
689  undoList->add(new GNEChange_EnableAttribute(this, key, true, parametersSet), true);
690  return;
691  default:
692  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
693  }
694 }
695 
696 
697 void
699  // nothing to disable
700 }
701 
702 
703 bool
705  switch (key) {
706  case SUMO_ATTR_END:
707  return (parametersSet & VEHPARS_END_SET) != 0;
708  case SUMO_ATTR_NUMBER:
709  return (parametersSet & VEHPARS_NUMBER_SET) != 0;
711  return (parametersSet & VEHPARS_VPH_SET) != 0;
712  case SUMO_ATTR_PERIOD:
713  return (parametersSet & VEHPARS_PERIOD_SET) != 0;
714  case SUMO_ATTR_PROB:
715  return (parametersSet & VEHPARS_PROB_SET) != 0;
716  default:
717  return true;
718  }
719 }
720 
721 
722 std::string
724  return getTagStr();
725 }
726 
727 
728 std::string
730  // special case for Trips and flow
732  // check if we're inspecting a Edge
733  if (myNet->getViewNet()->getInspectedAttributeCarriers().front() &&
734  myNet->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().getTag() == SUMO_TAG_EDGE) {
735  // check if edge correspond to a "from", "to" or "via" edge
737  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (from)";
738  } else if (myNet->getViewNet()->isAttributeCarrierInspected(getParentEdges().front())) {
739  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (to)";
740  } else {
741  // iterate over via
742  for (const auto& i : via) {
743  if (i == myNet->getViewNet()->getInspectedAttributeCarriers().front()->getID()) {
744  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (via)";
745  }
746  }
747  }
748  }
749  }
750  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
751 }
752 
753 
754 const std::map<std::string, std::string>&
756  return getParametersMap();
757 }
758 
759 // ===========================================================================
760 // protected
761 // ===========================================================================
762 
763 void
765  const GUIColorer& c = s.personColorer;
766  if (!setFunctionalColor(c.getActive())) {
768  }
769 }
770 
771 
772 bool
773 GNEPerson::setFunctionalColor(int /* activeScheme */) const {
774  /*
775  switch (activeScheme) {
776  case 0: {
777  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
778  GLHelper::setColor(getParameter().color);
779  return true;
780  }
781  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
782  GLHelper::setColor(getVehicleType().getColor());
783  return true;
784  }
785  return false;
786  }
787  case 2: {
788  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
789  GLHelper::setColor(getParameter().color);
790  return true;
791  }
792  return false;
793  }
794  case 3: {
795  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
796  GLHelper::setColor(getVehicleType().getColor());
797  return true;
798  }
799  return false;
800  }
801  case 8: { // color by angle
802  double hue = GeomHelper::naviDegree(getAngle());
803  GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.));
804  return true;
805  }
806  case 9: { // color randomly (by pointer)
807  const double hue = (long)this % 360; // [0-360]
808  const double sat = (((long)this / 360) % 67) / 100.0 + 0.33; // [0.33-1]
809  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
810  return true;
811  }
812  default:
813  return false;
814  }
815  */
816  return false;
817 }
818 
819 // ===========================================================================
820 // private
821 // ===========================================================================
822 
824  personPlan(_personPlan),
825  edge(nullptr),
826  arrivalPos(-1) {
827 }
828 
829 
831  personPlan(nullptr),
832  edge(nullptr),
833  arrivalPos(-1) {
834 }
835 
836 
837 void
838 GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
839  // declare string error
840  std::string error;
841  switch (key) {
842  case SUMO_ATTR_ID:
843  // update microsimID
844  setMicrosimID(value);
845  // Change IDs of all person plans children
846  for (const auto& personPlans : getChildDemandElements()) {
847  personPlans->setMicrosimID(getID());
848  }
849  break;
850  case SUMO_ATTR_TYPE:
852  // set manually vtypeID (needed for saving)
853  vtypeid = value;
854  break;
855  case SUMO_ATTR_COLOR:
856  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
857  color = parse<RGBColor>(value);
858  // mark parameter as set
860  } else {
861  // set default value
862  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
863  // unset parameter
865  }
866  break;
867  case SUMO_ATTR_DEPARTPOS:
868  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
870  // mark parameter as set
872  } else {
873  // set default value
875  // unset parameter
877  }
878  // compute person
879  updateGeometry();
880  break;
881  // Specific of persons
882  case SUMO_ATTR_DEPART: {
884  break;
885  }
886  // Specific of personFlows
887  case SUMO_ATTR_BEGIN: {
888  depart = string2time(value);
889  break;
890  }
891  case SUMO_ATTR_END:
892  repetitionEnd = string2time(value);
893  break;
895  repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
896  break;
897  case SUMO_ATTR_PERIOD:
898  repetitionOffset = string2time(value);
899  break;
900  case SUMO_ATTR_PROB:
901  repetitionProbability = parse<double>(value);
902  break;
903  case SUMO_ATTR_NUMBER:
904  repetitionNumber = parse<int>(value);
905  break;
906  //
907  case GNE_ATTR_SELECTED:
908  if (parse<bool>(value)) {
910  } else {
912  }
913  break;
914  case GNE_ATTR_PARAMETERS:
915  setParametersStr(value);
916  break;
917  default:
918  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
919  }
920 }
921 
922 
923 void
924 GNEPerson::toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters) {
925  if (value) {
927  } else {
928  parametersSet = previousParameters;
929  }
930 }
931 
932 
933 void GNEPerson::setMoveShape(const GNEMoveResult& moveResult) {
934  // change departPos
936  departPos = moveResult.newFirstPos;
937  // update geometry
938  updateGeometry();
939 }
940 
941 
942 void
943 GNEPerson::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
944  undoList->begin(myTagProperty.getGUIIcon(), "departPos of " + getTagStr());
945  // now set departPos
946  setAttribute(SUMO_ATTR_DEPARTPOS, toString(moveResult.newFirstPos), undoList);
947  undoList->end();
948 }
949 
950 /****************************************************************************/
FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[]
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:413
@ MID_GNE_PERSON_TRANSFORM
transform person to another person type (ej: person to personflow)
Definition: GUIAppEnum.h:1182
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:411
@ GLO_MAX
empty max
@ GLO_PERSON
a person
@ GLO_PERSONFLOW
a person flow
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:53
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
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
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
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_PERSON
@ GNE_TAG_WALK_ROUTE
@ SUMO_TAG_PERSONFLOW
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
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_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_CONTAINERSPERHOUR
@ 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:77
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
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:640
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 belongs to GNENet but has influency in the simulation.
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
virtual Position getPositionInView() const =0
Returns position of demand element in view.
Problem
enum class for demandElement problems
const std::string & getID() const
get ID
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:131
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:125
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
PathElement()
default constructor
class used in GUIGLObjectPopupMenu for person transformations
Definition: GNEPerson.h:38
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:96
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:92
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:70
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:110
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:145
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:99
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:102
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:356
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEPerson.cpp:441
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPerson.cpp:943
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEPerson.cpp:184
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:307
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:298
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNEPerson.cpp:326
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:292
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:704
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPerson.cpp:222
GNELane * getLastPathLane() const
get last path lane
Definition: GNEPerson.cpp:460
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEPerson.cpp:530
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:764
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:280
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPerson.cpp:933
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:773
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:729
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:203
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:682
~GNEPerson()
destructor
Definition: GNEPerson.cpp:180
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEPerson.cpp:755
SUMOVehicleClass getVClass() const
Definition: GNEPerson.cpp:286
void computePathElement()
compute pathElement
Definition: GNEPerson.cpp:432
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:320
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:593
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:350
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:924
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:698
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:566
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEPerson.cpp:163
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:467
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:332
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:515
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:266
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEPerson.cpp:453
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:313
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:273
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:723
static void setFlowParameters(const SumoXMLAttr attribute, int &parameters)
set flow parameters
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:537
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:513
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
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:531
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_drawAsCircle(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 DottedContourType type, const GUIVisualizationSettings &s, 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.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual double getColorValue(const GUIVisualizationSettings &, int) const
Definition: GUIGlObject.h:152
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.
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
const T getColor(const double value) const
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
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)
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
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:248
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|....
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"
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".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
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.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
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)
std::string getDepart() const
obtain depart parameter in string format
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 personShapes
details for draw person as person shapes
static const double personTriangles
details for draw person as triangles
static const double personCircles
details for draw person as circles
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