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#include <netedit/GNENet.h>
29
30#include "GNECalibratorFlow.h"
31
32// ===========================================================================
33// member method definitions
34// ===========================================================================
35
36#ifdef _MSC_VER
37#pragma warning(push)
38#pragma warning(disable: 4355) // mask warning about "this" in initializers
39#endif
43 // set VPH and speed enabled
46 // reset ID
47 id.clear();
48}
49
50
51GNECalibratorFlow::GNECalibratorFlow(GNEAdditional* calibratorParent, const SUMOTime begin, const SUMOTime end,
52 GNEDemandElement* vehicleType, GNEDemandElement* route) :
53 GNEAdditional(calibratorParent, GNE_TAG_CALIBRATOR_FLOW, ""),
55 // set parents
56 setParents<GNEAdditional*>({calibratorParent, nullptr});
57 setParents<GNEDemandElement*>({vehicleType, route});
58 // update centering boundary without updating grid
60 // reset ID
61 id.clear();
62 // set begin and end
63 depart = begin;
64 repetitionEnd = end;
65 // set default vehsperhour
67}
68
69
71 const SUMOVehicleParameter& vehicleParameters) :
72 GNEAdditional(calibratorParent, GNE_TAG_CALIBRATOR_FLOW, ""),
73 SUMOVehicleParameter(vehicleParameters),
75 // set parents
76 setParents<GNEAdditional*>({calibratorParent, nullptr});
77 setParents<GNEDemandElement*>({vehicleType, route});
78 // update centering boundary without updating grid
80 // reset ID
81 id.clear();
82}
83#ifdef _MSC_VER
84#pragma warning(pop)
85#endif
86
87
89
90
93 return nullptr;
94}
95
96
99 return this;
100}
101
102
103const Parameterised*
105 return this;
106}
107
108
109void
112 // open tag
113 device.openTag(SUMO_TAG_FLOW);
114 // write vehicle attributes
116 // write end
118 // write route
120 // write route probe
121 if (getParentAdditionals().at(1)) {
123 }
124 // write parameters
126 // close vehicle tag
127 device.closeTag();
128 } else {
129 WRITE_WARNING(TLF("calibratorFlow of calibrator '%' cannot be written. Either type or vehsPerHour or speed must be enabled", getParentAdditionals().front()->getID()));
130 }
131}
132
133
134bool
136 return true;
137}
138
139
140std::string
142 return "";
143}
144
145
146void
148 // nothing to fix
149}
150
151
152bool
154 return false;
155}
156
157
158void
162
163
168
169
170void
172 // nothing to update
173}
174
175
176void
177GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
178 // geometry of this element cannot be splitted
179}
180
181
182std::string
184 return getParentAdditionals().at(0)->getID();
185}
186
187
188void
190 // draw closing reroute as listed attribute
192 "Flow: " + getID());
193}
194
195
196std::string
198 switch (key) {
199 case SUMO_ATTR_ID:
200 return getMicrosimID();
201 case SUMO_ATTR_TYPE:
202 return vtypeid;
203 case SUMO_ATTR_ROUTE:
204 return getParentDemandElements().at(1)->getID();
206 if (getParentAdditionals().at(1)) {
207 return getParentAdditionals().at(1)->getID();
208 } else {
209 return "";
210 }
213 return toString(3600 / STEPS2TIME(repetitionOffset));
214 } else {
215 return "";
216 }
217 case SUMO_ATTR_SPEED:
220 } else {
221 return "";
222 }
223 case SUMO_ATTR_COLOR:
225 return toString(color);
226 } else {
228 }
229 case SUMO_ATTR_BEGIN:
230 return time2string(depart);
231 case SUMO_ATTR_END:
235 return getDepartLane();
236 } else {
238 }
241 return getDepartPos();
242 } else {
244 }
247 return getDepartSpeed();
248 } else {
250 }
253 return getArrivalLane();
254 } else {
256 }
259 return getArrivalPos();
260 } else {
262 }
265 return getArrivalSpeed();
266 } else {
268 }
269 case SUMO_ATTR_LINE:
271 return line;
272 } else {
274 }
277 return toString(personNumber);
278 } else {
280 }
284 } else {
286 }
289 return "true";
290 } else {
291 return "false";
292 }
295 return getDepartPosLat();
296 } else {
298 }
301 return getArrivalPosLat();
302 } else {
304 }
306 return getInsertionChecks();
307 case GNE_ATTR_PARENT:
308 return getParentAdditionals().at(0)->getID();
309 default:
310 return getCommonAttribute(key);
311 }
312}
313
314
315double
317 switch (key) {
318 case SUMO_ATTR_DEPART:
319 case SUMO_ATTR_BEGIN:
320 case SUMO_ATTR_END:
321 return STEPS2TIME(depart);
323 // only return departPos it if is given
325 return departPos;
326 } else {
327 return 0;
328 }
330 // only return departPos it if is given
332 return arrivalPos;
333 } else {
334 return -1;
335 }
336 case SUMO_ATTR_WIDTH:
337 case SUMO_ATTR_LENGTH:
338 case SUMO_ATTR_MINGAP:
339 return getParentDemandElements().at(0)->getAttributeDouble(key);
340 default:
341 return getCommonAttributeDouble(key);
342 }
343}
344
345
350
351
356
357
358void
359GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
360 if (value == getAttribute(key)) {
361 return; //avoid needless changes, later logic relies on the fact that attributes have changed
362 }
363 switch (key) {
364 case SUMO_ATTR_ID:
365 case SUMO_ATTR_TYPE:
366 case SUMO_ATTR_ROUTE:
368 case SUMO_ATTR_COLOR:
370 case SUMO_ATTR_SPEED:
371 case SUMO_ATTR_BEGIN:
372 case SUMO_ATTR_END:
379 case SUMO_ATTR_LINE:
386 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
387 break;
388 default:
389 setCommonAttribute(key, value, undoList);
390 break;
391 }
392}
393
394
395bool
396GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
397 switch (key) {
398 case SUMO_ATTR_ID:
399 return isValidAdditionalID(value);
400 case SUMO_ATTR_TYPE:
401 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) == nullptr);
402 case SUMO_ATTR_ROUTE:
403 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::routes, value, false) == nullptr);
405 if (value.empty()) {
406 return true;
407 } else {
408 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, value, false) != nullptr);
409 }
411 if (value.empty()) {
412 // speed and vehsPerHour cannot be empty at the same time
414 return false;
415 } else {
416 return true;
417 }
418 } else if (canParse<double>(value)) {
419 const double dVal = parse<double>(value);
420 return (dVal >= 0 || dVal == -1);
421 } else {
422 return false;
423 }
424 case SUMO_ATTR_SPEED:
425 if (value.empty()) {
426 // speed and vehsPerHour cannot be empty at the same time
428 return false;
429 } else {
430 return true;
431 }
432 } else if (canParse<double>(value)) {
433 const double dVal = parse<double>(value);
434 return (dVal >= 0 || dVal == -1);
435 } else {
436 return false;
437 }
438 case SUMO_ATTR_COLOR:
439 return canParse<RGBColor>(value);
440 case SUMO_ATTR_BEGIN:
441 return canParse<SUMOTime>(value);
442 case SUMO_ATTR_END:
443 return canParse<SUMOTime>(value);
445 if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
446 return true;
447 } else {
448 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
449 }
451 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
452 return true;
453 } else {
454 return canParse<double>(value);
455 }
457 if ((value == "random") || (value == "max")) {
458 return true;
459 } else {
460 return canParse<double>(value);
461 }
463 if (value == "current") {
464 return true;
465 } else {
466 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
467 }
469 if ((value == "random") || (value == "max")) {
470 return true;
471 } else {
472 return canParse<double>(value);
473 }
475 if (value == "current") {
476 return true;
477 } else {
478 return canParse<double>(value);
479 }
480 case SUMO_ATTR_LINE:
481 return true;
483 return canParse<int>(value) && parse<int>(value) >= 0;
485 return canParse<int>(value) && parse<int>(value) >= 0;
487 return canParse<bool>(value);
489 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
490 return true;
491 } else {
492 return canParse<double>(value);
493 }
495 if ((value == "left") || (value == "right") || (value == "center")) {
496 return true;
497 } else {
498 return canParse<double>(value);
499 }
501 return areInsertionChecksValid(value);
502 default:
503 return isCommonAttributeValid(key, value);
504 }
505}
506
507
508bool
510 switch (key) {
511 case SUMO_ATTR_TYPE:
512 return (parametersSet & VEHPARS_VTYPE_SET) != 0;
514 return (parametersSet & VEHPARS_VPH_SET) != 0;
515 case SUMO_ATTR_SPEED:
517 default:
518 return true;
519 }
520}
521
522
523std::string
525 return getTagStr();
526}
527
528
529std::string
533
534// ===========================================================================
535// private
536// ===========================================================================
537
538void
539GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
540 // declare string error
541 std::string error;
542 switch (key) {
543 case SUMO_ATTR_ID:
544 // update microsimID
545 setAdditionalID(value);
546 break;
547 case SUMO_ATTR_TYPE:
548 if (!isTemplate()) {
549 if (value.empty()) {
551 } else {
553 }
554 }
555 // set manually vtypeID (needed for saving)
556 vtypeid = value;
557 break;
558 case SUMO_ATTR_ROUTE:
560 break;
562 if (!isTemplate()) {
564 }
565 break;
567 if (value.empty()) {
568 parametersSet &= ~VEHPARS_VPH_SET;
569 } else {
570 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
571 // set parameters
573 }
574 break;
575 case SUMO_ATTR_SPEED:
576 if (value.empty()) {
577 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
578 } else {
579 calibratorSpeed = parse<double>(value);
580 // mark parameter as set
582 }
583 break;
584 case SUMO_ATTR_COLOR:
585 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
586 color = parse<RGBColor>(value);
587 // mark parameter as set
589 } else {
590 // set default value
592 // unset parameter
593 parametersSet &= ~VEHPARS_COLOR_SET;
594 }
595 break;
596 case SUMO_ATTR_BEGIN:
597 depart = string2time(value);
598 break;
599 case SUMO_ATTR_END:
600 repetitionEnd = string2time(value);
601 break;
603 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
605 // mark parameter as set
607 } else {
608 // set default value
610 // unset parameter
611 parametersSet &= ~VEHPARS_DEPARTLANE_SET;
612 }
613 break;
615 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
617 // mark parameter as set
619 } else {
620 // set default value
622 // unset parameter
623 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
624 }
625 // update geometry (except for template)
626 if (getParentAdditionals().size() > 0) {
628 }
629 break;
631 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
633 // mark parameter as set
635 } else {
636 // set default value
638 // unset parameter
639 parametersSet &= ~VEHPARS_DEPARTSPEED_SET;
640 }
641 break;
643 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
645 // mark parameter as set
647 } else {
648 // set default value
650 // unset parameter
651 parametersSet &= ~VEHPARS_ARRIVALLANE_SET;
652 }
653 break;
655 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
657 // mark parameter as set
659 } else {
660 // set default value
662 // unset parameter
663 parametersSet &= ~VEHPARS_ARRIVALPOS_SET;
664 }
665 // update geometry (except for template)
666 if (getParentAdditionals().size() > 0) {
668 }
669 break;
671 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
673 // mark parameter as set
675 } else {
676 // set default value
678 // unset parameter
679 parametersSet &= ~VEHPARS_ARRIVALSPEED_SET;
680 }
681 break;
682 case SUMO_ATTR_LINE:
683 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
684 line = value;
685 // mark parameter as set
687 } else {
688 // set default value
690 // unset parameter
691 parametersSet &= ~VEHPARS_LINE_SET;
692 }
693 break;
695 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
696 personNumber = parse<int>(value);
697 // mark parameter as set
699 } else {
700 // set default value
702 // unset parameter
703 parametersSet &= ~VEHPARS_PERSON_NUMBER_SET;
704 }
705 break;
707 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
708 containerNumber = parse<int>(value);
709 // mark parameter as set
711 } else {
712 // set default value
714 // unset parameter
715 parametersSet &= ~VEHPARS_CONTAINER_NUMBER_SET;
716 }
717 break;
719 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
720 // mark parameter as set
722 } else {
723 // unset parameter
724 parametersSet &= ~VEHPARS_ROUTE_SET;
725 }
726 break;
728 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
730 // mark parameter as set
732 } else {
733 // set default value
735 // unset parameter
736 parametersSet &= ~VEHPARS_DEPARTPOSLAT_SET;
737 }
738 break;
740 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
742 // mark parameter as set
744 } else {
745 // set default value
747 // unset parameter
748 parametersSet &= ~VEHPARS_ARRIVALPOSLAT_SET;
749 }
751 break;
754 break;
755 default:
756 setCommonAttribute(key, value);
757 break;
758 }
759}
760
761
762void
764 switch (key) {
765 case SUMO_ATTR_TYPE:
766 if (value) {
768 } else {
769 parametersSet &= ~VEHPARS_VTYPE_SET;
770 }
771 break;
773 if (value) {
775 } else {
776 parametersSet &= ~VEHPARS_VPH_SET;
777 }
778 break;
779 case SUMO_ATTR_SPEED:
780 if (value) {
782 } else {
783 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
784 }
785 break;
786 default:
787 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
788 }
789}
790
791/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ VARIABLESPEEDSIGN_STEP
#define WRITE_WARNING(msg)
Definition MsgHandler.h:286
#define TLF(string,...)
Definition MsgHandler.h:306
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
#define STEPS2TIME(x)
Definition SUMOTime.h:58
#define TIME2STEPS(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:49
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.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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:206
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 const RGBColor calibratorColor
color for Calibrators