Eclipse SUMO - Simulation of Urban MObility
GNETagProperties.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 // Abstract Base class for tag properties used in GNEAttributeCarrier
19 /****************************************************************************/
20 #pragma once
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 
28 
29 #include "GNEAttributeProperties.h"
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 
37 
38 public:
39 
40  enum TagType {
41  // basic types
42  NETWORKELEMENT = 1 << 0, // Network elements (Edges, Junctions, Lanes...)
43  ADDITIONALELEMENT = 1 << 1, // Additional elements (Bus Stops, Charging Stations, Detectors...)
44  SHAPE = 1 << 2, // Shapes (Polygons and POIs)
45  TAZELEMENT = 1 << 3, // Traffic Assignment Zones
46  DEMANDELEMENT = 1 << 4, // Demand elements (Routes, Vehicles, Trips...)
47  DATAELEMENT = 1 << 5, // Data elements (DataSets, Data Intervals, EdgeData...)
48  // sub additional elements
49  STOPPINGPLACE = 1 << 6, // StoppingPlaces (BusStops, ChargingStations...)
50  DETECTOR = 1 << 7, // Detectors (E1, E2...)
51  // sub demand elements
52  VTYPE = 1 << 8, // Vehicle types (vType and pTye)
53  VEHICLE = 1 << 9, // Vehicles (Vehicles, trips, flows, and routeFlows)
54  ROUTE = 1 << 10, // Routes and embedded routes
55  STOP = 1 << 11, // Stops
56  PERSON = 1 << 12, // Persons (Persons and personFlows)
57  PERSONPLAN = 1 << 13, // Person plans (Walks, rides, personTrips and personStops)
58  PERSONTRIP = 1 << 14, // Person Trips
59  WALK = 1 << 15, // Walks
60  RIDE = 1 << 16, // Rides
61  PERSONSTOP = 1 << 17, // Person stops
62  // sub data elements
63  GENERICDATA = 1 << 18, // Generic data (GNEEdgeData, GNELaneData...)
64  // other
65  SYMBOL = 1 << 19, // Symbol elements (VSSSymbols, RerouterSymbols...)
66  };
67 
68  enum TagProperty {
69  DRAWABLE = 1 << 0, // Element can be drawed in view
70  BLOCKMOVEMENT = 1 << 1, // Element can block their movement
71  BLOCKSHAPE = 1 << 2, // Element can block their shape
72  CLOSESHAPE = 1 << 3, // Element can close their shape
73  GEOPOSITION = 1 << 4, // Element's position can be defined using a GEO position
74  GEOSHAPE = 1 << 5, // Element's shape acn be defined using a GEO Shape
75  DIALOG = 1 << 6, // Element can be edited using a dialog (GNECalibratorDialog, GNERerouterDialog...)
76  SLAVE = 1 << 7, // Element is slave and will be writed in XML without id as child of another element (E3Entry -> E3Detector...)
77  MINIMUMCHILDREN = 1 << 8, // Element will be only writed in XML if has a minimum number of children
78  REPARENT = 1 << 9, // Element can be reparent
79  SYNONYM = 1 << 10, // Element will be written with a different name in der XML
80  SELECTABLE = 1 << 11, // Element is selectable
81  MASKSTARTENDPOS = 1 << 12, // Element mask attributes StartPos and EndPos as "length" (Only used in the appropiate GNEFrame)
82  MASKXYZPOSITION = 1 << 13, // Element mask attributes X, Y and Z as "Position"
83  WRITECHILDRENSEPARATE = 1 << 14, // Element writes their children in a separated filename
84  NOPARAMETERS = 1 << 15, // Element doesn't accept parameters "key1=value1|key2=value2|...|keyN=valueN" (by default all tags supports parameters)
85  PARAMETERSDOUBLE = 1 << 16, // Element only accept double parameters "key1=double1|key2=double1|...|keyN=doubleN"
86  RTREE = 1 << 17, // Element is placed in RTREE
87  CENTERAFTERCREATION = 1 << 18, // Camera is moved after element creation
88  PERSONPLAN_START_EDGE = 1 << 19, // Person plan starts in an edge
89  PERSONPLAN_END_EDGE = 1 << 20, // Person plan ends in an edge
90  PERSONPLAN_START_BUSSTOP = 1 << 21, // Person plan starts in a busStop
91  PERSONPLAN_END_BUSSTOP = 1 << 22, // Person plan ends in a busStop
92  PERSONPLAN_START_STOP = 1 << 23, // Person plan starts in a stop
93  PERSONPLAN_END_STOP = 1 << 24, // Person plan ends in a stop
94  EMBEDDED_ROUTE = 1 << 27, // Element has an ebebbed route
95  };
96 
99 
101  GNETagProperties(SumoXMLTag tag, int tagType, int tagProperty, GUIIcon icon, const std::vector<SumoXMLTag>& master_tag = {}, SumoXMLTag tagSynonym = SUMO_TAG_NOTHING);
102 
105 
107  SumoXMLTag getTag() const;
108 
110  const std::string& getTagStr() const;
111 
113  void checkTagIntegrity() const;
114 
116  void addAttribute(const GNEAttributeProperties& attributeProperty);
117 
120 
123 
125  std::vector<GNEAttributeProperties>::const_iterator begin() const;
126 
128  std::vector<GNEAttributeProperties>::const_iterator end() const;
129 
131  int getNumberOfAttributes() const;
132 
134  const std::string& getDefaultValue(SumoXMLAttr attr) const;
135 
137  GUIIcon getGUIIcon() const;
138 
140  const std::vector<SumoXMLTag>& getMasterTags() const;
141 
143  SumoXMLTag getTagSynonym() const;
144 
146  bool hasAttribute(SumoXMLAttr attr) const;
147 
149  bool isNetworkElement() const;
150 
152  bool isAdditionalElement() const;
153 
155  bool isShape() const;
156 
158  bool isTAZElement() const;
159 
161  bool isDemandElement() const;
162 
164  bool isDataElement() const;
165 
167  bool isStoppingPlace() const;
168 
170  bool isDetector() const;
171 
173  bool isVehicleType() const;
174 
176  bool isVehicle() const;
177 
179  bool isRoute() const;
180 
182  bool isStop() const;
183 
185  bool isPerson() const;
186 
188  bool isPersonPlan() const;
189 
191  bool isPersonTrip() const;
192 
194  bool isWalk() const;
195 
197  bool isRide() const;
198 
200  bool isPersonStop() const;
201 
203  bool isGenericData() const;
204 
206  bool isSlave() const;
207 
209  bool isSymbol() const;
210 
212  bool isDrawable() const;
213 
215  bool isSelectable() const;
216 
218  bool canBlockMovement() const;
219 
221  bool canBlockShape() const;
222 
224  bool canCloseShape() const;
225 
227  bool hasGEOPosition() const;
228 
230  bool hasGEOShape() const;
231 
233  bool hasTagSynonym() const;
234 
236  bool hasDialog() const;
237 
239  bool hasMinimumNumberOfChildren() const;
240 
242  bool hasParameters() const;
243 
245  bool hasDoubleParameters() const;
246 
248  bool isPlacedInRTree() const;
249 
251  bool canBeReparent() const;
252 
254  bool canWriteChildrenSeparate() const;
255 
257  bool canMaskStartEndPos() const;
258 
260  bool canMaskXYZPositions() const;
261 
263  bool canCenterCameraAfterCreation() const;
264 
266  bool personPlanStartEdge() const;
267 
269  bool personPlanEndEdge() const;
270 
272  bool personPlanStartBusStop() const;
273 
275  bool personPlanEndBusStop() const;
276 
278  bool personPlanStartStop() const;
279 
281  bool personPlanEndStop() const;
282 
284  bool embebbedRoute() const;
285 
287  bool isAttributeDeprecated(SumoXMLAttr attr) const;
288 
289 private:
292 
294  std::string myTagStr;
295 
298 
301 
303  std::vector<GNEAttributeProperties> myAttributeProperties;
304 
307 
309  std::vector<SumoXMLTag> myMasterTags;
310 
313 
315  std::vector<SumoXMLAttr> myDeprecatedAttributes;
316 
318  static const size_t MAXNUMBEROFATTRIBUTES;
319 };
320 
321 /****************************************************************************/
322 
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_NOTHING
invalid tag
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool isVehicleType() const
return true if tag correspond to a vehicle type element
SumoXMLTag myTagSynonym
Tag written in XML (If is SUMO_TAG_NOTHING), original Tag name will be written)
bool hasDoubleParameters() const
return true if Tag correspond to an element that supports double parameters "key1=double1|key2=double...
bool isShape() const
return true if tag correspond to a shape
bool isAttributeDeprecated(SumoXMLAttr attr) const
return true if attribute of this tag is deprecated
bool canMaskXYZPositions() const
return true if tag correspond to an element that can mask the attributes "X", "Y" and "Z" position as...
std::vector< SumoXMLTag > myMasterTags
vector with master tags (used by slave elements)
bool personPlanEndBusStop() const
return true if tag correspond to a person plan that starts in a busStop
bool canBeReparent() const
return true if tag correspond to an element that can be reparent
std::vector< GNEAttributeProperties >::const_iterator end() const
get end of attribute values (used for iterate)
bool canBlockMovement() const
return true if tag correspond to an element that can block their movement
bool isPersonStop() const
return true if tag correspond to a person stop element
bool personPlanEndEdge() const
return true if tag correspond to a person plan that starts in an edge
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
bool hasGEOPosition() const
return true if tag correspond to an element that can use a geo position
bool isTAZElement() const
return true if tag correspond to a TAZ element
bool hasGEOShape() const
return true if tag correspond to an element that can use a geo shape
bool isSlave() const
return true if tag correspond to an element slave of another element (I.e. doesn't have their own ID)
bool isGenericData() const
return true if tag correspond to a generic data element
void addDeprecatedAttribute(SumoXMLAttr attr)
add deprecated Attribute
bool personPlanStartEdge() const
return true if tag correspond to a person plan that starts in an edge
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool isPersonPlan() const
return true if tag correspond to a person plan
const GNEAttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
int myTagType
Attribute Type.
bool embebbedRoute() const
return true if tag correspond to an element that owns a embebbed route
bool isNetworkElement() const
return true if tag correspond to a network element
void addAttribute(const GNEAttributeProperties &attributeProperty)
add attribute (duplicated attributed aren't allowed)
bool isDataElement() const
return true if tag correspond to a data element
bool isSelectable() const
return true if tag correspond to a selectable element
bool isRoute() const
return true if tag correspond to a route element
bool isVehicle() const
return true if tag correspond to a vehicle element
static const size_t MAXNUMBEROFATTRIBUTES
max number of attributes allowed for every tag
bool isStop() const
return true if tag correspond to a stop element
bool personPlanStartBusStop() const
return true if tag correspond to a person plan that starts in a busStop
bool isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
bool personPlanStartStop() const
return true if tag correspond to a person plan that starts in a Stop
bool isPersonTrip() const
return true if tag correspond to a person trip
bool canBlockShape() const
return true if tag correspond to an element that can block their shape
std::vector< GNEAttributeProperties > myAttributeProperties
vector with the attribute values vinculated with this Tag
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
bool hasParameters() const
return true if Tag correspond to an element that supports parameters "key1=value1|key2=value2|....
bool isStoppingPlace() const
return true if tag correspond to a detector (Only used to group all stoppingPlaces in the output XML)
SumoXMLTag myTag
Sumo XML Tag vinculated wit this tag Property.
bool isDrawable() const
return true if tag correspond to a drawable element
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
std::vector< GNEAttributeProperties >::const_iterator begin() const
get begin of attribute values (used for iterate)
bool hasMinimumNumberOfChildren() const
return true if tag correspond to an element that only have a limited number of children
bool canMaskStartEndPos() const
return true if tag correspond to an element that can mask the attributes "start" and "end" position a...
bool isDetector() const
return true if tag correspond to a shape (Only used to group all detectors in the XML)
void checkTagIntegrity() const
check Tag integrity (this include all their attributes)
bool canWriteChildrenSeparate() const
return true if tag correspond to an element that can write their child in a different file
bool canCenterCameraAfterCreation() const
return true if tag correspond to an element that center camera after creation
bool isRide() const
return true if tag correspond to a ride element
SumoXMLTag getTagSynonym() const
get tag synonym
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
std::vector< SumoXMLAttr > myDeprecatedAttributes
List with the deprecated Attributes.
std::string myTagStr
Sumo XML Tag vinculated wit this tag Property in String format.
const std::vector< SumoXMLTag > & getMasterTags() const
get master tags
int getNumberOfAttributes() const
get number of attributes
bool personPlanEndStop() const
return true if tag correspond to a person plan that starts in a Stop
bool canCloseShape() const
return true if tag correspond to an element that can close their shape
bool isDemandElement() const
return true if tag correspond to a demand element
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
int myTagProperty
Attribute properties.
bool isWalk() const
return true if tag correspond to a walk element
GUIIcon myIcon
icon associated to this Tag
bool isAdditionalElement() const
return true if tag correspond to an additional element
bool isSymbol() const
return true if tag correspond to a symbol element
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
bool isPerson() const
return true if tag correspond to a person element
~GNETagProperties()
destructor
GNETagProperties()
default constructor