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>
29 
30 #include "AdditionalHandler.h"
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
36 
38 
39 
41 
42 
43 bool
45  // open SUMOBaseOBject
47  // check tag
48  try {
49  switch (tag) {
50  // Stopping Places
51  case SUMO_TAG_BUS_STOP:
53  break;
56  break;
57  case SUMO_TAG_ACCESS:
58  parseAccessAttributes(attrs);
59  break;
62  break;
65  break;
68  break;
71  break;
72  // Detectors
75  parseE1Attributes(attrs);
76  break;
79  parseE2Attributes(attrs);
80  break;
83  parseE3Attributes(attrs);
84  break;
85  case SUMO_TAG_DET_ENTRY:
86  parseEntryAttributes(attrs);
87  break;
88  case SUMO_TAG_DET_EXIT:
89  parseExitAttributes(attrs);
90  break;
93  break;
94  // TAZs
95  case SUMO_TAG_TAZ:
96  parseTAZAttributes(attrs);
97  break;
98  case SUMO_TAG_TAZSOURCE:
100  break;
101  case SUMO_TAG_TAZSINK:
102  parseTAZSinkAttributes(attrs);
103  break;
104  // Variable Speed Sign
105  case SUMO_TAG_VSS:
107  break;
108  case SUMO_TAG_STEP:
110  break;
111  // Calibrator
112  case SUMO_TAG_CALIBRATOR:
115  break;
116  // flow (calibrator)
117  case SUMO_TAG_FLOW:
119  break;
120  // Rerouter
121  case SUMO_TAG_REROUTER:
123  break;
124  case SUMO_TAG_INTERVAL:
126  break;
129  break;
132  break;
135  break;
138  break;
141  break;
142  // Route probe
143  case SUMO_TAG_ROUTEPROBE:
145  break;
146  // Vaporizer (deprecated)
147  case SUMO_TAG_VAPORIZER:
149  break;
150  // wires
153  break;
155  parseOverheadWireClamp(attrs);
156  break;
158  parseOverheadWire(attrs);
159  break;
160  // Poly
161  case SUMO_TAG_POLY:
162  parsePolyAttributes(attrs);
163  break;
164  case SUMO_TAG_POI:
165  parsePOIAttributes(attrs);
166  break;
167  // JuPedSim
170  break;
173  break;
174  // parameters
175  case SUMO_TAG_PARAM:
176  parseParameters(attrs);
177  break;
178  default:
179  // tag cannot be parsed in AdditionalHandler
180  return false;
181  break;
182  }
183  } catch (InvalidArgument& e) {
184  writeError(e.what());
185  }
186  return true;
187 }
188 
189 
190 void
192  // get last inserted object
194  // close SUMOBaseOBject
196  // check tag
197  switch (obj->getTag()) {
198  // Stopping Places
199  case SUMO_TAG_BUS_STOP:
200  case SUMO_TAG_TRAIN_STOP:
204  // detectors
205  case SUMO_TAG_E1DETECTOR:
207  case SUMO_TAG_E2DETECTOR:
209  case SUMO_TAG_E3DETECTOR:
212  // TAZs
213  case SUMO_TAG_TAZ:
214  // Variable Speed Sign
215  case SUMO_TAG_VSS:
216  // Calibrator
217  case SUMO_TAG_CALIBRATOR:
219  // Rerouter
220  case SUMO_TAG_REROUTER:
221  // Route probe
222  case SUMO_TAG_ROUTEPROBE:
223  // Vaporizer (deprecated)
224  case SUMO_TAG_VAPORIZER:
225  // wires
229  // Shapes
230  case SUMO_TAG_POLY:
231  case SUMO_TAG_POI:
232  // JuPedSim
235  // parse object and all their childrens
236  parseSumoBaseObject(obj);
237  // delete object (and all of their childrens)
238  delete obj;
239  break;
240  default:
241  break;
242  }
243 }
244 
245 
246 void
248  // switch tag
249  switch (obj->getTag()) {
250  // Stopping Places
251  case SUMO_TAG_BUS_STOP:
252  buildBusStop(obj,
263  obj->getParameters());
264  break;
265  case SUMO_TAG_TRAIN_STOP:
266  buildTrainStop(obj,
277  obj->getParameters());
278  break;
279  case SUMO_TAG_ACCESS:
280  buildAccess(obj,
285  obj->getParameters());
286  break;
288  buildContainerStop(obj,
299  obj->getParameters());
300  break;
316  obj->getParameters());
317  break;
319  buildParkingArea(obj,
334  obj->getParameters());
335  break;
337  buildParkingSpace(obj,
346  obj->getParameters());
347  break;
348  // Detectors
349  case SUMO_TAG_E1DETECTOR:
351  // build E1
352  buildE1Detector(obj,
356  obj->getPeriodAttribute(),
363  obj->getParameters());
364  break;
365  case SUMO_TAG_E2DETECTOR:
373  obj->getPeriodAttribute(),
385  obj->getParameters());
386  } else {
392  obj->getPeriodAttribute(),
404  obj->getParameters());
405  }
406  break;
407  case SUMO_TAG_E3DETECTOR:
409  buildDetectorE3(obj,
412  obj->getPeriodAttribute(),
422  obj->getParameters());
423  break;
424  case SUMO_TAG_DET_ENTRY:
425  buildDetectorEntry(obj,
429  obj->getParameters());
430  break;
431  case SUMO_TAG_DET_EXIT:
432  buildDetectorExit(obj,
436  obj->getParameters());
437  break;
449  obj->getParameters());
450  break;
451  // TAZs
452  case SUMO_TAG_TAZ:
453  buildTAZ(obj,
461  obj->getParameters());
462  break;
463  case SUMO_TAG_TAZSOURCE:
464  buildTAZSource(obj,
467  break;
468  case SUMO_TAG_TAZSINK:
469  buildTAZSink(obj,
472  break;
473  // Variable Speed Sign
474  case SUMO_TAG_VSS:
481  obj->getParameters());
482  break;
483  case SUMO_TAG_STEP:
487  break;
488  // Calibrator
489  case SUMO_TAG_CALIBRATOR:
496  obj->getPeriodAttribute(),
500  obj->getParameters());
501  break;
509  obj->getPeriodAttribute(),
513  obj->getParameters());
514  break;
515  case SUMO_TAG_FLOW:
517  obj->getVehicleParameter());
518  break;
519  // Rerouter
520  case SUMO_TAG_REROUTER:
521  buildRerouter(obj,
531  obj->getParameters());
532  break;
537  break;
542  break;
547  break;
553  break;
558  break;
559  case SUMO_TAG_INTERVAL:
560  // check if is VSS or a REROUTER interval
565  } else {
569  }
570  break;
571  // Route probe
572  case SUMO_TAG_ROUTEPROBE:
573  buildRouteProbe(obj,
576  obj->getPeriodAttribute(),
580  obj->getParameters());
581  break;
582  // Vaporizer (deprecated)
583  case SUMO_TAG_VAPORIZER:
584  buildVaporizer(obj,
589  obj->getParameters());
590  break;
591  // wire elements
598  obj->getParameters());
599  break;
601  buildOverheadWire(obj,
609  obj->getParameters());
610  break;
618  obj->getParameters());
619  break;
620  // Polygon
621  case SUMO_TAG_POLY:
622  buildPolygon(obj,
635  obj->getParameters());
636  break;
637  // POI
638  case SUMO_TAG_POI:
639  // check if we want to create a POI, POILane or POIGEO
640  if (obj->hasDoubleAttribute(SUMO_ATTR_X)) {
641  // build POI over view
642  buildPOI(obj,
656  obj->getParameters());
657  } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
658  // build POI over Lane
659  buildPOILane(obj,
675  obj->getParameters());
676  } else {
677  // build POIGEO over view
678  buildPOIGeo(obj,
692  obj->getParameters());
693  }
694  break;
695  // Jps WalkableArea
702  obj->getParameters());
703  break;
704  // Jps Obstacle
706  buildJpsObstacle(obj,
711  obj->getParameters());
712  break;
713  default:
714  break;
715  }
716  // now iterate over childrens
717  for (const auto& child : obj->getSumoBaseObjectChildren()) {
718  // call this function recursively
719  parseSumoBaseObject(child);
720  }
721 }
722 
723 
724 bool
726  return myErrorCreatingElement;
727 }
728 
729 
730 void
731 AdditionalHandler::writeError(const std::string& error) {
732  WRITE_ERROR(error);
733  myErrorCreatingElement = true;
734 }
735 
736 
737 void
739  // declare Ok Flag
740  bool parsedOk = true;
741  // needed attributes
742  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
743  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
744  // optional attributes
745  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
746  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
747  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
748  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
749  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
750  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
751  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
752  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
753  // continue if flag is ok
754  if (parsedOk) {
755  // set tag
757  // add all attributes
768  }
769 }
770 
771 
772 void
774  // declare Ok Flag
775  bool parsedOk = true;
776  // needed attributes
777  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
778  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
779  // optional attributes
780  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
781  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
782  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
783  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
784  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
785  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
786  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
787  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
788  // continue if flag is ok
789  if (parsedOk) {
790  // set tag
792  // add all attributes
803  }
804 }
805 
806 
807 void
809  // declare Ok Flag
810  bool parsedOk = true;
811  // needed attributes
812  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
813  const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
814  // optional attributes
815  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00); /* in future updates, INVALID_DOUBLE */
816  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
817  // check parent
819  // continue if flag is ok
820  if (parsedOk) {
821  // set tag
823  // add all attributes
828  }
829 }
830 
831 
832 void
834  // declare Ok Flag
835  bool parsedOk = true;
836  // needed attributes
837  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
838  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
839  // optional attributes
840  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
841  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
842  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
843  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
844  const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
845  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
846  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
847  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
848  // continue if flag is ok
849  if (parsedOk) {
850  // set tag
852  // add all attributes
863  }
864 }
865 
866 
867 void
869  // declare Ok Flag
870  bool parsedOk = true;
871  // needed attributes
872  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
873  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
874  // optional attributes
875  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
876  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
877  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
878  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
879  const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
880  const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
881  const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
882  const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
883  const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, "normal");
884  const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
885  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
886  const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
887 
888  // check charge type
889  if ((chargeType != "normal") && (chargeType != "electric") && (chargeType != "fuel")) {
890  writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
891  parsedOk = false;
892  }
893  // continue if flag is ok
894  if (parsedOk) {
895  // set tag
897  // add all attributes
912  }
913 }
914 
915 
916 void
918  // declare Ok Flag
919  bool parsedOk = true;
920  // needed attributes
921  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
922  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
923  // optional attributes
924  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
925  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
926  const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
927  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
928  const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
929  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
930  const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
931  const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
932  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
933  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
934  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
935  const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
936 
937  // continue if flag is ok
938  if (parsedOk) {
939  // set tag
941  // add all attributes
956  }
957 }
958 
959 
960 void
962  // declare Ok Flag
963  bool parsedOk = true;
964  // needed attributes
965  const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
966  const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
967  // optional attributes
968  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
969  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
970  const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
971  const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
972  const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
973  const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
974  // check parent
976  // continue if flag is ok
977  if (parsedOk) {
978  // set tag
980  // add all attributes
989  }
990 }
991 
992 
993 void
995  // declare Ok Flag
996  bool parsedOk = true;
997  // needed attributes
998  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
999  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1000  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1001  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1002  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1003  // optional attributes
1004  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1005  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1006  const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1007  const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1008  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1009  // continue if flag is ok
1010  if (parsedOk && checkDetectPersons(SUMO_TAG_E1DETECTOR, id, detectPersons)) {
1011  // set tag
1013  // add all attributes
1024  }
1025 }
1026 
1027 
1028 void
1030  // declare Ok Flag
1031  bool parsedOk = true;
1032  const int positionDef = attrs.hasAttribute(SUMO_ATTR_POSITION) ? 1 : 0;
1033  const int endPosDef = attrs.hasAttribute(SUMO_ATTR_ENDPOS) ? 1 : 0;
1034  const int lengthDef = attrs.hasAttribute(SUMO_ATTR_LENGTH) ? 1 : 0;
1035  // check attributes
1036  if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) > 2)) {
1037  writeError(TL("'pos', 'endPos' and 'length' cannot be defined together in a single lane area detector."));
1038  } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) < 2)) {
1039  writeError(TL("A single lane area detector requires two parameters of those 'pos', 'endPos' and 'length'."));
1040  } else {
1041  // needed attributes
1042  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1043  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1044  // special attributes
1045  const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1046  const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
1047  const double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1048  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
1049  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1050  // optional attributes
1051  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1052  const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
1053  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1054  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1055  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1056  const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
1057  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1058  const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1059  const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1060  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1061  const bool show = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), parsedOk, true);
1062  // continue if flag is ok
1063  if (parsedOk && checkDetectPersons(SUMO_TAG_E2DETECTOR, id, detectPersons)) {
1064  // set tag
1066  // add attributes depending of Lane/Lanes
1067  if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
1069  if (positionDef == 0) {
1072  } else if (endPosDef == 0) {
1075  } else if (lengthDef == 0) {
1078  }
1079  } else {
1083  }
1084  // add all attributes
1098  }
1099  }
1100 }
1101 
1102 
1103 void
1105  // declare Ok Flag
1106  bool parsedOk = true;
1107  // needed attributes
1108  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1109  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1110  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1111  // optional attributes
1112  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1113  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1114  const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1115  const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1116  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1117  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1118  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1119  const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), parsedOk, false);
1120  const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
1121  // continue if flag is ok
1122  if (parsedOk && checkDetectPersons(SUMO_TAG_E3DETECTOR, id, detectPersons)) {
1123  // set tag
1125  // add all attributes
1138  }
1139 }
1140 
1141 
1142 void
1144  // declare Ok Flag
1145  bool parsedOk = true;
1146  // needed attributes
1147  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1148  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1149  // optional attributes
1150  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1151  // check parent
1153  // continue if flag is ok
1154  if (parsedOk) {
1155  // set tag
1157  // add all attributes
1161  }
1162 }
1163 
1164 
1165 void
1167  // declare Ok Flag
1168  bool parsedOk = true;
1169  // needed attributes
1170  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1171  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1172  // optional attributes
1173  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1174  // check parent
1176  // continue if flag is ok
1177  if (parsedOk) {
1178  // set tag
1180  // add all attributes
1184  }
1185 }
1186 
1187 
1188 void
1190  // declare Ok Flag
1191  bool parsedOk = true;
1192  // needed attributes
1193  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1194  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1195  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1196  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1197  // optional attributes
1198  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1199  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1200  const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1201  const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1202  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1203  // continue if flag is ok
1204  if (parsedOk && checkDetectPersons(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, detectPersons)) {
1205  // set tag
1207  // add all attributes
1217  }
1218 }
1219 
1220 
1221 void
1223  // declare Ok Flag
1224  bool parsedOk = true;
1225  // needed attributes
1226  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1227  // optional attributes
1228  const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1229  const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
1230  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1231  const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1232  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1233  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1234  // continue if flag is ok
1235  if (parsedOk) {
1236  // set tag
1238  // add all attributes
1246  }
1247 }
1248 
1249 
1250 void
1252  // declare Ok Flag
1253  bool parsedOk = true;
1254  // needed attributes
1255  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1256  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1257  // check parent
1259  // continue if flag is ok
1260  if (parsedOk) {
1261  // set tag
1263  // add all attributes
1266  }
1267 }
1268 
1269 
1270 void
1272  // declare Ok Flag
1273  bool parsedOk = true;
1274  // needed attributes
1275  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1276  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1277  // check parent
1279  // continue if flag is ok
1280  if (parsedOk) {
1281  // set tag
1283  // add all attributes
1286  }
1287 }
1288 
1289 
1290 void
1292  // declare Ok Flag
1293  bool parsedOk = true;
1294  // needed attributes
1295  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1296  const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1297  // optional attributes
1298  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1299  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1300  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1301  // continue if flag is ok
1302  if (parsedOk) {
1303  // set tag
1305  // add all attributes
1311  }
1312 }
1313 
1314 
1315 void
1317  // declare Ok Flag
1318  bool parsedOk = true;
1319  // needed attributes
1320  const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1321  // optional attributes
1322  const std::string speed = attrs.getOpt<std::string>(SUMO_ATTR_SPEED, "", parsedOk, "");
1323  // check parent
1324  checkParent(SUMO_TAG_STEP, {SUMO_TAG_VSS}, parsedOk);
1325  // continue if flag is ok
1326  if (parsedOk) {
1327  // set tag
1329  // add all attributes
1332  }
1333 }
1334 
1335 
1336 void
1338  // declare Ok Flag
1339  bool parsedOk = true;
1340  // check that frecuency and trafficLight aren't defined together
1341  if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1342  (!attrs.hasAttribute(SUMO_ATTR_EDGE) && !attrs.hasAttribute(SUMO_ATTR_LANE))) {
1343  writeError(TL("Calibrators need either an edge or a lane"));
1344  parsedOk = false;
1345  }
1346  // needed attributes
1347  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1348  const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1349  // special attributes
1350  const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1351  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1352  // optional attributes
1353  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1354  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1355  const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1356  const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1357  const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1358  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1359  // continue if flag is ok
1360  if (parsedOk) {
1361  // set tag depending of edge/lane
1362  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1365  } else {
1368  }
1377  }
1378 }
1379 
1380 
1381 void
1383  // declare Ok Flag
1384  bool parsedOk = true;
1385  // check parent
1388  // check that frecuency and trafficLight aren't defined together
1390  writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
1391  }
1392  // first parse flow
1393  SUMOVehicleParameter* flowParameter = SUMOVehicleParserHelper::parseVehicleAttributes(SUMO_TAG_FLOW, attrs, false, true, true);
1394  if (flowParameter) {
1395  // set VPH and speed
1396  if (attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR)) {
1397  flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1398  flowParameter->parametersSet |= VEHPARS_VPH_SET;
1399  }
1400  if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1401  flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1402  flowParameter->parametersSet |= VEHPARS_CALIBRATORSPEED_SET;
1403  }
1404  // set begin and end
1405  flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1406  flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1407  if (parsedOk) {
1408  // set tag
1410  // set vehicle parameters
1412  // delete flow parameter (because in XMLStructure we have a copy)
1413  delete flowParameter;
1414  }
1415  }
1416  }
1417 }
1418 
1419 
1420 void
1422  // declare Ok Flag
1423  bool parsedOk = true;
1424  // needed attributes
1425  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1426  const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1427  // optional attributes
1428  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1429  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1430  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1431  SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1432  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1433  const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1434  const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
1435  // continue if flag is ok
1436  if (parsedOk) {
1437  // set tag
1439  // add all attributes
1449  }
1450 }
1451 
1452 
1453 void
1455  // declare Ok Flag
1456  bool parsedOk = true;
1457  // needed attributes
1458  const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1459  const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1460  // check parent
1462  // continue if flag is ok
1463  if (parsedOk) {
1464  // set tag
1466  // add all attributes
1469  }
1470 }
1471 
1472 
1473 void
1475  // declare Ok Flag
1476  bool parsedOk = true;
1477  // needed attributes
1478  const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1479  // optional attributes
1480  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1481  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1482  // check parent
1484  // continue if flag is ok
1485  if (parsedOk) {
1486  // set tag
1488  // add all attributes
1492  }
1493 }
1494 
1495 
1496 void
1498  // declare Ok Flag
1499  bool parsedOk = true;
1500  // needed attributes
1501  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1502  // optional attributes
1503  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1504  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1505  // check parent
1507  // continue if flag is ok
1508  if (parsedOk) {
1509  // set tag
1511  // add all attributes
1515  }
1516 }
1517 
1518 
1519 void
1521  // declare Ok Flag
1522  bool parsedOk = true;
1523  // needed attributes
1524  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1525  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1526  // check parent
1528  // continue if flag is ok
1529  if (parsedOk) {
1530  if (probability < 0) {
1531  writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_DEST_PROB_REROUTE)));
1532  } else {
1533  // set tag
1535  // add all attributes
1538  }
1539  }
1540 }
1541 
1542 
1543 void
1545  // declare Ok Flag
1546  bool parsedOk = true;
1547  // needed attributes
1548  const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1549  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1550  // optional attributes
1551  const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1552  // check parent
1554  // continue if flag is ok
1555  if (parsedOk) {
1556  if (probability < 0) {
1557  writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_PARKING_AREA_REROUTE)));
1558  } else {
1559  // set tag
1561  // add all attributes
1565  }
1566  }
1567 }
1568 
1569 
1570 void
1572  // declare Ok Flag
1573  bool parsedOk = true;
1574  // needed attributes
1575  const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1576  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1577  // check parent
1579  // continue if flag is ok
1580  if (parsedOk) {
1581  if (probability < 0) {
1582  writeError(TLF("Probability of % must be equal or greater than 0", toString(SUMO_TAG_ROUTE_PROB_REROUTE)));
1583  } else {
1584  // set tag
1586  // add all attributes
1589  }
1590  }
1591 }
1592 
1593 
1594 void
1596  // declare Ok Flag
1597  bool parsedOk = true;
1598  // needed attributes
1599  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1600  const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1601  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1602  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1603  const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1604  // optional attributes
1605  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1606  // continue if flag is ok
1607  if (parsedOk) {
1608  // set tag
1610  // add all attributes
1617  }
1618 }
1619 
1620 
1621 void
1623  // declare Ok Flag
1624  bool parsedOk = true;
1625  // needed attributes
1626  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1627  SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1628  SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1629  // optional attributes
1630  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1631  // continue if flag is ok
1632  if (parsedOk) {
1633  // set tag
1635  // add all attributes
1640  }
1641 }
1642 
1643 
1644 void
1646  // declare Ok Flag
1647  bool parsedOk = true;
1648  // needed attributes
1649  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1650  // optional attributes
1651  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1652  const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1653  const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1654  // continue if flag is ok
1655  if (parsedOk) {
1656  // set tag
1658  // add all attributes
1663  }
1664 }
1665 
1666 
1667 void
1669  // declare Ok Flag
1670  bool parsedOk = true;
1671  // needed attributes
1672  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1673  const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1674  const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1675  // optional attributes
1676  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1677  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1678  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1679  const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1680  // continue if flag is ok
1681  if (parsedOk) {
1682  // set tag
1684  // add all attributes
1692  }
1693 }
1694 
1695 
1696 void
1698  // declare Ok Flag
1699  bool parsedOk = true;
1700  // needed attributes
1701  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1702  const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1703  const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1704  const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1705  const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1706  const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1707  // continue if flag is ok
1708  if (parsedOk) {
1709  // set tag
1711  // add all attributes
1718  }
1719 }
1720 
1721 
1722 void
1724  // declare Ok Flag
1725  bool parsedOk = true;
1726  // needed attributes
1727  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1728  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1729  // optional attributes
1730  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1731  const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1732  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1733  const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1734  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1735  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1736  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1737  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1738  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1739  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1740  // continue if flag is ok
1741  if (parsedOk) {
1742  // set tag
1744  // add all attributes
1757  }
1758 }
1759 
1760 
1761 void
1763  // declare Ok Flag
1764  bool parsedOk = true;
1765  // check that x and y are defined together
1766  if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1767  (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1768  writeError(TL("X and Y must be be defined together in POIs"));
1769  parsedOk = false;
1770  }
1771  // check that lane and pos are defined together
1772  if ((attrs.hasAttribute(SUMO_ATTR_LANE) && !attrs.hasAttribute(SUMO_ATTR_POSITION)) ||
1774  writeError(TL("lane and position must be defined together in POIs"));
1775  parsedOk = false;
1776  }
1777  // check that lon and lat are defined together
1778  if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1779  (!attrs.hasAttribute(SUMO_ATTR_LON) && attrs.hasAttribute(SUMO_ATTR_LAT))) {
1780  writeError(TL("lon and lat must be be defined together in POIs"));
1781  parsedOk = false;
1782  }
1783  // needed attributes
1784  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1785  // special attributes
1786  const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1787  const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1788  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1789  const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1790  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1791  const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1792  const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1793  const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1794  // optional attributes
1795  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1796  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1797  std::string icon = attrs.getOpt<std::string>(SUMO_ATTR_ICON, "", parsedOk, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE));
1798  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1799  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1800  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1801  const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1802  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1803  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1804  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1805  // check icon
1806  if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
1807  WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
1808  icon = "none";
1809  }
1810  // continue if flag is ok
1811  if (parsedOk) {
1812  // set tag
1814  // add attributes depending of Lane/Lanes
1815  if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1818  } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1823  } else {
1826  }
1827  // add rest attributes
1839  }
1840 }
1841 
1842 
1843 void
1845  // declare Ok Flag
1846  bool parsedOk = true;
1847  // needed attributes
1848  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1849  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1850  // optional attributes
1851  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1852  // continue if flag is ok
1853  if (parsedOk) {
1854  // set tag
1856  // add all attributes
1860  }
1861 }
1862 
1863 
1864 void
1866  // declare Ok Flag
1867  bool parsedOk = true;
1868  // needed attributes
1869  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1870  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1871  // optional attributes
1872  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1873  // continue if flag is ok
1874  if (parsedOk) {
1875  // set tag
1877  // add all attributes
1881  }
1882 }
1883 
1884 
1885 void
1887  // declare Ok Flag
1888  bool parsedOk = true;
1889  // get key
1890  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, parsedOk);
1891  // get SumoBaseObject parent
1893  // check parent
1894  if (SumoBaseObjectParent == nullptr) {
1895  writeError(TL("Parameters must be defined within an object."));
1896  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_ROOTFILE) {
1897  writeError(TL("Parameters cannot be defined in the additional file's root."));
1898  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_PARAM) {
1899  writeError(TL("Parameters cannot be defined within another parameter."));
1900  } else if (parsedOk) {
1901  // get tag str
1902  const std::string parentTagStr = toString(SumoBaseObjectParent->getTag());
1903  // circumventing empty string value
1904  const std::string value = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
1905  // show warnings if values are invalid
1906  if (key.empty()) {
1907  WRITE_WARNINGF(TL("Error parsing key from % generic parameter. Key cannot be empty."), parentTagStr);
1908  } else if (!SUMOXMLDefinitions::isValidParameterKey(key)) {
1909  WRITE_WARNINGF(TL("Error parsing key from % generic parameter. Key contains invalid characters."), parentTagStr);
1910  } else {
1911  WRITE_DEBUG("Inserting generic parameter '" + key + "|" + value + "' into " + parentTagStr);
1912  // insert parameter in SumoBaseObjectParent
1913  SumoBaseObjectParent->addParameter(key, value);
1914  }
1915  }
1916 }
1917 
1918 
1919 void
1920 AdditionalHandler::checkParent(const SumoXMLTag currentTag, const std::vector<SumoXMLTag>& parentTags, bool& ok) {
1921  // check that parent SUMOBaseObject's tag is the parentTag
1923  if ((parent != nullptr) &&
1924  (parentTags.size() > 0) &&
1925  (std::find(parentTags.begin(), parentTags.end(), parent->getTag()) == parentTags.end())) {
1926  const std::string id = parent->hasStringAttribute(SUMO_ATTR_ID) ? ", id: '" + parent->getStringAttribute(SUMO_ATTR_ID) + "'" : "";
1927  writeError(TLF("'%' must be defined within the definition of a '%' (found % '%').", toString(currentTag), toString(parentTags.front()), toString(parent->getTag()), id));
1928  ok = false;
1929  }
1930 }
1931 
1932 
1933 bool
1934 AdditionalHandler::checkDetectPersons(const SumoXMLTag currentTag, const std::string& id, const std::string& detectPersons) {
1935  if (detectPersons.empty() || SUMOXMLDefinitions::PersonModeValues.hasString(detectPersons)) {
1936  return true;
1937  } else {
1938  writeError(TLF("Attribute '%' defined in % with id '%' doesn't have a valid value (given '%').", toString(SUMO_ATTR_DETECT_PERSONS), toString(currentTag), id, detectPersons));
1939  return false;
1940  }
1941 }
1942 
1943 /****************************************************************************/
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_NEXT_EDGES
@ 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_SHOW_DETECTOR
@ 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_OPEN_ENTRY
@ 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_DETECT_PERSONS
@ 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
void parseChargingStationAttributes(const SUMOSAXAttributes &attrs)
parse chargingStation 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::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show, const Parameterised::Map &parameters)=0
Builds a single-lane Area Detector (E2)
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)
bool checkDetectPersons(const SumoXMLTag currentTag, const std::string &id, const std::string &detectPersons)
check detect persons
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
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 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::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds a induction loop detector (E1)
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::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const bool openEntry, const bool expectedArrival, const Parameterised::Map &parameters)=0
Builds a multi entry exit detector (E3)
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 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::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds a Instant Induction Loop Detector (E1Instant)
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
virtual void buildMultiLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::vector< std::string > &laneIDs, 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::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show, const Parameterised::Map &parameters)=0
Builds a multi-lane Area Detector (E2)
void parseParkingAreaAttributes(const SUMOSAXAttributes &attrs)
parse parking area attributes
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:322
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< PersonMode > PersonModeValues
person modes
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
bool hasString(const std::string &str) const
const std::string & getString(const T key) const