Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEAdditionalHandler.h
169684 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 GNEAdditionalHandler.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
// Builds additional objects for netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/common/SUMOVehicleClass.h>
24
#include <utils/handlers/AdditionalHandler.h>
25
26
// ===========================================================================
27
// class declarations
28
// ===========================================================================
29
30
class GNENet;
31
class GNEEdge;
32
class GNELane;
33
class GNEAdditional;
34
35
// ===========================================================================
36
// class definitions
37
// ===========================================================================
38
39
class GNEAdditionalHandler : public AdditionalHandler {
40
41
public:
42
/// @brief Constructor
43
GNEAdditionalHandler(GNENet* net, const std::string& filename, const bool allowUndoRedo);
44
45
/// @brief Destructor
46
~GNEAdditionalHandler();
47
48
/// @brief run post parser tasks
49
bool postParserTasks();
50
51
/// @name build functions
52
/// @{
53
/**@brief Builds a bus stop
54
* @param[in] sumoBaseObject sumo base object used for build
55
* @param[in] id The id of the bus stop
56
* @param[in] laneID The lane the bus stop is placed on
57
* @param[in] startPos Begin position of the bus stop on the lane
58
* @param[in] endPos End position of the bus stop on the lane
59
* @param[in] name Name of busStop
60
* @param[in] lines Names of the bus lines that halt on this bus stop
61
* @param[in] personCapacity larger numbers of persons trying to enter will create an upstream jam on the sidewalk.
62
* @param[in] parkingLength parking length
63
* @param[in[ color busStop color
64
* @param[in] friendlyPos enable or disable friendly position
65
* @param[in] angle busStop's angle
66
* @param[in] parameters generic parameters
67
*/
68
bool buildBusStop(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
69
const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines,
70
const int personCapacity, const double parkingLength, const RGBColor& color, const bool friendlyPosition,
71
const double angle, const Parameterised::Map& parameters);
72
73
/**@brief Builds a train stop
74
* @param[in] sumoBaseObject sumo base object used for build
75
* @param[in] id The id of the train stop
76
* @param[in] laneID The lane the train stop is placed on
77
* @param[in] startPos Begin position of the train stop on the lane
78
* @param[in] endPos End position of the train stop on the lane
79
* @param[in] name Name of trainStop
80
* @param[in] lines Names of the train lines that halt on this train stop
81
* @param[in] personCapacity larger numbers of persons trying to enter will create an upstream jam on the sidewalk.
82
* @param[in] parkingLength parking length
83
* @param[in[ color trainStop color
84
* @param[in] friendlyPos enable or disable friendly position
85
* @param[in] angle trainStop's angle
86
* @param[in] parameters generic parameters
87
*/
88
bool buildTrainStop(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
89
const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines,
90
const int personCapacity, const double parkingLength, const RGBColor& color, const bool friendlyPosition,
91
const double angle, const Parameterised::Map& parameters);
92
93
/**@brief Builds an Access
94
* @param[in] sumoBaseObject sumo base object used for build
95
* @param[in] busStop GNEAdditional of this Access belongs
96
* @param[in] laneID The lane the Access is placed on
97
* @param[in] pos position of the Access on the lane
98
* @param[in[ length length of the Access
99
* @param[in] friendlyPos enable or disable friendly position
100
* @param[in] parameters generic parameters
101
*/
102
bool buildAccess(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const std::string& pos,
103
const double length, const bool friendlyPos, const Parameterised::Map& parameters);
104
105
/**@brief Builds a container stop
106
* @param[in] sumoBaseObject sumo base object used for build
107
* @param[in] id The id of the container stop
108
* @param[in] laneID The lane the container stop is placed on
109
* @param[in] startPos Begin position of the container stop on the lane
110
* @param[in] endPos End position of the container stop on the lane
111
* @param[in] name Name of container stop
112
* @param[in] lines Names of the bus lines that halt on this container stop
113
* @param[in] containerCapacity larger numbers of containers
114
* @param[in] parkingLength parking length
115
* @param[in[ color containerStop color
116
* @param[in] friendlyPos enable or disable friendly position
117
* @param[in] angle container stops's angle
118
* @param[in] parameters generic parameters
119
*/
120
bool buildContainerStop(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
121
const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines,
122
const int containerCapacity, const double parkingLength, const RGBColor& color, const bool friendlyPosition,
123
const double angle, const Parameterised::Map& parameters);
124
125
/**@brief Builds a charging Station
126
* @param[in] sumoBaseObject sumo base object used for build
127
* @param[in] id The id of the charging Station
128
* @param[in] laneID The lane the charging Station is placed on
129
* @param[in] startPos Begin position of the charging Station on the lane
130
* @param[in] endPos End position of the charging Station on the lane
131
* @param[in] name Name of charging station
132
* @param[in] chargingPower power charged in every timeStep
133
* @param[in] efficiency efficiency of the charge
134
* @param[in] chargeInTransit enable or disable charge in transit
135
* @param[in] chargeDelay delay in the charge
136
* @param[in] chargeType charge type (normal, electric or fuel)
137
* @param[in] waitingTime waiting time until start charging
138
* @param[in] friendlyPos enable or disable friendly position
139
* @param[in] parameters generic parameters
140
*/
141
bool buildChargingStation(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
142
const double startPos, const double endPos, const std::string& name, const double chargingPower,
143
const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay, const std::string& chargeType,
144
const SUMOTime waitingTime, const bool friendlyPosition, const std::string& parkingAreaID, const Parameterised::Map& parameters);
145
146
/**@brief Builds a Parking Area
147
* @param[in] sumoBaseObject sumo base object used for build
148
* @param[in] id The id of the Parking >Area
149
* @param[in] laneID The lane the Parking Area is placed on
150
* @param[in] startPos Begin position of the Parking Area on the lane
151
* @param[in] endPos End position of the Parking Area on the lane
152
* @param[in] departPos lane position in that vehicle must depart when leaves parkingArea
153
* @param[in] name Name of Parking Area
154
* @param[in] badges names which grant access to the parkingArea
155
* @param[in] friendlyPos enable or disable friendly position
156
* @param[in] roadSideCapacity road side capacity of ParkingArea
157
* @param[in] width ParkingArea's width
158
* @param[in] length ParkingArea's length
159
* @param[in] angle ParkingArea's angle
160
* @param[in] lefthand enable or disable lefthand
161
* @param[in] parameters generic parameters
162
*/
163
bool buildParkingArea(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
164
const double startPos, const double endPos, const std::string& departPos, const std::string& name,
165
const std::vector<std::string>& badges, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad,
166
const double width, const double length, const double angle, const bool lefthand, const Parameterised::Map& parameters);
167
168
/**@brief Builds a Parking Space
169
* @param[in] sumoBaseObject sumo base object used for build
170
* @param[in] x Position X
171
* @param[in] y Position Y
172
* @param[in] z Position Z
173
* @param[in] name Name of Parking Area
174
* @param[in] width ParkingArea's width
175
* @param[in] length ParkingArea's length
176
* @param[in] angle ParkingArea's angle
177
* @param[in] slope ParkingArea's slope (of this space)
178
* @param[in] parameters generic parameters
179
*/
180
bool buildParkingSpace(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const double x, const double y, const double z,
181
const std::string& name, const std::string& width, const std::string& length, const std::string& angle,
182
const double slope, const Parameterised::Map& parameters);
183
184
/**@brief Builds a induction loop detector (E1)
185
* @param[in] sumoBaseObject sumo base object used for build
186
* @param[in] id The id of the detector
187
* @param[in] laneID The lane the detector is placed on
188
* @param[in] pos position of the detector on the lane
189
* @param[in] period the aggregation period the values the detector collects shall be summed up.
190
* @param[in] filename The path to the output file.
191
* @param[in] vtypes list of vehicle types to be reported
192
* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection
193
* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)
194
* @param[in] name E1 detector name
195
* @param[in] friendlyPos enable or disable friendly position
196
* @param[in] parameters generic parameters
197
*/
198
bool buildE1Detector(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
199
const double position, const SUMOTime period, const std::string& file, const std::vector<std::string>& vehicleTypes,
200
const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
201
const bool friendlyPos, const Parameterised::Map& parameters);
202
203
/**@brief Builds a single-lane Area Detector (E2)
204
* @param[in] sumoBaseObject sumo base object used for build
205
* @param[in] id The id of the detector
206
* @param[in] laneID The lane the detector is placed on
207
* @param[in] pos position of the detector on the lane
208
* @param[in[ length length of the detector
209
* @param[in] period the aggregation period the values the detector collects shall be summed up.
210
* @param[in] trafficLight The traffic light that triggers aggregation when switching.
211
* @param[in] filename The path to the output file.
212
* @param[in] vtypes list of vehicle types to be reported
213
* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection
214
* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)
215
* @param[in] name E2 detector name
216
* @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting
217
* @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting
218
* @param[in] jamThreshold The minimum distance to the next standing vehicle in order to make this vehicle count as a participant to the jam
219
* @param[in] friendlyPos enable or disable friendly position
220
* @param[in] show detector in sumo-gui
221
* @param[in] parameters generic parameters
222
*/
223
bool buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
224
const double pos, const double length, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
225
const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
226
const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
227
const bool friendlyPos, const bool show, const Parameterised::Map& parameters);
228
229
/**@brief Builds a multi-lane Area Detector (E2)
230
* @param[in] sumoBaseObject sumo base object used for build
231
* @param[in] id The id of the detector
232
* @param[in] laneIDs The lanes the detector is placed on
233
* @param[in] pos position of the detector on the first lane
234
* @param[in] endPos position of the detector on the last lane
235
* @param[in] period the aggregation period the values the detector collects shall be summed up.
236
* @param[in] trafficLight The traffic light that triggers aggregation when switching.
237
* @param[in] filename The path to the output file.
238
* @param[in] vtypes list of vehicle types to be reported
239
* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection
240
* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)
241
* @param[in] name E2 detector name
242
* @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting
243
* @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting
244
* @param[in] jamThreshold The minimum distance to the next standing vehicle in order to make this vehicle count as a participant to the jam
245
* @param[in] friendlyPos enable or disable friendly position
246
* @param[in] show detector in sumo-gui
247
* @param[in] parameters generic parameters
248
*/
249
bool buildMultiLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::vector<std::string>& laneIDs,
250
const double pos, const double endPos, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
251
const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
252
const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
253
const bool friendlyPos, const bool show, const Parameterised::Map& parameters);
254
255
/**@brief Builds a multi entry exit detector (E3)
256
* @param[in] sumoBaseObject sumo base object used for build
257
* @param[in] id The id of the detector
258
* @param[in] pos position of the detector in the map
259
* @param[in] period the aggregation period the values the detector collects shall be summed up.
260
* @param[in] filename The path to the output file.
261
* @param[in] vtypes list of vehicle types to be reported
262
* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection
263
* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)
264
* @param[in] name E2 detector name
265
* @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting
266
* @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting
267
* @param[in] openEntry enable or disable open Entry
268
* @param[in] expectedArrival Whether no warning should be issued when a vehicle arrives within the detector area
269
* @param[in] parameters generic parameters
270
*/
271
bool buildDetectorE3(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const Position& pos, const SUMOTime period,
272
const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
273
const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold,
274
const bool openEntry, const bool expectedArrival, const Parameterised::Map& parameters);
275
276
/**@brief Builds a entry detector (E3)
277
* @param[in] sumoBaseObject sumo base object used for build
278
* @param[in] laneID The lane in which the entry detector is placed on
279
* @param[in] pos position of the entry detector on the lane
280
* @param[in] friendlyPos enable or disable friendly position
281
* @param[in] parameters generic parameters
282
*/
283
bool buildDetectorEntry(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos, const bool friendlyPos,
284
const Parameterised::Map& parameters);
285
286
/**@brief Builds a exit detector (E3)
287
* @param[in] sumoBaseObject sumo base object used for build
288
* @param[in] laneID The lane in which the exit detector is placed on
289
* @param[in] pos position of the exit detector on the lane
290
* @param[in] friendlyPos enable or disable friendly position
291
* @param[in] parameters generic parameters
292
*/
293
bool buildDetectorExit(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos, const bool friendlyPos,
294
const Parameterised::Map& parameters);
295
296
/**@brief Builds a Instant Induction Loop Detector (E1Instant)
297
* @param[in] sumoBaseObject sumo base object used for build
298
* @param[in] id The id of the detector
299
* @param[in] laneID The lane the detector is placed on
300
* @param[in] pos position of the detector on the lane
301
* @param[in] filename The path to the output file.
302
* @param[in] name E2 detector name
303
* @param[in] vtypes list of vehicle types to be reported
304
* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection
305
* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)
306
* @param[in] friendlyPos enable or disable friendly position
307
* @param[in] parameters generic parameters
308
*/
309
bool buildDetectorE1Instant(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
310
const double pos, const std::string& filename, const std::vector<std::string>& vehicleTypes,
311
const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
312
const bool friendlyPos, const Parameterised::Map& parameters);
313
314
/**@brief builds a microscopic calibrator over a lane
315
* @param[in] id The id of the calibrator
316
* @param[in] laneID The lane the calibrator is placed at
317
* @param[in] pos The position on the edge the calibrator lies at
318
* @param[in] name Calibrator name
319
* @param[in] outfile te file in which write results
320
* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming
321
* @param[in] vTypes space separated list of vehicle type ids to consider
322
* @param[in] parameters generic parameters
323
*/
324
bool buildLaneCalibrator(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID,
325
const double pos, const std::string& name, const std::string& outfile, const SUMOTime period, const std::string& routeprobe,
326
const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);
327
328
/**@brief builds a microscopic calibrator over an edge
329
* @param[in] sumoBaseObject sumo base object used for build
330
* @param[in] id The id of the calibrator
331
* @param[in] edgeID The edge the calibrator is placed at
332
* @param[in] pos The position on the edge the calibrator lies at
333
* @param[in] name Calibrator name
334
* @param[in] outfile te file in which write results
335
* @param[in] routeProbe route probe vinculated with this calibrator
336
* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming
337
* @param[in] vTypes space separated list of vehicle type ids to consider
338
* @param[in] parameters generic parameters
339
*/
340
bool buildEdgeCalibrator(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& edgeID,
341
const double pos, const std::string& name, const std::string& outfile, const SUMOTime period, const std::string& routeprobe,
342
const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);
343
344
/**@brief builds a calibrator flow
345
* @param[in] sumoBaseObject sumo base object used for build
346
* @param[in] vehicleParameter calibratorFlow parameter
347
*/
348
bool buildCalibratorFlow(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOVehicleParameter& vehicleParameter) ;
349
350
/**@brief builds a rerouter
351
* @param[in] sumoBaseObject sumo base object used for build
352
* @param[in] id The id of the rerouter
353
* @param[in] pos position of the rerouter in the map
354
* @param[in] edgeIDs The edges the rerouter is placed at
355
* @param[in] prob The probability the rerouter reroutes vehicles with
356
* @param[in] name Calibrator name
357
* @param[in] parameters generic parameters
358
*/
359
bool buildRerouter(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const Position& pos,
360
const std::vector<std::string>& edgeIDs, const double prob, const std::string& name, const bool off, const bool optional,
361
const SUMOTime timeThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);
362
363
/**@brief builds a rerouter interval
364
* @param[in] sumoBaseObject sumo base object used for build
365
* @param[in] begin begin of interval
366
* @param[in] end end of interval
367
*/
368
bool buildRerouterInterval(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOTime begin, const SUMOTime end);
369
370
/**@brief builds a closing lane reroute
371
* @param[in] sumoBaseObject sumo base object used for build
372
* @param[in] closedLane closed lane
373
* @param[in] permissions vClasses disallowed for the lane
374
*/
375
bool buildClosingLaneReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedLane, SVCPermissions permissions);
376
377
/**@brief builds a closing edge reroute
378
* @param[in] sumoBaseObject sumo base object used for build
379
* @param[in] closedEdgeID closed edge
380
* @param[in] permissions vClasses disallowed for the lane
381
*/
382
bool buildClosingReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedEdgeID, SVCPermissions permissions);
383
384
/**@brief builds a dest prob reroute
385
* @param[in] sumoBaseObject sumo base object used for build
386
* @param[in] newEdgeDestinationID new edge destination ID
387
* @param[in] probability rerouting probability
388
*/
389
bool buildDestProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newEdgeDestinationID, const double probability);
390
391
/**@brief builds a parking area reroute
392
* @param[in] sumoBaseObject sumo base object used for build
393
* @param[in] newParkignAreaID new parkingArea ID
394
* @param[in] probability rerouting probability
395
*/
396
bool buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newParkignAreaID, const double probability, const bool visible);
397
398
/**@brief builds a route prob reroute
399
* @param[in] sumoBaseObject sumo base object used for build
400
* @param[in] newRouteID new route ID
401
* @param[in] probability rerouting probability
402
*/
403
bool buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newRouteID, const double probability);
404
405
/**@brief builds a Route probe
406
* @param[in] sumoBaseObject sumo base object used for build
407
* @param[in] id The id of the routeprobe
408
* @param[in] edgeID The edges the routeprobe is placed at
409
* @param[in] period the aggregation period the values the routeprobe collects shall be summed up.
410
* @param[in] name Calibrator name
411
* @param[in] file The file to read the routeprobe definitions from
412
* @param[in] begin The time at which to start generating output
413
* @param[in] vTypes list of vehicle types to be affected
414
* @param[in] parameters generic parameters
415
*/
416
bool buildRouteProbe(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& edgeID, const SUMOTime period,
417
const std::string& name, const std::string& file, const SUMOTime begin, const std::vector<std::string>& vTypes,
418
const Parameterised::Map& parameters);
419
420
/**@brief Builds a VariableSpeedSign (lane speed additional)
421
* @param[in] sumoBaseObject sumo base object used for build
422
* @param[in] id The id of the lane speed additional
423
* @param[in] destLanes List of lanes affected by this speed additional
424
* @param[in] name VSS name
425
* @param[in] vTypes list of vehicle types to be affected
426
* @param[in] parameters generic parameters
427
*/
428
bool buildVariableSpeedSign(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const Position& pos,
429
const std::vector<std::string>& laneIDs, const std::string& name, const std::vector<std::string>& vTypes,
430
const Parameterised::Map& parameters);
431
432
/**@brief Builds a VariableSpeedSign Step
433
* @param[in] sumoBaseObject sumo base object used for build
434
* @param[in] time step's time
435
* @param[in] speed step's speed
436
*/
437
bool buildVariableSpeedSignStep(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const SUMOTime time, const double speed);
438
439
/**@brief Builds a vaporizer (lane speed additional)
440
* @param[in] sumoBaseObject sumo base object used for build
441
* @param[in] edgeID edge in which this vaporizer is placed
442
* @param[in] from time in which this vaporizer start
443
* @param[in] endTime time in which this vaporizer ends
444
* @param[in] name Vaporizer name
445
* @param[in] parameters generic parameters
446
*/
447
bool buildVaporizer(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const SUMOTime from,
448
const SUMOTime endTime, const std::string& name, const Parameterised::Map& parameters);
449
450
/**@brief Builds a TAZ (Traffic Assignment Zone)
451
* @param[in] sumoBaseObject sumo base object used for build
452
* @param[in] id TAZ ID
453
* @param[in] shape TAZ shape
454
* @param[in] center shape center
455
* @param[in] fill Whether the TAZ shall be filled
456
* @param[in] edgeIDs list of edges (note: This will create GNETAZSourceSinks/Sinks with default values)
457
* @param[in] name Vaporizer name
458
* @param[in] parameters generic parameters
459
*/
460
bool buildTAZ(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const PositionVector& shape,
461
const Position& center, const bool fill, const RGBColor& color, const std::vector<std::string>& edgeIDs,
462
const std::string& name, const Parameterised::Map& parameters);
463
464
/**@brief Builds a TAZSource (Traffic Assignment Zone)
465
* @param[in] sumoBaseObject sumo base object used for build
466
* @param[in] TAZ Traffic Assignment Zone in which this TAZSource is palced
467
* @param[in] edgeID edge in which TAZSource is placed
468
* @param[in] departWeight depart weight of TAZSource
469
*/
470
bool buildTAZSource(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double departWeight);
471
472
/**@brief Builds a TAZSink (Traffic Assignment Zone)
473
* @param[in] net net in which element will be inserted
474
* @param[in] allowUndoRedo enable or disable remove created additional with ctrl + Z / ctrl + Y
475
* @param[in] TAZ Traffic Assignment Zone in which this TAZSink is palced
476
* @param[in] edgeID edge in which TAZSink is placed
477
* @param[in] arrivalWeight arrival weight of TAZSink
478
*/
479
bool buildTAZSink(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double arrivalWeight);
480
481
/**@brief build traction substation
482
* @param[in] id Traction substation ID
483
* @param[in] pos Position of traction substation in view (optional)
484
* @param[in] voltage Voltage of at connection point for the overhead wire
485
* @param[in] currentLimit Current limit of the feeder line
486
* @param[in] parameters generic parameters
487
*/
488
bool buildTractionSubstation(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const Position& pos,
489
const double voltage, const double currentLimit, const Parameterised::Map& parameters);
490
491
/** @brief build overhead wire
492
* @param[in] id Overhead wire ID
493
* @param[in] lane Lane over which the segment is placed
494
* @param[in] substationId Substation to which the circuit is connected
495
* @param[in] laneIDs list of consecutive lanes of the circuit
496
* @param[in] startPos Starting position in the specified lane
497
* @param[in] endPos Ending position in the specified lane
498
* @param[in] friendlyPos enable or disable friendly position
499
* @param[in] forbiddenInnerLanes Inner lanes, where placing of overhead wire is restricted
500
* @param[in] parameters generic parameters
501
*/
502
bool buildOverheadWire(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& substationId,
503
const std::vector<std::string>& laneIDs, const double startPos, const double endPos, const bool friendlyPos,
504
const std::vector<std::string>& forbiddenInnerLanes, const Parameterised::Map& parameters);
505
506
/** @brief build overhead wire clamp
507
* @param[in] id Overhead wire clamp ID
508
* @param[in] overheadWireIDStartClamp ID of the overhead wire segment, to the start of which the overhead wire clamp is connected
509
* @param[in] laneIDStartClamp ID of the overhead wire segment lane of overheadWireIDStartClamp
510
* @param[in] overheadWireIDEndClamp ID of the overhead wire segment, to the end of which the overhead wire clamp is connected
511
* @param[in] laneIDEndClamp ID of the overhead wire segment lane of overheadWireIDEndClamp
512
* @param[in] parameters generic parameters
513
*/
514
bool buildOverheadWireClamp(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& overheadWireIDStartClamp,
515
const std::string& laneIDStartClamp, const std::string& overheadWireIDEndClamp, const std::string& laneIDEndClamp,
516
const Parameterised::Map& parameters);
517
518
/**@brief Builds a polygon using the given values
519
* @param[in] sumoBaseObject sumo base object used for build
520
* @param[in] id The name of the polygon
521
* @param[in] type The (abstract) type of the polygon
522
* @param[in] color The color of the polygon
523
* @param[in] layer The layer of the polygon
524
* @param[in] angle The rotation of the polygon
525
* @param[in] imgFile The raster image of the polygon
526
* @param[in] shape The shape of the polygon
527
* @param[in] geo specify if shape was loaded as GEO coordinate
528
* @param[in] fill Whether the polygon shall be filled
529
* @param[in] lineWidth Line width when drawing unfilled polygon
530
* @param[in] name polygon name
531
* @param[in] parameters generic parameters
532
*/
533
bool buildPolygon(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& type,
534
const RGBColor& color, const double layer, const double angle, const std::string& imgFile, const PositionVector& shape,
535
const bool geo, const bool fill, const double lineWidth, const std::string& name, const Parameterised::Map& parameters);
536
537
/**@brief Builds a POI using the given values
538
* @param[in] sumoBaseObject sumo base object used for build
539
* @param[in] id The name of the POI
540
* @param[in] type The (abstract) type of the POI
541
* @param[in] color The color of the POI
542
* @param[in] x POI's x position
543
* @param[in] y POI's y position
544
* @param[in] icon The icon of the POI
545
* @param[in] layer The layer of the POI
546
* @param[in] angle The rotation of the POI
547
* @param[in] imgFile The raster image of the POI
548
* @param[in] width The width of the POI image
549
* @param[in] height The height of the POI image
550
* @param[in] name POI name
551
* @param[in] parameters generic parameters
552
*/
553
bool buildPOI(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& type,
554
const RGBColor& color, const double x, const double y, const std::string& icon, const double layer,
555
const double angle, const std::string& imgFile, const double width, const double height, const std::string& name,
556
const Parameterised::Map& parameters);
557
558
/**@brief Builds a POI over lane using the given values
559
* @param[in] sumoBaseObject sumo base object used for build
560
* @param[in] id The name of the POI
561
* @param[in] type The (abstract) type of the POI
562
* @param[in] color The color of the POI
563
* @param[in] laneID The Lane in which this POI is placed
564
* @param[in] posOverLane The position over Lane
565
* @param[in] friendlyPos enable or disable friendly position
566
* @param[in] posLat The position lateral over Lane
567
* @param[in] icon The icon of the POI
568
* @param[in] layer The layer of the POI
569
* @param[in] angle The rotation of the POI
570
* @param[in] imgFile The raster image of the POI
571
* @param[in] width The width of the POI image
572
* @param[in] height The height of the POI image
573
* @param[in] name POI name
574
* @param[in] parameters generic parameters
575
*/
576
bool buildPOILane(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& type, const RGBColor& color,
577
const std::string& laneID, const double posOverLane, const bool friendlyPos, const double posLat, const std::string& icon,
578
const double layer, const double angle, const std::string& imgFile, const double width, const double height, const std::string& name,
579
const Parameterised::Map& parameters);
580
581
/**@brief Builds a POI in GEO coordinaten using the given values
582
* @param[in] sumoBaseObject sumo base object used for build
583
* @param[in] id The name of the POI
584
* @param[in] type The (abstract) type of the POI
585
* @param[in] color The color of the POI
586
* @param[in] lon POI's longitude
587
* @param[in] lat POI's latitude
588
* @param[in] icon The icon of the POI
589
* @param[in] layer The layer of the POI
590
* @param[in] angle The rotation of the POI
591
* @param[in] imgFile The raster image of the POI
592
* @param[in] width The width of the POI image
593
* @param[in] height The height of the POI image
594
* @param[in] name POI name
595
* @param[in] parameters generic parameters
596
*/
597
bool buildPOIGeo(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& type,
598
const RGBColor& color, const double lon, const double lat, const std::string& icon, const double layer,
599
const double angle, const std::string& imgFile, const double width, const double height, const std::string& name,
600
const Parameterised::Map& parameters);
601
602
/**@brief Builds a JuPedSim walkable area using the given values
603
* @param[in] sumoBaseObject sumo base object used for build
604
* @param[in] id The name of the walkable area
605
* @param[in] shape The shape of the walkable area
606
* @param[in] geo specify if shape was loaded as GEO
607
* @param[in] name walkable area name
608
* @param[in] parameters generic parameters
609
*/
610
bool buildJpsWalkableArea(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const PositionVector& shape,
611
bool geo, const std::string& name, const Parameterised::Map& parameters);
612
613
/**@brief Builds a JuPedSim obstacle using the given values
614
* @param[in] sumoBaseObject sumo base object used for build
615
* @param[in] id The name of the obstacle
616
* @param[in] shape The shape of the obstacle
617
* @param[in] geo specify if shape was loaded as GEO
618
* @param[in] name obstacle name
619
* @param[in] parameters generic parameters
620
*/
621
bool buildJpsObstacle(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const PositionVector& shape,
622
bool geo, const std::string& name, const Parameterised::Map& parameters);
623
624
/// @}
625
626
/// @brief check if a GNEAccess can be created in a certain Edge
627
static bool accessCanBeCreated(GNEAdditional* busStopParent, GNEEdge* edge);
628
629
/// @brief check if an overlapping is produced in rerouter if a interval with certain begin and end is inserted
630
static bool checkOverlappingRerouterIntervals(GNEAdditional* rerouter, const SUMOTime newBegin, const SUMOTime newEnd);
631
632
/**@brief check if the given position over a lane is valid
633
* @param[in] pos pos position of element over lane
634
* @param[in] length element's length
635
* @param[in] laneLength Length of the lane
636
* @param[in] friendlyPos Attribute of element
637
* @return true if the element position is valid, false in otherweise
638
*/
639
static bool checkLanePosition(double pos, const double length, const double laneLength, const bool friendlyPos);
640
641
/**@brief fix given position over lane
642
* @param[in] pos pos position of element over lane
643
* @param[in] laneLength Length of the lane
644
*/
645
static void fixLanePosition(double& pos, double& length, const double laneLength);
646
647
/**@brief check if enable friendly pos in small lanes
648
* @param[in] pos pos position of element over lane
649
* @param[in] length element's length
650
* @param[in] laneLength Length of the lane
651
* @param[in] friendlyPos Attribute of element
652
* @return true if the element position is valid, false in otherweise
653
*/
654
static bool checkFriendlyPosSmallLanes(double pos, const double length, const double laneLength, const bool friendlyPos);
655
656
/**@brief check if the given positions over a lane is valid
657
* @param[in] from begin position of element over lane
658
* @param[in] to end position of element over lane
659
* @param[in] laneLength Length of the lane
660
* @param[in] friendlyPos Attribute of element
661
* @return true if the element positions is valid, false in otherwise
662
*/
663
static bool checkLaneDoublePosition(double from, const double to, const double laneLength, const bool friendlyPos);
664
665
/**@brief fix the given positions over lane
666
* @param[in] from begin position of element over lane
667
* @param[in] to end position of element over lane
668
* @param[in] laneLength Length of the lane
669
*/
670
static void fixLaneDoublePosition(double& from, double& to, const double laneLengt);
671
672
/**@brief check if the given positions over two lanes are valid
673
* @param[in] fromPos position of element over first lane
674
* @param[in] fromLaneLength length of the first lane
675
* @param[in] toPos position of element over second lane
676
* @param[in] toLaneLength length of the second lane
677
* @param[in] friendlyPos flag for friendlyPos
678
* @return true if the element positions is valid, false in otherwise
679
*/
680
static bool checkMultiLanePosition(double fromPos, const double fromLaneLength, const double toPos, const double tolaneLength, const bool friendlyPos);
681
682
/**@brief fix the given positions over two lanes
683
* @param[in] fromPos position of element over first lane
684
* @param[in] fromLaneLength length of the first lane
685
* @param[in] toPos position of element over second lane
686
* @param[in] toLaneLength length of the second lane
687
*/
688
static void fixMultiLanePosition(double fromPos, const double fromLaneLength, double toPos, const double tolaneLength);
689
690
protected:
691
/// @brief get additional parent
692
GNEAdditional* getAdditionalParent(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, SumoXMLTag tag) const;
693
694
/// @brief get rerouter interval parent
695
GNEAdditional* getRerouterIntervalParent(const CommonXMLStructure::SumoBaseObject* sumoBaseObject) const;
696
697
/// @brief parse edges
698
std::vector<GNEEdge*> parseEdges(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& edgeIDs);
699
700
/// @brief parse lanes
701
std::vector<GNELane*> parseLanes(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& laneIDs);
702
703
/// @brief get element by ID
704
GNEAdditional* retrieveAdditionalElement(const std::vector<SumoXMLTag> tags, const std::string& id);
705
706
/// @brief check if element exist, and if overwrite
707
bool checkElement(const SumoXMLTag tag, GNEAdditional* additional);
708
709
private:
710
/// @brief pointer to GNENet
711
GNENet* myNet;
712
713
/// @brief allow undo/redo
714
const bool myAllowUndoRedo;
715
716
/// @brief invalidate default constructo
717
GNEAdditionalHandler() = delete;
718
719
/// @brief invalidate copy constructor
720
GNEAdditionalHandler(const GNEAdditionalHandler& s) = delete;
721
722
/// @brief invalidate assignment operator
723
GNEAdditionalHandler& operator=(const GNEAdditionalHandler& s) = delete;
724
};
725
726