SUMO - Simulation of Urban MObility
GNEAdditionalHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Builds trigger objects for netedit
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
24 #include <utils/xml/XMLSubSys.h>
29 #include <netedit/GNEViewNet.h>
30 #include <netedit/GNEUndoList.h>
31 #include <netedit/GNENet.h>
32 
33 
34 #include "GNEAdditionalHandler.h"
35 #include "GNEBusStop.h"
36 #include "GNEAccess.h"
37 #include "GNECalibrator.h"
38 #include "GNECalibratorFlow.h"
39 #include "GNECalibratorRoute.h"
41 #include "GNEChargingStation.h"
42 #include "GNEClosingLaneReroute.h"
43 #include "GNEClosingReroute.h"
44 #include "GNEContainerStop.h"
45 #include "GNEDestProbReroute.h"
46 #include "GNEDetectorE1.h"
47 #include "GNEDetectorE2.h"
48 #include "GNEDetectorE3.h"
49 #include "GNEDetectorEntry.h"
50 #include "GNEDetectorExit.h"
51 #include "GNEDetectorE1Instant.h"
52 #include "GNEParkingArea.h"
53 #include "GNEParkingSpace.h"
54 #include "GNERerouter.h"
55 #include "GNERerouterInterval.h"
56 #include "GNERouteProbReroute.h"
57 #include "GNEParkingAreaReroute.h"
58 #include "GNERouteProbe.h"
59 #include "GNEVaporizer.h"
60 #include "GNEVariableSpeedSign.h"
62 
63 
64 // ===========================================================================
65 // member method definitions
66 // ===========================================================================
67 
68 GNEAdditionalHandler::GNEAdditionalHandler(const std::string& file, GNEViewNet* viewNet, bool undoAdditionals, GNEAdditional* additionalParent) :
69  SUMOSAXHandler(file),
70  myViewNet(viewNet),
71  myUndoAdditionals(undoAdditionals),
72  myAdditionalParent(additionalParent),
73  myLastInsertedAdditional(nullptr) {
74  if (additionalParent) {
75  myParentElements.insertElement(additionalParent->getTag());
76  myParentElements.commitElementInsertion(additionalParent->getID());
77  }
78 }
79 
80 
82 
83 
84 void
86  // Obtain tag of element
87  SumoXMLTag tag = static_cast<SumoXMLTag>(element);
88  // check if we're parsing a generic parameter
89  if (tag == SUMO_TAG_PARAM) {
90  // push element int stack
92  // parse generic parameter
93  parseGenericParameter(attrs);
94  } else if (tag != SUMO_TAG_NOTHING) {
95  // reset last inserted additional
96  myLastInsertedAdditional = nullptr;
97  // push element int stack
99  // Call parse and build depending of tag
100  switch (tag) {
101  case SUMO_TAG_BUS_STOP:
102  parseAndBuildBusStop(attrs, tag);
103  break;
104  case SUMO_TAG_TRAIN_STOP:
106  break;
107  case SUMO_TAG_ACCESS:
108  parseAndBuildAccess(attrs, tag);
109  break;
111  parseAndBuildContainerStop(attrs, tag);
112  break;
114  parseAndBuildChargingStation(attrs, tag);
115  break;
116  case SUMO_TAG_E1DETECTOR:
118  parseAndBuildDetectorE1(attrs, tag);
119  break;
120  case SUMO_TAG_E2DETECTOR:
122  parseAndBuildDetectorE2(attrs, tag);
123  break;
124  case SUMO_TAG_E3DETECTOR:
126  parseAndBuildDetectorE3(attrs, tag);
127  break;
128  case SUMO_TAG_DET_ENTRY:
129  parseAndBuildDetectorEntry(attrs, tag);
130  break;
131  case SUMO_TAG_DET_EXIT:
132  parseAndBuildDetectorExit(attrs, tag);
133  break;
135  parseAndBuildDetectorE1Instant(attrs, tag);
136  break;
137  case SUMO_TAG_ROUTEPROBE:
138  parseAndBuildRouteProbe(attrs, tag);
139  break;
140  case SUMO_TAG_VAPORIZER:
141  parseAndBuildVaporizer(attrs, tag);
142  break;
143  case SUMO_TAG_VSS:
144  parseAndBuildVariableSpeedSign(attrs, tag);
145  break;
146  case SUMO_TAG_STEP:
148  break;
149  case SUMO_TAG_CALIBRATOR:
150  parseAndBuildCalibrator(attrs, tag);
151  break;
153  parseAndBuildParkingArea(attrs, tag);
154  break;
156  parseAndBuildParkingSpace(attrs, tag);
157  break;
158  case SUMO_TAG_VTYPE:
160  break;
161  case SUMO_TAG_ROUTE:
162  parseAndBuildCalibratorRoute(attrs, tag);
163  break;
164  case SUMO_TAG_FLOW:
165  parseAndBuildCalibratorFlow(attrs, tag);
166  break;
167  case SUMO_TAG_REROUTER:
168  parseAndBuildRerouter(attrs, tag);
169  break;
170  case SUMO_TAG_INTERVAL:
171  parseAndBuildRerouterInterval(attrs, tag);
172  break;
175  break;
178  break;
181  break;
184  break;
187  break;
188  default:
189  break;
190  }
191  }
192 }
193 
194 
195 void
197  // pop last inserted element
199 }
200 
201 
202 void
204  bool abort = false;
205  // parse attributes of Vaporizer
206  const std::string edgeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
207  double begin = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_BEGIN, abort);
208  double end = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_END, abort);
209  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_NAME, abort);
210  // Continue if all parameters were successfully loaded
211  if (!abort) {
212  // get GNEEdge
213  GNEEdge* edge = myViewNet->getNet()->retrieveEdge(edgeID, false);
214  // check that all parameters are valid
215  if (edge == nullptr) {
216  WRITE_WARNING("The edge '" + edgeID + "' to use within the " + toString(tag) + " is not known.");
217  } else if (myViewNet->getNet()->retrieveAdditional(tag, edgeID, false) != nullptr) {
218  WRITE_WARNING("There is already a " + toString(tag) + " in the edge '" + edgeID + "'.");
219  } else if (begin > end) {
220  WRITE_WARNING("Time interval of " + toString(tag) + " isn't valid. Attribute '" + toString(SUMO_ATTR_BEGIN) + "' is greater than attribute '" + toString(SUMO_ATTR_END) + "'.");
221  } else {
223  // save ID of last created element
225  }
226  }
227 }
228 
229 
230 void
232  bool abort = false;
233  // parse attributes of RouteProbe
234  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
235  std::string edgeId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_EDGE, abort);
236  std::string freq = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FREQUENCY, abort);
237  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
238  std::string file = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FILE, abort);
239  double begin = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_BEGIN, abort);
240  // Continue if all parameters were sucesfully loaded
241  if (!abort) {
242  // get edge
243  GNEEdge* edge = myViewNet->getNet()->retrieveEdge(edgeId, false);
244  // check that all elements are valid
245  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
246  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
247  } else if (edge == nullptr) {
248  // Write error if lane isn't valid
249  WRITE_WARNING("The edge '" + edgeId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
250  } else {
251  // Freq needs an extra check, because it can be empty
252  if (GNEAttributeCarrier::canParse<double>(freq)) {
253  if (GNEAttributeCarrier::parse<double>(freq) < 0) {
254  WRITE_WARNING(toString(SUMO_ATTR_FREQUENCY) + "of " + toString(tag) + "'" + id + "' cannot be negative.");
255  freq = "";
256  }
257  } else {
258  if (freq.empty()) {
259  WRITE_WARNING(toString(SUMO_ATTR_FREQUENCY) + "of " + toString(tag) + "'" + id + "' cannot be parsed to float.");
260  }
261  freq = "";
262  }
263  myLastInsertedAdditional = buildRouteProbe(myViewNet, myUndoAdditionals, id, edge, freq, name, file, begin);
264  // save ID of last created element
266  }
267  }
268 }
269 
270 
271 void
273  bool abort = false;
274  // parse attribute of calibrator routes
275  std::string routeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
276  std::string edgeIDs = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, routeID, tag, SUMO_ATTR_EDGES, abort);
277  RGBColor color = GNEAttributeCarrier::parseAttributeFromXML<RGBColor>(attrs, routeID, tag, SUMO_ATTR_COLOR, abort);
278  // Continue if all parameters were sucesfully loaded
279  if (!abort) {
280  // obtain edges (And show warnings if isn't valid)
281  std::vector<GNEEdge*> edges;
282  if (GNEAttributeCarrier::canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), edgeIDs, true)) {
283  edges = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(myViewNet->getNet(), edgeIDs);
284  }
285  // check that all elements are valid
286  if (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_ROUTE, routeID, false) != nullptr) {
287  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + routeID + "'.");
288  } else if (edges.size() == 0) {
289  WRITE_WARNING("Routes needs at least one edge.");
290  } else {
292  // save ID of last created element
294  }
295  }
296 }
297 
298 
299 void
301  bool abort = false;
302  // parse attribute of calibrator vehicle types
303  std::string vehicleTypeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
304  double accel = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_ACCEL, abort);
305  double decel = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_DECEL, abort);
306  double sigma = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_SIGMA, abort);
307  double tau = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_TAU, abort);
308  double length = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_LENGTH, abort);
309  double minGap = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_MINGAP, abort);
310  double maxSpeed = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_MAXSPEED, abort);
311  double speedFactor = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_SPEEDFACTOR, abort);
312  double speedDev = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_SPEEDDEV, abort);
313  RGBColor color = GNEAttributeCarrier::parseAttributeFromXML<RGBColor>(attrs, vehicleTypeID, tag, SUMO_ATTR_COLOR, abort);
314  SUMOVehicleClass vClass = GNEAttributeCarrier::parseAttributeFromXML<SUMOVehicleClass>(attrs, vehicleTypeID, tag, SUMO_ATTR_VCLASS, abort);
315  std::string emissionClass = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, vehicleTypeID, tag, SUMO_ATTR_EMISSIONCLASS, abort);
316  SUMOVehicleShape shape = GNEAttributeCarrier::parseAttributeFromXML<SUMOVehicleShape>(attrs, vehicleTypeID, tag, SUMO_ATTR_GUISHAPE, abort);
317  double width = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_WIDTH, abort);
318  std::string filename = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, vehicleTypeID, tag, SUMO_ATTR_IMGFILE, abort);
319  double impatience = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_IMPATIENCE, abort);
320  std::string laneChangeModel = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, vehicleTypeID, tag, SUMO_ATTR_LANE_CHANGE_MODEL, abort);
321  std::string carFollowModel = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, vehicleTypeID, tag, SUMO_ATTR_CAR_FOLLOW_MODEL, abort);
322  int personCapacity = GNEAttributeCarrier::parseAttributeFromXML<int>(attrs, vehicleTypeID, tag, SUMO_ATTR_PERSON_CAPACITY, abort);
323  int containerCapacity = GNEAttributeCarrier::parseAttributeFromXML<int>(attrs, vehicleTypeID, tag, SUMO_ATTR_CONTAINER_CAPACITY, abort);
324  double boardingDuration = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_BOARDING_DURATION, abort);
325  double loadingDuration = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_LOADING_DURATION, abort);
326  std::string latAlignment = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, vehicleTypeID, tag, SUMO_ATTR_LATALIGNMENT, abort);
327  double minGapLat = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_MINGAP_LAT, abort);
328  double maxSpeedLat = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, vehicleTypeID, tag, SUMO_ATTR_MAXSPEED_LAT, abort);
329  // Continue if all parameters were sucesfully loaded
330  if (!abort) {
331  // check that all elements are valid
332  if (myViewNet->getNet()->retrieveAdditional(SUMO_TAG_VTYPE, vehicleTypeID, false) != nullptr) {
333  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + vehicleTypeID + "'.");
334  } else {
335  myLastInsertedAdditional = buildVehicleType(myViewNet, true, vehicleTypeID, accel, decel, sigma, tau, length, minGap, maxSpeed, speedFactor, speedDev, color, vClass, emissionClass, shape, width,
336  filename, impatience, laneChangeModel, carFollowModel, personCapacity, containerCapacity, boardingDuration, loadingDuration, latAlignment, minGapLat, maxSpeedLat);
337  // save ID of last created element
339  }
340  }
341 }
342 
343 
344 void
346  bool abort = false;
347  // parse attributes of calibrator flows
348  std::string vehicleTypeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_TYPE, abort);
349  std::string routeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ROUTE, abort);
350  std::string vehsPerHour = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_VEHSPERHOUR, abort);
351  std::string speed = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_SPEED, abort);
352  RGBColor color = GNEAttributeCarrier::parseAttributeFromXML<RGBColor>(attrs, "", tag, SUMO_ATTR_COLOR, abort);
353  std::string departLane = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_DEPARTLANE, abort);
354  std::string departPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_DEPARTPOS, abort);
355  std::string departSpeed = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_DEPARTSPEED, abort);
356  std::string arrivalLane = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ARRIVALLANE, abort);
357  std::string arrivalPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ARRIVALPOS, abort);
358  std::string arrivalSpeed = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ARRIVALSPEED, abort);
359  std::string line = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_LINE, abort);
360  int personNumber = GNEAttributeCarrier::parseAttributeFromXML<int>(attrs, "", tag, SUMO_ATTR_PERSON_NUMBER, abort);
361  int containerNumber = GNEAttributeCarrier::parseAttributeFromXML<int>(attrs, "", tag, SUMO_ATTR_CONTAINER_NUMBER, abort);
362  bool reroute = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, "", tag, SUMO_ATTR_REROUTE, abort);
363  std::string departPosLat = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_DEPARTPOS_LAT, abort);
364  std::string arrivalPosLat = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ARRIVALPOS_LAT, abort);
365  double begin = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_BEGIN, abort);
366  double end = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_END, abort);
367  // Continue if all parameters were sucesfully loaded
368  if (!abort) {
369  // obtain route, vehicle type and calibrator parent
371  GNEAdditional* route = myViewNet->getNet()->retrieveAdditional(SUMO_TAG_ROUTE, routeID, false);
372  GNEAdditional* vtype = myViewNet->getNet()->retrieveAdditional(SUMO_TAG_VTYPE, vehicleTypeID, false);
373  // check that all elements are valid
374  if (route == nullptr) {
375  WRITE_WARNING(toString(SUMO_TAG_FLOW) + " cannot be created; their " + toString(SUMO_TAG_ROUTE) + " with ID = '" + routeID + "' doesn't exist");
376  abort = true;
377  } else if (vtype == nullptr) {
378  WRITE_WARNING(toString(SUMO_TAG_FLOW) + " cannot be created; their " + toString(SUMO_TAG_VTYPE) + " with ID = '" + vehicleTypeID + "' doesn't exist");
379  abort = true;
380  } else if ((vehsPerHour.empty()) && (speed.empty())) {
381  WRITE_WARNING(toString(SUMO_TAG_FLOW) + " cannot be created; At least parameters " + toString(SUMO_ATTR_VEHSPERHOUR) + " or " + toString(SUMO_ATTR_SPEED) + " has to be defined");
382  abort = true;
383  } else if (calibrator != NULL) {
384  myLastInsertedAdditional = buildCalibratorFlow(myViewNet, true, calibrator, route, vtype, vehsPerHour, speed, color, departLane, departPos, departSpeed, arrivalLane, arrivalPos, arrivalSpeed,
385  line, personNumber, containerNumber, reroute, departPosLat, arrivalPosLat, begin, end);
386  // save ID of last created element
388  }
389  }
390 }
391 
392 
393 void
395  if (myLastInsertedAdditional != 0) {
396  bool ok = true;
397  std::string key;
398  if (attrs.hasAttribute(SUMO_ATTR_KEY)) {
399  // obtain key
400  key = attrs.get<std::string>(SUMO_ATTR_KEY, 0, ok);
401  if (key.empty()) {
402  WRITE_WARNING("Error parsing key from additional generic parameter. Key cannot be empty");
403  ok = false;
404  }
406  WRITE_WARNING("Error parsing key from additional generic parameter. Key contains invalid characters");
407  ok = false;
408  }
409  } else {
410  WRITE_WARNING("Error parsing key from additional generic parameter. Key doesn't exist");
411  ok = false;
412  }
413  // circumventing empty string test
414  const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
416  WRITE_WARNING("Error parsing value from additional generic parameter. Value contains invalid characters");
417  ok = false;
418  }
419  // set parameter in last inserted additional
420  if (ok) {
421  WRITE_DEBUG("Inserting generic parameter '" + key + "|" + val + "' into additional " + toString(myLastInsertedAdditional->getTag()) + ".");
423  }
424  }
425 }
426 
427 
428 void
430  bool abort = false;
431  // parse attributes of VSS
432  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
433  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
434  GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FILE, abort); // deprecated
435  std::string lanesIDs = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANES, abort);
436  Position pos = GNEAttributeCarrier::parseAttributeFromXML<Position>(attrs, id, tag, SUMO_ATTR_POSITION, abort);
437  // Continue if all parameters were sucesfully loaded
438  if (!abort) {
439  // obtain lanes
440  std::vector<GNELane*> lanes;
441  if (GNEAttributeCarrier::canParse<std::vector<GNELane*> >(myViewNet->getNet(), lanesIDs, true)) {
442  lanes = GNEAttributeCarrier::parse<std::vector<GNELane*> >(myViewNet->getNet(), lanesIDs);
443  }
444  // check that all elements are valid
445  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
446  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
447  } else if (lanes.size() == 0) {
448  WRITE_WARNING("A Variable Speed Sign needs at least one lane.");
449  } else {
451  // save ID of last created element
453  }
454  }
455 }
456 
457 void
459  bool abort = false;
460  // Load step values
461  double time = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_TIME, abort);
462  double speed = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_SPEED, abort);
463  // Continue if all parameters were sucesfully loaded
464  if (!abort) {
465  // get Variable Speed Signal
467  // check that all parameters are valid
468  if (variableSpeedSign != nullptr) {
469  myLastInsertedAdditional = buildVariableSpeedSignStep(myViewNet, true, variableSpeedSign, time, speed);
470  // save ID of last created element
472  }
473  }
474 }
475 
476 
477 void
479  bool abort = false;
480  // parse attributes of Rerouter
481  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
482  std::string edgesIDs = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_EDGES, abort);
483  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
484  std::string file = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FILE, abort);
485  double probability = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_PROB, abort);
486  bool off = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_OFF, abort);
487  double timeThreshold = attrs.getOpt<double>(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), abort, 0);
488  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), abort, "");
489  Position pos = GNEAttributeCarrier::parseAttributeFromXML<Position>(attrs, id, tag, SUMO_ATTR_POSITION, abort);
490  // Continue if all parameters were sucesfully loaded
491  if (!abort) {
492  // obtain edges
493  std::vector<GNEEdge*> edges;
494  if (GNEAttributeCarrier::canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), edgesIDs, true)) {
495  edges = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(myViewNet->getNet(), edgesIDs);
496  }
497  // check that all elements are valid
498  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
499  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
500  } else if (edges.size() == 0) {
501  WRITE_WARNING("A rerouter needs at least one Edge");
502  } else {
503  myLastInsertedAdditional = buildRerouter(myViewNet, myUndoAdditionals, id, pos, edges, probability, name, file, off, timeThreshold, vTypes, false);
504  // save ID of last created element
506  }
507  }
508 }
509 
510 
511 void
513  bool abort = false;
514  // parse attributes of Rerouter
515  double begin = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_BEGIN, abort);
516  double end = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_END, abort);
517  // Continue if all parameters were sucesfully loaded
518  if (!abort) {
519  // obtain rerouter
521  // special case for load multiple intervals in the same rerouter
522  if (rerouter == nullptr) {
524  if (lastInsertedRerouterInterval) {
525  rerouter = lastInsertedRerouterInterval->getFirstAdditionalParent();
526  }
527  }
528  // check that rerouterInterval can be created
529  if (begin >= end) {
530  WRITE_WARNING(toString(tag) + " cannot be created; Attribute " + toString(SUMO_ATTR_END) + " must be greather than " + toString(SUMO_ATTR_BEGIN) + ".");
531  } else if (rerouter != nullptr) {
532  myLastInsertedAdditional = buildRerouterInterval(myViewNet, true, rerouter, begin, end);
533  // save ID of last created element
535  }
536  }
537 }
538 
539 
540 void
542  bool abort = false;
543  // parse attributes of Rerouter
544  std::string laneID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
545  std::string allow = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ALLOW, abort);
546  std::string disallow = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_DISALLOW, abort);
547  // Continue if all parameters were sucesfully loaded
548  if (!abort) {
549  // obtain lane and rerouter interval
550  GNELane* lane = myViewNet->getNet()->retrieveLane(laneID, false, true);
552  // check that all elements are valid
553  if (lane == nullptr) {
554  WRITE_WARNING("The lane '" + laneID + "' to use within the " + toString(tag) + " is not known.");
555  } else if (rerouterInterval != nullptr) {
556  myLastInsertedAdditional = buildClosingLaneReroute(myViewNet, true, rerouterInterval, lane, parseVehicleClasses(allow, disallow));
557  // save ID of last created element
559  }
560  }
561 }
562 
563 
564 void
566  bool abort = false;
567  // parse attributes of Rerouter
568  std::string edgeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
569  std::string allow = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ALLOW, abort);
570  std::string disallow = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_DISALLOW, abort);
571  // Continue if all parameters were sucesfully loaded
572  if (!abort) {
573  // obtain edge and rerouter interval
574  GNEEdge* edge = myViewNet->getNet()->retrieveEdge(edgeID, false);
576  // check that all elements are valid
577  if (edge == nullptr) {
578  WRITE_WARNING("The edge '" + edgeID + "' to use within the " + toString(tag) + " is not known.");
579  } else if (rerouterInterval != nullptr) {
580  myLastInsertedAdditional = buildClosingReroute(myViewNet, true, rerouterInterval, edge, parseVehicleClasses(allow, disallow));
581  // save ID of last created element
583  }
584  }
585 }
586 
587 
588 void
590  bool abort = false;
591  // parse attributes of Rerouter
592  std::string edgeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
593  double probability = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_PROB, abort);
594  // Continue if all parameters were sucesfully loaded
595  if (!abort) {
596  // obtain edge and rerouter interval
597  GNEEdge* edge = myViewNet->getNet()->retrieveEdge(edgeID, false);
599  // check that all elements are valid
600  if (edge == nullptr) {
601  WRITE_WARNING("The edge '" + edgeID + "' to use within the " + toString(tag) + " is not known.");
602  } else if (rerouterInterval != nullptr) {
603  myLastInsertedAdditional = builDestProbReroute(myViewNet, true, rerouterInterval, edge, probability);
604  // save ID of last created element
606  }
607  }
608 }
609 
610 
611 void
613  bool abort = false;
614  // parse attributes of Rerouter
615  std::string parkingAreaID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
616  double probability = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_PROB, abort);
617  bool visible = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, "", tag, SUMO_ATTR_VISIBLE, abort);
618  // Continue if all parameters were sucesfully loaded
619  if (!abort) {
620  // obtain edge and rerouter interval
621  GNEAdditional* parkingArea = myViewNet->getNet()->retrieveAdditional(SUMO_TAG_PARKING_AREA, parkingAreaID, false);
623  // check that all elements are valid
624  if (parkingArea == nullptr) {
625  WRITE_WARNING("The parkingArea '" + parkingAreaID + "' to use within the " + toString(tag) + " is not known.");
626  } else if (rerouterInterval != nullptr) {
627  myLastInsertedAdditional = builParkingAreaReroute(myViewNet, true, rerouterInterval, parkingArea, probability, visible);
628  // save ID of last created element
630  }
631  }
632 }
633 
634 
635 void
637  bool abort = false;
638  // parse attributes of Rerouter
639  std::string routeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
640  double probability = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_PROB, abort);
641  // Continue if all parameters were sucesfully loaded
642  if (!abort) {
643  // obtain rerouter interval
645  // check that all elements are valid
646  if (rerouterInterval != nullptr) {
647  myLastInsertedAdditional = buildRouteProbReroute(myViewNet, true, rerouterInterval, routeID, probability);
648  // save ID of last created element
650  }
651  }
652 }
653 
654 
655 void
657  bool abort = false;
658  // parse attributes of bus stop
659  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
660  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANE, abort);
661  std::string startPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_STARTPOS, abort);
662  std::string endPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_ENDPOS, abort);
663  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
664  std::vector<std::string> lines = GNEAttributeCarrier::parseAttributeFromXML<std::vector<std::string> >(attrs, id, tag, SUMO_ATTR_LINES, abort);
665  bool friendlyPosition = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_FRIENDLY_POS, abort);
666  // Continue if all parameters were sucesfully loaded
667  if (!abort) {
668  // get pointer to lane
669  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
670  // check that all elements are valid
671  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
672  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
673  } else if (lane == nullptr) {
674  // Write error if lane isn't valid
675  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
676  } else if (!fixStoppinPlacePosition(startPos, endPos, lane->getParentEdge().getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPosition)) {
677  // Write error if position isn't valid
678  WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'.");
679  } else {
680  myLastInsertedAdditional = buildBusStop(myViewNet, myUndoAdditionals, id, lane, startPos, endPos, name, lines, friendlyPosition, false);
681  // save ID of last created element
683  }
684  }
685 }
686 
687 
688 void
690  bool abort = false;
691  // parse attributes of container stop
692  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
693  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANE, abort);
694  std::string startPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_STARTPOS, abort);
695  std::string endPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_ENDPOS, abort);
696  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
697  std::vector<std::string> lines = GNEAttributeCarrier::parseAttributeFromXML<std::vector<std::string> >(attrs, id, tag, SUMO_ATTR_LINES, abort);
698  bool friendlyPosition = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_FRIENDLY_POS, abort);
699  // Continue if all parameters were sucesfully loaded
700  if (!abort) {
701  // get pointer to lane
702  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
703  // check that all elements are valid
704  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
705  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
706  } else if (lane == nullptr) {
707  // Write error if lane isn't valid
708  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
709  } else if (!fixStoppinPlacePosition(startPos, endPos, lane->getParentEdge().getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPosition)) {
710  // write error if position isn't valid
711  WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'.");
712  } else {
713  myLastInsertedAdditional = buildContainerStop(myViewNet, myUndoAdditionals, id, lane, startPos, endPos, name, lines, friendlyPosition, false);
714  // save ID of last created element
716  }
717  }
718 }
719 
720 
721 void
723  bool abort = false;
724  // parse attributes of Entry
725  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_LANE, abort);
726  std::string position = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_POSITION, abort);
727  std::string length = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_LENGTH, abort);
728  bool friendlyPos = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, "", tag, SUMO_ATTR_FRIENDLY_POS, abort);
729  // Check if parsing of parameters was correct
730  if (!abort) {
731  double posDouble = GNEAttributeCarrier::parse<double>(position);
732  // get lane and busStop parent
733  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
735  // check that all parameters are valid
736  if (lane == nullptr) {
737  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " is not known.");
738  } else if (busStop == nullptr) {
739  WRITE_WARNING("A " + toString(tag) + " must be declared within the definition of a " + toString(SUMO_TAG_BUS_STOP) + ".");
740  } else if (!checkAndFixDetectorPositionPosition(posDouble, lane->getLaneShapeLength(), friendlyPos)) {
741  WRITE_WARNING("Invalid position for " + toString(tag) + ".");
742  } else if (!accessCanBeCreated(busStop, lane->getParentEdge())) {
743  WRITE_WARNING("Edge '" + lane->getParentEdge().getID() + "' already has an Access for busStop '" + busStop->getID() + "'");
744  } else {
745  myLastInsertedAdditional = buildAccess(myViewNet, myUndoAdditionals, busStop, lane, toString(posDouble), length, friendlyPos, false);
746  // save ID of last created element
748  }
749  }
750 }
751 
752 
753 void
755  bool abort = false;
756  // parse attributes of charging station
757  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
758  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANE, abort);
759  std::string startPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_STARTPOS, abort);
760  std::string endPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_ENDPOS, abort);
761  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
762  double chargingPower = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_CHARGINGPOWER, abort);
763  double efficiency = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_EFFICIENCY, abort);
764  bool chargeInTransit = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_CHARGEINTRANSIT, abort);
765  double chargeDelay = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_CHARGEDELAY, abort);
766  bool friendlyPosition = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_FRIENDLY_POS, abort);
767  // Continue if all parameters were sucesfully loaded
768  if (!abort) {
769  // get pointer to lane
770  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
771  // check that all elements are valid
772  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
773  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
774  } else if (lane == nullptr) {
775  // Write error if lane isn't valid
776  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
777  } else if (!fixStoppinPlacePosition(startPos, endPos, lane->getParentEdge().getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPosition)) {
778  // write error if position isn't valid
779  WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'.");
780  } else {
781  myLastInsertedAdditional = buildChargingStation(myViewNet, myUndoAdditionals, id, lane, startPos, endPos, name, chargingPower, efficiency, chargeInTransit, chargeDelay, friendlyPosition, false);
782  // save ID of last created element
784  }
785  }
786 }
787 
788 
789 void
791  bool abort = false;
792  // parse attributes of charging station
793  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
794  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANE, abort);
795  std::string startPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_STARTPOS, abort);
796  std::string endPos = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_ENDPOS, abort);
797  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
798  bool friendlyPosition = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_FRIENDLY_POS, abort);
799  int roadSideCapacity = GNEAttributeCarrier::parseAttributeFromXML<int>(attrs, id, tag, SUMO_ATTR_ROADSIDE_CAPACITY, abort);
800  double width = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_WIDTH, abort);
801  std::string length = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LENGTH, abort);
802  double angle = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_ANGLE, abort);
803  // Continue if all parameters were sucesfully loaded
804  if (!abort) {
805  // get pointer to lane
806  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
807  // check that all elements are valid
808  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
809  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
810  } else if (lane == nullptr) {
811  // Write error if lane isn't valid
812  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
813  } else if (!fixStoppinPlacePosition(startPos, endPos, lane->getParentEdge().getNBEdge()->getFinalLength(), POSITION_EPS, friendlyPosition)) {
814  // write error if position isn't valid
815  WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'.");
816  } else {
817  myLastInsertedAdditional = buildParkingArea(myViewNet, myUndoAdditionals, id, lane, startPos, endPos, name, friendlyPosition, roadSideCapacity, width, length, angle, false);
818  // save ID of last created element
820  }
821  }
822 }
823 
824 
825 void
827  bool abort = false;
828  // parse attributes of charging station
829  double x = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_X, abort);
830  double y = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_Y, abort);
831  double z = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_Z, abort);
832  double width = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_WIDTH, abort);
833  double length = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_LENGTH, abort);
834  double angle = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_ANGLE, abort);
835  // Continue if all parameters were sucesfully loaded
836  if (!abort) {
837  // get Parking Area Parent
839  // check that all parameters are valid
840  if (parkingAreaParent != nullptr) {
841  myLastInsertedAdditional = buildParkingSpace(myViewNet, myUndoAdditionals, parkingAreaParent, x, y, z, width, length, angle, false);
842  // save ID of last created element
844  }
845  }
846 }
847 
848 
849 void
851  bool abort = false;
852  // due there is two differents calibrators, has to be parsed in a different way
853  std::string edgeID, laneId, id;
854  SumoXMLTag typeOfCalibrator = tag;
855  // change tag depending of XML parmeters
856  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
857  typeOfCalibrator = SUMO_TAG_CALIBRATOR;
858  id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", typeOfCalibrator, SUMO_ATTR_ID, abort);
859  edgeID = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, typeOfCalibrator, SUMO_ATTR_EDGE, abort);
860  std::string outfile = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, typeOfCalibrator, SUMO_ATTR_OUTPUT, abort);
861  double position = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, typeOfCalibrator, SUMO_ATTR_POSITION, abort);
862  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
863  double freq = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, typeOfCalibrator, SUMO_ATTR_FREQUENCY, abort);
864  // std::string routeProbe = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_ROUTEPROBE, abort); Currently routeProbe not used
865  // Continue if all parameters were sucesfully loaded
866  if (!abort) {
867  // get pointer and edge
868  GNEEdge* edge = myViewNet->getNet()->retrieveEdge(edgeID, false);
869  // check that all elements are valid
870  if (myViewNet->getNet()->retrieveAdditional(typeOfCalibrator, id, false) != nullptr) {
871  WRITE_WARNING("There is another " + toString(typeOfCalibrator) + " with the same ID='" + id + "'.");
872  } else if (edge == nullptr) {
873  WRITE_WARNING("The edge '" + edgeID + "' to use within the " + toString(typeOfCalibrator) + " '" + id + "' is not known.");
874  } else {
875  myLastInsertedAdditional = buildCalibrator(myViewNet, myUndoAdditionals, id, edge, position, name, outfile, freq);
876  // save ID of last created element
878  }
879  }
880  } else if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
881  typeOfCalibrator = SUMO_TAG_LANECALIBRATOR;
882  id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", typeOfCalibrator, SUMO_ATTR_ID, abort);
883  laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, typeOfCalibrator, SUMO_ATTR_LANE, abort);
884  std::string outfile = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, typeOfCalibrator, SUMO_ATTR_OUTPUT, abort);
885  double position = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, typeOfCalibrator, SUMO_ATTR_POSITION, abort);
886  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
887  double freq = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, typeOfCalibrator, SUMO_ATTR_FREQUENCY, abort);
888  // std::string routeProbe = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_ROUTEPROBE, abort); Currently routeProbe not used
889 
890  // Continue if all parameters were sucesfully loaded
891  if (!abort) {
892  // get pointer to lane
893  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
894  // check that all elements are valid
895  if (myViewNet->getNet()->retrieveAdditional(typeOfCalibrator, id, false) != nullptr) {
896  WRITE_WARNING("There is another " + toString(typeOfCalibrator) + " with the same ID='" + id + "'.");
897  } else if (lane == nullptr) {
898  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(typeOfCalibrator) + " '" + id + "' is not known.");
899  } else {
900  myLastInsertedAdditional = buildCalibrator(myViewNet, myUndoAdditionals, id, lane, position, name, outfile, freq);
901  // save ID of last created element
903  }
904  }
905  } else {
906  WRITE_WARNING("additional " + toString(tag) + " must have either a lane or an edge attribute.");
907  }
908 }
909 
910 
911 void
913  bool abort = false;
914  // parse attributes of E1
915  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
916  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANE, abort);
917  double position = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_POSITION, abort);
918  double frequency = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_FREQUENCY, abort);
919  std::string file = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FILE, abort);
920  std::string vehicleTypes = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_VTYPES, abort);
921  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
922  bool friendlyPos = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_FRIENDLY_POS, abort);
923  // Continue if all parameters were sucesfully loaded
924  if (!abort) {
925  // get pointer to lane
926  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
927  // check that all elements are valid
928  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
929  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
930  } else if (lane == nullptr) {
931  // Write error if lane isn't valid
932  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
933  } else if (!checkAndFixDetectorPositionPosition(position, lane->getLaneShapeLength(), friendlyPos)) {
934  WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'.");
935  } else {
936  myLastInsertedAdditional = buildDetectorE1(myViewNet, myUndoAdditionals, id, lane, position, frequency, file, vehicleTypes, name, friendlyPos, false);
937  // save ID of last created element
939  }
940  }
941 }
942 
943 
944 void
946  bool abort = false;
947  // parse attributes of E2
948  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
949  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANE, abort);
950  double position = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_POSITION, abort);
951  double frequency = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_FREQUENCY, abort);
952  std::string file = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FILE, abort);
953  std::string vehicleTypes = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_VTYPES, abort);
954  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
955  double length = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_LENGTH, abort);
956  double haltingTimeThreshold = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_HALTING_TIME_THRESHOLD, abort);
957  double haltingSpeedThreshold = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_HALTING_SPEED_THRESHOLD, abort);
958  double jamDistThreshold = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_JAM_DIST_THRESHOLD, abort);
959  bool friendlyPos = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_FRIENDLY_POS, abort);
960  // cont attribute is deprecated
961  GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_CONT, abort);
962  // Continue if all parameters were sucesfully loaded
963  if (!abort) {
964  // get pointer to lane
965  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
966  // check that all elements are valid
967  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
968  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
969  } else if (lane == nullptr) {
970  // Write error if lane isn't valid
971  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
972  } else if (!fixE2DetectorPositionPosition(position, length, lane->getParentEdge().getNBEdge()->getFinalLength(), friendlyPos)) {
973  WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'.");
974  } else {
975  myLastInsertedAdditional = buildDetectorE2(myViewNet, myUndoAdditionals, id, lane, position, length, frequency, file, vehicleTypes, name, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, friendlyPos, false);
976  // save ID of last created element
978  }
979  }
980 }
981 
982 
983 void
985  bool abort = false;
986  // parse attributes of E3
987  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
988  double frequency = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_FREQUENCY, abort);
989  std::string file = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FILE, abort);
990  std::string vehicleTypes = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_VTYPES, abort);
991  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
992  double haltingTimeThreshold = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_HALTING_TIME_THRESHOLD, abort);
993  double haltingSpeedThreshold = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_HALTING_SPEED_THRESHOLD, abort);
994  Position pos = GNEAttributeCarrier::parseAttributeFromXML<Position>(attrs, id, tag, SUMO_ATTR_POSITION, abort);
995  // Continue if all parameters were sucesfully loaded
996  if (!abort) {
997  // check that all elements are valid
998  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
999  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
1000  } else {
1001  myLastInsertedAdditional = buildDetectorE3(myViewNet, myUndoAdditionals, id, pos, frequency, file, vehicleTypes, name, haltingTimeThreshold, haltingSpeedThreshold, false);
1002  // save ID of last created element
1004  }
1005  }
1006 }
1007 
1008 
1009 void
1011  bool abort = false;
1012  // parse attributes of Entry
1013  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_LANE, abort);
1014  double position = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_POSITION, abort);
1015  bool friendlyPos = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, "", tag, SUMO_ATTR_FRIENDLY_POS, abort);
1016  // Check if parsing of parameters was correct
1017  if (!abort) {
1018  // get lane and E3 parent
1019  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
1021  // check that all parameters are valid
1022  if (lane == nullptr) {
1023  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " is not known.");
1024  } else if (!checkAndFixDetectorPositionPosition(position, lane->getLaneShapeLength(), friendlyPos)) {
1025  WRITE_WARNING("Invalid position for " + toString(tag) + ".");
1026  } else if (E3Parent) {
1027  myLastInsertedAdditional = buildDetectorEntry(myViewNet, myUndoAdditionals, E3Parent, lane, position, friendlyPos, false);
1028  // save ID of last created element
1030  }
1031  }
1032 }
1033 
1034 
1035 void
1037  bool abort = false;
1038  // parse attributes of Exit
1039  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_LANE, abort);
1040  double position = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, "", tag, SUMO_ATTR_POSITION, abort);
1041  bool friendlyPos = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, "", tag, SUMO_ATTR_FRIENDLY_POS, abort);
1042  // Check if parsing of parameters was correct
1043  if (!abort) {
1044  // get lane and E3 parent
1045  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
1047  // check that all parameters are valid
1048  if (lane == nullptr) {
1049  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " is not known.");
1050  } else if (!checkAndFixDetectorPositionPosition(position, lane->getLaneShapeLength(), friendlyPos)) {
1051  WRITE_WARNING("Invalid position for " + toString(tag) + ".");
1052  } else if (E3Parent) {
1053  myLastInsertedAdditional = buildDetectorExit(myViewNet, myUndoAdditionals, E3Parent, lane, position, friendlyPos, false);
1054  // save ID of last created element
1056  }
1057  }
1058 }
1059 
1060 
1061 void
1063  bool abort = false;
1064  // parse attributes of E1Instant
1065  std::string id = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, "", tag, SUMO_ATTR_ID, abort);
1066  std::string laneId = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_LANE, abort);
1067  double position = GNEAttributeCarrier::parseAttributeFromXML<double>(attrs, id, tag, SUMO_ATTR_POSITION, abort);
1068  std::string file = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_FILE, abort);
1069  std::string vehicleTypes = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_VTYPES, abort);
1070  std::string name = GNEAttributeCarrier::parseAttributeFromXML<std::string>(attrs, id, tag, SUMO_ATTR_NAME, abort);
1071  bool friendlyPos = GNEAttributeCarrier::parseAttributeFromXML<bool>(attrs, id, tag, SUMO_ATTR_FRIENDLY_POS, abort);
1072  // Continue if all parameters were sucesfully loaded
1073  if (!abort) {
1074  // get pointer to lane
1075  GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false, true);
1076  // check that all elements are valid
1077  if (myViewNet->getNet()->retrieveAdditional(tag, id, false) != nullptr) {
1078  WRITE_WARNING("There is another " + toString(tag) + " with the same ID='" + id + "'.");
1079  } else if (lane == nullptr) {
1080  // Write error if lane isn't valid
1081  WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known.");
1082  } else if (!checkAndFixDetectorPositionPosition(position, lane->getLaneShapeLength(), friendlyPos)) {
1083  WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'.");
1084  } else {
1085  myLastInsertedAdditional = buildDetectorE1Instant(myViewNet, myUndoAdditionals, id, lane, position, file, vehicleTypes, name, friendlyPos, false);
1086  // save ID of last created element
1088  }
1089  }
1090 }
1091 
1092 
1094 GNEAdditionalHandler::buildAdditional(GNEViewNet* viewNet, bool allowUndoRedo, SumoXMLTag tag, std::map<SumoXMLAttr, std::string> values) {
1095  // create additional depending of the tag
1096  switch (tag) {
1097  case SUMO_TAG_BUS_STOP: {
1098  // obtain specify attributes of busStop
1099  std::string id = values[SUMO_ATTR_ID];
1100  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1101  std::string startPos = values[SUMO_ATTR_STARTPOS];
1102  std::string endPos = values[SUMO_ATTR_ENDPOS];
1103  std::string name = values[SUMO_ATTR_NAME];
1104  std::vector<std::string> lines = GNEAttributeCarrier::parse<std::vector<std::string> >(values[SUMO_ATTR_LINES]);
1105  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1106  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1107  // Build busStop
1108  if (lane) {
1109  return buildBusStop(viewNet, allowUndoRedo, id, lane, startPos, endPos, name, lines, friendlyPos, blockMovement);
1110  } else {
1111  return nullptr;
1112  }
1113  }
1114  case SUMO_TAG_ACCESS: {
1115  // obtain specify attributes of detector E2
1116  std::string id = values[SUMO_ATTR_ID];
1117  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1118  GNEAdditional* busStop = viewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, values[GNE_ATTR_PARENT], false);
1119  std::string pos = values[SUMO_ATTR_POSITION];
1120  std::string length = values[SUMO_ATTR_LENGTH];
1121  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1122  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1123  // Build detector E2
1124  if (lane && busStop) {
1125  if (accessCanBeCreated(busStop, lane->getParentEdge())) {
1126  return buildAccess(viewNet, allowUndoRedo, busStop, lane, pos, length, friendlyPos, blockMovement);
1127  } else {
1128  WRITE_WARNING(toString(SUMO_TAG_BUS_STOP) + "'" + busStop->getID() + "' already owns a Acces in the edge '" + lane->getParentEdge().getID() + "'");
1129  return nullptr;
1130  }
1131  } else {
1132  return nullptr;
1133  }
1134  }
1135  case SUMO_TAG_CONTAINER_STOP: {
1136  // obtain specify attributes of containerStop
1137  std::string id = values[SUMO_ATTR_ID];
1138  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1139  std::string startPos = values[SUMO_ATTR_STARTPOS];
1140  std::string endPos = values[SUMO_ATTR_ENDPOS];
1141  std::string name = values[SUMO_ATTR_NAME];
1142  std::vector<std::string> lines = GNEAttributeCarrier::parse<std::vector<std::string> >(values[SUMO_ATTR_LINES]);
1143  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1144  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1145  // Build containerStop
1146  if (lane) {
1147  return buildContainerStop(viewNet, allowUndoRedo, id, lane, startPos, endPos, name, lines, friendlyPos, blockMovement);
1148  } else {
1149  return nullptr;
1150  }
1151  }
1153  // obtain specify attributes of chargingStation
1154  std::string id = values[SUMO_ATTR_ID];
1155  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1156  std::string startPos = values[SUMO_ATTR_STARTPOS];
1157  std::string endPos = values[SUMO_ATTR_ENDPOS];
1158  std::string name = values[SUMO_ATTR_NAME];
1159  double chargingPower = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_CHARGINGPOWER]);
1160  double efficiency = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_EFFICIENCY]);
1161  bool chargeInTransit = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_CHARGEINTRANSIT]);
1162  double chargeDelay = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_CHARGEDELAY]);
1163  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1164  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1165  // Build chargingStation
1166  if (lane) {
1167  return buildChargingStation(viewNet, allowUndoRedo, id, lane, startPos, endPos, name, chargingPower, efficiency, chargeInTransit, chargeDelay, friendlyPos, blockMovement);
1168  } else {
1169  return nullptr;
1170  }
1171  }
1172  case SUMO_TAG_PARKING_AREA: {
1173  // obtain specify attributes of Parking Area
1174  std::string id = values[SUMO_ATTR_ID];
1175  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1176  std::string startPos = values[SUMO_ATTR_STARTPOS];
1177  std::string endPos = values[SUMO_ATTR_ENDPOS];
1178  std::string name = values[SUMO_ATTR_NAME];
1179  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1180  int roadSideCapacity = GNEAttributeCarrier::parse<int>(values[SUMO_ATTR_ROADSIDE_CAPACITY]);
1181  double width = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_WIDTH]);
1182  std::string lenght = values[SUMO_ATTR_LENGTH];
1183  double angle = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_ANGLE]);
1184  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1185  // Build Parking Area
1186  if (lane) {
1187  return buildParkingArea(viewNet, allowUndoRedo, id, lane, startPos, endPos, name, friendlyPos, roadSideCapacity, width, lenght, angle, blockMovement);
1188  } else {
1189  return nullptr;
1190  }
1191  }
1192  case SUMO_TAG_PARKING_SPACE: {
1193  bool ok;
1194  // obtain specify attributes of Parking Space
1195  Position pos = GeomConvHelper::parseShapeReporting(values[SUMO_ATTR_POSITION], "user-supplied position", 0, ok, false)[0];
1196  double z = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_Z]);
1197  double width = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_WIDTH]);
1198  double lenght = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_LENGTH]);
1199  double angle = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_ANGLE]);
1200  GNEAdditional* parkingArea = viewNet->getNet()->retrieveAdditional(SUMO_TAG_PARKING_AREA, values[GNE_ATTR_PARENT], false);
1201  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1202  // Build Parking
1203  return buildParkingSpace(viewNet, allowUndoRedo, parkingArea, pos.x(), pos.y(), z, width, lenght, angle, blockMovement);
1204  }
1205  case SUMO_TAG_E1DETECTOR: {
1206  // obtain specify attributes of detector E1
1207  std::string id = values[SUMO_ATTR_ID];
1208  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1209  double pos = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_POSITION]);
1210  double freq = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_FREQUENCY]);
1211  std::string filename = values[SUMO_ATTR_FILE];
1212  std::string vehicleTypes = values[SUMO_ATTR_VTYPES];
1213  std::string name = values[SUMO_ATTR_NAME];
1214  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1215  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1216  // Build detector E1
1217  if (lane) {
1218  return buildDetectorE1(viewNet, allowUndoRedo, id, lane, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement);
1219  } else {
1220  return nullptr;
1221  }
1222  }
1223  case SUMO_TAG_E2DETECTOR: {
1224  // obtain specify attributes of detector E2
1225  std::string id = values[SUMO_ATTR_ID];
1226  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1227  double pos = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_POSITION]);
1228  double freq = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_FREQUENCY]);
1229  double length = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_LENGTH]);
1230  std::string filename = values[SUMO_ATTR_FILE];
1231  std::string vehicleTypes = values[SUMO_ATTR_VTYPES];
1232  std::string name = values[SUMO_ATTR_NAME];
1233  double timeThreshold = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_HALTING_TIME_THRESHOLD]);
1234  double speedThreshold = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_HALTING_SPEED_THRESHOLD]);
1235  double jamThreshold = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_JAM_DIST_THRESHOLD]);
1236  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1237  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1238  // Build detector E2
1239  if (lane) {
1240  return buildDetectorE2(viewNet, allowUndoRedo, id, lane, pos, length, freq, filename, vehicleTypes, name, timeThreshold, speedThreshold, jamThreshold, friendlyPos, blockMovement);
1241  } else {
1242  return nullptr;
1243  }
1244  }
1245  case SUMO_TAG_E3DETECTOR: {
1246  // obtain specify attributes of detector E3
1247  bool ok;
1248  std::string id = values[SUMO_ATTR_ID];
1249  PositionVector pos = GeomConvHelper::parseShapeReporting(values[SUMO_ATTR_POSITION], "user-supplied position", 0, ok, false);
1250  double freq = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_FREQUENCY]);
1251  std::string filename = values[SUMO_ATTR_FILE];
1252  std::string vehicleTypes = values[SUMO_ATTR_VTYPES];
1253  std::string name = values[SUMO_ATTR_NAME];
1254  double timeThreshold = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_HALTING_TIME_THRESHOLD]);
1255  double speedThreshold = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_HALTING_SPEED_THRESHOLD]);
1256  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1257  // Build detector E3
1258  if (pos.size() == 1) {
1259  return buildDetectorE3(viewNet, allowUndoRedo, id, pos[0], freq, filename, vehicleTypes, name, timeThreshold, speedThreshold, blockMovement);
1260  } else {
1261  return nullptr;
1262  }
1263  }
1264  case SUMO_TAG_DET_ENTRY: {
1265  // obtain specify attributes of detector Entry
1266  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1267  double pos = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_POSITION]);
1268  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1269  GNEAdditional* E3 = viewNet->getNet()->retrieveAdditional(SUMO_TAG_E3DETECTOR, values[GNE_ATTR_PARENT], false);
1270  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1271  // Build detector Entry
1272  if (lane && E3) {
1273  return buildDetectorEntry(viewNet, allowUndoRedo, E3, lane, pos, friendlyPos, blockMovement);
1274  } else {
1275  return nullptr;
1276  }
1277  }
1278  case SUMO_TAG_DET_EXIT: {
1279  // obtain specify attributes of Detector Exit
1280  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1281  double pos = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_POSITION]);
1282  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1283  GNEAdditional* E3 = viewNet->getNet()->retrieveAdditional(SUMO_TAG_E3DETECTOR, values[GNE_ATTR_PARENT], false);
1284  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1285  // Build detector Exit
1286  if (lane && E3) {
1287  return buildDetectorExit(viewNet, allowUndoRedo, E3, lane, pos, friendlyPos, blockMovement);
1288  } else {
1289  return nullptr;
1290  }
1291  }
1293  // obtain specify attributes of detector E1Instant
1294  std::string id = values[SUMO_ATTR_ID];
1295  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1296  double pos = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_POSITION]);
1297  std::string filename = values[SUMO_ATTR_FILE];
1298  std::string vehicleTypes = values[SUMO_ATTR_VTYPES];
1299  std::string name = values[SUMO_ATTR_NAME];
1300  bool friendlyPos = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_FRIENDLY_POS]);
1301  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1302  // Build detector E1Instant
1303  if (lane) {
1304  return buildDetectorE1Instant(viewNet, allowUndoRedo, id, lane, pos, filename, vehicleTypes, name, friendlyPos, blockMovement);
1305  } else {
1306  return nullptr;
1307  }
1308  }
1309  case SUMO_TAG_VSS: {
1310  // obtain specify attributes of variable speed signal
1311  std::string id = values[SUMO_ATTR_ID];
1312  bool ok;
1313  PositionVector pos = GeomConvHelper::parseShapeReporting(values[SUMO_ATTR_POSITION], "user-supplied position", 0, ok, false);
1314  std::vector<GNELane*> lanes = GNEAttributeCarrier::parse<std::vector<GNELane*> >(viewNet->getNet(), values[SUMO_ATTR_LANES]);
1315  std::string name = values[SUMO_ATTR_NAME];
1316  // get rest of parameters
1317  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1318  // build VSS
1319  if (pos.size() == 1) {
1320  return buildVariableSpeedSign(viewNet, allowUndoRedo, id, pos[0], lanes, name, blockMovement);
1321  } else {
1322  return nullptr;
1323  }
1324  }
1325  case SUMO_TAG_CALIBRATOR: {
1326  // obtain specify attributes of calibrator
1327  std::string id = values[SUMO_ATTR_ID];
1328  GNEEdge* edge = viewNet->getNet()->retrieveEdge(values[SUMO_ATTR_EDGE], false);
1329  // get rest of parameters
1330  double pos = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_POSITION]);
1331  std::string name = values[SUMO_ATTR_NAME];
1332  std::string outfile = values[SUMO_ATTR_OUTPUT];
1333  double freq = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_FREQUENCY]);
1334  // Build calibrator edge
1335  if (edge) {
1336  return buildCalibrator(viewNet, allowUndoRedo, id, edge, pos, name, outfile, freq);
1337  } else {
1338  return nullptr;
1339  }
1340  }
1341  case SUMO_TAG_LANECALIBRATOR: {
1342  // obtain specify attributes of calibrator
1343  std::string id = values[SUMO_ATTR_ID];
1344  GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false);
1345  // get rest of parameters
1346  double pos = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_POSITION]);
1347  std::string name = values[SUMO_ATTR_NAME];
1348  std::string outfile = values[SUMO_ATTR_OUTPUT];
1349  double freq = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_FREQUENCY]);
1350  // Build calibrator lane
1351  if (lane) {
1352  return buildCalibrator(viewNet, allowUndoRedo, id, lane, pos, name, outfile, freq);
1353  } else {
1354  return nullptr;
1355  }
1356  }
1357  case SUMO_TAG_REROUTER: {
1358  // obtain specify attributes of rerouter
1359  std::string id = values[SUMO_ATTR_ID];
1360  bool ok;
1361  PositionVector pos = GeomConvHelper::parseShapeReporting(values[SUMO_ATTR_POSITION], "user-supplied position", 0, ok, false);
1362  std::vector<GNEEdge*> edges = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(viewNet->getNet(), values[SUMO_ATTR_EDGES]);
1363  // Get rest of parameters
1364  bool off = GNEAttributeCarrier::parse<bool>(values[SUMO_ATTR_OFF]);
1365  double prob = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_PROB]);
1366  double timeThreshold = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_HALTING_TIME_THRESHOLD]);
1367  const std::string vTypes = values[SUMO_ATTR_VTYPES];
1368  bool blockMovement = GNEAttributeCarrier::parse<bool>(values[GNE_ATTR_BLOCK_MOVEMENT]);
1369  std::string name = values[SUMO_ATTR_NAME];
1370  std::string file = values[SUMO_ATTR_FILE];
1371  // Build rerouter
1372  if (pos.size() == 1) {
1373  return buildRerouter(viewNet, allowUndoRedo, id, pos[0], edges, prob, name, file, off, timeThreshold, vTypes, blockMovement);
1374  } else {
1375  return nullptr;
1376  }
1377  }
1378  case SUMO_TAG_ROUTEPROBE: {
1379  // obtain specify attributes of RouteProbe
1380  std::string id = values[SUMO_ATTR_ID];
1381  GNEEdge* edge = viewNet->getNet()->retrieveEdge(values[SUMO_ATTR_EDGE], false);
1382  std::string freq = values[SUMO_ATTR_FREQUENCY];
1383  std::string name = values[SUMO_ATTR_NAME];
1384  std::string filename = values[SUMO_ATTR_FILE];
1385  double begin = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_BEGIN]);
1386  // Build RouteProbe
1387  if (edge) {
1388  return buildRouteProbe(viewNet, allowUndoRedo, id, edge, freq, name, filename, begin);
1389  } else {
1390  return nullptr;
1391  }
1392  }
1393  case SUMO_TAG_VAPORIZER: {
1394  // obtain specify attributes of vaporizer
1395  GNEEdge* edge = viewNet->getNet()->retrieveEdge(values[SUMO_ATTR_EDGE], false);
1396  double begin = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_BEGIN]);
1397  double end = GNEAttributeCarrier::parse<double>(values[SUMO_ATTR_END]);
1398  std::string name = values[SUMO_ATTR_NAME];
1399  // Build Vaporizer
1400  if (edge) {
1401  if (begin > end) {
1402  WRITE_WARNING("Time interval of " + toString(tag) + " isn't valid. Attribute '" + toString(SUMO_ATTR_BEGIN) + "' is greater than attribute '" + toString(SUMO_ATTR_END) + "'.");
1403  } else if (viewNet->getNet()->retrieveAdditional(tag, edge->getID(), false) == nullptr) {
1404  return buildVaporizer(viewNet, allowUndoRedo, edge, begin, end, name);
1405  } else {
1406  WRITE_WARNING("There is already a " + toString(tag) + " in the edge '" + edge->getID() + "'.");
1407  }
1408  } else {
1409  return nullptr;
1410  }
1411  }
1412  default:
1413  return nullptr;
1414  }
1415 }
1416 
1417 
1419 GNEAdditionalHandler::buildBusStop(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, const std::string& startPos, const std::string& endPos, const std::string& name, const std::vector<std::string>& lines, bool friendlyPosition, bool blockMovement) {
1420  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, id, false) == nullptr) {
1421  GNEBusStop* busStop = new GNEBusStop(id, lane, viewNet, startPos, endPos, name, lines, friendlyPosition, blockMovement);
1422  if (allowUndoRedo) {
1423  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_BUS_STOP));
1424  viewNet->getUndoList()->add(new GNEChange_Additional(busStop, true), true);
1425  viewNet->getUndoList()->p_end();
1426  } else {
1427  viewNet->getNet()->insertAdditional(busStop);
1428  lane->addAdditionalChild(busStop);
1429  busStop->incRef("buildBusStop");
1430  }
1431  return busStop;
1432  } else {
1433  throw ProcessError("Could not build " + toString(SUMO_TAG_BUS_STOP) + " with ID '" + id + "' in netedit; probably declared twice.");
1434  }
1435 }
1436 
1437 
1439 GNEAdditionalHandler::buildAccess(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* busStop, GNELane* lane, const std::string& pos, const std::string& length, bool friendlyPos, bool blockMovement) {
1440  // Check if busStop parent and lane is correct
1441  if (lane == nullptr) {
1442  throw ProcessError("Could not build " + toString(SUMO_TAG_ACCESS) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist.");
1443  } else if (busStop == nullptr) {
1444  throw ProcessError("Could not build " + toString(SUMO_TAG_ACCESS) + " in netedit; " + toString(SUMO_TAG_BUS_STOP) + " parent doesn't exist.");
1445  } else if (!accessCanBeCreated(busStop, lane->getParentEdge())) {
1446  throw ProcessError("Could not build " + toString(SUMO_TAG_ACCESS) + " in netedit; " + toString(SUMO_TAG_BUS_STOP) + " parent already owns a Acces in the edge '" + lane->getParentEdge().getID() + "'");
1447  } else {
1448  GNEAccess* access = new GNEAccess(busStop, lane, viewNet, pos, length, friendlyPos, blockMovement);
1449  if (allowUndoRedo) {
1450  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_ACCESS));
1451  viewNet->getUndoList()->add(new GNEChange_Additional(access, true), true);
1452  viewNet->getUndoList()->p_end();
1453  } else {
1454  viewNet->getNet()->insertAdditional(access);
1455  lane->addAdditionalChild(access);
1456  busStop->addAdditionalChild(access);
1457  access->incRef("buildAccess");
1458  }
1459  return access;
1460  }
1461 }
1462 
1463 
1465 GNEAdditionalHandler::buildContainerStop(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, const std::string& startPos, const std::string& endPos, const std::string& name, const std::vector<std::string>& lines, bool friendlyPosition, bool blockMovement) {
1466  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, id, false) == nullptr) {
1467  GNEContainerStop* containerStop = new GNEContainerStop(id, lane, viewNet, startPos, endPos, name, lines, friendlyPosition, blockMovement);
1468  if (allowUndoRedo) {
1469  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CONTAINER_STOP));
1470  viewNet->getUndoList()->add(new GNEChange_Additional(containerStop, true), true);
1471  viewNet->getUndoList()->p_end();
1472  } else {
1473  viewNet->getNet()->insertAdditional(containerStop);
1474  lane->addAdditionalChild(containerStop);
1475  containerStop->incRef("buildContainerStop");
1476  }
1477  return containerStop;
1478  } else {
1479  throw ProcessError("Could not build " + toString(SUMO_TAG_CONTAINER_STOP) + " with ID '" + id + "' in netedit; probably declared twice.");
1480  }
1481 }
1482 
1483 
1485 GNEAdditionalHandler::buildChargingStation(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, const std::string& startPos, const std::string& endPos, const std::string& name,
1486  double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay, bool friendlyPosition, bool blockMovement) {
1487  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, id, false) == nullptr) {
1488  GNEChargingStation* chargingStation = new GNEChargingStation(id, lane, viewNet, startPos, endPos, name, chargingPower, efficiency, chargeInTransit, chargeDelay, friendlyPosition, blockMovement);
1489  if (allowUndoRedo) {
1490  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CHARGING_STATION));
1491  viewNet->getUndoList()->add(new GNEChange_Additional(chargingStation, true), true);
1492  viewNet->getUndoList()->p_end();
1493  } else {
1494  viewNet->getNet()->insertAdditional(chargingStation);
1495  lane->addAdditionalChild(chargingStation);
1496  chargingStation->incRef("buildChargingStation");
1497  }
1498  return chargingStation;
1499  } else {
1500  throw ProcessError("Could not build " + toString(SUMO_TAG_CHARGING_STATION) + " with ID '" + id + "' in netedit; probably declared twice.");
1501  }
1502 }
1503 
1504 
1506 GNEAdditionalHandler::buildParkingArea(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, const std::string& startPos, const std::string& endPos, const std::string& name,
1507  bool friendlyPosition, int roadSideCapacity, double width, const std::string& length, double angle, bool blockMovement) {
1508  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_PARKING_AREA, id, false) == nullptr) {
1509  GNEParkingArea* parkingArea = new GNEParkingArea(id, lane, viewNet, startPos, endPos, name, friendlyPosition, roadSideCapacity, width, length, angle, blockMovement);
1510  if (allowUndoRedo) {
1511  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_PARKING_AREA));
1512  viewNet->getUndoList()->add(new GNEChange_Additional(parkingArea, true), true);
1513  viewNet->getUndoList()->p_end();
1514  } else {
1515  viewNet->getNet()->insertAdditional(parkingArea);
1516  lane->addAdditionalChild(parkingArea);
1517  parkingArea->incRef("buildParkingArea");
1518  }
1519  return parkingArea;
1520  } else {
1521  throw ProcessError("Could not build " + toString(SUMO_TAG_PARKING_AREA) + " with ID '" + id + "' in netedit; probably declared twice.");
1522  }
1523 }
1524 
1525 
1527 GNEAdditionalHandler::buildParkingSpace(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* parkingAreaParent, double x, double y, double z, double width, double length, double angle, bool blockMovement) {
1528  GNEParkingSpace* parkingSpace = new GNEParkingSpace(viewNet, parkingAreaParent, x, y, z, width, length, angle, blockMovement);
1529  if (allowUndoRedo) {
1530  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_PARKING_SPACE));
1531  viewNet->getUndoList()->add(new GNEChange_Additional(parkingSpace, true), true);
1532  viewNet->getUndoList()->p_end();
1533  } else {
1534  viewNet->getNet()->insertAdditional(parkingSpace);
1535  parkingAreaParent->addAdditionalChild(parkingSpace);
1536  parkingSpace->incRef("buildParkingSpace");
1537  }
1538  return parkingSpace;
1539 }
1540 
1541 
1543 GNEAdditionalHandler::buildDetectorE1(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, double freq, const std::string& filename, const std::string& vehicleTypes, const std::string& name, bool friendlyPos, bool blockMovement) {
1544  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_E1DETECTOR, id, false) == nullptr) {
1545  GNEDetectorE1* detectorE1 = new GNEDetectorE1(id, lane, viewNet, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement);
1546  if (allowUndoRedo) {
1547  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E1DETECTOR));
1548  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE1, true), true);
1549  viewNet->getUndoList()->p_end();
1550  } else {
1551  viewNet->getNet()->insertAdditional(detectorE1);
1552  lane->addAdditionalChild(detectorE1);
1553  detectorE1->incRef("buildDetectorE1");
1554  }
1555  return detectorE1;
1556  } else {
1557  throw ProcessError("Could not build " + toString(SUMO_TAG_E1DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1558  }
1559 }
1560 
1561 
1563 GNEAdditionalHandler::buildDetectorE2(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, double length, double freq, const std::string& filename,
1564  const std::string& vehicleTypes, const std::string& name, const double timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement) {
1565  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_E2DETECTOR, id, false) == nullptr) {
1566  GNEDetectorE2* detectorE2 = new GNEDetectorE2(id, lane, viewNet, pos, length, freq, filename, vehicleTypes, name, timeThreshold, speedThreshold, jamThreshold, friendlyPos, blockMovement);
1567  if (allowUndoRedo) {
1568  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E2DETECTOR));
1569  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
1570  viewNet->getUndoList()->p_end();
1571  } else {
1572  viewNet->getNet()->insertAdditional(detectorE2);
1573  lane->addAdditionalChild(detectorE2);
1574  detectorE2->incRef("buildDetectorE2");
1575  }
1576  return detectorE2;
1577  } else {
1578  throw ProcessError("Could not build " + toString(SUMO_TAG_E2DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1579  }
1580 }
1581 
1582 
1584 GNEAdditionalHandler::buildDetectorE3(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, double freq, const std::string& filename, const std::string& vehicleTypes,
1585  const std::string& name, const double timeThreshold, double speedThreshold, bool blockMovement) {
1586  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_E3DETECTOR, id, false) == nullptr) {
1587  GNEDetectorE3* detectorE3 = new GNEDetectorE3(id, viewNet, pos, freq, filename, vehicleTypes, name, timeThreshold, speedThreshold, blockMovement);
1588  if (allowUndoRedo) {
1589  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E3DETECTOR));
1590  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE3, true), true);
1591  viewNet->getUndoList()->p_end();
1592  } else {
1593  viewNet->getNet()->insertAdditional(detectorE3);
1594  detectorE3->incRef("buildDetectorE3");
1595  }
1596  return detectorE3;
1597  } else {
1598  throw ProcessError("Could not build " + toString(SUMO_TAG_E3DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1599  }
1600 }
1601 
1602 
1604 GNEAdditionalHandler::buildDetectorEntry(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* E3Parent, GNELane* lane, double pos, bool friendlyPos, bool blockMovement) {
1605  // Check if Detector E3 parent and lane is correct
1606  if (lane == nullptr) {
1607  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist.");
1608  } else if (E3Parent == nullptr) {
1609  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_E3DETECTOR) + " parent doesn't exist.");
1610  } else {
1611  GNEDetectorEntry* entry = new GNEDetectorEntry(viewNet, E3Parent, lane, pos, friendlyPos, blockMovement);
1612  if (allowUndoRedo) {
1613  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_DET_ENTRY));
1614  viewNet->getUndoList()->add(new GNEChange_Additional(entry, true), true);
1615  viewNet->getUndoList()->p_end();
1616  } else {
1617  viewNet->getNet()->insertAdditional(entry);
1618  lane->addAdditionalChild(entry);
1619  E3Parent->addAdditionalChild(entry);
1620  entry->incRef("buildDetectorEntry");
1621  }
1622  return entry;
1623  }
1624 }
1625 
1626 
1628 GNEAdditionalHandler::buildDetectorExit(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* E3Parent, GNELane* lane, double pos, bool friendlyPos, bool blockMovement) {
1629  // Check if Detector E3 parent and lane is correct
1630  if (lane == nullptr) {
1631  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist.");
1632  } else if (E3Parent == nullptr) {
1633  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_E3DETECTOR) + " parent doesn't exist.");
1634  } else {
1635  GNEDetectorExit* exit = new GNEDetectorExit(viewNet, E3Parent, lane, pos, friendlyPos, blockMovement);
1636  if (allowUndoRedo) {
1637  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_DET_EXIT));
1638  viewNet->getUndoList()->add(new GNEChange_Additional(exit, true), true);
1639  viewNet->getUndoList()->p_end();
1640  } else {
1641  viewNet->getNet()->insertAdditional(exit);
1642  lane->addAdditionalChild(exit);
1643  E3Parent->addAdditionalChild(exit);
1644  exit->incRef("buildDetectorExit");
1645  }
1646  return exit;
1647  }
1648 }
1649 
1650 
1652 GNEAdditionalHandler::buildDetectorE1Instant(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, const std::string& filename, const std::string& vehicleTypes, const std::string& name, bool friendlyPos, bool blockMovement) {
1653  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, false) == nullptr) {
1654  GNEDetectorE1Instant* detectorE1Instant = new GNEDetectorE1Instant(id, lane, viewNet, pos, filename, vehicleTypes, name, friendlyPos, blockMovement);
1655  if (allowUndoRedo) {
1657  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE1Instant, true), true);
1658  viewNet->getUndoList()->p_end();
1659  } else {
1660  viewNet->getNet()->insertAdditional(detectorE1Instant);
1661  lane->addAdditionalChild(detectorE1Instant);
1662  detectorE1Instant->incRef("buildDetectorE1Instant");
1663  }
1664  return detectorE1Instant;
1665  } else {
1666  throw ProcessError("Could not build " + toString(SUMO_TAG_INSTANT_INDUCTION_LOOP) + " with ID '" + id + "' in netedit; probably declared twice.");
1667  }
1668 }
1669 
1670 
1672 GNEAdditionalHandler::buildCalibrator(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, const std::string& name, const std::string& outfile, const double freq) {
1673  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CALIBRATOR, id, false) == nullptr) {
1674  GNECalibrator* calibrator = new GNECalibrator(id, viewNet, lane, pos, freq, name, outfile);
1675  if (allowUndoRedo) {
1676  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CALIBRATOR));
1677  viewNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
1678  viewNet->getUndoList()->p_end();
1679  // center after creation
1680  viewNet->centerTo(calibrator->getGlID(), false);
1681  } else {
1682  viewNet->getNet()->insertAdditional(calibrator);
1683  lane->addAdditionalChild(calibrator);
1684  calibrator->incRef("buildCalibrator");
1685  }
1686  return calibrator;
1687  } else {
1688  throw ProcessError("Could not build " + toString(SUMO_TAG_CALIBRATOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1689  }
1690 }
1691 
1692 
1694 GNEAdditionalHandler::buildCalibrator(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNEEdge* edge, double pos, const std::string& name, const std::string& outfile, const double freq) {
1695  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CALIBRATOR, id, false) == nullptr) {
1696  GNECalibrator* calibrator = new GNECalibrator(id, viewNet, edge, pos, freq, name, outfile);
1697  if (allowUndoRedo) {
1698  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CALIBRATOR));
1699  viewNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
1700  viewNet->getUndoList()->p_end();
1701  // center after creation
1702  viewNet->centerTo(calibrator->getGlID(), false);
1703  } else {
1704  viewNet->getNet()->insertAdditional(calibrator);
1705  edge->addAdditionalChild(calibrator);
1706  calibrator->incRef("buildCalibrator");
1707  }
1708  return calibrator;
1709  } else {
1710  throw ProcessError("Could not build " + toString(SUMO_TAG_CALIBRATOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1711  }
1712 }
1713 
1714 
1716 GNEAdditionalHandler::buildCalibratorRoute(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& routeID, const std::vector<GNEEdge*>& edges, const RGBColor& color) {
1717  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_ROUTE, routeID, false) == nullptr) {
1718  // create route and add it to calibrator parent
1719  GNECalibratorRoute* route = new GNECalibratorRoute(viewNet, routeID, edges, color);
1720  if (allowUndoRedo) {
1721  viewNet->getUndoList()->p_begin("add " + toString(route->getTag()));
1722  viewNet->getUndoList()->add(new GNEChange_Additional(route, true), true);
1723  viewNet->getUndoList()->p_end();
1724  } else {
1725  viewNet->getNet()->insertAdditional(route);
1726  route->incRef("buildCalibratorRoute");
1727  }
1728  return route;
1729  } else {
1730  throw ProcessError("Could not build " + toString(SUMO_TAG_ROUTE) + " with ID '" + routeID + "' in netedit; probably declared twice.");
1731  }
1732 
1733 }
1734 
1735 
1737 GNEAdditionalHandler::buildVehicleType(GNEViewNet* viewNet, bool allowUndoRedo, std::string vehicleTypeID,
1738  double accel, double decel, double sigma, double tau, double length, double minGap, double maxSpeed,
1739  double speedFactor, double speedDev, const RGBColor& color, SUMOVehicleClass vClass, const std::string& emissionClass,
1740  SUMOVehicleShape shape, double width, const std::string& filename, double impatience, const std::string& laneChangeModel,
1741  const std::string& carFollowModel, int personCapacity, int containerCapacity, double boardingDuration,
1742  double loadingDuration, const std::string& latAlignment, double minGapLat, double maxSpeedLat) {
1743  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_VTYPE, vehicleTypeID, false) == nullptr) {
1744  // create vehicle type and add it to calibrator parent
1745  GNECalibratorVehicleType* vType = new GNECalibratorVehicleType(viewNet, vehicleTypeID, accel, decel, sigma, tau, length, minGap, maxSpeed,
1746  speedFactor, speedDev, color, vClass, emissionClass, shape, width, filename, impatience,
1747  laneChangeModel, carFollowModel, personCapacity, containerCapacity, boardingDuration,
1748  loadingDuration, latAlignment, minGapLat, maxSpeedLat);
1749  if (allowUndoRedo) {
1750  viewNet->getUndoList()->p_begin("add " + toString(vType->getTag()));
1751  viewNet->getUndoList()->add(new GNEChange_Additional(vType, true), true);
1752  viewNet->getUndoList()->p_end();
1753  } else {
1754  viewNet->getNet()->insertAdditional(vType);
1755  vType->incRef("buildCalibratorVehicleType");
1756  }
1757  return vType;
1758  } else {
1759  throw ProcessError("Could not build " + toString(SUMO_TAG_VTYPE) + " with ID '" + vehicleTypeID + "' in netedit; probably declared twice.");
1760  }
1761 }
1762 
1763 
1765 GNEAdditionalHandler::buildCalibratorFlow(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* calibratorParent, GNEAdditional* route, GNEAdditional* vtype,
1766  const std::string& vehsPerHour, const std::string& speed, const RGBColor& color, const std::string& departLane, const std::string& departPos,
1767  const std::string& departSpeed, const std::string& arrivalLane, const std::string& arrivalPos, const std::string& arrivalSpeed, const std::string& line,
1768  int personNumber, int containerNumber, bool reroute, const std::string& departPosLat, const std::string& arrivalPosLat, double begin, double end) {
1769 
1770  // create Flow and add it to calibrator parent
1771  GNECalibratorFlow* flow = new GNECalibratorFlow(calibratorParent, vtype, route, vehsPerHour, speed, color, departLane, departPos, departSpeed,
1772  arrivalLane, arrivalPos, arrivalSpeed, line, personNumber, containerNumber, reroute,
1773  departPosLat, arrivalPosLat, begin, end);
1774  if (allowUndoRedo) {
1775  viewNet->getUndoList()->p_begin("add " + toString(flow->getTag()));
1776  viewNet->getUndoList()->add(new GNEChange_Additional(flow, true), true);
1777  viewNet->getUndoList()->p_end();
1778  } else {
1779  calibratorParent->addAdditionalChild(flow);
1780  flow->incRef("buildCalibratorFlow");
1781  }
1782  return flow;
1783 }
1784 
1785 
1787 GNEAdditionalHandler::buildRerouter(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, const std::vector<GNEEdge*>& edges, double prob, const std::string& name, const std::string& file, bool off, double timeThreshold, const std::string& vTypes, bool blockMovement) {
1788  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_REROUTER, id, false) == nullptr) {
1789  GNERerouter* rerouter = new GNERerouter(id, viewNet, pos, edges, name, file, prob, off, timeThreshold, vTypes, blockMovement);
1790  if (allowUndoRedo) {
1791  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_REROUTER));
1792  viewNet->getUndoList()->add(new GNEChange_Additional(rerouter, true), true);
1793  viewNet->getUndoList()->p_end();
1794  } else {
1795  viewNet->getNet()->insertAdditional(rerouter);
1796  // add this rerouter as parent of all edges
1797  for (auto i : edges) {
1798  i->addAdditionalParent(rerouter);
1799  }
1800  rerouter->incRef("buildRerouter");
1801  }
1802  // parse rerouter childs
1803  if (!file.empty()) {
1804  // we assume that rerouter values files is placed in the same folder as the additional file
1805  std::string currentAdditionalFilename = FileHelpers::getFilePath(OptionsCont::getOptions().getString("sumo-additionals-file"));
1806  // Create additional handler for parse rerouter values
1807  GNEAdditionalHandler rerouterValuesHandler(currentAdditionalFilename + file, viewNet, allowUndoRedo, rerouter);
1808  // disable validation for rerouters
1809  XMLSubSys::setValidation("never", "auto");
1810  // Run parser
1811  if (!XMLSubSys::runParser(rerouterValuesHandler, currentAdditionalFilename + file, false)) {
1812  WRITE_MESSAGE("Loading of " + file + " failed.");
1813  }
1814  // enable validation for rerouters
1815  XMLSubSys::setValidation("auto", "auto");
1816  }
1817  return rerouter;
1818  } else {
1819  throw ProcessError("Could not build " + toString(SUMO_TAG_REROUTER) + " with ID '" + id + "' in netedit; probably declared twice.");
1820  }
1821 }
1822 
1823 
1825 GNEAdditionalHandler::buildRerouterInterval(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterParent, double begin, double end) {
1826  // check if new interval will produce a overlapping
1827  if (checkOverlappingRerouterIntervals(rerouterParent, begin, end)) {
1828  // create rerouter interval and add it into rerouter parent
1829  GNERerouterInterval* rerouterInterval = new GNERerouterInterval(rerouterParent, begin, end);
1830  if (allowUndoRedo) {
1831  viewNet->getUndoList()->p_begin("add " + toString(rerouterInterval->getTag()));
1832  viewNet->getUndoList()->add(new GNEChange_Additional(rerouterInterval, true), true);
1833  viewNet->getUndoList()->p_end();
1834  } else {
1835  rerouterParent->addAdditionalChild(rerouterInterval);
1836  rerouterInterval->incRef("buildRerouterInterval");
1837  }
1838  return rerouterInterval;
1839  } else {
1840  throw ProcessError("Could not build " + toString(SUMO_TAG_INTERVAL) + " with begin '" + toString(begin) + "' and '" + toString(end) + "' in '" + rerouterParent->getID() + "' due overlapping.");
1841  }
1842 }
1843 
1844 
1846 GNEAdditionalHandler::buildClosingLaneReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNELane* closedLane, SVCPermissions permissions) {
1847  // create closing lane reorute
1848  GNEClosingLaneReroute* closingLaneReroute = new GNEClosingLaneReroute(rerouterIntervalParent, closedLane, permissions);
1849  // add it to interval parent depending of allowUndoRedo
1850  if (allowUndoRedo) {
1851  viewNet->getUndoList()->p_begin("add " + toString(closingLaneReroute->getTag()));
1852  viewNet->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1853  viewNet->getUndoList()->p_end();
1854  } else {
1855  rerouterIntervalParent->addAdditionalChild(closingLaneReroute);
1856  closingLaneReroute->incRef("buildClosingLaneReroute");
1857  }
1858  return closingLaneReroute;
1859 }
1860 
1861 
1863 GNEAdditionalHandler::buildClosingReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNEEdge* closedEdge, SVCPermissions permissions) {
1864  // create closing reroute
1865  GNEClosingReroute* closingReroute = new GNEClosingReroute(rerouterIntervalParent, closedEdge, permissions);
1866  // add it to interval parent depending of allowUndoRedo
1867  if (allowUndoRedo) {
1868  viewNet->getUndoList()->p_begin("add " + toString(closingReroute->getTag()));
1869  viewNet->getUndoList()->add(new GNEChange_Additional(closingReroute, true), true);
1870  viewNet->getUndoList()->p_end();
1871  } else {
1872  rerouterIntervalParent->addAdditionalChild(closingReroute);
1873  closingReroute->incRef("buildClosingReroute");
1874  }
1875  return closingReroute;
1876 }
1877 
1878 
1880 GNEAdditionalHandler::builDestProbReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability) {
1881  // create dest probability reroute
1882  GNEDestProbReroute* destProbReroute = new GNEDestProbReroute(rerouterIntervalParent, newEdgeDestination, probability);
1883  // add it to interval parent depending of allowUndoRedo
1884  if (allowUndoRedo) {
1885  viewNet->getUndoList()->p_begin("add " + toString(destProbReroute->getTag()));
1886  viewNet->getUndoList()->add(new GNEChange_Additional(destProbReroute, true), true);
1887  viewNet->getUndoList()->p_end();
1888  } else {
1889  rerouterIntervalParent->addAdditionalChild(destProbReroute);
1890  destProbReroute->incRef("builDestProbReroute");
1891  }
1892  return destProbReroute;
1893 }
1894 
1895 
1897 GNEAdditionalHandler::builParkingAreaReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNEAdditional* newParkingArea, double probability, bool visible) {
1898  // create dest probability reroute
1899  GNEParkingAreaReroute* parkingAreaReroute = new GNEParkingAreaReroute(rerouterIntervalParent, newParkingArea, probability, visible);
1900  // add it to interval parent depending of allowUndoRedo
1901  if (allowUndoRedo) {
1902  viewNet->getUndoList()->p_begin("add " + toString(parkingAreaReroute->getTag()));
1903  viewNet->getUndoList()->add(new GNEChange_Additional(parkingAreaReroute, true), true);
1904  viewNet->getUndoList()->p_end();
1905  } else {
1906  rerouterIntervalParent->addAdditionalChild(parkingAreaReroute);
1907  parkingAreaReroute->incRef("builParkingAreaReroute");
1908  }
1909  return parkingAreaReroute;
1910 }
1911 
1912 
1914 GNEAdditionalHandler::buildRouteProbReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, const std::string& newRouteId, double probability) {
1915  // create rout prob rereoute
1916  GNERouteProbReroute* routeProbReroute = new GNERouteProbReroute(rerouterIntervalParent, newRouteId, probability);
1917  // add it to interval parent depending of allowUndoRedo
1918  if (allowUndoRedo) {
1919  viewNet->getUndoList()->p_begin("add " + toString(routeProbReroute->getTag()));
1920  viewNet->getUndoList()->add(new GNEChange_Additional(routeProbReroute, true), true);
1921  viewNet->getUndoList()->p_end();
1922  } else {
1923  rerouterIntervalParent->addAdditionalChild(routeProbReroute);
1924  routeProbReroute->incRef("buildRouteProbReroute");
1925  }
1926  return routeProbReroute;
1927 }
1928 
1929 
1931 GNEAdditionalHandler::buildRouteProbe(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNEEdge* edge, const std::string& freq, const std::string& name, const std::string& file, double begin) {
1932  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, id, false) == nullptr) {
1933  GNERouteProbe* routeProbe = new GNERouteProbe(id, viewNet, edge, freq, name, file, begin);
1934  if (allowUndoRedo) {
1935  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_ROUTEPROBE));
1936  viewNet->getUndoList()->add(new GNEChange_Additional(routeProbe, true), true);
1937  viewNet->getUndoList()->p_end();
1938  // center after creation
1939  viewNet->centerTo(routeProbe->getGlID(), false);
1940  } else {
1941  viewNet->getNet()->insertAdditional(routeProbe);
1942  edge->addAdditionalChild(routeProbe);
1943  routeProbe->incRef("buildRouteProbe");
1944  }
1945  return routeProbe;
1946  } else {
1947  throw ProcessError("Could not build " + toString(SUMO_TAG_ROUTEPROBE) + " with ID '" + id + "' in netedit; probably declared twice.");
1948  }
1949 }
1950 
1951 
1953 GNEAdditionalHandler::buildVariableSpeedSign(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, const std::vector<GNELane*>& lanes, const std::string& name, bool blockMovement) {
1954  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_VSS, id, false) == nullptr) {
1955  GNEVariableSpeedSign* variableSpeedSign = new GNEVariableSpeedSign(id, viewNet, pos, lanes, name, blockMovement);
1956  if (allowUndoRedo) {
1957  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_VSS));
1958  viewNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSign, true), true);
1959  viewNet->getUndoList()->p_end();
1960  } else {
1961  viewNet->getNet()->insertAdditional(variableSpeedSign);
1962  // add this VSS as parent of all edges
1963  for (auto i : lanes) {
1964  i->addAdditionalParent(variableSpeedSign);
1965  }
1966  variableSpeedSign->incRef("buildVariableSpeedSign");
1967  }
1968  return variableSpeedSign;
1969  } else {
1970  throw ProcessError("Could not build " + toString(SUMO_TAG_VSS) + " with ID '" + id + "' in netedit; probably declared twice.");
1971  }
1972 }
1973 
1974 
1976 GNEAdditionalHandler::buildVariableSpeedSignStep(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* VSSParent, double time, double speed) {
1977  // create Variable Speed Sign
1978  GNEVariableSpeedSignStep* variableSpeedSignStep = new GNEVariableSpeedSignStep(VSSParent, time, speed);
1979  // add it depending of allow undoRedo
1980  if (allowUndoRedo) {
1981  viewNet->getUndoList()->p_begin("add " + toString(variableSpeedSignStep->getTag()));
1982  viewNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSignStep, true), true);
1983  viewNet->getUndoList()->p_end();
1984  } else {
1985  VSSParent->addAdditionalChild(variableSpeedSignStep);
1986  variableSpeedSignStep->incRef("buildVariableSpeedSignStep");
1987  }
1988  return variableSpeedSignStep;
1989 }
1990 
1991 
1993 GNEAdditionalHandler::buildVaporizer(GNEViewNet* viewNet, bool allowUndoRedo, GNEEdge* edge, double startTime, double end, const std::string& name) {
1994  GNEVaporizer* vaporizer = new GNEVaporizer(viewNet, edge, startTime, end, name);
1995  if (allowUndoRedo) {
1996  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_VAPORIZER));
1997  viewNet->getUndoList()->add(new GNEChange_Additional(vaporizer, true), true);
1998  viewNet->getUndoList()->p_end();
1999  // center after creation
2000  viewNet->centerTo(vaporizer->getGlID(), false);
2001  } else {
2002  viewNet->getNet()->insertAdditional(vaporizer);
2003  edge->addAdditionalChild(vaporizer);
2004  vaporizer->incRef("buildVaporizer");
2005  }
2006  return vaporizer;
2007 }
2008 
2009 
2010 std::string
2011 GNEAdditionalHandler::getFileName(const SUMOSAXAttributes& attrs, const std::string& base, const bool allowEmpty) {
2012  // get the file name to read further definitions from
2013  bool ok = true;
2014  std::string file = attrs.getOpt<std::string>(SUMO_ATTR_FILE, 0, ok, "");
2015  if (file == "") {
2016  if (allowEmpty) {
2017  return file;
2018  }
2019  WRITE_WARNING("No filename given.");
2020  }
2021  // check whether absolute or relative filenames are given
2022  if (!FileHelpers::isAbsolute(file)) {
2023  return FileHelpers::getConfigurationRelative(base, file);
2024  }
2025  return file;
2026 }
2027 
2028 
2029 double
2030 GNEAdditionalHandler::getPosition(double pos, GNELane& lane, bool friendlyPos , const std::string& additionalID) {
2031  if (pos < 0) {
2032  pos = lane.getLaneShapeLength() + pos;
2033  }
2034  if (pos > lane.getLaneShapeLength()) {
2035  if (friendlyPos) {
2036  pos = lane.getLaneShapeLength() - (double) 0.1;
2037  } else {
2038  WRITE_WARNING("The position of additional '" + additionalID + "' lies beyond the lane's '" + lane.getID() + "' length.");
2039  }
2040  }
2041  return pos;
2042 }
2043 
2044 
2045 bool
2046 GNEAdditionalHandler::fixStoppinPlacePosition(std::string& startPos, std::string& endPos, const double laneLength, const double minLength, const bool friendlyPos) {
2047  // first check if startPos and endPos were defined
2048  if (GNEAttributeCarrier::canParse<double>(startPos) && GNEAttributeCarrier::canParse<double>(endPos)) {
2049  // first parse strings to numerical values
2050  double startPosDouble = GNEAttributeCarrier::parse<double>(startPos);
2051  double endPosDouble = GNEAttributeCarrier::parse<double>(endPos);
2052 
2053  // fix both positions
2054  if (minLength > laneLength) {
2055  return false;
2056  }
2057  if (startPosDouble < 0) {
2058  startPosDouble += laneLength;
2059  }
2060  if (endPosDouble < 0) {
2061  endPosDouble += laneLength;
2062  }
2063  if ((endPosDouble < minLength) || (endPosDouble > laneLength)) {
2064  if (!friendlyPos) {
2065  return false;
2066  }
2067  if (endPosDouble < minLength) {
2068  endPosDouble = minLength;
2069  }
2070  if (endPosDouble > laneLength) {
2071  endPosDouble = laneLength;
2072  }
2073  }
2074  if ((startPosDouble < 0) || (startPosDouble > (endPosDouble - minLength))) {
2075  if (!friendlyPos) {
2076  return false;
2077  }
2078  if (startPosDouble < 0) {
2079  startPosDouble = 0;
2080  }
2081  if (startPosDouble > (endPosDouble - minLength)) {
2082  startPosDouble = (endPosDouble - minLength);
2083  }
2084  }
2085  // Modify original positions
2086  startPos = toString(startPosDouble);
2087  endPos = toString(endPosDouble);
2088  } else if (GNEAttributeCarrier::canParse<double>(startPos)) {
2089  // check that endPosition is valid
2090  if (endPos.empty() || !GNEAttributeCarrier::canParse<double>(endPos)) {
2091  // first parse to double only startPos
2092  double startPosDouble = GNEAttributeCarrier::parse<double>(startPos);
2093  // fix both positions
2094  if (minLength > laneLength) {
2095  return false;
2096  }
2097  if (startPosDouble < 0) {
2098  startPosDouble += laneLength;
2099  }
2100  if ((startPosDouble < 0) || startPosDouble > (laneLength - minLength)) {
2101  if (!friendlyPos) {
2102  return false;
2103  }
2104  if (startPosDouble < 0) {
2105  startPosDouble = 0;
2106  }
2107  if (startPosDouble > (laneLength - minLength)) {
2108  startPosDouble = (laneLength - minLength);
2109  }
2110  }
2111  // Modify only start position
2112  startPos = toString(startPosDouble);
2113  } else {
2114  return false;
2115  }
2116  } else if (GNEAttributeCarrier::canParse<double>(endPos)) {
2117  // check that endPosition is valid
2118  if (startPos.empty() || !GNEAttributeCarrier::canParse<double>(startPos)) {
2119  // first parse to double only endPos
2120  double endPosDouble = GNEAttributeCarrier::parse<double>(endPos);
2121  // fix both positions
2122  if (minLength > laneLength) {
2123  return false;
2124  }
2125  if (endPosDouble < 0) {
2126  endPosDouble += laneLength;
2127  }
2128  if ((endPosDouble < minLength) || (endPosDouble > laneLength)) {
2129  if (!friendlyPos) {
2130  return false;
2131  }
2132  if (endPosDouble < minLength) {
2133  endPosDouble = minLength;
2134  }
2135  if (endPosDouble > laneLength) {
2136  endPosDouble = laneLength;
2137  }
2138  }
2139  if (0 > (endPosDouble - minLength)) {
2140  if (!friendlyPos) {
2141  return false;
2142  }
2143  }
2144  // Modify only end position
2145  endPos = toString(endPosDouble);
2146  } else {
2147  return false;
2148  }
2149  }
2150  return true;
2151 }
2152 
2153 
2154 bool GNEAdditionalHandler::checkAndFixDetectorPositionPosition(double& pos, const double laneLength, const bool friendlyPos) {
2155  if ((pos < 0) || (pos > laneLength)) {
2156  if (!friendlyPos) {
2157  return false;
2158  } else if (pos < 0) {
2159  pos = 0;
2160  } else if (pos > laneLength) {
2161  pos = laneLength;
2162  }
2163  }
2164  return true;
2165 }
2166 
2167 
2168 bool GNEAdditionalHandler::fixE2DetectorPositionPosition(double& pos, double& length, const double laneLength, const bool friendlyPos) {
2169  if ((pos < 0) || ((pos + length) > laneLength)) {
2170  if (!friendlyPos) {
2171  return false;
2172  } else if (pos < 0) {
2173  pos = 0;
2174  } else if (pos > laneLength) {
2175  pos = laneLength;
2176  length = 0;
2177  } else if ((pos + length) > laneLength) {
2178  length = laneLength - pos;
2179  }
2180  }
2181  return true;
2182 }
2183 
2184 
2185 bool
2187  // check that busStopParent is a busStop
2188  assert(busStopParent->getTag() == SUMO_TAG_BUS_STOP);
2189  // check if exist another acces for the same busStop in the given edge
2190  for (auto i : busStopParent->getAdditionalChilds()) {
2191  for (auto j : edge.getLanes()) {
2192  if (i->getAttribute(SUMO_ATTR_LANE) == j->getID()) {
2193  return false;
2194  }
2195  }
2196  }
2197  return true;
2198 }
2199 
2200 
2201 bool
2203  // check that rerouter is correct
2204  assert(rerouter->getTag() == SUMO_TAG_REROUTER);
2205  // declare a vector to keep sorted rerouter childs
2206  std::vector<std::pair<double, double>> sortedIntervals;
2207  // iterate over additional childs
2208  for (auto i : rerouter->getAdditionalChilds()) {
2209  sortedIntervals.push_back(std::make_pair(0., 0.));
2210  // set begin and end
2211  sortedIntervals.back().first = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_BEGIN));
2212  sortedIntervals.back().second = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_END));
2213  }
2214  // add new intervals
2215  sortedIntervals.push_back(std::make_pair(newBegin, newEnd));
2216  // sort childs
2217  std::sort(sortedIntervals.begin(), sortedIntervals.end());
2218  // check overlapping after sorting
2219  for (int i = 0; i < (int)sortedIntervals.size() - 1; i++) {
2220  if (sortedIntervals.at(i).second > sortedIntervals.at(i + 1).first) {
2221  return false;
2222  }
2223  }
2224  return true;
2225 }
2226 
2227 
2228 void
2230  myInsertedElements.push_back(std::make_pair(tag, ""));
2231 }
2232 
2233 
2234 void
2236  myInsertedElements.back().second = id;
2237 }
2238 
2239 
2240 void
2242  if (!myInsertedElements.empty()) {
2243  myInsertedElements.pop_back();
2244  }
2245 }
2246 
2247 
2250  if (myInsertedElements.size() < 2) {
2251  // currently we're finding additional parent in the additional XML root
2252  WRITE_WARNING("A " + toString(myInsertedElements.back().first) + " must be declared within the definition of a " + toString(expectedTag) + ".");
2253  return nullptr;
2254  } else {
2255  GNEAdditional* retrievedAdditional = viewNet->getNet()->retrieveAdditional((myInsertedElements.end() - 2)->first, (myInsertedElements.end() - 2)->second, false);
2256  if (retrievedAdditional == nullptr) {
2257  // additional doesn't exist
2258  WRITE_WARNING("A " + toString((myInsertedElements.end() - 1)->first) + " must be declared within the definition of a " + toString(expectedTag) + ".");
2259  return nullptr;
2260  } else if (retrievedAdditional->getTag() != expectedTag) {
2261  // invalid additional parent
2262  WRITE_WARNING("A " + toString((myInsertedElements.end() - 1)->first) + " cannot be declared within the definition of a " + toString(retrievedAdditional->getTag()) + ".");
2263  return nullptr;
2264  } else {
2265  return retrievedAdditional;
2266  }
2267  }
2268 }
2269 
2270 /****************************************************************************/
void insertAdditional(GNEAdditional *additional)
Insert a additional element int GNENet container.
Definition: GNENet.cpp:2132
SumoXMLTag
Numbers representing SUMO-XML - element names.
vehicle space used by GNEParkingAreas
static GNEAdditional * buildVehicleType(GNEViewNet *viewNet, bool allowUndoRedo, std::string vehicleTypeID, double accel, double decel, double sigma, double tau, double length, double minGap, double maxSpeed, double speedFactor, double speedDev, const RGBColor &color, SUMOVehicleClass vClass, const std::string &emissionClass, SUMOVehicleShape shape, double width, const std::string &filename, double impatience, const std::string &laneChangeModel, const std::string &carFollowModel, int personCapacity, int containerCapacity, double boardingDuration, double loadingDuration, const std::string &latAlignment, double minGapLat, double maxSpeedLat)
a routeprobe detector
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:907
alternative tag for e1 detector
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
Definition: FileHelpers.cpp:75
description of a vehicle type
void parseAndBuildRerouterRouteProbReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Route Prob Reroute.
void parseAndBuildRerouterParkingAreaReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a parkingAreaReroute.
static bool fixStoppinPlacePosition(std::string &startPos, std::string &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check if the position of an stoppingPlace over a lane is valid
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name) ...
void parseAndBuildDetectorE1(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a induction loop detector (E1)
static GNEAdditional * buildCalibrator(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double pos, const std::string &name, const std::string &outfile, double freq)
builds a microscopic calibrator over a lane
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
begin/end of the description of a single lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
a flow definition (used by router)
void commitElementInsertion(const std::string &id)
commit element insertion (used to save ID of last correct inserted element)
static GNEAdditional * buildVariableSpeedSign(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, Position pos, const std::vector< GNELane *> &destLanes, const std::string &name, bool blockMovement)
Builds a VariableSpeedSign (lane speed trigger)
A calibrator placed over edge.
static GNEAdditional * buildDetectorE2(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double pos, double length, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, const double timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement)
Builds a lane Area Detector (E2)
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
Definition: XMLSubSys.cpp:59
void parseAndBuildChargingStation(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a charging station.
lane of a reroute of type closing
Allow/disallow charge in transit in Charging Stations.
void parseAndBuildParkingSpace(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a parking space.
const std::string & getFileName() const
returns the current file name
double y() const
Returns the y-position.
Definition: Position.h:61
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
bool myUndoAdditionals
flag to check if created additionals must be undo and redo
double x() const
Returns the x-position.
Definition: Position.h:56
Representation of a RouteProbe in netedit.
Definition: GNERouteProbe.h:36
weights: time range begin
static bool checkAndFixDetectorPositionPosition(double &pos, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
void parseAndBuildDetectorExit(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Exit detector.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
static GNEAdditional * buildDetectorE3(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, Position pos, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, const double timeThreshold, double speedThreshold, bool blockMovement)
Builds a multi entry exit detector (E3)
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:78
static GNEAdditional * buildCalibratorRoute(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &routeID, const std::vector< GNEEdge *> &edges, const RGBColor &color)
GNEAdditionalHandler(const std::string &file, GNEViewNet *viewNet, bool undoAdditionals=true, GNEAdditional *additionalParent=nullptr)
Constructor.
SAX-handler base for SUMO-files.
A parking space for a single vehicle within a parking area.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything&#39;s ok.
Definition: XMLSubSys.cpp:113
GNEAdditional * retrieveAdditionalParent(GNEViewNet *viewNet, SumoXMLTag expectedTag) const
retrieve additional parent correspond to current status of myInsertedElements
double getPosition(double pos, GNELane &lane, bool friendlyPos, const std::string &additionalID)
extracts the position, checks whether it shall be mirrored and checks whether it is within the lane...
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
static GNEAdditional * buildContainerStop(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, const std::string &startPos, const std::string &endPos, const std::string &name, const std::vector< std::string > &lines, bool friendlyPosition, bool blockMovement)
Builds a container stop.
static GNEAdditional * buildClosingReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *rerouterIntervalParent, GNEEdge *closedEdge, SVCPermissions permissions)
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
begin/end of the description of a route
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:242
void parseAndBuildVariableSpeedSign(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Variable Speed Signal (lane speed trigger)
HierarchyInsertedElements myParentElements
HierarchyInsertedElements used for insert childs.
void parseAndBuildDetectorE2(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a lane area detector (E2)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
an e3 entry point
static GNEAdditional * builDestProbReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *rerouterIntervalParent, GNEEdge *newEdgeDestination, double probability)
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
static GNEAdditional * buildDetectorE1Instant(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double pos, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Builds a Instant Induction Loop Detector (E1Instant)
static GNEAdditional * buildDetectorEntry(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *E3Parent, GNELane *lane, double pos, bool friendlyPos, bool blockMovement)
Builds a entry detector (E3)
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:1787
static GNEAdditional * buildRouteProbReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *rerouterIntervalParent, const std::string &newRouteId, double probability)
void parseAndBuildDetectorE1Instant(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Instant induction loop detector (E1Instant)
GNEUndoList * getUndoList() const
get the undoList object
~GNEAdditionalHandler()
Destructor.
void parseAndBuildCalibratorVehicleType(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses vehicle type values of Calibrators.
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
A lane area vehicles can park at (netedit-version)
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1230
void addAdditionalChild(GNEAdditional *additional)
add additional child to this edge
static bool checkOverlappingRerouterIntervals(GNEAdditional *rerouter, double newBegin, double newEnd)
check if an overlapping is produced in rerouter if a interval with certain begin and end is inserted ...
void parseAndBuildRerouterInterval(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Rerouter Interval.
static GNEAdditional * buildChargingStation(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, const std::string &startPos, const std::string &endPos, const std::string &name, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay, bool friendlyPosition, bool blockMovement)
Builds a charging Station.
Encapsulated SAX-Attributes.
An instantenous induction loop.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
Definition: FileHelpers.cpp:90
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:85
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
parameter associated to a certain key
an e3 exit point
static GNEAdditional * buildAccess(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *busStop, GNELane *lane, const std::string &pos, const std::string &length, bool friendlyPos, bool blockMovement)
Builds an Access.
A list of positions.
static GNEAdditional * buildDetectorE1(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double pos, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Builds a induction loop detector (E1)
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
void parseAndBuildRerouter(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a rerouter.
A calibrator placed over lane (used in netedit)
Representation of a vaporizer in netedit.
Definition: GNEVaporizer.h:36
void parseAndBuildCalibratorRoute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses route values of Calibrators.
block movement of a graphic element
static GNEAdditional * buildRerouterInterval(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *rerouterParent, double begin, double end)
builds a rerouter interval
A lane area vehicles can halt at (netedit-version)
Definition: GNEBusStop.h:43
#define POSITION_EPS
Definition: config.h:172
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
probability of route of a reroute
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
probability of destiny of a reroute
const std::string getID() const
function to support debugging
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:249
GNEViewNet * myViewNet
pointer to View&#39;s Net
void incRef(const std::string &debugMsg="")
Increarse reference.
double getLaneShapeLength() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:726
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3523
static bool accessCanBeCreated(GNEAdditional *busStopParent, GNEEdge &edge)
check if a GNEAccess can be created in a certain Edge
void parseAndBuildDetectorE3(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a multi entry exit detector (E3)
static GNEAdditional * buildRerouter(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, Position pos, const std::vector< GNEEdge *> &edges, double prob, const std::string &name, const std::string &file, bool off, double timeThreshold, const std::string &vTypes, bool blockMovement)
builds a rerouter
void parseAndBuildRouteProbe(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds routeProbe.
static GNEAdditional * buildParkingSpace(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *parkingAreaParent, double x, double y, double z, double width, double length, double angle, bool blockMovement)
Builds a Parking Space.
reroute of type closing
GNEAdditional * getFirstAdditionalParent() const
void parseAndBuildRerouterDestProbReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Destiny Prob Reroute.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
entry for an alternative parking zone
void parseAndBuildCalibrator(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a mesoscopic or microscopic calibrator.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
void parseAndBuildVariableSpeedSignStep(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Variable Speed Signal Step.
void parseGenericParameter(const SUMOSAXAttributes &attrs)
Parse generic parameter and insert it in the last created additional.
static GNEAdditional * buildParkingArea(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, const std::string &startPos, const std::string &endPos, const std::string &name, bool friendlyPosition, int roadSideCapacity, double width, const std::string &length, double angle, bool blockMovement)
Builds a Parking Area.
trigger: the time of the step
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
A train stop (alias for bus stop)
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:832
void parseAndBuildBusStop(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a bus stop.
void parseAndBuildContainerStop(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a container stop.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
static GNEAdditional * builParkingAreaReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *rerouterIntervalParent, GNEAdditional *newParkignArea, double probability, bool visible)
static bool fixE2DetectorPositionPosition(double &pos, double &length, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:53
static GNEAdditional * buildAdditional(GNEViewNet *viewNet, bool allowUndoRedo, SumoXMLTag tag, std::map< SumoXMLAttr, std::string > values)
Build additionals.
void parseAndBuildCalibratorFlow(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses flow values of Calibrators.
weights: time range end
static GNEAdditional * buildVaporizer(GNEViewNet *viewNet, bool allowUndoRedo, GNEEdge *edge, double startTime, double end, const std::string &name)
Builds a vaporizer (lane speed trigger)
GNEAdditional * myLastInsertedAdditional
pointer to last inserted additional (used for generic parameters)
void parseAndBuildVaporizer(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Builds a vaporization.
vaporizer of vehicles
void parseAndBuildRerouterClosingLaneReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Closing Lane reroute.
GNENet * getNet() const
get the net object
static GNEAdditional * buildRouteProbe(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNEEdge *edge, const std::string &freq, const std::string &name, const std::string &file, double begin)
builds a Route probe
void parseAndBuildParkingArea(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a parking area.
GUIGlID getGlID() const
Returns the numerical id of the object.
an aggreagated-output interval
static GNEAdditional * buildCalibratorFlow(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *calibratorParent, GNEAdditional *route, GNEAdditional *vtype, const std::string &vehsPerHour, const std::string &speed, const RGBColor &color, const std::string &departLane, const std::string &departPos, const std::string &departSpeed, const std::string &arrivalLane, const std::string &arrivalPos, const std::string &arrivalSpeed, const std::string &line, int personNumber, int containerNumber, bool reroute, const std::string &departPosLat, const std::string &arrivalPosLat, double begin, double end)
A variable speed sign.
Eficiency of the charge in Charging Stations.
void parseAndBuildAccess(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses values and adds access to the current bus stop.
static std::string getFilePath(const std::string &path)
Removes the file information from the given path.
Definition: FileHelpers.cpp:65
parent of an additional element
static GNEAdditional * buildBusStop(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, const std::string &startPos, const std::string &endPos, const std::string &name, const std::vector< std::string > &lines, bool friendlyPosition, bool blockMovement)
Builds a bus stop.
void myEndElement(int element)
Called when a closing tag occurs.
static GNEAdditional * buildVariableSpeedSignStep(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *VSSParent, double time, double speed)
Builds a VariableSpeedSign Step.
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
Delay in the charge of charging stations.
void addAdditionalChild(GNEAdditional *additional)
add additional child to this additional
void insertElement(SumoXMLTag tag)
insert new element (called only in function myStartElement)
void popElement()
pop last inserted element (used only in function myEndElement)
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:586
A lane area vehicles can halt at (netedit-version)
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:243
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
An access point for a train stop.
static GNEAdditional * buildClosingLaneReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *rerouterIntervalParent, GNELane *closedLane, SVCPermissions permissions)
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1066
static GNEAdditional * buildDetectorExit(GNEViewNet *viewNet, bool allowUndoRedo, GNEAdditional *E3Parent, GNELane *lane, double pos, bool friendlyPos, bool blockMovement)
Builds a exit detector (E3)
A color information.
void parseAndBuildDetectorEntry(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Entry detector.
alternative tag for e3 detector
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occurred errors.
alternative tag for e2 detector
trigger: a step description
void parseAndBuildRerouterClosingReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Closing Reroute.
SumoXMLTag getTag() const
get XML Tag assigned to this object