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.dev/sumo
3 // Copyright (C) 2001-2024 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>
28 
29 #include "AdditionalHandler.h"
30 
31 
32 // ===========================================================================
33 // method definitions
34 // ===========================================================================
35 
37 
38 
40 
41 
42 bool
44  // open SUMOBaseOBject
46  // check tag
47  try {
48  switch (tag) {
49  // Stopping Places
50  case SUMO_TAG_BUS_STOP:
52  break;
55  break;
56  case SUMO_TAG_ACCESS:
57  parseAccessAttributes(attrs);
58  break;
61  break;
64  break;
67  break;
70  break;
71  // Detectors
74  parseE1Attributes(attrs);
75  break;
78  parseE2Attributes(attrs);
79  break;
82  parseE3Attributes(attrs);
83  break;
84  case SUMO_TAG_DET_ENTRY:
85  parseEntryAttributes(attrs);
86  break;
87  case SUMO_TAG_DET_EXIT:
88  parseExitAttributes(attrs);
89  break;
92  break;
93  // TAZs
94  case SUMO_TAG_TAZ:
95  parseTAZAttributes(attrs);
96  break;
97  case SUMO_TAG_TAZSOURCE:
99  break;
100  case SUMO_TAG_TAZSINK:
101  parseTAZSinkAttributes(attrs);
102  break;
103  // Variable Speed Sign
104  case SUMO_TAG_VSS:
106  break;
107  case SUMO_TAG_STEP:
109  break;
110  // Calibrator
111  case SUMO_TAG_CALIBRATOR:
114  break;
115  // flow (calibrator)
116  case SUMO_TAG_FLOW:
118  break;
119  // Rerouter
120  case SUMO_TAG_REROUTER:
122  break;
123  case SUMO_TAG_INTERVAL:
125  break;
128  break;
131  break;
134  break;
137  break;
140  break;
141  // Route probe
142  case SUMO_TAG_ROUTEPROBE:
144  break;
145  // Vaporizer (deprecated)
146  case SUMO_TAG_VAPORIZER:
148  break;
149  // wires
152  break;
154  parseOverheadWireClamp(attrs);
155  break;
157  parseOverheadWire(attrs);
158  break;
159  // Poly
160  case SUMO_TAG_POLY:
161  parsePolyAttributes(attrs);
162  break;
163  case SUMO_TAG_POI:
164  parsePOIAttributes(attrs);
165  break;
166  // JuPedSim
169  break;
172  break;
173  // parameters
174  case SUMO_TAG_PARAM:
175  parseParameters(attrs);
176  break;
177  default:
178  // tag cannot be parsed in AdditionalHandler
179  return false;
180  break;
181  }
182  } catch (InvalidArgument& e) {
183  writeError(e.what());
184  }
185  return true;
186 }
187 
188 
189 void
191  // get last inserted object
193  // close SUMOBaseOBject
195  // check tag
196  switch (obj->getTag()) {
197  // Stopping Places
198  case SUMO_TAG_BUS_STOP:
199  case SUMO_TAG_TRAIN_STOP:
203  // detectors
204  case SUMO_TAG_E1DETECTOR:
206  case SUMO_TAG_E2DETECTOR:
208  case SUMO_TAG_E3DETECTOR:
211  // TAZs
212  case SUMO_TAG_TAZ:
213  // Variable Speed Sign
214  case SUMO_TAG_VSS:
215  // Calibrator
216  case SUMO_TAG_CALIBRATOR:
218  // Rerouter
219  case SUMO_TAG_REROUTER:
220  // Route probe
221  case SUMO_TAG_ROUTEPROBE:
222  // Vaporizer (deprecated)
223  case SUMO_TAG_VAPORIZER:
224  // wires
228  // Shapes
229  case SUMO_TAG_POLY:
230  case SUMO_TAG_POI:
231  // JuPedSim
234  // parse object and all their childrens
235  parseSumoBaseObject(obj);
236  // delete object (and all of their childrens)
237  delete obj;
238  break;
239  default:
240  break;
241  }
242 }
243 
244 
245 void
247  // switch tag
248  switch (obj->getTag()) {
249  // Stopping Places
250  case SUMO_TAG_BUS_STOP:
251  buildBusStop(obj,
262  obj->getParameters());
263  break;
264  case SUMO_TAG_TRAIN_STOP:
265  buildTrainStop(obj,
276  obj->getParameters());
277  break;
278  case SUMO_TAG_ACCESS:
279  buildAccess(obj,
284  obj->getParameters());
285  break;
287  buildContainerStop(obj,
298  obj->getParameters());
299  break;
315  obj->getParameters());
316  break;
318  buildParkingArea(obj,
333  obj->getParameters());
334  break;
336  buildParkingSpace(obj,
345  obj->getParameters());
346  break;
347  // Detectors
348  case SUMO_TAG_E1DETECTOR:
350  // build E1
351  buildE1Detector(obj,
355  obj->getPeriodAttribute(),
360  obj->getParameters());
361  break;
362  case SUMO_TAG_E2DETECTOR:
370  obj->getPeriodAttribute(),
379  obj->getParameters());
380  } else {
386  obj->getPeriodAttribute(),
395  obj->getParameters());
396  }
397  break;
398  case SUMO_TAG_E3DETECTOR:
400  buildDetectorE3(obj,
403  obj->getPeriodAttribute(),
410  obj->getParameters());
411  break;
412  case SUMO_TAG_DET_ENTRY:
413  buildDetectorEntry(obj,
417  obj->getParameters());
418  break;
419  case SUMO_TAG_DET_EXIT:
420  buildDetectorExit(obj,
424  obj->getParameters());
425  break;
435  obj->getParameters());
436  break;
437  // TAZs
438  case SUMO_TAG_TAZ:
439  buildTAZ(obj,
447  obj->getParameters());
448  break;
449  case SUMO_TAG_TAZSOURCE:
450  buildTAZSource(obj,
453  break;
454  case SUMO_TAG_TAZSINK:
455  buildTAZSink(obj,
458  break;
459  // Variable Speed Sign
460  case SUMO_TAG_VSS:
467  obj->getParameters());
468  break;
469  case SUMO_TAG_STEP:
473  break;
474  // Calibrator
475  case SUMO_TAG_CALIBRATOR:
482  obj->getPeriodAttribute(),
486  obj->getParameters());
487  break;
495  obj->getPeriodAttribute(),
499  obj->getParameters());
500  break;
501  case SUMO_TAG_FLOW:
503  obj->getVehicleParameter());
504  break;
505  // Rerouter
506  case SUMO_TAG_REROUTER:
507  buildRerouter(obj,
517  obj->getParameters());
518  break;
523  break;
528  break;
533  break;
539  break;
544  break;
545  case SUMO_TAG_INTERVAL:
546  // check if is VSS or a REROUTER interval
551  } else {
555  }
556  break;
557  // Route probe
558  case SUMO_TAG_ROUTEPROBE:
559  buildRouteProbe(obj,
562  obj->getPeriodAttribute(),
566  obj->getParameters());
567  break;
568  // Vaporizer (deprecated)
569  case SUMO_TAG_VAPORIZER:
570  buildVaporizer(obj,
575  obj->getParameters());
576  break;
577  // wire elements
584  obj->getParameters());
585  break;
587  buildOverheadWire(obj,
595  obj->getParameters());
596  break;
604  obj->getParameters());
605  break;
606  // Polygon
607  case SUMO_TAG_POLY:
608  buildPolygon(obj,
621  obj->getParameters());
622  break;
623  // POI
624  case SUMO_TAG_POI:
625  // check if we want to create a POI, POILane or POIGEO
626  if (obj->hasDoubleAttribute(SUMO_ATTR_X)) {
627  // build POI over view
628  buildPOI(obj,
642  obj->getParameters());
643  } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
644  // build POI over Lane
645  buildPOILane(obj,
661  obj->getParameters());
662  } else {
663  // build POIGEO over view
664  buildPOIGeo(obj,
678  obj->getParameters());
679  }
680  break;
681  // Jps WalkableArea
688  obj->getParameters());
689  break;
690  // Jps Obstacle
692  buildJpsObstacle(obj,
697  obj->getParameters());
698  break;
699  default:
700  break;
701  }
702  // now iterate over childrens
703  for (const auto& child : obj->getSumoBaseObjectChildren()) {
704  // call this function recursively
705  parseSumoBaseObject(child);
706  }
707 }
708 
709 
710 bool
712  return myErrorCreatingElement;
713 }
714 
715 
716 void
717 AdditionalHandler::writeError(const std::string& error) {
718  WRITE_ERROR(error);
719  myErrorCreatingElement = true;
720 }
721 
722 
723 void
725  // declare Ok Flag
726  bool parsedOk = true;
727  // needed attributes
728  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
729  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
730  // optional attributes
731  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
732  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
733  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
734  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
735  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
736  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
737  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
738  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
739  // continue if flag is ok
740  if (parsedOk) {
741  // set tag
743  // add all attributes
754  }
755 }
756 
757 
758 void
760  // declare Ok Flag
761  bool parsedOk = true;
762  // needed attributes
763  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
764  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
765  // optional attributes
766  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
767  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
768  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
769  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
770  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
771  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
772  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
773  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
774  // continue if flag is ok
775  if (parsedOk) {
776  // set tag
778  // add all attributes
789  }
790 }
791 
792 
793 void
795  // declare Ok Flag
796  bool parsedOk = true;
797  // needed attributes
798  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
799  const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
800  // optional attributes
801  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00); /* in future updates, INVALID_DOUBLE */
802  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
803  // check parent
805  // continue if flag is ok
806  if (parsedOk) {
807  // set tag
809  // add all attributes
814  }
815 }
816 
817 
818 void
820  // declare Ok Flag
821  bool parsedOk = true;
822  // needed attributes
823  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
824  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
825  // optional attributes
826  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
827  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
828  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
829  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
830  const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
831  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
832  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
833  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
834  // continue if flag is ok
835  if (parsedOk) {
836  // set tag
838  // add all attributes
849  }
850 }
851 
852 
853 void
855  // declare Ok Flag
856  bool parsedOk = true;
857  // needed attributes
858  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
859  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
860  // optional attributes
861  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
862  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
863  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
864  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
865  const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
866  const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
867  const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
868  const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
869  const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, "normal");
870  const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
871  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
872  const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
873 
874  // check charge type
875  if ((chargeType != "normal") && (chargeType != "electric") && (chargeType != "fuel")) {
876  writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
877  parsedOk = false;
878  }
879  // continue if flag is ok
880  if (parsedOk) {
881  // set tag
883  // add all attributes
898  }
899 }
900 
901 
902 void
904  // declare Ok Flag
905  bool parsedOk = true;
906  // needed attributes
907  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
908  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
909  // optional attributes
910  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
911  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
912  const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
913  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
914  const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
915  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
916  const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
917  const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
918  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
919  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
920  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
921  const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
922 
923  // continue if flag is ok
924  if (parsedOk) {
925  // set tag
927  // add all attributes
942  }
943 }
944 
945 
946 void
948  // declare Ok Flag
949  bool parsedOk = true;
950  // needed attributes
951  const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
952  const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
953  // optional attributes
954  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
955  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
956  const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
957  const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
958  const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
959  const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
960  // check parent
962  // continue if flag is ok
963  if (parsedOk) {
964  // set tag
966  // add all attributes
975  }
976 }
977 
978 
979 void
981  // declare Ok Flag
982  bool parsedOk = true;
983  // needed attributes
984  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
985  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
986  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
987  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
988  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
989  // optional attributes
990  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
991  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
992  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
993  // continue if flag is ok
994  if (parsedOk) {
995  // set tag
997  // add all attributes
1006  }
1007 }
1008 
1009 
1010 void
1012  // declare Ok Flag
1013  bool parsedOk = true;
1014  // check that lane and length are defined together
1015  if (attrs.hasAttribute(SUMO_ATTR_LANE) && !attrs.hasAttribute(SUMO_ATTR_LENGTH)) {
1016  writeError(TL("'lane' and 'length' must be defined together in a lane area detector."));
1017  parsedOk = false;
1018  }
1019  // check that lanes and endPos are defined together
1021  writeError(TL("'lanes' and 'endPos' must be defined together in a lane area detector."));
1022  parsedOk = false;
1023  }
1024  // needed attributes
1025  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1026  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1027  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1028  // special attributes
1029  const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1030  const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
1031  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1032  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
1033  // optional attributes
1034  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1035  const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
1036  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1037  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1038  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1039  const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
1040  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1041  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1042  // continue if flag is ok
1043  if (parsedOk) {
1044  // set tag
1046  // add attributes depending of Lane/Lanes
1047  if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
1050  } else {
1053  }
1054  // 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  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1077  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1078  // optional attributes
1079  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1080  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1081  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1082  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1083  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1084  const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
1085  // continue if flag is ok
1086  if (parsedOk) {
1087  // set tag
1089  // add all attributes
1099  }
1100 }
1101 
1102 
1103 void
1105  // declare Ok Flag
1106  bool parsedOk = true;
1107  // needed attributes
1108  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1109  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1110  // optional attributes
1111  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1112  // check parent
1114  // continue if flag is ok
1115  if (parsedOk) {
1116  // set tag
1118  // add all attributes
1122  }
1123 }
1124 
1125 
1126 void
1128  // declare Ok Flag
1129  bool parsedOk = true;
1130  // needed attributes
1131  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1132  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1133  // optional attributes
1134  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1135  // check parent
1137  // continue if flag is ok
1138  if (parsedOk) {
1139  // set tag
1141  // add all attributes
1145  }
1146 }
1147 
1148 
1149 void
1151  // declare Ok Flag
1152  bool parsedOk = true;
1153  // needed attributes
1154  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1155  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1156  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1157  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1158  // optional attributes
1159  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1160  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1161  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1162  // continue if flag is ok
1163  if (parsedOk) {
1164  // set tag
1166  // add all attributes
1174  }
1175 }
1176 
1177 
1178 void
1180  // declare Ok Flag
1181  bool parsedOk = true;
1182  // needed attributes
1183  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1184  // optional attributes
1185  const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1186  const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
1187  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1188  const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1189  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1190  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1191  // continue if flag is ok
1192  if (parsedOk) {
1193  // set tag
1195  // add all attributes
1203  }
1204 }
1205 
1206 
1207 void
1209  // declare Ok Flag
1210  bool parsedOk = true;
1211  // needed attributes
1212  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1213  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1214  // check parent
1216  // continue if flag is ok
1217  if (parsedOk) {
1218  // set tag
1220  // add all attributes
1223  }
1224 }
1225 
1226 
1227 void
1229  // declare Ok Flag
1230  bool parsedOk = true;
1231  // needed attributes
1232  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1233  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1234  // check parent
1236  // continue if flag is ok
1237  if (parsedOk) {
1238  // set tag
1240  // add all attributes
1243  }
1244 }
1245 
1246 
1247 void
1249  // declare Ok Flag
1250  bool parsedOk = true;
1251  // needed attributes
1252  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1253  const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1254  // optional attributes
1255  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1256  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1257  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1258  // continue if flag is ok
1259  if (parsedOk) {
1260  // set tag
1262  // add all attributes
1268  }
1269 }
1270 
1271 
1272 void
1274  // declare Ok Flag
1275  bool parsedOk = true;
1276  // needed attributes
1277  const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1278  // optional attributes
1279  const std::string speed = attrs.getOpt<std::string>(SUMO_ATTR_SPEED, "", parsedOk, "");
1280  // check parent
1281  checkParent(SUMO_TAG_STEP, {SUMO_TAG_VSS}, parsedOk);
1282  // continue if flag is ok
1283  if (parsedOk) {
1284  // set tag
1286  // add all attributes
1289  }
1290 }
1291 
1292 
1293 void
1295  // declare Ok Flag
1296  bool parsedOk = true;
1297  // check that frecuency and trafficLight aren't defined together
1298  if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1299  (!attrs.hasAttribute(SUMO_ATTR_EDGE) && !attrs.hasAttribute(SUMO_ATTR_LANE))) {
1300  writeError(TL("Calibrators need either an edge or a lane"));
1301  parsedOk = false;
1302  }
1303  // needed attributes
1304  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1305  const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1306  // special attributes
1307  const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1308  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1309  // optional attributes
1310  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1311  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1312  const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1313  const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1314  const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1315  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1316  // continue if flag is ok
1317  if (parsedOk) {
1318  // set tag depending of edge/lane
1319  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1322  } else {
1325  }
1334  }
1335 }
1336 
1337 
1338 void
1340  // declare Ok Flag
1341  bool parsedOk = true;
1342  // check parent
1345  // check that frecuency and trafficLight aren't defined together
1347  writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
1348  }
1349  // first parse flow
1350  SUMOVehicleParameter* flowParameter = SUMOVehicleParserHelper::parseVehicleAttributes(SUMO_TAG_FLOW, attrs, false, true, true);
1351  if (flowParameter) {
1352  // set VPH and speed
1353  if (attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR)) {
1354  flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1355  flowParameter->parametersSet |= VEHPARS_VPH_SET;
1356  }
1357  if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1358  flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1359  flowParameter->parametersSet |= VEHPARS_CALIBRATORSPEED_SET;
1360  }
1361  // set begin and end
1362  flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1363  flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1364  if (parsedOk) {
1365  // set tag
1367  // set vehicle parameters
1369  // delete flow parameter (because in XMLStructure we have a copy)
1370  delete flowParameter;
1371  }
1372  }
1373  }
1374 }
1375 
1376 
1377 void
1379  // declare Ok Flag
1380  bool parsedOk = true;
1381  // needed attributes
1382  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1383  const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1384  // optional attributes
1385  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1386  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1387  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1388  SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1389  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1390  const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1391  const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
1392  // continue if flag is ok
1393  if (parsedOk) {
1394  // set tag
1396  // add all attributes
1406  }
1407 }
1408 
1409 
1410 void
1412  // declare Ok Flag
1413  bool parsedOk = true;
1414  // needed attributes
1415  const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1416  const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1417  // check parent
1419  // continue if flag is ok
1420  if (parsedOk) {
1421  // set tag
1423  // add all attributes
1426  }
1427 }
1428 
1429 
1430 void
1432  // declare Ok Flag
1433  bool parsedOk = true;
1434  // needed attributes
1435  const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1436  // optional attributes
1437  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1438  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1439  // check parent
1441  // continue if flag is ok
1442  if (parsedOk) {
1443  // set tag
1445  // add all attributes
1449  }
1450 }
1451 
1452 
1453 void
1455  // declare Ok Flag
1456  bool parsedOk = true;
1457  // needed attributes
1458  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1459  // optional attributes
1460  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1461  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1462  // check parent
1464  // continue if flag is ok
1465  if (parsedOk) {
1466  // set tag
1468  // add all attributes
1472  }
1473 }
1474 
1475 
1476 void
1478  // declare Ok Flag
1479  bool parsedOk = true;
1480  // needed attributes
1481  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1482  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1483  // check parent
1485  // continue if flag is ok
1486  if (parsedOk) {
1487  if (probability < 0) {
1488  writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_DEST_PROB_REROUTE)));
1489  } else {
1490  // set tag
1492  // add all attributes
1495  }
1496  }
1497 }
1498 
1499 
1500 void
1502  // declare Ok Flag
1503  bool parsedOk = true;
1504  // needed attributes
1505  const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1506  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1507  // optional attributes
1508  const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1509  // check parent
1511  // continue if flag is ok
1512  if (parsedOk) {
1513  if (probability < 0) {
1514  writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_PARKING_AREA_REROUTE)));
1515  } else {
1516  // set tag
1518  // add all attributes
1522  }
1523  }
1524 }
1525 
1526 
1527 void
1529  // declare Ok Flag
1530  bool parsedOk = true;
1531  // needed attributes
1532  const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1533  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1534  // check parent
1536  // continue if flag is ok
1537  if (parsedOk) {
1538  if (probability < 0) {
1539  writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_ROUTE_PROB_REROUTE)));
1540  } else {
1541  // set tag
1543  // add all attributes
1546  }
1547  }
1548 }
1549 
1550 
1551 void
1553  // declare Ok Flag
1554  bool parsedOk = true;
1555  // needed attributes
1556  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1557  const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1558  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1559  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1560  const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1561  // optional attributes
1562  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1563  // continue if flag is ok
1564  if (parsedOk) {
1565  // set tag
1567  // add all attributes
1574  }
1575 }
1576 
1577 
1578 void
1580  // declare Ok Flag
1581  bool parsedOk = true;
1582  // needed attributes
1583  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1584  SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1585  SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1586  // optional attributes
1587  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1588  // continue if flag is ok
1589  if (parsedOk) {
1590  // set tag
1592  // add all attributes
1597  }
1598 }
1599 
1600 
1601 void
1603  // declare Ok Flag
1604  bool parsedOk = true;
1605  // needed attributes
1606  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1607  // optional attributes
1608  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1609  const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1610  const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1611  // continue if flag is ok
1612  if (parsedOk) {
1613  // set tag
1615  // add all attributes
1620  }
1621 }
1622 
1623 
1624 void
1626  // declare Ok Flag
1627  bool parsedOk = true;
1628  // needed attributes
1629  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1630  const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1631  const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1632  // optional attributes
1633  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1634  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1635  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1636  const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1637  // continue if flag is ok
1638  if (parsedOk) {
1639  // set tag
1641  // add all attributes
1649  }
1650 }
1651 
1652 
1653 void
1655  // declare Ok Flag
1656  bool parsedOk = true;
1657  // needed attributes
1658  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1659  const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1660  const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1661  const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1662  const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1663  const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1664  // continue if flag is ok
1665  if (parsedOk) {
1666  // set tag
1668  // add all attributes
1675  }
1676 }
1677 
1678 
1679 void
1681  // declare Ok Flag
1682  bool parsedOk = true;
1683  // needed attributes
1684  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1685  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1686  // optional attributes
1687  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1688  const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1689  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1690  const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1691  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1692  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1693  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1694  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1695  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1696  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1697  // continue if flag is ok
1698  if (parsedOk) {
1699  // set tag
1701  // add all attributes
1714  }
1715 }
1716 
1717 
1718 void
1720  // declare Ok Flag
1721  bool parsedOk = true;
1722  // check that x and y are defined together
1723  if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1724  (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1725  writeError(TL("X and Y must be be defined together in POIs"));
1726  parsedOk = false;
1727  }
1728  // check that lane and pos are defined together
1729  if ((attrs.hasAttribute(SUMO_ATTR_LANE) && !attrs.hasAttribute(SUMO_ATTR_POSITION)) ||
1731  writeError(TL("lane and position must be defined together in POIs"));
1732  parsedOk = false;
1733  }
1734  // check that lon and lat are defined together
1735  if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1736  (!attrs.hasAttribute(SUMO_ATTR_LON) && attrs.hasAttribute(SUMO_ATTR_LAT))) {
1737  writeError(TL("lon and lat must be be defined together in POIs"));
1738  parsedOk = false;
1739  }
1740  // needed attributes
1741  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1742  // special attributes
1743  const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1744  const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1745  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1746  const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1747  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1748  const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1749  const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1750  const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1751  // optional attributes
1752  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1753  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1754  std::string icon = attrs.getOpt<std::string>(SUMO_ATTR_ICON, "", parsedOk, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE));
1755  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1756  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1757  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1758  const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1759  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1760  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1761  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1762  // check icon
1763  if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
1764  WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
1765  icon = "none";
1766  }
1767  // continue if flag is ok
1768  if (parsedOk) {
1769  // set tag
1771  // add attributes depending of Lane/Lanes
1772  if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1775  } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1780  } else {
1783  }
1784  // add rest attributes
1796  }
1797 }
1798 
1799 
1800 void
1802  // declare Ok Flag
1803  bool parsedOk = true;
1804  // needed attributes
1805  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1806  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1807  // optional attributes
1808  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1809  // continue if flag is ok
1810  if (parsedOk) {
1811  // set tag
1813  // add all attributes
1817  }
1818 }
1819 
1820 
1821 void
1823  // declare Ok Flag
1824  bool parsedOk = true;
1825  // needed attributes
1826  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1827  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1828  // optional attributes
1829  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1830  // continue if flag is ok
1831  if (parsedOk) {
1832  // set tag
1834  // add all attributes
1838  }
1839 }
1840 
1841 
1842 void
1844  // declare Ok Flag
1845  bool parsedOk = true;
1846  // get key
1847  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, parsedOk);
1848  // get SumoBaseObject parent
1850  // check parent
1851  if (SumoBaseObjectParent == nullptr) {
1852  writeError(TL("Parameters must be defined within an object."));
1853  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_ROOTFILE) {
1854  writeError(TL("Parameters cannot be defined in the additional file's root."));
1855  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_PARAM) {
1856  writeError(TL("Parameters cannot be defined within another parameter."));
1857  } else if (parsedOk) {
1858  // get tag str
1859  const std::string parentTagStr = toString(SumoBaseObjectParent->getTag());
1860  // circumventing empty string value
1861  const std::string value = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
1862  // show warnings if values are invalid
1863  if (key.empty()) {
1864  WRITE_WARNINGF(TL("Error parsing key from % generic parameter. Key cannot be empty."), parentTagStr);
1865  } else if (!SUMOXMLDefinitions::isValidParameterKey(key)) {
1866  WRITE_WARNINGF(TL("Error parsing key from % generic parameter. Key contains invalid characters."), parentTagStr);
1867  } else {
1868  WRITE_DEBUG("Inserting generic parameter '" + key + "|" + value + "' into " + parentTagStr);
1869  // insert parameter in SumoBaseObjectParent
1870  SumoBaseObjectParent->addParameter(key, value);
1871  }
1872  }
1873 }
1874 
1875 
1876 void
1877 AdditionalHandler::checkParent(const SumoXMLTag currentTag, const std::vector<SumoXMLTag>& parentTags, bool& ok) {
1878  // check that parent SUMOBaseObject's tag is the parentTag
1880  if ((parent != nullptr) &&
1881  (parentTags.size() > 0) &&
1882  (std::find(parentTags.begin(), parentTags.end(), parent->getTag()) == parentTags.end())) {
1883  const std::string id = parent->hasStringAttribute(SUMO_ATTR_ID) ? ", id: '" + parent->getStringAttribute(SUMO_ATTR_ID) + "'" : "";
1884  writeError("'" + toString(currentTag) + "' must be defined within the definition of a '" + toString(parentTags.front()) + "' (found '" + toString(parent->getTag()) + "'" + id + ").");
1885  ok = false;
1886  }
1887 }
1888 
1889 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:306
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:304
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:295
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
SUMOTime DELTA_T
Definition: SUMOTime.cpp:38
#define SUMOTime_MAX_PERIOD
Definition: SUMOTime.h:36
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
const int VEHPARS_VPH_SET
const int VEHPARS_CALIBRATORSPEED_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TRACTION_SUBSTATION
A traction substation.
@ 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_STEP
trigger: a step description
@ SUMO_TAG_OVERHEAD_WIRE_CLAMP
An overhead wire clamp (connection of wires in opposite directions)
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ 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_OVERHEAD_WIRE_SECTION
An overhead wire section.
@ 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 destination of a reroute
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_E1DETECTOR
an e1 detector
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ 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
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
@ 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_EXPECT_ARRIVAL
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_LINES
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_ICON
icon
@ SUMO_ATTR_LANE
@ SUMO_ATTR_ACCEPTED_BADGES
@ SUMO_ATTR_LON
@ SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_WAITINGTIME
@ SUMO_ATTR_VALUE
@ SUMO_ATTR_FILE
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_Y
@ SUMO_ATTR_SUBSTATIONID
id of a traction substation substation
@ SUMO_ATTR_Z
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_CHARGETYPE
Charge type (fuel or electric)
@ SUMO_ATTR_PARKING_LENGTH
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_VOLTAGE
voltage of the traction substation [V]
@ 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_OVERHEAD_WIRE_FORBIDDEN
forbidden lanes for overhead wire segment
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_GEO
@ SUMO_ATTR_LANES
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_END
id of the overhead wire, to the end of which the overhead wire clamp is connected
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_LEFTHAND
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART
id of the overhead wire lane, to the start of which the overhead wire clamp is connected
@ SUMO_ATTR_CHARGEINTRANSIT
Allow/disallow charge in transit in Charging Stations.
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_START
id of the overhead wire, to the start of which the overhead wire clamp is connected
@ SUMO_ATTR_CONTAINER_CAPACITY
@ SUMO_ATTR_FILL
Fill the polygon.
@ SUMO_ATTR_NAME
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_SLOPE
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_CENTER
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ROADSIDE_CAPACITY
@ SUMO_ATTR_CURRENTLIMIT
current limit of the traction substation [A]
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_OPTIONAL
@ 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 (different of waiting time)
@ SUMO_ATTR_TIME
trigger: the time of the step
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND
id of the overhead wire lane, to the end of which the overhead wire clamp is connected
@ SUMO_ATTR_RELATIVEPATH
const double INVALID_DOUBLE
invalid double
Definition: StdDefs.h:64
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
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 period, 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 Parameterised::Map &parameters)=0
Builds a multi-lane Area Detector (E2)
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
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 Parameterised::Map &parameters)=0
Builds a VariableSpeedSign (lane speed additional)
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 Parameterised::Map &parameters)=0
Builds a train stop.
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
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 period, const std::string &routeprobe, const double jamThreshold, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)=0
builds a microscopic calibrator over an edge
virtual void buildRerouterInterval(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOTime begin, const SUMOTime end)=0
builds a rerouter interval
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 Parameterised::Map &parameters)=0
Builds a Parking Space.
void parseRouteProbRerouteAttributes(const SUMOSAXAttributes &attrs)
parse route prob reroute attributes
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 bool off, const bool optional, const SUMOTime timeThreshold, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)=0
builds a rerouter
void parseJpsWalkableAreaAttributes(const SUMOSAXAttributes &attrs)
parse juPedSim walkable area attributes
void parseCalibratorFlowAttributes(const SUMOSAXAttributes &attrs)
parse calibrator flow attributes
virtual void buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const double length, const SUMOTime period, 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 Parameterised::Map &parameters)=0
Builds a single-lane Area Detector (E2)
void parseParkingAreaRerouteAttributes(const SUMOSAXAttributes &attrs)
parse parking area reroute attributes
void parseTAZAttributes(const SUMOSAXAttributes &attrs)
parse TAZ attributes
AdditionalHandler()
Constructor.
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 std::string &icon, const double layer, const double angle, const std::string &imgFile, const bool relativePath, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI over lane using the given values.
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 period, const std::string &routeprobe, const double jamThreshold, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)=0
builds a microscopic calibrator over a lane
void checkParent(const SumoXMLTag currentTag, const std::vector< SumoXMLTag > &parentTags, bool &ok)
check parents
void parseOverheadWire(const SUMOSAXAttributes &attrs)
parse overhead wire segment
CommonXMLStructure myCommonXMLStructure
common XML Structure
virtual void buildOverheadWireClamp(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &overheadWireIDStartClamp, const std::string &laneIDStartClamp, const std::string &overheadWireIDEndClamp, const std::string &laneIDEndClamp, const Parameterised::Map &parameters)=0
build overhead wire clamp
void parseTractionSubstation(const SUMOSAXAttributes &attrs)
parse traction substation
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
void parseOverheadWireClamp(const SUMOSAXAttributes &attrs)
parse overhead wire clamp
void writeError(const std::string &error)
write error and enable error creating element
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 buildDetectorE3(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const SUMOTime period, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const bool expectedArrival, const Parameterised::Map &parameters)=0
Builds a multi entry exit detector (E3)
virtual void buildDetectorEntry(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds a entry detector (E3)
void parsePOIAttributes(const SUMOSAXAttributes &attrs)
parse POI attributes
bool myErrorCreatingElement
flag for check if a element wasn't created
void endParseAttributes()
end parse attributes
virtual void buildE1Detector(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double position, const SUMOTime period, const std::string &file, const std::vector< std::string > &vehicleTypes, const std::string &name, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds a induction loop detector (E1)
virtual void buildJpsObstacle(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, bool geo, const std::string &name, const Parameterised::Map &parameters)=0
Builds a JuPedSim obstacle using the given values.
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 std::string &icon, const double layer, const double angle, const std::string &imgFile, bool relativePath, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI in GEO coordinaten using the given values.
virtual void buildJpsWalkableArea(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, bool geo, const std::string &name, const Parameterised::Map &parameters)=0
Builds a JuPedSim walkable area using the given values.
void parseJpsObstacleAttributes(const SUMOSAXAttributes &attrs)
parse juPedSim obstacle 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 std::string &chargeType, const SUMOTime waitingTime, const bool friendlyPosition, const std::string &parkingAreaID, const Parameterised::Map &parameters)=0
Builds a charging Station.
void parseVariableSpeedSignAttributes(const SUMOSAXAttributes &attrs)
parse variable speed sign attributes
virtual ~AdditionalHandler()
Destructor.
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 std::vector< std::string > &lines, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad, const double width, const double length, const double angle, const bool lefthand, const Parameterised::Map &parameters)=0
Builds a Parking Area.
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 Parameterised::Map &parameters)=0
Builds a TAZ (Traffic Assignment Zone)
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 std::string &icon, const double layer, const double angle, const std::string &imgFile, bool relativePath, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI using the given values.
void parseDestProbRerouteAttributes(const SUMOSAXAttributes &attrs)
parse dest prob reroute attributes
virtual void buildCalibratorFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameter)=0
builds a calibrator flow
void parseE1Attributes(const SUMOSAXAttributes &attrs)
parse E1 attributes
virtual void buildOverheadWire(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &substationId, const std::vector< std::string > &laneIDs, const double startPos, const double endPos, const bool friendlyPos, const std::vector< std::string > &forbiddenInnerLanes, const Parameterised::Map &parameters)=0
build overhead wire
void parseVariableSpeedSignStepAttributes(const SUMOSAXAttributes &attrs)
parse variable speed sign step attributes
void parseParameters(const SUMOSAXAttributes &attrs)
parse generic parameters
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)
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
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 Parameterised::Map &parameters)=0
Builds a Instant Induction Loop Detector (E1Instant)
virtual void buildVaporizer(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const SUMOTime from, const SUMOTime endTime, const std::string &name, const Parameterised::Map &parameters)=0
Builds a vaporizer (lane speed additional)
virtual void buildDetectorExit(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds a exit detector (E3)
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 Parameterised::Map &parameters)=0
Builds a container stop.
virtual void buildTractionSubstation(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const double voltage, const double currentLimit, const Parameterised::Map &parameters)=0
build traction substation
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 Parameterised::Map &parameters)=0
Builds a bus stop.
virtual void buildAccess(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const std::string &pos, const double length, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds an Access.
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 buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newParkignAreaID, const double probability, const bool visible)=0
builds a parking area reroute
virtual void buildRouteProbe(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &edgeID, const SUMOTime period, const std::string &name, const std::string &file, const SUMOTime begin, const Parameterised::Map &parameters)=0
builds a Route probe
void parseClosingLaneRerouteAttributes(const SUMOSAXAttributes &attrs)
parse closing lane reroute attributes
void parseRerouterIntervalAttributes(const SUMOSAXAttributes &attrs)
parse rerouter interval attributes
bool isErrorCreatingElement() const
get flag for check if a element wasn't created
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)
void parsePolyAttributes(const SUMOSAXAttributes &attrs)
void parseClosingRerouteAttributes(const SUMOSAXAttributes &attrs)
parse closing 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 Parameterised::Map &parameters)=0
Builds a polygon using the given values.
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
SumoXMLTag getTag() const
get XML myTag
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
SUMOTime getPeriodAttribute() const
get 'period' attribute
void setVehicleParameter(const SUMOVehicleParameter *vehicleParameter)
set vehicle parameters
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
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
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:317
A list of positions.
static const RGBColor INVISIBLE
Definition: RGBColor.h:195
static const RGBColor RED
named colors
Definition: RGBColor.h:185
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOTime getOptPeriod(const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read the SUMOTime 'period' attribute.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), 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.
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.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
double calibratorSpeed
speed (used by calibrator flows
static SUMOVehicleParameter * parseVehicleAttributes(int element, const SUMOSAXAttributes &attrs, const bool hardFail, const bool optionalID=false, const bool skipDepart=false, const bool allowInternalRoutes=false)
Parses a vehicle's attributes.
static StringBijection< POIIcon > POIIcons
POI icon values.
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:48
static const double DEFAULT_LAYER
Definition: Shape.h:43
static const double DEFAULT_LAYER_POI
Definition: Shape.h:45
static const double DEFAULT_IMG_WIDTH
Definition: Shape.h:49
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
static const double DEFAULT_LINEWIDTH
Definition: Shape.h:44
static const double DEFAULT_ANGLE
Definition: Shape.h:46
static const double DEFAULT_IMG_HEIGHT
Definition: Shape.h:50
static const std::string DEFAULT_TYPE
Definition: Shape.h:42
const std::string & getString(const T key) const