Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEAdditionalHandler.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Builds trigger objects for netedit
19/****************************************************************************/
20#include <config.h>
21
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_CHARGEDELAY, chargeDelay, true)) {
298 return false;
299 } else if (!SUMOXMLDefinitions::ChargeTypes.hasString(chargeType)) {
300 return writeError(TLF("Could not build % with ID '%' in netedit; Invalid charge type '%' .", toString(SUMO_TAG_CHARGING_STATION), id, chargeType));
301 } else {
302 // build chargingStation
303 GNEAdditional* chargingStation = new GNEChargingStation(id, myNet, myFileBucket, lane, startPos, endPos, name, chargingPower, totalPower, efficiency, chargeInTransit,
304 chargeDelay, chargeType, waitingTime, parkingAreaID, friendlyPosition, parameters);
305 // insert depending of allowUndoRedo
306 if (myAllowUndoRedo) {
307 myNet->getUndoList()->begin(chargingStation, TL("add charging station '") + id + "'");
308 myNet->getUndoList()->add(new GNEChange_Additional(chargingStation, true), true);
309 myNet->getUndoList()->end();
310 } else {
311 myNet->getAttributeCarriers()->insertAdditional(chargingStation);
312 lane->addChildElement(chargingStation);
313 chargingStation->incRef("buildChargingStation");
314 }
315 return true;
316 }
317 }
318}
319
320
321bool
322GNEAdditionalHandler::buildParkingArea(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
323 const double startPos, const double endPos, const std::string& departPos, const std::string& name,
324 const std::vector<std::string>& badges, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad,
325 const double width, const double length, const double angle, const bool lefthand, const Parameterised::Map& parameters) {
326 // check conditions
327 const auto element = retrieveAdditionalElement({SUMO_TAG_PARKING_AREA}, id);
328 if (!checkElement(SUMO_TAG_PARKING_AREA, element)) {
329 return false;
331 return false;
332 } else {
333 // get lane
334 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
335 // get departPos double
336 const double departPosDouble = GNEAttributeCarrier::canParse<double>(departPos) ? GNEAttributeCarrier::parse<double>(departPos) : 0;
337 // check lane
338 if (lane == nullptr) {
340 } else if (!checkLaneDoublePosition(startPos, endPos, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosition)) {
342 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_ROADSIDE_CAPACITY, roadSideCapacity, true)) {
343 return false;
344 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_WIDTH, width, true)) {
345 return false;
346 } else if (!checkNegative(SUMO_TAG_PARKING_AREA, id, SUMO_ATTR_LENGTH, length, true)) {
347 return false;
348 } else if ((departPosDouble < 0) || (departPosDouble > lane->getParentEdge()->getNBEdge()->getFinalLength())) {
349 return writeError(TLF("Could not build parking area with ID '%' in netedit; Invalid departPos over lane.", id));
350 } else {
351 // build parkingArea
352 GNEAdditional* parkingArea = new GNEParkingArea(id, myNet, myFileBucket, lane, startPos, endPos, GNEAttributeCarrier::canParse<double>(departPos) ? departPos : "",
353 name, badges, friendlyPosition, roadSideCapacity, onRoad,
354 (width == 0) ? SUMO_const_laneWidth : width, length, angle, lefthand, parameters);
355 // insert depending of allowUndoRedo
356 if (myAllowUndoRedo) {
357 myNet->getUndoList()->begin(parkingArea, TL("add parking area '") + id + "'");
358 myNet->getUndoList()->add(new GNEChange_Additional(parkingArea, true), true);
359 myNet->getUndoList()->end();
360 } else {
362 lane->addChildElement(parkingArea);
363 parkingArea->incRef("buildParkingArea");
364 }
365 return true;
366 }
367 }
368}
369
370
371bool
372GNEAdditionalHandler::buildParkingSpace(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const double x, const double y, const double z,
373 const std::string& name, const std::string& width, const std::string& length, const std::string& angle, const double slope,
374 const Parameterised::Map& parameters) {
375 // check width and heights
376 if (!width.empty() && !GNEAttributeCarrier::canParse<double>(width)) {
377 return writeError(TL("Could not build parking space in netedit; attribute width cannot be parse to float."));
378 } else if (!length.empty() && !GNEAttributeCarrier::canParse<double>(length)) {
379 return writeError(TL("Could not build parking space in netedit; attribute length cannot be parse to float."));
380 } else if (!angle.empty() && !GNEAttributeCarrier::canParse<double>(angle)) {
381 return writeError(TL("Could not build parking space in netedit; attribute angle cannot be parse to float."));
382 } else {
383 // get lane
384 GNEAdditional* parkingArea = getAdditionalParent(sumoBaseObject, SUMO_TAG_PARKING_AREA);
385 // get double values
386 const double widthDouble = width.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(width);
387 const double lengthDouble = length.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(length);
388 const double angleDouble = angle.empty() ? INVALID_DOUBLE : GNEAttributeCarrier::parse<double>(angle);
389 // check lane
390 if (parkingArea == nullptr) {
392 } else if ((widthDouble != INVALID_DOUBLE) && !checkNegative(SUMO_TAG_PARKING_SPACE, parkingArea->getID(), SUMO_ATTR_WIDTH, widthDouble, true)) {
393 return false;
394 } else if ((lengthDouble != INVALID_DOUBLE) && !checkNegative(SUMO_TAG_PARKING_SPACE, parkingArea->getID(), SUMO_ATTR_LENGTH, lengthDouble, true)) {
395 return false;
396 } else {
397 // build parkingSpace
398 GNEAdditional* parkingSpace = new GNEParkingSpace(parkingArea, Position(x, y, z), widthDouble, lengthDouble, angleDouble, slope, name, parameters);
399 // insert depending of allowUndoRedo
400 if (myAllowUndoRedo) {
401 myNet->getUndoList()->begin(parkingSpace, TL("add parking space in '") + parkingArea->getID() + "'");
402 myNet->getUndoList()->add(new GNEChange_Additional(parkingSpace, true), true);
403 myNet->getUndoList()->end();
404 } else {
406 parkingArea->addChildElement(parkingSpace);
407 parkingSpace->incRef("buildParkingSpace");
408 }
409 // update geometry (due boundaries)
410 parkingSpace->updateGeometry();
411 return true;
412 }
413 }
414}
415
416
417bool
418GNEAdditionalHandler::buildE1Detector(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
419 const double position, const SUMOTime period, const std::string& file, const std::vector<std::string>& vehicleTypes,
420 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
421 const bool friendlyPos, const Parameterised::Map& parameters) {
422 // check conditions
423 const auto element = retrieveAdditionalElement({SUMO_TAG_INDUCTION_LOOP}, id);
424 if (!checkElement(SUMO_TAG_INDUCTION_LOOP, element)) {
425 return false;
427 return false;
428 } else {
429 // get lane
430 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
431 // check lane
432 if (lane == nullptr) {
434 } else if (!checkLanePosition(position, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
436 } else if (!checkNegative(SUMO_TAG_INDUCTION_LOOP, id, SUMO_ATTR_PERIOD, period, true)) {
437 return false;
438 } else if (!checkFileName(SUMO_TAG_INDUCTION_LOOP, id, SUMO_ATTR_FILE, file)) {
439 return false;
440 } else if (!checkListOfVehicleTypes(SUMO_TAG_INDUCTION_LOOP, id, vehicleTypes)) {
441 return false;
442 } else {
443 // build E1
444 GNEAdditional* detectorE1 = new GNEInductionLoopDetector(id, myNet, myFileBucket, lane, position, period, file, vehicleTypes,
445 nextEdges, detectPersons, name, friendlyPos, parameters);
446 // insert depending of allowUndoRedo
447 if (myAllowUndoRedo) {
448 myNet->getUndoList()->begin(detectorE1, TL("add induction loop '") + id + "'");
449 myNet->getUndoList()->add(new GNEChange_Additional(detectorE1, true), true);
450 myNet->getUndoList()->end();
451 } else {
453 lane->addChildElement(detectorE1);
454 detectorE1->incRef("buildDetectorE1");
455 }
456 return true;
457 }
458 }
459}
460
461
462bool
463GNEAdditionalHandler::buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID,
464 const double pos, const double length, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
465 const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
466 const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
467 const bool friendlyPos, const bool show, const Parameterised::Map& parameters) {
468 // check conditions
471 return false;
473 return false;
474 } else {
475 // get lane
476 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
477 // check lane
478 if (lane == nullptr) {
480 } else {
481 // check friendlyPos in small lanes
482 const bool friendlyPosCheck = checkFriendlyPosSmallLanes(pos, length, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos);
483 if (!checkLanePosition(pos, length, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPosCheck)) {
485 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_LENGTH, length, true)) {
486 return false;
487 } else if ((period != -1) && !checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
488 return false;
489 } else if ((trafficLight.size() > 0) && !(SUMOXMLDefinitions::isValidNetID(trafficLight))) {
490 // temporal
491 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; invalid traffic light ID.", id));
492 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
493 return false;
494 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_HALTING_SPEED_THRESHOLD, speedThreshold, true)) {
495 return false;
496 } else if (!checkNegative(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
497 return false;
498 } else if (!checkFileName(SUMO_TAG_LANE_AREA_DETECTOR, id, SUMO_ATTR_FILE, filename)) {
499 return false;
500 } else if (!checkListOfVehicleTypes(SUMO_TAG_LANE_AREA_DETECTOR, id, vehicleTypes)) {
501 return false;
502 } else {
503 // build E2 single lane
504 GNEAdditional* detectorE2 = new GNELaneAreaDetector(id, myNet, myFileBucket, lane, pos, length, period, trafficLight, filename,
505 vehicleTypes, nextEdges, detectPersons, name, timeThreshold,
506 speedThreshold, jamThreshold, friendlyPosCheck, show, parameters);
507 // insert depending of allowUndoRedo
508 if (myAllowUndoRedo) {
509 myNet->getUndoList()->begin(detectorE2, TL("add lane area detector '") + id + "'");
510 myNet->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
511 myNet->getUndoList()->end();
512 } else {
514 lane->addChildElement(detectorE2);
515 detectorE2->incRef("buildDetectorE2");
516 }
517 return true;
518 }
519 }
520 }
521}
522
523
524bool
525GNEAdditionalHandler::buildMultiLaneDetectorE2(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::vector<std::string>& laneIDs,
526 const double pos, const double endPos, const SUMOTime period, const std::string& trafficLight, const std::string& filename,
527 const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
528 const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold,
529 const bool friendlyPos, const bool show, const Parameterised::Map& parameters) {
530 // check conditions
533 return false;
535 return false;
536 } else {
537 // get lanes
538 const auto lanes = parseLanes(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, laneIDs);
539 // check lanes
540 if (lanes.empty()) {
541 return false;
542 } else {
543 // calculate path
545 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; Lanes aren't consecutives.", id));
546 } else if (!checkMultiLanePosition(
547 pos, lanes.front()->getParentEdge()->getNBEdge()->getFinalLength(),
548 endPos, lanes.back()->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
550 } else if ((period != -1) && !checkNegative(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
551 return false;
552 } else if ((trafficLight.size() > 0) && !(SUMOXMLDefinitions::isValidNetID(trafficLight))) {
553 // temporal
554 return writeError(TLF("Could not build lane area detector with ID '%' in netedit; invalid traffic light ID.", id));
556 return false;
558 return false;
560 return false;
562 return false;
563 } else if (!checkListOfVehicleTypes(GNE_TAG_MULTI_LANE_AREA_DETECTOR, id, vehicleTypes)) {
564 return false;
565 } else {
566 // build E2 multilane detector
567 GNEAdditional* detectorE2 = new GNELaneAreaDetector(id, myNet, myFileBucket, lanes, pos, endPos, period, trafficLight, filename,
568 vehicleTypes, nextEdges, detectPersons, name, timeThreshold,
569 speedThreshold, jamThreshold, friendlyPos, show, parameters);
570 // insert depending of allowUndoRedo
571 if (myAllowUndoRedo) {
572 myNet->getUndoList()->begin(detectorE2, TL("add lane area detector '") + id + "'");
573 myNet->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true);
574 myNet->getUndoList()->end();
575 } else {
577 for (const auto& lane : lanes) {
578 lane->addChildElement(detectorE2);
579 }
580 detectorE2->incRef("buildDetectorE2Multilane");
581 }
582 return true;
583 }
584 }
585 }
586}
587
588
589bool
590GNEAdditionalHandler::buildDetectorE3(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos, const SUMOTime period,
591 const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
592 const std::string& detectPersons, const std::string& name, const SUMOTime timeThreshold, const double speedThreshold,
593 const bool openEntry, const bool expectedArrival, const Parameterised::Map& parameters) {
594 // check conditions
597 return false;
599 return false;
600 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_PERIOD, period, true)) {
601 return false;
602 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
603 return false;
604 } else if (!checkNegative(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_HALTING_SPEED_THRESHOLD, speedThreshold, true)) {
605 return false;
606 } else if (!checkFileName(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, SUMO_ATTR_FILE, filename)) {
607 return false;
608 } else if (!checkListOfVehicleTypes(SUMO_TAG_ENTRY_EXIT_DETECTOR, id, vehicleTypes)) {
609 return false;
610 } else {
611 // build E3
612 GNEAdditional* E3 = new GNEMultiEntryExitDetector(id, myNet, myFileBucket, pos, period, filename, vehicleTypes, nextEdges, detectPersons,
613 name, timeThreshold, speedThreshold, openEntry, expectedArrival, parameters);
614 // insert depending of allowUndoRedo
615 if (myAllowUndoRedo) {
616 myNet->getUndoList()->begin(E3, TL("add entry-exit detector '") + id + "'");
617 myNet->getUndoList()->add(new GNEChange_Additional(E3, true), true);
618 myNet->getUndoList()->end();
619 } else {
621 E3->incRef("buildDetectorE3");
622 }
623 return true;
624 }
625}
626
627
628bool
629GNEAdditionalHandler::buildDetectorEntry(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos,
630 const bool friendlyPos, const Parameterised::Map& parameters) {
631 // get lane
632 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
633 // get E3 parent
635 // Check if Detector E3 parent and lane is correct
636 if (lane == nullptr) {
638 } else if (E3 == nullptr) {
640 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
642 } else {
643 // build entry instant
644 GNEAdditional* entry = new GNEEntryExitDetector(SUMO_TAG_DET_ENTRY, E3, lane, pos, friendlyPos, parameters);
645 // insert depending of allowUndoRedo
646 if (myAllowUndoRedo) {
647 myNet->getUndoList()->begin(entry, TL("add entry detector in '") + E3->getID() + "'");
648 myNet->getUndoList()->add(new GNEChange_Additional(entry, true), true);
649 myNet->getUndoList()->end();
650 } else {
652 lane->addChildElement(entry);
653 E3->addChildElement(entry);
654 entry->incRef("buildDetectorEntry");
655 }
656 return true;
657 }
658}
659
660
661bool
662GNEAdditionalHandler::buildDetectorExit(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& laneID, const double pos,
663 const bool friendlyPos, const Parameterised::Map& parameters) {
664 // get lane
665 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
666 // get E3 parent
668 // Check if Detector E3 parent and lane is correct
669 if (lane == nullptr) {
671 } else if (E3 == nullptr) {
673 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
675 } else {
676 // build exit instant
677 GNEAdditional* exit = new GNEEntryExitDetector(SUMO_TAG_DET_EXIT, E3, lane, pos, friendlyPos, parameters);
678 // insert depending of allowUndoRedo
679 if (myAllowUndoRedo) {
680 myNet->getUndoList()->begin(exit, TL("add exit detector in '") + E3->getID() + "'");
681 myNet->getUndoList()->add(new GNEChange_Additional(exit, true), true);
682 myNet->getUndoList()->end();
683 } else {
685 lane->addChildElement(exit);
686 E3->addChildElement(exit);
687 exit->incRef("buildDetectorExit");
688 }
689 return true;
690 }
691}
692
693
694bool
695GNEAdditionalHandler::buildDetectorE1Instant(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& laneID, double pos,
696 const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
697 const std::string& detectPersons, const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters) {
698 // check conditions
701 return false;
703 return false;
704 } else {
705 // get lane
706 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
707 // check lane
708 if (lane == nullptr) {
711 return false;
712 } else if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
714 } else {
715 // build E1 instant
716 GNEAdditional* detectorE1Instant = new GNEInstantInductionLoopDetector(id, myNet, myFileBucket, lane, pos, filename, vehicleTypes, nextEdges,
717 detectPersons, name, friendlyPos, parameters);
718 // insert depending of allowUndoRedo
719 if (myAllowUndoRedo) {
720 myNet->getUndoList()->begin(detectorE1Instant, TL("add instant induction loop '") + id + "'");
721 myNet->getUndoList()->add(new GNEChange_Additional(detectorE1Instant, true), true);
722 myNet->getUndoList()->end();
723 } else {
724 myNet->getAttributeCarriers()->insertAdditional(detectorE1Instant);
725 lane->addChildElement(detectorE1Instant);
726 detectorE1Instant->incRef("buildDetectorE1Instant");
727 }
728 return true;
729 }
730 }
731}
732
733
734bool
735GNEAdditionalHandler::buildLaneCalibrator(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& laneID, const double pos,
736 const std::string& name, const std::string& outfile, const SUMOTime period, const std::string& routeprobeID, const double jamThreshold, const std::vector<std::string>& vTypes,
737 const Parameterised::Map& parameters) {
738 // get lane
739 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
740 // get routeProbe
741 GNEAdditional* routeProbe = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_ROUTEPROBE, routeprobeID, false);
742 // check conditions
744 if (!checkElement(GNE_TAG_CALIBRATOR_LANE, element)) {
745 return false;
747 return false;
748 } else if ((routeprobeID.size() > 0) && (routeProbe == nullptr)) {
750 } else if (lane == nullptr) {
752 } else {
753 // check lane
754 if (!checkLanePosition(pos, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), false)) {
756 } else if (!checkNegative(GNE_TAG_CALIBRATOR_LANE, id, SUMO_ATTR_PERIOD, period, true)) {
757 return false;
758 } else if (!checkNegative(GNE_TAG_CALIBRATOR_LANE, id, SUMO_ATTR_JAM_DIST_THRESHOLD, jamThreshold, true)) {
759 return false;
760 } else {
761 // build Calibrator
762 GNEAdditional* calibrator = (routeProbe == nullptr) ?
763 new GNECalibrator(id, myNet, myFileBucket, lane, pos, period, name, outfile, jamThreshold, vTypes, parameters) :
764 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()->centerTo(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 = (routeProbe == nullptr) ?
817 new GNECalibrator(id, myNet, myFileBucket, edge, pos, period, name, outfile, jamThreshold, vTypes, parameters) :
818 new GNECalibrator(id, myNet, myFileBucket, edge, pos, period, name, outfile, routeProbe, jamThreshold, vTypes, parameters);
819 // insert depending of allowUndoRedo
820 if (myAllowUndoRedo) {
821 myNet->getUndoList()->begin(calibrator, TL("add calibrator '") + id + "'");
822 myNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true);
823 myNet->getUndoList()->end();
824 // check if center after creation
827 myNet->getViewNet()->centerTo(calibrator->getPositionInView(), false);
828 }
829 } else {
831 edge->addChildElement(calibrator);
832 if (routeProbe) {
833 routeProbe->addChildElement(calibrator);
834 }
835 calibrator->incRef("buildCalibrator");
836 }
837 return true;
838 }
839 }
840}
841
842
843bool
845 // get vType
846 GNEDemandElement* vType = myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, vehicleParameter.vtypeid.empty() ? DEFAULT_VTYPE_ID : vehicleParameter.vtypeid, false);
847 // get route
849 // get calibrator parent
851 // check parents
852 if (vType == nullptr) {
853 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_VTYPE}, vehicleParameter.vtypeid);
854 } else if (route == nullptr) {
855 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_ROUTE}, vehicleParameter.routeid);
856 } else if (calibrator == nullptr) {
857 return writeErrorInvalidParent(SUMO_TAG_FLOW, "", {SUMO_TAG_CALIBRATOR}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
858 } else {
859 // create calibrator flow
860 GNEAdditional* flow = new GNECalibratorFlow(calibrator, vType, route, vehicleParameter);
861 // insert depending of allowUndoRedo
862 if (myAllowUndoRedo) {
863 myNet->getUndoList()->begin(flow, TL("add calibrator flow in '") + calibrator->getID() + "'");
864 myNet->getUndoList()->add(new GNEChange_Additional(flow, true), true);
865 myNet->getUndoList()->end();
866 } else {
868 calibrator->addChildElement(flow);
869 route->addChildElement(flow);
870 vType->addChildElement(flow);
871 flow->incRef("buildCalibratorFlow");
872 }
873 return true;
874 }
875}
876
877
878bool
879GNEAdditionalHandler::buildRerouter(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
880 const std::vector<std::string>& edgeIDs, const double prob, const std::string& name,
881 const bool off, const bool optional, const SUMOTime timeThreshold,
882 const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) {
883 // check conditions
884 const auto element = retrieveAdditionalElement({SUMO_TAG_REROUTER}, id);
885 if (!checkElement(SUMO_TAG_REROUTER, element)) {
886 return false;
887 } else if (!checkValidAdditionalID(SUMO_TAG_REROUTER, id)) {
888 return false;
889 } else if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_PROB, prob, true)) {
890 return false;
891 } else if (!checkNegative(SUMO_TAG_REROUTER, id, SUMO_ATTR_HALTING_TIME_THRESHOLD, timeThreshold, true)) {
892 return false;
893 } else if (!checkListOfVehicleTypes(SUMO_TAG_REROUTER, id, vTypes)) {
894 return false;
895 } else {
896 // parse edges
897 std::vector<GNEEdge*> edges = parseEdges(SUMO_TAG_REROUTER, id, edgeIDs);
898 // check edges
899 if (edges.empty()) {
900 return false;
901 } else {
902 GNEAdditional* rerouter = nullptr;
903 // continue depending of position
904 if (pos == Position::INVALID) {
905 if (edges.size() > 0) {
906 PositionVector laneShape = edges.front()->getChildLanes().front()->getLaneShape();
907 // move to side
908 laneShape.move2side(3);
909 // create rerouter
910 rerouter = new GNERerouter(id, myNet, myFileBucket, laneShape.positionAtOffset2D(laneShape.length2D() - 6), name, prob, off, optional, timeThreshold, vTypes, parameters);
911 } else {
912 rerouter = new GNERerouter(id, myNet, myFileBucket, Position(0, 0), name, prob, off, optional, timeThreshold, vTypes, parameters);
913 }
914 } else {
915 rerouter = new GNERerouter(id, myNet, myFileBucket, pos, name, prob, off, optional, timeThreshold, vTypes, parameters);
916 }
917 // create rerouter Symbols
918 std::vector<GNEAdditional*> rerouterSymbols;
919 for (const auto& edge : edges) {
920 rerouterSymbols.push_back(new GNERerouterSymbol(rerouter, edge));
921 }
922 // insert depending of allowUndoRedo
923 if (myAllowUndoRedo) {
924 myNet->getUndoList()->begin(rerouter, TL("add rerouter '") + id + "'");
925 myNet->getUndoList()->add(new GNEChange_Additional(rerouter, true), true);
926 // add symbols
927 for (const auto& rerouterSymbol : rerouterSymbols) {
928 myNet->getUndoList()->add(new GNEChange_Additional(rerouterSymbol, true), true);
929 }
930 myNet->getUndoList()->end();
931 } else {
933 rerouter->incRef("buildRerouter");
934 // add symbols into rerouter
935 for (const auto& rerouterSymbol : rerouterSymbols) {
936 rerouter->addChildElement(rerouterSymbol);
937 }
938 // add symbols into edges
939 for (int i = 0; i < (int)edges.size(); i++) {
940 edges.at(i)->addChildElement(rerouterSymbols.at(i));
941 }
942 }
943 return true;
944 }
945 }
946}
947
948
949bool
951 // get rerouter parent
952 GNEAdditional* rerouter = getAdditionalParent(sumoBaseObject, SUMO_TAG_REROUTER);
953 // check if rerouter exist
954 if (rerouter == nullptr) {
955 return writeErrorInvalidParent(SUMO_TAG_INTERVAL, "", {SUMO_TAG_REROUTER}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
956 } else if (!checkNegative(SUMO_TAG_INTERVAL, rerouter->getID(), SUMO_ATTR_BEGIN, begin, true)) {
957 return false;
958 } else if (!checkNegative(SUMO_TAG_INTERVAL, rerouter->getID(), SUMO_ATTR_END, end, true)) {
959 return false;
960 } else if (end < begin) {
961 return writeError(TLF("Could not build interval with ID '%' in netedit; begin is greater than end.", rerouter->getID()));
962 } else {
963 // check if new interval will produce a overlapping
964 if (checkOverlappingRerouterIntervals(rerouter, begin, end)) {
965 // create rerouter interval and add it into rerouter parent
966 GNEAdditional* rerouterInterval = new GNERerouterInterval(rerouter, begin, end);
967 // insert depending of allowUndoRedo
968 if (myAllowUndoRedo) {
969 myNet->getUndoList()->begin(rerouterInterval, TL("add rerouter interval in '") + rerouter->getID() + "'");
970 myNet->getUndoList()->add(new GNEChange_Additional(rerouterInterval, true), true);
971 myNet->getUndoList()->end();
972 } else {
973 rerouter->addChildElement(rerouterInterval);
974 rerouterInterval->incRef("buildRerouterInterval");
975 }
976 } else {
977 return writeError(TLF("Could not build interval with begin '%' and end '%' in '%' due overlapping.", toString(begin), toString(end), rerouter->getID()));
978 }
979 // update centering boundary of rerouter parent
980 rerouter->updateCenteringBoundary(true);
981 return true;
982 }
983}
984
985
986bool
987GNEAdditionalHandler::buildClosingLaneReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedLaneID, SVCPermissions permissions) {
988 // get rerouter interval parent
989 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
990 // get closed lane
991 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(closedLaneID, false);
992 // check parents
993 if (lane == nullptr) {
995 } else if (rerouterInterval == nullptr) {
997 } else {
998 // create closing lane reroute
999 GNEAdditional* closingLaneReroute = new GNEClosingLaneReroute(rerouterInterval, lane, permissions);
1000 // add it to interval parent depending of allowUndoRedo
1001 if (myAllowUndoRedo) {
1002 myNet->getUndoList()->begin(closingLaneReroute, TL("add closing lane reroute in '") + lane->getID() + "'");
1003 myNet->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1004 myNet->getUndoList()->end();
1005 } else {
1006 rerouterInterval->addChildElement(closingLaneReroute);
1007 closingLaneReroute->incRef("buildClosingLaneReroute");
1008 }
1009 // update centering boundary of rerouter parent
1010 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1011 return true;
1012 }
1013}
1014
1015
1016bool
1017GNEAdditionalHandler::buildClosingReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& closedEdgeID, SVCPermissions permissions) {
1018 // get rerouter interval parent
1019 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1020 // get closed edge
1021 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(closedEdgeID, false);
1022 // check parents
1023 if (edge == nullptr) {
1025 } else if (rerouterInterval == nullptr) {
1027 } else {
1028 // create closing reroute
1029 GNEAdditional* closingLaneReroute = new GNEClosingReroute(rerouterInterval, edge, permissions);
1030 // add it to interval parent depending of allowUndoRedo
1031 if (myAllowUndoRedo) {
1032 myNet->getUndoList()->begin(closingLaneReroute, TL("add closing reroute in '") + edge->getID() + "'");
1033 myNet->getUndoList()->add(new GNEChange_Additional(closingLaneReroute, true), true);
1034 myNet->getUndoList()->end();
1035 } else {
1036 rerouterInterval->addChildElement(closingLaneReroute);
1037 closingLaneReroute->incRef("buildClosingLaneReroute");
1038 }
1039 // update centering boundary of rerouter parent
1040 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1041 return true;
1042 }
1043}
1044
1045bool
1046GNEAdditionalHandler::buildDestProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newEdgeDestinationID, const double probability) {
1047 // get rerouter interval parent
1048 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1049 // get edge
1050 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(newEdgeDestinationID, false);
1051 // check parents
1052 if (edge == nullptr) {
1053 return writeErrorInvalidParent(SUMO_TAG_DEST_PROB_REROUTE, "", {SUMO_TAG_EDGE}, newEdgeDestinationID);
1054 } else if (rerouterInterval == nullptr) {
1056 } else {
1057 // create dest probability reroute
1058 GNEAdditional* destProbReroute = new GNEDestProbReroute(rerouterInterval, edge, probability);
1059 // add it to interval parent depending of allowUndoRedo
1060 if (myAllowUndoRedo) {
1061 myNet->getUndoList()->begin(destProbReroute, TL("add dest prob reroute in '") + edge->getID() + "'");
1062 myNet->getUndoList()->add(new GNEChange_Additional(destProbReroute, true), true);
1063 myNet->getUndoList()->end();
1064 } else {
1065 rerouterInterval->addChildElement(destProbReroute);
1066 destProbReroute->incRef("builDestProbReroute");
1067 }
1068 // update centering boundary of rerouter parent
1069 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1070 return true;
1071 }
1072}
1073
1074
1075bool
1076GNEAdditionalHandler::buildParkingAreaReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newParkignAreaID, const double probability, const bool visible) {
1077 // get rerouter interval parent
1078 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1079 // get parking area
1080 GNEAdditional* parkingArea = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, newParkignAreaID, false);
1081 // check parents
1082 if (parkingArea == nullptr) {
1084 } else if (rerouterInterval == nullptr) {
1086 } else {
1087 // create parking area reroute
1088 GNEAdditional* parkingAreaReroute = new GNEParkingAreaReroute(rerouterInterval, parkingArea, probability, visible);
1089 // add it to interval parent depending of allowUndoRedo
1090 if (myAllowUndoRedo) {
1091 myNet->getUndoList()->begin(parkingAreaReroute, TL("add parking area reroute in '") + parkingArea->getID() + "'");
1092 myNet->getUndoList()->add(new GNEChange_Additional(parkingAreaReroute, true), true);
1093 myNet->getUndoList()->end();
1094 } else {
1095 rerouterInterval->addChildElement(parkingAreaReroute);
1096 parkingAreaReroute->incRef("builParkingAreaReroute");
1097 }
1098 // update centering boundary of rerouter parent
1099 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1100 return true;
1101 }
1102}
1103
1104
1105bool
1106GNEAdditionalHandler::buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& newRouteID, const double probability) {
1107 // get rerouter interval parent
1108 GNEAdditional* rerouterInterval = getRerouterIntervalParent(sumoBaseObject);
1109 // get route parent
1111 // check parents
1112 if (route == nullptr) {
1114 } else if (rerouterInterval == nullptr) {
1116 } else {
1117 // create rout prob reroute
1118 GNEAdditional* routeProbReroute = new GNERouteProbReroute(rerouterInterval, route, probability);
1119 // add it to interval parent depending of allowUndoRedo
1120 if (myAllowUndoRedo) {
1121 myNet->getUndoList()->begin(routeProbReroute, TL("add route prob reroute in '") + route->getID() + "'");
1122 myNet->getUndoList()->add(new GNEChange_Additional(routeProbReroute, true), true);
1123 myNet->getUndoList()->end();
1124 } else {
1125 rerouterInterval->addChildElement(routeProbReroute);
1126 routeProbReroute->incRef("buildRouteProbReroute");
1127 }
1128 // update centering boundary of rerouter parent
1129 rerouterInterval->getParentAdditionals().front()->updateCenteringBoundary(true);
1130 return true;
1131 }
1132}
1133
1134
1135bool
1136GNEAdditionalHandler::buildRouteProbe(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& edgeID, const SUMOTime period,
1137 const std::string& name, const std::string& file, const SUMOTime begin, const std::vector<std::string>& vTypes,
1138 const Parameterised::Map& parameters) {
1139 // check conditions
1140 const auto element = retrieveAdditionalElement({SUMO_TAG_ROUTEPROBE}, id);
1141 if (!checkElement(SUMO_TAG_ROUTEPROBE, element)) {
1142 return false;
1144 return false;
1145 } else {
1146 // get edge
1147 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1148 // check lane
1149 if (edge == nullptr) {
1151 } else if (!checkNegative(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_PERIOD, period, true)) {
1152 return false;
1153 } else if (!checkNegative(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_BEGIN, begin, true)) {
1154 return false;
1155 } else if (!checkFileName(SUMO_TAG_ROUTEPROBE, id, SUMO_ATTR_FILE, file)) {
1156 return false;
1157 } else {
1158 // build route probe
1159 GNEAdditional* routeProbe = new GNERouteProbe(id, myNet, myFileBucket, edge, period, name, file, begin, vTypes, parameters);
1160 // insert depending of allowUndoRedo
1161 if (myAllowUndoRedo) {
1162 myNet->getUndoList()->begin(routeProbe, TL("add route probe '") + id + "'");
1163 myNet->getUndoList()->add(new GNEChange_Additional(routeProbe, true), true);
1164 myNet->getUndoList()->end();
1165 // check if center after creation
1166 if (sumoBaseObject->hasBoolAttribute(GNE_ATTR_CENTER_AFTER_CREATION) &&
1168 myNet->getViewNet()->centerTo(routeProbe->getPositionInView(), false);
1169 }
1170 } else {
1172 edge->addChildElement(routeProbe);
1173 routeProbe->incRef("buildRouteProbe");
1174 }
1175 return true;
1176 }
1177 }
1178}
1179
1180
1181bool
1182GNEAdditionalHandler::buildVariableSpeedSign(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
1183 const std::vector<std::string>& laneIDs, const std::string& name, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) {
1184 // check conditions
1185 const auto element = retrieveAdditionalElement({SUMO_TAG_VSS}, id);
1186 if (!checkElement(SUMO_TAG_VSS, element)) {
1187 return false;
1188 } else if (!checkValidAdditionalID(SUMO_TAG_VSS, id)) {
1189 return false;
1190 } else {
1191 // parse lanes
1192 std::vector<GNELane*> lanes = parseLanes(SUMO_TAG_VSS, id, laneIDs);
1193 // check lane
1194 if (lanes.empty()) {
1195 return false;
1196 } else {
1197 // check vTypes
1198 if (!checkListOfVehicleTypes(SUMO_TAG_VSS, id, vTypes)) {
1199 return false;
1200 } else {
1201 // create VSS
1202 GNEAdditional* variableSpeedSign = new GNEVariableSpeedSign(id, myNet, myFileBucket, pos, name, vTypes, parameters);
1203 // create VSS Symbols
1204 std::vector<GNEAdditional*> VSSSymbols;
1205 for (const auto& lane : lanes) {
1206 VSSSymbols.push_back(new GNEVariableSpeedSignSymbol(variableSpeedSign, lane));
1207 }
1208 // insert depending of allowUndoRedo
1209 if (myAllowUndoRedo) {
1210 myNet->getUndoList()->begin(variableSpeedSign, TL("add Variable Speed Sign '") + id + "'");
1211 myNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSign, true), true);
1212 for (const auto& VSSSymbol : VSSSymbols) {
1213 myNet->getUndoList()->add(new GNEChange_Additional(VSSSymbol, true), true);
1214 }
1215 myNet->getUndoList()->end();
1216 } else {
1217 myNet->getAttributeCarriers()->insertAdditional(variableSpeedSign);
1218 variableSpeedSign->incRef("buildVariableSpeedSign");
1219 // add symbols into VSS
1220 for (const auto& VSSSymbol : VSSSymbols) {
1221 variableSpeedSign->addChildElement(VSSSymbol);
1222 }
1223 // add symbols into lanes
1224 for (int i = 0; i < (int)lanes.size(); i++) {
1225 lanes.at(i)->addChildElement(VSSSymbols.at(i));
1226 }
1227 }
1228 }
1229 return true;
1230 }
1231 }
1232}
1233
1234
1235bool
1237 // get VSS parent
1239 // check lane
1240 if (VSS == nullptr) {
1241 return writeErrorInvalidParent(SUMO_TAG_STEP, "", {SUMO_TAG_VSS}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1242 } else if (!checkNegative(SUMO_TAG_STEP, VSS->getID(), SUMO_ATTR_TIME, time, true)) {
1243 return false;
1244 } else {
1245 // create Variable Speed Sign
1246 GNEAdditional* variableSpeedSignStep = new GNEVariableSpeedSignStep(VSS, time, speed);
1247 // add it depending of allow undoRedo
1248 if (myAllowUndoRedo) {
1249 myNet->getUndoList()->begin(variableSpeedSignStep, TL("add VSS Step in '") + VSS->getID() + "'");
1250 myNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSignStep, true), true);
1251 myNet->getUndoList()->end();
1252 } else {
1253 VSS->addChildElement(variableSpeedSignStep);
1254 variableSpeedSignStep->incRef("buildVariableSpeedSignStep");
1255 }
1256 // update centering boundary of VSS parent
1257 VSS->updateCenteringBoundary(true);
1258 return true;
1259 }
1260}
1261
1262
1263bool
1264GNEAdditionalHandler::buildVaporizer(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const SUMOTime beginTime,
1265 const SUMOTime endTime, const std::string& name, const Parameterised::Map& parameters) {
1266 // check conditions
1267 const auto element = retrieveAdditionalElement({SUMO_TAG_VAPORIZER}, edgeID);
1268 if (!checkElement(SUMO_TAG_VAPORIZER, element)) {
1269 return false;
1270 } else if (!checkValidAdditionalID(SUMO_TAG_VAPORIZER, edgeID)) {
1271 return false;
1272 } else {
1273 // get edge
1274 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1275 // check lane
1276 if (edge == nullptr) {
1278 } else if (!checkNegative(SUMO_TAG_VAPORIZER, edge->getID(), SUMO_ATTR_BEGIN, beginTime, true)) {
1279 return false;
1280 } else if (!checkNegative(SUMO_TAG_VAPORIZER, edge->getID(), SUMO_ATTR_END, endTime, true)) {
1281 return false;
1282 } else if (endTime < beginTime) {
1283 return writeError(TLF("Could not build Vaporizer with ID '%' in netedit; begin is greater than end.", edge->getID()));
1284 } else {
1285 // build vaporizer
1286 GNEAdditional* vaporizer = new GNEVaporizer(myNet, myFileBucket, edge, beginTime, endTime, name, parameters);
1287 // add it depending of allow undoRed
1288 if (myAllowUndoRedo) {
1289 myNet->getUndoList()->begin(vaporizer, TL("add vaporizer in '") + edge->getID() + "'");
1290 myNet->getUndoList()->add(new GNEChange_Additional(vaporizer, true), true);
1291 myNet->getUndoList()->end();
1292 // check if center after creation
1293 if (sumoBaseObject->hasBoolAttribute(GNE_ATTR_CENTER_AFTER_CREATION) &&
1295 myNet->getViewNet()->centerTo(vaporizer->getPositionInView(), false);
1296 }
1297 } else {
1299 edge->addChildElement(vaporizer);
1300 vaporizer->incRef("buildVaporizer");
1301 }
1302 return true;
1303 }
1304 }
1305}
1306
1307
1308bool
1309GNEAdditionalHandler::buildTAZ(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const PositionVector& shape,
1310 const Position& center, const bool fill, const RGBColor& color, const std::vector<std::string>& edgeIDs,
1311 const std::string& name, const Parameterised::Map& parameters) {
1312 // parse edges
1313 const std::vector<GNEEdge*> edges = parseEdges(SUMO_TAG_TAZ, id, edgeIDs);
1314 if (edges.size() != edgeIDs.size()) {
1315 return false;
1316 } else {
1317 // check TAZShape
1318 PositionVector TAZShape = shape;
1319 if (TAZShape.size() == 0) {
1320 // declare boundary
1321 Boundary TAZBoundary;
1322 for (const auto& edge : edges) {
1323 TAZBoundary.add(edge->getCenteringBoundary());
1324 }
1325 // iterate over children and add sourceSinkEdge boundaries to make a taz shape
1326 for (const auto& sourceSink : sumoBaseObject->getSumoBaseObjectChildren()) {
1327 // check that child is a source or sink elements (to avoid other elements)
1328 if ((sourceSink->getTag() == SUMO_TAG_TAZSOURCE) || (sourceSink->getTag() == SUMO_TAG_TAZSINK)) {
1329 const GNEEdge* sourceSinkEdge = myNet->getAttributeCarriers()->retrieveEdge(sourceSink->getStringAttribute(SUMO_ATTR_ID), false);
1330 if (sourceSinkEdge) {
1331 TAZBoundary.add(sourceSinkEdge->getCenteringBoundary());
1332 }
1333 }
1334 }
1335 // update TAZShape
1336 TAZShape = TAZBoundary.getShape(true);
1337 }
1338 // check TAZ
1339 const auto element = retrieveAdditionalElement({SUMO_TAG_TAZ}, id);
1340 if (!checkElement(SUMO_TAG_TAZ, element)) {
1341 return false;
1342 } else if (!checkValidAdditionalID(SUMO_TAG_TAZ, id)) {
1343 return false;
1344 } else if (TAZShape.size() == 0) {
1345 return writeError(TLF("Could not build TAZ with ID '%' in netedit; Invalid Shape.", id));
1346 } else {
1347 // build TAZ with the given shape
1348 const Position center2 = center == Position::INVALID ? TAZShape.getCentroid() : center;
1349 GNEAdditional* TAZ = new GNETAZ(id, myNet, myFileBucket, TAZShape, center2, fill, color, name, parameters);
1350 // disable updating geometry of TAZ children during insertion (because in large nets provokes slowdowns)
1352 // add it depending of allow undoRed
1353 if (myAllowUndoRedo) {
1354 myNet->getUndoList()->begin(TAZ, TL("add TAZ '") + id + "'");
1355 myNet->getUndoList()->add(new GNEChange_Additional(TAZ, true), true);
1356 // create TAZEdges
1357 for (const auto& edge : edges) {
1358 // create TAZ Source using GNEChange_Additional
1359 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, 1);
1360 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSource, true), true);
1361 // create TAZ Sink using GNEChange_Additional
1362 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, 1);
1363 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSink, true), true);
1364 }
1365 myNet->getUndoList()->end();
1366 } else {
1368 TAZ->incRef("buildTAZ");
1369 for (const auto& edge : edges) {
1370 // create TAZ Source
1371 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, 1);
1373 TAZSource->incRef("buildTAZ");
1374 TAZ->addChildElement(TAZSource);
1375 edge->addChildElement(TAZSource);
1376 // create TAZ Sink
1377 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, 1);
1379 TAZSink->incRef("buildTAZ");
1380 TAZ->addChildElement(TAZSink);
1381 edge->addChildElement(TAZSink);
1382 }
1383 }
1384 // enable updating geometry again and update geometry of TAZ
1386 // update TAZ parent
1387 TAZ->updateGeometry();
1388 return true;
1389 }
1390 }
1391}
1392
1393
1394bool
1395GNEAdditionalHandler::buildTAZSource(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double departWeight) {
1396 // get TAZ parent
1398 // get edge
1399 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1400 // check parents
1401 if (TAZ == nullptr) {
1402 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_TAZ}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1403 } else if (edge == nullptr) {
1404 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_EDGE}, TAZ->getID());
1405 } else {
1406 // declare TAZ Source
1407 GNETAZSourceSink* existentTAZSource = nullptr;
1408 // first check if already exist a TAZ Source for the given edge and TAZ
1409 for (auto it = edge->getChildTAZSourceSinks().begin(); (it != edge->getChildTAZSourceSinks().end()) && !existentTAZSource; it++) {
1410 if (((*it)->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) && ((*it)->getParentAdditionals().front() == TAZ)) {
1411 existentTAZSource = (*it);
1412 }
1413 }
1414 // check if TAZSource has to be created
1415 if (existentTAZSource == nullptr) {
1416 // Create TAZ only with departWeight
1417 GNETAZSourceSink* TAZSource = new GNETAZSourceSink(SUMO_TAG_TAZSOURCE, TAZ, edge, departWeight);
1418 // add it depending of allow undoRed
1419 if (myAllowUndoRedo) {
1420 myNet->getUndoList()->begin(TAZ, TL("add TAZ Source in '") + TAZ->getID() + "'");
1421 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSource, true), true);
1422 myNet->getUndoList()->end();
1423 } else {
1425 TAZ->addChildElement(TAZSource);
1426 edge->addChildElement(TAZSource);
1427 TAZSource->incRef("buildTAZSource");
1428 }
1429 } else {
1430 // update TAZ Attribute depending of allow undoRed
1431 if (myAllowUndoRedo) {
1432 myNet->getUndoList()->begin(TAZ, TL("update TAZ Source in '") + TAZ->getID() + "'");
1433 existentTAZSource->setAttribute(SUMO_ATTR_WEIGHT, toString(departWeight), myNet->getUndoList());
1434 myNet->getUndoList()->end();
1435 } else {
1436 existentTAZSource->setAttribute(SUMO_ATTR_WEIGHT, toString(departWeight), nullptr);
1437 }
1438 }
1439 return true;
1440 }
1441}
1442
1443
1444bool
1445GNEAdditionalHandler::buildTAZSink(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& edgeID, const double arrivalWeight) {
1446 // get TAZ parent
1448 // get edge
1449 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
1450 // check parents
1451 if (TAZ == nullptr) {
1452 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_TAZ}, sumoBaseObject->getParentSumoBaseObject()->getStringAttribute(SUMO_ATTR_ID));
1453 } else if (edge == nullptr) {
1454 return writeErrorInvalidParent(SUMO_TAG_SOURCE, edgeID, {SUMO_TAG_EDGE}, TAZ->getID());
1455 } else {
1456 // declare TAZ Sink
1457 GNETAZSourceSink* existentTAZSink = nullptr;
1458 // first check if already exist a TAZ Sink for the given edge and TAZ
1459 for (auto it = edge->getChildTAZSourceSinks().begin(); (it != edge->getChildTAZSourceSinks().end()) && !existentTAZSink; it++) {
1460 if (((*it)->getTagProperty()->getTag() == SUMO_TAG_TAZSINK) && ((*it)->getParentAdditionals().front() == TAZ)) {
1461 existentTAZSink = (*it);
1462 }
1463 }
1464 // check if TAZSink has to be created
1465 if (existentTAZSink == nullptr) {
1466 // Create TAZ only with departWeight
1467 GNETAZSourceSink* TAZSink = new GNETAZSourceSink(SUMO_TAG_TAZSINK, TAZ, edge, arrivalWeight);
1468 // add it depending of allow undoRed
1469 if (myAllowUndoRedo) {
1470 myNet->getUndoList()->begin(TAZ, TL("add TAZ Sink in '") + TAZ->getID() + "'");
1471 myNet->getUndoList()->add(new GNEChange_TAZSourceSink(TAZSink, true), true);
1472 myNet->getUndoList()->end();
1473 } else {
1475 TAZ->addChildElement(TAZSink);
1476 edge->addChildElement(TAZSink);
1477 TAZSink->incRef("buildTAZSink");
1478 }
1479 } else {
1480 // update TAZ Attribute depending of allow undoRed
1481 if (myAllowUndoRedo) {
1482 myNet->getUndoList()->begin(TAZ, TL("update TAZ Sink in '") + TAZ->getID() + "'");
1483 existentTAZSink->setAttribute(SUMO_ATTR_WEIGHT, toString(arrivalWeight), myNet->getUndoList());
1484 myNet->getUndoList()->end();
1485 } else {
1486 existentTAZSink->setAttribute(SUMO_ATTR_WEIGHT, toString(arrivalWeight), nullptr);
1487 }
1488 }
1489 return true;
1490 }
1491}
1492
1493
1494bool
1495GNEAdditionalHandler::buildTractionSubstation(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const Position& pos,
1496 const double voltage, const double currentLimit, const Parameterised::Map& parameters) {
1497 // check conditions
1498 const auto element = retrieveAdditionalElement({SUMO_TAG_TRACTION_SUBSTATION}, id);
1500 return false;
1502 return false;
1503 } else if (!checkNegative(SUMO_TAG_TRACTION_SUBSTATION, id, SUMO_ATTR_VOLTAGE, voltage, true)) {
1504 return false;
1505 } else if (!checkNegative(SUMO_TAG_TRACTION_SUBSTATION, id, SUMO_ATTR_CURRENTLIMIT, currentLimit, true)) {
1506 return false;
1507 } else {
1508 // build traction substation
1509 GNEAdditional* tractionSubstation = new GNETractionSubstation(id, myNet, myFileBucket, pos, voltage, currentLimit, parameters);
1510 // insert depending of allowUndoRedo
1511 if (myAllowUndoRedo) {
1512 myNet->getUndoList()->begin(tractionSubstation, TL("add traction substation '") + id + "'");
1513 myNet->getUndoList()->add(new GNEChange_Additional(tractionSubstation, true), true);
1514 myNet->getUndoList()->end();
1515 } else {
1516 myNet->getAttributeCarriers()->insertAdditional(tractionSubstation);
1517 tractionSubstation->incRef("buildTractionSubstation");
1518 }
1519 return true;
1520 }
1521}
1522
1523
1524bool
1525GNEAdditionalHandler::buildOverheadWire(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& substationId,
1526 const std::vector<std::string>& laneIDs, const double startPos, const double endPos, const bool friendlyPos,
1527 const std::vector<std::string>& forbiddenInnerLanes, const Parameterised::Map& parameters) {
1528 // check conditions
1531 return false;
1533 return false;
1534 } else {
1535 // get lanes
1536 const auto lanes = parseLanes(SUMO_TAG_OVERHEAD_WIRE_SECTION, id, laneIDs);
1537 // get traction substation
1538 const auto tractionSubstation = myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, substationId, false);
1539 // check lanes
1540 if (lanes.empty()) {
1541 return false;
1542 } else {
1543 // calculate path
1545 return writeError(TLF("Could not build overhead wire with ID '%' in netedit; Lanes aren't consecutives.", id));
1546 } else if (!checkMultiLanePosition(
1547 startPos, lanes.front()->getParentEdge()->getNBEdge()->getFinalLength(),
1548 endPos, lanes.back()->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
1550 } else if (tractionSubstation == nullptr) {
1552 } else {
1553 // build Overhead Wire
1554 GNEAdditional* overheadWire = new GNEOverheadWire(id, myNet, myFileBucket, lanes, tractionSubstation, startPos, endPos, friendlyPos, forbiddenInnerLanes, parameters);
1555 // insert depending of allowUndoRedo
1556 if (myAllowUndoRedo) {
1557 myNet->getUndoList()->begin(overheadWire, TL("add overhead wire '") + id + "'");
1558 myNet->getUndoList()->add(new GNEChange_Additional(overheadWire, true), true);
1559 myNet->getUndoList()->end();
1560 } else {
1562 for (const auto& lane : lanes) {
1563 lane->addChildElement(overheadWire);
1564 }
1565 overheadWire->incRef("buildOverheadWire");
1566 }
1567 }
1568 return true;
1569 }
1570 }
1571}
1572
1573
1574bool
1575GNEAdditionalHandler::buildOverheadWireClamp(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& /* id */, const std::string& /* overheadWireIDStartClamp */,
1576 const std::string& /* laneIDStartClamp */, const std::string& /* overheadWireIDEndClamp */, const std::string& /* laneIDEndClamp */,
1577 const Parameterised::Map& /* parameters */) {
1578 //
1579 return false;
1580}
1581
1582
1583bool
1584GNEAdditionalHandler::buildPolygon(const CommonXMLStructure::SumoBaseObject* sumoBaseObject, const std::string& id, const std::string& type,
1585 const RGBColor& color, double layer, double angle, const std::string& imgFile, const PositionVector& shape,
1586 bool geo, bool fill, double lineWidth, const std::string& name, const Parameterised::Map& parameters) {
1587 // check conditions
1588 if (type == "jupedsim.walkable_area") {
1589 return buildJpsWalkableArea(sumoBaseObject, id, shape, geo, name, parameters);
1590 } else if (type == "jupedsim.obstacle") {
1591 return buildJpsObstacle(sumoBaseObject, id, shape, geo, name, parameters);
1592 } else {
1593 // check conditions
1594 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1595 if (!checkElement(SUMO_TAG_POLY, element)) {
1596 return false;
1597 } else if (!checkValidAdditionalID(SUMO_TAG_POLY, id)) {
1598 return false;
1599 } else if (!checkNegative(SUMO_TAG_POLY, id, SUMO_ATTR_LINEWIDTH, lineWidth, true)) {
1600 return false;
1601 } else {
1602 // create poly
1603 GNEPoly* poly = new GNEPoly(id, myNet, myFileBucket, type, shape, geo, fill, lineWidth, color, layer, angle, imgFile, name, parameters);
1604 // add it depending of allow undoRed
1605 if (myAllowUndoRedo) {
1606 myNet->getUndoList()->begin(poly, TL("add polygon '") + id + "'");
1607 myNet->getUndoList()->add(new GNEChange_Additional(poly, true), true);
1608 myNet->getUndoList()->end();
1609 } else {
1610 // insert shape without allowing undo/redo
1612 poly->incRef("addPolygon");
1613 }
1614 return true;
1615 }
1616 }
1617}
1618
1619
1620bool
1621GNEAdditionalHandler::buildPOI(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1622 const RGBColor& color, const double x, const double y, const std::string& icon, double layer, double angle,
1623 const std::string& imgFile, double width, double height, const std::string& name, const Parameterised::Map& parameters) {
1624 // check conditions
1625 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1626 if (!checkElement(SUMO_TAG_POI, element)) {
1627 return false;
1628 } else if (!checkValidAdditionalID(SUMO_TAG_POI, id)) {
1629 return false;
1630 } else if (!checkNegative(SUMO_TAG_POI, id, SUMO_ATTR_WIDTH, width, true)) {
1631 return false;
1632 } else if (!checkNegative(SUMO_TAG_POI, id, SUMO_ATTR_HEIGHT, height, true)) {
1633 return false;
1634 } else if (!checkFileName(SUMO_TAG_POI, id, SUMO_ATTR_IMGFILE, imgFile)) {
1635 return false;
1636 } else {
1637 // parse position
1638 const auto pos = Position(x, y);
1639 // parse icon
1641 // create POI
1642 GNEPOI* POI = new GNEPOI(id, myNet, myFileBucket, type, color, pos, false, ic, layer, angle, imgFile, width, height, name, parameters);
1643 // add it depending of allow undoRed
1644 if (myAllowUndoRedo) {
1645 myNet->getUndoList()->begin(POI, TLF("add POI '%'", id));
1646 myNet->getUndoList()->add(new GNEChange_Additional(POI, true), true);
1647 myNet->getUndoList()->end();
1648 } else {
1649 // insert shape without allowing undo/redo
1651 POI->incRef("addPOI");
1652 }
1653 return true;
1654 }
1655}
1656
1657
1658bool
1659GNEAdditionalHandler::buildPOILane(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1660 const RGBColor& color, const std::string& laneID, double posOverLane, const bool friendlyPos, double posLat,
1661 const std::string& icon, double layer, double angle, const std::string& imgFile, double width, double height,
1662 const std::string& name, const Parameterised::Map& parameters) {
1663 // check conditions
1664 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1665 if (!checkElement(GNE_TAG_POILANE, element)) {
1666 return false;
1667 } else if (!checkValidAdditionalID(GNE_TAG_POILANE, id)) {
1668 return false;
1669 } else if (!checkNegative(GNE_TAG_POILANE, id, SUMO_ATTR_WIDTH, width, true)) {
1670 return false;
1671 } else if (!checkNegative(GNE_TAG_POILANE, id, SUMO_ATTR_HEIGHT, height, true)) {
1672 return false;
1673 } else if (!checkFileName(GNE_TAG_POILANE, id, SUMO_ATTR_IMGFILE, imgFile)) {
1674 return false;
1675 } else {
1676 // get lane
1677 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
1678 // check lane
1679 if (lane == nullptr) {
1681 } else if (!checkLanePosition(posOverLane, 0, lane->getParentEdge()->getNBEdge()->getFinalLength(), friendlyPos)) {
1683 } else {
1684 // parse icon
1686 // create POI (use GNEAdditional instead GNEPOI for add child references)
1687 GNEAdditional* POILane = new GNEPOI(id, myNet, myFileBucket, type, color, lane, posOverLane, friendlyPos, posLat, ic, layer,
1688 angle, imgFile, width, height, name, parameters);
1689 // add it depending of allow undoRed
1690 if (myAllowUndoRedo) {
1691 myNet->getUndoList()->begin(POILane, TLF("add POI lane '%'", id));
1692 myNet->getUndoList()->add(new GNEChange_Additional(POILane, true), true);
1693 myNet->getUndoList()->end();
1694 } else {
1695 // insert shape without allowing undo/redo
1697 lane->addChildElement(POILane);
1698 POILane->incRef("buildPOILane");
1699 }
1700 }
1701 return true;
1702 }
1703}
1704
1705
1706bool
1707GNEAdditionalHandler::buildPOIGeo(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const std::string& type,
1708 const RGBColor& color, const double lon, const double lat, const std::string& icon, double layer,
1709 double angle, const std::string& imgFile, double width, double height, const std::string& name,
1710 const Parameterised::Map& parameters) {
1711 // check conditions
1712 const auto element = retrieveAdditionalElement(NamespaceIDs::POIs, id);
1713 if (!checkElement(GNE_TAG_POIGEO, element)) {
1714 return false;
1715 } else if (!checkValidAdditionalID(GNE_TAG_POIGEO, id)) {
1716 return false;
1717 } else if (!checkNegative(GNE_TAG_POIGEO, id, SUMO_ATTR_WIDTH, width, true)) {
1718 return false;
1719 } else if (!checkNegative(GNE_TAG_POIGEO, id, SUMO_ATTR_HEIGHT, height, true)) {
1720 return false;
1721 } else if (!checkFileName(GNE_TAG_POIGEO, id, SUMO_ATTR_IMGFILE, imgFile)) {
1722 return false;
1723 } else if (GeoConvHelper::getFinal().getProjString() == "!") {
1724 return writeError(TLF("Could not build POI with ID '%' in netedit", id) + std::string("; ") + TL("Network requires a geo projection."));
1725 } else {
1726 // parse position
1727 const auto pos = Position(lon, lat);
1728 // parse icon
1730 // create POIGEO
1731 GNEPOI* POIGEO = new GNEPOI(id, myNet, myFileBucket, type, color, pos, true, ic, layer, angle, imgFile, width, height, name, parameters);
1732 // add it depending of allow undoRed
1733 if (myAllowUndoRedo) {
1734 myNet->getUndoList()->begin(POIGEO, TLF("add POI GEO '%'", id));
1735 myNet->getUndoList()->add(new GNEChange_Additional(POIGEO, true), true);
1736 myNet->getUndoList()->end();
1737 } else {
1738 // insert shape without allowing undo/redo
1740 POIGEO->incRef("buildPOIGeo");
1741 }
1742 return true;
1743 }
1744}
1745
1746
1747bool
1748GNEAdditionalHandler::buildJpsWalkableArea(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const PositionVector& shape,
1749 bool geo, const std::string& name, const Parameterised::Map& parameters) {
1750 // check conditions
1751 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1752 if (!checkElement(GNE_TAG_JPS_WALKABLEAREA, element)) {
1753 return false;
1755 return false;
1756 } else {
1757 // create walkable area
1758 GNEPoly* walkableArea = new GNEPoly(GNE_TAG_JPS_WALKABLEAREA, id, myNet, myFileBucket, shape, geo, name, parameters);
1759 // add it depending of allow undoRed
1760 if (myAllowUndoRedo) {
1761 myNet->getUndoList()->begin(walkableArea, TL("add jps walkable area '") + id + "'");
1762 myNet->getUndoList()->add(new GNEChange_Additional(walkableArea, true), true);
1763 myNet->getUndoList()->end();
1764 } else {
1765 // insert shape without allowing undo/redo
1767 walkableArea->incRef("addWalkableArea");
1768 }
1769 return true;
1770 }
1771}
1772
1773
1774bool
1775GNEAdditionalHandler::buildJpsObstacle(const CommonXMLStructure::SumoBaseObject* /*sumoBaseObject*/, const std::string& id, const PositionVector& shape,
1776 bool geo, const std::string& name, const Parameterised::Map& parameters) {
1777 // check conditions
1778 const auto element = retrieveAdditionalElement(NamespaceIDs::polygons, id);
1779 if (!checkElement(GNE_TAG_JPS_OBSTACLE, element)) {
1780 return false;
1782 return false;
1783 } else {
1784 // create walkable area
1785 GNEPoly* obstacle = new GNEPoly(GNE_TAG_JPS_OBSTACLE, id, myNet, myFileBucket, shape, geo, name, parameters);
1786 // add it depending of allow undoRed
1787 if (myAllowUndoRedo) {
1788 myNet->getUndoList()->begin(obstacle, TL("add jps obstacle '") + id + "'");
1789 myNet->getUndoList()->add(new GNEChange_Additional(obstacle, true), true);
1790 myNet->getUndoList()->end();
1791 } else {
1792 // insert shape without allowing undo/redo
1794 obstacle->incRef("addObstacle");
1795 }
1796 return true;
1797 }
1798}
1799
1800
1801bool
1802GNEAdditionalHandler::accessExists(const GNEAdditional* stoppingPlaceParent, const GNEEdge* edge) {
1803 // check if exist another access for the same parent in the given edge
1804 for (const auto& access : stoppingPlaceParent->getChildAdditionals()) {
1805 // check tag
1806 if (access->getTagProperty()->getTag() == SUMO_TAG_ACCESS) {
1807 // check all siblings of the lane
1808 for (const auto& lane : edge->getChildLanes()) {
1809 if (access->getAttribute(SUMO_ATTR_LANE) == lane->getID()) {
1810 return false;
1811 }
1812 }
1813 }
1814 }
1815 return true;
1816}
1817
1818
1819bool
1821 // declare a vector to keep sorted rerouter children
1822 std::vector<std::pair<SUMOTime, SUMOTime>> sortedIntervals;
1823 // iterate over child additional
1824 for (const auto& rerouterChild : rerouter->getChildAdditionals()) {
1825 if (!rerouterChild->getTagProperty()->isSymbol()) {
1826 sortedIntervals.push_back(std::make_pair((SUMOTime)0., (SUMOTime)0.));
1827 // set begin and end
1828 sortedIntervals.back().first = TIME2STEPS(rerouterChild->getAttributeDouble(SUMO_ATTR_BEGIN));
1829 sortedIntervals.back().second = TIME2STEPS(rerouterChild->getAttributeDouble(SUMO_ATTR_END));
1830 }
1831 }
1832 // add new intervals
1833 sortedIntervals.push_back(std::make_pair(newBegin, newEnd));
1834 // sort children
1835 std::sort(sortedIntervals.begin(), sortedIntervals.end());
1836 // check overlapping after sorting
1837 for (int i = 0; i < (int)sortedIntervals.size() - 1; i++) {
1838 if (sortedIntervals.at(i).second > sortedIntervals.at(i + 1).first) {
1839 return false;
1840 }
1841 }
1842 return true;
1843}
1844
1845
1846bool
1847GNEAdditionalHandler::checkLanePosition(double pos, const double length, const double laneLength, const bool friendlyPos) {
1848 if (friendlyPos) {
1849 return true;
1850 }
1851 // adjust from and to (negative means that start at the end of lane and count backward)
1852 if (pos < 0) {
1853 pos += laneLength;
1854 }
1855 // check extremes
1856 if ((pos < 0) || (pos > laneLength)) {
1857 return false;
1858 }
1859 // check pos + length
1860 if ((pos + length) > laneLength) {
1861 return false;
1862 }
1863 // all OK
1864 return true;
1865}
1866
1867
1868bool
1869GNEAdditionalHandler::checkFriendlyPosSmallLanes(double pos, const double length, const double laneLength, const bool friendlyPos) {
1870 if (friendlyPos == true) {
1871 return true;
1872 } else if (OptionsCont::getOptions().getBool("e2.friendlyPos.automatic")) {
1873 // adjust from and to (negative means that start at the end of lane and count backward)
1874 if (pos < 0) {
1875 pos += laneLength;
1876 }
1877 // check extremes
1878 if ((pos < 0) || (pos > laneLength)) {
1879 return true;
1880 }
1881 // check pos + length
1882 if ((pos + length) > laneLength) {
1883 return true;
1884 }
1885 }
1886 return false;
1887}
1888
1889
1890bool
1891GNEAdditionalHandler::checkLaneDoublePosition(double from, double to, const double laneLength, const bool friendlyPos) {
1892 if (friendlyPos) {
1893 return true;
1894 }
1895 // adjust from and to (negative means that start at the end of lane and count backward)
1896 if (from == INVALID_DOUBLE) {
1897 from = 0;
1898 }
1899 if (to == INVALID_DOUBLE) {
1900 to = laneLength;
1901 }
1902 if (from < 0) {
1903 from += laneLength;
1904 }
1905 if (to < 0) {
1906 to += laneLength;
1907 }
1908 if ((to - from) < POSITION_EPS) {
1909 return false;
1910 }
1911 if ((from < 0) || (from > laneLength)) {
1912 return false;
1913 }
1914 if ((to < 0) || (to > laneLength)) {
1915 return false;
1916 }
1917 return true;
1918}
1919
1920
1921void
1922GNEAdditionalHandler::fixLaneDoublePosition(double& from, double& to, const double laneLength) {
1923 // adjust from (negative means that start at the end of lane and count backward)
1924 if (from == INVALID_DOUBLE) {
1925 from = 0;
1926 }
1927 if (to == INVALID_DOUBLE) {
1928 to = laneLength;
1929 }
1930 if (from < 0) {
1931 from += laneLength;
1932 }
1933 if (from < 0) {
1934 from = 0;
1935 } else if (from > laneLength) {
1936 from = laneLength;
1937 }
1938 // adjust to
1939 if (to < 0) {
1940 to += laneLength;
1941 }
1942 if (to < 0) {
1943 to = 0;
1944 } else if (to > laneLength) {
1945 to = laneLength;
1946 }
1947 // to has more priorty as from, and distance between from and to must be >= POSITION_EPS
1948 if ((to - from) < POSITION_EPS) {
1949 if (to >= POSITION_EPS) {
1950 from = to - POSITION_EPS;
1951 } else {
1952 from = 0;
1953 to = POSITION_EPS;
1954 }
1955 }
1956}
1957
1958
1959bool
1960GNEAdditionalHandler::checkMultiLanePosition(double fromPos, const double fromLaneLength, const double toPos, const double tolaneLength, const bool friendlyPos) {
1961 if (friendlyPos) {
1962 return true;
1963 } else {
1964 return (checkLanePosition(fromPos, 0, fromLaneLength, false) && checkLanePosition(toPos, 0, tolaneLength, false));
1965 }
1966}
1967
1968
1971 if (sumoBaseObject->getParentSumoBaseObject() == nullptr) {
1972 return nullptr;
1973 } else if (!sumoBaseObject->getParentSumoBaseObject()->hasStringAttribute(SUMO_ATTR_ID)) {
1974 return nullptr;
1975 } else {
1977 }
1978}
1979
1980
1983 if (sumoBaseObject->getParentSumoBaseObject() == nullptr) {
1984 // parent interval doesn't exist
1985 return nullptr;
1986 } else if (sumoBaseObject->getParentSumoBaseObject()->getParentSumoBaseObject() == nullptr) {
1987 // rerouter parent doesn't exist
1988 return nullptr;
1989 } else if (!sumoBaseObject->getParentSumoBaseObject()->getParentSumoBaseObject()->hasStringAttribute(SUMO_ATTR_ID) || // rerouter ID
1990 !sumoBaseObject->getParentSumoBaseObject()->hasTimeAttribute(SUMO_ATTR_BEGIN) || // interval begin
1991 !sumoBaseObject->getParentSumoBaseObject()->hasTimeAttribute(SUMO_ATTR_END)) { // interval end
1992 return nullptr;
1993 } else {
1998 }
1999}
2000
2001
2002std::vector<GNEEdge*>
2003GNEAdditionalHandler::parseEdges(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& edgeIDs) {
2004 std::vector<GNEEdge*> edges;
2005 for (const auto& edgeID : edgeIDs) {
2006 GNEEdge* edge = myNet->getAttributeCarriers()->retrieveEdge(edgeID, false);
2007 // empty edges aren't allowed. If edge is empty, write error, clear edges and stop
2008 if (edge == nullptr) {
2009 writeError(TLF("Could not build % with ID '%' in netedit; % with ID '%' doesn't exist.", toString(tag), id, toString(SUMO_TAG_EDGE), edgeID));
2010 edges.clear();
2011 return edges;
2012 } else {
2013 edges.push_back(edge);
2014 }
2015 }
2016 return edges;
2017}
2018
2019
2020std::vector<GNELane*>
2021GNEAdditionalHandler::parseLanes(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& laneIDs) {
2022 std::vector<GNELane*> lanes;
2023 for (const auto& laneID : laneIDs) {
2024 GNELane* lane = myNet->getAttributeCarriers()->retrieveLane(laneID, false);
2025 // empty lanes aren't allowed. If lane is empty, write error, clear lanes and stop
2026 if (lane == nullptr) {
2027 writeError(TLF("Could not build % with ID '%' in netedit; % with ID '%' doesn't exist.", toString(tag), id, toString(SUMO_TAG_LANE), laneID));
2028 lanes.clear();
2029 return lanes;
2030 } else {
2031 lanes.push_back(lane);
2032 }
2033 }
2034 return lanes;
2035}
2036
2037
2039GNEAdditionalHandler::retrieveAdditionalElement(const std::vector<SumoXMLTag> tags, const std::string& id) {
2040 for (const auto& tag : tags) {
2041 // retrieve additional element
2042 auto additionalElement = myNet->getAttributeCarriers()->retrieveAdditional(tag, id, false);
2043 if (additionalElement) {
2044 return additionalElement;
2045 }
2046 }
2047 return nullptr;
2048}
2049
2050
2051bool
2053 if (additionalElement) {
2054 if (myOverwriteElements) {
2055 // delete element
2056 myNet->deleteAdditional(additionalElement, myNet->getUndoList());
2057 } else if (myRemainElements) {
2058 // duplicated demand
2059 return writeWarningDuplicated(tag, additionalElement->getID(), additionalElement->getTagProperty()->getTag());
2060 } else {
2061 // open overwrite dialog
2062 GNEOverwriteElement overwriteElementDialog(this, additionalElement);
2063 // continue depending of result
2064 if (overwriteElementDialog.getResult() == GNEOverwriteElement::Result::ACCEPT) {
2065 // delete element
2066 myNet->deleteAdditional(additionalElement, myNet->getUndoList());
2067 } else if (overwriteElementDialog.getResult() == GNEOverwriteElement::Result::CANCEL) {
2068 // duplicated demand
2069 return writeWarningDuplicated(tag, additionalElement->getID(), additionalElement->getTagProperty()->getTag());
2070 } else {
2071 return false;
2072 }
2073 }
2074 }
2075 return true;
2076}
2077
2078/****************************************************************************/
const unsigned char E3[]
Definition E3.cpp:22
long long int SUMOTime
Definition GUI.h:36
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
#define TIME2STEPS(x)
Definition SUMOTime.h:57
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_VTYPE_ID
POIIcon
POI icons.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TRACTION_SUBSTATION
A traction substation.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_CLOSING_REROUTE
reroute of type closing
@ SUMO_TAG_REROUTER
A rerouter.
@ GNE_TAG_MULTI_LANE_AREA_DETECTOR
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_STEP
trigger: a step description
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_DET_ENTRY
an e3 entry point
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
@ SUMO_TAG_ROUTE
description of a route
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_OVERHEAD_WIRE_SECTION
An overhead wire section.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_SOURCE
a source
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ SUMO_TAG_DEST_PROB_REROUTE
probability of destination of a reroute
@ GNE_TAG_POILANE
Point of interest over Lane.
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ SUMO_TAG_DET_EXIT
an e3 exit point
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_CLOSING_LANE_REROUTE
lane of a reroute of type closing
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_LANE
@ GNE_ATTR_CENTER_AFTER_CREATION
flag to center camera after element creation
@ SUMO_ATTR_FILE
@ SUMO_ATTR_JAM_DIST_THRESHOLD
@ SUMO_ATTR_PARKING_LENGTH
@ SUMO_ATTR_VOLTAGE
voltage of the traction substation [V]
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_LINEWIDTH
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_CONTAINER_CAPACITY
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ROADSIDE_CAPACITY
@ SUMO_ATTR_CURRENTLIMIT
current limit of the traction substation [A]
@ SUMO_ATTR_CHARGINGPOWER
@ SUMO_ATTR_PROB
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_CHARGEDELAY
Delay in the charge of charging stations (different of waiting time)
@ SUMO_ATTR_TIME
trigger: the time of the step
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
const double SUMO_const_laneWidth
Definition StdDefs.h:52
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:75
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
Definition Boundary.cpp:444
bool writeError(const std::string &error)
write error and enable error creating element
bool checkValidDetectorID(const SumoXMLTag tag, const std::string &value)
check if the given detector ID is valid
bool checkListOfVehicleTypes(const SumoXMLTag tag, const std::string &id, const std::vector< std::string > &vTypeIDs)
check list of IDs
bool writeWarningDuplicated(const SumoXMLTag tag, const std::string &id, const SumoXMLTag checkedTag)
write warning duplicated element
bool writeErrorInvalidParent(const SumoXMLTag tag, const std::string &id, const std::vector< SumoXMLTag > parentTags, const std::string &parentID)
write error "invalid parent element" giving ids of current and parent element
bool myOverwriteElements
overwrite elements
bool checkValidAdditionalID(const SumoXMLTag tag, const std::string &value)
check if the given additional ID is valid
bool checkFileName(const SumoXMLTag tag, const std::string &id, const SumoXMLAttr attribute, const std::string &value)
check if the given filename is valid
bool writeErrorInvalidPosition(const SumoXMLTag tag, const std::string &id)
write error "invalid position"
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 buildSingleLaneDetectorE2(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double pos, const double length, const SUMOTime period, const std::string &trafficLight, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos, const bool show, const Parameterised::Map &parameters)
Builds a single-lane Area Detector (E2)
bool checkOverlappingRerouterIntervals(GNEAdditional *rerouter, const SUMOTime newBegin, const SUMOTime newEnd)
check if an overlapping is produced in rerouter if a interval with certain begin and end is inserted
GNENet * myNet
pointer to GNENet
bool buildJpsObstacle(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, bool geo, const std::string &name, const Parameterised::Map &parameters)
Builds a JuPedSim obstacle using the given values.
bool buildParkingArea(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &laneID, const double startPos, const double endPos, const std::string &departPos, const std::string &name, const std::vector< std::string > &badges, const bool friendlyPosition, const int roadSideCapacity, const bool onRoad, const double width, const double length, const double angle, const bool lefthand, const Parameterised::Map &parameters)
Builds a Parking Area.
bool buildTAZ(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const PositionVector &shape, const Position &center, const bool fill, const RGBColor &color, const std::vector< std::string > &edgeIDs, const std::string &name, const Parameterised::Map &parameters)
Builds a TAZ (Traffic Assignment Zone)
bool buildVaporizer(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const SUMOTime from, const SUMOTime endTime, const std::string &name, const Parameterised::Map &parameters)
Builds a vaporizer (lane speed additional)
bool buildRouteProbe(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &edgeID, const SUMOTime period, const std::string &name, const std::string &file, const SUMOTime begin, const std::vector< std::string > &vTypes, const Parameterised::Map &parameters)
builds a Route probe
bool buildDetectorE3(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const Position &pos, const SUMOTime period, const std::string &filename, const std::vector< std::string > &vehicleTypes, const std::vector< std::string > &nextEdges, const std::string &detectPersons, const std::string &name, const SUMOTime timeThreshold, const double speedThreshold, const bool openEntry, const bool expectedArrival, const Parameterised::Map &parameters)
Builds a multi entry exit detector (E3)
bool buildRouteProbReroute(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &newRouteID, const double probability)
builds a route prob reroute
bool buildPolygon(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &type, const RGBColor &color, const double layer, const double angle, const std::string &imgFile, const PositionVector &shape, const bool geo, const bool fill, const double lineWidth, const std::string &name, const Parameterised::Map &parameters)
Builds a polygon using the given values.
bool checkMultiLanePosition(double fromPos, const double fromLaneLength, const double toPos, const double tolaneLength, const bool friendlyPos)
check if the given positions over two lanes are valid
virtual void updateCenteringBoundary(const bool updateGrid)=0
update centering boundary (implies change in RTREE)
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
virtual Position getPositionInView() const =0
Returns position of additional in view.
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:755
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEEdge.cpp:628
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > & getChildTAZSourceSinks() const
return child TAZSourceSinks (Set)
void addChildElement(ChildType *element)
add child without updating parent (ONLY used if we're creating elements without undo-redo)
bool allowPedestrians() const
check if current lane allow pedestrians
Definition GNELane.cpp:220
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:214
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
void insertTAZSourceSink(GNETAZSourceSink *sourceSink)
Insert a sourceSink element in container.
GNEAdditional * retrieveRerouterInterval(const std::string &rerouterID, const SUMOTime begin, const SUMOTime end) const
Returns the rerouter interval defined by given begin and end.
void insertAdditional(GNEAdditional *additional)
Insert a additional element in container.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition GNENet.cpp:736
void disableUpdateGeometry()
disable update geometry of elements after inserting or removing an element in net
Definition GNENet.cpp:2875
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:2869
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 centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition NBEdge.cpp:4884
static const std::vector< SumoXMLTag > busStops
busStops namespace
static const std::vector< SumoXMLTag > laneAreaDetectors
lane area detectors namespace
static const std::vector< SumoXMLTag > POIs
POIs namespace.
static const std::vector< SumoXMLTag > calibrators
calibrators namespace
static const std::vector< SumoXMLTag > polygons
polygon namespace
static OptionsCont & getOptions()
Retrieves the options.
C++ TraCI client API implementation.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:323
A list of positions.
double length2D() const
Returns the length.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Position positionAtOffset2D(double pos, double lateralOffset=0, bool extrapolateBeyond=false) const
Returns the position at the given length.
Structure representing possible vehicle parameter.
std::string vtypeid
The vehicle's type id.
std::string routeid
The vehicle's route id.
static StringBijection< ChargeType > ChargeTypes
charge type
static StringBijection< POIIcon > POIIcons
POI icon values.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
bool hasString(const std::string &str) const
check if the given string exist
T get(const std::string &str) const
get key