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.dev/sumo
3 // Copyright (C) 2001-2024 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 #include <utils/xml/NamespaceIDs.h>
28 
29 #include "GNECalibratorFlow.h"
30 
31 
32 // ===========================================================================
33 // member method definitions
34 // ===========================================================================
35 
38 {}, {}, {}, {}, {}, {}) {
39  // reset default values
40  resetDefaultValues();
41  // set VPH and speed enabled
42  toggleAttribute(SUMO_ATTR_VEHSPERHOUR, true);
43  toggleAttribute(SUMO_ATTR_SPEED, true);
44  // reset ID
45  id.clear();
46 }
47 
48 
50  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "",
51 {}, {}, {}, {calibratorParent}, {vehicleType, route}, {}),
53  // update centering boundary without updating grid
55  // reset ID
56  id.clear();
57 }
58 
59 
61  const SUMOVehicleParameter& vehicleParameters) :
62  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "",
63 {}, {}, {}, {calibratorParent}, {vehicleType, route}, {}),
64 SUMOVehicleParameter(vehicleParameters) {
65  // update centering boundary without updating grid
67  // reset ID
68  id.clear();
69 }
70 
71 
73 
74 
75 void
78  // open tag
79  device.openTag(SUMO_TAG_FLOW);
80  // write vehicle attributes
82  // write end
84  // write route
86  // VPH
89  }
90  // write parameters
92  // close vehicle tag
93  device.closeTag();
94  } else {
95  WRITE_WARNING(TLF("calibratorFlow of calibrator '%' cannot be written. Either type or vehsPerHour or speed must be enabled", getParentAdditionals().front()->getID()));
96  }
97 }
98 
99 
100 bool
102  return true;
103 }
104 
105 
106 std::string
108  return "";
109 }
110 
111 
112 void
114  // nothing to fix
115 }
116 
117 
118 bool
120  return false;
121 }
122 
123 
126  // calibrators flow cannot be moved
127  return nullptr;
128 }
129 
130 
131 void
133  // update centering boundary (needed for centering)
135 }
136 
137 
138 Position
140  // get rerouter parent position
141  Position signPosition = getParentAdditionals().front()->getPositionInView();
142  // set position depending of indexes
143  signPosition.add(4.5, (getDrawPositionIndex() * -1) + 1, 0);
144  // return signPosition
145  return signPosition;
146 }
147 
148 
149 void
150 GNECalibratorFlow::updateCenteringBoundary(const bool /*updateGrid*/) {
151  // nothing to update
152 }
153 
154 
155 void
156 GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
157  // geometry of this element cannot be splitted
158 }
159 
160 
161 std::string
163  return getParentAdditionals().at(0)->getID();
164 }
165 
166 
167 void
169  // push rotation matrix
171  // move to parent additional position
172  glTranslated(getParentAdditionals().front()->getPositionInView().x(), getParentAdditionals().front()->getPositionInView().y(), 0);
173  // rotate
174  glRotated((-1 * getParentAdditionals().front()->getAdditionalGeometry().getShapeRotations().front()) + 180, 0, 0, 1);
175  // draw rerouter interval as listed attribute
177  // pop rotation matrix
179 }
180 
181 
182 std::string
184  switch (key) {
185  case SUMO_ATTR_ID:
186  return getMicrosimID();
187  case SUMO_ATTR_TYPE:
188  return vtypeid;
189  case SUMO_ATTR_ROUTE:
190  return getParentDemandElements().at(1)->getID();
193  return toString(3600 / STEPS2TIME(repetitionOffset));
194  } else {
195  return "";
196  }
197  case SUMO_ATTR_SPEED:
199  return toString(calibratorSpeed);
200  } else {
201  return "";
202  }
203  case SUMO_ATTR_COLOR:
204  if (wasSet(VEHPARS_COLOR_SET)) {
205  return toString(color);
206  } else {
208  }
209  case SUMO_ATTR_BEGIN:
210  return time2string(depart);
211  case SUMO_ATTR_END:
212  return time2string(repetitionEnd);
215  return getDepartLane();
216  } else {
218  }
219  case SUMO_ATTR_DEPARTPOS:
221  return getDepartPos();
222  } else {
224  }
227  return getDepartSpeed();
228  } else {
230  }
233  return getArrivalLane();
234  } else {
236  }
239  return getArrivalPos();
240  } else {
242  }
245  return getArrivalSpeed();
246  } else {
248  }
249  case SUMO_ATTR_LINE:
250  if (wasSet(VEHPARS_LINE_SET)) {
251  return line;
252  } else {
254  }
257  return toString(personNumber);
258  } else {
260  }
263  return toString(containerNumber);
264  } else {
266  }
267  case SUMO_ATTR_REROUTE:
269  return "true";
270  } else {
271  return "false";
272  }
275  return getDepartPosLat();
276  } else {
278  }
281  return getArrivalPosLat();
282  } else {
284  }
286  return getInsertionChecks();
287  case GNE_ATTR_PARENT:
288  return getParentAdditionals().at(0)->getID();
289  case GNE_ATTR_SELECTED:
291  case GNE_ATTR_PARAMETERS:
293  default:
294  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
295  }
296 }
297 
298 
299 double
301  switch (key) {
302  case SUMO_ATTR_DEPART:
303  case SUMO_ATTR_BEGIN:
304  case SUMO_ATTR_END:
305  return STEPS2TIME(depart);
306  case SUMO_ATTR_DEPARTPOS:
307  // only return departPos it if is given
309  return departPos;
310  } else {
311  return 0;
312  }
314  // only return departPos it if is given
316  return arrivalPos;
317  } else {
318  return -1;
319  }
320  case SUMO_ATTR_WIDTH:
321  case SUMO_ATTR_LENGTH:
322  case SUMO_ATTR_MINGAP:
323  return getParentDemandElements().at(0)->getAttributeDouble(key);
324  default:
325  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
326  }
327 }
328 
329 
330 const Parameterised::Map&
332  return PARAMETERS_EMPTY;
333 }
334 
335 
336 void
337 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
338  if (value == getAttribute(key)) {
339  return; //avoid needless changes, later logic relies on the fact that attributes have changed
340  }
341  switch (key) {
342  case SUMO_ATTR_ID:
343  case SUMO_ATTR_TYPE:
344  case SUMO_ATTR_ROUTE:
345  case SUMO_ATTR_COLOR:
347  case SUMO_ATTR_SPEED:
348  case SUMO_ATTR_BEGIN:
349  case SUMO_ATTR_END:
351  case SUMO_ATTR_DEPARTPOS:
356  case SUMO_ATTR_LINE:
359  case SUMO_ATTR_REROUTE:
363  case GNE_ATTR_SELECTED:
364  case GNE_ATTR_PARAMETERS:
365  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
366  break;
367  default:
368  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
369  }
370 }
371 
372 
373 bool
374 GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
375  switch (key) {
376  case SUMO_ATTR_ID:
377  return isValidAdditionalID(value);
378  case SUMO_ATTR_TYPE:
379  return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) == nullptr);
380  case SUMO_ATTR_ROUTE:
381  return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::routes, value, false) == nullptr);
383  if (value.empty()) {
384  // speed and vehsPerHour cannot be empty at the same time
386  return false;
387  } else {
388  return true;
389  }
390  } else if (canParse<double>(value)) {
391  const double dVal = parse<double>(value);
392  return (dVal >= 0 || dVal == -1);
393  } else {
394  return false;
395  }
396  case SUMO_ATTR_SPEED:
397  if (value.empty()) {
398  // speed and vehsPerHour cannot be empty at the same time
400  return false;
401  } else {
402  return true;
403  }
404  } else if (canParse<double>(value)) {
405  const double dVal = parse<double>(value);
406  return (dVal >= 0 || dVal == -1);
407  } else {
408  return false;
409  }
410  case SUMO_ATTR_COLOR:
411  return canParse<RGBColor>(value);
412  case SUMO_ATTR_BEGIN:
413  return canParse<SUMOTime>(value);
414  case SUMO_ATTR_END:
415  return canParse<SUMOTime>(value);
417  if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
418  return true;
419  } else {
420  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
421  }
422  case SUMO_ATTR_DEPARTPOS:
423  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
424  return true;
425  } else {
426  return canParse<double>(value);
427  }
429  if ((value == "random") || (value == "max")) {
430  return true;
431  } else {
432  return canParse<double>(value);
433  }
435  if (value == "current") {
436  return true;
437  } else {
438  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
439  }
441  if ((value == "random") || (value == "max")) {
442  return true;
443  } else {
444  return canParse<double>(value);
445  }
447  if (value == "current") {
448  return true;
449  } else {
450  return canParse<double>(value);
451  }
452  case SUMO_ATTR_LINE:
453  return true;
455  return canParse<int>(value) && parse<int>(value) >= 0;
457  return canParse<int>(value) && parse<int>(value) >= 0;
458  case SUMO_ATTR_REROUTE:
459  return canParse<bool>(value);
461  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
462  return true;
463  } else {
464  return canParse<double>(value);
465  }
467  if ((value == "left") || (value == "right") || (value == "center")) {
468  return true;
469  } else {
470  return canParse<double>(value);
471  }
473  return areInsertionChecksValid(value);
474  case GNE_ATTR_SELECTED:
475  return canParse<bool>(value);
476  case GNE_ATTR_PARAMETERS:
477  return areParametersValid(value);
478  default:
479  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
480  }
481 }
482 
483 
484 bool
486  switch (key) {
487  case SUMO_ATTR_TYPE:
488  return (parametersSet & VEHPARS_VTYPE_SET) != 0;
490  return (parametersSet & VEHPARS_VPH_SET) != 0;
491  case SUMO_ATTR_SPEED:
493  default:
494  return true;
495  }
496 }
497 
498 
499 std::string
501  return getTagStr();
502 }
503 
504 
505 std::string
507  return getTagStr() + ": " + getAttribute(SUMO_ATTR_BEGIN) + " -> " + getAttribute(SUMO_ATTR_END);
508 }
509 
510 // ===========================================================================
511 // private
512 // ===========================================================================
513 
514 void
515 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
516  // declare string error
517  std::string error;
518  switch (key) {
519  case SUMO_ATTR_ID:
520  // update microsimID
521  setAdditionalID(value);
522  break;
523  case SUMO_ATTR_TYPE:
524  if (!isTemplate()) {
525  if (value.empty()) {
527  } else {
529  }
530  }
531  // set manually vtypeID (needed for saving)
532  vtypeid = value;
533  break;
534  case SUMO_ATTR_ROUTE:
536  break;
538  if (value.empty()) {
540  } else {
541  repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
542  // set parameters
544  }
545  break;
546  case SUMO_ATTR_SPEED:
547  if (value.empty()) {
549  } else {
550  calibratorSpeed = parse<double>(value);
551  // mark parameter as set
553  }
554  break;
555  case SUMO_ATTR_COLOR:
556  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
557  color = parse<RGBColor>(value);
558  // mark parameter as set
560  } else {
561  // set default value
562  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
563  // unset parameter
565  }
566  break;
567  case SUMO_ATTR_BEGIN:
568  depart = string2time(value);
569  break;
570  case SUMO_ATTR_END:
571  repetitionEnd = string2time(value);
572  break;
574  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
576  // mark parameter as set
578  } else {
579  // set default value
581  // unset parameter
583  }
584  break;
585  case SUMO_ATTR_DEPARTPOS:
586  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
588  // mark parameter as set
590  } else {
591  // set default value
593  // unset parameter
595  }
596  // update geometry (except for template)
597  if (getParentAdditionals().size() > 0) {
598  updateGeometry();
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  break;
614  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
616  // mark parameter as set
618  } else {
619  // set default value
621  // unset parameter
623  }
624  break;
626  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
628  // mark parameter as set
630  } else {
631  // set default value
633  // unset parameter
635  }
636  // update geometry (except for template)
637  if (getParentAdditionals().size() > 0) {
638  updateGeometry();
639  }
640  break;
642  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
644  // mark parameter as set
646  } else {
647  // set default value
649  // unset parameter
651  }
652  break;
653  case SUMO_ATTR_LINE:
654  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
655  line = value;
656  // mark parameter as set
658  } else {
659  // set default value
661  // unset parameter
663  }
664  break;
666  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
667  personNumber = parse<int>(value);
668  // mark parameter as set
670  } else {
671  // set default value
672  personNumber = parse<int>(myTagProperty.getDefaultValue(key));
673  // unset parameter
675  }
676  break;
678  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
679  containerNumber = parse<int>(value);
680  // mark parameter as set
682  } else {
683  // set default value
684  containerNumber = parse<int>(myTagProperty.getDefaultValue(key));
685  // unset parameter
687  }
688  break;
689  case SUMO_ATTR_REROUTE:
690  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
691  // mark parameter as set
693  } else {
694  // unset parameter
696  }
697  break;
699  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
701  // mark parameter as set
703  } else {
704  // set default value
706  // unset parameter
708  }
709  break;
711  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
713  // mark parameter as set
715  } else {
716  // set default value
718  // unset parameter
720  }
722  break;
724  parseInsertionChecks(value);
725  break;
726  case GNE_ATTR_SELECTED:
727  if (parse<bool>(value)) {
729  } else {
731  }
732  break;
733  case GNE_ATTR_PARAMETERS:
735  break;
736  default:
737  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
738  }
739 }
740 
741 
742 void
744  // nothing to do
745 }
746 
747 void
748 GNECalibratorFlow::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
749  // nothing to do
750 }
751 
752 
753 void
755  switch (key) {
756  case SUMO_ATTR_TYPE:
757  if (value) {
759  } else {
761  }
762  break;
764  if (value) {
766  } else {
768  }
769  break;
770  case SUMO_ATTR_SPEED:
771  if (value) {
773  } else {
775  }
776  break;
777  default:
778  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
779  }
780 }
781 
782 /****************************************************************************/
@ 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:295
#define TLF(string,...)
Definition: MsgHandler.h:317
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:69
#define STEPS2TIME(x)
Definition: SUMOTime.h:55
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
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_FLOW
a flow definition using from and to edges or a route
@ 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
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:49
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void drawListedAdditional(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
void setAdditionalID(const std::string &newID)
set additional ID
int getDrawPositionIndex() const
get draw position index (used in rerouters and VSS)
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
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
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
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
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
bool checkDrawMoveContour() const
check if draw move contour (red)
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
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
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
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
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 * retrieveDemandElements(const std::vector< SumoXMLTag > types, 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:122
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:143
Stores the information about how to visualize structures.
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static const std::vector< SumoXMLTag > types
type namespace
Definition: NamespaceIDs.h:53
static const std::vector< SumoXMLTag > routes
route namespace
Definition: NamespaceIDs.h:56
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:60
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:254
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:132
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 const RGBColor calibratorColor
color for Calibrators