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::ViewObjectsSelector - methods
219// ---------------------------------------------------------------------------
220
224
225
226void
228 // clear elements
229 myViewObjects.clearElements();
230 // process GUIGLObjects using elements under cursor
231 processGUIGlObjects(gViewObjectsHandler.getSelectedObjects());
232}
233
234
235void
237 // get all edges to filter
238 std::vector<const GUIGlObject*> edges;
239 for (const auto& edge : myViewObjects.edges) {
240 edges.push_back(edge);
241 }
242 myViewObjects.filterElements(edges);
243}
244
245
246void
248 // get all lanes to filter
249 std::vector<const GUIGlObject*> lanes;
250 for (const auto& lane : myViewObjects.lanes) {
251 lanes.push_back(lane);
252 }
253 myViewObjects.filterElements(lanes);
254}
255
256
257void
259 // get all elements to filter
260 std::vector<const GUIGlObject*> shapes;
261 for (const auto& poly : myViewObjects.polys) {
262 shapes.push_back(poly);
263 }
264 for (const auto& POI : myViewObjects.POIs) {
265 shapes.push_back(POI);
266 }
267 myViewObjects.filterElements(shapes);
268}
269
270
271void
272GNEViewNetHelper::ViewObjectsSelector::filterAdditionals(const bool includeStoppigPlaces, const bool includeTAZs) {
273 // get all elements to filter
274 std::vector<const GUIGlObject*> additionals;
275 for (const auto& additional : myViewObjects.additionals) {
276 if (!includeStoppigPlaces && (additional->getType() > GLO_STOPPING_PLACE) && (additional->getType() < GLO_STOPPING_PLACE_LAST)) {
277 continue;
278 } else if (!includeTAZs && (additional->getType() == GLO_TAZ)) {
279 continue;
280 } else {
281 additionals.push_back(additional);
282 }
283 }
284 myViewObjects.filterElements(additionals);
285}
286
287
288void
290 // get all elements to filter
291 std::vector<const GUIGlObject*> demandElements;
292 for (const auto& demandElement : myViewObjects.demandElements) {
293 if (!includeRoutes && (demandElement->getType() == GLO_ROUTE)) {
294 continue;
295 } else {
296 demandElements.push_back(demandElement);
297 }
298 }
299 myViewObjects.filterElements(demandElements);
300}
301
302
303void
304GNEViewNetHelper::ViewObjectsSelector::filterLockedElements(const std::vector<GUIGlObjectType> ignoreFilter) {
305 std::vector<const GUIGlObject*> GUIGlObjects;
306 // get all locked elements
307 for (const auto& GUIGlObject : myViewObjects.GUIGlObjects) {
309 GUIGlObjects.push_back(GUIGlObject);
310 }
311 }
312 // apply ignore filter
313 for (const auto& ignoredType : ignoreFilter) {
314 auto it = GUIGlObjects.begin();
315 while (it != GUIGlObjects.end()) {
316 if ((*it)->getType() == ignoredType) {
317 it = GUIGlObjects.erase(it);
318 } else {
319 it++;
320 }
321 }
322 }
323 // filter objects
324 myViewObjects.filterElements(GUIGlObjects);
325}
326
327
328const GUIGlObject*
330 if (myViewObjects.GUIGlObjects.size() > 0) {
331 return myViewObjects.GUIGlObjects.front();
332 } else {
333 return nullptr;
334 }
335}
336
337
340 if (myViewObjects.attributeCarriers.size() > 0) {
341 return myViewObjects.attributeCarriers.front();
342 } else {
343 return nullptr;
344 }
345}
346
347
350 if (myViewObjects.networkElements.size() > 0) {
351 return myViewObjects.networkElements.front();
352 } else {
353 return nullptr;
354 }
355}
356
357
360 if (myViewObjects.additionals.size() > 0) {
361 return myViewObjects.additionals.front();
362 } else {
363 return nullptr;
364 }
365}
366
367
370 if (myViewObjects.demandElements.size() > 0) {
371 return myViewObjects.demandElements.front();
372 } else {
373 return nullptr;
374 }
375}
376
377
380 if (myViewObjects.genericDatas.size() > 0) {
381 return myViewObjects.genericDatas.front();
382 } else {
383 return nullptr;
384 }
385}
386
387
390 if (myViewObjects.junctions.size() > 0) {
391 return myViewObjects.junctions.front();
392 } else {
393 return nullptr;
394 }
395}
396
397
398GNEEdge*
400 if (myViewObjects.edges.size() > 0) {
401 return myViewObjects.edges.front();
402 } else {
403 return nullptr;
404 }
405}
406
407
408GNELane*
410 if (myViewObjects.lanes.size() > 0) {
411 return myViewObjects.lanes.front();
412 } else {
413 return nullptr;
414 }
415}
416
417
418GNELane*
420 if (myViewObjects.lanes.size() > 0) {
421 for (auto& lane : myViewObjects.lanes) {
422 if (!(lane->isAttributeCarrierSelected() || lane->getParentEdge()->isAttributeCarrierSelected()) ||
423 !myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands().menuCheckLockSelectedElements->getCheck()) {
424 return lane;
425 }
426 }
427 // all locked, then return nullptr
428 return nullptr;
429 } else {
430 return nullptr;
431 }
432}
433
434
435const std::vector<GNELane*>&
437 return myViewObjects.lanes;
438}
439
440
443 if (myViewObjects.crossings.size() > 0) {
444 return myViewObjects.crossings.front();
445 } else {
446 return nullptr;
447 }
448}
449
450
453 if (myViewObjects.walkingAreas.size() > 0) {
454 return myViewObjects.walkingAreas.front();
455 } else {
456 return nullptr;
457 }
458}
459
460
463 if (myViewObjects.connections.size() > 0) {
464 return myViewObjects.connections.front();
465 } else {
466 return nullptr;
467 }
468}
469
470
473 if (myViewObjects.internalLanes.size() > 0) {
474 return myViewObjects.internalLanes.front();
475 } else {
476 return nullptr;
477 }
478}
479
480
481GNEPOI*
483 if (myViewObjects.POIs.size() > 0) {
484 return myViewObjects.POIs.front();
485 } else {
486 return nullptr;
487 }
488}
489
490
491GNEPoly*
493 if (myViewObjects.polys.size() > 0) {
494 return myViewObjects.polys.front();
495 } else {
496 return nullptr;
497 }
498}
499
500
501GNETAZ*
503 if (myViewObjects.TAZs.size() > 0) {
504 return myViewObjects.TAZs.front();
505 } else {
506 return nullptr;
507 }
508}
509
510
513 if (myViewObjects.edgeDatas.size() > 0) {
514 return myViewObjects.edgeDatas.front();
515 } else {
516 return nullptr;
517 }
518}
519
520
523 if (myViewObjects.edgeRelDatas.size() > 0) {
524 return myViewObjects.edgeRelDatas.front();
525 } else {
526 return nullptr;
527 }
528}
529
530
533 if (myViewObjects.TAZRelDatas.size() > 0) {
534 return myViewObjects.TAZRelDatas.front();
535 } else {
536 return nullptr;
537 }
538}
539
540
541const std::vector<GUIGlObject*>&
543 return myViewObjects.GUIGlObjects;
544}
545
546
547const std::vector<GNEAttributeCarrier*>&
549 return myViewObjects.attributeCarriers;
550}
551
552
553const std::vector<GNEJunction*>&
555 return myViewObjects.junctions;
556}
557
558
559const std::vector<GNEEdge*>&
561 return myViewObjects.edges;
562}
563
564const std::vector<GNETAZ*>&
566 return myViewObjects.TAZs;
567}
568
569const std::vector<GNEAdditional*>&
571 return myViewObjects.additionals;
572}
573
574const std::vector<GNEDemandElement*>&
576 return myViewObjects.demandElements;
577}
578
579
581
582
583void
585 // just clear all containers
586 GUIGlObjects.clear();
587 attributeCarriers.clear();
588 networkElements.clear();
589 additionals.clear();
590 demandElements.clear();
591 junctions.clear();
592 edges.clear();
593 lanes.clear();
594 crossings.clear();
595 walkingAreas.clear();
596 connections.clear();
597 internalLanes.clear();
598 TAZs.clear();
599 POIs.clear();
600 polys.clear();
601 genericDatas.clear();
602 edgeDatas.clear();
603 edgeRelDatas.clear();
604 TAZRelDatas.clear();
605}
606
607
608void
610 for (const auto& object : objects) {
611 // remove from GUIGlObjects
612 auto itGlObjects = GUIGlObjects.begin();
613 while (itGlObjects != GUIGlObjects.end()) {
614 if (*itGlObjects == object) {
615 itGlObjects = GUIGlObjects.erase(itGlObjects);
616 } else {
617 itGlObjects++;
618 }
619 }
620 // remove from attributeCarriers
621 auto itACs = attributeCarriers.begin();
622 while (itACs != attributeCarriers.end()) {
623 if ((*itACs)->getGUIGlObject() == object) {
624 itACs = attributeCarriers.erase(itACs);
625 } else {
626 itACs++;
627 }
628 }
629 // remove from networkElements
630 auto itNetworkElements = networkElements.begin();
631 while (itNetworkElements != networkElements.end()) {
632 if ((*itNetworkElements)->getGUIGlObject() == object) {
633 itNetworkElements = networkElements.erase(itNetworkElements);
634 } else {
635 itNetworkElements++;
636 }
637 }
638 // remove from additionals
639 auto itAdditionals = additionals.begin();
640 while (itAdditionals != additionals.end()) {
641 if ((*itAdditionals)->getGUIGlObject() == object) {
642 itAdditionals = additionals.erase(itAdditionals);
643 } else {
644 itAdditionals++;
645 }
646 }
647 // remove from demandElements
648 auto itDemandElements = demandElements.begin();
649 while (itDemandElements != demandElements.end()) {
650 if ((*itDemandElements)->getGUIGlObject() == object) {
651 itDemandElements = demandElements.erase(itDemandElements);
652 } else {
653 itDemandElements++;
654 }
655 }
656 // remove from genericDatas
657 auto itGenericDatas = genericDatas.begin();
658 while (itGenericDatas != genericDatas.end()) {
659 if ((*itGenericDatas)->getGUIGlObject() == object) {
660 itGenericDatas = genericDatas.erase(itGenericDatas);
661 } else {
662 itGenericDatas++;
663 }
664 }
665 // remove from junctions
666 auto itJunctions = junctions.begin();
667 while (itJunctions != junctions.end()) {
668 if ((*itJunctions)->getGUIGlObject() == object) {
669 itJunctions = junctions.erase(itJunctions);
670 } else {
671 itJunctions++;
672 }
673 }
674 // remove from edges
675 auto itEdges = edges.begin();
676 while (itEdges != edges.end()) {
677 if ((*itEdges)->getGUIGlObject() == object) {
678 itEdges = edges.erase(itEdges);
679 } else {
680 itEdges++;
681 }
682 }
683 // remove from lanes
684 auto itLanes = lanes.begin();
685 while (itLanes != lanes.end()) {
686 if ((*itLanes)->getGUIGlObject() == object) {
687 itLanes = lanes.erase(itLanes);
688 } else {
689 itLanes++;
690 }
691 }
692 // remove from crossings
693 auto itCrossings = crossings.begin();
694 while (itCrossings != crossings.end()) {
695 if ((*itCrossings)->getGUIGlObject() == object) {
696 itCrossings = crossings.erase(itCrossings);
697 } else {
698 itCrossings++;
699 }
700 }
701 // remove from walkingAreas
702 auto itWalkingAreas = walkingAreas.begin();
703 while (itWalkingAreas != walkingAreas.end()) {
704 if ((*itWalkingAreas)->getGUIGlObject() == object) {
705 itWalkingAreas = walkingAreas.erase(itWalkingAreas);
706 } else {
707 itWalkingAreas++;
708 }
709 }
710 // remove from connections
711 auto itConnections = connections.begin();
712 while (itConnections != connections.end()) {
713 if ((*itConnections)->getGUIGlObject() == object) {
714 itConnections = connections.erase(itConnections);
715 } else {
716 itConnections++;
717 }
718 }
719 // remove from internalLanes
720 auto itInternalLanes = internalLanes.begin();
721 while (itInternalLanes != internalLanes.end()) {
722 if ((*itInternalLanes)->getGUIGlObject() == object) {
723 itInternalLanes = internalLanes.erase(itInternalLanes);
724 } else {
725 itInternalLanes++;
726 }
727 }
728 // remove from TAZs
729 auto itTAZs = TAZs.begin();
730 while (itTAZs != TAZs.end()) {
731 if ((*itTAZs)->getGUIGlObject() == object) {
732 itTAZs = TAZs.erase(itTAZs);
733 } else {
734 itTAZs++;
735 }
736 }
737 // remove from POIs
738 auto itPOIs = POIs.begin();
739 while (itPOIs != POIs.end()) {
740 if ((*itPOIs)->getGUIGlObject() == object) {
741 itPOIs = POIs.erase(itPOIs);
742 } else {
743 itPOIs++;
744 }
745 }
746 // remove from polys
747 auto itPolys = polys.begin();
748 while (itPolys != polys.end()) {
749 if ((*itPolys)->getGUIGlObject() == object) {
750 itPolys = polys.erase(itPolys);
751 } else {
752 itPolys++;
753 }
754 }
755 // remove from edgeDatas
756 auto itEdgeDatas = edgeDatas.begin();
757 while (itEdgeDatas != edgeDatas.end()) {
758 if ((*itEdgeDatas)->getGUIGlObject() == object) {
759 itEdgeDatas = edgeDatas.erase(itEdgeDatas);
760 } else {
761 itEdgeDatas++;
762 }
763 }
764 // remove from edgeRelDatas
765 auto itEdgeRelDatas = edgeRelDatas.begin();
766 while (itEdgeRelDatas != edgeRelDatas.end()) {
767 if ((*itEdgeRelDatas)->getGUIGlObject() == object) {
768 itEdgeRelDatas = edgeRelDatas.erase(itEdgeRelDatas);
769 } else {
770 itEdgeRelDatas++;
771 }
772 }
773 // remove from TAZRelDatas
774 auto itTAZRelDatas = TAZRelDatas.begin();
775 while (itTAZRelDatas != TAZRelDatas.end()) {
776 if ((*itTAZRelDatas)->getGUIGlObject() == object) {
777 itTAZRelDatas = TAZRelDatas.erase(itTAZRelDatas);
778 } else {
779 itTAZRelDatas++;
780 }
781 }
782 }
783}
784
785
786void
788 // get front AC
789 const auto frontGLObject = myViewNet->getFrontGLObject();
790 // cast specific network element
791 switch (glObject->getType()) {
792 case GLO_JUNCTION: {
793 // get junction
794 auto junction = myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(glObject->getMicrosimID());
795 // check front element
796 if (glObject == frontGLObject) {
797 // insert at front
798 container.junctions.insert(container.junctions.begin(), junction);
799 container.networkElements.insert(container.networkElements.begin(), junction);
800 container.attributeCarriers.insert(container.attributeCarriers.begin(), junction);
801 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), junction);
802 } else {
803 // insert at back
804 container.junctions.push_back(junction);
805 container.networkElements.push_back(junction);
806 container.attributeCarriers.push_back(junction);
807 container.GUIGlObjects.push_back(junction);
808 }
809 break;
810 }
811 case GLO_EDGE: {
812 // get edge
813 auto edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(glObject->getMicrosimID());
814 // check front element
815 if (glObject == frontGLObject) {
816 // insert at front
817 container.edges.insert(container.edges.begin(), edge);
818 container.networkElements.insert(container.networkElements.begin(), edge);
819 container.attributeCarriers.insert(container.attributeCarriers.begin(), edge);
820 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), edge);
821 } else {
822 // insert at back
823 container.edges.push_back(edge);
824 container.networkElements.push_back(edge);
825 container.attributeCarriers.push_back(edge);
826 container.GUIGlObjects.push_back(edge);
827 }
828 break;
829 }
830 case GLO_LANE: {
831 // get lane
832 auto lane = myViewNet->getNet()->getAttributeCarriers()->retrieveLane(glObject);
833 // check front element
834 if (glObject == frontGLObject) {
835 // insert at front
836 container.lanes.insert(container.lanes.begin(), lane);
837 container.networkElements.insert(container.networkElements.begin(), lane);
838 container.attributeCarriers.insert(container.attributeCarriers.begin(), lane);
839 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), lane);
840 } else {
841 // insert at back
842 container.lanes.push_back(lane);
843 container.networkElements.push_back(lane);
844 container.attributeCarriers.push_back(lane);
845 container.GUIGlObjects.push_back(lane);
846 }
847 break;
848 }
849 case GLO_CROSSING: {
850 // get crossing
851 auto crossing = myViewNet->getNet()->getAttributeCarriers()->retrieveCrossing(glObject);
852 // check front element
853 if (glObject == frontGLObject) {
854 // insert at front
855 container.crossings.insert(container.crossings.begin(), crossing);
856 container.networkElements.insert(container.networkElements.begin(), crossing);
857 container.attributeCarriers.insert(container.attributeCarriers.begin(), crossing);
858 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), crossing);
859 } else {
860 // insert at back
861 container.crossings.push_back(crossing);
862 container.networkElements.push_back(crossing);
863 container.attributeCarriers.push_back(crossing);
864 container.GUIGlObjects.push_back(crossing);
865 }
866 break;
867 }
868 case GLO_WALKINGAREA: {
869 // get walkingArea
870 auto walkingArea = myViewNet->getNet()->getAttributeCarriers()->retrieveWalkingArea(glObject);
871 // check front element
872 if (glObject == frontGLObject) {
873 // insert at front
874 container.walkingAreas.insert(container.walkingAreas.begin(), walkingArea);
875 container.networkElements.insert(container.networkElements.begin(), walkingArea);
876 container.attributeCarriers.insert(container.attributeCarriers.begin(), walkingArea);
877 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), walkingArea);
878 } else {
879 // insert at back
880 container.walkingAreas.push_back(walkingArea);
881 container.networkElements.push_back(walkingArea);
882 container.attributeCarriers.push_back(walkingArea);
883 container.GUIGlObjects.push_back(walkingArea);
884 }
885 break;
886 }
887 case GLO_CONNECTION: {
888 // get connection
889 auto connection = myViewNet->getNet()->getAttributeCarriers()->retrieveConnection(glObject);
890 // check front element
891 if (glObject == frontGLObject) {
892 // insert at front
893 container.connections.insert(container.connections.begin(), connection);
894 container.networkElements.insert(container.networkElements.begin(), connection);
895 container.attributeCarriers.insert(container.attributeCarriers.begin(), connection);
896 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), connection);
897 } else {
898 // insert at back
899 container.connections.push_back(connection);
900 container.networkElements.push_back(connection);
901 container.attributeCarriers.push_back(connection);
902 container.GUIGlObjects.push_back(connection);
903 }
904 break;
905 }
906 case GLO_TLLOGIC: {
907 // get internal lane
908 auto internalLane = myViewNet->getNet()->getAttributeCarriers()->retrieveInternalLane(glObject);
909 // check front element
910 if (glObject == frontGLObject) {
911 // insert at front
912 container.internalLanes.insert(container.internalLanes.begin(), internalLane);
913 container.attributeCarriers.insert(container.attributeCarriers.begin(), internalLane);
914 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), internalLane);
915 } else {
916 // insert at back
917 container.internalLanes.push_back(internalLane);
918 container.attributeCarriers.push_back(internalLane);
919 container.GUIGlObjects.push_back(internalLane);
920 }
921 break;
922 }
923 default:
924 break;
925 }
926}
927
928
929void
931 // get additional element
932 auto additionalElement = myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject, false);
933 if (additionalElement) {
934 // insert depending if is the front attribute carrier
935 if (additionalElement == myViewNet->getFrontAttributeCarrier()) {
936 // insert at front
937 container.additionals.insert(container.additionals.begin(), additionalElement);
938 container.attributeCarriers.insert(container.attributeCarriers.begin(), additionalElement);
939 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), additionalElement);
940 } else {
941 // insert at back
942 container.additionals.push_back(additionalElement);
943 container.attributeCarriers.push_back(additionalElement);
944 container.GUIGlObjects.push_back(additionalElement);
945 }
946 }
947}
948
949
950void
952 // cast specific shape
953 if (glObject->getType() == GLO_POI) {
954 // cast POI
955 auto POI = dynamic_cast<GNEPOI*>(myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject));
956 // check front element
957 if (glObject == myViewNet->getFrontGLObject()) {
958 // insert at front
959 container.POIs.insert(container.POIs.begin(), POI);
960 } else {
961 // insert at back
962 container.POIs.push_back(POI);
963 }
964 } else if ((glObject->getType() == GLO_POLYGON) || (glObject->getType() == GLO_JPS_WALKABLEAREA) || (glObject->getType() == GLO_JPS_OBSTACLE)) {
965 // cast poly
966 auto poly = dynamic_cast<GNEPoly*>(myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject));
967 // check front element
968 if (glObject == myViewNet->getFrontGLObject()) {
969 // insert at front
970 container.polys.insert(container.polys.begin(), poly);
971 } else {
972 // insert at back
973 container.polys.push_back(poly);
974 }
975 }
976}
977
978
979void
981 // cast specific TAZ
982 if (glObject->getType() == GLO_TAZ) {
983 // cast TAZ
984 auto TAZ = dynamic_cast<GNETAZ*>(myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(glObject));
985 // check front element
986 if (glObject == myViewNet->getFrontGLObject()) {
987 // insert at front
988 container.TAZs.insert(container.TAZs.begin(), TAZ);
989 } else {
990 // insert at back
991 container.TAZs.push_back(TAZ);
992 }
993 }
994}
995
996
997void
999 // get demandElement
1000 GNEDemandElement* demandElement = myViewNet->getNet()->getAttributeCarriers()->retrieveDemandElement(glObject, false);
1001 if (demandElement) {
1002 // insert depending if is the front attribute carrier
1003 if (demandElement == myViewNet->getFrontAttributeCarrier()) {
1004 // insert at front
1005 container.demandElements.insert(container.demandElements.begin(), demandElement);
1006 container.attributeCarriers.insert(container.attributeCarriers.begin(), demandElement);
1007 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), demandElement);
1008 } else {
1009 // insert at back
1010 container.demandElements.push_back(demandElement);
1011 container.attributeCarriers.push_back(demandElement);
1012 container.GUIGlObjects.push_back(demandElement);
1013 }
1014 }
1015}
1016
1017
1018void
1020 // cast specific generic data
1021 switch (glObject->getType()) {
1022 case GLO_EDGEDATA: {
1023 // cast EdgeData
1024 auto edgeData = dynamic_cast<GNEEdgeData*>(myViewNet->getNet()->getAttributeCarriers()->retrieveGenericData(glObject));
1025 // check front element
1026 if (glObject == myViewNet->getFrontGLObject()) {
1027 // insert at front
1028 container.edgeDatas.insert(container.edgeDatas.begin(), edgeData);
1029 container.genericDatas.insert(container.genericDatas.begin(), edgeData);
1030 container.attributeCarriers.insert(container.attributeCarriers.begin(), edgeData);
1031 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), edgeData);
1032 } else {
1033 // insert at back
1034 container.edgeDatas.push_back(edgeData);
1035 container.genericDatas.push_back(edgeData);
1036 container.attributeCarriers.push_back(edgeData);
1037 container.GUIGlObjects.push_back(edgeData);
1038 }
1039 break;
1040 }
1041 case GLO_EDGERELDATA: {
1042 // cast EdgeData
1043 auto edgeRelData = dynamic_cast<GNEEdgeRelData*>(myViewNet->getNet()->getAttributeCarriers()->retrieveGenericData(glObject));
1044 // check front element
1045 if (glObject == myViewNet->getFrontGLObject()) {
1046 // insert at front
1047 container.edgeRelDatas.insert(container.edgeRelDatas.begin(), edgeRelData);
1048 container.genericDatas.insert(container.genericDatas.begin(), edgeRelData);
1049 container.attributeCarriers.insert(container.attributeCarriers.begin(), edgeRelData);
1050 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), edgeRelData);
1051 } else {
1052 // insert at back
1053 container.edgeRelDatas.push_back(edgeRelData);
1054 container.genericDatas.push_back(edgeRelData);
1055 container.attributeCarriers.push_back(edgeRelData);
1056 container.GUIGlObjects.push_back(edgeRelData);
1057 }
1058 break;
1059 }
1060 case GLO_TAZRELDATA: {
1061 // cast TAZRelData
1062 auto TAZRelData = dynamic_cast<GNETAZRelData*>(myViewNet->getNet()->getAttributeCarriers()->retrieveGenericData(glObject));
1063 // check front element
1064 if (glObject == myViewNet->getFrontGLObject()) {
1065 // insert at front
1066 container.TAZRelDatas.insert(container.TAZRelDatas.begin(), TAZRelData);
1067 container.genericDatas.insert(container.genericDatas.begin(), TAZRelData);
1068 container.attributeCarriers.insert(container.attributeCarriers.begin(), TAZRelData);
1069 container.GUIGlObjects.insert(container.GUIGlObjects.begin(), TAZRelData);
1070 } else {
1071 // insert at back
1072 container.TAZRelDatas.push_back(TAZRelData);
1073 container.genericDatas.push_back(TAZRelData);
1074 container.attributeCarriers.push_back(TAZRelData);
1075 container.GUIGlObjects.push_back(TAZRelData);
1076 }
1077 break;
1078 }
1079 default:
1080 break;
1081 }
1082}
1083
1084
1085void
1087 // iterate over filtered edge objects
1088 for (const auto& glObjectLayer : objectsContainer) {
1089 for (const auto& glObject : glObjectLayer.second) {
1090 // update all elements by categories
1091 updateNetworkElements(myViewObjects, glObject.object);
1092 updateAdditionalElements(myViewObjects, glObject.object);
1093 updateShapeElements(myViewObjects, glObject.object);
1094 updateTAZElements(myViewObjects, glObject.object);
1095 updateDemandElements(myViewObjects, glObject.object);
1096 updateGenericDataElements(myViewObjects, glObject.object);
1097 }
1098 }
1099}
1100
1101
1105
1106// ---------------------------------------------------------------------------
1107// GNEViewNetHelper::MouseButtonKeyPressed - methods
1108// ---------------------------------------------------------------------------
1109
1113
1114
1115void
1117 myEventInfo = (FXEvent*) eventData;
1118}
1119
1120
1121bool
1123 if (myEventInfo) {
1124 return (myEventInfo->state & SHIFTMASK) != 0;
1125 } else {
1126 return false;
1127 }
1128}
1129
1130
1131bool
1133 if (myEventInfo) {
1134 return (myEventInfo->state & CONTROLMASK) != 0;
1135 } else {
1136 return false;
1137 }
1138}
1139
1140
1141bool
1143 if (myEventInfo) {
1144 return (myEventInfo->state & ALTMASK) != 0;
1145 } else {
1146 return false;
1147 }
1148}
1149
1150
1151bool
1153 if (myEventInfo) {
1154 return (myEventInfo->state & LEFTBUTTONMASK) != 0;
1155 } else {
1156 return false;
1157 }
1158}
1159
1160
1161bool
1163 if (myEventInfo) {
1164 return (myEventInfo->state & RIGHTBUTTONMASK) != 0;
1165 } else {
1166 return false;
1167 }
1168}
1169
1170// ---------------------------------------------------------------------------
1171// GNEViewNetHelper::MoveSingleElementValues - methods
1172// ---------------------------------------------------------------------------
1173
1177
1178
1179bool
1181 // first obtain moving reference (common for all)
1182 myRelativeClickedPosition = myViewNet->getPositionInformation();
1183 // get edited element
1184 const GNENetworkElement* editedElement = myViewNet->myEditNetworkElementShapes.getEditedNetworkElement();
1185 // check what type of AC will be moved
1186 if (myViewNet->myViewObjectsSelector.getJunctionFront() && (myViewNet->myViewObjectsSelector.getJunctionFront() == editedElement)) {
1187 // get move operation
1188 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getJunctionFront()->getMoveOperation();
1189 // continue if move operation is valid
1190 if (moveOperation) {
1191 myMoveOperation = moveOperation;
1192 return true;
1193 } else {
1194 return false;
1195 }
1196 } else if (myViewNet->myViewObjectsSelector.getLaneFront() && (myViewNet->myViewObjectsSelector.getLaneFront() == editedElement)) {
1197 // get move operation
1198 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getLaneFront()->getMoveOperation();
1199 // continue if move operation is valid
1200 if (moveOperation) {
1201 myMoveOperation = moveOperation;
1202 return true;
1203 } else {
1204 return false;
1205 }
1206 } else if (myViewNet->myViewObjectsSelector.getCrossingFront() && (myViewNet->myViewObjectsSelector.getCrossingFront() == editedElement)) {
1207 // get move operation
1208 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getCrossingFront()->getMoveOperation();
1209 // continue if move operation is valid
1210 if (moveOperation) {
1211 myMoveOperation = moveOperation;
1212 return true;
1213 } else {
1214 return false;
1215 }
1216 } else if (myViewNet->myViewObjectsSelector.getConnectionFront() && (myViewNet->myViewObjectsSelector.getConnectionFront() == editedElement)) {
1217 // get move operation
1218 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getConnectionFront()->getMoveOperation();
1219 // continue if move operation is valid
1220 if (moveOperation) {
1221 myMoveOperation = moveOperation;
1222 return true;
1223 } else {
1224 return false;
1225 }
1226 } else if (myViewNet->myViewObjectsSelector.getWalkingAreaFront() && (myViewNet->myViewObjectsSelector.getWalkingAreaFront() == editedElement)) {
1227 // get move operation
1228 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getWalkingAreaFront()->getMoveOperation();
1229 // continue if move operation is valid
1230 if (moveOperation) {
1231 myMoveOperation = moveOperation;
1232 return true;
1233 } else {
1234 return false;
1235 }
1236 } else {
1237 // there isn't moved items, then return false
1238 return false;
1239 }
1240}
1241
1242
1243bool
1245 // first obtain moving reference (common for all)
1246 myRelativeClickedPosition = myViewNet->getPositionInformation();
1247 // get front AC
1248 const GNEAttributeCarrier* frontAC = myViewNet->myViewObjectsSelector.getAttributeCarrierFront();
1249 // check what type of AC will be moved
1250 if (myViewNet->myViewObjectsSelector.getPolyFront() && (frontAC == myViewNet->myViewObjectsSelector.getPolyFront())) {
1251 // get move operation
1252 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getPolyFront()->getMoveOperation();
1253 // continue if move operation is valid
1254 if (moveOperation) {
1255 myMoveOperation = moveOperation;
1256 return true;
1257 } else {
1258 return false;
1259 }
1260 } else if (myViewNet->myViewObjectsSelector.getPOIFront() && (frontAC == myViewNet->myViewObjectsSelector.getPOIFront())) {
1261 // get move operation
1262 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getPOIFront()->getMoveOperation();
1263 // continue if move operation is valid
1264 if (moveOperation) {
1265 myMoveOperation = moveOperation;
1266 return true;
1267 } else {
1268 return false;
1269 }
1270 } else if (myViewNet->myViewObjectsSelector.getAdditionalFront() && (frontAC == myViewNet->myViewObjectsSelector.getAdditionalFront())) {
1271 // get move operation
1272 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getAdditionalFront()->getMoveOperation();
1273 // continue if move operation is valid
1274 if (moveOperation) {
1275 myMoveOperation = moveOperation;
1276 return true;
1277 } else {
1278 return false;
1279 }
1280 } else if (myViewNet->myViewObjectsSelector.getJunctionFront() && (frontAC == myViewNet->myViewObjectsSelector.getJunctionFront())) {
1281 // check if over junction there is a geometry point
1282 if (myViewNet->myViewObjectsSelector.getEdgeFront() && (myViewNet->myViewObjectsSelector.getEdgeFront()->clickedOverGeometryPoint(myRelativeClickedPosition))) {
1283 // get move operation
1284 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getEdgeFront()->getMoveOperation();
1285 // continue if move operation is valid
1286 if (moveOperation) {
1287 myMoveOperation = moveOperation;
1288 return true;
1289 } else {
1290 return false;
1291 }
1292 } else {
1293 // get move operation
1294 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getJunctionFront()->getMoveOperation();
1295 // continue if move operation is valid
1296 if (moveOperation) {
1297 myMoveOperation = moveOperation;
1298 return true;
1299 } else {
1300 return false;
1301 }
1302 }
1303 } else if (myViewNet->myViewObjectsSelector.getEdgeFront() && (frontAC == myViewNet->myViewObjectsSelector.getEdgeFront())) {
1304 // calculate Edge movement values (can be entire shape, single geometry points, altitude, etc.)
1305 if (myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1306 // edit end point
1307 myViewNet->myViewObjectsSelector.getEdgeFront()->editEndpoint(myViewNet->getPositionInformation(), myViewNet->myUndoList);
1308 // edge values wasn't calculated, then return false
1309 return false;
1310 } else {
1311 // get move operation
1312 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getEdgeFront()->getMoveOperation();
1313 // continue if move operation is valid
1314 if (moveOperation) {
1315 myMoveOperation = moveOperation;
1316 return true;
1317 } else {
1318 return false;
1319 }
1320 }
1321 } else if (myViewNet->myViewObjectsSelector.getLaneFront() && (frontAC == myViewNet->myViewObjectsSelector.getLaneFront())) {
1322 // get move operation
1323 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getLaneFront()->getMoveOperation();
1324 // continue if move operation is valid
1325 if (moveOperation) {
1326 myMoveOperation = moveOperation;
1327 return true;
1328 } else {
1329 return false;
1330 }
1331 } else {
1332 // there isn't moved items, then return false
1333 return false;
1334 }
1335}
1336
1337
1338bool
1340 // first obtain moving reference (common for all)
1341 myRelativeClickedPosition = myViewNet->getPositionInformation();
1342 // get front AC
1343 const GNEAttributeCarrier* frontAC = myViewNet->myViewObjectsSelector.getAttributeCarrierFront();
1344 // check demand element
1345 if (myViewNet->myViewObjectsSelector.getDemandElementFront() && (frontAC == myViewNet->myViewObjectsSelector.getDemandElementFront())) {
1346 // get move operation
1347 GNEMoveOperation* moveOperation = myViewNet->myViewObjectsSelector.getDemandElementFront()->getMoveOperation();
1348 // continue if move operation is valid
1349 if (moveOperation) {
1350 myMoveOperation = moveOperation;
1351 return true;
1352 } else {
1353 return false;
1354 }
1355
1356 } else {
1357 // there isn't moved items, then return false
1358 return false;
1359 }
1360}
1361
1362
1363void
1365 if (myMoveOperation) {
1366 // calculate moveOffset
1367 const GNEMoveOffset moveOffset = calculateMoveOffset();
1368 // check if mouse button is pressed
1369 if (mouseLeftButtonPressed) {
1370 // move elements
1371 GNEMoveElement::moveElement(myViewNet, myMoveOperation, moveOffset);
1372 } else {
1373 // commit move
1374 GNEMoveElement::commitMove(myViewNet, myMoveOperation, moveOffset, myViewNet->getUndoList());
1375 // don't forget delete move operation
1376 delete myMoveOperation;
1377 myMoveOperation = nullptr;
1378 }
1379 }
1380}
1381
1382
1383void
1385 if (myMoveOperation) {
1386 // calculate moveOffset
1387 const GNEMoveOffset moveOffset = calculateMoveOffset();
1388 GNEMoveElement::commitMove(myViewNet, myMoveOperation, moveOffset, myViewNet->getUndoList());
1389 // don't forget delete move operation
1390 delete myMoveOperation;
1391 myMoveOperation = nullptr;
1392 }
1393}
1394
1395
1396bool
1398 return myMoveOperation != nullptr;
1399}
1400
1401
1404 if (myMoveOperation) {
1405 return myMoveOperation->moveElement;
1406 } else {
1407 return nullptr;
1408 }
1409}
1410
1411
1412const GNEMoveOffset
1414 // calculate moveOffset depending of current mouse position and relative clicked position
1415 // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1416 Position moveOffset = (myViewNet->getPositionInformation() - myViewNet->myMoveSingleElement.myRelativeClickedPosition);
1417 // calculate Z depending of moveElevation
1418 if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1419 // use Y as Z value and return Z move offset
1420 return GNEMoveOffset(moveOffset.y());
1421 } else {
1422 // return X-Y move offset
1423 return GNEMoveOffset(moveOffset.x(), moveOffset.y());
1424 }
1425}
1426
1427// ---------------------------------------------------------------------------
1428// GNEViewNetHelper::MoveMultipleElementValues - methods
1429// ---------------------------------------------------------------------------
1430
1432 myViewNet(viewNet),
1433 myMovingSelectedEdge(false),
1434 myEdgeOffset(0) {
1435}
1436
1437
1438void
1440 // save clicked position (to calculate offset)
1441 myClickedPosition = myViewNet->getPositionInformation();
1442 // continue depending of clicked element
1443 if (myViewNet->myViewObjectsSelector.getJunctionFront()) {
1444 calculateJunctionSelection();
1445 } else if (myViewNet->myViewObjectsSelector.getEdgeFront()) {
1446 calculateEdgeSelection(myViewNet->myViewObjectsSelector.getEdgeFront());
1447 }
1448 myViewNet->updateViewNet();
1449}
1450
1451
1452void
1454 // calculate moveOffset
1455 const GNEMoveOffset moveOffset = calculateMoveOffset();
1456 // check if mouse button is pressed
1457 if (mouseLeftButtonPressed) {
1458 // iterate over all operations
1459 for (const auto& moveOperation : myMoveOperations) {
1460 // move elements
1461 GNEMoveElement::moveElement(myViewNet, moveOperation, moveOffset);
1462 }
1463 } else if (myMoveOperations.size() > 0) {
1464 // begin undo list
1465 myViewNet->getUndoList()->begin(GUIIcon::MODEMOVE, TL("moving selection"));
1466 // iterate over all operations
1467 for (const auto& moveOperation : myMoveOperations) {
1468 // commit move
1469 GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1470 // don't forget delete move operation
1471 delete moveOperation;
1472 }
1473 // end undo list
1474 myViewNet->getUndoList()->end();
1475 // clear move operations
1476 myMoveOperations.clear();
1477 }
1478}
1479
1480
1481void
1483 // calculate moveOffset
1484 const GNEMoveOffset moveOffset = calculateMoveOffset();
1485 // begin undo list
1486 myViewNet->getUndoList()->begin(GUIIcon::MODEMOVE, TL("moving selection"));
1487 // finish all move operations
1488 for (const auto& moveOperation : myMoveOperations) {
1489 GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1490 // don't forget delete move operation
1491 delete moveOperation;
1492 }
1493 // end undo list
1494 myViewNet->getUndoList()->end();
1495 // clear move operations
1496 myMoveOperations.clear();
1497}
1498
1499
1500bool
1502 return (myMoveOperations.size() > 0);
1503}
1504
1505
1506bool
1508 return myMovingSelectedEdge;
1509}
1510
1511
1512void
1516
1517
1518double
1520 return myEdgeOffset;
1521}
1522
1523
1524bool
1526 return myMoveOperations.size() > 0;
1527}
1528
1529
1530const GNEMoveOffset
1532 // calculate moveOffset depending of current mouse position and relative clicked position
1533 // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1534 Position moveOffset = (myViewNet->getPositionInformation() - myClickedPosition);
1535 // calculate Z depending of moveElevation
1536 if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1537 // use Y for Z and return X move offset
1538 return GNEMoveOffset(moveOffset.y());
1539 } else {
1540 // return X-Y move offset
1541 return GNEMoveOffset(moveOffset.x(), moveOffset.y());
1542 }
1543}
1544
1545
1546void
1548 // declare move operation
1549 GNEMoveOperation* moveOperation = nullptr;
1550 // first move all selected junctions
1551 const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
1552 // iterate over selected junctions
1553 for (const auto& junction : selectedJunctions) {
1554 moveOperation = junction->getMoveOperation();
1555 if (moveOperation) {
1556 myMoveOperations.push_back(moveOperation);
1557 }
1558 }
1559 // now move all selected edges
1560 const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
1561 // iterate over selected edges
1562 for (const auto& edge : selectedEdges) {
1563 moveOperation = edge->getMoveOperation();
1564 if (moveOperation) {
1565 myMoveOperations.push_back(moveOperation);
1566 }
1567 }
1568}
1569
1570
1571void
1573 // first move all selected junctions
1574 const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
1575 // iterate over selected junctions
1576 for (const auto& junction : selectedJunctions) {
1577 GNEMoveOperation* moveOperation = junction->getMoveOperation();
1578 if (moveOperation) {
1579 myMoveOperations.push_back(moveOperation);
1580 }
1581 }
1582 // enable moving selected edge flag
1583 myMovingSelectedEdge = true;
1584 // get edge shape
1585 const auto& shape = clickedEdge->getNBEdge()->getGeometry();
1586 // calculate offset based on the clicked edge shape and convex angle
1587 if (clickedEdge->isConvexAngle()) {
1588 myEdgeOffset = shape.nearest_offset_to_point2D(myViewNet->getPositionInformation());
1589 } else {
1590 myEdgeOffset = shape.length2D() - shape.nearest_offset_to_point2D(myViewNet->getPositionInformation());
1591 }
1592 // now move all selected edges
1593 const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
1594 // iterate over edges between 0 and 180 degrees
1595 for (const auto& edge : selectedEdges) {
1596 GNEMoveOperation* moveOperation = edge->getMoveOperation();
1597 // continue if move operation is valid
1598 if (moveOperation) {
1599 myMoveOperations.push_back(moveOperation);
1600 }
1601 }
1602}
1603
1604// ---------------------------------------------------------------------------
1605// GNEViewNetHelper::VehicleOptions - methods
1606// ---------------------------------------------------------------------------
1607
1609 myViewNet(viewNet) {
1610}
1611
1612
1613void
1618
1619
1620void
1624
1625// ---------------------------------------------------------------------------
1626// GNEViewNetHelper::VehicleTypeOptions - methods
1627// ---------------------------------------------------------------------------
1628
1632
1633
1634void
1639
1640
1641void
1645
1646// ---------------------------------------------------------------------------
1647// GNEViewNetHelper::SelectingArea - methods
1648// ---------------------------------------------------------------------------
1649
1651 selectingUsingRectangle(false),
1652 startDrawing(false),
1653 myViewNet(viewNet) {
1654}
1655
1656
1657void
1659 selectingUsingRectangle = true;
1660 selectionCorner1 = myViewNet->getPositionInformation();
1661 selectionCorner2 = selectionCorner1;
1662}
1663
1664
1665void
1667 // start drawing
1668 startDrawing = true;
1669 // only update selection corner 2
1670 selectionCorner2 = myViewNet->getPositionInformation();
1671 // update status bar
1672 myViewNet->setStatusBarText(TL("Selection width:") + toString(fabs(selectionCorner1.x() - selectionCorner2.x()))
1673 + TL(" height:") + toString(fabs(selectionCorner1.y() - selectionCorner2.y()))
1674 + TL(" diagonal:") + toString(selectionCorner1.distanceTo2D(selectionCorner2)));
1675}
1676
1677
1678void
1680 // finish rectangle selection
1681 selectingUsingRectangle = false;
1682 startDrawing = false;
1683 // clear status bar
1684 myViewNet->setStatusBarText("");
1685}
1686
1687
1688void
1690 // shift held down on mouse-down and mouse-up and check that rectangle exist
1691 if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1692 (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1693 myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1694 // create boundary between two corners
1695 Boundary rectangleBoundary;
1696 rectangleBoundary.add(selectionCorner1);
1697 rectangleBoundary.add(selectionCorner2);
1698 // process selection within boundary
1699 processBoundarySelection(rectangleBoundary);
1700 }
1701}
1702
1703
1704std::vector<GNEEdge*>
1706 // shift held down on mouse-down and mouse-up and check that rectangle exist
1707 if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1708 (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1709 myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1710 // create boundary between two corners
1711 Boundary rectangleBoundary;
1712 rectangleBoundary.add(selectionCorner1);
1713 rectangleBoundary.add(selectionCorner2);
1714 // obtain all elements in boundary
1715 myViewNet->updateObjectsInBoundary(rectangleBoundary);
1716 // return all edges
1717 return myViewNet->getViewObjectsSelector().getEdges();
1718 } else {
1719 return {};
1720 }
1721}
1722
1723
1724void
1726 if (selectingUsingRectangle) {
1728 glTranslated(0, 0, GLO_RECTANGLESELECTION);
1729 GLHelper::setColor(color);
1730 glLineWidth(2);
1731 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1732 glBegin(GL_QUADS);
1733 glVertex2d(selectionCorner1.x(), selectionCorner1.y());
1734 glVertex2d(selectionCorner1.x(), selectionCorner2.y());
1735 glVertex2d(selectionCorner2.x(), selectionCorner2.y());
1736 glVertex2d(selectionCorner2.x(), selectionCorner1.y());
1737 glEnd();
1739 }
1740}
1741
1742
1743void
1745 const bool selEdges = myViewNet->myNetworkViewOptions.selectEdges();
1746 // obtain all elements in boundary
1747 myViewNet->updateObjectsInBoundary(boundary);
1748 // filter ACsInBoundary depending of current supermode
1749 std::set<GNEAttributeCarrier*> ACsFiltered;
1750 for (const auto& AC : myViewNet->getViewObjectsSelector().getAttributeCarriers()) {
1751 if (!AC->getGUIGlObject()->isGLObjectLocked()) {
1752 if (myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
1753 if (AC->getTagProperty().isNetworkElement() || AC->getTagProperty().isAdditionalElement()) {
1754 if ((AC->getTagProperty().getTag() == SUMO_TAG_EDGE && !selEdges)
1755 || (AC->getTagProperty().getTag() == SUMO_TAG_LANE && selEdges)) {
1756 continue;
1757 }
1758 ACsFiltered.insert(AC);
1759 }
1760 } else if (myViewNet->myEditModes.isCurrentSupermodeDemand() && AC->getTagProperty().isDemandElement()) {
1761 ACsFiltered.insert(AC);
1762 } else if (myViewNet->myEditModes.isCurrentSupermodeData() && AC->getTagProperty().isGenericData()) {
1763 ACsFiltered.insert(AC);
1764 }
1765 }
1766 }
1767 // declare two sets of attribute carriers, one for select and another for unselect
1768 std::vector<GNEAttributeCarrier*> ACToSelect;
1769 std::vector<GNEAttributeCarrier*> ACToUnselect;
1770 // reserve memory (we assume that in the worst case we're going to insert all elements of ACsInBoundaryFiltered
1771 ACToSelect.reserve(ACsFiltered.size());
1772 ACToUnselect.reserve(ACsFiltered.size());
1773 // in restrict AND replace mode all current selected attribute carriers will be unselected
1774 if ((myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::RESTRICT) ||
1775 (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::REPLACE)) {
1776 // obtain selected ACs depending of current supermode
1777 const auto selectedAC = myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(false);
1778 // add id into ACs to unselect
1779 for (const auto& AC : selectedAC) {
1780 ACToUnselect.push_back(AC);
1781 }
1782 }
1783 // iterate over AttributeCarriers obtained of boundary an place it in ACToSelect or ACToUnselect
1784 for (const auto& AC : ACsFiltered) {
1785 switch (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode()) {
1787 ACToUnselect.push_back(AC);
1788 break;
1790 if (std::find(ACToUnselect.begin(), ACToUnselect.end(), AC) != ACToUnselect.end()) {
1791 ACToSelect.push_back(AC);
1792 }
1793 break;
1794 default:
1795 ACToSelect.push_back(AC);
1796 break;
1797 }
1798 }
1799 // select junctions and their connections and crossings if Auto select junctions is enabled (note: only for "add mode")
1800 if (myViewNet->autoSelectNodes() && (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::ADD)) {
1801 std::vector<GNEEdge*> edgesToSelect;
1802 // iterate over ACToSelect and extract edges
1803 for (const auto& AC : ACToSelect) {
1804 if (AC->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1805 edgesToSelect.push_back(dynamic_cast<GNEEdge*>(AC));
1806 }
1807 }
1808 // iterate over extracted edges
1809 for (const auto& edge : edgesToSelect) {
1810 // select junction source and all their connections and crossings
1811 ACToSelect.push_back(edge->getFromJunction());
1812 for (const auto& connection : edge->getFromJunction()->getGNEConnections()) {
1813 ACToSelect.push_back(connection);
1814 }
1815 for (const auto& crossing : edge->getFromJunction()->getGNECrossings()) {
1816 ACToSelect.push_back(crossing);
1817 }
1818 // select junction destination and all their connections crossings
1819 ACToSelect.push_back(edge->getToJunction());
1820 for (const auto& connection : edge->getToJunction()->getGNEConnections()) {
1821 ACToSelect.push_back(connection);
1822 }
1823 for (const auto& crossing : edge->getToJunction()->getGNECrossings()) {
1824 ACToSelect.push_back(crossing);
1825 }
1826 }
1827 }
1828 // only continue if there is ACs to select or unselect
1829 if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
1830 // first unselect AC of ACToUnselect and then selects AC of ACToSelect
1831 myViewNet->myUndoList->begin(GUIIcon::MODESELECT, TL("selection using rectangle"));
1832 for (const auto& AC : ACToUnselect) {
1833 AC->setAttribute(GNE_ATTR_SELECTED, "0", myViewNet->myUndoList);
1834 }
1835 for (const auto& AC : ACToSelect) {
1836 if (AC->getTagProperty().isSelectable()) {
1837 AC->setAttribute(GNE_ATTR_SELECTED, "1", myViewNet->myUndoList);
1838 }
1839 }
1840 myViewNet->myUndoList->end();
1841 }
1842 myViewNet->makeNonCurrent();
1843}
1844
1845// ---------------------------------------------------------------------------
1846// GNEViewNetHelper::TestingMode - methods
1847// ---------------------------------------------------------------------------
1848
1850 myViewNet(viewNet) {
1851}
1852
1853
1854void
1856 // first check if testing mode is enabled and window size is correct
1857 if (OptionsCont::getOptions().getBool("gui-testing") && OptionsCont::getOptions().isSet("window-size")) {
1858 std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
1859 // make sure that given windows size has exactly two valid int values
1860 if ((windowSize.size() == 2) && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
1861 myTestingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
1862 myTestingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
1863 } else {
1864 WRITE_ERRORF(TL("Invalid windows size-format: %for option 'window-size'"), toString(windowSize));
1865 }
1866 }
1867}
1868
1869
1870void
1872 // first check if testing mode is enabled
1873 if (OptionsCont::getOptions().getBool("gui-testing")) {
1874 // check if main windows has to be resized
1875 if (myTestingWidth > 0) {
1876 mainWindow->resize(myTestingWidth, myTestingHeight);
1877 }
1878 //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
1879 // draw pink square in the upper left corner on top of everything
1880 const double size = myViewNet->p2m(32);
1881 Position center = myViewNet->screenPos2NetPos(8, 8);
1882 // magenta
1885 glTranslated(center.x(), center.y(), GLO_TESTELEMENT);
1886 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1887 glBegin(GL_QUADS);
1888 glVertex2d(0, 0);
1889 glVertex2d(0, -size);
1890 glVertex2d(size, -size);
1891 glVertex2d(size, 0);
1892 glEnd();
1894 // blue
1897 glTranslated(center.x(), center.y(), GLO_TESTELEMENT + 1);
1898 glScaled(0.7, 0.7, 0);
1899 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1900 glBegin(GL_QUADS);
1901 glVertex2d(0, 0);
1902 glVertex2d(0, -size);
1903 glVertex2d(size, -size);
1904 glVertex2d(size, 0);
1905 glEnd();
1907 // yellow
1910 glTranslated(center.x(), center.y(), GLO_TESTELEMENT + 2);
1911 glScaled(0.4, 0.4, 0);
1912 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1913 glBegin(GL_QUADS);
1914 glVertex2d(0, 0);
1915 glVertex2d(0, -size);
1916 glVertex2d(size, -size);
1917 glVertex2d(size, 0);
1918 glEnd();
1920 }
1921}
1922
1923// ---------------------------------------------------------------------------
1924// GNEViewNetHelper::SaveElements - methods
1925// ---------------------------------------------------------------------------
1926
1928 myViewNet(viewNet) {
1929}
1930
1931
1933 delete mySaveIndividualFilesPopup;
1934}
1935
1936
1937void
1939 // get save element grip
1940 auto gripSaveElements = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements;
1941 // get tooltip menu
1942 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
1943 // create save sumo config button
1944 mySaveNeteditConfig = new MFXButtonTooltip(gripSaveElements, tooltipMenu,
1945 std::string("\t") + TL("Save Netedit Config") + std::string("\t") + TL("Save Netedit Config. (Ctrl+Shift+E)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_NETEDITCONFIG),
1946 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_E_SAVENETEDITCONFIG, GUIDesignButtonToolbar);
1947 mySaveNeteditConfig->create();
1948 // create save sumo config button
1949 mySaveSumoConfig = new MFXButtonTooltip(gripSaveElements, tooltipMenu,
1950 std::string("\t") + TL("Save Sumo Config") + std::string("\t") + TL("Save Sumo Config. (Ctrl+Shift+S)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_SUMOCONFIG),
1951 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_S_SAVESUMOCONFIG, GUIDesignButtonToolbar);
1952 mySaveSumoConfig->create();
1953 // create save network button
1954 mySaveNetwork = new MFXButtonTooltip(gripSaveElements, tooltipMenu,
1955 std::string("\t") + TL("Save network") + std::string("\t") + TL("Save network. (Ctrl+S)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_NETWORKELEMENTS),
1956 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK, GUIDesignButtonToolbar);
1957 mySaveNetwork->create();
1958 // create popup for save individual files
1959 mySaveIndividualFilesPopup = new FXPopup(gripSaveElements, POPUP_VERTICAL);
1960 mySaveIndividualFilesPopup->create();
1961 // create save individual files button
1962 mySaveIndividualFiles = new MFXMenuButtonTooltip(gripSaveElements, tooltipMenu,
1963 std::string("\t") + TL("Save individual files") + std::string("\t") + TL("Save individual files."),
1964 GUIIconSubSys::getIcon(GUIIcon::SAVE_MULTIPLE), mySaveIndividualFilesPopup, nullptr, GUIDesignButtonToolbarLocator);
1965 mySaveIndividualFiles->create();
1966 // create save additional elements button
1967 mySaveAdditionalElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
1968 std::string("\t") + TL("Save additional elements") + std::string("\t") + TL("Save additional elements. (Ctrl+Shift+A)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_ADDITIONALELEMENTS),
1969 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_A_SAVEADDITIONALS, GUIDesignButtonPopup);
1970 mySaveAdditionalElements->create();
1971 // create save demand elements button
1972 mySaveDemandElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
1973 std::string("\t") + TL("Save demand elements") + std::string("\t") + TL("Save demand elements. (Ctrl+Shift+D)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_DEMANDELEMENTS),
1974 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS, GUIDesignButtonPopup);
1975 mySaveDemandElements->create();
1976 // create save data elements button
1977 mySaveDataElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
1978 std::string("\t") + TL("Save data elements") + std::string("\t") + TL("Save data elements. (Ctrl+Shift+B)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_DATAELEMENTS),
1979 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS, GUIDesignButtonPopup);
1980 mySaveDataElements->create();
1981 // create save mean datas elements button
1982 mySaveMeanDataElements = new MFXButtonTooltip(mySaveIndividualFilesPopup, tooltipMenu,
1983 std::string("\t") + TL("Save mean data elements") + std::string("\t") + TL("Save mean data elements. (Ctrl+Shift+M)"), GUIIconSubSys::getIcon(GUIIcon::SAVE_MEANDATAELEMENTS),
1984 myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_M_SAVEMEANDATAS, GUIDesignButtonPopup);
1985 mySaveMeanDataElements->create();
1986 // recalc menu bar because there is new elements
1987 gripSaveElements->recalc();
1988 // show menu bar modes
1989 gripSaveElements->show();
1990}
1991
1992
1993void
1995 if (value) {
1996 mySaveIndividualFiles->enable();
1997 } else {
1998 mySaveIndividualFiles->disable();
1999 }
2000}
2001
2002// ---------------------------------------------------------------------------
2003// GNEViewNetHelper::TimeFormat - methods
2004// ---------------------------------------------------------------------------
2005
2007 myViewNet(viewNet) {
2008}
2009
2010
2011void
2013 // create save sumo config button
2014 mySwitchButton = new MFXButtonTooltip(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().timeSwitch,
2015 myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu(),
2016 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,
2017 myViewNet->getViewParent()->getGNEAppWindows(), MID_GNE_TOGGLE_TIMEFORMAT, GUIDesignButtonToolbar);
2018 mySwitchButton->create();
2019}
2020
2021
2022void
2032
2033
2034void
2036 if (gHumanReadableTime) {
2037 mySwitchButton->setText("H");
2038 } else {
2039 mySwitchButton->setText("S");
2040 }
2041}
2042
2043// ---------------------------------------------------------------------------
2044// GNEViewNetHelper::EditModes - methods
2045// ---------------------------------------------------------------------------
2046
2048 currentSupermode(Supermode::NETWORK),
2049 networkEditMode(NetworkEditMode::NETWORK_INSPECT),
2050 demandEditMode(DemandEditMode::DEMAND_INSPECT),
2051 dataEditMode(DataEditMode::DATA_INSPECT),
2052 myViewNet(viewNet) {
2053 auto& neteditOptions = OptionsCont::getOptions();
2054 // if new option is enabled, start in create edge mode
2055 if (neteditOptions.getBool("new")) {
2057 neteditOptions.resetWritable();
2058 neteditOptions.set("new", "false");
2059 }
2060}
2061
2062
2064 delete myNeteditViewsPopup;
2065}
2066
2067
2068void
2070 // grip supermodes
2071 auto gripSupermodes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes;
2072 // static toolTip menu
2073 auto toolTipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2074 // create network button
2075 networkButton = new MFXCheckableButton(false, gripSupermodes, toolTipMenu,
2076 TL("Network") + std::string("\t") + TL("Edit network elements") + std::string("\t") + TL("Set mode for editing network elements. (F2)"),
2078 networkButton->create();
2079 // create demand button
2080 demandButton = new MFXCheckableButton(false, gripSupermodes, toolTipMenu,
2081 TL("Demand") + std::string("\t") + TL("Edit traffic demand elements") + std::string("\t") + TL("Set mode for editing traffic demand. (F3)"),
2083 demandButton->create();
2084 // create data button
2085 dataButton = new MFXCheckableButton(false, gripSupermodes, toolTipMenu,
2086 TL("Data") + std::string("\t") + TL("Edit data elements") + std::string("\t") + TL("Set mode for editing data demand. (F4)"),
2088 dataButton->create();
2089 // build the views popup
2090 myNeteditViewsPopup = new FXPopup(gripSupermodes, POPUP_VERTICAL);
2091 myNeteditViewsPopup->create();
2092 // build views button
2093 myNeteditViewsButton = new MFXMenuButtonTooltip(gripSupermodes, toolTipMenu,
2094 (std::string("\t") + TL("Change netedit view") + std::string("\t") + TL("Change netedit view.")).c_str(),
2096 myNeteditViewsButton->create();
2097 // build default view button
2098 myDefaultViewButton = new MFXButtonTooltip(myNeteditViewsPopup, toolTipMenu,
2099 (std::string("Default\t") + TL("Set default view") + std::string("\t") + TL("Set default view.")).c_str(),
2101 myDefaultViewButton->create();
2102 // build jupedsim view button
2103 myJuPedSimViewButton = new MFXButtonTooltip(myNeteditViewsPopup, toolTipMenu,
2104 (std::string("JuPedSim\t") + TL("Set JuPedSim view") + std::string("\t") + TL("Set JuPedSim view.")).c_str(),
2106 myJuPedSimViewButton->create();
2107 myNeteditViewsPopup->recalc();
2108 // set width (grip + 3 large buttons + icon button)
2109 gripSupermodes->setWidth(353);
2110 // show menu bar modes
2111 gripSupermodes->show();
2112}
2113
2114
2115void
2117 if (!force && (supermode == currentSupermode)) {
2118 myViewNet->setStatusBarText(TL("Mode already selected"));
2119 if (myViewNet->myCurrentFrame != nullptr) {
2120 myViewNet->myCurrentFrame->focusUpperElement();
2121 }
2122 } else {
2123 myViewNet->setStatusBarText("");
2124 // abort current operation
2125 myViewNet->abortOperation(false);
2126 // set super mode
2127 currentSupermode = supermode;
2128 // set supermodes
2129 if (supermode == Supermode::NETWORK) {
2130 // change buttons
2131 networkButton->setChecked(true);
2132 demandButton->setChecked(false);
2133 dataButton->setChecked(false);
2134 // show network buttons
2135 myViewNet->myNetworkCheckableButtons.showNetworkCheckableButtons();
2136 // hide demand buttons
2137 myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
2138 // hide data buttons
2139 myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
2140 // force update network mode
2141 setNetworkEditMode(networkEditMode, true);
2142 } else if (supermode == Supermode::DEMAND) {
2143 // change buttons
2144 networkButton->setChecked(false);
2145 demandButton->setChecked(true);
2146 dataButton->setChecked(false);
2147 // hide network buttons
2148 myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
2149 // show demand buttons
2150 myViewNet->myDemandCheckableButtons.showDemandCheckableButtons();
2151 // hide data buttons
2152 myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
2153 // force update demand mode
2154 setDemandEditMode(demandEditMode, true);
2155 // demand modes require ALWAYS a recomputing
2156 myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
2157 // check if update path calculator
2158 if (!myViewNet->myNet->getDemandPathManager()->getPathCalculator()->isPathCalculatorUpdated()) {
2159 // update path calculator of demand path manager
2160 myViewNet->myNet->getDemandPathManager()->getPathCalculator()->updatePathCalculator();
2161 // compute all demand elements
2162 myViewNet->myNet->computeDemandElements(myViewNet->myViewParent->getGNEAppWindows());
2163 }
2164 } else if (supermode == Supermode::DATA) {
2165 // change buttons
2166 networkButton->setChecked(false);
2167 demandButton->setChecked(false);
2168 dataButton->setChecked(true);
2169 // hide network buttons
2170 myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
2171 // hide demand buttons
2172 myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
2173 // show data buttons
2174 myViewNet->myDataCheckableButtons.showDataCheckableButtons();
2175 // force update data mode
2176 setDataEditMode(dataEditMode, true);
2177 // check if recompute
2178 if (myViewNet->getViewParent()->getGNEAppWindows()->getProcessingMenuCommands().menuCheckRecomputeDataMode->getCheck() == TRUE) {
2179 // demand modes require ALWAYS a recomputing
2180 myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
2181 }
2182 // check if update path calculator
2183 if (!myViewNet->myNet->getNetworkPathManager()->getPathCalculator()->isPathCalculatorUpdated()) {
2184 // compute all data elements
2185 myViewNet->myNet->computeDataElements(myViewNet->myViewParent->getGNEAppWindows());
2186 }
2187 // reset TAZ contours (due filling)
2188 for (const auto& TAZ : myViewNet->getNet()->getAttributeCarriers()->getAdditionals().at(SUMO_TAG_TAZ)) {
2189 TAZ.second->resetAdditionalContour();
2190 }
2191 }
2192 // update buttons
2193 networkButton->update();
2194 demandButton->update();
2195 dataButton->update();
2196 // update Supermode CommandButtons in GNEAppWindows
2197 myViewNet->myViewParent->getGNEAppWindows()->updateSuperModeMenuCommands(currentSupermode);
2198 }
2199}
2200
2201
2202void
2204 if ((mode == networkEditMode) && !force) {
2205 myViewNet->setStatusBarText(TL("Network mode already selected"));
2206 if (myViewNet->myCurrentFrame != nullptr) {
2207 myViewNet->myCurrentFrame->focusUpperElement();
2208 }
2209 } else if (networkEditMode == NetworkEditMode::NETWORK_TLS && !myViewNet->myViewParent->getTLSEditorFrame()->isTLSSaved()) {
2210 myViewNet->setStatusBarText(TL("Save modifications in TLS before change mode"));
2211 myViewNet->myCurrentFrame->focusUpperElement();
2212 } else {
2213 myViewNet->setStatusBarText("");
2214 myViewNet->abortOperation(false);
2215 // stop editing of custom shapes
2216 myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
2217 // set new Network mode
2218 networkEditMode = mode;
2219 // for common modes (Inspect/Delete/Select/move) change also the other supermode
2220 if (networkEditMode == NetworkEditMode::NETWORK_INSPECT) {
2221 demandEditMode = DemandEditMode::DEMAND_INSPECT;
2222 dataEditMode = DataEditMode::DATA_INSPECT;
2223 } else if (networkEditMode == NetworkEditMode::NETWORK_DELETE) {
2224 demandEditMode = DemandEditMode::DEMAND_DELETE;
2225 dataEditMode = DataEditMode::DATA_DELETE;
2226 } else if (networkEditMode == NetworkEditMode::NETWORK_SELECT) {
2227 demandEditMode = DemandEditMode::DEMAND_SELECT;
2228 dataEditMode = DataEditMode::DATA_SELECT;
2229 } else if (networkEditMode == NetworkEditMode::NETWORK_MOVE) {
2230 demandEditMode = DemandEditMode::DEMAND_MOVE;
2231 }
2232 // certain modes require a recomputing
2233 switch (mode) {
2238 // modes which depend on computed data
2239 myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
2240 break;
2241 default:
2242 break;
2243 }
2244 // update cursors
2245 myViewNet->updateCursor();
2246 // update network mode specific controls
2247 myViewNet->updateNetworkModeSpecificControls();
2248 }
2249}
2250
2251
2252void
2254 if ((mode == demandEditMode) && !force) {
2255 myViewNet->setStatusBarText(TL("Demand mode already selected"));
2256 if (myViewNet->myCurrentFrame != nullptr) {
2257 myViewNet->myCurrentFrame->focusUpperElement();
2258 }
2259 } else {
2260 myViewNet->setStatusBarText("");
2261 myViewNet->abortOperation(false);
2262 // stop editing of custom shapes
2263 myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
2264 // set new Demand mode
2265 demandEditMode = mode;
2266 // for common modes (Inspect/Delete/Select/Move) change also the other supermode
2267 if (demandEditMode == DemandEditMode::DEMAND_INSPECT) {
2268 networkEditMode = NetworkEditMode::NETWORK_INSPECT;
2269 dataEditMode = DataEditMode::DATA_INSPECT;
2270 } else if (demandEditMode == DemandEditMode::DEMAND_DELETE) {
2271 networkEditMode = NetworkEditMode::NETWORK_DELETE;
2272 dataEditMode = DataEditMode::DATA_DELETE;
2273 } else if (demandEditMode == DemandEditMode::DEMAND_SELECT) {
2274 networkEditMode = NetworkEditMode::NETWORK_SELECT;
2275 dataEditMode = DataEditMode::DATA_SELECT;
2276 } else if (demandEditMode == DemandEditMode::DEMAND_MOVE) {
2277 networkEditMode = NetworkEditMode::NETWORK_MOVE;
2278 }
2279 // update cursors
2280 myViewNet->updateCursor();
2281 // update network mode specific controls
2282 myViewNet->updateDemandModeSpecificControls();
2283 }
2284}
2285
2286
2287void
2289 if ((mode == dataEditMode) && !force) {
2290 myViewNet->setStatusBarText(TL("Data mode already selected"));
2291 if (myViewNet->myCurrentFrame != nullptr) {
2292 myViewNet->myCurrentFrame->focusUpperElement();
2293 }
2294 } else {
2295 myViewNet->setStatusBarText("");
2296 myViewNet->abortOperation(false);
2297 // stop editing of custom shapes
2298 myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
2299 // set new Data mode
2300 dataEditMode = mode;
2301 // for common modes (Inspect/Delete/Select/Move) change also the other supermode
2302 if (dataEditMode == DataEditMode::DATA_INSPECT) {
2303 networkEditMode = NetworkEditMode::NETWORK_INSPECT;
2304 demandEditMode = DemandEditMode::DEMAND_INSPECT;
2305 } else if (dataEditMode == DataEditMode::DATA_DELETE) {
2306 networkEditMode = NetworkEditMode::NETWORK_DELETE;
2307 demandEditMode = DemandEditMode::DEMAND_DELETE;
2308 } else if (dataEditMode == DataEditMode::DATA_SELECT) {
2309 networkEditMode = NetworkEditMode::NETWORK_SELECT;
2310 demandEditMode = DemandEditMode::DEMAND_SELECT;
2311 }
2312 // update all datasets
2313 for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
2314 dataSet.second->updateAttributeColors();
2315 }
2316 // update cursors
2317 myViewNet->updateCursor();
2318 // update network mode specific controls
2319 myViewNet->updateDataModeSpecificControls();
2320 }
2321}
2322
2323
2324bool
2326 return (currentSupermode == Supermode::NETWORK);
2327}
2328
2329
2330bool
2332 return (currentSupermode == Supermode::DEMAND);
2333}
2334
2335
2336bool
2338 return (currentSupermode == Supermode::DATA);
2339}
2340
2341
2342void
2344 // grip supermodes
2345 auto gripSupermodes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes;
2346 // file menu commands
2347 auto& fileMenuCommands = myViewNet->getViewParent()->getGNEAppWindows()->getFileMenuCommands();
2348 // continue depending of selector
2349 if (sel == MID_GNE_VIEW_DEFAULT) {
2350 myNeteditViewsButton->setIcon(GUIIconSubSys::getIcon(GUIIcon::VIEWDEFAULT));
2351 gripSupermodes->setWidth(353);
2352 // show menu commands
2353 fileMenuCommands.setDefaultView();
2354 } else if (sel == MID_GNE_VIEW_JUPEDSIM) {
2355 myNeteditViewsButton->setIcon(GUIIconSubSys::getIcon(GUIIcon::VIEWJUPEDSIM));
2356 gripSupermodes->setWidth(250);
2357 // hide menu commands
2358 fileMenuCommands.setJuPedSimView();
2359 }
2360 // update viewNet
2361 myViewNet->viewUpdated();
2362}
2363
2364
2365bool
2367 return myNeteditViewsButton->getIcon() == GUIIconSubSys::getIcon(GUIIcon::VIEWDEFAULT);
2368}
2369
2370
2371bool
2373 return myNeteditViewsButton->getIcon() == GUIIconSubSys::getIcon(GUIIcon::VIEWJUPEDSIM);
2374}
2375
2376// ---------------------------------------------------------------------------
2377// GNEViewNetHelper::NetworkViewOptions - methods
2378// ---------------------------------------------------------------------------
2379
2383
2384
2385void
2387 // get grip modes
2388 auto gripModes = myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes;
2389 // static toolTip menu
2390 auto toolTipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2391 // create menu checks
2392 menuCheckToggleGrid = new MFXCheckableButton(false, gripModes, toolTipMenu,
2393 (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)")),
2396 menuCheckToggleGrid->setChecked(false);
2397 menuCheckToggleGrid->create();
2398
2399 menuCheckToggleDrawJunctionShape = new MFXCheckableButton(false, gripModes, toolTipMenu,
2400 (std::string("\t") + TL("Hide junction shape") + std::string("\t") + TL("Toggle hiding junction shape. (Ctrl+J)")),
2403 menuCheckToggleDrawJunctionShape->setChecked(false);
2404 menuCheckToggleDrawJunctionShape->create();
2405
2406 menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, gripModes, toolTipMenu,
2407 (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.")),
2410 menuCheckDrawSpreadVehicles->setChecked(false);
2411 menuCheckDrawSpreadVehicles->create();
2412
2413 menuCheckShowDemandElements = new MFXCheckableButton(false, gripModes, toolTipMenu,
2414 (std::string("\t") + TL("Show demand elements") + std::string("\t") + TL("Toggle show demand elements.")),
2417 menuCheckShowDemandElements->setChecked(false);
2418 menuCheckShowDemandElements->create();
2419
2420 menuCheckSelectEdges = new MFXCheckableButton(false, gripModes, toolTipMenu,
2421 (std::string("\t") + TL("Clicks target lanes") + std::string("\t") + TL("Toggle whether clicking should inspect/select/delete lanes instead of edges.")),
2424 menuCheckSelectEdges->create();
2425
2426 menuCheckShowConnections = new MFXCheckableButton(false, gripModes, toolTipMenu,
2427 (std::string("\t") + TL("Show connections over junctions") + std::string("\t") + TL("Toggle show connections over junctions.")),
2430 menuCheckShowConnections->setChecked(myViewNet->getVisualisationSettings().showLane2Lane);
2431 menuCheckShowConnections->create();
2432
2433 menuCheckHideConnections = new MFXCheckableButton(false, gripModes, toolTipMenu,
2434 (std::string("\t") + TL("Hide connections") + std::string("\t") + TL("Toggle hide connections.")),
2437 menuCheckHideConnections->setChecked(false);
2438 menuCheckHideConnections->create();
2439
2440 menuCheckShowAdditionalSubElements = new MFXCheckableButton(false, gripModes, toolTipMenu,
2441 (std::string("\t") + TL("Show additional sub-elements") + std::string("\t") + TL("Toggle show additional sub-elements.")),
2444 menuCheckShowAdditionalSubElements->setChecked(false);
2445 menuCheckShowAdditionalSubElements->create();
2446
2447 menuCheckShowTAZElements = new MFXCheckableButton(false, gripModes, toolTipMenu,
2448 (std::string("\t") + TL("Show TAZ elements") + std::string("\t") + TL("Toggle show TAZ elements.")),
2451 menuCheckShowTAZElements->setChecked(false);
2452 menuCheckShowTAZElements->create();
2453
2454 menuCheckExtendSelection = new MFXCheckableButton(false, gripModes, toolTipMenu,
2455 (std::string("\t") + TL("Automatic select junctions") + std::string("\t") + TL("Toggle whether selecting multiple edges should automatically select their junctions.")),
2458 menuCheckExtendSelection->setChecked(true);
2459 menuCheckExtendSelection->create();
2460
2461 menuCheckChangeAllPhases = new MFXCheckableButton(false, gripModes, toolTipMenu,
2462 (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.")),
2465 menuCheckChangeAllPhases->setChecked(false);
2466 menuCheckChangeAllPhases->create();
2467
2468 menuCheckWarnAboutMerge = new MFXCheckableButton(false, gripModes, toolTipMenu,
2469 (std::string("\t") + TL("Automatic merging junction") + std::string("\t") + TL("Toggle ask for confirmation before merging junction.")),
2472 menuCheckWarnAboutMerge->create();
2473
2474 menuCheckShowJunctionBubble = new MFXCheckableButton(false, gripModes, toolTipMenu,
2475 (std::string("\t") + TL("Show bubbles") + std::string("\t") + TL("Toggle show bubbles over junctions shapes.")),
2478 menuCheckShowJunctionBubble->setChecked(false);
2479 menuCheckShowJunctionBubble->create();
2480
2481 menuCheckMoveElevation = new MFXCheckableButton(false, gripModes, toolTipMenu,
2482 (std::string("\t") + TL("Move elevation") + std::string("\t") + TL("Apply mouse movement to elevation instead of x,y position.")),
2485 menuCheckMoveElevation->setChecked(false);
2486 menuCheckMoveElevation->create();
2487
2488 menuCheckChainEdges = new MFXCheckableButton(false, gripModes, toolTipMenu,
2489 (std::string("\t") + TL("Edge chain mode") + std::string("\t") + TL("Create consecutive edges with a single click (hit ESC to cancel chain).")),
2492 menuCheckChainEdges->setChecked(false);
2493 menuCheckChainEdges->create();
2494
2495 menuCheckAutoOppositeEdge = new MFXCheckableButton(false, gripModes, toolTipMenu,
2496 (std::string("\t") + TL("Edge opposite direction") + std::string("\t") + TL("Automatically create an edge in the opposite direction.")),
2499 menuCheckAutoOppositeEdge->setChecked(false);
2500 menuCheckAutoOppositeEdge->create();
2501
2502 // always recalc after creating new elements
2503 gripModes->recalc();
2504}
2505
2506
2507void
2509 menuCheckToggleGrid->hide();
2510 menuCheckToggleDrawJunctionShape->hide();
2511 menuCheckDrawSpreadVehicles->hide();
2512 menuCheckShowDemandElements->hide();
2513 menuCheckSelectEdges->hide();
2514 menuCheckShowConnections->hide();
2515 menuCheckHideConnections->hide();
2516 menuCheckShowAdditionalSubElements->hide();
2517 menuCheckShowTAZElements->hide();
2518 menuCheckExtendSelection->hide();
2519 menuCheckChangeAllPhases->hide();
2520 menuCheckWarnAboutMerge->hide();
2521 menuCheckShowJunctionBubble->hide();
2522 menuCheckMoveElevation->hide();
2523 menuCheckChainEdges->hide();
2524 menuCheckAutoOppositeEdge->hide();
2525}
2526
2527
2528void
2529GNEViewNetHelper::NetworkViewOptions::getVisibleNetworkMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2530 // save visible menu commands in commands vector
2531 if (menuCheckToggleGrid->shown()) {
2532 commands.push_back(menuCheckToggleGrid);
2533 }
2534 if (menuCheckToggleDrawJunctionShape->shown()) {
2535 commands.push_back(menuCheckToggleDrawJunctionShape);
2536 }
2537 if (menuCheckDrawSpreadVehicles->shown()) {
2538 commands.push_back(menuCheckDrawSpreadVehicles);
2539 }
2540 if (menuCheckShowDemandElements->shown()) {
2541 commands.push_back(menuCheckShowDemandElements);
2542 }
2543 if (menuCheckSelectEdges->shown()) {
2544 commands.push_back(menuCheckSelectEdges);
2545 }
2546 if (menuCheckShowConnections->shown()) {
2547 commands.push_back(menuCheckShowConnections);
2548 }
2549 if (menuCheckHideConnections->shown()) {
2550 commands.push_back(menuCheckHideConnections);
2551 }
2552 if (menuCheckShowAdditionalSubElements->shown()) {
2553 commands.push_back(menuCheckShowAdditionalSubElements);
2554 }
2555 if (menuCheckShowTAZElements->shown()) {
2556 commands.push_back(menuCheckShowTAZElements);
2557 }
2558 if (menuCheckExtendSelection->shown()) {
2559 commands.push_back(menuCheckExtendSelection);
2560 }
2561 if (menuCheckChangeAllPhases->shown()) {
2562 commands.push_back(menuCheckChangeAllPhases);
2563 }
2564 if (menuCheckWarnAboutMerge->shown()) {
2565 commands.push_back(menuCheckWarnAboutMerge);
2566 }
2567 if (menuCheckShowJunctionBubble->shown()) {
2568 commands.push_back(menuCheckShowJunctionBubble);
2569 }
2570 if (menuCheckMoveElevation->shown()) {
2571 commands.push_back(menuCheckMoveElevation);
2572 }
2573 if (menuCheckChainEdges->shown()) {
2574 commands.push_back(menuCheckChainEdges);
2575 }
2576 if (menuCheckAutoOppositeEdge->shown()) {
2577 commands.push_back(menuCheckAutoOppositeEdge);
2578 }
2579}
2580
2581
2582bool
2584 return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
2585}
2586
2587
2588bool
2590 if (menuCheckShowDemandElements->shown()) {
2591 return (menuCheckShowDemandElements->amChecked() == TRUE);
2592 } else {
2593 // by default, if menuCheckShowDemandElements isn't shown, always show demand elements
2594 return true;
2595 }
2596}
2597
2598
2599bool
2601 if (menuCheckSelectEdges->shown()) {
2602 return (menuCheckSelectEdges->amChecked() != TRUE);
2603 } else {
2604 // by default, if menuCheckSelectEdges isn't shown, always select edges
2605 return true;
2606 }
2607}
2608
2609
2610bool
2612 if (myViewNet->myEditModes.isCurrentSupermodeData()) {
2613 return false;
2614 } else if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_CONNECT) {
2615 // check if menu check hide connections ins shown
2616 return (menuCheckHideConnections->amChecked() == FALSE);
2617 } else if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_PROHIBITION) {
2618 return true;
2619 } else if (myViewNet->myEditModes.isCurrentSupermodeNetwork() && menuCheckShowConnections->shown() == false) {
2620 return false;
2621 } else {
2622 return (myViewNet->getVisualisationSettings().showLane2Lane);
2623 }
2624}
2625
2626
2627bool
2629 if (!myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
2630 return false;
2631 } else if (menuCheckShowAdditionalSubElements->shown() == false) {
2632 return false;
2633 } else {
2634 return menuCheckShowAdditionalSubElements->amChecked();
2635 }
2636}
2637
2638
2639bool
2641 if (!myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
2642 return false;
2643 } else if (menuCheckShowTAZElements->shown() == false) {
2644 return false;
2645 } else {
2646 return menuCheckShowTAZElements->amChecked();
2647 }
2648}
2649
2650
2651bool
2653 if (menuCheckMoveElevation->shown()) {
2654 return (menuCheckMoveElevation->amChecked() == TRUE);
2655 } else {
2656 return false;
2657 }
2658}
2659
2660// ---------------------------------------------------------------------------
2661// GNEViewNetHelper::DemandViewOptions - methods
2662// ---------------------------------------------------------------------------
2663
2665 myViewNet(viewNet) {
2666}
2667
2668
2669void
2671 // get grip modes
2672 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
2673 // get tooltip menu
2674 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2675 // create menu checks
2676 menuCheckToggleGrid = new MFXCheckableButton(false, gripModes, tooltipMenu,
2677 (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)")),
2680 menuCheckToggleGrid->setChecked(false);
2681 menuCheckToggleGrid->create();
2682
2683 menuCheckToggleDrawJunctionShape = new MFXCheckableButton(false, gripModes, tooltipMenu,
2684 (std::string("\t") + TL("Hide junction shape") + std::string("\t") + TL("Toggle hiding junction shape. (Ctrl+J)")),
2687 menuCheckToggleDrawJunctionShape->setChecked(false);
2688 menuCheckToggleDrawJunctionShape->create();
2689
2690 menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, gripModes, tooltipMenu,
2691 (std::string("\t") + TL("Draw vehicles spread/depart position") + std::string("\t") + TL("Draw vehicles spread in lane or in depart position.")),
2694 menuCheckDrawSpreadVehicles->setChecked(false);
2695 menuCheckDrawSpreadVehicles->create();
2696
2697 menuCheckHideShapes = new MFXCheckableButton(false, gripModes, tooltipMenu,
2698 (std::string("\t") + TL("Show shapes") + std::string("\t") + TL("Toggle show shapes (Polygons and POIs).")),
2701 menuCheckHideShapes->setChecked(false);
2702 menuCheckHideShapes->create();
2703
2704 menuCheckShowAllTrips = new MFXCheckableButton(false, gripModes, tooltipMenu,
2705 (std::string("\t") + TL("Show all trips") + std::string("\t") + TL("Toggle show all trips (requires updated demand - F5).")),
2708 menuCheckShowAllTrips->setChecked(false);
2709 menuCheckShowAllTrips->create();
2710
2711 menuCheckShowAllPersonPlans = new MFXCheckableButton(false, gripModes, tooltipMenu,
2712 (std::string("\t") + TL("Show all person plans") + std::string("\t") + TL("Toggle show all person plans.")),
2715 menuCheckShowAllPersonPlans->setChecked(false);
2716 menuCheckShowAllPersonPlans->create();
2717
2718 menuCheckLockPerson = new MFXCheckableButton(false, gripModes, tooltipMenu,
2719 (std::string("\t") + TL("Lock selected person") + std::string("\t") + TL("Toggle lock selected person.")),
2722 menuCheckLockPerson->setChecked(false);
2723 menuCheckLockPerson->create();
2724
2725 menuCheckShowAllContainerPlans = new MFXCheckableButton(false, gripModes, tooltipMenu,
2726 (std::string("\t") + TL("Show all containers plans") + std::string("\t") + TL("Toggle show all container plans.")),
2729 menuCheckShowAllContainerPlans->setChecked(false);
2730 menuCheckShowAllContainerPlans->create();
2731
2732 menuCheckLockContainer = new MFXCheckableButton(false, gripModes, tooltipMenu,
2733 (std::string("\t") + TL("Lock selected container") + std::string("\t") + TL("Toggle lock selected container.")),
2736 menuCheckLockContainer->setChecked(false);
2737 menuCheckLockContainer->create();
2738
2739 menuCheckHideNonInspectedDemandElements = new MFXCheckableButton(false, gripModes, tooltipMenu,
2740 (std::string("\t") + TL("Show non-inspected demand elements") + std::string("\t") + TL("Toggle show non-inspected demand elements.")),
2743 menuCheckHideNonInspectedDemandElements->setChecked(false);
2744 menuCheckHideNonInspectedDemandElements->create();
2745
2746 menuCheckShowOverlappedRoutes = new MFXCheckableButton(false, gripModes, tooltipMenu,
2747 (std::string("\t") + TL("Show number of overlapped routes") + std::string("\t") + TL("Toggle show number of overlapped routes.")),
2750 menuCheckShowOverlappedRoutes->setChecked(false);
2751 menuCheckShowOverlappedRoutes->create();
2752
2753 // always recalc after creating new elements
2754 gripModes->recalc();
2755}
2756
2757
2758void
2760 menuCheckToggleGrid->hide();
2761 menuCheckToggleDrawJunctionShape->hide();
2762 menuCheckDrawSpreadVehicles->hide();
2763 menuCheckHideShapes->hide();
2764 menuCheckShowAllTrips->hide();
2765 menuCheckShowAllPersonPlans->hide();
2766 menuCheckLockPerson->hide();
2767 menuCheckShowAllContainerPlans->hide();
2768 menuCheckLockContainer->hide();
2769 menuCheckHideNonInspectedDemandElements->hide();
2770 menuCheckShowOverlappedRoutes->hide();
2771}
2772
2773
2774void
2775GNEViewNetHelper::DemandViewOptions::getVisibleDemandMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2776 // save visible menu commands in commands vector
2777 if (menuCheckToggleGrid->shown()) {
2778 commands.push_back(menuCheckToggleGrid);
2779 }
2780 if (menuCheckToggleDrawJunctionShape->shown()) {
2781 commands.push_back(menuCheckToggleDrawJunctionShape);
2782 }
2783 if (menuCheckDrawSpreadVehicles->shown()) {
2784 commands.push_back(menuCheckDrawSpreadVehicles);
2785 }
2786 if (menuCheckHideShapes->shown()) {
2787 commands.push_back(menuCheckHideShapes);
2788 }
2789 if (menuCheckShowAllTrips->shown()) {
2790 commands.push_back(menuCheckShowAllTrips);
2791 }
2792 if (menuCheckShowAllPersonPlans->shown() && menuCheckShowAllPersonPlans->isEnabled()) {
2793 commands.push_back(menuCheckShowAllPersonPlans);
2794 }
2795 if (menuCheckLockPerson->shown() && menuCheckLockPerson->isEnabled()) {
2796 commands.push_back(menuCheckLockPerson);
2797 }
2798 if (menuCheckShowAllContainerPlans->shown() && menuCheckShowAllContainerPlans->isEnabled()) {
2799 commands.push_back(menuCheckShowAllContainerPlans);
2800 }
2801 if (menuCheckLockContainer->shown() && menuCheckLockContainer->isEnabled()) {
2802 commands.push_back(menuCheckLockContainer);
2803 }
2804 if (menuCheckHideNonInspectedDemandElements->shown()) {
2805 commands.push_back(menuCheckHideNonInspectedDemandElements);
2806 }
2807 if (menuCheckShowOverlappedRoutes->shown()) {
2808 commands.push_back(menuCheckShowOverlappedRoutes);
2809 }
2810}
2811
2812
2813bool
2815 return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
2816}
2817
2818
2819bool
2821 if (menuCheckHideNonInspectedDemandElements->shown()) {
2822 // check conditions
2823 if ((menuCheckHideNonInspectedDemandElements->amChecked() == FALSE) || (myViewNet->getInspectedAttributeCarriers().empty())) {
2824 // if checkbox is disabled or there isn't insepected element, then return true
2825 return true;
2826 } else if (myViewNet->getInspectedAttributeCarriers().front()->getTagProperty().isDemandElement()) {
2827 if (myViewNet->isAttributeCarrierInspected(demandElement)) {
2828 // if inspected element correspond to demandElement, return true
2829 return true;
2830 } else {
2831 // if demandElement is a route, check if dottedAC is one of their children (Vehicle or Stop)
2832 for (const auto& i : demandElement->getChildDemandElements()) {
2833 if (myViewNet->isAttributeCarrierInspected(i)) {
2834 return true;
2835 }
2836 }
2837 // if demandElement is a vehicle, check if dottedAC is one of his route Parent
2838 for (const auto& i : demandElement->getParentDemandElements()) {
2839 if (myViewNet->isAttributeCarrierInspected(i)) {
2840 return true;
2841 }
2842 }
2843 // dottedAC isn't one of their parent, then return false
2844 return false;
2845 }
2846 } else {
2847 // we're inspecting a demand element, then return true
2848 return true;
2849 }
2850 } else {
2851 // we're inspecting a demand element, then return true
2852 return true;
2853 }
2854}
2855
2856
2857bool
2859 if (menuCheckHideShapes->shown()) {
2860 return (menuCheckHideShapes->amChecked() == FALSE);
2861 } else {
2862 return true;
2863 }
2864}
2865
2866
2867bool
2869 return (menuCheckShowAllTrips->amChecked() == TRUE);
2870}
2871
2872
2873bool
2875 if (menuCheckShowAllPersonPlans->isEnabled()) {
2876 return (menuCheckShowAllPersonPlans->amChecked() == TRUE);
2877 } else {
2878 return false;
2879 }
2880}
2881
2882
2883void
2885 myLockedPerson = person;
2886}
2887
2888
2889void
2891 myLockedPerson = nullptr;
2892}
2893
2894
2895const GNEDemandElement*
2897 return myLockedPerson;
2898}
2899
2900
2901bool
2903 if (menuCheckShowAllContainerPlans->isEnabled()) {
2904 return (menuCheckShowAllContainerPlans->amChecked() == TRUE);
2905 } else {
2906 return false;
2907 }
2908}
2909
2910
2911void
2913 myLockedContainer = container;
2914}
2915
2916
2917void
2919 myLockedContainer = nullptr;
2920}
2921
2922
2923bool
2925 if (menuCheckShowOverlappedRoutes->isEnabled()) {
2926 return (menuCheckShowOverlappedRoutes->amChecked() == TRUE);
2927 } else {
2928 return false;
2929 }
2930}
2931
2932
2933const GNEDemandElement*
2935 return myLockedContainer;
2936}
2937
2938// ---------------------------------------------------------------------------
2939// GNEViewNetHelper::DataViewOptions - methods
2940// ---------------------------------------------------------------------------
2941
2943 myViewNet(viewNet) {
2944}
2945
2946
2947void
2949 // get grip modes
2950 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
2951 // get tooltip menu
2952 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
2953 // create menu checks
2954 menuCheckToggleDrawJunctionShape = new MFXCheckableButton(false, gripModes, tooltipMenu,
2955 (std::string("\t") + TL("Hide junction shape") + std::string("\t") + TL("Toggle hiding junction shape. (Ctrl+J)")),
2958 menuCheckToggleDrawJunctionShape->setChecked(false);
2959 menuCheckToggleDrawJunctionShape->create();
2960
2961 menuCheckShowAdditionals = new MFXCheckableButton(false, gripModes, tooltipMenu,
2962 (std::string("\t") + TL("Show additionals") + std::string("\t") + TL("Toggle show additionals.")),
2965 menuCheckShowAdditionals->create();
2966
2967 menuCheckShowShapes = new MFXCheckableButton(false, gripModes, tooltipMenu,
2968 (std::string("\t") + TL("Show shapes") + std::string("\t") + TL("Toggle show shapes (Polygons and POIs).")),
2971 menuCheckShowShapes->create();
2972
2973 menuCheckShowDemandElements = new MFXCheckableButton(false, gripModes, tooltipMenu,
2974 (std::string("\t") + TL("Show demand elements") + std::string("\t") + TL("Toggle show demand elements.")),
2977 menuCheckShowDemandElements->create();
2978
2979 menuCheckToggleTAZRelDrawing = new MFXCheckableButton(false, gripModes, tooltipMenu,
2980 (std::string("\t") + TL("Draw TAZREL drawing mode") + std::string("\t") + TL("Toggle draw TAZREL drawing mode.")),
2983 menuCheckToggleTAZRelDrawing->create();
2984
2985 menuCheckToggleTAZDrawFill = new MFXCheckableButton(false, gripModes, tooltipMenu,
2986 (std::string("\t") + TL("Toggle draw TAZ fill") + std::string("\t") + TL("Toggle draw TAZ fill")),
2989 menuCheckToggleTAZDrawFill->create();
2990
2991 menuCheckToggleTAZRelOnlyFrom = new MFXCheckableButton(false, gripModes, tooltipMenu,
2992 (std::string("\t") + TL("Toggle draw TAZRel only from") + std::string("\t") + TL("Toggle draw TAZRel only from")),
2995 menuCheckToggleTAZRelOnlyFrom->create();
2996
2997 menuCheckToggleTAZRelOnlyTo = new MFXCheckableButton(false, gripModes, tooltipMenu,
2998 (std::string("\t") + TL("Toggle draw TAZRel only to") + std::string("\t") + TL("Toggle draw TAZRel only to")),
3001 menuCheckToggleTAZRelOnlyTo->create();
3002
3003 // always recalc after creating new elements
3004 gripModes->recalc();
3005}
3006
3007
3008void
3010 menuCheckToggleDrawJunctionShape->hide();
3011 menuCheckShowAdditionals->hide();
3012 menuCheckShowShapes->hide();
3013 menuCheckShowDemandElements->hide();
3014 menuCheckToggleTAZRelDrawing->hide();
3015 menuCheckToggleTAZDrawFill->hide();
3016 menuCheckToggleTAZRelOnlyFrom->hide();
3017 menuCheckToggleTAZRelOnlyTo->hide();
3018}
3019
3020
3021void
3022GNEViewNetHelper::DataViewOptions::getVisibleDataMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
3023 // save visible menu commands in commands vector
3024 if (menuCheckToggleDrawJunctionShape->shown()) {
3025 commands.push_back(menuCheckToggleDrawJunctionShape);
3026 }
3027 if (menuCheckShowAdditionals->shown()) {
3028 commands.push_back(menuCheckShowAdditionals);
3029 }
3030 if (menuCheckShowShapes->shown()) {
3031 commands.push_back(menuCheckShowShapes);
3032 }
3033 if (menuCheckShowDemandElements->shown()) {
3034 commands.push_back(menuCheckShowDemandElements);
3035 }
3036 if (menuCheckToggleTAZRelDrawing->shown()) {
3037 commands.push_back(menuCheckToggleTAZRelDrawing);
3038 }
3039 if (menuCheckToggleTAZDrawFill->shown()) {
3040 commands.push_back(menuCheckToggleTAZDrawFill);
3041 }
3042 if (menuCheckToggleTAZRelOnlyFrom->shown()) {
3043 commands.push_back(menuCheckToggleTAZRelOnlyFrom);
3044 }
3045 if (menuCheckToggleTAZRelOnlyTo->shown()) {
3046 commands.push_back(menuCheckToggleTAZRelOnlyTo);
3047 }
3048}
3049
3050
3051bool
3053 if (menuCheckShowAdditionals->shown()) {
3054 return (menuCheckShowAdditionals->amChecked() == TRUE);
3055 } else {
3056 return true;
3057 }
3058}
3059
3060
3061bool
3063 if (menuCheckShowShapes->shown()) {
3064 return (menuCheckShowShapes->amChecked() == TRUE);
3065 } else {
3066 return true;
3067 }
3068}
3069
3070
3071bool
3073 if (menuCheckShowDemandElements->shown()) {
3074 return (menuCheckShowDemandElements->amChecked() == TRUE);
3075 } else {
3076 return true;
3077 }
3078}
3079
3080
3081bool
3083 return (menuCheckToggleTAZRelDrawing->amChecked() != TRUE);
3084}
3085
3086
3087bool
3089 if (menuCheckToggleTAZDrawFill->shown()) {
3090 return (menuCheckToggleTAZDrawFill->amChecked() != TRUE);
3091 } else {
3092 return false;
3093 }
3094}
3095
3096
3097bool
3099 if (menuCheckToggleTAZRelOnlyFrom->shown()) {
3100 return (menuCheckToggleTAZRelOnlyFrom->amChecked() != TRUE);
3101 } else {
3102 return false;
3103 }
3104}
3105
3106
3107bool
3109 if (menuCheckToggleTAZRelOnlyTo->shown()) {
3110 return (menuCheckToggleTAZRelOnlyTo->amChecked() != TRUE);
3111 } else {
3112 return false;
3113 }
3114}
3115
3116// ---------------------------------------------------------------------------
3117// GNEViewNetHelper::IntervalBar - methods
3118// ---------------------------------------------------------------------------
3119
3121 myViewNet(viewNet) {
3122}
3123
3124
3125void
3127 // create interval label
3128 FXLabel* genericDataLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3129 "Data type", 0, GUIDesignLabelThickedFixed(100));
3130 genericDataLabel->create();
3131 // create combo box for generic datas
3132 myGenericDataTypesComboBox = new MFXComboBoxIcon(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3135 myGenericDataTypesComboBox->create();
3136 // fill combo box
3137 myGenericDataTypesComboBox->appendIconItem("<all>");
3138 myGenericDataTypesComboBox->appendIconItem(toString(GNE_TAG_EDGEREL_SINGLE).c_str());
3139 myGenericDataTypesComboBox->appendIconItem(toString(SUMO_TAG_EDGEREL).c_str());
3140 myGenericDataTypesComboBox->appendIconItem(toString(SUMO_TAG_TAZREL).c_str());
3141 // create dataSet label
3142 FXLabel* dataSetLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3143 "Data sets", 0, GUIDesignLabelThickedFixed(100));
3144 dataSetLabel->create();
3145 // create combo box for sets
3146 myDataSetsComboBox = new MFXComboBoxIcon(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3149 myDataSetsComboBox->create();
3150 // create checkbutton for myLimitByInterval
3151 myIntervalCheckBox = new FXCheckButton(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3153 myIntervalCheckBox->create();
3154 // create textfield for begin
3155 myBeginTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3157 myBeginTextField->create();
3158 // create text field for end
3159 myEndTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3161 myEndTextField->create();
3162 // create parameter label
3163 FXLabel* parameterLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3164 "Parameter", 0, GUIDesignLabelThickedFixed(100));
3165 parameterLabel->create();
3166 // create combo box for attributes
3167 myParametersComboBox = new MFXComboBoxIcon(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
3170 myParametersComboBox->create();
3171 // always recalc after creating new elements
3172 myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->recalc();
3173}
3174
3175
3176void
3178 // first update interval bar
3179 updateIntervalBar();
3180 // show toolbar grip
3181 myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->show();
3182}
3183
3184
3185void
3187 // hide toolbar grip
3188 myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->hide();
3189}
3190
3191
3192void
3194 // check if intervalBar has to be updated
3195 if (myUpdateInterval && myViewNet->getNet()) {
3196 // clear data sets
3197 myDataSets.clear();
3198 // declare intervals
3199 double begin = INVALID_DOUBLE;
3200 double end = INVALID_DOUBLE;
3201 // clear parameters
3202 myParameters.clear();
3203 // iterate over all data elements
3204 for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
3205 // add data set ID
3206 myDataSets.push_back(dataSet.second->getID());
3207 // iterate over all intervals
3208 for (const auto& interval : dataSet.second->getDataIntervalChildren()) {
3209 // set intervals
3210 if ((begin == INVALID_DOUBLE) || (interval.first < begin)) {
3211 begin = interval.first;
3212 }
3213 if ((end == INVALID_DOUBLE) || (interval.first > end)) {
3214 end = interval.first;
3215 }
3216 // iterate over all generic datas
3217 for (const auto& genericData : interval.second->getGenericDataChildren()) {
3218 // iterate over parameters
3219 for (const auto& parameter : genericData->getParametersMap()) {
3220 myParameters.insert(parameter.first);
3221 }
3222 }
3223 }
3224 }
3225 // get previous dataSet
3226 const std::string previousDataSet = myDataSetsComboBox->getText().text();
3227 // get previous interval
3228 const std::string previousBegin = (myIntervalCheckBox->getCheck() == TRUE) ? myBeginTextField->getText().text() : "";
3229 const std::string previousEnd = (myIntervalCheckBox->getCheck() == TRUE) ? myEndTextField->getText().text() : "";
3230 // get previous parameter
3231 const std::string previousParameter = myParametersComboBox->getText().text();
3232 // clear comboBoxes
3233 myDataSetsComboBox->clearItems();
3234 myParametersComboBox->clearItems();
3235 // add first item (all)
3236 myDataSetsComboBox->appendIconItem("<all>");
3237 myParametersComboBox->appendIconItem("<all>");
3238 // fill dataSet comboBox
3239 for (const auto& dataSet : myDataSets) {
3240 myDataSetsComboBox->appendIconItem(dataSet.c_str());
3241 }
3242 // set begin/end
3243 myBeginTextField->setText(toString(begin).c_str());
3244 myEndTextField->setText(toString(end).c_str());
3245 // fill parameter comboBox
3246 for (const auto& parameter : myParameters) {
3247 myParametersComboBox->appendIconItem(parameter.c_str());
3248 }
3249 // check previous dataSet
3250 myDataSetsComboBox->setCurrentItem(0, FALSE);
3251 for (int i = 0; i < myDataSetsComboBox->getNumItems(); i++) {
3252 if (myDataSetsComboBox->getItemText(i) == previousDataSet) {
3253 myDataSetsComboBox->setCurrentItem(i);
3254 }
3255 }
3256 // set previous interval
3257 if (myIntervalCheckBox->getCheck() == TRUE) {
3258 myBeginTextField->setText(previousBegin.c_str());
3259 myEndTextField->setText(previousEnd.c_str());
3260 }
3261 // check previous parameter
3262 myParametersComboBox->setCurrentItem(0, FALSE);
3263 for (int i = 0; i < myParametersComboBox->getNumItems(); i++) {
3264 if (myParametersComboBox->getItemText(i) == previousParameter) {
3265 myParametersComboBox->setCurrentItem(i);
3266 }
3267 }
3268 // check if enable or disable
3269 if ((myViewNet->getEditModes().dataEditMode == DataEditMode::DATA_INSPECT) ||
3270 (myViewNet->getEditModes().dataEditMode == DataEditMode::DATA_SELECT) ||
3271 (myViewNet->getEditModes().dataEditMode == DataEditMode::DATA_DELETE)) {
3272 enableIntervalBar();
3273 } else {
3274 disableIntervalBar();
3275 }
3276 // intervalBar updated, then change flag
3277 myUpdateInterval = false;
3278 }
3279}
3280
3281
3282void
3284 myUpdateInterval = true;
3285}
3286
3287
3290 if (myGenericDataTypesComboBox->isEnabled() && (myGenericDataTypesComboBox->getTextColor() == FXRGB(0, 0, 0))) {
3291 if (myGenericDataTypesComboBox->getText() == toString(GNE_TAG_EDGEREL_SINGLE).c_str()) {
3293 } else if (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_EDGEREL).c_str()) {
3294 return SUMO_TAG_EDGEREL;
3295 } else if (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_TAZREL).c_str()) {
3296 return SUMO_TAG_TAZREL;
3297 }
3298 }
3299 return SUMO_TAG_NOTHING;
3300}
3301
3302
3305 if (!myDataSetsComboBox->isEnabled() ||
3306 (myDataSetsComboBox->getCurrentItem() == 0) ||
3307 (myDataSetsComboBox->getTextColor() == FXRGB(255, 0, 0))) {
3308 return nullptr;
3309 } else {
3310 return myViewNet->getNet()->getAttributeCarriers()->retrieveDataSet(myDataSetsComboBox->getText().text());
3311 }
3312}
3313
3314
3315double
3317 if (!myIntervalCheckBox->isEnabled() || (myIntervalCheckBox->getCheck() == FALSE)) {
3318 return INVALID_DOUBLE;
3319 } else {
3320 return GNEAttributeCarrier::parse<double>(myBeginTextField->getText().text());
3321 }
3322}
3323
3324
3325double
3327 if (!myIntervalCheckBox->isEnabled() || (myIntervalCheckBox->getCheck() == FALSE)) {
3328 return INVALID_DOUBLE;
3329 } else {
3330 return GNEAttributeCarrier::parse<double>(myEndTextField->getText().text());
3331 }
3332}
3333
3334
3335std::string
3337 if (!myParametersComboBox->isEnabled() ||
3338 (myParametersComboBox->getCurrentItem() == 0) ||
3339 (myParametersComboBox->getTextColor() == FXRGB(255, 0, 0))) {
3340 return "";
3341 } else {
3342 return myParametersComboBox->getText().text();
3343 }
3344}
3345
3346
3347void
3349 if ((myGenericDataTypesComboBox->getText() == "<all>") ||
3350 (myGenericDataTypesComboBox->getText() == toString(GNE_TAG_EDGEREL_SINGLE).c_str()) ||
3351 (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_EDGEREL).c_str()) ||
3352 (myGenericDataTypesComboBox->getText() == toString(SUMO_TAG_TAZREL).c_str())) {
3353 myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
3354 } else {
3355 myGenericDataTypesComboBox->setTextColor(FXRGB(255, 0, 0));
3356 }
3357 // update view net
3358 myViewNet->updateViewNet();
3359}
3360
3361
3362void
3364 // check if exist
3365 if (std::find(myDataSets.begin(), myDataSets.end(), myDataSetsComboBox->getText().text()) != myDataSets.end()) {
3366 myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
3367 } else {
3368 myDataSetsComboBox->setTextColor(FXRGB(255, 0, 0));
3369 }
3370 // update view net
3371 myViewNet->updateViewNet();
3372}
3373
3374
3375void
3377 // enable or disable text fields
3378 if (myIntervalCheckBox->isEnabled() && (myIntervalCheckBox->getCheck() == TRUE)) {
3379 myBeginTextField->enable();
3380 myEndTextField->enable();
3381 } else {
3382 myBeginTextField->disable();
3383 myEndTextField->disable();
3384 }
3385 // update view net
3386 myViewNet->updateViewNet();
3387}
3388
3389
3390void
3392 if (myBeginTextField->getText().empty()) {
3393 myBeginTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMinimumBegin()).c_str());
3394 myBeginTextField->setTextColor(FXRGB(0, 0, 0));
3395 } else if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
3396 myBeginTextField->setTextColor(FXRGB(0, 0, 0));
3397 } else {
3398 myBeginTextField->setTextColor(FXRGB(255, 0, 0));
3399 }
3400 // update view net
3401 myViewNet->updateViewNet();
3402}
3403
3404
3405void
3407 if (myEndTextField->getText().empty()) {
3408 myEndTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMaximumEnd()).c_str());
3409 myEndTextField->setTextColor(FXRGB(0, 0, 0));
3410 } else if (GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
3411 myEndTextField->setTextColor(FXRGB(0, 0, 0));
3412 } else {
3413 myEndTextField->setTextColor(FXRGB(255, 0, 0));
3414 }
3415 // update view net
3416 myViewNet->updateViewNet();
3417}
3418
3419
3420void
3422 // check if exist
3423 if (myParameters.count(myParametersComboBox->getText().text()) > 0) {
3424 myParametersComboBox->setTextColor(FXRGB(0, 0, 0));
3425 } else {
3426 myParametersComboBox->setTextColor(FXRGB(255, 0, 0));
3427 }
3428 // update view net
3429 myViewNet->updateViewNet();
3430}
3431
3432
3433
3434void
3436 // enable elements
3437 myGenericDataTypesComboBox->enable();
3438 myDataSetsComboBox->enable();
3439 myIntervalCheckBox->enable();
3440 if (myIntervalCheckBox->getCheck() == TRUE) {
3441 myBeginTextField->enable();
3442 myEndTextField->enable();
3443 } else {
3444 myBeginTextField->disable();
3445 myEndTextField->disable();
3446 }
3447 myParametersComboBox->enable();
3448}
3449
3450
3451void
3453 // disable all elements
3454 myGenericDataTypesComboBox->disable();
3455 myDataSetsComboBox->disable();
3456 myIntervalCheckBox->disable();
3457 myBeginTextField->disable();
3458 myEndTextField->disable();
3459 myParametersComboBox->disable();
3460}
3461
3462// ---------------------------------------------------------------------------
3463// GNEViewNetHelper::CommonCheckableButtons - methods
3464// ---------------------------------------------------------------------------
3465
3469
3470
3471void
3473 // get grip modes
3474 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3475 // get tooltip menu
3476 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3477 // inspect button
3478 inspectButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3479 std::string("\t") + TL("Inspect mode") + std::string("\t") + TL("Mode for inspect elements and change their attributes. (I)"),
3481 inspectButton->create();
3482 // delete button
3483 deleteButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3484 std::string("\t") + TL("Delete mode") + std::string("\t") + TL("Mode for deleting elements. (D)"),
3486 deleteButton->create();
3487 // select button
3488 selectButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3489 std::string("\t") + TL("Select mode") + std::string("\t") + TL("Mode for selecting elements. (S)"),
3491 selectButton->create();
3492 // always recalc menu bar after creating new elements
3493 gripModes->recalc();
3494}
3495
3496
3497void
3499 inspectButton->show();
3500 deleteButton->show();
3501 selectButton->show();
3502}
3503
3504
3505void
3507 inspectButton->hide();
3508 deleteButton->hide();
3509 selectButton->hide();
3510}
3511
3512
3513void
3515 inspectButton->setChecked(false);
3516 deleteButton->setChecked(false);
3517 selectButton->setChecked(false);
3518}
3519
3520
3521void
3523 inspectButton->update();
3524 deleteButton->update();
3525 selectButton->update();
3526}
3527
3528// ---------------------------------------------------------------------------
3529// GNEViewNetHelper::NetworkCheckableButtons - methods
3530// ---------------------------------------------------------------------------
3531
3535
3536
3537void
3539 // get grip modes
3540 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3541 // get tooltip menu
3542 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3543 // move button
3544 moveNetworkElementsButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3545 std::string("\t") + TL("Move mode") + std::string("\t") + TL("Mode for moving elements. (M)"),
3547 moveNetworkElementsButton->create();
3548 // create edge
3549 createEdgeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3550 std::string("\t") + TL("Edge mode") + std::string("\t") + TL("Mode for creating junctions and edges. (E)"),
3552 createEdgeButton->create();
3553 // traffic light mode
3554 trafficLightButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3555 std::string("\t") + TL("Traffic light mode") + std::string("\t") + TL("Mode for editing traffic lights over junctions. (T)"),
3557 trafficLightButton->create();
3558 // connection mode
3559 connectionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3560 std::string("\t") + TL("Connection mode") + std::string("\t") + TL("Mode for edit connections between lanes. (C)"),
3562 connectionButton->create();
3563 // prohibition mode
3564 prohibitionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3565 std::string("\t") + TL("Prohibition mode") + std::string("\t") + TL("Mode for editing connection prohibitions. (H)"),
3567 prohibitionButton->create();
3568 // crossing mode
3569 crossingButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3570 std::string("\t") + TL("Crossing mode") + std::string("\t") + TL("Mode for creating crossings between edges. (R)"),
3572 crossingButton->create();
3573 // additional mode
3574 additionalButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3575 std::string("\t") + TL("Additional mode") + std::string("\t") + TL("Mode for creating additional elements. (A)"),
3577 additionalButton->create();
3578 // wire mode
3579 wireButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3580 std::string("\t") + TL("Wire mode") + std::string("\t") + TL("Mode for editing overhead wires. (W)"),
3582 wireButton->create();
3583 // TAZ Mode
3584 TAZButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3585 std::string("\t") + TL("TAZ mode") + std::string("\t") + TL("Mode for creating Traffic Assignment Zones. (Z)"),
3587 TAZButton->create();
3588 // shape mode
3589 shapeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3590 std::string("\t") + TL("Polygon mode") + std::string("\t") + TL("Mode for creating polygons and POIs. (P)"),
3592 shapeButton->create();
3593 // decal mode
3594 decalButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3595 std::string("\t") + TL("Decal mode") + std::string("\t") + TL("Mode for editing decals. (U)"),
3597 decalButton->create();
3598 // always recalc after creating new elements
3599 gripModes->recalc();
3600}
3601
3602
3603void
3605 // continue depending of view
3606 if (myViewNet->getEditModes().isJuPedSimView()) {
3607 moveNetworkElementsButton->show();
3608 createEdgeButton->show();
3609 connectionButton->hide();
3610 trafficLightButton->hide();
3611 additionalButton->show();
3612 crossingButton->show();
3613 TAZButton->show();
3614 shapeButton->show();
3615 prohibitionButton->hide();
3616 wireButton->hide();
3617 decalButton->hide();
3618 } else {
3619 moveNetworkElementsButton->show();
3620 createEdgeButton->show();
3621 connectionButton->show();
3622 trafficLightButton->show();
3623 additionalButton->show();
3624 crossingButton->show();
3625 TAZButton->show();
3626 shapeButton->show();
3627 prohibitionButton->show();
3628 wireButton->show();
3629 decalButton->show();
3630 }
3631}
3632
3633
3634void
3636 moveNetworkElementsButton->hide();
3637 createEdgeButton->hide();
3638 connectionButton->hide();
3639 trafficLightButton->hide();
3640 additionalButton->hide();
3641 crossingButton->hide();
3642 TAZButton->hide();
3643 shapeButton->hide();
3644 prohibitionButton->hide();
3645 wireButton->hide();
3646 decalButton->hide();
3647}
3648
3649
3650void
3652 moveNetworkElementsButton->setChecked(false);
3653 createEdgeButton->setChecked(false);
3654 connectionButton->setChecked(false);
3655 trafficLightButton->setChecked(false);
3656 additionalButton->setChecked(false);
3657 crossingButton->setChecked(false);
3658 TAZButton->setChecked(false);
3659 shapeButton->setChecked(false);
3660 prohibitionButton->setChecked(false);
3661 wireButton->setChecked(false);
3662 decalButton->setChecked(false);
3663}
3664
3665
3666void
3668 moveNetworkElementsButton->update();
3669 createEdgeButton->update();
3670 connectionButton->update();
3671 trafficLightButton->update();
3672 additionalButton->update();
3673 crossingButton->update();
3674 TAZButton->update();
3675 shapeButton->update();
3676 prohibitionButton->update();
3677 wireButton->update();
3678 decalButton->update();
3679}
3680
3681// ---------------------------------------------------------------------------
3682// GNEViewNetHelper::DemandCheckableButtons - methods
3683// ---------------------------------------------------------------------------
3684
3688
3689
3690void
3692 // get grip modes
3693 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3694 // get tooltip menu
3695 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3696 // move button
3697 moveDemandElementsButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3698 std::string("\t") + TL("Move mode") + std::string("\t") + TL("Mode for moving elements. (M)"),
3700 moveDemandElementsButton->create();
3701 // route mode
3702 routeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3703 std::string("\t") + TL("Route mode") + std::string("\t") + TL("Mode for creating routes. (R)"),
3705 routeButton->create();
3706 // rout distribution mode
3707 routeDistributionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3708 std::string("\t") + TL("Route distribution mode") + std::string("\t") + TL("Mode for creating and editing rout distributions. (W)"),
3710 routeDistributionButton->create();
3711 // vehicle mode
3712 vehicleButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3713 std::string("\t") + TL("Vehicle mode") + std::string("\t") + TL("Mode for creating vehicles. (V)"),
3715 vehicleButton->create();
3716 // type mode
3717 typeButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3718 std::string("\t") + TL("Type mode") + std::string("\t") + TL("Mode for creating types (of vehicles, persons and containers). (T)"),
3720 typeButton->create();
3721 // type distribution mode
3722 typeDistributionButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3723 std::string("\t") + TL("Type distribution mode") + std::string("\t") + TL("Mode for creating and editing type distribution. (U)"),
3725 typeDistributionButton->create();
3726 // stop mode
3727 stopButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3728 std::string("\t") + TL("Stop mode") + std::string("\t") + TL("Mode for creating stops. (A)"),
3730 stopButton->create();
3731 // person mode
3732 personButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3733 std::string("\t") + TL("Person mode") + std::string("\t") + TL("Mode for creating persons. (P)"),
3735 personButton->create();
3736 // person plan mode
3737 personPlanButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3738 std::string("\t") + TL("Person plan mode") + std::string("\t") + TL("Mode for creating person plans. (L)"),
3740 personPlanButton->create();
3741 // container mode
3742 containerButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3743 std::string("\t") + TL("Container mode") + std::string("\t") + TL("Mode for creating containers. (C)"),
3745 containerButton->create();
3746 // container plan mode
3747 containerPlanButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3748 std::string("\t") + TL("Container plan mode") + std::string("\t") + TL("Mode for creating container plans. (H)"),
3750 containerPlanButton->create();
3751 // always recalc after creating new elements
3752 gripModes->recalc();
3753}
3754
3755
3756void
3758 if (myViewNet->getEditModes().isJuPedSimView()) {
3759 moveDemandElementsButton->hide();
3760 routeButton->show();
3761 routeDistributionButton->show();
3762 vehicleButton->hide();
3763 typeButton->show();
3764 typeDistributionButton->show();
3765 stopButton->hide();
3766 personButton->show();
3767 personPlanButton->show();
3768 containerButton->hide();
3769 containerPlanButton->hide();
3770 } else {
3771 moveDemandElementsButton->show();
3772 routeButton->show();
3773 routeDistributionButton->show();
3774 vehicleButton->show();
3775 typeButton->show();
3776 typeDistributionButton->show();
3777 stopButton->show();
3778 personButton->show();
3779 personPlanButton->show();
3780 containerButton->show();
3781 containerPlanButton->show();
3782 }
3783}
3784
3785
3786void
3788 moveDemandElementsButton->hide();
3789 routeButton->hide();
3790 routeDistributionButton->hide();
3791 vehicleButton->hide();
3792 typeButton->hide();
3793 typeDistributionButton->hide();
3794 stopButton->hide();
3795 personButton->hide();
3796 personPlanButton->hide();
3797 containerButton->hide();
3798 containerPlanButton->hide();
3799}
3800
3801
3802void
3804 moveDemandElementsButton->setChecked(false);
3805 routeButton->setChecked(false);
3806 routeDistributionButton->setChecked(false);
3807 vehicleButton->setChecked(false);
3808 typeButton->setChecked(false);
3809 typeDistributionButton->setChecked(false);
3810 stopButton->setChecked(false);
3811 personButton->setChecked(false);
3812 personPlanButton->setChecked(false);
3813 containerButton->setChecked(false);
3814 containerPlanButton->setChecked(false);
3815}
3816
3817
3818void
3820 moveDemandElementsButton->update();
3821 routeButton->update();
3822 routeDistributionButton->update();
3823 vehicleButton->update();
3824 typeButton->update();
3825 typeDistributionButton->update();
3826 stopButton->update();
3827 personButton->update();
3828 personPlanButton->update();
3829 containerButton->update();
3830 containerPlanButton->update();
3831}
3832
3833// ---------------------------------------------------------------------------
3834// GNEViewNetHelper::DataCheckableButtons - methods
3835// ---------------------------------------------------------------------------
3836
3840
3841
3842void
3844 // get grip modes
3845 auto gripModes = myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes;
3846 // get tooltip menu
3847 auto tooltipMenu = myViewNet->myViewParent->getGNEAppWindows()->getStaticTooltipMenu();
3848 // edgeData mode
3849 edgeDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3850 std::string("\t") + TL("Edge data mode") + std::string("\t") + TL("Mode for creating edge datas. (E)"),
3852 edgeDataButton->create();
3853 // edgeRelData mode
3854 edgeRelDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3855 std::string("\t") + TL("Edge relation data mode") + std::string("\t") + TL("Mode for creating edge relation datas. (R)"),
3857 edgeRelDataButton->create();
3858 // TAZRelData mode
3859 TAZRelDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3860 std::string("\t") + TL("TAZ relation data mode") + std::string("\t") + TL("Mode for creating TAZ relation datas. (Z)"),
3862 TAZRelDataButton->create();
3863 // meanData button
3864 meanDataButton = new MFXCheckableButton(false, gripModes, tooltipMenu,
3865 std::string("\t") + TL("MeanData mode") + std::string("\t") + TL("Mode for MeanData elements. (M)"),
3867 meanDataButton->create();
3868 // always recalc after creating new elements
3869 gripModes->recalc();
3870}
3871
3872
3873void
3875 edgeDataButton->show();
3876 edgeRelDataButton->show();
3877 TAZRelDataButton->show();
3878 meanDataButton->show();
3879}
3880
3881
3882void
3884 edgeDataButton->hide();
3885 edgeRelDataButton->hide();
3886 TAZRelDataButton->hide();
3887 meanDataButton->hide();
3888}
3889
3890
3891void
3893 edgeDataButton->setChecked(false);
3894 edgeRelDataButton->setChecked(false);
3895 TAZRelDataButton->setChecked(false);
3896 meanDataButton->setChecked(false);
3897}
3898
3899
3900void
3902 edgeDataButton->update();
3903 edgeRelDataButton->update();
3904 TAZRelDataButton->update();
3905 meanDataButton->update();
3906}
3907
3908// ---------------------------------------------------------------------------
3909// GNEViewNetHelper::EditNetworkElementShapes - methods
3910// ---------------------------------------------------------------------------
3911
3913 myViewNet(viewNet),
3914 myPreviousNetworkEditMode(NetworkEditMode::NETWORK_NONE) {
3915}
3916
3917
3918void
3920 if (element && (myEditedNetworkElement == nullptr)) {
3921 // save current edit mode before starting
3922 myPreviousNetworkEditMode = myViewNet->myEditModes.networkEditMode;
3923 // set move mode
3924 myViewNet->myEditModes.setNetworkEditMode(NetworkEditMode::NETWORK_MOVE);
3925 //set editedNetworkElement
3926 myEditedNetworkElement = element;
3927 // enable shape edited flag
3928 myEditedNetworkElement->setShapeEdited(true);
3929 // update view net to show the new editedShapePoly
3930 myViewNet->updateViewNet();
3931 }
3932}
3933
3934
3935void
3937 // stop edit shape junction deleting editedShapePoly
3938 if (myEditedNetworkElement != nullptr) {
3939 // disable shape edited flag
3940 myEditedNetworkElement->setShapeEdited(false);
3941 // reset editedNetworkElement
3942 myEditedNetworkElement = nullptr;
3943 // restore previous edit mode
3944 if (myViewNet->myEditModes.networkEditMode != myPreviousNetworkEditMode) {
3945 myViewNet->myEditModes.setNetworkEditMode(myPreviousNetworkEditMode);
3946 }
3947 }
3948}
3949
3950
3951void
3953 // save edited junction's shape
3954 if (myEditedNetworkElement != nullptr) {
3955 // stop edit custom shape
3956 stopEditCustomShape();
3957 }
3958}
3959
3960
3963 return myEditedNetworkElement;
3964}
3965
3966// ---------------------------------------------------------------------------
3967// GNEViewNetHelper::BlockIcon - methods
3968// ---------------------------------------------------------------------------
3969
3970void
3972 const GNEAttributeCarrier* AC, GUIGlObjectType type, const Position position, const double exaggeration,
3973 const double size, const double offsetx, const double offsety) {
3974 // first check if icon can be drawn
3975 if (checkDrawing(d, AC, type, exaggeration)) {
3976 // Start pushing matrix
3978 // Traslate to position
3979 glTranslated(position.x(), position.y(), GLO_LOCKICON);
3980 // Traslate depending of the offset
3981 glTranslated(offsetx, offsety, 0);
3982 // rotate to avoid draw invert
3983 glRotated(180, 0, 0, 1);
3984 // Set draw color
3985 glColor3d(1, 1, 1);
3986 // Draw lock icon
3988 // Pop matrix
3990 }
3991}
3992
3993
3995
3996
3997bool
3999 GUIGlObjectType type, const double exaggeration) {
4000 // check detail
4002 return false;
4003 }
4004 // get view net
4005 const auto viewNet = AC->getNet()->getViewNet();
4006 // check exaggeration
4007 if (exaggeration == 0) {
4008 return false;
4009 }
4010 // check supermodes
4011 if (viewNet->getEditModes().isCurrentSupermodeNetwork() &&
4013 return false;
4014 }
4015 if (viewNet->getEditModes().isCurrentSupermodeDemand() && (!AC->getTagProperty().isDemandElement())) {
4016 return false;
4017 }
4018 if (viewNet->getEditModes().isCurrentSupermodeData() && (!AC->getTagProperty().isDataElement())) {
4019 return false;
4020 }
4021 // check if is locked
4022 if (!viewNet->getLockManager().isObjectLocked(type, AC->isAttributeCarrierSelected())) {
4023 return false;
4024 }
4025 // all ok, then draw
4026 return true;
4027}
4028
4029// ---------------------------------------------------------------------------
4030// GNEViewNetHelper - methods
4031// ---------------------------------------------------------------------------
4032
4033const std::vector<RGBColor>&
4035 // if is empty, fill it
4036 if (myRainbowScaledColors.empty()) {
4037 // fill scale colors (10)
4038 myRainbowScaledColors.push_back(RGBColor(232, 35, 0, 255));
4039 myRainbowScaledColors.push_back(RGBColor(255, 165, 0, 255));
4040 myRainbowScaledColors.push_back(RGBColor(255, 255, 0, 255));
4041 myRainbowScaledColors.push_back(RGBColor(28, 215, 0, 255));
4042 myRainbowScaledColors.push_back(RGBColor(0, 181, 100, 255));
4043 myRainbowScaledColors.push_back(RGBColor(0, 255, 191, 255));
4044 myRainbowScaledColors.push_back(RGBColor(178, 255, 255, 255));
4045 myRainbowScaledColors.push_back(RGBColor(0, 112, 184, 255));
4046 myRainbowScaledColors.push_back(RGBColor(56, 41, 131, 255));
4047 myRainbowScaledColors.push_back(RGBColor(127, 0, 255, 255));
4048 }
4049 return myRainbowScaledColors;
4050}
4051
4052
4053const RGBColor&
4054GNEViewNetHelper::getRainbowScaledColor(const double min, const double max, const double value) {
4055 // check extremes
4056 if (value <= min) {
4057 return getRainbowScaledColors().front();
4058 } else if (value >= max) {
4059 return getRainbowScaledColors().back();
4060 } else {
4061 // calculate value procent between [min, max]
4062 const double procent = ((value - min) * 100) / (max - min);
4063 // check if is valid
4064 if (procent <= 0) {
4065 return getRainbowScaledColors().front();
4066 } else if (procent >= 100) {
4067 return getRainbowScaledColors().back();
4068 } else {
4069 // return scaled color
4070 return getRainbowScaledColors().at((int)(procent / 10.0));
4071 }
4072 }
4073}
4074
4075
4076std::vector<GUIGlObject*>
4077GNEViewNetHelper::filterElementsByLayer(const std::vector<GUIGlObject*>& GLObjects) {
4078 std::vector<GUIGlObject*> filteredGLObjects;
4079 if (GLObjects.size() > 0) {
4080 const auto firstLayer = GLObjects.front()->getType();
4081 for (const auto& GLObject : GLObjects) {
4082 if ((GLO_RIDE <= firstLayer) && (firstLayer <= GLO_TRANSHIP) &&
4083 (GLO_RIDE <= GLObject->getType()) && (GLObject->getType() <= GLO_TRANSHIP)) {
4084 filteredGLObjects.push_back(GLObject);
4085 } else if ((GLO_STOP <= firstLayer) && (firstLayer <= GLO_STOP_PLAN) &&
4086 (GLO_STOP <= GLObject->getType()) && (GLObject->getType() <= GLO_STOP_PLAN)) {
4087 filteredGLObjects.push_back(GLObject);
4088 } else if ((GLO_VEHICLE <= firstLayer) && (firstLayer <= GLO_ROUTEFLOW) &&
4089 (GLO_VEHICLE <= GLObject->getType()) && (GLObject->getType() <= GLO_ROUTEFLOW)) {
4090 filteredGLObjects.push_back(GLObject);
4091 } else if ((GLO_PERSON <= firstLayer) && (firstLayer <= GLO_PERSONFLOW) &&
4092 (GLO_PERSON <= GLObject->getType()) && (GLObject->getType() <= GLO_PERSONFLOW)) {
4093 filteredGLObjects.push_back(GLObject);
4094 } else if ((GLO_CONTAINER <= firstLayer) && (firstLayer <= GLO_CONTAINERFLOW) &&
4095 (GLO_CONTAINER <= GLObject->getType()) && (GLObject->getType() <= GLO_CONTAINERFLOW)) {
4096 filteredGLObjects.push_back(GLObject);
4097 } else if (GLObject->getType() == firstLayer) {
4098 filteredGLObjects.push_back(GLObject);
4099 }
4100 }
4101 }
4102 return filteredGLObjects;
4103}
4104
4105/****************************************************************************/
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:311
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:317
#define GUIDesignButtonPopup
checkable button placed in popup (for example, locate buttons)
Definition GUIDesigns.h:118
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:129
#define GUIDesignButtonLeft
button extended over over Frame with thick and raise frame
Definition GUIDesigns.h:91
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:80
#define GUIDesignTLSTableCheckableButtonIcon
checkable button only with icon used in TLSTable
Definition GUIDesigns.h:115
#define GUIDesignComboBoxVisibleItemsFixed
Definition GUIDesigns.h:58
#define GUIDesignTextFieldFixedRestricted(width, type)
text field with fixed width
Definition GUIDesigns.h:74
#define GUIDesignMFXCheckableButtonSquare
Definition GUIDesigns.h:143
#define GUIDesignButtonToolbarLocator
little checkable button with icon placed in navigation toolbar used specify for Locator
Definition GUIDesigns.h:135
#define GUIDesignMFXCheckableButtonSupermode
checkable button with icon placed in navigation toolbar for supermodes
Definition GUIDesigns.h:146
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition GUIDesigns.h:207
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:258
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:654
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
An Element which don't belong to GNENet but has influence in the simulation.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
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:1759
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:779
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:125
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2147
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)
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
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
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)
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)
GNEPOI * getPOIFront() const
get front POI or a pointer to nullptr
GNEInternalLane * getInternalLaneFront() const
get front internal lane or a pointer to nullptr
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
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
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 attribute carrier 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
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
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.
std::map< double, std::vector< ObjectContainer > > GLObjectsSortedContainer
typedef
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