Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNENetHelper.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-2023 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// Helper for GNENet
19/****************************************************************************/
20
22#include <netedit/GNENet.h>
23#include <netedit/GNEViewNet.h>
47
48#include "GNENetHelper.h"
49
50// ---------------------------------------------------------------------------
51// GNENetHelper::AttributeCarriers - methods
52// ---------------------------------------------------------------------------
53
55 myNet(net),
56 myStopIndex(0) {
57 // fill additionals with tags
60 for (const auto& additionalTag : additionalTags) {
61 myAdditionals.insert(std::make_pair(additionalTag.getTag(), std::set<GNEAdditional*>()));
62 }
63 // fill demand elements with tags
65 for (const auto& demandElementTag : demandElementTags) {
66 myDemandElements.insert(std::make_pair(demandElementTag.getTag(), std::set<GNEDemandElement*>()));
67 }
69 for (const auto& stopTag : stopTags) {
70 myDemandElements.insert(std::make_pair(stopTag.getTag(), std::set<GNEDemandElement*>()));
71 }
72 // fill data elements with tags
74 for (const auto& genericDataElementTag : genericDataElementTags) {
75 myGenericDatas.insert(std::make_pair(genericDataElementTag.getTag(), std::set<GNEGenericData*>()));
76 }
77 // fill meanDatas with tags
79 for (const auto& meanDataTag : meanDataTags) {
80 myMeanDatas.insert(std::make_pair(meanDataTag.getTag(), std::set<GNEMeanData*>()));
81 }
82}
83
84
86 // Drop EdgeTypes
87 for (const auto& edgeType : myEdgeTypes) {
88 edgeType.second->decRef("GNENetHelper::~GNENet");
89 // show extra information for tests
90 WRITE_DEBUG("Deleting unreferenced " + edgeType.second->getTagStr() + " '" + edgeType.second->getID() + "' in AttributeCarriers destructor");
91 delete edgeType.second;
92 }
93 // Drop Edges
94 for (const auto& edge : myEdges) {
95 edge.second->decRef("GNENetHelper::~GNENet");
96 // show extra information for tests
97 WRITE_DEBUG("Deleting unreferenced " + edge.second->getTagStr() + " '" + edge.second->getID() + "' in AttributeCarriers destructor");
98 delete edge.second;
99 }
100 // Drop myJunctions
101 for (const auto& junction : myJunctions) {
102 junction.second->decRef("GNENetHelper::~GNENet");
103 // show extra information for tests
104 WRITE_DEBUG("Deleting unreferenced " + junction.second->getTagStr() + " '" + junction.second->getID() + "' in AttributeCarriers destructor");
105 delete junction.second;
106 }
107 // Drop Additionals (Only used for additionals that were inserted without using GNEChange_Additional)
108 for (const auto& additionalTag : myAdditionals) {
109 for (const auto& additional : additionalTag.second) {
110 // decrease reference manually (because it was increased manually in GNEAdditionalHandler)
111 additional->decRef();
112 // show extra information for tests
113 WRITE_DEBUG("Deleting unreferenced " + additional->getTagStr() + " in AttributeCarriers destructor");
114 delete additional;
115 }
116 }
117 // Drop demand elements (Only used for demand elements that were inserted without using GNEChange_DemandElement, for example the default VType")
118 for (const auto& demandElementTag : myDemandElements) {
119 for (const auto& demandElement : demandElementTag.second) {
120 // decrease reference manually (because it was increased manually in GNERouteHandler)
121 demandElement->decRef();
122 // show extra information for tests
123 if (demandElement->getTagProperty().isType()) {
124 // special case for default VTypes
125 if (DEFAULT_VTYPES.count(demandElement->getID()) == 0) {
126 WRITE_DEBUG("Deleting unreferenced " + demandElement->getTagStr() + " in AttributeCarriers destructor");
127 }
128 } else {
129 WRITE_DEBUG("Deleting unreferenced " + demandElement->getTagStr() + " in AttributeCarriers destructor");
130 }
131 delete demandElement;
132 }
133 }
134 // Drop dataSets (Only used for TAZElements that were inserted without using GNEChange_DataSets)
135 for (const auto& dataSet : myDataSets) {
136 // decrease reference manually (because it was increased manually in GNEDataHandler)
137 dataSet->decRef();
138 // show extra information for tests
139 WRITE_DEBUG("Deleting unreferenced " + dataSet->getTagStr() + " in AttributeCarriers destructor");
140 delete dataSet;
141 }
142 // Drop MeanDatas (Only used for meanDatas that were inserted without using GNEChange_MeanData)
143 for (const auto& meanDataTag : myMeanDatas) {
144 for (const auto& meanData : meanDataTag.second) {
145 // decrease reference manually (because it was increased manually in GNEMeanDataHandler)
146 meanData->decRef();
147 // show extra information for tests
148 WRITE_DEBUG("Deleting unreferenced " + meanData->getTagStr() + " in AttributeCarriers destructor");
149 delete meanData;
150 }
151 }
152}
153
154
155void
157 std::map<std::string, GNEEdge*> newEdgeMap;
158 std::map<std::string, GNEJunction*> newJunctionMap;
159 // fill newEdgeMap
160 for (const auto& edge : myEdges) {
161 edge.second->setMicrosimID(edge.second->getNBEdge()->getID());
162 newEdgeMap[edge.second->getNBEdge()->getID()] = edge.second;
163 }
164 for (const auto& junction : myJunctions) {
165 newJunctionMap[junction.second->getNBNode()->getID()] = junction.second;
166 junction.second->setMicrosimID(junction.second->getNBNode()->getID());
167 }
168 myEdges = newEdgeMap;
169 myJunctions = newJunctionMap;
170}
171
172
173bool
175 // check what type of AC
176 if (AC->getTagProperty().getTag() == SUMO_TAG_JUNCTION) {
177 // Junction
178 const GNEJunction* junction = myJunctions.at(AC->getID());
179 if (junction->getNBNode()->getShape().size() == 0) {
180 return shape.around(junction->getNBNode()->getCenter());
181 } else {
182 return (shape.overlapsWith(junction->getNBNode()->getShape()));
183 }
184 } else if (AC->getTagProperty().getTag() == SUMO_TAG_EDGE) {
185 // Edge
186 for (const auto& lane : myEdges.at(AC->getID())->getLanes()) {
187 if (shape.overlapsWith(lane->getLaneShape())) {
188 return true;
189 }
190 }
191 return false;
192 } else if (AC->getTagProperty().getTag() == SUMO_TAG_LANE) {
193 // Lane
194 return shape.overlapsWith(retrieveLane(AC->getID())->getLaneShape());
195 } else if (AC->getTagProperty().getTag() == SUMO_TAG_CONNECTION) {
196 // connection
197 return shape.overlapsWith(dynamic_cast<GNEConnection*>(AC)->getConnectionShape());
198 } else if (AC->getTagProperty().getTag() == SUMO_TAG_CROSSING) {
199 // crossing
200 return shape.overlapsWith(dynamic_cast<GNECrossing*>(AC)->getCrossingShape());
201 } else if (AC->getTagProperty().isAdditionalElement()) {
202 // Additional (including shapes and TAZs
203 const GNEAdditional* additional = retrieveAdditional(AC);
204 if (additional->getAdditionalGeometry().getShape().size() <= 1) {
205 return shape.around(additional->getPositionInView());
206 } else {
207 return shape.overlapsWith(additional->getAdditionalGeometry().getShape());
208 }
209 } else {
210 return false;
211 }
212}
213
214
217 // obtain blocked GUIGlObject
219 // Make sure that object exists
220 if (object != nullptr) {
221 // unblock and try to parse to AttributeCarrier
223 GNEAttributeCarrier* ac = dynamic_cast<GNEAttributeCarrier*>(object);
224 // If was successfully parsed, return it
225 if (ac == nullptr) {
226 throw ProcessError("GUIGlObject does not match the declared type");
227 } else {
228 return ac;
229 }
230 } else if (hardFail) {
231 throw ProcessError("Attempted to retrieve non-existant GUIGlObject");
232 } else {
233 return nullptr;
234 }
235}
236
237
238std::vector<GNEAttributeCarrier*>
240 std::vector<GNEAttributeCarrier*> result;
241 if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_JUNCTION)) {
242 for (const auto& junction : myJunctions) {
243 result.push_back(junction.second);
244 }
245 } else if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_EDGE)) {
246 for (const auto& edge : myEdges) {
247 result.push_back(edge.second);
248 }
249 } else if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_LANE)) {
250 for (const auto& lane : myLanes) {
251 result.push_back(lane);
252 }
253 } else if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_CONNECTION)) {
254 for (const auto& connection : myConnections) {
255 result.push_back(connection);
256 }
257 } else if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_CROSSING)) {
258 for (const auto& crossing : myCrossings) {
259 result.push_back(crossing);
260 }
261 } else if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_WALKINGAREA)) {
262 for (const auto& walkingArea : myWalkingAreas) {
263 result.push_back(walkingArea);
264 }
266 for (const auto& additional : myAdditionals.at(tag)) {
267 result.push_back(additional);
268 }
270 for (const auto& demandElemet : myDemandElements.at(tag)) {
271 result.push_back(demandElemet);
272 }
273 } else if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_DATASET)) {
274 for (const auto& dataSet : myDataSets) {
275 result.push_back(dataSet);
276 }
277 } else if ((tag == SUMO_TAG_NOTHING) || (tag == SUMO_TAG_DATAINTERVAL)) {
278 for (const auto& dataInterval : myDataIntervals) {
279 result.push_back(dataInterval);
280 }
282 for (const auto& genericData : myGenericDatas.at(tag)) {
283 result.push_back(genericData);
284 }
285 } else if ((tag == SUMO_TAG_NOTHING) || (GNEAttributeCarrier::getTagProperty(tag).isMeanData())) {
286 for (const auto& meanData : myMeanDatas.at(tag)) {
287 result.push_back(meanData);
288 }
289 }
290 return result;
291}
292
293
294std::vector<GNEAttributeCarrier*>
296 std::vector<GNEAttributeCarrier*> result;
297 // continue depending of supermode
298 if (supermode == Supermode::NETWORK) {
299 // network
300 for (const auto& junction : myJunctions) {
301 if (!onlySelected || junction.second->isAttributeCarrierSelected()) {
302 result.push_back(junction.second);
303 }
304 }
305 for (const auto& crossing : myCrossings) {
306 if (!onlySelected || crossing->isAttributeCarrierSelected()) {
307 result.push_back(crossing);
308 }
309 }
310 for (const auto& edge : myEdges) {
311 if (!onlySelected || edge.second->isAttributeCarrierSelected()) {
312 result.push_back(edge.second);
313 }
314 }
315 for (const auto& lane : myLanes) {
316 if (!onlySelected || lane->isAttributeCarrierSelected()) {
317 result.push_back(lane);
318 }
319 }
320 for (const auto& connection : myConnections) {
321 if (!onlySelected || connection->isAttributeCarrierSelected()) {
322 result.push_back(connection);
323 }
324 }
325 for (const auto& additionalSet : myAdditionals) {
326 for (const auto& additional : additionalSet.second) {
327 if (!onlySelected || additional->isAttributeCarrierSelected()) {
328 result.push_back(additional);
329 }
330 }
331 }
332 } else if (supermode == Supermode::DEMAND) {
333 for (const auto& demandElementSet : myDemandElements) {
334 for (const auto& demandElement : demandElementSet.second) {
335 if (!onlySelected || demandElement->isAttributeCarrierSelected()) {
336 result.push_back(demandElement);
337 }
338 }
339 }
340 } else if (supermode == Supermode::DATA) {
341 for (const auto& dataSet : myDataSets) {
342 if (!onlySelected || dataSet->isAttributeCarrierSelected()) {
343 result.push_back(dataSet);
344 }
345 }
346 for (const auto& dataInterval : myDataIntervals) {
347 if (!onlySelected || dataInterval->isAttributeCarrierSelected()) {
348 result.push_back(dataInterval);
349 }
350 }
351 for (const auto& genericDataSet : myGenericDatas) {
352 for (const auto& genericData : genericDataSet.second) {
353 if (!onlySelected || genericData->isAttributeCarrierSelected()) {
354 result.push_back(genericData);
355 }
356 }
357 }
358 for (const auto& meanDataSet : myMeanDatas) {
359 for (const auto& meanData : meanDataSet.second) {
360 if (!onlySelected || meanData->isAttributeCarrierSelected()) {
361 result.push_back(meanData);
362 }
363 }
364 }
365 }
366 return result;
367}
368
369
370std::vector<GNEAttributeCarrier*>
372 // get modes
373 const auto& editModes = myNet->getViewNet()->getEditModes();
374 // declare vector to save result
375 std::vector<GNEAttributeCarrier*> result;
376 result.reserve(gSelected.getSelected().size());
377 // iterate over all elements of global selection
378 for (const auto& glID : gSelected.getSelected()) {
379 // obtain AC
380 GNEAttributeCarrier* AC = retrieveAttributeCarrier(glID, false);
381 // check if attribute carrier exist and is selected
382 if (AC && AC->isAttributeCarrierSelected()) {
383 bool insert = false;
384 if (ignoreCurrentSupermode) {
385 insert = true;
386 } else if (editModes.isCurrentSupermodeNetwork() && (AC->getTagProperty().isNetworkElement() || AC->getTagProperty().isAdditionalElement())) {
387 insert = true;
388 } else if (editModes.isCurrentSupermodeDemand() && AC->getTagProperty().isDemandElement()) {
389 insert = true;
390 } else if (editModes.isCurrentSupermodeData() && AC->getTagProperty().isDataElement()) {
391 insert = true;
392 }
393 if (insert) {
394 result.push_back(AC);
395 }
396 }
397 }
398 return result;
399}
400
401
403GNENetHelper::AttributeCarriers::retrieveJunction(const std::string& id, bool hardFail) const {
404 if (myJunctions.count(id)) {
405 return myJunctions.at(id);
406 } else if (hardFail) {
407 // If junction wasn't found, throw exception
408 throw UnknownElement("Junction " + id);
409 } else {
410 return nullptr;
411 }
412}
413
414
415const std::map<std::string, GNEJunction*>&
417 return myJunctions;
418}
419
420
421std::vector<GNEJunction*>
423 std::vector<GNEJunction*> result;
424 // returns junctions depending of selection
425 for (const auto& junction : myJunctions) {
426 if (junction.second->isAttributeCarrierSelected()) {
427 result.push_back(junction.second);
428 }
429 }
430 return result;
431}
432
433
436 // increase reference
437 junction->incRef("GNENet::registerJunction");
438 junction->setResponsible(false);
439 myJunctions[junction->getMicrosimID()] = junction;
440 // expand net boundary
441 myNet->expandBoundary(junction->getCenteringBoundary());
442 // add edge into grid
443 myNet->addGLObjectIntoGrid(junction);
444 // update geometry
445 junction->updateGeometry();
446 // add z in net boundary
447 myNet->addZValueInBoundary(junction->getNBNode()->getPosition().z());
448 return junction;
449}
450
451
452void
454 myJunctions.clear();
455}
456
457
458void
460 // make a copy of junctions
461 std::map<std::string, GNEJunction*> junctionCopy = myJunctions;
462 // clear junctions
463 myJunctions.clear();
464 // fill junctions again
465 for (const auto& junction : junctionCopy) {
466 // update microsim ID
467 junction.second->setMicrosimID(prefix + junction.first);
468 // insert in myJunctions again
469 myJunctions[prefix + junction.first] = junction.second;
470 }
471}
472
473
474void
476 if (myJunctions.count(junction->getID()) == 0) {
477 throw ProcessError(junction->getTagStr() + " with ID='" + junction->getID() + "' doesn't exist in AttributeCarriers.junction");
478 } else if (myJunctions.count(newID) != 0) {
479 throw ProcessError("There is another " + junction->getTagStr() + " with new ID='" + newID + "' in myJunctions");
480 } else {
481 // remove junction from container
482 myJunctions.erase(junction->getNBNode()->getID());
483 // rename in NetBuilder
484 myNet->getNetBuilder()->getNodeCont().rename(junction->getNBNode(), newID);
485 // update microsim ID
486 junction->setMicrosimID(newID);
487 // add it into myJunctions again
488 myJunctions[junction->getID()] = junction;
489 // build crossings
490 junction->getNBNode()->buildCrossings();
491 // net has to be saved
492 myNet->getSavingStatus()->requireSaveNetwork();
493 }
494}
495
496
497int
499 int counter = 0;
500 for (const auto& junction : myJunctions) {
501 if (junction.second->isAttributeCarrierSelected()) {
502 counter++;
503 }
504 }
505 return counter;
506}
507
508
511 // cast crossing
512 GNECrossing* crossing = dynamic_cast<GNECrossing*>(AC);
513 if (crossing && (myCrossings.count(crossing) > 0)) {
514 return crossing;
515 } else if (hardFail) {
516 if (AC) {
517 throw UnknownElement("Crossing " + AC->getID());
518 } else {
519 throw UnknownElement("Crossing");
520 }
521 } else {
522 return nullptr;
523 }
524}
525
526
527const std::set<GNECrossing*>&
529 return myCrossings;
530}
531
532
533std::vector<GNECrossing*>
535 std::vector<GNECrossing*> result;
536 // iterate over crossings
537 for (const auto& crossing : myCrossings) {
538 if (crossing->isAttributeCarrierSelected()) {
539 result.push_back(crossing);
540 }
541 }
542 return result;
543}
544
545
546void
548 if (myCrossings.insert(crossing).second == false) {
549 throw ProcessError(crossing->getTagStr() + " with ID='" + crossing->getID() + "' already exist");
550 }
551}
552
553
554void
556 const auto finder = myCrossings.find(crossing);
557 if (finder == myCrossings.end()) {
558 throw ProcessError(crossing->getTagStr() + " with ID='" + crossing->getID() + "' wasn't previously inserted");
559 } else {
560 myCrossings.erase(finder);
561 }
562}
563
564
565int
567 int counter = 0;
568 for (const auto& crossing : myCrossings) {
569 if (crossing->isAttributeCarrierSelected()) {
570 counter++;
571 }
572 }
573 return counter;
574}
575
576
579 // cast walkingArea
580 GNEWalkingArea* walkingArea = dynamic_cast<GNEWalkingArea*>(AC);
581 if (walkingArea && (myWalkingAreas.count(walkingArea) > 0)) {
582 return walkingArea;
583 } else if (hardFail) {
584 if (AC) {
585 throw UnknownElement("WalkingArea " + AC->getID());
586 } else {
587 throw UnknownElement("WalkingArea");
588 }
589 } else {
590 return nullptr;
591 }
592}
593
594
595const std::set<GNEWalkingArea*>&
597 return myWalkingAreas;
598}
599
600
601std::vector<GNEWalkingArea*>
603 std::vector<GNEWalkingArea*> result;
604 // iterate over walkingAreas
605 for (const auto& walkingArea : myWalkingAreas) {
606 if (walkingArea->isAttributeCarrierSelected()) {
607 result.push_back(walkingArea);
608 }
609 }
610 return result;
611}
612
613
614void
616 if (myWalkingAreas.insert(walkingArea).second == false) {
617 throw ProcessError(walkingArea->getTagStr() + " with ID='" + walkingArea->getID() + "' already exist");
618 }
619}
620
621
622void
624 const auto finder = myWalkingAreas.find(walkingArea);
625 if (finder == myWalkingAreas.end()) {
626 throw ProcessError(walkingArea->getTagStr() + " with ID='" + walkingArea->getID() + "' wasn't previously inserted");
627 } else {
628 myWalkingAreas.erase(finder);
629 }
630}
631
632
633int
635 int counter = 0;
636 for (const auto& walkingArea : myWalkingAreas) {
637 if (walkingArea->isAttributeCarrierSelected()) {
638 counter++;
639 }
640 }
641 return counter;
642}
643
644
646GNENetHelper::AttributeCarriers::retrieveEdgeType(const std::string& id, bool hardFail) const {
647 if (myEdgeTypes.count(id) > 0) {
648 return myEdgeTypes.at(id);
649 } else if (hardFail) {
650 // If edge wasn't found, throw exception
651 throw UnknownElement("EdgeType " + id);
652 } else {
653 return nullptr;
654 }
655}
656
657
660 // increase reference
661 edgeType->incRef("GNENet::registerEdgeType");
662 // add it in container
663 myEdgeTypes[edgeType->getMicrosimID()] = edgeType;
664 return edgeType;
665}
666
667
668const std::map<std::string, GNEEdgeType*>&
670 return myEdgeTypes;
671}
672
673
675 myEdgeTypes.clear();
676}
677
678
679void
681 if (myEdgeTypes.count(edgeType->getID()) == 0) {
682 throw ProcessError(edgeType->getTagStr() + " with ID='" + edgeType->getID() + "' doesn't exist in AttributeCarriers.edgeType");
683 } else if (myEdgeTypes.count(newID) != 0) {
684 throw ProcessError("There is another " + edgeType->getTagStr() + " with new ID='" + newID + "' in myEdgeTypes");
685 } else {
686 // remove edgeType from container
687 myEdgeTypes.erase(edgeType->getID());
688 // rename in typeCont
689 myNet->getNetBuilder()->getTypeCont().updateEdgeTypeID(edgeType->getID(), newID);
690 // update microsim ID
691 edgeType->setMicrosimID(newID);
692 // add it into myEdgeTypes again
693 myEdgeTypes[edgeType->getID()] = edgeType;
694 // net has to be saved
695 myNet->getSavingStatus()->requireSaveNetwork();
696 }
697}
698
699
700std::string
702 int counter = 0;
703 while (myEdgeTypes.count("edgeType_" + toString(counter)) != 0) {
704 counter++;
705 }
706 return ("edgeType_" + toString(counter));
707}
708
709
710GNEEdge*
711GNENetHelper::AttributeCarriers::retrieveEdge(const std::string& id, bool hardFail) const {
712 if (myEdges.count(id) > 0) {
713 return myEdges.at(id);
714 } else if (hardFail) {
715 // If edge wasn't found, throw exception
716 throw UnknownElement("Edge " + id);
717 } else {
718 return nullptr;
719 }
720}
721
722
723std::vector<GNEEdge*>
725 if ((from == nullptr) || (to == nullptr)) {
726 throw UnknownElement("Junctions cannot be nullptr");
727 }
728 std::vector<GNEEdge*> edges;
729 // iterate over Junctions
730 for (const auto& edge : myEdges) {
731 if ((edge.second->getFromJunction() == from) && (edge.second->getToJunction() == to)) {
732 edges.push_back(edge.second);
733 }
734 }
735 return edges;
736}
737
738
739const std::map<std::string, GNEEdge*>&
741 return myEdges;
742}
743
744
745std::vector<GNEEdge*>
747 std::vector<GNEEdge*> result;
748 // returns edges depending of selection
749 for (const auto& edge : myEdges) {
750 if (edge.second->isAttributeCarrierSelected()) {
751 result.push_back(edge.second);
752 }
753 }
754 return result;
755}
756
757
758GNEEdge*
760 edge->incRef("GNENet::registerEdge");
761 edge->setResponsible(false);
762 // add edge to internal container of GNENet
763 myEdges[edge->getMicrosimID()] = edge;
764 // expand edge boundary
765 myNet->expandBoundary(edge->getCenteringBoundary());
766 // add edge into grid
767 myNet->addGLObjectIntoGrid(edge);
768 // insert all lanes
769 for (const auto& lane : edge->getLanes()) {
770 insertLane(lane);
771 }
772 // Add references into GNEJunctions
773 edge->getFromJunction()->addOutgoingGNEEdge(edge);
774 edge->getToJunction()->addIncomingGNEEdge(edge);
775 return edge;
776}
777
778
779void
783
784
785void
787 // make a copy of edges
788 std::map<std::string, GNEEdge*> edgeCopy = myEdges;
789 // clear edges
790 myEdges.clear();
791 // fill edges again
792 for (const auto& edge : edgeCopy) {
793 // update microsim ID
794 edge.second->setMicrosimID(prefix + edge.first);
795 // insert in myEdges again
796 myEdges[prefix + edge.first] = edge.second;
797 }
798}
799
800
801void
803 if (myEdges.count(edge->getID()) == 0) {
804 throw ProcessError(edge->getTagStr() + " with ID='" + edge->getID() + "' doesn't exist in AttributeCarriers.edge");
805 } else if (myEdges.count(newID) != 0) {
806 throw ProcessError("There is another " + edge->getTagStr() + " with new ID='" + newID + "' in myEdges");
807 } else {
808 // remove edge from container
809 myEdges.erase(edge->getNBEdge()->getID());
810 // rename in NetBuilder
811 myNet->getNetBuilder()->getEdgeCont().rename(edge->getNBEdge(), newID);
812 // update microsim ID
813 edge->setMicrosimID(newID);
814 // add it into myEdges again
815 myEdges[edge->getID()] = edge;
816 // rename all connections related to this edge
817 for (const auto& lane : edge->getLanes()) {
818 lane->updateConnectionIDs();
819 }
820 // net has to be saved
821 myNet->getSavingStatus()->requireSaveNetwork();
822 }
823}
824
825
826int
828 int counter = 0;
829 for (const auto& edge : myEdges) {
830 if (edge.second->isAttributeCarrierSelected()) {
831 counter++;
832 }
833 }
834 return counter;
835}
836
837
838GNELane*
839GNENetHelper::AttributeCarriers::retrieveLane(const std::string& id, bool hardFail, bool checkVolatileChange) const {
840 const std::string edge_id = SUMOXMLDefinitions::getEdgeIDFromLane(id);
841 const GNEEdge* edge = retrieveEdge(edge_id, false);
842 if (edge != nullptr) {
843 GNELane* lane = nullptr;
844 // search lane in lane's edges
845 for (auto laneIt : edge->getLanes()) {
846 if (laneIt->getID() == id) {
847 lane = laneIt;
848 }
849 }
850 // throw exception or return nullptr if lane wasn't found
851 if (lane == nullptr) {
852 if (hardFail) {
853 // Throw exception if hardFail is enabled
854 throw UnknownElement(toString(SUMO_TAG_LANE) + " " + id);
855 }
856 } else {
857 // check if the recomputing with volatile option has changed the number of lanes (needed for additionals and demand elements)
858 if (checkVolatileChange && (myNet->getEdgesAndNumberOfLanes().count(edge_id) == 1) &&
859 myNet->getEdgesAndNumberOfLanes().at(edge_id) != (int)edge->getLanes().size()) {
860 return edge->getLanes().at(lane->getIndex() + 1);
861 }
862 return lane;
863 }
864 } else if (hardFail) {
865 // Throw exception if hardFail is enabled
866 throw UnknownElement(toString(SUMO_TAG_EDGE) + " " + edge_id);
867 }
868 return nullptr;
869}
870
871
872GNELane*
874 // cast lane
875 GNELane* lane = dynamic_cast<GNELane*>(AC);
876 if (lane && (myLanes.count(lane) > 0)) {
877 return lane;
878 } else if (hardFail) {
879 if (AC) {
880 throw UnknownElement("Lane " + AC->getID());
881 } else {
882 throw UnknownElement("Lane");
883 }
884 } else {
885 return nullptr;
886 }
887}
888
889
890const std::set<GNELane*>&
892 return myLanes;
893}
894
895
896std::vector<GNELane*>
898 std::vector<GNELane*> result;
899 // returns lanes depending of selection
900 for (const auto& lane : myLanes) {
901 if (lane->isAttributeCarrierSelected()) {
902 result.push_back(lane);
903 }
904 }
905 return result;
906}
907
908
909void
911 if (myLanes.insert(lane).second == false) {
912 throw ProcessError(lane->getTagStr() + " with ID='" + lane->getID() + "' already exist");
913 }
914}
915
916
917void
919 const auto finder = myLanes.find(lane);
920 if (finder == myLanes.end()) {
921 throw ProcessError(lane->getTagStr() + " with ID='" + lane->getID() + "' wasn't previously inserted");
922 } else {
923 myLanes.erase(finder);
924 }
925}
926
927
928int
930 int counter = 0;
931 for (const auto& lane : myLanes) {
932 if (lane->isAttributeCarrierSelected()) {
933 counter++;
934 }
935 }
936 return counter;
937}
938
939
941GNENetHelper::AttributeCarriers::retrieveConnection(const std::string& id, bool hardFail) const {
942 // iterate over connections
943 for (const auto& connection : myConnections) {
944 if (connection->getID() == id) {
945 return connection;
946 }
947 }
948 if (hardFail) {
949 // If POI wasn't found, throw exception
950 throw UnknownElement("Connection " + id);
951 } else {
952 return nullptr;
953 }
954}
955
956
959 // cast connection
960 GNEConnection* connection = dynamic_cast<GNEConnection*>(AC);
961 if (connection && (myConnections.count(connection) > 0)) {
962 return connection;
963 } else if (hardFail) {
964 if (AC) {
965 throw UnknownElement("Connection " + AC->getID());
966 } else {
967 throw UnknownElement("Connection");
968 }
969 } else {
970 return nullptr;
971 }
972}
973
974
975const std::set<GNEConnection*>&
977 return myConnections;
978}
979
980
981std::vector<GNEConnection*>
983 std::vector<GNEConnection*> result;
984 // returns connections depending of selection
985 for (const auto& connection : myConnections) {
986 if (connection->isAttributeCarrierSelected()) {
987 result.push_back(connection);
988 }
989 }
990 return result;
991}
992
993
994void
996 if (myConnections.insert(connection).second == false) {
997 throw ProcessError(connection->getTagStr() + " with ID='" + connection->getID() + "' already exist");
998 }
999}
1000
1001
1002void
1004 const auto finder = myConnections.find(connection);
1005 if (finder == myConnections.end()) {
1006 throw ProcessError(connection->getTagStr() + " with ID='" + connection->getID() + "' wasn't previously inserted");
1007 } else {
1008 myConnections.erase(finder);
1009 }
1010}
1011
1012
1013int
1015 int counter = 0;
1016 for (const auto& connection : myConnections) {
1017 if (connection->isAttributeCarrierSelected()) {
1018 counter++;
1019 }
1020 }
1021 return counter;
1022}
1023
1024
1026GNENetHelper::AttributeCarriers::retrieveAdditional(SumoXMLTag type, const std::string& id, bool hardFail) const {
1027 for (const auto& additional : myAdditionals.at(type)) {
1028 if (additional->getID() == id) {
1029 return additional;
1030 }
1031 }
1032 if (hardFail) {
1033 throw ProcessError("Attempted to retrieve non-existant additional (string)");
1034 } else {
1035 return nullptr;
1036 }
1037}
1038
1039
1042 // cast additional
1043 GNEAdditional* additional = dynamic_cast<GNEAdditional*>(AC);
1044 if (additional && (myAdditionals.at(AC->getTagProperty().getTag()).count(additional) > 0)) {
1045 return additional;
1046 } else if (hardFail) {
1047 throw ProcessError("Attempted to retrieve non-existant additional (AttributeCarrier)");
1048 } else {
1049 return nullptr;
1050 }
1051}
1052
1053
1055GNENetHelper::AttributeCarriers::retrieveRerouterInterval(const std::string& rerouterID, const SUMOTime begin, const SUMOTime end) const {
1056 // first retrieve rerouter
1057 const GNEAdditional* rerouter = retrieveAdditional(SUMO_TAG_REROUTER, rerouterID);
1058 // parse begin and end
1059 const std::string beginStr = time2string(begin);
1060 const std::string endStr = time2string(end);
1061 // now iterate over all children and check begin and end
1062 for (const auto& interval : rerouter->getChildAdditionals()) {
1063 // check tag (to avoid symbols)
1064 if (interval->getTagProperty().getTag() == SUMO_TAG_INTERVAL) {
1065 // check begin and end
1066 if ((interval->getAttribute(SUMO_ATTR_BEGIN) == beginStr) &&
1067 (interval->getAttribute(SUMO_ATTR_END) == endStr)) {
1068 return interval;
1069 }
1070 }
1071 }
1072 // throw exception
1073 throw ProcessError("Attempted to retrieve non-existant rerouter interval");
1074}
1075
1076
1077const std::map<SumoXMLTag, std::set<GNEAdditional*> >&
1079 return myAdditionals;
1080}
1081
1082
1083std::vector<GNEAdditional*>
1085 std::vector<GNEAdditional*> result;
1086 // returns additionals depending of selection
1087 for (const auto& additionalsTags : myAdditionals) {
1088 for (const auto& additional : additionalsTags.second) {
1089 if (additional->isAttributeCarrierSelected()) {
1090 result.push_back(additional);
1091 }
1092 }
1093 }
1094 return result;
1095}
1096
1097
1098std::vector<GNEAdditional*>
1100 std::vector<GNEAdditional*> result;
1101 // returns additionals depending of selection
1102 for (const auto& additionalsTags : myAdditionals) {
1103 for (const auto& additional : additionalsTags.second) {
1104 if (additional->getTagProperty().isShapeElement() && additional->isAttributeCarrierSelected()) {
1105 result.push_back(additional);
1106 }
1107 }
1108 }
1109 return result;
1110}
1111
1112
1113int
1115 int counter = 0;
1116 for (const auto& additionalsTag : myAdditionals) {
1117 counter += (int)additionalsTag.second.size();
1118 }
1119 return counter;
1120}
1121
1122
1123void
1125 // clear elements in grid
1126 for (const auto& additionalsTags : myAdditionals) {
1127 for (const auto& additional : additionalsTags.second) {
1128 myNet->removeGLObjectFromGrid(additional);
1129 }
1130 }
1131 // iterate over myAdditionals and clear all additionals
1132 for (auto& additionals : myAdditionals) {
1133 additionals.second.clear();
1134 }
1135}
1136
1137
1138std::string
1140 // obtain option container
1141 const auto& neteditOptions = OptionsCont::getOptions();
1142 // get prefix
1143 std::string prefix;
1144 if (tag == SUMO_TAG_BUS_STOP) {
1145 prefix = neteditOptions.getString("busStop-prefix");
1146 } else if (tag == SUMO_TAG_TRAIN_STOP) {
1147 prefix = neteditOptions.getString("trainStop-prefix");
1148 } else if (tag == SUMO_TAG_CONTAINER_STOP) {
1149 prefix = neteditOptions.getString("containerStop-prefix");
1150 } else if (tag == SUMO_TAG_CHARGING_STATION) {
1151 prefix = neteditOptions.getString("chargingStation-prefix");
1152 } else if (tag == SUMO_TAG_PARKING_AREA) {
1153 prefix = neteditOptions.getString("parkingArea-prefix");
1154 } else if (tag == SUMO_TAG_INDUCTION_LOOP) {
1155 prefix = neteditOptions.getString("e1Detector-prefix");
1156 } else if ((tag == SUMO_TAG_LANE_AREA_DETECTOR) || (tag == GNE_TAG_MULTI_LANE_AREA_DETECTOR)) {
1157 prefix = neteditOptions.getString("e2Detector-prefix");
1158 } else if (tag == SUMO_TAG_ENTRY_EXIT_DETECTOR) {
1159 prefix = neteditOptions.getString("e3Detector-prefix");
1160 } else if (tag == SUMO_TAG_INSTANT_INDUCTION_LOOP) {
1161 prefix = neteditOptions.getString("e1InstantDetector-prefix");
1162 } else if (tag == SUMO_TAG_REROUTER) {
1163 prefix = neteditOptions.getString("rerouter-prefix");
1164 } else if ((tag == SUMO_TAG_CALIBRATOR) || (tag == GNE_TAG_CALIBRATOR_LANE)) {
1165 prefix = neteditOptions.getString("calibrator-prefix");
1166 } else if (tag == SUMO_TAG_ROUTEPROBE) {
1167 prefix = neteditOptions.getString("routeProbe-prefix");
1168 } else if (tag == SUMO_TAG_VSS) {
1169 prefix = neteditOptions.getString("vss-prefix");
1170 } else if (tag == SUMO_TAG_TRACTION_SUBSTATION) {
1171 prefix = neteditOptions.getString("tractionSubstation-prefix");
1172 } else if (tag == SUMO_TAG_OVERHEAD_WIRE_SECTION) {
1173 prefix = neteditOptions.getString("overheadWire-prefix");
1174 } else if (tag == SUMO_TAG_POLY) {
1175 prefix = neteditOptions.getString("polygon-prefix");
1176 } else if ((tag == SUMO_TAG_POI) || (tag == GNE_TAG_POILANE) || (tag == GNE_TAG_POIGEO)) {
1177 prefix = neteditOptions.getString("poi-prefix");
1178 } else if (tag == SUMO_TAG_TAZ) {
1179 prefix = toString(SUMO_TAG_TAZ);
1180 }
1181 int counter = 0;
1182 // check special cases
1183 if ((tag == SUMO_TAG_BUS_STOP) || (tag == SUMO_TAG_TRAIN_STOP)) {
1184 // BusStops and trainStops share namespace
1185 while ((retrieveAdditional(SUMO_TAG_BUS_STOP, prefix + "_" + toString(counter), false) != nullptr) ||
1186 (retrieveAdditional(SUMO_TAG_TRAIN_STOP, prefix + "_" + toString(counter), false) != nullptr)) {
1187 counter++;
1188 }
1189 } else if ((tag == SUMO_TAG_CALIBRATOR) || (tag == GNE_TAG_CALIBRATOR_LANE)) {
1190 // Calibrators over edge/lane share namespace
1191 while ((retrieveAdditional(SUMO_TAG_CALIBRATOR, prefix + "_" + toString(counter), false) != nullptr) ||
1192 (retrieveAdditional(GNE_TAG_CALIBRATOR_LANE, prefix + "_" + toString(counter), false) != nullptr)) {
1193 counter++;
1194 }
1195 } else if ((tag == SUMO_TAG_POLY) || (tag == SUMO_TAG_TAZ)) {
1196 // Polys and TAZs share namespace
1197 while ((retrieveAdditional(SUMO_TAG_POLY, prefix + "_" + toString(counter), false) != nullptr) ||
1198 (retrieveAdditional(SUMO_TAG_TAZ, prefix + "_" + toString(counter), false) != nullptr)) {
1199 counter++;
1200 }
1201 } else if ((tag == SUMO_TAG_POI) || (tag == GNE_TAG_POILANE) || (tag == GNE_TAG_POIGEO)) {
1202 while ((retrieveAdditional(SUMO_TAG_POI, prefix + "_" + toString(counter), false) != nullptr) ||
1203 (retrieveAdditional(GNE_TAG_POILANE, prefix + "_" + toString(counter), false) != nullptr) ||
1204 (retrieveAdditional(GNE_TAG_POIGEO, prefix + "_" + toString(counter), false) != nullptr)) {
1205 counter++;
1206 }
1207 } else if ((tag == SUMO_TAG_LANE_AREA_DETECTOR) || (tag == GNE_TAG_MULTI_LANE_AREA_DETECTOR)) {
1208 while ((retrieveAdditional(SUMO_TAG_LANE_AREA_DETECTOR, prefix + "_" + toString(counter), false) != nullptr) ||
1209 (retrieveAdditional(GNE_TAG_MULTI_LANE_AREA_DETECTOR, prefix + "_" + toString(counter), false) != nullptr)) {
1210 counter++;
1211 }
1212 } else {
1213 while (retrieveAdditional(tag, prefix + "_" + toString(counter), false) != nullptr) {
1214 counter++;
1215 }
1216 }
1217 return (prefix + "_" + toString(counter));
1218}
1219
1220
1221int
1223 int counter = 0;
1224 for (const auto& additionalsTags : myAdditionals) {
1225 for (const auto& additional : additionalsTags.second) {
1226 if (additional->isAttributeCarrierSelected()) {
1227 counter++;
1228 }
1229 }
1230 }
1231 return counter;
1232}
1233
1234
1235int
1237 return getNumberOfSelectedAdditionals() - getNumberOfSelectedPolygons() -
1238 getNumberOfSelectedPOIs() - getNumberOfSelectedTAZs() - getNumberOfSelectedTAZSources() -
1239 getNumberOfSelectedTAZSinks() - getNumberOfSelectedWires();
1240}
1241
1242
1243int
1245 int counter = 0;
1246 for (const auto& poly : myAdditionals.at(SUMO_TAG_POLY)) {
1247 if (poly->isAttributeCarrierSelected()) {
1248 counter++;
1249 }
1250 }
1251 return counter;
1252}
1253
1254
1255int
1257 int counter = 0;
1258 for (const auto& POI : myAdditionals.at(SUMO_TAG_POI)) {
1259 if (POI->isAttributeCarrierSelected()) {
1260 counter++;
1261 }
1262 }
1263 for (const auto& POILane : myAdditionals.at(GNE_TAG_POILANE)) {
1264 if (POILane->isAttributeCarrierSelected()) {
1265 counter++;
1266 }
1267 }
1268 for (const auto& POIGEO : myAdditionals.at(GNE_TAG_POIGEO)) {
1269 if (POIGEO->isAttributeCarrierSelected()) {
1270 counter++;
1271 }
1272 }
1273 return counter;
1274}
1275
1276
1277int
1279 int counter = 0;
1280 for (const auto& TAZ : myAdditionals.at(SUMO_TAG_TAZ)) {
1281 if (TAZ->isAttributeCarrierSelected()) {
1282 counter++;
1283 }
1284 }
1285 return counter;
1286}
1287
1288
1289int
1291 int counter = 0;
1292 for (const auto& TAZSource : myAdditionals.at(SUMO_TAG_TAZSOURCE)) {
1293 if (TAZSource->isAttributeCarrierSelected()) {
1294 counter++;
1295 }
1296 }
1297 return counter;
1298}
1299
1300
1301int
1303 int counter = 0;
1304 for (const auto& TAZSink : myAdditionals.at(SUMO_TAG_TAZSINK)) {
1305 if (TAZSink->isAttributeCarrierSelected()) {
1306 counter++;
1307 }
1308 }
1309 return counter;
1310}
1311
1312
1313int
1315 int counter = 0;
1316 for (const auto& additionalsTags : myAdditionals) {
1317 for (const auto& additional : additionalsTags.second) {
1318 if (additional->isAttributeCarrierSelected() && additional->getTagProperty().isWireElement()) {
1319 counter++;
1320 }
1321 }
1322 }
1323 return counter;
1324}
1325
1326
1328GNENetHelper::AttributeCarriers::retrieveDemandElement(SumoXMLTag type, const std::string& id, bool hardFail) const {
1329 for (const auto& demandElement : myDemandElements.at(type)) {
1330 if (demandElement->getID() == id) {
1331 return demandElement;
1332 }
1333 }
1334 if (hardFail) {
1335 throw ProcessError("Attempted to retrieve non-existant demand element (string)");
1336 } else {
1337 return nullptr;
1338 }
1339}
1340
1341
1344 // cast demandElement
1345 GNEDemandElement* demandElement = dynamic_cast<GNEDemandElement*>(AC);
1346 if (demandElement && (myDemandElements.at(AC->getTagProperty().getTag()).count(demandElement) > 0)) {
1347 return demandElement;
1348 } else if (hardFail) {
1349 throw ProcessError("Attempted to retrieve non-existant demand element (AttributeCarrier)");
1350 } else {
1351 return nullptr;
1352 }
1353}
1354
1355
1358 if (myDemandElements.at(type).size() == 0) {
1359 return nullptr;
1360 } else {
1361 // map with elements sorted by ID
1362 std::map<std::string, GNEDemandElement* > map;
1363 for (const auto& demandElement : myDemandElements.at(type)) {
1364 map[demandElement->getID()] = demandElement;
1365 }
1366 return map.begin()->second;
1367 }
1368}
1369
1370
1371std::vector<GNEDemandElement*>
1373 std::vector<GNEDemandElement*> result;
1374 // returns demand elements depending of selection
1375 for (const auto& demandElementTag : myDemandElements) {
1376 for (const auto& demandElement : demandElementTag.second) {
1377 if (demandElement->isAttributeCarrierSelected()) {
1378 result.push_back(demandElement);
1379 }
1380 }
1381 }
1382 return result;
1383}
1384
1385
1386const std::map<SumoXMLTag, std::set<GNEDemandElement*> >&
1388 return myDemandElements;
1389}
1390
1391
1392int
1394 int counter = 0;
1395 for (const auto& demandElementTag : myDemandElements) {
1396 if (demandElementTag.first == SUMO_TAG_VTYPE) {
1397 // iterate over vehicle types to avoid default vTypes
1398 for (const auto& vType : demandElementTag.second) {
1399 if (vType->getAttribute(GNE_ATTR_DEFAULT_VTYPE) != GNEAttributeCarrier::True) {
1400 counter++;
1401 }
1402 }
1403 } else {
1404 counter += (int)demandElementTag.second.size();
1405 }
1406 }
1407 return counter;
1408}
1409
1410
1411std::string
1413 // obtain option container
1414 const auto& neteditOptions = OptionsCont::getOptions();
1415 // get tag property
1416 const auto tagProperty = GNEAttributeCarrier::getTagProperty(tag);
1417 // get prefix
1418 std::string prefix;
1419 if (tag == SUMO_TAG_ROUTE) {
1420 prefix = neteditOptions.getString("route-prefix");
1421 } else if (tag == SUMO_TAG_VTYPE) {
1422 prefix = neteditOptions.getString("vType-prefix");
1423 } else if (tag == SUMO_TAG_VTYPE_DISTRIBUTION) {
1424 prefix = neteditOptions.getString("vTypeDistribution-prefix");
1425 } else if ((tag == SUMO_TAG_TRIP) || (tag == GNE_TAG_TRIP_JUNCTIONS) || (tag == GNE_TAG_TRIP_TAZS)) {
1426 prefix = neteditOptions.getString("trip-prefix");
1427 } else if (tagProperty.isVehicle() && !tagProperty.isFlow()) {
1428 prefix = neteditOptions.getString("vehicle-prefix");
1429 } else if (tagProperty.isPerson()) {
1430 if (tagProperty.isFlow()) {
1431 prefix = neteditOptions.getString("personflow-prefix");
1432 } else {
1433 prefix = neteditOptions.getString("person-prefix");
1434 }
1435 } else if (tagProperty.isContainer()) {
1436 if (tagProperty.isFlow()) {
1437 prefix = neteditOptions.getString("containerflow-prefix");
1438 } else {
1439 prefix = neteditOptions.getString("container-prefix");
1440 }
1441 } else if (tagProperty.isFlow()) {
1442 prefix = neteditOptions.getString("flow-prefix");
1443 }
1444 // declare counter
1445 int counter = 0;
1446 if (tagProperty.isType()) {
1447 // special case for persons (person and personFlows share nameSpaces)
1448 while ((retrieveDemandElement(SUMO_TAG_VTYPE, prefix + "_" + toString(counter), false) != nullptr) ||
1449 (retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, prefix + "_" + toString(counter), false) != nullptr)) {
1450 counter++;
1451 }
1452 // return new person ID
1453 return (prefix + "_" + toString(counter));
1454 } else if (tagProperty.isPerson()) {
1455 // special case for persons (person and personFlows share nameSpaces)
1456 while ((retrieveDemandElement(SUMO_TAG_PERSON, prefix + "_" + toString(counter), false) != nullptr) ||
1457 (retrieveDemandElement(SUMO_TAG_PERSONFLOW, prefix + "_" + toString(counter), false) != nullptr)) {
1458 counter++;
1459 }
1460 // return new person ID
1461 return (prefix + "_" + toString(counter));
1462 } else if (tagProperty.isContainer()) {
1463 // special case for containers (container and containerFlows share nameSpaces)
1464 while ((retrieveDemandElement(SUMO_TAG_CONTAINER, prefix + "_" + toString(counter), false) != nullptr) ||
1465 (retrieveDemandElement(SUMO_TAG_CONTAINERFLOW, prefix + "_" + toString(counter), false) != nullptr)) {
1466 counter++;
1467 }
1468 // return new container ID
1469 return (prefix + "_" + toString(counter));
1470 } else if (tagProperty.isVehicle() || tagProperty.isFlow()) {
1471 // check all vehicles, because share nameSpaces
1472 while ((retrieveDemandElement(SUMO_TAG_VEHICLE, prefix + "_" + toString(counter), false) != nullptr) ||
1473 (retrieveDemandElement(SUMO_TAG_TRIP, prefix + "_" + toString(counter), false) != nullptr) ||
1474 (retrieveDemandElement(GNE_TAG_VEHICLE_WITHROUTE, prefix + "_" + toString(counter), false) != nullptr) ||
1475 (retrieveDemandElement(GNE_TAG_TRIP_JUNCTIONS, prefix + "_" + toString(counter), false) != nullptr) ||
1476 (retrieveDemandElement(GNE_TAG_TRIP_TAZS, prefix + "_" + toString(counter), false) != nullptr) ||
1477 (retrieveDemandElement(GNE_TAG_FLOW_ROUTE, prefix + "_" + toString(counter), false) != nullptr) ||
1478 (retrieveDemandElement(SUMO_TAG_FLOW, prefix + "_" + toString(counter), false) != nullptr) ||
1479 (retrieveDemandElement(GNE_TAG_FLOW_WITHROUTE, prefix + "_" + toString(counter), false) != nullptr) ||
1480 (retrieveDemandElement(GNE_TAG_FLOW_JUNCTIONS, prefix + "_" + toString(counter), false) != nullptr) ||
1481 (retrieveDemandElement(GNE_TAG_FLOW_TAZS, prefix + "_" + toString(counter), false) != nullptr)) {
1482 counter++;
1483 }
1484 // return new vehicle ID
1485 return (prefix + "_" + toString(counter));
1486 } else {
1487 while (retrieveDemandElement(tag, prefix + "_" + toString(counter), false) != nullptr) {
1488 counter++;
1489 }
1490 // return new element ID
1491 return (prefix + "_" + toString(counter));
1492 }
1493}
1494
1495
1498 for (const auto& vType : myDemandElements.at(SUMO_TAG_VTYPE)) {
1499 if (vType->getID() == DEFAULT_VTYPE_ID) {
1500 return vType;
1501 }
1502 }
1503 throw ProcessError(TL("Default vType doesn't exist"));
1504}
1505
1506
1507void
1509 // clear elements in grid
1510 for (const auto& demandElementsTags : myDemandElements) {
1511 for (const auto& demandElement : demandElementsTags.second) {
1512 myNet->removeGLObjectFromGrid(demandElement);
1513 }
1514 }
1515 // iterate over myDemandElements and clear all demand elements
1516 for (auto& demandElements : myDemandElements) {
1517 demandElements.second.clear();
1518 }
1519}
1520
1521
1522void
1524 // Create default vehicle Type (it has to be created here due myViewNet was previously nullptr)
1525 GNEVType* defaultVehicleType = new GNEVType(myNet, DEFAULT_VTYPE_ID, SVC_PASSENGER);
1526 myDemandElements.at(defaultVehicleType->getTagProperty().getTag()).insert(defaultVehicleType);
1527 defaultVehicleType->incRef("GNENet::DEFAULT_VEHTYPE");
1528
1529 // Create default Bike Type (it has to be created here due myViewNet was previously nullptr)
1530 GNEVType* defaultBikeType = new GNEVType(myNet, DEFAULT_BIKETYPE_ID, SVC_BICYCLE);
1531 myDemandElements.at(defaultBikeType->getTagProperty().getTag()).insert(defaultBikeType);
1532 defaultBikeType->incRef("GNENet::DEFAULT_BIKETYPE_ID");
1533
1534 // Create default taxi Type (it has to be created here due myViewNet was previously nullptr)
1535 GNEVType* defaultTaxiType = new GNEVType(myNet, DEFAULT_TAXITYPE_ID, SVC_TAXI);
1536 myDemandElements.at(defaultTaxiType->getTagProperty().getTag()).insert(defaultTaxiType);
1537 defaultTaxiType->incRef("GNENet::DEFAULT_TAXITYPE_ID");
1538
1539 // Create default rail Type (it has to be created here due myViewNet was previously nullptr)
1540 GNEVType* defaultRailType = new GNEVType(myNet, DEFAULT_RAILTYPE_ID, SVC_RAIL);
1541 myDemandElements.at(defaultRailType->getTagProperty().getTag()).insert(defaultRailType);
1542 defaultRailType->incRef("GNENet::DEFAULT_RAILTYPE_ID");
1543
1544 // Create default person Type (it has to be created here due myViewNet was previously nullptr)
1545 GNEVType* defaultPersonType = new GNEVType(myNet, DEFAULT_PEDTYPE_ID, SVC_PEDESTRIAN);
1546 myDemandElements.at(defaultPersonType->getTagProperty().getTag()).insert(defaultPersonType);
1547 defaultPersonType->incRef("GNENet::DEFAULT_PEDTYPE_ID");
1548
1549 // Create default container Type (it has to be created here due myViewNet was previously nullptr)
1550 GNEVType* defaultContainerType = new GNEVType(myNet, DEFAULT_CONTAINERTYPE_ID, SVC_IGNORING);
1551 myDemandElements.at(defaultContainerType->getTagProperty().getTag()).insert(defaultContainerType);
1552 defaultContainerType->incRef("GNENet::DEFAULT_CONTAINERTYPE_ID");
1553}
1554
1555
1556int
1558 return myStopIndex++;
1559}
1560
1561
1562int
1564 int counter = 0;
1565 for (const auto& demandElementsTags : myDemandElements) {
1566 for (const auto& demandElement : demandElementsTags.second) {
1567 if (demandElement->isAttributeCarrierSelected()) {
1568 counter++;
1569 }
1570 }
1571 }
1572 return counter;
1573}
1574
1575
1576int
1578 int counter = 0;
1579 // iterate over routes
1580 for (const auto& route : myDemandElements.at(SUMO_TAG_ROUTE)) {
1581 if (route->isAttributeCarrierSelected()) {
1582 counter++;
1583 }
1584 }
1585 // iterate over vehicles with embedded routes
1586 for (const auto& vehicle : myDemandElements.at(GNE_TAG_VEHICLE_WITHROUTE)) {
1587 if (vehicle->getChildDemandElements().front()->isAttributeCarrierSelected()) {
1588 counter++;
1589 }
1590 }
1591 for (const auto& flow : myDemandElements.at(GNE_TAG_FLOW_WITHROUTE)) {
1592 if (flow->getChildDemandElements().front()->isAttributeCarrierSelected()) {
1593 counter++;
1594 }
1595 }
1596 return counter;
1597}
1598
1599
1600int
1602 int counter = 0;
1603 // iterate over all vehicles and flows
1604 for (const auto& vehicle : myDemandElements.at(SUMO_TAG_VEHICLE)) {
1605 if (vehicle->isAttributeCarrierSelected()) {
1606 counter++;
1607 }
1608 }
1609 for (const auto& trip : myDemandElements.at(SUMO_TAG_TRIP)) {
1610 if (trip->isAttributeCarrierSelected()) {
1611 counter++;
1612 }
1613 }
1614 for (const auto& vehicle : myDemandElements.at(GNE_TAG_VEHICLE_WITHROUTE)) {
1615 if (vehicle->isAttributeCarrierSelected()) {
1616 counter++;
1617 }
1618 }
1619 for (const auto& flow : myDemandElements.at(SUMO_TAG_FLOW)) {
1620 if (flow->isAttributeCarrierSelected()) {
1621 counter++;
1622 }
1623 }
1624 for (const auto& flow : myDemandElements.at(GNE_TAG_FLOW_ROUTE)) {
1625 if (flow->isAttributeCarrierSelected()) {
1626 counter++;
1627 }
1628 }
1629 for (const auto& flow : myDemandElements.at(GNE_TAG_FLOW_WITHROUTE)) {
1630 if (flow->isAttributeCarrierSelected()) {
1631 counter++;
1632 }
1633 }
1634 return counter;
1635}
1636
1637
1638int
1640 int counter = 0;
1641 // iterate over all persons
1642 for (const auto& person : myDemandElements.at(SUMO_TAG_PERSON)) {
1643 if (person->isAttributeCarrierSelected()) {
1644 counter++;
1645 }
1646 }
1647 for (const auto& personFlow : myDemandElements.at(SUMO_TAG_PERSONFLOW)) {
1648 if (personFlow->isAttributeCarrierSelected()) {
1649 counter++;
1650 }
1651 }
1652 return counter;
1653}
1654
1655
1656int
1658 int counter = 0;
1659 // iterate over all person plans
1660 for (const auto& person : myDemandElements.at(SUMO_TAG_PERSON)) {
1661 for (const auto& personPlan : person->getChildDemandElements()) {
1662 if (personPlan->getTagProperty().isPersonTrip() && personPlan->isAttributeCarrierSelected()) {
1663 counter++;
1664 }
1665 }
1666 }
1667 for (const auto& personFlow : myDemandElements.at(SUMO_TAG_PERSONFLOW)) {
1668 for (const auto& personPlan : personFlow->getChildDemandElements()) {
1669 if (personPlan->getTagProperty().isPersonTrip() && personPlan->isAttributeCarrierSelected()) {
1670 counter++;
1671 }
1672 }
1673 }
1674 return counter;
1675}
1676
1677
1678int
1680 int counter = 0;
1681 // iterate over all person plans
1682 for (const auto& person : myDemandElements.at(SUMO_TAG_PERSON)) {
1683 for (const auto& personPlan : person->getChildDemandElements()) {
1684 if (personPlan->getTagProperty().isWalk() && personPlan->isAttributeCarrierSelected()) {
1685 counter++;
1686 }
1687 }
1688 }
1689 for (const auto& personFlow : myDemandElements.at(SUMO_TAG_PERSONFLOW)) {
1690 for (const auto& personPlan : personFlow->getChildDemandElements()) {
1691 if (personPlan->getTagProperty().isWalk() && personPlan->isAttributeCarrierSelected()) {
1692 counter++;
1693 }
1694 }
1695 }
1696 return counter;
1697}
1698
1699
1700int
1702 int counter = 0;
1703 // iterate over all person plans
1704 for (const auto& person : myDemandElements.at(SUMO_TAG_PERSON)) {
1705 for (const auto& personPlan : person->getChildDemandElements()) {
1706 if (personPlan->getTagProperty().isRide() && personPlan->isAttributeCarrierSelected()) {
1707 counter++;
1708 }
1709 }
1710 }
1711 for (const auto& personFlow : myDemandElements.at(SUMO_TAG_PERSONFLOW)) {
1712 for (const auto& personPlan : personFlow->getChildDemandElements()) {
1713 if (personPlan->getTagProperty().isRide() && personPlan->isAttributeCarrierSelected()) {
1714 counter++;
1715 }
1716 }
1717 }
1718 return counter;
1719}
1720
1721
1722int
1724 int counter = 0;
1725 // iterate over all containers
1726 for (const auto& container : myDemandElements.at(SUMO_TAG_CONTAINER)) {
1727 if (container->isAttributeCarrierSelected()) {
1728 counter++;
1729 }
1730 }
1731 for (const auto& containerFlow : myDemandElements.at(SUMO_TAG_CONTAINERFLOW)) {
1732 if (containerFlow->isAttributeCarrierSelected()) {
1733 counter++;
1734 }
1735 }
1736 return counter;
1737}
1738
1739
1740int
1742 int counter = 0;
1743 // iterate over all container plans
1744 for (const auto& container : myDemandElements.at(SUMO_TAG_CONTAINER)) {
1745 for (const auto& containerPlan : container->getChildDemandElements()) {
1746 if (containerPlan->getTagProperty().isTransportPlan() && containerPlan->isAttributeCarrierSelected()) {
1747 counter++;
1748 }
1749 }
1750 }
1751 for (const auto& containerFlow : myDemandElements.at(SUMO_TAG_CONTAINERFLOW)) {
1752 for (const auto& containerPlan : containerFlow->getChildDemandElements()) {
1753 if (containerPlan->getTagProperty().isTransportPlan() && containerPlan->isAttributeCarrierSelected()) {
1754 counter++;
1755 }
1756 }
1757 }
1758 return counter;
1759}
1760
1761
1762int
1764 int counter = 0;
1765 // iterate over all container plans
1766 for (const auto& container : myDemandElements.at(SUMO_TAG_CONTAINER)) {
1767 for (const auto& containerPlan : container->getChildDemandElements()) {
1768 if (containerPlan->getTagProperty().isTranshipPlan() && containerPlan->isAttributeCarrierSelected()) {
1769 counter++;
1770 }
1771 }
1772 }
1773 for (const auto& containerFlow : myDemandElements.at(SUMO_TAG_CONTAINERFLOW)) {
1774 for (const auto& containerPlan : containerFlow->getChildDemandElements()) {
1775 if (containerPlan->getTagProperty().isTranshipPlan() && containerPlan->isAttributeCarrierSelected()) {
1776 counter++;
1777 }
1778 }
1779 }
1780 return counter;
1781}
1782
1783
1784int
1786 int counter = 0;
1787 // iterate over routes
1788 for (const auto& route : myDemandElements.at(SUMO_TAG_ROUTE)) {
1789 if (route->isAttributeCarrierSelected()) {
1790 counter++;
1791 }
1792 }
1793 // vehicles
1794 for (const auto& trip : myDemandElements.at(SUMO_TAG_TRIP)) {
1795 for (const auto& stop : trip->getChildDemandElements()) {
1796 if (stop->getTagProperty().isStop() && stop->isAttributeCarrierSelected()) {
1797 counter++;
1798 }
1799 }
1800 }
1801 for (const auto& vehicle : myDemandElements.at(GNE_TAG_VEHICLE_WITHROUTE)) {
1802 for (const auto& stop : vehicle->getChildDemandElements().front()->getChildDemandElements()) {
1803 if (stop->getTagProperty().isStop() && stop->isAttributeCarrierSelected()) {
1804 counter++;
1805 }
1806 }
1807 }
1808 for (const auto& flow : myDemandElements.at(SUMO_TAG_FLOW)) {
1809 for (const auto& stop : flow->getChildDemandElements()) {
1810 if (stop->getTagProperty().isStop() && stop->isAttributeCarrierSelected()) {
1811 counter++;
1812 }
1813 }
1814 }
1815 for (const auto& flow : myDemandElements.at(GNE_TAG_FLOW_WITHROUTE)) {
1816 for (const auto& stop : flow->getChildDemandElements().front()->getChildDemandElements()) {
1817 if (stop->getTagProperty().isStop() && stop->isAttributeCarrierSelected()) {
1818 counter++;
1819 }
1820 }
1821 }
1822 // persons
1823 for (const auto& person : myDemandElements.at(SUMO_TAG_PERSON)) {
1824 for (const auto& personPlan : person->getChildDemandElements()) {
1825 if (personPlan->getTagProperty().isStopPerson() && personPlan->isAttributeCarrierSelected()) {
1826 counter++;
1827 }
1828 }
1829 }
1830 for (const auto& personFlow : myDemandElements.at(SUMO_TAG_PERSONFLOW)) {
1831 for (const auto& personPlan : personFlow->getChildDemandElements()) {
1832 if (personPlan->getTagProperty().isStopPerson() && personPlan->isAttributeCarrierSelected()) {
1833 counter++;
1834 }
1835 }
1836 }
1837 // containers
1838 for (const auto& container : myDemandElements.at(SUMO_TAG_CONTAINER)) {
1839 for (const auto& containerPlan : container->getChildDemandElements()) {
1840 if (containerPlan->getTagProperty().isStopContainer() && containerPlan->isAttributeCarrierSelected()) {
1841 counter++;
1842 }
1843 }
1844 }
1845 for (const auto& containerFlow : myDemandElements.at(SUMO_TAG_CONTAINERFLOW)) {
1846 for (const auto& containerPlan : containerFlow->getChildDemandElements()) {
1847 if (containerPlan->getTagProperty().isStopContainer() && containerPlan->isAttributeCarrierSelected()) {
1848 counter++;
1849 }
1850 }
1851 }
1852 return counter;
1853}
1854
1855
1857GNENetHelper::AttributeCarriers::retrieveDataSet(const std::string& id, bool hardFail) const {
1858 for (const auto& dataSet : myDataSets) {
1859 if (dataSet->getID() == id) {
1860 return dataSet;
1861 }
1862 }
1863 if (hardFail) {
1864 throw ProcessError("Attempted to retrieve non-existant data set");
1865 } else {
1866 return nullptr;
1867 }
1868}
1869
1870
1873 // cast dataSet
1874 GNEDataSet* dataSet = dynamic_cast<GNEDataSet*>(AC);
1875 if (dataSet && (myDataSets.count(dataSet) > 0)) {
1876 return dataSet;
1877 } else if (hardFail) {
1878 throw ProcessError("Attempted to retrieve non-existant data set");
1879 } else {
1880 return nullptr;
1881 }
1882}
1883
1884
1885const std::set<GNEDataSet*>&
1887 return myDataSets;
1888}
1889
1890
1891std::string
1893 const std::string dataSetTagStr = toString(SUMO_TAG_DATASET);
1894 int counter = 0;
1895 while (retrieveDataSet(prefix + dataSetTagStr + "_" + toString(counter), false) != nullptr) {
1896 counter++;
1897 }
1898 return (prefix + dataSetTagStr + "_" + toString(counter));
1899}
1900
1901
1904 // cast dataInterval
1905 GNEDataInterval* dataInterval = dynamic_cast<GNEDataInterval*>(AC);
1906 if (dataInterval && (myDataIntervals.count(dataInterval) > 0)) {
1907 return dataInterval;
1908 } else if (hardFail) {
1909 throw ProcessError("Attempted to retrieve non-existant data interval");
1910 } else {
1911 return nullptr;
1912 }
1913}
1914
1915
1916const std::set<GNEDataInterval*>&
1918 return myDataIntervals;
1919}
1920
1921
1922void
1924 if (myDataIntervals.insert(dataInterval).second == false) {
1925 throw ProcessError(dataInterval->getTagStr() + " with ID='" + dataInterval->getID() + "' already exist");
1926 }
1927 // mark interval toolbar for update
1928 myNet->getViewNet()->getIntervalBar().markForUpdate();
1929}
1930
1931
1932void
1934 const auto finder = myDataIntervals.find(dataInterval);
1935 if (finder == myDataIntervals.end()) {
1936 throw ProcessError(dataInterval->getTagStr() + " with ID='" + dataInterval->getID() + "' wasn't previously inserted");
1937 } else {
1938 myDataIntervals.erase(finder);
1939 }
1940 // mark interval toolbar for update
1941 myNet->getViewNet()->getIntervalBar().markForUpdate();
1942}
1943
1944
1947 // cast genericData
1948 GNEGenericData* genericData = dynamic_cast<GNEGenericData*>(AC);
1949 if (genericData && (myGenericDatas.at(AC->getTagProperty().getTag()).count(genericData) > 0)) {
1950 return genericData;
1951 } else if (hardFail) {
1952 throw ProcessError("Attempted to retrieve non-existant data set");
1953 } else {
1954 return nullptr;
1955 }
1956}
1957
1958
1959std::vector<GNEGenericData*>
1961 std::vector<GNEGenericData*> result;
1962 // returns generic datas depending of selection
1963 for (const auto& genericDataTag : myGenericDatas) {
1964 for (const auto& genericData : genericDataTag.second) {
1965 if (genericData->isAttributeCarrierSelected()) {
1966 result.push_back(genericData);
1967 }
1968 }
1969 }
1970 return result;
1971}
1972
1973
1974const std::map<SumoXMLTag, std::set<GNEGenericData*> >&
1976 return myGenericDatas;
1977}
1978
1979
1980std::vector<GNEGenericData*>
1981GNENetHelper::AttributeCarriers::retrieveGenericDatas(const SumoXMLTag genericDataTag, const double begin, const double end) {
1982 // declare generic data vector
1983 std::vector<GNEGenericData*> genericDatas;
1984 // iterate over all data sets
1985 for (const auto& genericData : myGenericDatas.at(genericDataTag)) {
1986 // check interval
1987 if ((genericData->getDataIntervalParent()->getAttributeDouble(SUMO_ATTR_BEGIN) >= begin) &&
1988 (genericData->getDataIntervalParent()->getAttributeDouble(SUMO_ATTR_END) <= end)) {
1989 genericDatas.push_back(genericData);
1990 }
1991 }
1992 return genericDatas;
1993}
1994
1995
1996int
1998 int counter = 0;
1999 // iterate over all generic datas
2000 for (const auto& genericDataTag : myGenericDatas) {
2001 counter += (int)genericDataTag.second.size();
2002 }
2003 return counter;
2004}
2005
2006
2007int
2009 int counter = 0;
2010 // iterate over all edgeDatas
2011 for (const auto& genericData : myGenericDatas.at(GNE_TAG_EDGEREL_SINGLE)) {
2012 if (genericData->isAttributeCarrierSelected()) {
2013 counter++;
2014 }
2015 }
2016 return counter;
2017}
2018
2019
2020int
2022 int counter = 0;
2023 // iterate over all edgeDatas
2024 for (const auto& genericData : myGenericDatas.at(SUMO_TAG_EDGEREL)) {
2025 if (genericData->isAttributeCarrierSelected()) {
2026 counter++;
2027 }
2028 }
2029 return counter;
2030}
2031
2032
2033int
2035 int counter = 0;
2036 // iterate over all edgeDatas
2037 for (const auto& genericData : myGenericDatas.at(SUMO_TAG_TAZREL)) {
2038 if (genericData->isAttributeCarrierSelected()) {
2039 counter++;
2040 }
2041 }
2042 return counter;
2043}
2044
2045
2046void
2048 if (myGenericDatas.at(genericData->getTagProperty().getTag()).insert(genericData).second == false) {
2049 throw ProcessError(genericData->getTagStr() + " with ID='" + genericData->getID() + "' already exist");
2050 }
2051 // mark interval toolbar for update
2052 myNet->getViewNet()->getIntervalBar().markForUpdate();
2053}
2054
2055
2056void
2058 const auto finder = myGenericDatas.at(genericData->getTagProperty().getTag()).find(genericData);
2059 if (finder == myGenericDatas.at(genericData->getTagProperty().getTag()).end()) {
2060 throw ProcessError(genericData->getTagStr() + " with ID='" + genericData->getID() + "' wasn't previously inserted");
2061 } else {
2062 myGenericDatas.at(genericData->getTagProperty().getTag()).erase(finder);
2063 }
2064 // mark interval toolbar for update
2065 myNet->getViewNet()->getIntervalBar().markForUpdate();
2066}
2067
2068
2069std::set<std::string>
2070GNENetHelper::AttributeCarriers::retrieveGenericDataParameters(const std::string& genericDataTag, const double begin, const double end) const {
2071 // declare solution
2072 std::set<std::string> attributesSolution;
2073 // declare generic data vector
2074 std::vector<GNEGenericData*> genericDatas;
2075 // iterate over all data sets
2076 for (const auto& interval : myDataIntervals) {
2077 // check interval
2078 if ((interval->getAttributeDouble(SUMO_ATTR_BEGIN) >= begin) && (interval->getAttributeDouble(SUMO_ATTR_END) <= end)) {
2079 // iterate over generic datas
2080 for (const auto& genericData : interval->getGenericDataChildren()) {
2081 if (genericDataTag.empty() || (genericData->getTagProperty().getTagStr() == genericDataTag)) {
2082 genericDatas.push_back(genericData);
2083 }
2084 }
2085 }
2086 }
2087 // iterate over generic datas
2088 for (const auto& genericData : genericDatas) {
2089 for (const auto& attribute : genericData->getParametersMap()) {
2090 attributesSolution.insert(attribute.first);
2091 }
2092 }
2093 return attributesSolution;
2094}
2095
2096
2097std::set<std::string>
2098GNENetHelper::AttributeCarriers::retrieveGenericDataParameters(const std::string& dataSetID, const std::string& genericDataTag,
2099 const std::string& beginStr, const std::string& endStr) const {
2100 // declare solution
2101 std::set<std::string> attributesSolution;
2102 // vector of data sets and intervals
2103 std::vector<GNEDataSet*> dataSets;
2104 std::vector<GNEDataInterval*> dataIntervals;
2105 // get dataSet
2106 GNEDataSet* retrievedDataSet = retrieveDataSet(dataSetID, false);
2107 // if dataSetID is empty, return all parameters
2108 if (dataSetID.empty()) {
2109 // add all data sets
2110 dataSets.reserve(myDataSets.size());
2111 for (const auto& dataSet : myDataSets) {
2112 dataSets.push_back(dataSet);
2113 }
2114 } else if (retrievedDataSet) {
2115 dataSets.push_back(retrievedDataSet);
2116 } else {
2117 return attributesSolution;
2118 }
2119 // now continue with data intervals
2120 int numberOfIntervals = 0;
2121 for (const auto& dataSet : dataSets) {
2122 numberOfIntervals += (int)dataSet->getDataIntervalChildren().size();
2123 }
2124 // resize dataIntervals
2125 dataIntervals.reserve(numberOfIntervals);
2126 // add intervals
2127 for (const auto& dataSet : dataSets) {
2128 for (const auto& dataInterval : dataSet->getDataIntervalChildren()) {
2129 // continue depending of begin and end
2130 if (beginStr.empty() && endStr.empty()) {
2131 dataIntervals.push_back(dataInterval.second);
2132 } else if (endStr.empty()) {
2133 // parse begin
2134 const double begin = GNEAttributeCarrier::parse<double>(beginStr);
2135 if (dataInterval.second->getAttributeDouble(SUMO_ATTR_BEGIN) >= begin) {
2136 dataIntervals.push_back(dataInterval.second);
2137 }
2138 } else if (beginStr.empty()) {
2139 // parse end
2140 const double end = GNEAttributeCarrier::parse<double>(endStr);
2141 if (dataInterval.second->getAttributeDouble(SUMO_ATTR_END) <= end) {
2142 dataIntervals.push_back(dataInterval.second);
2143 }
2144 } else {
2145 // parse both begin end
2146 const double begin = GNEAttributeCarrier::parse<double>(beginStr);
2147 const double end = GNEAttributeCarrier::parse<double>(endStr);
2148 if ((dataInterval.second->getAttributeDouble(SUMO_ATTR_BEGIN) >= begin) &&
2149 (dataInterval.second->getAttributeDouble(SUMO_ATTR_END) <= end)) {
2150 dataIntervals.push_back(dataInterval.second);
2151 }
2152 }
2153 }
2154 }
2155 // finally iterate over intervals and get attributes
2156 for (const auto& dataInterval : dataIntervals) {
2157 for (const auto& genericData : dataInterval->getGenericDataChildren()) {
2158 // check generic data tag
2159 if (genericDataTag.empty() || (genericData->getTagProperty().getTagStr() == genericDataTag)) {
2160 for (const auto& attribute : genericData->getParametersMap()) {
2161 attributesSolution.insert(attribute.first);
2162 }
2163 }
2164 }
2165 }
2166 return attributesSolution;
2167}
2168
2169
2171GNENetHelper::AttributeCarriers::retrieveMeanData(SumoXMLTag type, const std::string& id, bool hardFail) const {
2172 for (const auto& meanData : myMeanDatas.at(type)) {
2173 if (meanData->getID() == id) {
2174 return meanData;
2175 }
2176 }
2177 if (hardFail) {
2178 throw ProcessError("Attempted to retrieve non-existant meanData (string)");
2179 } else {
2180 return nullptr;
2181 }
2182}
2183
2184
2187 // cast meanData
2188 GNEMeanData* meanData = dynamic_cast<GNEMeanData*>(AC);
2189 if (meanData && (myMeanDatas.at(AC->getTagProperty().getTag()).count(meanData) > 0)) {
2190 return meanData;
2191 } else if (hardFail) {
2192 throw ProcessError("Attempted to retrieve non-existant meanData (AttributeCarrier)");
2193 } else {
2194 return nullptr;
2195 }
2196}
2197
2198
2199const std::map<SumoXMLTag, std::set<GNEMeanData*> >&
2201 return myMeanDatas;
2202}
2203
2204
2205int
2207 int counter = 0;
2208 for (const auto& meanDatasTag : myMeanDatas) {
2209 counter += (int)meanDatasTag.second.size();
2210 }
2211 return counter;
2212}
2213
2214
2215void
2217 // clear elements in grid
2218 for (const auto& meanDatasTags : myMeanDatas) {
2219 for (const auto& meanData : meanDatasTags.second) {
2220 myNet->removeGLObjectFromGrid(meanData);
2221 }
2222 }
2223 // iterate over myMeanDatas and clear all meanDatas
2224 for (auto& meanDatas : myMeanDatas) {
2225 meanDatas.second.clear();
2226 }
2227}
2228
2229
2230std::string
2232 // obtain option container
2233 const auto& neteditOptions = OptionsCont::getOptions();
2234 // get prefix
2235 std::string prefix;
2236 if (tag == SUMO_TAG_MEANDATA_EDGE) {
2237 prefix = neteditOptions.getString("meanDataEdge-prefix");
2238 } else if (tag == SUMO_TAG_MEANDATA_LANE) {
2239 prefix = neteditOptions.getString("meanDataLane-prefix");
2240 }
2241 int counter = 0;
2242 while (retrieveMeanData(tag, prefix + "_" + toString(counter), false) != nullptr) {
2243 counter++;
2244 }
2245 return (prefix + "_" + toString(counter));
2246}
2247
2248
2249void
2251 myNet->getNetBuilder()->getNodeCont().insert(junction->getNBNode());
2252 registerJunction(junction);
2253}
2254
2255
2256void
2258 // remove it from inspected elements and GNEElementTree
2259 myNet->getViewNet()->removeFromAttributeCarrierInspected(junction);
2260 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(junction);
2261 // Remove from grid and container
2262 myNet->removeGLObjectFromGrid(junction);
2263 myJunctions.erase(junction->getMicrosimID());
2264 myNet->getNetBuilder()->getNodeCont().extract(junction->getNBNode());
2265 junction->decRef("GNENet::deleteSingleJunction");
2266 junction->setResponsible(true);
2267}
2268
2269
2270bool
2272 return (myEdgeTypes.count(edgeType->getID()) > 0);
2273}
2274
2275
2276void
2278 // get pointer to create edge frame
2279 const auto& createEdgeFrame = myNet->getViewNet()->getViewParent()->getCreateEdgeFrame();
2280 // insert in myEdgeTypes
2281 myEdgeTypes[edgeType->getMicrosimID()] = edgeType;
2282 // update edge selector
2283 if (myNet->getViewNet()->getViewParent()->getCreateEdgeFrame()->shown()) {
2284 myNet->getViewNet()->getViewParent()->getCreateEdgeFrame()->getEdgeTypeSelector()->refreshEdgeTypeSelector();
2285 }
2286 // set current edge type inspected
2287 createEdgeFrame->getEdgeTypeSelector()->setCurrentEdgeType(edgeType);
2288}
2289
2290
2291void
2293 // get pointer to create edge frame
2294 const auto& createEdgeFrame = myNet->getViewNet()->getViewParent()->getCreateEdgeFrame();
2295 // remove it from inspected elements and GNEElementTree
2296 myNet->getViewNet()->removeFromAttributeCarrierInspected(edgeType);
2297 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(edgeType);
2298 // remove from edge types
2299 myEdgeTypes.erase(edgeType->getMicrosimID());
2300 // check if this is the selected edge type in edgeSelector
2301 if (createEdgeFrame->getEdgeTypeSelector()->getEdgeTypeSelected() == edgeType) {
2302 createEdgeFrame->getEdgeTypeSelector()->clearEdgeTypeSelected();
2303 }
2304 // update edge selector
2305 createEdgeFrame->getEdgeTypeSelector()->refreshEdgeTypeSelector();
2306}
2307
2308
2309void
2311 NBEdge* nbe = edge->getNBEdge();
2312 myNet->getNetBuilder()->getEdgeCont().insert(nbe); // should we ignore pruning double edges?
2313 // if this edge was previouls extracted from the edgeContainer we have to rewire the nodes
2314 nbe->getFromNode()->addOutgoingEdge(nbe);
2315 nbe->getToNode()->addIncomingEdge(nbe);
2316 // register edge
2317 registerEdge(edge);
2318}
2319
2320
2321void
2323 // remove it from inspected elements and GNEElementTree
2324 myNet->getViewNet()->removeFromAttributeCarrierInspected(edge);
2325 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(edge);
2326 // remove edge from visual grid and container
2327 myNet->removeGLObjectFromGrid(edge);
2328 myEdges.erase(edge->getMicrosimID());
2329 // remove all lanes
2330 for (const auto& lane : edge->getLanes()) {
2331 deleteLane(lane);
2332 }
2333 // extract edge of district container
2334 myNet->getNetBuilder()->getEdgeCont().extract(myNet->getNetBuilder()->getDistrictCont(), edge->getNBEdge());
2335 edge->decRef("GNENet::deleteSingleEdge");
2336 edge->setResponsible(true);
2337 // Remove refrences from GNEJunctions
2339 edge->getToJunction()->removeIncomingGNEEdge(edge);
2340 // get template editor
2341 GNEInspectorFrame::TemplateEditor* templateEditor = myNet->getViewNet()->getViewParent()->getInspectorFrame()->getTemplateEditor();
2342 // check if we have to remove template
2343 if (templateEditor->getEdgeTemplate() && (templateEditor->getEdgeTemplate()->getID() == edge->getID())) {
2344 templateEditor->setEdgeTemplate(nullptr);
2345 }
2346}
2347
2348
2349bool
2351 // first check that additional pointer is valid
2352 if (additional) {
2353 // get vector with this additional element type
2354 const auto& additionalElementTag = myAdditionals.at(additional->getTagProperty().getTag());
2355 // find demanElement in additionalElementTag
2356 return std::find(additionalElementTag.begin(), additionalElementTag.end(), additional) != additionalElementTag.end();
2357 } else {
2358 throw ProcessError("Invalid additional pointer");
2359 }
2360}
2361
2362
2363void
2365 // insert additional
2366 if (myAdditionals.at(additional->getTagProperty().getTag()).insert(additional).second == false) {
2367 throw ProcessError(additional->getTagStr() + " with ID='" + additional->getID() + "' already exist");
2368 }
2369 // add element in grid
2370 if (additional->getTagProperty().isPlacedInRTree()) {
2371 myNet->addGLObjectIntoGrid(additional);
2372 }
2373 // update geometry after insertion of additionals if myUpdateGeometryEnabled is enabled
2374 if (myNet->isUpdateGeometryEnabled()) {
2375 additional->updateGeometry();
2376 }
2377 // additionals has to be saved
2378 myNet->getSavingStatus()->requireSaveAdditionals();
2379}
2380
2381
2382void
2384 // find demanElement in additionalTag
2385 auto itFind = myAdditionals.at(additional->getTagProperty().getTag()).find(additional);
2386 // check if additional was previously inserted
2387 if (itFind == myAdditionals.at(additional->getTagProperty().getTag()).end()) {
2388 throw ProcessError(additional->getTagStr() + " with ID='" + additional->getID() + "' wasn't previously inserted");
2389 }
2390 // remove it from inspected elements and GNEElementTree
2391 myNet->getViewNet()->removeFromAttributeCarrierInspected(additional);
2392 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(additional);
2393 // remove from container
2394 myAdditionals.at(additional->getTagProperty().getTag()).erase(itFind);
2395 // remove element from grid
2396 if (additional->getTagProperty().isPlacedInRTree()) {
2397 myNet->removeGLObjectFromGrid(additional);
2398 }
2399 // delete path element
2400 myNet->getPathManager()->removePath(additional);
2401 // additionals has to be saved
2402 myNet->getSavingStatus()->requireSaveAdditionals();
2403}
2404
2405
2406bool
2408 // first check that demandElement pointer is valid
2409 if (demandElement) {
2410 // get vector with this demand element type
2411 const auto& demandElementTag = myDemandElements.at(demandElement->getTagProperty().getTag());
2412 // find demanElement in demandElementTag
2413 return std::find(demandElementTag.begin(), demandElementTag.end(), demandElement) != demandElementTag.end();
2414 } else {
2415 throw ProcessError("Invalid demandElement pointer");
2416 }
2417}
2418
2419
2420void
2422 // insert in demandElements container
2423 if (myDemandElements.at(demandElement->getTagProperty().getTag()).insert(demandElement).second == false) {
2424 throw ProcessError(demandElement->getTagStr() + " with ID='" + demandElement->getID() + "' already exist");
2425 }
2426 // add element in grid
2427 myNet->addGLObjectIntoGrid(demandElement);
2428 // update geometry after insertion of demandElements if myUpdateGeometryEnabled is enabled
2429 if (myNet->isUpdateGeometryEnabled()) {
2430 demandElement->updateGeometry();
2431 }
2432 // update demand elements frames
2433 updateDemandElementFrames(demandElement->getTagProperty());
2434 // demandElements has to be saved
2435 myNet->getSavingStatus()->requireSaveDemandElements();
2436}
2437
2438
2439void
2441 // find demanElement in demandElementTag
2442 auto itFind = myDemandElements.at(demandElement->getTagProperty().getTag()).find(demandElement);
2443 // check if demandElement was previously inserted
2444 if (itFind == myDemandElements.at(demandElement->getTagProperty().getTag()).end()) {
2445 throw ProcessError(demandElement->getTagStr() + " with ID='" + demandElement->getID() + "' wasn't previously inserted");
2446 }
2447 // remove it from inspected elements and GNEElementTree
2448 myNet->getViewNet()->removeFromAttributeCarrierInspected(demandElement);
2449 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(demandElement);
2450 myNet->getViewNet()->getViewParent()->getPersonPlanFrame()->getPersonHierarchy()->removeCurrentEditedAttributeCarrier(demandElement);
2451 myNet->getViewNet()->getViewParent()->getContainerPlanFrame()->getContainerHierarchy()->removeCurrentEditedAttributeCarrier(demandElement);
2452 // if is the last inserted route, remove it from GNEViewNet
2453 if (myNet->getViewNet()->getLastCreatedRoute() == demandElement) {
2454 myNet->getViewNet()->setLastCreatedRoute(nullptr);
2455 }
2456 // erase it from container
2457 myDemandElements.at(demandElement->getTagProperty().getTag()).erase(itFind);
2458 // remove element from grid
2459 myNet->removeGLObjectFromGrid(demandElement);
2460 // delete path element
2461 myNet->getPathManager()->removePath(demandElement);
2462 // check if update demand elements frames
2463 if (updateFrames) {
2464 updateDemandElementFrames(demandElement->getTagProperty());
2465 }
2466 // demandElements has to be saved
2467 myNet->getSavingStatus()->requireSaveDemandElements();
2468}
2469
2470
2471bool
2473 // first check that dataSet pointer is valid
2474 if (dataSet) {
2475 if (myDataSets.find(dataSet) != myDataSets.end()) {
2476 return true;
2477 } else {
2478 return false;
2479 }
2480 } else {
2481 throw ProcessError("Invalid dataSet pointer");
2482 }
2483}
2484
2485
2486void
2488 // Check if dataSet element exists before insertion
2489 if (myDataSets.insert(dataSet).second == false) {
2490 throw ProcessError(dataSet->getTagStr() + " with ID='" + dataSet->getID() + "' already exist");
2491 }
2492 // dataSets has to be saved
2493 myNet->getSavingStatus()->requireSaveDataElements();
2494 // mark interval toolbar for update
2495 myNet->getViewNet()->getIntervalBar().markForUpdate();
2496}
2497
2498
2499void
2501 // find dataSet
2502 const auto itFind = myDataSets.find(dataSet);
2503 // first check that dataSet pointer is valid
2504 if (itFind == myDataSets.end()) {
2505 throw ProcessError(dataSet->getTagStr() + " with ID='" + dataSet->getID() + "' wasn't previously inserted");
2506 }
2507 // remove it from inspected elements and GNEElementTree
2508 myNet->getViewNet()->removeFromAttributeCarrierInspected(dataSet);
2509 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(dataSet);
2510 // obtain demand element and erase it from container
2511 myDataSets.erase(itFind);
2512 // dataSets has to be saved
2513 myNet->getSavingStatus()->requireSaveDataElements();
2514 // mark interval toolbar for update
2515 myNet->getViewNet()->getIntervalBar().markForUpdate();
2516}
2517
2518
2519bool
2521 // first check that meanData pointer is valid
2522 if (meanData) {
2523 // get vector with this meanData element type
2524 const auto& meanDataElementTag = myMeanDatas.at(meanData->getTagProperty().getTag());
2525 // find demanElement in meanDataElementTag
2526 return std::find(meanDataElementTag.begin(), meanDataElementTag.end(), meanData) != meanDataElementTag.end();
2527 } else {
2528 throw ProcessError(TL("Invalid meanData pointer"));
2529 }
2530}
2531
2532
2533void
2535 // insert meanData
2536 if (myMeanDatas.at(meanData->getTagProperty().getTag()).insert(meanData).second == false) {
2537 throw ProcessError(meanData->getTagStr() + " with ID='" + meanData->getID() + "' already exist");
2538 }
2539 // add element in grid
2540 if (meanData->getTagProperty().isPlacedInRTree()) {
2541 myNet->addGLObjectIntoGrid(meanData);
2542 }
2543 // update geometry after insertion of meanDatas if myUpdateGeometryEnabled is enabled
2544 if (myNet->isUpdateGeometryEnabled()) {
2545 meanData->updateGeometry();
2546 }
2547 // meanDatas has to be saved
2548 myNet->getSavingStatus()->requireSaveMeanDatas();
2549}
2550
2551
2552void
2554 // find demanElement in meanDataTag
2555 auto itFind = myMeanDatas.at(meanData->getTagProperty().getTag()).find(meanData);
2556 // check if meanData was previously inserted
2557 if (itFind == myMeanDatas.at(meanData->getTagProperty().getTag()).end()) {
2558 throw ProcessError(meanData->getTagStr() + " with ID='" + meanData->getID() + "' wasn't previously inserted");
2559 }
2560 // remove it from inspected elements and GNEElementTree
2561 myNet->getViewNet()->removeFromAttributeCarrierInspected(meanData);
2562 myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(meanData);
2563 // remove from container
2564 myMeanDatas.at(meanData->getTagProperty().getTag()).erase(itFind);
2565 // remove element from grid
2566 if (meanData->getTagProperty().isPlacedInRTree()) {
2567 myNet->removeGLObjectFromGrid(meanData);
2568 }
2569 // meanDatas has to be saved
2570 myNet->getSavingStatus()->requireSaveMeanDatas();
2571}
2572
2573
2574void
2576 if (myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
2577 // continue depending of demand mode
2578 switch (myNet->getViewNet()->getEditModes().demandEditMode) {
2580 if (tagProperty.isType()) {
2581 myNet->getViewNet()->getViewParent()->getVehicleFrame()->getTypeSelector()->refreshDemandElementSelector();
2582 }
2583 break;
2585 if (tagProperty.isType()) {
2586 myNet->getViewNet()->getViewParent()->getTypeFrame()->getTypeSelector()->refreshTypeSelector();
2587 }
2588 break;
2590 if (tagProperty.isType()) {
2591 myNet->getViewNet()->getViewParent()->getTypeDistributionFrame()->getTypeDistributionSelector()->refreshTypeDistributionSelector();
2592 }
2593 break;
2595 myNet->getViewNet()->getViewParent()->getStopFrame()->getStopParentSelector()->refreshDemandElementSelector();
2596 break;
2598 if (tagProperty.isType()) {
2599 myNet->getViewNet()->getViewParent()->getPersonFrame()->getTypeSelector()->refreshDemandElementSelector();
2600 }
2601 break;
2603 if (tagProperty.isPerson()) {
2604 myNet->getViewNet()->getViewParent()->getPersonPlanFrame()->getPersonSelector()->refreshDemandElementSelector();
2605 }
2606 break;
2608 if (tagProperty.isType()) {
2609 myNet->getViewNet()->getViewParent()->getContainerFrame()->getTypeSelector()->refreshDemandElementSelector();
2610 }
2611 break;
2613 if (tagProperty.isContainer()) {
2614 myNet->getViewNet()->getViewParent()->getContainerPlanFrame()->getContainerSelector()->refreshDemandElementSelector();
2615 }
2616 break;
2617 default:
2618 // nothing to update
2619 break;
2620 }
2621 }
2622}
2623
2624// ---------------------------------------------------------------------------
2625// GNENetHelper::SavingStatus - methods
2626// ---------------------------------------------------------------------------
2627
2630
2631
2632void
2634 mySumoConfigSaved = false;
2635}
2636
2637
2638void
2640 mySumoConfigSaved = true;
2641}
2642
2643
2644bool
2646 return mySumoConfigSaved;
2647}
2648
2649
2650
2651void
2653 myNeteditConfigSaved = false;
2654}
2655
2656
2657void
2659 myNeteditConfigSaved = true;
2660}
2661
2662
2663bool
2665 return myNeteditConfigSaved;
2666}
2667
2668
2669void
2671 myNetworkSaved = false;
2672 // implies requiere save netedit config and sumo config
2673 myNeteditConfigSaved = false;
2674 mySumoConfigSaved = false;
2675}
2676
2677
2678void
2680 myNetworkSaved = true;
2681}
2682
2683
2684bool
2686 return myNetworkSaved;
2687}
2688
2689
2690void
2692 myTLSSaved = false;
2693}
2694
2695
2696void
2698 myTLSSaved = true;
2699}
2700
2701
2702bool
2704 return myTLSSaved;
2705}
2706
2707
2708void
2710 myEdgeTypeSaved = false;
2711}
2712
2713
2714void
2716 myEdgeTypeSaved = true;
2717}
2718
2719
2720bool
2722 return myEdgeTypeSaved;
2723}
2724
2725
2726void
2728 myAdditionalSaved = false;
2729 // implies requiere save netedit config and sumo config
2730 myNeteditConfigSaved = false;
2731 mySumoConfigSaved = false;
2732}
2733
2734
2735void
2737 myAdditionalSaved = true;
2738}
2739
2740
2741bool
2743 return myAdditionalSaved;
2744}
2745
2746
2747void
2749 myDemandElementSaved = false;
2750 // implies requiere save netedit config and sumo config
2751 myNeteditConfigSaved = false;
2752 mySumoConfigSaved = false;
2753}
2754
2755
2756void
2758 myDemandElementSaved = true;
2759}
2760
2761
2762bool
2764 return myDemandElementSaved;
2765}
2766
2767
2768void
2770 myDataElementSaved = false;
2771 // implies requiere save netedit config and sumo config
2772 myNeteditConfigSaved = false;
2773 mySumoConfigSaved = false;
2774}
2775
2776
2777void
2779 myDataElementSaved = true;
2780}
2781
2782
2783bool
2785 return myDataElementSaved;
2786}
2787
2788
2789void
2791 myMeanDataElementSaved = false;
2792 // implies requiere save netedit config and sumo config
2793 myNeteditConfigSaved = false;
2794 mySumoConfigSaved = false;
2795}
2796
2797
2798void
2800 myMeanDataElementSaved = true;
2801}
2802
2803
2804bool
2806 return myMeanDataElementSaved;
2807}
2808
2809// ---------------------------------------------------------------------------
2810// GNENetHelper::GNEChange_ReplaceEdgeInTLS - methods
2811// ---------------------------------------------------------------------------
2812
2814 GNEChange(Supermode::NETWORK, true, false),
2815 myTllcont(tllcont),
2816 myReplaced(replaced),
2817 myBy(by) {
2818}
2819
2820
2822
2823
2824void
2826 // assuming this is only used for replacing incoming connections (GNENet::replaceIncomingEdge)
2827 myTllcont.replaceRemoved(myBy, -1, myReplaced, -1, true);
2828}
2829
2830
2831void
2833 // assuming this is only used for replacing incoming connections (GNENet::replaceIncomingEdge)
2834 myTllcont.replaceRemoved(myReplaced, -1, myBy, -1, true);
2835}
2836
2837
2838std::string
2840 return TL("Redo replace in TLS");
2841}
2842
2843
2844std::string
2846 return TL("Undo replace in TLS");
2847}
2848
2849
2850bool
2852 return myReplaced != myBy;
2853}
2854
2855/****************************************************************************/
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
@ DATA
Data mode (edgeData, LaneData etc..)
@ DEMAND
Demand mode (Routes, Vehicles etc..)
@ DEMAND_PERSONPLAN
Mode for editing person plan.
@ DEMAND_CONTAINER
Mode for editing container.
@ DEMAND_PERSON
Mode for editing person.
@ DEMAND_TYPEDISTRIBUTION
Mode for editing type distributions.
@ DEMAND_VEHICLE
Mode for editing vehicles.
@ DEMAND_STOP
Mode for editing stops.
@ DEMAND_CONTAINERPLAN
Mode for editing container plan.
@ DEMAND_TYPE
Mode for editing types.
long long int SUMOTime
Definition GUI.h:36
unsigned int GUIGlID
Definition GUIGlObject.h:43
GUISelectedStorage gSelected
A global holder of selected objects.
#define WRITE_DEBUG(msg)
Definition MsgHandler.h:281
#define TL(string)
Definition MsgHandler.h:287
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_RAILTYPE_ID
const std::string DEFAULT_PEDTYPE_ID
const std::set< std::string > DEFAULT_VTYPES
const std::string DEFAULT_VTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
const std::string DEFAULT_BIKETYPE_ID
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_TRIP_JUNCTIONS
a trip between junctions
@ SUMO_TAG_TRACTION_SUBSTATION
A traction substation.
@ GNE_TAG_TRIP_TAZS
a single trip definition that uses TAZs
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_DATAINTERVAL
@ 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_NOTHING
invalid tag
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_CONTAINERFLOW
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ GNE_TAG_EDGEREL_SINGLE
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_MEANDATA_LANE
a lane based mean data detector
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route
@ GNE_TAG_FLOW_JUNCTIONS
a flow between junctions
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_WALKINGAREA
walking area for pedestrians
@ GNE_TAG_FLOW_TAZS
a flow between TAZs
@ GNE_TAG_CALIBRATOR_LANE
A calibrator placed over lane.
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
@ 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_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ GNE_TAG_VEHICLE_WITHROUTE
description of a vehicle with an embedded route
@ GNE_TAG_POILANE
Point of interest over Lane.
@ SUMO_TAG_DATASET
@ SUMO_TAG_PERSON
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
@ SUMO_TAG_TAZREL
a relation between two TAZs
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
@ 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_PERSONFLOW
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_BEGIN
weights: time range begin
@ GNE_ATTR_DEFAULT_VTYPE
Flag to check if VType is a default VType.
@ SUMO_ATTR_END
weights: time range end
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
An Element which don't belong to GNENet but has influence in the simulation.
virtual void updateGeometry()=0
update pre-computed geometry information
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
virtual Position getPositionInView() const =0
Returns position of additional in view.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static const std::vector< GNETagProperties > getTagPropertiesByType(const int tagPropertyCategory)
get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT,...
static const std::string True
true value in string format (used for comparing boolean values in getAttribute(......
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
the function-object for an editing operation (abstract base)
Definition GNEChange.h:56
const PositionVector & getConnectionShape() const
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition GNECrossing.h:44
const PositionVector & getCrossingShape() const
An Element which don't belong to GNENet but has influence in the simulation.
An Element which don't belong to GNENet but has influence in the simulation.
virtual void updateGeometry()=0
update pre-computed geometry information
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
void setResponsible(bool newVal)
set responsibility for deleting internal structures
Definition GNEEdge.cpp:1227
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:480
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition GNEEdge.cpp:840
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:77
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:82
void setMicrosimID(const std::string &newID)
override to also set lane ids
Definition GNEEdge.cpp:2066
An Element which don't belong to GNENet but has influence in the simulation.
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
void setEdgeTemplate(const GNEEdge *edge)
set edge template
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
void setResponsible(bool newVal)
set responsibility for deleting internal structures
void updateGeometry()
update pre-computed geometry information (including crossings)
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
NBNode * getNBNode() const
Return net build node.
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:788
An Element which don't belong to GNENet but has influence in the simulation.
Definition GNEMeanData.h:33
void updateGeometry()
update pre-computed geometry information
std::vector< GNEEdge * > retrieveEdges(GNEJunction *from, GNEJunction *to) const
get all edges by from and to GNEJunction
void insertWalkingArea(GNEWalkingArea *walkingArea)
insert walkingArea
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool hardFail=true) const
get a single attribute carrier based on a GLID
int getNumberOfSelectedAdditionals() const
get number of selected additionals (Including POIs, Polygons, TAZs and Wires)
const std::map< SumoXMLTag, std::set< GNEGenericData * > > & getGenericDatas() const
get all generic datas
const std::set< GNELane * > & getLanes() const
get lanes
const std::set< GNEConnection * > & getConnections() const
get connections
int getNumberOfSelectedConnections() const
get number of selected connections
void deleteDataSet(GNEDataSet *dataSet)
delete demand element element of GNENet container
void addPrefixToJunctions(const std::string &prefix)
add prefix to all junctions
void insertLane(GNELane *lane)
insert lane
int getNumberOfSelectedEdgeRelDatas() const
get number of selected edge rel datas
int getNumberOfSelectedCrossings() const
get number of selected crossings
GNEEdgeType * registerEdgeType(GNEEdgeType *edgeType)
registers a edge in GNENet containers
std::vector< GNEAdditional * > getSelectedShapes() const
get selected shapes
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
std::map< SumoXMLTag, std::set< GNEDemandElement * > > myDemandElements
map with the tag and pointer to demand elements of net
const std::map< SumoXMLTag, std::set< GNEDemandElement * > > & getDemandElements() const
get demand elements
void insertDataSet(GNEDataSet *dataSet)
Insert a demand element element int GNENet container.
bool dataSetExist(GNEDataSet *dataSet) const
return true if given demand element exist
int getNumberOfSelectedRides() const
get number of selected rides
void clearDemandElements()
clear demand elements
void insertGenericData(GNEGenericData *genericData)
insert generic data
GNEEdge * registerEdge(GNEEdge *edge)
registers an edge with GNENet containers
bool demandElementExist(GNEDemandElement *demandElement) const
return true if given demand element exist
void deleteDemandElement(GNEDemandElement *demandElement, const bool updateFrames)
delete demand element element of GNENet container
int getNumberOfSelectedPersonTrips() const
get number of selected person trips
std::string generateDemandElementID(SumoXMLTag tag) const
generate demand element id
int getNumberOfMeanDatas() const
get number of meanDatas
void addPrefixToEdges(const std::string &prefix)
add prefix to all edges
void remapJunctionAndEdgeIds()
remap junction and edge IDs
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag tag=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
void clearEdgeTypes()
clear edgeTypes
int getNumberOfSelectedTranships() const
get number of selected tranships
const std::map< SumoXMLTag, std::set< GNEMeanData * > > & getMeanDatas() const
get meanDatas
int getNumberOfSelectedVehicles() const
get number of selected vehicles
int getNumberOfSelectedWalks() const
get number of selected walks
void deleteEdgeType(GNEEdgeType *edgeType)
deletes edgeType
std::string generateDataSetID(const std::string &prefix) const
generate data set id
void deleteConnection(GNEConnection *connection)
delete connection
void clearAdditionals()
clear additionals
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
std::vector< GNEGenericData * > retrieveGenericDatas(const SumoXMLTag genericDataTag, const double begin, const double end)
retrieve generic datas within the given interval
int getStopIndex()
get (and update) stop index
std::set< std::string > retrieveGenericDataParameters(const std::string &genericDataTag, const double begin, const double end) const
return a set of parameters for the given data Interval
std::vector< GNEWalkingArea * > getSelectedWalkingAreas() const
return all selected walkingAreas
std::map< SumoXMLTag, std::set< GNEGenericData * > > myGenericDatas
map with the tag and pointer to all generic datas
void deleteSingleJunction(GNEJunction *junction)
deletes a single junction
GNEMeanData * retrieveMeanData(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named meanData.
GNEJunction * registerJunction(GNEJunction *junction)
registers a junction in GNENet containers
const std::set< GNEDataSet * > & getDataSets() const
get demand elements
int getNumberOfSelectedWalkingAreas() const
get number of selected walkingAreas
bool isNetworkElementAroundShape(GNEAttributeCarrier *AC, const PositionVector &shape) const
check if shape of given AC (network element) is around the given shape
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
std::vector< GNEDemandElement * > getSelectedDemandElements() const
get selected demand elements
GNEDemandElement * retrieveFirstDemandElement(SumoXMLTag type) const
Returns the first demand element sorted by ID (or null if type is empty)
void updateJunctionID(GNEJunction *junction, const std::string &newID)
update junction ID in container
void deleteGenericData(GNEGenericData *genericData)
delete generic data
void insertCrossing(GNECrossing *crossing)
insert crossing
int getNumberOfSelectedWires() const
get number of selected Wires
std::string generateMeanDataID(SumoXMLTag type) const
generate meanData id
void insertMeanData(GNEMeanData *meanData)
Insert a meanData element int GNENet container.
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
int getNumberOfSelectedTAZs() const
get number of selected TAZs
void deleteWalkingArea(GNEWalkingArea *walkingArea)
delete walkingArea
int getNumberOfSelectedTransport() const
get number of selected transports
GNEDataInterval * retrieveDataInterval(GNEAttributeCarrier *AC, bool hardFail=true) const
Returns the data interval.
std::vector< GNELane * > getSelectedLanes() const
get selected lanes
void insertConnection(GNEConnection *connection)
insert connection
std::vector< GNEAdditional * > getSelectedAdditionals() const
get selected additionals
int getNumberOfSelectedJunctions() const
get number of selected junctions
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
int getNumberOfGenericDatas() const
Return the number of generic datas.
int getNumberOfSelectedDemandElements() const
get number of selected demand elements
int getNumberOfSelectedPersons() const
get number of selected persons
int getNumberOfSelectedPureAdditionals() const
get number of selected pure additionals (Except POIs, Polygons, TAZs and Wires)
GNEEdgeType * retrieveEdgeType(const std::string &id, bool hardFail=true) const
get edge type by id
void deleteMeanData(GNEMeanData *meanData)
delete meanData element of GNENet container
int getNumberOfSelectedRoutes() const
get number of selected routes
void addDefaultVTypes()
add default VTypes
int getNumberOfSelectedPOIs() const
get number of selected POIs
void deleteSingleEdge(GNEEdge *edge)
deletes a single edge
std::string generateAdditionalID(SumoXMLTag type) const
generate additional id
const std::set< GNEDataInterval * > & getDataIntervals() const
get all data intervals of network
void deleteAdditional(GNEAdditional *additional)
delete additional element of GNENet container
int getNumberOfDemandElements() const
Return the number of demand elements.
int getNumberOfSelectedPolygons() const
get number of selected polygons
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
int getNumberOfAdditionals() const
get number of additionals
const std::set< GNECrossing * > & getCrossings() const
get crossings
void insertDemandElement(GNEDemandElement *demandElement)
Insert a demand element element int GNENet container.
const std::map< SumoXMLTag, std::set< GNEAdditional * > > & getAdditionals() const
get additionals
void updateEdgeID(GNEEdge *edge, const std::string &newID)
update edge ID in container
std::vector< GNECrossing * > getSelectedCrossings() const
return all selected crossings
std::map< SumoXMLTag, std::set< GNEMeanData * > > myMeanDatas
map with the tag and pointer to meanData elements of net
int getNumberOfSelectedLanes() const
get number of selected lanes
GNEAdditional * retrieveRerouterInterval(const std::string &rerouterID, const SUMOTime begin, const SUMOTime end) const
Returns the rerouter interval defined by given begin and end.
int getNumberOfSelectedEdgeDatas() const
get number of selected edge datas
void updateEdgeTypeID(GNEEdgeType *edgeType, const std::string &newID)
update edgeType ID in container
int getNumberOfSelectedTAZSources() const
get number of selected TAZSources
bool additionalExist(const GNEAdditional *additional) const
return true if given additional exist
void insertAdditional(GNEAdditional *additional)
Insert a additional element int GNENet container.
void insertEdgeType(GNEEdgeType *edgeType)
inserts a single edgeType into the net and into the underlying netbuild-container
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
int getNumberOfSelectedEdgeTAZRel() const
get number of selected edge TAZ Rels
std::vector< GNEGenericData * > getSelectedGenericDatas() const
get selected generic datas
void deleteLane(GNELane *lane)
delete lane
void insertJunction(GNEJunction *junction)
std::vector< GNEEdge * > getSelectedEdges() const
return all edges
std::map< SumoXMLTag, std::set< GNEAdditional * > > myAdditionals
map with the tag and pointer to additional elements of net
void insertDataInterval(GNEDataInterval *dataInterval)
insert data interval
int getNumberOfSelectedTAZSinks() const
get number of selected TAZSinks
void updateDemandElementFrames(const GNETagProperties &tagProperty)
update demand element frames (called after insert/delete demand element)
const std::map< std::string, GNEJunction * > & getJunctions() const
get junctions
int getNumberOfSelectedEdges() const
get number of selected edges
const std::map< std::string, GNEEdgeType * > & getEdgeTypes() const
map with the ID and pointer to edgeTypes of net
GNECrossing * retrieveCrossing(GNEAttributeCarrier *AC, bool hardFail=true) const
get Crossing by AC
void clearMeanDatas()
clear meanDatas
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
std::vector< GNEConnection * > getSelectedConnections() const
get selected connections
void clearJunctions()
clear junctions
bool meanDataExist(const GNEMeanData *meanData) const
return true if given meanData exist
void deleteCrossing(GNECrossing *crossing)
delete crossing
GNEGenericData * retrieveGenericData(GNEAttributeCarrier *AC, bool hardFail=true) const
Returns the generic data.
GNEDemandElement * getDefaultType() const
get default type
bool edgeTypeExist(const GNEEdgeType *edgeType) const
GNEWalkingArea * retrieveWalkingArea(GNEAttributeCarrier *AC, bool hardFail=true) const
get WalkingArea by AC
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(const bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
int getNumberOfSelectedStops() const
get number of selected stops
AttributeCarriers(GNENet *net)
constructor
std::string generateEdgeTypeID() const
generate edgeType id
void deleteDataInterval(GNEDataInterval *dataInterval)
delete data interval
GNEConnection * retrieveConnection(const std::string &id, bool hardFail=true) const
get Connection by id
const std::set< GNEWalkingArea * > & getWalkingAreas() const
get walkingAreas
int getNumberOfSelectedContainers() const
get number of selected containers
std::string undoName() const
undo name
GNEChange_ReplaceEdgeInTLS(NBTrafficLightLogicCont &tllcont, NBEdge *replaced, NBEdge *by)
constructor
std::string redoName() const
get Redo name
bool trueChange()
wether original and new value differ
void requireSaveTLS()
inform that TLS has to be saved
void dataElementsSaved()
mark demand elements as saved
bool isEdgeTypeSaved() const
check if edgeType are saved
void requireSaveNetwork()
inform that network has to be saved
void requireSaveEdgeType()
inform that edgeType has to be saved
bool isTLSSaved() const
check if TLS are saved
void demandElementsSaved()
mark demand elements as saved
void SumoConfigSaved()
mark SumoConfig as saved
void additionalsSaved()
mark additionals as saved
void requireSaveNeteditConfig()
inform that netedit config has to be saved
void requireSaveSumoConfig()
inform that SumoConfig has to be saved
void TLSSaved()
mark TLS as saved
bool isSumoConfigSaved() const
check if SumoConfig is saved
void neteditConfigSaved()
mark netedit config as saved
void requireSaveMeanDatas()
inform that mean data elements has to be saved
void meanDatasSaved()
mark mean data elements as saved
bool isDemandElementsSaved() const
check if demand elements are saved
void requireSaveAdditionals()
inform that additionals has to be saved
bool isDataElementsSaved() const
check if data elements are saved
bool isNetworkSaved() const
check if network is saved
bool isMeanDatasSaved() const
check if mean data elements are saved
void requireSaveDataElements()
inform that data elements has to be saved
bool isNeteditConfigSaved() const
check if netedit config is saved
void networkSaved()
mark network as saved
bool isAdditionalsSaved() const
check if additionals are saved
void requireSaveDemandElements()
inform that demand elements has to be saved
void edgeTypeSaved()
mark edgeType as saved
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void decRef(const std::string &debugMsg="")
Decrease reference.
void incRef(const std::string &debugMsg="")
Increase reference.
bool isMeanData() const
return true if tag correspond to a mean data element
bool isContainer() const
return true if tag correspond to a container element
bool isGenericData() const
return true if tag correspond to a generic data element
bool isNetworkElement() const
return true if tag correspond to a network element
bool isDataElement() const
return true if tag correspond to a data element
bool isType() const
return true if tag correspond to a vehicle/person/container type element
bool isPlacedInRTree() const
return true if Tag correspond to an element that has to be placed in RTREE
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDemandElement() const
return true if tag correspond to a demand element
bool isAdditionalElement() const
return true if tag correspond to an additional element (note: this include TAZ, shapes and wires)
bool isPerson() const
return true if tag correspond to a person element
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
const PositionVector & getShape() const
The shape of the additional element.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
GUIGlObject * getObjectBlocking(GUIGlID id) const
Returns the object from the container locking it.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
The representation of a single edge during network building.
Definition NBEdge.h:92
NBNode * getToNode() const
Returns the destination node of the edge.
Definition NBEdge.h:536
const std::string & getID() const
Definition NBEdge.h:1515
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition NBEdge.h:529
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
Definition NBNode.cpp:484
Position getCenter() const
Returns a position that is guaranteed to lie within the node shape.
Definition NBNode.cpp:3770
int buildCrossings()
build pedestrian crossings
Definition NBNode.cpp:2963
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
Definition NBNode.cpp:494
const Position & getPosition() const
Definition NBNode.h:258
const PositionVector & getShape() const
retrieve the junction shape
Definition NBNode.cpp:2571
A container for traffic light definitions and built programs.
const std::string & getID() const
Returns the id.
Definition Named.h:74
static OptionsCont & getOptions()
Retrieves the options.
C++ TraCI client API implementation.
double z() const
Returns the z-position.
Definition Position.h:65
A list of positions.
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns the information whether the given polygon overlaps with this.
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID