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  }
1409  return nullptr;
1410  }
1411  default:
1412  return nullptr;
1413  }
1414 }
1415 
1416 
1418 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) {
1419  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_BUS_STOP, id, false) == nullptr) {
1420  GNEBusStop* busStop = new GNEBusStop(id, lane, viewNet, startPos, endPos, name, lines, friendlyPosition, blockMovement);
1421  if (allowUndoRedo) {
1422  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_BUS_STOP));
1423  viewNet->getUndoList()->add(new GNEChange_Additional(busStop, true), true);
1424  viewNet->getUndoList()->p_end();
1425  } else {
1426  viewNet->getNet()->insertAdditional(busStop);
1427  lane->addAdditionalChild(busStop);
1428  busStop->incRef("buildBusStop");
1429  }
1430  return busStop;
1431  } else {
1432  throw ProcessError("Could not build " + toString(SUMO_TAG_BUS_STOP) + " with ID '" + id + "' in netedit; probably declared twice.");
1433  }
1434 }
1435 
1436 
1438 GNEAdditionalHandler::buildAccess(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* busStop, GNELane* lane, const std::string& pos, const std::string& length, bool friendlyPos, bool blockMovement) {
1439  // Check if busStop parent and lane is correct
1440  if (lane == nullptr) {
1441  throw ProcessError("Could not build " + toString(SUMO_TAG_ACCESS) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist.");
1442  } else if (busStop == nullptr) {
1443  throw ProcessError("Could not build " + toString(SUMO_TAG_ACCESS) + " in netedit; " + toString(SUMO_TAG_BUS_STOP) + " parent doesn't exist.");
1444  } else if (!accessCanBeCreated(busStop, lane->getParentEdge())) {
1445  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() + "'");
1446  } else {
1447  GNEAccess* access = new GNEAccess(busStop, lane, viewNet, pos, length, friendlyPos, blockMovement);
1448  if (allowUndoRedo) {
1449  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_ACCESS));
1450  viewNet->getUndoList()->add(new GNEChange_Additional(access, true), true);
1451  viewNet->getUndoList()->p_end();
1452  } else {
1453  viewNet->getNet()->insertAdditional(access);
1454  lane->addAdditionalChild(access);
1455  busStop->addAdditionalChild(access);
1456  access->incRef("buildAccess");
1457  }
1458  return access;
1459  }
1460 }
1461 
1462 
1464 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) {
1465  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, id, false) == nullptr) {
1466  GNEContainerStop* containerStop = new GNEContainerStop(id, lane, viewNet, startPos, endPos, name, lines, friendlyPosition, blockMovement);
1467  if (allowUndoRedo) {
1468  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CONTAINER_STOP));
1469  viewNet->getUndoList()->add(new GNEChange_Additional(containerStop, true), true);
1470  viewNet->getUndoList()->p_end();
1471  } else {
1472  viewNet->getNet()->insertAdditional(containerStop);
1473  lane->addAdditionalChild(containerStop);
1474  containerStop->incRef("buildContainerStop");
1475  }
1476  return containerStop;
1477  } else {
1478  throw ProcessError("Could not build " + toString(SUMO_TAG_CONTAINER_STOP) + " with ID '" + id + "' in netedit; probably declared twice.");
1479  }
1480 }
1481 
1482 
1484 GNEAdditionalHandler::buildChargingStation(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, const std::string& startPos, const std::string& endPos, const std::string& name,
1485  double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay, bool friendlyPosition, bool blockMovement) {
1486  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CHARGING_STATION, id, false) == nullptr) {
1487  GNEChargingStation* chargingStation = new GNEChargingStation(id, lane, viewNet, startPos, endPos, name, chargingPower, efficiency, chargeInTransit, chargeDelay, friendlyPosition, blockMovement);
1488  if (allowUndoRedo) {
1489  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CHARGING_STATION));
1490  viewNet->getUndoList()->add(new GNEChange_Additional(chargingStation, true), true);
1491  viewNet->getUndoList()->p_end();
1492  } else {
1493  viewNet->getNet()->insertAdditional(chargingStation);
1494  lane->addAdditionalChild(chargingStation);
1495  chargingStation->incRef("buildChargingStation");
1496  }
1497  return chargingStation;
1498  } else {
1499  throw ProcessError("Could not build " + toString(SUMO_TAG_CHARGING_STATION) + " with ID '" + id + "' in netedit; probably declared twice.");
1500  }
1501 }
1502 
1503 
1505 GNEAdditionalHandler::buildParkingArea(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, const std::string& startPos, const std::string& endPos, const std::string& name,
1506  bool friendlyPosition, int roadSideCapacity, double width, const std::string& length, double angle, bool blockMovement) {
1507  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_PARKING_AREA, id, false) == nullptr) {
1508  GNEParkingArea* parkingArea = new GNEParkingArea(id, lane, viewNet, startPos, endPos, name, friendlyPosition, roadSideCapacity, width, length, angle, blockMovement);
1509  if (allowUndoRedo) {
1510  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_PARKING_AREA));
1511  viewNet->getUndoList()->add(new GNEChange_Additional(parkingArea, true), true);
1512  viewNet->getUndoList()->p_end();
1513  } else {
1514  viewNet->getNet()->insertAdditional(parkingArea);
1515  lane->addAdditionalChild(parkingArea);
1516  parkingArea->incRef("buildParkingArea");
1517  }
1518  return parkingArea;
1519  } else {
1520  throw ProcessError("Could not build " + toString(SUMO_TAG_PARKING_AREA) + " with ID '" + id + "' in netedit; probably declared twice.");
1521  }
1522 }
1523 
1524 
1526 GNEAdditionalHandler::buildParkingSpace(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* parkingAreaParent, double x, double y, double z, double width, double length, double angle, bool blockMovement) {
1527  GNEParkingSpace* parkingSpace = new GNEParkingSpace(viewNet, parkingAreaParent, x, y, z, width, length, angle, blockMovement);
1528  if (allowUndoRedo) {
1529  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_PARKING_SPACE));
1530  viewNet->getUndoList()->add(new GNEChange_Additional(parkingSpace, true), true);
1531  viewNet->getUndoList()->p_end();
1532  } else {
1533  viewNet->getNet()->insertAdditional(parkingSpace);
1534  parkingAreaParent->addAdditionalChild(parkingSpace);
1535  parkingSpace->incRef("buildParkingSpace");
1536  }
1537  return parkingSpace;
1538 }
1539 
1540 
1542 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) {
1543  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_E1DETECTOR, id, false) == nullptr) {
1544  GNEDetectorE1* detectorE1 = new GNEDetectorE1(id, lane, viewNet, pos, freq, filename, vehicleTypes, name, friendlyPos, blockMovement);
1545  if (allowUndoRedo) {
1546  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E1DETECTOR));
1547  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE1, true), true);
1548  viewNet->getUndoList()->p_end();
1549  } else {
1550  viewNet->getNet()->insertAdditional(detectorE1);
1551  lane->addAdditionalChild(detectorE1);
1552  detectorE1->incRef("buildDetectorE1");
1553  }
1554  return detectorE1;
1555  } else {
1556  throw ProcessError("Could not build " + toString(SUMO_TAG_E1DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1557  }
1558 }
1559 
1560 
1562 GNEAdditionalHandler::buildDetectorE2(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, double length, double freq, const std::string& filename,
1563  const std::string& vehicleTypes, const std::string& name, const double timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement) {
1564  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_E2DETECTOR, id, false) == nullptr) {
1565  GNEDetectorE2* detectorE2 = new GNEDetectorE2(id, lane, viewNet, pos, length, freq, filename, vehicleTypes, name, timeThreshold, speedThreshold, jamThreshold, friendlyPos, blockMovement);
1566  if (allowUndoRedo) {
1567  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E2DETECTOR));
1568  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
1569  viewNet->getUndoList()->p_end();
1570  } else {
1571  viewNet->getNet()->insertAdditional(detectorE2);
1572  lane->addAdditionalChild(detectorE2);
1573  detectorE2->incRef("buildDetectorE2");
1574  }
1575  return detectorE2;
1576  } else {
1577  throw ProcessError("Could not build " + toString(SUMO_TAG_E2DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1578  }
1579 }
1580 
1581 
1583 GNEAdditionalHandler::buildDetectorE3(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, double freq, const std::string& filename, const std::string& vehicleTypes,
1584  const std::string& name, const double timeThreshold, double speedThreshold, bool blockMovement) {
1585  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_E3DETECTOR, id, false) == nullptr) {
1586  GNEDetectorE3* detectorE3 = new GNEDetectorE3(id, viewNet, pos, freq, filename, vehicleTypes, name, timeThreshold, speedThreshold, blockMovement);
1587  if (allowUndoRedo) {
1588  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E3DETECTOR));
1589  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE3, true), true);
1590  viewNet->getUndoList()->p_end();
1591  } else {
1592  viewNet->getNet()->insertAdditional(detectorE3);
1593  detectorE3->incRef("buildDetectorE3");
1594  }
1595  return detectorE3;
1596  } else {
1597  throw ProcessError("Could not build " + toString(SUMO_TAG_E3DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1598  }
1599 }
1600 
1601 
1603 GNEAdditionalHandler::buildDetectorEntry(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* E3Parent, GNELane* lane, double pos, bool friendlyPos, bool blockMovement) {
1604  // Check if Detector E3 parent and lane is correct
1605  if (lane == nullptr) {
1606  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist.");
1607  } else if (E3Parent == nullptr) {
1608  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_E3DETECTOR) + " parent doesn't exist.");
1609  } else {
1610  GNEDetectorEntry* entry = new GNEDetectorEntry(viewNet, E3Parent, lane, pos, friendlyPos, blockMovement);
1611  if (allowUndoRedo) {
1612  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_DET_ENTRY));
1613  viewNet->getUndoList()->add(new GNEChange_Additional(entry, true), true);
1614  viewNet->getUndoList()->p_end();
1615  } else {
1616  viewNet->getNet()->insertAdditional(entry);
1617  lane->addAdditionalChild(entry);
1618  E3Parent->addAdditionalChild(entry);
1619  entry->incRef("buildDetectorEntry");
1620  }
1621  return entry;
1622  }
1623 }
1624 
1625 
1627 GNEAdditionalHandler::buildDetectorExit(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* E3Parent, GNELane* lane, double pos, bool friendlyPos, bool blockMovement) {
1628  // Check if Detector E3 parent and lane is correct
1629  if (lane == nullptr) {
1630  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist.");
1631  } else if (E3Parent == nullptr) {
1632  throw ProcessError("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_E3DETECTOR) + " parent doesn't exist.");
1633  } else {
1634  GNEDetectorExit* exit = new GNEDetectorExit(viewNet, E3Parent, lane, pos, friendlyPos, blockMovement);
1635  if (allowUndoRedo) {
1636  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_DET_EXIT));
1637  viewNet->getUndoList()->add(new GNEChange_Additional(exit, true), true);
1638  viewNet->getUndoList()->p_end();
1639  } else {
1640  viewNet->getNet()->insertAdditional(exit);
1641  lane->addAdditionalChild(exit);
1642  E3Parent->addAdditionalChild(exit);
1643  exit->incRef("buildDetectorExit");
1644  }
1645  return exit;
1646  }
1647 }
1648 
1649 
1651 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) {
1652  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_INSTANT_INDUCTION_LOOP, id, false) == nullptr) {
1653  GNEDetectorE1Instant* detectorE1Instant = new GNEDetectorE1Instant(id, lane, viewNet, pos, filename, vehicleTypes, name, friendlyPos, blockMovement);
1654  if (allowUndoRedo) {
1656  viewNet->getUndoList()->add(new GNEChange_Additional(detectorE1Instant, true), true);
1657  viewNet->getUndoList()->p_end();
1658  } else {
1659  viewNet->getNet()->insertAdditional(detectorE1Instant);
1660  lane->addAdditionalChild(detectorE1Instant);
1661  detectorE1Instant->incRef("buildDetectorE1Instant");
1662  }
1663  return detectorE1Instant;
1664  } else {
1665  throw ProcessError("Could not build " + toString(SUMO_TAG_INSTANT_INDUCTION_LOOP) + " with ID '" + id + "' in netedit; probably declared twice.");
1666  }
1667 }
1668 
1669 
1671 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) {
1672  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CALIBRATOR, id, false) == nullptr) {
1673  GNECalibrator* calibrator = new GNECalibrator(id, viewNet, lane, pos, freq, name, outfile);
1674  if (allowUndoRedo) {
1675  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CALIBRATOR));
1676  viewNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
1677  viewNet->getUndoList()->p_end();
1678  // center after creation
1679  viewNet->centerTo(calibrator->getGlID(), false);
1680  } else {
1681  viewNet->getNet()->insertAdditional(calibrator);
1682  lane->addAdditionalChild(calibrator);
1683  calibrator->incRef("buildCalibrator");
1684  }
1685  return calibrator;
1686  } else {
1687  throw ProcessError("Could not build " + toString(SUMO_TAG_CALIBRATOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1688  }
1689 }
1690 
1691 
1693 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) {
1694  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_CALIBRATOR, id, false) == nullptr) {
1695  GNECalibrator* calibrator = new GNECalibrator(id, viewNet, edge, pos, freq, name, outfile);
1696  if (allowUndoRedo) {
1697  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CALIBRATOR));
1698  viewNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
1699  viewNet->getUndoList()->p_end();
1700  // center after creation
1701  viewNet->centerTo(calibrator->getGlID(), false);
1702  } else {
1703  viewNet->getNet()->insertAdditional(calibrator);
1704  edge->addAdditionalChild(calibrator);
1705  calibrator->incRef("buildCalibrator");
1706  }
1707  return calibrator;
1708  } else {
1709  throw ProcessError("Could not build " + toString(SUMO_TAG_CALIBRATOR) + " with ID '" + id + "' in netedit; probably declared twice.");
1710  }
1711 }
1712 
1713 
1715 GNEAdditionalHandler::buildCalibratorRoute(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& routeID, const std::vector<GNEEdge*>& edges, const RGBColor& color) {
1716  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_ROUTE, routeID, false) == nullptr) {
1717  // create route and add it to calibrator parent
1718  GNECalibratorRoute* route = new GNECalibratorRoute(viewNet, routeID, edges, color);
1719  if (allowUndoRedo) {
1720  viewNet->getUndoList()->p_begin("add " + toString(route->getTag()));
1721  viewNet->getUndoList()->add(new GNEChange_Additional(route, true), true);
1722  viewNet->getUndoList()->p_end();
1723  } else {
1724  viewNet->getNet()->insertAdditional(route);
1725  route->incRef("buildCalibratorRoute");
1726  }
1727  return route;
1728  } else {
1729  throw ProcessError("Could not build " + toString(SUMO_TAG_ROUTE) + " with ID '" + routeID + "' in netedit; probably declared twice.");
1730  }
1731 
1732 }
1733 
1734 
1736 GNEAdditionalHandler::buildVehicleType(GNEViewNet* viewNet, bool allowUndoRedo, std::string vehicleTypeID,
1737  double accel, double decel, double sigma, double tau, double length, double minGap, double maxSpeed,
1738  double speedFactor, double speedDev, const RGBColor& color, SUMOVehicleClass vClass, const std::string& emissionClass,
1739  SUMOVehicleShape shape, double width, const std::string& filename, double impatience, const std::string& laneChangeModel,
1740  const std::string& carFollowModel, int personCapacity, int containerCapacity, double boardingDuration,
1741  double loadingDuration, const std::string& latAlignment, double minGapLat, double maxSpeedLat) {
1742  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_VTYPE, vehicleTypeID, false) == nullptr) {
1743  // create vehicle type and add it to calibrator parent
1744  GNECalibratorVehicleType* vType = new GNECalibratorVehicleType(viewNet, vehicleTypeID, accel, decel, sigma, tau, length, minGap, maxSpeed,
1745  speedFactor, speedDev, color, vClass, emissionClass, shape, width, filename, impatience,
1746  laneChangeModel, carFollowModel, personCapacity, containerCapacity, boardingDuration,
1747  loadingDuration, latAlignment, minGapLat, maxSpeedLat);
1748  if (allowUndoRedo) {
1749  viewNet->getUndoList()->p_begin("add " + toString(vType->getTag()));
1750  viewNet->getUndoList()->add(new GNEChange_Additional(vType, true), true);
1751  viewNet->getUndoList()->p_end();
1752  } else {
1753  viewNet->getNet()->insertAdditional(vType);
1754  vType->incRef("buildCalibratorVehicleType");
1755  }
1756  return vType;
1757  } else {
1758  throw ProcessError("Could not build " + toString(SUMO_TAG_VTYPE) + " with ID '" + vehicleTypeID + "' in netedit; probably declared twice.");
1759  }
1760 }
1761 
1762 
1764 GNEAdditionalHandler::buildCalibratorFlow(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* calibratorParent, GNEAdditional* route, GNEAdditional* vtype,
1765  const std::string& vehsPerHour, const std::string& speed, const RGBColor& color, const std::string& departLane, const std::string& departPos,
1766  const std::string& departSpeed, const std::string& arrivalLane, const std::string& arrivalPos, const std::string& arrivalSpeed, const std::string& line,
1767  int personNumber, int containerNumber, bool reroute, const std::string& departPosLat, const std::string& arrivalPosLat, double begin, double end) {
1768 
1769  // create Flow and add it to calibrator parent
1770  GNECalibratorFlow* flow = new GNECalibratorFlow(calibratorParent, vtype, route, vehsPerHour, speed, color, departLane, departPos, departSpeed,
1771  arrivalLane, arrivalPos, arrivalSpeed, line, personNumber, containerNumber, reroute,
1772  departPosLat, arrivalPosLat, begin, end);
1773  if (allowUndoRedo) {
1774  viewNet->getUndoList()->p_begin("add " + toString(flow->getTag()));
1775  viewNet->getUndoList()->add(new GNEChange_Additional(flow, true), true);
1776  viewNet->getUndoList()->p_end();
1777  } else {
1778  calibratorParent->addAdditionalChild(flow);
1779  flow->incRef("buildCalibratorFlow");
1780  }
1781  return flow;
1782 }
1783 
1784 
1786 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) {
1787  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_REROUTER, id, false) == nullptr) {
1788  GNERerouter* rerouter = new GNERerouter(id, viewNet, pos, edges, name, file, prob, off, timeThreshold, vTypes, blockMovement);
1789  if (allowUndoRedo) {
1790  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_REROUTER));
1791  viewNet->getUndoList()->add(new GNEChange_Additional(rerouter, true), true);
1792  viewNet->getUndoList()->p_end();
1793  } else {
1794  viewNet->getNet()->insertAdditional(rerouter);
1795  // add this rerouter as parent of all edges
1796  for (auto i : edges) {
1797  i->addAdditionalParent(rerouter);
1798  }
1799  rerouter->incRef("buildRerouter");
1800  }
1801  // parse rerouter childs
1802  if (!file.empty()) {
1803  // we assume that rerouter values files is placed in the same folder as the additional file
1804  std::string currentAdditionalFilename = FileHelpers::getFilePath(OptionsCont::getOptions().getString("sumo-additionals-file"));
1805  // Create additional handler for parse rerouter values
1806  GNEAdditionalHandler rerouterValuesHandler(currentAdditionalFilename + file, viewNet, allowUndoRedo, rerouter);
1807  // disable validation for rerouters
1808  XMLSubSys::setValidation("never", "auto");
1809  // Run parser
1810  if (!XMLSubSys::runParser(rerouterValuesHandler, currentAdditionalFilename + file, false)) {
1811  WRITE_MESSAGE("Loading of " + file + " failed.");
1812  }
1813  // enable validation for rerouters
1814  XMLSubSys::setValidation("auto", "auto");
1815  }
1816  return rerouter;
1817  } else {
1818  throw ProcessError("Could not build " + toString(SUMO_TAG_REROUTER) + " with ID '" + id + "' in netedit; probably declared twice.");
1819  }
1820 }
1821 
1822 
1824 GNEAdditionalHandler::buildRerouterInterval(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterParent, double begin, double end) {
1825  // check if new interval will produce a overlapping
1826  if (checkOverlappingRerouterIntervals(rerouterParent, begin, end)) {
1827  // create rerouter interval and add it into rerouter parent
1828  GNERerouterInterval* rerouterInterval = new GNERerouterInterval(rerouterParent, begin, end);
1829  if (allowUndoRedo) {
1830  viewNet->getUndoList()->p_begin("add " + toString(rerouterInterval->getTag()));
1831  viewNet->getUndoList()->add(new GNEChange_Additional(rerouterInterval, true), true);
1832  viewNet->getUndoList()->p_end();
1833  } else {
1834  rerouterParent->addAdditionalChild(rerouterInterval);
1835  rerouterInterval->incRef("buildRerouterInterval");
1836  }
1837  return rerouterInterval;
1838  } else {
1839  throw ProcessError("Could not build " + toString(SUMO_TAG_INTERVAL) + " with begin '" + toString(begin) + "' and '" + toString(end) + "' in '" + rerouterParent->getID() + "' due overlapping.");
1840  }
1841 }
1842 
1843 
1845 GNEAdditionalHandler::buildClosingLaneReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNELane* closedLane, SVCPermissions permissions) {
1846  // create closing lane reorute
1847  GNEClosingLaneReroute* closingLaneReroute = new GNEClosingLaneReroute(rerouterIntervalParent, closedLane, permissions);
1848  // add it to interval parent depending of allowUndoRedo
1849  if (allowUndoRedo) {
1850  viewNet->getUndoList()->p_begin("add " + toString(closingLaneReroute->getTag()));
1851  viewNet->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1852  viewNet->getUndoList()->p_end();
1853  } else {
1854  rerouterIntervalParent->addAdditionalChild(closingLaneReroute);
1855  closingLaneReroute->incRef("buildClosingLaneReroute");
1856  }
1857  return closingLaneReroute;
1858 }
1859 
1860 
1862 GNEAdditionalHandler::buildClosingReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNEEdge* closedEdge, SVCPermissions permissions) {
1863  // create closing reroute
1864  GNEClosingReroute* closingReroute = new GNEClosingReroute(rerouterIntervalParent, closedEdge, permissions);
1865  // add it to interval parent depending of allowUndoRedo
1866  if (allowUndoRedo) {
1867  viewNet->getUndoList()->p_begin("add " + toString(closingReroute->getTag()));
1868  viewNet->getUndoList()->add(new GNEChange_Additional(closingReroute, true), true);
1869  viewNet->getUndoList()->p_end();
1870  } else {
1871  rerouterIntervalParent->addAdditionalChild(closingReroute);
1872  closingReroute->incRef("buildClosingReroute");
1873  }
1874  return closingReroute;
1875 }
1876 
1877 
1879 GNEAdditionalHandler::builDestProbReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability) {
1880  // create dest probability reroute
1881  GNEDestProbReroute* destProbReroute = new GNEDestProbReroute(rerouterIntervalParent, newEdgeDestination, probability);
1882  // add it to interval parent depending of allowUndoRedo
1883  if (allowUndoRedo) {
1884  viewNet->getUndoList()->p_begin("add " + toString(destProbReroute->getTag()));
1885  viewNet->getUndoList()->add(new GNEChange_Additional(destProbReroute, true), true);
1886  viewNet->getUndoList()->p_end();
1887  } else {
1888  rerouterIntervalParent->addAdditionalChild(destProbReroute);
1889  destProbReroute->incRef("builDestProbReroute");
1890  }
1891  return destProbReroute;
1892 }
1893 
1894 
1896 GNEAdditionalHandler::builParkingAreaReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, GNEAdditional* newParkingArea, double probability, bool visible) {
1897  // create dest probability reroute
1898  GNEParkingAreaReroute* parkingAreaReroute = new GNEParkingAreaReroute(rerouterIntervalParent, newParkingArea, probability, visible);
1899  // add it to interval parent depending of allowUndoRedo
1900  if (allowUndoRedo) {
1901  viewNet->getUndoList()->p_begin("add " + toString(parkingAreaReroute->getTag()));
1902  viewNet->getUndoList()->add(new GNEChange_Additional(parkingAreaReroute, true), true);
1903  viewNet->getUndoList()->p_end();
1904  } else {
1905  rerouterIntervalParent->addAdditionalChild(parkingAreaReroute);
1906  parkingAreaReroute->incRef("builParkingAreaReroute");
1907  }
1908  return parkingAreaReroute;
1909 }
1910 
1911 
1913 GNEAdditionalHandler::buildRouteProbReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* rerouterIntervalParent, const std::string& newRouteId, double probability) {
1914  // create rout prob rereoute
1915  GNERouteProbReroute* routeProbReroute = new GNERouteProbReroute(rerouterIntervalParent, newRouteId, probability);
1916  // add it to interval parent depending of allowUndoRedo
1917  if (allowUndoRedo) {
1918  viewNet->getUndoList()->p_begin("add " + toString(routeProbReroute->getTag()));
1919  viewNet->getUndoList()->add(new GNEChange_Additional(routeProbReroute, true), true);
1920  viewNet->getUndoList()->p_end();
1921  } else {
1922  rerouterIntervalParent->addAdditionalChild(routeProbReroute);
1923  routeProbReroute->incRef("buildRouteProbReroute");
1924  }
1925  return routeProbReroute;
1926 }
1927 
1928 
1930 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) {
1931  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, id, false) == nullptr) {
1932  GNERouteProbe* routeProbe = new GNERouteProbe(id, viewNet, edge, freq, name, file, begin);
1933  if (allowUndoRedo) {
1934  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_ROUTEPROBE));
1935  viewNet->getUndoList()->add(new GNEChange_Additional(routeProbe, true), true);
1936  viewNet->getUndoList()->p_end();
1937  // center after creation
1938  viewNet->centerTo(routeProbe->getGlID(), false);
1939  } else {
1940  viewNet->getNet()->insertAdditional(routeProbe);
1941  edge->addAdditionalChild(routeProbe);
1942  routeProbe->incRef("buildRouteProbe");
1943  }
1944  return routeProbe;
1945  } else {
1946  throw ProcessError("Could not build " + toString(SUMO_TAG_ROUTEPROBE) + " with ID '" + id + "' in netedit; probably declared twice.");
1947  }
1948 }
1949 
1950 
1952 GNEAdditionalHandler::buildVariableSpeedSign(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, const std::vector<GNELane*>& lanes, const std::string& name, bool blockMovement) {
1953  if (viewNet->getNet()->retrieveAdditional(SUMO_TAG_VSS, id, false) == nullptr) {
1954  GNEVariableSpeedSign* variableSpeedSign = new GNEVariableSpeedSign(id, viewNet, pos, lanes, name, blockMovement);
1955  if (allowUndoRedo) {
1956  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_VSS));
1957  viewNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSign, true), true);
1958  viewNet->getUndoList()->p_end();
1959  } else {
1960  viewNet->getNet()->insertAdditional(variableSpeedSign);
1961  // add this VSS as parent of all edges
1962  for (auto i : lanes) {
1963  i->addAdditionalParent(variableSpeedSign);
1964  }
1965  variableSpeedSign->incRef("buildVariableSpeedSign");
1966  }
1967  return variableSpeedSign;
1968  } else {
1969  throw ProcessError("Could not build " + toString(SUMO_TAG_VSS) + " with ID '" + id + "' in netedit; probably declared twice.");
1970  }
1971 }
1972 
1973 
1975 GNEAdditionalHandler::buildVariableSpeedSignStep(GNEViewNet* viewNet, bool allowUndoRedo, GNEAdditional* VSSParent, double time, double speed) {
1976  // create Variable Speed Sign
1977  GNEVariableSpeedSignStep* variableSpeedSignStep = new GNEVariableSpeedSignStep(VSSParent, time, speed);
1978  // add it depending of allow undoRedo
1979  if (allowUndoRedo) {
1980  viewNet->getUndoList()->p_begin("add " + toString(variableSpeedSignStep->getTag()));
1981  viewNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSignStep, true), true);
1982  viewNet->getUndoList()->p_end();
1983  } else {
1984  VSSParent->addAdditionalChild(variableSpeedSignStep);
1985  variableSpeedSignStep->incRef("buildVariableSpeedSignStep");
1986  }
1987  return variableSpeedSignStep;
1988 }
1989 
1990 
1992 GNEAdditionalHandler::buildVaporizer(GNEViewNet* viewNet, bool allowUndoRedo, GNEEdge* edge, double startTime, double end, const std::string& name) {
1993  GNEVaporizer* vaporizer = new GNEVaporizer(viewNet, edge, startTime, end, name);
1994  if (allowUndoRedo) {
1995  viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_VAPORIZER));
1996  viewNet->getUndoList()->add(new GNEChange_Additional(vaporizer, true), true);
1997  viewNet->getUndoList()->p_end();
1998  // center after creation
1999  viewNet->centerTo(vaporizer->getGlID(), false);
2000  } else {
2001  viewNet->getNet()->insertAdditional(vaporizer);
2002  edge->addAdditionalChild(vaporizer);
2003  vaporizer->incRef("buildVaporizer");
2004  }
2005  return vaporizer;
2006 }
2007 
2008 
2009 std::string
2010 GNEAdditionalHandler::getFileName(const SUMOSAXAttributes& attrs, const std::string& base, const bool allowEmpty) {
2011  // get the file name to read further definitions from
2012  bool ok = true;
2013  std::string file = attrs.getOpt<std::string>(SUMO_ATTR_FILE, 0, ok, "");
2014  if (file == "") {
2015  if (allowEmpty) {
2016  return file;
2017  }
2018  WRITE_WARNING("No filename given.");
2019  }
2020  // check whether absolute or relative filenames are given
2021  if (!FileHelpers::isAbsolute(file)) {
2022  return FileHelpers::getConfigurationRelative(base, file);
2023  }
2024  return file;
2025 }
2026 
2027 
2028 double
2029 GNEAdditionalHandler::getPosition(double pos, GNELane& lane, bool friendlyPos , const std::string& additionalID) {
2030  if (pos < 0) {
2031  pos = lane.getLaneShapeLength() + pos;
2032  }
2033  if (pos > lane.getLaneShapeLength()) {
2034  if (friendlyPos) {
2035  pos = lane.getLaneShapeLength() - (double) 0.1;
2036  } else {
2037  WRITE_WARNING("The position of additional '" + additionalID + "' lies beyond the lane's '" + lane.getID() + "' length.");
2038  }
2039  }
2040  return pos;
2041 }
2042 
2043 
2044 bool
2045 GNEAdditionalHandler::fixStoppinPlacePosition(std::string& startPos, std::string& endPos, const double laneLength, const double minLength, const bool friendlyPos) {
2046  // first check if startPos and endPos were defined
2047  if (GNEAttributeCarrier::canParse<double>(startPos) && GNEAttributeCarrier::canParse<double>(endPos)) {
2048  // first parse strings to numerical values
2049  double startPosDouble = GNEAttributeCarrier::parse<double>(startPos);
2050  double endPosDouble = GNEAttributeCarrier::parse<double>(endPos);
2051 
2052  // fix both positions
2053  if (minLength > laneLength) {
2054  return false;
2055  }
2056  if (startPosDouble < 0) {
2057  startPosDouble += laneLength;
2058  }
2059  if (endPosDouble < 0) {
2060  endPosDouble += laneLength;
2061  }
2062  if ((endPosDouble < minLength) || (endPosDouble > laneLength)) {
2063  if (!friendlyPos) {
2064  return false;
2065  }
2066  if (endPosDouble < minLength) {
2067  endPosDouble = minLength;
2068  }
2069  if (endPosDouble > laneLength) {
2070  endPosDouble = laneLength;
2071  }
2072  }
2073  if ((startPosDouble < 0) || (startPosDouble > (endPosDouble - minLength))) {
2074  if (!friendlyPos) {
2075  return false;
2076  }
2077  if (startPosDouble < 0) {
2078  startPosDouble = 0;
2079  }
2080  if (startPosDouble > (endPosDouble - minLength)) {
2081  startPosDouble = (endPosDouble - minLength);
2082  }
2083  }
2084  // Modify original positions
2085  startPos = toString(startPosDouble);
2086  endPos = toString(endPosDouble);
2087  } else if (GNEAttributeCarrier::canParse<double>(startPos)) {
2088  // check that endPosition is valid
2089  if (endPos.empty() || !GNEAttributeCarrier::canParse<double>(endPos)) {
2090  // first parse to double only startPos
2091  double startPosDouble = GNEAttributeCarrier::parse<double>(startPos);
2092  // fix both positions
2093  if (minLength > laneLength) {
2094  return false;
2095  }
2096  if (startPosDouble < 0) {
2097  startPosDouble += laneLength;
2098  }
2099  if ((startPosDouble < 0) || startPosDouble > (laneLength - minLength)) {
2100  if (!friendlyPos) {
2101  return false;
2102  }
2103  if (startPosDouble < 0) {
2104  startPosDouble = 0;
2105  }
2106  if (startPosDouble > (laneLength - minLength)) {
2107  startPosDouble = (laneLength - minLength);
2108  }
2109  }
2110  // Modify only start position
2111  startPos = toString(startPosDouble);
2112  } else {
2113  return false;
2114  }
2115  } else if (GNEAttributeCarrier::canParse<double>(endPos)) {
2116  // check that endPosition is valid
2117  if (startPos.empty() || !GNEAttributeCarrier::canParse<double>(startPos)) {
2118  // first parse to double only endPos
2119  double endPosDouble = GNEAttributeCarrier::parse<double>(endPos);
2120  // fix both positions
2121  if (minLength > laneLength) {
2122  return false;
2123  }
2124  if (endPosDouble < 0) {
2125  endPosDouble += laneLength;
2126  }
2127  if ((endPosDouble < minLength) || (endPosDouble > laneLength)) {
2128  if (!friendlyPos) {
2129  return false;
2130  }
2131  if (endPosDouble < minLength) {
2132  endPosDouble = minLength;
2133  }
2134  if (endPosDouble > laneLength) {
2135  endPosDouble = laneLength;
2136  }
2137  }
2138  if (0 > (endPosDouble - minLength)) {
2139  if (!friendlyPos) {
2140  return false;
2141  }
2142  }
2143  // Modify only end position
2144  endPos = toString(endPosDouble);
2145  } else {
2146  return false;
2147  }
2148  }
2149  return true;
2150 }
2151 
2152 
2153 bool GNEAdditionalHandler::checkAndFixDetectorPositionPosition(double& pos, const double laneLength, const bool friendlyPos) {
2154  if ((pos < 0) || (pos > laneLength)) {
2155  if (!friendlyPos) {
2156  return false;
2157  } else if (pos < 0) {
2158  pos = 0;
2159  } else if (pos > laneLength) {
2160  pos = laneLength;
2161  }
2162  }
2163  return true;
2164 }
2165 
2166 
2167 bool GNEAdditionalHandler::fixE2DetectorPositionPosition(double& pos, double& length, const double laneLength, const bool friendlyPos) {
2168  if ((pos < 0) || ((pos + length) > laneLength)) {
2169  if (!friendlyPos) {
2170  return false;
2171  } else if (pos < 0) {
2172  pos = 0;
2173  } else if (pos > laneLength) {
2174  pos = laneLength;
2175  length = 0;
2176  } else if ((pos + length) > laneLength) {
2177  length = laneLength - pos;
2178  }
2179  }
2180  return true;
2181 }
2182 
2183 
2184 bool
2186  // check that busStopParent is a busStop
2187  assert(busStopParent->getTag() == SUMO_TAG_BUS_STOP);
2188  // check if exist another acces for the same busStop in the given edge
2189  for (auto i : busStopParent->getAdditionalChilds()) {
2190  for (auto j : edge.getLanes()) {
2191  if (i->getAttribute(SUMO_ATTR_LANE) == j->getID()) {
2192  return false;
2193  }
2194  }
2195  }
2196  return true;
2197 }
2198 
2199 
2200 bool
2202  // check that rerouter is correct
2203  assert(rerouter->getTag() == SUMO_TAG_REROUTER);
2204  // declare a vector to keep sorted rerouter childs
2205  std::vector<std::pair<double, double>> sortedIntervals;
2206  // iterate over additional childs
2207  for (auto i : rerouter->getAdditionalChilds()) {
2208  sortedIntervals.push_back(std::make_pair(0., 0.));
2209  // set begin and end
2210  sortedIntervals.back().first = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_BEGIN));
2211  sortedIntervals.back().second = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_END));
2212  }
2213  // add new intervals
2214  sortedIntervals.push_back(std::make_pair(newBegin, newEnd));
2215  // sort childs
2216  std::sort(sortedIntervals.begin(), sortedIntervals.end());
2217  // check overlapping after sorting
2218  for (int i = 0; i < (int)sortedIntervals.size() - 1; i++) {
2219  if (sortedIntervals.at(i).second > sortedIntervals.at(i + 1).first) {
2220  return false;
2221  }
2222  }
2223  return true;
2224 }
2225 
2226 
2227 void
2229  myInsertedElements.push_back(std::make_pair(tag, ""));
2230 }
2231 
2232 
2233 void
2235  myInsertedElements.back().second = id;
2236 }
2237 
2238 
2239 void
2241  if (!myInsertedElements.empty()) {
2242  myInsertedElements.pop_back();
2243  }
2244 }
2245 
2246 
2249  if (myInsertedElements.size() < 2) {
2250  // currently we're finding additional parent in the additional XML root
2251  WRITE_WARNING("A " + toString(myInsertedElements.back().first) + " must be declared within the definition of a " + toString(expectedTag) + ".");
2252  return nullptr;
2253  } else {
2254  GNEAdditional* retrievedAdditional = viewNet->getNet()->retrieveAdditional((myInsertedElements.end() - 2)->first, (myInsertedElements.end() - 2)->second, false);
2255  if (retrievedAdditional == nullptr) {
2256  // additional doesn't exist
2257  WRITE_WARNING("A " + toString((myInsertedElements.end() - 1)->first) + " must be declared within the definition of a " + toString(expectedTag) + ".");
2258  return nullptr;
2259  } else if (retrievedAdditional->getTag() != expectedTag) {
2260  // invalid additional parent
2261  WRITE_WARNING("A " + toString((myInsertedElements.end() - 1)->first) + " cannot be declared within the definition of a " + toString(retrievedAdditional->getTag()) + ".");
2262  return nullptr;
2263  } else {
2264  return retrievedAdditional;
2265  }
2266  }
2267 }
2268 
2269 /****************************************************************************/
void insertAdditional(GNEAdditional *additional)
Insert a additional element int GNENet container.
Definition: GNENet.cpp:2140
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:915
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:1795
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:1298
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:796
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3543
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:1074
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