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,
334 obj->getParameters())) {
335 obj->markAsCreated();
336 }
337 break;
339 if (buildParkingArea(obj,
354 obj->getParameters())) {
355 obj->markAsCreated();
356 }
357 break;
359 if (buildParkingSpace(obj,
368 obj->getParameters())) {
369 obj->markAsCreated();
370 }
371 break;
372 // Detectors
375 // build E1
376 if (buildE1Detector(obj,
380 obj->getPeriodAttribute(),
387 obj->getParameters())) {
388 obj->markAsCreated();
389 }
390 break;
399 obj->getPeriodAttribute(),
411 obj->getParameters())) {
412 obj->markAsCreated();
413 }
414 } else {
420 obj->getPeriodAttribute(),
432 obj->getParameters())) {
433 obj->markAsCreated();
434 }
435 }
436 break;
439 if (buildDetectorE3(obj,
442 obj->getPeriodAttribute(),
452 obj->getParameters())) {
453 obj->markAsCreated();
454 }
455 break;
457 if (buildDetectorEntry(obj,
461 obj->getParameters())) {
462 obj->markAsCreated();
463 }
464 break;
466 if (buildDetectorExit(obj,
470 obj->getParameters())) {
471 obj->markAsCreated();
472 }
473 break;
485 obj->getParameters())) {
486 obj->markAsCreated();
487 }
488 break;
489 // TAZs
490 case SUMO_TAG_TAZ:
491 if (buildTAZ(obj,
499 obj->getParameters())) {
500 obj->markAsCreated();
501 }
502 break;
504 if (buildTAZSource(obj,
507 obj->markAsCreated();
508 }
509 break;
510 case SUMO_TAG_TAZSINK:
511 if (buildTAZSink(obj,
514 obj->markAsCreated();
515 }
516 break;
517 // Variable Speed Sign
518 case SUMO_TAG_VSS:
525 obj->getParameters())) {
526 obj->markAsCreated();
527 }
528 break;
529 case SUMO_TAG_STEP:
533 obj->markAsCreated();
534 }
535 break;
536 // Calibrator
538 if (buildEdgeCalibrator(obj,
544 obj->getPeriodAttribute(),
548 obj->getParameters())) {
549 obj->markAsCreated();
550 }
551 break;
553 if (buildLaneCalibrator(obj,
559 obj->getPeriodAttribute(),
563 obj->getParameters())) {
564 obj->markAsCreated();
565 }
566 break;
567 case SUMO_TAG_FLOW:
568 if (buildCalibratorFlow(obj,
569 obj->getVehicleParameter())) {
570 obj->markAsCreated();
571 }
572 break;
573 // Rerouter
575 if (buildRerouter(obj,
585 obj->getParameters())) {
586 obj->markAsCreated();
587 }
588 break;
594 obj->markAsCreated();
595 }
596 break;
598 if (buildClosingReroute(obj,
602 obj->markAsCreated();
603 }
604 break;
606 if (buildDestProbReroute(obj,
609 obj->markAsCreated();
610 }
611 break;
617 obj->markAsCreated();
618 }
619 break;
621 if (buildRouteProbReroute(obj,
624 obj->markAsCreated();
625 }
626 break;
628 // check if is aREROUTER interval
630 if (buildRerouterInterval(obj,
633 obj->markAsCreated();
634 }
635 }
636 break;
637 // Route probe
639 if (buildRouteProbe(obj,
642 obj->getPeriodAttribute(),
647 obj->getParameters())) {
648 obj->markAsCreated();
649 }
650 break;
651 // Vaporizer (deprecated)
653 if (buildVaporizer(obj,
658 obj->getParameters())) {
659 obj->markAsCreated();
660 }
661 break;
662 // wire elements
669 obj->getParameters())) {
670 obj->markAsCreated();
671 }
672 break;
674 if (buildOverheadWire(obj,
682 obj->getParameters())) {
683 obj->markAsCreated();
684 }
685 break;
693 obj->getParameters())) {
694 obj->markAsCreated();
695 }
696 break;
697 // Polygon
698 case SUMO_TAG_POLY:
699 if (buildPolygon(obj,
711 obj->getParameters())) {
712 obj->markAsCreated();
713 }
714 break;
715 // POI
716 case SUMO_TAG_POI:
717 // check if we want to create a POI, POILane or POIGEO
719 // build POI over view
720 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,
753 obj->getParameters())) {
754 obj->markAsCreated();
755 }
756 } else {
757 // build POIGEO over view
758 if (buildPOIGeo(obj,
771 obj->getParameters())) {
772 obj->markAsCreated();
773 }
774 }
775 break;
776 // Jps WalkableArea
778 if (buildJpsWalkableArea(obj,
783 obj->getParameters())) {
784 obj->markAsCreated();
785 }
786 break;
787 // Jps Obstacle
789 if (buildJpsObstacle(obj,
794 obj->getParameters())) {
795 obj->markAsCreated();
796 }
797 break;
798 default:
799 break;
800 }
801 // now iterate over childrens
802 for (const auto& child : obj->getSumoBaseObjectChildren()) {
803 // call this function recursively
804 parseSumoBaseObject(child);
805 }
806 }
807}
808
809
810void
812 // declare Ok Flag
813 bool parsedOk = true;
814 // needed attributes
815 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
816 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
817 // optional attributes
818 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
819 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
820 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
821 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
822 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
823 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
824 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
825 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
826 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
827 // continue if flag is ok
828 if (parsedOk) {
829 // set tag
831 // add all attributes
843 } else {
845 }
846}
847
848
849void
851 // declare Ok Flag
852 bool parsedOk = true;
853 // needed attributes
854 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
855 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
856 // optional attributes
857 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
858 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
859 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
860 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
861 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
862 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
863 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
864 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
865 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
866 // continue if flag is ok
867 if (parsedOk) {
868 // set tag
870 // add all attributes
882 } else {
884 }
885}
886
887
888void
890 // declare Ok Flag
891 bool parsedOk = true;
892 // needed attributes
893 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
894 const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
895 // optional attributes
896 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00, false); /* in future updates, INVALID_DOUBLE */
897 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
898 // check parent
900 // continue if flag is ok
901 if (parsedOk) {
902 // set tag
904 // add all attributes
909 } else {
911 }
912}
913
914
915void
917 // declare Ok Flag
918 bool parsedOk = true;
919 // needed attributes
920 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
921 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
922 // optional attributes
923 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
924 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
925 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
926 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
927 const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
928 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
929 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
930 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
931 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
932 // continue if flag is ok
933 if (parsedOk) {
934 // set tag
936 // add all attributes
948 } else {
950 }
951}
952
953
954void
956 // declare Ok Flag
957 bool parsedOk = true;
958 // needed attributes
959 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
960 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
961 // optional attributes
962 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
963 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
964 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
965 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
966 const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
967 const double totalPower = attrs.getOpt<double>(SUMO_ATTR_TOTALPOWER, id.c_str(), parsedOk, 0);
968 const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
969 const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
970 const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
971 const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, SUMOXMLDefinitions::ChargeTypes.getString(ChargeType::NORMAL));
972 const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
973 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
974 const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
975 // check charge type
976 if ((chargeType != "normal") && (chargeType != "battery-exchange") && (chargeType != "fuel")) {
977 writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
978 parsedOk = false;
979 }
980 // continue if flag is ok
981 if (parsedOk) {
982 // set tag
984 // add all attributes
1000 } else {
1002 }
1003}
1004
1005
1006void
1008 // declare Ok Flag
1009 bool parsedOk = true;
1010 // needed attributes
1011 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1012 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1013 // optional attributes
1014 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1015 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1016 const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
1017 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1018 const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
1019 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1020 const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
1021 const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
1022 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
1023 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1024 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
1025 const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
1026 // continue if flag is ok
1027 if (parsedOk) {
1028 // set tag
1030 // add all attributes
1045 } else {
1047 }
1048}
1049
1050
1051void
1053 // declare Ok Flag
1054 bool parsedOk = true;
1055 // needed attributes
1056 const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
1057 const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
1058 // optional attributes
1059 const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
1060 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
1061 const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
1062 const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
1063 const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
1064 const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
1065 // check parent
1067 // continue if flag is ok
1068 if (parsedOk) {
1069 // set tag
1071 // add all attributes
1080 } else {
1082 }
1083}
1084
1085
1086void
1088 // declare Ok Flag
1089 bool parsedOk = true;
1090 // needed attributes
1091 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1092 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1093 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1094 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1095 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1096 // optional attributes
1097 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1098 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1099 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1100 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1101 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1102 // continue if flag is ok
1103 if (parsedOk && checkDetectPersons(SUMO_TAG_E1DETECTOR, id, detectPersons)) {
1104 // set tag
1106 // add all attributes
1117 } else {
1119 }
1120}
1121
1122
1123void
1125 // declare Ok Flag
1126 bool parsedOk = true;
1127 const int positionDef = attrs.hasAttribute(SUMO_ATTR_POSITION) ? 1 : 0;
1128 const int endPosDef = attrs.hasAttribute(SUMO_ATTR_ENDPOS) ? 1 : 0;
1129 const int lengthDef = attrs.hasAttribute(SUMO_ATTR_LENGTH) ? 1 : 0;
1130 // check attributes
1131 if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) > 2)) {
1132 writeError(TL("'pos', 'endPos' and 'length' cannot be defined together in a single lane area detector."));
1134 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) < 2)) {
1135 writeError(TL("A single lane area detector requires two parameters of those 'pos', 'endPos' and 'length'."));
1137 } else {
1138 // needed attributes
1139 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1140 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1141 // special attributes
1142 const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1143 const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
1144 const double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1145 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
1146 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1147 // optional attributes
1148 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1149 const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
1150 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1151 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1152 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1153 const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
1154 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1155 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1156 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1157 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1158 const bool show = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), parsedOk, true);
1159 // continue if flag is ok
1160 if (parsedOk && checkDetectPersons(SUMO_TAG_E2DETECTOR, id, detectPersons)) {
1161 // set tag
1163 // add attributes depending of Lane/Lanes
1164 if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
1166 if (positionDef == 0) {
1169 } else if (endPosDef == 0) {
1172 } else if (lengthDef == 0) {
1175 }
1176 } else {
1180 }
1181 // add all attributes
1195 } else {
1197 }
1198 }
1199}
1200
1201
1202void
1204 // declare Ok Flag
1205 bool parsedOk = true;
1206 // needed attributes
1207 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1208 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1209 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1210 // optional attributes
1211 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1212 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1213 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1214 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1215 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1216 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1217 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1218 const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), parsedOk, false);
1219 const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
1220 // continue if flag is ok
1221 if (parsedOk && checkDetectPersons(SUMO_TAG_E3DETECTOR, id, detectPersons)) {
1222 // set tag
1224 // add all attributes
1237 } else {
1239 }
1240}
1241
1242
1243void
1245 // declare Ok Flag
1246 bool parsedOk = true;
1247 // needed attributes
1248 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1249 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1250 // optional attributes
1251 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1252 // check parent
1254 // continue if flag is ok
1255 if (parsedOk) {
1256 // set tag
1258 // add all attributes
1262 } else {
1264 }
1265}
1266
1267
1268void
1270 // declare Ok Flag
1271 bool parsedOk = true;
1272 // needed attributes
1273 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1274 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1275 // optional attributes
1276 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1277 // check parent
1279 // continue if flag is ok
1280 if (parsedOk) {
1281 // set tag
1283 // add all attributes
1287 } else {
1289 }
1290}
1291
1292
1293void
1295 // declare Ok Flag
1296 bool parsedOk = true;
1297 // needed attributes
1298 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1299 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1300 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1301 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1302 // optional attributes
1303 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1304 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1305 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1306 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1307 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1308 // continue if flag is ok
1309 if (parsedOk && checkDetectPersons(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, detectPersons)) {
1310 // set tag
1312 // add all attributes
1322 } else {
1324 }
1325}
1326
1327
1328void
1330 // declare Ok Flag
1331 bool parsedOk = true;
1332 // needed attributes
1333 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1334 // optional attributes
1335 const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1336 const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
1337 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1338 const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1339 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1340 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1341 // continue if flag is ok
1342 if (parsedOk) {
1343 // set tag
1345 // add all attributes
1353 } else {
1355 }
1356}
1357
1358
1359void
1361 // declare Ok Flag
1362 bool parsedOk = true;
1363 // needed attributes
1364 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1365 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1366 // check parent
1368 // continue if flag is ok
1369 if (parsedOk) {
1370 // set tag
1372 // add all attributes
1375 } else {
1377 }
1378}
1379
1380
1381void
1383 // declare Ok Flag
1384 bool parsedOk = true;
1385 // needed attributes
1386 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1387 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1388 // check parent
1390 // continue if flag is ok
1391 if (parsedOk) {
1392 // set tag
1394 // add all attributes
1397 } else {
1399 }
1400}
1401
1402
1403void
1405 // declare Ok Flag
1406 bool parsedOk = true;
1407 // needed attributes
1408 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1409 const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1410 // optional attributes
1411 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1412 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1413 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1414 // continue if flag is ok
1415 if (parsedOk) {
1416 // set tag
1418 // add all attributes
1424 } else {
1426 }
1427}
1428
1429
1430void
1432 // declare Ok Flag
1433 bool parsedOk = true;
1434 // needed attributes
1435 const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1436 // optional attributes
1437 const double speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, "", parsedOk, OptionsCont::getOptions().getFloat("default.speed"));
1438 // check parent
1440 // continue if flag is ok
1441 if (parsedOk) {
1442 // set tag
1444 // add all attributes
1447 } else {
1449 }
1450}
1451
1452
1453void
1455 // declare Ok Flag
1456 bool parsedOk = true;
1457 // check that frecuency and trafficLight aren't defined together
1458 if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1460 writeError(TL("Calibrators need either an edge or a lane"));
1461 parsedOk = false;
1462 }
1463 // needed attributes
1464 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1465 const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1466 // special attributes
1467 const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1468 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1469 // optional attributes
1470 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1471 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1472 const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1473 const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1474 const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1475 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1476 // continue if flag is ok
1477 if (parsedOk) {
1478 // set tag depending of edge/lane
1479 if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1482 } else {
1485 }
1494 } else {
1496 }
1497}
1498
1499
1500void
1502 // declare Ok Flag
1503 bool parsedOk = true;
1504 // check parent
1506 // check that frecuency and trafficLight aren't defined together
1508 writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
1510 } else {
1512 if (flowParameter) {
1513 // set VPH and speed
1515 flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1516 flowParameter->parametersSet |= VEHPARS_VPH_SET;
1517 }
1518 if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1519 flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1521 }
1522 // set begin and end
1523 flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1524 flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1525 if (parsedOk) {
1526 // set tag
1528 // set vehicle parameters
1530 // delete flow parameter (because in XMLStructure we have a copy)
1531 delete flowParameter;
1532 } else {
1534 }
1535 } else {
1537 }
1538 }
1539 } else {
1541 }
1542}
1543
1544
1545void
1547 // declare Ok Flag
1548 bool parsedOk = true;
1549 // needed attributes
1550 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1551 const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1552 // optional attributes
1553 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1554 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1555 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1556 SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1557 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1558 const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1559 const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
1560 // check attributes
1561 if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB, probability, true)) {
1562 parsedOk = false;
1563 }
1564 // continue if flag is ok
1565 if (parsedOk) {
1566 // set tag
1568 // add all attributes
1578 } else {
1580 }
1581}
1582
1583
1584void
1586 // declare Ok Flag
1587 bool parsedOk = true;
1588 // needed attributes
1589 const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1590 const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1591 // check parent
1593 // continue if flag is ok
1594 if (parsedOk) {
1595 // set tag
1597 // add all attributes
1600 } else {
1602 }
1603}
1604
1605
1606void
1608 // declare Ok Flag
1609 bool parsedOk = true;
1610 // needed attributes
1611 const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1612 // optional attributes
1613 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1614 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1615 // check parent
1617 // continue if flag is ok
1618 if (parsedOk) {
1619 // set tag
1621 // add all attributes
1625 } else {
1627 }
1628}
1629
1630
1631void
1633 // declare Ok Flag
1634 bool parsedOk = true;
1635 // needed attributes
1636 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1637 // optional attributes
1638 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1639 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, "");
1640 // check parent
1642 // continue if flag is ok
1643 if (parsedOk) {
1644 // set tag
1646 // add all attributes
1650 } else {
1652 }
1653}
1654
1655
1656void
1658 // declare Ok Flag
1659 bool parsedOk = true;
1660 // needed attributes
1661 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1662 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1663 // check attributes
1664 if (!checkNegative(SUMO_TAG_DEST_PROB_REROUTE, edgeID, SUMO_ATTR_PROB, probability, true)) {
1665 parsedOk = false;
1666 }
1667 // check parent
1669 // continue if flag is ok
1670 if (parsedOk) {
1671 // set tag
1673 // add all attributes
1676 } else {
1678 }
1679}
1680
1681
1682void
1684 // declare Ok Flag
1685 bool parsedOk = true;
1686 // needed attributes
1687 const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1688 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1689 // check attributes
1690 if (!checkNegative(SUMO_TAG_PARKING_AREA_REROUTE, parkingAreaID, SUMO_ATTR_PROB, probability, true)) {
1691 parsedOk = false;
1692 }
1693 // optional attributes
1694 const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1695 // check parent
1697 // continue if flag is ok
1698 if (parsedOk) {
1699 // set tag
1701 // add all attributes
1705 } else {
1707 }
1708}
1709
1710
1711void
1713 // declare Ok Flag
1714 bool parsedOk = true;
1715 // needed attributes
1716 const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1717 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1718 // check attributes
1719 if (!checkNegative(SUMO_TAG_ROUTE_PROB_REROUTE, routeID, SUMO_ATTR_PROB, probability, true)) {
1720 parsedOk = false;
1721 }
1722 // check parent
1724 // continue if flag is ok
1725 if (parsedOk) {
1726 // set tag
1728 // add all attributes
1731 } else {
1733 }
1734}
1735
1736
1737void
1739 // declare Ok Flag
1740 bool parsedOk = true;
1741 // needed attributes
1742 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1743 const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1744 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1745 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1746 const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1747 // optional attributes
1748 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1749 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1750 // continue if flag is ok
1751 if (parsedOk) {
1752 // set tag
1754 // add all attributes
1762 } else {
1764 }
1765}
1766
1767
1768void
1770 // declare Ok Flag
1771 bool parsedOk = true;
1772 // needed attributes
1773 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1774 SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1775 SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1776 // optional attributes
1777 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1778 // continue if flag is ok
1779 if (parsedOk) {
1780 // set tag
1782 // add all attributes
1787 } else {
1789 }
1790}
1791
1792
1793void
1795 // declare Ok Flag
1796 bool parsedOk = true;
1797 // needed attributes
1798 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1799 // optional attributes
1800 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1801 const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1802 const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1803 // continue if flag is ok
1804 if (parsedOk) {
1805 // set tag
1807 // add all attributes
1812 } else {
1814 }
1815}
1816
1817
1818void
1820 // declare Ok Flag
1821 bool parsedOk = true;
1822 // needed attributes
1823 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1824 const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1825 const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1826 // optional attributes
1827 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1828 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1829 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1830 const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1831 // continue if flag is ok
1832 if (parsedOk) {
1833 // set tag
1835 // add all attributes
1843 } else {
1845 }
1846}
1847
1848
1849void
1851 // declare Ok Flag
1852 bool parsedOk = true;
1853 // needed attributes
1854 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1855 const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1856 const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1857 const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1858 const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1859 const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1860 // continue if flag is ok
1861 if (parsedOk) {
1862 // set tag
1864 // add all attributes
1871 } else {
1873 }
1874}
1875
1876
1877void
1879 // declare Ok Flag
1880 bool parsedOk = true;
1881 // needed attributes
1882 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1883 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1884 // optional attributes
1885 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1886 const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1887 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1888 const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1889 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1890 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1891 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1892 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1893 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1894 // continue if flag is ok
1895 if (parsedOk) {
1896 // set tag
1898 // add all attributes
1910 } else {
1912 }
1913}
1914
1915
1916void
1918 // declare Ok Flag
1919 bool parsedOk = true;
1920 // check that x and y are defined together
1921 if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1922 (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1923 writeError(TL("X and Y must be be defined together in POIs"));
1924 parsedOk = false;
1925 }
1926 // check that lane and pos are defined together
1929 writeError(TL("lane and position must be defined together in POIs"));
1930 parsedOk = false;
1931 }
1932 // check that lon and lat are defined together
1933 if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1935 writeError(TL("lon and lat must be be defined together in POIs"));
1936 parsedOk = false;
1937 }
1938 // needed attributes
1939 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1940 // special attributes
1941 const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1942 const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1943 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1944 const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1945 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1946 const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1947 const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1948 const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1949 // optional attributes
1950 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1951 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1952 std::string icon = attrs.getOpt<std::string>(SUMO_ATTR_ICON, "", parsedOk, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE));
1953 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1954 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1955 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1956 const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1957 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1958 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1959 // check icon
1960 if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
1961 WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
1962 icon = "none";
1963 }
1964 // continue if flag is ok
1965 if (parsedOk) {
1966 // set tag
1968 // add attributes depending of Lane/Lanes
1969 if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1972 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1977 } else {
1980 }
1981 // add rest attributes
1992 } else {
1994 }
1995}
1996
1997
1998void
2000 // declare Ok Flag
2001 bool parsedOk = true;
2002 // needed attributes
2003 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2004 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2005 // optional attributes
2006 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2007 // continue if flag is ok
2008 if (parsedOk) {
2009 // set tag
2011 // add all attributes
2015 } else {
2017 }
2018}
2019
2020
2021void
2023 // declare Ok Flag
2024 bool parsedOk = true;
2025 // needed attributes
2026 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2027 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2028 // optional attributes
2029 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2030 // continue if flag is ok
2031 if (parsedOk) {
2032 // set tag
2034 // add all attributes
2038 } else {
2040 }
2041}
2042
2043
2044bool
2047 if (parentCalibrator == nullptr) {
2048 return false;
2049 }
2050 const auto parentRootFile = parentCalibrator->getParentSumoBaseObject();
2051 if (parentRootFile != nullptr) {
2052 return false;
2053 }
2054 if ((parentCalibrator->getTag() == SUMO_TAG_CALIBRATOR) || (parentCalibrator->getTag() == GNE_TAG_CALIBRATOR_LANE)) {
2055 return true;
2056 } else {
2057 return writeError(TLF("Calibrator Flows have to be defined within a %.", toString(SUMO_TAG_CALIBRATOR)));
2058 }
2059}
2060
2061
2062bool
2063AdditionalHandler::checkDetectPersons(const SumoXMLTag currentTag, const std::string& id, const std::string& detectPersons) {
2064 if (detectPersons.empty() || SUMOXMLDefinitions::PersonModeValues.hasString(detectPersons)) {
2065 return true;
2066 } else {
2067 writeError(TLF("Attribute '%' defined in % with id '%' doesn't have a valid value (given '%').", toString(SUMO_ATTR_DETECT_PERSONS), toString(currentTag), id, detectPersons));
2068 return false;
2069 }
2070}
2071
2072/****************************************************************************/
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_TOTALPOWER
total charge in W/s of the Charging Stations
@ 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.
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 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 totalPower, 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 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