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.dev/sumo
3 // Copyright (C) 2001-2024 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 
43  enum TagType {
44  // basic types
45  NETWORKELEMENT = 1 << 0, // Network elements (Edges, Junctions, Lanes...)
46  ADDITIONALELEMENT = 1 << 1, // Additional elements (Bus Stops, Charging Stations, Detectors...)
47  DEMANDELEMENT = 1 << 2, // Demand elements (Routes, Vehicles, Trips...)
48  DATAELEMENT = 1 << 3, // Data elements (DataSets, Data Intervals, EdgeData...)
49  // sub additional elements
50  STOPPINGPLACE = 1 << 4, // StoppingPlaces (BusStops, ChargingStations...)
51  DETECTOR = 1 << 5, // Detectors (E1, E2...)
52  CALIBRATOR = 1 << 6, // Calibrators
53  SHAPE = 1 << 7, // Shapes (Polygons and POIs)
54  TAZELEMENT = 1 << 8, // Traffic Assignment Zones
55  WIRE = 1 << 9, // Wire elements
56  JUPEDSIM = 1 << 10, // JuPedSim elements
57  // sub demand elements
58  VTYPE = 1 << 11, // Vehicle types (vType and vTypeDistribution)
59  VEHICLE = 1 << 12, // Vehicles (Vehicles, trips, flows...)
60  ROUTE = 1 << 13, // Routes and embedded routes
61  VEHICLESTOP = 1 << 14, // Vehicle stops
62  VEHICLEWAYPOINT = 1 << 15, // Vehicle waypoints (note: All waypoints are also Stops)
63  FLOW = 1 << 16, // Flows
64  // persons
65  PERSON = 1 << 17, // Persons (Persons and personFlows)
66  PERSONPLAN = 1 << 18, // Person plans (Walks, rides, personTrips and stopPersons)
67  PERSONTRIP = 1 << 19, // Person Trips
68  WALK = 1 << 20, // Walks
69  RIDE = 1 << 21, // Rides
70  STOPPERSON = 1 << 22, // Person stops
71  // containers
72  CONTAINER = 1 << 23, // Containers (Containers and personFlows)
73  CONTAINERPLAN = 1 << 24, // Container plans (tranship and transport)
74  TRANSPORT = 1 << 25, // Transport
75  TRANSHIP = 1 << 26, // Tranship
76  STOPCONTAINER = 1 << 27, // Container stops
77  // sub data elements
78  GENERICDATA = 1 << 28, // Generic data (GNEEdgeData, GNELaneData...)
79  MEANDATA = 1 << 29, // Mean datas
80  // other
81  INTERNALLANE = 1 << 30, // Internal Lane
82  };
83 
85  enum TagProperty {
86  NO_PROPERTY = 1 << 0, // Element doesn't have properties
87  NOTDRAWABLE = 1 << 1, // Element cannot be drawn in view
88  CLOSESHAPE = 1 << 2, // Element can close their shape
89  GEOSHAPE = 1 << 3, // Element's shape acn be defined using a GEO Shape
90  DIALOG = 1 << 4, // Element can be edited using a dialog (GNECalibratorDialog, GNERerouterDialog...)
91  CHILD = 1 << 5, // Element is child of another element and will be written in XML without id (Example: E3Entry -> E3Detector...)
92  REPARENT = 1 << 6, // Element can be reparent
93  NOTSELECTABLE = 1 << 7, // Element cannot be selected
94  MASKSTARTENDPOS = 1 << 8, // Element mask attributes StartPos and EndPos as "length" (Only used in the appropiate GNEFrame)
95  NOPARAMETERS = 1 << 9, // Element doesn't accept parameters "key1=value1|key2=value2|...|keyN=valueN" (by default all tags supports parameters)
96  RTREE = 1 << 10, // Element is placed in RTREE
97  CENTERAFTERCREATION = 1 << 11, // Camera is moved after element creation
98  REQUIRE_PROJ = 1 << 12, // Element require a geo-projection defined in network
99  VCLASS_ICON = 1 << 13, // Element returns icon depending of their vClass
100  SYMBOL = 1 << 14, // Symbol elements (VSSSymbols, RerouterSymbols...)
101  };
102 
104  enum TagParents {
105  NO_PARENTS = 1 << 0, // No parents
106  // exclusive of vehicles
107  VEHICLE_ROUTE = 1 << 1, // Vehicle is placed over route
108  VEHICLE_ROUTE_EMBEDDED = 1 << 2, // Vehicle has an embedded route
109  VEHICLE_EDGES = 1 << 3, // Vehicle is placed over a from-to edges
110  VEHICLE_JUNCTIONS = 1 << 4, // Vehicle is placed over a from-to junctions
111  VEHICLE_TAZS = 1 << 5, // Vehicle is placed over a from-to TAZs
112  // exclusive of plans
113  PLAN_CONSECUTIVE_EDGES = 1 << 6, // Plan placed in consecutive edges
114  PLAN_ROUTE = 1 << 7, // Plan placed in route
115  PLAN_EDGE = 1 << 8, // Plan placed in edge
116  PLAN_BUSSTOP = 1 << 9, // Plan placed in busStop
117  PLAN_TRAINSTOP = 1 << 10, // Plan placed in trainStop
118  PLAN_CONTAINERSTOP = 1 << 11, // Plan placed in containerStop
119  PLAN_FROM_EDGE = 1 << 12, // Plan starts in edge
120  PLAN_FROM_TAZ = 1 << 13, // Plan starts in TAZ
121  PLAN_FROM_JUNCTION = 1 << 14, // Plan starts in junction
122  PLAN_FROM_BUSSTOP = 1 << 15, // Plan starts in busStop
123  PLAN_FROM_TRAINSTOP = 1 << 16, // Plan starts in trainStop
124  PLAN_FROM_CONTAINERSTOP = 1 << 17, // Plan starts in containerStop
125  PLAN_TO_EDGE = 1 << 18, // Plan ends in edge
126  PLAN_TO_TAZ = 1 << 19, // Plan ends in TAZ
127  PLAN_TO_JUNCTION = 1 << 20, // Plan ends in junction
128  PLAN_TO_BUSSTOP = 1 << 21, // Plan ends in busStop
129  PLAN_TO_TRAINSTOP = 1 << 22, // Plan ends in trainStop
130  PLAN_TO_CONTAINERSTOP = 1 << 23, // Plan ends in containerStop
131  };
132 
133  // @brief conflicts
134  enum Conflicts {
135  NO_CONFLICTS = 1 << 0, // Element doesn't have conflicts
136  POS_LANE = 1 << 1, // Position over lane isn't valid
137  POS_LANE_START = 1 << 2, // Start position over lane isn't valid
138  POS_LANE_END = 1 << 3, // End position over lane isn't valid
139  NO_ADDITIONAL_CHILDREN = 1 << 4, // Element doesn't have additional children
140  };
141 
144 
146  GNETagProperties(const SumoXMLTag tag, const int tagType, const int tagProperty, const int tagParents, const int conflicts,
147  const GUIIcon icon, const SumoXMLTag XMLTag, const std::string tooltip, std::vector<SumoXMLTag> parentTags = {},
148  const unsigned int backgroundColor = FXRGBA(255, 255, 255, 255), const std::string fieldString = "");
149 
152 
154  SumoXMLTag getTag() const;
155 
157  Supermode getSupermode() const;
158 
160  const std::string& getTagStr() const;
161 
163  void checkTagIntegrity() const;
164 
166  void addAttribute(const GNEAttributeProperties& attributeProperty);
167 
169  const std::string& getFieldString() const;
170 
172  const std::string& getTooltipText() const;
173 
175  unsigned int getBackGroundColor() const;
176 
179 
181  std::vector<GNEAttributeProperties>::const_iterator begin() const;
182 
184  std::vector<GNEAttributeProperties>::const_iterator end() const;
185 
187  const GNEAttributeProperties& at(int index) const;
188 
190  int getNumberOfAttributes() const;
191 
193  const std::string& getDefaultValue(SumoXMLAttr attr) const;
194 
196  GUIIcon getGUIIcon() const;
197 
199  SumoXMLTag getXMLTag() const;
200 
202  const std::vector<SumoXMLTag>& getParentTags() const;
203 
205  bool hasAttribute(SumoXMLAttr attr) const;
206 
209 
211  bool isNetworkElement() const;
212 
214  bool isAdditionalElement() const;
215 
217  bool isAdditionalPureElement() const;
218 
220  bool isDemandElement() const;
221 
223  bool isDataElement() const;
224 
226 
230  bool isStoppingPlace() const;
231 
233  bool isDetector() const;
234 
236  bool isCalibrator() const;
237 
239  bool isShapeElement() const;
240 
242  bool isTAZElement() const;
243 
245  bool isWireElement() const;
246 
248  bool isJuPedSimElement() const;
249 
251 
255  bool isType() const;
256 
258  bool isTypeDist() const;
259 
261  bool isVehicle() const;
262 
264  bool isRoute() const;
265 
267  bool isVehicleStop() const;
268 
270  bool isVehicleWaypoint() const;
271 
273  bool isFlow() const;
274 
276  bool isPerson() const;
277 
279  bool isContainer() const;
280 
282 
286  bool isPlan() const;
287 
289  bool isPlanPerson() const;
290 
292  bool isPlanContainer() const;
293 
295  bool isPersonTrip() const;
296 
298  bool isPlanWalk() const;
299 
301  bool isPlanRide() const;
302 
304  bool isPlanTransport() const;
305 
307  bool isPlanTranship() const;
308 
310  bool isPlanStop() const;
311 
313  bool isPlanStopPerson() const;
314 
316  bool isPlanStopContainer() const;
317 
319 
323  bool isGenericData() const;
324 
326  bool isMeanData() const;
327 
329 
332 
334  bool vehicleRoute() const;
335 
337  bool vehicleRouteEmbedded() const;
338 
340  bool vehicleEdges() const;
341 
343  bool vehicleJunctions() const;
344 
346  bool vehicleTAZs() const;
347 
349 
353  bool planConsecutiveEdges() const;
354 
356  bool planRoute() const;
357 
359  bool planEdge() const;
360 
362  bool planBusStop() const;
363 
365  bool planTrainStop() const;
366 
368  bool planContainerStop() const;
369 
371  bool planStoppingPlace() const;
372 
374  bool planFromTo() const;
375 
377  bool planFromEdge() const;
378 
380  bool planFromTAZ() const;
381 
383  bool planFromJunction() const;
384 
386  bool planFromStoppingPlace() const;
387 
389  bool planFromBusStop() const;
390 
392  bool planFromTrainStop() const;
393 
395  bool planFromContainerStop() const;
396 
398  bool planToEdge() const;
399 
401  bool planToTAZ() const;
402 
404  bool planToJunction() const;
405 
407  bool planToStoppingPlace() const;
408 
410  bool planToBusStop() const;
411 
413  bool planToTrainStop() const;
414 
416  bool planToContainerStop() const;
417 
419 
421  bool isChild() const;
422 
424  bool isSymbol() const;
425 
427  bool isInternalLane() const;
428 
430  bool isDrawable() const;
431 
433  bool isSelectable() const;
434 
436  bool canCloseShape() const;
437 
439  bool hasGEOShape() const;
440 
442  bool hasDialog() const;
443 
445  bool hasParameters() const;
446 
448  bool isPlacedInRTree() const;
449 
451  bool canBeReparent() const;
452 
454  bool canMaskStartEndPos() const;
455 
457  bool canCenterCameraAfterCreation() const;
458 
460  bool requireProj() const;
461 
463  bool vClassIcon() const;
464 
465 private:
468 
470  std::string myTagStr;
471 
473  int myTagType = -1;
474 
476  int myTagProperty = -1;
477 
479  int myTagParents = -1;
480 
482  int myConflicts = -1;
483 
485  std::vector<GNEAttributeProperties> myAttributeProperties;
486 
489 
492 
494  std::string myTooltipText;
495 
497  std::vector<SumoXMLTag> myParentTags;
498 
500  std::string myFieldString;
501 
503  unsigned int myBackgroundColor = 0;
504 };
505 
506 /****************************************************************************/
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.
@ SUMO_TAG_NOTHING
invalid tag
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const std::string & getTooltipText() const
get tooltip text
bool isPlanTransport() 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 planToContainerStop() const
return true if tag correspond to a plan that starts in containerStop
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
TagProperty
general tag properties
bool isPlan() const
plans
bool planFromJunction() const
return true if tag correspond to a plan that starts in junction
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 planToBusStop() const
return true if tag correspond to a plan that starts in busStop
bool isGenericData() const
data elements
bool planToStoppingPlace() const
return true if tag correspond to a plan that ends in stoppingPlace
bool planFromContainerStop() const
return true if tag correspond to a plan that starts in containerStop
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool planFromTo() const
return true if tag correspond to a plan with from-to parents
bool planRoute() const
return true if tag correspond to a plan placed over route
const GNEAttributeProperties & getAttributeProperties(SumoXMLAttr attr) const
get attribute (throw error if doesn't exist)
int myTagType
tag Types
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 planStoppingPlace() const
return true if tag correspond to a plan placed in stoppingPlace
bool isNetworkElement() const
element sets
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 isSelectable() const
return true if tag correspond to a selectable element
bool planToJunction() const
return true if tag correspond to a plan that starts in junction
bool isType() const
demand elements
std::string myTooltipText
tooltip text
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
bool isPlanStop() const
return true if tag correspond to a stop plan
bool planToTAZ() const
return true if tag correspond to a plan that starts in TAZ
bool planFromStoppingPlace() const
return true if tag correspond to a plan that starts in stoppingPlace
bool planConsecutiveEdges() const
plan parents
int myConflicts
conflicts
bool isPlacedInRTree() const
return true if Tag correspond to an element that has to be placed in RTREE
bool vehicleJunctions() const
return true if tag correspond to a vehicle placed over from-to junctions
std::string myFieldString
field string
bool isPlanStopContainer() const
return true if tag correspond to a container stop plan
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
additional elements
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...
bool planFromEdge() const
return true if tag correspond to a plan that starts in edge
Supermode getSupermode() const
get supermode associated with this tag
bool planFromBusStop() const
return true if tag correspond to a plan that starts in busStop
bool isDetector() const
return true if tag correspond to a shape (Only used to group all detectors in the XML)
bool planFromTrainStop() const
return true if tag correspond to a plan that starts in trainStop
void checkTagIntegrity() const
check Tag integrity (this include all their attributes)
bool planToTrainStop() const
return true if tag correspond to a plan that starts in trainStop
int myTagParents
tag parents
bool planFromTAZ() const
return true if tag correspond to a plan that starts in TAZ
bool vehicleRouteEmbedded() const
return true if tag correspond to a vehicle placed over an embedded route
bool isTypeDist() const
return true if tag correspond to a type distribution element
bool canCenterCameraAfterCreation() const
return true if tag correspond to an element that center camera after creation
bool isJuPedSimElement() const
return true if tag correspond to a JuPedSim element
bool isPlanContainer() const
return true if tag correspond to a container plan
bool planEdge() const
return true if tag correspond to a plan placed over edge
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
int getNumberOfAttributes() const
get number of attributes
bool planContainerStop() const
return true if tag correspond to a plan placed over containerStop
bool vehicleEdges() const
return true if tag correspond to a vehicle placed over from-to edges
bool canCloseShape() const
return true if tag correspond to an element that can close their shape
bool isPlanPerson() const
return true if tag correspond to a person plan
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
tag properties
SumoXMLTag getXMLTag() const
get XML tag
bool isPlanRide() const
return true if tag correspond to a ride plan
bool isInternalLane() const
return true if tag correspond to an internal lane
GUIIcon myIcon
icon associated to this Tag
bool planTrainStop() const
return true if tag correspond to a plan placed over trainStop
bool isVehicleWaypoint() const
return true if tag correspond to a vehicle waypoint element
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 hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
bool isPlanStopPerson() const
return true if tag correspond to a person stop plan
unsigned int getBackGroundColor() const
get background color
bool isVehicleStop() const
return true if tag correspond to a vehicle stop element
bool isPerson() const
return true if tag correspond to a person element
bool vehicleTAZs() const
return true if tag correspond to a vehicle placed over from-to TAZs
~GNETagProperties()
destructor
bool vehicleRoute() const
plan parents
bool isPlanWalk() const
return true if tag correspond to a walk plan
bool planToEdge() const
return true if tag correspond to a plan that starts in edge
bool planBusStop() const
return true if tag correspond to a plan placed over busStop
bool requireProj() const
return true if tag correspond to an element that requires a geo projection
bool isPlanTranship() const
return true if tag correspond to a tranship
GNETagProperties()
default constructor