Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
43bool
45 // open SUMOBaseOBject
47 // check tag
48 try {
49 switch (tag) {
50 // Stopping Places
53 break;
56 break;
57 case SUMO_TAG_ACCESS:
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;
87 break;
90 break;
93 break;
94 // TAZs
95 case SUMO_TAG_TAZ:
96 parseTAZAttributes(attrs);
97 break;
100 break;
101 case SUMO_TAG_TAZSINK:
103 break;
104 // Variable Speed Sign
105 case SUMO_TAG_VSS:
107 break;
108 case SUMO_TAG_STEP:
110 break;
111 // Calibrator
115 break;
116 // flow (calibrator)
117 case SUMO_TAG_FLOW:
119 break;
120 // Rerouter
123 break;
126 break;
129 break;
132 break;
135 break;
138 break;
141 break;
142 // Route probe
145 break;
146 // Vaporizer (deprecated)
149 break;
150 // wires
153 break;
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
181 return false;
182 }
183 } catch (InvalidArgument& e) {
184 writeError(e.what());
185 }
186 return true;
187}
188
189
190void
192 // get last inserted object
194 if (obj) {
195 // close SUMOBaseOBject
197 // check tag
198 switch (obj->getTag()) {
199 // Stopping Places
205 // detectors
213 // TAZs
214 case SUMO_TAG_TAZ:
215 // Variable Speed Sign
216 case SUMO_TAG_VSS:
217 // Calibrator
220 // Rerouter
222 // Route probe
224 // Vaporizer (deprecated)
226 // wires
230 // Shapes
231 case SUMO_TAG_POLY:
232 case SUMO_TAG_POI:
233 // JuPedSim
236 // parse object and all their childrens
238 // delete object (and all of their childrens)
239 delete obj;
240 break;
241 default:
242 break;
243 }
244 }
245}
246
247
248void
250 // switch tag
251 switch (obj->getTag()) {
252 // Stopping Places
254 if (buildBusStop(obj,
265 obj->getParameters())) {
266 obj->markAsCreated();
267 }
268 break;
270 if (buildTrainStop(obj,
281 obj->getParameters())) {
282 obj->markAsCreated();
283 }
284 break;
285 case SUMO_TAG_ACCESS:
286 if (buildAccess(obj,
291 obj->getParameters())) {
292 obj->markAsCreated();
293 }
294 break;
296 if (buildContainerStop(obj,
307 obj->getParameters())) {
308 obj->markAsCreated();
309 }
310 break;
312 if (buildChargingStation(obj,
326 obj->getParameters())) {
327 obj->markAsCreated();
328 }
329 break;
331 if (buildParkingArea(obj,
346 obj->getParameters())) {
347 obj->markAsCreated();
348 }
349 break;
351 if (buildParkingSpace(obj,
360 obj->getParameters())) {
361 obj->markAsCreated();
362 }
363 break;
364 // Detectors
367 // build E1
368 if (buildE1Detector(obj,
372 obj->getPeriodAttribute(),
379 obj->getParameters())) {
380 obj->markAsCreated();
381 }
382 break;
391 obj->getPeriodAttribute(),
403 obj->getParameters())) {
404 obj->markAsCreated();
405 }
406 } else {
412 obj->getPeriodAttribute(),
424 obj->getParameters())) {
425 obj->markAsCreated();
426 }
427 }
428 break;
431 if (buildDetectorE3(obj,
434 obj->getPeriodAttribute(),
444 obj->getParameters())) {
445 obj->markAsCreated();
446 }
447 break;
449 if (buildDetectorEntry(obj,
453 obj->getParameters())) {
454 obj->markAsCreated();
455 }
456 break;
458 if (buildDetectorExit(obj,
462 obj->getParameters())) {
463 obj->markAsCreated();
464 }
465 break;
477 obj->getParameters())) {
478 obj->markAsCreated();
479 }
480 break;
481 // TAZs
482 case SUMO_TAG_TAZ:
483 if (buildTAZ(obj,
491 obj->getParameters())) {
492 obj->markAsCreated();
493 }
494 break;
496 if (buildTAZSource(obj,
499 obj->markAsCreated();
500 }
501 break;
502 case SUMO_TAG_TAZSINK:
503 if (buildTAZSink(obj,
506 obj->markAsCreated();
507 }
508 break;
509 // Variable Speed Sign
510 case SUMO_TAG_VSS:
517 obj->getParameters())) {
518 obj->markAsCreated();
519 }
520 break;
521 case SUMO_TAG_STEP:
525 obj->markAsCreated();
526 }
527 break;
528 // Calibrator
530 if (buildEdgeCalibrator(obj,
536 obj->getPeriodAttribute(),
540 obj->getParameters())) {
541 obj->markAsCreated();
542 }
543 break;
545 if (buildLaneCalibrator(obj,
551 obj->getPeriodAttribute(),
555 obj->getParameters())) {
556 obj->markAsCreated();
557 }
558 break;
559 case SUMO_TAG_FLOW:
560 if (buildCalibratorFlow(obj,
561 obj->getVehicleParameter())) {
562 obj->markAsCreated();
563 }
564 break;
565 // Rerouter
567 if (buildRerouter(obj,
577 obj->getParameters())) {
578 obj->markAsCreated();
579 }
580 break;
586 obj->markAsCreated();
587 }
588 break;
590 if (buildClosingReroute(obj,
594 obj->markAsCreated();
595 }
596 break;
598 if (buildDestProbReroute(obj,
601 obj->markAsCreated();
602 }
603 break;
609 obj->markAsCreated();
610 }
611 break;
613 if (buildRouteProbReroute(obj,
616 obj->markAsCreated();
617 }
618 break;
620 // check if is VSS or a REROUTER interval
622 if (buildRerouterInterval(obj,
625 obj->markAsCreated();
626 }
627 } else {
631 obj->markAsCreated();
632 }
633 }
634 break;
635 // Route probe
637 if (buildRouteProbe(obj,
640 obj->getPeriodAttribute(),
645 obj->getParameters())) {
646 obj->markAsCreated();
647 }
648 break;
649 // Vaporizer (deprecated)
651 if (buildVaporizer(obj,
656 obj->getParameters())) {
657 obj->markAsCreated();
658 }
659 break;
660 // wire elements
667 obj->getParameters())) {
668 obj->markAsCreated();
669 }
670 break;
672 if (buildOverheadWire(obj,
680 obj->getParameters())) {
681 obj->markAsCreated();
682 }
683 break;
691 obj->getParameters())) {
692 obj->markAsCreated();
693 }
694 break;
695 // Polygon
696 case SUMO_TAG_POLY:
697 if (buildPolygon(obj,
710 obj->getParameters())) {
711 obj->markAsCreated();
712 }
713 break;
714 // POI
715 case SUMO_TAG_POI:
716 // check if we want to create a POI, POILane or POIGEO
718 // build POI over view
719 if (buildPOI(obj,
733 obj->getParameters())) {
734 obj->markAsCreated();
735 }
736 } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
737 // build POI over Lane
738 if (buildPOILane(obj,
754 obj->getParameters())) {
755 obj->markAsCreated();
756 }
757 } else {
758 // build POIGEO over view
759 if (buildPOIGeo(obj,
773 obj->getParameters())) {
774 obj->markAsCreated();
775 }
776 }
777 break;
778 // Jps WalkableArea
780 if (buildJpsWalkableArea(obj,
785 obj->getParameters())) {
786 obj->markAsCreated();
787 }
788 break;
789 // Jps Obstacle
791 if (buildJpsObstacle(obj,
796 obj->getParameters())) {
797 obj->markAsCreated();
798 }
799 break;
800 default:
801 break;
802 }
803 // now iterate over childrens
804 for (const auto& child : obj->getSumoBaseObjectChildren()) {
805 // call this function recursively
806 parseSumoBaseObject(child);
807 }
808}
809
810
811void
813 // declare Ok Flag
814 bool parsedOk = true;
815 // needed attributes
816 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
817 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
818 // optional attributes
819 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
820 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
821 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
822 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
823 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
824 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
825 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
826 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
827 // continue if flag is ok
828 if (parsedOk) {
829 // set tag
831 // add all attributes
842 } else {
844 }
845}
846
847
848void
850 // declare Ok Flag
851 bool parsedOk = true;
852 // needed attributes
853 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
854 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
855 // optional attributes
856 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
857 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
858 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
859 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
860 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
861 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
862 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
863 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
864 // continue if flag is ok
865 if (parsedOk) {
866 // set tag
868 // add all attributes
879 } else {
881 }
882}
883
884
885void
887 // declare Ok Flag
888 bool parsedOk = true;
889 // needed attributes
890 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
891 const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
892 // optional attributes
893 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00); /* in future updates, INVALID_DOUBLE */
894 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
895 // check parent
897 // continue if flag is ok
898 if (parsedOk) {
899 // set tag
901 // add all attributes
906 } else {
908 }
909}
910
911
912void
914 // declare Ok Flag
915 bool parsedOk = true;
916 // needed attributes
917 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
918 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
919 // optional attributes
920 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
921 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
922 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
923 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
924 const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
925 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
926 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
927 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
928 // continue if flag is ok
929 if (parsedOk) {
930 // set tag
932 // add all attributes
943 } else {
945 }
946}
947
948
949void
951 // declare Ok Flag
952 bool parsedOk = true;
953 // needed attributes
954 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
955 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
956 // optional attributes
957 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
958 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
959 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
960 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
961 const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
962 const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
963 const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
964 const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
965 const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, "normal");
966 const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
967 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
968 const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
969
970 // check charge type
971 if ((chargeType != "normal") && (chargeType != "electric") && (chargeType != "fuel")) {
972 writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
973 parsedOk = false;
974 }
975 // continue if flag is ok
976 if (parsedOk) {
977 // set tag
979 // add all attributes
994 } else {
996 }
997}
998
999
1000void
1002 // declare Ok Flag
1003 bool parsedOk = true;
1004 // needed attributes
1005 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1006 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1007 // optional attributes
1008 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1009 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1010 const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
1011 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1012 const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
1013 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1014 const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
1015 const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
1016 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
1017 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1018 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
1019 const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
1020
1021 // continue if flag is ok
1022 if (parsedOk) {
1023 // set tag
1025 // add all attributes
1040 } else {
1042 }
1043}
1044
1045
1046void
1048 // declare Ok Flag
1049 bool parsedOk = true;
1050 // needed attributes
1051 const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
1052 const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
1053 // optional attributes
1054 const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
1055 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
1056 const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
1057 const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
1058 const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
1059 const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
1060 // check parent
1062 // continue if flag is ok
1063 if (parsedOk) {
1064 // set tag
1066 // add all attributes
1075 } else {
1077 }
1078}
1079
1080
1081void
1083 // declare Ok Flag
1084 bool parsedOk = true;
1085 // needed attributes
1086 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1087 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1088 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1089 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1090 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1091 // optional attributes
1092 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1093 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1094 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1095 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1096 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1097 // continue if flag is ok
1098 if (parsedOk && checkDetectPersons(SUMO_TAG_E1DETECTOR, id, detectPersons)) {
1099 // set tag
1101 // add all attributes
1112 } else {
1114 }
1115}
1116
1117
1118void
1120 // declare Ok Flag
1121 bool parsedOk = true;
1122 const int positionDef = attrs.hasAttribute(SUMO_ATTR_POSITION) ? 1 : 0;
1123 const int endPosDef = attrs.hasAttribute(SUMO_ATTR_ENDPOS) ? 1 : 0;
1124 const int lengthDef = attrs.hasAttribute(SUMO_ATTR_LENGTH) ? 1 : 0;
1125 // check attributes
1126 if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) > 2)) {
1127 writeError(TL("'pos', 'endPos' and 'length' cannot be defined together in a single lane area detector."));
1129 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) < 2)) {
1130 writeError(TL("A single lane area detector requires two parameters of those 'pos', 'endPos' and 'length'."));
1132 } else {
1133 // needed attributes
1134 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1135 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1136 // special attributes
1137 const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1138 const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
1139 const double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1140 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
1141 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1142 // optional attributes
1143 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1144 const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
1145 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1146 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1147 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1148 const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
1149 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1150 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1151 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1152 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1153 const bool show = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), parsedOk, true);
1154 // continue if flag is ok
1155 if (parsedOk && checkDetectPersons(SUMO_TAG_E2DETECTOR, id, detectPersons)) {
1156 // set tag
1158 // add attributes depending of Lane/Lanes
1159 if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
1161 if (positionDef == 0) {
1164 } else if (endPosDef == 0) {
1167 } else if (lengthDef == 0) {
1170 }
1171 } else {
1175 }
1176 // add all attributes
1190 } else {
1192 }
1193 }
1194}
1195
1196
1197void
1199 // declare Ok Flag
1200 bool parsedOk = true;
1201 // needed attributes
1202 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1203 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1204 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1205 // optional attributes
1206 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1207 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1208 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1209 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1210 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1211 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1212 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1213 const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), parsedOk, false);
1214 const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
1215 // continue if flag is ok
1216 if (parsedOk && checkDetectPersons(SUMO_TAG_E3DETECTOR, id, detectPersons)) {
1217 // set tag
1219 // add all attributes
1232 } else {
1234 }
1235}
1236
1237
1238void
1240 // declare Ok Flag
1241 bool parsedOk = true;
1242 // needed attributes
1243 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1244 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1245 // optional attributes
1246 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1247 // check parent
1249 // continue if flag is ok
1250 if (parsedOk) {
1251 // set tag
1253 // add all attributes
1257 } else {
1259 }
1260}
1261
1262
1263void
1265 // declare Ok Flag
1266 bool parsedOk = true;
1267 // needed attributes
1268 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1269 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1270 // optional attributes
1271 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1272 // check parent
1274 // continue if flag is ok
1275 if (parsedOk) {
1276 // set tag
1278 // add all attributes
1282 } else {
1284 }
1285}
1286
1287
1288void
1290 // declare Ok Flag
1291 bool parsedOk = true;
1292 // needed attributes
1293 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1294 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1295 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1296 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1297 // optional attributes
1298 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1299 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1300 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1301 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1302 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1303 // continue if flag is ok
1304 if (parsedOk && checkDetectPersons(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, detectPersons)) {
1305 // set tag
1307 // add all attributes
1317 } else {
1319 }
1320}
1321
1322
1323void
1325 // declare Ok Flag
1326 bool parsedOk = true;
1327 // needed attributes
1328 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1329 // optional attributes
1330 const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1331 const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
1332 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1333 const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1334 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1335 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1336 // continue if flag is ok
1337 if (parsedOk) {
1338 // set tag
1340 // add all attributes
1348 } else {
1350 }
1351}
1352
1353
1354void
1356 // declare Ok Flag
1357 bool parsedOk = true;
1358 // needed attributes
1359 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1360 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1361 // check parent
1363 // continue if flag is ok
1364 if (parsedOk) {
1365 // set tag
1367 // add all attributes
1370 } else {
1372 }
1373}
1374
1375
1376void
1378 // declare Ok Flag
1379 bool parsedOk = true;
1380 // needed attributes
1381 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1382 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1383 // check parent
1385 // continue if flag is ok
1386 if (parsedOk) {
1387 // set tag
1389 // add all attributes
1392 } else {
1394 }
1395}
1396
1397
1398void
1400 // declare Ok Flag
1401 bool parsedOk = true;
1402 // needed attributes
1403 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1404 const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1405 // optional attributes
1406 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1407 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1408 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1409 // continue if flag is ok
1410 if (parsedOk) {
1411 // set tag
1413 // add all attributes
1419 } else {
1421 }
1422}
1423
1424
1425void
1427 // declare Ok Flag
1428 bool parsedOk = true;
1429 // needed attributes
1430 const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1431 // optional attributes
1432 const std::string speed = attrs.getOpt<std::string>(SUMO_ATTR_SPEED, "", parsedOk, "");
1433 // check parent
1435 // continue if flag is ok
1436 if (parsedOk) {
1437 // set tag
1439 // add all attributes
1442 } else {
1444 }
1445}
1446
1447
1448void
1450 // declare Ok Flag
1451 bool parsedOk = true;
1452 // check that frecuency and trafficLight aren't defined together
1453 if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1455 writeError(TL("Calibrators need either an edge or a lane"));
1456 parsedOk = false;
1457 }
1458 // needed attributes
1459 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1460 const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1461 // special attributes
1462 const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1463 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1464 // optional attributes
1465 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1466 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1467 const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1468 const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1469 const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1470 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1471 // continue if flag is ok
1472 if (parsedOk) {
1473 // set tag depending of edge/lane
1474 if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1477 } else {
1480 }
1489 } else {
1491 }
1492}
1493
1494
1495void
1497 // declare Ok Flag
1498 bool parsedOk = true;
1499 // check parent
1501 // check that frecuency and trafficLight aren't defined together
1503 writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
1505 } else {
1507 if (flowParameter) {
1508 // set VPH and speed
1510 flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1511 flowParameter->parametersSet |= VEHPARS_VPH_SET;
1512 }
1513 if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1514 flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1516 }
1517 // set begin and end
1518 flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1519 flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1520 if (parsedOk) {
1521 // set tag
1523 // set vehicle parameters
1525 // delete flow parameter (because in XMLStructure we have a copy)
1526 delete flowParameter;
1527 } else {
1529 }
1530 } else {
1532 }
1533 }
1534 } else {
1536 }
1537}
1538
1539
1540void
1542 // declare Ok Flag
1543 bool parsedOk = true;
1544 // needed attributes
1545 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1546 const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1547 // optional attributes
1548 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1549 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1550 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1551 SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1552 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1553 const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1554 const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
1555 // check attributes
1556 if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB , probability, true)) {
1557 parsedOk = false;
1558 }
1559 // continue if flag is ok
1560 if (parsedOk) {
1561 // set tag
1563 // add all attributes
1573 } else {
1575 }
1576}
1577
1578
1579void
1581 // declare Ok Flag
1582 bool parsedOk = true;
1583 // needed attributes
1584 const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1585 const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1586 // check parent
1588 // continue if flag is ok
1589 if (parsedOk) {
1590 // set tag
1592 // add all attributes
1595 } else {
1597 }
1598}
1599
1600
1601void
1603 // declare Ok Flag
1604 bool parsedOk = true;
1605 // needed attributes
1606 const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1607 // optional attributes
1608 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1609 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1610 // check parent
1612 // continue if flag is ok
1613 if (parsedOk) {
1614 // set tag
1616 // add all attributes
1620 } else {
1622 }
1623}
1624
1625
1626void
1628 // declare Ok Flag
1629 bool parsedOk = true;
1630 // needed attributes
1631 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1632 // optional attributes
1633 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1634 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1635 // check parent
1637 // continue if flag is ok
1638 if (parsedOk) {
1639 // set tag
1641 // add all attributes
1645 } else {
1647 }
1648}
1649
1650
1651void
1653 // declare Ok Flag
1654 bool parsedOk = true;
1655 // needed attributes
1656 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1657 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1658 // check attributes
1659 if (!checkNegative(SUMO_TAG_DEST_PROB_REROUTE, edgeID, SUMO_ATTR_PROB, probability, true)) {
1660 parsedOk = false;
1661 }
1662 // check parent
1664 // continue if flag is ok
1665 if (parsedOk) {
1666 // set tag
1668 // add all attributes
1671 } else {
1673 }
1674}
1675
1676
1677void
1679 // declare Ok Flag
1680 bool parsedOk = true;
1681 // needed attributes
1682 const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1683 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1684 // check attributes
1685 if (!checkNegative(SUMO_TAG_PARKING_AREA_REROUTE, parkingAreaID, SUMO_ATTR_PROB, probability, true)) {
1686 parsedOk = false;
1687 }
1688 // optional attributes
1689 const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1690 // check parent
1692 // continue if flag is ok
1693 if (parsedOk) {
1694 // set tag
1696 // add all attributes
1700 } else {
1702 }
1703}
1704
1705
1706void
1708 // declare Ok Flag
1709 bool parsedOk = true;
1710 // needed attributes
1711 const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1712 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1713 // check attributes
1714 if (!checkNegative(SUMO_TAG_ROUTE_PROB_REROUTE, routeID, SUMO_ATTR_PROB, probability, true)) {
1715 parsedOk = false;
1716 }
1717 // check parent
1719 // continue if flag is ok
1720 if (parsedOk) {
1721 // set tag
1723 // add all attributes
1726 } else {
1728 }
1729}
1730
1731
1732void
1734 // declare Ok Flag
1735 bool parsedOk = true;
1736 // needed attributes
1737 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1738 const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1739 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1740 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1741 const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1742 // optional attributes
1743 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1744 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1745 // continue if flag is ok
1746 if (parsedOk) {
1747 // set tag
1749 // add all attributes
1757 } else {
1759 }
1760}
1761
1762
1763void
1765 // declare Ok Flag
1766 bool parsedOk = true;
1767 // needed attributes
1768 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1769 SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1770 SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1771 // optional attributes
1772 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1773 // continue if flag is ok
1774 if (parsedOk) {
1775 // set tag
1777 // add all attributes
1782 } else {
1784 }
1785}
1786
1787
1788void
1790 // declare Ok Flag
1791 bool parsedOk = true;
1792 // needed attributes
1793 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1794 // optional attributes
1795 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1796 const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1797 const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1798 // continue if flag is ok
1799 if (parsedOk) {
1800 // set tag
1802 // add all attributes
1807 } else {
1809 }
1810}
1811
1812
1813void
1815 // declare Ok Flag
1816 bool parsedOk = true;
1817 // needed attributes
1818 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1819 const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1820 const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1821 // optional attributes
1822 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1823 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1824 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1825 const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1826 // continue if flag is ok
1827 if (parsedOk) {
1828 // set tag
1830 // add all attributes
1838 } else {
1840 }
1841}
1842
1843
1844void
1846 // declare Ok Flag
1847 bool parsedOk = true;
1848 // needed attributes
1849 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1850 const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1851 const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1852 const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1853 const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1854 const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1855 // continue if flag is ok
1856 if (parsedOk) {
1857 // set tag
1859 // add all attributes
1866 } else {
1868 }
1869}
1870
1871
1872void
1874 // declare Ok Flag
1875 bool parsedOk = true;
1876 // needed attributes
1877 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1878 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1879 // optional attributes
1880 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1881 const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1882 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1883 const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1884 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1885 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1886 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1887 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1888 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1889 const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1890 // continue if flag is ok
1891 if (parsedOk) {
1892 // set tag
1894 // add all attributes
1907 } else {
1909 }
1910}
1911
1912
1913void
1915 // declare Ok Flag
1916 bool parsedOk = true;
1917 // check that x and y are defined together
1918 if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1919 (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1920 writeError(TL("X and Y must be be defined together in POIs"));
1921 parsedOk = false;
1922 }
1923 // check that lane and pos are defined together
1926 writeError(TL("lane and position must be defined together in POIs"));
1927 parsedOk = false;
1928 }
1929 // check that lon and lat are defined together
1930 if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1932 writeError(TL("lon and lat must be be defined together in POIs"));
1933 parsedOk = false;
1934 }
1935 // needed attributes
1936 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1937 // special attributes
1938 const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1939 const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1940 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1941 const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1942 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1943 const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1944 const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1945 const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1946 // optional attributes
1947 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1948 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1949 std::string icon = attrs.getOpt<std::string>(SUMO_ATTR_ICON, "", parsedOk, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE));
1950 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1951 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1952 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1953 const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1954 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1955 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1956 const bool relativePath = attrs.getOpt<bool>(SUMO_ATTR_RELATIVEPATH, id.c_str(), parsedOk, Shape::DEFAULT_RELATIVEPATH);
1957 // check icon
1958 if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
1959 WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
1960 icon = "none";
1961 }
1962 // continue if flag is ok
1963 if (parsedOk) {
1964 // set tag
1966 // add attributes depending of Lane/Lanes
1967 if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1970 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1975 } else {
1978 }
1979 // add rest attributes
1991 } else {
1993 }
1994}
1995
1996
1997void
1999 // declare Ok Flag
2000 bool parsedOk = true;
2001 // needed attributes
2002 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2003 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2004 // optional attributes
2005 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2006 // continue if flag is ok
2007 if (parsedOk) {
2008 // set tag
2010 // add all attributes
2014 } else {
2016 }
2017}
2018
2019
2020void
2022 // declare Ok Flag
2023 bool parsedOk = true;
2024 // needed attributes
2025 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2026 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2027 // optional attributes
2028 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2029 // continue if flag is ok
2030 if (parsedOk) {
2031 // set tag
2033 // add all attributes
2037 } else {
2039 }
2040}
2041
2042
2043bool
2046 if (parentCalibrator == nullptr) {
2047 return false;
2048 }
2049 const auto parentRootFile = parentCalibrator->getParentSumoBaseObject();
2050 if (parentRootFile != nullptr) {
2051 return false;
2052 }
2053 if ((parentCalibrator->getTag() == SUMO_TAG_CALIBRATOR) || (parentCalibrator->getTag() == GNE_TAG_CALIBRATOR_LANE)){
2054 return true;
2055 } else {
2056 return writeError(TLF("Calibrator Flows has to be defined within of a %.", toString(SUMO_TAG_CALIBRATOR)));
2057 }
2058}
2059
2060
2061bool
2062AdditionalHandler::checkDetectPersons(const SumoXMLTag currentTag, const std::string& id, const std::string& detectPersons) {
2063 if (detectPersons.empty() || SUMOXMLDefinitions::PersonModeValues.hasString(detectPersons)) {
2064 return true;
2065 } else {
2066 writeError(TLF("Attribute '%' defined in % with id '%' doesn't have a valid value (given '%').", toString(SUMO_ATTR_DETECT_PERSONS), toString(currentTag), id, detectPersons));
2067 return false;
2068 }
2069}
2070
2071/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#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 long long int VEHPARS_VPH_SET
const long long 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_NOTHING
invalid tag, must be the last one
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ 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_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_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 bool buildClosingReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &closedEdgeID, SVCPermissions permissions)=0
builds a closing edge reroute
virtual bool 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 std::vector< std::string > &vTypes, const Parameterised::Map &parameters)=0
builds a Route probe
void parseE1InstantAttributes(const SUMOSAXAttributes &attrs)
parse E1 instant attributes
void parseCalibratorAttributes(const SUMOSAXAttributes &attrs)
parse calibrator attributes
virtual bool 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 bool 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 parseChargingStationAttributes(const SUMOSAXAttributes &attrs)
parse chargingStation attributes
virtual bool 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.
bool checkDetectPersons(const SumoXMLTag currentTag, const std::string &id, const std::string &detectPersons)
check detect persons
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
virtual bool 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
virtual bool 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 bool 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.
void parseRouteProbRerouteAttributes(const SUMOSAXAttributes &attrs)
parse route prob reroute attributes
virtual bool buildRerouterInterval(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOTime begin, const SUMOTime end)=0
builds a rerouter interval
void parseJpsWalkableAreaAttributes(const SUMOSAXAttributes &attrs)
parse juPedSim walkable area attributes
void parseCalibratorFlowAttributes(const SUMOSAXAttributes &attrs)
parse calibrator flow attributes
virtual bool 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 parseParkingAreaRerouteAttributes(const SUMOSAXAttributes &attrs)
parse parking area reroute attributes
void parseTAZAttributes(const SUMOSAXAttributes &attrs)
parse TAZ attributes
virtual bool buildCalibratorFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameter)=0
builds a calibrator flow
virtual bool 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)
AdditionalHandler()
Constructor.
virtual bool 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
virtual bool 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)
void parseOverheadWire(const SUMOSAXAttributes &attrs)
parse overhead wire segment
void parseTractionSubstation(const SUMOSAXAttributes &attrs)
parse traction substation
virtual bool 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.
virtual bool 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 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
virtual bool 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)
bool beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs)
begin parse attributes
void parseTrainStopAttributes(const SUMOSAXAttributes &attrs)
parse trainStop attributes
virtual bool 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.
virtual bool 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 parsePOIAttributes(const SUMOSAXAttributes &attrs)
parse POI attributes
void endParseAttributes()
end parse attributes
virtual bool buildClosingLaneReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &closedLane, SVCPermissions permissions)=0
builds a closing lane reroute
virtual bool 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 bool 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 bool 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)
void parseJpsObstacleAttributes(const SUMOSAXAttributes &attrs)
parse juPedSim obstacle attributes
void parseVariableSpeedSignAttributes(const SUMOSAXAttributes &attrs)
parse variable speed sign attributes
virtual ~AdditionalHandler()
Destructor.
virtual bool buildVariableSpeedSignStep(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOTime time, const std::string &speed)=0
Builds a VariableSpeedSign Step.
virtual bool 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 parseDestProbRerouteAttributes(const SUMOSAXAttributes &attrs)
parse dest prob reroute attributes
void parseE1Attributes(const SUMOSAXAttributes &attrs)
parse E1 attributes
virtual bool 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
void parseVariableSpeedSignStepAttributes(const SUMOSAXAttributes &attrs)
parse variable speed sign step attributes
virtual bool 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 bool 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 parseParkingSpaceAttributes(const SUMOSAXAttributes &attrs)
parse parking space attributes
void parseExitAttributes(const SUMOSAXAttributes &attrs)
parse exist attributes
void parseRerouterAttributes(const SUMOSAXAttributes &attrs)
parse rerouter attributes
void parseBusStopAttributes(const SUMOSAXAttributes &attrs)
void parseContainerStopAttributes(const SUMOSAXAttributes &attrs)
parse containerStop attributes
virtual bool 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)
void parseParkingAreaAttributes(const SUMOSAXAttributes &attrs)
parse parking area attributes
virtual bool 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 bool buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newRouteID, const double probability)=0
builds a route prob reroute
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
bool checkCalibratorFlowParents()
check calibrator flow parents
void parseVaporizerAttributes(const SUMOSAXAttributes &attrs)
parse vaporizer attributes
virtual bool buildDestProbReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newEdgeDestinationID, const double probability)=0
builds a dest prob reroute
virtual bool 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
virtual bool 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)
void parseClosingLaneRerouteAttributes(const SUMOSAXAttributes &attrs)
parse closing lane reroute attributes
virtual bool buildTAZSource(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const double departWeight)=0
Builds a TAZSource (Traffic Assignment Zone)
virtual bool 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
virtual bool 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.
void parseRerouterIntervalAttributes(const SUMOSAXAttributes &attrs)
parse rerouter interval attributes
virtual bool 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.
virtual bool buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newParkignAreaID, const double probability, const bool visible)=0
builds a parking area reroute
void parseEntryAttributes(const SUMOSAXAttributes &attrs)
parse entry attributes
void parsePolyAttributes(const SUMOSAXAttributes &attrs)
virtual bool buildTAZSink(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const double arrivalWeight)=0
Builds a TAZSink (Traffic Assignment Zone)
void parseClosingRerouteAttributes(const SUMOSAXAttributes &attrs)
parse closing reroute attributes
void checkParsedParent(const SumoXMLTag currentTag, const std::vector< SumoXMLTag > &parentTags, bool &ok)
bool writeError(const std::string &error)
write error and enable error creating element
void parseParameters(const SUMOSAXAttributes &attrs)
parse generic parameters
CommonXMLStructure myCommonXMLStructure
common XML Structure
bool checkNegative(const SumoXMLTag tag, const std::string &id, const SumoXMLAttr attribute, const int value, const bool canBeZero)
check if the given int value is NOT negative
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 markAsCreated()
mark as successfully created
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
void abortSUMOBaseOBject()
abort SUMOBaseOBject
CommonXMLStructure::SumoBaseObject * getCurrentSumoBaseObject() const
get current editedSumoBaseObject
void openSUMOBaseOBject()
open SUMOBaseOBject
void closeSUMOBaseOBject()
close SUMOBaseOBject
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.
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.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
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 const bool DEFAULT_RELATIVEPATH
Definition Shape.h:48
static const double DEFAULT_LAYER
Definition Shape.h:43
static const double DEFAULT_LAYER_POI
Definition Shape.h:45
static const double DEFAULT_IMG_WIDTH
Definition Shape.h:49
static const std::string DEFAULT_IMG_FILE
Definition Shape.h:47
static const double DEFAULT_LINEWIDTH
Definition Shape.h:44
static const double DEFAULT_ANGLE
Definition Shape.h:46
static const double DEFAULT_IMG_HEIGHT
Definition Shape.h:50
static const std::string DEFAULT_TYPE
Definition Shape.h:42
const std::string & getString(const T key) const
bool hasString(const std::string &str) const