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-2022 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 #include <config.h>
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 
30 
31 #include "GNEAttributeProperties.h"
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
37 
39 
40 public:
41 
42  enum TagType {
43  // basic types
44  NETWORKELEMENT = 1 << 0, // Network elements (Edges, Junctions, Lanes...)
45  ADDITIONALELEMENT = 1 << 1, // Additional elements (Bus Stops, Charging Stations, Detectors...)
46  SHAPE = 1 << 2, // Shapes (Polygons and POIs)
47  TAZELEMENT = 1 << 3, // Traffic Assignment Zones
48  DEMANDELEMENT = 1 << 4, // Demand elements (Routes, Vehicles, Trips...)
49  DATAELEMENT = 1 << 5, // Data elements (DataSets, Data Intervals, EdgeData...)
50  // sub additional elements
51  STOPPINGPLACE = 1 << 6, // StoppingPlaces (BusStops, ChargingStations...)
52  DETECTOR = 1 << 7, // Detectors (E1, E2...)
53  // sub demand elements
54  VTYPE = 1 << 8, // Vehicle types (vType and vTypeDistribution)
55  VEHICLE = 1 << 9, // Vehicles (Vehicles, trips, flows...)
56  ROUTE = 1 << 10, // Routes and embedded routes
57  STOP = 1 << 11, // Stops
58  FLOW = 1 << 12, // Flows
59  // persons
60  PERSON = 1 << 13, // Persons (Persons and personFlows)
61  PERSONPLAN = 1 << 14, // Person plans (Walks, rides, personTrips and stopPersons)
62  PERSONTRIP = 1 << 15, // Person Trips
63  WALK = 1 << 16, // Walks
64  RIDE = 1 << 17, // Rides
65  STOPPERSON = 1 << 18, // Person stops
66  // containers
67  CONTAINER = 1 << 19, // Containers (Containers and personFlows)
68  CONTAINERPLAN = 1 << 20, // Container plans (tranship and transport)
69  TRANSPORT = 1 << 21, // Transport
70  TRANSHIP = 1 << 22, // Tranship
71  STOPCONTAINER = 1 << 23, // Container stops
72  // sub data elements
73  GENERICDATA = 1 << 24, // Generic data (GNEEdgeData, GNELaneData...)
74  // other
75  SYMBOL = 1 << 25, // Symbol elements (VSSSymbols, RerouterSymbols...)
76  INTERNALLANE = 1 << 26, // Internal Lane
77  };
78 
79  enum TagProperty {
80  NOTDRAWABLE = 1 << 0, // Element cannot be drawed in view
81  CLOSESHAPE = 1 << 1, // Element can close their shape
82  GEOSHAPE = 1 << 2, // Element's shape acn be defined using a GEO Shape
83  DIALOG = 1 << 3, // Element can be edited using a dialog (GNECalibratorDialog, GNERerouterDialog...)
84  CHILD = 1 << 4, // Element is child of another element and will be writed in XML without id (Example: E3Entry -> E3Detector...)
85  MINIMUMCHILDREN = 1 << 5, // Element will be only writed in XML if has a minimum number of children
86  REPARENT = 1 << 6, // Element can be reparent
87  NOTSELECTABLE = 1 << 7, // Element cannot be selected
88  MASKSTARTENDPOS = 1 << 8, // Element mask attributes StartPos and EndPos as "length" (Only used in the appropiate GNEFrame)
89  WRITECHILDRENSEPARATE = 1 << 9, // Element writes their children in a separated filename
90  NOPARAMETERS = 1 << 10, // Element doesn't accept parameters "key1=value1|key2=value2|...|keyN=valueN" (by default all tags supports parameters)
91  RTREE = 1 << 11, // Element is placed in RTREE
92  CENTERAFTERCREATION = 1 << 12, // Camera is moved after element creation
93  EMBEDDED_ROUTE = 1 << 13, // Element has an embedded route
94  REQUIERE_PROJ = 1 << 14, // Element requiere a geo-projection defined in network
95  };
96 
99 
101  GNETagProperties(const SumoXMLTag tag, const int tagType, const int tagProperty, const GUIIcon icon, const SumoXMLTag XMLTag,
102  const std::vector<SumoXMLTag> parentTags = {}, const unsigned int backgroundColor = FXRGBA(255, 255, 255, 255));
103 
106 
108  SumoXMLTag getTag() const;
109 
111  Supermode getSupermode() const;
112 
114  const std::string& getTagStr() const;
115 
117  void checkTagIntegrity() const;
118 
120  void addAttribute(const GNEAttributeProperties& attributeProperty);
121 
124 
126  const std::string& getFieldString() const;
127 
129  void setFieldString(const std::string& fieldString);
130 
132  unsigned int getBackGroundColor() const;
133 
136 
138  std::vector<GNEAttributeProperties>::const_iterator begin() const;
139 
141  std::vector<GNEAttributeProperties>::const_iterator end() const;
142 
144  const GNEAttributeProperties& at(int index) const;
145 
147  int getNumberOfAttributes() const;
148 
150  const std::string& getDefaultValue(SumoXMLAttr attr) const;
151 
153  GUIIcon getGUIIcon() const;
154 
156  SumoXMLTag getXMLTag() const;
157 
159  const std::vector<SumoXMLTag>& getParentTags() const;
160 
162  bool hasAttribute(SumoXMLAttr attr) const;
163 
165  bool isNetworkElement() const;
166 
168  bool isAdditionalElement() const;
169 
171  bool isShape() const;
172 
174  bool isTAZElement() const;
175 
177  bool isDemandElement() const;
178 
180  bool isDataElement() const;
181 
183  bool isStoppingPlace() const;
184 
186  bool isDetector() const;
187 
189  bool isVehicleType() const;
190 
192  bool isVehicle() const;
193 
195  bool isRoute() const;
196 
198  bool isStop() const;
199 
201  bool isFlow() const;
202 
204  bool isPerson() const;
205 
207  bool isPersonPlan() const;
208 
210  bool isPersonTrip() const;
211 
213  bool isWalk() const;
214 
216  bool isRide() const;
217 
219  bool isStopPerson() const;
220 
222  bool isContainer() const;
223 
225  bool isContainerPlan() const;
226 
228  bool isTransportPlan() const;
229 
231  bool isTranshipPlan() const;
232 
234  bool isStopContainer() const;
235 
237  bool isGenericData() const;
238 
240  bool isChild() const;
241 
243  bool isSymbol() const;
244 
246  bool isInternalLane() const;
247 
249  bool isDrawable() const;
250 
252  bool isSelectable() const;
253 
255  bool canCloseShape() const;
256 
258  bool hasGEOShape() const;
259 
261  bool hasDialog() const;
262 
264  bool hasMinimumNumberOfChildren() const;
265 
267  bool hasParameters() const;
268 
270  bool isPlacedInRTree() const;
271 
273  bool canBeReparent() const;
274 
276  bool canWriteChildrenSeparate() const;
277 
279  bool canMaskStartEndPos() const;
280 
282  bool canCenterCameraAfterCreation() const;
283 
285  bool embebbedRoute() const;
286 
288  bool requireProj() const;
289 
291  bool isAttributeDeprecated(SumoXMLAttr attr) const;
292 
293 private:
296 
298  std::string myTagStr;
299 
302 
305 
307  std::vector<GNEAttributeProperties> myAttributeProperties;
308 
311 
314 
316  std::vector<SumoXMLTag> myParentTags;
317 
319  std::vector<SumoXMLAttr> myDeprecatedAttributes;
320 
322  std::string myFieldString;
323 
325  unsigned int myBackgroundColor;
326 
328  static const size_t MAXNUMBEROFATTRIBUTES;
329 };
330 
331 /****************************************************************************/
332 
Supermode
@brie enum for supermodes
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool isVehicleType() const
return true if tag correspond to a vehicle type element
bool isTransportPlan() const
return true if tag correspond to a transport
bool isShape() const
return true if tag correspond to a shape
bool isContainer() const
return true if tag correspond to a container element
bool isAttributeDeprecated(SumoXMLAttr attr) const
return true if attribute of this tag is deprecated
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)
const std::vector< SumoXMLTag > & getParentTags() const
get parent tags
bool isTAZElement() const
return true if tag correspond to a TAZ element
bool isFlow() const
return true if tag correspond to a flow element
bool hasGEOShape() const
return true if tag correspond to an element that can use a geo shape
bool isGenericData() const
return true if tag correspond to a generic data element
void addDeprecatedAttribute(SumoXMLAttr attr)
add deprecated Attribute
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.
SumoXMLTag myXMLTag
Tag written in XML and used in GNENetHelper::AttributeCarriers.
bool embebbedRoute() const
return true if tag correspond to an element that owns a embebbed route
bool isChild() const
return true if tag correspond to an element child of another element (Example: E3->Entry/Exit)
bool isNetworkElement() const
return true if tag correspond to a network element
void addAttribute(const GNEAttributeProperties &attributeProperty)
add attribute (duplicated attributed aren't allowed)
const std::string & getFieldString() const
get field string (by default tag in string format)
bool isDataElement() const
return true if tag correspond to a data element
bool isTranshipPlan() const
return true if tag correspond to a tranship
bool isSelectable() const
return true if tag correspond to a selectable element
std::vector< SumoXMLTag > myParentTags
vector with master tags (used by child elements)
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 isPlacedInRTree() const
return true if Tag correspond to an element that has has to be placed in RTREE
std::string myFieldString
field string
const GNEAttributeProperties & at(int index) const
get attribute value
bool isPersonTrip() const
return true if tag correspond to a person trip
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.
unsigned int myBackgroundColor
background color (used in labels and textFields, by default white)
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...
Supermode getSupermode() const
get supermode associated with this tag
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
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.
int getNumberOfAttributes() const
get number of attributes
bool isStopPerson() const
return true if tag correspond to a person stop element
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
bool isContainerPlan() const
return true if tag correspond to a container plan
SumoXMLTag getXMLTag() const
get XML tag
bool isInternalLane() const
return true if tag correspond to a internal lane
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 isStopContainer() const
return true if tag correspond to a container stop element
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
unsigned int getBackGroundColor() const
get background color
bool isPerson() const
return true if tag correspond to a person element
~GNETagProperties()
destructor
bool requireProj() const
return true if tag correspond to an element that requires a geo projection
void setFieldString(const std::string &fieldString)
set field that will be drawn in TextFields/ComboBox/etc,
GNETagProperties()
default constructor