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-2025 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
37AdditionalHandler::AdditionalHandler(const std::string& filename) :
38 CommonHandler(filename) {
39}
40
41
43
44
45bool
47 // open SUMOBaseOBject
49 // check tag
50 try {
51 switch (tag) {
52 // Stopping Places
55 break;
58 break;
59 case SUMO_TAG_ACCESS:
61 break;
64 break;
67 break;
70 break;
73 break;
74 // Detectors
77 parseE1Attributes(attrs);
78 break;
81 parseE2Attributes(attrs);
82 break;
85 parseE3Attributes(attrs);
86 break;
89 break;
92 break;
95 break;
96 // TAZs
97 case SUMO_TAG_TAZ:
98 parseTAZAttributes(attrs);
99 break;
102 break;
103 case SUMO_TAG_TAZSINK:
105 break;
106 // Variable Speed Sign
107 case SUMO_TAG_VSS:
109 break;
110 case SUMO_TAG_STEP:
112 break;
113 // Calibrator
117 break;
118 // flow (calibrator)
119 case SUMO_TAG_FLOW:
121 break;
122 // Rerouter
125 break;
128 break;
131 break;
134 break;
137 break;
140 break;
143 break;
144 // Route probe
147 break;
148 // Vaporizer (deprecated)
151 break;
152 // wires
155 break;
158 break;
160 parseOverheadWire(attrs);
161 break;
162 // Poly
163 case SUMO_TAG_POLY:
164 parsePolyAttributes(attrs);
165 break;
166 case SUMO_TAG_POI:
167 parsePOIAttributes(attrs);
168 break;
169 // JuPedSim
172 break;
175 break;
176 // parameters
177 case SUMO_TAG_PARAM:
178 parseParameters(attrs);
179 break;
180 default:
181 // tag cannot be parsed in AdditionalHandler
183 return false;
184 }
185 } catch (InvalidArgument& e) {
186 writeError(e.what());
187 }
188 return true;
189}
190
191
192void
194 // get last inserted object
196 if (obj) {
197 // close SUMOBaseOBject
199 // check tag
200 switch (obj->getTag()) {
201 // Stopping Places
207 // detectors
215 // TAZs
216 case SUMO_TAG_TAZ:
217 // Variable Speed Sign
218 case SUMO_TAG_VSS:
219 // Calibrator
222 // Rerouter
224 // Route probe
226 // Vaporizer (deprecated)
228 // wires
232 // Shapes
233 case SUMO_TAG_POLY:
234 case SUMO_TAG_POI:
235 // JuPedSim
238 // parse object and all their childrens
240 // delete object (and all of their childrens)
241 delete obj;
242 break;
243 default:
244 break;
245 }
246 }
247}
248
249
250void
252 // check if loading was aborted
253 if (!myAbortLoading) {
254 // switch tag
255 switch (obj->getTag()) {
256 // Stopping Places
258 if (buildBusStop(obj,
270 obj->getParameters())) {
271 obj->markAsCreated();
272 }
273 break;
275 if (buildTrainStop(obj,
287 obj->getParameters())) {
288 obj->markAsCreated();
289 }
290 break;
291 case SUMO_TAG_ACCESS:
292 if (buildAccess(obj,
297 obj->getParameters())) {
298 obj->markAsCreated();
299 }
300 break;
302 if (buildContainerStop(obj,
314 obj->getParameters())) {
315 obj->markAsCreated();
316 }
317 break;
319 if (buildChargingStation(obj,
333 obj->getParameters())) {
334 obj->markAsCreated();
335 }
336 break;
338 if (buildParkingArea(obj,
353 obj->getParameters())) {
354 obj->markAsCreated();
355 }
356 break;
358 if (buildParkingSpace(obj,
367 obj->getParameters())) {
368 obj->markAsCreated();
369 }
370 break;
371 // Detectors
374 // build E1
375 if (buildE1Detector(obj,
379 obj->getPeriodAttribute(),
386 obj->getParameters())) {
387 obj->markAsCreated();
388 }
389 break;
398 obj->getPeriodAttribute(),
410 obj->getParameters())) {
411 obj->markAsCreated();
412 }
413 } else {
419 obj->getPeriodAttribute(),
431 obj->getParameters())) {
432 obj->markAsCreated();
433 }
434 }
435 break;
438 if (buildDetectorE3(obj,
441 obj->getPeriodAttribute(),
451 obj->getParameters())) {
452 obj->markAsCreated();
453 }
454 break;
456 if (buildDetectorEntry(obj,
460 obj->getParameters())) {
461 obj->markAsCreated();
462 }
463 break;
465 if (buildDetectorExit(obj,
469 obj->getParameters())) {
470 obj->markAsCreated();
471 }
472 break;
484 obj->getParameters())) {
485 obj->markAsCreated();
486 }
487 break;
488 // TAZs
489 case SUMO_TAG_TAZ:
490 if (buildTAZ(obj,
498 obj->getParameters())) {
499 obj->markAsCreated();
500 }
501 break;
503 if (buildTAZSource(obj,
506 obj->markAsCreated();
507 }
508 break;
509 case SUMO_TAG_TAZSINK:
510 if (buildTAZSink(obj,
513 obj->markAsCreated();
514 }
515 break;
516 // Variable Speed Sign
517 case SUMO_TAG_VSS:
524 obj->getParameters())) {
525 obj->markAsCreated();
526 }
527 break;
528 case SUMO_TAG_STEP:
532 obj->markAsCreated();
533 }
534 break;
535 // Calibrator
537 if (buildEdgeCalibrator(obj,
543 obj->getPeriodAttribute(),
547 obj->getParameters())) {
548 obj->markAsCreated();
549 }
550 break;
552 if (buildLaneCalibrator(obj,
558 obj->getPeriodAttribute(),
562 obj->getParameters())) {
563 obj->markAsCreated();
564 }
565 break;
566 case SUMO_TAG_FLOW:
567 if (buildCalibratorFlow(obj,
568 obj->getVehicleParameter())) {
569 obj->markAsCreated();
570 }
571 break;
572 // Rerouter
574 if (buildRerouter(obj,
584 obj->getParameters())) {
585 obj->markAsCreated();
586 }
587 break;
593 obj->markAsCreated();
594 }
595 break;
597 if (buildClosingReroute(obj,
601 obj->markAsCreated();
602 }
603 break;
605 if (buildDestProbReroute(obj,
608 obj->markAsCreated();
609 }
610 break;
616 obj->markAsCreated();
617 }
618 break;
620 if (buildRouteProbReroute(obj,
623 obj->markAsCreated();
624 }
625 break;
627 // check if is aREROUTER interval
629 if (buildRerouterInterval(obj,
632 obj->markAsCreated();
633 }
634 }
635 break;
636 // Route probe
638 if (buildRouteProbe(obj,
641 obj->getPeriodAttribute(),
646 obj->getParameters())) {
647 obj->markAsCreated();
648 }
649 break;
650 // Vaporizer (deprecated)
652 if (buildVaporizer(obj,
657 obj->getParameters())) {
658 obj->markAsCreated();
659 }
660 break;
661 // wire elements
668 obj->getParameters())) {
669 obj->markAsCreated();
670 }
671 break;
673 if (buildOverheadWire(obj,
681 obj->getParameters())) {
682 obj->markAsCreated();
683 }
684 break;
692 obj->getParameters())) {
693 obj->markAsCreated();
694 }
695 break;
696 // Polygon
697 case SUMO_TAG_POLY:
698 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,
732 obj->getParameters())) {
733 obj->markAsCreated();
734 }
735 } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
736 // build POI over Lane
737 if (buildPOILane(obj,
752 obj->getParameters())) {
753 obj->markAsCreated();
754 }
755 } else {
756 // build POIGEO over view
757 if (buildPOIGeo(obj,
770 obj->getParameters())) {
771 obj->markAsCreated();
772 }
773 }
774 break;
775 // Jps WalkableArea
777 if (buildJpsWalkableArea(obj,
782 obj->getParameters())) {
783 obj->markAsCreated();
784 }
785 break;
786 // Jps Obstacle
788 if (buildJpsObstacle(obj,
793 obj->getParameters())) {
794 obj->markAsCreated();
795 }
796 break;
797 default:
798 break;
799 }
800 // now iterate over childrens
801 for (const auto& child : obj->getSumoBaseObjectChildren()) {
802 // call this function recursively
803 parseSumoBaseObject(child);
804 }
805 }
806}
807
808
809void
811 // declare Ok Flag
812 bool parsedOk = true;
813 // needed attributes
814 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
815 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
816 // optional attributes
817 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
818 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
819 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
820 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
821 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
822 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
823 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
824 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
825 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
826 // continue if flag is ok
827 if (parsedOk) {
828 // set tag
830 // 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 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
865 // continue if flag is ok
866 if (parsedOk) {
867 // set tag
869 // add all attributes
881 } else {
883 }
884}
885
886
887void
889 // declare Ok Flag
890 bool parsedOk = true;
891 // needed attributes
892 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
893 const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
894 // optional attributes
895 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00, false); /* in future updates, INVALID_DOUBLE */
896 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
897 // check parent
899 // continue if flag is ok
900 if (parsedOk) {
901 // set tag
903 // add all attributes
908 } else {
910 }
911}
912
913
914void
916 // declare Ok Flag
917 bool parsedOk = true;
918 // needed attributes
919 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
920 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
921 // optional attributes
922 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
923 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
924 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
925 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
926 const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
927 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
928 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
929 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
930 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
931 // continue if flag is ok
932 if (parsedOk) {
933 // set tag
935 // add all attributes
947 } else {
949 }
950}
951
952
953void
955 // declare Ok Flag
956 bool parsedOk = true;
957 // needed attributes
958 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
959 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
960 // optional attributes
961 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
962 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
963 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
964 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
965 const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
966 const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
967 const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
968 const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
969 const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, SUMOXMLDefinitions::ChargeTypes.getString(ChargeType::NORMAL));
970 const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
971 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
972 const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
973 // check charge type
974 if ((chargeType != "normal") && (chargeType != "battery-exchange") && (chargeType != "fuel")) {
975 writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
976 parsedOk = false;
977 }
978 // continue if flag is ok
979 if (parsedOk) {
980 // set tag
982 // add all attributes
997 } else {
999 }
1000}
1001
1002
1003void
1005 // declare Ok Flag
1006 bool parsedOk = true;
1007 // needed attributes
1008 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1009 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1010 // optional attributes
1011 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1012 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1013 const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
1014 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1015 const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
1016 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1017 const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
1018 const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
1019 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
1020 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1021 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
1022 const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
1023 // continue if flag is ok
1024 if (parsedOk) {
1025 // set tag
1027 // add all attributes
1042 } else {
1044 }
1045}
1046
1047
1048void
1050 // declare Ok Flag
1051 bool parsedOk = true;
1052 // needed attributes
1053 const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
1054 const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
1055 // optional attributes
1056 const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
1057 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
1058 const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
1059 const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
1060 const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
1061 const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
1062 // check parent
1064 // continue if flag is ok
1065 if (parsedOk) {
1066 // set tag
1068 // add all attributes
1077 } else {
1079 }
1080}
1081
1082
1083void
1085 // declare Ok Flag
1086 bool parsedOk = true;
1087 // needed attributes
1088 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1089 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1090 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1091 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1092 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1093 // optional attributes
1094 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1095 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1096 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1097 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1098 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1099 // continue if flag is ok
1100 if (parsedOk && checkDetectPersons(SUMO_TAG_E1DETECTOR, id, detectPersons)) {
1101 // set tag
1103 // add all attributes
1114 } else {
1116 }
1117}
1118
1119
1120void
1122 // declare Ok Flag
1123 bool parsedOk = true;
1124 const int positionDef = attrs.hasAttribute(SUMO_ATTR_POSITION) ? 1 : 0;
1125 const int endPosDef = attrs.hasAttribute(SUMO_ATTR_ENDPOS) ? 1 : 0;
1126 const int lengthDef = attrs.hasAttribute(SUMO_ATTR_LENGTH) ? 1 : 0;
1127 // check attributes
1128 if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) > 2)) {
1129 writeError(TL("'pos', 'endPos' and 'length' cannot be defined together in a single lane area detector."));
1131 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) < 2)) {
1132 writeError(TL("A single lane area detector requires two parameters of those 'pos', 'endPos' and 'length'."));
1134 } else {
1135 // needed attributes
1136 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1137 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1138 // special attributes
1139 const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1140 const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
1141 const double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1142 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
1143 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1144 // optional attributes
1145 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1146 const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
1147 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1148 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1149 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1150 const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
1151 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1152 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1153 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1154 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1155 const bool show = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), parsedOk, true);
1156 // continue if flag is ok
1157 if (parsedOk && checkDetectPersons(SUMO_TAG_E2DETECTOR, id, detectPersons)) {
1158 // set tag
1160 // add attributes depending of Lane/Lanes
1161 if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
1163 if (positionDef == 0) {
1166 } else if (endPosDef == 0) {
1169 } else if (lengthDef == 0) {
1172 }
1173 } else {
1177 }
1178 // add all attributes
1192 } else {
1194 }
1195 }
1196}
1197
1198
1199void
1201 // declare Ok Flag
1202 bool parsedOk = true;
1203 // needed attributes
1204 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1205 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1206 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1207 // optional attributes
1208 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1209 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1210 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1211 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1212 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1213 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1214 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1215 const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), parsedOk, false);
1216 const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
1217 // continue if flag is ok
1218 if (parsedOk && checkDetectPersons(SUMO_TAG_E3DETECTOR, id, detectPersons)) {
1219 // set tag
1221 // add all attributes
1234 } else {
1236 }
1237}
1238
1239
1240void
1242 // declare Ok Flag
1243 bool parsedOk = true;
1244 // needed attributes
1245 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1246 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1247 // optional attributes
1248 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1249 // check parent
1251 // continue if flag is ok
1252 if (parsedOk) {
1253 // set tag
1255 // add all attributes
1259 } else {
1261 }
1262}
1263
1264
1265void
1267 // declare Ok Flag
1268 bool parsedOk = true;
1269 // needed attributes
1270 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1271 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1272 // optional attributes
1273 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1274 // check parent
1276 // continue if flag is ok
1277 if (parsedOk) {
1278 // set tag
1280 // add all attributes
1284 } else {
1286 }
1287}
1288
1289
1290void
1292 // declare Ok Flag
1293 bool parsedOk = true;
1294 // needed attributes
1295 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1296 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1297 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1298 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1299 // optional attributes
1300 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1301 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1302 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1303 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1304 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1305 // continue if flag is ok
1306 if (parsedOk && checkDetectPersons(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, detectPersons)) {
1307 // set tag
1309 // add all attributes
1319 } else {
1321 }
1322}
1323
1324
1325void
1327 // declare Ok Flag
1328 bool parsedOk = true;
1329 // needed attributes
1330 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1331 // optional attributes
1332 const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1333 const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
1334 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1335 const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1336 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1337 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1338 // continue if flag is ok
1339 if (parsedOk) {
1340 // set tag
1342 // add all attributes
1350 } else {
1352 }
1353}
1354
1355
1356void
1358 // declare Ok Flag
1359 bool parsedOk = true;
1360 // needed attributes
1361 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1362 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1363 // check parent
1365 // continue if flag is ok
1366 if (parsedOk) {
1367 // set tag
1369 // add all attributes
1372 } else {
1374 }
1375}
1376
1377
1378void
1380 // declare Ok Flag
1381 bool parsedOk = true;
1382 // needed attributes
1383 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1384 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1385 // check parent
1387 // continue if flag is ok
1388 if (parsedOk) {
1389 // set tag
1391 // add all attributes
1394 } else {
1396 }
1397}
1398
1399
1400void
1402 // declare Ok Flag
1403 bool parsedOk = true;
1404 // needed attributes
1405 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1406 const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1407 // optional attributes
1408 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1409 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1410 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1411 // continue if flag is ok
1412 if (parsedOk) {
1413 // set tag
1415 // add all attributes
1421 } else {
1423 }
1424}
1425
1426
1427void
1429 // declare Ok Flag
1430 bool parsedOk = true;
1431 // needed attributes
1432 const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1433 // optional attributes
1434 const double speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, "", parsedOk, OptionsCont::getOptions().getFloat("default.speed"));
1435 // check parent
1437 // continue if flag is ok
1438 if (parsedOk) {
1439 // set tag
1441 // add all attributes
1444 } else {
1446 }
1447}
1448
1449
1450void
1452 // declare Ok Flag
1453 bool parsedOk = true;
1454 // check that frecuency and trafficLight aren't defined together
1455 if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1457 writeError(TL("Calibrators need either an edge or a lane"));
1458 parsedOk = false;
1459 }
1460 // needed attributes
1461 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1462 const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1463 // special attributes
1464 const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1465 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1466 // optional attributes
1467 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1468 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1469 const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1470 const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1471 const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1472 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1473 // continue if flag is ok
1474 if (parsedOk) {
1475 // set tag depending of edge/lane
1476 if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1479 } else {
1482 }
1491 } else {
1493 }
1494}
1495
1496
1497void
1499 // declare Ok Flag
1500 bool parsedOk = true;
1501 // check parent
1503 // check that frecuency and trafficLight aren't defined together
1505 writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
1507 } else {
1509 if (flowParameter) {
1510 // set VPH and speed
1512 flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1513 flowParameter->parametersSet |= VEHPARS_VPH_SET;
1514 }
1515 if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1516 flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1518 }
1519 // set begin and end
1520 flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1521 flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1522 if (parsedOk) {
1523 // set tag
1525 // set vehicle parameters
1527 // delete flow parameter (because in XMLStructure we have a copy)
1528 delete flowParameter;
1529 } else {
1531 }
1532 } else {
1534 }
1535 }
1536 } else {
1538 }
1539}
1540
1541
1542void
1544 // declare Ok Flag
1545 bool parsedOk = true;
1546 // needed attributes
1547 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1548 const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1549 // optional attributes
1550 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1551 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1552 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1553 SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1554 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1555 const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1556 const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
1557 // check attributes
1558 if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB, probability, true)) {
1559 parsedOk = false;
1560 }
1561 // continue if flag is ok
1562 if (parsedOk) {
1563 // set tag
1565 // add all attributes
1575 } else {
1577 }
1578}
1579
1580
1581void
1583 // declare Ok Flag
1584 bool parsedOk = true;
1585 // needed attributes
1586 const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1587 const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1588 // check parent
1590 // continue if flag is ok
1591 if (parsedOk) {
1592 // set tag
1594 // add all attributes
1597 } else {
1599 }
1600}
1601
1602
1603void
1605 // declare Ok Flag
1606 bool parsedOk = true;
1607 // needed attributes
1608 const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1609 // optional attributes
1610 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1611 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1612 // check parent
1614 // continue if flag is ok
1615 if (parsedOk) {
1616 // set tag
1618 // add all attributes
1622 } else {
1624 }
1625}
1626
1627
1628void
1630 // declare Ok Flag
1631 bool parsedOk = true;
1632 // needed attributes
1633 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1634 // optional attributes
1635 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1636 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1637 // check parent
1639 // continue if flag is ok
1640 if (parsedOk) {
1641 // set tag
1643 // add all attributes
1647 } else {
1649 }
1650}
1651
1652
1653void
1655 // declare Ok Flag
1656 bool parsedOk = true;
1657 // needed attributes
1658 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1659 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1660 // check attributes
1661 if (!checkNegative(SUMO_TAG_DEST_PROB_REROUTE, edgeID, SUMO_ATTR_PROB, probability, true)) {
1662 parsedOk = false;
1663 }
1664 // check parent
1666 // continue if flag is ok
1667 if (parsedOk) {
1668 // set tag
1670 // add all attributes
1673 } else {
1675 }
1676}
1677
1678
1679void
1681 // declare Ok Flag
1682 bool parsedOk = true;
1683 // needed attributes
1684 const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1685 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1686 // check attributes
1687 if (!checkNegative(SUMO_TAG_PARKING_AREA_REROUTE, parkingAreaID, SUMO_ATTR_PROB, probability, true)) {
1688 parsedOk = false;
1689 }
1690 // optional attributes
1691 const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1692 // check parent
1694 // continue if flag is ok
1695 if (parsedOk) {
1696 // set tag
1698 // add all attributes
1702 } else {
1704 }
1705}
1706
1707
1708void
1710 // declare Ok Flag
1711 bool parsedOk = true;
1712 // needed attributes
1713 const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1714 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1715 // check attributes
1716 if (!checkNegative(SUMO_TAG_ROUTE_PROB_REROUTE, routeID, SUMO_ATTR_PROB, probability, true)) {
1717 parsedOk = false;
1718 }
1719 // check parent
1721 // continue if flag is ok
1722 if (parsedOk) {
1723 // set tag
1725 // add all attributes
1728 } else {
1730 }
1731}
1732
1733
1734void
1736 // declare Ok Flag
1737 bool parsedOk = true;
1738 // needed attributes
1739 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1740 const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1741 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1742 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1743 const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1744 // optional attributes
1745 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1746 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1747 // continue if flag is ok
1748 if (parsedOk) {
1749 // set tag
1751 // add all attributes
1759 } else {
1761 }
1762}
1763
1764
1765void
1767 // declare Ok Flag
1768 bool parsedOk = true;
1769 // needed attributes
1770 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1771 SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1772 SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1773 // optional attributes
1774 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1775 // continue if flag is ok
1776 if (parsedOk) {
1777 // set tag
1779 // add all attributes
1784 } else {
1786 }
1787}
1788
1789
1790void
1792 // declare Ok Flag
1793 bool parsedOk = true;
1794 // needed attributes
1795 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1796 // optional attributes
1797 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1798 const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1799 const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1800 // continue if flag is ok
1801 if (parsedOk) {
1802 // set tag
1804 // add all attributes
1809 } else {
1811 }
1812}
1813
1814
1815void
1817 // declare Ok Flag
1818 bool parsedOk = true;
1819 // needed attributes
1820 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1821 const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1822 const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1823 // optional attributes
1824 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1825 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1826 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1827 const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1828 // continue if flag is ok
1829 if (parsedOk) {
1830 // set tag
1832 // add all attributes
1840 } else {
1842 }
1843}
1844
1845
1846void
1848 // declare Ok Flag
1849 bool parsedOk = true;
1850 // needed attributes
1851 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1852 const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1853 const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1854 const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1855 const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1856 const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1857 // continue if flag is ok
1858 if (parsedOk) {
1859 // set tag
1861 // add all attributes
1868 } else {
1870 }
1871}
1872
1873
1874void
1876 // declare Ok Flag
1877 bool parsedOk = true;
1878 // needed attributes
1879 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1880 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1881 // optional attributes
1882 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1883 const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1884 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1885 const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1886 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1887 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1888 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1889 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1890 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1891 // continue if flag is ok
1892 if (parsedOk) {
1893 // set tag
1895 // 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 // check icon
1957 if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
1958 WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
1959 icon = "none";
1960 }
1961 // continue if flag is ok
1962 if (parsedOk) {
1963 // set tag
1965 // add attributes depending of Lane/Lanes
1966 if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1969 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1974 } else {
1977 }
1978 // add rest attributes
1989 } else {
1991 }
1992}
1993
1994
1995void
1997 // declare Ok Flag
1998 bool parsedOk = true;
1999 // needed attributes
2000 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2001 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2002 // optional attributes
2003 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2004 // continue if flag is ok
2005 if (parsedOk) {
2006 // set tag
2008 // add all attributes
2012 } else {
2014 }
2015}
2016
2017
2018void
2020 // declare Ok Flag
2021 bool parsedOk = true;
2022 // needed attributes
2023 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2024 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2025 // optional attributes
2026 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2027 // continue if flag is ok
2028 if (parsedOk) {
2029 // set tag
2031 // add all attributes
2035 } else {
2037 }
2038}
2039
2040
2041bool
2044 if (parentCalibrator == nullptr) {
2045 return false;
2046 }
2047 const auto parentRootFile = parentCalibrator->getParentSumoBaseObject();
2048 if (parentRootFile != nullptr) {
2049 return false;
2050 }
2051 if ((parentCalibrator->getTag() == SUMO_TAG_CALIBRATOR) || (parentCalibrator->getTag() == GNE_TAG_CALIBRATOR_LANE)) {
2052 return true;
2053 } else {
2054 return writeError(TLF("Calibrator Flows have to be defined within a %.", toString(SUMO_TAG_CALIBRATOR)));
2055 }
2056}
2057
2058
2059bool
2060AdditionalHandler::checkDetectPersons(const SumoXMLTag currentTag, const std::string& id, const std::string& detectPersons) {
2061 if (detectPersons.empty() || SUMOXMLDefinitions::PersonModeValues.hasString(detectPersons)) {
2062 return true;
2063 } else {
2064 writeError(TLF("Attribute '%' defined in % with id '%' doesn't have a valid value (given '%').", toString(SUMO_ATTR_DETECT_PERSONS), toString(currentTag), id, detectPersons));
2065 return false;
2066 }
2067}
2068
2069/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNING(msg)
Definition MsgHandler.h:286
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
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_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_ERROR
tag used for indicate that there is an error (usually loading elements in handlers)
@ 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
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
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 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
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.
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)
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)
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 double angle, const Parameterised::Map &parameters)=0
Builds a container stop.
void parseOverheadWire(const SUMOSAXAttributes &attrs)
parse overhead wire segment
void parseTractionSubstation(const SUMOSAXAttributes &attrs)
parse traction substation
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 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.
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.
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 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 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 double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI over lane using the given values.
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)
AdditionalHandler()=delete
invalidate default onstructor
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 double speed)=0
Builds a VariableSpeedSign Step.
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, 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 parseDestProbRerouteAttributes(const SUMOSAXAttributes &attrs)
parse dest prob reroute 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 double angle, const Parameterised::Map &parameters)=0
Builds a bus stop.
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 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, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)=0
Builds a POI using the given values.
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
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 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 double angle, const Parameterised::Map &parameters)=0
Builds a train stop.
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
The XML-Handler for network loading.
void checkParsedParent(const SumoXMLTag currentTag, const std::vector< SumoXMLTag > &parentTags, bool &ok)
check parsed parents
bool writeError(const std::string &error)
write error and enable error creating element
bool myAbortLoading
abort loading
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
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
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:323
A list of positions.
static const RGBColor INVISIBLE
Definition RGBColor.h:198
static const RGBColor RED
named colors
Definition RGBColor.h:188
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< ChargeType > ChargeTypes
charge type
static StringBijection< PersonMode > PersonModeValues
person modes
static StringBijection< POIIcon > POIIcons
POI icon values.
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:48
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:49
static const std::string DEFAULT_TYPE
Definition Shape.h:42
const std::string & getString(const T key) const
get string
bool hasString(const std::string &str) const
check if the given string exist