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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // Representation of persons in NETEDIT
15 /****************************************************************************/
16 
17 // ===========================================================================
18 // included modules
19 // ===========================================================================
20 
21 #include <cmath>
24 #include <netedit/GNENet.h>
25 #include <netedit/GNEUndoList.h>
26 #include <netedit/GNEViewNet.h>
27 #include <netedit/GNEViewParent.h>
35 #include <utils/gui/div/GLHelper.h>
40 
41 #include "GNEPerson.h"
42 #include "GNERouteHandler.h"
43 
44 
45 // ===========================================================================
46 // FOX callback mapping
47 // ===========================================================================
48 FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[] = {
50 };
51 
52 FXDEFMAP(GNEPerson::GNESelectedPersonsPopupMenu) selectedPersonsPopupMenuMap[] = {
54 };
55 
56 // Object implementation
57 FXIMPLEMENT(GNEPerson::GNEPersonPopupMenu, GUIGLObjectPopupMenu, personPopupMenuMap, ARRAYNUMBER(personPopupMenuMap))
58 FXIMPLEMENT(GNEPerson::GNESelectedPersonsPopupMenu, GUIGLObjectPopupMenu, selectedPersonsPopupMenuMap, ARRAYNUMBER(selectedPersonsPopupMenuMap))
59 
60 // ===========================================================================
61 // GNEPerson::GNEPersonPopupMenu
62 // ===========================================================================
63 
65  GUIGLObjectPopupMenu(app, parent, *person),
66  myPerson(person),
67  myTransformToPerson(nullptr),
68  myTransformToPersonFlow(nullptr) {
69  // build header
70  myPerson->buildPopupHeader(this, app);
71  // build menu command for center button and copy cursor position to clipboard
72  myPerson->buildCenterPopupEntry(this);
73  myPerson->buildPositionCopyEntry(this, false);
74  // buld menu commands for names
75  new FXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
76  new FXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
77  new FXMenuSeparator(this);
78  // build selection and show parameters menu
79  myPerson->getViewNet()->buildSelectionACPopupEntry(this, myPerson);
80  myPerson->buildShowParamsPopupEntry(this);
81  // add transform functions only in demand mode
82  if (myPerson->getViewNet()->getEditModes().currentSupermode == GNE_SUPERMODE_DEMAND) {
83  // create menu pane for transform operations
84  FXMenuPane* transformOperation = new FXMenuPane(this);
85  this->insertMenuPaneChild(transformOperation);
86  new FXMenuCascade(this, "transform to", nullptr, transformOperation);
87  // Create menu comands for all transformations
88  myTransformToPerson = new FXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(ICON_PERSON), this, MID_GNE_PERSON_TRANSFORM);
89  myTransformToPersonFlow = new FXMenuCommand(transformOperation, "Person (embedded route)", GUIIconSubSys::getIcon(ICON_PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
90  // check what menu command has to be disabled
91  if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSON) {
92  myTransformToPerson->disable();
93  } else if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSONFLOW) {
94  myTransformToPersonFlow->disable();
95  }
96  }
97 }
98 
99 
101 
102 
103 long
104 GNEPerson::GNEPersonPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
105  if (obj == myTransformToPerson) {
107  } else if (obj == myTransformToPersonFlow) {
109  }
110  return 1;
111 }
112 
113 
114 // ===========================================================================
115 // GNEPerson::GNESelectedPersonsPopupMenu
116 // ===========================================================================
117 
118 GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent) :
119  GUIGLObjectPopupMenu(app, parent, *person),
120  myPersonTag(person->getTagProperty().getTag()),
121  mySelectedPersons(selectedPerson),
122  myTransformToPerson(nullptr),
123  myTransformToPersonFlow(nullptr) {
124  // build header
125  person->buildPopupHeader(this, app);
126  // build menu command for center button and copy cursor position to clipboard
127  person->buildCenterPopupEntry(this);
128  person->buildPositionCopyEntry(this, false);
129  // buld menu commands for names
130  new FXMenuCommand(this, ("Copy " + person->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
131  new FXMenuCommand(this, ("Copy " + person->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
132  new FXMenuSeparator(this);
133  // build selection and show parameters menu
134  person->getViewNet()->buildSelectionACPopupEntry(this, person);
135  person->buildShowParamsPopupEntry(this);
136  // add transform functions only in demand mode
138  // create menu pane for transform operations
139  FXMenuPane* transformOperation = new FXMenuPane(this);
140  this->insertMenuPaneChild(transformOperation);
141  new FXMenuCascade(this, "transform to", nullptr, transformOperation);
142  // Create menu comands for all transformations
143  myTransformToPerson = new FXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(ICON_PERSON), this, MID_GNE_PERSON_TRANSFORM);
144  myTransformToPersonFlow = new FXMenuCommand(transformOperation, "PersonFlow", GUIIconSubSys::getIcon(ICON_PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
145  }
146 }
147 
148 
150 
151 
152 long
154  // iterate over all selected persons
155  for (const auto& i : mySelectedPersons) {
156  if ((obj == myTransformToPerson) &&
157  (i->getTagProperty().getTag() == myPersonTag)) {
159  } else if ((obj == myTransformToPersonFlow) &&
160  (i->getTagProperty().getTag() == myPersonTag)) {
162  }
163  }
164  return 1;
165 }
166 
167 // ===========================================================================
168 // member method definitions
169 // ===========================================================================
170 
172  GNEDemandElement(personparameters.id, viewNet, (tag == SUMO_TAG_PERSONFLOW) ? GLO_PERSONFLOW : GLO_PERSON, tag,
173 {}, {}, {}, {}, {pType}, {}, {}, {}, {}, {}),
174 SUMOVehicleParameter(personparameters) {
175  // set manually vtypeID (needed for saving)
176  vtypeid = pType->getID();
177 }
178 
179 
181 
182 
183 std::string
185  // obtain depart depending if is a Person, trip or routeFlow
186  std::string departStr;
188  departStr = toString(depart);
189  } else {
190  departStr = getDepart();
191  }
192  // we need to handle depart as a tuple of 20 numbers (format: 000000...00<departTime>)
193  departStr.reserve(20 - departStr.size());
194  // add 0s at the beginning of departStr until we have 20 numbers
195  for (int i = (int)departStr.size(); i < 20; i++) {
196  departStr.insert(departStr.begin(), '0');
197  }
198  return departStr;
199 }
200 
201 
202 void
204  // obtain tag depending if tagProperty has a synonym
206  // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
208  // unset VType parameter
210  // write person attributes (VType will not be written)
211  write(device, OptionsCont::getOptions(), synonymTag);
212  // set VType parameter again
214  } else {
215  // write person attributes, including VType
216  write(device, OptionsCont::getOptions(), synonymTag, getParentDemandElements().at(0)->getID());
217  }
218  // write specific flow attributes
220  // write routeFlow values depending if it was set
223  }
226  }
229  }
232  }
235  }
236  }
237  // write parameters
238  writeParams(device);
239  // write child demand elements associated to this person (Rides, Walks...)
240  for (const auto& i : getChildDemandElements()) {
241  i->writeDemandElement(device);
242  }
243  // close person tag
244  device.closeTag();
245 }
246 
247 
248 bool
250  // a single person is always valid
251  return true;
252 }
253 
254 
255 std::string
257  // A single person cannot habe problem (but their children)
258  return "";
259 }
260 
261 
262 void
264  // nothing to fix
265 }
266 
267 
268 GNEEdge*
270  return getChildDemandElements().front()->getFromEdge();
271 }
272 
273 
274 GNEEdge*
276  return getChildDemandElements().front()->getToEdge();
277 }
278 
279 
282  return getParentDemandElements().front()->getVClass();
283 }
284 
285 
286 const RGBColor&
288  return color;
289 }
290 
291 
292 void
294  // Persons cannot be moved
295 }
296 
297 
298 void
300  // Persons cannot be moved
301 }
302 
303 
304 void
306  // Persons cannot be moved
307 }
308 
309 
310 void
312  // Persons cannot be moved
313 }
314 
315 
316 void
318  // only update geometry of childrens
319  for (const auto& i : getChildDemandElements()) {
320  i->updateGeometry();
321  }
322 }
323 
324 
325 void
327  // only update partial geometry of childrens
328  for (const auto& i : getChildDemandElements()) {
329  i->updatePartialGeometry(edge);
330  }
331 }
332 
333 
334 void
336  // nothing to compute
337 }
338 
339 
340 void
342  // nothing to invalidate
343 }
344 
345 
346 Position
348  // Position in view depend of first child element
349  if (getChildDemandElements().size() > 0) {
350  if (getChildDemandElements().at(0)->getTagProperty().isPersonStop()) {
351  return getChildDemandElements().at(0)->getDemandElementGeometry().getShape().getLineCenter();
352  } else {
353  // obtain lane (special case for rides)
354  SUMOVehicleClass vClassEdgeFrom = getChildDemandElements().front()->getTagProperty().isRide() ? SVC_PASSENGER : SVC_PEDESTRIAN;
355  GNELane* lane = getChildDemandElements().at(0)->getParentEdges().at(0)->getLaneByAllowedVClass(vClassEdgeFrom);
356  // return position in view depending of lane
357  if (lane->getLaneShape().length() < 2.5) {
358  return lane->getLaneShape().front();
359  } else {
360  Position A = lane->getLaneShape().positionAtOffset(2.5);
361  Position B = lane->getLaneShape().positionAtOffset(2.5);
362  // return Middle point
363  return Position((A.x() + B.x()) / 2, (A.y() + B.y()) / 2);
364  }
365  }
366  } else {
367  return Position(0, 0);
368  }
369 }
370 
371 
374  // return a GNEPersonPopupMenu
375  return new GNEPersonPopupMenu(this, app, parent);
376 }
377 
378 
379 std::string
381  return myViewNet->getNet()->getMicrosimID();
382 }
383 
384 
385 Boundary
387  Boundary personBoundary;
388  if (getChildDemandElements().size() > 0) {
389  personBoundary.add(getChildDemandElements().front()->getCenteringBoundary());
390  } else {
391  personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
392  }
393  personBoundary.grow(20);
394  return personBoundary;
395 }
396 
397 
398 void
399 GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetElement* /*originalElement*/, const GNENetElement* /*newElement*/, GNEUndoList* /*undoList*/) {
400  // geometry of this element cannot be splitted
401 }
402 
403 
404 void
406  bool drawPerson = true;
407  // check if person can be drawn
409  drawPerson = false;
411  drawPerson = false;
412  } else if (getChildDemandElements().empty()) {
413  drawPerson = false;
414  }
415  // continue if person can be drawn
416  if (drawPerson) {
417  // obtain exaggeration (and add the special personExaggeration)
418  const double exaggeration = s.personSize.getExaggeration(s, this, 80) + s.detailSettings.personExaggeration;
419  // obtain width and length
420  const double length = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_LENGTH);
421  const double width = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_WIDTH);
422  // obtain diameter around person (used to calculate distance bewteen cursor and person)
423  const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
424  // obtain img file
425  const std::string file = getParentDemandElements().at(0)->getAttribute(SUMO_ATTR_IMGFILE);
426  Position personPosition;
427  // obtain position depending of first PersonPlan child
428  if (getChildDemandElements().front()->getTagProperty().isPersonStop()) {
429  // obtain position of stop center
430  personPosition = getChildDemandElements().front()->getPositionInView();
431  } else {
432  // obtain position of first edge
433  personPosition = getChildDemandElements().front()->getDemandElementSegmentGeometry().getFirstPosition();
434  }
435  // check that position is valid and person can be drawn
436  if ((personPosition != Position::INVALID) &&
437  !(s.drawForPositionSelection && (personPosition.distanceSquaredTo(myViewNet->getPositionInformation()) > distanceSquared))) {
438  // push GL ID
439  glPushName(getGlID());
440  // push draw matrix
441  glPushMatrix();
442  // translate and rotate
443  glTranslated(personPosition.x(), personPosition.y(), getType());
444  glRotated(90, 0, 0, 1);
445  // set person color
446  setColor(s);
447  // set scale
448  glScaled(exaggeration, exaggeration, 1);
449  // draw person depending of detail level
450  if (s.drawDetail(s.detailSettings.personShapes, exaggeration)) {
451  GUIBasePersonHelper::drawAction_drawAsImage(0, length, width, file, SVS_PEDESTRIAN, exaggeration);
452  } else if (s.drawDetail(s.detailSettings.personCircles, exaggeration)) {
454  } else if (s.drawDetail(s.detailSettings.personTriangles, exaggeration)) {
456  }
457  // pop matrix
458  glPopMatrix();
459  drawName(personPosition, s.scale, s.personName, s.angle);
460  if (s.personValue.show) {
461  Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
462  const double value = getColorValue(s, s.personColorer.getActive());
463  GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
464  }
465  // check if dotted contour has to be drawn
466  if (myViewNet->getDottedAC() == this) {
467  GLHelper::drawShapeDottedContourRectangle(s, getType(), personPosition, exaggeration, exaggeration);
468  }
469  // pop name
470  glPopName();
471  }
472  }
473 }
474 
475 
476 void
478  if (!myViewNet) {
479  throw ProcessError("ViewNet cannot be nullptr");
480  } else {
482  // add object of list into selected objects
484  if (changeFlag) {
485  mySelected = true;
486  }
487  }
488 }
489 
490 
491 void
493  if (!myViewNet) {
494  throw ProcessError("ViewNet cannot be nullptr");
495  } else {
497  // remove object of list of selected objects
499  if (changeFlag) {
500  mySelected = false;
501 
502  }
503  }
504 }
505 
506 
507 std::string
509  // declare string error
510  std::string error;
511  switch (key) {
512  case SUMO_ATTR_ID:
513  return getDemandElementID();
514  case SUMO_ATTR_TYPE:
515  return getParentDemandElements().at(0)->getID();
516  case SUMO_ATTR_COLOR:
517  if (wasSet(VEHPARS_COLOR_SET)) {
518  return toString(color);
519  } else {
521  }
522  case SUMO_ATTR_DEPARTPOS:
524  return getDepartPos();
525  } else {
527  }
528  // Specific of persons
529  case SUMO_ATTR_DEPART:
530  return toString(depart);
531  // Specific of personFlows
532  case SUMO_ATTR_BEGIN:
533  return time2string(depart);
534  case SUMO_ATTR_END:
535  return time2string(repetitionEnd);
537  return toString(3600 / STEPS2TIME(repetitionOffset));
538  case SUMO_ATTR_PERIOD:
540  case SUMO_ATTR_PROB:
542  case SUMO_ATTR_NUMBER:
543  return toString(repetitionNumber);
544  //
545  case GNE_ATTR_SELECTED:
547  case GNE_ATTR_PARAMETERS:
548  return getParametersStr();
549  default:
550  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
551  }
552 }
553 
554 
555 double
557  switch (key) {
558  case SUMO_ATTR_DEPARTPOS:
560  return departPos;
561  } else {
562  return 0;
563  }
564  default:
565  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
566  }
567 }
568 
569 
570 void
571 GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
572  if (value == getAttribute(key)) {
573  return; //avoid needless changes, later logic relies on the fact that attributes have changed
574  }
575  switch (key) {
576  case SUMO_ATTR_ID:
577  case SUMO_ATTR_TYPE:
578  case SUMO_ATTR_COLOR:
579  case SUMO_ATTR_DEPARTPOS:
580  // Specific of persons
581  case SUMO_ATTR_DEPART:
582  // Specific of personFlows
583  case SUMO_ATTR_BEGIN:
584  case SUMO_ATTR_END:
585  case SUMO_ATTR_NUMBER:
587  case SUMO_ATTR_PERIOD:
588  case SUMO_ATTR_PROB:
589  //
590  case GNE_ATTR_PARAMETERS:
591  case GNE_ATTR_SELECTED:
592  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
593  break;
594  default:
595  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
596  }
597 }
598 
599 
600 bool
601 GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
602  // declare string error
603  std::string error;
604  switch (key) {
605  case SUMO_ATTR_ID:
606  // Persons and personflows share namespace
608  (myViewNet->getNet()->retrieveDemandElement(SUMO_TAG_PERSON, value, false) == nullptr) &&
609  (myViewNet->getNet()->retrieveDemandElement(SUMO_TAG_PERSONFLOW, value, false) == nullptr)) {
610  return true;
611  } else {
612  return false;
613  }
614  case SUMO_ATTR_TYPE:
615  return SUMOXMLDefinitions::isValidTypeID(value) && (myViewNet->getNet()->retrieveDemandElement(SUMO_TAG_VTYPE, value, false) != nullptr);
616  case SUMO_ATTR_COLOR:
617  return canParse<RGBColor>(value);
618  case SUMO_ATTR_DEPARTPOS: {
619  double dummyDepartPos;
620  DepartPosDefinition dummyDepartPosProcedure;
621  parseDepartPos(value, toString(SUMO_TAG_VEHICLE), id, dummyDepartPos, dummyDepartPosProcedure, error);
622  // if error is empty, given value is valid
623  return error.empty();
624  }
625  // Specific of persons
626  case SUMO_ATTR_DEPART: {
627  if (canParse<double>(value)) {
628  return (parse<double>(value) >= 0);
629  } else {
630  return false;
631  }
632  }
633  // Specific of personflows
634  case SUMO_ATTR_BEGIN:
635  if (canParse<double>(value)) {
636  return (parse<double>(value) >= 0);
637  } else {
638  return false;
639  }
640  case SUMO_ATTR_END:
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  }
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_PERIOD:
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_PROB:
665  if (value.empty()) {
666  return true;
667  } else if (canParse<double>(value)) {
668  return (parse<double>(value) >= 0);
669  } else {
670  return false;
671  }
672  case SUMO_ATTR_NUMBER:
673  if (canParse<int>(value)) {
674  return (parse<int>(value) >= 0);
675  } else {
676  return false;
677  }
678  //
679  case GNE_ATTR_SELECTED:
680  return canParse<bool>(value);
681  case GNE_ATTR_PARAMETERS:
682  return Parameterised::areParametersValid(value);
683  default:
684  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
685  }
686 }
687 
688 
689 void
691  // obtain a copy of parameter sets
692  int newParametersSet = parametersSet;
693  // modify newParametersSet
694  GNERouteHandler::setFlowParameters(key, newParametersSet);
695  // add GNEChange_EnableAttribute
696  undoList->add(new GNEChange_EnableAttribute(this, myViewNet->getNet(), parametersSet, newParametersSet), true);
697 }
698 
699 
700 void
702  // nothing to disable
703 }
704 
705 
706 bool
708  switch (key) {
709  case SUMO_ATTR_END:
710  return (parametersSet & VEHPARS_END_SET) != 0;
711  case SUMO_ATTR_NUMBER:
712  return (parametersSet & VEHPARS_NUMBER_SET) != 0;
714  return (parametersSet & VEHPARS_VPH_SET) != 0;
715  case SUMO_ATTR_PERIOD:
716  return (parametersSet & VEHPARS_PERIOD_SET) != 0;
717  case SUMO_ATTR_PROB:
718  return (parametersSet & VEHPARS_PROB_SET) != 0;
719  default:
720  return true;
721  }
722 }
723 
724 
725 std::string
727  return getTagStr();
728 }
729 
730 
731 std::string
733  // special case for Trips and flow
735  // check if we're inspecting a Edge
736  if (myViewNet->getNet()->getViewNet()->getDottedAC() &&
738  // check if edge correspond to a "from", "to" or "via" edge
739  if (getParentEdges().front() == myViewNet->getNet()->getViewNet()->getDottedAC()) {
740  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (from)";
741  } else if (getParentEdges().front() == myViewNet->getNet()->getViewNet()->getDottedAC()) {
742  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (to)";
743  } else {
744  // iterate over via
745  for (const auto& i : via) {
746  if (i == myViewNet->getNet()->getViewNet()->getDottedAC()->getID()) {
747  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (via)";
748  }
749  }
750  }
751  }
752  }
753  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
754 }
755 
756 // ===========================================================================
757 // protected
758 // ===========================================================================
759 
760 void
762  const GUIColorer& c = s.personColorer;
763  if (!setFunctionalColor(c.getActive())) {
765  }
766 }
767 
768 
769 bool
770 GNEPerson::setFunctionalColor(int /* activeScheme */) const {
771  /*
772  switch (activeScheme) {
773  case 0: {
774  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
775  GLHelper::setColor(getParameter().color);
776  return true;
777  }
778  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
779  GLHelper::setColor(getVehicleType().getColor());
780  return true;
781  }
782  return false;
783  }
784  case 2: {
785  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
786  GLHelper::setColor(getParameter().color);
787  return true;
788  }
789  return false;
790  }
791  case 3: {
792  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
793  GLHelper::setColor(getVehicleType().getColor());
794  return true;
795  }
796  return false;
797  }
798  case 8: { // color by angle
799  double hue = GeomHelper::naviDegree(getAngle());
800  GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.));
801  return true;
802  }
803  case 9: { // color randomly (by pointer)
804  const double hue = (long)this % 360; // [0-360]
805  const double sat = (((long)this / 360) % 67) / 100.0 + 0.33; // [0.33-1]
806  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
807  return true;
808  }
809  default:
810  return false;
811  }
812  */
813  return false;
814 }
815 
816 // ===========================================================================
817 // private
818 // ===========================================================================
819 
821  personPlan(_personPlan),
822  edge(nullptr),
823  arrivalPos(-1) {
824 }
825 
826 
828  personPlan(nullptr),
829  edge(nullptr),
830  arrivalPos(-1) {
831 }
832 
833 
834 void
835 GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
836  // declare string error
837  std::string error;
838  switch (key) {
839  case SUMO_ATTR_ID:
840  changeDemandElementID(value);
841  break;
842  case SUMO_ATTR_TYPE:
843  replaceParentDemandElement(this, value, 0);
844  // set manually vtypeID (needed for saving)
845  vtypeid = value;
846  break;
847  case SUMO_ATTR_COLOR:
848  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
849  color = parse<RGBColor>(value);
850  // mark parameter as set
852  } else {
853  // set default value
854  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
855  // unset parameter
857  }
858  break;
859  case SUMO_ATTR_DEPARTPOS:
860  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
862  // mark parameter as set
864  } else {
865  // set default value
867  // unset parameter
869  }
870  // compute person
871  updateGeometry();
872  break;
873  // Specific of persons
874  case SUMO_ATTR_DEPART: {
875  std::string oldDepart = getBegin();
877  myViewNet->getNet()->updateDemandElementBegin(oldDepart, this);
878  break;
879  }
880  // Specific of personFlows
881  case SUMO_ATTR_BEGIN: {
882  std::string oldBegin = getBegin();
883  depart = string2time(value);
884  myViewNet->getNet()->updateDemandElementBegin(oldBegin, this);
885  break;
886  }
887  case SUMO_ATTR_END:
888  repetitionEnd = string2time(value);
889  break;
891  repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
892  break;
893  case SUMO_ATTR_PERIOD:
894  repetitionOffset = string2time(value);
895  break;
896  case SUMO_ATTR_PROB:
897  repetitionProbability = parse<double>(value);
898  break;
899  case SUMO_ATTR_NUMBER:
900  repetitionNumber = parse<int>(value);
901  break;
902  //
903  case GNE_ATTR_SELECTED:
904  if (parse<bool>(value)) {
906  } else {
908  }
909  break;
910  case GNE_ATTR_PARAMETERS:
911  setParametersStr(value);
912  break;
913  default:
914  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
915  }
916 }
917 
918 
919 void
920 GNEPerson::setEnabledAttribute(const int enabledAttributes) {
921  parametersSet = enabledAttributes;
922 }
923 
924 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
GNEViewParent::getSelectorFrame
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Definition: GNEViewParent.cpp:186
GNEPerson::GNESelectedPersonsPopupMenu::onCmdTransform
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:153
GNEDemandElement::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Definition: GNEDemandElement.h:376
SUMO_ATTR_TYPE
@ SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
GNEPerson::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:399
GUIVisualizationSettings::drawForPositionSelection
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
Definition: GUIVisualizationSettings.h:644
GLO_MAX
@ GLO_MAX
empty max
Definition: GUIGlObjectTypes.h:165
SVC_PEDESTRIAN
@ SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEPerson::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:761
SUMOVehicleParameter::wasSet
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: SUMOVehicleParameter.h:312
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GLHelper::drawTextSettings
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
Definition: GLHelper.cpp:706
SUMO_ATTR_DEPART
@ SUMO_ATTR_DEPART
Definition: SUMOXMLDefinitions.h:431
GNEPerson::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:690
GNEPerson::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:556
Parameterised::getParametersStr
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
Definition: Parameterised.cpp:112
GUIVisualizationDetailSettings::personShapes
static const double personShapes
details for draw person as person shapes
Definition: GUIVisualizationSettings.h:334
GNEAdditional.h
GNEPerson::GNEPerson
GNEPerson(SumoXMLTag tag, GNEViewNet *viewNet, GNEDemandElement *pType, const SUMOVehicleParameter &personparameters)
constructor for persons
Definition: GNEPerson.cpp:171
GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu
GNESelectedPersonsPopupMenu()
default constructor needed by FOX
Definition: GNEPerson.h:93
SUMOVehicleParameter::parametersSet
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color)
Definition: SUMOVehicleParameter.h:671
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:788
SUMO_ATTR_IMGFILE
@ SUMO_ATTR_IMGFILE
Definition: SUMOXMLDefinitions.h:792
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GUIGLObjectPopupMenu::insertMenuPaneChild
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
Definition: GUIGLObjectPopupMenu.cpp:80
DEFAULT_PEDTYPE_ID
const std::string DEFAULT_PEDTYPE_ID
GUIGlObject::getColorValue
virtual double getColorValue(const GUIVisualizationSettings &, int) const
Definition: GUIGlObject.h:150
SUMO_ATTR_LENGTH
@ SUMO_ATTR_LENGTH
Definition: SUMOXMLDefinitions.h:393
SUMOVehicleParameter::color
RGBColor color
The vehicle's color, TraCI may change this.
Definition: SUMOVehicleParameter.h:477
GNEHierarchicalChildElements::getChildDemandElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
Definition: GNEHierarchicalChildElements.cpp:296
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GUIGlObject::drawName
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
Definition: GUIGlObject.cpp:354
GNEHierarchicalParentElements::getParentEdges
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
Definition: GNEHierarchicalParentElements.cpp:181
GUIVisualizationSettings::angle
double angle
The current view rotation angle.
Definition: GUIVisualizationSettings.h:405
GNEPerson::getBegin
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:184
GNEPerson::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPerson.cpp:311
Position::INVALID
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:284
GNEPerson::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEPerson.cpp:492
GNEAttributeCarrier::GNEChange_EnableAttribute
friend class GNEChange_EnableAttribute
Definition: GNEAttributeCarrier.h:58
SUMOVehicleParameter::vtypeid
std::string vtypeid
The vehicle's type id.
Definition: SUMOVehicleParameter.h:474
VEHPARS_NUMBER_SET
const int VEHPARS_NUMBER_SET
Definition: SUMOVehicleParameter.h:51
SUMOVehicleParameter::departPosProcedure
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Definition: SUMOVehicleParameter.h:497
GNEPerson::GNESelectedPersonsPopupMenu::myTransformToPersonFlow
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:106
SUMOVehicleParameter::repetitionOffset
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
Definition: SUMOVehicleParameter.h:550
GNEPerson::~GNEPerson
~GNEPerson()
destructor
Definition: GNEPerson.cpp:180
GUIGlobalSelection.h
GNEPerson::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:386
SUMO_ATTR_PERIOD
@ SUMO_ATTR_PERIOD
Definition: SUMOXMLDefinitions.h:645
SUMO_TAG_PERSON
@ SUMO_TAG_PERSON
Definition: SUMOXMLDefinitions.h:295
GUIVisualizationDetailSettings::personTriangles
static const double personTriangles
details for draw person as triangles
Definition: GUIVisualizationSettings.h:328
GNEPerson::getColor
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:287
GNEPerson.h
GNENet::retrieveDemandElement
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2316
GNEPerson::GNEPersonPopupMenu
class used in GUIGLObjectPopupMenu for person transformations
Definition: GNEPerson.h:40
GUIVisualizationSettings::personColorer
GUIColorer personColorer
The person colorer.
Definition: GUIVisualizationSettings.h:532
SUMO_ATTR_COLOR
@ SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:704
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
SUMOVehicleParameter::departProcedure
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
Definition: SUMOVehicleParameter.h:485
GNEViewNetHelper::NetworkViewOptions::showDemandElements
bool showDemandElements() const
check if show demand elements checkbox is enabled
Definition: GNEViewNetHelper.cpp:1616
GNEViewNet
Definition: GNEViewNet.h:42
GNEPerson::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEPerson.cpp:341
GNERouteHandler::transformToPerson
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
Definition: GNERouteHandler.cpp:1021
GLO_PERSON
@ GLO_PERSON
Definition: GUIGlObjectTypes.h:159
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
PositionVector::length
double length() const
Returns the length.
Definition: PositionVector.cpp:484
GNEDemandElement::getViewNet
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Definition: GNEDemandElement.cpp:253
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
GLHelper.h
MID_COPY_NAME
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:382
GNEPerson::GNESelectedPersonsPopupMenu
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:73
SUMO_TAG_VTYPE
@ SUMO_TAG_VTYPE
description of a vehicle type
Definition: SUMOXMLDefinitions.h:121
GNEPerson::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPerson.cpp:203
GNEPerson::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPerson.cpp:305
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIIconSubSys::getIcon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition: GUIIconSubSys.cpp:609
GLO_PERSONFLOW
@ GLO_PERSONFLOW
a person flow
Definition: GUIGlObjectTypes.h:161
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:621
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:482
GNEPerson::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:249
FXDEFMAP
FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[]
VEHPARS_PROB_SET
const int VEHPARS_PROB_SET
Definition: SUMOVehicleParameter.h:54
GNEPerson::computePath
void computePath()
compute path
Definition: GNEPerson.cpp:335
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:523
GUIVisualizationTextSettings::scaledSize
double scaledSize(double scale, double constFactor=0.1) const
get scale size
Definition: GUIVisualizationSettings.cpp:195
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:154
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
GUIAppEnum.h
SUMOVehicleParameter::tag
SumoXMLTag tag
The vehicle tag.
Definition: SUMOVehicleParameter.h:465
SUMO_ATTR_BEGIN
@ SUMO_ATTR_BEGIN
weights: time range begin
Definition: SUMOXMLDefinitions.h:678
GNEPerson::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:405
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GUIBasePersonHelper::drawAction_drawAsCircle
static void drawAction_drawAsCircle(const double length, const double width)
Definition: GUIBasePersonHelper.cpp:57
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEPerson::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:256
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:131
GNEDemandElement::changeDemandElementID
void changeDemandElementID(const std::string &newID)
change ID of demand element
Definition: GNEDemandElement.cpp:385
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNEAttributeCarrier::TagProperties::getTagSynonym
SumoXMLTag getTagSynonym() const
get tag synonym
Definition: GNEAttributeCarrier.cpp:670
GNERouteHandler::setFlowParameters
static void setFlowParameters(const SumoXMLAttr attribute, int &parameters)
configure flow parameters
Definition: GNERouteHandler.cpp:1033
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
RGBColor
Definition: RGBColor.h:39
SUMO_TAG_FLOW
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
Definition: SUMOXMLDefinitions.h:149
GNEPerson::GNESelectedPersonsPopupMenu::~GNESelectedPersonsPopupMenu
~GNESelectedPersonsPopupMenu()
Destructor.
Definition: GNEPerson.cpp:149
SUMO_ATTR_PROB
@ SUMO_ATTR_PROB
Definition: SUMOXMLDefinitions.h:629
GUIVisualizationSettings::detailSettings
GUIVisualizationDetailSettings detailSettings
detail settings
Definition: GUIVisualizationSettings.h:683
GNEAttributeCarrier::getTagProperty
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Definition: GNEAttributeCarrier.cpp:1273
GNEHierarchicalParentElements::getParentDemandElements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
Definition: GNEHierarchicalParentElements.cpp:114
GNEPerson::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:477
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:113
GNELane::getLaneShape
const PositionVector & getLaneShape() const
Definition: GNELane.cpp:86
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:58
SUMOVehicleParameter::getDepart
std::string getDepart() const
obtain depart parameter in string format
Definition: SUMOVehicleParameter.cpp:574
GNEPerson::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:726
GUIPropertySchemeStorage::getScheme
T & getScheme()
Definition: GUIPropertySchemeStorage.h:79
GNEPerson::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEPerson.cpp:269
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
VEHPARS_COLOR_SET
const int VEHPARS_COLOR_SET
Definition: SUMOVehicleParameter.h:45
GNEViewNet::getNetworkViewOptions
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:452
GNEViewNet.h
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
SVC_PASSENGER
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
Definition: SUMOVehicleClass.h:159
PositionVector::positionAtOffset
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:248
SUMO_ATTR_WIDTH
@ SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:386
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:468
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:1026
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
SUMOVehicleParameter::repetitionProbability
double repetitionProbability
The probability for emitting a vehicle per second.
Definition: SUMOVehicleParameter.h:553
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
GNE_ATTR_PARAMETERS
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:989
SUMOVehicleParameter::arrivalPos
double arrivalPos
(optional) The position the vehicle shall arrive on
Definition: SUMOVehicleParameter.h:522
GLHelper::drawShapeDottedContourRectangle
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position &center, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
Definition: GLHelper.cpp:560
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:632
ProcessError
Definition: UtilExceptions.h:39
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:305
GNEPerson::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:601
GUIVisualizationDetailSettings::personExaggeration
static const double personExaggeration
Exaggeration for persons (only used in NETEDIT)
Definition: GUIVisualizationSettings.h:337
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUIBasePersonHelper.h
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:785
time2string
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:67
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:552
GNEViewNet::getDemandViewOptions
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:458
SUMOVehicleParameter::parseDepart
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
Definition: SUMOVehicleParameter.cpp:244
GNEPerson::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:920
GUIVisualizationSettings::personSize
GUIVisualizationSizeSettings personSize
Definition: GUIVisualizationSettings.h:538
GNENetElement
Definition: GNENetElement.h:43
GNENet::updateDemandElementBegin
void updateDemandElementBegin(const std::string &oldBegin, GNEDemandElement *demandElement)
update demand element begin in container
Definition: GNENet.cpp:2378
MID_GNE_PERSON_TRANSFORM
@ MID_GNE_PERSON_TRANSFORM
transform person to another person type (ej: person to personflow)
Definition: GUIAppEnum.h:962
GUIVisualizationTextSettings::show
bool show
flag show
Definition: GUIVisualizationSettings.h:68
GNEPerson
Definition: GNEPerson.h:36
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:190
SUMOVehicleParameter::getDepartPos
std::string getDepartPos() const
obtain depart pos parameter in string format
Definition: SUMOVehicleParameter.cpp:616
SUMO_TAG_VEHICLE
@ SUMO_TAG_VEHICLE
description of a vehicle
Definition: SUMOXMLDefinitions.h:119
string2time
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:44
GNEPerson::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEPerson.cpp:326
VEHPARS_VPH_SET
const int VEHPARS_VPH_SET
Definition: SUMOVehicleParameter.h:53
GNELane.h
ICON_PERSONFLOW
@ ICON_PERSONFLOW
Definition: GUIIcons.h:307
GUIBasePersonHelper::drawAction_drawAsTriangle
static void drawAction_drawAsTriangle(const double angle, const double length, const double width)
Definition: GUIBasePersonHelper.cpp:35
GNEChange_EnableAttribute.h
MSDevice_BTreceiver.h
GNENet::getViewNet
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2117
GNEPerson::setFunctionalColor
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:770
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
SUMOVehicleParameter::write
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
Definition: SUMOVehicleParameter.cpp:67
GNEPerson::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPerson.cpp:281
SVS_PEDESTRIAN
@ SVS_PEDESTRIAN
render as a pedestrian
Definition: SUMOVehicleClass.h:54
SUMOVehicleParameter::repetitionEnd
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
Definition: SUMOVehicleParameter.h:556
Parameterised::setParametersStr
void setParametersStr(const std::string &paramsString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
Definition: Parameterised.cpp:139
GNEViewParent.h
GNEViewNetHelper::DemandViewOptions::showNonInspectedDemandElements
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
Definition: GNEViewNetHelper.cpp:1741
GLIncludes.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
VEHPARS_VTYPE_SET
const int VEHPARS_VTYPE_SET
Definition: SUMOVehicleParameter.h:46
GNESelectorFrame.h
GNEAttributeCarrier::TagProperties::getDefaultValue
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
Definition: GNEAttributeCarrier.cpp:574
GNEPerson::setAttribute
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:571
GUIMainWindow
Definition: GUIMainWindow.h:46
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
SUMOVehicleParameter::via
std::vector< std::string > via
List of the via-edges the vehicle must visit.
Definition: SUMOVehicleParameter.h:659
SUMOXMLDefinitions::isValidTypeID
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
Definition: SUMOXMLDefinitions.cpp:979
GNEPerson::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEPerson.cpp:275
GNEAttributeCarrier::TagProperties::hasTagSynonym
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
Definition: GNEAttributeCarrier.cpp:840
Parameterised::areParametersValid
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
Definition: Parameterised.cpp:166
GNE_SUPERMODE_DEMAND
@ GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
Definition: GNEViewNetHelper.h:48
VEHPARS_DEPARTPOS_SET
const int VEHPARS_DEPARTPOS_SET
Definition: SUMOVehicleParameter.h:48
InvalidArgument
Definition: UtilExceptions.h:56
GNEPerson::GNESelectedPersonsPopupMenu::myTransformToPerson
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:103
SUMOXMLDefinitions::isValidVehicleID
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
Definition: SUMOXMLDefinitions.cpp:973
GNEPerson::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:263
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
DepartPosDefinition
DepartPosDefinition
Possible ways to choose the departure position.
Definition: SUMOVehicleParameter.h:140
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:33
GNEDemandElement::getDemandElementID
const std::string & getDemandElementID() const
returns DemandElement ID
Definition: GNEDemandElement.cpp:369
GNEPerson::personPlanSegment::personPlanSegment
personPlanSegment()
constructor
Definition: GNEPerson.cpp:827
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:266
GNEPerson::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:732
GNERouteHandler::transformToPersonFlow
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
Definition: GNERouteHandler.cpp:1027
GNEPerson::GNEPersonPopupMenu::onCmdTransform
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:104
GNEHierarchicalParentElements::replaceParentDemandElement
void replaceParentDemandElement(GNEShape *shapeTobeChanged, const std::string &newParentDemandElementID, int demandElementParentIndex)
replace the parent demand element of a shape
Definition: GNEHierarchicalParentElements.cpp:540
SUMO_TAG_PERSONFLOW
@ SUMO_TAG_PERSONFLOW
Definition: SUMOXMLDefinitions.h:299
GUIVisualizationSettings::personValue
GUIVisualizationTextSettings personValue
Definition: GUIVisualizationSettings.h:541
GUIBasePersonHelper::drawAction_drawAsImage
static void drawAction_drawAsImage(const double angle, const double length, const double width, const std::string &file, const SUMOVehicleShape guiShape, const double exaggeration)
Definition: GUIBasePersonHelper.cpp:90
GUIVisualizationSettings::personName
GUIVisualizationTextSettings personName
Definition: GUIVisualizationSettings.h:541
GNE_ATTR_SELECTED
@ GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
StringTokenizer.h
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:434
SUMO_ATTR_END
@ SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:680
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
GUIVisualizationSettings::drawDetail
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
Definition: GUIVisualizationSettings.cpp:1669
VEHPARS_PERIOD_SET
const int VEHPARS_PERIOD_SET
Definition: SUMOVehicleParameter.h:52
GNEPerson::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEPerson.cpp:299
SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_DEPARTPOS
Definition: SUMOXMLDefinitions.h:433
DEPART_POS_GIVEN
@ DEPART_POS_GIVEN
The position is given.
Definition: SUMOVehicleParameter.h:144
GNESelectorFrame::LockGLObjectTypes::removeLockedObject
void removeLockedObject(const GUIGlObjectType type)
set object unselected
Definition: GNESelectorFrame.cpp:573
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
GNEUndoList
Definition: GNEUndoList.h:48
SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_VEHSPERHOUR
Definition: SUMOXMLDefinitions.h:786
MID_COPY_TYPED_NAME
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:384
SUMOVehicleParameter::parseDepartPos
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.
Definition: SUMOVehicleParameter.cpp:312
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
NBLoadedSUMOTLDef.h
SUMOVehicleParameter::repetitionNumber
int repetitionNumber
Definition: SUMOVehicleParameter.h:544
VEHPARS_END_SET
const int VEHPARS_END_SET
Definition: SUMOVehicleParameter.h:50
GNEPerson::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:317
GNEPerson::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:380
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
ICON_PERSON
@ ICON_PERSON
Definition: GUIIcons.h:306
SUMO_ATTR_NUMBER
@ SUMO_ATTR_NUMBER
Definition: SUMOXMLDefinitions.h:666
GNEPerson::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEPerson.cpp:508
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
GNEPerson::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:373
GUIPropertyScheme::getColor
const T getColor(const double value) const
Definition: GUIPropertyScheme.h:110
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEPerson::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:701
GNEPerson::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:707
GNEPerson::startGeometryMoving
void startGeometryMoving()
Definition: GNEPerson.cpp:293
GNEChange_Attribute.h
GNENet.h
GUIPropertySchemeStorage::getActive
int getActive() const
Definition: GUIPropertySchemeStorage.h:75
SUMOVehicleParameter::departPos
double departPos
(optional) The position the vehicle shall depart from
Definition: SUMOVehicleParameter.h:494
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
SUMO_TAG_TRIP
@ SUMO_TAG_TRIP
a single trip definition (used by router)
Definition: SUMOXMLDefinitions.h:145
GUISelectedStorage::deselect
void deselect(GUIGlID id)
Deselects the object with the given id.
Definition: GUISelectedStorage.cpp:130
GNEViewNet::getViewParent
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:1008
GNERouteHandler.h
GNESelectorFrame::getLockGLObjectTypes
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition: GNESelectorFrame.cpp:459
GNEUndoList.h
GUIVisualizationDetailSettings::personCircles
static const double personCircles
details for draw person as circles
Definition: GUIVisualizationSettings.h:331
GNEPerson::getPositionInView
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:347
GNEPerson::GNEPersonPopupMenu::~GNEPersonPopupMenu
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:100
GUIPropertySchemeStorage< GUIColorScheme >
Position::distanceSquaredTo
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
Definition: Position.h:238
GNESelectorFrame::LockGLObjectTypes::addedLockedObject
void addedLockedObject(const GUIGlObjectType type)
set object selected
Definition: GNESelectorFrame.cpp:567