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-2026 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
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,
712 obj->getParameters())) {
713 obj->markAsCreated();
714 }
715 break;
716 // POI
717 case SUMO_TAG_POI:
718 // check if we want to create a POI, POILane or POIGEO
720 // build POI over view
721 if (buildPOI(obj,
734 obj->getParameters())) {
735 obj->markAsCreated();
736 }
737 } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
738 // build POI over Lane
739 if (buildPOILane(obj,
754 obj->getParameters())) {
755 obj->markAsCreated();
756 }
757 } else {
758 // build POIGEO over view
759 if (buildPOIGeo(obj,
772 obj->getParameters())) {
773 obj->markAsCreated();
774 }
775 }
776 break;
777 // Jps WalkableArea
779 if (buildJpsWalkableArea(obj,
784 obj->getParameters())) {
785 obj->markAsCreated();
786 }
787 break;
788 // Jps Obstacle
790 if (buildJpsObstacle(obj,
795 obj->getParameters())) {
796 obj->markAsCreated();
797 }
798 break;
799 default:
800 break;
801 }
802 // now iterate over childrens
803 for (const auto& child : obj->getSumoBaseObjectChildren()) {
804 // call this function recursively
805 parseSumoBaseObject(child);
806 }
807 }
808}
809
810
811void
813 // declare Ok Flag
814 bool parsedOk = true;
815 // needed attributes
816 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
817 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
818 // optional attributes
819 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
820 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
821 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
822 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
823 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
824 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
825 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
826 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
827 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
828 // continue if flag is ok
829 if (parsedOk) {
830 // set tag
832 // add all attributes
844 } else {
846 }
847}
848
849
850void
852 // declare Ok Flag
853 bool parsedOk = true;
854 // needed attributes
855 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
856 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
857 // optional attributes
858 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
859 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
860 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
861 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
862 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
863 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
864 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
865 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
866 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
867 // continue if flag is ok
868 if (parsedOk) {
869 // set tag
871 // add all attributes
883 } else {
885 }
886}
887
888
889void
891 // declare Ok Flag
892 bool parsedOk = true;
893 // needed attributes
894 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
895 const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
896 // optional attributes
897 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00, false); /* in future updates, INVALID_DOUBLE */
898 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
899 // check parent
901 // continue if flag is ok
902 if (parsedOk) {
903 // set tag
905 // add all attributes
910 } else {
912 }
913}
914
915
916void
918 // declare Ok Flag
919 bool parsedOk = true;
920 // needed attributes
921 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
922 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
923 // optional attributes
924 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
925 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
926 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
927 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
928 const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
929 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
930 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
931 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
932 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
933 // continue if flag is ok
934 if (parsedOk) {
935 // set tag
937 // add all attributes
949 } else {
951 }
952}
953
954
955void
957 // declare Ok Flag
958 bool parsedOk = true;
959 // needed attributes
960 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
961 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
962 // optional attributes
963 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
964 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
965 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
966 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
967 const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
968 const double totalPower = attrs.getOpt<double>(SUMO_ATTR_TOTALPOWER, id.c_str(), parsedOk, 0);
969 const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
970 const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
971 const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
972 const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, SUMOXMLDefinitions::ChargeTypes.getString(ChargeType::NORMAL));
973 const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
974 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
975 const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
976 // check charge type
977 if ((chargeType != "normal") && (chargeType != "battery-exchange") && (chargeType != "fuel")) {
978 writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
979 parsedOk = false;
980 }
981 // continue if flag is ok
982 if (parsedOk) {
983 // set tag
985 // add all attributes
1001 } else {
1003 }
1004}
1005
1006
1007void
1009 // declare Ok Flag
1010 bool parsedOk = true;
1011 // needed attributes
1012 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1013 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1014 // optional attributes
1015 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1016 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1017 const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
1018 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1019 const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
1020 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1021 const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
1022 const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
1023 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
1024 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1025 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
1026 const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
1027 // continue if flag is ok
1028 if (parsedOk) {
1029 // set tag
1031 // add all attributes
1046 } else {
1048 }
1049}
1050
1051
1052void
1054 // declare Ok Flag
1055 bool parsedOk = true;
1056 // needed attributes
1057 const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
1058 const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
1059 // optional attributes
1060 const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
1061 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
1062 const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
1063 const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
1064 const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
1065 const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
1066 // check parent
1068 // continue if flag is ok
1069 if (parsedOk) {
1070 // set tag
1072 // add all attributes
1081 } else {
1083 }
1084}
1085
1086
1087void
1089 // declare Ok Flag
1090 bool parsedOk = true;
1091 // needed attributes
1092 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1093 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1094 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1095 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1096 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1097 // optional attributes
1098 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1099 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1100 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1101 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1102 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1103 // continue if flag is ok
1104 if (parsedOk && checkDetectPersons(SUMO_TAG_E1DETECTOR, id, detectPersons)) {
1105 // set tag
1107 // add all attributes
1118 } else {
1120 }
1121}
1122
1123
1124void
1126 // declare Ok Flag
1127 bool parsedOk = true;
1128 const int positionDef = attrs.hasAttribute(SUMO_ATTR_POSITION) ? 1 : 0;
1129 const int endPosDef = attrs.hasAttribute(SUMO_ATTR_ENDPOS) ? 1 : 0;
1130 const int lengthDef = attrs.hasAttribute(SUMO_ATTR_LENGTH) ? 1 : 0;
1131 // check attributes
1132 if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) > 2)) {
1133 writeError(TL("'pos', 'endPos' and 'length' cannot be defined together in a single lane area detector."));
1135 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) < 2)) {
1136 writeError(TL("A single lane area detector requires two parameters of those 'pos', 'endPos' and 'length'."));
1138 } else {
1139 // needed attributes
1140 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1141 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1142 // special attributes
1143 const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1144 const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
1145 const double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1146 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
1147 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1148 // optional attributes
1149 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1150 const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
1151 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1152 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1153 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1154 const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
1155 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1156 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1157 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1158 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1159 const bool show = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), parsedOk, true);
1160 // continue if flag is ok
1161 if (parsedOk && checkDetectPersons(SUMO_TAG_E2DETECTOR, id, detectPersons)) {
1162 // set tag
1164 // add attributes depending of Lane/Lanes
1165 if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
1167 if (positionDef == 0) {
1170 } else if (endPosDef == 0) {
1173 } else if (lengthDef == 0) {
1176 }
1177 } else {
1181 }
1182 // add all attributes
1196 } else {
1198 }
1199 }
1200}
1201
1202
1203void
1205 // declare Ok Flag
1206 bool parsedOk = true;
1207 // needed attributes
1208 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1209 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1210 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1211 // optional attributes
1212 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1213 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1214 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1215 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1216 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1217 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1218 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1219 const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), parsedOk, false);
1220 const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
1221 // continue if flag is ok
1222 if (parsedOk && checkDetectPersons(SUMO_TAG_E3DETECTOR, id, detectPersons)) {
1223 // set tag
1225 // add all attributes
1238 } else {
1240 }
1241}
1242
1243
1244void
1246 // declare Ok Flag
1247 bool parsedOk = true;
1248 // needed attributes
1249 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1250 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1251 // optional attributes
1252 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1253 // check parent
1255 // continue if flag is ok
1256 if (parsedOk) {
1257 // set tag
1259 // add all attributes
1263 } else {
1265 }
1266}
1267
1268
1269void
1271 // declare Ok Flag
1272 bool parsedOk = true;
1273 // needed attributes
1274 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1275 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1276 // optional attributes
1277 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1278 // check parent
1280 // continue if flag is ok
1281 if (parsedOk) {
1282 // set tag
1284 // add all attributes
1288 } else {
1290 }
1291}
1292
1293
1294void
1296 // declare Ok Flag
1297 bool parsedOk = true;
1298 // needed attributes
1299 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1300 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1301 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1302 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1303 // optional attributes
1304 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1305 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1306 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1307 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1308 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1309 // continue if flag is ok
1310 if (parsedOk && checkDetectPersons(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, detectPersons)) {
1311 // set tag
1313 // add all attributes
1323 } else {
1325 }
1326}
1327
1328
1329void
1331 // declare Ok Flag
1332 bool parsedOk = true;
1333 // needed attributes
1334 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1335 // optional attributes
1336 const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1337 const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
1338 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1339 const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1340 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1341 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1342 // continue if flag is ok
1343 if (parsedOk) {
1344 // set tag
1346 // add all attributes
1354 } else {
1356 }
1357}
1358
1359
1360void
1362 // declare Ok Flag
1363 bool parsedOk = true;
1364 // needed attributes
1365 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1366 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1367 // check parent
1369 // continue if flag is ok
1370 if (parsedOk) {
1371 // set tag
1373 // add all attributes
1376 } else {
1378 }
1379}
1380
1381
1382void
1384 // declare Ok Flag
1385 bool parsedOk = true;
1386 // needed attributes
1387 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1388 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1389 // check parent
1391 // continue if flag is ok
1392 if (parsedOk) {
1393 // set tag
1395 // add all attributes
1398 } else {
1400 }
1401}
1402
1403
1404void
1406 // declare Ok Flag
1407 bool parsedOk = true;
1408 // needed attributes
1409 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1410 const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1411 // optional attributes
1412 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1413 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1414 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1415 // continue if flag is ok
1416 if (parsedOk) {
1417 // set tag
1419 // add all attributes
1425 } else {
1427 }
1428}
1429
1430
1431void
1433 // declare Ok Flag
1434 bool parsedOk = true;
1435 // needed attributes
1436 const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1437 // optional attributes
1438 const double speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, "", parsedOk, OptionsCont::getOptions().getFloat("default.speed"));
1439 // check parent
1441 // continue if flag is ok
1442 if (parsedOk) {
1443 // set tag
1445 // add all attributes
1448 } else {
1450 }
1451}
1452
1453
1454void
1456 // declare Ok Flag
1457 bool parsedOk = true;
1458 // check that frecuency and trafficLight aren't defined together
1459 if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1461 writeError(TL("Calibrators need either an edge or a lane"));
1462 parsedOk = false;
1463 }
1464 // needed attributes
1465 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1466 const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1467 // special attributes
1468 const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1469 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1470 // optional attributes
1471 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1472 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1473 const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1474 const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1475 const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1476 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1477 // continue if flag is ok
1478 if (parsedOk) {
1479 // set tag depending of edge/lane
1480 if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1483 } else {
1486 }
1495 } else {
1497 }
1498}
1499
1500
1501void
1503 // declare Ok Flag
1504 bool parsedOk = true;
1505 // check parent
1507 // check that frecuency and trafficLight aren't defined together
1509 writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
1511 } else {
1513 if (flowParameter) {
1514 // set VPH and speed
1516 flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1517 flowParameter->parametersSet |= VEHPARS_VPH_SET;
1518 }
1519 if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1520 flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1522 }
1523 // set begin and end
1524 flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1525 flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1526 if (parsedOk) {
1527 // set tag
1529 // set vehicle parameters
1531 // delete flow parameter (because in XMLStructure we have a copy)
1532 delete flowParameter;
1533 } else {
1535 }
1536 } else {
1538 }
1539 }
1540 } else {
1542 }
1543}
1544
1545
1546void
1548 // declare Ok Flag
1549 bool parsedOk = true;
1550 // needed attributes
1551 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1552 const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1553 // optional attributes
1554 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1555 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1556 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1557 SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1558 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1559 const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1560 const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
1561 // check attributes
1562 if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB, probability, true)) {
1563 parsedOk = false;
1564 }
1565 // continue if flag is ok
1566 if (parsedOk) {
1567 // set tag
1569 // add all attributes
1579 } else {
1581 }
1582}
1583
1584
1585void
1587 // declare Ok Flag
1588 bool parsedOk = true;
1589 // needed attributes
1590 const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1591 const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1592 // check parent
1594 // continue if flag is ok
1595 if (parsedOk) {
1596 // set tag
1598 // add all attributes
1601 } else {
1603 }
1604}
1605
1606
1607void
1609 // declare Ok Flag
1610 bool parsedOk = true;
1611 // needed attributes
1612 const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1613 // optional attributes
1614 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1615 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1616 // check parent
1618 // continue if flag is ok
1619 if (parsedOk) {
1620 // set tag
1622 // add all attributes
1626 } else {
1628 }
1629}
1630
1631
1632void
1634 // declare Ok Flag
1635 bool parsedOk = true;
1636 // needed attributes
1637 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1638 // optional attributes
1639 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1640 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, "");
1641 // check parent
1643 // continue if flag is ok
1644 if (parsedOk) {
1645 // set tag
1647 // add all attributes
1651 } else {
1653 }
1654}
1655
1656
1657void
1659 // declare Ok Flag
1660 bool parsedOk = true;
1661 // needed attributes
1662 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1663 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1664 // check attributes
1665 if (!checkNegative(SUMO_TAG_DEST_PROB_REROUTE, edgeID, SUMO_ATTR_PROB, probability, true)) {
1666 parsedOk = false;
1667 }
1668 // check parent
1670 // continue if flag is ok
1671 if (parsedOk) {
1672 // set tag
1674 // add all attributes
1677 } else {
1679 }
1680}
1681
1682
1683void
1685 // declare Ok Flag
1686 bool parsedOk = true;
1687 // needed attributes
1688 const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1689 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1690 // check attributes
1691 if (!checkNegative(SUMO_TAG_PARKING_AREA_REROUTE, parkingAreaID, SUMO_ATTR_PROB, probability, true)) {
1692 parsedOk = false;
1693 }
1694 // optional attributes
1695 const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1696 // check parent
1698 // continue if flag is ok
1699 if (parsedOk) {
1700 // set tag
1702 // add all attributes
1706 } else {
1708 }
1709}
1710
1711
1712void
1714 // declare Ok Flag
1715 bool parsedOk = true;
1716 // needed attributes
1717 const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1718 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1719 // check attributes
1720 if (!checkNegative(SUMO_TAG_ROUTE_PROB_REROUTE, routeID, SUMO_ATTR_PROB, probability, true)) {
1721 parsedOk = false;
1722 }
1723 // check parent
1725 // continue if flag is ok
1726 if (parsedOk) {
1727 // set tag
1729 // add all attributes
1732 } else {
1734 }
1735}
1736
1737
1738void
1740 // declare Ok Flag
1741 bool parsedOk = true;
1742 // needed attributes
1743 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1744 const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1745 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1746 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1747 const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1748 // optional attributes
1749 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1750 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1751 // continue if flag is ok
1752 if (parsedOk) {
1753 // set tag
1755 // add all attributes
1763 } else {
1765 }
1766}
1767
1768
1769void
1771 // declare Ok Flag
1772 bool parsedOk = true;
1773 // needed attributes
1774 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1775 SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1776 SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1777 // optional attributes
1778 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1779 // continue if flag is ok
1780 if (parsedOk) {
1781 // set tag
1783 // add all attributes
1788 } else {
1790 }
1791}
1792
1793
1794void
1796 // declare Ok Flag
1797 bool parsedOk = true;
1798 // needed attributes
1799 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1800 // optional attributes
1801 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1802 const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1803 const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1804 // continue if flag is ok
1805 if (parsedOk) {
1806 // set tag
1808 // add all attributes
1813 } else {
1815 }
1816}
1817
1818
1819void
1821 // declare Ok Flag
1822 bool parsedOk = true;
1823 // needed attributes
1824 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1825 const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1826 const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1827 // optional attributes
1828 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1829 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1830 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1831 const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1832 // continue if flag is ok
1833 if (parsedOk) {
1834 // set tag
1836 // add all attributes
1844 } else {
1846 }
1847}
1848
1849
1850void
1852 // declare Ok Flag
1853 bool parsedOk = true;
1854 // needed attributes
1855 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1856 const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1857 const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1858 const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1859 const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1860 const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1861 // continue if flag is ok
1862 if (parsedOk) {
1863 // set tag
1865 // add all attributes
1872 } else {
1874 }
1875}
1876
1877
1878void
1880 // declare Ok Flag
1881 bool parsedOk = true;
1882 // needed attributes
1883 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1884 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1885 // optional attributes
1886 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1887 const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1888 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1889 const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1890 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1891 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1892 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1893 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1894 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, Shape::DEFAULT_NAME);
1895 const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_HEIGHT);
1896 // continue if flag is ok
1897 if (parsedOk) {
1898 // set tag
1900 // add all attributes
1913 } else {
1915 }
1916}
1917
1918
1919void
1921 // declare Ok Flag
1922 bool parsedOk = true;
1923 // check that x and y are defined together
1924 if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1925 (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1926 writeError(TL("X and Y must be be defined together in POIs"));
1927 parsedOk = false;
1928 }
1929 // check that lane and pos are defined together
1932 writeError(TL("lane and position must be defined together in POIs"));
1933 parsedOk = false;
1934 }
1935 // check that lon and lat are defined together
1936 if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1938 writeError(TL("lon and lat must be be defined together in POIs"));
1939 parsedOk = false;
1940 }
1941 // needed attributes
1942 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1943 // special attributes
1944 const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1945 const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1946 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1947 const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1948 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1949 const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1950 const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1951 const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1952 // optional attributes
1953 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1954 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1955 std::string icon = attrs.getOpt<std::string>(SUMO_ATTR_ICON, "", parsedOk, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE));
1956 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1957 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1958 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1959 const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1960 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1961 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, Shape::DEFAULT_NAME);
1962 // check icon
1963 if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
1964 WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
1965 icon = "none";
1966 }
1967 // continue if flag is ok
1968 if (parsedOk) {
1969 // set tag
1971 // add attributes depending of Lane/Lanes
1972 if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1975 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1980 } else {
1983 }
1984 // add rest attributes
1995 } else {
1997 }
1998}
1999
2000
2001void
2003 // declare Ok Flag
2004 bool parsedOk = true;
2005 // needed attributes
2006 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2007 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2008 // optional attributes
2009 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2010 // continue if flag is ok
2011 if (parsedOk) {
2012 // set tag
2014 // add all attributes
2018 } else {
2020 }
2021}
2022
2023
2024void
2026 // declare Ok Flag
2027 bool parsedOk = true;
2028 // needed attributes
2029 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2030 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2031 // optional attributes
2032 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2033 // continue if flag is ok
2034 if (parsedOk) {
2035 // set tag
2037 // add all attributes
2041 } else {
2043 }
2044}
2045
2046
2047bool
2050 if (parentCalibrator == nullptr) {
2051 return false;
2052 }
2053 const auto parentRootFile = parentCalibrator->getParentSumoBaseObject();
2054 if (parentRootFile != nullptr) {
2055 return false;
2056 }
2057 if ((parentCalibrator->getTag() == SUMO_TAG_CALIBRATOR) || (parentCalibrator->getTag() == GNE_TAG_CALIBRATOR_LANE)) {
2058 return true;
2059 } else {
2060 return writeError(TLF("Calibrator Flows have to be defined within a %.", toString(SUMO_TAG_CALIBRATOR)));
2061 }
2062}
2063
2064
2065bool
2066AdditionalHandler::checkDetectPersons(const SumoXMLTag currentTag, const std::string& id, const std::string& detectPersons) {
2067 if (detectPersons.empty() || SUMOXMLDefinitions::PersonModeValues.hasString(detectPersons)) {
2068 return true;
2069 } else {
2070 writeError(TLF("Attribute '%' defined in % with id '%' doesn't have a valid value (given '%').", toString(SUMO_ATTR_DETECT_PERSONS), toString(currentTag), id, detectPersons));
2071 return false;
2072 }
2073}
2074
2075/****************************************************************************/
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:60
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:49
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
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 double height, const Parameterised::Map &parameters)=0
Builds a polygon using the given values.
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
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
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:208
static const RGBColor RED
named colors
Definition RGBColor.h:198
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_HEIGHT
Definition Shape.h:50
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 std::string DEFAULT_NAME
Definition Shape.h:51
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