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/GNEViewNet.h>
22 #include <netedit/GNEUndoList.h>
26 #include <utils/gui/div/GLHelper.h>
28 #include <utils/xml/NamespaceIDs.h>
29 
30 #include "GNECalibratorFlow.h"
31 
32 
33 // ===========================================================================
34 // member method definitions
35 // ===========================================================================
36 
39 {}, {}, {}, {}, {}, {}) {
40  // reset default values
41  resetDefaultValues();
42  // set VPH and speed enabled
43  toggleAttribute(SUMO_ATTR_VEHSPERHOUR, true);
44  toggleAttribute(SUMO_ATTR_SPEED, true);
45  // reset ID
46  id.clear();
47 }
48 
49 
51  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "",
52 {}, {}, {}, {calibratorParent}, {vehicleType, route}, {}),
54  // update centering boundary without updating grid
56  // reset ID
57  id.clear();
58 }
59 
60 
62  const SUMOVehicleParameter& vehicleParameters) :
63  GNEAdditional(calibratorParent->getNet(), GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "",
64 {}, {}, {}, {calibratorParent}, {vehicleType, route}, {}),
65 SUMOVehicleParameter(vehicleParameters) {
66  // update centering boundary without updating grid
68  // reset ID
69  id.clear();
70 }
71 
72 
74 
75 
76 void
79  // open tag
80  device.openTag(SUMO_TAG_FLOW);
81  // write vehicle attributes
83  // write end
85  // write route
87  // VPH
90  }
91  // write parameters
93  // close vehicle tag
94  device.closeTag();
95  } else {
96  WRITE_WARNING(TLF("calibratorFlow of calibrator '%' cannot be written. Either type or vehsPerHour or speed must be enabled", getParentAdditionals().front()->getID()));
97  }
98 }
99 
100 
101 bool
103  return true;
104 }
105 
106 
107 std::string
109  return "";
110 }
111 
112 
113 void
115  // nothing to fix
116 }
117 
118 
119 bool
121  return false;
122 }
123 
124 
127  // calibrators flow cannot be moved
128  return nullptr;
129 }
130 
131 
132 void
134  // update centering boundary (needed for centering)
136 }
137 
138 
139 Position
141  // get rerouter parent position
142  Position signPosition = getParentAdditionals().front()->getPositionInView();
143  // set position depending of indexes
144  signPosition.add(4.5, (getDrawPositionIndex() * -1) + 1, 0);
145  // return signPosition
146  return signPosition;
147 }
148 
149 
150 void
151 GNECalibratorFlow::updateCenteringBoundary(const bool /*updateGrid*/) {
152  // nothing to update
153 }
154 
155 
156 void
157 GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
158  // geometry of this element cannot be splitted
159 }
160 
161 
162 std::string
164  return getParentAdditionals().at(0)->getID();
165 }
166 
167 
168 void
171  // push rotation matrix
173  // move to parent additional position
174  glTranslated(getParentAdditionals().front()->getPositionInView().x(), getParentAdditionals().front()->getPositionInView().y(), 0);
175  // rotate
176  glRotated((-1 * getParentAdditionals().front()->getAdditionalGeometry().getShapeRotations().front()) + 180, 0, 0, 1);
177  // draw rerouter interval as listed attribute
179  // pop rotation matrix
181  }
182 }
183 
184 
185 std::string
187  switch (key) {
188  case SUMO_ATTR_ID:
189  return getMicrosimID();
190  case SUMO_ATTR_TYPE:
191  return vtypeid;
192  case SUMO_ATTR_ROUTE:
193  return getParentDemandElements().at(1)->getID();
196  return toString(3600 / STEPS2TIME(repetitionOffset));
197  } else {
198  return "";
199  }
200  case SUMO_ATTR_SPEED:
202  return toString(calibratorSpeed);
203  } else {
204  return "";
205  }
206  case SUMO_ATTR_COLOR:
207  if (wasSet(VEHPARS_COLOR_SET)) {
208  return toString(color);
209  } else {
211  }
212  case SUMO_ATTR_BEGIN:
213  return time2string(depart);
214  case SUMO_ATTR_END:
215  return time2string(repetitionEnd);
218  return getDepartLane();
219  } else {
221  }
222  case SUMO_ATTR_DEPARTPOS:
224  return getDepartPos();
225  } else {
227  }
230  return getDepartSpeed();
231  } else {
233  }
236  return getArrivalLane();
237  } else {
239  }
242  return getArrivalPos();
243  } else {
245  }
248  return getArrivalSpeed();
249  } else {
251  }
252  case SUMO_ATTR_LINE:
253  if (wasSet(VEHPARS_LINE_SET)) {
254  return line;
255  } else {
257  }
260  return toString(personNumber);
261  } else {
263  }
266  return toString(containerNumber);
267  } else {
269  }
270  case SUMO_ATTR_REROUTE:
272  return "true";
273  } else {
274  return "false";
275  }
278  return getDepartPosLat();
279  } else {
281  }
284  return getArrivalPosLat();
285  } else {
287  }
289  return getInsertionChecks();
290  case GNE_ATTR_PARENT:
291  return getParentAdditionals().at(0)->getID();
292  case GNE_ATTR_SELECTED:
294  case GNE_ATTR_PARAMETERS:
296  default:
297  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
298  }
299 }
300 
301 
302 double
304  switch (key) {
305  case SUMO_ATTR_DEPART:
306  case SUMO_ATTR_BEGIN:
307  case SUMO_ATTR_END:
308  return STEPS2TIME(depart);
309  case SUMO_ATTR_DEPARTPOS:
310  // only return departPos it if is given
312  return departPos;
313  } else {
314  return 0;
315  }
317  // only return departPos it if is given
319  return arrivalPos;
320  } else {
321  return -1;
322  }
323  case SUMO_ATTR_WIDTH:
324  case SUMO_ATTR_LENGTH:
325  case SUMO_ATTR_MINGAP:
326  return getParentDemandElements().at(0)->getAttributeDouble(key);
327  default:
328  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
329  }
330 }
331 
332 
333 const Parameterised::Map&
335  return PARAMETERS_EMPTY;
336 }
337 
338 
339 void
340 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
341  if (value == getAttribute(key)) {
342  return; //avoid needless changes, later logic relies on the fact that attributes have changed
343  }
344  switch (key) {
345  case SUMO_ATTR_ID:
346  case SUMO_ATTR_TYPE:
347  case SUMO_ATTR_ROUTE:
348  case SUMO_ATTR_COLOR:
350  case SUMO_ATTR_SPEED:
351  case SUMO_ATTR_BEGIN:
352  case SUMO_ATTR_END:
354  case SUMO_ATTR_DEPARTPOS:
359  case SUMO_ATTR_LINE:
362  case SUMO_ATTR_REROUTE:
366  case GNE_ATTR_SELECTED:
367  case GNE_ATTR_PARAMETERS:
368  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
369  break;
370  default:
371  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
372  }
373 }
374 
375 
376 bool
377 GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
378  switch (key) {
379  case SUMO_ATTR_ID:
380  return isValidAdditionalID(value);
381  case SUMO_ATTR_TYPE:
382  return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) == nullptr);
383  case SUMO_ATTR_ROUTE:
384  return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::routes, value, false) == nullptr);
386  if (value.empty()) {
387  // speed and vehsPerHour cannot be empty at the same time
389  return false;
390  } else {
391  return true;
392  }
393  } else if (canParse<double>(value)) {
394  const double dVal = parse<double>(value);
395  return (dVal >= 0 || dVal == -1);
396  } else {
397  return false;
398  }
399  case SUMO_ATTR_SPEED:
400  if (value.empty()) {
401  // speed and vehsPerHour cannot be empty at the same time
403  return false;
404  } else {
405  return true;
406  }
407  } else if (canParse<double>(value)) {
408  const double dVal = parse<double>(value);
409  return (dVal >= 0 || dVal == -1);
410  } else {
411  return false;
412  }
413  case SUMO_ATTR_COLOR:
414  return canParse<RGBColor>(value);
415  case SUMO_ATTR_BEGIN:
416  return canParse<SUMOTime>(value);
417  case SUMO_ATTR_END:
418  return canParse<SUMOTime>(value);
420  if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
421  return true;
422  } else {
423  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
424  }
425  case SUMO_ATTR_DEPARTPOS:
426  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
427  return true;
428  } else {
429  return canParse<double>(value);
430  }
432  if ((value == "random") || (value == "max")) {
433  return true;
434  } else {
435  return canParse<double>(value);
436  }
438  if (value == "current") {
439  return true;
440  } else {
441  return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
442  }
444  if ((value == "random") || (value == "max")) {
445  return true;
446  } else {
447  return canParse<double>(value);
448  }
450  if (value == "current") {
451  return true;
452  } else {
453  return canParse<double>(value);
454  }
455  case SUMO_ATTR_LINE:
456  return true;
458  return canParse<int>(value) && parse<int>(value) >= 0;
460  return canParse<int>(value) && parse<int>(value) >= 0;
461  case SUMO_ATTR_REROUTE:
462  return canParse<bool>(value);
464  if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
465  return true;
466  } else {
467  return canParse<double>(value);
468  }
470  if ((value == "left") || (value == "right") || (value == "center")) {
471  return true;
472  } else {
473  return canParse<double>(value);
474  }
476  return areInsertionChecksValid(value);
477  case GNE_ATTR_SELECTED:
478  return canParse<bool>(value);
479  case GNE_ATTR_PARAMETERS:
480  return areParametersValid(value);
481  default:
482  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
483  }
484 }
485 
486 
487 bool
489  switch (key) {
490  case SUMO_ATTR_TYPE:
491  return (parametersSet & VEHPARS_VTYPE_SET) != 0;
493  return (parametersSet & VEHPARS_VPH_SET) != 0;
494  case SUMO_ATTR_SPEED:
496  default:
497  return true;
498  }
499 }
500 
501 
502 std::string
504  return getTagStr();
505 }
506 
507 
508 std::string
510  return getTagStr() + ": " + getAttribute(SUMO_ATTR_BEGIN) + " -> " + getAttribute(SUMO_ATTR_END);
511 }
512 
513 // ===========================================================================
514 // private
515 // ===========================================================================
516 
517 void
518 GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
519  // declare string error
520  std::string error;
521  switch (key) {
522  case SUMO_ATTR_ID:
523  // update microsimID
524  setAdditionalID(value);
525  break;
526  case SUMO_ATTR_TYPE:
527  if (!isTemplate()) {
528  if (value.empty()) {
530  } else {
532  }
533  }
534  // set manually vtypeID (needed for saving)
535  vtypeid = value;
536  break;
537  case SUMO_ATTR_ROUTE:
539  break;
541  if (value.empty()) {
543  } else {
544  repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
545  // set parameters
547  }
548  break;
549  case SUMO_ATTR_SPEED:
550  if (value.empty()) {
552  } else {
553  calibratorSpeed = parse<double>(value);
554  // mark parameter as set
556  }
557  break;
558  case SUMO_ATTR_COLOR:
559  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
560  color = parse<RGBColor>(value);
561  // mark parameter as set
563  } else {
564  // set default value
565  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
566  // unset parameter
568  }
569  break;
570  case SUMO_ATTR_BEGIN:
571  depart = string2time(value);
572  break;
573  case SUMO_ATTR_END:
574  repetitionEnd = string2time(value);
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_DEPARTPOS:
589  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
591  // mark parameter as set
593  } else {
594  // set default value
596  // unset parameter
598  }
599  // update geometry (except for template)
600  if (getParentAdditionals().size() > 0) {
601  updateGeometry();
602  }
603  break;
605  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
607  // mark parameter as set
609  } else {
610  // set default value
612  // unset parameter
614  }
615  break;
617  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
619  // mark parameter as set
621  } else {
622  // set default value
624  // unset parameter
626  }
627  break;
629  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
631  // mark parameter as set
633  } else {
634  // set default value
636  // unset parameter
638  }
639  // update geometry (except for template)
640  if (getParentAdditionals().size() > 0) {
641  updateGeometry();
642  }
643  break;
645  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
647  // mark parameter as set
649  } else {
650  // set default value
652  // unset parameter
654  }
655  break;
656  case SUMO_ATTR_LINE:
657  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
658  line = value;
659  // mark parameter as set
661  } else {
662  // set default value
664  // unset parameter
666  }
667  break;
669  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
670  personNumber = parse<int>(value);
671  // mark parameter as set
673  } else {
674  // set default value
675  personNumber = parse<int>(myTagProperty.getDefaultValue(key));
676  // unset parameter
678  }
679  break;
681  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
682  containerNumber = parse<int>(value);
683  // mark parameter as set
685  } else {
686  // set default value
687  containerNumber = parse<int>(myTagProperty.getDefaultValue(key));
688  // unset parameter
690  }
691  break;
692  case SUMO_ATTR_REROUTE:
693  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
694  // mark parameter as set
696  } else {
697  // unset parameter
699  }
700  break;
702  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
704  // mark parameter as set
706  } else {
707  // set default value
709  // unset parameter
711  }
712  break;
714  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
716  // mark parameter as set
718  } else {
719  // set default value
721  // unset parameter
723  }
725  break;
727  parseInsertionChecks(value);
728  break;
729  case GNE_ATTR_SELECTED:
730  if (parse<bool>(value)) {
732  } else {
734  }
735  break;
736  case GNE_ATTR_PARAMETERS:
738  break;
739  default:
740  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
741  }
742 }
743 
744 
745 void
747  // nothing to do
748 }
749 
750 void
751 GNECalibratorFlow::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
752  // nothing to do
753 }
754 
755 
756 void
758  switch (key) {
759  case SUMO_ATTR_TYPE:
760  if (value) {
762  } else {
764  }
765  break;
767  if (value) {
769  } else {
771  }
772  break;
773  case SUMO_ATTR_SPEED:
774  if (value) {
776  } else {
778  }
779  break;
780  default:
781  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
782  }
783 }
784 
785 /****************************************************************************/
@ 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:123
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2136
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 GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:747
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.
bool showAdditionals() const
check if additionals has to be drawn
static const RGBColor calibratorColor
color for Calibrators