Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNECalibratorFlow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18//
19/****************************************************************************/
20#include <config.h>
21
23
25#include <netedit/GNENet.h>
31
32#include "GNECalibratorFlow.h"
33
34// ===========================================================================
35// member method definitions
36// ===========================================================================
37
38#ifdef _MSC_VER
39#pragma warning(push)
40#pragma warning(disable: 4355) // mask warning about "this" in initializers
41#endif
45 // set VPH and speed enabled
48 // reset ID
49 id.clear();
50}
51
52
53GNECalibratorFlow::GNECalibratorFlow(GNEAdditional* calibratorParent, const SUMOTime begin, const SUMOTime end,
54 GNEDemandElement* vehicleType, GNEDemandElement* route) :
55 GNEAdditional(calibratorParent, GNE_TAG_CALIBRATOR_FLOW, ""),
57 // set parents
58 setParents<GNEAdditional*>({calibratorParent, nullptr});
59 setParents<GNEDemandElement*>({vehicleType, route});
60 // update centering boundary without updating grid
62 // reset ID
63 id.clear();
64 // set begin and end
65 depart = begin;
66 repetitionEnd = end;
67 // set default vehsperhour
69}
70
71
73 const SUMOVehicleParameter& vehicleParameters) :
74 GNEAdditional(calibratorParent, GNE_TAG_CALIBRATOR_FLOW, ""),
75 SUMOVehicleParameter(vehicleParameters),
77 // set parents
78 setParents<GNEAdditional*>({calibratorParent, nullptr});
79 setParents<GNEDemandElement*>({vehicleType, route});
80 // update centering boundary without updating grid
82 // reset ID
83 id.clear();
84}
85#ifdef _MSC_VER
86#pragma warning(pop)
87#endif
88
89
91
92
95 return nullptr;
96}
97
98
101 return this;
102}
103
104
105const Parameterised*
107 return this;
108}
109
110
111void
114 // open tag
115 device.openTag(SUMO_TAG_FLOW);
116 // write vehicle attributes
118 // write end
120 // write route
122 // write route probe
123 if (getParentAdditionals().at(1)) {
125 }
126 // write parameters
127 XMLHelpers::writeParams(device, *this);
128 // close vehicle tag
129 device.closeTag();
130 } else {
131 WRITE_WARNING(TLF("calibratorFlow of calibrator '%' cannot be written. Either type or vehsPerHour or speed must be enabled", getParentAdditionals().front()->getID()));
132 }
133}
134
135
136bool
138 return true;
139}
140
141
142std::string
144 return "";
145}
146
147
148void
150 // nothing to fix
151}
152
153
154bool
156 return false;
157}
158
159
160void
164
165
170
171
172void
174 // nothing to update
175}
176
177
178void
179GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
180 // geometry of this element cannot be splitted
181}
182
183
184std::string
186 return getParentAdditionals().at(0)->getID();
187}
188
189
190void
192 // draw closing reroute as listed attribute
194 "Flow: " + getID());
195}
196
197
198std::string
200 switch (key) {
201 case SUMO_ATTR_ID:
202 return getMicrosimID();
203 case SUMO_ATTR_TYPE:
204 return vtypeid;
205 case SUMO_ATTR_ROUTE:
206 return getParentDemandElements().at(1)->getID();
208 if (getParentAdditionals().at(1)) {
209 return getParentAdditionals().at(1)->getID();
210 } else {
211 return "";
212 }
215 return toString(3600 / STEPS2TIME(repetitionOffset));
216 } else {
217 return "";
218 }
219 case SUMO_ATTR_SPEED:
222 } else {
223 return "";
224 }
225 case SUMO_ATTR_COLOR:
227 return toString(color);
228 } else {
230 }
231 case SUMO_ATTR_BEGIN:
232 return time2string(depart);
233 case SUMO_ATTR_END:
237 return getDepartLane();
238 } else {
240 }
243 return getDepartPos();
244 } else {
246 }
249 return getDepartSpeed();
250 } else {
252 }
255 return getArrivalLane();
256 } else {
258 }
261 return getArrivalPos();
262 } else {
264 }
267 return getArrivalSpeed();
268 } else {
270 }
271 case SUMO_ATTR_LINE:
273 return line;
274 } else {
276 }
279 return toString(personNumber);
280 } else {
282 }
286 } else {
288 }
291 return "true";
292 } else {
293 return "false";
294 }
297 return getDepartPosLat();
298 } else {
300 }
303 return getArrivalPosLat();
304 } else {
306 }
308 return getInsertionChecks();
309 case GNE_ATTR_PARENT:
310 return getParentAdditionals().at(0)->getID();
311 default:
312 return getCommonAttribute(key);
313 }
314}
315
316
317double
319 switch (key) {
320 case SUMO_ATTR_DEPART:
321 case SUMO_ATTR_BEGIN:
322 case SUMO_ATTR_END:
323 return STEPS2TIME(depart);
325 // only return departPos it if is given
327 return departPos;
328 } else {
329 return 0;
330 }
332 // only return departPos it if is given
334 return arrivalPos;
335 } else {
336 return -1;
337 }
338 case SUMO_ATTR_WIDTH:
339 case SUMO_ATTR_LENGTH:
340 case SUMO_ATTR_MINGAP:
341 return getParentDemandElements().at(0)->getAttributeDouble(key);
342 default:
343 return getCommonAttributeDouble(key);
344 }
345}
346
347
352
353
358
359
360void
361GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
362 if (value == getAttribute(key)) {
363 return; //avoid needless changes, later logic relies on the fact that attributes have changed
364 }
365 switch (key) {
366 case SUMO_ATTR_ID:
367 case SUMO_ATTR_TYPE:
368 case SUMO_ATTR_ROUTE:
370 case SUMO_ATTR_COLOR:
372 case SUMO_ATTR_SPEED:
373 case SUMO_ATTR_BEGIN:
374 case SUMO_ATTR_END:
381 case SUMO_ATTR_LINE:
388 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
389 break;
390 default:
391 setCommonAttribute(key, value, undoList);
392 break;
393 }
394}
395
396
397bool
398GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
399 switch (key) {
400 case SUMO_ATTR_ID:
401 return isValidAdditionalID(value);
402 case SUMO_ATTR_TYPE:
403 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) == nullptr);
404 case SUMO_ATTR_ROUTE:
405 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::routes, value, false) == nullptr);
407 if (value.empty()) {
408 return true;
409 } else {
410 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
411 }
413 if (value.empty()) {
414 // speed and vehsPerHour cannot be empty at the same time
416 return false;
417 } else {
418 return true;
419 }
420 } else if (canParse<double>(value)) {
421 const double dVal = parse<double>(value);
422 return (dVal >= 0 || dVal == -1);
423 } else {
424 return false;
425 }
426 case SUMO_ATTR_SPEED:
427 if (value.empty()) {
428 // speed and vehsPerHour cannot be empty at the same time
430 return false;
431 } else {
432 return true;
433 }
434 } else if (canParse<double>(value)) {
435 const double dVal = parse<double>(value);
436 return (dVal >= 0 || dVal == -1);
437 } else {
438 return false;
439 }
440 case SUMO_ATTR_COLOR:
441 return canParse<RGBColor>(value);
442 case SUMO_ATTR_BEGIN:
443 return canParse<SUMOTime>(value);
444 case SUMO_ATTR_END:
445 return canParse<SUMOTime>(value);
447 if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
448 return true;
449 } else {
450 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
451 }
453 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
454 return true;
455 } else {
456 return canParse<double>(value);
457 }
459 if ((value == "random") || (value == "max")) {
460 return true;
461 } else {
462 return canParse<double>(value);
463 }
465 if (value == "current") {
466 return true;
467 } else {
468 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
469 }
471 if ((value == "random") || (value == "max")) {
472 return true;
473 } else {
474 return canParse<double>(value);
475 }
477 if (value == "current") {
478 return true;
479 } else {
480 return canParse<double>(value);
481 }
482 case SUMO_ATTR_LINE:
483 return true;
485 return canParse<int>(value) && parse<int>(value) >= 0;
487 return canParse<int>(value) && parse<int>(value) >= 0;
489 return canParse<bool>(value);
491 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
492 return true;
493 } else {
494 return canParse<double>(value);
495 }
497 if ((value == "left") || (value == "right") || (value == "center")) {
498 return true;
499 } else {
500 return canParse<double>(value);
501 }
503 return areInsertionChecksValid(value);
504 default:
505 return isCommonAttributeValid(key, value);
506 }
507}
508
509
510bool
512 switch (key) {
513 case SUMO_ATTR_TYPE:
514 return (parametersSet & VEHPARS_VTYPE_SET) != 0;
516 return (parametersSet & VEHPARS_VPH_SET) != 0;
517 case SUMO_ATTR_SPEED:
519 default:
520 return true;
521 }
522}
523
524
525std::string
527 return getTagStr();
528}
529
530
531std::string
535
536// ===========================================================================
537// private
538// ===========================================================================
539
540void
541GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
542 // declare string error
543 std::string error;
544 switch (key) {
545 case SUMO_ATTR_ID:
546 // update microsimID
547 setAdditionalID(value);
548 break;
549 case SUMO_ATTR_TYPE:
550 if (!isTemplate()) {
551 if (value.empty()) {
553 } else {
555 }
556 }
557 // set manually vtypeID (needed for saving)
558 vtypeid = value;
559 break;
560 case SUMO_ATTR_ROUTE:
562 break;
564 if (!isTemplate()) {
566 }
567 break;
569 if (value.empty()) {
570 parametersSet &= ~VEHPARS_VPH_SET;
571 } else {
572 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
573 // set parameters
575 }
576 break;
577 case SUMO_ATTR_SPEED:
578 if (value.empty()) {
579 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
580 } else {
581 calibratorSpeed = parse<double>(value);
582 // mark parameter as set
584 }
585 break;
586 case SUMO_ATTR_COLOR:
587 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
588 color = parse<RGBColor>(value);
589 // mark parameter as set
591 } else {
592 // set default value
594 // unset parameter
595 parametersSet &= ~VEHPARS_COLOR_SET;
596 }
597 break;
598 case SUMO_ATTR_BEGIN:
599 depart = string2time(value);
600 break;
601 case SUMO_ATTR_END:
602 repetitionEnd = string2time(value);
603 break;
605 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
607 // mark parameter as set
609 } else {
610 // set default value
612 // unset parameter
613 parametersSet &= ~VEHPARS_DEPARTLANE_SET;
614 }
615 break;
617 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
619 // mark parameter as set
621 } else {
622 // set default value
624 // unset parameter
625 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
626 }
627 // update geometry (except for template)
628 if (getParentAdditionals().size() > 0) {
630 }
631 break;
633 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
635 // mark parameter as set
637 } else {
638 // set default value
640 // unset parameter
641 parametersSet &= ~VEHPARS_DEPARTSPEED_SET;
642 }
643 break;
645 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
647 // mark parameter as set
649 } else {
650 // set default value
652 // unset parameter
653 parametersSet &= ~VEHPARS_ARRIVALLANE_SET;
654 }
655 break;
657 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
659 // mark parameter as set
661 } else {
662 // set default value
664 // unset parameter
665 parametersSet &= ~VEHPARS_ARRIVALPOS_SET;
666 }
667 // update geometry (except for template)
668 if (getParentAdditionals().size() > 0) {
670 }
671 break;
673 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
675 // mark parameter as set
677 } else {
678 // set default value
680 // unset parameter
681 parametersSet &= ~VEHPARS_ARRIVALSPEED_SET;
682 }
683 break;
684 case SUMO_ATTR_LINE:
685 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
686 line = value;
687 // mark parameter as set
689 } else {
690 // set default value
692 // unset parameter
693 parametersSet &= ~VEHPARS_LINE_SET;
694 }
695 break;
697 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
698 personNumber = parse<int>(value);
699 // mark parameter as set
701 } else {
702 // set default value
704 // unset parameter
705 parametersSet &= ~VEHPARS_PERSON_NUMBER_SET;
706 }
707 break;
709 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
710 containerNumber = parse<int>(value);
711 // mark parameter as set
713 } else {
714 // set default value
716 // unset parameter
717 parametersSet &= ~VEHPARS_CONTAINER_NUMBER_SET;
718 }
719 break;
721 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
722 // mark parameter as set
724 } else {
725 // unset parameter
726 parametersSet &= ~VEHPARS_ROUTE_SET;
727 }
728 break;
730 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
732 // mark parameter as set
734 } else {
735 // set default value
737 // unset parameter
738 parametersSet &= ~VEHPARS_DEPARTPOSLAT_SET;
739 }
740 break;
742 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
744 // mark parameter as set
746 } else {
747 // set default value
749 // unset parameter
750 parametersSet &= ~VEHPARS_ARRIVALPOSLAT_SET;
751 }
753 break;
756 break;
757 default:
758 setCommonAttribute(key, value);
759 break;
760 }
761}
762
763
764void
766 switch (key) {
767 case SUMO_ATTR_TYPE:
768 if (value) {
770 } else {
771 parametersSet &= ~VEHPARS_VTYPE_SET;
772 }
773 break;
775 if (value) {
777 } else {
778 parametersSet &= ~VEHPARS_VPH_SET;
779 }
780 break;
781 case SUMO_ATTR_SPEED:
782 if (value) {
784 } else {
785 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
786 }
787 break;
788 default:
789 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
790 }
791}
792
793/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ VARIABLESPEEDSIGN_STEP
#define WRITE_WARNING(msg)
Definition MsgHandler.h:298
#define TLF(string,...)
Definition MsgHandler.h:318
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:47
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:107
#define STEPS2TIME(x)
Definition SUMOTime.h:58
constexpr SUMOTime TIME2STEPS(double x)
Definition SUMOTime.h:60
const std::string DEFAULT_VTYPE_ID
const long long int VEHPARS_ARRIVALSPEED_SET
const long long int VEHPARS_DEPARTPOSLAT_SET
const long long int VEHPARS_ARRIVALPOSLAT_SET
const long long int VEHPARS_PERSON_NUMBER_SET
const long long int VEHPARS_DEPARTSPEED_SET
@ GIVEN
The position is given.
const long long int VEHPARS_ROUTE_SET
const long long int VEHPARS_COLOR_SET
const long long int VEHPARS_ARRIVALLANE_SET
const long long int VEHPARS_DEPARTLANE_SET
const long long int VEHPARS_DEPARTPOS_SET
const long long int VEHPARS_ARRIVALPOS_SET
const long long int VEHPARS_CONTAINER_NUMBER_SET
const long long int VEHPARS_VTYPE_SET
const long long int VEHPARS_VPH_SET
@ GIVEN
The arrival position is given.
const long long int VEHPARS_CALIBRATORSPEED_SET
const long long int VEHPARS_LINE_SET
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_ROUTE
description of a route
@ GNE_TAG_CALIBRATOR_FLOW
a flow definition within in Calibrator
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_ARRIVALSPEED
@ SUMO_ATTR_ARRIVALLANE
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_DEPARTPOS_LAT
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_MINGAP
@ SUMO_ATTR_ROUTEPROBE
@ SUMO_ATTR_CONTAINER_NUMBER
@ SUMO_ATTR_LINE
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_REROUTE
@ SUMO_ATTR_DEPARTSPEED
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_DEPARTLANE
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_ROUTE
@ SUMO_ATTR_PERSON_NUMBER
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_ARRIVALPOS_LAT
@ SUMO_ATTR_INSERTIONCHECKS
@ SUMO_ATTR_WIDTH
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
void setAdditionalID(const std::string &newID)
set additional ID
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void drawListedAdditional(const GUIVisualizationSettings &s, const RGBColor baseCol, const RGBColor textCol, GUITexture texture, const std::string text) const
draw listed additional
Position getListedPositionInView() const
get listed position in view
void updateGeometryListedAdditional()
update geometry of listed additional
double getCommonAttributeDouble(SumoXMLAttr key) const
const std::string getID() const override
get ID (all Attribute Carriers have one)
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
Position getCommonAttributePosition(SumoXMLAttr key) const
GNENet * myNet
pointer to net
bool isCommonAttributeValid(SumoXMLAttr key, const std::string &value) const
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
bool isAttributeEnabled(SumoXMLAttr key) const override
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
GNECalibratorFlow(GNENet *net)
default constructor
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Position getAttributePosition(SumoXMLAttr key) const override
~GNECalibratorFlow()
destructor
void toggleAttribute(SumoXMLAttr key, const bool value) override
toggle attribute
bool checkDrawMoveContour() const override
check if draw move contour (red)
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Position getPositionInView() const override
Returns position of additional in view.
void updateGeometry() override
update pre-computed geometry information
double getAttributeDouble(SumoXMLAttr key) const override
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
bool isAdditionalValid() const override
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
bool isValid(SumoXMLAttr key, const std::string &value) override
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this calibratorFlow
std::string getParentName() const override
Returns the name of the parent object.
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Parameterised * getParameters() override
get parameters associated with this calibratorFlow
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEDemandElement * retrieveDemandElements(const std::vector< SumoXMLTag > types, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
const RGBColor & getDefaultColorValue(SumoXMLAttr attr) const
get default bool value
int getDefaultIntValue(SumoXMLAttr attr) const
get default int value
const std::string & getDefaultStringValue(SumoXMLAttr attr) const
default values
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Stores the information about how to visualize structures.
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static const std::vector< SumoXMLTag > types
type namespace
static const std::vector< SumoXMLTag > routes
route namespace
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
static const RGBColor BLACK
Definition RGBColor.h:212
Structure representing possible vehicle parameter.
double departPosLat
(optional) The lateral position the vehicle shall depart from
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
std::string vtypeid
The vehicle's type id.
std::string getDepartLane() const
obtain depart lane parameter in string format
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
bool wasSet(long long int what) const
Returns whether the given parameter was set.
std::string getDepartSpeed() const
obtain depart speed parameter in string format
std::string getArrivalPos() const
obtain arrival pos parameter in string format
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
RGBColor color
The vehicle's color, TraCI may change this.
bool areInsertionChecksValid(const std::string &value) const
check if given insertion checks are valid
double arrivalPos
(optional) The position the vehicle shall arrive on
static int parseInsertionChecks(const std::string &value)
parses insertion checks
double calibratorSpeed
speed (used by calibrator flows
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
std::string getInsertionChecks() const
get insertion checks in string format
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
std::string getDepartPos() const
obtain depart pos parameter in string format
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
int insertionChecks
bitset of InsertionCheck
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport)
int containerNumber
The static number of containers in the vehicle when it departs.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
static OutputDevice & writeParams(OutputDevice &device, const Parameterised &params)
write the parameters of the given object as param tags
static const RGBColor calibratorColor
color for Calibrators