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-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Builds trigger objects for netedit
19/****************************************************************************/
20#include <config.h>
21
26#include <netedit/GNENet.h>
28#include <netedit/GNEUndoList.h>
31
32#include "GNEAccess.h"
34#include "GNEBusStop.h"
35#include "GNECalibrator.h"
36#include "GNECalibratorFlow.h"
37#include "GNEChargingStation.h"
39#include "GNEClosingReroute.h"
40#include "GNEContainerStop.h"
41#include "GNEDestProbReroute.h"
45#include "GNELaneAreaDetector.h"
47#include "GNEOverheadWire.h"
48#include "GNEPOI.h"
49#include "GNEParkingArea.h"
51#include "GNEParkingSpace.h"
52#include "GNEPoly.h"
53#include "GNERerouter.h"
54#include "GNERerouterInterval.h"
55#include "GNERerouterSymbol.h"
56#include "GNERouteProbReroute.h"
57#include "GNERouteProbe.h"
58#include "GNETAZ.h"
60#include "GNEVaporizer.h"
64
65// ===========================================================================
66// GNEAdditionalHandler method definitions
67// ===========================================================================
68
69GNEAdditionalHandler::GNEAdditionalHandler(GNENet* net, FileBucket* fileBucket, const bool allowUndoRedo) :
70 AdditionalHandler(fileBucket),
71 myNet(net),
72 myAllowUndoRedo(allowUndoRedo) {
73}
74
75
77 // update options based in current buckets
79}
80
81
82bool
83GNEAdditionalHandler::buildBusStop(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id,
84 const std::string& laneID, const double startPos, const double endPos, const std::string& name,
85 const std::vector<std::string>& lines, const int personCapacity, const double parkingLength,
86 const RGBColor& color, const bool friendlyPosition, const double angle,
87 const Parameterised::Map& parameters) {
88 // check conditions
89 const auto element = retrieveAdditionalElement(NamespaceIDs::busStops, id);
90 if (!checkElement(SUMO_TAG_BUS_STOP, element)) {
91 return false;
93 return false;
94 } else {
95 // get lane
96 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
97 // check lane
98 if (lane == nullptr) {
100 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
102 } else if (!checkNegative(SUMO_TAG_BUS_STOP, id, SUMO_ATTR_PERSON_CAPACITY, personCapacity, true)) {
103 return false;
104 } else if (!checkNegative(SUMO_TAG_BUS_STOP, id, SUMO_ATTR_PARKING_LENGTH, parkingLength, true)) {
105 return false;
106 } else {
107 // build busStop
108 GNEAdditional* busStop = GNEBusStop::buildBusStop(id, myNet, myFileBucket, lane, startPos, endPos, name, lines, personCapacity,
109 parkingLength, color, friendlyPosition, angle, parameters);
110 // insert depending of allowUndoRedo
111 if (myAllowUndoRedo) {
112 myNet->getUndoList()->begin(busStop, TL("add bus stop '") + id + "'");
113 myNet->getUndoList()->add(new GNEChange_Additional(busStop, true), true);
114 myNet->getUndoList()->end();
115 } else {
117 lane->addChildElement(busStop);
118 busStop->incRef("buildBusStop");
119 }
120 return true;
121 }
122 }
123}
124
125
126bool
127GNEAdditionalHandler::buildTrainStop(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id,
128 const std::string& laneID, const double startPos, const double endPos, const std::string& name,
129 const std::vector<std::string>& lines, const int personCapacity, const double parkingLength,
130 const RGBColor& color, const bool friendlyPosition, const double angle,
131 const Parameterised::Map& parameters) {
132 // check conditions
133 const auto element = retrieveAdditionalElement(NamespaceIDs::busStops, id);
134 if (!checkElement(SUMO_TAG_TRAIN_STOP, element)) {
135 return false;
137 return false;
138 } else {
139 // get lane
140 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
141 // check lane
142 if (lane == nullptr) {
144 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
146 } else if (!checkNegative(SUMO_TAG_TRAIN_STOP, id, SUMO_ATTR_PERSON_CAPACITY, personCapacity, true)) {
147 return false;
148 } else if (!checkNegative(SUMO_TAG_TRAIN_STOP, id, SUMO_ATTR_PARKING_LENGTH, parkingLength, true)) {
149 return false;
150 } else {
151 // build trainStop
152 GNEAdditional* trainStop = GNEBusStop::buildTrainStop(id, myNet, myFileBucket, lane, startPos, endPos, name, lines, personCapacity,
153 parkingLength, color, friendlyPosition, angle, parameters);
154 // insert depending of allowUndoRedo
155 if (myAllowUndoRedo) {
156 myNet->getUndoList()->begin(trainStop, TL("add train stop '") + id + "'");
157 myNet->getUndoList()->add(new GNEChange_Additional(trainStop, true), true);
158 myNet->getUndoList()->end();
159 } else {
161 lane->addChildElement(trainStop);
162 trainStop->incRef("buildTrainStop");
163 }
164 return true;
165 }
166 }
167}
168
169
170bool
171GNEAdditionalHandler::buildAccess(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID,
172 const std::string& pos, const double length, const bool friendlyPos, const Parameterised::Map& parameters) {
173 // get lane
174 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
175 // get busStop (or trainStop)
176 const auto busStop = getAdditionalParent(sumoBaseObject, SUMO_TAG_BUS_STOP);
177 const auto trainStop = getAdditionalParent(sumoBaseObject, SUMO_TAG_TRAIN_STOP);
178 const auto containerStop = getAdditionalParent(sumoBaseObject, SUMO_TAG_CONTAINER_STOP);
179 // check parent
180 if ((busStop == nullptr) && (trainStop == nullptr) && (containerStop == nullptr)) {
183 } else {
185 }
186 }
187 GNEAdditional* accessParent = busStop ? busStop : trainStop ? trainStop : containerStop;
188 // pos double
189 bool validPos = true;
190 double posDouble = 0;
191 if (lane) {
192 if (GNEAttributeCarrier::canParse<double>(pos)) {
193 posDouble = GNEAttributeCarrier::parse<double>(pos);
194 validPos = checkLanePosition(posDouble, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos);
195 } else if (pos == "random" || pos == "doors" || pos == "carriage") {
196 posDouble = INVALID_DOUBLE;
197 } else if (pos.empty()) {
198 posDouble = 0;
199 } else {
200 validPos = false;
201 }
202 }
203 // Check if lane is correct
204 if (lane == nullptr) {
206 } else if (!validPos) {
207 return writeErrorInvalidPosition(SUMO_TAG_ACCESS, accessParent->getID());
208 } else if ((length != -1) && !checkNegative(SUMO_TAG_ACCESS, accessParent->getID(), SUMO_ATTR_LENGTH, length, true)) {
209 return false;
210 } else if (!accessExists(accessParent, lane->getParentEdge())) {
211 return writeError(TLF("Could not build access in netedit; % '%' already owns an access in the edge '%'", accessParent->getTagStr(), accessParent->getID(), lane->getParentEdge()->getID()));
212 } else if (!containerStop && !lane->allowPedestrians()) {
213 // only for busStops and trainStops
214 return writeError(TLF("Could not build access in netedit; The lane '%' doesn't support pedestrians", lane->getID()));
215 } else {
216 // build access
217 GNEAdditional* access = new GNEAccess(accessParent, lane, posDouble, pos, friendlyPos, length, parameters);
218 // insert depending of allowUndoRedo
219 if (myAllowUndoRedo) {
220 myNet->getUndoList()->begin(access, TL("add access in '") + accessParent->getID() + "'");
221 myNet->getUndoList()->add(new GNEChange_Additional(access, true), true);
222 myNet->getUndoList()->end();
223 } else {
225 lane->addChildElement(access);
226 accessParent->addChildElement(access);
227 access->incRef("buildAccess");
228 }
229 return true;
230 }
231}
232
233
234bool
235GNEAdditionalHandler::buildContainerStop(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
236 const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines, const int containerCapacity,
237 const double parkingLength, const RGBColor& color, const bool friendlyPosition, const double angle, const Parameterised::Map& parameters) {
238 // check conditions
239 const auto element = retrieveAdditionalElement({SUMO_TAG_CONTAINER_STOP}, id);
240 if (!checkElement(SUMO_TAG_CONTAINER_STOP, element)) {
241 return false;
243 return false;
244 } else {
245 // get lane
246 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
247 // check lane
248 if (lane == nullptr) {
250 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
252 } else if (!checkNegative(SUMO_TAG_CONTAINER_STOP, id, SUMO_ATTR_CONTAINER_CAPACITY, containerCapacity, true)) {
253 return false;
254 } else if (!checkNegative(SUMO_TAG_CONTAINER_STOP, id, SUMO_ATTR_PARKING_LENGTH, parkingLength, true)) {
255 return false;
256 } else {
257 // build containerStop
258 GNEAdditional* containerStop = new GNEContainerStop(id, myNet, myFileBucket, lane, startPos, endPos, name, lines, containerCapacity, parkingLength,
259 color, friendlyPosition, angle, parameters);
260 // insert depending of allowUndoRedo
261 if (myAllowUndoRedo) {
262 myNet->getUndoList()->begin(containerStop, TL("add container stop '") + id + "'");
263 myNet->getUndoList()->add(new GNEChange_Additional(containerStop, true), true);
264 myNet->getUndoList()->end();
265 } else {
267 lane->addChildElement(containerStop);
268 containerStop->incRef("buildContainerStop");
269 }
270 return true;
271 }
272 }
273}
274
275
276bool
278 const std::string& laneID, const double startPos, const double endPos, const std::string& name, const double chargingPower,
279 const double totalPower, const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay, const std::string& chargeType,
280 const SUMOTime waitingTime, const bool friendlyPosition, const std::string& parkingAreaID, const Parameterised::Map& parameters) {
281 // check conditions
282 const auto element = retrieveAdditionalElement({SUMO_TAG_CHARGING_STATION}, id);
284 return false;
286 return false;
287 } else {
288 // get lane
289 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
290 // check lane
291 if (lane == nullptr) {
293 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
295 } else if (!checkNegative(SUMO_TAG_CHARGING_STATION, id, SUMO_ATTR_CHARGINGPOWER, chargingPower, true)) {
296 return false;
297 } else if (!checkNegative(SUMO_TAG_CHARGING_STATION, id, SUMO_ATTR_TOTALPOWER, totalPower, true)) {
298 return false;
299 } else if (!checkNegative(SUMO_TAG_CHARGING_STATION, id, SUMO_ATTR_CHARGEDELAY, chargeDelay, true)) {
300 return false;
301 } else if (!SUMOXMLDefinitions::ChargeTypes.hasString(chargeType)) {
302 return writeError(TLF("Could not build % with ID '%' in netedit; Invalid charge type '%' .", toString(SUMO_TAG_CHARGING_STATION), id, chargeType));
303 } else {
304 // build chargingStation
305 GNEAdditional* chargingStation = new GNEChargingStation(id, myNet, myFileBucket, lane, startPos, endPos, name, chargingPower, totalPower, efficiency, chargeInTransit,
306 chargeDelay, chargeType, waitingTime, parkingAreaID, friendlyPosition, parameters);
307 // insert depending of allowUndoRedo
308 if (myAllowUndoRedo) {
309 myNet->getUndoList()->begin(chargingStation, TL("add charging station '") + id + "'");
310 myNet->getUndoList()->add(new GNEChange_Additional(chargingStation, true), true);
311 myNet->getUndoList()->end();
312 } else {
313 myNet->getAttributeCarriers()->insertAdditional(chargingStation);
314 lane->addChildElement(chargingStation);
315 chargingStation->incRef("buildChargingStation");
316 }
317 return true;
318 }
319 }
320}
321
322
323bool
324GNEAdditionalHandler::buildParkingArea(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
325 const double startPos, const double endPos, const std::string& departPos, const std::string& name,
326 const std::vector<std::string>& badges, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad,
327 const double width, const double length, const double angle, const bool lefthand, const Parameterised::Map& parameters) {
328 // check conditions
329 const auto element = retrieveAdditionalElement({SUMO_TAG_PARKING_AREA}, id);
330 if (!checkElement(SUMO_TAG_PARKING_AREA, element)) {
331 return false;
333 return false;
334 } else {
335 // get lane
336 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
337 // get departPos double
338 const double departPosDouble = GNEAttributeCarrier::canParse<double>(departPos) ? GNEAttributeCarrier::parse<double>(departPos) : 0;
339 // check lane
340 if (lane == nullptr) {
342 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
344 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_ROADSIDE_CAPACITY, roadSideCapacity, true)) {
345 return false;
346 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_WIDTH, width, true)) {
347 return false;
348 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_LENGTH, length, true)) {
349 return false;
350 } else if ((departPosDouble < 0) || (departPosDouble > lane->getParentEdge()->getNBEdge()->getFinalLength())) {
351 return writeError(TLF("Could not build parking area with ID '%' in netedit; Invalid departPos over lane.", id));
352 } else {
353 // build parkingArea
354 GNEAdditional* parkingArea = new GNEParkingArea(id, myNet, myFileBucket, lane, startPos, endPos, GNEAttributeCarrier::canParse<double>(departPos) ? departPos : "",
355 name, badges, friendlyPosition, roadSideCapacity, onRoad,
356 (width == 0) ? SUMO_const_laneWidth : width, length, angle, lefthand, parameters);
357 // insert depending of allowUndoRedo
358 if (myAllowUndoRedo) {
359 myNet->getUndoList()->begin(parkingArea, TL("add parking area '") + id + "'");
360 myNet->getUndoList()->add(new GNEChange_Additional(parkingArea, true), true);
361 myNet->getUndoList()->end();
362 } else {
364 lane->addChildElement(parkingArea);
365 parkingArea->incRef("buildParkingArea");
366 }
367 return true;
368 }
369 }
370}
371
372
373bool
374GNEAdditionalHandler::buildParkingSpace(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const double x, const double y, const double z,
375 const std::string& name, const std::string& width, const std::string& length, const std::string& angle, const double slope,
376 const Parameterised::Map& parameters) {
377 // check width and heights
378 if (!width.empty() && !GNEAttributeCarrier::canParse<double>(width)) {
379 return writeError(TL("Could not build parking space in netedit; attribute width cannot be parse to float."));
380 } else if (!length.empty() && !GNEAttributeCarrier::canParse<double>(length)) {
381 return writeError(TL("Could not build parking space in netedit; attribute length cannot be parse to float."));
382 } else if (!angle.empty() && !GNEAttributeCarrier::canParse<double>(angle)) {
383 return writeError(TL("Could not build parking space in netedit; attribute angle cannot be parse to float."));
384 } else {
385 // get lane
386 GNEAdditional* parkingArea = getAdditionalParent(sumoBaseObject, SUMO_TAG_PARKING_AREA);
387 // get double values
388 const double widthDouble = width.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(width);
389 const double lengthDouble = length.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(length);
390 const double angleDouble = angle.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(angle);
391 // check lane
392 if (parkingArea == nullptr) {
394 } else if ((widthDouble != INVALID_DOUBLE) && !checkNegative(SUMO_TAG_PARKING_SPACE, parkingArea->getID(), SUMO_ATTR_WIDTH, widthDouble, true)) {
395 return false;
396 } else if ((lengthDouble != INVALID_DOUBLE) && !checkNegative(SUMO_TAG_PARKING_SPACE, parkingArea->getID(), SUMO_ATTR_LENGTH, lengthDouble, true)) {
397 return false;
398 } else {
399 // build parkingSpace
400 GNEAdditional* parkingSpace = new GNEParkingSpace(parkingArea, Position(x, y, z), widthDouble, lengthDouble, angleDouble, slope, name, parameters);
401 // insert depending of allowUndoRedo
402 if (myAllowUndoRedo) {
403 myNet->getUndoList()->begin(parkingSpace, TL("add parking space in '") + parkingArea->getID() + "'");
404 myNet->getUndoList()->add(new GNEChange_Additional(parkingSpace, true), true);
405 myNet->getUndoList()->end();
406 } else {
408 parkingArea->addChildElement(parkingSpace);
409 parkingSpace->incRef("buildParkingSpace");
410 }
411 // update geometry (due boundaries)
412 parkingSpace->updateGeometry();
413 return true;
414 }
415 }
416}
417
418
419bool
420GNEAdditionalHandler::buildE1Detector(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
421 const double position, const SUMOTime period, const std::string& file, const std::vector<std::string>& vehicleTypes,
422 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
423 const bool friendlyPos, const Parameterised::Map& parameters) {
424 // check conditions
425 const auto element = retrieveAdditionalElement({SUMO_TAG_INDUCTION_LOOP}, id);
426 if (!checkElement(SUMO_TAG_INDUCTION_LOOP, element)) {
427 return false;
429 return false;
430 } else {
431 // get lane
432 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
433 // check lane
434 if (lane == nullptr) {
436 } else if (!checkLanePosition(position, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
438 } else if (!checkNegative(SUMO_TAG_INDUCTION_LOOP, id, SUMO_ATTR_PERIOD, period, true)) {
439 return false;
440 } else if (!checkFileName(SUMO_TAG_INDUCTION_LOOP, id, SUMO_ATTR_FILE, file)) {
441 return false;
442 } else if (!checkListOfVehicleTypes(SUMO_TAG_INDUCTION_LOOP, id, vehicleTypes)) {
443 return false;
444 } else {
445 // build E1
446 GNEAdditional* detectorE1 = new GNEInductionLoopDetector(id, myNet, myFileBucket, lane, position, period, file, vehicleTypes,
447 nextEdges, detectPersons, name, friendlyPos, parameters);
448 // insert depending of allowUndoRedo
449 if (myAllowUndoRedo) {
450 myNet->getUndoList()->begin(detectorE1, TL("add induction loop '") + id + "'");
451 myNet->getUndoList()->add(new GNEChange_Additional(detectorE1, true), true);
452 myNet->getUndoList()->end();
453 } else {
455 lane->addChildElement(detectorE1);
456 detectorE1->incRef("buildDetectorE1");
457 }
458 return true;
459 }
460 }
461}
462
463
464bool
465GNEAdditionalHandler::buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
466 const double pos, const double length, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
467 const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
468 const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
469 const bool friendlyPos, const bool show, const Parameterised::Map& parameters) {
470 // check conditions
473 return false;
475 return false;
476 } else {
477 // get lane
478 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
479 // check lane
480 if (lane == nullptr) {
482 } else {
483 // check friendlyPos in small lanes
484 const bool friendlyPosCheck = checkFriendlyPosSmallLanes(pos, length, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos);
485 if (!checkLanePosition(pos, length, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosCheck)) {
487 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_LENGTH, length, true)) {
488 return false;
489 } else if ((period != -1) && !checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
490 return false;
491 } else if ((trafficLight.size() > 0) && !(SUMOXMLDefinitions::isValidNetID(trafficLight))) {
492 // temporal
493 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; invalid traffic light ID.", id));
494 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
495 return false;
496 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_HALTING_SPEED_THRESHOLD, speedThreshold, true)) {
497 return false;
498 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
499 return false;
500 } else if (!checkFileName(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_FILE, filename)) {
501 return false;
502 } else if (!checkListOfVehicleTypes(SUMO_TAG_LANE_AREA_DETECTOR, id, vehicleTypes)) {
503 return false;
504 } else {
505 // build E2 single lane
506 GNEAdditional* detectorE2 = new GNELaneAreaDetector(id, myNet, myFileBucket, lane, pos, length, period, trafficLight, filename,
507 vehicleTypes, nextEdges, detectPersons, name, timeThreshold,
508 speedThreshold, jamThreshold, friendlyPosCheck, show, parameters);
509 // insert depending of allowUndoRedo
510 if (myAllowUndoRedo) {
511 myNet->getUndoList()->begin(detectorE2, TL("add lane area detector '") + id + "'");
512 myNet->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
513 myNet->getUndoList()->end();
514 } else {
516 lane->addChildElement(detectorE2);
517 detectorE2->incRef("buildDetectorE2");
518 }
519 return true;
520 }
521 }
522 }
523}
524
525
526bool
527GNEAdditionalHandler::buildMultiLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::vector<std::string>& laneIDs,
528 const double pos, const double endPos, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
529 const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
530 const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
531 const bool friendlyPos, const bool show, const Parameterised::Map& parameters) {
532 // check conditions
535 return false;
537 return false;
538 } else {
539 // get lanes
540 const auto lanes = parseLanes(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, laneIDs);
541 // check lanes
542 if (lanes.empty()) {
543 return false;
544 } else {
545 // calculate path
547 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; Lanes aren't consecutives.", id));
548 } else if (!checkMultiLanePosition(
549 pos, lanes.front()->getParentEdge()->getNBEdge()->getFinalLength(),
550 endPos, lanes.back()->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
552 } else if ((period != -1) && !checkNegative(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
553 return false;
554 } else if ((trafficLight.size() > 0) && !(SUMOXMLDefinitions::isValidNetID(trafficLight))) {
555 // temporal
556 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; invalid traffic light ID.", id));
558 return false;
560 return false;
562 return false;
564 return false;
565 } else if (!checkListOfVehicleTypes(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, vehicleTypes)) {
566 return false;
567 } else {
568 // build E2 multilane detector
569 GNEAdditional* detectorE2 = new GNELaneAreaDetector(id, myNet, myFileBucket, lanes, pos, endPos, period, trafficLight, filename,
570 vehicleTypes, nextEdges, detectPersons, name, timeThreshold,
571 speedThreshold, jamThreshold, friendlyPos, show, parameters);
572 // insert depending of allowUndoRedo
573 if (myAllowUndoRedo) {
574 myNet->getUndoList()->begin(detectorE2, TL("add lane area detector '") + id + "'");
575 myNet->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
576 myNet->getUndoList()->end();
577 } else {
579 for (const auto& lane : lanes) {
580 lane->addChildElement(detectorE2);
581 }
582 detectorE2->incRef("buildDetectorE2Multilane");
583 }
584 return true;
585 }
586 }
587 }
588}
589
590
591bool
592GNEAdditionalHandler::buildDetectorE3(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos, const SUMOTime period,
593 const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
594 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold,
595 const bool openEntry, const bool expectedArrival, const Parameterised::Map& parameters) {
596 // check conditions
599 return false;
601 return false;
602 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
603 return false;
604 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
605 return false;
606 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_HALTING_SPEED_THRESHOLD, speedThreshold, true)) {
607 return false;
608 } else if (!checkFileName(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_FILE, filename)) {
609 return false;
610 } else if (!checkListOfVehicleTypes(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, vehicleTypes)) {
611 return false;
612 } else {
613 // build E3
614 GNEAdditional* E3 = new GNEMultiEntryExitDetector(id, myNet, myFileBucket, pos, period, filename, vehicleTypes, nextEdges, detectPersons,
615 name, timeThreshold, speedThreshold, openEntry, expectedArrival, parameters);
616 // insert depending of allowUndoRedo
617 if (myAllowUndoRedo) {
618 myNet->getUndoList()->begin(E3, TL("add entry-exit detector '") + id + "'");
619 myNet->getUndoList()->add(new GNEChange_Additional(E3, true), true);
620 myNet->getUndoList()->end();
621 } else {
623 E3->incRef("buildDetectorE3");
624 }
625 return true;
626 }
627}
628
629
630bool
631GNEAdditionalHandler::buildDetectorEntry(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos,
632 const bool friendlyPos, const Parameterised::Map& parameters) {
633 // get lane
634 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
635 // get E3 parent
637 // Check if Detector E3 parent and lane is correct
638 if (lane == nullptr) {
640 } else if (E3 == nullptr) {
642 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
644 } else {
645 // build entry instant
646 GNEAdditional* entry = new GNEEntryExitDetector(SUMO_TAG_DET_ENTRY, E3, lane, pos, friendlyPos, parameters);
647 // insert depending of allowUndoRedo
648 if (myAllowUndoRedo) {
649 myNet->getUndoList()->begin(entry, TL("add entry detector in '") + E3->getID() + "'");
650 myNet->getUndoList()->add(new GNEChange_Additional(entry, true), true);
651 myNet->getUndoList()->end();
652 } else {
654 lane->addChildElement(entry);
655 E3->addChildElement(entry);
656 entry->incRef("buildDetectorEntry");
657 }
658 return true;
659 }
660}
661
662
663bool
664GNEAdditionalHandler::buildDetectorExit(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos,
665 const bool friendlyPos, const Parameterised::Map& parameters) {
666 // get lane
667 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
668 // get E3 parent
670 // Check if Detector E3 parent and lane is correct
671 if (lane == nullptr) {
673 } else if (E3 == nullptr) {
675 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
677 } else {
678 // build exit instant
679 GNEAdditional* exit = new GNEEntryExitDetector(SUMO_TAG_DET_EXIT, E3, lane, pos, friendlyPos, parameters);
680 // insert depending of allowUndoRedo
681 if (myAllowUndoRedo) {
682 myNet->getUndoList()->begin(exit, TL("add exit detector in '") + E3->getID() + "'");
683 myNet->getUndoList()->add(new GNEChange_Additional(exit, true), true);
684 myNet->getUndoList()->end();
685 } else {
687 lane->addChildElement(exit);
688 E3->addChildElement(exit);
689 exit->incRef("buildDetectorExit");
690 }
691 return true;
692 }
693}
694
695
696bool
697GNEAdditionalHandler::buildDetectorE1Instant(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID, double pos,
698 const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
699 const std::string& detectPersons, const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters) {
700 // check conditions
703 return false;
705 return false;
706 } else {
707 // get lane
708 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
709 // check lane
710 if (lane == nullptr) {
713 return false;
714 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
716 } else {
717 // build E1 instant
718 GNEAdditional* detectorE1Instant = new GNEInstantInductionLoopDetector(id, myNet, myFileBucket, lane, pos, filename, vehicleTypes, nextEdges,
719 detectPersons, name, friendlyPos, parameters);
720 // insert depending of allowUndoRedo
721 if (myAllowUndoRedo) {
722 myNet->getUndoList()->begin(detectorE1Instant, TL("add instant induction loop '") + id + "'");
723 myNet->getUndoList()->add(new GNEChange_Additional(detectorE1Instant, true), true);
724 myNet->getUndoList()->end();
725 } else {
726 myNet->getAttributeCarriers()->insertAdditional(detectorE1Instant);
727 lane->addChildElement(detectorE1Instant);
728 detectorE1Instant->incRef("buildDetectorE1Instant");
729 }
730 return true;
731 }
732 }
733}
734
735
736bool
737GNEAdditionalHandler::buildLaneCalibrator(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID, const double pos,
738 const std::string& name, const std::string& outfile, const SUMOTime period, const std::string& routeprobeID, const double jamThreshold, const std::vector<std::string>& vTypes,
739 const Parameterised::Map& parameters) {
740 // get lane
741 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
742 // get routeProbe
743 GNEAdditional* routeProbe = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, routeprobeID, false);
744 // check conditions
746 if (!checkElement(GNE_TAG_CALIBRATOR_LANE, element)) {
747 return false;
749 return false;
750 } else if ((routeprobeID.size() > 0) && (routeProbe == nullptr)) {
752 } else if (lane == nullptr) {
754 } else {
755 // check lane
756 if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), false)) {
758 } else if (!checkNegative(GNE_TAG_CALIBRATOR_LANE, id, SUMO_ATTR_PERIOD, period, true)) {
759 return false;
760 } else if (!checkNegative(GNE_TAG_CALIBRATOR_LANE, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
761 return false;
762 } else {
763 // build Calibrator
764 GNEAdditional* calibrator = new GNECalibrator(id, myNet, myFileBucket, lane, pos, period, name, outfile, routeProbe, jamThreshold, vTypes, parameters);
765 // insert depending of allowUndoRedo
766 if (myAllowUndoRedo) {
767 myNet->getUndoList()->begin(calibrator, TL("add lane calibrator '") + id + "'");
768 myNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
769 myNet->getUndoList()->end();
770 // check if center after creation
773 myNet->getViewNet()->centerToPos(calibrator->getPositionInView(), false);
774 }
775 } else {
777 lane->addChildElement(calibrator);
778 if (routeProbe) {
779 routeProbe->addChildElement(calibrator);
780 }
781 calibrator->incRef("buildCalibrator");
782 }
783 return true;
784 }
785 }
786}
787
788
789bool
790GNEAdditionalHandler::buildEdgeCalibrator(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& edgeID, const double pos,
791 const std::string& name, const std::string& outfile, const SUMOTime period, const std::string& routeprobeID, const double jamThreshold, const std::vector<std::string>& vTypes,
792 const Parameterised::Map& parameters) {
793 // get edge
794 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
795 // get routeProbe
796 GNEAdditional* routeProbe = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, routeprobeID, false);
797 // check conditions
799 if (!checkElement(SUMO_TAG_CALIBRATOR, element)) {
800 return false;
802 return false;
803 } else if ((routeprobeID.size() > 0) && (routeProbe == nullptr)) {
805 } else if (edge == nullptr) {
807 } else {
808 if (!checkLanePosition(pos, 0, edge->getChildLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), false)) {
810 } else if (!checkNegative(SUMO_TAG_CALIBRATOR, id, SUMO_ATTR_PERIOD, period, true)) {
811 return false;
812 } else if (!checkNegative(SUMO_TAG_CALIBRATOR, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
813 return false;
814 } else {
815 // build Calibrator
816 GNEAdditional* calibrator = new GNECalibrator(id, myNet, myFileBucket, edge, pos, period, name, outfile, routeProbe, jamThreshold, vTypes, parameters);
817 // insert depending of allowUndoRedo
818 if (myAllowUndoRedo) {
819 myNet->getUndoList()->begin(calibrator, TL("add calibrator '") + id + "'");
820 myNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
821 myNet->getUndoList()->end();
822 // check if center after creation
825 myNet->getViewNet()->centerToPos(calibrator->getPositionInView(), false);
826 }
827 } else {
829 edge->addChildElement(calibrator);
830 if (routeProbe) {
831 routeProbe->addChildElement(calibrator);
832 }
833 calibrator->incRef("buildCalibrator");
834 }
835 return true;
836 }
837 }
838}
839
840
841bool
843 // get vType
844 GNEDemandElement* vType = myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, vehicleParameter.vtypeid.empty() ? DEFAULT_VTYPE_ID : vehicleParameter.vtypeid, false);
845 // get route
847 // get calibrator parent
849 // check parents
850 if (vType == nullptr) {
851 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_VTYPE}, vehicleParameter.vtypeid);
852 } else if (route == nullptr) {
853 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_ROUTE}, vehicleParameter.routeid);
854 } else if (calibrator == nullptr) {
855 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_CALIBRATOR}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
856 } else {
857 // create calibrator flow
858 GNEAdditional* flow = new GNECalibratorFlow(calibrator, vType, route, vehicleParameter);
859 // insert depending of allowUndoRedo
860 if (myAllowUndoRedo) {
861 myNet->getUndoList()->begin(flow, TL("add calibrator flow in '") + calibrator->getID() + "'");
862 myNet->getUndoList()->add(new GNEChange_Additional(flow, true), true);
863 myNet->getUndoList()->end();
864 } else {
866 calibrator->addChildElement(flow);
867 route->addChildElement(flow);
868 vType->addChildElement(flow);
869 flow->incRef("buildCalibratorFlow");
870 }
871 return true;
872 }
873}
874
875
876bool
877GNEAdditionalHandler::buildRerouter(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
878 const std::vector<std::string>& edgeIDs, const double prob, const std::string& name,
879 const bool off, const bool optional, const SUMOTime timeThreshold,
880 const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) {
881 // check conditions
882 const auto element = retrieveAdditionalElement({SUMO_TAG_REROUTER}, id);
883 if (!checkElement(SUMO_TAG_REROUTER, element)) {
884 return false;
885 } else if (!checkValidAdditionalID(SUMO_TAG_REROUTER, id)) {
886 return false;
887 } else if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB, prob, true)) {
888 return false;
889 } else if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
890 return false;
891 } else if (!checkListOfVehicleTypes(SUMO_TAG_REROUTER, id, vTypes)) {
892 return false;
893 } else {
894 // parse edges
895 std::vector<GNEEdge*> edges = parseEdges(SUMO_TAG_REROUTER, id, edgeIDs);
896 // check edges
897 if (edges.empty()) {
898 return false;
899 } else {
900 GNEAdditional* rerouter = nullptr;
901 // continue depending of position
902 if (pos == Position::INVALID) {
903 if (edges.size() > 0) {
904 PositionVector laneShape = edges.front()->getChildLanes().front()->getLaneShape();
905 // move to side
906 laneShape.move2side(3);
907 // create rerouter
908 rerouter = new GNERerouter(id, myNet, myFileBucket, laneShape.positionAtOffset2D(laneShape.length2D() - 6), name, prob, off, optional, timeThreshold, vTypes, parameters);
909 } else {
910 rerouter = new GNERerouter(id, myNet, myFileBucket, Position(0, 0), name, prob, off, optional, timeThreshold, vTypes, parameters);
911 }
912 } else {
913 rerouter = new GNERerouter(id, myNet, myFileBucket, pos, name, prob, off, optional, timeThreshold, vTypes, parameters);
914 }
915 // create rerouter Symbols
916 std::vector<GNEAdditional*> rerouterSymbols;
917 for (const auto& edge : edges) {
918 rerouterSymbols.push_back(new GNERerouterSymbol(rerouter, edge));
919 }
920 // insert depending of allowUndoRedo
921 if (myAllowUndoRedo) {
922 myNet->getUndoList()->begin(rerouter, TL("add rerouter '") + id + "'");
923 myNet->getUndoList()->add(new GNEChange_Additional(rerouter, true), true);
924 // add symbols
925 for (const auto& rerouterSymbol : rerouterSymbols) {
926 myNet->getUndoList()->add(new GNEChange_Additional(rerouterSymbol, true), true);
927 }
928 myNet->getUndoList()->end();
929 } else {
931 rerouter->incRef("buildRerouter");
932 // add symbols into rerouter
933 for (const auto& rerouterSymbol : rerouterSymbols) {
934 rerouter->addChildElement(rerouterSymbol);
935 }
936 // add symbols into edges
937 for (int i = 0; i < (int)edges.size(); i++) {
938 edges.at(i)->addChildElement(rerouterSymbols.at(i));
939 }
940 }
941 return true;
942 }
943 }
944}
945
946
947bool
949 // get rerouter parent
950 GNEAdditional* rerouter = getAdditionalParent(sumoBaseObject, SUMO_TAG_REROUTER);
951 // check if rerouter exist
952 if (rerouter == nullptr) {
953 return writeErrorInvalidParent(SUMO_TAG_INTERVAL, "", {SUMO_TAG_REROUTER}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
954 } else if (!checkNegative(SUMO_TAG_INTERVAL, rerouter->getID(), SUMO_ATTR_BEGIN, begin, true)) {
955 return false;
956 } else if (!checkNegative(SUMO_TAG_INTERVAL, rerouter->getID(), SUMO_ATTR_END, end, true)) {
957 return false;
958 } else if (end < begin) {
959 return writeError(TLF("Could not build interval with ID '%' in netedit; begin is greater than end.", rerouter->getID()));
960 } else {
961 // check if new interval will produce a overlapping
962 if (checkOverlappingRerouterIntervals(rerouter, begin, end)) {
963 // create rerouter interval and add it into rerouter parent
964 GNEAdditional* rerouterInterval = new GNERerouterInterval(rerouter, begin, end);
965 // insert depending of allowUndoRedo
966 if (myAllowUndoRedo) {
967 myNet->getUndoList()->begin(rerouterInterval, TL("add rerouter interval in '") + rerouter->getID() + "'");
968 myNet->getUndoList()->add(new GNEChange_Additional(rerouterInterval, true), true);
969 myNet->getUndoList()->end();
970 } else {
971 rerouter->addChildElement(rerouterInterval);
972 rerouterInterval->incRef("buildRerouterInterval");
973 }
974 } else {
975 return writeError(TLF("Could not build interval with begin '%' and end '%' in '%' due overlapping.", toString(begin), toString(end), rerouter->getID()));
976 }
977 // update centering boundary of rerouter parent
978 rerouter->updateCenteringBoundary(true);
979 return true;
980 }
981}
982
983
984bool
985GNEAdditionalHandler::buildClosingLaneReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedLaneID, SVCPermissions permissions) {
986 // get rerouter interval parent
987 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
988 // get closed lane
989 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(closedLaneID, false);
990 // check parents
991 if (lane == nullptr) {
993 } else if (rerouterInterval == nullptr) {
995 } else {
996 // create closing lane reroute
997 GNEAdditional* closingLaneReroute = new GNEClosingLaneReroute(rerouterInterval, lane, permissions);
998 // add it to interval parent depending of allowUndoRedo
999 if (myAllowUndoRedo) {
1000 myNet->getUndoList()->begin(closingLaneReroute, TL("add closing lane reroute in '") + lane->getID() + "'");
1001 myNet->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1002 myNet->getUndoList()->end();
1003 } else {
1004 rerouterInterval->addChildElement(closingLaneReroute);
1005 closingLaneReroute->incRef("buildClosingLaneReroute");
1006 }
1007 // update centering boundary of rerouter parent
1008 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1009 return true;
1010 }
1011}
1012
1013
1014bool
1015GNEAdditionalHandler::buildClosingReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedEdgeID, SVCPermissions permissions) {
1016 // get rerouter interval parent
1017 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1018 // get closed edge
1019 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(closedEdgeID, false);
1020 // check parents
1021 if (edge == nullptr) {
1023 } else if (rerouterInterval == nullptr) {
1025 } else {
1026 // create closing reroute
1027 GNEAdditional* closingLaneReroute = new GNEClosingReroute(rerouterInterval, edge, permissions);
1028 // add it to interval parent depending of allowUndoRedo
1029 if (myAllowUndoRedo) {
1030 myNet->getUndoList()->begin(closingLaneReroute, TL("add closing reroute in '") + edge->getID() + "'");
1031 myNet->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1032 myNet->getUndoList()->end();
1033 } else {
1034 rerouterInterval->addChildElement(closingLaneReroute);
1035 closingLaneReroute->incRef("buildClosingLaneReroute");
1036 }
1037 // update centering boundary of rerouter parent
1038 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1039 return true;
1040 }
1041}
1042
1043bool
1044GNEAdditionalHandler::buildDestProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newEdgeDestinationID, const double probability) {
1045 // get rerouter interval parent
1046 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1047 // get edge
1048 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(newEdgeDestinationID, false);
1049 // check parents
1050 if (edge == nullptr && newEdgeDestinationID != "keepDestination" && newEdgeDestinationID != "terminateRoute") {
1051 return writeErrorInvalidParent(SUMO_TAG_DEST_PROB_REROUTE, "", {SUMO_TAG_EDGE}, newEdgeDestinationID);
1052 } else if (rerouterInterval == nullptr) {
1054 } else {
1055 // create dest probability reroute
1056 GNEAdditional* destProbReroute = new GNEDestProbReroute(rerouterInterval, newEdgeDestinationID, probability);
1057 // add it to interval parent depending of allowUndoRedo
1058 if (myAllowUndoRedo) {
1059 myNet->getUndoList()->begin(destProbReroute, TL("add dest prob reroute to '") + newEdgeDestinationID + "'");
1060 myNet->getUndoList()->add(new GNEChange_Additional(destProbReroute, true), true);
1061 myNet->getUndoList()->end();
1062 } else {
1063 rerouterInterval->addChildElement(destProbReroute);
1064 destProbReroute->incRef("builDestProbReroute");
1065 }
1066 // update centering boundary of rerouter parent
1067 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1068 return true;
1069 }
1070}
1071
1072
1073bool
1074GNEAdditionalHandler::buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newParkignAreaID, const double probability, const bool visible) {
1075 // get rerouter interval parent
1076 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1077 // get parking area
1078 GNEAdditional* parkingArea = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, newParkignAreaID, false);
1079 // check parents
1080 if (parkingArea == nullptr) {
1082 } else if (rerouterInterval == nullptr) {
1084 } else {
1085 // create parking area reroute
1086 GNEAdditional* parkingAreaReroute = new GNEParkingAreaReroute(rerouterInterval, parkingArea, probability, visible);
1087 // add it to interval parent depending of allowUndoRedo
1088 if (myAllowUndoRedo) {
1089 myNet->getUndoList()->begin(parkingAreaReroute, TL("add parking area reroute in '") + parkingArea->getID() + "'");
1090 myNet->getUndoList()->add(new GNEChange_Additional(parkingAreaReroute, true), true);
1091 myNet->getUndoList()->end();
1092 } else {
1093 rerouterInterval->addChildElement(parkingAreaReroute);
1094 parkingAreaReroute->incRef("builParkingAreaReroute");
1095 }
1096 // update centering boundary of rerouter parent
1097 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1098 return true;
1099 }
1100}
1101
1102
1103bool
1104GNEAdditionalHandler::buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newRouteID, const double probability) {
1105 // get rerouter interval parent
1106 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1107 // get route parent
1109 // check parents
1110 if (route == nullptr) {
1112 } else if (rerouterInterval == nullptr) {
1114 } else {
1115 // create rout prob reroute
1116 GNEAdditional* routeProbReroute = new GNERouteProbReroute(rerouterInterval, route, probability);
1117 // add it to interval parent depending of allowUndoRedo
1118 if (myAllowUndoRedo) {
1119 myNet->getUndoList()->begin(routeProbReroute, TL("add route prob reroute in '") + route->getID() + "'");
1120 myNet->getUndoList()->add(new GNEChange_Additional(routeProbReroute, true), true);
1121 myNet->getUndoList()->end();
1122 } else {
1123 rerouterInterval->addChildElement(routeProbReroute);
1124 routeProbReroute->incRef("buildRouteProbReroute");
1125 }
1126 // update centering boundary of rerouter parent
1127 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1128 return true;
1129 }
1130}
1131
1132
1133bool
1134GNEAdditionalHandler::buildRouteProbe(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& edgeID, const SUMOTime period,
1135 const std::string& name, const std::string& file, const SUMOTime begin, const std::vector<std::string>& vTypes,
1136 const Parameterised::Map& parameters) {
1137 // check conditions
1138 const auto element = retrieveAdditionalElement({SUMO_TAG_ROUTEPROBE}, id);
1139 if (!checkElement(SUMO_TAG_ROUTEPROBE, element)) {
1140 return false;
1142 return false;
1143 } else {
1144 // get edge
1145 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1146 // check lane
1147 if (edge == nullptr) {
1149 } else if (!checkNegative(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_PERIOD, period, true)) {
1150 return false;
1151 } else if (!checkNegative(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_BEGIN, begin, true)) {
1152 return false;
1153 } else if (!checkFileName(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_FILE, file)) {
1154 return false;
1155 } else {
1156 // build route probe
1157 GNEAdditional* routeProbe = new GNERouteProbe(id, myNet, myFileBucket, edge, period, name, file, begin, vTypes, parameters);
1158 // insert depending of allowUndoRedo
1159 if (myAllowUndoRedo) {
1160 myNet->getUndoList()->begin(routeProbe, TL("add route probe '") + id + "'");
1161 myNet->getUndoList()->add(new GNEChange_Additional(routeProbe, true), true);
1162 myNet->getUndoList()->end();
1163 // check if center after creation
1164 if (sumoBaseObject->hasBoolAttribute(GNE_ATTR_CENTER_AFTER_CREATION) &&
1166 myNet->getViewNet()->centerToPos(routeProbe->getPositionInView(), false);
1167 }
1168 } else {
1170 edge->addChildElement(routeProbe);
1171 routeProbe->incRef("buildRouteProbe");
1172 }
1173 return true;
1174 }
1175 }
1176}
1177
1178
1179bool
1180GNEAdditionalHandler::buildVariableSpeedSign(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
1181 const std::vector<std::string>& laneIDs, const std::string& name, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) {
1182 // check conditions
1183 const auto element = retrieveAdditionalElement({SUMO_TAG_VSS}, id);
1184 if (!checkElement(SUMO_TAG_VSS, element)) {
1185 return false;
1186 } else if (!checkValidAdditionalID(SUMO_TAG_VSS, id)) {
1187 return false;
1188 } else {
1189 // parse lanes
1190 std::vector<GNELane*> lanes = parseLanes(SUMO_TAG_VSS, id, laneIDs);
1191 // check lane
1192 if (lanes.empty()) {
1193 return false;
1194 } else {
1195 // check vTypes
1196 if (!checkListOfVehicleTypes(SUMO_TAG_VSS, id, vTypes)) {
1197 return false;
1198 } else {
1199 // create VSS
1200 GNEAdditional* variableSpeedSign = new GNEVariableSpeedSign(id, myNet, myFileBucket, pos, name, vTypes, parameters);
1201 // create VSS Symbols
1202 std::vector<GNEAdditional*> VSSSymbols;
1203 for (const auto& lane : lanes) {
1204 VSSSymbols.push_back(new GNEVariableSpeedSignSymbol(variableSpeedSign, lane));
1205 }
1206 // insert depending of allowUndoRedo
1207 if (myAllowUndoRedo) {
1208 myNet->getUndoList()->begin(variableSpeedSign, TL("add Variable Speed Sign '") + id + "'");
1209 myNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSign, true), true);
1210 for (const auto& VSSSymbol : VSSSymbols) {
1211 myNet->getUndoList()->add(new GNEChange_Additional(VSSSymbol, true), true);
1212 }
1213 myNet->getUndoList()->end();
1214 } else {
1215 myNet->getAttributeCarriers()->insertAdditional(variableSpeedSign);
1216 variableSpeedSign->incRef("buildVariableSpeedSign");
1217 // add symbols into VSS
1218 for (const auto& VSSSymbol : VSSSymbols) {
1219 variableSpeedSign->addChildElement(VSSSymbol);
1220 }
1221 // add symbols into lanes
1222 for (int i = 0; i < (int)lanes.size(); i++) {
1223 lanes.at(i)->addChildElement(VSSSymbols.at(i));
1224 }
1225 }
1226 }
1227 return true;
1228 }
1229 }
1230}
1231
1232
1233bool
1235 // get VSS parent
1237 // check lane
1238 if (VSS == nullptr) {
1239 return writeErrorInvalidParent(SUMO_TAG_STEP, "", {SUMO_TAG_VSS}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1240 } else if (!checkNegative(SUMO_TAG_STEP, VSS->getID(), SUMO_ATTR_TIME, time, true)) {
1241 return false;
1242 } else {
1243 // create Variable Speed Sign
1244 GNEAdditional* variableSpeedSignStep = new GNEVariableSpeedSignStep(VSS, time, speed);
1245 // add it depending of allow undoRedo
1246 if (myAllowUndoRedo) {
1247 myNet->getUndoList()->begin(variableSpeedSignStep, TL("add VSS Step in '") + VSS->getID() + "'");
1248 myNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSignStep, true), true);
1249 myNet->getUndoList()->end();
1250 } else {
1251 VSS->addChildElement(variableSpeedSignStep);
1252 variableSpeedSignStep->incRef("buildVariableSpeedSignStep");
1253 }
1254 // update centering boundary of VSS parent
1255 VSS->updateCenteringBoundary(true);
1256 return true;
1257 }
1258}
1259
1260
1261bool
1262GNEAdditionalHandler::buildVaporizer(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const SUMOTime beginTime,
1263 const SUMOTime endTime, const std::string& name, const Parameterised::Map& parameters) {
1264 // check conditions
1265 const auto element = retrieveAdditionalElement({SUMO_TAG_VAPORIZER}, edgeID);
1266 if (!checkElement(SUMO_TAG_VAPORIZER, element)) {
1267 return false;
1268 } else if (!checkValidAdditionalID(SUMO_TAG_VAPORIZER, edgeID)) {
1269 return false;
1270 } else {
1271 // get edge
1272 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1273 // check lane
1274 if (edge == nullptr) {
1276 } else if (!checkNegative(SUMO_TAG_VAPORIZER, edge->getID(), SUMO_ATTR_BEGIN, beginTime, true)) {
1277 return false;
1278 } else if (!checkNegative(SUMO_TAG_VAPORIZER, edge->getID(), SUMO_ATTR_END, endTime, true)) {
1279 return false;
1280 } else if (endTime < beginTime) {
1281 return writeError(TLF("Could not build Vaporizer with ID '%' in netedit; begin is greater than end.", edge->getID()));
1282 } else {
1283 // build vaporizer
1284 GNEAdditional* vaporizer = new GNEVaporizer(myNet, myFileBucket, edge, beginTime, endTime, name, parameters);
1285 // add it depending of allow undoRed
1286 if (myAllowUndoRedo) {
1287 myNet->getUndoList()->begin(vaporizer, TL("add vaporizer in '") + edge->getID() + "'");
1288 myNet->getUndoList()->add(new GNEChange_Additional(vaporizer, true), true);
1289 myNet->getUndoList()->end();
1290 // check if center after creation
1291 if (sumoBaseObject->hasBoolAttribute(GNE_ATTR_CENTER_AFTER_CREATION) &&
1293 myNet->getViewNet()->centerToPos(vaporizer->getPositionInView(), false);
1294 }
1295 } else {
1297 edge->addChildElement(vaporizer);
1298 vaporizer->incRef("buildVaporizer");
1299 }
1300 return true;
1301 }
1302 }
1303}
1304
1305
1306bool
1307GNEAdditionalHandler::buildTAZ(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const PositionVector& shape,
1308 const Position& center, const bool fill, const RGBColor& color, const std::vector<std::string>& edgeIDs,
1309 const std::string& name, const Parameterised::Map& parameters) {
1310 // parse edges
1311 const std::vector<GNEEdge*> edges = parseEdges(SUMO_TAG_TAZ, id, edgeIDs);
1312 if (edges.size() != edgeIDs.size()) {
1313 return false;
1314 } else {
1315 // check TAZShape
1316 PositionVector TAZShape = shape;
1317 if (TAZShape.size() == 0) {
1318 // declare boundary
1319 Boundary TAZBoundary;
1320 for (const auto& edge : edges) {
1321 TAZBoundary.add(edge->getCenteringBoundary());
1322 }
1323 // iterate over children and add sourceSinkEdge boundaries to make a taz shape
1324 for (const auto& sourceSink : sumoBaseObject->getSumoBaseObjectChildren()) {
1325 // check that child is a source or sink elements (to avoid other elements)
1326 if ((sourceSink->getTag() == SUMO_TAG_TAZSOURCE) || (sourceSink->getTag() == SUMO_TAG_TAZSINK)) {
1327 const GNEEdge* sourceSinkEdge = myNet->getAttributeCarriers()->retrieveEdge(sourceSink->getStringAttribute(SUMO_ATTR_ID), false);
1328 if (sourceSinkEdge) {
1329 TAZBoundary.add(sourceSinkEdge->getCenteringBoundary());
1330 }
1331 }
1332 }
1333 // update TAZShape
1334 TAZShape = TAZBoundary.getShape(true);
1335 }
1336 // check TAZ
1337 const auto element = retrieveAdditionalElement({SUMO_TAG_TAZ}, id);
1338 if (!checkElement(SUMO_TAG_TAZ, element)) {
1339 return false;
1340 } else if (!checkValidAdditionalID(SUMO_TAG_TAZ, id)) {
1341 return false;
1342 } else if (TAZShape.size() == 0) {
1343 return writeError(TLF("Could not build TAZ with ID '%' in netedit; Invalid Shape.", id));
1344 } else {
1345 // build TAZ with the given shape
1346 const Position center2 = center == Position::INVALID ? TAZShape.getCentroid() : center;
1347 GNEAdditional* TAZ = new GNETAZ(id, myNet, myFileBucket, TAZShape, center2, fill, color, name, parameters);
1348 // disable updating geometry of TAZ children during insertion (because in large nets provokes slowdowns)
1350 // add it depending of allow undoRed
1351 if (myAllowUndoRedo) {
1352 myNet->getUndoList()->begin(TAZ, TL("add TAZ '") + id + "'");
1353 myNet->getUndoList()->add(new GNEChange_Additional(TAZ, true), true);
1354 // create TAZEdges
1355 for (const auto& edge : edges) {
1356 // create TAZ Source using GNEChange_Additional
1357 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, 1);
1358 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSource, true), true);
1359 // create TAZ Sink using GNEChange_Additional
1360 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, 1);
1361 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSink, true), true);
1362 }
1363 myNet->getUndoList()->end();
1364 } else {
1366 TAZ->incRef("buildTAZ");
1367 for (const auto& edge : edges) {
1368 // create TAZ Source
1369 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, 1);
1371 TAZSource->incRef("buildTAZ");
1372 TAZ->addChildElement(TAZSource);
1373 edge->addChildElement(TAZSource);
1374 // create TAZ Sink
1375 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, 1);
1377 TAZSink->incRef("buildTAZ");
1378 TAZ->addChildElement(TAZSink);
1379 edge->addChildElement(TAZSink);
1380 }
1381 }
1382 // enable updating geometry again and update geometry of TAZ
1384 // update TAZ parent
1385 TAZ->updateGeometry();
1386 return true;
1387 }
1388 }
1389}
1390
1391
1392bool
1393GNEAdditionalHandler::buildTAZSource(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double departWeight) {
1394 // get TAZ parent
1396 // get edge
1397 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1398 // check parents
1399 if (TAZ == nullptr) {
1400 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_TAZ}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1401 } else if (edge == nullptr) {
1402 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_EDGE}, TAZ->getID());
1403 } else {
1404 // declare TAZ Source
1405 GNETAZSourceSink* existentTAZSource = nullptr;
1406 // first check if already exist a TAZ Source for the given edge and TAZ
1407 for (auto it = edge->getChildTAZSourceSinks().begin(); (it != edge->getChildTAZSourceSinks().end()) && !existentTAZSource; it++) {
1408 if (((*it)->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) && ((*it)->getParentAdditionals().front() == TAZ)) {
1409 existentTAZSource = (*it);
1410 }
1411 }
1412 // check if TAZSource has to be created
1413 if (existentTAZSource == nullptr) {
1414 // Create TAZ only with departWeight
1415 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, departWeight);
1416 // add it depending of allow undoRed
1417 if (myAllowUndoRedo) {
1418 myNet->getUndoList()->begin(TAZ, TL("add TAZ Source in '") + TAZ->getID() + "'");
1419 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSource, true), true);
1420 myNet->getUndoList()->end();
1421 } else {
1423 TAZ->addChildElement(TAZSource);
1424 edge->addChildElement(TAZSource);
1425 TAZSource->incRef("buildTAZSource");
1426 }
1427 } else {
1428 // update TAZ Attribute depending of allow undoRed
1429 if (myAllowUndoRedo) {
1430 myNet->getUndoList()->begin(TAZ, TL("update TAZ Source in '") + TAZ->getID() + "'");
1431 existentTAZSource->setAttribute(SUMO_ATTR_WEIGHT, toString(departWeight), myNet->getUndoList());
1432 myNet->getUndoList()->end();
1433 } else {
1434 existentTAZSource->setAttribute(SUMO_ATTR_WEIGHT, toString(departWeight), nullptr);
1435 }
1436 }
1437 return true;
1438 }
1439}
1440
1441
1442bool
1443GNEAdditionalHandler::buildTAZSink(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double arrivalWeight) {
1444 // get TAZ parent
1446 // get edge
1447 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1448 // check parents
1449 if (TAZ == nullptr) {
1450 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_TAZ}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1451 } else if (edge == nullptr) {
1452 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_EDGE}, TAZ->getID());
1453 } else {
1454 // declare TAZ Sink
1455 GNETAZSourceSink* existentTAZSink = nullptr;
1456 // first check if already exist a TAZ Sink for the given edge and TAZ
1457 for (auto it = edge->getChildTAZSourceSinks().begin(); (it != edge->getChildTAZSourceSinks().end()) && !existentTAZSink; it++) {
1458 if (((*it)->getTagProperty()->getTag() == SUMO_TAG_TAZSINK) && ((*it)->getParentAdditionals().front() == TAZ)) {
1459 existentTAZSink = (*it);
1460 }
1461 }
1462 // check if TAZSink has to be created
1463 if (existentTAZSink == nullptr) {
1464 // Create TAZ only with departWeight
1465 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, arrivalWeight);
1466 // add it depending of allow undoRed
1467 if (myAllowUndoRedo) {
1468 myNet->getUndoList()->begin(TAZ, TL("add TAZ Sink in '") + TAZ->getID() + "'");
1469 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSink, true), true);
1470 myNet->getUndoList()->end();
1471 } else {
1473 TAZ->addChildElement(TAZSink);
1474 edge->addChildElement(TAZSink);
1475 TAZSink->incRef("buildTAZSink");
1476 }
1477 } else {
1478 // update TAZ Attribute depending of allow undoRed
1479 if (myAllowUndoRedo) {
1480 myNet->getUndoList()->begin(TAZ, TL("update TAZ Sink in '") + TAZ->getID() + "'");
1481 existentTAZSink->setAttribute(SUMO_ATTR_WEIGHT, toString(arrivalWeight), myNet->getUndoList());
1482 myNet->getUndoList()->end();
1483 } else {
1484 existentTAZSink->setAttribute(SUMO_ATTR_WEIGHT, toString(arrivalWeight), nullptr);
1485 }
1486 }
1487 return true;
1488 }
1489}
1490
1491
1492bool
1493GNEAdditionalHandler::buildTractionSubstation(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
1494 const double voltage, const double currentLimit, const Parameterised::Map& parameters) {
1495 // check conditions
1496 const auto element = retrieveAdditionalElement({SUMO_TAG_TRACTION_SUBSTATION}, id);
1498 return false;
1500 return false;
1501 } else if (!checkNegative(SUMO_TAG_TRACTION_SUBSTATION, id, SUMO_ATTR_VOLTAGE, voltage, true)) {
1502 return false;
1503 } else if (!checkNegative(SUMO_TAG_TRACTION_SUBSTATION, id, SUMO_ATTR_CURRENTLIMIT, currentLimit, true)) {
1504 return false;
1505 } else {
1506 // build traction substation
1507 GNEAdditional* tractionSubstation = new GNETractionSubstation(id, myNet, myFileBucket, pos, voltage, currentLimit, parameters);
1508 // insert depending of allowUndoRedo
1509 if (myAllowUndoRedo) {
1510 myNet->getUndoList()->begin(tractionSubstation, TL("add traction substation '") + id + "'");
1511 myNet->getUndoList()->add(new GNEChange_Additional(tractionSubstation, true), true);
1512 myNet->getUndoList()->end();
1513 } else {
1514 myNet->getAttributeCarriers()->insertAdditional(tractionSubstation);
1515 tractionSubstation->incRef("buildTractionSubstation");
1516 }
1517 return true;
1518 }
1519}
1520
1521
1522bool
1523GNEAdditionalHandler::buildOverheadWire(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& substationId,
1524 const std::vector<std::string>& laneIDs, const double startPos, const double endPos, const bool friendlyPos,
1525 const std::vector<std::string>& forbiddenInnerLanes, const Parameterised::Map& parameters) {
1526 // check conditions
1529 return false;
1531 return false;
1532 } else {
1533 // get lanes
1534 const auto lanes = parseLanes(SUMO_TAG_OVERHEAD_WIRE_SECTION, id, laneIDs);
1535 // get traction substation
1536 const auto tractionSubstation = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, substationId, false);
1537 // check lanes
1538 if (lanes.empty()) {
1539 return false;
1540 } else {
1541 // calculate path
1543 return writeError(TLF("Could not build overhead wire with ID '%' in netedit; Lanes aren't consecutives.", id));
1544 } else if (!checkMultiLanePosition(
1545 startPos, lanes.front()->getParentEdge()->getNBEdge()->getFinalLength(),
1546 endPos, lanes.back()->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
1548 } else if (tractionSubstation == nullptr) {
1550 } else {
1551 // build Overhead Wire
1552 GNEAdditional* overheadWire = new GNEOverheadWire(id, myNet, myFileBucket, lanes, tractionSubstation, startPos, endPos, friendlyPos, forbiddenInnerLanes, parameters);
1553 // insert depending of allowUndoRedo
1554 if (myAllowUndoRedo) {
1555 myNet->getUndoList()->begin(overheadWire, TL("add overhead wire '") + id + "'");
1556 myNet->getUndoList()->add(new GNEChange_Additional(overheadWire, true), true);
1557 myNet->getUndoList()->end();
1558 } else {
1560 for (const auto& lane : lanes) {
1561 lane->addChildElement(overheadWire);
1562 }
1563 overheadWire->incRef("buildOverheadWire");
1564 }
1565 }
1566 return true;
1567 }
1568 }
1569}
1570
1571
1572bool
1573GNEAdditionalHandler::buildOverheadWireClamp(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& /* id */, const std::string& /* overheadWireIDStartClamp */,
1574 const std::string& /* laneIDStartClamp */, const std::string& /* overheadWireIDEndClamp */, const std::string& /* laneIDEndClamp */,
1575 const Parameterised::Map& /* parameters */) {
1576 //
1577 return false;
1578}
1579
1580
1581bool
1582GNEAdditionalHandler::buildPolygon(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& type,
1583 const RGBColor& color, const double layer, const double angle, const std::string& imgFile, const PositionVector& shape,
1584 const bool geo, const bool fill, const double lineWidth, const std::string& name, const double height,
1585 const Parameterised::Map& parameters) {
1586 // check conditions
1587 if (type == "jupedsim.walkable_area") {
1588 return buildJpsWalkableArea(sumoBaseObject, id, shape, geo, name, parameters);
1589 } else if (type == "jupedsim.obstacle") {
1590 return buildJpsObstacle(sumoBaseObject, id, shape, geo, name, parameters);
1591 } else {
1592 // check conditions
1593 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1594 if (!checkElement(SUMO_TAG_POLY, element)) {
1595 return false;
1596 } else if (!checkValidAdditionalID(SUMO_TAG_POLY, id)) {
1597 return false;
1598 } else if (!checkNegative(SUMO_TAG_POLY, id, SUMO_ATTR_LINEWIDTH, lineWidth, true)) {
1599 return false;
1600 } else {
1601 // create poly
1602 GNEPoly* poly = new GNEPoly(id, myNet, myFileBucket, type, shape, geo, fill, lineWidth, color, layer, angle, imgFile, name, height, parameters);
1603 // add it depending of allow undoRed
1604 if (myAllowUndoRedo) {
1605 myNet->getUndoList()->begin(poly, TL("add polygon '") + id + "'");
1606 myNet->getUndoList()->add(new GNEChange_Additional(poly, true), true);
1607 myNet->getUndoList()->end();
1608 } else {
1609 // insert shape without allowing undo/redo
1611 poly->incRef("addPolygon");
1612 }
1613 return true;
1614 }
1615 }
1616}
1617
1618
1619bool
1620GNEAdditionalHandler::buildPOI(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1621 const RGBColor& color, const double x, const double y, const std::string& icon, double layer, double angle,
1622 const std::string& imgFile, double width, double height, const std::string& name, const Parameterised::Map& parameters) {
1623 // check conditions
1624 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1625 if (!checkElement(SUMO_TAG_POI, element)) {
1626 return false;
1627 } else if (!checkValidAdditionalID(SUMO_TAG_POI, id)) {
1628 return false;
1629 } else if (!checkNegative(SUMO_TAG_POI, id, SUMO_ATTR_WIDTH, width, true)) {
1630 return false;
1631 } else if (!checkNegative(SUMO_TAG_POI, id, SUMO_ATTR_HEIGHT, height, true)) {
1632 return false;
1633 } else if (!checkFileName(SUMO_TAG_POI, id, SUMO_ATTR_IMGFILE, imgFile)) {
1634 return false;
1635 } else {
1636 // parse position
1637 const auto pos = Position(x, y);
1638 // parse icon
1640 // create POI
1641 GNEPOI* POI = new GNEPOI(id, myNet, myFileBucket, type, color, pos, false, ic, layer, angle, imgFile, width, height, name, parameters);
1642 // add it depending of allow undoRed
1643 if (myAllowUndoRedo) {
1644 myNet->getUndoList()->begin(POI, TLF("add POI '%'", id));
1645 myNet->getUndoList()->add(new GNEChange_Additional(POI, true), true);
1646 myNet->getUndoList()->end();
1647 } else {
1648 // insert shape without allowing undo/redo
1650 POI->incRef("addPOI");
1651 }
1652 return true;
1653 }
1654}
1655
1656
1657bool
1658GNEAdditionalHandler::buildPOILane(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1659 const RGBColor& color, const std::string& laneID, double posOverLane, const bool friendlyPos, double posLat,
1660 const std::string& icon, double layer, double angle, const std::string& imgFile, double width, double height,
1661 const std::string& name, const Parameterised::Map& parameters) {
1662 // check conditions
1663 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1664 if (!checkElement(GNE_TAG_POILANE, element)) {
1665 return false;
1666 } else if (!checkValidAdditionalID(GNE_TAG_POILANE, id)) {
1667 return false;
1668 } else if (!checkNegative(GNE_TAG_POILANE, id, SUMO_ATTR_WIDTH, width, true)) {
1669 return false;
1670 } else if (!checkNegative(GNE_TAG_POILANE, id, SUMO_ATTR_HEIGHT, height, true)) {
1671 return false;
1672 } else if (!checkFileName(GNE_TAG_POILANE, id, SUMO_ATTR_IMGFILE, imgFile)) {
1673 return false;
1674 } else {
1675 // get lane
1676 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
1677 // check lane
1678 if (lane == nullptr) {
1680 } else if (!checkLanePosition(posOverLane, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
1682 } else {
1683 // parse icon
1685 // create POI (use GNEAdditional instead GNEPOI for add child references)
1686 GNEAdditional* POILane = new GNEPOI(id, myNet, myFileBucket, type, color, lane, posOverLane, friendlyPos, posLat, ic, layer,
1687 angle, imgFile, width, height, name, parameters);
1688 // add it depending of allow undoRed
1689 if (myAllowUndoRedo) {
1690 myNet->getUndoList()->begin(POILane, TLF("add POI lane '%'", id));
1691 myNet->getUndoList()->add(new GNEChange_Additional(POILane, true), true);
1692 myNet->getUndoList()->end();
1693 } else {
1694 // insert shape without allowing undo/redo
1696 lane->addChildElement(POILane);
1697 POILane->incRef("buildPOILane");
1698 }
1699 }
1700 return true;
1701 }
1702}
1703
1704
1705bool
1706GNEAdditionalHandler::buildPOIGeo(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1707 const RGBColor& color, const double lon, const double lat, const std::string& icon, double layer,
1708 double angle, const std::string& imgFile, double width, double height, const std::string& name,
1709 const Parameterised::Map& parameters) {
1710 // check conditions
1711 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1712 if (!checkElement(GNE_TAG_POIGEO, element)) {
1713 return false;
1714 } else if (!checkValidAdditionalID(GNE_TAG_POIGEO, id)) {
1715 return false;
1716 } else if (!checkNegative(GNE_TAG_POIGEO, id, SUMO_ATTR_WIDTH, width, true)) {
1717 return false;
1718 } else if (!checkNegative(GNE_TAG_POIGEO, id, SUMO_ATTR_HEIGHT, height, true)) {
1719 return false;
1720 } else if (!checkFileName(GNE_TAG_POIGEO, id, SUMO_ATTR_IMGFILE, imgFile)) {
1721 return false;
1722 } else if (GeoConvHelper::getFinal().getProjString() == "!") {
1723 return writeError(TLF("Could not build POI with ID '%' in netedit", id) + std::string("; ") + TL("Network requires a geo projection."));
1724 } else {
1725 // parse position
1726 const auto pos = Position(lon, lat);
1727 // parse icon
1729 // create POIGEO
1730 GNEPOI* POIGEO = new GNEPOI(id, myNet, myFileBucket, type, color, pos, true, ic, layer, angle, imgFile, width, height, name, parameters);
1731 // add it depending of allow undoRed
1732 if (myAllowUndoRedo) {
1733 myNet->getUndoList()->begin(POIGEO, TLF("add POI GEO '%'", id));
1734 myNet->getUndoList()->add(new GNEChange_Additional(POIGEO, true), true);
1735 myNet->getUndoList()->end();
1736 } else {
1737 // insert shape without allowing undo/redo
1739 POIGEO->incRef("buildPOIGeo");
1740 }
1741 return true;
1742 }
1743}
1744
1745
1746bool
1747GNEAdditionalHandler::buildJpsWalkableArea(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const PositionVector& shape,
1748 bool geo, const std::string& name, const Parameterised::Map& parameters) {
1749 // check conditions
1750 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1751 if (!checkElement(GNE_TAG_JPS_WALKABLEAREA, element)) {
1752 return false;
1754 return false;
1755 } else {
1756 // create walkable area
1757 GNEPoly* walkableArea = new GNEPoly(GNE_TAG_JPS_WALKABLEAREA, id, myNet, myFileBucket, shape, geo, name, parameters);
1758 // add it depending of allow undoRed
1759 if (myAllowUndoRedo) {
1760 myNet->getUndoList()->begin(walkableArea, TL("add jps walkable area '") + id + "'");
1761 myNet->getUndoList()->add(new GNEChange_Additional(walkableArea, true), true);
1762 myNet->getUndoList()->end();
1763 } else {
1764 // insert shape without allowing undo/redo
1766 walkableArea->incRef("addWalkableArea");
1767 }
1768 return true;
1769 }
1770}
1771
1772
1773bool
1774GNEAdditionalHandler::buildJpsObstacle(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const PositionVector& shape,
1775 bool geo, const std::string& name, const Parameterised::Map& parameters) {
1776 // check conditions
1777 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1778 if (!checkElement(GNE_TAG_JPS_OBSTACLE, element)) {
1779 return false;
1781 return false;
1782 } else {
1783 // create walkable area
1784 GNEPoly* obstacle = new GNEPoly(GNE_TAG_JPS_OBSTACLE, id, myNet, myFileBucket, shape, geo, name, parameters);
1785 // add it depending of allow undoRed
1786 if (myAllowUndoRedo) {
1787 myNet->getUndoList()->begin(obstacle, TL("add jps obstacle '") + id + "'");
1788 myNet->getUndoList()->add(new GNEChange_Additional(obstacle, true), true);
1789 myNet->getUndoList()->end();
1790 } else {
1791 // insert shape without allowing undo/redo
1793 obstacle->incRef("addObstacle");
1794 }
1795 return true;
1796 }
1797}
1798
1799
1800bool
1801GNEAdditionalHandler::accessExists(const GNEAdditional* stoppingPlaceParent, const GNEEdge* edge) {
1802 // check if exist another access for the same parent in the given edge
1803 for (const auto& access : stoppingPlaceParent->getChildAdditionals()) {
1804 // check tag
1805 if (access->getTagProperty()->getTag() == SUMO_TAG_ACCESS) {
1806 // check all siblings of the lane
1807 for (const auto& lane : edge->getChildLanes()) {
1808 if (access->getAttribute(SUMO_ATTR_LANE) == lane->getID()) {
1809 return false;
1810 }
1811 }
1812 }
1813 }
1814 return true;
1815}
1816
1817
1818bool
1820 // declare a vector to keep sorted rerouter children
1821 std::vector<std::pair<SUMOTime, SUMOTime>> sortedIntervals;
1822 // iterate over child additional
1823 for (const auto& rerouterChild : rerouter->getChildAdditionals()) {
1824 if (!rerouterChild->getTagProperty()->isSymbol()) {
1825 sortedIntervals.push_back(std::make_pair((SUMOTime)0., (SUMOTime)0.));
1826 // set begin and end
1827 sortedIntervals.back().first = TIME2STEPS(rerouterChild->getAttributeDouble(SUMO_ATTR_BEGIN));
1828 sortedIntervals.back().second = TIME2STEPS(rerouterChild->getAttributeDouble(SUMO_ATTR_END));
1829 }
1830 }
1831 // add new intervals
1832 sortedIntervals.push_back(std::make_pair(newBegin, newEnd));
1833 // sort children
1834 std::sort(sortedIntervals.begin(), sortedIntervals.end());
1835 // check overlapping after sorting
1836 for (int i = 0; i < (int)sortedIntervals.size() - 1; i++) {
1837 if (sortedIntervals.at(i).second > sortedIntervals.at(i + 1).first) {
1838 return false;
1839 }
1840 }
1841 return true;
1842}
1843
1844
1845bool
1846GNEAdditionalHandler::checkLanePosition(double pos, const double length, const double laneLength, const bool friendlyPos) {
1847 if (friendlyPos) {
1848 return true;
1849 }
1850 // adjust from and to (negative means that start at the end of lane and count backward)
1851 if (pos < 0) {
1852 pos += laneLength;
1853 }
1854 // check extremes
1855 if ((pos < 0) || (pos - POSITION_EPS > laneLength)) {
1856 return false;
1857 }
1858 // check pos + length
1859 if ((pos + length - POSITION_EPS) > laneLength) {
1860 return false;
1861 }
1862 // all OK
1863 return true;
1864}
1865
1866
1867bool
1868GNEAdditionalHandler::checkFriendlyPosSmallLanes(double pos, const double length, const double laneLength, const bool friendlyPos) {
1869 if (friendlyPos == true) {
1870 return true;
1871 } else if (OptionsCont::getOptions().getBool("e2.friendlyPos.automatic")) {
1872 // adjust from and to (negative means that start at the end of lane and count backward)
1873 if (pos < 0) {
1874 pos += laneLength;
1875 }
1876 // check extremes
1877 if ((pos < 0) || (pos > laneLength)) {
1878 return true;
1879 }
1880 // check pos + length
1881 if ((pos + length) > laneLength) {
1882 return true;
1883 }
1884 }
1885 return false;
1886}
1887
1888
1889bool
1890GNEAdditionalHandler::checkLaneDoublePosition(double from, double to, const double laneLength, const bool friendlyPos) {
1891 if (friendlyPos) {
1892 return true;
1893 }
1894 // adjust from and to (negative means that start at the end of lane and count backward)
1895 if (from == INVALID_DOUBLE) {
1896 from = 0;
1897 }
1898 if (to == INVALID_DOUBLE) {
1899 to = laneLength;
1900 }
1901 if (from < 0) {
1902 from += laneLength;
1903 }
1904 if (to < 0) {
1905 to += laneLength;
1906 }
1907 if ((to - from) < POSITION_EPS) {
1908 return false;
1909 }
1910 if ((from < 0) || (from > laneLength)) {
1911 return false;
1912 }
1913 if ((to < 0) || (to > laneLength && (toString(to) != toString(laneLength)))) {
1914 return false;
1915 }
1916 return true;
1917}
1918
1919
1920void
1921GNEAdditionalHandler::fixLaneDoublePosition(double& from, double& to, const double laneLength) {
1922 // adjust from (negative means that start at the end of lane and count backward)
1923 if (from == INVALID_DOUBLE) {
1924 from = 0;
1925 }
1926 if (to == INVALID_DOUBLE) {
1927 to = laneLength;
1928 }
1929 if (from < 0) {
1930 from += laneLength;
1931 }
1932 if (from < 0) {
1933 from = 0;
1934 } else if (from > laneLength) {
1935 from = laneLength;
1936 }
1937 // adjust to
1938 if (to < 0) {
1939 to += laneLength;
1940 }
1941 if (to < 0) {
1942 to = 0;
1943 } else if (to > laneLength) {
1944 to = laneLength;
1945 }
1946 // to has more priorty as from, and distance between from and to must be >= POSITION_EPS
1947 if ((to - from) < POSITION_EPS) {
1948 if (to >= POSITION_EPS) {
1949 from = to - POSITION_EPS;
1950 } else {
1951 from = 0;
1952 to = POSITION_EPS;
1953 }
1954 }
1955}
1956
1957
1958bool
1959GNEAdditionalHandler::checkMultiLanePosition(double fromPos, const double fromLaneLength, const double toPos, const double tolaneLength, const bool friendlyPos) {
1960 if (friendlyPos) {
1961 return true;
1962 } else {
1963 return (checkLanePosition(fromPos, 0, fromLaneLength, false) && checkLanePosition(toPos, 0, tolaneLength, false));
1964 }
1965}
1966
1967
1970 if (sumoBaseObject->getParentSumoBaseObject() == nullptr) {
1971 return nullptr;
1972 } else if (!sumoBaseObject->getParentSumoBaseObject()->hasStringAttribute(SUMO_ATTR_ID)) {
1973 return nullptr;
1974 } else {
1976 }
1977}
1978
1979
1982 if (sumoBaseObject->getParentSumoBaseObject() == nullptr) {
1983 // parent interval doesn't exist
1984 return nullptr;
1985 } else if (sumoBaseObject->getParentSumoBaseObject()->getParentSumoBaseObject() == nullptr) {
1986 // rerouter parent doesn't exist
1987 return nullptr;
1988 } else if (!sumoBaseObject->getParentSumoBaseObject()->getParentSumoBaseObject()->hasStringAttribute(SUMO_ATTR_ID) || // rerouter ID
1989 !sumoBaseObject->getParentSumoBaseObject()->hasTimeAttribute(SUMO_ATTR_BEGIN) || // interval begin
1990 !sumoBaseObject->getParentSumoBaseObject()->hasTimeAttribute(SUMO_ATTR_END)) { // interval end
1991 return nullptr;
1992 } else {
1997 }
1998}
1999
2000
2001std::vector<GNEEdge*>
2002GNEAdditionalHandler::parseEdges(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& edgeIDs) {
2003 std::vector<GNEEdge*> edges;
2004 for (const auto& edgeID : edgeIDs) {
2005 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
2006 // empty edges aren't allowed. If edge is empty, write error, clear edges and stop
2007 if (edge == nullptr) {
2008 writeError(TLF("Could not build % with ID '%' in netedit; % with ID '%' doesn't exist.", toString(tag), id, toString(SUMO_TAG_EDGE), edgeID));
2009 edges.clear();
2010 return edges;
2011 } else {
2012 edges.push_back(edge);
2013 }
2014 }
2015 return edges;
2016}
2017
2018
2019std::vector<GNELane*>
2020GNEAdditionalHandler::parseLanes(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& laneIDs) {
2021 std::vector<GNELane*> lanes;
2022 for (const auto& laneID : laneIDs) {
2023 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
2024 // empty lanes aren't allowed. If lane is empty, write error, clear lanes and stop
2025 if (lane == nullptr) {
2026 writeError(TLF("Could not build % with ID '%' in netedit; % with ID '%' doesn't exist.", toString(tag), id, toString(SUMO_TAG_LANE), laneID));
2027 lanes.clear();
2028 return lanes;
2029 } else {
2030 lanes.push_back(lane);
2031 }
2032 }
2033 return lanes;
2034}
2035
2036
2038GNEAdditionalHandler::retrieveAdditionalElement(const std::vector<SumoXMLTag> tags, const std::string& id) {
2039 for (const auto& tag : tags) {
2040 // retrieve additional element
2041 auto additionalElement = myNet->getAttributeCarriers()->retrieveAdditional(tag, id, false);
2042 if (additionalElement) {
2043 return additionalElement;
2044 }
2045 }
2046 return nullptr;
2047}
2048
2049
2050bool
2052 if (additionalElement) {
2053 if (myOverwriteElements) {
2054 // delete element
2055 myNet->deleteAdditional(additionalElement, myNet->getUndoList());
2056 } else if (myRemainElements) {
2057 // duplicated demand
2058 return writeWarningDuplicated(tag, additionalElement->getID(), additionalElement->getTagProperty()->getTag());
2059 } else {
2060 // open overwrite dialog
2061 GNEOverwriteElement overwriteElementDialog(this, additionalElement);
2062 // continue depending of result
2063 if (overwriteElementDialog.getResult() == GNEOverwriteElement::Result::ACCEPT) {
2064 // delete element
2065 myNet->deleteAdditional(additionalElement, myNet->getUndoList());
2066 } else if (overwriteElementDialog.getResult() == GNEOverwriteElement::Result::CANCEL) {
2067 // duplicated demand
2068 return writeWarningDuplicated(tag, additionalElement->getID(), additionalElement->getTagProperty()->getTag());
2069 } else {
2070 return false;
2071 }
2072 }
2073 }
2074 return true;
2075}
2076
2077/****************************************************************************/
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:60
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_TOTALPOWER
total charge in W/s of the Charging Stations
@ 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:49
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"
FileBucket * myFileBucket
fileBucket
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 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 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 double height, const Parameterised::Map &parameters)
Builds a polygon using the given values.
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 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.
GNEApplicationWindowHelper::FileBucketHandler * getFileBucketHandler() const
get file bucket handler
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
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:773
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEEdge.cpp:646
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:222
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:216
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.
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition GNENet.cpp:739
void disableUpdateGeometry()
disable update geometry of elements after inserting or removing an element in net
Definition GNENet.cpp:2881
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
GNEApplicationWindow * getGNEApplicationWindow() const
get tag properties database
Definition GNENet.cpp:138
GNEUndoList * getUndoList() const
get undo list(used for simplify code)
Definition GNENet.cpp:156
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
void enableUpdateGeometry()
Definition GNENet.cpp:2875
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...
virtual void centerToPos(const Position &pos, bool applyZoom, double zoomDist=20)
centers to the chosen position
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:4894
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