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,
269 obj->getParameters())) {
270 obj->markAsCreated();
271 }
272 break;
274 if (buildTrainStop(obj,
285 obj->getParameters())) {
286 obj->markAsCreated();
287 }
288 break;
289 case SUMO_TAG_ACCESS:
290 if (buildAccess(obj,
295 obj->getParameters())) {
296 obj->markAsCreated();
297 }
298 break;
300 if (buildContainerStop(obj,
311 obj->getParameters())) {
312 obj->markAsCreated();
313 }
314 break;
316 if (buildChargingStation(obj,
330 obj->getParameters())) {
331 obj->markAsCreated();
332 }
333 break;
335 if (buildParkingArea(obj,
350 obj->getParameters())) {
351 obj->markAsCreated();
352 }
353 break;
355 if (buildParkingSpace(obj,
364 obj->getParameters())) {
365 obj->markAsCreated();
366 }
367 break;
368 // Detectors
371 // build E1
372 if (buildE1Detector(obj,
376 obj->getPeriodAttribute(),
383 obj->getParameters())) {
384 obj->markAsCreated();
385 }
386 break;
395 obj->getPeriodAttribute(),
407 obj->getParameters())) {
408 obj->markAsCreated();
409 }
410 } else {
416 obj->getPeriodAttribute(),
428 obj->getParameters())) {
429 obj->markAsCreated();
430 }
431 }
432 break;
435 if (buildDetectorE3(obj,
438 obj->getPeriodAttribute(),
448 obj->getParameters())) {
449 obj->markAsCreated();
450 }
451 break;
453 if (buildDetectorEntry(obj,
457 obj->getParameters())) {
458 obj->markAsCreated();
459 }
460 break;
462 if (buildDetectorExit(obj,
466 obj->getParameters())) {
467 obj->markAsCreated();
468 }
469 break;
481 obj->getParameters())) {
482 obj->markAsCreated();
483 }
484 break;
485 // TAZs
486 case SUMO_TAG_TAZ:
487 if (buildTAZ(obj,
495 obj->getParameters())) {
496 obj->markAsCreated();
497 }
498 break;
500 if (buildTAZSource(obj,
503 obj->markAsCreated();
504 }
505 break;
506 case SUMO_TAG_TAZSINK:
507 if (buildTAZSink(obj,
510 obj->markAsCreated();
511 }
512 break;
513 // Variable Speed Sign
514 case SUMO_TAG_VSS:
521 obj->getParameters())) {
522 obj->markAsCreated();
523 }
524 break;
525 case SUMO_TAG_STEP:
529 obj->markAsCreated();
530 }
531 break;
532 // Calibrator
534 if (buildEdgeCalibrator(obj,
540 obj->getPeriodAttribute(),
544 obj->getParameters())) {
545 obj->markAsCreated();
546 }
547 break;
549 if (buildLaneCalibrator(obj,
555 obj->getPeriodAttribute(),
559 obj->getParameters())) {
560 obj->markAsCreated();
561 }
562 break;
563 case SUMO_TAG_FLOW:
564 if (buildCalibratorFlow(obj,
565 obj->getVehicleParameter())) {
566 obj->markAsCreated();
567 }
568 break;
569 // Rerouter
571 if (buildRerouter(obj,
581 obj->getParameters())) {
582 obj->markAsCreated();
583 }
584 break;
590 obj->markAsCreated();
591 }
592 break;
594 if (buildClosingReroute(obj,
598 obj->markAsCreated();
599 }
600 break;
602 if (buildDestProbReroute(obj,
605 obj->markAsCreated();
606 }
607 break;
613 obj->markAsCreated();
614 }
615 break;
617 if (buildRouteProbReroute(obj,
620 obj->markAsCreated();
621 }
622 break;
624 // check if is aREROUTER interval
626 if (buildRerouterInterval(obj,
629 obj->markAsCreated();
630 }
631 }
632 break;
633 // Route probe
635 if (buildRouteProbe(obj,
638 obj->getPeriodAttribute(),
643 obj->getParameters())) {
644 obj->markAsCreated();
645 }
646 break;
647 // Vaporizer (deprecated)
649 if (buildVaporizer(obj,
654 obj->getParameters())) {
655 obj->markAsCreated();
656 }
657 break;
658 // wire elements
665 obj->getParameters())) {
666 obj->markAsCreated();
667 }
668 break;
670 if (buildOverheadWire(obj,
678 obj->getParameters())) {
679 obj->markAsCreated();
680 }
681 break;
689 obj->getParameters())) {
690 obj->markAsCreated();
691 }
692 break;
693 // Polygon
694 case SUMO_TAG_POLY:
695 if (buildPolygon(obj,
707 obj->getParameters())) {
708 obj->markAsCreated();
709 }
710 break;
711 // POI
712 case SUMO_TAG_POI:
713 // check if we want to create a POI, POILane or POIGEO
715 // build POI over view
716 if (buildPOI(obj,
729 obj->getParameters())) {
730 obj->markAsCreated();
731 }
732 } else if (obj->hasStringAttribute(SUMO_ATTR_LANE)) {
733 // build POI over Lane
734 if (buildPOILane(obj,
749 obj->getParameters())) {
750 obj->markAsCreated();
751 }
752 } else {
753 // build POIGEO over view
754 if (buildPOIGeo(obj,
767 obj->getParameters())) {
768 obj->markAsCreated();
769 }
770 }
771 break;
772 // Jps WalkableArea
774 if (buildJpsWalkableArea(obj,
779 obj->getParameters())) {
780 obj->markAsCreated();
781 }
782 break;
783 // Jps Obstacle
785 if (buildJpsObstacle(obj,
790 obj->getParameters())) {
791 obj->markAsCreated();
792 }
793 break;
794 default:
795 break;
796 }
797 // now iterate over childrens
798 for (const auto& child : obj->getSumoBaseObjectChildren()) {
799 // call this function recursively
800 parseSumoBaseObject(child);
801 }
802 }
803}
804
805
806void
808 // declare Ok Flag
809 bool parsedOk = true;
810 // needed attributes
811 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
812 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
813 // optional attributes
814 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
815 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
816 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
817 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
818 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
819 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
820 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
821 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
822 // continue if flag is ok
823 if (parsedOk) {
824 // set tag
826 // add all attributes
837 } else {
839 }
840}
841
842
843void
845 // declare Ok Flag
846 bool parsedOk = true;
847 // needed attributes
848 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
849 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
850 // optional attributes
851 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
852 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
853 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
854 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
855 const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), parsedOk, 6);
856 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
857 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
858 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
859 // continue if flag is ok
860 if (parsedOk) {
861 // set tag
863 // add all attributes
874 } else {
876 }
877}
878
879
880void
882 // declare Ok Flag
883 bool parsedOk = true;
884 // needed attributes
885 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
886 const std::string position = attrs.get<std::string>(SUMO_ATTR_POSITION, "", parsedOk);
887 // optional attributes
888 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", parsedOk, -1.00, false); /* in future updates, INVALID_DOUBLE */
889 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
890 // check parent
892 // continue if flag is ok
893 if (parsedOk) {
894 // set tag
896 // add all attributes
901 } else {
903 }
904}
905
906
907void
909 // declare Ok Flag
910 bool parsedOk = true;
911 // needed attributes
912 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
913 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
914 // optional attributes
915 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
916 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
917 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
918 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
919 const int containerCapacity = attrs.getOpt<int>(SUMO_ATTR_CONTAINER_CAPACITY, id.c_str(), parsedOk, 6);
920 const double parkingLength = attrs.getOpt<double>(SUMO_ATTR_PARKING_LENGTH, id.c_str(), parsedOk, 0);
921 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
922 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
923 // continue if flag is ok
924 if (parsedOk) {
925 // set tag
927 // add all attributes
938 } else {
940 }
941}
942
943
944void
946 // declare Ok Flag
947 bool parsedOk = true;
948 // needed attributes
949 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
950 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
951 // optional attributes
952 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
953 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
954 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
955 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, id.c_str(), parsedOk, std::vector<std::string>());
956 const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), parsedOk, 22000);
957 const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), parsedOk, 0.95);
958 const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), parsedOk, 0);
959 const SUMOTime chargeDelay = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CHARGEDELAY, id.c_str(), parsedOk, 0);
960 const std::string chargeType = attrs.getOpt<std::string>(SUMO_ATTR_CHARGETYPE, id.c_str(), parsedOk, SUMOXMLDefinitions::ChargeTypes.getString(ChargeType::NORMAL));
961 const SUMOTime waitingTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_WAITINGTIME, id.c_str(), parsedOk, TIME2STEPS(900));
962 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
963 const std::string parkingAreaID = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, id.c_str(), parsedOk, "");
964
965 // check charge type
966 if ((chargeType != "normal") && (chargeType != "battery-exchange") && (chargeType != "fuel")) {
967 writeError(TLF("Invalid charge type '%' defined in chargingStation '%'.", chargeType, id));
968 parsedOk = false;
969 }
970 // continue if flag is ok
971 if (parsedOk) {
972 // set tag
974 // add all attributes
989 } else {
991 }
992}
993
994
995void
997 // declare Ok Flag
998 bool parsedOk = true;
999 // needed attributes
1000 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1001 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1002 // optional attributes
1003 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1004 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1005 const std::string departPos = attrs.getOpt<std::string>(SUMO_ATTR_DEPARTPOS, id.c_str(), parsedOk, "");
1006 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1007 const std::vector<std::string> badges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ACCEPTED_BADGES, id.c_str(), parsedOk, std::vector<std::string>());
1008 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1009 const int roadSideCapacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), parsedOk, 0);
1010 const bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), parsedOk, false);
1011 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, 0);
1012 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1013 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, 0);
1014 const bool lefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, id.c_str(), parsedOk, false);
1015
1016 // continue if flag is ok
1017 if (parsedOk) {
1018 // set tag
1020 // add all attributes
1035 } else {
1037 }
1038}
1039
1040
1041void
1043 // declare Ok Flag
1044 bool parsedOk = true;
1045 // needed attributes
1046 const double x = attrs.get<double>(SUMO_ATTR_X, "", parsedOk);
1047 const double y = attrs.get<double>(SUMO_ATTR_Y, "", parsedOk);
1048 // optional attributes
1049 const double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", parsedOk, 0);
1050 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, "", parsedOk, "");
1051 const std::string width = attrs.getOpt<std::string>(SUMO_ATTR_WIDTH, "", parsedOk, "");
1052 const std::string length = attrs.getOpt<std::string>(SUMO_ATTR_LENGTH, "", parsedOk, "");
1053 const std::string angle = attrs.getOpt<std::string>(SUMO_ATTR_ANGLE, "", parsedOk, "");
1054 const double slope = attrs.getOpt<double>(SUMO_ATTR_SLOPE, "", parsedOk, 0);
1055 // check parent
1057 // continue if flag is ok
1058 if (parsedOk) {
1059 // set tag
1061 // add all attributes
1070 } else {
1072 }
1073}
1074
1075
1076void
1078 // declare Ok Flag
1079 bool parsedOk = true;
1080 // needed attributes
1081 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1082 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1083 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1084 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1085 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1086 // optional attributes
1087 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1088 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1089 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1090 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1091 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1092 // continue if flag is ok
1093 if (parsedOk && checkDetectPersons(SUMO_TAG_E1DETECTOR, id, detectPersons)) {
1094 // set tag
1096 // add all attributes
1107 } else {
1109 }
1110}
1111
1112
1113void
1115 // declare Ok Flag
1116 bool parsedOk = true;
1117 const int positionDef = attrs.hasAttribute(SUMO_ATTR_POSITION) ? 1 : 0;
1118 const int endPosDef = attrs.hasAttribute(SUMO_ATTR_ENDPOS) ? 1 : 0;
1119 const int lengthDef = attrs.hasAttribute(SUMO_ATTR_LENGTH) ? 1 : 0;
1120 // check attributes
1121 if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) > 2)) {
1122 writeError(TL("'pos', 'endPos' and 'length' cannot be defined together in a single lane area detector."));
1124 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && ((positionDef + endPosDef + lengthDef) < 2)) {
1125 writeError(TL("A single lane area detector requires two parameters of those 'pos', 'endPos' and 'length'."));
1127 } else {
1128 // needed attributes
1129 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1130 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1131 // special attributes
1132 const std::string laneId = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1133 const std::vector<std::string> laneIds = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk, std::vector<std::string>());
1134 const double position = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1135 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, 0);
1136 const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), parsedOk, 0);
1137 // optional attributes
1138 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1139 const std::string trafficLight = attrs.getOpt<std::string>(SUMO_ATTR_TLID, id.c_str(), parsedOk, "");
1140 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1141 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1142 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1143 const double jamDistThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 10);
1144 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1145 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1146 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1147 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1148 const bool show = attrs.getOpt<bool>(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), parsedOk, true);
1149 // continue if flag is ok
1150 if (parsedOk && checkDetectPersons(SUMO_TAG_E2DETECTOR, id, detectPersons)) {
1151 // set tag
1153 // add attributes depending of Lane/Lanes
1154 if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
1156 if (positionDef == 0) {
1159 } else if (endPosDef == 0) {
1162 } else if (lengthDef == 0) {
1165 }
1166 } else {
1170 }
1171 // add all attributes
1185 } else {
1187 }
1188 }
1189}
1190
1191
1192void
1194 // declare Ok Flag
1195 bool parsedOk = true;
1196 // needed attributes
1197 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1198 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1199 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1200 // optional attributes
1201 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1202 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1203 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1204 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1205 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1206 const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, TIME2STEPS(1));
1207 const double haltingSpeedThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), parsedOk, 1.39);
1208 const bool openEntry = attrs.getOpt<bool>(SUMO_ATTR_OPEN_ENTRY, id.c_str(), parsedOk, false);
1209 const bool expectedArrival = attrs.getOpt<bool>(SUMO_ATTR_EXPECT_ARRIVAL, id.c_str(), parsedOk, false);
1210 // continue if flag is ok
1211 if (parsedOk && checkDetectPersons(SUMO_TAG_E3DETECTOR, id, detectPersons)) {
1212 // set tag
1214 // add all attributes
1227 } else {
1229 }
1230}
1231
1232
1233void
1235 // declare Ok Flag
1236 bool parsedOk = true;
1237 // needed attributes
1238 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1239 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1240 // optional attributes
1241 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1242 // check parent
1244 // continue if flag is ok
1245 if (parsedOk) {
1246 // set tag
1248 // add all attributes
1252 } else {
1254 }
1255}
1256
1257
1258void
1260 // declare Ok Flag
1261 bool parsedOk = true;
1262 // needed attributes
1263 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, "", parsedOk);
1264 const double position = attrs.get<double>(SUMO_ATTR_POSITION, "", parsedOk);
1265 // optional attributes
1266 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "", parsedOk, false);
1267 // check parent
1269 // continue if flag is ok
1270 if (parsedOk) {
1271 // set tag
1273 // add all attributes
1277 } else {
1279 }
1280}
1281
1282
1283void
1285 // declare Ok Flag
1286 bool parsedOk = true;
1287 // needed attributes
1288 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1289 const std::string laneId = attrs.get<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk);
1290 const double position = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1291 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1292 // optional attributes
1293 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1294 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1295 const std::vector<std::string> nextEdges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_NEXT_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1296 const std::string detectPersons = attrs.getOpt<std::string>(SUMO_ATTR_DETECT_PERSONS, "", parsedOk);
1297 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1298 // continue if flag is ok
1299 if (parsedOk && checkDetectPersons(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, detectPersons)) {
1300 // set tag
1302 // add all attributes
1312 } else {
1314 }
1315}
1316
1317
1318void
1320 // declare Ok Flag
1321 bool parsedOk = true;
1322 // needed attributes
1323 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1324 // optional attributes
1325 const PositionVector shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk, PositionVector());
1326 const Position center = attrs.getOpt<Position>(SUMO_ATTR_CENTER, id.c_str(), parsedOk, shape.size() > 0 ? shape.getCentroid() : Position::INVALID);
1327 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1328 const std::vector<std::string> edges = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk, std::vector<std::string>());
1329 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1330 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1331 // continue if flag is ok
1332 if (parsedOk) {
1333 // set tag
1335 // add all attributes
1343 } else {
1345 }
1346}
1347
1348
1349void
1351 // declare Ok Flag
1352 bool parsedOk = true;
1353 // needed attributes
1354 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1355 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1356 // check parent
1358 // continue if flag is ok
1359 if (parsedOk) {
1360 // set tag
1362 // add all attributes
1365 } else {
1367 }
1368}
1369
1370
1371void
1373 // declare Ok Flag
1374 bool parsedOk = true;
1375 // needed attributes
1376 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1377 const double weight = attrs.get<double>(SUMO_ATTR_WEIGHT, edgeID.c_str(), parsedOk);
1378 // check parent
1380 // continue if flag is ok
1381 if (parsedOk) {
1382 // set tag
1384 // add all attributes
1387 } else {
1389 }
1390}
1391
1392
1393void
1395 // declare Ok Flag
1396 bool parsedOk = true;
1397 // needed attributes
1398 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1399 const std::vector<std::string> lanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1400 // optional attributes
1401 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position());
1402 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1403 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1404 // continue if flag is ok
1405 if (parsedOk) {
1406 // set tag
1408 // add all attributes
1414 } else {
1416 }
1417}
1418
1419
1420void
1422 // declare Ok Flag
1423 bool parsedOk = true;
1424 // needed attributes
1425 const SUMOTime time = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, "", parsedOk);
1426 // optional attributes
1427 const double speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, "", parsedOk, OptionsCont::getOptions().getFloat("default.speed"));
1428 // check parent
1430 // continue if flag is ok
1431 if (parsedOk) {
1432 // set tag
1434 // add all attributes
1437 } else {
1439 }
1440}
1441
1442
1443void
1445 // declare Ok Flag
1446 bool parsedOk = true;
1447 // check that frecuency and trafficLight aren't defined together
1448 if ((attrs.hasAttribute(SUMO_ATTR_EDGE) && attrs.hasAttribute(SUMO_ATTR_LANE)) ||
1450 writeError(TL("Calibrators need either an edge or a lane"));
1451 parsedOk = false;
1452 }
1453 // needed attributes
1454 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1455 const double pos = attrs.get<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk);
1456 // special attributes
1457 const std::string edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk, "");
1458 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, id.c_str(), parsedOk, "");
1459 // optional attributes
1460 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1461 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, DELTA_T);
1462 const std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), parsedOk, "");
1463 const double jamThreshold = attrs.getOpt<double>(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), parsedOk, 0.5);
1464 const std::string output = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), parsedOk, "");
1465 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1466 // continue if flag is ok
1467 if (parsedOk) {
1468 // set tag depending of edge/lane
1469 if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
1472 } else {
1475 }
1484 } else {
1486 }
1487}
1488
1489
1490void
1492 // declare Ok Flag
1493 bool parsedOk = true;
1494 // check parent
1496 // check that frecuency and trafficLight aren't defined together
1498 writeError(TL("CalibratorFlows need either the attribute vehsPerHour or speed or type (or any combination of these)"));
1500 } else {
1502 if (flowParameter) {
1503 // set VPH and speed
1505 flowParameter->repetitionOffset = TIME2STEPS(3600. / attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, "", parsedOk));
1506 flowParameter->parametersSet |= VEHPARS_VPH_SET;
1507 }
1508 if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1509 flowParameter->calibratorSpeed = attrs.get<double>(SUMO_ATTR_SPEED, "", parsedOk);
1511 }
1512 // set begin and end
1513 flowParameter->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1514 flowParameter->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1515 if (parsedOk) {
1516 // set tag
1518 // set vehicle parameters
1520 // delete flow parameter (because in XMLStructure we have a copy)
1521 delete flowParameter;
1522 } else {
1524 }
1525 } else {
1527 }
1528 }
1529 } else {
1531 }
1532}
1533
1534
1535void
1537 // declare Ok Flag
1538 bool parsedOk = true;
1539 // needed attributes
1540 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1541 const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
1542 // optional attributes
1543 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1544 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1545 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 1);
1546 SUMOTime timeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), parsedOk, 0);
1547 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1548 const bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), parsedOk, false);
1549 const bool optional = attrs.getOpt<bool>(SUMO_ATTR_OPTIONAL, id.c_str(), parsedOk, false);
1550 // check attributes
1551 if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB, probability, true)) {
1552 parsedOk = false;
1553 }
1554 // continue if flag is ok
1555 if (parsedOk) {
1556 // set tag
1558 // add all attributes
1568 } else {
1570 }
1571}
1572
1573
1574void
1576 // declare Ok Flag
1577 bool parsedOk = true;
1578 // needed attributes
1579 const SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, "", parsedOk);
1580 const SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, "", parsedOk);
1581 // check parent
1583 // continue if flag is ok
1584 if (parsedOk) {
1585 // set tag
1587 // add all attributes
1590 } else {
1592 }
1593}
1594
1595
1596void
1598 // declare Ok Flag
1599 bool parsedOk = true;
1600 // needed attributes
1601 const std::string laneID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1602 // optional attributes
1603 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1604 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1605 // check parent
1607 // continue if flag is ok
1608 if (parsedOk) {
1609 // set tag
1611 // add all attributes
1615 } else {
1617 }
1618}
1619
1620
1621void
1623 // declare Ok Flag
1624 bool parsedOk = true;
1625 // needed attributes
1626 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1627 // optional attributes
1628 const std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, "", parsedOk, "");
1629 const std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, "", parsedOk, !disallow.size() ? "authority" : "");
1630 // check parent
1632 // continue if flag is ok
1633 if (parsedOk) {
1634 // set tag
1636 // add all attributes
1640 } else {
1642 }
1643}
1644
1645
1646void
1648 // declare Ok Flag
1649 bool parsedOk = true;
1650 // needed attributes
1651 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1652 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1653 // check attributes
1654 if (!checkNegative(SUMO_TAG_DEST_PROB_REROUTE, edgeID, SUMO_ATTR_PROB, probability, true)) {
1655 parsedOk = false;
1656 }
1657 // check parent
1659 // continue if flag is ok
1660 if (parsedOk) {
1661 // set tag
1663 // add all attributes
1666 } else {
1668 }
1669}
1670
1671
1672void
1674 // declare Ok Flag
1675 bool parsedOk = true;
1676 // needed attributes
1677 const std::string parkingAreaID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1678 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1679 // check attributes
1680 if (!checkNegative(SUMO_TAG_PARKING_AREA_REROUTE, parkingAreaID, SUMO_ATTR_PROB, probability, true)) {
1681 parsedOk = false;
1682 }
1683 // optional attributes
1684 const bool visible = attrs.getOpt<bool>(SUMO_ATTR_VISIBLE, "", parsedOk, false);
1685 // check parent
1687 // continue if flag is ok
1688 if (parsedOk) {
1689 // set tag
1691 // add all attributes
1695 } else {
1697 }
1698}
1699
1700
1701void
1703 // declare Ok Flag
1704 bool parsedOk = true;
1705 // needed attributes
1706 const std::string routeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1707 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, "", parsedOk, 1);
1708 // check attributes
1709 if (!checkNegative(SUMO_TAG_ROUTE_PROB_REROUTE, routeID, SUMO_ATTR_PROB, probability, true)) {
1710 parsedOk = false;
1711 }
1712 // check parent
1714 // continue if flag is ok
1715 if (parsedOk) {
1716 // set tag
1718 // add all attributes
1721 } else {
1723 }
1724}
1725
1726
1727void
1729 // declare Ok Flag
1730 bool parsedOk = true;
1731 // needed attributes
1732 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1733 const std::string edge = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), parsedOk);
1734 const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), parsedOk);
1735 const SUMOTime period = attrs.getOptPeriod(id.c_str(), parsedOk, SUMOTime_MAX_PERIOD);
1736 const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), parsedOk, -1);
1737 // optional attributes
1738 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1739 const std::vector<std::string> vehicleTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk, std::vector<std::string>());
1740 // continue if flag is ok
1741 if (parsedOk) {
1742 // set tag
1744 // add all attributes
1752 } else {
1754 }
1755}
1756
1757
1758void
1760 // declare Ok Flag
1761 bool parsedOk = true;
1762 // needed attributes
1763 const std::string edgeID = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1764 SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
1765 SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
1766 // optional attributes
1767 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, edgeID.c_str(), parsedOk, "");
1768 // continue if flag is ok
1769 if (parsedOk) {
1770 // set tag
1772 // add all attributes
1777 } else {
1779 }
1780}
1781
1782
1783void
1785 // declare Ok Flag
1786 bool parsedOk = true;
1787 // needed attributes
1788 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1789 // optional attributes
1790 const Position pos = attrs.getOpt<Position>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, Position::INVALID);
1791 const double voltage = attrs.getOpt<double>(SUMO_ATTR_VOLTAGE, id.c_str(), parsedOk, 600);
1792 const double currentLimit = attrs.getOpt<double>(SUMO_ATTR_CURRENTLIMIT, id.c_str(), parsedOk, 400);
1793 // continue if flag is ok
1794 if (parsedOk) {
1795 // set tag
1797 // add all attributes
1802 } else {
1804 }
1805}
1806
1807
1808void
1810 // declare Ok Flag
1811 bool parsedOk = true;
1812 // needed attributes
1813 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1814 const std::string substationID = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1815 const std::vector<std::string> laneIDs = attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), parsedOk);
1816 // optional attributes
1817 const double startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), parsedOk, 0);
1818 const double endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), parsedOk, INVALID_DOUBLE);
1819 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1820 const std::vector<std::string> forbiddenInnerLanes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN, "", parsedOk);
1821 // continue if flag is ok
1822 if (parsedOk) {
1823 // set tag
1825 // add all attributes
1833 } else {
1835 }
1836}
1837
1838
1839void
1841 // declare Ok Flag
1842 bool parsedOk = true;
1843 // needed attributes
1844 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1845 const std::string substationId = attrs.get<std::string>(SUMO_ATTR_SUBSTATIONID, id.c_str(), parsedOk);
1846 const std::string wireClampStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_START, id.c_str(), parsedOk);
1847 const std::string wireClampLaneStart = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART, id.c_str(), parsedOk);
1848 const std::string wireClampEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_END, id.c_str(), parsedOk);
1849 const std::string wireClampLaneEnd = attrs.get<std::string>(SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND, id.c_str(), parsedOk);
1850 // continue if flag is ok
1851 if (parsedOk) {
1852 // set tag
1854 // add all attributes
1861 } else {
1863 }
1864}
1865
1866
1867void
1869 // declare Ok Flag
1870 bool parsedOk = true;
1871 // needed attributes
1872 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1873 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1874 // optional attributes
1875 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1876 const bool geo = attrs.getOpt<bool>(SUMO_ATTR_GEO, id.c_str(), parsedOk, false);
1877 const bool fill = attrs.getOpt<bool>(SUMO_ATTR_FILL, id.c_str(), parsedOk, false);
1878 const double lineWidth = attrs.getOpt<double>(SUMO_ATTR_LINEWIDTH, id.c_str(), parsedOk, Shape::DEFAULT_LINEWIDTH);
1879 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER);
1880 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), parsedOk, Shape::DEFAULT_TYPE);
1881 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, id.c_str(), parsedOk, Shape::DEFAULT_IMG_FILE);
1882 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1883 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1884 // continue if flag is ok
1885 if (parsedOk) {
1886 // set tag
1888 // add all attributes
1900 } else {
1902 }
1903}
1904
1905
1906void
1908 // declare Ok Flag
1909 bool parsedOk = true;
1910 // check that x and y are defined together
1911 if ((attrs.hasAttribute(SUMO_ATTR_X) && !attrs.hasAttribute(SUMO_ATTR_Y)) ||
1912 (!attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y))) {
1913 writeError(TL("X and Y must be be defined together in POIs"));
1914 parsedOk = false;
1915 }
1916 // check that lane and pos are defined together
1919 writeError(TL("lane and position must be defined together in POIs"));
1920 parsedOk = false;
1921 }
1922 // check that lon and lat are defined together
1923 if ((attrs.hasAttribute(SUMO_ATTR_LON) && !attrs.hasAttribute(SUMO_ATTR_LAT)) ||
1925 writeError(TL("lon and lat must be be defined together in POIs"));
1926 parsedOk = false;
1927 }
1928 // needed attributes
1929 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1930 // special attributes
1931 const double x = attrs.getOpt<double>(SUMO_ATTR_X, id.c_str(), parsedOk, 0);
1932 const double y = attrs.getOpt<double>(SUMO_ATTR_Y, id.c_str(), parsedOk, 0);
1933 const std::string lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, "", parsedOk, "");
1934 const double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, id.c_str(), parsedOk, 0);
1935 const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), parsedOk, false);
1936 const double posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, id.c_str(), parsedOk, 0);
1937 const double lon = attrs.getOpt<double>(SUMO_ATTR_LON, id.c_str(), parsedOk, 0);
1938 const double lat = attrs.getOpt<double>(SUMO_ATTR_LAT, id.c_str(), parsedOk, 0);
1939 // optional attributes
1940 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::RED);
1941 const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, "", parsedOk, Shape::DEFAULT_TYPE);
1942 std::string icon = attrs.getOpt<std::string>(SUMO_ATTR_ICON, "", parsedOk, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE));
1943 const double layer = attrs.getOpt<double>(SUMO_ATTR_LAYER, id.c_str(), parsedOk, Shape::DEFAULT_LAYER_POI);
1944 const std::string imgFile = attrs.getOpt<std::string>(SUMO_ATTR_IMGFILE, "", parsedOk, Shape::DEFAULT_IMG_FILE);
1945 const double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), parsedOk, Shape::DEFAULT_IMG_WIDTH);
1946 const double height = attrs.getOpt<double>(SUMO_ATTR_HEIGHT, id.c_str(), parsedOk, Shape::DEFAULT_IMG_HEIGHT);
1947 const double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), parsedOk, Shape::DEFAULT_ANGLE);
1948 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1949 // check icon
1950 if (!SUMOXMLDefinitions::POIIcons.hasString(icon)) {
1951 WRITE_WARNING(TLF("Invalid icon % for POI '%', using default", icon, id));
1952 icon = "none";
1953 }
1954 // continue if flag is ok
1955 if (parsedOk) {
1956 // set tag
1958 // add attributes depending of Lane/Lanes
1959 if (attrs.hasAttribute(SUMO_ATTR_X) && attrs.hasAttribute(SUMO_ATTR_Y)) {
1962 } else if (attrs.hasAttribute(SUMO_ATTR_LANE) && attrs.hasAttribute(SUMO_ATTR_POSITION)) {
1967 } else {
1970 }
1971 // add rest attributes
1982 } else {
1984 }
1985}
1986
1987
1988void
1990 // declare Ok Flag
1991 bool parsedOk = true;
1992 // needed attributes
1993 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
1994 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
1995 // optional attributes
1996 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
1997 // continue if flag is ok
1998 if (parsedOk) {
1999 // set tag
2001 // add all attributes
2005 } else {
2007 }
2008}
2009
2010
2011void
2013 // declare Ok Flag
2014 bool parsedOk = true;
2015 // needed attributes
2016 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
2017 const PositionVector shapeStr = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), parsedOk);
2018 // optional attributes
2019 const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), parsedOk, "");
2020 // continue if flag is ok
2021 if (parsedOk) {
2022 // set tag
2024 // add all attributes
2028 } else {
2030 }
2031}
2032
2033
2034bool
2037 if (parentCalibrator == nullptr) {
2038 return false;
2039 }
2040 const auto parentRootFile = parentCalibrator->getParentSumoBaseObject();
2041 if (parentRootFile != nullptr) {
2042 return false;
2043 }
2044 if ((parentCalibrator->getTag() == SUMO_TAG_CALIBRATOR) || (parentCalibrator->getTag() == GNE_TAG_CALIBRATOR_LANE)) {
2045 return true;
2046 } else {
2047 return writeError(TLF("Calibrator Flows have to be defined within a %.", toString(SUMO_TAG_CALIBRATOR)));
2048 }
2049}
2050
2051
2052bool
2053AdditionalHandler::checkDetectPersons(const SumoXMLTag currentTag, const std::string& id, const std::string& detectPersons) {
2054 if (detectPersons.empty() || SUMOXMLDefinitions::PersonModeValues.hasString(detectPersons)) {
2055 return true;
2056 } else {
2057 writeError(TLF("Attribute '%' defined in % with id '%' doesn't have a valid value (given '%').", toString(SUMO_ATTR_DETECT_PERSONS), toString(currentTag), id, detectPersons));
2058 return false;
2059 }
2060}
2061
2062/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNING(msg)
Definition MsgHandler.h:287
#define TL(string)
Definition MsgHandler.h:305
#define TLF(string,...)
Definition MsgHandler.h:307
SUMOTime DELTA_T
Definition SUMOTime.cpp:38
#define SUMOTime_MAX_PERIOD
Definition SUMOTime.h:36
#define TIME2STEPS(x)
Definition SUMOTime.h:57
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
const long long int VEHPARS_VPH_SET
const long long int VEHPARS_CALIBRATORSPEED_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TRACTION_SUBSTATION
A traction substation.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_CLOSING_REROUTE
reroute of type closing
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_E2DETECTOR
an e2 detector
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_STEP
trigger: a step description
@ SUMO_TAG_OVERHEAD_WIRE_CLAMP
An overhead wire clamp (connection of wires in opposite directions)
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_DET_ENTRY
an e3 entry point
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_OVERHEAD_WIRE_SECTION
An overhead wire section.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ SUMO_TAG_DEST_PROB_REROUTE
probability of destination of a reroute
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_E1DETECTOR
an e1 detector
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ SUMO_TAG_ERROR
tag used for indicate that there is an error (usually loading elements in handlers)
@ SUMO_TAG_DET_EXIT
an e3 exit point
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_CLOSING_LANE_REROUTE
lane of a reroute of type closing
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
@ SUMO_TAG_E3DETECTOR
an e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_ATTR_EXPECT_ARRIVAL
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_LINES
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_ICON
icon
@ SUMO_ATTR_LANE
@ SUMO_ATTR_ACCEPTED_BADGES
@ SUMO_ATTR_LON
@ SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_WAITINGTIME
@ SUMO_ATTR_NEXT_EDGES
@ SUMO_ATTR_FILE
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_Y
@ SUMO_ATTR_SUBSTATIONID
id of a traction substation substation
@ SUMO_ATTR_Z
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_CHARGETYPE
Charge type (fuel or electric)
@ SUMO_ATTR_PARKING_LENGTH
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_VOLTAGE
voltage of the traction substation [V]
@ SUMO_ATTR_X
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_OFF
@ SUMO_ATTR_ROUTEPROBE
@ SUMO_ATTR_LINEWIDTH
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN
forbidden lanes for overhead wire segment
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_GEO
@ SUMO_ATTR_LANES
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_END
id of the overhead wire, to the end of which the overhead wire clamp is connected
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_LEFTHAND
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_LANESTART
id of the overhead wire lane, to the start of which the overhead wire clamp is connected
@ SUMO_ATTR_CHARGEINTRANSIT
Allow/disallow charge in transit in Charging Stations.
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_START
id of the overhead wire, to the start of which the overhead wire clamp is connected
@ SUMO_ATTR_CONTAINER_CAPACITY
@ SUMO_ATTR_FILL
Fill the polygon.
@ SUMO_ATTR_NAME
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_SLOPE
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_CENTER
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ROADSIDE_CAPACITY
@ SUMO_ATTR_CURRENTLIMIT
current limit of the traction substation [A]
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
@ SUMO_ATTR_OPTIONAL
@ SUMO_ATTR_OUTPUT
@ SUMO_ATTR_SHOW_DETECTOR
@ SUMO_ATTR_CHARGINGPOWER
@ SUMO_ATTR_PROB
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_ONROAD
@ SUMO_ATTR_LAT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_EFFICIENCY
Eficiency of the charge in Charging Stations.
@ SUMO_ATTR_ID
@ SUMO_ATTR_VISIBLE
@ SUMO_ATTR_OPEN_ENTRY
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_CHARGEDELAY
Delay in the charge of charging stations (different of waiting time)
@ SUMO_ATTR_TIME
trigger: the time of the step
@ SUMO_ATTR_OVERHEAD_WIRECLAMP_LANEEND
id of the overhead wire lane, to the end of which the overhead wire clamp is connected
@ SUMO_ATTR_DETECT_PERSONS
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
virtual bool buildClosingReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &closedEdgeID, SVCPermissions permissions)=0
builds a closing edge reroute
virtual bool buildRouteProbe(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &edgeID, const SUMOTime period, const std::string &name, const std::string &file, const SUMOTime begin, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)=0
builds a Route probe
void parseE1InstantAttributes(const SUMOSAXAttributes &attrs)
parse E1 instant attributes
void parseCalibratorAttributes(const SUMOSAXAttributes &attrs)
parse calibrator attributes
virtual bool buildBusStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int personCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const Parameterised::Map &parameters)=0
Builds a bus stop.
virtual bool buildAccess(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const std::string &pos, const double length, const bool friendlyPos, const Parameterised::Map &parameters)=0
Builds an Access.
void parseChargingStationAttributes(const SUMOSAXAttributes &attrs)
parse chargingStation attributes
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)
void parseOverheadWire(const SUMOSAXAttributes &attrs)
parse overhead wire segment
void parseTractionSubstation(const SUMOSAXAttributes &attrs)
parse traction substation
virtual bool buildPolygon(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double layer, const double angle, const std::string &imgFile, const PositionVector &shape, const bool geo, const bool fill, const double lineWidth, const std::string &name, const Parameterised::Map &parameters)=0
Builds a polygon using the given values.
virtual bool buildChargingStation(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const double chargingPower, const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay, const std::string &chargeType, const SUMOTime waitingTime, const bool friendlyPosition, const std::string &parkingAreaID, const Parameterised::Map &parameters)=0
Builds a charging Station.
virtual bool buildTrainStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int personCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const Parameterised::Map &parameters)=0
Builds a train stop.
void parseE3Attributes(const SUMOSAXAttributes &attrs)
parse E3 attributes
void parseE2Attributes(const SUMOSAXAttributes &attrs)
parse E2 attributes
void parseTAZSinkAttributes(const SUMOSAXAttributes &attrs)
parse TAZ sink attributes
void parseOverheadWireClamp(const SUMOSAXAttributes &attrs)
parse overhead wire clamp
virtual bool buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const double length, const SUMOTime period, const std::string &trafficLight, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show, const Parameterised::Map &parameters)=0
Builds a single-lane Area Detector (E2)
bool beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs)
begin parse attributes
void parseTrainStopAttributes(const SUMOSAXAttributes &attrs)
parse trainStop attributes
virtual bool 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
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
virtual bool buildContainerStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int containerCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const Parameterised::Map &parameters)=0
Builds a container stop.
void parseRerouterIntervalAttributes(const SUMOSAXAttributes &attrs)
parse rerouter interval attributes
virtual bool buildJpsWalkableArea(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, bool geo, const std::string &name, const Parameterised::Map &parameters)=0
Builds a JuPedSim walkable area using the given values.
virtual bool buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newParkignAreaID, const double probability, const bool visible)=0
builds a parking area reroute
void parseEntryAttributes(const SUMOSAXAttributes &attrs)
parse entry attributes
void parsePolyAttributes(const SUMOSAXAttributes &attrs)
virtual bool buildTAZSink(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const double arrivalWeight)=0
Builds a TAZSink (Traffic Assignment Zone)
void parseClosingRerouteAttributes(const SUMOSAXAttributes &attrs)
parse closing reroute attributes
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