Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/GNETagPropertiesDatabase.h
169665 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file GNETagPropertiesDatabase.h
15
/// @author Pablo Alvarez lopez
16
/// @date Feb 2025
17
///
18
// Database with all information about netedit elements
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNETagProperties.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNETagPropertiesDatabase {
30
31
public:
32
/// @brief constructor
33
GNETagPropertiesDatabase();
34
35
/// @brief destructor
36
~GNETagPropertiesDatabase();
37
38
/// @brief get tagProperty associated to the given tag
39
const GNETagProperties* getTagProperty(const SumoXMLTag tag, const bool hardFail) const;
40
41
/// @brief get tagProperties associated to the given set tag (persons, stops, plans, etc.)
42
const std::vector<const GNETagProperties*> getTagPropertiesSet(const SumoXMLTag tag, const bool hardFail) const;
43
44
/// @brief get tagProperties associated to the given GNETagProperties::Type (NETWORKELEMENT, ADDITIONALELEMENT, VEHICLE, etc.)
45
const std::vector<const GNETagProperties*> getTagPropertiesByType(const GNETagProperties::Type type) const;
46
47
/// @brief max number of editable (non extended) attributes
48
int getMaxNumberOfEditableAttributeRows() const;
49
50
/// @brief get max number of geo attribute rows
51
int getMaxNumberOfGeoAttributeRows() const;
52
53
/// @brief get max number of flow attribute rows
54
int getMaxNumberOfFlowAttributeRows() const;
55
56
/// @brief get max number of netedit attribute rows
57
int getMaxNumberOfNeteditAttributesRows() const;
58
59
/// @brief get hierarchy dept
60
int getHierarchyDepth() const;
61
62
/// @brief write machine readable attribute help to file
63
void writeAttributeHelp() const;
64
65
protected:
66
/// @brief fill hierarchy elements
67
void fillHierarchy();
68
69
/// @brief fill network elements
70
void fillNetworkElements();
71
72
/// @brief fill additional elements
73
void fillAdditionalElements();
74
75
/// @brief fill shape elements
76
void fillShapeElements();
77
78
/// @brief fill TAZ elements
79
void fillTAZElements();
80
81
/// @brief fill Wire elements
82
void fillWireElements();
83
84
/// @brief fill JuPedSim elements
85
void fillJuPedSimElements();
86
87
/// @brief fill demand elements
88
void fillDemandElements();
89
90
/// @brief fill vehicle elements
91
void fillVehicleElements();
92
93
/// @brief fill stop elements
94
void fillStopElements();
95
96
/// @brief fill waypoint elements
97
void fillWaypointElements();
98
99
/// @brief fill person elements
100
void fillPersonElements();
101
102
/// @brief fill person plan trips
103
void fillPersonPlanTrips();
104
105
/// @brief fill person plan walks
106
void fillPersonPlanWalks();
107
108
/// @brief fill person plan rides
109
void fillPersonPlanRides();
110
111
/// @brief fill person stop elements
112
void fillPersonStopElements();
113
114
/// @brief fill container elements
115
void fillContainerElements();
116
117
/// @brief fill container transport elements
118
void fillContainerTransportElements();
119
120
/// @brief fill container tranship elements
121
void fillContainerTranshipElements();
122
123
/// @brief fill container stop elements
124
void fillContainerStopElements();
125
126
/// @brief fill common attributes
127
void fillCommonAttributes(GNETagProperties* tagProperties);
128
129
/// @brief fill common stoppingPlace attributes
130
void fillCommonStoppingPlaceAttributes(GNETagProperties* tagProperties, const bool includeColor);
131
132
/// @brief fill common POI attributes
133
void fillCommonPOIAttributes(GNETagProperties* tagProperties);
134
135
/// @brief fill common route attributes
136
void fillCommonRouteAttributes(GNETagProperties* tagProperties);
137
138
/// @brief fill common vType attributes
139
void fillCommonVTypeAttributes(GNETagProperties* tagProperties);
140
141
/// @brief fill common vehicle attributes (used by vehicles, trips, routeFlows and flows)
142
void fillCommonVehicleAttributes(GNETagProperties* tagProperties);
143
144
/// @brief fill common flow attributes (used by flows, routeFlows and personFlows)
145
void fillCommonFlowAttributes(GNETagProperties* tagProperties, SumoXMLAttr perHour);
146
147
/// @brief fill Car Following Model of Vehicle/Person Types
148
void fillCarFollowingModelAttributes(GNETagProperties* tagProperties);
149
150
/// @brief fill Junction Model Attributes of Vehicle/Person Types
151
void fillJunctionModelAttributes(GNETagProperties* tagProperties);
152
153
/// @brief fill Junction Model Attributes of Vehicle/Person Types
154
void fillLaneChangingModelAttributes(GNETagProperties* tagProperties);
155
156
/// @brief fill common person attributes (used by person and personFlows)
157
void fillCommonPersonAttributes(GNETagProperties* tagProperties);
158
159
/// @brief fill common container attributes (used by container and containerFlows)
160
void fillCommonContainerAttributes(GNETagProperties* tagProperties);
161
162
/// @brief fill stop person attributes
163
void fillCommonStopAttributes(GNETagProperties* tagProperties, const bool waypoint);
164
165
/// @brief fill plan from-to attribute
166
void fillPlanParentAttributes(GNETagProperties* tagProperties);
167
168
/// @brief fill person trip common attributes
169
void fillPersonTripCommonAttributes(GNETagProperties* tagProperties);
170
171
/// @brief fill walk common attributes
172
void fillWalkCommonAttributes(GNETagProperties* tagProperties);
173
174
/// @brief fill ride common attributes
175
void fillRideCommonAttributes(GNETagProperties* tagProperties);
176
177
/// @brief fill transport common attributes
178
void fillTransportCommonAttributes(GNETagProperties* tagProperties);
179
180
/// @brief fill ride common attributes
181
void fillTranshipCommonAttributes(GNETagProperties* tagProperties);
182
183
/// @brief fill plan stop common attributes
184
void fillPlanStopCommonAttributes(GNETagProperties* tagProperties);
185
186
/// @brief fill Data elements
187
void fillDataElements();
188
189
/// @brief fill stop person attributes
190
void fillCommonMeanDataAttributes(GNETagProperties* tagProperties);
191
192
/// @name specific attributes
193
/// @{
194
195
/// @brief fill ID attribute
196
void fillIDAttribute(GNETagProperties* tagProperties, const bool createMode);
197
198
/// @brief fill name attribute
199
void fillNameAttribute(GNETagProperties* tagProperties);
200
201
/// @brief fill edge attribute
202
void fillEdgeAttribute(GNETagProperties* tagProperties, const bool synonymID);
203
204
/// @brief fill lane attribute
205
void fillLaneAttribute(GNETagProperties* tagProperties, const bool synonymID);
206
207
/// @brief fill friendlyPos attribute
208
void fillFriendlyPosAttribute(GNETagProperties* tagProperties);
209
210
/// @brief fill vTypes attribute
211
void fillVTypesAttribute(GNETagProperties* tagProperties);
212
213
/// @brief fill file attribute
214
void fillFileAttribute(GNETagProperties* tagProperties);
215
216
/// @brief fill output attribute
217
void fillOutputAttribute(GNETagProperties* tagProperties);
218
219
/// @brief fill imgFile attribute
220
void fillImgFileAttribute(GNETagProperties* tagProperties, const bool isExtended);
221
222
/// @brief fill depart attribute
223
void fillDepartAttribute(GNETagProperties* tagProperties);
224
225
/// @brief fill allowDisallow attributes
226
void fillAllowDisallowAttributes(GNETagProperties* tagProperties);
227
228
/// @brief fill lane position attribute
229
void fillPosOverLaneAttribute(GNETagProperties* tagProperties);
230
231
/// @brief fill detect person attribute
232
void fillDetectPersonsAttribute(GNETagProperties* tagProperties);
233
234
/// @brief fill color attribute
235
void fillColorAttribute(GNETagProperties* tagProperties, const std::string& defaultColor);
236
237
/// @brief fill detector period attribute
238
void fillDetectorPeriodAttribute(GNETagProperties* tagProperties);
239
240
/// @brief fill detector next edges attribute
241
void fillDetectorNextEdgesAttribute(GNETagProperties* tagProperties);
242
243
/// @brief fill detector threshold attribute
244
void fillDetectorThresholdAttributes(GNETagProperties* tagProperties, const bool includingJam);
245
246
/// @brief fill distribution probability attribute
247
void fillDistributionProbability(GNETagProperties* tagProperties, const bool visible);
248
249
/// @}
250
251
/// @brief update max number of attributes by type
252
void updateMaxNumberOfAttributesEditorRows();
253
254
/// @brief update max hierarchy depth
255
void updateMaxHierarchyDepth();
256
257
private:
258
/// @brief max number of editable (non extended) attributes (needed for attributes editor)
259
int myMaxNumberOfEditableAttributeRows = 0;
260
261
/// @brief max number of geo attributes (needed for geo attributes editor)
262
int myMaxNumberOfGeoAttributeRows = 0;
263
264
/// @brief max number of flow attributes (needed for geo attributes editor)
265
int myMaxNumberOfFlowAttributeRows = 0;
266
267
/// @brief max number of netedit attributes (needed for netedit attributes editor)
268
int myMaxNumberOfNeteditAttributeRows = 0;
269
270
/// @brief hierarchy dept
271
int myHierarchyDepth = 0;
272
273
/// @brief map with tag properties sets (persons, stops, etc.)
274
std::map<SumoXMLTag, GNETagProperties*> mySetTagProperties;
275
276
/// @brief map with the tags properties
277
std::map<SumoXMLTag, GNETagProperties*> myTagProperties;
278
279
/// @brief Invalidated copy constructor.
280
GNETagPropertiesDatabase(const GNETagPropertiesDatabase&) = delete;
281
282
/// @brief Invalidated assignment operator
283
GNETagPropertiesDatabase& operator=(const GNETagPropertiesDatabase& src) = delete;
284
};
285
286