Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNECalibratorFlow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-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>
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}, {}),
65SUMOVehicleParameter(vehicleParameters) {
66 // update centering boundary without updating grid
68 // reset ID
69 id.clear();
70}
71
72
74
75
76void
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
101bool
103 return true;
104}
105
106
107std::string
109 return "";
110}
111
112
113void
115 // nothing to fix
116}
117
118
119bool
121 return false;
122}
123
124
127 // calibrators flow cannot be moved
128 return nullptr;
129}
130
131
132void
134 // update centering boundary (needed for centering)
136}
137
138
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
150void
152 // nothing to update
153}
154
155
156void
157GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
158 // geometry of this element cannot be splitted
159}
160
161
162std::string
164 return getParentAdditionals().at(0)->getID();
165}
166
167
168void
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
185std::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:
203 } else {
204 return "";
205 }
206 case SUMO_ATTR_COLOR:
208 return toString(color);
209 } else {
211 }
212 case SUMO_ATTR_BEGIN:
213 return time2string(depart);
214 case SUMO_ATTR_END:
218 return getDepartLane();
219 } else {
221 }
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:
254 return line;
255 } else {
257 }
260 return toString(personNumber);
261 } else {
263 }
267 } else {
269 }
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();
294 default:
295 return getCommonAttribute(key);
296 }
297}
298
299
300double
302 switch (key) {
303 case SUMO_ATTR_DEPART:
304 case SUMO_ATTR_BEGIN:
305 case SUMO_ATTR_END:
306 return STEPS2TIME(depart);
308 // only return departPos it if is given
310 return departPos;
311 } else {
312 return 0;
313 }
315 // only return departPos it if is given
317 return arrivalPos;
318 } else {
319 return -1;
320 }
321 case SUMO_ATTR_WIDTH:
322 case SUMO_ATTR_LENGTH:
323 case SUMO_ATTR_MINGAP:
324 return getParentDemandElements().at(0)->getAttributeDouble(key);
325 default:
326 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
327 }
328}
329
330
335
336
337void
338GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
339 if (value == getAttribute(key)) {
340 return; //avoid needless changes, later logic relies on the fact that attributes have changed
341 }
342 switch (key) {
343 case SUMO_ATTR_ID:
344 case SUMO_ATTR_TYPE:
345 case SUMO_ATTR_ROUTE:
346 case SUMO_ATTR_COLOR:
348 case SUMO_ATTR_SPEED:
349 case SUMO_ATTR_BEGIN:
350 case SUMO_ATTR_END:
357 case SUMO_ATTR_LINE:
365 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
366 break;
367 default:
368 setCommonAttribute(key, value, undoList);
369 break;
370 }
371}
372
373
374bool
375GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
376 switch (key) {
377 case SUMO_ATTR_ID:
378 return isValidAdditionalID(value);
379 case SUMO_ATTR_TYPE:
380 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) == nullptr);
381 case SUMO_ATTR_ROUTE:
382 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::routes, value, false) == nullptr);
384 if (value.empty()) {
385 // speed and vehsPerHour cannot be empty at the same time
387 return false;
388 } else {
389 return true;
390 }
391 } else if (canParse<double>(value)) {
392 const double dVal = parse<double>(value);
393 return (dVal >= 0 || dVal == -1);
394 } else {
395 return false;
396 }
397 case SUMO_ATTR_SPEED:
398 if (value.empty()) {
399 // speed and vehsPerHour cannot be empty at the same time
401 return false;
402 } else {
403 return true;
404 }
405 } else if (canParse<double>(value)) {
406 const double dVal = parse<double>(value);
407 return (dVal >= 0 || dVal == -1);
408 } else {
409 return false;
410 }
411 case SUMO_ATTR_COLOR:
412 return canParse<RGBColor>(value);
413 case SUMO_ATTR_BEGIN:
414 return canParse<SUMOTime>(value);
415 case SUMO_ATTR_END:
416 return canParse<SUMOTime>(value);
418 if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
419 return true;
420 } else {
421 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
422 }
424 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
425 return true;
426 } else {
427 return canParse<double>(value);
428 }
430 if ((value == "random") || (value == "max")) {
431 return true;
432 } else {
433 return canParse<double>(value);
434 }
436 if (value == "current") {
437 return true;
438 } else {
439 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
440 }
442 if ((value == "random") || (value == "max")) {
443 return true;
444 } else {
445 return canParse<double>(value);
446 }
448 if (value == "current") {
449 return true;
450 } else {
451 return canParse<double>(value);
452 }
453 case SUMO_ATTR_LINE:
454 return true;
456 return canParse<int>(value) && parse<int>(value) >= 0;
458 return canParse<int>(value) && parse<int>(value) >= 0;
460 return canParse<bool>(value);
462 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
463 return true;
464 } else {
465 return canParse<double>(value);
466 }
468 if ((value == "left") || (value == "right") || (value == "center")) {
469 return true;
470 } else {
471 return canParse<double>(value);
472 }
474 return areInsertionChecksValid(value);
476 return areParametersValid(value);
477 default:
478 return isCommonValid(key, value);
479 }
480}
481
482
483bool
485 switch (key) {
486 case SUMO_ATTR_TYPE:
487 return (parametersSet & VEHPARS_VTYPE_SET) != 0;
489 return (parametersSet & VEHPARS_VPH_SET) != 0;
490 case SUMO_ATTR_SPEED:
492 default:
493 return true;
494 }
495}
496
497
498std::string
500 return getTagStr();
501}
502
503
504std::string
508
509// ===========================================================================
510// private
511// ===========================================================================
512
513void
514GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
515 // declare string error
516 std::string error;
517 switch (key) {
518 case SUMO_ATTR_ID:
519 // update microsimID
520 setAdditionalID(value);
521 break;
522 case SUMO_ATTR_TYPE:
523 if (!isTemplate()) {
524 if (value.empty()) {
526 } else {
528 }
529 }
530 // set manually vtypeID (needed for saving)
531 vtypeid = value;
532 break;
533 case SUMO_ATTR_ROUTE:
535 break;
537 if (value.empty()) {
538 parametersSet &= ~VEHPARS_VPH_SET;
539 } else {
540 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
541 // set parameters
543 }
544 break;
545 case SUMO_ATTR_SPEED:
546 if (value.empty()) {
547 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
548 } else {
549 calibratorSpeed = parse<double>(value);
550 // mark parameter as set
552 }
553 break;
554 case SUMO_ATTR_COLOR:
555 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
556 color = parse<RGBColor>(value);
557 // mark parameter as set
559 } else {
560 // set default value
561 color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
562 // unset parameter
563 parametersSet &= ~VEHPARS_COLOR_SET;
564 }
565 break;
566 case SUMO_ATTR_BEGIN:
567 depart = string2time(value);
568 break;
569 case SUMO_ATTR_END:
570 repetitionEnd = string2time(value);
571 break;
573 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
575 // mark parameter as set
577 } else {
578 // set default value
580 // unset parameter
581 parametersSet &= ~VEHPARS_DEPARTLANE_SET;
582 }
583 break;
585 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
587 // mark parameter as set
589 } else {
590 // set default value
592 // unset parameter
593 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
594 }
595 // update geometry (except for template)
596 if (getParentAdditionals().size() > 0) {
598 }
599 break;
601 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
603 // mark parameter as set
605 } else {
606 // set default value
608 // unset parameter
609 parametersSet &= ~VEHPARS_DEPARTSPEED_SET;
610 }
611 break;
613 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
615 // mark parameter as set
617 } else {
618 // set default value
620 // unset parameter
621 parametersSet &= ~VEHPARS_ARRIVALLANE_SET;
622 }
623 break;
625 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
627 // mark parameter as set
629 } else {
630 // set default value
632 // unset parameter
633 parametersSet &= ~VEHPARS_ARRIVALPOS_SET;
634 }
635 // update geometry (except for template)
636 if (getParentAdditionals().size() > 0) {
638 }
639 break;
641 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
643 // mark parameter as set
645 } else {
646 // set default value
648 // unset parameter
649 parametersSet &= ~VEHPARS_ARRIVALSPEED_SET;
650 }
651 break;
652 case SUMO_ATTR_LINE:
653 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
654 line = value;
655 // mark parameter as set
657 } else {
658 // set default value
660 // unset parameter
661 parametersSet &= ~VEHPARS_LINE_SET;
662 }
663 break;
665 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
666 personNumber = parse<int>(value);
667 // mark parameter as set
669 } else {
670 // set default value
671 personNumber = parse<int>(myTagProperty.getDefaultValue(key));
672 // unset parameter
673 parametersSet &= ~VEHPARS_PERSON_NUMBER_SET;
674 }
675 break;
677 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
678 containerNumber = parse<int>(value);
679 // mark parameter as set
681 } else {
682 // set default value
684 // unset parameter
685 parametersSet &= ~VEHPARS_CONTAINER_NUMBER_SET;
686 }
687 break;
689 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
690 // mark parameter as set
692 } else {
693 // unset parameter
694 parametersSet &= ~VEHPARS_ROUTE_SET;
695 }
696 break;
698 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
700 // mark parameter as set
702 } else {
703 // set default value
705 // unset parameter
706 parametersSet &= ~VEHPARS_DEPARTPOSLAT_SET;
707 }
708 break;
710 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
712 // mark parameter as set
714 } else {
715 // set default value
717 // unset parameter
718 parametersSet &= ~VEHPARS_ARRIVALPOSLAT_SET;
719 }
721 break;
724 break;
727 break;
728 default:
729 setCommonAttribute(key, value);
730 break;
731 }
732}
733
734
735void
737 // nothing to do
738}
739
740void
741GNECalibratorFlow::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
742 // nothing to do
743}
744
745
746void
748 switch (key) {
749 case SUMO_ATTR_TYPE:
750 if (value) {
752 } else {
753 parametersSet &= ~VEHPARS_VTYPE_SET;
754 }
755 break;
757 if (value) {
759 } else {
760 parametersSet &= ~VEHPARS_VPH_SET;
761 }
762 break;
763 case SUMO_ATTR_SPEED:
764 if (value) {
766 } else {
767 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
768 }
769 break;
770 default:
771 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
772 }
773}
774
775/****************************************************************************/
@ 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 long long int VEHPARS_ARRIVALSPEED_SET
const long long int VEHPARS_DEPARTPOSLAT_SET
const long long int VEHPARS_ARRIVALPOSLAT_SET
const long long int VEHPARS_PERSON_NUMBER_SET
const long long int VEHPARS_DEPARTSPEED_SET
@ GIVEN
The position is given.
const long long int VEHPARS_ROUTE_SET
const long long int VEHPARS_COLOR_SET
const long long int VEHPARS_ARRIVALLANE_SET
const long long int VEHPARS_DEPARTLANE_SET
const long long int VEHPARS_DEPARTPOS_SET
const long long int VEHPARS_ARRIVALPOS_SET
const long long int VEHPARS_CONTAINER_NUMBER_SET
const long long int VEHPARS_VTYPE_SET
const long long int VEHPARS_VPH_SET
@ GIVEN
The arrival position is given.
const long long int VEHPARS_CALIBRATORSPEED_SET
const long long int VEHPARS_LINE_SET
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_ROUTE
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
@ 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:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
An Element which don't belong to GNENet but has influence in the simulation.
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)
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
bool isCommonValid(SumoXMLAttr key, const std::string &value)
static const Parameterised::Map PARAMETERS_EMPTY
empty parameter maps (used by ACs without parameters)
GNENet * myNet
pointer to net
std::string getCommonAttribute(SumoXMLAttr key) const
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:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2163
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
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Stores the information about how to visualize structures.
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static const std::vector< SumoXMLTag > types
type namespace
static const std::vector< SumoXMLTag > routes
route namespace
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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
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 departLane
(optional) The lane the vehicle shall depart from (index in edge)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
std::string vtypeid
The vehicle's type id.
std::string getDepartLane() const
obtain depart lane parameter in string format
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
bool wasSet(long long int what) const
Returns whether the given parameter was set.
std::string getDepartSpeed() const
obtain depart speed parameter in string format
std::string getArrivalPos() const
obtain arrival pos parameter in string format
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
RGBColor color
The vehicle's color, TraCI may change this.
bool areInsertionChecksValid(const std::string &value) const
check if given insertion checks are valid
double arrivalPos
(optional) The position the vehicle shall arrive on
static int parseInsertionChecks(const std::string &value)
parses insertion checks
double calibratorSpeed
speed (used by calibrator flows
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
std::string getInsertionChecks() const
get insertion checks in string format
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
std::string getDepartPos() const
obtain depart pos parameter in string format
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
int insertionChecks
bitset of InsertionCheck
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport)
int containerNumber
The static number of containers in the vehicle when it departs.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
bool showAdditionals() const
check if additionals has to be drawn
static const RGBColor calibratorColor
color for Calibrators