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