Eclipse SUMO - Simulation of Urban MObility
AdditionalHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // The XML-Handler for additionals loading
19 /****************************************************************************/
20 #include <config.h>
21 
24 #include <utils/shapes/Shape.h>
27 
28 #include "AdditionalHandler.h"
29 
30 
31 // ===========================================================================
32 // method definitions
33 // ===========================================================================
34 
36 
37 
39 
40 
41 bool
43  // open SUMOBaseOBject
45  // check tag
46  try {
47  switch (tag) {
48  // Stopping Places
49  case SUMO_TAG_BUS_STOP:
51  break;
54  break;
55  case SUMO_TAG_ACCESS:
56  parseAccessAttributes(attrs);
57  break;
60  break;
63  break;
66  break;
69  break;
70  // Detectors
73  parseE1Attributes(attrs);
74  break;
77  parseE2Attributes(attrs);
78  break;
81  parseE3Attributes(attrs);
82  break;
83  case SUMO_TAG_DET_ENTRY:
84  parseEntryAttributes(attrs);
85  break;
86  case SUMO_TAG_DET_EXIT:
87  parseExitAttributes(attrs);
88  break;
91  break;
92  // TAZs
93  case SUMO_TAG_TAZ:
94  parseTAZAttributes(attrs);
95  break;
96  case SUMO_TAG_TAZSOURCE:
98  break;
99  case SUMO_TAG_TAZSINK:
100  parseTAZSinkAttributes(attrs);
101  break;
102  // Variable Speed Sign
103  case SUMO_TAG_VSS:
105  break;
106  case SUMO_TAG_STEP:
108  break;
109  // Calibrator
110  case SUMO_TAG_CALIBRATOR:
113  break;
114  // flow (calibrator)
115  case SUMO_TAG_FLOW:
117  break;
118  // Rerouter
119  case SUMO_TAG_REROUTER:
121  break;
122  case SUMO_TAG_INTERVAL:
124  break;
127  break;
130  break;
133  break;
136  break;
139  break;
140  // Route probe
141  case SUMO_TAG_ROUTEPROBE:
143  break;
144  // Vaporizer (deprecated)
145  case SUMO_TAG_VAPORIZER:
147  break;
148  // wires
151  break;
153  parseOverheadWireClamp(attrs);
154  break;
156  parseOverheadWire(attrs);
157  break;
158  // Poly
159  case SUMO_TAG_POLY:
160  parsePolyAttributes(attrs);
161  break;
162  case SUMO_TAG_POI:
163  parsePOIAttributes(attrs);
164  break;
165  // parameters
166  case SUMO_TAG_PARAM:
167  parseParameters(attrs);
168  break;
169  default:
170  // tag cannot be parsed in AdditionalHandler
171  return false;
172  break;
173  }
174  } catch (InvalidArgument& e) {
175  writeError(e.what());
176  }
177  return true;
178 }
179 
180 
181 void
183  // get last inserted object
185  // close SUMOBaseOBject
187  // check tag
188  switch (obj->getTag()) {
189  // Stopping Places
190  case SUMO_TAG_BUS_STOP:
191  case SUMO_TAG_TRAIN_STOP:
195  // detectors
196  case SUMO_TAG_E1DETECTOR:
198  case SUMO_TAG_E2DETECTOR:
200  case SUMO_TAG_E3DETECTOR:
203  // TAZs
204  case SUMO_TAG_TAZ:
205  // Variable Speed Sign
206  case SUMO_TAG_VSS:
207  // Calibrator
208  case SUMO_TAG_CALIBRATOR:
210  // Rerouter
211  case SUMO_TAG_REROUTER:
212  // Route probe
213  case SUMO_TAG_ROUTEPROBE:
214  // Vaporizer (deprecated)
215  case SUMO_TAG_VAPORIZER:
216  // wires
220  // Shapes
221  case SUMO_TAG_POLY:
222  case SUMO_TAG_POI:
223  // parse object and all their childrens
224  parseSumoBaseObject(obj);
225  // delete object (and all of their childrens)
226  delete obj;
227  break;
228  default:
229  break;
230  }
231 }
232 
233 
234 void
236  // switch tag
237  switch (obj->getTag()) {
238  // Stopping Places
239  case SUMO_TAG_BUS_STOP:
240  buildBusStop(obj,
251  obj->getParameters());
252  break;
253  case SUMO_TAG_TRAIN_STOP:
254  buildTrainStop(obj,
265  obj->getParameters());
266  break;
267  case SUMO_TAG_ACCESS:
268  buildAccess(obj,
273  obj->getParameters());
274  break;
276  buildContainerStop(obj,
287  obj->getParameters());
288  break;
301  obj->getParameters());
302  break;
304  buildParkingArea(obj,
317  obj->getParameters());
318  break;
320  buildParkingSpace(obj,
329  obj->getParameters());
330  break;
331  // Detectors
332  case SUMO_TAG_E1DETECTOR:
334  // build E1
335  buildE1Detector(obj,
339  obj->getPeriodAttribute(),
344  obj->getParameters());
345  break;
346  case SUMO_TAG_E2DETECTOR:
354  obj->getPeriodAttribute(),
363  obj->getParameters());
364  } else {
370  obj->getPeriodAttribute(),
379  obj->getParameters());
380  }
381  break;
382  case SUMO_TAG_E3DETECTOR:
384  buildDetectorE3(obj,
387  obj->getPeriodAttribute(),
393  obj->getParameters());
394  break;
395  case SUMO_TAG_DET_ENTRY:
396  buildDetectorEntry(obj,
400  obj->getParameters());
401  break;
402  case SUMO_TAG_DET_EXIT:
403  buildDetectorExit(obj,
407  obj->getParameters());
408  break;
418  obj->getParameters());
419  break;
420  // TAZs
421  case SUMO_TAG_TAZ:
422  buildTAZ(obj,
430  obj->getParameters());
431  break;
432  case SUMO_TAG_TAZSOURCE:
433  buildTAZSource(obj,
436  break;
437  case SUMO_TAG_TAZSINK:
438  buildTAZSink(obj,
441  break;
442  // Variable Speed Sign
443  case SUMO_TAG_VSS:
450  obj->getParameters());
451  break;
452  case SUMO_TAG_STEP:
456  break;
457  // Calibrator
458  case SUMO_TAG_CALIBRATOR:
465  obj->getPeriodAttribute(),
469  obj->getParameters());
470  break;
478  obj->getPeriodAttribute(),
482  obj->getParameters());
483  break;
484  case SUMO_TAG_FLOW:
486  obj->getVehicleParameter());
487  break;
488  // Rerouter
489  case SUMO_TAG_REROUTER:
490  buildRerouter(obj,
499  obj->getParameters());
500  break;
505  break;
510  break;
515  break;
521  break;
526  break;
527  case SUMO_TAG_INTERVAL:
528  // check if is VSS or a REROUTER interval
533  } else {
537  }
538  break;
539  // Route probe
540  case SUMO_TAG_ROUTEPROBE:
541  buildRouteProbe(obj,
544  obj->getPeriodAttribute(),
548  obj->getParameters());
549  break;
550  // Vaporizer (deprecated)
551  case SUMO_TAG_VAPORIZER:
552  buildVaporizer(obj,
557  obj->getParameters());
558  break;
559  // wire elements
566  obj->getParameters());
567  break;
569  buildOverheadWire(obj,
577  obj->getParameters());
578  break;
586  obj->getParameters());
587  break;
588  // Polygon
589  case SUMO_TAG_POLY:
590  buildPolygon(obj,
603  obj->getParameters());
604  break;
605  // POI
606  case SUMO_TAG_POI:
607  // check if we want to create a POI, POILane or POIGEO
608  if (obj->hasDoubleAttribute(SUMO_ATTR_X)) {
609  // build PO
610  buildPOI(obj,
623  obj->getParameters());
624  } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
625  // build POI over Lane
626  buildPOILane(obj,
641  obj->getParameters());
642  } else {
643  // build POIGEO
644  buildPOIGeo(obj,
657  obj->getParameters());
658  }
659  break;
660  default:
661  break;
662  }
663  // now iterate over childrens
664  for (const auto& child : obj->getSumoBaseObjectChildren()) {
665  // call this function recursively
666  parseSumoBaseObject(child);
667  }
668 }
669 
670 
671 bool
673  return myErrorCreatingElement;
674 }
675 
676 
677 void
678 AdditionalHandler::writeError(const std::string& error) {
679  WRITE_ERROR(error);
680  myErrorCreatingElement = true;
681 }
682 
683 
684 void
686  // declare Ok Flag
687  bool parsedOk = true;
688  // needed attributes
689  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
690  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
691  // optional attributes
692  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
693  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
694  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
695  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
696  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
697  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
698  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
699  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
700  // continue if flag is ok
701  if (parsedOk) {
702  // set tag
704  // add all attributes
715  }
716 }
717 
718 
719 void
721  // declare Ok Flag
722  bool parsedOk = true;
723  // needed attributes
724  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
725  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
726  // optional attributes
727  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
728  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
729  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
730  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
731  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
732  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
733  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
734  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
735  // continue if flag is ok
736  if (parsedOk) {
737  // set tag
739  // add all attributes
750  }
751 }
752 
753 
754 void
756  // declare Ok Flag
757  bool parsedOk = true;
758  // needed attributes
759  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
760  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
761  // optional attributes
762  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00); /* in future updates, INVALID_DOUBLE */
763  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
764  // check parent
766  // continue if flag is ok
767  if (parsedOk) {
768  // set tag
770  // add all attributes
775  }
776 }
777 
778 
779 void
781  // declare Ok Flag
782  bool parsedOk = true;
783  // needed attributes
784  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
785  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
786  // optional attributes
787  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
788  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
789  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
790  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
791  const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
792  const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
793  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
794  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
795  // continue if flag is ok
796  if (parsedOk) {
797  // set tag
799  // add all attributes
810  }
811 }
812 
813 
814 void
816  // declare Ok Flag
817  bool parsedOk = true;
818  // needed attributes
819  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
820  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
821  // optional attributes
822  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
823  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
824  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
825  const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
826  const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
827  const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
828  const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
829  const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
830  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
831  // continue if flag is ok
832  if (parsedOk) {
833  // set tag
835  // add all attributes
847  }
848 }
849 
850 
851 void
853  // declare Ok Flag
854  bool parsedOk = true;
855  // needed attributes
856  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
857  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
858  // optional attributes
859  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
860  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
861  const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
862  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
863  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
864  const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
865  const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
866  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
867  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
868  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
869  // continue if flag is ok
870  if (parsedOk) {
871  // set tag
873  // add all attributes
886  }
887 }
888 
889 
890 void
892  // declare Ok Flag
893  bool parsedOk = true;
894  // needed attributes
895  const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
896  const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
897  // optional attributes
898  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
899  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
900  const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
901  const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
902  const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
903  const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
904  // check parent
906  // continue if flag is ok
907  if (parsedOk) {
908  // set tag
910  // add all attributes
919  }
920 }
921 
922 
923 void
925  // declare Ok Flag
926  bool parsedOk = true;
927  // needed attributes
928  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
929  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
930  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
931  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
932  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
933  // optional attributes
934  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
935  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
936  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
937  // continue if flag is ok
938  if (parsedOk) {
939  // set tag
941  // add all attributes
950  }
951 }
952 
953 
954 void
956  // declare Ok Flag
957  bool parsedOk = true;
958  // check that lane and length are defined together
960  writeError("'lane' and 'length' must be defined together in a lane area detector.");
961  parsedOk = false;
962  }
963  // check that lanes and endPos are defined together
965  writeError("'lanes' and 'endPos' must be defined together in a lane area detector.");
966  parsedOk = false;
967  }
968  // needed attributes
969  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
970  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
971  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
972  // special attributes
973  const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
974  const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
975  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
976  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
977  // optional attributes
978  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
979  const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
980  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
981  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
982  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
983  const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
984  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
985  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
986  // continue if flag is ok
987  if (parsedOk) {
988  // set tag
990  // add attributes depending of Lane/Lanes
991  if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
994  } else {
997  }
998  // add all attributes
1010  }
1011 }
1012 
1013 
1014 void
1016  // declare Ok Flag
1017  bool parsedOk = true;
1018  // needed attributes
1019  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1020  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1021  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1022  // optional attributes
1023  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1024  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1025  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1026  const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1027  const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1028  // continue if flag is ok
1029  if (parsedOk) {
1030  // set tag
1032  // add all attributes
1041  }
1042 }
1043 
1044 
1045 void
1047  // declare Ok Flag
1048  bool parsedOk = true;
1049  // needed attributes
1050  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1051  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1052  // optional attributes
1053  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1054  // check parent
1056  // continue if flag is ok
1057  if (parsedOk) {
1058  // set tag
1060  // add all attributes
1064  }
1065 }
1066 
1067 
1068 void
1070  // declare Ok Flag
1071  bool parsedOk = true;
1072  // needed attributes
1073  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1074  const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1075  // optional attributes
1076  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1077  // check parent
1079  // continue if flag is ok
1080  if (parsedOk) {
1081  // set tag
1083  // add all attributes
1087  }
1088 }
1089 
1090 
1091 void
1093  // declare Ok Flag
1094  bool parsedOk = true;
1095  // needed attributes
1096  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1097  const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1098  const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1099  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1100  // optional attributes
1101  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1102  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1103  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1104  // continue if flag is ok
1105  if (parsedOk) {
1106  // set tag
1108  // add all attributes
1116  }
1117 }
1118 
1119 
1120 void
1122  // declare Ok Flag
1123  bool parsedOk = true;
1124  // needed attributes
1125  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1126  // optional attributes
1127  const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1128  const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position());
1129  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1130  const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1131  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1132  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1133  // continue if flag is ok
1134  if (parsedOk) {
1135  // set tag
1137  // add all attributes
1145  }
1146 }
1147 
1148 
1149 void
1151  // declare Ok Flag
1152  bool parsedOk = true;
1153  // needed attributes
1154  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1155  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1156  // check parent
1158  // continue if flag is ok
1159  if (parsedOk) {
1160  // set tag
1162  // add all attributes
1165  }
1166 }
1167 
1168 
1169 void
1171  // declare Ok Flag
1172  bool parsedOk = true;
1173  // needed attributes
1174  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1175  const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1176  // check parent
1178  // continue if flag is ok
1179  if (parsedOk) {
1180  // set tag
1182  // add all attributes
1185  }
1186 }
1187 
1188 
1189 void
1191  // declare Ok Flag
1192  bool parsedOk = true;
1193  // needed attributes
1194  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1195  const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1196  // optional attributes
1197  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
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  // continue if flag is ok
1201  if (parsedOk) {
1202  // set tag
1204  // add all attributes
1210  }
1211 }
1212 
1213 
1214 void
1216  // declare Ok Flag
1217  bool parsedOk = true;
1218  // needed attributes
1219  const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1220  // optional attributes
1221  const std::string speed = attrs.getOpt<std::string>(SUMO_ATTR_SPEED, "", parsedOk, "");
1222  // check parent
1223  checkParent(SUMO_TAG_STEP, {SUMO_TAG_VSS}, parsedOk);
1224  // continue if flag is ok
1225  if (parsedOk) {
1226  // set tag
1228  // add all attributes
1231  }
1232 }
1233 
1234 
1235 void
1237  // declare Ok Flag
1238  bool parsedOk = true;
1239  // check that frecuency and trafficLight aren't defined together
1240  if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1241  (!attrs.hasAttribute(SUMO_ATTR_EDGE) && !attrs.hasAttribute(SUMO_ATTR_LANE))) {
1242  writeError("Calibrators need either an edge or a lane");
1243  parsedOk = false;
1244  }
1245  // needed attributes
1246  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1247  const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1248  // special attributes
1249  const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1250  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1251  // optional attributes
1252  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1253  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1254  const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1255  const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1256  const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, 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 depending of edge/lane
1261  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1264  } else {
1267  }
1276  }
1277 }
1278 
1279 
1280 void
1282  // declare Ok Flag
1283  bool parsedOk = true;
1284  // check parent
1287  // check that frecuency and trafficLight aren't defined together
1289  writeError("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)");
1290  }
1291  // first parse flow
1292  SUMOVehicleParameter* flowParameter = SUMOVehicleParserHelper::parseVehicleAttributes(SUMO_TAG_FLOW, attrs, false, true, true);
1293  if (flowParameter) {
1294  // set VPH and speed
1295  if (attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR)) {
1296  flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1297  flowParameter->parametersSet |= VEHPARS_VPH_SET;
1298  }
1299  if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1300  flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1301  flowParameter->parametersSet |= VEHPARS_CALIBRATORSPEED_SET;
1302  }
1303  if (parsedOk) {
1304  // set tag
1306  // set vehicle parameters
1308  // delete flow parameter (because in XMLStructure we have a copy)
1309  delete flowParameter;
1310  }
1311  }
1312  }
1313 }
1314 
1315 
1316 void
1318  // declare Ok Flag
1319  bool parsedOk = true;
1320  // needed attributes
1321  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1322  const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1323  // optional attributes
1324  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1325  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1326  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1327  SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1328  const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1329  const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1330  // continue if flag is ok
1331  if (parsedOk) {
1332  // set tag
1334  // add all attributes
1343  }
1344 }
1345 
1346 
1347 void
1349  // declare Ok Flag
1350  bool parsedOk = true;
1351  // needed attributes
1352  const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1353  const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1354  // check parent
1356  // continue if flag is ok
1357  if (parsedOk) {
1358  // set tag
1360  // add all attributes
1363  }
1364 }
1365 
1366 
1367 void
1369  // declare Ok Flag
1370  bool parsedOk = true;
1371  // needed attributes
1372  const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1373  // optional attributes
1374  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1375  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1376  // check parent
1378  // continue if flag is ok
1379  if (parsedOk) {
1380  // set tag
1382  // add all attributes
1386  }
1387 }
1388 
1389 
1390 void
1392  // declare Ok Flag
1393  bool parsedOk = true;
1394  // needed attributes
1395  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1396  // optional attributes
1397  const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1398  const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1399  // check parent
1401  // continue if flag is ok
1402  if (parsedOk) {
1403  // set tag
1405  // add all attributes
1409  }
1410 }
1411 
1412 
1413 void
1415  // declare Ok Flag
1416  bool parsedOk = true;
1417  // needed attributes
1418  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1419  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1420  // check parent
1422  // continue if flag is ok
1423  if (parsedOk) {
1424  if (probability < 0) {
1425  writeError("Probability of " + toString(SUMO_TAG_DEST_PROB_REROUTE) + " must be equal or greater than 0");
1426  } else {
1427  // set tag
1429  // add all attributes
1432  }
1433  }
1434 }
1435 
1436 
1437 void
1439  // declare Ok Flag
1440  bool parsedOk = true;
1441  // needed attributes
1442  const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1443  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1444  // optional attributes
1445  const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1446  // check parent
1448  // continue if flag is ok
1449  if (parsedOk) {
1450  if (probability < 0) {
1451  writeError("Probability of " + toString(SUMO_TAG_PARKING_AREA_REROUTE) + " must be equal or greater than 0");
1452  } else {
1453  // set tag
1455  // add all attributes
1459  }
1460  }
1461 }
1462 
1463 
1464 void
1466  // declare Ok Flag
1467  bool parsedOk = true;
1468  // needed attributes
1469  const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1470  const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1471  // check parent
1473  // continue if flag is ok
1474  if (parsedOk) {
1475  if (probability < 0) {
1476  writeError("Probability of " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + " must be equal or greater than 0");
1477  } else {
1478  // set tag
1480  // add all attributes
1483  }
1484  }
1485 }
1486 
1487 
1488 void
1490  // declare Ok Flag
1491  bool parsedOk = true;
1492  // needed attributes
1493  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1494  const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1495  const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1496  const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1497  const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1498  // optional attributes
1499  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1500  // continue if flag is ok
1501  if (parsedOk) {
1502  // set tag
1504  // add all attributes
1511  }
1512 }
1513 
1514 
1515 void
1517  // declare Ok Flag
1518  bool parsedOk = true;
1519  // needed attributes
1520  const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1521  SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1522  SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1523  // optional attributes
1524  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1525  // continue if flag is ok
1526  if (parsedOk) {
1527  // set tag
1529  // add all attributes
1534  }
1535 }
1536 
1537 
1538 void
1540  // declare Ok Flag
1541  bool parsedOk = true;
1542  // needed attributes
1543  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1544  // optional attributes
1545  const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1546  const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1547  const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1548  // continue if flag is ok
1549  if (parsedOk) {
1550  // set tag
1552  // add all attributes
1557  }
1558 }
1559 
1560 
1561 void
1563  // declare Ok Flag
1564  bool parsedOk = true;
1565  // needed attributes
1566  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1567  const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1568  const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1569  // optional attributes
1570  const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1571  const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1572  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1573  const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1574  // continue if flag is ok
1575  if (parsedOk) {
1576  // set tag
1578  // add all attributes
1586  }
1587 }
1588 
1589 
1590 void
1592  // declare Ok Flag
1593  bool parsedOk = true;
1594  // needed attributes
1595  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1596  const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1597  const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1598  const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1599  const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1600  const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1601  // continue if flag is ok
1602  if (parsedOk) {
1603  // set tag
1605  // add all attributes
1612  }
1613 }
1614 
1615 
1616 void
1618  // declare Ok Flag
1619  bool parsedOk = true;
1620  // needed attributes
1621  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1622  const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1623  // optional attributes
1624  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1625  const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1626  const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1627  const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1628  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1629  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1630  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1631  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1632  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1633  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1634  // continue if flag is ok
1635  if (parsedOk) {
1636  // set tag
1638  // add all attributes
1651  }
1652 }
1653 
1654 
1655 void
1657  // declare Ok Flag
1658  bool parsedOk = true;
1659  // check that x and y are defined together
1660  if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1661  (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1662  writeError("X and Y must be be defined together in POIs");
1663  parsedOk = false;
1664  }
1665  // check that lane and pos are defined together
1666  if ((attrs.hasAttribute(SUMO_ATTR_LANE) && !attrs.hasAttribute(SUMO_ATTR_POSITION)) ||
1668  writeError("lane and position must be be defined together in POIs");
1669  parsedOk = false;
1670  }
1671  // check that lon and lat are defined together
1672  if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1673  (!attrs.hasAttribute(SUMO_ATTR_LON) && attrs.hasAttribute(SUMO_ATTR_LAT))) {
1674  writeError("lon and lat must be be defined together in POIs");
1675  parsedOk = false;
1676  }
1677  // needed attributes
1678  const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1679  // special attributes
1680  const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1681  const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1682  const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1683  const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1684  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1685  const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1686  const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1687  const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1688  // optional attributes
1689  const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1690  const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1691  const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1692  const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1693  const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1694  const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1695  const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1696  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1697  const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1698  // continue if flag is ok
1699  if (parsedOk) {
1700  // set tag
1702  // add attributes depending of Lane/Lanes
1703  if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1706  } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1711  } else {
1714  }
1715  // add rest attributes
1726  }
1727 }
1728 
1729 
1730 void
1732  // declare Ok Flag
1733  bool parsedOk = true;
1734  // get key
1735  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, parsedOk);
1736  // get SumoBaseObject parent
1738  // check parent
1739  if (SumoBaseObjectParent == nullptr) {
1740  writeError("Parameters must be defined within an object.");
1741  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_ROOTFILE) {
1742  writeError("Parameters cannot be defined in the additional file's root.");
1743  } else if (SumoBaseObjectParent->getTag() == SUMO_TAG_PARAM) {
1744  writeError("Parameters cannot be defined within another parameter.");
1745  } else if (parsedOk) {
1746  // get tag str
1747  const std::string parentTagStr = toString(SumoBaseObjectParent->getTag());
1748  // circumventing empty string value
1749  const std::string value = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
1750  // show warnings if values are invalid
1751  if (key.empty()) {
1752  WRITE_WARNING("Error parsing key from " + parentTagStr + " generic parameter. Key cannot be empty.");
1753  } else if (!SUMOXMLDefinitions::isValidParameterKey(key)) {
1754  WRITE_WARNING("Error parsing key from " + parentTagStr + " generic parameter. Key contains invalid characters.");
1755  } else {
1756  WRITE_DEBUG("Inserting generic parameter '" + key + "|" + value + "' into " + parentTagStr);
1757  // insert parameter in SumoBaseObjectParent
1758  SumoBaseObjectParent->addParameter(key, value);
1759  }
1760  }
1761 }
1762 
1763 
1764 void
1765 AdditionalHandler::checkParent(const SumoXMLTag currentTag, const std::vector<SumoXMLTag>& parentTags, bool& ok) {
1766  // check that parent SUMOBaseObject's tag is the parentTag
1768  if ((parent != nullptr) &&
1769  (parentTags.size() > 0) &&
1770  (std::find(parentTags.begin(), parentTags.end(), parent->getTag()) == parentTags.end())) {
1771  const std::string id = parent->hasStringAttribute(SUMO_ATTR_ID) ? ", id: '" + parent->getStringAttribute(SUMO_ATTR_ID) + "'" : "";
1772  writeError("'" + toString(currentTag) + "' must be defined within the definition of a '" + toString(parentTags.front()) + "' (found '" + toString(parent->getTag()) + "'" + id + ").");
1773  ok = false;
1774  }
1775 }
1776 
1777 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:276
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:274
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
#define SUMOTime_MAX_PERIOD
Definition: SUMOTime.h:35
#define TIME2STEPS(x)
Definition: SUMOTime.h:56
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 definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ 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 destiny of a reroute
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_E1DETECTOR
an e1 detector
@ SUMO_TAG_DET_EXIT
an e3 exit point
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_CLOSING_LANE_REROUTE
lane of a reroute of type closing
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
@ SUMO_TAG_E3DETECTOR
an e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_LINES
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_LANE
@ SUMO_ATTR_LON
@ SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_VALUE
@ SUMO_ATTR_FILE
@ SUMO_ATTR_Y
@ SUMO_ATTR_SUBSTATIONID
id of a traction substation substation
@ SUMO_ATTR_Z
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ 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_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_OUTPUT
@ SUMO_ATTR_CHARGINGPOWER
@ SUMO_ATTR_PROB
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_ONROAD
@ SUMO_ATTR_LAT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_EFFICIENCY
Eficiency of the charge in Charging Stations.
@ SUMO_ATTR_ID
@ SUMO_ATTR_VISIBLE
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_KEY
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_CHARGEDELAY
Delay in the charge of charging stations.
@ SUMO_ATTR_TIME
trigger: the time of the step
@ SUMO_ATTR_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
Definition: StdDefs.h:60
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 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 Parameterised::Map &parameters)=0
Builds a multi entry exit detector (E3)
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 buildPOILane(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const std::string &laneID, const double posOverLane, const bool friendlyPosition, const double posLat, const double layer, const double angle, const std::string &imgFile, const bool relativePath, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI over lane using the given values.
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 buildPOI(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double x, const double y, const double layer, const double angle, const std::string &imgFile, bool relativePath, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI 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
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 SUMOTime timeThreshold, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)=0
builds a rerouter
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::string &name, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds a induction loop detector (E1)
void parseVariableSpeedSignAttributes(const SUMOSAXAttributes &attrs)
parse variable speed sign attributes
virtual ~AdditionalHandler()
Destructor.
virtual void buildAccess(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const double length, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds an Access.
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)
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 buildChargingStation(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const double chargingPower, const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay, const bool friendlyPosition, const Parameterised::Map &parameters)=0
Builds a charging Station.
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.
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 buildParkingArea(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &departPos, const std::string &name, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad, const double width, const double length, const double angle, const Parameterised::Map &parameters)=0
Builds a Parking Area.
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
virtual void buildPOIGeo(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double lon, const double lat, const double layer, const double angle, const std::string &imgFile, bool relativePath, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI in GEO coordinaten using the given values.
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
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)
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:298
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.
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)
Parses a vehicle's attributes.
static bool isValidParameterKey(const std::string &value)
whether the given string is a valid key for a parameter
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h: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