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
32
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
37
39
40public:
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 DEMANDELEMENT = 1 << 2, // Demand elements (Routes, Vehicles, Trips...)
47 DATAELEMENT = 1 << 3, // Data elements (DataSets, Data Intervals, EdgeData...)
48 // sub additional elements
49 STOPPINGPLACE = 1 << 4, // StoppingPlaces (BusStops, ChargingStations...)
50 DETECTOR = 1 << 5, // Detectors (E1, E2...)
51 CALIBRATOR = 1 << 6, // Calibrators
52 SHAPE = 1 << 7, // Shapes (Polygons and POIs)
53 TAZELEMENT = 1 << 8, // Traffic Assignment Zones
54 WIRE = 1 << 9, // Wire elements
55 // sub demand elements
56 VTYPE = 1 << 10, // Vehicle types (vType and vTypeDistribution)
57 VEHICLE = 1 << 11, // Vehicles (Vehicles, trips, flows...)
58 ROUTE = 1 << 12, // Routes and embedded routes
59 STOP = 1 << 13, // Stops
60 WAYPOINT = 1 << 14, // Waypoints (note: All waypoints are also Stops)
61 FLOW = 1 << 15, // Flows
62 // persons
63 PERSON = 1 << 16, // Persons (Persons and personFlows)
64 PERSONPLAN = 1 << 17, // Person plans (Walks, rides, personTrips and stopPersons)
65 PERSONTRIP = 1 << 18, // Person Trips
66 WALK = 1 << 19, // Walks
67 RIDE = 1 << 20, // Rides
68 STOPPERSON = 1 << 21, // Person stops
69 // containers
70 CONTAINER = 1 << 22, // Containers (Containers and personFlows)
71 CONTAINERPLAN = 1 << 23, // Container plans (tranship and transport)
72 TRANSPORT = 1 << 24, // Transport
73 TRANSHIP = 1 << 25, // Tranship
74 STOPCONTAINER = 1 << 26, // Container stops
75 // sub data elements
76 GENERICDATA = 1 << 27, // Generic data (GNEEdgeData, GNELaneData...)
77 // other
78 SYMBOL = 1 << 28, // Symbol elements (VSSSymbols, RerouterSymbols...)
79 INTERNALLANE = 1 << 29, // Internal Lane
80 };
81
83 NOTDRAWABLE = 1 << 0, // Element cannot be drawed in view
84 CLOSESHAPE = 1 << 1, // Element can close their shape
85 GEOSHAPE = 1 << 2, // Element's shape acn be defined using a GEO Shape
86 DIALOG = 1 << 3, // Element can be edited using a dialog (GNECalibratorDialog, GNERerouterDialog...)
87 CHILD = 1 << 4, // Element is child of another element and will be writed in XML without id (Example: E3Entry -> E3Detector...)
88 REPARENT = 1 << 5, // Element can be reparent
89 NOTSELECTABLE = 1 << 6, // Element cannot be selected
90 MASKSTARTENDPOS = 1 << 7, // Element mask attributes StartPos and EndPos as "length" (Only used in the appropiate GNEFrame)
91 NOPARAMETERS = 1 << 8, // Element doesn't accept parameters "key1=value1|key2=value2|...|keyN=valueN" (by default all tags supports parameters)
92 RTREE = 1 << 9, // Element is placed in RTREE
93 CENTERAFTERCREATION = 1 << 10, // Camera is moved after element creation
94 EMBEDDED_ROUTE = 1 << 11, // Element has an embedded route
95 REQUIRE_PROJ = 1 << 12, // Element require a geo-projection defined in network
96 VCLASS_ICON = 1 << 13, // Element returns icon depending of their vClass
97 };
98
101
103 GNETagProperties(const SumoXMLTag tag, const int tagType, const int tagProperty, const GUIIcon icon, const SumoXMLTag XMLTag,
104 const std::vector<SumoXMLTag> parentTags = {}, const unsigned int backgroundColor = FXRGBA(255, 255, 255, 255));
105
108
110 SumoXMLTag getTag() const;
111
113 Supermode getSupermode() const;
114
116 const std::string& getTagStr() const;
117
119 void checkTagIntegrity() const;
120
122 void addAttribute(const GNEAttributeProperties& attributeProperty);
123
125 const std::string& getFieldString() const;
126
128 void setFieldString(const std::string& fieldString);
129
131 unsigned int getBackGroundColor() const;
132
135
137 std::vector<GNEAttributeProperties>::const_iterator begin() const;
138
140 std::vector<GNEAttributeProperties>::const_iterator end() const;
141
143 const GNEAttributeProperties& at(int index) const;
144
146 int getNumberOfAttributes() const;
147
149 const std::string& getDefaultValue(SumoXMLAttr attr) const;
150
152 GUIIcon getGUIIcon() const;
153
155 SumoXMLTag getXMLTag() const;
156
158 const std::vector<SumoXMLTag>& getParentTags() const;
159
161 bool hasAttribute(SumoXMLAttr attr) const;
162
164 bool isNetworkElement() const;
165
167 bool isAdditionalElement() const;
168
170 bool isAdditionalPureElement() const;
171
173 bool isDemandElement() const;
174
176 bool isDataElement() const;
177
179 bool isStoppingPlace() const;
180
182 bool isDetector() const;
183
185 bool isCalibrator() const;
186
188 bool isShapeElement() const;
189
191 bool isTAZElement() const;
192
194 bool isWireElement() const;
195
197 bool isVehicleType() const;
198
200 bool isVehicle() const;
201
203 bool isRoute() const;
204
206 bool isStop() const;
207
209 bool isWaypoint() const;
210
212 bool isFlow() const;
213
215 bool isPerson() const;
216
218 bool isPersonPlan() const;
219
221 bool isPersonTrip() const;
222
224 bool isWalk() const;
225
227 bool isRide() const;
228
230 bool isStopPerson() const;
231
233 bool isContainer() const;
234
236 bool isContainerPlan() const;
237
239 bool isTransportPlan() const;
240
242 bool isTranshipPlan() const;
243
245 bool isStopContainer() const;
246
248 bool isGenericData() const;
249
251 bool isChild() const;
252
254 bool isSymbol() const;
255
257 bool isInternalLane() const;
258
260 bool isDrawable() const;
261
263 bool isSelectable() const;
264
266 bool canCloseShape() const;
267
269 bool hasGEOShape() const;
270
272 bool hasDialog() const;
273
275 bool hasParameters() const;
276
278 bool isPlacedInRTree() const;
279
281 bool canBeReparent() const;
282
284 bool canMaskStartEndPos() const;
285
287 bool canCenterCameraAfterCreation() const;
288
290 bool hasEmbeddedRoute() const;
291
293 bool requireProj() const;
294
296 bool vClassIcon() const;
297
298private:
301
303 std::string myTagStr;
304
307
310
312 std::vector<GNEAttributeProperties> myAttributeProperties;
313
316
319
321 std::vector<SumoXMLTag> myParentTags;
322
324 std::string myFieldString;
325
327 unsigned int myBackgroundColor;
328
330 static const size_t MAXNUMBEROFATTRIBUTES;
331};
332
333/****************************************************************************/
334
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 isContainer() const
return true if tag correspond to a container element
bool canBeReparent() const
return true if tag correspond to an element that can be reparent
bool isShapeElement() const
return true if tag correspond to a shape
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 vClassIcon() const
return true if tag correspond to an element that has vClass icons
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 hasEmbeddedRoute() const
return true if tag correspond to an element that owns an embedded route
bool isGenericData() const
return true if tag correspond to a generic data element
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 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 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.
bool isCalibrator() const
return true if tag correspond to a calibrator (Only used to group all detectors in the XML)
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 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 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
bool isAdditionalPureElement() const
return true if tag correspond to a pure additional element
std::string myTagStr
Sumo XML Tag vinculated wit this tag Property in String format.
bool isWireElement() const
return true if tag correspond to a Wire element
bool isWaypoint() const
return true if tag correspond to a waypoint element
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 an internal lane
GUIIcon myIcon
icon associated to this Tag
bool isAdditionalElement() const
return true if tag correspond to an additional element (note: this include TAZ, shapes and wires)
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