Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
RouteHandler.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// The XML-Handler for route elements loading
19/****************************************************************************/
20#include <config.h>
21
26#include <utils/shapes/Shape.h>
29#include <utils/xml/XMLSubSys.h>
31
32#include "RouteHandler.h"
33
34
35// ===========================================================================
36// method definitions
37// ===========================================================================
38
39RouteHandler::RouteHandler(const std::string& filename, const bool hardFail) :
40 myFilename(filename),
41 myHardFail(hardFail),
42 myFlowBeginDefault(string2time(OptionsCont::getOptions().getString("begin"))),
43 myFlowEndDefault(string2time(OptionsCont::getOptions().getString("end"))) {
44}
45
46
48
49
50bool
52 // open SUMOBaseOBject
54 // check tag
55 try {
56 switch (tag) {
57 // vTypes
58 case SUMO_TAG_VTYPE:
59 parseVType(attrs);
60 break;
63 break;
64 // routes
65 case SUMO_TAG_ROUTE:
66 parseRoute(attrs);
67 break;
70 break;
71 // vehicles
72 case SUMO_TAG_TRIP:
73 parseTrip(attrs);
74 break;
76 parseVehicle(attrs);
77 break;
78 // flows
79 case SUMO_TAG_FLOW:
80 parseFlow(attrs);
81 break;
82 // stop
83 case SUMO_TAG_STOP:
84 parseStop(attrs);
85 break;
86 // persons
87 case SUMO_TAG_PERSON:
88 parsePerson(attrs);
89 break;
91 parsePersonFlow(attrs);
92 break;
93 // person plans
95 parsePersonTrip(attrs);
96 break;
97 case SUMO_TAG_RIDE:
98 parseRide(attrs);
99 break;
100 case SUMO_TAG_WALK:
101 parseWalk(attrs);
102 break;
103 // container
105 parseContainer(attrs);
106 break;
108 parseContainerFlow(attrs);
109 break;
110 // container plans
112 parseTransport(attrs);
113 break;
115 parseTranship(attrs);
116 break;
117 // parameters
118 case SUMO_TAG_PARAM:
119 parseParameters(attrs);
120 break;
121 // other
122 case SUMO_TAG_INTERVAL: {
123 parseInterval(attrs);
124 break;
125 }
126 default:
127 // get vehicle type Base object
129 // parse embedded car following model information
130 if (vTypeObject && (vTypeObject->getTag() == SUMO_TAG_VTYPE)) {
131 // nested CFM attributes
132 return parseNestedCFM(tag, attrs, vTypeObject);
133 } else {
134 // tag cannot be parsed in routeHandler
136 return false;
137 }
138 }
139 } catch (InvalidArgument& e) {
140 WRITE_ERROR(e.what());
141 }
142 return true;
143}
144
145
146void
148 // get last inserted object
150 // check tag
151 if (obj) {
152 // close SUMOBaseOBject
154 // get parent tag (if exist)
155 const auto parentTag = obj->getParentSumoBaseObject() ? obj->getParentSumoBaseObject()->getTag() : SUMO_TAG_NOTHING;
156 switch (obj->getTag()) {
157 // specia case for route (because can be embedded)
158 case SUMO_TAG_ROUTE:
159 // only parse non-embedded and without distributionsroutes
160 if ((obj->getStringAttribute(SUMO_ATTR_ID).size() > 0) &&
161 (parentTag != SUMO_TAG_ROUTE_DISTRIBUTION)) {
162 // parse route and all their childrens
164 // delete object (and all of their childrens)
165 delete obj;
166 }
167 break;
168 // demand elements
169 case SUMO_TAG_VTYPE:
170 // only parse vTypes without distributions
171 if (parentTag != SUMO_TAG_VTYPE_DISTRIBUTION) {
172 // parse vType and all their childrens
174 // delete object (and all of their childrens)
175 delete obj;
176 }
177 break;
180 case SUMO_TAG_TRIP:
181 case SUMO_TAG_VEHICLE:
182 case SUMO_TAG_FLOW:
183 case SUMO_TAG_PERSON:
187 // parse object and all their childrens
189 // delete object (and all of their childrens)
190 delete obj;
191 break;
192 default:
193 break;
194 }
195 }
196}
197
198
199void
201 // switch tag
202 switch (obj->getTag()) {
203 // vTypes
204 case SUMO_TAG_VTYPE:
205 if (buildVType(obj,
206 obj->getVehicleTypeParameter())) {
207 obj->markAsCreated();
208 }
209 break;
216 obj->markAsCreated();
217 }
218 break;
219 // route
220 case SUMO_TAG_ROUTE:
221 if (obj->getStringAttribute(SUMO_ATTR_ID).empty()) {
222 if (buildEmbeddedRoute(obj,
227 obj->getParameters())) {
228 obj->markAsCreated();
229 }
230 } else {
231 if (buildRoute(obj,
233 obj->getVClass(),
239 obj->getParameters())) {
240 obj->markAsCreated();
241 }
242 }
243 break;
249 obj->markAsCreated();
250 }
251 break;
252 // vehicles
253 case SUMO_TAG_TRIP:
256 // build trip with from-to junctions
257 if (buildTripJunctions(obj,
258 obj->getVehicleParameter(),
261 obj->markAsCreated();
262 }
263 } else if (obj->hasStringAttribute(SUMO_ATTR_FROM_TAZ) &&
265 // build trip with from-to TAZs
266 if (buildTripTAZs(obj,
267 obj->getVehicleParameter(),
270 obj->markAsCreated();
271 }
272 } else {
273 // build trip with from-to edges
274 if (buildTrip(obj,
275 obj->getVehicleParameter(),
278 obj->markAsCreated();
279 }
280 }
281 break;
282 case SUMO_TAG_VEHICLE:
284 if (buildVehicleOverRoute(obj,
285 obj->getVehicleParameter())) {
286 obj->markAsCreated();
287 }
288 }
289 break;
290 // flows
291 case SUMO_TAG_FLOW:
293 // build flow over route
294 if (buildFlowOverRoute(obj,
295 obj->getVehicleParameter())) {
296 obj->markAsCreated();
297 }
300 // build flow with from-to junctions
301 if (buildFlowJunctions(obj,
302 obj->getVehicleParameter(),
305 obj->markAsCreated();
306 }
307 } else if (obj->hasStringAttribute(SUMO_ATTR_FROM_TAZ) &&
309 // build flow with from-to TAZs
310 if (buildFlowTAZs(obj,
311 obj->getVehicleParameter(),
314 obj->markAsCreated();
315 }
316 } else if ((obj->getSumoBaseObjectChildren().size() == 0) ||
317 (obj->getSumoBaseObjectChildren().front()->getTag() != SUMO_TAG_ROUTE)) {
318 // build flow with from-to edges
319 if (buildFlow(obj,
320 obj->getVehicleParameter(),
323 obj->markAsCreated();
324 }
325 }
326 break;
327 // persons
328 case SUMO_TAG_PERSON:
329 if (buildPerson(obj,
330 obj->getVehicleParameter())) {
331 obj->markAsCreated();
332 }
333 break;
335 if (buildPersonFlow(obj,
336 obj->getVehicleParameter())) {
337 obj->markAsCreated();
338 }
339 break;
340 // person plans
342 if (buildPersonTrip(obj,
343 obj->getPlanParameters(),
350 obj->markAsCreated();
351 }
352 break;
353 case SUMO_TAG_RIDE:
354 if (buildRide(obj,
355 obj->getPlanParameters(),
359 obj->markAsCreated();
360 }
361 break;
362 case SUMO_TAG_WALK:
363 if (buildWalk(obj,
364 obj->getPlanParameters(),
368 obj->markAsCreated();
369 }
370 break;
371 // container
373 if (buildContainer(obj,
374 obj->getVehicleParameter())) {
375 obj->markAsCreated();
376 }
377 break;
379 if (buildContainerFlow(obj,
380 obj->getVehicleParameter())) {
381 obj->markAsCreated();
382 }
383 break;
384 // container plans
386 if (buildTransport(obj,
387 obj->getPlanParameters(),
391 obj->markAsCreated();
392 }
393 break;
395 if (buildTranship(obj,
396 obj->getPlanParameters(),
401 obj->markAsCreated();
402 }
403 break;
404 // stops
405 case SUMO_TAG_STOP:
406 if (buildStop(obj,
407 obj->getPlanParameters(),
408 obj->getStopParameter())) {
409 obj->markAsCreated();
410 }
411 break;
412 default:
413 break;
414 }
415 // now iterate over childrens
416 for (const auto& child : obj->getSumoBaseObjectChildren()) {
417 // call this function recursively
418 parseSumoBaseObject(child);
419 }
420}
421
422
423void
425 // parse vehicleType
427 if (vehicleTypeParameter) {
428 // set tag
430 // add all attributes
432 // delete vehicleType parameter (because in XMLStructure we have a copy)
433 delete vehicleTypeParameter;
434 } else {
436 }
437}
438
439
440void
442 // declare Ok Flag
443 bool parsedOk = true;
444 // needed attributes
445 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
446 // optional attributes
447 const int deterministic = attrs.getOpt<int>(SUMO_ATTR_DETERMINISTIC, id.c_str(), parsedOk, -1);
448 const std::vector<std::string> vTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, id.c_str(), parsedOk);
449 const std::vector<double> probabilities = attrs.getOpt<std::vector<double> >(SUMO_ATTR_PROBS, id.c_str(), parsedOk);
450 // check distribution
451 if (vTypes.size() != probabilities.size()) {
453 }
454 if (parsedOk) {
455 // set tag
457 // add all attributes
462 } else {
464 }
465}
466
467
468void
470 // get embedded route flag
471 const bool embeddedRoute = isEmbeddedRoute(attrs);
472 // first check if this is an embedded route
473 if ((embeddedRoute && attrs.hasAttribute(SUMO_ATTR_ID)) || (!embeddedRoute && !attrs.hasAttribute(SUMO_ATTR_ID))) {
474 writeError(TL("a route must be defined either within a vehicle/flow or with an ID attribute"));
475 } else {
476 // declare Ok Flag
477 bool parsedOk = true;
478 // special case for ID
479 const std::string id = attrs.getOpt<std::string>(SUMO_ATTR_ID, "", parsedOk, "");
480 // needed attributes
481 const std::vector<std::string> edges = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), parsedOk);
482 // optional attributes
484 const RGBColor color = attrs.getOpt<RGBColor>(SUMO_ATTR_COLOR, id.c_str(), parsedOk, RGBColor::INVISIBLE);
485 const int repeat = attrs.getOpt<int>(SUMO_ATTR_REPEAT, id.c_str(), parsedOk, 0);
486 const SUMOTime cycleTime = attrs.getOptSUMOTimeReporting(SUMO_ATTR_CYCLETIME, id.c_str(), parsedOk, 0);
487 const double probability = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), parsedOk, 0);
488 // check attributes
489 if (!checkNegative(SUMO_TAG_ROUTE, id, SUMO_ATTR_CYCLETIME, cycleTime, true)) {
490 parsedOk = false;
491 }
492 if (parsedOk) {
493 // set tag
495 // add all attributes
503 } else {
505 }
506 }
507}
508
509
510void
512 // declare Ok Flag
513 bool parsedOk = true;
514 // needed attributes
515 const std::string id = attrs.get<std::string>(SUMO_ATTR_ID, "", parsedOk);
516 // optional attributes
517 const std::vector<std::string> routes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_ROUTES, id.c_str(), parsedOk);
518 const std::vector<double> probabilities = attrs.getOpt<std::vector<double> >(SUMO_ATTR_PROBS, id.c_str(), parsedOk);
519 // check distribution
520 if (routes.size() != probabilities.size()) {
522 }
523 if (parsedOk) {
524 // set tag
526 // add all attributes
530 } else {
532 }
533}
534
535
536void
538 // declare Ok Flag
539 bool parsedOk = true;
540 // parse vehicle
542 if (tripParameter) {
543 // check from/to edge/junction
545 writeError(TL("Attributes 'from', 'fromJunction' and 'fromTaz' cannot be defined together"));
548 writeError(TL("Attributes 'to', 'toJunction' and 'toTaz' cannot be defined together"));
551 // from-to attributes
552 const std::string fromJunction = attrs.get<std::string>(SUMO_ATTR_FROM_JUNCTION, tripParameter->id.c_str(), parsedOk);
553 const std::string toJunction = attrs.get<std::string>(SUMO_ATTR_TO_JUNCTION, tripParameter->id.c_str(), parsedOk);
554 if (parsedOk) {
555 // set tag
557 // set vehicle parameters
559 // add other attributes
562 } else {
564 }
565 } else if (attrs.hasAttribute(SUMO_ATTR_FROM_TAZ) && attrs.hasAttribute(SUMO_ATTR_TO_TAZ)) {
566 // from-to attributes
567 const std::string fromJunction = attrs.get<std::string>(SUMO_ATTR_FROM_TAZ, tripParameter->id.c_str(), parsedOk);
568 const std::string toJunction = attrs.get<std::string>(SUMO_ATTR_TO_TAZ, tripParameter->id.c_str(), parsedOk);
569 if (parsedOk) {
570 // set tag
572 // set vehicle parameters
574 // add other attributes
577 } else {
579 }
580 } else {
581 // from-to attributes
582 const std::string from = attrs.getOpt<std::string>(SUMO_ATTR_FROM, tripParameter->id.c_str(), parsedOk, "");
583 const std::string to = attrs.getOpt<std::string>(SUMO_ATTR_TO, tripParameter->id.c_str(), parsedOk, "");
584 // optional attributes
585 const std::vector<std::string> via = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VIA, tripParameter->id.c_str(), parsedOk);
586 if (parsedOk) {
587 // set tag
589 // set vehicle parameters
591 // add other attributes
595 } else {
597 }
598 }
599 // delete trip parameter (because in XMLStructure we have a copy)
600 delete tripParameter;
601 } else {
603 }
604}
605
606
607void
609 // first parse vehicle
611 if (vehicleParameter) {
612 // set tag
614 // set vehicle parameters
616 // delete vehicle parameter (because in XMLStructure we have a copy)
617 delete vehicleParameter;
618 } else {
620 }
621}
622
623
624void
626 // declare Ok Flag
627 bool parsedOk = true;
628 // first parse flow
630 if (flowParameter) {
631 // set vehicle parameters
633 // check from/to edge/junction
635 writeError(TL("Attributes 'from', 'fromJunction' and 'fromTaz' cannot be defined together"));
638 writeError(TL("Attributes 'to', 'toJunction' and 'toTaz' cannot be defined together"));
640 } else if (attrs.hasAttribute(SUMO_ATTR_FROM) && attrs.hasAttribute(SUMO_ATTR_TO)) {
641 // from-to attributes
642 const std::string from = attrs.get<std::string>(SUMO_ATTR_FROM, flowParameter->id.c_str(), parsedOk);
643 const std::string to = attrs.get<std::string>(SUMO_ATTR_TO, flowParameter->id.c_str(), parsedOk);
644 // optional attributes
645 const std::vector<std::string> via = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VIA, flowParameter->id.c_str(), parsedOk);
646 if (parsedOk) {
647 // set tag
649 // add other attributes
653 } else {
655 }
657 // from-to attributes
658 const std::string fromJunction = attrs.get<std::string>(SUMO_ATTR_FROM_JUNCTION, flowParameter->id.c_str(), parsedOk);
659 const std::string toJunction = attrs.get<std::string>(SUMO_ATTR_TO_JUNCTION, flowParameter->id.c_str(), parsedOk);
660 if (parsedOk) {
661 // set tag
663 // add other attributes
666 } else {
668 }
669 } else if (attrs.hasAttribute(SUMO_ATTR_FROM_TAZ) && attrs.hasAttribute(SUMO_ATTR_TO_TAZ)) {
670 // from-to attributes
671 const std::string fromJunction = attrs.get<std::string>(SUMO_ATTR_FROM_TAZ, flowParameter->id.c_str(), parsedOk);
672 const std::string toJunction = attrs.get<std::string>(SUMO_ATTR_TO_TAZ, flowParameter->id.c_str(), parsedOk);
673 if (parsedOk) {
674 // set tag
676 // add other attributes
679 } else {
681 }
682 } else if (attrs.hasAttribute(SUMO_ATTR_ROUTE)) {
683 // from-to attributes
684 const std::string route = attrs.get<std::string>(SUMO_ATTR_ROUTE, flowParameter->id.c_str(), parsedOk);
685 if (parsedOk) {
686 // set tag
688 // add other attributes
690 } else {
692 }
693 } else {
694 // set tag
696 }
697 // delete flow parameter (because in XMLStructure we have a copy)
698 delete flowParameter;
699 } else {
701 }
702}
703
704
705void
707 // declare Ok Flag
708 bool parsedOk = true;
709 // declare stop
711 // plan parameters
712 const auto planParameters = CommonXMLStructure::PlanParameters(myCommonXMLStructure.getCurrentSumoBaseObject(), attrs, parsedOk);
713 // get parents
714 std::vector<SumoXMLTag> stopParents;
715 stopParents.insert(stopParents.end(), NamespaceIDs::routes.begin(), NamespaceIDs::routes.end());
716 stopParents.insert(stopParents.end(), NamespaceIDs::vehicles.begin(), NamespaceIDs::vehicles.end());
717 stopParents.insert(stopParents.end(), NamespaceIDs::persons.begin(), NamespaceIDs::persons.end());
718 stopParents.insert(stopParents.end(), NamespaceIDs::containers.begin(), NamespaceIDs::containers.end());
719 // check parents
720 checkParsedParent(SUMO_TAG_STOP, stopParents, parsedOk);
721 // parse stop
722 if (parsedOk && parseStopParameters(stop, attrs)) {
723 // set tag
725 // add stop attributes
728 } else {
730 }
731}
732
733
734void
736 // first parse vehicle
738 if (personParameter) {
739 // set tag
741 // set vehicle parameter
743 // delete person parameter (because in XMLStructure we have a copy)
744 delete personParameter;
745 } else {
747 }
748}
749
750
751void
753 // first parse flow
755 if (personFlowParameter) {
756 // set tag
758 // set vehicle parameter
760 // delete person flow parameter (because in XMLStructure we have a copy)
761 delete personFlowParameter;
762 } else {
764 }
765}
766
767
768void
770 // declare Ok Flag
771 bool parsedOk = true;
772 // plan parameters
773 const auto planParameters = CommonXMLStructure::PlanParameters(myCommonXMLStructure.getCurrentSumoBaseObject(), attrs, parsedOk);
774 // optional attributes
775 const std::vector<std::string> via = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VIA, "", parsedOk);
776 const std::vector<std::string> vTypes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_VTYPES, "", parsedOk);
777 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, "", parsedOk);
778 std::vector<std::string> modes = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_MODES, "", parsedOk);
779 const double departPos = attrs.getOpt<double>(SUMO_ATTR_DEPARTPOS, "", parsedOk, -1);
780 const double arrivalPos = attrs.getOpt<double>(SUMO_ATTR_ARRIVALPOS, "", parsedOk, -1);
781 const double walkFactor = attrs.getOpt<double>(SUMO_ATTR_WALKFACTOR, "", parsedOk, 0);
782 const std::string group = attrs.getOpt<std::string>(SUMO_ATTR_GROUP, "", parsedOk, "");
783 // check modes
784 SVCPermissions dummyModeSet;
785 std::string dummyError;
786 if (!SUMOVehicleParameter::parsePersonModes(toString(modes), toString(SUMO_TAG_PERSONTRIP), "", dummyModeSet, dummyError)) {
787 WRITE_WARNING(dummyError);
788 modes.clear();
789 }
790 // check parents
792 if (parsedOk) {
793 // set tag
795 // add all attributes
804 } else {
806 }
807}
808
809
810void
813 writeError(TL("Speed and duration attributes cannot be defined together in walks"));
815 } else {
816 // declare Ok Flag
817 bool parsedOk = true;
818 // plan parameters
819 const auto planParameters = CommonXMLStructure::PlanParameters(myCommonXMLStructure.getCurrentSumoBaseObject(), attrs, parsedOk);
820 // optional attributes
821 const double departPos = attrs.getOpt<double>(SUMO_ATTR_DEPARTPOS, "", parsedOk, -1);
822 const double arrivalPos = attrs.getOpt<double>(SUMO_ATTR_ARRIVALPOS, "", parsedOk, -1);
823 const double speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, "", parsedOk, 1.39);
824 const SUMOTime duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, "", parsedOk, 0);
825 // check parents
827 if (parsedOk) {
828 // set tag
830 // add all attributes
836 } else {
838 }
839 }
840}
841
842
843void
845 // declare Ok Flag
846 bool parsedOk = true;
847 // plan parameters
848 const auto planParameters = CommonXMLStructure::PlanParameters(myCommonXMLStructure.getCurrentSumoBaseObject(), attrs, parsedOk);
849 // optional attributes
850 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, "", parsedOk);
851 const double arrivalPos = attrs.getOpt<double>(SUMO_ATTR_ARRIVALPOS, "", parsedOk, -1);
852 const std::string group = attrs.getOpt<std::string>(SUMO_ATTR_GROUP, "", parsedOk, "");
853 // check parents
855 if (parsedOk) {
856 // set tag
858 // add all attributes
863 } else {
865 }
866}
867
868
869void
871 // first parse container
873 if (containerParameter) {
874 // set tag
876 // set vehicle parameter
878 // delete container parameter (because in XMLStructure we have a copy)
879 delete containerParameter;
880 } else {
882 }
883}
884
885
886void
888 // first parse flow
890 if (containerFlowParameter) {
891 // set tag
893 // set vehicle parameter
895 // delete container flow parameter (because in XMLStructure we have a copy)
896 delete containerFlowParameter;
897 } else {
899 }
900}
901
902
903void
905 // declare Ok Flag
906 bool parsedOk = true;
907 // plan parameters
908 const auto planParameters = CommonXMLStructure::PlanParameters(myCommonXMLStructure.getCurrentSumoBaseObject(), attrs, parsedOk);
909 // optional attributes
910 const std::vector<std::string> lines = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_LINES, "", parsedOk);
911 const double arrivalPos = attrs.getOpt<double>(SUMO_ATTR_ARRIVALPOS, "", parsedOk, -1);
912 const std::string group = attrs.getOpt<std::string>(SUMO_ATTR_GROUP, "", parsedOk, "");
913 // check parents
915 if (parsedOk) {
916 // set tag
918 // add all attributes
923 } else {
925 }
926}
927
928
929void
932 writeError(TL("Speed and duration attributes cannot be defined together in tranships"));
934 } else {
935 // declare Ok Flag
936 bool parsedOk = true;
937 // plan parameters
938 const auto planParameters = CommonXMLStructure::PlanParameters(myCommonXMLStructure.getCurrentSumoBaseObject(), attrs, parsedOk);
939 // optional attributes
940 const double arrivalPos = attrs.getOpt<double>(SUMO_ATTR_ARRIVALPOS, "", parsedOk, -1);
941 const double departPos = attrs.getOpt<double>(SUMO_ATTR_DEPARTPOS, "", parsedOk, -1);
942 const double speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, "", parsedOk, 1.39);
943 const SUMOTime duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, "", parsedOk, 0);
944 // check parents
946 if (parsedOk) {
947 // set tag
949 // add all attributes
955 } else {
957 }
958 }
959}
960
961
962void
964 // declare Ok Flag
965 bool parsedOk = true;
966 // just parse begin and end default
967 myFlowBeginDefault = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, parsedOk);
968 myFlowEndDefault = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, parsedOk);
969}
970
971
972bool
974 // write warning info
975 WRITE_WARNINGF(TL("Defining car-following parameters in a nested element is deprecated in vType '%', use attributes instead!"), vTypeObject->getStringAttribute(SUMO_ATTR_ID));
976 // get vType to modify it
977 auto vType = vTypeObject->getVehicleTypeParameter();
978 // parse nested CFM attributes
979 if (SUMOVehicleParserHelper::parseCFMParams(&vType, tag, attrs, true)) {
980 vTypeObject->setVehicleTypeParameter(&vType);
981 return true;
982 } else if (myHardFail) {
983 throw ProcessError(TL("Invalid parsing embedded VType"));
984 } else {
985 return writeError(TL("Invalid parsing embedded VType"));
986 }
987 return false;
988}
989
990
991bool
993 // check stop parameters
994 if (attrs.hasAttribute(SUMO_ATTR_ARRIVAL)) {
996 }
997 if (attrs.hasAttribute(SUMO_ATTR_DURATION)) {
999 }
1000 if (attrs.hasAttribute(SUMO_ATTR_UNTIL)) {
1002 }
1003 if (attrs.hasAttribute(SUMO_ATTR_STARTED)) {
1005 }
1006 if (attrs.hasAttribute(SUMO_ATTR_ENDED)) {
1008 }
1009 if (attrs.hasAttribute(SUMO_ATTR_EXTENSION)) {
1011 }
1012 if (attrs.hasAttribute(SUMO_ATTR_ENDPOS)) {
1014 }
1015 if (attrs.hasAttribute(SUMO_ATTR_STARTPOS)) {
1017 }
1020 }
1021 if (attrs.hasAttribute(SUMO_ATTR_TRIGGERED)) {
1023 }
1024 // legacy attribute
1027 }
1028 if (attrs.hasAttribute(SUMO_ATTR_PARKING)) {
1030 }
1031 if (attrs.hasAttribute(SUMO_ATTR_EXPECTED)) {
1033 }
1034 if (attrs.hasAttribute(SUMO_ATTR_PERMITTED)) {
1036 }
1039 }
1040 if (attrs.hasAttribute(SUMO_ATTR_TRIP_ID)) {
1042 }
1043 if (attrs.hasAttribute(SUMO_ATTR_SPLIT)) {
1045 }
1046 if (attrs.hasAttribute(SUMO_ATTR_JOIN)) {
1048 }
1049 if (attrs.hasAttribute(SUMO_ATTR_LINE)) {
1051 }
1052 if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
1054 }
1055 if (attrs.hasAttribute(SUMO_ATTR_ONDEMAND)) {
1057 }
1058 if (attrs.hasAttribute(SUMO_ATTR_JUMP)) {
1060 }
1061 // get parameters
1062 bool ok = true;
1063 // edge/lane
1064 stop.edge = attrs.getOpt<std::string>(SUMO_ATTR_EDGE, nullptr, ok, "");
1065 stop.lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, nullptr, ok, stop.busstop);
1066 // check errors
1067 if (!stop.edge.empty() && !stop.lane.empty()) {
1068 return writeError(TL("A stop must be defined either with an edge or with an lane, not both"));
1069 }
1070 // stopping places
1071 stop.busstop = attrs.getOpt<std::string>(SUMO_ATTR_BUS_STOP, nullptr, ok, "");
1072 if (stop.busstop.empty()) {
1073 stop.busstop = attrs.getOpt<std::string>(SUMO_ATTR_TRAIN_STOP, nullptr, ok, stop.busstop);
1074 }
1075 stop.chargingStation = attrs.getOpt<std::string>(SUMO_ATTR_CHARGING_STATION, nullptr, ok, "");
1076 stop.overheadWireSegment = attrs.getOpt<std::string>(SUMO_ATTR_OVERHEAD_WIRE_SEGMENT, nullptr, ok, "");
1077 stop.containerstop = attrs.getOpt<std::string>(SUMO_ATTR_CONTAINER_STOP, nullptr, ok, "");
1078 stop.parkingarea = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, nullptr, ok, "");
1079 //check stopping places
1080 const int numStoppingPlaces = !stop.busstop.empty() + !stop.chargingStation.empty() + !stop.overheadWireSegment.empty() +
1081 !stop.containerstop.empty() + !stop.parkingarea.empty();
1082 if (numStoppingPlaces > 1) {
1083 return writeError(TL("A stop must be defined only in a StoppingPlace"));
1084 } else if ((numStoppingPlaces == 0) && stop.edge.empty() && stop.lane.empty()) {
1085 return writeError(TL("A stop must be defined in an edge, a lane, or in a StoppingPlace"));
1086 }
1087 // declare error suffix
1088 std::string errorSuffix;
1089 if (stop.busstop != "") {
1090 errorSuffix = " at '" + stop.busstop + "'" + errorSuffix;
1091 } else if (stop.chargingStation != "") {
1092 errorSuffix = " at '" + stop.chargingStation + "'" + errorSuffix;
1093 } else if (stop.overheadWireSegment != "") {
1094 errorSuffix = " at '" + stop.overheadWireSegment + "'" + errorSuffix;
1095 } else if (stop.containerstop != "") {
1096 errorSuffix = " at '" + stop.containerstop + "'" + errorSuffix;
1097 } else if (stop.parkingarea != "") {
1098 errorSuffix = " at '" + stop.parkingarea + "'" + errorSuffix;
1099 } else if (stop.edge != "") {
1100 errorSuffix = " at '" + stop.edge + "'" + errorSuffix;
1101 } else {
1102 errorSuffix = " on lane '" + stop.lane + "'" + errorSuffix;
1103 }
1104 // speed for counting as stopped
1105 stop.speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, nullptr, ok, 0);
1106 if (stop.speed < 0) {
1107 return writeError("Speed cannot be negative for stop" + errorSuffix);
1108 return false;
1109 }
1110 // get the standing duration
1111 bool expectTrigger = !attrs.hasAttribute(SUMO_ATTR_DURATION) && !attrs.hasAttribute(SUMO_ATTR_UNTIL) && !attrs.hasAttribute(SUMO_ATTR_SPEED);
1112 std::vector<std::string> triggers = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_TRIGGERED, nullptr, ok);
1113 // legacy
1114 if (attrs.getOpt<bool>(SUMO_ATTR_CONTAINER_TRIGGERED, nullptr, ok, false)) {
1115 triggers.push_back(toString(SUMO_TAG_CONTAINER));
1116 };
1117 SUMOVehicleParameter::parseStopTriggers(triggers, expectTrigger, stop);
1118 stop.startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, nullptr, ok, 0);
1119 stop.endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, nullptr, ok, 0);
1120 stop.friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, nullptr, ok, false);
1121 stop.arrival = attrs.getOptSUMOTimeReporting(SUMO_ATTR_ARRIVAL, nullptr, ok, -1);
1122 stop.duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, nullptr, ok, -1);
1123 stop.until = attrs.getOptSUMOTimeReporting(SUMO_ATTR_UNTIL, nullptr, ok, -1);
1124 if (!expectTrigger && (!ok || (stop.duration < 0 && stop.until < 0 && stop.speed == 0))) {
1125 return writeError("Invalid duration or end time is given for a stop" + errorSuffix);
1126 return false;
1127 }
1128 stop.extension = attrs.getOptSUMOTimeReporting(SUMO_ATTR_EXTENSION, nullptr, ok, -1);
1129 const bool defaultParking = (stop.triggered || stop.containerTriggered || stop.parkingarea != "");
1130 stop.parking = attrs.getOpt<ParkingType>(SUMO_ATTR_PARKING, nullptr, ok, defaultParking ? ParkingType::OFFROAD : ParkingType::ONROAD);
1131 if ((stop.parkingarea != "") && (stop.parking == ParkingType::ONROAD)) {
1132 WRITE_WARNING("Stop at parkingarea overrides attribute 'parking' for stop" + errorSuffix);
1134 }
1135 if (!ok) {
1136 return writeError("Invalid bool for 'triggered', 'containerTriggered' or 'parking' for stop" + errorSuffix);
1137 return false;
1138 }
1139 // expected persons
1140 const std::vector<std::string>& expected = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EXPECTED, nullptr, ok);
1141 stop.awaitedPersons.insert(expected.begin(), expected.end());
1142 if (stop.awaitedPersons.size() > 0 && (stop.parametersSet & STOP_TRIGGER_SET) == 0) {
1143 stop.triggered = true;
1144 if ((stop.parametersSet & STOP_PARKING_SET) == 0) {
1146 }
1147 }
1148 // permitted transportables
1149 const std::vector<std::string>& permitted = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_PERMITTED, nullptr, ok);
1150 stop.permitted.insert(permitted.begin(), permitted.end());
1151 // expected containers
1152 const std::vector<std::string>& expectedContainers = attrs.getOpt<std::vector<std::string> >(SUMO_ATTR_EXPECTED_CONTAINERS, nullptr, ok);
1153 stop.awaitedContainers.insert(expectedContainers.begin(), expectedContainers.end());
1154 if (stop.awaitedContainers.size() > 0 && (stop.parametersSet & STOP_CONTAINER_TRIGGER_SET) == 0) {
1155 stop.containerTriggered = true;
1156 if ((stop.parametersSet & STOP_PARKING_SET) == 0) {
1158 }
1159 }
1160 // public transport trip id
1161 stop.tripId = attrs.getOpt<std::string>(SUMO_ATTR_TRIP_ID, nullptr, ok, "");
1162 stop.split = attrs.getOpt<std::string>(SUMO_ATTR_SPLIT, nullptr, ok, "");
1163 stop.join = attrs.getOpt<std::string>(SUMO_ATTR_JOIN, nullptr, ok, "");
1164 stop.line = attrs.getOpt<std::string>(SUMO_ATTR_LINE, nullptr, ok, "");
1165 // index
1166 const std::string idx = attrs.getOpt<std::string>(SUMO_ATTR_INDEX, nullptr, ok, "end");
1167 if (idx == "end") {
1168 stop.index = STOP_INDEX_END;
1169 } else if (idx == "fit") {
1170 stop.index = STOP_INDEX_FIT;
1171 } else {
1172 stop.index = attrs.get<int>(SUMO_ATTR_INDEX, nullptr, ok);
1173 if (!ok || stop.index < 0) {
1174 return writeError("Invalid 'index' for stop" + errorSuffix);
1175 return false;
1176 }
1177 }
1178 stop.started = attrs.getOptSUMOTimeReporting(SUMO_ATTR_STARTED, nullptr, ok, -1);
1179 stop.ended = attrs.getOptSUMOTimeReporting(SUMO_ATTR_ENDED, nullptr, ok, -1);
1180 stop.posLat = attrs.getOpt<double>(SUMO_ATTR_POSITION_LAT, nullptr, ok, INVALID_DOUBLE);
1181 stop.actType = attrs.getOpt<std::string>(SUMO_ATTR_ACTTYPE, nullptr, ok, "");
1182 stop.onDemand = attrs.getOpt<bool>(SUMO_ATTR_ONDEMAND, nullptr, ok, false);
1183 stop.jump = attrs.getOptSUMOTimeReporting(SUMO_ATTR_JUMP, nullptr, ok, -1);
1184 return true;
1185}
1186
1187
1188bool
1190 // check conditions
1191 if (attrs.hasAttribute(SUMO_ATTR_ID)) {
1192 return false;
1194 return false;
1196 return false;
1198 return true;
1200 return true;
1201 } else {
1202 return false;
1203 }
1204}
1205
1206/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:296
#define WRITE_ERROR(msg)
Definition MsgHandler.h:304
#define WRITE_WARNING(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:315
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
const int STOP_ARRIVAL_SET
const int STOP_DURATION_SET
const int STOP_INDEX_END
const int STOP_POSLAT_SET
const int STOP_EXPECTED_SET
const int STOP_SPEED_SET
const int STOP_UNTIL_SET
const int STOP_LINE_SET
const int STOP_PARKING_SET
const int STOP_TRIP_ID_SET
const int STOP_PERMITTED_SET
const int STOP_SPLIT_SET
const int STOP_START_SET
const int STOP_JOIN_SET
const int STOP_CONTAINER_TRIGGER_SET
const int STOP_EXTENSION_SET
const int STOP_INDEX_FIT
const int STOP_ENDED_SET
const int STOP_TRIGGER_SET
const int STOP_JUMP_SET
const int STOP_ONDEMAND_SET
const int STOP_END_SET
const int STOP_STARTED_SET
const int STOP_EXPECTED_CONTAINERS_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_WALK
@ SUMO_TAG_NOTHING
invalid tag, must be the last one
@ SUMO_TAG_TRANSHIP
@ SUMO_TAG_CONTAINERFLOW
@ SUMO_TAG_STOP
stop for vehicles
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_TRANSPORT
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_RIDE
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONTRIP
@ SUMO_TAG_PERSONFLOW
@ SUMO_TAG_TRIP
a single trip definition (used by router)
ParkingType
Numbers representing special SUMO-XML-attribute values Information on whether a car is parking on the...
@ SUMO_ATTR_CONTAINER_TRIGGERED
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_LINES
@ SUMO_ATTR_LANE
@ SUMO_ATTR_FROM_JUNCTION
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_STARTED
@ SUMO_ATTR_VIA
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_TRAIN_STOP
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_TO_JUNCTION
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_SPLIT
@ SUMO_ATTR_ACTTYPE
@ SUMO_ATTR_PROBS
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_ROUTES
@ SUMO_ATTR_MODES
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_OVERHEAD_WIRE_SEGMENT
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_GROUP
@ SUMO_ATTR_ENDED
@ SUMO_ATTR_ONDEMAND
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ARRIVAL
@ SUMO_ATTR_TO_TAZ
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_PERMITTED
@ SUMO_ATTR_FROM_TAZ
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_JUMP
@ SUMO_ATTR_PROB
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_WALKFACTOR
@ SUMO_ATTR_DETERMINISTIC
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_ROUTE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
@ SUMO_ATTR_REPEAT
@ SUMO_ATTR_CYCLETIME
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
bool writeErrorInvalidDistribution(const SumoXMLTag tag, const std::string &id)
write error "invalid distribution"
void checkParsedParent(const SumoXMLTag currentTag, const std::vector< SumoXMLTag > &parentTags, bool &ok)
bool writeError(const std::string &error)
write error and enable error creating element
void parseParameters(const SUMOSAXAttributes &attrs)
parse generic parameters
CommonXMLStructure myCommonXMLStructure
common XML Structure
bool checkNegative(const SumoXMLTag tag, const std::string &id, const SumoXMLAttr attribute, const int value, const bool canBeZero)
check if the given int value is NOT negative
plan parameters (used for group all from-to parameters related with plans)
void addDoubleListAttribute(const SumoXMLAttr attr, const std::vector< double > &value)
add double list attribute into current SumoBaseObject node
const std::vector< double > & getDoubleListAttribute(const SumoXMLAttr attr) const
get double list attribute
void addIntAttribute(const SumoXMLAttr attr, const int value)
add int attribute into current SumoBaseObject node
void setVehicleTypeParameter(const SUMOVTypeParameter *vehicleTypeParameter)
set vehicle type parameters
const SUMOVehicleParameter::Stop & getStopParameter() const
get stop parameters
const RGBColor & getColorAttribute(const SumoXMLAttr attr) const
get color attribute
SUMOTime getTimeAttribute(const SumoXMLAttr attr) const
get time 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 CommonXMLStructure::PlanParameters & getPlanParameters() const
get plan parameteres
const std::map< std::string, std::string > & getParameters() const
get parameters
SUMOVehicleClass getVClass() const
vehicle class
void setPlanParameters(const CommonXMLStructure::PlanParameters &planParameters)
set plan parmeter
const SUMOVTypeParameter & getVehicleTypeParameter() const
get current vType
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
void setVClass(SUMOVehicleClass vClass)
set vehicle class
void setVehicleParameter(const SUMOVehicleParameter *vehicleParameter)
set vehicle parameters
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
void setStopParameter(const SUMOVehicleParameter::Stop &stopParameter)
add stop parameters
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
static const std::vector< SumoXMLTag > vehicles
vehicles namespace
static const std::vector< SumoXMLTag > routes
route namespace
static const std::vector< SumoXMLTag > persons
persons namespace
static const std::vector< SumoXMLTag > containers
containers namespace
A storage for options typed value containers)
Definition OptionsCont.h:89
static const RGBColor INVISIBLE
Definition RGBColor.h:195
void parseWalk(const SUMOSAXAttributes &attrs)
parse walk
virtual bool buildTranship(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPosition, const double departPosition, const double speed, const SUMOTime duration)=0
build tranship
void parseContainerFlow(const SUMOSAXAttributes &attrs)
parse container flow
void parseFlow(const SUMOSAXAttributes &attrs)
parse flow (including flows, flows over routes and flows with embedded routes)
bool parseNestedCFM(const SumoXMLTag tag, const SUMOSAXAttributes &attrs, CommonXMLStructure::SumoBaseObject *vTypeObject)
parse nested CarFollowingModel
bool beginParseAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs)
begin parse attributes
virtual bool buildEmbeddedRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::vector< std::string > &edgeIDs, const RGBColor &color, const int repeat, const SUMOTime cycleTime, const Parameterised::Map &routeParameters)=0
build embedded route
bool isEmbeddedRoute(const SUMOSAXAttributes &attrs) const
check embedded route
virtual bool buildFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromEdgeID, const std::string &toEdgeID)=0
build flow (from-to edges)
void parsePerson(const SUMOSAXAttributes &attrs)
parse person
virtual bool buildRouteDistribution(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::vector< std::string > &vTypeIDs, const std::vector< double > &probabilities)=0
build route distribution
void parseTransport(const SUMOSAXAttributes &attrs)
parse transport
void endParseAttributes()
end parse attributes
virtual bool buildPerson(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &personParameters)=0
build person
virtual bool buildPersonFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &personFlowParameters)=0
build person flow
virtual bool buildContainer(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &containerParameters)=0
build container
virtual bool buildVTypeDistribution(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const int deterministic, const std::vector< std::string > &vTypeIDs, const std::vector< double > &probabilities)=0
build vType distribution
virtual bool buildWalk(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const double speed, const SUMOTime duration)=0
build walk
void parseVTypeDistribution(const SUMOSAXAttributes &attrs)
parse vType distribution
virtual bool buildRide(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group)=0
build ride
const std::string myFilename
filename (needed for parsing vTypes)
virtual bool buildFlowOverRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters)=0
build a flow over an existent route
void parseStop(const SUMOSAXAttributes &attrs)
parse stop
void parseContainer(const SUMOSAXAttributes &attrs)
parse container
RouteHandler(const std::string &filename, const bool hardFail)
Constructor.
void parsePersonTrip(const SUMOSAXAttributes &attrs)
parse person trip
void parseRoute(const SUMOSAXAttributes &attrs)
parse route
void parseTrip(const SUMOSAXAttributes &attrs)
parse trip
SUMOTime myFlowEndDefault
The default value for flow ends.
virtual ~RouteHandler()
Destructor.
virtual bool buildTripTAZs(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromTazID, const std::string &toTazID)=0
build trip (from-to TAZs)
void parseSumoBaseObject(CommonXMLStructure::SumoBaseObject *obj)
parse SumoBaseObject (it's called recursivelly)
void parsePersonFlow(const SUMOSAXAttributes &attrs)
parse person flow
void parseInterval(const SUMOSAXAttributes &attrs)
parse interval
virtual bool buildPersonTrip(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &types, const std::vector< std::string > &modes, const std::vector< std::string > &lines, const double walkFactor, const std::string &group)=0
build person trip
void parseVType(const SUMOSAXAttributes &attrs)
void parseRide(const SUMOSAXAttributes &attrs)
parse ride
virtual bool buildFlowJunctions(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromJunctionID, const std::string &toJunctionID)=0
build flow (from-to junctions)
virtual bool buildVType(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVTypeParameter &vTypeParameter)=0
build vType
virtual bool buildFlowTAZs(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromTAZID, const std::string &toTAZID)=0
build flow (from-to TAZs)
SUMOTime myFlowBeginDefault
The default value for flow begins.
virtual bool buildRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, SUMOVehicleClass vClass, const std::vector< std::string > &edgeIDs, const RGBColor &color, const int repeat, const SUMOTime cycleTime, const double probability, const Parameterised::Map &routeParameters)=0
build route
void parseVehicle(const SUMOSAXAttributes &attrs)
parse vehicle (including vehicles over routes and vehicles with embedded routes)
virtual bool buildStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const SUMOVehicleParameter::Stop &stopParameters)=0
build stop
virtual bool buildTrip(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromEdgeID, const std::string &toEdgeID)=0
build trip (from-to edges)
virtual bool buildContainerFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &containerFlowParameters)=0
build container flow
virtual bool buildVehicleOverRoute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters)=0
build a vehicle over an existent route
bool parseStopParameters(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs)
parse stop parameters
virtual bool buildTripJunctions(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameters, const std::string &fromJunctionID, const std::string &toJunctionID)=0
build trip (from-to junctions)
const bool myHardFail
enable or disable hardFail (stop parsing if parameter aren't correct)
virtual bool buildTransport(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const CommonXMLStructure::PlanParameters &planParameters, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group)=0
build transport
void parseRouteDistribution(const SUMOSAXAttributes &attrs)
parse route distribution
void parseTranship(const SUMOSAXAttributes &attrs)
parse tranship
Encapsulated SAX-Attributes.
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.
Definition of vehicle stop (position and duration)
SUMOTime started
the time at which this stop was reached
std::string edge
The edge to stop at.
ParkingType parking
whether the vehicle is removed from the net while stopping
std::string lane
The lane to stop at.
SUMOTime extension
The maximum time extension for boarding / loading.
bool friendlyPos
enable or disable friendly position (used by netedit)
double speed
the speed at which this stop counts as reached (waypoint mode)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
double startPos
The stopping position start.
std::string line
the new line id of the trip within a cyclical public transport route
double posLat
the lateral offset when stopping
bool onDemand
whether the stop may be skipped
std::string chargingStation
(Optional) charging station if one is assigned to the stop
std::string overheadWireSegment
(Optional) overhead line segment if one is assigned to the stop
std::set< std::string > permitted
IDs of persons or containers that may board/load at this stop.
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
SUMOTime jump
transfer time if there shall be a jump from this stop to the next route edge
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
SUMOTime until
The time at which the vehicle may continue its journey.
std::string actType
act Type (only used by Persons) (used by netedit)
bool triggered
whether an arriving person lets the vehicle continue
SUMOTime ended
the time at which this stop was ended
double endPos
The stopping position end.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
std::string busstop
(Optional) bus stop if one is assigned to the stop
std::string tripId
id of the trip within a cyclical public transport route
std::string containerstop
(Optional) container stop if one is assigned to the stop
bool containerTriggered
whether an arriving container lets the vehicle continue
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
Structure representing possible vehicle parameter.
std::string id
The vehicle's id.
static bool parsePersonModes(const std::string &modes, const std::string &element, const std::string &id, SVCPermissions &modeSet, std::string &error)
Validates a given person modes value.
static void parseStopTriggers(const std::vector< std::string > &triggers, bool expectTrigger, Stop &stop)
parses stop trigger values
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const bool hardFail, const std::string &file)
Starts to parse a vehicle type.
static bool parseCFMParams(SUMOVTypeParameter *into, const SumoXMLTag element, const SUMOSAXAttributes &attrs, const bool nestedCFM)
Parses Car Following Mode params.
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 SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
static SUMOVehicleParameter * parseFlowAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs, const bool hardFail, const bool needID, const SUMOTime beginDefault, const SUMOTime endDefault, const bool allowInternalRoutes=false)
Parses a flow's attributes.