Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNETagProperties.h
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// 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 MEANDATA = 1 << 28, // Mean datas
78 // other
79 SYMBOL = 1 << 29, // Symbol elements (VSSSymbols, RerouterSymbols...)
80 INTERNALLANE = 1 << 30, // Internal Lane
81 };
82
84 NOTDRAWABLE = 1 << 0, // Element cannot be drawed in view
85 CLOSESHAPE = 1 << 1, // Element can close their shape
86 GEOSHAPE = 1 << 2, // Element's shape acn be defined using a GEO Shape
87 DIALOG = 1 << 3, // Element can be edited using a dialog (GNECalibratorDialog, GNERerouterDialog...)
88 CHILD = 1 << 4, // Element is child of another element and will be writed in XML without id (Example: E3Entry -> E3Detector...)
89 REPARENT = 1 << 5, // Element can be reparent
90 NOTSELECTABLE = 1 << 6, // Element cannot be selected
91 MASKSTARTENDPOS = 1 << 7, // Element mask attributes StartPos and EndPos as "length" (Only used in the appropiate GNEFrame)
92 NOPARAMETERS = 1 << 8, // Element doesn't accept parameters "key1=value1|key2=value2|...|keyN=valueN" (by default all tags supports parameters)
93 RTREE = 1 << 9, // Element is placed in RTREE
94 CENTERAFTERCREATION = 1 << 10, // Camera is moved after element creation
95 EMBEDDED_ROUTE = 1 << 11, // Element has an embedded route
96 REQUIRE_PROJ = 1 << 12, // Element require a geo-projection defined in network
97 VCLASS_ICON = 1 << 13, // Element returns icon depending of their vClass
98 };
99
102
104 GNETagProperties(const SumoXMLTag tag, const int tagType, const int tagProperty, const GUIIcon icon, const SumoXMLTag XMLTag,
105 const std::vector<SumoXMLTag> parentTags = {}, const unsigned int backgroundColor = FXRGBA(255, 255, 255, 255));
106
109
111 SumoXMLTag getTag() const;
112
114 Supermode getSupermode() const;
115
117 const std::string& getTagStr() const;
118
120 void checkTagIntegrity() const;
121
123 void addAttribute(const GNEAttributeProperties& attributeProperty);
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 isAdditionalPureElement() const;
172
174 bool isDemandElement() const;
175
177 bool isDataElement() const;
178
180 bool isStoppingPlace() const;
181
183 bool isDetector() const;
184
186 bool isCalibrator() const;
187
189 bool isShapeElement() const;
190
192 bool isTAZElement() const;
193
195 bool isWireElement() const;
196
198 bool isType() const;
199
201 bool isVehicle() const;
202
204 bool isRoute() const;
205
207 bool isStop() const;
208
210 bool isWaypoint() const;
211
213 bool isFlow() const;
214
216 bool isPerson() const;
217
219 bool isPersonPlan() const;
220
222 bool isPersonTrip() const;
223
225 bool isWalk() const;
226
228 bool isRide() const;
229
231 bool isStopPerson() const;
232
234 bool isContainer() const;
235
237 bool isContainerPlan() const;
238
240 bool isTransportPlan() const;
241
243 bool isTranshipPlan() const;
244
246 bool isStopContainer() const;
247
249 bool isGenericData() const;
250
252 bool isMeanData() const;
253
255 bool isChild() const;
256
258 bool isSymbol() const;
259
261 bool isInternalLane() const;
262
264 bool isDrawable() const;
265
267 bool isSelectable() const;
268
270 bool canCloseShape() const;
271
273 bool hasGEOShape() const;
274
276 bool hasDialog() const;
277
279 bool hasParameters() const;
280
282 bool isPlacedInRTree() const;
283
285 bool canBeReparent() const;
286
288 bool canMaskStartEndPos() const;
289
291 bool canCenterCameraAfterCreation() const;
292
294 bool hasEmbeddedRoute() const;
295
297 bool requireProj() const;
298
300 bool vClassIcon() const;
301
302private:
305
307 std::string myTagStr;
308
311
314
316 std::vector<GNEAttributeProperties> myAttributeProperties;
317
320
323
325 std::vector<SumoXMLTag> myParentTags;
326
328 std::string myFieldString;
329
331 unsigned int myBackgroundColor;
332
334 static const size_t MAXNUMBEROFATTRIBUTES;
335};
336
337/****************************************************************************/
338
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 isTransportPlan() const
return true if tag correspond to a transport
bool isMeanData() const
return true if tag correspond to a mean data element
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
bool isType() const
return true if tag correspond to a vehicle/person/container type 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