Eclipse SUMO - Simulation of Urban MObility
GNECalibratorFlow.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 <netedit/GNENet.h>
21 #include <netedit/GNEUndoList.h>
24 
25 #include "GNECalibratorFlow.h"
26 
27 
28 // ===========================================================================
29 // member method definitions
30 // ===========================================================================
31 
34 {}, {}, {}, {}, {}, {}, {}, {},
35 std::map<std::string, std::string>()) {
36  // reset default values
37  resetDefaultValues();
38  // set VPH and speed enabled
39  toogleAttribute(SUMO_ATTR_VEHSPERHOUR, true, 0);
40  toogleAttribute(SUMO_ATTR_SPEED, true, 0);
41 }
42 
43 
45  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_FLOW_CALIBRATOR, "",
46 {}, {}, {}, {calibratorParent}, {}, {}, {vehicleType, route}, {},
47 std::map<std::string, std::string>()),
49  // update centering boundary without updating grid
51 }
52 
53 
54 GNECalibratorFlow::GNECalibratorFlow(GNEAdditional* calibratorParent, GNEDemandElement* vehicleType, GNEDemandElement* route, const SUMOVehicleParameter& vehicleParameters) :
55  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_FLOW_CALIBRATOR, "",
56 {}, {}, {}, {calibratorParent}, {}, {}, {vehicleType, route}, {},
57 std::map<std::string, std::string>()),
58 SUMOVehicleParameter(vehicleParameters) {
59  // update centering boundary without updating grid
61 }
62 
63 
65 
66 
67 void
70  // open tag
71  device.openTag(SUMO_TAG_FLOW);
72  // write route
74  // write vehicle attributes
76  // VPH
79  }
80  // write parameters
82  // close vehicle tag
83  device.closeTag();
84  } else {
85  WRITE_WARNING(toString(GNE_TAG_FLOW_CALIBRATOR) + " of calibrator '" + getParentAdditionals().front()->getID() +
86  "' cannot be written. Either type or vehsPerHour or speed must be enabled");
87  }
88 }
89 
90 
93  // calibrators flow cannot be moved
94  return nullptr;
95 }
96 
97 
98 void
100  // update centering boundary (needed for centering)
102 }
103 
104 
105 Position
107  // get rerouter parent position
108  Position signPosition = getParentAdditionals().front()->getPositionInView();
109  // set position depending of indexes
110  signPosition.add(4.5, (getDrawPositionIndex() * -1) + 1, 0);
111  // return signPosition
112  return signPosition;
113 }
114 
115 
116 void
117 GNECalibratorFlow::updateCenteringBoundary(const bool /*updateGrid*/) {
121 }
122 
123 
124 void
125 GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
126  // geometry of this element cannot be splitted
127 }
128 
129 
130 std::string
132  return getParentAdditionals().at(0)->getID();
133 }
134 
135 
136 void
138  // draw rerouter interval as listed attribute
141 }
142 
143 
144 std::string
146  switch (key) {
147  case SUMO_ATTR_ID:
148  return getID();
149  case SUMO_ATTR_TYPE:
150  return vtypeid;
151  case SUMO_ATTR_ROUTE:
152  return getParentDemandElements().at(1)->getID();
154  return toString(3600 / STEPS2TIME(repetitionOffset));
155  case SUMO_ATTR_SPEED:
156  return toString(calibratorSpeed);
157  case SUMO_ATTR_COLOR:
158  if (wasSet(VEHPARS_COLOR_SET)) {
159  return toString(color);
160  } else {
162  }
163  case SUMO_ATTR_BEGIN:
164  return time2string(depart);
165  case SUMO_ATTR_END:
166  return time2string(repetitionEnd);
169  return getDepartLane();
170  } else {
172  }
173  case SUMO_ATTR_DEPARTPOS:
175  return getDepartPos();
176  } else {
178  }
181  return getDepartSpeed();
182  } else {
184  }
187  return getArrivalLane();
188  } else {
190  }
193  return getArrivalPos();
194  } else {
196  }
199  return getArrivalSpeed();
200  } else {
202  }
203  case SUMO_ATTR_LINE:
204  if (wasSet(VEHPARS_LINE_SET)) {
205  return line;
206  } else {
208  }
211  return toString(personNumber);
212  } else {
214  }
217  return toString(containerNumber);
218  } else {
220  }
221  case SUMO_ATTR_REROUTE:
223  return "true";
224  } else {
225  return "false";
226  }
229  return getDepartPosLat();
230  } else {
232  }
235  return getArrivalPosLat();
236  } else {
238  }
239  case GNE_ATTR_PARENT:
240  return getParentAdditionals().at(0)->getID();
241  case GNE_ATTR_SELECTED:
243  case GNE_ATTR_PARAMETERS:
245  default:
246  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
247  }
248 }
249 
250 
251 double
253  switch (key) {
254  case SUMO_ATTR_DEPART:
255  case SUMO_ATTR_BEGIN:
256  case SUMO_ATTR_END:
257  return STEPS2TIME(depart);
258  case SUMO_ATTR_DEPARTPOS:
259  // only return departPos it if is given
261  return departPos;
262  } else {
263  return 0;
264  }
266  // only return departPos it if is given
268  return arrivalPos;
269  } else {
270  return -1;
271  }
272  case SUMO_ATTR_WIDTH:
273  case SUMO_ATTR_LENGTH:
274  case SUMO_ATTR_MINGAP:
275  return getParentDemandElements().at(0)->getAttributeDouble(key);
276  default:
277  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
278  }
279 }
280 
281 
282 void
283 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
284  if (value == getAttribute(key)) {
285  return; //avoid needless changes, later logic relies on the fact that attributes have changed
286  }
287  switch (key) {
288  case SUMO_ATTR_ID:
289  case SUMO_ATTR_TYPE:
290  case SUMO_ATTR_ROUTE:
291  case SUMO_ATTR_COLOR:
293  case SUMO_ATTR_SPEED:
294  case SUMO_ATTR_BEGIN:
295  case SUMO_ATTR_END:
297  case SUMO_ATTR_DEPARTPOS:
302  case SUMO_ATTR_LINE:
305  case SUMO_ATTR_REROUTE:
308  case GNE_ATTR_SELECTED:
309  case GNE_ATTR_PARAMETERS:
310  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
311  break;
312  default:
313  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
314  }
315 }
316 
317 
318 bool
319 GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
320  switch (key) {
321  case SUMO_ATTR_ID:
322  return isValidAdditionalID(value);
323  case SUMO_ATTR_TYPE:
325  case SUMO_ATTR_ROUTE:
328  if (value.empty()) {
329  // speed and vehsPerHour cannot be empty at the same time
331  return false;
332  } else {
333  return true;
334  }
335  } else if (canParse<double>(value)) {
336  const double dVal = parse<double>(value);
337  return (dVal >= 0 || dVal == -1);
338  } else {
339  return false;
340  }
341  case SUMO_ATTR_SPEED:
342  if (value.empty()) {
343  // speed and vehsPerHour cannot be empty at the same time
345  return false;
346  } else {
347  return true;
348  }
349  } else if (canParse<double>(value)) {
350  const double dVal = parse<double>(value);
351  return (dVal >= 0 || dVal == -1);
352  } else {
353  return false;
354  }
355  case SUMO_ATTR_COLOR:
356  return canParse<RGBColor>(value);
357  case SUMO_ATTR_BEGIN:
358  return canParse<SUMOTime>(value);
359  case SUMO_ATTR_END:
360  return canParse<SUMOTime>(value);
362  if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
363  return true;
364  } else {
365  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
366  }
367  case SUMO_ATTR_DEPARTPOS:
368  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
369  return true;
370  } else {
371  return canParse<double>(value);
372  }
374  if ((value == "random") || (value == "max")) {
375  return true;
376  } else {
377  return canParse<double>(value);
378  }
380  if (value == "current") {
381  return true;
382  } else {
383  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
384  }
386  if ((value == "random") || (value == "max")) {
387  return true;
388  } else {
389  return canParse<double>(value);
390  }
392  if (value == "current") {
393  return true;
394  } else {
395  return canParse<double>(value);
396  }
397  case SUMO_ATTR_LINE:
398  return true;
400  return canParse<int>(value) && parse<int>(value) >= 0;
402  return canParse<int>(value) && parse<int>(value) >= 0;
403  case SUMO_ATTR_REROUTE:
404  return canParse<bool>(value);
406  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
407  return true;
408  } else {
409  return canParse<double>(value);
410  }
412  if ((value == "left") || (value == "right") || (value == "center")) {
413  return true;
414  } else {
415  return canParse<double>(value);
416  }
417  case GNE_ATTR_SELECTED:
418  return canParse<bool>(value);
419  case GNE_ATTR_PARAMETERS:
420  return Parameterised::areParametersValid(value);
421  default:
422  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
423  }
424 }
425 
426 
427 bool
429  switch (key) {
430  case SUMO_ATTR_TYPE:
431  return (parametersSet & VEHPARS_VTYPE_SET) != 0;
433  return (parametersSet & VEHPARS_VPH_SET) != 0;
434  case SUMO_ATTR_SPEED:
436  default:
437  return true;
438  }
439 }
440 
441 
442 std::string
444  return getTagStr();
445 }
446 
447 
448 std::string
450  return getTagStr() + ": " + getAttribute(SUMO_ATTR_BEGIN) + " -> " + getAttribute(SUMO_ATTR_END);
451 }
452 
453 // ===========================================================================
454 // private
455 // ===========================================================================
456 
457 void
458 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
459  // declare string error
460  std::string error;
461  switch (key) {
462  case SUMO_ATTR_ID:
463  // update microsimID
464  setMicrosimID(value);
465  break;
466  case SUMO_ATTR_TYPE:
467  if (!isTemplate()) {
468  if (value.empty()) {
470  } else {
472  }
473  }
474  // set manually vtypeID (needed for saving)
475  vtypeid = value;
476  break;
477  case SUMO_ATTR_ROUTE:
479  break;
481  repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
482  // set parameters
484  break;
485  case SUMO_ATTR_SPEED:
486  calibratorSpeed = parse<double>(value);
487  // mark parameter as set
489  break;
490  case SUMO_ATTR_COLOR:
491  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
492  color = parse<RGBColor>(value);
493  // mark parameter as set
495  } else {
496  // set default value
497  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
498  // unset parameter
500  }
501  break;
502  case SUMO_ATTR_BEGIN:
503  depart = string2time(value);
504  break;
505  case SUMO_ATTR_END:
506  repetitionEnd = string2time(value);
507  break;
509  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
511  // mark parameter as set
513  } else {
514  // set default value
516  // unset parameter
518  }
519  break;
520  case SUMO_ATTR_DEPARTPOS:
521  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
523  // mark parameter as set
525  } else {
526  // set default value
528  // unset parameter
530  }
531  // update geometry (except for template)
532  if (getParentAdditionals().size() > 0) {
533  updateGeometry();
534  }
535  break;
537  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
539  // mark parameter as set
541  } else {
542  // set default value
544  // unset parameter
546  }
547  break;
549  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
551  // mark parameter as set
553  } else {
554  // set default value
556  // unset parameter
558  }
559  break;
561  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
563  // mark parameter as set
565  } else {
566  // set default value
568  // unset parameter
570  }
571  // update geometry (except for template)
572  if (getParentAdditionals().size() > 0) {
573  updateGeometry();
574  }
575  break;
577  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
579  // mark parameter as set
581  } else {
582  // set default value
584  // unset parameter
586  }
587  break;
588  case SUMO_ATTR_LINE:
589  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
590  line = value;
591  // mark parameter as set
593  } else {
594  // set default value
596  // unset parameter
598  }
599  break;
601  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
602  personNumber = parse<int>(value);
603  // mark parameter as set
605  } else {
606  // set default value
607  personNumber = parse<int>(myTagProperty.getDefaultValue(key));
608  // unset parameter
610  }
611  break;
613  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
614  containerNumber = parse<int>(value);
615  // mark parameter as set
617  } else {
618  // set default value
619  containerNumber = parse<int>(myTagProperty.getDefaultValue(key));
620  // unset parameter
622  }
623  break;
624  case SUMO_ATTR_REROUTE:
625  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
626  // mark parameter as set
628  } else {
629  // unset parameter
631  }
632  break;
634  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
636  // mark parameter as set
638  } else {
639  // set default value
641  // unset parameter
643  }
644  break;
646  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
648  // mark parameter as set
650  } else {
651  // set default value
653  // unset parameter
655  }
657  break;
658  case GNE_ATTR_SELECTED:
659  if (parse<bool>(value)) {
661  } else {
663  }
664  break;
665  case GNE_ATTR_PARAMETERS:
667  break;
668  default:
669  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
670  }
671 }
672 
673 
674 void
676  // nothing to do
677 }
678 
679 void
680 GNECalibratorFlow::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
681  // nothing to do
682 }
683 
684 
685 void
686 GNECalibratorFlow::toogleAttribute(SumoXMLAttr key, const bool value, const int /*previousParameters*/) {
687  switch (key) {
688  case SUMO_ATTR_TYPE:
689  if (value) {
691  } else {
693  }
694  break;
696  if (value) {
698  } else {
700  }
701  break;
702  case SUMO_ATTR_SPEED:
703  if (value) {
705  } else {
707  }
708  break;
709  default:
710  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
711  }
712 }
713 
714 /****************************************************************************/
@ GLO_CALIBRATOR
a Calibrator
@ VARIABLESPEEDSIGN_STEP
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
const std::string DEFAULT_VTYPE_ID
const int VEHPARS_VPH_SET
const int VEHPARS_ROUTE_SET
const int VEHPARS_COLOR_SET
@ GIVEN
The position is given.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_CONTAINER_NUMBER_SET
const int VEHPARS_ARRIVALLANE_SET
const int VEHPARS_DEPARTLANE_SET
const int VEHPARS_ARRIVALPOSLAT_SET
const int VEHPARS_ARRIVALSPEED_SET
const int VEHPARS_CALIBRATORSPEED_SET
@ GIVEN
The arrival position is given.
const int VEHPARS_LINE_SET
const int VEHPARS_PERSON_NUMBER_SET
const int VEHPARS_DEPARTSPEED_SET
const int VEHPARS_VTYPE_SET
const int VEHPARS_ARRIVALPOS_SET
const int VEHPARS_DEPARTPOSLAT_SET
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ GNE_TAG_FLOW_CALIBRATOR
a flow definition within in Calibrator
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_ROUTE
begin/end of the description of a route
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
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_MINGAP
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ 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_WIDTH
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
void reset()
Resets the boundary.
Definition: Boundary.cpp:65
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
const std::string & getID() const
get ID
void drawListedAddtional(const GUIVisualizationSettings &s, const Position &parentPosition, const int offsetX, const int extraOffsetY, const RGBColor baseCol, const RGBColor textCol, GUITexture texture, const std::string text) const
draw listed additional
int getDrawPositionIndex() const
get draw position index (used in rerouters and VSS)
Boundary myAdditionalBoundary
Additional Boundary.
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
double getAttributeDouble(SumoXMLAttr key) const
GNECalibratorFlow(GNENet *net)
default constructor
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
~GNECalibratorFlow()
destructor
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
GNEMoveOperation * getMoveOperation()
get move operation
void updateGeometry()
update pre-computed geometry information
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Position getPositionInView() const
Returns position of additional in view.
bool isAttributeEnabled(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getParentName() const
Returns the name of the parent object.
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
toogle attribute
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
An Element which don't belongs to GNENet but has influency in the simulation.
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
move operation
move result
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
SumoXMLTag getXMLTag() const
get XML tag
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Stores the information about how to visualize structures.
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:248
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:125
static const RGBColor BLACK
Definition: RGBColor.h:193
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 parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
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.
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)
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.
double arrivalPos
(optional) The position the vehicle shall arrive on
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.
bool wasSet(int what) const
Returns whether the given parameter was set.
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.
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 bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
static const RGBColor calibratorColor
color for Calibrators