Eclipse SUMO - Simulation of Urban MObility
AdditionalHandler.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 // The XML-Handler for additionals loading
19 /****************************************************************************/
20 #include <config.h>
21 
24 #include <utils/shapes/Shape.h>
27 
28 #include "AdditionalHandler.h"
29 
30 
31 // ===========================================================================
32 // method definitions
33 // ===========================================================================
34 
36 
37 
39 
40 
41 bool
43  // open SUMOBaseOBject
45  // check tag
46  try {
47  switch (tag) {
48  // Stopping Places
49  case SUMO_TAG_BUS_STOP:
51  break;
54  break;
55  case SUMO_TAG_ACCESS:
56  parseAccessAttributes(attrs);
57  break;
60  break;
63  break;
66  break;
69  break;
70  // Detectors
73  parseE1Attributes(attrs);
74  break;
77  parseE2Attributes(attrs);
78  break;
81  parseE3Attributes(attrs);
82  break;
83  case SUMO_TAG_DET_ENTRY:
84  parseEntryAttributes(attrs);
85  break;
86  case SUMO_TAG_DET_EXIT:
87  parseExitAttributes(attrs);
88  break;
91  break;
92  // TAZs
93  case SUMO_TAG_TAZ:
94  parseTAZAttributes(attrs);
95  break;
96  case SUMO_TAG_TAZSOURCE:
98  break;
99  case SUMO_TAG_TAZSINK:
100  parseTAZSinkAttributes(attrs);
101  break;
102  // Variable Speed Sign
103  case SUMO_TAG_VSS:
105  break;
106  case SUMO_TAG_STEP:
108  break;
109  // Calibrator
110  case SUMO_TAG_CALIBRATOR:
113  break;
114  // flow (calibrator)
115  case SUMO_TAG_FLOW:
117  break;
118  // Rerouter
119  case SUMO_TAG_REROUTER:
121  break;
122  case SUMO_TAG_INTERVAL:
124  break;
127  break;
130  break;
133  break;
136  break;
139  break;
140  // Route probe
141  case SUMO_TAG_ROUTEPROBE:
143  break;
144  // Vaporizer (deprecated)
145  case SUMO_TAG_VAPORIZER:
147  break;
148  // Poly
149  case SUMO_TAG_POLY:
150  parsePolyAttributes(attrs);
151  break;
152  case SUMO_TAG_POI:
153  parsePOIAttributes(attrs);
154  break;
155  // parameters
156  case SUMO_TAG_PARAM:
157  parseParameters(attrs);
158  break;
159  default:
160  // tag cannot be parsed in AdditionalHandler
161  return false;
162  break;
163  }
164  } catch (InvalidArgument& e) {
165  WRITE_ERROR(e.what());
166  }
167  return true;
168 }
169 
170 
171 void
173  // get last inserted object
175  // close SUMOBaseOBject
177  // check tag
178  switch (obj->getTag()) {
179  // Stopping Places
180  case SUMO_TAG_BUS_STOP:
181  case SUMO_TAG_TRAIN_STOP:
185  // detectors
186  case SUMO_TAG_E1DETECTOR:
188  case SUMO_TAG_E2DETECTOR:
190  case SUMO_TAG_E3DETECTOR:
193  // TAZs
194  case SUMO_TAG_TAZ:
195  // Variable Speed Sign
196  case SUMO_TAG_VSS:
197  // Calibrator
198  case SUMO_TAG_CALIBRATOR:
200  // Rerouter
201  case SUMO_TAG_REROUTER:
202  // Route probe
203  case SUMO_TAG_ROUTEPROBE:
204  // Vaporizer (deprecated)
205  case SUMO_TAG_VAPORIZER:
206  // Shapes
207  case SUMO_TAG_POLY:
208  case SUMO_TAG_POI:
209  // parse object and all their childrens
210  parseSumoBaseObject(obj);
211  // delete object (and all of their childrens)
212  delete obj;
213  break;
214  default:
215  break;
216  }
217 }
218 
219 
220 void
222  // switch tag
223  switch (obj->getTag()) {
224  // Stopping Places
225  case SUMO_TAG_BUS_STOP:
226  buildBusStop(obj,
237  obj->getParameters());
238  break;
239  case SUMO_TAG_TRAIN_STOP:
240  buildTrainStop(obj,
251  obj->getParameters());
252  break;
253  case SUMO_TAG_ACCESS:
254  buildAccess(obj,
259  obj->getParameters());
260  break;
262  buildContainerStop(obj,
273  obj->getParameters());
274  break;
287  obj->getParameters());
288  break;
290  buildParkingArea(obj,
303  obj->getParameters());
304  break;
306  buildParkingSpace(obj,
315  obj->getParameters());
316  break;
317  // Detectors
318  case SUMO_TAG_E1DETECTOR:
320  // build E1
321  buildE1Detector(obj,
330  obj->getParameters());
331  break;
332  case SUMO_TAG_E2DETECTOR:
349  obj->getParameters());
350  } else {
365  obj->getParameters());
366  }
367  break;
368  case SUMO_TAG_E3DETECTOR:
370  buildDetectorE3(obj,
379  obj->getParameters());
380  break;
381  case SUMO_TAG_DET_ENTRY:
382  buildDetectorEntry(obj,
386  obj->getParameters());
387  break;
388  case SUMO_TAG_DET_EXIT:
389  buildDetectorExit(obj,
393  obj->getParameters());
394  break;
404  obj->getParameters());
405  break;
406  // TAZs
407  case SUMO_TAG_TAZ:
408  buildTAZ(obj,
416  obj->getParameters());
417  break;
418  case SUMO_TAG_TAZSOURCE:
419  buildTAZSource(obj,
422  break;
423  case SUMO_TAG_TAZSINK:
424  buildTAZSink(obj,
427  break;
428  // Variable Speed Sign
429  case SUMO_TAG_VSS:
436  obj->getParameters());
437  break;
438  case SUMO_TAG_STEP:
442  break;
443  // Calibrator
444  case SUMO_TAG_CALIBRATOR:
455  obj->getParameters());
456  break;
468  obj->getParameters());
469  break;
470  case SUMO_TAG_FLOW:
472  obj->getVehicleParameter());
473  break;
474  // Rerouter
475  case SUMO_TAG_REROUTER:
476  buildRerouter(obj,
486  obj->getParameters());
487  break;
492  break;
497  break;
502  break;
508  break;
513  break;
514  case SUMO_TAG_INTERVAL:
515  // check if is VSS or a REROUTER interval
520  } else {
524  }
525  break;
526  // Route probe
527  case SUMO_TAG_ROUTEPROBE:
528  buildRouteProbe(obj,
535  obj->getParameters());
536  break;
537  // Vaporizer (deprecated)
538  case SUMO_TAG_VAPORIZER:
539  buildVaporizer(obj,
544  obj->getParameters());
545  break;
546  // Polygon
547  case SUMO_TAG_POLY:
548  buildPolygon(obj,
561  obj->getParameters());
562  break;
563  // POI
564  case SUMO_TAG_POI:
565  // check if we want to create a POI, POILane or POIGEO
566  if (obj->hasDoubleAttribute(SUMO_ATTR_X)) {
567  // build PO
568  buildPOI(obj,
581  obj->getParameters());
582  } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
583  // build POI over Lane
584  buildPOILane(obj,
599  obj->getParameters());
600  } else {
601  // build POIGEO
602  buildPOIGeo(obj,
615  obj->getParameters());
616  }
617  break;
618  default:
619  break;
620  }
621  // now iterate over childrens
622  for (const auto& child : obj->getSumoBaseObjectChildren()) {
623  // call this function recursively
624  parseSumoBaseObject(child);
625  }
626 }
627 
628 
629 void
631  // declare Ok Flag
632  bool parsedOk = true;
633  // needed attributes
634  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
635  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
636  // optional attributes
637  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
638  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
639  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
640  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
641  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
642  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
643  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor(false));
644  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
645  // continue if flag is ok
646  if (parsedOk) {
647  // set tag
649  // add all attributes
660  }
661 }
662 
663 
664 void
666  // declare Ok Flag
667  bool parsedOk = true;
668  // needed attributes
669  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
670  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
671  // optional attributes
672  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
673  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
674  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
675  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
676  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
677  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
678  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor(false));
679  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
680  // continue if flag is ok
681  if (parsedOk) {
682  // set tag
684  // add all attributes
695  }
696 }
697 
698 
699 void
701  // declare Ok Flag
702  bool parsedOk = true;
703  // needed attributes
704  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
705  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
706  // optional attributes
707  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00); /* in future updates, INVALID_DOUBLE */
708  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
709  // check parent
711  // continue if flag is ok
712  if (parsedOk) {
713  // set tag
715  // add all attributes
720  }
721 }
722 
723 
724 void
726  // declare Ok Flag
727  bool parsedOk = true;
728  // needed attributes
729  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
730  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
731  // optional attributes
732  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
733  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
734  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
735  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
736  const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
737  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
738  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor(false));
739  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
740  // continue if flag is ok
741  if (parsedOk) {
742  // set tag
744  // add all attributes
755  }
756 }
757 
758 
759 void
761  // declare Ok Flag
762  bool parsedOk = true;
763  // needed attributes
764  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
765  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
766  // optional attributes
767  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
768  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
769  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
770  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
771  const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
772  const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
773  const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
774  const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
775  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
776  // continue if flag is ok
777  if (parsedOk) {
778  // set tag
780  // add all attributes
792  }
793 }
794 
795 
796 void
798  // declare Ok Flag
799  bool parsedOk = true;
800  // needed attributes
801  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
802  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
803  // optional attributes
804  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
805  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
806  const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
807  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
808  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
809  const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
810  const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
811  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
812  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
813  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
814  // continue if flag is ok
815  if (parsedOk) {
816  // set tag
818  // add all attributes
831  }
832 }
833 
834 
835 void
837  // declare Ok Flag
838  bool parsedOk = true;
839  // needed attributes
840  const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
841  const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
842  // optional attributes
843  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
844  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
845  const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
846  const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
847  const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
848  const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
849  // check parent
851  // continue if flag is ok
852  if (parsedOk) {
853  // set tag
855  // add all attributes
864  }
865 }
866 
867 
868 void
870  // declare Ok Flag
871  bool parsedOk = true;
872  // needed attributes
873  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
874  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
875  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
876  const SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), parsedOk);
877  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
878  // optional attributes
879  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
880  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
881  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
882  // continue if flag is ok
883  if (parsedOk) {
884  // set tag
886  // add all attributes
895  }
896 }
897 
898 
899 void
901  // declare Ok Flag
902  bool parsedOk = true;
903  // check that frequency and trafficLight aren't defined together
905  WRITE_ERROR("Define either '" + toString(SUMO_ATTR_FREQUENCY) + "' or '" + toString(SUMO_ATTR_TLID) + "' in a lane area detector.");
906  parsedOk = false;
907  }
908  // check that lane and length are defined together
910  WRITE_ERROR("'lane' and 'length' must be defined together in a lane area detector.");
911  parsedOk = false;
912  }
913  // check that lanes and endPos are defined together
915  WRITE_ERROR("'lanes' and 'endPos' must be defined together in a lane area detector.");
916  parsedOk = false;
917  }
918  // needed attributes
919  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
920  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
921  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
922  // special attributes
923  const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
924  const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
925  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
926  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
927  const SUMOTime frequency = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), parsedOk, -1);
928  const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
929  // optional attributes
930  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
931  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
932  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
933  const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
934  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
935  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
936  // continue if flag is ok
937  if (parsedOk) {
938  // set tag
940  // add attributes depending of Lane/Lanes
941  if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
944  } else {
947  }
948  // add all attributes
960  }
961 }
962 
963 
964 void
966  // declare Ok Flag
967  bool parsedOk = true;
968  // needed attributes
969  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
970  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
971  const SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), parsedOk);
972  // optional attributes
973  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
974  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
975  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
976  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
977  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
978  // continue if flag is ok
979  if (parsedOk) {
980  // set tag
982  // add all attributes
991  }
992 }
993 
994 
995 void
997  // declare Ok Flag
998  bool parsedOk = true;
999  // needed attributes
1000  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1001  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1002  // optional attributes
1003  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1004  // check parent
1006  // continue if flag is ok
1007  if (parsedOk) {
1008  // set tag
1010  // add all attributes
1014  }
1015 }
1016 
1017 
1018 void
1020  // declare Ok Flag
1021  bool parsedOk = true;
1022  // needed attributes
1023  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1024  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1025  // optional attributes
1026  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1027  // check parent
1029  // continue if flag is ok
1030  if (parsedOk) {
1031  // set tag
1033  // add all attributes
1037  }
1038 }
1039 
1040 
1041 void
1043  // declare Ok Flag
1044  bool parsedOk = true;
1045  // needed attributes
1046  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1047  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1048  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1049  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1050  // optional attributes
1051  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1052  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1053  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1054  // continue if flag is ok
1055  if (parsedOk) {
1056  // set tag
1058  // add all attributes
1066  }
1067 }
1068 
1069 
1070 void
1072  // declare Ok Flag
1073  bool parsedOk = true;
1074  // needed attributes
1075  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1076  // optional attributes
1077  const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1078  const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position());
1079  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1080  const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1081  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1082  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1083  // continue if flag is ok
1084  if (parsedOk) {
1085  // set tag
1087  // add all attributes
1095  }
1096 }
1097 
1098 
1099 void
1101  // declare Ok Flag
1102  bool parsedOk = true;
1103  // needed attributes
1104  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1105  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1106  // check parent
1108  // continue if flag is ok
1109  if (parsedOk) {
1110  // set tag
1112  // add all attributes
1115  }
1116 }
1117 
1118 
1119 void
1121  // declare Ok Flag
1122  bool parsedOk = true;
1123  // needed attributes
1124  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1125  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1126  // check parent
1128  // continue if flag is ok
1129  if (parsedOk) {
1130  // set tag
1132  // add all attributes
1135  }
1136 }
1137 
1138 
1139 void
1141  // declare Ok Flag
1142  bool parsedOk = true;
1143  // needed attributes
1144  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1145  const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1146  // optional attributes
1147  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1148  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1149  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1150  // continue if flag is ok
1151  if (parsedOk) {
1152  // set tag
1154  // add all attributes
1160  }
1161 }
1162 
1163 
1164 void
1166  // declare Ok Flag
1167  bool parsedOk = true;
1168  // needed attributes
1169  const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1170  // optional attributes
1171  const std::string speed = attrs.getOpt<std::string>(SUMO_ATTR_SPEED, "", parsedOk, "");
1172  // check parent
1173  checkParent(SUMO_TAG_STEP, {SUMO_TAG_VSS}, parsedOk);
1174  // continue if flag is ok
1175  if (parsedOk) {
1176  // set tag
1178  // add all attributes
1181  }
1182 }
1183 
1184 
1185 void
1187  // declare Ok Flag
1188  bool parsedOk = true;
1189  // check that frecuency and trafficLight aren't defined together
1190  if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1191  (!attrs.hasAttribute(SUMO_ATTR_EDGE) && !attrs.hasAttribute(SUMO_ATTR_LANE))) {
1192  WRITE_ERROR("Calibrators need either an edge or a lane");
1193  parsedOk = false;
1194  }
1195  // needed attributes
1196  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1197  const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1198  // special attributes
1199  const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1200  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1201  // optional attributes
1202  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1203  const SUMOTime freq = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), parsedOk, DELTA_T);
1204  const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1205  const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1206  const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1207  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1208  // continue if flag is ok
1209  if (parsedOk) {
1210  // set tag depending of edge/lane
1211  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1214  } else {
1217  }
1226  }
1227 }
1228 
1229 
1230 void
1232  // check parent
1235  // check that frecuency and trafficLight aren't defined together
1237  WRITE_ERROR("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)");
1238  }
1239  // first parse flow
1241  string2time(OptionsCont::getOptions().getString("begin")),
1242  string2time(OptionsCont::getOptions().getString("end")));
1243  if (flowParameter) {
1244  // set tag
1246  // set vehicle parameters
1248  // delete flow parameter (because in XMLStructure we have a copy)
1249  delete flowParameter;
1250  }
1251  }
1252 }
1253 
1254 
1255 void
1257  // declare Ok Flag
1258  bool parsedOk = true;
1259  // needed attributes
1260  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1261  const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1262  // optional attributes
1263  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1264  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1265  const std::string file = attrs.getOpt<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk, "");
1266  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1267  SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1268  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1269  const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1270  // continue if flag is ok
1271  if (parsedOk) {
1272  // set tag
1274  // add all attributes
1284  }
1285 }
1286 
1287 
1288 void
1290  // declare Ok Flag
1291  bool parsedOk = true;
1292  // needed attributes
1293  const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1294  const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1295  // check parent
1297  // continue if flag is ok
1298  if (parsedOk) {
1299  // set tag
1301  // add all attributes
1304  }
1305 }
1306 
1307 
1308 void
1310  // declare Ok Flag
1311  bool parsedOk = true;
1312  // needed attributes
1313  const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1314  // optional attributes
1315  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, "authority");
1316  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1317  // check parent
1319  // continue if flag is ok
1320  if (parsedOk) {
1321  // set tag
1323  // add all attributes
1327  }
1328 }
1329 
1330 
1331 void
1333  // declare Ok Flag
1334  bool parsedOk = true;
1335  // needed attributes
1336  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1337  // optional attributes
1338  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, "authority");
1339  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1340  // check parent
1342  // continue if flag is ok
1343  if (parsedOk) {
1344  // set tag
1346  // add all attributes
1350  }
1351 }
1352 
1353 
1354 void
1356  // declare Ok Flag
1357  bool parsedOk = true;
1358  // needed attributes
1359  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1360  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1361  // check parent
1363  // continue if flag is ok
1364  if (parsedOk) {
1365  if (probability < 0) {
1366  WRITE_ERROR("Probability of " + toString(SUMO_TAG_DEST_PROB_REROUTE) + " must be equal or greater than 0");
1367  } else {
1368  // set tag
1370  // add all attributes
1373  }
1374  }
1375 }
1376 
1377 
1378 void
1380  // declare Ok Flag
1381  bool parsedOk = true;
1382  // needed attributes
1383  const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1384  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1385  // optional attributes
1386  const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1387  // check parent
1389  // continue if flag is ok
1390  if (parsedOk) {
1391  if (probability < 0) {
1392  WRITE_ERROR("Probability of " + toString(SUMO_TAG_PARKING_AREA_REROUTE) + " must be equal or greater than 0");
1393  } else {
1394  // set tag
1396  // add all attributes
1400  }
1401  }
1402 }
1403 
1404 
1405 void
1407  // declare Ok Flag
1408  bool parsedOk = true;
1409  // needed attributes
1410  const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1411  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1412  // check parent
1414  // continue if flag is ok
1415  if (parsedOk) {
1416  if (probability < 0) {
1417  WRITE_ERROR("Probability of " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + " must be equal or greater than 0");
1418  } else {
1419  // set tag
1421  // add all attributes
1424  }
1425  }
1426 }
1427 
1428 
1429 void
1431  // declare Ok Flag
1432  bool parsedOk = true;
1433  // needed attributes
1434  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1435  const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1436  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1437  SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), parsedOk);
1438  SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1439  // optional attributes
1440  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1441  // continue if flag is ok
1442  if (parsedOk) {
1443  // set tag
1445  // add all attributes
1452  }
1453 }
1454 
1455 
1456 void
1458  // declare Ok Flag
1459  bool parsedOk = true;
1460  // needed attributes
1461  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1462  SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1463  SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1464  // optional attributes
1465  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1466  // continue if flag is ok
1467  if (parsedOk) {
1468  // set tag
1470  // add all attributes
1475  }
1476 }
1477 
1478 
1479 void
1481  // declare Ok Flag
1482  bool parsedOk = true;
1483  // needed attributes
1484  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1485  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1486  // optional attributes
1487  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1488  const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1489  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1490  const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1491  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1492  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1493  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1494  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1495  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1496  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1497  // continue if flag is ok
1498  if (parsedOk) {
1499  // set tag
1501  // add all attributes
1514  }
1515 }
1516 
1517 
1518 void
1520  // declare Ok Flag
1521  bool parsedOk = true;
1522  // check that x and y are defined together
1523  if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1524  (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1525  WRITE_ERROR("X and Y must be be defined together in POIs");
1526  parsedOk = false;
1527  }
1528  // check that lane and pos are defined together
1529  if ((attrs.hasAttribute(SUMO_ATTR_LANE) && !attrs.hasAttribute(SUMO_ATTR_POSITION)) ||
1531  WRITE_ERROR("lane and position must be be defined together in POIs");
1532  parsedOk = false;
1533  }
1534  // check that lon and lat are defined together
1535  if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1536  (!attrs.hasAttribute(SUMO_ATTR_LON) && attrs.hasAttribute(SUMO_ATTR_LAT))) {
1537  WRITE_ERROR("lon and lat must be be defined together in POIs");
1538  parsedOk = false;
1539  }
1540  // needed attributes
1541  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1542  // special attributes
1543  const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1544  const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1545  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1546  const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1547  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1548  const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1549  const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1550  const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1551  // optional attributes
1552  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1553  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1554  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1555  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1556  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1557  const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1558  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1559  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1560  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1561  // continue if flag is ok
1562  if (parsedOk) {
1563  // set tag
1565  // add attributes depending of Lane/Lanes
1566  if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1569  } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1574  } else {
1577  }
1578  // add rest attributes
1589  }
1590 }
1591 
1592 
1593 void
1595  // declare Ok Flag
1596  bool parsedOk = true;
1597  // get key
1598  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, parsedOk);
1599  // get SumoBaseObject parent
1601  // check parent
1602  if (SumoBaseObjectParent == nullptr) {
1603  WRITE_ERROR("Parameters must be defined within an object.");
1604  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_ROOTFILE) {
1605  WRITE_ERROR("Parameters cannot be defined in the additional file's root.");
1606  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_PARAM) {
1607  WRITE_ERROR("Parameters cannot be defined within another parameter.");
1608  } else if (parsedOk) {
1609  // get tag str
1610  const std::string parentTagStr = toString(SumoBaseObjectParent->getTag());
1611  // circumventing empty string value
1612  const std::string value = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
1613  // show warnings if values are invalid
1614  if (key.empty()) {
1615  WRITE_WARNING("Error parsing key from " + parentTagStr + " generic parameter. Key cannot be empty.");
1616  } else if (!SUMOXMLDefinitions::isValidParameterKey(key)) {
1617  WRITE_WARNING("Error parsing key from " + parentTagStr + " generic parameter. Key contains invalid characters.");
1618  } else {
1619  WRITE_DEBUG("Inserting generic parameter '" + key + "|" + value + "' into " + parentTagStr);
1620  // insert parameter in SumoBaseObjectParent
1621  SumoBaseObjectParent->addParameter(key, value);
1622  }
1623  }
1624 }
1625 
1626 
1627 void
1628 AdditionalHandler::checkParent(const SumoXMLTag currentTag, const std::vector<SumoXMLTag>& parentTags, bool& ok) const {
1629  // check that parent SUMOBaseObject's tag is the parentTag
1631  if ((parent != nullptr) &&
1632  (parentTags.size() > 0) &&
1633  (std::find(parentTags.begin(), parentTags.end(), parent->getTag()) == parentTags.end())) {
1634  const std::string id = parent->hasStringAttribute(SUMO_ATTR_ID) ? ", id: '" + parent->getStringAttribute(SUMO_ATTR_ID) + "'" : "";
1635  WRITE_ERROR("'" + toString(currentTag) + "' must be defined within the definition of a '" + toString(parentTags.front()) + "' (found '" + toString(parent->getTag()) + "'" + id + ").");
1636  ok = false;
1637  }
1638 }
1639 
1640 /****************************************************************************/
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:290
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:288
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
long long int SUMOTime
Definition: SUMOTime.h:32
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_CLOSING_REROUTE
reroute of type closing
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_E2DETECTOR
an e2 detector
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ SUMO_TAG_ROOTFILE
root file
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_LANECALIBRATOR
A calibrator placed over lane (used in netedit)
@ SUMO_TAG_STEP
trigger: a step description
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ SUMO_TAG_DET_ENTRY
an e3 entry point
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ SUMO_TAG_DEST_PROB_REROUTE
probability of destiny of a reroute
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_E1DETECTOR
an e1 detector
@ SUMO_TAG_DET_EXIT
an e3 exit point
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_CLOSING_LANE_REROUTE
lane of a reroute of type closing
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
@ SUMO_TAG_E3DETECTOR
an e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_LINES
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_LANE
@ SUMO_ATTR_LON
@ SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_VALUE
@ SUMO_ATTR_FILE
@ SUMO_ATTR_Y
@ SUMO_ATTR_Z
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_PARKING_LENGTH
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_X
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_OFF
@ SUMO_ATTR_ROUTEPROBE
@ SUMO_ATTR_LINEWIDTH
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_GEO
@ SUMO_ATTR_LANES
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_CHARGEINTRANSIT
Allow/disallow charge in transit in Charging Stations.
@ SUMO_ATTR_CONTAINER_CAPACITY
@ SUMO_ATTR_FILL
Fill the polygon.
@ SUMO_ATTR_NAME
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_SLOPE
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_FREQUENCY
@ SUMO_ATTR_CENTER
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ROADSIDE_CAPACITY
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_OUTPUT
@ SUMO_ATTR_CHARGINGPOWER
@ SUMO_ATTR_PROB
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_ONROAD
@ SUMO_ATTR_LAT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_EFFICIENCY
Eficiency of the charge in Charging Stations.
@ SUMO_ATTR_ID
@ SUMO_ATTR_VISIBLE
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_KEY
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_CHARGEDELAY
Delay in the charge of charging stations.
@ SUMO_ATTR_TIME
trigger: the time of the step
@ SUMO_ATTR_RELATIVEPATH
const double INVALID_DOUBLE
Definition: StdDefs.h:63
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
virtual void buildDestProbReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newEdgeDestinationID, const double probability)=0
builds a dest prob reroute
void parseE1InstantAttributes(const SUMOSAXAttributes &attrs)
parse E1 instant attributes
void parseCalibratorAttributes(const SUMOSAXAttributes &attrs)
parse calibrator attributes
void parseChargingStationAttributes(const SUMOSAXAttributes &attrs)
parse chargingStation attributes
virtual void buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newRouteID, const double probability)=0
builds a route prob reroute
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
virtual void buildRerouterInterval(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOTime begin, const SUMOTime end)=0
builds a rerouter interval
void parseRouteProbRerouteAttributes(const SUMOSAXAttributes &attrs)
parse route prob reroute attributes
virtual void buildContainerStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int containerCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const std::map< std::string, std::string > &parameters)=0
Builds a container stop.
void parseCalibratorFlowAttributes(const SUMOSAXAttributes &attrs)
parse calibrator flow attributes
void parseParkingAreaRerouteAttributes(const SUMOSAXAttributes &attrs)
parse parking area reroute attributes
void parseTAZAttributes(const SUMOSAXAttributes &attrs)
parse TAZ attributes
AdditionalHandler()
Constructor.
virtual void buildEdgeCalibrator(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &edgeID, const double pos, const std::string &name, const std::string &outfile, const SUMOTime freq, const std::string &routeprobe, const double jamThreshold, const std::vector< std::string > &vTypes, const std::map< std::string, std::string > &parameters)=0
builds a microscopic calibrator over an edge
virtual void buildRerouter(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const std::vector< std::string > &edgeIDs, const double prob, const std::string &name, const std::string &file, const bool off, const SUMOTime timeThreshold, const std::vector< std::string > &vTypes, const std::map< std::string, std::string > &parameters)=0
builds a rerouter
virtual void buildParkingSpace(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const double x, const double y, const double z, const std::string &name, const std::string &width, const std::string &length, const std::string &angle, const double slope, const std::map< std::string, std::string > &parameters)=0
Builds a Parking Space.
CommonXMLStructure myCommonXMLStructure
common XML Structure
virtual void buildVaporizer(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const SUMOTime from, const SUMOTime endTime, const std::string &name, const std::map< std::string, std::string > &parameters)=0
Builds a vaporizer (lane speed additional)
virtual void buildPOIGeo(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double lon, const double lat, const double layer, const double angle, const std::string &imgFile, bool relativePath, const double width, const double height, const std::string &name, const std::map< std::string, std::string > &parameters)=0
Builds a POI in GEO coordinaten using the given values.
void parseE3Attributes(const SUMOSAXAttributes &attrs)
parse E3 attributes
void parseE2Attributes(const SUMOSAXAttributes &attrs)
parse E2 attributes
void parseTAZSinkAttributes(const SUMOSAXAttributes &attrs)
parse TAZ sink attributes
bool beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs)
begin parse attributes
void parseTrainStopAttributes(const SUMOSAXAttributes &attrs)
parse trainStop attributes
virtual void buildVariableSpeedSignStep(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOTime time, const std::string &speed)=0
Builds a VariableSpeedSign Step.
virtual void buildDetectorEntry(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const bool friendlyPos, const std::map< std::string, std::string > &parameters)=0
Builds a entry detector (E3)
virtual void buildBusStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int personCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const std::map< std::string, std::string > &parameters)=0
Builds a bus stop.
void parsePOIAttributes(const SUMOSAXAttributes &attrs)
parse POI attributes
void endParseAttributes()
end parse attributes
virtual void buildAccess(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const double length, const bool friendlyPos, const std::map< std::string, std::string > &parameters)=0
Builds an Access.
virtual void buildVariableSpeedSign(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const std::vector< std::string > &laneIDs, const std::string &name, const std::vector< std::string > &vTypes, const std::map< std::string, std::string > &parameters)=0
Builds a VariableSpeedSign (lane speed additional)
virtual void buildParkingArea(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &departPos, const std::string &name, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad, const double width, const double length, const double angle, const std::map< std::string, std::string > &parameters)=0
Builds a Parking Area.
void parseVariableSpeedSignAttributes(const SUMOSAXAttributes &attrs)
parse variable speed sign attributes
void checkParent(const SumoXMLTag currentTag, const std::vector< SumoXMLTag > &parentTags, bool &ok) const
check parents
~AdditionalHandler()
Destructor.
virtual void buildPOI(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double x, const double y, const double layer, const double angle, const std::string &imgFile, bool relativePath, const double width, const double height, const std::string &name, const std::map< std::string, std::string > &parameters)=0
Builds a POI using the given values.
void parseDestProbRerouteAttributes(const SUMOSAXAttributes &attrs)
parse dest prob reroute attributes
virtual void buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const double length, const SUMOTime freq, const std::string &trafficLight, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const std::map< std::string, std::string > &parameters)=0
Builds a single-lane Area Detector (E2)
virtual void buildCalibratorFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameter)=0
builds a calibrator flow
void parseE1Attributes(const SUMOSAXAttributes &attrs)
parse E1 attributes
void parseVariableSpeedSignStepAttributes(const SUMOSAXAttributes &attrs)
parse variable speed sign step attributes
void parseParameters(const SUMOSAXAttributes &attrs)
parse generic parameters
virtual void buildPOILane(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const std::string &laneID, const double posOverLane, const bool friendlyPosition, const double posLat, const double layer, const double angle, const std::string &imgFile, const bool relativePath, const double width, const double height, const std::string &name, const std::map< std::string, std::string > &parameters)=0
Builds a POI over lane using the given values.
virtual void buildDetectorE3(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const SUMOTime freq, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const std::map< std::string, std::string > &parameters)=0
Builds a multi entry exit detector (E3)
void parseParkingSpaceAttributes(const SUMOSAXAttributes &attrs)
parse parking space attributes
void parseExitAttributes(const SUMOSAXAttributes &attrs)
parse exist attributes
virtual void buildClosingLaneReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &closedLane, SVCPermissions permissions)=0
builds a closing lane reroute
virtual void buildTAZSink(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const double arrivalWeight)=0
Builds a TAZSink (Traffic Assignment Zone)
virtual void buildTrainStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int personCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const std::map< std::string, std::string > &parameters)=0
Builds a train stop.
void parseRerouterAttributes(const SUMOSAXAttributes &attrs)
parse rerouter attributes
void parseBusStopAttributes(const SUMOSAXAttributes &attrs)
virtual void buildClosingReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &closedEdgeID, SVCPermissions permissions)=0
builds a closing edge reroute
void parseContainerStopAttributes(const SUMOSAXAttributes &attrs)
parse containerStop attributes
void parseParkingAreaAttributes(const SUMOSAXAttributes &attrs)
parse parking area attributes
void parseRouteProbeAttributes(const SUMOSAXAttributes &attrs)
parse route probe attributes
void parseAccessAttributes(const SUMOSAXAttributes &attrs)
parse access attributes
void parseTAZSourceAttributes(const SUMOSAXAttributes &attrs)
parse TAZ source attributes
void parseVaporizerAttributes(const SUMOSAXAttributes &attrs)
parse vaporizer attributes
virtual void buildChargingStation(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const double chargingPower, const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay, const bool friendlyPosition, const std::map< std::string, std::string > &parameters)=0
Builds a charging Station.
virtual void buildE1Detector(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double position, const SUMOTime frequency, const std::string &file, const std::vector< std::string > &vehicleTypes, const std::string &name, const bool friendlyPos, const std::map< std::string, std::string > &parameters)=0
Builds a induction loop detector (E1)
virtual void buildMultiLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::vector< std::string > &lanes, const double pos, const double endPos, const SUMOTime freq, const std::string &trafficLight, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const std::map< std::string, std::string > &parameters)=0
Builds a multi-lane Area Detector (E2)
virtual void buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newParkignAreaID, const double probability, const bool visible)=0
builds a parking area reroute
void parseClosingLaneRerouteAttributes(const SUMOSAXAttributes &attrs)
parse closing lane reroute attributes
virtual void buildPolygon(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double layer, const double angle, const std::string &imgFile, const bool relativePath, const PositionVector &shape, const bool geo, const bool fill, const double lineWidth, const std::string &name, const std::map< std::string, std::string > &parameters)=0
Builds a polygon using the given values.
virtual void buildDetectorExit(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const bool friendlyPos, const std::map< std::string, std::string > &parameters)=0
Builds a exit detector (E3)
virtual void buildRouteProbe(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &edgeID, const SUMOTime freq, const std::string &name, const std::string &file, const SUMOTime begin, const std::map< std::string, std::string > &parameters)=0
builds a Route probe
void parseRerouterIntervalAttributes(const SUMOSAXAttributes &attrs)
parse rerouter interval attributes
virtual void buildDetectorE1Instant(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::string &name, const bool friendlyPos, const std::map< std::string, std::string > &parameters)=0
Builds a Instant Induction Loop Detector (E1Instant)
void parseEntryAttributes(const SUMOSAXAttributes &attrs)
parse entry attributes
virtual void buildTAZSource(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const double departWeight)=0
Builds a TAZSource (Traffic Assignment Zone)
virtual void buildTAZ(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, const Position &center, const bool fill, const RGBColor &color, const std::vector< std::string > &edgeIDs, const std::string &name, const std::map< std::string, std::string > &parameters)=0
Builds a TAZ (Traffic Assignment Zone)
void parsePolyAttributes(const SUMOSAXAttributes &attrs)
void parseClosingRerouteAttributes(const SUMOSAXAttributes &attrs)
parse closing reroute attributes
virtual void buildLaneCalibrator(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const std::string &name, const std::string &outfile, const SUMOTime freq, const std::string &routeprobe, const double jamThreshold, const std::vector< std::string > &vTypes, const std::map< std::string, std::string > &parameters)=0
builds a microscopic calibrator over a lane
void addIntAttribute(const SumoXMLAttr attr, const int value)
add int attribute into current SumoBaseObject node
const RGBColor & getColorAttribute(const SumoXMLAttr attr) const
get color attribute
SUMOTime getTimeAttribute(const SumoXMLAttr attr) const
get time attribute
const PositionVector & getPositionVectorAttribute(const SumoXMLAttr attr) const
get PositionVector attribute
bool hasStringAttribute(const SumoXMLAttr attr) const
has function
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
SumoBaseObject * getParentSumoBaseObject() const
get pointer to mySumoBaseObjectParent SumoBaseObject (if is null, then is the root)
const Position & getPositionAttribute(const SumoXMLAttr attr) const
get Position attribute
void addPositionVectorAttribute(const SumoXMLAttr attr, const PositionVector &value)
add PositionVector attribute into current SumoBaseObject node
const std::map< std::string, std::string > & getParameters() const
get parameters
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addTimeAttribute(const SumoXMLAttr attr, const SUMOTime value)
add time attribute into current SumoBaseObject node
void addStringListAttribute(const SumoXMLAttr attr, const std::vector< std::string > &value)
add string list attribute into current SumoBaseObject node
int getIntAttribute(const SumoXMLAttr attr) const
get int attribute
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
bool hasDoubleAttribute(const SumoXMLAttr attr) const
check if current SumoBaseObject has the given double attribute
void addPositionAttribute(const SumoXMLAttr attr, const Position &value)
add Position attribute into current SumoBaseObject node
bool getBoolAttribute(const SumoXMLAttr attr) const
get bool attribute
void setVehicleParameter(const SUMOVehicleParameter *vehicleParameter)
set vehicle parameters
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
double getDoubleAttribute(const SumoXMLAttr attr) const
get double attribute
const SUMOVehicleParameter & getVehicleParameter() const
get vehicle parameters
const std::vector< std::string > & getStringListAttribute(const SumoXMLAttr attr) const
get string list attribute
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
const std::string & getStringAttribute(const SumoXMLAttr attr) const
get string attribute
const std::vector< SumoBaseObject * > & getSumoBaseObjectChildren() const
get SumoBaseObject children
CommonXMLStructure::SumoBaseObject * getCurrentSumoBaseObject() const
get current editedSumoBaseObject
void openSUMOBaseOBject()
open SUMOBaseOBject
void closeSUMOBaseOBject()
close myTag
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:293
A list of positions.
static const RGBColor RED
named colors
Definition: RGBColor.h:185
Encapsulated SAX-Attributes.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
Structure representing possible vehicle parameter.
static SUMOVehicleParameter * parseFlowAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs, const bool hardFail, const bool needID, const SUMOTime beginDefault, const SUMOTime endDefault)
Parses a flow's attributes.
static bool isValidParameterKey(const std::string &value)
whether the given string is a valid key for a parameter
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:47
static const double DEFAULT_LAYER
Definition: Shape.h:42
static const double DEFAULT_LAYER_POI
Definition: Shape.h:44
static const double DEFAULT_IMG_WIDTH
Definition: Shape.h:48
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:46
static const double DEFAULT_LINEWIDTH
Definition: Shape.h:43
static const double DEFAULT_ANGLE
Definition: Shape.h:45
static const double DEFAULT_IMG_HEIGHT
Definition: Shape.h:49
static const std::string DEFAULT_TYPE
Definition: Shape.h:41