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 setParent<GNEAdditional*>(calibratorParent);
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#ifdef _MSC_VER
69#pragma warning(pop)
70#endif
71
72
74 const SUMOVehicleParameter& vehicleParameters) :
75 GNEAdditional(calibratorParent, GNE_TAG_CALIBRATOR_FLOW, ""),
76 SUMOVehicleParameter(vehicleParameters),
78 // set parents
79 setParent<GNEAdditional*>(calibratorParent);
80 setParents<GNEDemandElement*>({vehicleType, route});
81 // update centering boundary without updating grid
83 // reset ID
84 id.clear();
85}
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 parameters
122 // close vehicle tag
123 device.closeTag();
124 } else {
125 WRITE_WARNING(TLF("calibratorFlow of calibrator '%' cannot be written. Either type or vehsPerHour or speed must be enabled", getParentAdditionals().front()->getID()));
126 }
127}
128
129
130bool
132 return true;
133}
134
135
136std::string
138 return "";
139}
140
141
142void
144 // nothing to fix
145}
146
147
148bool
150 return false;
151}
152
153
154void
158
159
164
165
166void
168 // nothing to update
169}
170
171
172void
173GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
174 // geometry of this element cannot be splitted
175}
176
177
178std::string
180 return getParentAdditionals().at(0)->getID();
181}
182
183
184void
186 // draw closing reroute as listed attribute
188 "Flow: " + getID());
189}
190
191
192std::string
194 switch (key) {
195 case SUMO_ATTR_ID:
196 return getMicrosimID();
197 case SUMO_ATTR_TYPE:
198 return vtypeid;
199 case SUMO_ATTR_ROUTE:
200 return getParentDemandElements().at(1)->getID();
203 return toString(3600 / STEPS2TIME(repetitionOffset));
204 } else {
205 return "";
206 }
207 case SUMO_ATTR_SPEED:
210 } else {
211 return "";
212 }
213 case SUMO_ATTR_COLOR:
215 return toString(color);
216 } else {
218 }
219 case SUMO_ATTR_BEGIN:
220 return time2string(depart);
221 case SUMO_ATTR_END:
225 return getDepartLane();
226 } else {
228 }
231 return getDepartPos();
232 } else {
234 }
237 return getDepartSpeed();
238 } else {
240 }
243 return getArrivalLane();
244 } else {
246 }
249 return getArrivalPos();
250 } else {
252 }
255 return getArrivalSpeed();
256 } else {
258 }
259 case SUMO_ATTR_LINE:
261 return line;
262 } else {
264 }
267 return toString(personNumber);
268 } else {
270 }
274 } else {
276 }
279 return "true";
280 } else {
281 return "false";
282 }
285 return getDepartPosLat();
286 } else {
288 }
291 return getArrivalPosLat();
292 } else {
294 }
296 return getInsertionChecks();
297 case GNE_ATTR_PARENT:
298 return getParentAdditionals().at(0)->getID();
299 default:
300 return getCommonAttribute(key);
301 }
302}
303
304
305double
307 switch (key) {
308 case SUMO_ATTR_DEPART:
309 case SUMO_ATTR_BEGIN:
310 case SUMO_ATTR_END:
311 return STEPS2TIME(depart);
313 // only return departPos it if is given
315 return departPos;
316 } else {
317 return 0;
318 }
320 // only return departPos it if is given
322 return arrivalPos;
323 } else {
324 return -1;
325 }
326 case SUMO_ATTR_WIDTH:
327 case SUMO_ATTR_LENGTH:
328 case SUMO_ATTR_MINGAP:
329 return getParentDemandElements().at(0)->getAttributeDouble(key);
330 default:
331 return getCommonAttributeDouble(key);
332 }
333}
334
335
340
341
346
347
348void
349GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
350 if (value == getAttribute(key)) {
351 return; //avoid needless changes, later logic relies on the fact that attributes have changed
352 }
353 switch (key) {
354 case SUMO_ATTR_ID:
355 case SUMO_ATTR_TYPE:
356 case SUMO_ATTR_ROUTE:
357 case SUMO_ATTR_COLOR:
359 case SUMO_ATTR_SPEED:
360 case SUMO_ATTR_BEGIN:
361 case SUMO_ATTR_END:
368 case SUMO_ATTR_LINE:
375 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
376 break;
377 default:
378 setCommonAttribute(key, value, undoList);
379 break;
380 }
381}
382
383
384bool
385GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
386 switch (key) {
387 case SUMO_ATTR_ID:
388 return isValidAdditionalID(value);
389 case SUMO_ATTR_TYPE:
390 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) == nullptr);
391 case SUMO_ATTR_ROUTE:
392 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::routes, value, false) == nullptr);
394 if (value.empty()) {
395 // speed and vehsPerHour cannot be empty at the same time
397 return false;
398 } else {
399 return true;
400 }
401 } else if (canParse<double>(value)) {
402 const double dVal = parse<double>(value);
403 return (dVal >= 0 || dVal == -1);
404 } else {
405 return false;
406 }
407 case SUMO_ATTR_SPEED:
408 if (value.empty()) {
409 // speed and vehsPerHour cannot be empty at the same time
411 return false;
412 } else {
413 return true;
414 }
415 } else if (canParse<double>(value)) {
416 const double dVal = parse<double>(value);
417 return (dVal >= 0 || dVal == -1);
418 } else {
419 return false;
420 }
421 case SUMO_ATTR_COLOR:
422 return canParse<RGBColor>(value);
423 case SUMO_ATTR_BEGIN:
424 return canParse<SUMOTime>(value);
425 case SUMO_ATTR_END:
426 return canParse<SUMOTime>(value);
428 if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
429 return true;
430 } else {
431 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
432 }
434 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
435 return true;
436 } else {
437 return canParse<double>(value);
438 }
440 if ((value == "random") || (value == "max")) {
441 return true;
442 } else {
443 return canParse<double>(value);
444 }
446 if (value == "current") {
447 return true;
448 } else {
449 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
450 }
452 if ((value == "random") || (value == "max")) {
453 return true;
454 } else {
455 return canParse<double>(value);
456 }
458 if (value == "current") {
459 return true;
460 } else {
461 return canParse<double>(value);
462 }
463 case SUMO_ATTR_LINE:
464 return true;
466 return canParse<int>(value) && parse<int>(value) >= 0;
468 return canParse<int>(value) && parse<int>(value) >= 0;
470 return canParse<bool>(value);
472 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
473 return true;
474 } else {
475 return canParse<double>(value);
476 }
478 if ((value == "left") || (value == "right") || (value == "center")) {
479 return true;
480 } else {
481 return canParse<double>(value);
482 }
484 return areInsertionChecksValid(value);
485 default:
486 return isCommonAttributeValid(key, value);
487 }
488}
489
490
491bool
493 switch (key) {
494 case SUMO_ATTR_TYPE:
495 return (parametersSet & VEHPARS_VTYPE_SET) != 0;
497 return (parametersSet & VEHPARS_VPH_SET) != 0;
498 case SUMO_ATTR_SPEED:
500 default:
501 return true;
502 }
503}
504
505
506std::string
508 return getTagStr();
509}
510
511
512std::string
516
517// ===========================================================================
518// private
519// ===========================================================================
520
521void
522GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
523 // declare string error
524 std::string error;
525 switch (key) {
526 case SUMO_ATTR_ID:
527 // update microsimID
528 setAdditionalID(value);
529 break;
530 case SUMO_ATTR_TYPE:
531 if (!isTemplate()) {
532 if (value.empty()) {
534 } else {
536 }
537 }
538 // set manually vtypeID (needed for saving)
539 vtypeid = value;
540 break;
541 case SUMO_ATTR_ROUTE:
543 break;
545 if (value.empty()) {
546 parametersSet &= ~VEHPARS_VPH_SET;
547 } else {
548 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
549 // set parameters
551 }
552 break;
553 case SUMO_ATTR_SPEED:
554 if (value.empty()) {
555 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
556 } else {
557 calibratorSpeed = parse<double>(value);
558 // mark parameter as set
560 }
561 break;
562 case SUMO_ATTR_COLOR:
563 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
564 color = parse<RGBColor>(value);
565 // mark parameter as set
567 } else {
568 // set default value
570 // unset parameter
571 parametersSet &= ~VEHPARS_COLOR_SET;
572 }
573 break;
574 case SUMO_ATTR_BEGIN:
575 depart = string2time(value);
576 break;
577 case SUMO_ATTR_END:
578 repetitionEnd = string2time(value);
579 break;
581 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
583 // mark parameter as set
585 } else {
586 // set default value
588 // unset parameter
589 parametersSet &= ~VEHPARS_DEPARTLANE_SET;
590 }
591 break;
593 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
595 // mark parameter as set
597 } else {
598 // set default value
600 // unset parameter
601 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
602 }
603 // update geometry (except for template)
604 if (getParentAdditionals().size() > 0) {
606 }
607 break;
609 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
611 // mark parameter as set
613 } else {
614 // set default value
616 // unset parameter
617 parametersSet &= ~VEHPARS_DEPARTSPEED_SET;
618 }
619 break;
621 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
623 // mark parameter as set
625 } else {
626 // set default value
628 // unset parameter
629 parametersSet &= ~VEHPARS_ARRIVALLANE_SET;
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_ARRIVALPOS_SET;
642 }
643 // update geometry (except for template)
644 if (getParentAdditionals().size() > 0) {
646 }
647 break;
649 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
651 // mark parameter as set
653 } else {
654 // set default value
656 // unset parameter
657 parametersSet &= ~VEHPARS_ARRIVALSPEED_SET;
658 }
659 break;
660 case SUMO_ATTR_LINE:
661 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
662 line = value;
663 // mark parameter as set
665 } else {
666 // set default value
668 // unset parameter
669 parametersSet &= ~VEHPARS_LINE_SET;
670 }
671 break;
673 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
674 personNumber = parse<int>(value);
675 // mark parameter as set
677 } else {
678 // set default value
680 // unset parameter
681 parametersSet &= ~VEHPARS_PERSON_NUMBER_SET;
682 }
683 break;
685 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
686 containerNumber = parse<int>(value);
687 // mark parameter as set
689 } else {
690 // set default value
692 // unset parameter
693 parametersSet &= ~VEHPARS_CONTAINER_NUMBER_SET;
694 }
695 break;
697 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
698 // mark parameter as set
700 } else {
701 // unset parameter
702 parametersSet &= ~VEHPARS_ROUTE_SET;
703 }
704 break;
706 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
708 // mark parameter as set
710 } else {
711 // set default value
713 // unset parameter
714 parametersSet &= ~VEHPARS_DEPARTPOSLAT_SET;
715 }
716 break;
718 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
720 // mark parameter as set
722 } else {
723 // set default value
725 // unset parameter
726 parametersSet &= ~VEHPARS_ARRIVALPOSLAT_SET;
727 }
729 break;
732 break;
733 default:
734 setCommonAttribute(key, value);
735 break;
736 }
737}
738
739
740void
742 switch (key) {
743 case SUMO_ATTR_TYPE:
744 if (value) {
746 } else {
747 parametersSet &= ~VEHPARS_VTYPE_SET;
748 }
749 break;
751 if (value) {
753 } else {
754 parametersSet &= ~VEHPARS_VPH_SET;
755 }
756 break;
757 case SUMO_ATTR_SPEED:
758 if (value) {
760 } else {
761 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
762 }
763 break;
764 default:
765 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
766 }
767}
768
769/****************************************************************************/
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_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_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 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
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)
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:200
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