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-2023 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>
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}, {}),
63SUMOVehicleParameter(vehicleParameters) {
64 // update centering boundary without updating grid
66 // reset ID
67 id.clear();
68}
69
70
72
73
74void
77 // open tag
78 device.openTag(SUMO_TAG_FLOW);
79 // write vehicle attributes
81 // write end
83 // write route
85 // VPH
88 }
89 // write parameters
91 // close vehicle tag
92 device.closeTag();
93 } else {
94 WRITE_WARNING(TLF("calibratorFlow of calibrator '%' cannot be written. Either type or vehsPerHour or speed must be enabled", getParentAdditionals().front()->getID()));
95 }
96}
97
98
99bool
101 return true;
102}
103
104
105std::string
107 return "";
108}
109
110
111void
113 // nothing to fix
114}
115
116
119 // calibrators flow cannot be moved
120 return nullptr;
121}
122
123
124void
126 // update centering boundary (needed for centering)
128}
129
130
133 // get rerouter parent position
134 Position signPosition = getParentAdditionals().front()->getPositionInView();
135 // set position depending of indexes
136 signPosition.add(4.5, (getDrawPositionIndex() * -1) + 1, 0);
137 // return signPosition
138 return signPosition;
139}
140
141
142void
148
149
150void
151GNECalibratorFlow::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
152 // geometry of this element cannot be splitted
153}
154
155
156std::string
158 return getParentAdditionals().at(0)->getID();
159}
160
161
162void
164 // push rotation matrix
166 // move to parent additional position
167 glTranslated(getParentAdditionals().front()->getPositionInView().x(), getParentAdditionals().front()->getPositionInView().y(), 0);
168 // rotate
169 glRotated((-1 * getParentAdditionals().front()->getAdditionalGeometry().getShapeRotations().front()) + 180, 0, 0, 1);
170 // draw rerouter interval as listed attribute
172 // pop rotation matrix
174}
175
176
177std::string
179 switch (key) {
180 case SUMO_ATTR_ID:
181 return getMicrosimID();
182 case SUMO_ATTR_TYPE:
183 return vtypeid;
184 case SUMO_ATTR_ROUTE:
185 return getParentDemandElements().at(1)->getID();
188 return toString(3600 / STEPS2TIME(repetitionOffset));
189 } else {
190 return "";
191 }
192 case SUMO_ATTR_SPEED:
195 } else {
196 return "";
197 }
198 case SUMO_ATTR_COLOR:
200 return toString(color);
201 } else {
203 }
204 case SUMO_ATTR_BEGIN:
205 return time2string(depart);
206 case SUMO_ATTR_END:
210 return getDepartLane();
211 } else {
213 }
216 return getDepartPos();
217 } else {
219 }
222 return getDepartSpeed();
223 } else {
225 }
228 return getArrivalLane();
229 } else {
231 }
234 return getArrivalPos();
235 } else {
237 }
240 return getArrivalSpeed();
241 } else {
243 }
244 case SUMO_ATTR_LINE:
246 return line;
247 } else {
249 }
252 return toString(personNumber);
253 } else {
255 }
259 } else {
261 }
264 return "true";
265 } else {
266 return "false";
267 }
270 return getDepartPosLat();
271 } else {
273 }
276 return getArrivalPosLat();
277 } else {
279 }
281 return getInsertionChecks();
282 case GNE_ATTR_PARENT:
283 return getParentAdditionals().at(0)->getID();
288 default:
289 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
290 }
291}
292
293
294double
296 switch (key) {
297 case SUMO_ATTR_DEPART:
298 case SUMO_ATTR_BEGIN:
299 case SUMO_ATTR_END:
300 return STEPS2TIME(depart);
302 // only return departPos it if is given
304 return departPos;
305 } else {
306 return 0;
307 }
309 // only return departPos it if is given
311 return arrivalPos;
312 } else {
313 return -1;
314 }
315 case SUMO_ATTR_WIDTH:
316 case SUMO_ATTR_LENGTH:
317 case SUMO_ATTR_MINGAP:
318 return getParentDemandElements().at(0)->getAttributeDouble(key);
319 default:
320 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
321 }
322}
323
324
329
330
331void
332GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
333 if (value == getAttribute(key)) {
334 return; //avoid needless changes, later logic relies on the fact that attributes have changed
335 }
336 switch (key) {
337 case SUMO_ATTR_ID:
338 case SUMO_ATTR_TYPE:
339 case SUMO_ATTR_ROUTE:
340 case SUMO_ATTR_COLOR:
342 case SUMO_ATTR_SPEED:
343 case SUMO_ATTR_BEGIN:
344 case SUMO_ATTR_END:
351 case SUMO_ATTR_LINE:
360 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
361 break;
362 default:
363 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
364 }
365}
366
367
368bool
369GNECalibratorFlow::isValid(SumoXMLAttr key, const std::string& value) {
370 switch (key) {
371 case SUMO_ATTR_ID:
372 return isValidAdditionalID(value);
373 case SUMO_ATTR_TYPE:
375 case SUMO_ATTR_ROUTE:
378 if (value.empty()) {
379 // speed and vehsPerHour cannot be empty at the same time
381 return false;
382 } else {
383 return true;
384 }
385 } else if (canParse<double>(value)) {
386 const double dVal = parse<double>(value);
387 return (dVal >= 0 || dVal == -1);
388 } else {
389 return false;
390 }
391 case SUMO_ATTR_SPEED:
392 if (value.empty()) {
393 // speed and vehsPerHour cannot be empty at the same time
395 return false;
396 } else {
397 return true;
398 }
399 } else if (canParse<double>(value)) {
400 const double dVal = parse<double>(value);
401 return (dVal >= 0 || dVal == -1);
402 } else {
403 return false;
404 }
405 case SUMO_ATTR_COLOR:
406 return canParse<RGBColor>(value);
407 case SUMO_ATTR_BEGIN:
408 return canParse<SUMOTime>(value);
409 case SUMO_ATTR_END:
410 return canParse<SUMOTime>(value);
412 if ((value == "random") || (value == "free") || (value == "allowed") || (value == "best") || (value == "first")) {
413 return true;
414 } else {
415 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
416 }
418 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "base") || (value == "last")) {
419 return true;
420 } else {
421 return canParse<double>(value);
422 }
424 if ((value == "random") || (value == "max")) {
425 return true;
426 } else {
427 return canParse<double>(value);
428 }
430 if (value == "current") {
431 return true;
432 } else {
433 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
434 }
436 if ((value == "random") || (value == "max")) {
437 return true;
438 } else {
439 return canParse<double>(value);
440 }
442 if (value == "current") {
443 return true;
444 } else {
445 return canParse<double>(value);
446 }
447 case SUMO_ATTR_LINE:
448 return true;
450 return canParse<int>(value) && parse<int>(value) >= 0;
452 return canParse<int>(value) && parse<int>(value) >= 0;
454 return canParse<bool>(value);
456 if ((value == "random") || (value == "free") || (value == "random_free") || (value == "left") || (value == "right") || (value == "center")) {
457 return true;
458 } else {
459 return canParse<double>(value);
460 }
462 if ((value == "left") || (value == "right") || (value == "center")) {
463 return true;
464 } else {
465 return canParse<double>(value);
466 }
468 return areInsertionChecksValid(value);
470 return canParse<bool>(value);
472 return areParametersValid(value);
473 default:
474 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
475 }
476}
477
478
479bool
481 switch (key) {
482 case SUMO_ATTR_TYPE:
483 return (parametersSet & VEHPARS_VTYPE_SET) != 0;
485 return (parametersSet & VEHPARS_VPH_SET) != 0;
486 case SUMO_ATTR_SPEED:
488 default:
489 return true;
490 }
491}
492
493
494std::string
496 return getTagStr();
497}
498
499
500std::string
504
505// ===========================================================================
506// private
507// ===========================================================================
508
509void
510GNECalibratorFlow::setAttribute(SumoXMLAttr key, const std::string& value) {
511 // declare string error
512 std::string error;
513 switch (key) {
514 case SUMO_ATTR_ID:
515 // update microsimID
516 setMicrosimID(value);
517 break;
518 case SUMO_ATTR_TYPE:
519 if (!isTemplate()) {
520 if (value.empty()) {
522 } else {
524 }
525 }
526 // set manually vtypeID (needed for saving)
527 vtypeid = value;
528 break;
529 case SUMO_ATTR_ROUTE:
531 break;
533 if (value.empty()) {
534 parametersSet &= ~VEHPARS_VPH_SET;
535 } else {
536 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
537 // set parameters
539 }
540 break;
541 case SUMO_ATTR_SPEED:
542 if (value.empty()) {
543 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
544 } else {
545 calibratorSpeed = parse<double>(value);
546 // mark parameter as set
548 }
549 break;
550 case SUMO_ATTR_COLOR:
551 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
552 color = parse<RGBColor>(value);
553 // mark parameter as set
555 } else {
556 // set default value
557 color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
558 // unset parameter
559 parametersSet &= ~VEHPARS_COLOR_SET;
560 }
561 break;
562 case SUMO_ATTR_BEGIN:
563 depart = string2time(value);
564 break;
565 case SUMO_ATTR_END:
566 repetitionEnd = string2time(value);
567 break;
569 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
571 // mark parameter as set
573 } else {
574 // set default value
576 // unset parameter
577 parametersSet &= ~VEHPARS_DEPARTLANE_SET;
578 }
579 break;
581 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
583 // mark parameter as set
585 } else {
586 // set default value
588 // unset parameter
589 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
590 }
591 // update geometry (except for template)
592 if (getParentAdditionals().size() > 0) {
594 }
595 break;
597 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
599 // mark parameter as set
601 } else {
602 // set default value
604 // unset parameter
605 parametersSet &= ~VEHPARS_DEPARTSPEED_SET;
606 }
607 break;
609 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
611 // mark parameter as set
613 } else {
614 // set default value
616 // unset parameter
617 parametersSet &= ~VEHPARS_ARRIVALLANE_SET;
618 }
619 break;
621 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
623 // mark parameter as set
625 } else {
626 // set default value
628 // unset parameter
629 parametersSet &= ~VEHPARS_ARRIVALPOS_SET;
630 }
631 // update geometry (except for template)
632 if (getParentAdditionals().size() > 0) {
634 }
635 break;
637 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
639 // mark parameter as set
641 } else {
642 // set default value
644 // unset parameter
645 parametersSet &= ~VEHPARS_ARRIVALSPEED_SET;
646 }
647 break;
648 case SUMO_ATTR_LINE:
649 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
650 line = value;
651 // mark parameter as set
653 } else {
654 // set default value
656 // unset parameter
657 parametersSet &= ~VEHPARS_LINE_SET;
658 }
659 break;
661 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
662 personNumber = parse<int>(value);
663 // mark parameter as set
665 } else {
666 // set default value
667 personNumber = parse<int>(myTagProperty.getDefaultValue(key));
668 // unset parameter
669 parametersSet &= ~VEHPARS_PERSON_NUMBER_SET;
670 }
671 break;
673 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
674 containerNumber = parse<int>(value);
675 // mark parameter as set
677 } else {
678 // set default value
680 // unset parameter
681 parametersSet &= ~VEHPARS_CONTAINER_NUMBER_SET;
682 }
683 break;
685 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
686 // mark parameter as set
688 } else {
689 // unset parameter
690 parametersSet &= ~VEHPARS_ROUTE_SET;
691 }
692 break;
694 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
696 // mark parameter as set
698 } else {
699 // set default value
701 // unset parameter
702 parametersSet &= ~VEHPARS_DEPARTPOSLAT_SET;
703 }
704 break;
706 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
708 // mark parameter as set
710 } else {
711 // set default value
713 // unset parameter
714 parametersSet &= ~VEHPARS_ARRIVALPOSLAT_SET;
715 }
717 break;
720 break;
722 if (parse<bool>(value)) {
724 } else {
726 }
727 break;
730 break;
731 default:
732 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
733 }
734}
735
736
737void
739 // nothing to do
740}
741
742void
743GNECalibratorFlow::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
744 // nothing to do
745}
746
747
748void
750 switch (key) {
751 case SUMO_ATTR_TYPE:
752 if (value) {
754 } else {
755 parametersSet &= ~VEHPARS_VTYPE_SET;
756 }
757 break;
759 if (value) {
761 } else {
762 parametersSet &= ~VEHPARS_VPH_SET;
763 }
764 break;
765 case SUMO_ATTR_SPEED:
766 if (value) {
768 } else {
769 parametersSet &= ~VEHPARS_CALIBRATORSPEED_SET;
770 }
771 break;
772 default:
773 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
774 }
775}
776
777/****************************************************************************/
@ 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:270
#define TLF(string,...)
Definition MsgHandler.h:288
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_VEHICLE
description of a vehicle
@ 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
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.
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
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
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 writed into XML (must be reimplemented in all detector chi...
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:120
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
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
Stores the information about how to visualize structures.
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
static OptionsCont & getOptions()
Retrieves the options.
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: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