70 #define NODEFAULTVALUE "<NODEFAULTVALUE>" 99 template<> std::string
107 if (
string.size() == 0) {
125 if (
string.size() == 0) {
135 template<> std::vector<std::string>
137 std::vector<std::string> parsedValues;
143 template<> std::vector<int>
145 std::vector<std::string> parsedValues = parse<std::vector<std::string> >(string);
146 std::vector<int> parsedIntValues;
147 for (
auto i : parsedValues) {
148 parsedIntValues.push_back(parse<int>(i));
150 return parsedIntValues;
154 template<> std::vector<double>
156 std::vector<std::string> parsedValues = parse<std::vector<std::string> >(string);
157 std::vector<double> parsedDoubleValues;
158 for (
auto i : parsedValues) {
159 parsedDoubleValues.push_back(parse<double>(i));
161 return parsedDoubleValues;
165 template<> std::vector<bool>
167 std::vector<std::string> parsedValues = parse<std::vector<std::string> >(string);
168 std::vector<bool> parsedBoolValues;
169 for (
auto i : parsedValues) {
170 parsedBoolValues.push_back(parse<bool>(i));
172 return parsedBoolValues;
200 std::vector<SumoXMLAttr>
202 std::vector<SumoXMLAttr> attr;
204 attr.push_back(i.first);
218 if (
isInt(tag, attr)) {
220 }
else if (
isFloat(tag, attr)) {
222 }
else if (
isTime(tag, attr)) {
224 }
else if (
isBool(tag, attr)) {
226 }
else if (
isColor(tag, attr)) {
230 }
else if (
isList(tag, attr)) {
240 return value.find_first_of(
" \t\n\r@$%^&/|\\{}*'\";:<>") == std::string::npos;
248 return (value.find_first_of(
"\t\n\r@$%^&|\\{}*'\";:<>") == std::string::npos);
256 const std::vector<std::pair <SumoXMLAttr, std::string> >&
266 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"13.89"));
269 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
270 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
"all"));
273 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
276 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NAME,
""));
277 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"default"));
285 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
286 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SHAPE,
""));
287 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_RADIUS,
"1.5"));
290 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TLID,
""));
294 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"13.89"));
295 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ALLOW,
"all"));
298 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"default"));
307 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_COLOR,
"red"));
308 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANE,
""));
309 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
310 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LAYER,
"0"));
311 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"0"));
312 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_HEIGHT,
"0"));
314 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ANGLE,
"0"));
319 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_COLOR,
"green"));
320 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILL,
"false"));
321 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LAYER,
"0"));
322 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TYPE,
""));
324 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ANGLE,
"0"));
330 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"3"));
337 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PASS,
"false"));
348 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NAME,
""));
350 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
357 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NAME,
""));
359 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINES,
""));
366 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NAME,
""));
378 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
386 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LENGTH,
"10"));
388 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
389 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_CONT,
"false"));
397 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_X,
"0"));
398 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_Y,
"0"));
400 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
416 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LANES,
""));
417 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
430 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
431 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PROB,
"1"));
432 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_OFF,
"false"));
438 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_FILE,
""));
439 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_BEGIN,
"0"));
444 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_END,
"10"));
453 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PERIOD,
"-1"));
454 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_PROB,
"-1"));
455 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_NUMBER,
"100"));
462 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LINE,
""));
465 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_REROUTE,
"false"));
472 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_COLOR,
""));
476 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_ACCEL,
"2.6"));
477 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_DECEL,
"4.5"));
478 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SIGMA,
"0.5"));
479 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_TAU,
"1.0"));
480 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_LENGTH,
"5.0"));
481 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_MINGAP,
"2.5"));
485 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_COLOR,
"1,1,0"));
486 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_VCLASS,
"unknown"));
489 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_WIDTH,
"2.0"));
504 attrs.push_back(std::pair<SumoXMLAttr, std::string>(
SUMO_ATTR_SPEED,
"50.0"));
515 std::vector<SumoXMLTag>
517 std::vector<SumoXMLTag> tags;
526 const std::vector<SumoXMLTag>&
540 const std::vector<SumoXMLTag>&
562 const std::vector<SumoXMLTag>&
1057 if (i.first == attr) {
1068 if (i.first == attr) {
1076 const std::vector<std::string>&
1080 std::vector<std::string> choices;
1083 for (
auto it : choices) {
1091 for (
auto it : choices) {
1099 for (
auto it : choices) {
1105 for (
auto it : choices) {
1117 for (
auto it : choices) {
1221 myAttrDefinitions[
SUMO_TAG_BUS_STOP][
SUMO_ATTR_FRIENDLY_POS] =
"If set, no error will be reported if element is placed behind the lane. Instead,it will be placed 0.1 meters from the lanes end or at position 0.1, if the position was negative and larger than the lanes length after multiplication with - 1";
1229 myAttrDefinitions[
SUMO_TAG_CONTAINER_STOP][
SUMO_ATTR_FRIENDLY_POS] =
"If set, no error will be reported if element is placed behind the lane. Instead,it will be placed 0.1 meters from the lanes end or at position 0.1, if the position was negative and larger than the lanes length after multiplication with - 1";
1248 myAttrDefinitions[
SUMO_TAG_E1DETECTOR][
SUMO_ATTR_FRIENDLY_POS] =
"If set, no error will be reported if element is placed behind the lane. Instead,it will be placed 0.1 meters from the lanes end or at position 0.1, if the position was negative and larger than the lanes length after multiplication with - 1";
1260 myAttrDefinitions[
SUMO_TAG_E2DETECTOR][
SUMO_ATTR_FRIENDLY_POS] =
"If set, no error will be reported if element is placed behind the lane. Instead,it will be placed 0.1 meters from the lanes end or at position 0.1, if the position was negative and larger than the lanes length after multiplication with - 1";
1272 myAttrDefinitions[
SUMO_TAG_DET_ENTRY][
SUMO_ATTR_FRIENDLY_POS] =
"If set, no error will be reported if element is placed behind the lane. Instead,it will be placed 0.1 meters from the lanes end or at position 0.1, if the position was negative and larger than the lanes length after multiplication with - 1";
1276 myAttrDefinitions[
SUMO_TAG_DET_EXIT][
SUMO_ATTR_FRIENDLY_POS] =
"If set, no error will be reported if element is placed behind the lane. Instead,it will be placed 0.1 meters from the lanes end or at position 0.1, if the position was negative and larger than the lanes length after multiplication with - 1";
1379 return parse<int>(i.second);
1391 return parse<double>(i.second);
1403 return parse<bool>(i.second);
1411 template<> std::string
1427 return parse<SUMOVehicleClass>(i.second);
1439 return parse<SUMOVehicleShape>(i.second);
1451 return parse<RGBColor>(i.second);
1459 template<> std::vector<int>
1463 return parse<std::vector<int> >(i.second);
1471 template<> std::vector<double>
1475 return parse<std::vector<double> >(i.second);
1483 template<> std::vector<bool>
1487 return parse<std::vector<bool> >(i.second);
1495 template<> std::vector<std::string>
1499 return parse<std::vector<std::string> >(i.second);
static bool _str2Bool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter ...
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myColorAttrs
map with the color attributes
The information about how to spread the lanes from the given position.
SumoXMLTag
Numbers representing SUMO-XML - element names.
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static RGBColor parseColor(std::string coldef)
Parses a color information.
static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical of type float
description of a vehicle type
Whether vehicles must keep the junction clear.
whether a given shape is user-defined
static std::string getAttributeType(SumoXMLTag tag, SumoXMLAttr attr)
get type of attribute
GNEAttributeCarrier(SumoXMLTag tag, GUIIcon icon)
Constructor.
const SumoXMLTag myTag
the xml tag to which this attribute carrier corresponds
begin/end of the description of a junction
begin/end of the description of a single lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
std::vector< SumoXMLAttr > getAttrs() const
get vector of attributes
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false)
a flow definition (used by router)
static std::map< SumoXMLTag, std::map< SumoXMLAttr, std::string > > myAttrDefinitions
map with the definition of attributes
static bool isDiscrete(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is Discrete
GUIIcon
An enumeration of icons used by the gui applications.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
static std::vector< SumoXMLTag > myAllowedShapeTags
vector with the allowed tags of shapes
static const std::vector< SumoXMLTag > & allowedShapeTags()
get all editable for tag shape elements
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myPositiveAttrs
map with the positive attributes
connectio between two lanes
Allow/disallow charge in transit in Charging Stations.
static const std::vector< SumoXMLTag > & allowedNetElementsTags()
get all editable for tag net elements
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myUniqueAttrs
map with the unique attributes (i.e. attributes without default values)
static std::map< SumoXMLTag, std::map< SumoXMLAttr, std::vector< std::string > > > myDiscreteChoices
map with the values of discrete choices
foe visibility distance of a link
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myBoolAttrs
map with the boolean attributes
static const std::string LOADED
feature is still unchanged after being loaded (implies approval)
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myProbabilityAttrs
map with the probability attributes
static int getHigherNumberOfAttributes()
return the number of attributes of the tag with the most highter number of attributes ...
GUIIcon myIcon
icon associated to this AC
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myTimeAttrs
map with the attributes of type time
weights: time range begin
link,node: the traffic light id responsible for this link
static bool isPositive(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is only Positive (i.e. cannot take negative values)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a polygon
static std::map< SumoXMLTag, std::vector< std::pair< SumoXMLAttr, std::string > > > _allowedAttributes
map with the allowed attributes and their default values
static std::vector< SumoXMLTag > myBlockShapeTags
vector with the allowed tags that can block their shapes
static bool isValidFilename(const std::string &value)
true if value is a valid file value
first coordinate of edge shape
static const std::vector< std::pair< SumoXMLAttr, std::string > > & allowedAttributes(SumoXMLTag tag)
get all editable attributes for tag and their default values.
begin/end of the description of a route
static double _str2double(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
static std::vector< SumoXMLTag > myAllowedNetElementTags
vector with the allowed tags of netElements
static bool isString(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type string
static std::vector< SumoXMLTag > allowedTags()
get all editable for tag elements of all types
std::vector< std::string > getStrings() const
static const std::vector< std::string > & discreteChoices(SumoXMLTag tag, SumoXMLAttr attr)
return a list of discrete choices for this attribute or an empty vector
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myListAttrs
map with the attributes of type list
static bool isInt(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical or type int
static bool isValidID(const std::string &value)
true if value is a valid sumo ID
static const std::string MODIFIED
feature has been manually modified (implies approval)
static bool isTime(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is time
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
static bool isNonEditable(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is non editable
static std::vector< SumoXMLTag > myBlockMovementTags
vector with the allowed tags that can block their movement
The turning radius at an intersection in m.
static std::vector< SumoXMLTag > myAllowedAdditionalTags
vector with the allowed tags of additionals
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr)
check if an element with certain tag has a certain attribute
static bool canBlockMovement(SumoXMLTag tag)
return true if element tag can block their movement
static bool hasDefaultValue(SumoXMLTag tag, SumoXMLAttr attr)
check if attribute of an element has a default avlue
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
static const double INVALID_POSITION
default value for invalid positions (used by POIs and Polygons)
static bool isColor(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type color for a certain tag
static bool isFilename(SumoXMLTag tag, SumoXMLAttr attr)
whether a string attribute is a filename
static int _str2int(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
static T getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr)
return the default value of the attribute of an element
node: the type of traffic light
edge: the shape in xml-definition
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
const std::string getID() const
function to support debugging
virtual std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myNonEditableAttrs
map with the non-editable attributes
begin/end of the description of an edge
static bool isUnique(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is unique (may not be edited for a multi-selection and don't have a default valu...
static int myMaxNumAttribute
maximum number of attributes of all tags
trigger: the time of the step
FXIcon * getIcon() const
get FXIcon assigned to this object
static bool isProbability(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is a probability (i.e. oly can values between [0, 1])
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
static const std::vector< SumoXMLTag > & allowedAdditionalTags()
get all editable for tag additional elements
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in allGNEAttributeCarrier.
static const std::string APPROVED
feature has been approved but not changed (i.e. after being reguessed)
static bool isBool(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool for a certain tag
crossing between edges for pedestrians
static std::string getDefinition(SumoXMLTag tag, SumoXMLAttr attr)
return definition of a certain SumoXMLAttr
static bool discreteCombinableChoices(SumoXMLTag tag, SumoXMLAttr attr)
return whether the given attribute allows for a combination of discrete values
SumoXMLTag getTag() const
get XML Tag assigned to this object
Eficiency of the charge in Charging Stations.
static const std::string GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
last coordinate of edge shape
Delay in the charge of charging stations.
static bool isNumerical(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is numerical (int or float)
GUIIcon getGUIIcon() const
get GUI icon assigned to this object
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myNumericalIntAttrs
map with the numerical attributes of type Int
static T parse(const std::string &string)
parses a number of type T from string
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myNumericalFloatAttrs
map with the numerical attributes of type Float
static bool canBlockShape(SumoXMLTag tag)
return true if element tag can block their shape
vehicles ignoring classes
static std::map< SumoXMLTag, SumoXMLTag > myAllowedAdditionalWithParentTags
map with the allowed tags of additionals with parent and their parent
static bool isList(SumoXMLTag tag, SumoXMLAttr attr)
whether an attribute is of type bool
begin/end of the description of a polygon
trigger: a step description
static std::map< SumoXMLTag, std::set< SumoXMLAttr > > myFileAttrs
map with the empty attributes