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>
25 #include <utils/gui/div/GLHelper.h>
27 
28 #include "GNECalibratorFlow.h"
29 
30 
31 // ===========================================================================
32 // member method definitions
33 // ===========================================================================
34 
37 {}, {}, {}, {}, {}, {}) {
38  // reset default values
39  resetDefaultValues();
40  // set VPH and speed enabled
41  toggleAttribute(SUMO_ATTR_VEHSPERHOUR, true);
42  toggleAttribute(SUMO_ATTR_SPEED, true);
43  // reset ID
44  id.clear();
45 }
46 
47 
49  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "",
50 {}, {}, {}, {calibratorParent}, {vehicleType, route}, {}),
52  // update centering boundary without updating grid
54  // reset ID
55  id.clear();
56 }
57 
58 
60  const SUMOVehicleParameter& vehicleParameters) :
61  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "",
62 {}, {}, {}, {calibratorParent}, {vehicleType, route}, {}),
63 SUMOVehicleParameter(vehicleParameters) {
64  // update centering boundary without updating grid
66  // reset ID
67  id.clear();
68 }
69 
70 
72 
73 
74 void
77  // open tag
78  device.openTag(SUMO_TAG_FLOW);
79  // write vehicle attributes
81  // write route
83  // VPH
86  }
87  // write parameters
89  // close vehicle tag
90  device.closeTag();
91  } else {
92  WRITE_WARNING(toString(GNE_TAG_CALIBRATOR_FLOW) + " of calibrator '" + getParentAdditionals().front()->getID() +
93  "' cannot be written. Either type or vehsPerHour or speed must be enabled");
94  }
95 }
96 
97 
100  // calibrators flow cannot be moved
101  return nullptr;
102 }
103 
104 
105 void
107  // update centering boundary (needed for centering)
109 }
110 
111 
112 Position
114  // get rerouter parent position
115  Position signPosition = getParentAdditionals().front()->getPositionInView();
116  // set position depending of indexes
117  signPosition.add(4.5, (getDrawPositionIndex() * -1) + 1, 0);
118  // return signPosition
119  return signPosition;
120 }
121 
122 
123 void
124 GNECalibratorFlow::updateCenteringBoundary(const bool /*updateGrid*/) {
128 }
129 
130 
131 void
132 GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
133  // geometry of this element cannot be splitted
134 }
135 
136 
137 std::string
139  return getParentAdditionals().at(0)->getID();
140 }
141 
142 
143 void
145  // push rotation matrix
147  // move to parent additional position
148  glTranslated(getParentAdditionals().front()->getPositionInView().x(), getParentAdditionals().front()->getPositionInView().y(), 0);
149  // rotate
150  glRotated((-1 * getParentAdditionals().front()->getAdditionalGeometry().getShapeRotations().front()) + 180, 0, 0, 1);
151  // draw rerouter interval as listed attribute
153  // pop rotation matrix
155 }
156 
157 
158 std::string
160  switch (key) {
161  case SUMO_ATTR_ID:
162  return getMicrosimID();
163  case SUMO_ATTR_TYPE:
164  return vtypeid;
165  case SUMO_ATTR_ROUTE:
166  return getParentDemandElements().at(1)->getID();
169  return toString(3600 / STEPS2TIME(repetitionOffset));
170  } else {
171  return "";
172  }
173  case SUMO_ATTR_SPEED:
175  return toString(calibratorSpeed);
176  } else {
177  return "";
178  }
179  case SUMO_ATTR_COLOR:
180  if (wasSet(VEHPARS_COLOR_SET)) {
181  return toString(color);
182  } else {
184  }
185  case SUMO_ATTR_BEGIN:
186  return time2string(depart);
187  case SUMO_ATTR_END:
188  return time2string(repetitionEnd);
191  return getDepartLane();
192  } else {
194  }
195  case SUMO_ATTR_DEPARTPOS:
197  return getDepartPos();
198  } else {
200  }
203  return getDepartSpeed();
204  } else {
206  }
209  return getArrivalLane();
210  } else {
212  }
215  return getArrivalPos();
216  } else {
218  }
221  return getArrivalSpeed();
222  } else {
224  }
225  case SUMO_ATTR_LINE:
226  if (wasSet(VEHPARS_LINE_SET)) {
227  return line;
228  } else {
230  }
233  return toString(personNumber);
234  } else {
236  }
239  return toString(containerNumber);
240  } else {
242  }
243  case SUMO_ATTR_REROUTE:
245  return "true";
246  } else {
247  return "false";
248  }
251  return getDepartPosLat();
252  } else {
254  }
257  return getArrivalPosLat();
258  } else {
260  }
262  return getInsertionChecks();
263  case GNE_ATTR_PARENT:
264  return getParentAdditionals().at(0)->getID();
265  case GNE_ATTR_SELECTED:
267  case GNE_ATTR_PARAMETERS:
269  default:
270  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
271  }
272 }
273 
274 
275 double
277  switch (key) {
278  case SUMO_ATTR_DEPART:
279  case SUMO_ATTR_BEGIN:
280  case SUMO_ATTR_END:
281  return STEPS2TIME(depart);
282  case SUMO_ATTR_DEPARTPOS:
283  // only return departPos it if is given
285  return departPos;
286  } else {
287  return 0;
288  }
290  // only return departPos it if is given
292  return arrivalPos;
293  } else {
294  return -1;
295  }
296  case SUMO_ATTR_WIDTH:
297  case SUMO_ATTR_LENGTH:
298  case SUMO_ATTR_MINGAP:
299  return getParentDemandElements().at(0)->getAttributeDouble(key);
300  default:
301  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
302  }
303 }
304 
305 
306 const Parameterised::Map&
308  return PARAMETERS_EMPTY;
309 }
310 
311 
312 void
313 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
314  if (value == getAttribute(key)) {
315  return; //avoid needless changes, later logic relies on the fact that attributes have changed
316  }
317  switch (key) {
318  case SUMO_ATTR_ID:
319  case SUMO_ATTR_TYPE:
320  case SUMO_ATTR_ROUTE:
321  case SUMO_ATTR_COLOR:
323  case SUMO_ATTR_SPEED:
324  case SUMO_ATTR_BEGIN:
325  case SUMO_ATTR_END:
327  case SUMO_ATTR_DEPARTPOS:
332  case SUMO_ATTR_LINE:
335  case SUMO_ATTR_REROUTE:
339  case GNE_ATTR_SELECTED:
340  case GNE_ATTR_PARAMETERS:
341  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
342  break;
343  default:
344  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
345  }
346 }
347 
348 
349 bool
350 GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
351  switch (key) {
352  case SUMO_ATTR_ID:
353  return isValidAdditionalID(value);
354  case SUMO_ATTR_TYPE:
356  case SUMO_ATTR_ROUTE:
359  if (value.empty()) {
360  // speed and vehsPerHour cannot be empty at the same time
362  return false;
363  } else {
364  return true;
365  }
366  } else if (canParse<double>(value)) {
367  const double dVal = parse<double>(value);
368  return (dVal >= 0 || dVal == -1);
369  } else {
370  return false;
371  }
372  case SUMO_ATTR_SPEED:
373  if (value.empty()) {
374  // speed and vehsPerHour cannot be empty at the same time
376  return false;
377  } else {
378  return true;
379  }
380  } else if (canParse<double>(value)) {
381  const double dVal = parse<double>(value);
382  return (dVal >= 0 || dVal == -1);
383  } else {
384  return false;
385  }
386  case SUMO_ATTR_COLOR:
387  return canParse<RGBColor>(value);
388  case SUMO_ATTR_BEGIN:
389  return canParse<SUMOTime>(value);
390  case SUMO_ATTR_END:
391  return canParse<SUMOTime>(value);
393  if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
394  return true;
395  } else {
396  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
397  }
398  case SUMO_ATTR_DEPARTPOS:
399  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
400  return true;
401  } else {
402  return canParse<double>(value);
403  }
405  if ((value == "random") || (value == "max")) {
406  return true;
407  } else {
408  return canParse<double>(value);
409  }
411  if (value == "current") {
412  return true;
413  } else {
414  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
415  }
417  if ((value == "random") || (value == "max")) {
418  return true;
419  } else {
420  return canParse<double>(value);
421  }
423  if (value == "current") {
424  return true;
425  } else {
426  return canParse<double>(value);
427  }
428  case SUMO_ATTR_LINE:
429  return true;
431  return canParse<int>(value) && parse<int>(value) >= 0;
433  return canParse<int>(value) && parse<int>(value) >= 0;
434  case SUMO_ATTR_REROUTE:
435  return canParse<bool>(value);
437  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
438  return true;
439  } else {
440  return canParse<double>(value);
441  }
443  if ((value == "left") || (value == "right") || (value == "center")) {
444  return true;
445  } else {
446  return canParse<double>(value);
447  }
449  return areInsertionChecksValid(value);
450  case GNE_ATTR_SELECTED:
451  return canParse<bool>(value);
452  case GNE_ATTR_PARAMETERS:
453  return areParametersValid(value);
454  default:
455  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
456  }
457 }
458 
459 
460 bool
462  switch (key) {
463  case SUMO_ATTR_TYPE:
464  return (parametersSet & VEHPARS_VTYPE_SET) != 0;
466  return (parametersSet & VEHPARS_VPH_SET) != 0;
467  case SUMO_ATTR_SPEED:
469  default:
470  return true;
471  }
472 }
473 
474 
475 std::string
477  return getTagStr();
478 }
479 
480 
481 std::string
483  return getTagStr() + ": " + getAttribute(SUMO_ATTR_BEGIN) + " -> " + getAttribute(SUMO_ATTR_END);
484 }
485 
486 // ===========================================================================
487 // private
488 // ===========================================================================
489 
490 void
491 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
492  // declare string error
493  std::string error;
494  switch (key) {
495  case SUMO_ATTR_ID:
496  // update microsimID
497  setMicrosimID(value);
498  break;
499  case SUMO_ATTR_TYPE:
500  if (!isTemplate()) {
501  if (value.empty()) {
503  } else {
505  }
506  }
507  // set manually vtypeID (needed for saving)
508  vtypeid = value;
509  break;
510  case SUMO_ATTR_ROUTE:
512  break;
514  if (value.empty()) {
516  } else {
517  repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
518  // set parameters
520  }
521  break;
522  case SUMO_ATTR_SPEED:
523  if (value.empty()) {
525  } else {
526  calibratorSpeed = parse<double>(value);
527  // mark parameter as set
529  }
530  break;
531  case SUMO_ATTR_COLOR:
532  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
533  color = parse<RGBColor>(value);
534  // mark parameter as set
536  } else {
537  // set default value
538  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
539  // unset parameter
541  }
542  break;
543  case SUMO_ATTR_BEGIN:
544  depart = string2time(value);
545  break;
546  case SUMO_ATTR_END:
547  repetitionEnd = string2time(value);
548  break;
550  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
552  // mark parameter as set
554  } else {
555  // set default value
557  // unset parameter
559  }
560  break;
561  case SUMO_ATTR_DEPARTPOS:
562  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
564  // mark parameter as set
566  } else {
567  // set default value
569  // unset parameter
571  }
572  // update geometry (except for template)
573  if (getParentAdditionals().size() > 0) {
574  updateGeometry();
575  }
576  break;
578  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
580  // mark parameter as set
582  } else {
583  // set default value
585  // unset parameter
587  }
588  break;
590  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
592  // mark parameter as set
594  } else {
595  // set default value
597  // unset parameter
599  }
600  break;
602  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
604  // mark parameter as set
606  } else {
607  // set default value
609  // unset parameter
611  }
612  // update geometry (except for template)
613  if (getParentAdditionals().size() > 0) {
614  updateGeometry();
615  }
616  break;
618  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
620  // mark parameter as set
622  } else {
623  // set default value
625  // unset parameter
627  }
628  break;
629  case SUMO_ATTR_LINE:
630  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
631  line = value;
632  // mark parameter as set
634  } else {
635  // set default value
637  // unset parameter
639  }
640  break;
642  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
643  personNumber = parse<int>(value);
644  // mark parameter as set
646  } else {
647  // set default value
648  personNumber = parse<int>(myTagProperty.getDefaultValue(key));
649  // unset parameter
651  }
652  break;
654  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
655  containerNumber = parse<int>(value);
656  // mark parameter as set
658  } else {
659  // set default value
660  containerNumber = parse<int>(myTagProperty.getDefaultValue(key));
661  // unset parameter
663  }
664  break;
665  case SUMO_ATTR_REROUTE:
666  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
667  // mark parameter as set
669  } else {
670  // unset parameter
672  }
673  break;
675  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
677  // mark parameter as set
679  } else {
680  // set default value
682  // unset parameter
684  }
685  break;
687  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
689  // mark parameter as set
691  } else {
692  // set default value
694  // unset parameter
696  }
698  break;
700  parseInsertionChecks(value);
701  break;
702  case GNE_ATTR_SELECTED:
703  if (parse<bool>(value)) {
705  } else {
707  }
708  break;
709  case GNE_ATTR_PARAMETERS:
711  break;
712  default:
713  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
714  }
715 }
716 
717 
718 void
720  // nothing to do
721 }
722 
723 void
724 GNECalibratorFlow::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
725  // nothing to do
726 }
727 
728 
729 void
731  switch (key) {
732  case SUMO_ATTR_TYPE:
733  if (value) {
735  } else {
737  }
738  break;
740  if (value) {
742  } else {
744  }
745  break;
746  case SUMO_ATTR_SPEED:
747  if (value) {
749  } else {
751  }
752  break;
753  default:
754  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
755  }
756 }
757 
758 /****************************************************************************/
@ GLO_CALIBRATOR
a Calibrator
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ VARIABLESPEEDSIGN_STEP
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
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:54
#define TIME2STEPS(x)
Definition: SUMOTime.h:56
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
@ 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
@ 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
@ 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_INSERTIONCHECKS
@ 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:78
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
void drawListedAddtional(const GUIVisualizationSettings &s, const Position &parentPosition, const double offsetX, const double 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)
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
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
const std::string getID() const
get ID (all Attribute Carriers have one)
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
static const Parameterised::Map PARAMETERS_EMPTY
empty parameter maps (used by ACs without parameters)
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
const Parameterised::Map & getACParametersMap() const
get parameters map
double getAttributeDouble(SumoXMLAttr key) const
GNECalibratorFlow(GNENet *net)
default constructor
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void toggleAttribute(SumoXMLAttr key, const bool value)
toggle attribute
~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
write 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.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
An Element which don't belong to GNENet but has influence 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:132
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
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.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:141
Stores the information about how to visualize structures.
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:59
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:251
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|....
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
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.
void parseInsertionChecks(const std::string &value)
parses insertion checks
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.
bool areInsertionChecksValid(const std::string &value) const
check if given insertion checks are valid
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.
std::string getInsertionChecks() const
get insertion checks in string format
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