Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEViewNetHelper.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-2024 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/****************************************************************************/
19// A file used to reduce the size of GNEViewNet.h grouping structs and classes
20/****************************************************************************/
39
40#include "GNEViewNetHelper.h"
41#include "GNEViewNet.h"
42#include "GNENet.h"
43#include "GNEUndoList.h"
44#include "GNEViewParent.h"
46
47
48// ===========================================================================
49// static members
50// ===========================================================================
51
52std::vector<RGBColor> GNEViewNetHelper::myRainbowScaledColors;
53
54// ---------------------------------------------------------------------------
55// GNEViewNetHelper::LockManager - methods
56// ---------------------------------------------------------------------------
57
59 myViewNet(viewNet) {
60 // fill myLockedElements objects
75 // fill myLockedElements objects
86 // fill myLockedElements objects
90}
91
92
94
95
96bool
97GNEViewNetHelper::LockManager::isObjectLocked(GUIGlObjectType objectType, const bool selected) const {
98 if (selected && (myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands().menuCheckLockSelectedElements->getCheck() == TRUE)) {
99 return true;
100 } else if ((objectType >= GLO_ADDITIONALELEMENT) && (objectType <= GLO_ACCESS)) {
101 // additionals
102 return myLockedElements.at(GLO_ADDITIONALELEMENT).lock;
103 } else if ((objectType >= GLO_WIRE) && (objectType <= GLO_TRACTIONSUBSTATION)) {
104 // wires
105 return myLockedElements.at(GLO_WIRE).lock;
106 } else if ((objectType == GLO_ROUTE) || (objectType == GLO_ROUTE_EMBEDDED)) {
107 // routes
108 return myLockedElements.at(GLO_ROUTE).lock;
109 } else if ((objectType >= GLO_VEHICLE) && (objectType <= GLO_ROUTEFLOW)) {
110 // vehicles
111 return myLockedElements.at(GLO_VEHICLE).lock;
112 } else if ((objectType == GLO_PERSON) || (objectType == GLO_PERSONFLOW)) {
113 // persons
114 return myLockedElements.at(GLO_PERSON).lock;
115 } else if ((objectType == GLO_CONTAINER) || (objectType == GLO_CONTAINERFLOW)) {
116 // containers
117 return myLockedElements.at(GLO_CONTAINER).lock;
118 } else if ((objectType >= GLO_STOP) && (objectType <= GLO_STOP_PLAN)) {
119 // stops
120 return myLockedElements.at(GLO_STOP).lock;
121 } else {
122 return myLockedElements.at(objectType).lock;
123 }
124}
125
126
127void
129 // get lock menu commands
130 GNEApplicationWindowHelper::LockMenuCommands& lockMenuCommands = myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands();
131 // network
132 myLockedElements[GLO_JUNCTION].lock = lockMenuCommands.menuCheckLockJunction->getCheck() == TRUE;
133 myLockedElements[GLO_EDGE].lock = lockMenuCommands.menuCheckLockEdges->getCheck() == TRUE;
134 myLockedElements[GLO_LANE].lock = lockMenuCommands.menuCheckLockLanes->getCheck() == TRUE;
135 myLockedElements[GLO_CONNECTION].lock = lockMenuCommands.menuCheckLockConnections->getCheck() == TRUE;
136 myLockedElements[GLO_CROSSING].lock = lockMenuCommands.menuCheckLockCrossings->getCheck() == TRUE;
137 myLockedElements[GLO_WALKINGAREA].lock = lockMenuCommands.menuCheckLockWalkingAreas->getCheck() == TRUE;
138 myLockedElements[GLO_ADDITIONALELEMENT].lock = lockMenuCommands.menuCheckLockAdditionals->getCheck() == TRUE;
139 myLockedElements[GLO_WIRE].lock = lockMenuCommands.menuCheckLockWires->getCheck() == TRUE;
140 myLockedElements[GLO_TAZ].lock = lockMenuCommands.menuCheckLockTAZs->getCheck() == TRUE;
141 myLockedElements[GLO_POLYGON].lock = lockMenuCommands.menuCheckLockPolygons->getCheck() == TRUE;
142 myLockedElements[GLO_POI].lock = lockMenuCommands.menuCheckLockPOIs->getCheck() == TRUE;
143 myLockedElements[GLO_JPS_WALKABLEAREA].lock = lockMenuCommands.menuCheckLockJpsWalkableAreas->getCheck() == TRUE;
144 myLockedElements[GLO_JPS_OBSTACLE].lock = lockMenuCommands.menuCheckLockJpsObstacles->getCheck() == TRUE;
145 // demand
146 myLockedElements[GLO_ROUTE].lock = lockMenuCommands.menuCheckLockRoutes->getCheck() == TRUE;
147 myLockedElements[GLO_VEHICLE].lock = lockMenuCommands.menuCheckLockVehicles->getCheck() == TRUE;
148 myLockedElements[GLO_PERSON].lock = lockMenuCommands.menuCheckLockPersons->getCheck() == TRUE;
149 myLockedElements[GLO_PERSONTRIP].lock = lockMenuCommands.menuCheckLockPersonTrip->getCheck() == TRUE;
150 myLockedElements[GLO_WALK].lock = lockMenuCommands.menuCheckLockWalk->getCheck() == TRUE;
151 myLockedElements[GLO_RIDE].lock = lockMenuCommands.menuCheckLockRides->getCheck() == TRUE;
152 myLockedElements[GLO_CONTAINER].lock = lockMenuCommands.menuCheckLockContainers->getCheck() == TRUE;
153 myLockedElements[GLO_TRANSPORT].lock = lockMenuCommands.menuCheckLockTransports->getCheck() == TRUE;
154 myLockedElements[GLO_TRANSHIP].lock = lockMenuCommands.menuCheckLockTranships->getCheck() == TRUE;
155 myLockedElements[GLO_STOP].lock = lockMenuCommands.menuCheckLockStops->getCheck() == TRUE;
156 // data
157 myLockedElements[GLO_EDGEDATA].lock = lockMenuCommands.menuCheckLockEdgeDatas->getCheck() == TRUE;
158 myLockedElements[GLO_EDGERELDATA].lock = lockMenuCommands.menuCheckLockEdgeRelDatas->getCheck() == TRUE;
159 myLockedElements[GLO_TAZRELDATA].lock = lockMenuCommands.menuCheckLockEdgeTAZRels->getCheck() == TRUE;
160}
161
162
163void
165 // get lock menu commands
166 GNEApplicationWindowHelper::LockMenuCommands& lockMenuCommands = myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands();
167 // network
168 lockMenuCommands.menuCheckLockJunction->setCheck(myLockedElements[GLO_JUNCTION].lock);
169 lockMenuCommands.menuCheckLockEdges->setCheck(myLockedElements[GLO_EDGE].lock);
170 lockMenuCommands.menuCheckLockLanes->setCheck(myLockedElements[GLO_LANE].lock);
171 lockMenuCommands.menuCheckLockConnections->setCheck(myLockedElements[GLO_CONNECTION].lock);
172 lockMenuCommands.menuCheckLockCrossings->setCheck(myLockedElements[GLO_CROSSING].lock);
173 lockMenuCommands.menuCheckLockWalkingAreas->setCheck(myLockedElements[GLO_WALKINGAREA].lock);
174 lockMenuCommands.menuCheckLockAdditionals->setCheck(myLockedElements[GLO_ADDITIONALELEMENT].lock);
175 lockMenuCommands.menuCheckLockWires->setCheck(myLockedElements[GLO_WIRE].lock);
176 lockMenuCommands.menuCheckLockTAZs->setCheck(myLockedElements[GLO_TAZ].lock);
177 lockMenuCommands.menuCheckLockPolygons->setCheck(myLockedElements[GLO_POLYGON].lock);
178 lockMenuCommands.menuCheckLockPOIs->setCheck(myLockedElements[GLO_POI].lock);
179 lockMenuCommands.menuCheckLockJpsWalkableAreas->setCheck(myLockedElements[GLO_JPS_WALKABLEAREA].lock);
180 lockMenuCommands.menuCheckLockJpsObstacles->setCheck(myLockedElements[GLO_JPS_OBSTACLE].lock);
181 // demand
182 lockMenuCommands.menuCheckLockRoutes->setCheck(myLockedElements[GLO_ROUTE].lock);
183 lockMenuCommands.menuCheckLockVehicles->setCheck(myLockedElements[GLO_VEHICLE].lock);
184 lockMenuCommands.menuCheckLockPersons->setCheck(myLockedElements[GLO_PERSON].lock);
185 lockMenuCommands.menuCheckLockPersonTrip->setCheck(myLockedElements[GLO_PERSONTRIP].lock);
186 lockMenuCommands.menuCheckLockWalk->setCheck(myLockedElements[GLO_WALK].lock);
187 lockMenuCommands.menuCheckLockRides->setCheck(myLockedElements[GLO_RIDE].lock);
188 lockMenuCommands.menuCheckLockContainers->setCheck(myLockedElements[GLO_CONTAINER].lock);
189 lockMenuCommands.menuCheckLockTransports->setCheck(myLockedElements[GLO_TRANSPORT].lock);
190 lockMenuCommands.menuCheckLockTranships->setCheck(myLockedElements[GLO_TRANSHIP].lock);
191 lockMenuCommands.menuCheckLockStops->setCheck(myLockedElements[GLO_STOP].lock);
192 // data
193 lockMenuCommands.menuCheckLockEdgeDatas->setCheck(myLockedElements[GLO_EDGEDATA].lock);
194 lockMenuCommands.menuCheckLockEdgeRelDatas->setCheck(myLockedElements[GLO_EDGERELDATA].lock);
195 lockMenuCommands.menuCheckLockEdgeTAZRels->setCheck(myLockedElements[GLO_TAZRELDATA].lock);
196}
197
198
202
203
207
208
210
211
216
217// ---------------------------------------------------------------------------
218// GNEViewNetHelper::InspectedElements - methods
219// ---------------------------------------------------------------------------
220
222
223
224void
226 myInspectedACs.clear();
227 if (AC) {
228 myFirstInspectedAC = AC;
229 myInspectedACs.insert(AC);
230 } else {
231 myFirstInspectedAC = nullptr;
232 }
233}
234
235
236void
237GNEViewNetHelper::InspectedElements::inspectACs(const std::vector<GNEAttributeCarrier*>& ACs) {
238 myInspectedACs.clear();
239 if (ACs.size() > 0) {
240 myFirstInspectedAC = ACs.front();
241 for (const auto& AC : ACs) {
242 myInspectedACs.insert(AC);
243 }
244 } else {
245 myFirstInspectedAC = nullptr;
246 }
247}
248
249
250void
252 auto it = myInspectedACs.find(AC);
253 if (it != myInspectedACs.end()) {
254 myInspectedACs.erase(it);
255 if (myInspectedACs.size() == 0) {
256 myInspectedACs.clear();
257 myFirstInspectedAC = nullptr;
258 } else if (myFirstInspectedAC == AC) {
259 myFirstInspectedAC = (*myInspectedACs.begin());
260 }
261 }
262}
263
264
265void
267 myFirstInspectedAC = nullptr;
268 myInspectedACs.clear();
269}
270
271
274 return myFirstInspectedAC;
275}
276
277
278const std::unordered_set<GNEAttributeCarrier*>&
280 return myInspectedACs;
281}
282
283
284bool
286 if (myInspectedACs.empty()) {
287 return false;
288 } else if (myFirstInspectedAC == AC) {
289 return true;
290 } else {
291 return myInspectedACs.find(AC) != myInspectedACs.end();
292 }
293}
294
295
296bool
298 if (myInspectedACs.empty()) {
299 return false;
300 } else if (myFirstInspectedAC == AC) {
301 return true;
302 } else {
303 // we need a const_cast because our myInspectedACs is a set of non-constant ACs (in this case is safe)
304 return myInspectedACs.find(const_cast<GNEAttributeCarrier*>(AC)) != myInspectedACs.end();
305 }
306}
307
308
309bool
311 return myInspectedACs.size() > 0;
312}
313
314
315bool
317 return myInspectedACs.size() == 1;
318}
319
320
321bool
323 return myInspectedACs.size() > 1;
324}
325
326// ---------------------------------------------------------------------------
327// GNEViewNetHelper::MarkFrontElements - methods
328// ---------------------------------------------------------------------------
329
331
332
333void
337
338
339void
341 if (myMarkedACs.size() > 0) {
342 auto it = myMarkedACs.find(AC);
343 if (it != myMarkedACs.end()) {
344 myMarkedACs.erase(it);
345 }
346 }
347}
348
349
350void
352 // make a copy because container is modified in every iteration
353 const auto copy = myMarkedACs;
354 for (auto& AC : copy) {
356 }
357}
358
359
360const std::unordered_set<GNEAttributeCarrier*>&
362 return myMarkedACs;
363}
364
365// ---------------------------------------------------------------------------
366// GNEViewNetHelper::ViewObjectsSelector - methods
367// ---------------------------------------------------------------------------
368
372
373
374void
376 // clear elements and reserve space
377 myViewObjects.clearElements();
378 myViewObjects.reserve(gViewObjectsHandler.getNumberOfSelectedObjects());
379 // process GUIGLObjects using elements under cursor
380 processGUIGlObjects(gViewObjectsHandler.getSelectedObjects());
381}
382
383
384void
386 // get all elements to filter
387 std::vector<const GUIGlObject*> glElements;
388 for (const auto& glElement : myViewObjects.GUIGlObjects) {
389 if (glElement->getType() != exception) {
390 glElements.push_back(glElement);
391 }
392 }
393 myViewObjects.filterElements(glElements);
394}
395
396
397void
399 if (myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
400 filterDemandElements(true);
401 filterDataElements();
402 } else if (myViewNet->getEditModes().isCurrentSupermodeDemand()) {
403 filterNetworkElements();
404 filterAdditionals(true, true);
405 filterDataElements();
406 } else if (myViewNet->getEditModes().isCurrentSupermodeData()) {
407 filterNetworkElements();
408 filterDemandElements(true);
409 }
410}
411
412
413void
415 // get all edges to filter
416 std::vector<const GUIGlObject*> junctions;
417 for (const auto& junction : myViewObjects.junctions) {
418 junctions.push_back(junction);
419 }
420 myViewObjects.filterElements(junctions);
421}
422
423
424void
426 // get all edges to filter
427 std::vector<const GUIGlObject*> edges;
428 for (const auto& edge : myViewObjects.edges) {
429 edges.push_back(edge);
430 }
431 myViewObjects.filterElements(edges);
432}
433
434
435void
437 // get all lanes to filter
438 std::vector<const GUIGlObject*> lanes;
439 for (const auto& lane : myViewObjects.lanes) {
440 lanes.push_back(lane);
441 }
442 myViewObjects.filterElements(lanes);
443}
444
445
446void
448 // get all connections to filter
449 std::vector<const GUIGlObject*> connections;
450 for (const auto& connection : myViewObjects.connections) {
451 connections.push_back(connection);
452 }
453 myViewObjects.filterElements(connections);
454}
455
456
457void
459 // get all crossings to filter
460 std::vector<const GUIGlObject*> crossings;
461 for (const auto& crossing : myViewObjects.crossings) {
462 crossings.push_back(crossing);
463 }
464 myViewObjects.filterElements(crossings);
465}
466
467
468void
470 // get all walkingAreas to filter
471 std::vector<const GUIGlObject*> walkingAreas;
472 for (const auto& walkingArea : myViewObjects.walkingAreas) {
473 walkingAreas.push_back(walkingArea);
474 }
475 myViewObjects.filterElements(walkingAreas);
476}
477
478
479void
481 // get all elements to filter
482 std::vector<const GUIGlObject*> shapes;
483 for (const auto& poly : myViewObjects.polys) {
484 shapes.push_back(poly);
485 }
486 for (const auto& POI : myViewObjects.POIs) {
487 shapes.push_back(POI);
488 }
489 myViewObjects.filterElements(shapes);
490}
491
492
493void
494GNEViewNetHelper::ViewObjectsSelector::filterAdditionals(const bool includeStoppigPlaces, const bool includeTAZs) {
495 // get all elements to filter
496 std::vector<const GUIGlObject*> additionals;
497 for (const auto& additional : myViewObjects.additionals) {
498 if (!includeStoppigPlaces && (additional->getType() > GLO_STOPPING_PLACE) && (additional->getType() < GLO_STOPPING_PLACE_LAST)) {
499 continue;
500 } else if (!includeTAZs && (additional->getType() == GLO_TAZ)) {
501 continue;
502 } else {
503 additionals.push_back(additional);
504 }
505 }
506 myViewObjects.filterElements(additionals);
507}
508
509
510void
512 // get all elements to filter
513 std::vector<const GUIGlObject*> networkElements;
514 for (const auto& networkElement : myViewObjects.networkElements) {
515 networkElements.push_back(networkElement);
516 }
517 myViewObjects.filterElements(networkElements);
518}
519
520
521void
523 // get all elements to filter
524 std::vector<const GUIGlObject*> demandElements;
525 for (const auto& demandElement : myViewObjects.demandElements) {
526 if (!includeRoutes && (demandElement->getType() == GLO_ROUTE)) {
527 continue;
528 } else {
529 demandElements.push_back(demandElement);
530 }
531 }
532 myViewObjects.filterElements(demandElements);
533}
534
535
536void
538 // get all elements to filter
539 std::vector<const GUIGlObject*> datadElements;
540 for (const auto& datadElement : myViewObjects.edgeDatas) {
541 datadElements.push_back(datadElement);
542 }
543 for (const auto& datadElement : myViewObjects.edgeRelDatas) {
544 datadElements.push_back(datadElement);
545 }
546 for (const auto& datadElement : myViewObjects.TAZRelDatas) {
547 datadElements.push_back(datadElement);
548 }
549 myViewObjects.filterElements(datadElements);
550
551}
552
553
554void
555GNEViewNetHelper::ViewObjectsSelector::filterLockedElements(const std::vector<GUIGlObjectType> ignoreFilter) {
556 std::vector<const GUIGlObject*> GUIGlObjects;
557 // get all locked elements
558 for (const auto& GUIGlObject : myViewObjects.GUIGlObjects) {
560 GUIGlObjects.push_back(GUIGlObject);
561 }
562 }
563 // apply ignore filter
564 for (const auto& ignoredType : ignoreFilter) {
565 auto it = GUIGlObjects.begin();
566 while (it != GUIGlObjects.end()) {
567 if ((*it)->getType() == ignoredType) {
568 it = GUIGlObjects.erase(it);
569 } else {
570 it++;
571 }
572 }
573 }
574 // filter objects
575 myViewObjects.filterElements(GUIGlObjects);
576}
577
578
579const GUIGlObject*
581 if (myViewObjects.GUIGlObjects.size() > 0) {
582 return myViewObjects.GUIGlObjects.front();
583 } else {
584 return nullptr;
585 }
586}
587
588
591 if (myViewObjects.attributeCarriers.size() > 0) {
592 return myViewObjects.attributeCarriers.front();
593 } else {
594 return nullptr;
595 }
596}
597
598
601 if (myViewObjects.networkElements.size() > 0) {
602 return myViewObjects.networkElements.front();
603 } else {
604 return nullptr;
605 }
606}
607
608
611 if (myViewObjects.additionals.size() > 0) {
612 return myViewObjects.additionals.front();
613 } else {
614 return nullptr;
615 }
616}
617
618
621 if (myViewObjects.demandElements.size() > 0) {
622 return myViewObjects.demandElements.front();
623 } else {
624 return nullptr;
625 }
626}
627
628
631 if (myViewObjects.genericDatas.size() > 0) {
632 return myViewObjects.genericDatas.front();
633 } else {
634 return nullptr;
635 }
636}
637
638
641 if (myViewObjects.junctions.size() > 0) {
642 return myViewObjects.junctions.front();
643 } else {
644 return nullptr;
645 }
646}
647
648
649GNEEdge*
651 if (myViewObjects.edges.size() > 0) {
652 return myViewObjects.edges.front();
653 } else {
654 return nullptr;
655 }
656}
657
658
659GNELane*
661 if (myViewObjects.lanes.size() > 0) {
662 return myViewObjects.lanes.front();
663 } else {
664 return nullptr;
665 }
666}
667
668
669GNELane*
671 if (myViewObjects.lanes.size() > 0) {
672 for (auto& lane : myViewObjects.lanes) {
673 if (!(lane->isAttributeCarrierSelected() || lane->getParentEdge()->isAttributeCarrierSelected()) ||
674 !myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands().menuCheckLockSelectedElements->getCheck()) {
675 return lane;
676 }
677 }
678 // all locked, then return nullptr
679 return nullptr;
680 } else {
681 return nullptr;
682 }
683}
684
685
686const std::vector<GNELane*>&
688 return myViewObjects.lanes;
689}
690
691
694 if (myViewObjects.crossings.size() > 0) {
695 return myViewObjects.crossings.front();
696 } else {
697 return nullptr;
698 }
699}
700
701
704 if (myViewObjects.walkingAreas.size() > 0) {
705 return myViewObjects.walkingAreas.front();
706 } else {
707 return nullptr;
708 }
709}
710
711
714 if (myViewObjects.connections.size() > 0) {
715 return myViewObjects.connections.front();
716 } else {
717 return nullptr;
718 }
719}
720
721
724 if (myViewObjects.internalLanes.size() > 0) {
725 return myViewObjects.internalLanes.front();
726 } else {
727 return nullptr;
728 }
729}
730
731
732GNEPOI*
734 if (myViewObjects.POIs.size() > 0) {
735 return myViewObjects.POIs.front();
736 } else {
737 return nullptr;
738 }
739}
740
741
742GNEPoly*
744 if (myViewObjects.polys.size() > 0) {
745 return myViewObjects.polys.front();
746 } else {
747 return nullptr;
748 }
749}
750
751
752GNETAZ*
754 if (myViewObjects.TAZs.size() > 0) {
755 return myViewObjects.TAZs.front();
756 } else {
757 return nullptr;
758 }
759}
760
761
764 if (myViewObjects.edgeDatas.size() > 0) {
765 return myViewObjects.edgeDatas.front();
766 } else {
767 return nullptr;
768 }
769}
770
771
774 if (myViewObjects.edgeRelDatas.size() > 0) {
775 return myViewObjects.edgeRelDatas.front();
776 } else {
777 return nullptr;
778 }
779}
780
781
784 if (myViewObjects.TAZRelDatas.size() > 0) {
785 return myViewObjects.TAZRelDatas.front();
786 } else {
787 return nullptr;
788 }
789}
790
791
792const std::vector<GUIGlObject*>&
794 return myViewObjects.GUIGlObjects;
795}
796
797
798const std::vector<GNEAttributeCarrier*>&
800 return myViewObjects.attributeCarriers;
801}
802
803
804const std::vector<GNEJunction*>&
806 return myViewObjects.junctions;
807}
808
809
810const std::vector<GNEEdge*>&
812 return myViewObjects.edges;
813}
814
815const std::vector<GNETAZ*>&
817 return myViewObjects.TAZs;
818}
819
820const std::vector<GNEAdditional*>&
822 return myViewObjects.additionals;
823}
824
825const std::vector<GNEDemandElement*>&
827 return myViewObjects.demandElements;
828}
829
830
832
833
834void
836 GUIGlObjects.clear();
837 attributeCarriers.clear();
838 networkElements.clear();
839 additionals.clear();
840 demandElements.clear();
841 junctions.clear();
842 edges.clear();
843 lanes.clear();
844 crossings.clear();
845 walkingAreas.clear();
846 connections.clear();
847 internalLanes.clear();
848 TAZs.clear();
849 POIs.clear();
850 polys.clear();
851 genericDatas.clear();
852 edgeDatas.clear();
853 edgeRelDatas.clear();
854 TAZRelDatas.clear();
855}
856
857
858void
860 GUIGlObjects.reserve(size);
861 attributeCarriers.reserve(size);
862 networkElements.reserve(size);
863 additionals.reserve(size);
864 demandElements.reserve(size);
865 junctions.reserve(size);
866 edges.reserve(size);
867 lanes.reserve(size);
868 crossings.reserve(size);
869 walkingAreas.reserve(size);
870 connections.reserve(size);
871 internalLanes.reserve(size);
872 TAZs.reserve(size);
873 POIs.reserve(size);
874 polys.reserve(size);
875 genericDatas.reserve(size);
876 edgeDatas.reserve(size);
877 edgeRelDatas.reserve(size);
878 TAZRelDatas.reserve(size);
879}
880
881
882void
884 for (const auto& object : objects) {
885 // remove from GUIGlObjects
886 auto itGlObjects = GUIGlObjects.begin();
887 while (itGlObjects != GUIGlObjects.end()) {
888 if (*itGlObjects == object) {
889 itGlObjects = GUIGlObjects.erase(itGlObjects);
890 } else {
891 itGlObjects++;
892 }
893 }
894 // remove from attributeCarriers
895 auto itACs = attributeCarriers.begin();
896 while (itACs != attributeCarriers.end()) {
897 if ((*itACs)->getGUIGlObject() == object) {
898 itACs = attributeCarriers.erase(itACs);
899 } else {
900 itACs++;
901 }
902 }
903 // remove from networkElements
904 auto itNetworkElements = networkElements.begin();
905 while (itNetworkElements != networkElements.end()) {
906 if ((*itNetworkElements)->getGUIGlObject() == object) {
907 itNetworkElements = networkElements.erase(itNetworkElements);
908 } else {
909 itNetworkElements++;
910 }
911 }
912 // remove from additionals
913 auto itAdditionals = additionals.begin();
914 while (itAdditionals != additionals.end()) {
915 if ((*itAdditionals)->getGUIGlObject() == object) {
916 itAdditionals = additionals.erase(itAdditionals);
917 } else {
918 itAdditionals++;
919 }
920 }
921 // remove from demandElements
922 auto itDemandElements = demandElements.begin();
923 while (itDemandElements != demandElements.end()) {
924 if ((*itDemandElements)->getGUIGlObject() == object) {
925 itDemandElements = demandElements.erase(itDemandElements);
926 } else {
927 itDemandElements++;
928 }
929 }
930 // remove from genericDatas
931 auto itGenericDatas = genericDatas.begin();
932 while (itGenericDatas != genericDatas.end()) {
933 if ((*itGenericDatas)->getGUIGlObject() == object) {
934 itGenericDatas = genericDatas.erase(itGenericDatas);
935 } else {
936 itGenericDatas++;
937 }
938 }
939 // remove from junctions
940 auto itJunctions = junctions.begin();
941 while (itJunctions != junctions.end()) {
942 if ((*itJunctions)->getGUIGlObject() == object) {
943 itJunctions = junctions.erase(itJunctions);
944 } else {
945 itJunctions++;
946 }
947 }
948 // remove from edges
949 auto itEdges = edges.begin();
950 while (itEdges != edges.end()) {
951 if ((*itEdges)->getGUIGlObject() == object) {
952 itEdges = edges.erase(itEdges);
953 } else {
954 itEdges++;
955 }
956 }
957 // remove from lanes
958 auto itLanes = lanes.begin();
959 while (itLanes != lanes.end()) {
960 if ((*itLanes)->getGUIGlObject() == object) {
961 itLanes = lanes.erase(itLanes);
962 } else {
963 itLanes++;
964 }
965 }
966 // remove from crossings
967 auto itCrossings = crossings.begin();
968 while (itCrossings != crossings.end()) {
969 if ((*itCrossings)->getGUIGlObject() == object) {
970 itCrossings = crossings.erase(itCrossings);
971 } else {
972 itCrossings++;
973 }
974 }
975 // remove from walkingAreas
976 auto itWalkingAreas = walkingAreas.begin();
977 while (itWalkingAreas != walkingAreas.end()) {
978 if ((*itWalkingAreas)->getGUIGlObject() == object) {
979 itWalkingAreas = walkingAreas.erase(itWalkingAreas);
980 } else {
981 itWalkingAreas++;
982 }
983 }
984 // remove from connections
985 auto itConnections = connections.begin();
986 while (itConnections != connections.end()) {
987 if ((*itConnections)->getGUIGlObject() == object) {
988 itConnections = connections.erase(itConnections);
989 } else {
990 itConnections++;
991 }
992 }
993 // remove from internalLanes
994 auto itInternalLanes = internalLanes.begin();
995 while (itInternalLanes != internalLanes.end()) {
996 if ((*itInternalLanes)->getGUIGlObject() == object) {
997 itInternalLanes = internalLanes.erase(itInternalLanes);
998 } else {
999 itInternalLanes++;
1000 }
1001 }
1002 // remove from TAZs
1003 auto itTAZs = TAZs.begin();
1004 while (itTAZs != TAZs.end()) {
1005 if ((*itTAZs)->getGUIGlObject() == object) {
1006 itTAZs = TAZs.erase(itTAZs);
1007 } else {
1008 itTAZs++;
1009 }
1010 }
1011 // remove from POIs
1012 auto itPOIs = POIs.begin();
1013 while (itPOIs != POIs.end()) {
1014 if ((*itPOIs)->getGUIGlObject() == object) {
1015 itPOIs = POIs.erase(itPOIs);
1016 } else {
1017 itPOIs++;
1018 }
1019 }
1020 // remove from polys
1021 auto itPolys = polys.begin();
1022 while (itPolys != polys.end()) {
1023 if ((*itPolys)->getGUIGlObject() == object) {
1024 itPolys = polys.erase(itPolys);
1025 } else {
1026 itPolys++;
1027 }
1028 }
1029 // remove from edgeDatas
1030 auto itEdgeDatas = edgeDatas.begin();
1031 while (itEdgeDatas != edgeDatas.end()) {
1032 if ((*itEdgeDatas)->getGUIGlObject() == object) {
1033 itEdgeDatas = edgeDatas.erase(itEdgeDatas);
1034 } else {
1035 itEdgeDatas++;
1036 }
1037 }
1038 // remove from edgeRelDatas
1039 auto itEdgeRelDatas = edgeRelDatas.begin();
1040 while (itEdgeRelDatas != edgeRelDatas.end()) {
1041 if ((*itEdgeRelDatas)->getGUIGlObject() == object) {
1042 itEdgeRelDatas = edgeRelDatas.erase(itEdgeRelDatas);
1043 } else {
1044 itEdgeRelDatas++;
1045 }
1046 }
1047 // remove from TAZRelDatas
1048 auto itTAZRelDatas = TAZRelDatas.begin();
1049 while (itTAZRelDatas != TAZRelDatas.end()) {
1050 if ((*itTAZRelDatas)->getGUIGlObject() == object) {
1051 itTAZRelDatas = TAZRelDatas.erase(itTAZRelDatas);
1052 } else {
1053 itTAZRelDatas++;
1054 }
1055 }
1056 }
1057}
1058
1059
1060void
1062 // cast specific network element
1063 switch (glObject->getType()) {
1064 case GLO_JUNCTION: {
1065 // get junction
1066 auto junction = myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(glObject->getMicrosimID());
1067 // check front element
1068 if (junction->isMarkedForDrawingFront()) {
1069 // insert at front
1070 container.junctions.insert(container.junctions.begin(), junction);
1071 container.networkElements.insert(container.networkElements.begin(), junction);
1072 container.attributeCarriers.insert(container.attributeCarriers.begin(), junction);
1073 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), junction);
1074 } else {
1075 // insert at back
1076 container.junctions.push_back(junction);
1077 container.networkElements.push_back(junction);
1078 container.attributeCarriers.push_back(junction);
1079 container.GUIGlObjects.push_back(junction);
1080 }
1081 break;
1082 }
1083 case GLO_EDGE: {
1084 // get edge
1085 auto edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(glObject->getMicrosimID());
1086 // check front element
1087 if (edge->isMarkedForDrawingFront()) {
1088 // insert at front
1089 container.edges.insert(container.edges.begin(), edge);
1090 container.networkElements.insert(container.networkElements.begin(), edge);
1091 container.attributeCarriers.insert(container.attributeCarriers.begin(), edge);
1092 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), edge);
1093 } else {
1094 // insert at back
1095 container.edges.push_back(edge);
1096 container.networkElements.push_back(edge);
1097 container.attributeCarriers.push_back(edge);
1098 container.GUIGlObjects.push_back(edge);
1099 }
1100 break;
1101 }
1102 case GLO_LANE: {
1103 // get lane
1104 auto lane = myViewNet->getNet()->getAttributeCarriers()->retrieveLane(glObject);
1105 // check front element
1106 if (lane->isMarkedForDrawingFront()) {
1107 // insert at front
1108 container.lanes.insert(container.lanes.begin(), lane);
1109 container.networkElements.insert(container.networkElements.begin(), lane);
1110 container.attributeCarriers.insert(container.attributeCarriers.begin(), lane);
1111 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), lane);
1112 } else {
1113 // insert at back
1114 container.lanes.push_back(lane);
1115 container.networkElements.push_back(lane);
1116 container.attributeCarriers.push_back(lane);
1117 container.GUIGlObjects.push_back(lane);
1118 }
1119 break;
1120 }
1121 case GLO_CROSSING: {
1122 // get crossing
1123 auto crossing = myViewNet->getNet()->getAttributeCarriers()->retrieveCrossing(glObject);
1124 // check front element
1125 if (crossing->isMarkedForDrawingFront()) {
1126 // insert at front
1127 container.crossings.insert(container.crossings.begin(), crossing);
1128 container.networkElements.insert(container.networkElements.begin(), crossing);
1129 container.attributeCarriers.insert(container.attributeCarriers.begin(), crossing);
1130 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), crossing);
1131 } else {
1132 // insert at back
1133 container.crossings.push_back(crossing);
1134 container.networkElements.push_back(crossing);
1135 container.attributeCarriers.push_back(crossing);
1136 container.GUIGlObjects.push_back(crossing);
1137 }
1138 break;
1139 }
1140 case GLO_WALKINGAREA: {
1141 // get walkingArea
1142 auto walkingArea = myViewNet->getNet()->getAttributeCarriers()->retrieveWalkingArea(glObject);
1143 // check front element
1144 if (walkingArea->isMarkedForDrawingFront()) {
1145 // insert at front
1146 container.walkingAreas.insert(container.walkingAreas.begin(), walkingArea);
1147 container.networkElements.insert(container.networkElements.begin(), walkingArea);
1148 container.attributeCarriers.insert(container.attributeCarriers.begin(), walkingArea);
1149 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), walkingArea);
1150 } else {
1151 // insert at back
1152 container.walkingAreas.push_back(walkingArea);
1153 container.networkElements.push_back(walkingArea);
1154 container.attributeCarriers.push_back(walkingArea);
1155 container.GUIGlObjects.push_back(walkingArea);
1156 }
1157 break;
1158 }
1159 case GLO_CONNECTION: {
1160 // get connection
1161 auto connection = myViewNet->getNet()->getAttributeCarriers()->retrieveConnection(glObject);
1162 // check front element
1163 if (connection->isMarkedForDrawingFront()) {
1164 // insert at front
1165 container.connections.insert(container.connections.begin(), connection);
1166 container.networkElements.insert(container.networkElements.begin(), connection);
1167 container.attributeCarriers.insert(container.attributeCarriers.begin(), connection);
1168 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), connection);
1169 } else {
1170 // insert at back
1171 container.connections.push_back(connection);
1172 container.networkElements.push_back(connection);
1173 container.attributeCarriers.push_back(connection);
1174 container.GUIGlObjects.push_back(connection);
1175 }
1176 break;
1177 }
1178 case GLO_TLLOGIC: {
1179 // get internal lane
1180 auto internalLane = myViewNet->getNet()->getAttributeCarriers()->retrieveInternalLane(glObject);
1181 // check front element
1182 if (internalLane->isMarkedForDrawingFront()) {
1183 // insert at front
1184 container.internalLanes.insert(container.internalLanes.begin(), internalLane);
1185 container.attributeCarriers.insert(container.attributeCarriers.begin(), internalLane);
1186 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), internalLane);
1187 } else {
1188 // insert at back
1189 container.internalLanes.push_back(internalLane);
1190 container.attributeCarriers.push_back(internalLane);
1191 container.GUIGlObjects.push_back(internalLane);
1192 }
1193 break;
1194 }
1195 default:
1196 break;
1197 }
1198}
1199
1200
1201void
1203 // get additional element
1204 auto additionalElement = myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject, false);
1205 if (additionalElement) {
1206 // insert depending if is the front attribute carrier
1207 if (additionalElement->isMarkedForDrawingFront()) {
1208 // insert at front
1209 container.additionals.insert(container.additionals.begin(), additionalElement);
1210 container.attributeCarriers.insert(container.attributeCarriers.begin(), additionalElement);
1211 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), additionalElement);
1212 } else {
1213 // insert at back
1214 container.additionals.push_back(additionalElement);
1215 container.attributeCarriers.push_back(additionalElement);
1216 container.GUIGlObjects.push_back(additionalElement);
1217 }
1218 }
1219}
1220
1221
1222void
1224 // cast specific shape
1225 if (glObject->getType() == GLO_POI) {
1226 // cast POI
1227 auto POI = dynamic_cast<GNEPOI*>(myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject));
1228 // check front element
1229 if (POI->isMarkedForDrawingFront()) {
1230 // insert at front
1231 container.POIs.insert(container.POIs.begin(), POI);
1232 } else {
1233 // insert at back
1234 container.POIs.push_back(POI);
1235 }
1236 } else if ((glObject->getType() == GLO_POLYGON) || (glObject->getType() == GLO_JPS_WALKABLEAREA) || (glObject->getType() == GLO_JPS_OBSTACLE)) {
1237 // cast poly
1238 auto poly = dynamic_cast<GNEPoly*>(myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject));
1239 // check front element
1240 if (poly->isMarkedForDrawingFront()) {
1241 // insert at front
1242 container.polys.insert(container.polys.begin(), poly);
1243 } else {
1244 // insert at back
1245 container.polys.push_back(poly);
1246 }
1247 }
1248}
1249
1250
1251void
1253 // cast specific TAZ
1254 if (glObject->getType() == GLO_TAZ) {
1255 // cast TAZ
1256 auto TAZ = dynamic_cast<GNETAZ*>(myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject));
1257 // check front element
1258 if (TAZ->isMarkedForDrawingFront()) {
1259 // insert at front
1260 container.TAZs.insert(container.TAZs.begin(), TAZ);
1261 } else {
1262 // insert at back
1263 container.TAZs.push_back(TAZ);
1264 }
1265 }
1266}
1267
1268
1269void
1271 // get demandElement
1272 GNEDemandElement* demandElement = myViewNet->getNet()->getAttributeCarriers()->retrieveDemandElement(glObject, false);
1273 if (demandElement) {
1274 // insert depending if is the front attribute carrier
1275 if (demandElement->isMarkedForDrawingFront()) {
1276 // insert at front
1277 container.demandElements.insert(container.demandElements.begin(), demandElement);
1278 container.attributeCarriers.insert(container.attributeCarriers.begin(), demandElement);
1279 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), demandElement);
1280 } else {
1281 // insert at back
1282 container.demandElements.push_back(demandElement);
1283 container.attributeCarriers.push_back(demandElement);
1284 container.GUIGlObjects.push_back(demandElement);
1285 }
1286 }
1287}
1288
1289
1290void
1292 // cast specific generic data
1293 switch (glObject->getType()) {
1294 case GLO_EDGEDATA: {
1295 // cast EdgeData
1296 auto edgeData = dynamic_cast<GNEEdgeData*>(myViewNet->getNet()->getAttributeCarriers()->retrieveGenericData(glObject));
1297 // check front element
1298 if (edgeData->isMarkedForDrawingFront()) {
1299 // insert at front
1300 container.edgeDatas.insert(container.edgeDatas.begin(), edgeData);
1301 container.genericDatas.insert(container.genericDatas.begin(), edgeData);
1302 container.attributeCarriers.insert(container.attributeCarriers.begin(), edgeData);
1303 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), edgeData);
1304 } else {
1305 // insert at back
1306 container.edgeDatas.push_back(edgeData);
1307 container.genericDatas.push_back(edgeData);
1308 container.attributeCarriers.push_back(edgeData);
1309 container.GUIGlObjects.push_back(edgeData);
1310 }
1311 break;
1312 }
1313 case GLO_EDGERELDATA: {
1314 // cast EdgeData
1315 auto edgeRelData = dynamic_cast<GNEEdgeRelData*>(myViewNet->getNet()->getAttributeCarriers()->retrieveGenericData(glObject));
1316 // check front element
1317 if (edgeRelData->isMarkedForDrawingFront()) {
1318 // insert at front
1319 container.edgeRelDatas.insert(container.edgeRelDatas.begin(), edgeRelData);
1320 container.genericDatas.insert(container.genericDatas.begin(), edgeRelData);
1321 container.attributeCarriers.insert(container.attributeCarriers.begin(), edgeRelData);
1322 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), edgeRelData);
1323 } else {
1324 // insert at back
1325 container.edgeRelDatas.push_back(edgeRelData);
1326 container.genericDatas.push_back(edgeRelData);
1327 container.attributeCarriers.push_back(edgeRelData);
1328 container.GUIGlObjects.push_back(edgeRelData);
1329 }
1330 break;
1331 }
1332 case GLO_TAZRELDATA: {
1333 // cast TAZRelData
1334 auto TAZRelData = dynamic_cast<GNETAZRelData*>(myViewNet->getNet()->getAttributeCarriers()->retrieveGenericData(glObject));
1335 // check front element
1336 if (TAZRelData->isMarkedForDrawingFront()) {
1337 // insert at front
1338 container.TAZRelDatas.insert(container.TAZRelDatas.begin(), TAZRelData);
1339 container.genericDatas.insert(container.genericDatas.begin(), TAZRelData);
1340 container.attributeCarriers.insert(container.attributeCarriers.begin(), TAZRelData);
1341 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), TAZRelData);
1342 } else {
1343 // insert at back
1344 container.TAZRelDatas.push_back(TAZRelData);
1345 container.genericDatas.push_back(TAZRelData);
1346 container.attributeCarriers.push_back(TAZRelData);
1347 container.GUIGlObjects.push_back(TAZRelData);
1348 }
1349 break;
1350 }
1351 default:
1352 break;
1353 }
1354}
1355
1356
1357void
1359 // iterate over filtered edge objects
1360 for (const auto& glObjectLayer : objectsContainer) {
1361 for (const auto& glObject : glObjectLayer.second) {
1362 // update all elements by categories
1363 updateNetworkElements(myViewObjects, glObject.object);
1364 updateAdditionalElements(myViewObjects, glObject.object);
1365 updateShapeElements(myViewObjects, glObject.object);
1366 updateTAZElements(myViewObjects, glObject.object);
1367 updateDemandElements(myViewObjects, glObject.object);
1368 updateGenericDataElements(myViewObjects, glObject.object);
1369 }
1370 }
1371}
1372
1373
1377
1378// ---------------------------------------------------------------------------
1379// GNEViewNetHelper::MouseButtonKeyPressed - methods
1380// ---------------------------------------------------------------------------
1381
1385
1386
1387void
1389 myEventInfo = (FXEvent*) eventData;
1390}
1391
1392
1393bool
1395 if (myEventInfo) {
1396 return (myEventInfo->state & SHIFTMASK) != 0;
1397 } else {
1398 return false;
1399 }
1400}
1401
1402
1403bool
1405 if (myEventInfo) {
1406 return (myEventInfo->state & CONTROLMASK) != 0;
1407 } else {
1408 return false;
1409 }
1410}
1411
1412
1413bool
1415 if (myEventInfo) {
1416 return (myEventInfo->state & ALTMASK) != 0;
1417 } else {
1418 return false;
1419 }
1420}
1421
1422
1423bool
1425 if (myEventInfo) {
1426 return (myEventInfo->state & LEFTBUTTONMASK) != 0;
1427 } else {
1428 return false;
1429 }
1430}
1431
1432
1433bool
1435 if (myEventInfo) {
1436 return (myEventInfo->state & RIGHTBUTTONMASK) != 0;
1437 } else {
1438 return false;
1439 }
1440}
1441
1442// ---------------------------------------------------------------------------
1443// GNEViewNetHelper::MoveSingleElementValues - methods
1444// ---------------------------------------------------------------------------
1445
1449
1450
1451bool
1453 // first obtain moving reference (common for all)
1454 myRelativeClickedPosition = myViewNet->getPositionInformation();
1455 // get edited element
1456 const GNENetworkElement* editedElement = myViewNet->myEditNetworkElementShapes.getEditedNetworkElement();
1457 // check what type of AC will be moved
1458 if (myViewNet->myViewObjectsSelector.getJunctionFront() && (myViewNet->myViewObjectsSelector.getJunctionFront() == editedElement)) {
1459 // get move operation
1460 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getJunctionFront()->getMoveOperation();
1461 // continue if move operation is valid
1462 if (moveOperation) {
1463 myMoveOperation = moveOperation;
1464 return true;
1465 } else {
1466 return false;
1467 }
1468 } else if (myViewNet->myViewObjectsSelector.getLaneFront() && (myViewNet->myViewObjectsSelector.getLaneFront() == editedElement)) {
1469 // get move operation
1470 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getLaneFront()->getMoveOperation();
1471 // continue if move operation is valid
1472 if (moveOperation) {
1473 myMoveOperation = moveOperation;
1474 return true;
1475 } else {
1476 return false;
1477 }
1478 } else if (myViewNet->myViewObjectsSelector.getCrossingFront() && (myViewNet->myViewObjectsSelector.getCrossingFront() == editedElement)) {
1479 // get move operation
1480 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getCrossingFront()->getMoveOperation();
1481 // continue if move operation is valid
1482 if (moveOperation) {
1483 myMoveOperation = moveOperation;
1484 return true;
1485 } else {
1486 return false;
1487 }
1488 } else if (myViewNet->myViewObjectsSelector.getConnectionFront() && (myViewNet->myViewObjectsSelector.getConnectionFront() == editedElement)) {
1489 // get move operation
1490 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getConnectionFront()->getMoveOperation();
1491 // continue if move operation is valid
1492 if (moveOperation) {
1493 myMoveOperation = moveOperation;
1494 return true;
1495 } else {
1496 return false;
1497 }
1498 } else if (myViewNet->myViewObjectsSelector.getWalkingAreaFront() && (myViewNet->myViewObjectsSelector.getWalkingAreaFront() == editedElement)) {
1499 // get move operation
1500 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getWalkingAreaFront()->getMoveOperation();
1501 // continue if move operation is valid
1502 if (moveOperation) {
1503 myMoveOperation = moveOperation;
1504 return true;
1505 } else {
1506 return false;
1507 }
1508 } else {
1509 // there isn't moved items, then return false
1510 return false;
1511 }
1512}
1513
1514
1515bool
1517 // first obtain moving reference (common for all)
1518 myRelativeClickedPosition = myViewNet->getPositionInformation();
1519 // get front AC
1520 const GNEAttributeCarrier* markAC = myViewNet->myViewObjectsSelector.getAttributeCarrierFront();
1521 // check what type of AC will be moved
1522 if (myViewNet->myViewObjectsSelector.getPolyFront() && (markAC == myViewNet->myViewObjectsSelector.getPolyFront())) {
1523 // get move operation
1524 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getPolyFront()->getMoveOperation();
1525 // continue if move operation is valid
1526 if (moveOperation) {
1527 myMoveOperation = moveOperation;
1528 return true;
1529 } else {
1530 return false;
1531 }
1532 } else if (myViewNet->myViewObjectsSelector.getPOIFront() && (markAC == myViewNet->myViewObjectsSelector.getPOIFront())) {
1533 // get move operation
1534 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getPOIFront()->getMoveOperation();
1535 // continue if move operation is valid
1536 if (moveOperation) {
1537 myMoveOperation = moveOperation;
1538 return true;
1539 } else {
1540 return false;
1541 }
1542 } else if (myViewNet->myViewObjectsSelector.getAdditionalFront() && (markAC == myViewNet->myViewObjectsSelector.getAdditionalFront())) {
1543 // get move operation
1544 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getAdditionalFront()->getMoveOperation();
1545 // continue if move operation is valid
1546 if (moveOperation) {
1547 myMoveOperation = moveOperation;
1548 return true;
1549 } else {
1550 return false;
1551 }
1552 } else if (myViewNet->myViewObjectsSelector.getJunctionFront() && (markAC == myViewNet->myViewObjectsSelector.getJunctionFront())) {
1553 // check if over junction there is a geometry point
1554 if (myViewNet->myViewObjectsSelector.getEdgeFront() && (myViewNet->myViewObjectsSelector.getEdgeFront()->clickedOverGeometryPoint(myRelativeClickedPosition))) {
1555 // get move operation
1556 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getEdgeFront()->getMoveOperation();
1557 // continue if move operation is valid
1558 if (moveOperation) {
1559 myMoveOperation = moveOperation;
1560 return true;
1561 } else {
1562 return false;
1563 }
1564 } else {
1565 // get move operation
1566 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getJunctionFront()->getMoveOperation();
1567 // continue if move operation is valid
1568 if (moveOperation) {
1569 myMoveOperation = moveOperation;
1570 return true;
1571 } else {
1572 return false;
1573 }
1574 }
1575 } else if (myViewNet->myViewObjectsSelector.getEdgeFront() && (markAC == myViewNet->myViewObjectsSelector.getEdgeFront())) {
1576 // calculate Edge movement values (can be entire shape, single geometry points, altitude, etc.)
1577 if (myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1578 // edit end point
1579 myViewNet->myViewObjectsSelector.getEdgeFront()->editEndpoint(myViewNet->getPositionInformation(), myViewNet->myUndoList);
1580 // edge values wasn't calculated, then return false
1581 return false;
1582 } else {
1583 // get move operation
1584 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getEdgeFront()->getMoveOperation();
1585 // continue if move operation is valid
1586 if (moveOperation) {
1587 myMoveOperation = moveOperation;
1588 return true;
1589 } else {
1590 return false;
1591 }
1592 }
1593 } else if (myViewNet->myViewObjectsSelector.getLaneFront() && (markAC == myViewNet->myViewObjectsSelector.getLaneFront())) {
1594 // get move operation
1595 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getLaneFront()->getMoveOperation();
1596 // continue if move operation is valid
1597 if (moveOperation) {
1598 myMoveOperation = moveOperation;
1599 return true;
1600 } else {
1601 return false;
1602 }
1603 } else {
1604 // there isn't moved items, then return false
1605 return false;
1606 }
1607}
1608
1609
1610bool
1612 // first obtain moving reference (common for all)
1613 myRelativeClickedPosition = myViewNet->getPositionInformation();
1614 // get front AC
1615 const GNEAttributeCarrier* markAC = myViewNet->myViewObjectsSelector.getAttributeCarrierFront();
1616 // check demand element
1617 if (myViewNet->myViewObjectsSelector.getDemandElementFront() && (markAC == myViewNet->myViewObjectsSelector.getDemandElementFront())) {
1618 // get move operation
1619 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getDemandElementFront()->getMoveOperation();
1620 // continue if move operation is valid
1621 if (moveOperation) {
1622 myMoveOperation = moveOperation;
1623 return true;
1624 } else {
1625 return false;
1626 }
1627
1628 } else {
1629 // there isn't moved items, then return false
1630 return false;
1631 }
1632}
1633
1634
1635void
1637 if (myMoveOperation) {
1638 // calculate moveOffset
1639 const GNEMoveOffset moveOffset = calculateMoveOffset();
1640 // check if mouse button is pressed
1641 if (mouseLeftButtonPressed) {
1642 // move elements
1643 GNEMoveElement::moveElement(myViewNet, myMoveOperation, moveOffset);
1644 } else {
1645 // commit move
1646 GNEMoveElement::commitMove(myViewNet, myMoveOperation, moveOffset, myViewNet->getUndoList());
1647 // don't forget delete move operation
1648 delete myMoveOperation;
1649 myMoveOperation = nullptr;
1650 }
1651 }
1652}
1653
1654
1655void
1657 if (myMoveOperation) {
1658 // calculate moveOffset
1659 const GNEMoveOffset moveOffset = calculateMoveOffset();
1660 GNEMoveElement::commitMove(myViewNet, myMoveOperation, moveOffset, myViewNet->getUndoList());
1661 // don't forget delete move operation
1662 delete myMoveOperation;
1663 myMoveOperation = nullptr;
1664 }
1665}
1666
1667
1668bool
1670 return myMoveOperation != nullptr;
1671}
1672
1673
1676 if (myMoveOperation) {
1677 return myMoveOperation->moveElement;
1678 } else {
1679 return nullptr;
1680 }
1681}
1682
1683
1684const GNEMoveOffset
1686 // calculate moveOffset depending of current mouse position and relative clicked position
1687 // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1688 Position moveOffset = (myViewNet->getPositionInformation() - myViewNet->myMoveSingleElement.myRelativeClickedPosition);
1689 // calculate Z depending of moveElevation
1690 if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1691 // use Y as Z value and return Z move offset
1692 return GNEMoveOffset(moveOffset.y());
1693 } else {
1694 // return X-Y move offset
1695 return GNEMoveOffset(moveOffset.x(), moveOffset.y());
1696 }
1697}
1698
1699// ---------------------------------------------------------------------------
1700// GNEViewNetHelper::MoveMultipleElementValues - methods
1701// ---------------------------------------------------------------------------
1702
1704 myViewNet(viewNet),
1705 myMovingSelectedEdge(false),
1706 myEdgeOffset(0) {
1707}
1708
1709
1710void
1712 // save clicked position (to calculate offset)
1713 myClickedPosition = myViewNet->getPositionInformation();
1714 // continue depending of clicked element
1715 if (myViewNet->myViewObjectsSelector.getJunctionFront()) {
1716 calculateJunctionSelection();
1717 } else if (myViewNet->myViewObjectsSelector.getEdgeFront()) {
1718 calculateEdgeSelection(myViewNet->myViewObjectsSelector.getEdgeFront());
1719 }
1720 myViewNet->updateViewNet();
1721}
1722
1723
1724void
1726 // calculate moveOffset
1727 const GNEMoveOffset moveOffset = calculateMoveOffset();
1728 // check if mouse button is pressed
1729 if (mouseLeftButtonPressed) {
1730 // iterate over all operations
1731 for (const auto& moveOperation : myMoveOperations) {
1732 // move elements
1733 GNEMoveElement::moveElement(myViewNet, moveOperation, moveOffset);
1734 }
1735 } else if (myMoveOperations.size() > 0) {
1736 // begin undo list
1737 myViewNet->getUndoList()->begin(GUIIcon::MODEMOVE, TL("moving selection"));
1738 // iterate over all operations
1739 for (const auto& moveOperation : myMoveOperations) {
1740 // commit move
1741 GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1742 // don't forget delete move operation
1743 delete moveOperation;
1744 }
1745 // end undo list
1746 myViewNet->getUndoList()->end();
1747 // clear move operations
1748 myMoveOperations.clear();
1749 }
1750}
1751
1752
1753void
1755 // calculate moveOffset
1756 const GNEMoveOffset moveOffset = calculateMoveOffset();
1757 // begin undo list
1758 myViewNet->getUndoList()->begin(GUIIcon::MODEMOVE, TL("moving selection"));
1759 // finish all move operations
1760 for (const auto& moveOperation : myMoveOperations) {
1761 GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1762 // don't forget delete move operation
1763 delete moveOperation;
1764 }
1765 // end undo list
1766 myViewNet->getUndoList()->end();
1767 // clear move operations
1768 myMoveOperations.clear();
1769}
1770
1771
1772bool
1774 return (myMoveOperations.size() > 0);
1775}
1776
1777
1778bool
1780 return myMovingSelectedEdge;
1781}
1782
1783
1784void
1788
1789
1790double
1792 return myEdgeOffset;
1793}
1794
1795
1796bool
1798 return myMoveOperations.size() > 0;
1799}
1800
1801
1802const GNEMoveOffset
1804 // calculate moveOffset depending of current mouse position and relative clicked position
1805 // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1806 Position moveOffset = (myViewNet->getPositionInformation() - myClickedPosition);
1807 // calculate Z depending of moveElevation
1808 if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1809 // use Y for Z and return X move offset
1810 return GNEMoveOffset(moveOffset.y());
1811 } else {
1812 // return X-Y move offset
1813 return GNEMoveOffset(moveOffset.x(), moveOffset.y());
1814 }
1815}
1816
1817
1818void
1820 // declare move operation
1821 GNEMoveOperation* moveOperation = nullptr;
1822 // first move all selected junctions
1823 const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
1824 // iterate over selected junctions
1825 for (const auto& junction : selectedJunctions) {
1826 moveOperation = junction->getMoveOperation();
1827 if (moveOperation) {
1828 myMoveOperations.push_back(moveOperation);
1829 }
1830 }
1831 // now move all selected edges
1832 const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
1833 // iterate over selected edges
1834 for (const auto& edge : selectedEdges) {
1835 moveOperation = edge->getMoveOperation();
1836 if (moveOperation) {
1837 myMoveOperations.push_back(moveOperation);
1838 }
1839 }
1840}
1841
1842
1843void
1845 // first move all selected junctions
1846 const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
1847 // iterate over selected junctions
1848 for (const auto& junction : selectedJunctions) {
1849 GNEMoveOperation* moveOperation = junction->getMoveOperation();
1850 if (moveOperation) {
1851 myMoveOperations.push_back(moveOperation);
1852 }
1853 }
1854 // enable moving selected edge flag
1855 myMovingSelectedEdge = true;
1856 // get edge shape
1857 const auto& shape = clickedEdge->getNBEdge()->getGeometry();
1858 // calculate offset based on the clicked edge shape and convex angle
1859 if (clickedEdge->isConvexAngle()) {
1860 myEdgeOffset = shape.nearest_offset_to_point2D(myViewNet->getPositionInformation());
1861 } else {
1862 myEdgeOffset = shape.length2D() - shape.nearest_offset_to_point2D(myViewNet->getPositionInformation());
1863 }
1864 // now move all selected edges
1865 const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
1866 // iterate over edges between 0 and 180 degrees
1867 for (const auto& edge : selectedEdges) {
1868 GNEMoveOperation* moveOperation = edge->getMoveOperation();
1869 // continue if move operation is valid
1870 if (moveOperation) {
1871 myMoveOperations.push_back(moveOperation);
1872 }
1873 }
1874}
1875
1876// ---------------------------------------------------------------------------
1877// GNEViewNetHelper::VehicleOptions - methods
1878// ---------------------------------------------------------------------------
1879
1881 myViewNet(viewNet) {
1882}
1883
1884
1885void
1890
1891
1892void
1896
1897// ---------------------------------------------------------------------------
1898// GNEViewNetHelper::VehicleTypeOptions - methods
1899// ---------------------------------------------------------------------------
1900
1904
1905
1906void
1911
1912
1913void
1917
1918// ---------------------------------------------------------------------------
1919// GNEViewNetHelper::SelectingArea - methods
1920// ---------------------------------------------------------------------------
1921
1923 selectingUsingRectangle(false),
1924 startDrawing(false),
1925 myViewNet(viewNet) {
1926}
1927
1928
1929void
1931 selectingUsingRectangle = true;
1932 selectionCorner1 = myViewNet->getPositionInformation();
1933 selectionCorner2 = selectionCorner1;
1934}
1935
1936
1937void
1939 // start drawing
1940 startDrawing = true;
1941 // only update selection corner 2
1942 selectionCorner2 = myViewNet->getPositionInformation();
1943 // update status bar
1944 myViewNet->setStatusBarText(TL("Selection width:") + toString(fabs(selectionCorner1.x() - selectionCorner2.x()))
1945 + TL(" height:") + toString(fabs(selectionCorner1.y() - selectionCorner2.y()))
1946 + TL(" diagonal:") + toString(selectionCorner1.distanceTo2D(selectionCorner2)));
1947}
1948
1949
1950void
1952 // finish rectangle selection
1953 selectingUsingRectangle = false;
1954 startDrawing = false;
1955 // clear status bar
1956 myViewNet->setStatusBarText("");
1957}
1958
1959
1960void
1962 // shift held down on mouse-down and mouse-up and check that rectangle exist
1963 if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1964 (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1965 myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1966 // create boundary between two corners
1967 Boundary rectangleBoundary;
1968 rectangleBoundary.add(selectionCorner1);
1969 rectangleBoundary.add(selectionCorner2);
1970 // process selection within boundary
1971 processBoundarySelection(rectangleBoundary);
1972 }
1973}
1974
1975
1976std::vector<GNEEdge*>
1978 // shift held down on mouse-down and mouse-up and check that rectangle exist
1979 if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1980 (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1981 myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1982 // create boundary between two corners
1983 Boundary rectangleBoundary;
1984 rectangleBoundary.add(selectionCorner1);
1985 rectangleBoundary.add(selectionCorner2);
1986 // obtain all elements in boundary
1987 myViewNet->updateObjectsInBoundary(rectangleBoundary);
1988 // return all edges
1989 return myViewNet->getViewObjectsSelector().getEdges();
1990 } else {
1991 return {};
1992 }
1993}
1994
1995
1996void
1998 if (selectingUsingRectangle) {
2000 glTranslated(0, 0, GLO_RECTANGLESELECTION);
2001 GLHelper::setColor(color);
2002 glLineWidth(2);
2003 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
2004 glBegin(GL_QUADS);
2005 glVertex2d(selectionCorner1.x(), selectionCorner1.y());
2006 glVertex2d(selectionCorner1.x(), selectionCorner2.y());
2007 glVertex2d(selectionCorner2.x(), selectionCorner2.y());
2008 glVertex2d(selectionCorner2.x(), selectionCorner1.y());
2009 glEnd();
2011 }
2012}
2013
2014
2015void
2017 const bool selEdges = myViewNet->myNetworkViewOptions.selectEdges();
2018 // obtain all elements in boundary
2019 myViewNet->updateObjectsInBoundary(boundary);
2020 // filter ACsInBoundary depending of current supermode
2021 std::vector<GNEAttributeCarrier*> ACsFiltered;
2022 ACsFiltered.reserve(myViewNet->getViewObjectsSelector().getAttributeCarriers().size());
2023 for (const auto& AC : myViewNet->getViewObjectsSelector().getAttributeCarriers()) {
2024 // isGLObjectLockedcheck also if we're in their correspoindient supermode
2025 if (!AC->getGUIGlObject()->isGLObjectLocked()) {
2026 const auto& tagProperty = AC->getTagProperty();
2027 if (tagProperty.isNetworkElement() || tagProperty.isAdditionalElement()) {
2028 // filter edges and lanes
2029 if (((tagProperty.getTag() == SUMO_TAG_EDGE) && !selEdges) ||
2030 ((tagProperty.getTag() == SUMO_TAG_LANE) && selEdges)) {
2031 continue;
2032 } else {
2033 ACsFiltered.push_back(AC);
2034 }
2035 } else if (tagProperty.isDemandElement()) {
2036 ACsFiltered.push_back(AC);
2037 } else if (tagProperty.isGenericData()) {
2038 ACsFiltered.push_back(AC);
2039 }
2040 }
2041 }
2042 // declare two sets of attribute carriers, one for select and another for unselect
2043 std::vector<GNEAttributeCarrier*> ACToSelect;
2044 std::vector<GNEAttributeCarrier*> ACToUnselect;
2045 // reserve memory (we assume that in the worst case we're going to insert all elements of ACsInBoundaryFiltered
2046 ACToSelect.reserve(ACsFiltered.size());
2047 ACToUnselect.reserve(ACsFiltered.size());
2048 // in restrict AND replace mode all current selected attribute carriers will be unselected
2049 const auto modificationMode = myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode();
2051 // obtain selected ACs depending of current supermode
2052 const auto selectedAC = myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(false);
2053 // add id into ACs to unselect
2054 for (const auto& AC : selectedAC) {
2055 ACToUnselect.push_back(AC);
2056 }
2057 }
2058 // iterate over AttributeCarriers obtained of boundary an place it in ACToSelect or ACToUnselect
2059 for (const auto& AC : ACsFiltered) {
2060 switch (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode()) {
2062 ACToUnselect.push_back(AC);
2063 break;
2065 if (std::find(ACToUnselect.begin(), ACToUnselect.end(), AC) != ACToUnselect.end()) {
2066 ACToSelect.push_back(AC);
2067 }
2068 break;
2069 default:
2070 ACToSelect.push_back(AC);
2071 break;
2072 }
2073 }
2074 // select junctions and their connections and crossings if Auto select junctions is enabled (note: only for "add mode")
2075 if (myViewNet->autoSelectNodes() && (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::ADD)) {
2076 std::vector<GNEEdge*> edgesToSelect;
2077 // iterate over ACToSelect and extract edges
2078 for (const auto& AC : ACToSelect) {
2079 if (AC->getTagProperty().getTag() == SUMO_TAG_EDGE) {
2080 edgesToSelect.push_back(dynamic_cast<GNEEdge*>(AC));
2081 }
2082 }
2083 // iterate over extracted edges
2084 for (const auto& edge : edgesToSelect) {
2085 // select junction source and all their connections and crossings
2086 ACToSelect.push_back(edge->getFromJunction());
2087 for (const auto& connection : edge->getFromJunction()->getGNEConnections()) {
2088 ACToSelect.push_back(connection);
2089 }
2090 for (const auto& crossing : edge->getFromJunction()->getGNECrossings()) {
2091 ACToSelect.push_back(crossing);
2092 }
2093 // select junction destination and all their connections crossings
2094 ACToSelect.push_back(edge->getToJunction());
2095 for (const auto& connection : edge->getToJunction()->getGNEConnections()) {
2096 ACToSelect.push_back(connection);
2097 }
2098 for (const auto& crossing : edge->getToJunction()->getGNECrossings()) {
2099 ACToSelect.push_back(crossing);
2100 }
2101 }
2102 }
2103 // only continue if there is ACs to select or unselect
2104 if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
2105 // first unselect AC of ACToUnselect and then selects AC of ACToSelect
2106 myViewNet->myUndoList->begin(GUIIcon::MODESELECT, TL("selection using rectangle"));
2107 for (const auto& AC : ACToUnselect) {
2108 AC->setAttribute(GNE_ATTR_SELECTED, "0", myViewNet->myUndoList);
2109 }
2110 for (const auto& AC : ACToSelect) {
2111 if (AC->getTagProperty().isSelectable()) {
2112 AC->setAttribute(GNE_ATTR_SELECTED, "1", myViewNet->myUndoList);
2113 }
2114 }
2115 myViewNet->myUndoList->end();
2116 }
2117 myViewNet->makeNonCurrent();
2118}
2119
2120// ---------------------------------------------------------------------------
2121// GNEViewNetHelper::TestingMode - methods
2122// ---------------------------------------------------------------------------
2123
2125 myViewNet(viewNet) {
2126}
2127
2128
2129void
2131 // first check if testing mode is enabled and window size is correct
2132 if (OptionsCont::getOptions().getBool("gui-testing") && OptionsCont::getOptions().isSet("window-size")) {
2133 std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
2134 // make sure that given windows size has exactly two valid int values
2135 if ((windowSize.size() == 2) && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
2136 myTestingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
2137 myTestingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
2138 } else {
2139 WRITE_ERRORF(TL("Invalid windows size-format: %for option 'window-size'"), toString(windowSize));
2140 }
2141 }
2142}
2143
2144
2145void
2147 // first check if testing mode is enabled
2148 if (OptionsCont::getOptions().getBool("gui-testing")) {
2149 // check if main windows has to be resized
2150 if (myTestingWidth > 0) {
2151 mainWindow->resize(myTestingWidth, myTestingHeight);
2152 }
2153 //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
2154 // draw pink square in the upper left corner on top of everything
2155 const double size = myViewNet->p2m(32);
2156 Position center = myViewNet->screenPos2NetPos(8, 8);
2157 // magenta
2160 glTranslated(center.x(), center.y(), GLO_TESTELEMENT);
2161 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
2162 glBegin(GL_QUADS);
2163 glVertex2d(0, 0);
2164 glVertex2d(0, -size);
2165 glVertex2d(size, -size);
2166 glVertex2d(size, 0);
2167 glEnd();
2169 // blue
2172 glTranslated(center.x(), center.y(), GLO_TESTELEMENT + 1);
2173 glScaled(0.7, 0.7, 0);
2174 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
2175 glBegin(GL_QUADS);
2176 glVertex2d(0, 0);
2177 glVertex2d(0, -size);
2178 glVertex2d(size, -size);
2179 glVertex2d(size, 0);
2180 glEnd();
2182 // yellow
2185 glTranslated(center.x(), center.y(), GLO_TESTELEMENT + 2);
2186 glScaled(0.4, 0.4, 0);
2187 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
2188 glBegin(GL_QUADS);
2189 glVertex2d(0, 0);
2190 glVertex2d(0, -size);
2191 glVertex2d(size, -size);
2192 glVertex2d(size, 0);
2193 glEnd();
2195 }
2196}
2197
2198// ---------------------------------------------------------------------------
2199// GNEViewNetHelper::SaveElements - methods
2200// ---------------------------------------------------------------------------
2201
2203 myViewNet(viewNet) {
2204}
2205
2206
2208 delete mySaveIndividualFilesPopup;
2209}
2210
2211
2212void
2214 // get save element grip
2215 auto gripSaveElements = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements;
2216 // get tooltip menu
2217 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2218 // create save sumo config button
2219 mySaveNeteditConfig = new MFXButtonTooltip(gripSaveElements, tooltipMenu,
2220 std::string("\t") + TL("Save Netedit Config") + std::string("\t") + TL("Save Netedit Config. (Ctrl+Shift+E)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_NETEDITCONFIG),
2221 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_E_SAVENETEDITCONFIG, GUIDesignButtonToolbar);
2222 mySaveNeteditConfig->create();
2223 // create save sumo config button
2224 mySaveSumoConfig = new MFXButtonTooltip(gripSaveElements, tooltipMenu,
2225 std::string("\t") + TL("Save Sumo Config") + std::string("\t") + TL("Save Sumo Config. (Ctrl+Shift+S)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_SUMOCONFIG),
2226 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_S_SAVESUMOCONFIG, GUIDesignButtonToolbar);
2227 mySaveSumoConfig->create();
2228 // create save network button
2229 mySaveNetwork = new MFXButtonTooltip(gripSaveElements, tooltipMenu,
2230 std::string("\t") + TL("Save network") + std::string("\t") + TL("Save network. (Ctrl+S)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_NETWORKELEMENTS),
2231 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK, GUIDesignButtonToolbar);
2232 mySaveNetwork->create();
2233 // create popup for save individual files
2234 mySaveIndividualFilesPopup = new FXPopup(gripSaveElements, POPUP_VERTICAL);
2235 mySaveIndividualFilesPopup->create();
2236 // create save individual files button
2237 mySaveIndividualFiles = new MFXMenuButtonTooltip(gripSaveElements, tooltipMenu,
2238 std::string("\t") + TL("Save individual files") + std::string("\t") + TL("Save individual files."),
2239 GUIIconSubSys::getIcon(GUIIcon::SAVE_MULTIPLE), mySaveIndividualFilesPopup, nullptr, GUIDesignButtonToolbarLocator);
2240 mySaveIndividualFiles->create();
2241 // create save additional elements button
2242 mySaveAdditionalElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
2243 std::string("\t") + TL("Save additional elements") + std::string("\t") + TL("Save additional elements. (Ctrl+Shift+A)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_ADDITIONALELEMENTS),
2244 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_A_SAVEADDITIONALS, GUIDesignButtonPopup);
2245 mySaveAdditionalElements->create();
2246 // create save demand elements button
2247 mySaveDemandElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
2248 std::string("\t") + TL("Save demand elements") + std::string("\t") + TL("Save demand elements. (Ctrl+Shift+D)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_DEMANDELEMENTS),
2249 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS, GUIDesignButtonPopup);
2250 mySaveDemandElements->create();
2251 // create save data elements button
2252 mySaveDataElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
2253 std::string("\t") + TL("Save data elements") + std::string("\t") + TL("Save data elements. (Ctrl+Shift+B)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_DATAELEMENTS),
2254 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS, GUIDesignButtonPopup);
2255 mySaveDataElements->create();
2256 // create save mean datas elements button
2257 mySaveMeanDataElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
2258 std::string("\t") + TL("Save mean data elements") + std::string("\t") + TL("Save mean data elements. (Ctrl+Shift+M)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_MEANDATAELEMENTS),
2259 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_M_SAVEMEANDATAS, GUIDesignButtonPopup);
2260 mySaveMeanDataElements->create();
2261 // recalc menu bar because there is new elements
2262 gripSaveElements->recalc();
2263 // show menu bar modes
2264 gripSaveElements->show();
2265}
2266
2267
2268void
2270 if (value) {
2271 mySaveIndividualFiles->enable();
2272 } else {
2273 mySaveIndividualFiles->disable();
2274 }
2275}
2276
2277// ---------------------------------------------------------------------------
2278// GNEViewNetHelper::TimeFormat - methods
2279// ---------------------------------------------------------------------------
2280
2282 myViewNet(viewNet) {
2283}
2284
2285
2286void
2288 // create save sumo config button
2289 mySwitchButton = new MFXButtonTooltip(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().timeSwitch,
2290 myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu(),
2291 gHumanReadableTime ? "H" : "S" + std::string("\t") + TL("Switch between seconds and HH:MM:SS") + std::string("\t") + TL("Switch between seconds and HH:MM:SS"), nullptr,
2292 myViewNet->getViewParent()->getGNEAppWindows(), MID_GNE_TOGGLE_TIMEFORMAT, GUIDesignButtonToolbar);
2293 mySwitchButton->create();
2294}
2295
2296
2297void
2307
2308
2309void
2311 if (gHumanReadableTime) {
2312 mySwitchButton->setText("H");
2313 } else {
2314 mySwitchButton->setText("S");
2315 }
2316}
2317
2318// ---------------------------------------------------------------------------
2319// GNEViewNetHelper::EditModes - methods
2320// ---------------------------------------------------------------------------
2321
2323 currentSupermode(Supermode::NETWORK),
2324 networkEditMode(NetworkEditMode::NETWORK_INSPECT),
2325 demandEditMode(DemandEditMode::DEMAND_INSPECT),
2326 dataEditMode(DataEditMode::DATA_INSPECT),
2327 myViewNet(viewNet) {
2328 auto& neteditOptions = OptionsCont::getOptions();
2329 // if new option is enabled, start in create edge mode
2330 if (neteditOptions.getBool("new")) {
2332 neteditOptions.resetWritable();
2333 neteditOptions.set("new", "false");
2334 }
2335}
2336
2337
2339 delete myNeteditViewsPopup;
2340}
2341
2342
2343void
2345 // grip supermodes
2346 auto gripSupermodes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes;
2347 // static toolTip menu
2348 auto toolTipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2349 // create network button
2350 networkButton = new MFXCheckableButton(false, gripSupermodes, toolTipMenu,
2351 TL("Network") + std::string("\t") + TL("Edit network elements") + std::string("\t") + TL("Set mode for editing network elements. (F2)"),
2353 networkButton->create();
2354 // create demand button
2355 demandButton = new MFXCheckableButton(false, gripSupermodes, toolTipMenu,
2356 TL("Demand") + std::string("\t") + TL("Edit traffic demand elements") + std::string("\t") + TL("Set mode for editing traffic demand. (F3)"),
2358 demandButton->create();
2359 // create data button
2360 dataButton = new MFXCheckableButton(false, gripSupermodes, toolTipMenu,
2361 TL("Data") + std::string("\t") + TL("Edit data elements") + std::string("\t") + TL("Set mode for editing data demand. (F4)"),
2363 dataButton->create();
2364 // build the views popup
2365 myNeteditViewsPopup = new FXPopup(gripSupermodes, POPUP_VERTICAL);
2366 myNeteditViewsPopup->create();
2367 // build views button
2368 myNeteditViewsButton = new MFXMenuButtonTooltip(gripSupermodes, toolTipMenu,
2369 (std::string("\t") + TL("Change netedit view") + std::string("\t") + TL("Change netedit view.")).c_str(),
2371 myNeteditViewsButton->create();
2372 // build default view button
2373 myDefaultViewButton = new MFXButtonTooltip(myNeteditViewsPopup, toolTipMenu,
2374 (std::string("Default\t") + TL("Set default view") + std::string("\t") + TL("Set default view.")).c_str(),
2376 myDefaultViewButton->create();
2377 // build jupedsim view button
2378 myJuPedSimViewButton = new MFXButtonTooltip(myNeteditViewsPopup, toolTipMenu,
2379 (std::string("JuPedSim\t") + TL("Set JuPedSim view") + std::string("\t") + TL("Set JuPedSim view.")).c_str(),
2381 myJuPedSimViewButton->create();
2382 myNeteditViewsPopup->recalc();
2383 // set width (grip + 3 large buttons + icon button)
2384 gripSupermodes->setWidth(353);
2385 // show menu bar modes
2386 gripSupermodes->show();
2387}
2388
2389
2390void
2392 if (!force && (supermode == currentSupermode)) {
2393 myViewNet->setStatusBarText(TL("Mode already selected"));
2394 if (myViewNet->myCurrentFrame != nullptr) {
2395 myViewNet->myCurrentFrame->focusUpperElement();
2396 }
2397 } else {
2398 myViewNet->setStatusBarText("");
2399 // abort current operation
2400 myViewNet->abortOperation(false);
2401 // set super mode
2402 currentSupermode = supermode;
2403 // set supermodes
2404 if (supermode == Supermode::NETWORK) {
2405 // change buttons
2406 networkButton->setChecked(true);
2407 demandButton->setChecked(false);
2408 dataButton->setChecked(false);
2409 // show network buttons
2410 myViewNet->myNetworkCheckableButtons.showNetworkCheckableButtons();
2411 // hide demand buttons
2412 myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
2413 // hide data buttons
2414 myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
2415 // force update network mode
2416 setNetworkEditMode(networkEditMode, true);
2417 } else if (supermode == Supermode::DEMAND) {
2418 // change buttons
2419 networkButton->setChecked(false);
2420 demandButton->setChecked(true);
2421 dataButton->setChecked(false);
2422 // hide network buttons
2423 myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
2424 // show demand buttons
2425 myViewNet->myDemandCheckableButtons.showDemandCheckableButtons();
2426 // hide data buttons
2427 myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
2428 // force update demand mode
2429 setDemandEditMode(demandEditMode, true);
2430 // demand modes require ALWAYS a recomputing
2431 myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
2432 // check if update path calculator
2433 if (!myViewNet->myNet->getDemandPathManager()->getPathCalculator()->isPathCalculatorUpdated()) {
2434 // update path calculator of demand path manager
2435 myViewNet->myNet->getDemandPathManager()->getPathCalculator()->updatePathCalculator();
2436 // compute all demand elements
2437 myViewNet->myNet->computeDemandElements(myViewNet->myViewParent->getGNEAppWindows());
2438 }
2439 } else if (supermode == Supermode::DATA) {
2440 // change buttons
2441 networkButton->setChecked(false);
2442 demandButton->setChecked(false);
2443 dataButton->setChecked(true);
2444 // hide network buttons
2445 myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
2446 // hide demand buttons
2447 myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
2448 // show data buttons
2449 myViewNet->myDataCheckableButtons.showDataCheckableButtons();
2450 // force update data mode
2451 setDataEditMode(dataEditMode, true);
2452 // check if recompute
2453 if (myViewNet->getViewParent()->getGNEAppWindows()->getProcessingMenuCommands().menuCheckRecomputeDataMode->getCheck() == TRUE) {
2454 // demand modes require ALWAYS a recomputing
2455 myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
2456 }
2457 // reset TAZ contours (due filling)
2458 for (const auto& TAZ : myViewNet->getNet()->getAttributeCarriers()->getAdditionals().at(SUMO_TAG_TAZ)) {
2459 TAZ.second->resetAdditionalContour();
2460 }
2461 }
2462 // update buttons
2463 networkButton->update();
2464 demandButton->update();
2465 dataButton->update();
2466 // update Supermode CommandButtons in GNEAppWindows
2467 myViewNet->myViewParent->getGNEAppWindows()->updateSuperModeMenuCommands(currentSupermode);
2468 }
2469}
2470
2471
2472void
2474 if ((mode == networkEditMode) && !force) {
2475 myViewNet->setStatusBarText(TL("Network mode already selected"));
2476 if (myViewNet->myCurrentFrame != nullptr) {
2477 myViewNet->myCurrentFrame->focusUpperElement();
2478 }
2479 } else if (networkEditMode == NetworkEditMode::NETWORK_TLS && !myViewNet->myViewParent->getTLSEditorFrame()->isTLSSaved()) {
2480 myViewNet->setStatusBarText(TL("Save modifications in TLS before change mode"));
2481 myViewNet->myCurrentFrame->focusUpperElement();
2482 } else {
2483 myViewNet->setStatusBarText("");
2484 myViewNet->abortOperation(false);
2485 // stop editing of custom shapes
2486 myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
2487 // set new Network mode
2488 networkEditMode = mode;
2489 // for common modes (Inspect/Delete/Select/move) change also the other supermode
2490 if (networkEditMode == NetworkEditMode::NETWORK_INSPECT) {
2491 demandEditMode = DemandEditMode::DEMAND_INSPECT;
2492 dataEditMode = DataEditMode::DATA_INSPECT;
2493 } else if (networkEditMode == NetworkEditMode::NETWORK_DELETE) {
2494 demandEditMode = DemandEditMode::DEMAND_DELETE;
2495 dataEditMode = DataEditMode::DATA_DELETE;
2496 } else if (networkEditMode == NetworkEditMode::NETWORK_SELECT) {
2497 demandEditMode = DemandEditMode::DEMAND_SELECT;
2498 dataEditMode = DataEditMode::DATA_SELECT;
2499 } else if (networkEditMode == NetworkEditMode::NETWORK_MOVE) {
2500 demandEditMode = DemandEditMode::DEMAND_MOVE;
2501 }
2502 // certain modes require a recomputing
2503 switch (mode) {
2508 // modes which depend on computed data
2509 myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
2510 break;
2511 default:
2512 break;
2513 }
2514 // update cursors
2515 myViewNet->updateCursor();
2516 // update network mode specific controls
2517 myViewNet->updateNetworkModeSpecificControls();
2518 }
2519}
2520
2521
2522void
2524 if ((mode == demandEditMode) && !force) {
2525 myViewNet->setStatusBarText(TL("Demand mode already selected"));
2526 if (myViewNet->myCurrentFrame != nullptr) {
2527 myViewNet->myCurrentFrame->focusUpperElement();
2528 }
2529 } else {
2530 myViewNet->setStatusBarText("");
2531 myViewNet->abortOperation(false);
2532 // stop editing of custom shapes
2533 myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
2534 // set new Demand mode
2535 demandEditMode = mode;
2536 // for common modes (Inspect/Delete/Select/Move) change also the other supermode
2537 if (demandEditMode == DemandEditMode::DEMAND_INSPECT) {
2538 networkEditMode = NetworkEditMode::NETWORK_INSPECT;
2539 dataEditMode = DataEditMode::DATA_INSPECT;
2540 } else if (demandEditMode == DemandEditMode::DEMAND_DELETE) {
2541 networkEditMode = NetworkEditMode::NETWORK_DELETE;
2542 dataEditMode = DataEditMode::DATA_DELETE;
2543 } else if (demandEditMode == DemandEditMode::DEMAND_SELECT) {
2544 networkEditMode = NetworkEditMode::NETWORK_SELECT;
2545 dataEditMode = DataEditMode::DATA_SELECT;
2546 } else if (demandEditMode == DemandEditMode::DEMAND_MOVE) {
2547 networkEditMode = NetworkEditMode::NETWORK_MOVE;
2548 }
2549 // update cursors
2550 myViewNet->updateCursor();
2551 // update network mode specific controls
2552 myViewNet->updateDemandModeSpecificControls();
2553 }
2554}
2555
2556
2557void
2559 if ((mode == dataEditMode) && !force) {
2560 myViewNet->setStatusBarText(TL("Data mode already selected"));
2561 if (myViewNet->myCurrentFrame != nullptr) {
2562 myViewNet->myCurrentFrame->focusUpperElement();
2563 }
2564 } else {
2565 myViewNet->setStatusBarText("");
2566 myViewNet->abortOperation(false);
2567 // stop editing of custom shapes
2568 myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
2569 // set new Data mode
2570 dataEditMode = mode;
2571 // for common modes (Inspect/Delete/Select/Move) change also the other supermode
2572 if (dataEditMode == DataEditMode::DATA_INSPECT) {
2573 networkEditMode = NetworkEditMode::NETWORK_INSPECT;
2574 demandEditMode = DemandEditMode::DEMAND_INSPECT;
2575 } else if (dataEditMode == DataEditMode::DATA_DELETE) {
2576 networkEditMode = NetworkEditMode::NETWORK_DELETE;
2577 demandEditMode = DemandEditMode::DEMAND_DELETE;
2578 } else if (dataEditMode == DataEditMode::DATA_SELECT) {
2579 networkEditMode = NetworkEditMode::NETWORK_SELECT;
2580 demandEditMode = DemandEditMode::DEMAND_SELECT;
2581 }
2582 // update all datasets
2583 for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
2584 dataSet.second->updateAttributeColors();
2585 }
2586 // update cursors
2587 myViewNet->updateCursor();
2588 // update network mode specific controls
2589 myViewNet->updateDataModeSpecificControls();
2590 }
2591}
2592
2593
2594bool
2596 return (currentSupermode == Supermode::NETWORK);
2597}
2598
2599
2600bool
2602 return (currentSupermode == Supermode::DEMAND);
2603}
2604
2605
2606bool
2608 return (currentSupermode == Supermode::DATA);
2609}
2610
2611
2612void
2614 // grip supermodes
2615 auto gripSupermodes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes;
2616 // file menu commands
2617 auto& fileMenuCommands = myViewNet->getViewParent()->getGNEAppWindows()->getFileMenuCommands();
2618 // continue depending of selector
2619 if (sel == MID_GNE_VIEW_DEFAULT) {
2620 myNeteditViewsButton->setIcon(GUIIconSubSys::getIcon(GUIIcon::VIEWDEFAULT));
2621 gripSupermodes->setWidth(353);
2622 // show menu commands
2623 fileMenuCommands.setDefaultView();
2624 } else if (sel == MID_GNE_VIEW_JUPEDSIM) {
2625 myNeteditViewsButton->setIcon(GUIIconSubSys::getIcon(GUIIcon::VIEWJUPEDSIM));
2626 gripSupermodes->setWidth(250);
2627 // hide menu commands
2628 fileMenuCommands.setJuPedSimView();
2629 }
2630 // update viewNet
2631 myViewNet->viewUpdated();
2632}
2633
2634
2635bool
2637 return myNeteditViewsButton->getIcon() == GUIIconSubSys::getIcon(GUIIcon::VIEWDEFAULT);
2638}
2639
2640
2641bool
2643 return myNeteditViewsButton->getIcon() == GUIIconSubSys::getIcon(GUIIcon::VIEWJUPEDSIM);
2644}
2645
2646// ---------------------------------------------------------------------------
2647// GNEViewNetHelper::NetworkViewOptions - methods
2648// ---------------------------------------------------------------------------
2649
2653
2654
2655void
2657 // get grip modes
2658 auto gripModes = myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes;
2659 // static toolTip menu
2660 auto toolTipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2661 // create menu checks
2662 menuCheckToggleGrid = new MFXCheckableButton(false, gripModes, toolTipMenu,
2663 (std::string("\t") + TL("Show grid") + std::string("\t") + TL("Show grid and restrict movement to the grid - define grid size in visualization options. (Ctrl+G)")),
2666 menuCheckToggleGrid->setChecked(false);
2667 menuCheckToggleGrid->create();
2668
2669 menuCheckToggleDrawJunctionShape = new MFXCheckableButton(false, gripModes, toolTipMenu,
2670 (std::string("\t") + TL("Hide junction shape") + std::string("\t") + TL("Toggle hiding junction shape. (Ctrl+J)")),
2673 menuCheckToggleDrawJunctionShape->setChecked(false);
2674 menuCheckToggleDrawJunctionShape->create();
2675
2676 menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, gripModes, toolTipMenu,
2677 (std::string("\t") + TL("Draw vehicles spread in lane or depart position") + std::string("\t") + TL("Draw vehicles spread in lane or in depart position.")),
2680 menuCheckDrawSpreadVehicles->setChecked(false);
2681 menuCheckDrawSpreadVehicles->create();
2682
2683 menuCheckShowDemandElements = new MFXCheckableButton(false, gripModes, toolTipMenu,
2684 (std::string("\t") + TL("Show demand elements") + std::string("\t") + TL("Toggle show demand elements.")),
2687 menuCheckShowDemandElements->setChecked(false);
2688 menuCheckShowDemandElements->create();
2689
2690 menuCheckSelectEdges = new MFXCheckableButton(false, gripModes, toolTipMenu,
2691 (std::string("\t") + TL("Clicks target lanes") + std::string("\t") + TL("Toggle whether clicking should inspect/select/delete lanes instead of edges.")),
2694 menuCheckSelectEdges->create();
2695
2696 menuCheckShowConnections = new MFXCheckableButton(false, gripModes, toolTipMenu,
2697 (std::string("\t") + TL("Show connections over junctions") + std::string("\t") + TL("Toggle show connections over junctions.")),
2700 menuCheckShowConnections->setChecked(myViewNet->getVisualisationSettings().showLane2Lane);
2701 menuCheckShowConnections->create();
2702
2703 menuCheckHideConnections = new MFXCheckableButton(false, gripModes, toolTipMenu,
2704 (std::string("\t") + TL("Hide connections") + std::string("\t") + TL("Toggle hide connections.")),
2707 menuCheckHideConnections->setChecked(false);
2708 menuCheckHideConnections->create();
2709
2710 menuCheckShowAdditionalSubElements = new MFXCheckableButton(false, gripModes, toolTipMenu,
2711 (std::string("\t") + TL("Show additional sub-elements") + std::string("\t") + TL("Toggle show additional sub-elements.")),
2714 menuCheckShowAdditionalSubElements->setChecked(false);
2715 menuCheckShowAdditionalSubElements->create();
2716
2717 menuCheckShowTAZElements = new MFXCheckableButton(false, gripModes, toolTipMenu,
2718 (std::string("\t") + TL("Show TAZ elements") + std::string("\t") + TL("Toggle show TAZ elements.")),
2721 menuCheckShowTAZElements->setChecked(false);
2722 menuCheckShowTAZElements->create();
2723
2724 menuCheckExtendSelection = new MFXCheckableButton(false, gripModes, toolTipMenu,
2725 (std::string("\t") + TL("Automatic select junctions") + std::string("\t") + TL("Toggle whether selecting multiple edges should automatically select their junctions.")),
2728 menuCheckExtendSelection->setChecked(true);
2729 menuCheckExtendSelection->create();
2730
2731 menuCheckChangeAllPhases = new MFXCheckableButton(false, gripModes, toolTipMenu,
2732 (std::string("\t") + TL("Apply state to all phases") + std::string("\t") + TL("Toggle whether clicking should apply state changes to all phases of the current TLS plan.")),
2735 menuCheckChangeAllPhases->setChecked(false);
2736 menuCheckChangeAllPhases->create();
2737
2738 menuCheckWarnAboutMerge = new MFXCheckableButton(false, gripModes, toolTipMenu,
2739 (std::string("\t") + TL("Automatic merging junction") + std::string("\t") + TL("Toggle ask for confirmation before merging junction.")),
2742 menuCheckWarnAboutMerge->create();
2743
2744 menuCheckShowJunctionBubble = new MFXCheckableButton(false, gripModes, toolTipMenu,
2745 (std::string("\t") + TL("Show bubbles") + std::string("\t") + TL("Toggle show bubbles over junctions shapes.")),
2748 menuCheckShowJunctionBubble->setChecked(false);
2749 menuCheckShowJunctionBubble->create();
2750
2751 menuCheckMoveElevation = new MFXCheckableButton(false, gripModes, toolTipMenu,
2752 (std::string("\t") + TL("Move elevation") + std::string("\t") + TL("Apply mouse movement to elevation instead of x,y position.")),
2755 menuCheckMoveElevation->setChecked(false);
2756 menuCheckMoveElevation->create();
2757
2758 menuCheckChainEdges = new MFXCheckableButton(false, gripModes, toolTipMenu,
2759 (std::string("\t") + TL("Edge chain mode") + std::string("\t") + TL("Create consecutive edges with a single click (hit ESC to cancel chain).")),
2762 menuCheckChainEdges->setChecked(false);
2763 menuCheckChainEdges->create();
2764
2765 menuCheckAutoOppositeEdge = new MFXCheckableButton(false, gripModes, toolTipMenu,
2766 (std::string("\t") + TL("Edge opposite direction") + std::string("\t") + TL("Automatically create an edge in the opposite direction.")),
2769 menuCheckAutoOppositeEdge->setChecked(false);
2770 menuCheckAutoOppositeEdge->create();
2771
2772 // always recalc after creating new elements
2773 gripModes->recalc();
2774}
2775
2776
2777void
2779 menuCheckToggleGrid->hide();
2780 menuCheckToggleDrawJunctionShape->hide();
2781 menuCheckDrawSpreadVehicles->hide();
2782 menuCheckShowDemandElements->hide();
2783 menuCheckSelectEdges->hide();
2784 menuCheckShowConnections->hide();
2785 menuCheckHideConnections->hide();
2786 menuCheckShowAdditionalSubElements->hide();
2787 menuCheckShowTAZElements->hide();
2788 menuCheckExtendSelection->hide();
2789 menuCheckChangeAllPhases->hide();
2790 menuCheckWarnAboutMerge->hide();
2791 menuCheckShowJunctionBubble->hide();
2792 menuCheckMoveElevation->hide();
2793 menuCheckChainEdges->hide();
2794 menuCheckAutoOppositeEdge->hide();
2795}
2796
2797
2798void
2799GNEViewNetHelper::NetworkViewOptions::getVisibleNetworkMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2800 // save visible menu commands in commands vector
2801 if (menuCheckToggleGrid->shown()) {
2802 commands.push_back(menuCheckToggleGrid);
2803 }
2804 if (menuCheckToggleDrawJunctionShape->shown()) {
2805 commands.push_back(menuCheckToggleDrawJunctionShape);
2806 }
2807 if (menuCheckDrawSpreadVehicles->shown()) {
2808 commands.push_back(menuCheckDrawSpreadVehicles);
2809 }
2810 if (menuCheckShowDemandElements->shown()) {
2811 commands.push_back(menuCheckShowDemandElements);
2812 }
2813 if (menuCheckSelectEdges->shown()) {
2814 commands.push_back(menuCheckSelectEdges);
2815 }
2816 if (menuCheckShowConnections->shown()) {
2817 commands.push_back(menuCheckShowConnections);
2818 }
2819 if (menuCheckHideConnections->shown()) {
2820 commands.push_back(menuCheckHideConnections);
2821 }
2822 if (menuCheckShowAdditionalSubElements->shown()) {
2823 commands.push_back(menuCheckShowAdditionalSubElements);
2824 }
2825 if (menuCheckShowTAZElements->shown()) {
2826 commands.push_back(menuCheckShowTAZElements);
2827 }
2828 if (menuCheckExtendSelection->shown()) {
2829 commands.push_back(menuCheckExtendSelection);
2830 }
2831 if (menuCheckChangeAllPhases->shown()) {
2832 commands.push_back(menuCheckChangeAllPhases);
2833 }
2834 if (menuCheckWarnAboutMerge->shown()) {
2835 commands.push_back(menuCheckWarnAboutMerge);
2836 }
2837 if (menuCheckShowJunctionBubble->shown()) {
2838 commands.push_back(menuCheckShowJunctionBubble);
2839 }
2840 if (menuCheckMoveElevation->shown()) {
2841 commands.push_back(menuCheckMoveElevation);
2842 }
2843 if (menuCheckChainEdges->shown()) {
2844 commands.push_back(menuCheckChainEdges);
2845 }
2846 if (menuCheckAutoOppositeEdge->shown()) {
2847 commands.push_back(menuCheckAutoOppositeEdge);
2848 }
2849}
2850
2851
2852bool
2854 return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
2855}
2856
2857
2858bool
2860 if (menuCheckShowDemandElements->shown()) {
2861 return (menuCheckShowDemandElements->amChecked() == TRUE);
2862 } else {
2863 // by default, if menuCheckShowDemandElements isn't shown, always show demand elements
2864 return true;
2865 }
2866}
2867
2868
2869bool
2871 if (menuCheckSelectEdges->shown()) {
2872 return (menuCheckSelectEdges->amChecked() != TRUE);
2873 } else {
2874 // by default, if menuCheckSelectEdges isn't shown, always select edges
2875 return true;
2876 }
2877}
2878
2879
2880bool
2882 if (myViewNet->myEditModes.isCurrentSupermodeData()) {
2883 return false;
2884 } else if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_CONNECT) {
2885 // check if menu check hide connections ins shown
2886 return (menuCheckHideConnections->amChecked() == FALSE);
2887 } else if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_PROHIBITION) {
2888 return true;
2889 } else if (myViewNet->myEditModes.isCurrentSupermodeNetwork() && menuCheckShowConnections->shown() == false) {
2890 return false;
2891 } else {
2892 return (myViewNet->getVisualisationSettings().showLane2Lane);
2893 }
2894}
2895
2896
2897bool
2899 if (!myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
2900 return false;
2901 } else if (menuCheckShowAdditionalSubElements->shown() == false) {
2902 return false;
2903 } else {
2904 return menuCheckShowAdditionalSubElements->amChecked();
2905 }
2906}
2907
2908
2909bool
2911 if (!myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
2912 return false;
2913 } else if (menuCheckShowTAZElements->shown() == false) {
2914 return false;
2915 } else {
2916 return menuCheckShowTAZElements->amChecked();
2917 }
2918}
2919
2920
2921bool
2923 if (menuCheckMoveElevation->shown()) {
2924 return (menuCheckMoveElevation->amChecked() == TRUE);
2925 } else {
2926 return false;
2927 }
2928}
2929
2930// ---------------------------------------------------------------------------
2931// GNEViewNetHelper::DemandViewOptions - methods
2932// ---------------------------------------------------------------------------
2933
2935 myViewNet(viewNet) {
2936}
2937
2938
2939void
2941 // get grip modes
2942 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
2943 // get tooltip menu
2944 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2945 // create menu checks
2946 menuCheckToggleGrid = new MFXCheckableButton(false, gripModes, tooltipMenu,
2947 (std::string("\t") + TL("Show grid") + std::string("\t") + TL("Show grid and restrict movement to the grid - define grid size in visualization options. (Ctrl+G)")),
2950 menuCheckToggleGrid->setChecked(false);
2951 menuCheckToggleGrid->create();
2952
2953 menuCheckToggleDrawJunctionShape = new MFXCheckableButton(false, gripModes, tooltipMenu,
2954 (std::string("\t") + TL("Hide junction shape") + std::string("\t") + TL("Toggle hiding junction shape. (Ctrl+J)")),
2957 menuCheckToggleDrawJunctionShape->setChecked(false);
2958 menuCheckToggleDrawJunctionShape->create();
2959
2960 menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, gripModes, tooltipMenu,
2961 (std::string("\t") + TL("Draw vehicles spread/depart position") + std::string("\t") + TL("Draw vehicles spread in lane or in depart position.")),
2964 menuCheckDrawSpreadVehicles->setChecked(false);
2965 menuCheckDrawSpreadVehicles->create();
2966
2967 menuCheckHideShapes = new MFXCheckableButton(false, gripModes, tooltipMenu,
2968 (std::string("\t") + TL("Show shapes") + std::string("\t") + TL("Toggle show shapes (Polygons and POIs).")),
2971 menuCheckHideShapes->setChecked(false);
2972 menuCheckHideShapes->create();
2973
2974 menuCheckShowAllTrips = new MFXCheckableButton(false, gripModes, tooltipMenu,
2975 (std::string("\t") + TL("Show all trips") + std::string("\t") + TL("Toggle show all trips (requires updated demand - F5).")),
2978 menuCheckShowAllTrips->setChecked(false);
2979 menuCheckShowAllTrips->create();
2980
2981 menuCheckShowAllPersonPlans = new MFXCheckableButton(false, gripModes, tooltipMenu,
2982 (std::string("\t") + TL("Show all person plans") + std::string("\t") + TL("Toggle show all person plans.")),
2985 menuCheckShowAllPersonPlans->setChecked(false);
2986 menuCheckShowAllPersonPlans->create();
2987
2988 menuCheckLockPerson = new MFXCheckableButton(false, gripModes, tooltipMenu,
2989 (std::string("\t") + TL("Lock selected person") + std::string("\t") + TL("Toggle lock selected person.")),
2992 menuCheckLockPerson->setChecked(false);
2993 menuCheckLockPerson->create();
2994
2995 menuCheckShowAllContainerPlans = new MFXCheckableButton(false, gripModes, tooltipMenu,
2996 (std::string("\t") + TL("Show all containers plans") + std::string("\t") + TL("Toggle show all container plans.")),
2999 menuCheckShowAllContainerPlans->setChecked(false);
3000 menuCheckShowAllContainerPlans->create();
3001
3002 menuCheckLockContainer = new MFXCheckableButton(false, gripModes, tooltipMenu,
3003 (std::string("\t") + TL("Lock selected container") + std::string("\t") + TL("Toggle lock selected container.")),
3006 menuCheckLockContainer->setChecked(false);
3007 menuCheckLockContainer->create();
3008
3009 menuCheckHideNonInspectedDemandElements = new MFXCheckableButton(false, gripModes, tooltipMenu,
3010 (std::string("\t") + TL("Show non-inspected demand elements") + std::string("\t") + TL("Toggle show non-inspected demand elements.")),
3013 menuCheckHideNonInspectedDemandElements->setChecked(false);
3014 menuCheckHideNonInspectedDemandElements->create();
3015
3016 menuCheckShowOverlappedRoutes = new MFXCheckableButton(false, gripModes, tooltipMenu,
3017 (std::string("\t") + TL("Show number of overlapped routes") + std::string("\t") + TL("Toggle show number of overlapped routes.")),
3020 menuCheckShowOverlappedRoutes->setChecked(false);
3021 menuCheckShowOverlappedRoutes->create();
3022
3023 // always recalc after creating new elements
3024 gripModes->recalc();
3025}
3026
3027
3028void
3030 menuCheckToggleGrid->hide();
3031 menuCheckToggleDrawJunctionShape->hide();
3032 menuCheckDrawSpreadVehicles->hide();
3033 menuCheckHideShapes->hide();
3034 menuCheckShowAllTrips->hide();
3035 menuCheckShowAllPersonPlans->hide();
3036 menuCheckLockPerson->hide();
3037 menuCheckShowAllContainerPlans->hide();
3038 menuCheckLockContainer->hide();
3039 menuCheckHideNonInspectedDemandElements->hide();
3040 menuCheckShowOverlappedRoutes->hide();
3041}
3042
3043
3044void
3045GNEViewNetHelper::DemandViewOptions::getVisibleDemandMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
3046 // save visible menu commands in commands vector
3047 if (menuCheckToggleGrid->shown()) {
3048 commands.push_back(menuCheckToggleGrid);
3049 }
3050 if (menuCheckToggleDrawJunctionShape->shown()) {
3051 commands.push_back(menuCheckToggleDrawJunctionShape);
3052 }
3053 if (menuCheckDrawSpreadVehicles->shown()) {
3054 commands.push_back(menuCheckDrawSpreadVehicles);
3055 }
3056 if (menuCheckHideShapes->shown()) {
3057 commands.push_back(menuCheckHideShapes);
3058 }
3059 if (menuCheckShowAllTrips->shown()) {
3060 commands.push_back(menuCheckShowAllTrips);
3061 }
3062 if (menuCheckShowAllPersonPlans->shown() && menuCheckShowAllPersonPlans->isEnabled()) {
3063 commands.push_back(menuCheckShowAllPersonPlans);
3064 }
3065 if (menuCheckLockPerson->shown() && menuCheckLockPerson->isEnabled()) {
3066 commands.push_back(menuCheckLockPerson);
3067 }
3068 if (menuCheckShowAllContainerPlans->shown() && menuCheckShowAllContainerPlans->isEnabled()) {
3069 commands.push_back(menuCheckShowAllContainerPlans);
3070 }
3071 if (menuCheckLockContainer->shown() && menuCheckLockContainer->isEnabled()) {
3072 commands.push_back(menuCheckLockContainer);
3073 }
3074 if (menuCheckHideNonInspectedDemandElements->shown()) {
3075 commands.push_back(menuCheckHideNonInspectedDemandElements);
3076 }
3077 if (menuCheckShowOverlappedRoutes->shown()) {
3078 commands.push_back(menuCheckShowOverlappedRoutes);
3079 }
3080}
3081
3082
3083bool
3085 return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
3086}
3087
3088
3089bool
3091 if (menuCheckHideNonInspectedDemandElements->shown()) {
3092 const auto& inspectedElements = myViewNet->getInspectedElements();
3093 // check conditions
3094 if ((menuCheckHideNonInspectedDemandElements->amChecked() == FALSE) || (inspectedElements.getFirstAC() == nullptr)) {
3095 // if checkbox is disabled or there isn't an inspected element, then return true
3096 return true;
3097 } else if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().isDemandElement()) {
3098 if (inspectedElements.isACInspected(demandElement)) {
3099 // if inspected element correspond to demandElement, return true
3100 return true;
3101 } else {
3102 // if demandElement is a route, check if dottedAC is one of their children (Vehicle or Stop)
3103 for (const auto& demandElementChild : demandElement->getChildDemandElements()) {
3104 if (inspectedElements.isACInspected(demandElementChild)) {
3105 return true;
3106 }
3107 }
3108 // if demandElement is a vehicle, check if dottedAC is one of his route Parent
3109 for (const auto& demandElementParent : demandElement->getParentDemandElements()) {
3110 if (inspectedElements.isACInspected(demandElementParent)) {
3111 return true;
3112 }
3113 }
3114 // dottedAC isn't one of their parent, then return false
3115 return false;
3116 }
3117 } else {
3118 // we're inspecting a demand element, then return true
3119 return true;
3120 }
3121 } else {
3122 // we're inspecting a demand element, then return true
3123 return true;
3124 }
3125}
3126
3127
3128bool
3130 if (menuCheckHideShapes->shown()) {
3131 return (menuCheckHideShapes->amChecked() == FALSE);
3132 } else {
3133 return true;
3134 }
3135}
3136
3137
3138bool
3140 return (menuCheckShowAllTrips->amChecked() == TRUE);
3141}
3142
3143
3144bool
3146 if (menuCheckShowAllPersonPlans->isEnabled()) {
3147 return (menuCheckShowAllPersonPlans->amChecked() == TRUE);
3148 } else {
3149 return false;
3150 }
3151}
3152
3153
3154void
3156 myLockedPerson = person;
3157}
3158
3159
3160void
3162 myLockedPerson = nullptr;
3163}
3164
3165
3166const GNEDemandElement*
3168 return myLockedPerson;
3169}
3170
3171
3172bool
3174 if (menuCheckShowAllContainerPlans->isEnabled()) {
3175 return (menuCheckShowAllContainerPlans->amChecked() == TRUE);
3176 } else {
3177 return false;
3178 }
3179}
3180
3181
3182void
3184 myLockedContainer = container;
3185}
3186
3187
3188void
3190 myLockedContainer = nullptr;
3191}
3192
3193
3194bool
3196 if (menuCheckShowOverlappedRoutes->isEnabled()) {
3197 return (menuCheckShowOverlappedRoutes->amChecked() == TRUE);
3198 } else {
3199 return false;
3200 }
3201}
3202
3203
3204const GNEDemandElement*
3206 return myLockedContainer;
3207}
3208
3209// ---------------------------------------------------------------------------
3210// GNEViewNetHelper::DataViewOptions - methods
3211// ---------------------------------------------------------------------------
3212
3214 myViewNet(viewNet) {
3215}
3216
3217
3218void
3220 // get grip modes
3221 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3222 // get tooltip menu
3223 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3224 // create menu checks
3225 menuCheckToggleDrawJunctionShape = new MFXCheckableButton(false, gripModes, tooltipMenu,
3226 (std::string("\t") + TL("Hide junction shape") + std::string("\t") + TL("Toggle hiding junction shape. (Ctrl+J)")),
3229 menuCheckToggleDrawJunctionShape->setChecked(false);
3230 menuCheckToggleDrawJunctionShape->create();
3231
3232 menuCheckShowAdditionals = new MFXCheckableButton(false, gripModes, tooltipMenu,
3233 (std::string("\t") + TL("Show additionals") + std::string("\t") + TL("Toggle show additionals.")),
3236 menuCheckShowAdditionals->create();
3237
3238 menuCheckShowShapes = new MFXCheckableButton(false, gripModes, tooltipMenu,
3239 (std::string("\t") + TL("Show shapes") + std::string("\t") + TL("Toggle show shapes (Polygons and POIs).")),
3242 menuCheckShowShapes->create();
3243
3244 menuCheckShowDemandElements = new MFXCheckableButton(false, gripModes, tooltipMenu,
3245 (std::string("\t") + TL("Show demand elements") + std::string("\t") + TL("Toggle show demand elements.")),
3248 menuCheckShowDemandElements->create();
3249
3250 menuCheckToggleTAZRelDrawing = new MFXCheckableButton(false, gripModes, tooltipMenu,
3251 (std::string("\t") + TL("Draw TAZREL drawing mode") + std::string("\t") + TL("Toggle draw TAZREL drawing mode.")),
3254 menuCheckToggleTAZRelDrawing->create();
3255
3256 menuCheckToggleTAZDrawFill = new MFXCheckableButton(false, gripModes, tooltipMenu,
3257 (std::string("\t") + TL("Toggle draw TAZ fill") + std::string("\t") + TL("Toggle draw TAZ fill")),
3260 menuCheckToggleTAZDrawFill->create();
3261
3262 menuCheckToggleTAZRelOnlyFrom = new MFXCheckableButton(false, gripModes, tooltipMenu,
3263 (std::string("\t") + TL("Toggle draw TAZRel only from") + std::string("\t") + TL("Toggle draw TAZRel only from")),
3266 menuCheckToggleTAZRelOnlyFrom->create();
3267
3268 menuCheckToggleTAZRelOnlyTo = new MFXCheckableButton(false, gripModes, tooltipMenu,
3269 (std::string("\t") + TL("Toggle draw TAZRel only to") + std::string("\t") + TL("Toggle draw TAZRel only to")),
3272 menuCheckToggleTAZRelOnlyTo->create();
3273
3274 // always recalc after creating new elements
3275 gripModes->recalc();
3276}
3277
3278
3279void
3281 menuCheckToggleDrawJunctionShape->hide();
3282 menuCheckShowAdditionals->hide();
3283 menuCheckShowShapes->hide();
3284 menuCheckShowDemandElements->hide();
3285 menuCheckToggleTAZRelDrawing->hide();
3286 menuCheckToggleTAZDrawFill->hide();
3287 menuCheckToggleTAZRelOnlyFrom->hide();
3288 menuCheckToggleTAZRelOnlyTo->hide();
3289}
3290
3291
3292void
3293GNEViewNetHelper::DataViewOptions::getVisibleDataMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
3294 // save visible menu commands in commands vector
3295 if (menuCheckToggleDrawJunctionShape->shown()) {
3296 commands.push_back(menuCheckToggleDrawJunctionShape);
3297 }
3298 if (menuCheckShowAdditionals->shown()) {
3299 commands.push_back(menuCheckShowAdditionals);
3300 }
3301 if (menuCheckShowShapes->shown()) {
3302 commands.push_back(menuCheckShowShapes);
3303 }
3304 if (menuCheckShowDemandElements->shown()) {
3305 commands.push_back(menuCheckShowDemandElements);
3306 }
3307 if (menuCheckToggleTAZRelDrawing->shown()) {
3308 commands.push_back(menuCheckToggleTAZRelDrawing);
3309 }
3310 if (menuCheckToggleTAZDrawFill->shown()) {
3311 commands.push_back(menuCheckToggleTAZDrawFill);
3312 }
3313 if (menuCheckToggleTAZRelOnlyFrom->shown()) {
3314 commands.push_back(menuCheckToggleTAZRelOnlyFrom);
3315 }
3316 if (menuCheckToggleTAZRelOnlyTo->shown()) {
3317 commands.push_back(menuCheckToggleTAZRelOnlyTo);
3318 }
3319}
3320
3321
3322bool
3324 if (menuCheckShowAdditionals->shown()) {
3325 return (menuCheckShowAdditionals->amChecked() == TRUE);
3326 } else {
3327 return true;
3328 }
3329}
3330
3331
3332bool
3334 if (menuCheckShowShapes->shown()) {
3335 return (menuCheckShowShapes->amChecked() == TRUE);
3336 } else {
3337 return true;
3338 }
3339}
3340
3341
3342bool
3344 if (menuCheckShowDemandElements->shown()) {
3345 return (menuCheckShowDemandElements->amChecked() == TRUE);
3346 } else {
3347 return true;
3348 }
3349}
3350
3351
3352bool
3354 return (menuCheckToggleTAZRelDrawing->amChecked() != TRUE);
3355}
3356
3357
3358bool
3360 if (menuCheckToggleTAZDrawFill->shown()) {
3361 return (menuCheckToggleTAZDrawFill->amChecked() != TRUE);
3362 } else {
3363 return false;
3364 }
3365}
3366
3367
3368bool
3370 if (menuCheckToggleTAZRelOnlyFrom->shown()) {
3371 return (menuCheckToggleTAZRelOnlyFrom->amChecked() != TRUE);
3372 } else {
3373 return false;
3374 }
3375}
3376
3377
3378bool
3380 if (menuCheckToggleTAZRelOnlyTo->shown()) {
3381 return (menuCheckToggleTAZRelOnlyTo->amChecked() != TRUE);
3382 } else {
3383 return false;
3384 }
3385}
3386
3387// ---------------------------------------------------------------------------
3388// GNEViewNetHelper::IntervalBar - methods
3389// ---------------------------------------------------------------------------
3390
3392 myViewNet(viewNet) {
3393}
3394
3395
3396void
3398 // create interval label
3399 FXLabel* genericDataLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3400 "Data type", 0, GUIDesignLabelThickedFixed(100));
3401 genericDataLabel->create();
3402 // create combo box for generic datas
3403 myGenericDataTypesComboBox = new MFXComboBoxIcon(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3406 myGenericDataTypesComboBox->create();
3407 // fill combo box
3408 myGenericDataTypesComboBox->appendIconItem("<all>");
3409 myGenericDataTypesComboBox->appendIconItem(toString(GNE_TAG_EDGEREL_SINGLE).c_str());
3410 myGenericDataTypesComboBox->appendIconItem(toString(SUMO_TAG_EDGEREL).c_str());
3411 myGenericDataTypesComboBox->appendIconItem(toString(SUMO_TAG_TAZREL).c_str());
3412 // create dataSet label
3413 FXLabel* dataSetLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3414 "Data sets", 0, GUIDesignLabelThickedFixed(100));
3415 dataSetLabel->create();
3416 // create combo box for sets
3417 myDataSetsComboBox = new MFXComboBoxIcon(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3420 myDataSetsComboBox->create();
3421 // create checkbutton for myLimitByInterval
3422 myIntervalCheckBox = new FXCheckButton(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3424 myIntervalCheckBox->create();
3425 // create textfield for begin
3426 myBeginTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3428 myBeginTextField->create();
3429 // create text field for end
3430 myEndTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3432 myEndTextField->create();
3433 // create parameter label
3434 FXLabel* parameterLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3435 "Parameter", 0, GUIDesignLabelThickedFixed(100));
3436 parameterLabel->create();
3437 // create combo box for attributes
3438 myParametersComboBox = new MFXComboBoxIcon(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3441 myParametersComboBox->create();
3442 // always recalc after creating new elements
3443 myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->recalc();
3444}
3445
3446
3447void
3449 // first update interval bar
3450 updateIntervalBar();
3451 // show toolbar grip
3452 myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->show();
3453}
3454
3455
3456void
3458 // hide toolbar grip
3459 myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->hide();
3460}
3461
3462
3463void
3465 // check if intervalBar has to be updated
3466 if (myUpdateInterval && myViewNet->getNet()) {
3467 // clear data sets
3468 myDataSets.clear();
3469 // declare intervals
3470 double begin = INVALID_DOUBLE;
3471 double end = INVALID_DOUBLE;
3472 // clear parameters
3473 myParameters.clear();
3474 // iterate over all data elements
3475 for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
3476 // add data set ID
3477 myDataSets.push_back(dataSet.second->getID());
3478 // iterate over all intervals
3479 for (const auto& interval : dataSet.second->getDataIntervalChildren()) {
3480 // set intervals
3481 if ((begin == INVALID_DOUBLE) || (interval.first < begin)) {
3482 begin = interval.first;
3483 }
3484 if ((end == INVALID_DOUBLE) || (interval.first > end)) {
3485 end = interval.first;
3486 }
3487 // iterate over all generic datas
3488 for (const auto& genericData : interval.second->getGenericDataChildren()) {
3489 // iterate over parameters
3490 for (const auto& parameter : genericData->getParametersMap()) {
3491 myParameters.insert(parameter.first);
3492 }
3493 }
3494 }
3495 }
3496 // get previous dataSet
3497 const std::string previousDataSet = myDataSetsComboBox->getText().text();
3498 // get previous interval
3499 const std::string previousBegin = (myIntervalCheckBox->getCheck() == TRUE) ? myBeginTextField->getText().text() : "";
3500 const std::string previousEnd = (myIntervalCheckBox->getCheck() == TRUE) ? myEndTextField->getText().text() : "";
3501 // get previous parameter
3502 const std::string previousParameter = myParametersComboBox->getText().text();
3503 // clear comboBoxes
3504 myDataSetsComboBox->clearItems();
3505 myParametersComboBox->clearItems();
3506 // add first item (all)
3507 myDataSetsComboBox->appendIconItem("<all>");
3508 myParametersComboBox->appendIconItem("<all>");
3509 // fill dataSet comboBox
3510 for (const auto& dataSet : myDataSets) {
3511 myDataSetsComboBox->appendIconItem(dataSet.c_str());
3512 }
3513 // set begin/end
3514 myBeginTextField->setText(toString(begin).c_str());
3515 myEndTextField->setText(toString(end).c_str());
3516 // fill parameter comboBox
3517 for (const auto& parameter : myParameters) {
3518 myParametersComboBox->appendIconItem(parameter.c_str());
3519 }
3520 // check previous dataSet
3521 myDataSetsComboBox->setCurrentItem(0, FALSE);
3522 for (int i = 0; i < myDataSetsComboBox->getNumItems(); i++) {
3523 if (myDataSetsComboBox->getItemText(i) == previousDataSet) {
3524 myDataSetsComboBox->setCurrentItem(i);
3525 }
3526 }
3527 // set previous interval
3528 if (myIntervalCheckBox->getCheck() == TRUE) {
3529 myBeginTextField->setText(previousBegin.c_str());
3530 myEndTextField->setText(previousEnd.c_str());
3531 }
3532 // check previous parameter
3533 myParametersComboBox->setCurrentItem(0, FALSE);
3534 for (int i = 0; i < myParametersComboBox->getNumItems(); i++) {
3535 if (myParametersComboBox->getItemText(i) == previousParameter) {
3536 myParametersComboBox->setCurrentItem(i);
3537 }
3538 }
3539 // check if enable or disable
3540 if ((myViewNet->getEditModes().dataEditMode == DataEditMode::DATA_INSPECT) ||
3541 (myViewNet->getEditModes().dataEditMode == DataEditMode::DATA_SELECT) ||
3542 (myViewNet->getEditModes().dataEditMode == DataEditMode::DATA_DELETE)) {
3543 enableIntervalBar();
3544 } else {
3545 disableIntervalBar();
3546 }
3547 // intervalBar updated, then change flag
3548 myUpdateInterval = false;
3549 }
3550}
3551
3552
3553void
3555 myUpdateInterval = true;
3556}
3557
3558
3561 if (myGenericDataTypesComboBox->isEnabled() && (myGenericDataTypesComboBox->getTextColor() == FXRGB(0, 0, 0))) {
3562 if (myGenericDataTypesComboBox->getText() == toString(GNE_TAG_EDGEREL_SINGLE).c_str()) {
3564 } else if (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_EDGEREL).c_str()) {
3565 return SUMO_TAG_EDGEREL;
3566 } else if (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_TAZREL).c_str()) {
3567 return SUMO_TAG_TAZREL;
3568 }
3569 }
3570 return SUMO_TAG_NOTHING;
3571}
3572
3573
3576 if (!myDataSetsComboBox->isEnabled() ||
3577 (myDataSetsComboBox->getCurrentItem() == 0) ||
3578 (myDataSetsComboBox->getTextColor() == FXRGB(255, 0, 0))) {
3579 return nullptr;
3580 } else {
3581 return myViewNet->getNet()->getAttributeCarriers()->retrieveDataSet(myDataSetsComboBox->getText().text());
3582 }
3583}
3584
3585
3586double
3588 if (!myIntervalCheckBox->isEnabled() || (myIntervalCheckBox->getCheck() == FALSE)) {
3589 return INVALID_DOUBLE;
3590 } else {
3591 return GNEAttributeCarrier::parse<double>(myBeginTextField->getText().text());
3592 }
3593}
3594
3595
3596double
3598 if (!myIntervalCheckBox->isEnabled() || (myIntervalCheckBox->getCheck() == FALSE)) {
3599 return INVALID_DOUBLE;
3600 } else {
3601 return GNEAttributeCarrier::parse<double>(myEndTextField->getText().text());
3602 }
3603}
3604
3605
3606std::string
3608 if (!myParametersComboBox->isEnabled() ||
3609 (myParametersComboBox->getCurrentItem() == 0) ||
3610 (myParametersComboBox->getTextColor() == FXRGB(255, 0, 0))) {
3611 return "";
3612 } else {
3613 return myParametersComboBox->getText().text();
3614 }
3615}
3616
3617
3618void
3620 if ((myGenericDataTypesComboBox->getText() == "<all>") ||
3621 (myGenericDataTypesComboBox->getText() == toString(GNE_TAG_EDGEREL_SINGLE).c_str()) ||
3622 (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_EDGEREL).c_str()) ||
3623 (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_TAZREL).c_str())) {
3624 myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
3625 } else {
3626 myGenericDataTypesComboBox->setTextColor(FXRGB(255, 0, 0));
3627 }
3628 // update view net
3629 myViewNet->updateViewNet();
3630}
3631
3632
3633void
3635 // check if exist
3636 if (std::find(myDataSets.begin(), myDataSets.end(), myDataSetsComboBox->getText().text()) != myDataSets.end()) {
3637 myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
3638 } else {
3639 myDataSetsComboBox->setTextColor(FXRGB(255, 0, 0));
3640 }
3641 // update view net
3642 myViewNet->updateViewNet();
3643}
3644
3645
3646void
3648 // enable or disable text fields
3649 if (myIntervalCheckBox->isEnabled() && (myIntervalCheckBox->getCheck() == TRUE)) {
3650 myBeginTextField->enable();
3651 myEndTextField->enable();
3652 } else {
3653 myBeginTextField->disable();
3654 myEndTextField->disable();
3655 }
3656 // update view net
3657 myViewNet->updateViewNet();
3658}
3659
3660
3661void
3663 if (myBeginTextField->getText().empty()) {
3664 myBeginTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMinimumBegin()).c_str());
3665 myBeginTextField->setTextColor(FXRGB(0, 0, 0));
3666 } else if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
3667 myBeginTextField->setTextColor(FXRGB(0, 0, 0));
3668 } else {
3669 myBeginTextField->setTextColor(FXRGB(255, 0, 0));
3670 }
3671 // update view net
3672 myViewNet->updateViewNet();
3673}
3674
3675
3676void
3678 if (myEndTextField->getText().empty()) {
3679 myEndTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMaximumEnd()).c_str());
3680 myEndTextField->setTextColor(FXRGB(0, 0, 0));
3681 } else if (GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
3682 myEndTextField->setTextColor(FXRGB(0, 0, 0));
3683 } else {
3684 myEndTextField->setTextColor(FXRGB(255, 0, 0));
3685 }
3686 // update view net
3687 myViewNet->updateViewNet();
3688}
3689
3690
3691void
3693 // check if exist
3694 if (myParameters.count(myParametersComboBox->getText().text()) > 0) {
3695 myParametersComboBox->setTextColor(FXRGB(0, 0, 0));
3696 } else {
3697 myParametersComboBox->setTextColor(FXRGB(255, 0, 0));
3698 }
3699 // update view net
3700 myViewNet->updateViewNet();
3701}
3702
3703
3704
3705void
3707 // enable elements
3708 myGenericDataTypesComboBox->enable();
3709 myDataSetsComboBox->enable();
3710 myIntervalCheckBox->enable();
3711 if (myIntervalCheckBox->getCheck() == TRUE) {
3712 myBeginTextField->enable();
3713 myEndTextField->enable();
3714 } else {
3715 myBeginTextField->disable();
3716 myEndTextField->disable();
3717 }
3718 myParametersComboBox->enable();
3719}
3720
3721
3722void
3724 // disable all elements
3725 myGenericDataTypesComboBox->disable();
3726 myDataSetsComboBox->disable();
3727 myIntervalCheckBox->disable();
3728 myBeginTextField->disable();
3729 myEndTextField->disable();
3730 myParametersComboBox->disable();
3731}
3732
3733// ---------------------------------------------------------------------------
3734// GNEViewNetHelper::CommonCheckableButtons - methods
3735// ---------------------------------------------------------------------------
3736
3740
3741
3742void
3744 // get grip modes
3745 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3746 // get tooltip menu
3747 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3748 // inspect button
3749 inspectButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3750 std::string("\t") + TL("Inspect mode") + std::string("\t") + TL("Mode for inspect elements and change their attributes. (I)"),
3752 inspectButton->create();
3753 // delete button
3754 deleteButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3755 std::string("\t") + TL("Delete mode") + std::string("\t") + TL("Mode for deleting elements. (D)"),
3757 deleteButton->create();
3758 // select button
3759 selectButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3760 std::string("\t") + TL("Select mode") + std::string("\t") + TL("Mode for selecting elements. (S)"),
3762 selectButton->create();
3763 // always recalc menu bar after creating new elements
3764 gripModes->recalc();
3765}
3766
3767
3768void
3770 inspectButton->show();
3771 deleteButton->show();
3772 selectButton->show();
3773}
3774
3775
3776void
3778 inspectButton->hide();
3779 deleteButton->hide();
3780 selectButton->hide();
3781}
3782
3783
3784void
3786 inspectButton->setChecked(false);
3787 deleteButton->setChecked(false);
3788 selectButton->setChecked(false);
3789}
3790
3791
3792void
3794 inspectButton->update();
3795 deleteButton->update();
3796 selectButton->update();
3797}
3798
3799// ---------------------------------------------------------------------------
3800// GNEViewNetHelper::NetworkCheckableButtons - methods
3801// ---------------------------------------------------------------------------
3802
3806
3807
3808void
3810 // get grip modes
3811 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3812 // get tooltip menu
3813 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3814 // move button
3815 moveNetworkElementsButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3816 std::string("\t") + TL("Move mode") + std::string("\t") + TL("Mode for moving elements. (M)"),
3818 moveNetworkElementsButton->create();
3819 // create edge
3820 createEdgeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3821 std::string("\t") + TL("Edge mode") + std::string("\t") + TL("Mode for creating junctions and edges. (E)"),
3823 createEdgeButton->create();
3824 // traffic light mode
3825 trafficLightButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3826 std::string("\t") + TL("Traffic light mode") + std::string("\t") + TL("Mode for editing traffic lights over junctions. (T)"),
3828 trafficLightButton->create();
3829 // connection mode
3830 connectionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3831 std::string("\t") + TL("Connection mode") + std::string("\t") + TL("Mode for edit connections between lanes. (C)"),
3833 connectionButton->create();
3834 // prohibition mode
3835 prohibitionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3836 std::string("\t") + TL("Prohibition mode") + std::string("\t") + TL("Mode for editing connection prohibitions. (H)"),
3838 prohibitionButton->create();
3839 // crossing mode
3840 crossingButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3841 std::string("\t") + TL("Crossing mode") + std::string("\t") + TL("Mode for creating crossings between edges. (R)"),
3843 crossingButton->create();
3844 // additional mode
3845 additionalButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3846 std::string("\t") + TL("Additional mode") + std::string("\t") + TL("Mode for creating additional elements. (A)"),
3848 additionalButton->create();
3849 // wire mode
3850 wireButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3851 std::string("\t") + TL("Wire mode") + std::string("\t") + TL("Mode for editing overhead wires. (W)"),
3853 wireButton->create();
3854 // TAZ Mode
3855 TAZButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3856 std::string("\t") + TL("TAZ mode") + std::string("\t") + TL("Mode for creating Traffic Assignment Zones. (Z)"),
3858 TAZButton->create();
3859 // shape mode
3860 shapeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3861 std::string("\t") + TL("Polygon mode") + std::string("\t") + TL("Mode for creating polygons and POIs. (P)"),
3863 shapeButton->create();
3864 // decal mode
3865 decalButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3866 std::string("\t") + TL("Decal mode") + std::string("\t") + TL("Mode for editing decals. (U)"),
3868 decalButton->create();
3869 // always recalc after creating new elements
3870 gripModes->recalc();
3871}
3872
3873
3874void
3876 // continue depending of view
3877 if (myViewNet->getEditModes().isJuPedSimView()) {
3878 moveNetworkElementsButton->show();
3879 createEdgeButton->show();
3880 connectionButton->hide();
3881 trafficLightButton->hide();
3882 additionalButton->show();
3883 crossingButton->show();
3884 TAZButton->show();
3885 shapeButton->show();
3886 prohibitionButton->hide();
3887 wireButton->hide();
3888 decalButton->hide();
3889 } else {
3890 moveNetworkElementsButton->show();
3891 createEdgeButton->show();
3892 connectionButton->show();
3893 trafficLightButton->show();
3894 additionalButton->show();
3895 crossingButton->show();
3896 TAZButton->show();
3897 shapeButton->show();
3898 prohibitionButton->show();
3899 wireButton->show();
3900 decalButton->show();
3901 }
3902}
3903
3904
3905void
3907 moveNetworkElementsButton->hide();
3908 createEdgeButton->hide();
3909 connectionButton->hide();
3910 trafficLightButton->hide();
3911 additionalButton->hide();
3912 crossingButton->hide();
3913 TAZButton->hide();
3914 shapeButton->hide();
3915 prohibitionButton->hide();
3916 wireButton->hide();
3917 decalButton->hide();
3918}
3919
3920
3921void
3923 moveNetworkElementsButton->setChecked(false);
3924 createEdgeButton->setChecked(false);
3925 connectionButton->setChecked(false);
3926 trafficLightButton->setChecked(false);
3927 additionalButton->setChecked(false);
3928 crossingButton->setChecked(false);
3929 TAZButton->setChecked(false);
3930 shapeButton->setChecked(false);
3931 prohibitionButton->setChecked(false);
3932 wireButton->setChecked(false);
3933 decalButton->setChecked(false);
3934}
3935
3936
3937void
3939 moveNetworkElementsButton->update();
3940 createEdgeButton->update();
3941 connectionButton->update();
3942 trafficLightButton->update();
3943 additionalButton->update();
3944 crossingButton->update();
3945 TAZButton->update();
3946 shapeButton->update();
3947 prohibitionButton->update();
3948 wireButton->update();
3949 decalButton->update();
3950}
3951
3952// ---------------------------------------------------------------------------
3953// GNEViewNetHelper::DemandCheckableButtons - methods
3954// ---------------------------------------------------------------------------
3955
3959
3960
3961void
3963 // get grip modes
3964 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3965 // get tooltip menu
3966 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3967 // move button
3968 moveDemandElementsButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3969 std::string("\t") + TL("Move mode") + std::string("\t") + TL("Mode for moving elements. (M)"),
3971 moveDemandElementsButton->create();
3972 // route mode
3973 routeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3974 std::string("\t") + TL("Route mode") + std::string("\t") + TL("Mode for creating routes. (R)"),
3976 routeButton->create();
3977 // rout distribution mode
3978 routeDistributionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3979 std::string("\t") + TL("Route distribution mode") + std::string("\t") + TL("Mode for creating and editing rout distributions. (W)"),
3981 routeDistributionButton->create();
3982 // vehicle mode
3983 vehicleButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3984 std::string("\t") + TL("Vehicle mode") + std::string("\t") + TL("Mode for creating vehicles. (V)"),
3986 vehicleButton->create();
3987 // type mode
3988 typeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3989 std::string("\t") + TL("Type mode") + std::string("\t") + TL("Mode for creating types (of vehicles, persons and containers). (T)"),
3991 typeButton->create();
3992 // type distribution mode
3993 typeDistributionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3994 std::string("\t") + TL("Type distribution mode") + std::string("\t") + TL("Mode for creating and editing type distribution. (U)"),
3996 typeDistributionButton->create();
3997 // stop mode
3998 stopButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3999 std::string("\t") + TL("Stop mode") + std::string("\t") + TL("Mode for creating stops. (A)"),
4001 stopButton->create();
4002 // person mode
4003 personButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4004 std::string("\t") + TL("Person mode") + std::string("\t") + TL("Mode for creating persons. (P)"),
4006 personButton->create();
4007 // person plan mode
4008 personPlanButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4009 std::string("\t") + TL("Person plan mode") + std::string("\t") + TL("Mode for creating person plans. (L)"),
4011 personPlanButton->create();
4012 // container mode
4013 containerButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4014 std::string("\t") + TL("Container mode") + std::string("\t") + TL("Mode for creating containers. (C)"),
4016 containerButton->create();
4017 // container plan mode
4018 containerPlanButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4019 std::string("\t") + TL("Container plan mode") + std::string("\t") + TL("Mode for creating container plans. (H)"),
4021 containerPlanButton->create();
4022 // always recalc after creating new elements
4023 gripModes->recalc();
4024}
4025
4026
4027void
4029 if (myViewNet->getEditModes().isJuPedSimView()) {
4030 moveDemandElementsButton->hide();
4031 routeButton->show();
4032 routeDistributionButton->show();
4033 vehicleButton->hide();
4034 typeButton->show();
4035 typeDistributionButton->show();
4036 stopButton->hide();
4037 personButton->show();
4038 personPlanButton->show();
4039 containerButton->hide();
4040 containerPlanButton->hide();
4041 } else {
4042 moveDemandElementsButton->show();
4043 routeButton->show();
4044 routeDistributionButton->show();
4045 vehicleButton->show();
4046 typeButton->show();
4047 typeDistributionButton->show();
4048 stopButton->show();
4049 personButton->show();
4050 personPlanButton->show();
4051 containerButton->show();
4052 containerPlanButton->show();
4053 }
4054}
4055
4056
4057void
4059 moveDemandElementsButton->hide();
4060 routeButton->hide();
4061 routeDistributionButton->hide();
4062 vehicleButton->hide();
4063 typeButton->hide();
4064 typeDistributionButton->hide();
4065 stopButton->hide();
4066 personButton->hide();
4067 personPlanButton->hide();
4068 containerButton->hide();
4069 containerPlanButton->hide();
4070}
4071
4072
4073void
4075 moveDemandElementsButton->setChecked(false);
4076 routeButton->setChecked(false);
4077 routeDistributionButton->setChecked(false);
4078 vehicleButton->setChecked(false);
4079 typeButton->setChecked(false);
4080 typeDistributionButton->setChecked(false);
4081 stopButton->setChecked(false);
4082 personButton->setChecked(false);
4083 personPlanButton->setChecked(false);
4084 containerButton->setChecked(false);
4085 containerPlanButton->setChecked(false);
4086}
4087
4088
4089void
4091 moveDemandElementsButton->update();
4092 routeButton->update();
4093 routeDistributionButton->update();
4094 vehicleButton->update();
4095 typeButton->update();
4096 typeDistributionButton->update();
4097 stopButton->update();
4098 personButton->update();
4099 personPlanButton->update();
4100 containerButton->update();
4101 containerPlanButton->update();
4102}
4103
4104// ---------------------------------------------------------------------------
4105// GNEViewNetHelper::DataCheckableButtons - methods
4106// ---------------------------------------------------------------------------
4107
4111
4112
4113void
4115 // get grip modes
4116 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
4117 // get tooltip menu
4118 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
4119 // edgeData mode
4120 edgeDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4121 std::string("\t") + TL("Edge data mode") + std::string("\t") + TL("Mode for creating edge datas. (E)"),
4123 edgeDataButton->create();
4124 // edgeRelData mode
4125 edgeRelDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4126 std::string("\t") + TL("Edge relation data mode") + std::string("\t") + TL("Mode for creating edge relation datas. (R)"),
4128 edgeRelDataButton->create();
4129 // TAZRelData mode
4130 TAZRelDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4131 std::string("\t") + TL("TAZ relation data mode") + std::string("\t") + TL("Mode for creating TAZ relation datas. (Z)"),
4133 TAZRelDataButton->create();
4134 // meanData button
4135 meanDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
4136 std::string("\t") + TL("MeanData mode") + std::string("\t") + TL("Mode for MeanData elements. (M)"),
4138 meanDataButton->create();
4139 // always recalc after creating new elements
4140 gripModes->recalc();
4141}
4142
4143
4144void
4146 edgeDataButton->show();
4147 edgeRelDataButton->show();
4148 TAZRelDataButton->show();
4149 meanDataButton->show();
4150}
4151
4152
4153void
4155 edgeDataButton->hide();
4156 edgeRelDataButton->hide();
4157 TAZRelDataButton->hide();
4158 meanDataButton->hide();
4159}
4160
4161
4162void
4164 edgeDataButton->setChecked(false);
4165 edgeRelDataButton->setChecked(false);
4166 TAZRelDataButton->setChecked(false);
4167 meanDataButton->setChecked(false);
4168}
4169
4170
4171void
4173 edgeDataButton->update();
4174 edgeRelDataButton->update();
4175 TAZRelDataButton->update();
4176 meanDataButton->update();
4177}
4178
4179// ---------------------------------------------------------------------------
4180// GNEViewNetHelper::EditNetworkElementShapes - methods
4181// ---------------------------------------------------------------------------
4182
4184 myViewNet(viewNet),
4185 myPreviousNetworkEditMode(NetworkEditMode::NETWORK_NONE) {
4186}
4187
4188
4189void
4191 if (element && (myEditedNetworkElement == nullptr)) {
4192 // save current edit mode before starting
4193 myPreviousNetworkEditMode = myViewNet->myEditModes.networkEditMode;
4194 // set move mode
4195 myViewNet->myEditModes.setNetworkEditMode(NetworkEditMode::NETWORK_MOVE);
4196 //set editedNetworkElement
4197 myEditedNetworkElement = element;
4198 // enable shape edited flag
4199 myEditedNetworkElement->setShapeEdited(true);
4200 // update view net to show the new editedShapePoly
4201 myViewNet->updateViewNet();
4202 }
4203}
4204
4205
4206void
4208 // stop edit shape junction deleting editedShapePoly
4209 if (myEditedNetworkElement != nullptr) {
4210 // disable shape edited flag
4211 myEditedNetworkElement->setShapeEdited(false);
4212 // reset editedNetworkElement
4213 myEditedNetworkElement = nullptr;
4214 // restore previous edit mode
4215 if (myViewNet->myEditModes.networkEditMode != myPreviousNetworkEditMode) {
4216 myViewNet->myEditModes.setNetworkEditMode(myPreviousNetworkEditMode);
4217 }
4218 }
4219}
4220
4221
4222void
4224 // save edited junction's shape
4225 if (myEditedNetworkElement != nullptr) {
4226 // stop edit custom shape
4227 stopEditCustomShape();
4228 }
4229}
4230
4231
4234 return myEditedNetworkElement;
4235}
4236
4237// ---------------------------------------------------------------------------
4238// GNEViewNetHelper::BlockIcon - methods
4239// ---------------------------------------------------------------------------
4240
4241void
4243 const GNEAttributeCarrier* AC, GUIGlObjectType type, const Position position, const double exaggeration,
4244 const double size, const double offsetx, const double offsety) {
4245 // first check if icon can be drawn
4246 if (checkDrawing(d, AC, type, exaggeration)) {
4247 // Start pushing matrix
4249 // Traslate to position
4250 glTranslated(position.x(), position.y(), GLO_LOCKICON);
4251 // Traslate depending of the offset
4252 glTranslated(offsetx, offsety, 0);
4253 // rotate to avoid draw invert
4254 glRotated(180, 0, 0, 1);
4255 // Set draw color
4256 glColor3d(1, 1, 1);
4257 // Draw lock icon
4259 // Pop matrix
4261 }
4262}
4263
4264
4266
4267
4268bool
4270 GUIGlObjectType type, const double exaggeration) {
4271 // check detail
4273 return false;
4274 }
4275 // get view net
4276 const auto viewNet = AC->getNet()->getViewNet();
4277 // check exaggeration
4278 if (exaggeration == 0) {
4279 return false;
4280 }
4281 // check supermodes
4282 if (viewNet->getEditModes().isCurrentSupermodeNetwork() &&
4284 return false;
4285 }
4286 if (viewNet->getEditModes().isCurrentSupermodeDemand() && (!AC->getTagProperty().isDemandElement())) {
4287 return false;
4288 }
4289 if (viewNet->getEditModes().isCurrentSupermodeData() && (!AC->getTagProperty().isDataElement())) {
4290 return false;
4291 }
4292 // check if is locked
4293 if (!viewNet->getLockManager().isObjectLocked(type, AC->isAttributeCarrierSelected())) {
4294 return false;
4295 }
4296 // all ok, then draw
4297 return true;
4298}
4299
4300// ---------------------------------------------------------------------------
4301// GNEViewNetHelper - methods
4302// ---------------------------------------------------------------------------
4303
4304const std::vector<RGBColor>&
4306 // if is empty, fill it
4307 if (myRainbowScaledColors.empty()) {
4308 // fill scale colors (10)
4309 myRainbowScaledColors.push_back(RGBColor(232, 35, 0, 255));
4310 myRainbowScaledColors.push_back(RGBColor(255, 165, 0, 255));
4311 myRainbowScaledColors.push_back(RGBColor(255, 255, 0, 255));
4312 myRainbowScaledColors.push_back(RGBColor(28, 215, 0, 255));
4313 myRainbowScaledColors.push_back(RGBColor(0, 181, 100, 255));
4314 myRainbowScaledColors.push_back(RGBColor(0, 255, 191, 255));
4315 myRainbowScaledColors.push_back(RGBColor(178, 255, 255, 255));
4316 myRainbowScaledColors.push_back(RGBColor(0, 112, 184, 255));
4317 myRainbowScaledColors.push_back(RGBColor(56, 41, 131, 255));
4318 myRainbowScaledColors.push_back(RGBColor(127, 0, 255, 255));
4319 }
4320 return myRainbowScaledColors;
4321}
4322
4323
4324const RGBColor&
4325GNEViewNetHelper::getRainbowScaledColor(const double min, const double max, const double value) {
4326 // check extremes
4327 if (value <= min) {
4328 return getRainbowScaledColors().front();
4329 } else if (value >= max) {
4330 return getRainbowScaledColors().back();
4331 } else {
4332 // calculate value procent between [min, max]
4333 const double procent = ((value - min) * 100) / (max - min);
4334 // check if is valid
4335 if (procent <= 0) {
4336 return getRainbowScaledColors().front();
4337 } else if (procent >= 100) {
4338 return getRainbowScaledColors().back();
4339 } else {
4340 // return scaled color
4341 return getRainbowScaledColors().at((int)(procent / 10.0));
4342 }
4343 }
4344}
4345
4346
4347std::vector<GUIGlObject*>
4348GNEViewNetHelper::filterElementsByLayer(const std::vector<GUIGlObject*>& GLObjects) {
4349 std::vector<GUIGlObject*> filteredGLObjects;
4350 if (GLObjects.size() > 0) {
4351 const auto firstLayer = GLObjects.front()->getType();
4352 for (const auto& GLObject : GLObjects) {
4353 if ((GLO_RIDE <= firstLayer) && (firstLayer <= GLO_TRANSHIP) &&
4354 (GLO_RIDE <= GLObject->getType()) && (GLObject->getType() <= GLO_TRANSHIP)) {
4355 filteredGLObjects.push_back(GLObject);
4356 } else if ((GLO_STOP <= firstLayer) && (firstLayer <= GLO_STOP_PLAN) &&
4357 (GLO_STOP <= GLObject->getType()) && (GLObject->getType() <= GLO_STOP_PLAN)) {
4358 filteredGLObjects.push_back(GLObject);
4359 } else if ((GLO_VEHICLE <= firstLayer) && (firstLayer <= GLO_ROUTEFLOW) &&
4360 (GLO_VEHICLE <= GLObject->getType()) && (GLObject->getType() <= GLO_ROUTEFLOW)) {
4361 filteredGLObjects.push_back(GLObject);
4362 } else if ((GLO_PERSON <= firstLayer) && (firstLayer <= GLO_PERSONFLOW) &&
4363 (GLO_PERSON <= GLObject->getType()) && (GLObject->getType() <= GLO_PERSONFLOW)) {
4364 filteredGLObjects.push_back(GLObject);
4365 } else if ((GLO_CONTAINER <= firstLayer) && (firstLayer <= GLO_CONTAINERFLOW) &&
4366 (GLO_CONTAINER <= GLObject->getType()) && (GLObject->getType() <= GLO_CONTAINERFLOW)) {
4367 filteredGLObjects.push_back(GLObject);
4368 } else if (GLObject->getType() == firstLayer) {
4369 filteredGLObjects.push_back(GLObject);
4370 }
4371 }
4372 }
4373 return filteredGLObjects;
4374}
4375
4376/****************************************************************************/
DataEditMode
enum for data edit modes
@ DATA_SELECT
mode for selecting data elements
@ DATA_INSPECT
mode for inspecting data elements
@ DATA_DELETE
mode for deleting data elements
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
@ DATA
Data mode (edgeData, LaneData etc..)
@ DEMAND
Demand mode (Routes, Vehicles etc..)
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_WIRE
Mode for editing wires.
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_SELECT
mode for selecting network elements
@ NETWORK_INSPECT
mode for inspecting network elements
@ NETWORK_PROHIBITION
Mode for editing connection prohibitions.
@ NETWORK_NONE
empty Network mode
@ NETWORK_CONNECT
mode for connecting lanes
DemandEditMode
@brie enum for demand edit modes
@ DEMAND_INSPECT
mode for inspecting demand elements
@ DEMAND_DELETE
mode for deleting demand elements
@ DEMAND_SELECT
mode for selecting demand elements
@ DEMAND_MOVE
mode for moving demand elements
@ MID_GNE_NETWORKVIEWOPTIONS_AUTOOPPOSITEEDGES
automatically create opposite edge
Definition GUIAppEnum.h:847
@ MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS
save Data Elements
Definition GUIAppEnum.h:204
@ MID_HOTKEY_F3_SUPERMODE_DEMAND
select demand supermode in netedit
Definition GUIAppEnum.h:234
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWALLPERSONPLANS
show all person plans
Definition GUIAppEnum.h:879
@ MID_GNE_DATAVIEWOPTIONS_TAZRELDRAWING
toggle TAZRel drawing
Definition GUIAppEnum.h:903
@ MID_HOTKEY_U_MODE_DECAL_TYPEDISTRIBUTION
hotkey for mode decal AND type distribution
Definition GUIAppEnum.h:69
@ MID_GNE_NETWORKVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition GUIAppEnum.h:821
@ MID_GNE_NETWORKVIEWOPTIONS_MOVEELEVATION
move elevation instead of x,y
Definition GUIAppEnum.h:843
@ MID_GNE_NETWORKVIEWOPTIONS_HIDECONNECTIONS
hide connections
Definition GUIAppEnum.h:829
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWCONNECTIONS
show connections
Definition GUIAppEnum.h:827
@ MID_GNE_INTERVALBAR_BEGIN
begin changed in InterbalBar
Definition GUIAppEnum.h:923
@ MID_GNE_DATAVIEWOPTIONS_TAZRELONLYTO
toggle draw TAZRel only to
Definition GUIAppEnum.h:909
@ MID_GNE_DATAVIEWOPTIONS_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:895
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWTAZELEMENTS
show TAZ elements
Definition GUIAppEnum.h:833
@ MID_GNE_DEMANDVIEWOPTIONS_LOCKPERSON
lock person
Definition GUIAppEnum.h:881
@ MID_HOTKEY_Z_MODE_TAZ_TAZREL
hotkey for mode editing TAZ and TAZRel
Definition GUIAppEnum.h:75
@ MID_GNE_DEMANDVIEWOPTIONS_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:869
@ MID_HOTKEY_A_MODE_STARTSIMULATION_ADDITIONALS_STOPS
hotkey for start simulation in SUMO and set editing mode additionals AND stops in netedit
Definition GUIAppEnum.h:43
@ MID_GNE_NETWORKVIEWOPTIONS_ASKFORMERGE
ask before merging junctions
Definition GUIAppEnum.h:839
@ MID_GNE_TOGGLE_TIMEFORMAT
switch time format
Definition GUIAppEnum.h:801
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWGRID
show grid
Definition GUIAppEnum.h:867
@ MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS
Save Demand Elements.
Definition GUIAppEnum.h:208
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in netedit.
Definition GUIAppEnum.h:117
@ MID_HOTKEY_D_MODE_SINGLESIMULATIONSTEP_DELETE
hotkey for perform a single simulation step in SUMO and set delete mode in netedit
Definition GUIAppEnum.h:49
@ MID_GNE_NETWORKVIEWOPTIONS_CHAINEDGES
create edges in chain mode
Definition GUIAppEnum.h:845
@ MID_GNE_DATAVIEWOPTIONS_SHOWDEMANDELEMENTS
show demand elements
Definition GUIAppEnum.h:901
@ MID_HOTKEY_C_MODE_CONNECT_CONTAINER
hotkey for mode connecting lanes AND container
Definition GUIAppEnum.h:45
@ MID_HOTKEY_H_MODE_PROHIBITION_CONTAINERPLAN
hotkey for mode prohibition AND container plan
Definition GUIAppEnum.h:53
@ MID_HOTKEY_W_MODE_WIRE_ROUTEDISTRIBUTION
hotkey for mode editing overhead wires AND route distributions
Definition GUIAppEnum.h:73
@ MID_HOTKEY_T_MODE_TLS_TYPE
hotkey for mode editing TLS AND Vehicle Types
Definition GUIAppEnum.h:67
@ MID_GNE_DEMANDVIEWOPTIONS_HIDESHAPES
hide shapes
Definition GUIAppEnum.h:875
@ MID_GNE_DATAVIEWOPTIONS_SHOWADDITIONALS
show additionals
Definition GUIAppEnum.h:897
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWBUBBLES
show junctions as bubbles
Definition GUIAppEnum.h:841
@ MID_GNE_INTERVALBAR_END
end changed in InterbalBar
Definition GUIAppEnum.h:925
@ MID_GNE_NETWORKVIEWOPTIONS_EXTENDSELECTION
extend selection
Definition GUIAppEnum.h:835
@ MID_HOTKEY_S_MODE_STOPSIMULATION_SELECT
hotkey for stop simulation in SUMO and set select mode in netedit
Definition GUIAppEnum.h:63
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWSUBADDITIONALS
show sub-additionals
Definition GUIAppEnum.h:831
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWALLCONTAINERPLANS
show all container plans
Definition GUIAppEnum.h:883
@ MID_GNE_VIEW_DEFAULT
set default view
Definition GUIAppEnum.h:783
@ MID_HOTKEY_F4_SUPERMODE_DATA
select data supermode in netedit
Definition GUIAppEnum.h:236
@ MID_GNE_VIEW_JUPEDSIM
set juPedSim view
Definition GUIAppEnum.h:785
@ MID_GNE_INTERVALBAR_PARAMETER
parameter changed in InterbalBar
Definition GUIAppEnum.h:927
@ MID_HOTKEY_R_MODE_CROSSING_ROUTE_EDGERELDATA
hotkey for mode editing crossing, routes and edge rel datas
Definition GUIAppEnum.h:65
@ MID_GNE_DATAVIEWOPTIONS_TAZDRAWFILL
toggle draw TAZ fill
Definition GUIAppEnum.h:905
@ MID_HOTKEY_CTRL_SHIFT_M_SAVEMEANDATAS
save Mean Datas
Definition GUIAppEnum.h:216
@ MID_HOTKEY_L_MODE_PERSONPLAN
hotkey for mode person plan
Definition GUIAppEnum.h:57
@ MID_HOTKEY_V_MODE_VEHICLE
hotkey for mode create vehicles
Definition GUIAppEnum.h:71
@ MID_HOTKEY_I_MODE_INSPECT
hotkey for mode inspecting object attributes
Definition GUIAppEnum.h:55
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWDEMANDELEMENTS
show demand elements
Definition GUIAppEnum.h:823
@ MID_HOTKEY_CTRL_SHIFT_E_SAVENETEDITCONFIG
save netedit Config
Definition GUIAppEnum.h:210
@ MID_GNE_DEMANDVIEWOPTIONS_HIDENONINSPECTED
hide non-inspected demand element
Definition GUIAppEnum.h:873
@ MID_HOTKEY_CTRL_SHIFT_A_SAVEADDITIONALS
Save Additional Elements.
Definition GUIAppEnum.h:202
@ MID_GNE_INTERVALBAR_GENERICDATATYPE
generic data selected
Definition GUIAppEnum.h:917
@ MID_GNE_NETWORKVIEWOPTIONS_CHANGEALLPHASES
change all phases
Definition GUIAppEnum.h:837
@ MID_GNE_DATAVIEWOPTIONS_SHOWSHAPES
show shapes
Definition GUIAppEnum.h:899
@ MID_HOTKEY_E_MODE_EDGE_EDGEDATA
hotkey for mode adding edges AND edgeDatas
Definition GUIAppEnum.h:51
@ MID_GNE_DATAVIEWOPTIONS_TAZRELONLYFROM
toggle draw TAZRel only from
Definition GUIAppEnum.h:907
@ MID_GNE_NETWORKVIEWOPTIONS_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:819
@ MID_GNE_DEMANDVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition GUIAppEnum.h:871
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWOVERLAPPEDROUTES
show overlapped routes
Definition GUIAppEnum.h:887
@ MID_HOTKEY_CTRL_SHIFT_S_SAVESUMOCONFIG
save SUMOConfig (SUMO AND netedit)
Definition GUIAppEnum.h:222
@ MID_GNE_INTERVALBAR_DATASET
data set selected
Definition GUIAppEnum.h:919
@ MID_HOTKEY_M_MODE_MOVE_MEANDATA
hotkey for mode moving element AND mean data
Definition GUIAppEnum.h:59
@ MID_HOTKEY_F2_SUPERMODE_NETWORK
select network supermode in netedit
Definition GUIAppEnum.h:232
@ MID_GNE_DEMANDVIEWOPTIONS_LOCKCONTAINER
lock container
Definition GUIAppEnum.h:885
@ MID_GNE_NETWORKVIEWOPTIONS_SELECTEDGES
select edges
Definition GUIAppEnum.h:825
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWTRIPS
show all trips
Definition GUIAppEnum.h:877
@ MID_GNE_NETWORKVIEWOPTIONS_TOGGLEGRID
show grid
Definition GUIAppEnum.h:817
@ MID_GNE_INTERVALBAR_LIMITED
enable/disable show data elements by interval
Definition GUIAppEnum.h:921
@ MID_HOTKEY_P_MODE_POLYGON_PERSON
hotkey for mode creating polygons
Definition GUIAppEnum.h:61
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180
Definition GUIDesigns.h:305
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:311
#define GUIDesignButtonPopup
checkable button placed in popup (for example, locate buttons)
Definition GUIDesigns.h:112
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:123
#define GUIDesignButtonLeft
button extended over over Frame with thick and raise frame
Definition GUIDesigns.h:85
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:74
#define GUIDesignTLSTableCheckableButtonIcon
checkable button only with icon used in TLSTable
Definition GUIDesigns.h:109
#define GUIDesignComboBoxVisibleItemsFixed
combo box size fixed
Definition GUIDesigns.h:52
#define GUIDesignTextFieldFixedRestricted(width, type)
text field with fixed width
Definition GUIDesigns.h:68
#define GUIDesignMFXCheckableButtonSquare
Definition GUIDesigns.h:137
#define GUIDesignButtonToolbarLocator
little checkable button with icon placed in navigation toolbar used specify for Locator
Definition GUIDesigns.h:129
#define GUIDesignMFXCheckableButtonSupermode
checkable button with icon placed in navigation toolbar for supermodes
Definition GUIDesigns.h:140
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition GUIDesigns.h:201
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:252
GUIGlObjectType
@ GLO_EDGERELDATA
edge relation data
@ GLO_TAZRELDATA
TAZ relation data.
@ GLO_WALKINGAREA
a walkingArea
@ GLO_JPS_WALKABLEAREA
walkable area
@ GLO_ROUTE_EMBEDDED
a route
@ GLO_TESTELEMENT
test element (used in netedit)
@ GLO_TRANSHIP
a container tranship
@ GLO_STOPPING_PLACE_LAST
reserved GLO type for packing all StoppingPlace elements
@ GLO_STOP_PLAN
a stop plan stop
@ GLO_ACCESS
a Acces
@ GLO_ROUTEFLOW
a routeFlow
@ GLO_WALK
a walk
@ GLO_ROUTE
a route
@ GLO_WIRE
reserved GLO type for packing all wire elements
@ GLO_JUNCTION
a junction
@ GLO_LANE
a lane
@ GLO_RIDE
a ride
@ GLO_TAZ
Traffic Assignment Zones (TAZs)
@ GLO_CONTAINER
a container
@ GLO_JPS_OBSTACLE
obstacles
@ GLO_EDGEDATA
edge data
@ GLO_CONNECTION
a connection
@ GLO_ADDITIONALELEMENT
reserved GLO type for packing all additionals elements
@ GLO_PERSONTRIP
a person trip
@ GLO_EDGE
an edge
@ GLO_STOPPING_PLACE
reserved GLO type for packing all StoppingPlace elements
@ GLO_VEHICLE
a vehicle
@ GLO_PERSON
a person
@ GLO_TRANSPORT
a container transport
@ GLO_POI
poi (over view, geo and lane)
@ GLO_RECTANGLESELECTION
rectangle selection shape (used in netedit)
@ GLO_STOP
a stop
@ GLO_CONTAINERFLOW
a person flow
@ GLO_POLYGON
polygon
@ GLO_TLLOGIC
a tl-logic
@ GLO_CROSSING
a tl-logic
@ GLO_PERSONFLOW
a person flow
@ GLO_TRACTIONSUBSTATION
a segment of an overhead line
@ GLO_LOCKICON
Lock icon (used in netedit)
GUIViewObjectsHandler gViewObjectsHandler
@ DATAMODE_CHECKBOX_SHOWADDITIONALS
@ SAVE_NETEDITCONFIG
@ SAVE_DATAELEMENTS
@ NETWORKMODE_CHECKBOX_BUBBLES
@ SAVE_NETWORKELEMENTS
@ DATAMODE_CHECKBOX_TAZRELONLYFROM
@ MODEPERSONPLAN
@ MODECROSSING
@ MODEMEANDATA
@ MODEADDITIONAL
@ MODEEDGERELDATA
@ SUPERMODEDEMAND
@ MODEPROHIBITION
@ SAVE_ADDITIONALELEMENTS
@ DEMANDMODE_CHECKBOX_HIDENONINSPECTEDDEMANDELEMENTS
@ NETWORKMODE_CHECKBOX_HIDECONNECTIONS
@ DEMANDMODE_CHECKBOX_SHOWTRIPS
@ COMMONMODE_CHECKBOX_TOGGLEDRAWJUNCTIONSHAPE
@ DATAMODE_CHECKBOX_SHOWSHAPES
@ NETWORKMODE_CHECKBOX_SELECTEDGES
@ COMMONMODE_CHECKBOX_SHOWDEMANDELEMENTS
@ DEMANDMODE_CHECKBOX_LOCKPERSON
@ NETWORKMODE_CHECKBOX_APPLYTOALLPHASES
@ MODECREATEEDGE
@ DATAMODE_CHECKBOX_TAZRELONLYTO
@ NETWORKMODE_CHECKBOX_AUTOSELECTJUNCTIONS
@ SAVE_MEANDATAELEMENTS
@ DATAMODE_CHECKBOX_TAZRELDRAWING
@ NETWORKMODE_CHECKBOX_SHOWCONNECTIONS
@ DEMANDMODE_CHECKBOX_SHOWPERSONPLANS
@ MODECONTAINER
@ DEMANDMODE_CHECKBOX_HIDESHAPES
@ DATAMODE_CHECKBOX_TAZDRAWFILL
@ MODEEDGEDATA
@ NETWORKMODE_CHECKBOX_ELEVATION
@ SUPERMODENETWORK
@ COMMONMODE_CHECKBOX_SPREADVEHICLE
@ SAVE_DEMANDELEMENTS
@ DEMANDMODE_CHECKBOX_LOCKCONTAINER
@ NETWORKMODE_CHECKBOX_SHOWSUBADDITIONALS
@ NETWORKMODE_CHECKBOX_SHOWTAZELEMENTS
@ SUPERMODEDATA
@ MODECONNECTION
@ MODECONTAINERPLAN
@ SAVE_MULTIPLE
@ NETWORKMODE_CHECKBOX_CHAIN
@ DEMANDMODE_CHECKBOX_SHOWOVERLAPPEDROUTES
@ NETWORKMODE_CHECKBOX_ASKFORMERGE
@ SAVE_SUMOCONFIG
@ VIEWJUPEDSIM
@ MODETYPEDISTRIBUTION
@ COMMONMODE_CHECKBOX_TOGGLEGRID
@ MODEROUTEDISTRIBUTION
@ MODETAZRELDATA
@ DEMANDMODE_CHECKBOX_SHOWCONTAINERPLANS
@ NETWORKMODE_CHECKBOX_TWOWAY
#define WRITE_ERRORF(...)
Definition MsgHandler.h:305
#define TL(string)
Definition MsgHandler.h:315
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_NOTHING
invalid tag, must be the last one
@ GNE_TAG_EDGEREL_SINGLE
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_TAZREL
a relation between two TAZs
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_SELECTED
element is selected
bool gHumanReadableTime
Definition StdDefs.cpp:29
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
#define UNUSED_PARAMETER(x)
Definition StdDefs.h:30
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:78
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
An Element which don't belong to GNENet but has influence in the simulation.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool isMarkedForDrawingFront() const
check if this AC is marked for drawing front
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unmarkForDrawingFront()
unmark for drawing front
GNENet * getNet() const
get pointer to net
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition GNECrossing.h:44
An Element which don't belong to GNENet but has influence in the simulation.
Definition GNEEdgeData.h:37
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
bool isConvexAngle() const
check if edge makes a convex angle [0 - 180) degrees
Definition GNEEdge.cpp:1757
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:781
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.
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move element
static void commitMove(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const GNEMoveOffset &offset, GNEUndoList *undoList)
commit move element for the given offset
static void moveElement(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const GNEMoveOffset &offset)
move element the for given offset (note: offset can be X-Y-0, 0-0-Z or X-Y-Z)
move offset
move operation
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2163
void setShapeEdited(const bool value)
set shape edited
An Element which don't belong to GNENet but has influence in the simulation.
bool isNetworkElement() const
element sets
bool isDataElement() const
return true if tag correspond to a data element
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 isInspectingElements() const
check if we're inspecting at least one element
void inspectAC(GNEAttributeCarrier *AC)
void inspectACs(const std::vector< GNEAttributeCarrier * > &ACs)
inspect multiple ACs
bool isACInspected(GNEAttributeCarrier *AC) const
const std::unordered_set< GNEAttributeCarrier * > & getACs() const
get hash table with all inspected ACs
GNEAttributeCarrier * getFirstAC() const
void uninspectAC(GNEAttributeCarrier *AC)
uninspect AC
bool isInspectingSingleElement() const
check if we're inspecting exactly one element
bool isInspectingMultipleElements() const
check if we're inspecting more than one elements
void clearInspectedElements()
clear inspected AC
std::string getParameter() const
get parameter
void hideIntervalBar()
hide all options menu checks
void setGenericDataType()
set generic data type
double getBegin() const
get begin
void showIntervalBar()
show interval option bar
void disableIntervalBar()
disable interval bar
void updateIntervalBar()
update interval bar
void buildIntervalBarElements()
build interval bar elements
GNEDataSet * getDataSet() const
get dataSet
IntervalBar(GNEViewNet *viewNet)
default constructor
void enableIntervalBar()
enable interval bar
void setInterval()
update limit by interval
SumoXMLTag getGenericDataType() const
get generic data type
void updateLockMenuBar()
update lock inspect menuBar
bool isObjectLocked(GUIGlObjectType objectType, const bool selected) const
check if given GLObject is locked for inspect, select, delete and move
LockManager(GNEViewNet *viewNet)
constructor
std::map< GUIGlObjectType, OperationLocked > myLockedElements
map with locked elements
GNEViewNet * myViewNet
pointer to viewNet
void unmarkAC(GNEAttributeCarrier *AC)
unmark AC for drawing front
void markAC(GNEAttributeCarrier *AC)
mark AC as drawing front
const std::unordered_set< GNEAttributeCarrier * > & getACs() const
get hash table with all fronted ACs
std::vector< GNEConnection * > connections
vector with the connections
std::vector< GNEGenericData * > genericDatas
vector with the generic datas
std::vector< GNEPOI * > POIs
vector with the POIs
std::vector< GNEInternalLane * > internalLanes
vector with the internal lanes
std::vector< GUIGlObject * > GUIGlObjects
vector with the GUIGlObjects
std::vector< GNELane * > lanes
vector with the lanes
std::vector< GNETAZRelData * > TAZRelDatas
vector with the TAZ relation datas
void reserve(int size)
reseve memory for all elements
std::vector< GNECrossing * > crossings
vector with the crossings
std::vector< GNEPoly * > polys
vector with the polys
std::vector< GNETAZ * > TAZs
vector with the TAZ elements
std::vector< GNEAdditional * > additionals
vector with the additional elements
std::vector< GNEAttributeCarrier * > attributeCarriers
vector with the attribute carriers
std::vector< GNENetworkElement * > networkElements
vector with the network elements
std::vector< GNEEdgeData * > edgeDatas
vector with the edge datas
std::vector< GNEEdgeRelData * > edgeRelDatas
vector with the edge relation datas
std::vector< GNEEdge * > edges
vector with the edges
void filterElements(const std::vector< const GUIGlObject * > &objects)
filter elements
std::vector< GNEJunction * > junctions
vector with the junctions
std::vector< GNEWalkingArea * > walkingAreas
vector with the walkingAreas
std::vector< GNEDemandElement * > demandElements
vector with the demand elements
GNEEdgeRelData * getEdgeRelDataElementFront() const
get edge rel data element or a pointer to nullptr
void updateObjects()
update objects (using gViewObjectsHandler)
void filterConnections()
filter (remove) connections
void filterAllExcept(GUIGlObjectType exception)
filter all elements except the given GLO type
GNEEdgeData * getEdgeDataElementFront() const
get edge data element or a pointer to nullptr
void updateShapeElements(ViewObjectsContainer &container, const GUIGlObject *glObject)
update shape elements
GNEConnection * getConnectionFront() const
get front connection or a pointer to nullptr
const std::vector< GNEAttributeCarrier * > & getAttributeCarriers() const
get vector with ACs
void filterEdges()
filter (remove) edges
GNEPoly * getPolyFront() const
get front Poly or a pointer to nullptr
void updateDemandElements(ViewObjectsContainer &container, const GUIGlObject *glObject)
update demand elements
void filterLockedElements(const std::vector< GUIGlObjectType > ignoreFilter={})
filter locked elements (except the ignoreFilter)
void filterCrossings()
filter (remove) crossings
GNEPOI * getPOIFront() const
get front POI or a pointer to nullptr
GNEInternalLane * getInternalLaneFront() const
get front internal lane or a pointer to nullptr
void filterNetworkElements()
filter (remove) network elements
void processGUIGlObjects(const GUIViewObjectsHandler::GLObjectsSortedContainer &objectsContainer)
process GL objects
const std::vector< GNETAZ * > & getTAZs() const
get vector with TAZs
GNEWalkingArea * getWalkingAreaFront() const
get front walkingArea or a pointer to nullptr
void filterBySuperMode()
filter by supermode
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier or a pointer to nullptr
void updateAdditionalElements(ViewObjectsContainer &container, const GUIGlObject *glObject)
update additional elements
void updateGenericDataElements(ViewObjectsContainer &container, const GUIGlObject *glObject)
update generic data elements
void filterDemandElements(const bool includeRoutes)
filter (remove) demand elements
void updateTAZElements(ViewObjectsContainer &container, const GUIGlObject *glObject)
update TAZ elements
const std::vector< GNEDemandElement * > & getDemandElements() const
get vector with Demand Elements
void filterWalkingAreas()
filter (remove) walkingAreas
GNETAZ * getTAZFront() const
get front TAZ or a pointer to nullptr
void filterAdditionals(const bool includeStoppigPlaces, const bool includeTAZs)
filter (remove) additionals
GNELane * getLaneFront() const
get front lane or a pointer to nullptr
void updateNetworkElements(ViewObjectsContainer &container, const GUIGlObject *glObject)
update network elements
GNEGenericData * getGenericDataElementFront() const
get generic data element or a pointer to nullptr
GNEAdditional * getAdditionalFront() const
get front additional element or a pointer to nullptr
GNELane * getLaneFrontNonLocked() const
get front lane or a pointer to nullptr checking if is locked
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
GNENetworkElement * getNetworkElementFront() const
get front network element or a pointer to nullptr
const std::vector< GNEEdge * > & getEdges() const
get vector with edges
GNECrossing * getCrossingFront() const
get front crossing or a pointer to nullptr
GNEJunction * getJunctionFront() const
get front junction or a pointer to nullptr
void filterLanes()
filter (remove) lanes
void filterJunctions()
filter (remove) junctions
GNETAZRelData * getTAZRelDataElementFront() const
get TAZ rel data element or a pointer to nullptr
const std::vector< GUIGlObject * > & getGLObjects() const
get vector with GL objects
void filterShapes()
filter (remove) polys and POIs
const std::vector< GNEJunction * > & getJunctions() const
get vector with junctions
GNEDemandElement * getDemandElementFront() const
get front demand element or a pointer to nullptr
void filterDataElements()
filter (remove) datga elements
const std::vector< GNELane * > & getLanes() const
get lanes
const std::vector< GNEAdditional * > & getAdditionals() const
get vector with additionals
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
virtual bool isGLObjectLocked() const
check if element is locked (Currently used only in netedit)
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
int getNumberOfSelectedObjects() const
get number of selected objects
std::map< double, std::vector< ObjectContainer > > GLObjectsSortedContainer
typedef for pack elements sorted by layer
const GLObjectsSortedContainer & getSelectedObjects() const
get all elements under cursor sorted by layer
ComboBox with icon.
FXbool getCheck() const
Get check state (TRUE, FALSE or MAYBE)
void setCheck(FXbool s=TRUE)
Set check state (TRUE, FALSE or MAYBE)
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition NBEdge.h:783
bool set(const std::string &name, const std::string &value, const bool append=false)
Sets the given value for the named option.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
void resetWritable()
Resets all options to be writeable.
static OptionsCont & getOptions()
Retrieves the options.
C++ TraCI client API implementation.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static const RGBColor BLUE
Definition RGBColor.h:187
static const RGBColor YELLOW
Definition RGBColor.h:188
static const RGBColor MAGENTA
Definition RGBColor.h:190
MFXMenuCheckIcon * menuCheckLockConnections
menu check to lock connections
MFXMenuCheckIcon * menuCheckLockPersonTrip
menu check to lock personTrips
MFXMenuCheckIcon * menuCheckLockPersons
menu check to lock persons
MFXMenuCheckIcon * menuCheckLockVehicles
menu check to lock vehicles
MFXMenuCheckIcon * menuCheckLockCrossings
menu check to lock crossings
MFXMenuCheckIcon * menuCheckLockTAZs
menu check to lock TAZs
MFXMenuCheckIcon * menuCheckLockWalk
menu check to lock walks
MFXMenuCheckIcon * menuCheckLockEdgeTAZRels
menu check to lock edgeTAZRels
MFXMenuCheckIcon * menuCheckLockWires
menu check to lock Wires
MFXMenuCheckIcon * menuCheckLockPOIs
menu check to lock POIs
MFXMenuCheckIcon * menuCheckLockPolygons
menu check to lock polygons
MFXMenuCheckIcon * menuCheckLockWalkingAreas
menu check to lock walkingAreas
MFXMenuCheckIcon * menuCheckLockEdges
menu check to lock edges
MFXMenuCheckIcon * menuCheckLockRides
menu check to lock rides
MFXMenuCheckIcon * menuCheckLockContainers
menu check to lock containers
MFXMenuCheckIcon * menuCheckLockJpsWalkableAreas
menu check to lock jps walkableareas
MFXMenuCheckIcon * menuCheckLockEdgeRelDatas
menu check to lock edgeRelDatas
MFXMenuCheckIcon * menuCheckLockStops
menu check to lock stops
MFXMenuCheckIcon * menuCheckLockLanes
menu check to lock lanes
MFXMenuCheckIcon * menuCheckLockAdditionals
menu check to lock additionals
MFXMenuCheckIcon * menuCheckLockJpsObstacles
menu check to lock jps obstacles
MFXMenuCheckIcon * menuCheckLockTranships
menu check to lock tranships
MFXMenuCheckIcon * menuCheckLockTransports
menu check to lock transports
CommonCheckableButtons(GNEViewNet *viewNet)
default constructor
void buildCommonCheckableButtons()
build checkable buttons
void updateCommonCheckableButtons()
update Common checkable buttons
void disableCommonCheckableButtons()
hide all options menu checks
void hideCommonCheckableButtons()
hide all Common Checkable Buttons
void showCommonCheckableButtons()
show all Common Checkable Buttons
void hideDataCheckableButtons()
hide all Data Checkable Buttons
void showDataCheckableButtons()
show all Data Checkable Buttons
void disableDataCheckableButtons()
hide all options menu checks
void buildDataCheckableButtons()
build checkable buttons
void updateDataCheckableButtons()
update Data checkable buttons
DataCheckableButtons(GNEViewNet *viewNet)
default constructor
DataViewOptions(GNEViewNet *viewNet)
default constructor
bool TAZRelOnlyTo() const
check if toggle TAZRel only to checkbox is enabled
void hideDataViewOptionsMenuChecks()
hide all options menu checks
bool showAdditionals() const
check if additionals has to be drawn
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool TAZRelOnlyFrom() const
check if toggle TAZRel only from checkbox is enabled
bool TAZDrawFill() const
check if toggle TAZ draw fill checkbox is enabled
void buildDataViewOptionsMenuChecks()
build menu checks
void getVisibleDataMenuCommands(std::vector< MFXCheckableButton * > &commands) const
get visible demand menu commands
bool showShapes() const
check if shapes has to be drawn
bool TAZRelDrawing() const
check if toggle TAZRel drawing checkbox is enabled
void hideDemandCheckableButtons()
hide all Demand Checkable Buttons
DemandCheckableButtons(GNEViewNet *viewNet)
default constructor
void buildDemandCheckableButtons()
build checkable buttons
void showDemandCheckableButtons()
show all Demand Checkable Buttons
void updateDemandCheckableButtons()
update Demand checkable buttons
void disableDemandCheckableButtons()
hide all options menu checks
void lockPerson(const GNEDemandElement *person)
lock person
bool showAllPersonPlans() const
check all person plans has to be show
void lockContainer(const GNEDemandElement *container)
lock container
void buildDemandViewOptionsMenuChecks()
build menu checks
const GNEDemandElement * getLockedPerson() const
get locked person
const GNEDemandElement * getLockedContainer() const
get locked container
bool showShapes() const
check if shapes has to be drawn
void hideDemandViewOptionsMenuChecks()
hide all options menu checks
bool showAllContainerPlans() const
check all container plans has to be show
bool drawSpreadVehicles() const
check if vehicles must be drawn spread
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
DemandViewOptions(GNEViewNet *viewNet)
default constructor
bool showOverlappedRoutes() const
show overlapped routes
void getVisibleDemandMenuCommands(std::vector< MFXCheckableButton * > &commands) const
get visible demand menu commands
bool showAllTrips() const
check if trips has to be drawn
void buildSuperModeButtons()
build checkable buttons
bool isDefaultView() const
check if default view is enabled
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
void setDemandEditMode(DemandEditMode demandMode, const bool force=false)
set Demand edit mode
bool isCurrentSupermodeData() const
@check if current supermode is Data
void setView(FXSelector sel)
set view
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
bool isJuPedSimView() const
check if default view is enabled
void setSupermode(Supermode supermode, const bool force)
set supermode
void setNetworkEditMode(NetworkEditMode networkMode, const bool force=false)
set Network edit mode
EditModes(GNEViewNet *viewNet)
constructor
void setDataEditMode(DataEditMode dataMode, const bool force=false)
set Data edit mode
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
EditNetworkElementShapes(GNEViewNet *viewNet)
default constructor
void startEditCustomShape(GNENetworkElement *element)
start edit custom shape
static bool checkDrawing(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const double exaggeration)
check if icon can be drawn
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool altKeyPressed() const
check if ALT is pressed during current event
void update(void *eventData)
update status of MouseButtonKeyPressed during current event
bool mouseRightButtonPressed() const
check if mouse right button is pressed during current event
bool controlKeyPressed() const
check if CONTROL is pressed during current event
bool mouseLeftButtonPressed() const
check if mouse left button is pressed during current event
void moveSelection(const bool mouseLeftButtonPressed)
move selection
void calculateEdgeSelection(const GNEEdge *clickedEdge)
calculate edge selection
const GNEMoveOffset calculateMoveOffset() const
calculate move offset
bool isCurrentlyMovingMultipleElements() const
check if there are moving elements
void finishMoveSelection()
finish moving selection
bool isMovingSelection() const
check if currently there is element being moved
void resetMovingSelectedEdge()
reset flag for moving edge
void calculateJunctionSelection()
calculate junction selection
MoveMultipleElementModul(GNEViewNet *viewNet)
constructor
bool isMovingSelectedEdge() const
flag for moving edge
const GNEMoveOffset calculateMoveOffset() const
calculate offset
MoveSingleElementModul(GNEViewNet *viewNet)
constructor
bool beginMoveSingleElementDemandMode()
begin move single element in Demand mode
void moveSingleElement(const bool mouseLeftButtonPressed)
move single element in Network AND Demand mode
GNEMoveElement * getMovedElement() const
get moved element
bool isCurrentlyMovingSingleElement() const
check if there are moving elements
bool beginMoveSingleElementNetworkMode()
begin move single element in Network mode
bool beginMoveNetworkElementShape()
begin move network elementshape
void finishMoveSingleElement()
finish moving single elements in Network AND Demand mode
void updateNetworkCheckableButtons()
update network checkable buttons
void showNetworkCheckableButtons()
show all Network Checkable Buttons
void buildNetworkCheckableButtons()
build checkable buttons
NetworkCheckableButtons(GNEViewNet *viewNet)
default constructor
void hideNetworkCheckableButtons()
hide all Network Checkable Buttons
void disableNetworkCheckableButtons()
hide all options menu checks
bool showConnections() const
check if select show connections checkbox is enabled
bool drawSpreadVehicles() const
check if vehicles must be drawn spread
bool editingElevation() const
check if we're editing elevation
void getVisibleNetworkMenuCommands(std::vector< MFXCheckableButton * > &commands) const
get visible network menu commands
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool showSubAdditionals() const
check if show sub-additionals
bool selectEdges() const
check if select edges checkbox is enabled
bool showTAZElements() const
check if show TAZ Elements
NetworkViewOptions(GNEViewNet *viewNet)
default constructor
void hideNetworkViewOptionsMenuChecks()
hide all options menu checks
void buildNetworkViewOptionsMenuChecks()
build menu checks
SaveElements(GNEViewNet *viewNet)
default constructor
void setSaveIndividualFiles(bool value)
enable or disable save individual files
void buildSaveElementsButtons()
build save buttons
void finishRectangleSelection()
finish rectangle selection
void drawRectangleSelection(const RGBColor &color) const
draw rectangle selection
void beginRectangleSelection()
begin rectangle selection
void moveRectangleSelection()
move rectangle selection
void processBoundarySelection(const Boundary &boundary)
Process boundary Selection.
void processRectangleSelection()
process rectangle Selection
std::vector< GNEEdge * > processEdgeRectangleSelection()
process rectangle Selection (only limited to Edges)
SelectingArea(GNEViewNet *viewNet)
default constructor
void drawTestingElements(GUIMainWindow *mainWindow)
draw testing element
TestingMode(GNEViewNet *viewNet)
default constructor
void initTestingMode()
init testing mode
void buildTimeFormatButtons()
build time format buttons
TimeFormat(GNEViewNet *viewNet)
default constructor
void switchTimeFormat()
switch time format
void updateButtonLabel()
update button label
void buildVehicleOptionsMenuChecks()
build menu checks
VehicleOptions(GNEViewNet *viewNet)
constructor
void hideVehicleOptionsMenuChecks()
hide all options menu checks
VehicleTypeOptions(GNEViewNet *viewNet)
constructor
void buildVehicleTypeOptionsMenuChecks()
build menu checks
void hideVehicleTypeOptionsMenuChecks()
hide all options menu checks
static std::vector< RGBColor > myRainbowScaledColors
scale (rainbow) colors
static const RGBColor & getRainbowScaledColor(const double min, const double max, const double value)
get rainbow scaled color
static std::vector< GUIGlObject * > filterElementsByLayer(const std::vector< GUIGlObject * > &GLObjects)
filter elements based on the layer
static const std::vector< RGBColor > & getRainbowScaledColors()
get scaled rainbow colors