Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEAdditionalHandler.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Builds trigger objects for netedit
19/****************************************************************************/
20#include <config.h>
21
25#include <netedit/GNENet.h>
27#include <netedit/GNEUndoList.h>
30
31#include "GNEAccess.h"
33#include "GNEBusStop.h"
34#include "GNECalibrator.h"
35#include "GNECalibratorFlow.h"
36#include "GNEChargingStation.h"
38#include "GNEClosingReroute.h"
39#include "GNEContainerStop.h"
40#include "GNEDestProbReroute.h"
44#include "GNELaneAreaDetector.h"
46#include "GNEOverheadWire.h"
47#include "GNEPOI.h"
48#include "GNEParkingArea.h"
50#include "GNEParkingSpace.h"
51#include "GNEPoly.h"
52#include "GNERerouter.h"
53#include "GNERerouterInterval.h"
54#include "GNERerouterSymbol.h"
55#include "GNERouteProbReroute.h"
56#include "GNERouteProbe.h"
57#include "GNETAZ.h"
59#include "GNEVaporizer.h"
63
64// ===========================================================================
65// GNEAdditionalHandler method definitions
66// ===========================================================================
67
68GNEAdditionalHandler::GNEAdditionalHandler(GNENet* net, const std::string& filename, const bool allowUndoRedo) :
69 AdditionalHandler(filename),
70 myNet(net),
71 myAllowUndoRedo(allowUndoRedo) {
72}
73
74
77
78
79bool
81 // nothing to do
82 return true;
83}
84
85
86bool
87GNEAdditionalHandler::buildBusStop(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id,
88 const std::string& laneID, const double startPos, const double endPos, const std::string& name,
89 const std::vector<std::string>& lines, const int personCapacity, const double parkingLength,
90 const RGBColor& color, const bool friendlyPosition, const double angle,
91 const Parameterised::Map& parameters) {
92 // check conditions
93 const auto element = retrieveAdditionalElement(NamespaceIDs::busStops, id);
94 if (!checkElement(SUMO_TAG_BUS_STOP, element)) {
95 return false;
97 return false;
98 } else {
99 // get lane
100 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
101 // check lane
102 if (lane == nullptr) {
104 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
106 } else if (!checkNegative(SUMO_TAG_BUS_STOP, id, SUMO_ATTR_PERSON_CAPACITY, personCapacity, true)) {
107 return false;
108 } else if (!checkNegative(SUMO_TAG_BUS_STOP, id, SUMO_ATTR_PARKING_LENGTH, parkingLength, true)) {
109 return false;
110 } else {
111 // build busStop
112 GNEAdditional* busStop = GNEBusStop::buildBusStop(id, myNet, myFilename, lane, startPos, endPos, name, lines, personCapacity,
113 parkingLength, color, friendlyPosition, angle, parameters);
114 // insert depending of allowUndoRedo
115 if (myAllowUndoRedo) {
116 myNet->getViewNet()->getUndoList()->begin(busStop, TL("add bus stop '") + id + "'");
117 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(busStop, true), true);
119 } else {
121 lane->addChildElement(busStop);
122 busStop->incRef("buildBusStop");
123 }
124 return true;
125 }
126 }
127}
128
129
130bool
131GNEAdditionalHandler::buildTrainStop(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id,
132 const std::string& laneID, const double startPos, const double endPos, const std::string& name,
133 const std::vector<std::string>& lines, const int personCapacity, const double parkingLength,
134 const RGBColor& color, const bool friendlyPosition, const double angle,
135 const Parameterised::Map& parameters) {
136 // check conditions
137 const auto element = retrieveAdditionalElement(NamespaceIDs::busStops, id);
138 if (!checkElement(SUMO_TAG_TRAIN_STOP, element)) {
139 return false;
141 return false;
142 } else {
143 // get lane
144 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
145 // check lane
146 if (lane == nullptr) {
148 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
150 } else if (!checkNegative(SUMO_TAG_TRAIN_STOP, id, SUMO_ATTR_PERSON_CAPACITY, personCapacity, true)) {
151 return false;
152 } else if (!checkNegative(SUMO_TAG_TRAIN_STOP, id, SUMO_ATTR_PARKING_LENGTH, parkingLength, true)) {
153 return false;
154 } else {
155 // build trainStop
156 GNEAdditional* trainStop = GNEBusStop::buildTrainStop(id, myNet, myFilename, lane, startPos, endPos, name, lines, personCapacity,
157 parkingLength, color, friendlyPosition, angle, parameters);
158 // insert depending of allowUndoRedo
159 if (myAllowUndoRedo) {
160 myNet->getViewNet()->getUndoList()->begin(trainStop, TL("add train stop '") + id + "'");
161 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(trainStop, true), true);
163 } else {
165 lane->addChildElement(trainStop);
166 trainStop->incRef("buildTrainStop");
167 }
168 return true;
169 }
170 }
171}
172
173
174bool
175GNEAdditionalHandler::buildAccess(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID,
176 const std::string& pos, const double length, const bool friendlyPos, const Parameterised::Map& parameters) {
177 // get lane
178 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
179 // get busStop (or trainStop)
180 const auto busStop = getAdditionalParent(sumoBaseObject, SUMO_TAG_BUS_STOP);
181 const auto trainStop = getAdditionalParent(sumoBaseObject, SUMO_TAG_TRAIN_STOP);
182 const auto containerStop = getAdditionalParent(sumoBaseObject, SUMO_TAG_CONTAINER_STOP);
183 // check parent
184 if ((busStop == nullptr) && (trainStop == nullptr) && (containerStop == nullptr)) {
187 } else {
189 }
190 }
191 GNEAdditional* accessParent = busStop ? busStop : trainStop ? trainStop : containerStop;
192 // pos double
193 bool validPos = true;
194 double posDouble = 0;
195 if (lane) {
196 if (GNEAttributeCarrier::canParse<double>(pos)) {
197 posDouble = GNEAttributeCarrier::parse<double>(pos);
198 validPos = checkLanePosition(posDouble, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos);
199 } else if (pos == "random" || pos == "doors" || pos == "carriage") {
200 posDouble = INVALID_DOUBLE;
201 } else if (pos.empty()) {
202 posDouble = 0;
203 } else {
204 validPos = false;
205 }
206 }
207 // Check if lane is correct
208 if (lane == nullptr) {
210 } else if (!validPos) {
211 return writeErrorInvalidPosition(SUMO_TAG_ACCESS, accessParent->getID());
212 } else if ((length != -1) && !checkNegative(SUMO_TAG_ACCESS, accessParent->getID(), SUMO_ATTR_LENGTH, length, true)) {
213 return false;
214 } else if (!accessExists(accessParent, lane->getParentEdge())) {
215 return writeError(TLF("Could not build access in netedit; % '%' already owns an access in the edge '%'", accessParent->getTagStr(), accessParent->getID(), lane->getParentEdge()->getID()));
216 } else if (!containerStop && !lane->allowPedestrians()) {
217 // only for busStops and trainStops
218 return writeError(TLF("Could not build access in netedit; The lane '%' doesn't support pedestrians", lane->getID()));
219 } else {
220 // build access
221 GNEAdditional* access = new GNEAccess(accessParent, lane, posDouble, pos, friendlyPos, length, parameters);
222 // insert depending of allowUndoRedo
223 if (myAllowUndoRedo) {
224 myNet->getViewNet()->getUndoList()->begin(access, TL("add access in '") + accessParent->getID() + "'");
225 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(access, true), true);
227 } else {
229 lane->addChildElement(access);
230 accessParent->addChildElement(access);
231 access->incRef("buildAccess");
232 }
233 return true;
234 }
235}
236
237
238bool
239GNEAdditionalHandler::buildContainerStop(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
240 const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines, const int containerCapacity,
241 const double parkingLength, const RGBColor& color, const bool friendlyPosition, const double angle, const Parameterised::Map& parameters) {
242 // check conditions
243 const auto element = retrieveAdditionalElement({SUMO_TAG_CONTAINER_STOP}, id);
244 if (!checkElement(SUMO_TAG_CONTAINER_STOP, element)) {
245 return false;
247 return false;
248 } else {
249 // get lane
250 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
251 // check lane
252 if (lane == nullptr) {
254 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
256 } else if (!checkNegative(SUMO_TAG_CONTAINER_STOP, id, SUMO_ATTR_CONTAINER_CAPACITY, containerCapacity, true)) {
257 return false;
258 } else if (!checkNegative(SUMO_TAG_CONTAINER_STOP, id, SUMO_ATTR_PARKING_LENGTH, parkingLength, true)) {
259 return false;
260 } else {
261 // build containerStop
262 GNEAdditional* containerStop = new GNEContainerStop(id, myNet, myFilename, lane, startPos, endPos, name, lines, containerCapacity, parkingLength,
263 color, friendlyPosition, angle, parameters);
264 // insert depending of allowUndoRedo
265 if (myAllowUndoRedo) {
266 myNet->getViewNet()->getUndoList()->begin(containerStop, TL("add container stop '") + id + "'");
267 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(containerStop, true), true);
269 } else {
271 lane->addChildElement(containerStop);
272 containerStop->incRef("buildContainerStop");
273 }
274 return true;
275 }
276 }
277}
278
279
280bool
282 const std::string& laneID, const double startPos, const double endPos, const std::string& name, const double chargingPower,
283 const double totalPower, const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay, const std::string& chargeType,
284 const SUMOTime waitingTime, const bool friendlyPosition, const std::string& parkingAreaID, const Parameterised::Map& parameters) {
285 // check conditions
286 const auto element = retrieveAdditionalElement({SUMO_TAG_CHARGING_STATION}, id);
288 return false;
290 return false;
291 } else {
292 // get lane
293 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
294 // check lane
295 if (lane == nullptr) {
297 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
299 } else if (!checkNegative(SUMO_TAG_CHARGING_STATION, id, SUMO_ATTR_CHARGINGPOWER, chargingPower, true)) {
300 return false;
301 } else if (!checkNegative(SUMO_TAG_CHARGING_STATION, id, SUMO_ATTR_CHARGEDELAY, chargeDelay, true)) {
302 return false;
303 } else if (!SUMOXMLDefinitions::ChargeTypes.hasString(chargeType)) {
304 return writeError(TLF("Could not build % with ID '%' in netedit; Invalid charge type '%' .", toString(SUMO_TAG_CHARGING_STATION), id, chargeType));
305 } else {
306 // build chargingStation
307 GNEAdditional* chargingStation = new GNEChargingStation(id, myNet, myFilename, lane, startPos, endPos, name, chargingPower, totalPower, efficiency, chargeInTransit,
308 chargeDelay, chargeType, waitingTime, parkingAreaID, friendlyPosition, parameters);
309 // insert depending of allowUndoRedo
310 if (myAllowUndoRedo) {
311 myNet->getViewNet()->getUndoList()->begin(chargingStation, TL("add charging station '") + id + "'");
312 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(chargingStation, true), true);
314 } else {
315 myNet->getAttributeCarriers()->insertAdditional(chargingStation);
316 lane->addChildElement(chargingStation);
317 chargingStation->incRef("buildChargingStation");
318 }
319 return true;
320 }
321 }
322}
323
324
325bool
326GNEAdditionalHandler::buildParkingArea(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
327 const double startPos, const double endPos, const std::string& departPos, const std::string& name,
328 const std::vector<std::string>& badges, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad,
329 const double width, const double length, const double angle, const bool lefthand, const Parameterised::Map& parameters) {
330 // check conditions
331 const auto element = retrieveAdditionalElement({SUMO_TAG_PARKING_AREA}, id);
332 if (!checkElement(SUMO_TAG_PARKING_AREA, element)) {
333 return false;
335 return false;
336 } else {
337 // get lane
338 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
339 // get departPos double
340 const double departPosDouble = GNEAttributeCarrier::canParse<double>(departPos) ? GNEAttributeCarrier::parse<double>(departPos) : 0;
341 // check lane
342 if (lane == nullptr) {
344 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
346 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_ROADSIDE_CAPACITY, roadSideCapacity, true)) {
347 return false;
348 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_WIDTH, width, true)) {
349 return false;
350 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_LENGTH, length, true)) {
351 return false;
352 } else if ((departPosDouble < 0) || (departPosDouble > lane->getParentEdge()->getNBEdge()->getFinalLength())) {
353 return writeError(TLF("Could not build parking area with ID '%' in netedit; Invalid departPos over lane.", id));
354 } else {
355 // build parkingArea
356 GNEAdditional* parkingArea = new GNEParkingArea(id, myNet, myFilename, lane, startPos, endPos, GNEAttributeCarrier::canParse<double>(departPos) ? departPos : "",
357 name, badges, friendlyPosition, roadSideCapacity, onRoad,
358 (width == 0) ? SUMO_const_laneWidth : width, length, angle, lefthand, parameters);
359 // insert depending of allowUndoRedo
360 if (myAllowUndoRedo) {
361 myNet->getViewNet()->getUndoList()->begin(parkingArea, TL("add parking area '") + id + "'");
362 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(parkingArea, true), true);
364 } else {
366 lane->addChildElement(parkingArea);
367 parkingArea->incRef("buildParkingArea");
368 }
369 return true;
370 }
371 }
372}
373
374
375bool
376GNEAdditionalHandler::buildParkingSpace(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const double x, const double y, const double z,
377 const std::string& name, const std::string& width, const std::string& length, const std::string& angle, const double slope,
378 const Parameterised::Map& parameters) {
379 // check width and heights
380 if (!width.empty() && !GNEAttributeCarrier::canParse<double>(width)) {
381 return writeError(TL("Could not build parking space in netedit; attribute width cannot be parse to float."));
382 } else if (!length.empty() && !GNEAttributeCarrier::canParse<double>(length)) {
383 return writeError(TL("Could not build parking space in netedit; attribute length cannot be parse to float."));
384 } else if (!angle.empty() && !GNEAttributeCarrier::canParse<double>(angle)) {
385 return writeError(TL("Could not build parking space in netedit; attribute angle cannot be parse to float."));
386 } else {
387 // get lane
388 GNEAdditional* parkingArea = getAdditionalParent(sumoBaseObject, SUMO_TAG_PARKING_AREA);
389 // get double values
390 const double widthDouble = width.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(width);
391 const double lengthDouble = length.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(length);
392 const double angleDouble = angle.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(angle);
393 // check lane
394 if (parkingArea == nullptr) {
396 } else if ((widthDouble != INVALID_DOUBLE) && !checkNegative(SUMO_TAG_PARKING_SPACE, parkingArea->getID(), SUMO_ATTR_WIDTH, widthDouble, true)) {
397 return false;
398 } else if ((lengthDouble != INVALID_DOUBLE) && !checkNegative(SUMO_TAG_PARKING_SPACE, parkingArea->getID(), SUMO_ATTR_LENGTH, lengthDouble, true)) {
399 return false;
400 } else {
401 // build parkingSpace
402 GNEAdditional* parkingSpace = new GNEParkingSpace(parkingArea, Position(x, y, z), widthDouble, lengthDouble, angleDouble, slope, name, parameters);
403 // insert depending of allowUndoRedo
404 if (myAllowUndoRedo) {
405 myNet->getViewNet()->getUndoList()->begin(parkingSpace, TL("add parking space in '") + parkingArea->getID() + "'");
406 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(parkingSpace, true), true);
408 } else {
410 parkingArea->addChildElement(parkingSpace);
411 parkingSpace->incRef("buildParkingSpace");
412 }
413 // update geometry (due boundaries)
414 parkingSpace->updateGeometry();
415 return true;
416 }
417 }
418}
419
420
421bool
422GNEAdditionalHandler::buildE1Detector(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
423 const double position, const SUMOTime period, const std::string& file, const std::vector<std::string>& vehicleTypes,
424 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
425 const bool friendlyPos, const Parameterised::Map& parameters) {
426 // check conditions
427 const auto element = retrieveAdditionalElement({SUMO_TAG_INDUCTION_LOOP}, id);
428 if (!checkElement(SUMO_TAG_INDUCTION_LOOP, element)) {
429 return false;
431 return false;
432 } else {
433 // get lane
434 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
435 // check lane
436 if (lane == nullptr) {
438 } else if (!checkLanePosition(position, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
440 } else if (!checkNegative(SUMO_TAG_INDUCTION_LOOP, id, SUMO_ATTR_PERIOD, period, true)) {
441 return false;
442 } else if (!checkFileName(SUMO_TAG_INDUCTION_LOOP, id, SUMO_ATTR_FILE, file)) {
443 return false;
444 } else if (!checkListOfVehicleTypes(SUMO_TAG_INDUCTION_LOOP, id, vehicleTypes)) {
445 return false;
446 } else {
447 // build E1
448 GNEAdditional* detectorE1 = new GNEInductionLoopDetector(id, myNet, myFilename, lane, position, period, file, vehicleTypes,
449 nextEdges, detectPersons, name, friendlyPos, parameters);
450 // insert depending of allowUndoRedo
451 if (myAllowUndoRedo) {
452 myNet->getViewNet()->getUndoList()->begin(detectorE1, TL("add induction loop '") + id + "'");
453 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(detectorE1, true), true);
455 } else {
457 lane->addChildElement(detectorE1);
458 detectorE1->incRef("buildDetectorE1");
459 }
460 return true;
461 }
462 }
463}
464
465
466bool
467GNEAdditionalHandler::buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
468 const double pos, const double length, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
469 const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
470 const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
471 const bool friendlyPos, const bool show, const Parameterised::Map& parameters) {
472 // check conditions
475 return false;
477 return false;
478 } else {
479 // get lane
480 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
481 // check lane
482 if (lane == nullptr) {
484 } else {
485 // check friendlyPos in small lanes
486 const bool friendlyPosCheck = checkFriendlyPosSmallLanes(pos, length, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos);
487 if (!checkLanePosition(pos, length, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosCheck)) {
489 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_LENGTH, length, true)) {
490 return false;
491 } else if ((period != -1) && !checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
492 return false;
493 } else if ((trafficLight.size() > 0) && !(SUMOXMLDefinitions::isValidNetID(trafficLight))) {
494 // temporal
495 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; invalid traffic light ID.", id));
496 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
497 return false;
498 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_HALTING_SPEED_THRESHOLD, speedThreshold, true)) {
499 return false;
500 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
501 return false;
502 } else if (!checkFileName(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_FILE, filename)) {
503 return false;
504 } else if (!checkListOfVehicleTypes(SUMO_TAG_LANE_AREA_DETECTOR, id, vehicleTypes)) {
505 return false;
506 } else {
507 // build E2 single lane
508 GNEAdditional* detectorE2 = new GNELaneAreaDetector(id, myNet, myFilename, lane, pos, length, period, trafficLight, filename,
509 vehicleTypes, nextEdges, detectPersons, name, timeThreshold,
510 speedThreshold, jamThreshold, friendlyPosCheck, show, parameters);
511 // insert depending of allowUndoRedo
512 if (myAllowUndoRedo) {
513 myNet->getViewNet()->getUndoList()->begin(detectorE2, TL("add lane area detector '") + id + "'");
514 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
516 } else {
518 lane->addChildElement(detectorE2);
519 detectorE2->incRef("buildDetectorE2");
520 }
521 return true;
522 }
523 }
524 }
525}
526
527
528bool
529GNEAdditionalHandler::buildMultiLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::vector<std::string>& laneIDs,
530 const double pos, const double endPos, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
531 const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
532 const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
533 const bool friendlyPos, const bool show, const Parameterised::Map& parameters) {
534 // check conditions
537 return false;
539 return false;
540 } else {
541 // get lanes
542 const auto lanes = parseLanes(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, laneIDs);
543 // check lanes
544 if (lanes.empty()) {
545 return false;
546 } else {
547 // calculate path
549 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; Lanes aren't consecutives.", id));
550 } else if (!checkMultiLanePosition(
551 pos, lanes.front()->getParentEdge()->getNBEdge()->getFinalLength(),
552 endPos, lanes.back()->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
554 } else if ((period != -1) && !checkNegative(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
555 return false;
556 } else if ((trafficLight.size() > 0) && !(SUMOXMLDefinitions::isValidNetID(trafficLight))) {
557 // temporal
558 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; invalid traffic light ID.", id));
560 return false;
562 return false;
564 return false;
566 return false;
567 } else if (!checkListOfVehicleTypes(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, vehicleTypes)) {
568 return false;
569 } else {
570 // build E2 multilane detector
571 GNEAdditional* detectorE2 = new GNELaneAreaDetector(id, myNet, myFilename, lanes, pos, endPos, period, trafficLight, filename,
572 vehicleTypes, nextEdges, detectPersons, name, timeThreshold,
573 speedThreshold, jamThreshold, friendlyPos, show, parameters);
574 // insert depending of allowUndoRedo
575 if (myAllowUndoRedo) {
576 myNet->getViewNet()->getUndoList()->begin(detectorE2, TL("add lane area detector '") + id + "'");
577 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
579 } else {
581 for (const auto& lane : lanes) {
582 lane->addChildElement(detectorE2);
583 }
584 detectorE2->incRef("buildDetectorE2Multilane");
585 }
586 return true;
587 }
588 }
589 }
590}
591
592
593bool
594GNEAdditionalHandler::buildDetectorE3(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos, const SUMOTime period,
595 const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
596 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold,
597 const bool openEntry, const bool expectedArrival, const Parameterised::Map& parameters) {
598 // check conditions
601 return false;
603 return false;
604 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
605 return false;
606 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
607 return false;
608 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_HALTING_SPEED_THRESHOLD, speedThreshold, true)) {
609 return false;
610 } else if (!checkFileName(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_FILE, filename)) {
611 return false;
612 } else if (!checkListOfVehicleTypes(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, vehicleTypes)) {
613 return false;
614 } else {
615 // build E3
616 GNEAdditional* E3 = new GNEMultiEntryExitDetector(id, myNet, myFilename, pos, period, filename, vehicleTypes, nextEdges, detectPersons,
617 name, timeThreshold, speedThreshold, openEntry, expectedArrival, parameters);
618 // insert depending of allowUndoRedo
619 if (myAllowUndoRedo) {
620 myNet->getViewNet()->getUndoList()->begin(E3, TL("add entry-exit detector '") + id + "'");
621 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(E3, true), true);
623 } else {
625 E3->incRef("buildDetectorE3");
626 }
627 return true;
628 }
629}
630
631
632bool
633GNEAdditionalHandler::buildDetectorEntry(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos,
634 const bool friendlyPos, const Parameterised::Map& parameters) {
635 // get lane
636 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
637 // get E3 parent
639 // Check if Detector E3 parent and lane is correct
640 if (lane == nullptr) {
642 } else if (E3 == nullptr) {
644 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
646 } else {
647 // build entry instant
648 GNEAdditional* entry = new GNEEntryExitDetector(SUMO_TAG_DET_ENTRY, E3, lane, pos, friendlyPos, parameters);
649 // insert depending of allowUndoRedo
650 if (myAllowUndoRedo) {
651 myNet->getViewNet()->getUndoList()->begin(entry, TL("add entry detector in '") + E3->getID() + "'");
652 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(entry, true), true);
654 } else {
656 lane->addChildElement(entry);
657 E3->addChildElement(entry);
658 entry->incRef("buildDetectorEntry");
659 }
660 return true;
661 }
662}
663
664
665bool
666GNEAdditionalHandler::buildDetectorExit(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos,
667 const bool friendlyPos, const Parameterised::Map& parameters) {
668 // get lane
669 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
670 // get E3 parent
672 // Check if Detector E3 parent and lane is correct
673 if (lane == nullptr) {
675 } else if (E3 == nullptr) {
677 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
679 } else {
680 // build exit instant
681 GNEAdditional* exit = new GNEEntryExitDetector(SUMO_TAG_DET_EXIT, E3, lane, pos, friendlyPos, parameters);
682 // insert depending of allowUndoRedo
683 if (myAllowUndoRedo) {
684 myNet->getViewNet()->getUndoList()->begin(exit, TL("add exit detector in '") + E3->getID() + "'");
685 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(exit, true), true);
687 } else {
689 lane->addChildElement(exit);
690 E3->addChildElement(exit);
691 exit->incRef("buildDetectorExit");
692 }
693 return true;
694 }
695}
696
697
698bool
699GNEAdditionalHandler::buildDetectorE1Instant(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID, double pos,
700 const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
701 const std::string& detectPersons, const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters) {
702 // check conditions
705 return false;
707 return false;
708 } else {
709 // get lane
710 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
711 // check lane
712 if (lane == nullptr) {
715 return false;
716 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
718 } else {
719 // build E1 instant
720 GNEAdditional* detectorE1Instant = new GNEInstantInductionLoopDetector(id, myNet, myFilename, lane, pos, filename, vehicleTypes, nextEdges,
721 detectPersons, name, friendlyPos, parameters);
722 // insert depending of allowUndoRedo
723 if (myAllowUndoRedo) {
724 myNet->getViewNet()->getUndoList()->begin(detectorE1Instant, TL("add instant induction loop '") + id + "'");
725 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(detectorE1Instant, true), true);
727 } else {
728 myNet->getAttributeCarriers()->insertAdditional(detectorE1Instant);
729 lane->addChildElement(detectorE1Instant);
730 detectorE1Instant->incRef("buildDetectorE1Instant");
731 }
732 return true;
733 }
734 }
735}
736
737
738bool
739GNEAdditionalHandler::buildLaneCalibrator(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID, const double pos,
740 const std::string& name, const std::string& outfile, const SUMOTime period, const std::string& routeprobeID, const double jamThreshold, const std::vector<std::string>& vTypes,
741 const Parameterised::Map& parameters) {
742 // get lane
743 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
744 // get routeProbe
745 GNEAdditional* routeProbe = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, routeprobeID, false);
746 // check conditions
748 if (!checkElement(GNE_TAG_CALIBRATOR_LANE, element)) {
749 return false;
751 return false;
752 } else if ((routeprobeID.size() > 0) && (routeProbe == nullptr)) {
754 } else if (lane == nullptr) {
756 } else {
757 // check lane
758 if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), false)) {
760 } else if (!checkNegative(GNE_TAG_CALIBRATOR_LANE, id, SUMO_ATTR_PERIOD, period, true)) {
761 return false;
762 } else if (!checkNegative(GNE_TAG_CALIBRATOR_LANE, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
763 return false;
764 } else {
765 // build Calibrator
766 GNEAdditional* calibrator = (routeProbe == nullptr) ?
767 new GNECalibrator(id, myNet, myFilename, lane, pos, period, name, outfile, jamThreshold, vTypes, parameters) :
768 new GNECalibrator(id, myNet, myFilename, lane, pos, period, name, outfile, routeProbe, jamThreshold, vTypes, parameters);
769 // insert depending of allowUndoRedo
770 if (myAllowUndoRedo) {
771 myNet->getViewNet()->getUndoList()->begin(calibrator, TL("add lane calibrator '") + id + "'");
772 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
774 // check if center after creation
777 myNet->getViewNet()->centerTo(calibrator->getPositionInView(), false);
778 }
779 } else {
781 lane->addChildElement(calibrator);
782 if (routeProbe) {
783 routeProbe->addChildElement(calibrator);
784 }
785 calibrator->incRef("buildCalibrator");
786 }
787 return true;
788 }
789 }
790}
791
792
793bool
794GNEAdditionalHandler::buildEdgeCalibrator(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& edgeID, const double pos,
795 const std::string& name, const std::string& outfile, const SUMOTime period, const std::string& routeprobeID, const double jamThreshold, const std::vector<std::string>& vTypes,
796 const Parameterised::Map& parameters) {
797 // get edge
798 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
799 // get routeProbe
800 GNEAdditional* routeProbe = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, routeprobeID, false);
801 // check conditions
803 if (!checkElement(SUMO_TAG_CALIBRATOR, element)) {
804 return false;
806 return false;
807 } else if ((routeprobeID.size() > 0) && (routeProbe == nullptr)) {
809 } else if (edge == nullptr) {
811 } else {
812 if (!checkLanePosition(pos, 0, edge->getChildLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), false)) {
814 } else if (!checkNegative(SUMO_TAG_CALIBRATOR, id, SUMO_ATTR_PERIOD, period, true)) {
815 return false;
816 } else if (!checkNegative(SUMO_TAG_CALIBRATOR, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
817 return false;
818 } else {
819 // build Calibrator
820 GNEAdditional* calibrator = (routeProbe == nullptr) ?
821 new GNECalibrator(id, myNet, myFilename, edge, pos, period, name, outfile, jamThreshold, vTypes, parameters) :
822 new GNECalibrator(id, myNet, myFilename, edge, pos, period, name, outfile, routeProbe, jamThreshold, vTypes, parameters);
823 // insert depending of allowUndoRedo
824 if (myAllowUndoRedo) {
825 myNet->getViewNet()->getUndoList()->begin(calibrator, TL("add calibrator '") + id + "'");
826 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
828 // check if center after creation
831 myNet->getViewNet()->centerTo(calibrator->getPositionInView(), false);
832 }
833 } else {
835 edge->addChildElement(calibrator);
836 if (routeProbe) {
837 routeProbe->addChildElement(calibrator);
838 }
839 calibrator->incRef("buildCalibrator");
840 }
841 return true;
842 }
843 }
844}
845
846
847bool
849 // get vType
850 GNEDemandElement* vType = myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, vehicleParameter.vtypeid.empty() ? DEFAULT_VTYPE_ID : vehicleParameter.vtypeid, false);
851 // get route
853 // get calibrator parent
855 // check parents
856 if (vType == nullptr) {
857 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_VTYPE}, vehicleParameter.vtypeid);
858 } else if (route == nullptr) {
859 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_ROUTE}, vehicleParameter.routeid);
860 } else if (calibrator == nullptr) {
861 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_CALIBRATOR}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
862 } else {
863 // create calibrator flow
864 GNEAdditional* flow = new GNECalibratorFlow(calibrator, vType, route, vehicleParameter);
865 // insert depending of allowUndoRedo
866 if (myAllowUndoRedo) {
867 myNet->getViewNet()->getUndoList()->begin(flow, TL("add calibrator flow in '") + calibrator->getID() + "'");
868 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(flow, true), true);
870 } else {
872 calibrator->addChildElement(flow);
873 route->addChildElement(flow);
874 vType->addChildElement(flow);
875 flow->incRef("buildCalibratorFlow");
876 }
877 return true;
878 }
879}
880
881
882bool
883GNEAdditionalHandler::buildRerouter(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
884 const std::vector<std::string>& edgeIDs, const double prob, const std::string& name,
885 const bool off, const bool optional, const SUMOTime timeThreshold,
886 const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) {
887 // check conditions
888 const auto element = retrieveAdditionalElement({SUMO_TAG_REROUTER}, id);
889 if (!checkElement(SUMO_TAG_REROUTER, element)) {
890 return false;
891 } else if (!checkValidAdditionalID(SUMO_TAG_REROUTER, id)) {
892 return false;
893 } else if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB, prob, true)) {
894 return false;
895 } else if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
896 return false;
897 } else if (!checkListOfVehicleTypes(SUMO_TAG_REROUTER, id, vTypes)) {
898 return false;
899 } else {
900 // parse edges
901 std::vector<GNEEdge*> edges = parseEdges(SUMO_TAG_REROUTER, id, edgeIDs);
902 // check edges
903 if (edges.empty()) {
904 return false;
905 } else {
906 GNEAdditional* rerouter = nullptr;
907 // continue depending of position
908 if (pos == Position::INVALID) {
909 if (edges.size() > 0) {
910 PositionVector laneShape = edges.front()->getChildLanes().front()->getLaneShape();
911 // move to side
912 laneShape.move2side(3);
913 // create rerouter
914 rerouter = new GNERerouter(id, myNet, myFilename, laneShape.positionAtOffset2D(laneShape.length2D() - 6), name, prob, off, optional, timeThreshold, vTypes, parameters);
915 } else {
916 rerouter = new GNERerouter(id, myNet, myFilename, Position(0, 0), name, prob, off, optional, timeThreshold, vTypes, parameters);
917 }
918 } else {
919 rerouter = new GNERerouter(id, myNet, myFilename, pos, name, prob, off, optional, timeThreshold, vTypes, parameters);
920 }
921 // create rerouter Symbols
922 std::vector<GNEAdditional*> rerouterSymbols;
923 for (const auto& edge : edges) {
924 rerouterSymbols.push_back(new GNERerouterSymbol(rerouter, edge));
925 }
926 // insert depending of allowUndoRedo
927 if (myAllowUndoRedo) {
928 myNet->getViewNet()->getUndoList()->begin(rerouter, TL("add rerouter '") + id + "'");
929 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(rerouter, true), true);
930 // add symbols
931 for (const auto& rerouterSymbol : rerouterSymbols) {
932 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(rerouterSymbol, true), true);
933 }
935 } else {
937 rerouter->incRef("buildRerouter");
938 // add symbols into rerouter
939 for (const auto& rerouterSymbol : rerouterSymbols) {
940 rerouter->addChildElement(rerouterSymbol);
941 }
942 // add symbols into edges
943 for (int i = 0; i < (int)edges.size(); i++) {
944 edges.at(i)->addChildElement(rerouterSymbols.at(i));
945 }
946 }
947 return true;
948 }
949 }
950}
951
952
953bool
955 // get rerouter parent
956 GNEAdditional* rerouter = getAdditionalParent(sumoBaseObject, SUMO_TAG_REROUTER);
957 // check if rerouter exist
958 if (rerouter == nullptr) {
959 return writeErrorInvalidParent(SUMO_TAG_INTERVAL, "", {SUMO_TAG_REROUTER}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
960 } else if (!checkNegative(SUMO_TAG_INTERVAL, rerouter->getID(), SUMO_ATTR_BEGIN, begin, true)) {
961 return false;
962 } else if (!checkNegative(SUMO_TAG_INTERVAL, rerouter->getID(), SUMO_ATTR_END, end, true)) {
963 return false;
964 } else if (end < begin) {
965 return writeError(TLF("Could not build interval with ID '%' in netedit; begin is greater than end.", rerouter->getID()));
966 } else {
967 // check if new interval will produce a overlapping
968 if (checkOverlappingRerouterIntervals(rerouter, begin, end)) {
969 // create rerouter interval and add it into rerouter parent
970 GNEAdditional* rerouterInterval = new GNERerouterInterval(rerouter, begin, end);
971 // insert depending of allowUndoRedo
972 if (myAllowUndoRedo) {
973 myNet->getViewNet()->getUndoList()->begin(rerouterInterval, TL("add rerouter interval in '") + rerouter->getID() + "'");
974 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(rerouterInterval, true), true);
976 } else {
977 rerouter->addChildElement(rerouterInterval);
978 rerouterInterval->incRef("buildRerouterInterval");
979 }
980 } else {
981 return writeError(TLF("Could not build interval with begin '%' and end '%' in '%' due overlapping.", toString(begin), toString(end), rerouter->getID()));
982 }
983 // update centering boundary of rerouter parent
984 rerouter->updateCenteringBoundary(true);
985 return true;
986 }
987}
988
989
990bool
991GNEAdditionalHandler::buildClosingLaneReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedLaneID, SVCPermissions permissions) {
992 // get rerouter interval parent
993 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
994 // get closed lane
995 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(closedLaneID, false);
996 // check parents
997 if (lane == nullptr) {
999 } else if (rerouterInterval == nullptr) {
1001 } else {
1002 // create closing lane reroute
1003 GNEAdditional* closingLaneReroute = new GNEClosingLaneReroute(rerouterInterval, lane, permissions);
1004 // add it to interval parent depending of allowUndoRedo
1005 if (myAllowUndoRedo) {
1006 myNet->getViewNet()->getUndoList()->begin(closingLaneReroute, TL("add closing lane reroute in '") + lane->getID() + "'");
1007 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1009 } else {
1010 rerouterInterval->addChildElement(closingLaneReroute);
1011 closingLaneReroute->incRef("buildClosingLaneReroute");
1012 }
1013 // update centering boundary of rerouter parent
1014 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1015 return true;
1016 }
1017}
1018
1019
1020bool
1021GNEAdditionalHandler::buildClosingReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedEdgeID, SVCPermissions permissions) {
1022 // get rerouter interval parent
1023 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1024 // get closed edge
1025 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(closedEdgeID, false);
1026 // check parents
1027 if (edge == nullptr) {
1029 } else if (rerouterInterval == nullptr) {
1031 } else {
1032 // create closing reroute
1033 GNEAdditional* closingLaneReroute = new GNEClosingReroute(rerouterInterval, edge, permissions);
1034 // add it to interval parent depending of allowUndoRedo
1035 if (myAllowUndoRedo) {
1036 myNet->getViewNet()->getUndoList()->begin(closingLaneReroute, TL("add closing reroute in '") + edge->getID() + "'");
1037 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1039 } else {
1040 rerouterInterval->addChildElement(closingLaneReroute);
1041 closingLaneReroute->incRef("buildClosingLaneReroute");
1042 }
1043 // update centering boundary of rerouter parent
1044 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1045 return true;
1046 }
1047}
1048
1049bool
1050GNEAdditionalHandler::buildDestProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newEdgeDestinationID, const double probability) {
1051 // get rerouter interval parent
1052 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1053 // get edge
1054 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(newEdgeDestinationID, false);
1055 // check parents
1056 if (edge == nullptr) {
1057 return writeErrorInvalidParent(SUMO_TAG_DEST_PROB_REROUTE, "", {SUMO_TAG_EDGE}, newEdgeDestinationID);
1058 } else if (rerouterInterval == nullptr) {
1060 } else {
1061 // create dest probability reroute
1062 GNEAdditional* destProbReroute = new GNEDestProbReroute(rerouterInterval, edge, probability);
1063 // add it to interval parent depending of allowUndoRedo
1064 if (myAllowUndoRedo) {
1065 myNet->getViewNet()->getUndoList()->begin(destProbReroute, TL("add dest prob reroute in '") + edge->getID() + "'");
1066 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(destProbReroute, true), true);
1068 } else {
1069 rerouterInterval->addChildElement(destProbReroute);
1070 destProbReroute->incRef("builDestProbReroute");
1071 }
1072 // update centering boundary of rerouter parent
1073 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1074 return true;
1075 }
1076}
1077
1078
1079bool
1080GNEAdditionalHandler::buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newParkignAreaID, const double probability, const bool visible) {
1081 // get rerouter interval parent
1082 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1083 // get parking area
1084 GNEAdditional* parkingArea = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, newParkignAreaID, false);
1085 // check parents
1086 if (parkingArea == nullptr) {
1088 } else if (rerouterInterval == nullptr) {
1090 } else {
1091 // create parking area reroute
1092 GNEAdditional* parkingAreaReroute = new GNEParkingAreaReroute(rerouterInterval, parkingArea, probability, visible);
1093 // add it to interval parent depending of allowUndoRedo
1094 if (myAllowUndoRedo) {
1095 myNet->getViewNet()->getUndoList()->begin(parkingAreaReroute, TL("add parking area reroute in '") + parkingArea->getID() + "'");
1096 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(parkingAreaReroute, true), true);
1098 } else {
1099 rerouterInterval->addChildElement(parkingAreaReroute);
1100 parkingAreaReroute->incRef("builParkingAreaReroute");
1101 }
1102 // update centering boundary of rerouter parent
1103 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1104 return true;
1105 }
1106}
1107
1108
1109bool
1110GNEAdditionalHandler::buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newRouteID, const double probability) {
1111 // get rerouter interval parent
1112 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1113 // get route parent
1115 // check parents
1116 if (route == nullptr) {
1118 } else if (rerouterInterval == nullptr) {
1120 } else {
1121 // create rout prob reroute
1122 GNEAdditional* routeProbReroute = new GNERouteProbReroute(rerouterInterval, route, probability);
1123 // add it to interval parent depending of allowUndoRedo
1124 if (myAllowUndoRedo) {
1125 myNet->getViewNet()->getUndoList()->begin(routeProbReroute, TL("add route prob reroute in '") + route->getID() + "'");
1126 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(routeProbReroute, true), true);
1128 } else {
1129 rerouterInterval->addChildElement(routeProbReroute);
1130 routeProbReroute->incRef("buildRouteProbReroute");
1131 }
1132 // update centering boundary of rerouter parent
1133 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1134 return true;
1135 }
1136}
1137
1138
1139bool
1140GNEAdditionalHandler::buildRouteProbe(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& edgeID, const SUMOTime period,
1141 const std::string& name, const std::string& file, const SUMOTime begin, const std::vector<std::string>& vTypes,
1142 const Parameterised::Map& parameters) {
1143 // check conditions
1144 const auto element = retrieveAdditionalElement({SUMO_TAG_ROUTEPROBE}, id);
1145 if (!checkElement(SUMO_TAG_ROUTEPROBE, element)) {
1146 return false;
1148 return false;
1149 } else {
1150 // get edge
1151 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1152 // check lane
1153 if (edge == nullptr) {
1155 } else if (!checkNegative(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_PERIOD, period, true)) {
1156 return false;
1157 } else if (!checkNegative(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_BEGIN, begin, true)) {
1158 return false;
1159 } else if (!checkFileName(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_FILE, file)) {
1160 return false;
1161 } else {
1162 // build route probe
1163 GNEAdditional* routeProbe = new GNERouteProbe(id, myNet, myFilename, edge, period, name, file, begin, vTypes, parameters);
1164 // insert depending of allowUndoRedo
1165 if (myAllowUndoRedo) {
1166 myNet->getViewNet()->getUndoList()->begin(routeProbe, TL("add route probe '") + id + "'");
1167 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(routeProbe, true), true);
1169 // check if center after creation
1170 if (sumoBaseObject->hasBoolAttribute(GNE_ATTR_CENTER_AFTER_CREATION) &&
1172 myNet->getViewNet()->centerTo(routeProbe->getPositionInView(), false);
1173 }
1174 } else {
1176 edge->addChildElement(routeProbe);
1177 routeProbe->incRef("buildRouteProbe");
1178 }
1179 return true;
1180 }
1181 }
1182}
1183
1184
1185bool
1186GNEAdditionalHandler::buildVariableSpeedSign(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
1187 const std::vector<std::string>& laneIDs, const std::string& name, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) {
1188 // check conditions
1189 const auto element = retrieveAdditionalElement({SUMO_TAG_VSS}, id);
1190 if (!checkElement(SUMO_TAG_VSS, element)) {
1191 return false;
1192 } else if (!checkValidAdditionalID(SUMO_TAG_VSS, id)) {
1193 return false;
1194 } else {
1195 // parse lanes
1196 std::vector<GNELane*> lanes = parseLanes(SUMO_TAG_VSS, id, laneIDs);
1197 // check lane
1198 if (lanes.empty()) {
1199 return false;
1200 } else {
1201 // check vTypes
1202 if (!checkListOfVehicleTypes(SUMO_TAG_VSS, id, vTypes)) {
1203 return false;
1204 } else {
1205 // create VSS
1206 GNEAdditional* variableSpeedSign = new GNEVariableSpeedSign(id, myNet, myFilename, pos, name, vTypes, parameters);
1207 // create VSS Symbols
1208 std::vector<GNEAdditional*> VSSSymbols;
1209 for (const auto& lane : lanes) {
1210 VSSSymbols.push_back(new GNEVariableSpeedSignSymbol(variableSpeedSign, lane));
1211 }
1212 // insert depending of allowUndoRedo
1213 if (myAllowUndoRedo) {
1214 myNet->getViewNet()->getUndoList()->begin(variableSpeedSign, TL("add Variable Speed Sign '") + id + "'");
1215 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(variableSpeedSign, true), true);
1216 for (const auto& VSSSymbol : VSSSymbols) {
1217 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(VSSSymbol, true), true);
1218 }
1220 } else {
1221 myNet->getAttributeCarriers()->insertAdditional(variableSpeedSign);
1222 variableSpeedSign->incRef("buildVariableSpeedSign");
1223 // add symbols into VSS
1224 for (const auto& VSSSymbol : VSSSymbols) {
1225 variableSpeedSign->addChildElement(VSSSymbol);
1226 }
1227 // add symbols into lanes
1228 for (int i = 0; i < (int)lanes.size(); i++) {
1229 lanes.at(i)->addChildElement(VSSSymbols.at(i));
1230 }
1231 }
1232 }
1233 return true;
1234 }
1235 }
1236}
1237
1238
1239bool
1241 // get VSS parent
1243 // check lane
1244 if (VSS == nullptr) {
1245 return writeErrorInvalidParent(SUMO_TAG_STEP, "", {SUMO_TAG_VSS}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1246 } else if (!checkNegative(SUMO_TAG_STEP, VSS->getID(), SUMO_ATTR_TIME, time, true)) {
1247 return false;
1248 } else {
1249 // create Variable Speed Sign
1250 GNEAdditional* variableSpeedSignStep = new GNEVariableSpeedSignStep(VSS, time, speed);
1251 // add it depending of allow undoRedo
1252 if (myAllowUndoRedo) {
1253 myNet->getViewNet()->getUndoList()->begin(variableSpeedSignStep, TL("add VSS Step in '") + VSS->getID() + "'");
1254 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(variableSpeedSignStep, true), true);
1256 } else {
1257 VSS->addChildElement(variableSpeedSignStep);
1258 variableSpeedSignStep->incRef("buildVariableSpeedSignStep");
1259 }
1260 // update centering boundary of VSS parent
1261 VSS->updateCenteringBoundary(true);
1262 return true;
1263 }
1264}
1265
1266
1267bool
1268GNEAdditionalHandler::buildVaporizer(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const SUMOTime beginTime,
1269 const SUMOTime endTime, const std::string& name, const Parameterised::Map& parameters) {
1270 // check conditions
1271 const auto element = retrieveAdditionalElement({SUMO_TAG_VAPORIZER}, edgeID);
1272 if (!checkElement(SUMO_TAG_VAPORIZER, element)) {
1273 return false;
1274 } else if (!checkValidAdditionalID(SUMO_TAG_VAPORIZER, edgeID)) {
1275 return false;
1276 } else {
1277 // get edge
1278 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1279 // check lane
1280 if (edge == nullptr) {
1282 } else if (!checkNegative(SUMO_TAG_VAPORIZER, edge->getID(), SUMO_ATTR_BEGIN, beginTime, true)) {
1283 return false;
1284 } else if (!checkNegative(SUMO_TAG_VAPORIZER, edge->getID(), SUMO_ATTR_END, endTime, true)) {
1285 return false;
1286 } else if (endTime < beginTime) {
1287 return writeError(TLF("Could not build Vaporizer with ID '%' in netedit; begin is greater than end.", edge->getID()));
1288 } else {
1289 // build vaporizer
1290 GNEAdditional* vaporizer = new GNEVaporizer(myNet, myFilename, edge, beginTime, endTime, name, parameters);
1291 // add it depending of allow undoRed
1292 if (myAllowUndoRedo) {
1293 myNet->getViewNet()->getUndoList()->begin(vaporizer, TL("add vaporizer in '") + edge->getID() + "'");
1294 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(vaporizer, true), true);
1296 // check if center after creation
1297 if (sumoBaseObject->hasBoolAttribute(GNE_ATTR_CENTER_AFTER_CREATION) &&
1299 myNet->getViewNet()->centerTo(vaporizer->getPositionInView(), false);
1300 }
1301 } else {
1303 edge->addChildElement(vaporizer);
1304 vaporizer->incRef("buildVaporizer");
1305 }
1306 return true;
1307 }
1308 }
1309}
1310
1311
1312bool
1313GNEAdditionalHandler::buildTAZ(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const PositionVector& shape,
1314 const Position& center, const bool fill, const RGBColor& color, const std::vector<std::string>& edgeIDs,
1315 const std::string& name, const Parameterised::Map& parameters) {
1316 // parse edges
1317 const std::vector<GNEEdge*> edges = parseEdges(SUMO_TAG_TAZ, id, edgeIDs);
1318 if (edges.size() != edgeIDs.size()) {
1319 return false;
1320 } else {
1321 // check TAZShape
1322 PositionVector TAZShape = shape;
1323 if (TAZShape.size() == 0) {
1324 // declare boundary
1325 Boundary TAZBoundary;
1326 for (const auto& edge : edges) {
1327 TAZBoundary.add(edge->getCenteringBoundary());
1328 }
1329 // iterate over children and add sourceSinkEdge boundaries to make a taz shape
1330 for (const auto& sourceSink : sumoBaseObject->getSumoBaseObjectChildren()) {
1331 // check that child is a source or sink elements (to avoid other elements)
1332 if ((sourceSink->getTag() == SUMO_TAG_TAZSOURCE) || (sourceSink->getTag() == SUMO_TAG_TAZSINK)) {
1333 const GNEEdge* sourceSinkEdge = myNet->getAttributeCarriers()->retrieveEdge(sourceSink->getStringAttribute(SUMO_ATTR_ID), false);
1334 if (sourceSinkEdge) {
1335 TAZBoundary.add(sourceSinkEdge->getCenteringBoundary());
1336 }
1337 }
1338 }
1339 // update TAZShape
1340 TAZShape = TAZBoundary.getShape(true);
1341 }
1342 // check TAZ
1343 const auto element = retrieveAdditionalElement({SUMO_TAG_TAZ}, id);
1344 if (!checkElement(SUMO_TAG_TAZ, element)) {
1345 return false;
1346 } else if (!checkValidAdditionalID(SUMO_TAG_TAZ, id)) {
1347 return false;
1348 } else if (TAZShape.size() == 0) {
1349 return writeError(TLF("Could not build TAZ with ID '%' in netedit; Invalid Shape.", id));
1350 } else {
1351 // build TAZ with the given shape
1352 const Position center2 = center == Position::INVALID ? TAZShape.getCentroid() : center;
1353 GNEAdditional* TAZ = new GNETAZ(id, myNet, myFilename, TAZShape, center2, fill, color, name, parameters);
1354 // disable updating geometry of TAZ children during insertion (because in large nets provokes slowdowns)
1356 // add it depending of allow undoRed
1357 if (myAllowUndoRedo) {
1358 myNet->getViewNet()->getUndoList()->begin(TAZ, TL("add TAZ '") + id + "'");
1359 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(TAZ, true), true);
1360 // create TAZEdges
1361 for (const auto& edge : edges) {
1362 // create TAZ Source using GNEChange_Additional
1363 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, 1);
1364 myNet->getViewNet()->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSource, true), true);
1365 // create TAZ Sink using GNEChange_Additional
1366 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, 1);
1367 myNet->getViewNet()->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSink, true), true);
1368 }
1370 } else {
1372 TAZ->incRef("buildTAZ");
1373 for (const auto& edge : edges) {
1374 // create TAZ Source
1375 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, 1);
1377 TAZSource->incRef("buildTAZ");
1378 TAZ->addChildElement(TAZSource);
1379 edge->addChildElement(TAZSource);
1380 // create TAZ Sink
1381 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, 1);
1383 TAZSink->incRef("buildTAZ");
1384 TAZ->addChildElement(TAZSink);
1385 edge->addChildElement(TAZSink);
1386 }
1387 }
1388 // enable updating geometry again and update geometry of TAZ
1390 // update TAZ parent
1391 TAZ->updateGeometry();
1392 return true;
1393 }
1394 }
1395}
1396
1397
1398bool
1399GNEAdditionalHandler::buildTAZSource(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double departWeight) {
1400 // get TAZ parent
1402 // get edge
1403 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1404 // check parents
1405 if (TAZ == nullptr) {
1406 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_TAZ}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1407 } else if (edge == nullptr) {
1408 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_EDGE}, TAZ->getID());
1409 } else {
1410 // declare TAZ Source
1411 GNETAZSourceSink* existentTAZSource = nullptr;
1412 // first check if already exist a TAZ Source for the given edge and TAZ
1413 for (auto it = edge->getChildTAZSourceSinks().begin(); (it != edge->getChildTAZSourceSinks().end()) && !existentTAZSource; it++) {
1414 if (((*it)->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) && ((*it)->getParentAdditionals().front() == TAZ)) {
1415 existentTAZSource = (*it);
1416 }
1417 }
1418 // check if TAZSource has to be created
1419 if (existentTAZSource == nullptr) {
1420 // Create TAZ only with departWeight
1421 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, departWeight);
1422 // add it depending of allow undoRed
1423 if (myAllowUndoRedo) {
1424 myNet->getViewNet()->getUndoList()->begin(TAZ, TL("add TAZ Source in '") + TAZ->getID() + "'");
1425 myNet->getViewNet()->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSource, true), true);
1427 } else {
1429 TAZ->addChildElement(TAZSource);
1430 edge->addChildElement(TAZSource);
1431 TAZSource->incRef("buildTAZSource");
1432 }
1433 } else {
1434 // update TAZ Attribute depending of allow undoRed
1435 if (myAllowUndoRedo) {
1436 myNet->getViewNet()->getUndoList()->begin(TAZ, TL("update TAZ Source in '") + TAZ->getID() + "'");
1437 existentTAZSource->setAttribute(SUMO_ATTR_WEIGHT, toString(departWeight), myNet->getViewNet()->getUndoList());
1439 } else {
1440 existentTAZSource->setAttribute(SUMO_ATTR_WEIGHT, toString(departWeight), nullptr);
1441 }
1442 }
1443 return true;
1444 }
1445}
1446
1447
1448bool
1449GNEAdditionalHandler::buildTAZSink(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double arrivalWeight) {
1450 // get TAZ parent
1452 // get edge
1453 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1454 // check parents
1455 if (TAZ == nullptr) {
1456 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_TAZ}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1457 } else if (edge == nullptr) {
1458 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_EDGE}, TAZ->getID());
1459 } else {
1460 // declare TAZ Sink
1461 GNETAZSourceSink* existentTAZSink = nullptr;
1462 // first check if already exist a TAZ Sink for the given edge and TAZ
1463 for (auto it = edge->getChildTAZSourceSinks().begin(); (it != edge->getChildTAZSourceSinks().end()) && !existentTAZSink; it++) {
1464 if (((*it)->getTagProperty()->getTag() == SUMO_TAG_TAZSINK) && ((*it)->getParentAdditionals().front() == TAZ)) {
1465 existentTAZSink = (*it);
1466 }
1467 }
1468 // check if TAZSink has to be created
1469 if (existentTAZSink == nullptr) {
1470 // Create TAZ only with departWeight
1471 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, arrivalWeight);
1472 // add it depending of allow undoRed
1473 if (myAllowUndoRedo) {
1474 myNet->getViewNet()->getUndoList()->begin(TAZ, TL("add TAZ Sink in '") + TAZ->getID() + "'");
1475 myNet->getViewNet()->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSink, true), true);
1477 } else {
1479 TAZ->addChildElement(TAZSink);
1480 edge->addChildElement(TAZSink);
1481 TAZSink->incRef("buildTAZSink");
1482 }
1483 } else {
1484 // update TAZ Attribute depending of allow undoRed
1485 if (myAllowUndoRedo) {
1486 myNet->getViewNet()->getUndoList()->begin(TAZ, TL("update TAZ Sink in '") + TAZ->getID() + "'");
1487 existentTAZSink->setAttribute(SUMO_ATTR_WEIGHT, toString(arrivalWeight), myNet->getViewNet()->getUndoList());
1489 } else {
1490 existentTAZSink->setAttribute(SUMO_ATTR_WEIGHT, toString(arrivalWeight), nullptr);
1491 }
1492 }
1493 return true;
1494 }
1495}
1496
1497
1498bool
1499GNEAdditionalHandler::buildTractionSubstation(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
1500 const double voltage, const double currentLimit, const Parameterised::Map& parameters) {
1501 // check conditions
1502 const auto element = retrieveAdditionalElement({SUMO_TAG_TRACTION_SUBSTATION}, id);
1504 return false;
1506 return false;
1507 } else if (!checkNegative(SUMO_TAG_TRACTION_SUBSTATION, id, SUMO_ATTR_VOLTAGE, voltage, true)) {
1508 return false;
1509 } else if (!checkNegative(SUMO_TAG_TRACTION_SUBSTATION, id, SUMO_ATTR_CURRENTLIMIT, currentLimit, true)) {
1510 return false;
1511 } else {
1512 // build traction substation
1513 GNEAdditional* tractionSubstation = new GNETractionSubstation(id, myNet, myFilename, pos, voltage, currentLimit, parameters);
1514 // insert depending of allowUndoRedo
1515 if (myAllowUndoRedo) {
1516 myNet->getViewNet()->getUndoList()->begin(tractionSubstation, TL("add traction substation '") + id + "'");
1517 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(tractionSubstation, true), true);
1519 } else {
1520 myNet->getAttributeCarriers()->insertAdditional(tractionSubstation);
1521 tractionSubstation->incRef("buildTractionSubstation");
1522 }
1523 return true;
1524 }
1525}
1526
1527
1528bool
1529GNEAdditionalHandler::buildOverheadWire(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& substationId,
1530 const std::vector<std::string>& laneIDs, const double startPos, const double endPos, const bool friendlyPos,
1531 const std::vector<std::string>& forbiddenInnerLanes, const Parameterised::Map& parameters) {
1532 // check conditions
1535 return false;
1537 return false;
1538 } else {
1539 // get lanes
1540 const auto lanes = parseLanes(SUMO_TAG_OVERHEAD_WIRE_SECTION, id, laneIDs);
1541 // get traction substation
1542 const auto tractionSubstation = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, substationId, false);
1543 // check lanes
1544 if (lanes.empty()) {
1545 return false;
1546 } else {
1547 // calculate path
1549 return writeError(TLF("Could not build overhead wire with ID '%' in netedit; Lanes aren't consecutives.", id));
1550 } else if (!checkMultiLanePosition(
1551 startPos, lanes.front()->getParentEdge()->getNBEdge()->getFinalLength(),
1552 endPos, lanes.back()->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
1554 } else if (tractionSubstation == nullptr) {
1556 } else {
1557 // build Overhead Wire
1558 GNEAdditional* overheadWire = new GNEOverheadWire(id, myNet, myFilename, lanes, tractionSubstation, startPos, endPos, friendlyPos, forbiddenInnerLanes, parameters);
1559 // insert depending of allowUndoRedo
1560 if (myAllowUndoRedo) {
1561 myNet->getViewNet()->getUndoList()->begin(overheadWire, TL("add overhead wire '") + id + "'");
1562 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(overheadWire, true), true);
1564 } else {
1566 for (const auto& lane : lanes) {
1567 lane->addChildElement(overheadWire);
1568 }
1569 overheadWire->incRef("buildOverheadWire");
1570 }
1571 }
1572 return true;
1573 }
1574 }
1575}
1576
1577
1578bool
1579GNEAdditionalHandler::buildOverheadWireClamp(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& /* id */, const std::string& /* overheadWireIDStartClamp */,
1580 const std::string& /* laneIDStartClamp */, const std::string& /* overheadWireIDEndClamp */, const std::string& /* laneIDEndClamp */,
1581 const Parameterised::Map& /* parameters */) {
1582 //
1583 return false;
1584}
1585
1586
1587bool
1588GNEAdditionalHandler::buildPolygon(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& type,
1589 const RGBColor& color, double layer, double angle, const std::string& imgFile, const PositionVector& shape,
1590 bool geo, bool fill, double lineWidth, const std::string& name, const Parameterised::Map& parameters) {
1591 // check conditions
1592 if (type == "jupedsim.walkable_area") {
1593 return buildJpsWalkableArea(sumoBaseObject, id, shape, geo, name, parameters);
1594 } else if (type == "jupedsim.obstacle") {
1595 return buildJpsObstacle(sumoBaseObject, id, shape, geo, name, parameters);
1596 } else {
1597 // check conditions
1598 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1599 if (!checkElement(SUMO_TAG_POLY, element)) {
1600 return false;
1601 } else if (!checkValidAdditionalID(SUMO_TAG_POLY, id)) {
1602 return false;
1603 } else if (!checkNegative(SUMO_TAG_POLY, id, SUMO_ATTR_LINEWIDTH, lineWidth, true)) {
1604 return false;
1605 } else {
1606 // create poly
1607 GNEPoly* poly = new GNEPoly(id, myNet, myFilename, type, shape, geo, fill, lineWidth, color, layer, angle, imgFile, name, parameters);
1608 // add it depending of allow undoRed
1609 if (myAllowUndoRedo) {
1610 myNet->getViewNet()->getUndoList()->begin(poly, TL("add polygon '") + id + "'");
1611 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(poly, true), true);
1613 } else {
1614 // insert shape without allowing undo/redo
1616 poly->incRef("addPolygon");
1617 }
1618 return true;
1619 }
1620 }
1621}
1622
1623
1624bool
1625GNEAdditionalHandler::buildPOI(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1626 const RGBColor& color, const double x, const double y, const std::string& icon, double layer, double angle,
1627 const std::string& imgFile, double width, double height, const std::string& name, const Parameterised::Map& parameters) {
1628 // check conditions
1629 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1630 if (!checkElement(SUMO_TAG_POI, element)) {
1631 return false;
1632 } else if (!checkValidAdditionalID(SUMO_TAG_POI, id)) {
1633 return false;
1634 } else if (!checkNegative(SUMO_TAG_POI, id, SUMO_ATTR_WIDTH, width, true)) {
1635 return false;
1636 } else if (!checkNegative(SUMO_TAG_POI, id, SUMO_ATTR_HEIGHT, height, true)) {
1637 return false;
1638 } else if (!checkFileName(SUMO_TAG_POI, id, SUMO_ATTR_IMGFILE, imgFile)) {
1639 return false;
1640 } else {
1641 // parse position
1642 const auto pos = Position(x, y);
1643 // parse icon
1645 // create POI
1646 GNEPOI* POI = new GNEPOI(id, myNet, myFilename, type, color, pos, false, POIIcon, layer, angle, imgFile, width, height, name, parameters);
1647 // add it depending of allow undoRed
1648 if (myAllowUndoRedo) {
1649 myNet->getViewNet()->getUndoList()->begin(POI, TLF("add POI '%'", id));
1650 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(POI, true), true);
1652 } else {
1653 // insert shape without allowing undo/redo
1655 POI->incRef("addPOI");
1656 }
1657 return true;
1658 }
1659}
1660
1661
1662bool
1663GNEAdditionalHandler::buildPOILane(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1664 const RGBColor& color, const std::string& laneID, double posOverLane, const bool friendlyPos, double posLat,
1665 const std::string& icon, double layer, double angle, const std::string& imgFile, double width, double height,
1666 const std::string& name, const Parameterised::Map& parameters) {
1667 // check conditions
1668 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1669 if (!checkElement(GNE_TAG_POILANE, element)) {
1670 return false;
1671 } else if (!checkValidAdditionalID(GNE_TAG_POILANE, id)) {
1672 return false;
1673 } else if (!checkNegative(GNE_TAG_POILANE, id, SUMO_ATTR_WIDTH, width, true)) {
1674 return false;
1675 } else if (!checkNegative(GNE_TAG_POILANE, id, SUMO_ATTR_HEIGHT, height, true)) {
1676 return false;
1677 } else if (!checkFileName(GNE_TAG_POILANE, id, SUMO_ATTR_IMGFILE, imgFile)) {
1678 return false;
1679 } else {
1680 // get lane
1681 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
1682 // check lane
1683 if (lane == nullptr) {
1685 } else if (!checkLanePosition(posOverLane, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
1687 } else {
1688 // parse icon
1690 // create POI (use GNEAdditional instead GNEPOI for add child references)
1691 GNEAdditional* POILane = new GNEPOI(id, myNet, myFilename, type, color, lane, posOverLane, friendlyPos, posLat, POIIcon, layer,
1692 angle, imgFile, width, height, name, parameters);
1693 // add it depending of allow undoRed
1694 if (myAllowUndoRedo) {
1695 myNet->getViewNet()->getUndoList()->begin(POILane, TLF("add POI lane '%'", id));
1696 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(POILane, true), true);
1698 } else {
1699 // insert shape without allowing undo/redo
1701 lane->addChildElement(POILane);
1702 POILane->incRef("buildPOILane");
1703 }
1704 }
1705 return true;
1706 }
1707}
1708
1709
1710bool
1711GNEAdditionalHandler::buildPOIGeo(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1712 const RGBColor& color, const double lon, const double lat, const std::string& icon, double layer,
1713 double angle, const std::string& imgFile, double width, double height, const std::string& name,
1714 const Parameterised::Map& parameters) {
1715 // check conditions
1716 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1717 if (!checkElement(GNE_TAG_POIGEO, element)) {
1718 return false;
1719 } else if (!checkValidAdditionalID(GNE_TAG_POIGEO, id)) {
1720 return false;
1721 } else if (!checkNegative(GNE_TAG_POIGEO, id, SUMO_ATTR_WIDTH, width, true)) {
1722 return false;
1723 } else if (!checkNegative(GNE_TAG_POIGEO, id, SUMO_ATTR_HEIGHT, height, true)) {
1724 return false;
1725 } else if (!checkFileName(GNE_TAG_POIGEO, id, SUMO_ATTR_IMGFILE, imgFile)) {
1726 return false;
1727 } else if (GeoConvHelper::getFinal().getProjString() == "!") {
1728 return writeError(TLF("Could not build POI with ID '%' in netedit", id) + std::string("; ") + TL("Network requires a geo projection."));
1729 } else {
1730 // parse position
1731 const auto pos = Position(lon, lat);
1732 // parse icon
1734 // create POIGEO
1735 GNEPOI* POIGEO = new GNEPOI(id, myNet, myFilename, type, color, pos, true, POIIcon, layer, angle, imgFile, width, height, name, parameters);
1736 // add it depending of allow undoRed
1737 if (myAllowUndoRedo) {
1738 myNet->getViewNet()->getUndoList()->begin(POIGEO, TLF("add POI GEO '%'", id));
1739 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(POIGEO, true), true);
1741 } else {
1742 // insert shape without allowing undo/redo
1744 POIGEO->incRef("buildPOIGeo");
1745 }
1746 return true;
1747 }
1748}
1749
1750
1751bool
1752GNEAdditionalHandler::buildJpsWalkableArea(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const PositionVector& shape,
1753 bool geo, const std::string& name, const Parameterised::Map& parameters) {
1754 // check conditions
1755 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1756 if (!checkElement(GNE_TAG_JPS_WALKABLEAREA, element)) {
1757 return false;
1759 return false;
1760 } else {
1761 // create walkable area
1762 GNEPoly* walkableArea = new GNEPoly(GNE_TAG_JPS_WALKABLEAREA, id, myNet, myFilename, shape, geo, name, parameters);
1763 // add it depending of allow undoRed
1764 if (myAllowUndoRedo) {
1765 myNet->getViewNet()->getUndoList()->begin(walkableArea, TL("add jps walkable area '") + id + "'");
1766 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(walkableArea, true), true);
1768 } else {
1769 // insert shape without allowing undo/redo
1771 walkableArea->incRef("addWalkableArea");
1772 }
1773 return true;
1774 }
1775}
1776
1777
1778bool
1779GNEAdditionalHandler::buildJpsObstacle(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const PositionVector& shape,
1780 bool geo, const std::string& name, const Parameterised::Map& parameters) {
1781 // check conditions
1782 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1783 if (!checkElement(GNE_TAG_JPS_OBSTACLE, element)) {
1784 return false;
1786 return false;
1787 } else {
1788 // create walkable area
1789 GNEPoly* obstacle = new GNEPoly(GNE_TAG_JPS_OBSTACLE, id, myNet, myFilename, shape, geo, name, parameters);
1790 // add it depending of allow undoRed
1791 if (myAllowUndoRedo) {
1792 myNet->getViewNet()->getUndoList()->begin(obstacle, TL("add jps obstacle '") + id + "'");
1793 myNet->getViewNet()->getUndoList()->add(new GNEChange_Additional(obstacle, true), true);
1795 } else {
1796 // insert shape without allowing undo/redo
1798 obstacle->incRef("addObstacle");
1799 }
1800 return true;
1801 }
1802}
1803
1804
1805bool
1806GNEAdditionalHandler::accessExists(const GNEAdditional* stoppingPlaceParent, const GNEEdge* edge) {
1807 // check if exist another access for the same parent in the given edge
1808 for (const auto& access : stoppingPlaceParent->getChildAdditionals()) {
1809 // check tag
1810 if (access->getTagProperty()->getTag() == SUMO_TAG_ACCESS) {
1811 // check all siblings of the lane
1812 for (const auto& lane : edge->getChildLanes()) {
1813 if (access->getAttribute(SUMO_ATTR_LANE) == lane->getID()) {
1814 return false;
1815 }
1816 }
1817 }
1818 }
1819 return true;
1820}
1821
1822
1823bool
1825 // declare a vector to keep sorted rerouter children
1826 std::vector<std::pair<SUMOTime, SUMOTime>> sortedIntervals;
1827 // iterate over child additional
1828 for (const auto& rerouterChild : rerouter->getChildAdditionals()) {
1829 if (!rerouterChild->getTagProperty()->isSymbol()) {
1830 sortedIntervals.push_back(std::make_pair((SUMOTime)0., (SUMOTime)0.));
1831 // set begin and end
1832 sortedIntervals.back().first = TIME2STEPS(rerouterChild->getAttributeDouble(SUMO_ATTR_BEGIN));
1833 sortedIntervals.back().second = TIME2STEPS(rerouterChild->getAttributeDouble(SUMO_ATTR_END));
1834 }
1835 }
1836 // add new intervals
1837 sortedIntervals.push_back(std::make_pair(newBegin, newEnd));
1838 // sort children
1839 std::sort(sortedIntervals.begin(), sortedIntervals.end());
1840 // check overlapping after sorting
1841 for (int i = 0; i < (int)sortedIntervals.size() - 1; i++) {
1842 if (sortedIntervals.at(i).second > sortedIntervals.at(i + 1).first) {
1843 return false;
1844 }
1845 }
1846 return true;
1847}
1848
1849
1850bool
1851GNEAdditionalHandler::checkLanePosition(double pos, const double length, const double laneLength, const bool friendlyPos) {
1852 if (friendlyPos) {
1853 return true;
1854 }
1855 // adjust from and to (negative means that start at the end of lane and count backward)
1856 if (pos < 0) {
1857 pos += laneLength;
1858 }
1859 // check extremes
1860 if ((pos < 0) || (pos > laneLength)) {
1861 return false;
1862 }
1863 // check pos + length
1864 if ((pos + length) > laneLength) {
1865 return false;
1866 }
1867 // all OK
1868 return true;
1869}
1870
1871
1872bool
1873GNEAdditionalHandler::checkFriendlyPosSmallLanes(double pos, const double length, const double laneLength, const bool friendlyPos) {
1874 if (friendlyPos == true) {
1875 return true;
1876 } else if (OptionsCont::getOptions().getBool("e2.friendlyPos.automatic")) {
1877 // adjust from and to (negative means that start at the end of lane and count backward)
1878 if (pos < 0) {
1879 pos += laneLength;
1880 }
1881 // check extremes
1882 if ((pos < 0) || (pos > laneLength)) {
1883 return true;
1884 }
1885 // check pos + length
1886 if ((pos + length) > laneLength) {
1887 return true;
1888 }
1889 }
1890 return false;
1891}
1892
1893
1894bool
1895GNEAdditionalHandler::checkLaneDoublePosition(double from, double to, const double laneLength, const bool friendlyPos) {
1896 if (friendlyPos) {
1897 return true;
1898 }
1899 // adjust from and to (negative means that start at the end of lane and count backward)
1900 if (from == INVALID_DOUBLE) {
1901 from = 0;
1902 }
1903 if (to == INVALID_DOUBLE) {
1904 to = laneLength;
1905 }
1906 if (from < 0) {
1907 from += laneLength;
1908 }
1909 if (to < 0) {
1910 to += laneLength;
1911 }
1912 if ((to - from) < POSITION_EPS) {
1913 return false;
1914 }
1915 if ((from < 0) || (from > laneLength)) {
1916 return false;
1917 }
1918 if ((to < 0) || (to > laneLength)) {
1919 return false;
1920 }
1921 return true;
1922}
1923
1924
1925void
1926GNEAdditionalHandler::fixLaneDoublePosition(double& from, double& to, const double laneLength) {
1927 // adjust from (negative means that start at the end of lane and count backward)
1928 if (from == INVALID_DOUBLE) {
1929 from = 0;
1930 }
1931 if (to == INVALID_DOUBLE) {
1932 to = laneLength;
1933 }
1934 if (from < 0) {
1935 from += laneLength;
1936 }
1937 if (from < 0) {
1938 from = 0;
1939 } else if (from > laneLength) {
1940 from = laneLength;
1941 }
1942 // adjust to
1943 if (to < 0) {
1944 to += laneLength;
1945 }
1946 if (to < 0) {
1947 to = 0;
1948 } else if (to > laneLength) {
1949 to = laneLength;
1950 }
1951 // to has more priorty as from, and distance between from and to must be >= POSITION_EPS
1952 if ((to - from) < POSITION_EPS) {
1953 if (to >= POSITION_EPS) {
1954 from = to - POSITION_EPS;
1955 } else {
1956 from = 0;
1957 to = POSITION_EPS;
1958 }
1959 }
1960}
1961
1962
1963bool
1964GNEAdditionalHandler::checkMultiLanePosition(double fromPos, const double fromLaneLength, const double toPos, const double tolaneLength, const bool friendlyPos) {
1965 if (friendlyPos) {
1966 return true;
1967 } else {
1968 return (checkLanePosition(fromPos, 0, fromLaneLength, false) && checkLanePosition(toPos, 0, tolaneLength, false));
1969 }
1970}
1971
1972
1975 if (sumoBaseObject->getParentSumoBaseObject() == nullptr) {
1976 return nullptr;
1977 } else if (!sumoBaseObject->getParentSumoBaseObject()->hasStringAttribute(SUMO_ATTR_ID)) {
1978 return nullptr;
1979 } else {
1981 }
1982}
1983
1984
1987 if (sumoBaseObject->getParentSumoBaseObject() == nullptr) {
1988 // parent interval doesn't exist
1989 return nullptr;
1990 } else if (sumoBaseObject->getParentSumoBaseObject()->getParentSumoBaseObject() == nullptr) {
1991 // rerouter parent doesn't exist
1992 return nullptr;
1993 } else if (!sumoBaseObject->getParentSumoBaseObject()->getParentSumoBaseObject()->hasStringAttribute(SUMO_ATTR_ID) || // rerouter ID
1994 !sumoBaseObject->getParentSumoBaseObject()->hasTimeAttribute(SUMO_ATTR_BEGIN) || // interval begin
1995 !sumoBaseObject->getParentSumoBaseObject()->hasTimeAttribute(SUMO_ATTR_END)) { // interval end
1996 return nullptr;
1997 } else {
2002 }
2003}
2004
2005
2006std::vector<GNEEdge*>
2007GNEAdditionalHandler::parseEdges(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& edgeIDs) {
2008 std::vector<GNEEdge*> edges;
2009 for (const auto& edgeID : edgeIDs) {
2010 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
2011 // empty edges aren't allowed. If edge is empty, write error, clear edges and stop
2012 if (edge == nullptr) {
2013 writeError(TLF("Could not build % with ID '%' in netedit; % with ID '%' doesn't exist.", toString(tag), id, toString(SUMO_TAG_EDGE), edgeID));
2014 edges.clear();
2015 return edges;
2016 } else {
2017 edges.push_back(edge);
2018 }
2019 }
2020 return edges;
2021}
2022
2023
2024std::vector<GNELane*>
2025GNEAdditionalHandler::parseLanes(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& laneIDs) {
2026 std::vector<GNELane*> lanes;
2027 for (const auto& laneID : laneIDs) {
2028 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
2029 // empty lanes aren't allowed. If lane is empty, write error, clear lanes and stop
2030 if (lane == nullptr) {
2031 writeError(TLF("Could not build % with ID '%' in netedit; % with ID '%' doesn't exist.", toString(tag), id, toString(SUMO_TAG_LANE), laneID));
2032 lanes.clear();
2033 return lanes;
2034 } else {
2035 lanes.push_back(lane);
2036 }
2037 }
2038 return lanes;
2039}
2040
2041
2043GNEAdditionalHandler::retrieveAdditionalElement(const std::vector<SumoXMLTag> tags, const std::string& id) {
2044 for (const auto& tag : tags) {
2045 // retrieve additional element
2046 auto additionalElement = myNet->getAttributeCarriers()->retrieveAdditional(tag, id, false);
2047 if (additionalElement) {
2048 return additionalElement;
2049 }
2050 }
2051 return nullptr;
2052}
2053
2054
2055bool
2057 if (additionalElement) {
2058 if (myOverwriteElements) {
2059 // delete element
2060 myNet->deleteAdditional(additionalElement, myNet->getViewNet()->getUndoList());
2061 } else if (myRemainElements) {
2062 // duplicated demand
2063 return writeWarningDuplicated(tag, additionalElement->getID(), additionalElement->getTagProperty()->getTag());
2064 } else {
2065 // open overwrite dialog
2066 GNEOverwriteElement overwriteElementDialog(this, additionalElement);
2067 // continue depending of result
2068 if (overwriteElementDialog.getResult() == GNEOverwriteElement::Result::ACCEPT) {
2069 // delete element
2070 myNet->deleteAdditional(additionalElement, myNet->getViewNet()->getUndoList());
2071 } else if (overwriteElementDialog.getResult() == GNEOverwriteElement::Result::CANCEL) {
2072 // duplicated demand
2073 return writeWarningDuplicated(tag, additionalElement->getID(), additionalElement->getTagProperty()->getTag());
2074 } else {
2075 return false;
2076 }
2077 }
2078 }
2079 return true;
2080}
2081
2082/****************************************************************************/
const unsigned char E3[]
Definition E3.cpp:22
long long int SUMOTime
Definition GUI.h:36
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
#define TIME2STEPS(x)
Definition SUMOTime.h:57
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_VTYPE_ID
POIIcon
POI icons.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TRACTION_SUBSTATION
A traction substation.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_CLOSING_REROUTE
reroute of type closing
@ SUMO_TAG_REROUTER
A rerouter.
@ GNE_TAG_MULTI_LANE_AREA_DETECTOR
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_STEP
trigger: a step description
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_DET_ENTRY
an e3 entry point
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
@ SUMO_TAG_ROUTE
description of a route
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_OVERHEAD_WIRE_SECTION
An overhead wire section.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_SOURCE
a source
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ SUMO_TAG_DEST_PROB_REROUTE
probability of destination of a reroute
@ GNE_TAG_POILANE
Point of interest over Lane.
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ SUMO_TAG_DET_EXIT
an e3 exit point
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_CLOSING_LANE_REROUTE
lane of a reroute of type closing
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_LANE
@ GNE_ATTR_CENTER_AFTER_CREATION
flag to center camera after element creation
@ SUMO_ATTR_FILE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_PARKING_LENGTH
@ SUMO_ATTR_VOLTAGE
voltage of the traction substation [V]
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_LINEWIDTH
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_CONTAINER_CAPACITY
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ROADSIDE_CAPACITY
@ SUMO_ATTR_CURRENTLIMIT
current limit of the traction substation [A]
@ SUMO_ATTR_CHARGINGPOWER
@ SUMO_ATTR_PROB
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_CHARGEDELAY
Delay in the charge of charging stations (different of waiting time)
@ SUMO_ATTR_TIME
trigger: the time of the step
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
const double SUMO_const_laneWidth
Definition StdDefs.h:52
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:75
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
Definition Boundary.cpp:444
bool writeError(const std::string &error)
write error and enable error creating element
bool checkValidDetectorID(const SumoXMLTag tag, const std::string &value)
check if the given detector ID is valid
bool checkListOfVehicleTypes(const SumoXMLTag tag, const std::string &id, const std::vector< std::string > &vTypeIDs)
check list of IDs
bool writeWarningDuplicated(const SumoXMLTag tag, const std::string &id, const SumoXMLTag checkedTag)
write warning duplicated element
bool writeErrorInvalidParent(const SumoXMLTag tag, const std::string &id, const std::vector< SumoXMLTag > parentTags, const std::string &parentID)
write error "invalid parent element" giving ids of current and parent element
bool myOverwriteElements
overwrite elements
bool checkValidAdditionalID(const SumoXMLTag tag, const std::string &value)
check if the given additional ID is valid
bool checkFileName(const SumoXMLTag tag, const std::string &id, const SumoXMLAttr attribute, const std::string &value)
check if the given filename is valid
bool writeErrorInvalidPosition(const SumoXMLTag tag, const std::string &id)
write error "invalid position"
const std::string myFilename
filename
bool checkNegative(const SumoXMLTag tag, const std::string &id, const SumoXMLAttr attribute, const int value, const bool canBeZero)
check if the given int value is NOT negative
bool myRemainElements
remain elements
SUMOTime getTimeAttribute(const SumoXMLAttr attr) const
get time attribute
bool hasBoolAttribute(const SumoXMLAttr attr) const
check if current SumoBaseObject has the given bool attribute
bool hasStringAttribute(const SumoXMLAttr attr) const
has function
SumoBaseObject * getParentSumoBaseObject() const
get pointer to mySumoBaseObjectParent SumoBaseObject (if is null, then is the root)
bool hasTimeAttribute(const SumoXMLAttr attr) const
check if current SumoBaseObject has the given time attribute
SumoXMLTag getTag() const
get XML myTag
bool getBoolAttribute(const SumoXMLAttr attr) const
get bool attribute
const std::string & getStringAttribute(const SumoXMLAttr attr) const
get string attribute
const std::vector< SumoBaseObject * > & getSumoBaseObjectChildren() const
get SumoBaseObject children
GNEAdditional * retrieveAdditionalElement(const std::vector< SumoXMLTag > tags, const std::string &id)
get element by ID
bool buildJpsWalkableArea(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, bool geo, const std::string &name, const Parameterised::Map &parameters)
Builds a JuPedSim walkable area using the given values.
bool buildLaneCalibrator(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const std::string &name, const std::string &outfile, const SUMOTime period, const std::string &routeprobe, const double jamThreshold, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)
builds a microscopic calibrator over a lane
bool buildClosingReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &closedEdgeID, SVCPermissions permissions)
builds a closing edge reroute
GNEAdditional * getRerouterIntervalParent(const CommonXMLStructure::SumoBaseObject *sumoBaseObject) const
get rerouter interval parent
std::vector< GNELane * > parseLanes(const SumoXMLTag tag, const std::string &id, const std::vector< std::string > &laneIDs)
parse lanes
void fixLaneDoublePosition(double &from, double &to, const double laneLengt)
fix the given positions over lane
bool checkFriendlyPosSmallLanes(double pos, const double length, const double laneLength, const bool friendlyPos)
check if enable friendly pos in small lanes
bool buildPOI(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double x, const double y, const std::string &icon, const double layer, const double angle, const std::string &imgFile, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)
Builds a POI using the given values.
bool buildPOIGeo(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double lon, const double lat, const std::string &icon, const double layer, const double angle, const std::string &imgFile, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)
Builds a POI in GEO coordinaten using the given values.
bool buildTrainStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int personCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const double angle, const Parameterised::Map &parameters)
Builds a train stop.
bool buildTAZSource(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const double departWeight)
Builds a TAZSource (Traffic Assignment Zone)
bool buildOverheadWireClamp(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &overheadWireIDStartClamp, const std::string &laneIDStartClamp, const std::string &overheadWireIDEndClamp, const std::string &laneIDEndClamp, const Parameterised::Map &parameters)
build overhead wire clamp
bool buildOverheadWire(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &substationId, const std::vector< std::string > &laneIDs, const double startPos, const double endPos, const bool friendlyPos, const std::vector< std::string > &forbiddenInnerLanes, const Parameterised::Map &parameters)
build overhead wire
GNEAdditional * getAdditionalParent(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, SumoXMLTag tag) const
get additional parent
bool buildMultiLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::vector< std::string > &laneIDs, const double pos, const double endPos, const SUMOTime period, const std::string &trafficLight, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show, const Parameterised::Map &parameters)
Builds a multi-lane Area Detector (E2)
bool buildE1Detector(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double position, const SUMOTime period, const std::string &file, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const bool friendlyPos, const Parameterised::Map &parameters)
Builds a induction loop detector (E1)
bool buildVariableSpeedSignStep(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOTime time, const double speed)
Builds a VariableSpeedSign Step.
bool buildPOILane(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const std::string &laneID, const double posOverLane, const bool friendlyPos, const double posLat, const std::string &icon, const double layer, const double angle, const std::string &imgFile, const double width, const double height, const std::string &name, const Parameterised::Map &parameters)
Builds a POI over lane using the given values.
bool buildBusStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int personCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const double angle, const Parameterised::Map &parameters)
Builds a bus stop.
bool buildAccess(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const std::string &pos, const double length, const bool friendlyPos, const Parameterised::Map &parameters)
Builds an Access.
static bool accessExists(const GNEAdditional *stoppingPlaceParent, const GNEEdge *edge)
check if a GNEAccess can be created in the given edge
bool buildDetectorEntry(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const bool friendlyPos, const Parameterised::Map &parameters)
Builds a entry detector (E3)
bool buildContainerStop(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const std::vector< std::string > &lines, const int containerCapacity, const double parkingLength, const RGBColor &color, const bool friendlyPosition, const double angle, const Parameterised::Map &parameters)
Builds a container stop.
bool buildEdgeCalibrator(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &edgeID, const double pos, const std::string &name, const std::string &outfile, const SUMOTime period, const std::string &routeprobe, const double jamThreshold, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)
builds a microscopic calibrator over an edge
bool buildRerouter(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const std::vector< std::string > &edgeIDs, const double prob, const std::string &name, const bool off, const bool optional, const SUMOTime timeThreshold, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)
builds a rerouter
bool buildDestProbReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newEdgeDestinationID, const double probability)
builds a dest prob reroute
bool buildClosingLaneReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &closedLane, SVCPermissions permissions)
builds a closing lane reroute
bool buildCalibratorFlow(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOVehicleParameter &vehicleParameter)
builds a calibrator flow
bool buildVariableSpeedSign(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const std::vector< std::string > &laneIDs, const std::string &name, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)
Builds a VariableSpeedSign (lane speed additional)
bool buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newParkignAreaID, const double probability, const bool visible)
builds a parking area reroute
GNEAdditionalHandler()=delete
invalidate default constructo
bool buildDetectorExit(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &laneID, const double pos, const bool friendlyPos, const Parameterised::Map &parameters)
Builds a exit detector (E3)
bool buildParkingSpace(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const double x, const double y, const double z, const std::string &name, const std::string &width, const std::string &length, const std::string &angle, const double slope, const Parameterised::Map &parameters)
Builds a Parking Space.
bool buildChargingStation(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &name, const double chargingPower, const double totalPower, const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay, const std::string &chargeType, const SUMOTime waitingTime, const bool friendlyPosition, const std::string &parkingAreaID, const Parameterised::Map &parameters)
Builds a charging Station.
const bool myAllowUndoRedo
allow undo/redo
bool checkLaneDoublePosition(double from, const double to, const double laneLength, const bool friendlyPos)
check if the given positions over a lane is valid
std::vector< GNEEdge * > parseEdges(const SumoXMLTag tag, const std::string &id, const std::vector< std::string > &edgeIDs)
parse edges
bool postParserTasks()
run post parser tasks
bool buildTractionSubstation(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const double voltage, const double currentLimit, const Parameterised::Map &parameters)
build traction substation
bool checkLanePosition(double pos, const double length, const double laneLength, const bool friendlyPos)
check if the given position over a lane is valid
bool buildRerouterInterval(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const SUMOTime begin, const SUMOTime end)
builds a rerouter interval
bool buildDetectorE1Instant(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const bool friendlyPos, const Parameterised::Map &parameters)
Builds a Instant Induction Loop Detector (E1Instant)
bool buildTAZSink(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const double arrivalWeight)
Builds a TAZSink (Traffic Assignment Zone)
bool checkElement(const SumoXMLTag tag, GNEAdditional *additional)
check if element exist, and if overwrite
bool buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const double length, const SUMOTime period, const std::string &trafficLight, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show, const Parameterised::Map &parameters)
Builds a single-lane Area Detector (E2)
bool checkOverlappingRerouterIntervals(GNEAdditional *rerouter, const SUMOTime newBegin, const SUMOTime newEnd)
check if an overlapping is produced in rerouter if a interval with certain begin and end is inserted
GNENet * myNet
pointer to GNENet
bool buildJpsObstacle(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, bool geo, const std::string &name, const Parameterised::Map &parameters)
Builds a JuPedSim obstacle using the given values.
bool buildParkingArea(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &departPos, const std::string &name, const std::vector< std::string > &badges, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad, const double width, const double length, const double angle, const bool lefthand, const Parameterised::Map &parameters)
Builds a Parking Area.
bool buildTAZ(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, const Position &center, const bool fill, const RGBColor &color, const std::vector< std::string > &edgeIDs, const std::string &name, const Parameterised::Map &parameters)
Builds a TAZ (Traffic Assignment Zone)
bool buildVaporizer(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const SUMOTime from, const SUMOTime endTime, const std::string &name, const Parameterised::Map &parameters)
Builds a vaporizer (lane speed additional)
bool buildRouteProbe(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &edgeID, const SUMOTime period, const std::string &name, const std::string &file, const SUMOTime begin, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)
builds a Route probe
bool buildDetectorE3(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const SUMOTime period, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const bool openEntry, const bool expectedArrival, const Parameterised::Map &parameters)
Builds a multi entry exit detector (E3)
bool buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newRouteID, const double probability)
builds a route prob reroute
bool buildPolygon(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double layer, const double angle, const std::string &imgFile, const PositionVector &shape, const bool geo, const bool fill, const double lineWidth, const std::string &name, const Parameterised::Map &parameters)
Builds a polygon using the given values.
bool checkMultiLanePosition(double fromPos, const double fromLaneLength, const double toPos, const double tolaneLength, const bool friendlyPos)
check if the given positions over two lanes are valid
virtual void updateCenteringBoundary(const bool updateGrid)=0
update centering boundary (implies change in RTREE)
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
virtual Position getPositionInView() const =0
Returns position of additional in view.
const std::string getID() const override
get ID (all Attribute Carriers have one)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
virtual void updateGeometry()=0
update pre-computed geometry information
static GNEBusStop * buildTrainStop(GNENet *net)
default constructor
static GNEBusStop * buildBusStop(GNENet *net)
default constructor
Result getResult() const
get result to indicate if this dialog was closed accepting or rejecting changes
Definition GNEDialog.cpp:96
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:753
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEEdge.cpp:626
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > & getChildTAZSourceSinks() const
return child TAZSourceSinks (Set)
void addChildElement(ChildType *element)
add child without updating parent (ONLY used if we're creating elements without undo-redo)
bool allowPedestrians() const
check if current lane allow pedestrians
Definition GNELane.cpp:220
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:214
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
void insertTAZSourceSink(GNETAZSourceSink *sourceSink)
Insert a sourceSink element in container.
GNEAdditional * retrieveRerouterInterval(const std::string &rerouterID, const SUMOTime begin, const SUMOTime end) const
Returns the rerouter interval defined by given begin and end.
void insertAdditional(GNEAdditional *additional)
Insert a additional element in container.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition GNENet.cpp:712
void disableUpdateGeometry()
disable update geometry of elements after inserting or removing an element in net
Definition GNENet.cpp:2873
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
void enableUpdateGeometry()
Definition GNENet.cpp:2867
void incRef(const std::string &debugMsg="")
Increase reference.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
GNEUndoList * getUndoList() const
get the undoList object
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition NBEdge.cpp:4884
static const std::vector< SumoXMLTag > busStops
busStops namespace
static const std::vector< SumoXMLTag > laneAreaDetectors
lane area detectors namespace
static const std::vector< SumoXMLTag > POIs
POIs namespace.
static const std::vector< SumoXMLTag > calibrators
calibrators namespace
static const std::vector< SumoXMLTag > polygons
polygon namespace
static OptionsCont & getOptions()
Retrieves the options.
C++ TraCI client API implementation.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:323
A list of positions.
double length2D() const
Returns the length.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Position positionAtOffset2D(double pos, double lateralOffset=0, bool extrapolateBeyond=false) const
Returns the position at the given length.
Structure representing possible vehicle parameter.
std::string vtypeid
The vehicle's type id.
std::string routeid
The vehicle's route id.
static StringBijection< ChargeType > ChargeTypes
charge type
static StringBijection< POIIcon > POIIcons
POI icon values.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
bool hasString(const std::string &str) const
check if the given string exist
T get(const std::string &str) const
get key