Eclipse SUMO - Simulation of Urban MObility
GNEViewNetHelper.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 /****************************************************************************/
34 #include <utils/gui/div/GLHelper.h>
39 
40 #include "GNEViewNetHelper.h"
41 #include "GNEViewNet.h"
42 #include "GNENet.h"
43 #include "GNEUndoList.h"
44 #include "GNEViewParent.h"
45 #include "GNEApplicationWindow.h"
46 
47 
48 // ===========================================================================
49 // static members
50 // ===========================================================================
51 
52 std::vector<RGBColor> GNEViewNetHelper::myRainbowScaledColors;
53 
54 // ---------------------------------------------------------------------------
55 // GNEViewNetHelper::ObjectsUnderCursor - methods
56 // ---------------------------------------------------------------------------
57 
59  myViewNet(viewNet),
60  mySwapLane2edge(false) {
61 }
62 
63 
64 void
65 GNEViewNetHelper::ObjectsUnderCursor::updateObjectUnderCursor(const std::vector<GUIGlObject*>& GUIGlObjects) {
66  // reset flag
67  mySwapLane2edge = false;
68  // clear elements
69  myEdgeObjects.clearElements();
70  myLaneObjects.clearElements();
71  // set GUIGlObject in myGUIGlObjectLanes
72  sortGUIGlObjects(GUIGlObjects);
73  // iterate over myGUIGlObjectLanes
74  for (const auto& glObject : myEdgeObjects.GUIGlObjects) {
75  // cast attribute carrier from glObject
76  GNEAttributeCarrier* AC = dynamic_cast<GNEAttributeCarrier*>(glObject);
77  // only continue if attributeCarrier isn't nullptr;
78  if (AC) {
79  // update attribute carrier
80  updateAttributeCarriers(myEdgeObjects, AC);
81  // cast specific network elemetns
82  if (AC->getTagProperty().isNetworkElement()) {
83  // update network elements
84  updateNetworkElements(myEdgeObjects, AC);
85  } else if (AC->getTagProperty().isAdditionalElement()) {
86  // update additional elements
87  updateAdditionalElements(myEdgeObjects, AC);
88  } else if (AC->getTagProperty().isTAZElement()) {
89  // update TAZ elements
90  updateTAZElements(myEdgeObjects, AC);
91  } else if (AC->getTagProperty().isShape()) {
92  // update shape elements
93  updateShapeElements(myEdgeObjects, AC);
94  } else if (AC->getTagProperty().isDemandElement()) {
95  // update demand elements
96  updateDemandElements(myEdgeObjects, AC);
97  } else if (AC->getTagProperty().isGenericData()) {
98  // update generic datas
99  updateGenericDataElements(myEdgeObjects, AC);
100  }
101  }
102  }
103  // update GUIGlObjects (due front element)
104  updateGUIGlObjects(myEdgeObjects);
105  // iterate over myGUIGlObjectLanes
106  for (const auto& glObject : myLaneObjects.GUIGlObjects) {
107  // cast attribute carrier from glObject
108  GNEAttributeCarrier* AC = dynamic_cast<GNEAttributeCarrier*>(glObject);
109  // only continue if attributeCarrier isn't nullptr;
110  if (AC) {
111  // update attribute carrier
112  updateAttributeCarriers(myLaneObjects, AC);
113  // cast specific network elemetns
114  if (AC->getTagProperty().isNetworkElement()) {
115  // update network elements
116  updateNetworkElements(myLaneObjects, AC);
117  } else if (AC->getTagProperty().isAdditionalElement()) {
118  // update additional elements
119  updateAdditionalElements(myLaneObjects, AC);
120  } else if (AC->getTagProperty().isTAZElement()) {
121  // update TAZ elements
122  updateTAZElements(myLaneObjects, AC);
123  } else if (AC->getTagProperty().isShape()) {
124  // update shape elements
125  updateShapeElements(myLaneObjects, AC);
126  } else if (AC->getTagProperty().isDemandElement()) {
127  // update demand elements
128  updateDemandElements(myLaneObjects, AC);
129  } else if (AC->getTagProperty().isGenericData()) {
130  // update generic datas
131  updateGenericDataElements(myLaneObjects, AC);
132  }
133  }
134  }
135  // update GUIGlObjects (due front element)
136  updateGUIGlObjects(myLaneObjects);
137 }
138 
139 
140 void
142  // enable flag
143  mySwapLane2edge = true;
144 }
145 
146 
147 GUIGlID
149  if (getGUIGlObjectFront()) {
150  return getGUIGlObjectFront()->getGlID();
151  } else {
152  return 0;
153  }
154 }
155 
156 
159  if (getGUIGlObjectFront()) {
160  return getGUIGlObjectFront()->getType();
161  } else {
162  return GLO_NETWORK;
163  }
164 }
165 
166 
169  if (mySwapLane2edge) {
170  if (myEdgeObjects.attributeCarriers.size() > 0) {
171  return myEdgeObjects.GUIGlObjects.front();
172  } else {
173  return nullptr;
174  }
175  } else {
176  if (myLaneObjects.attributeCarriers.size() > 0) {
177  return myLaneObjects.GUIGlObjects.front();
178  } else {
179  return nullptr;
180  }
181  }
182 }
183 
184 
187  if (mySwapLane2edge) {
188  if (myEdgeObjects.attributeCarriers.size() > 0) {
189  return myEdgeObjects.attributeCarriers.front();
190  } else {
191  return nullptr;
192  }
193  } else {
194  if (myLaneObjects.attributeCarriers.size() > 0) {
195  return myLaneObjects.attributeCarriers.front();
196  } else {
197  return nullptr;
198  }
199  }
200 }
201 
202 
205  if (mySwapLane2edge) {
206  if (myEdgeObjects.networkElements.size() > 0) {
207  return myEdgeObjects.networkElements.front();
208  } else {
209  return nullptr;
210  }
211  } else {
212  if (myLaneObjects.networkElements.size() > 0) {
213  return myLaneObjects.networkElements.front();
214  } else {
215  return nullptr;
216  }
217  }
218 }
219 
220 
223  if (mySwapLane2edge) {
224  if (myEdgeObjects.additionals.size() > 0) {
225  return myEdgeObjects.additionals.front();
226  } else {
227  return nullptr;
228  }
229  } else {
230  if (myLaneObjects.additionals.size() > 0) {
231  return myLaneObjects.additionals.front();
232  } else {
233  return nullptr;
234  }
235  }
236 }
237 
238 
239 GNEShape*
241  if (mySwapLane2edge) {
242  if (myEdgeObjects.shapes.size() > 0) {
243  return myEdgeObjects.shapes.front();
244  } else {
245  return nullptr;
246  }
247  } else {
248  if (myLaneObjects.shapes.size() > 0) {
249  return myLaneObjects.shapes.front();
250  } else {
251  return nullptr;
252  }
253  }
254 }
255 
256 
259  if (mySwapLane2edge) {
260  if (myEdgeObjects.TAZElements.size() > 0) {
261  return myEdgeObjects.TAZElements.front();
262  } else {
263  return nullptr;
264  }
265  } else {
266  if (myLaneObjects.TAZElements.size() > 0) {
267  return myLaneObjects.TAZElements.front();
268  } else {
269  return nullptr;
270  }
271  }
272 }
273 
274 
277  if (mySwapLane2edge) {
278  if (myEdgeObjects.demandElements.size() > 0) {
279  return myEdgeObjects.demandElements.front();
280  } else {
281  return nullptr;
282  }
283  } else {
284  if (myLaneObjects.demandElements.size() > 0) {
285  return myLaneObjects.demandElements.front();
286  } else {
287  return nullptr;
288  }
289  }
290 }
291 
292 
295  if (mySwapLane2edge) {
296  if (myEdgeObjects.genericDatas.size() > 0) {
297  return myEdgeObjects.genericDatas.front();
298  } else {
299  return nullptr;
300  }
301  } else {
302  if (myLaneObjects.genericDatas.size() > 0) {
303  return myLaneObjects.genericDatas.front();
304  } else {
305  return nullptr;
306  }
307  }
308 }
309 
310 
313  if (mySwapLane2edge) {
314  if (myEdgeObjects.junctions.size() > 0) {
315  return myEdgeObjects.junctions.front();
316  } else {
317  return nullptr;
318  }
319  } else {
320  if (myLaneObjects.junctions.size() > 0) {
321  return myLaneObjects.junctions.front();
322  } else {
323  return nullptr;
324  }
325  }
326 }
327 
328 
329 GNEEdge*
331  if (mySwapLane2edge) {
332  if (myEdgeObjects.edges.size() > 0) {
333  return myEdgeObjects.edges.front();
334  } else {
335  return nullptr;
336  }
337  } else {
338  if (myLaneObjects.edges.size() > 0) {
339  return myLaneObjects.edges.front();
340  } else {
341  return nullptr;
342  }
343  }
344 }
345 
346 
347 GNELane*
349  if (mySwapLane2edge) {
350  if (myEdgeObjects.lanes.size() > 0) {
351  return myEdgeObjects.lanes.front();
352  } else {
353  return nullptr;
354  }
355  } else {
356  if (myLaneObjects.lanes.size() > 0) {
357  return myLaneObjects.lanes.front();
358  } else {
359  return nullptr;
360  }
361  }
362 }
363 
364 
365 const std::vector<GNELane*>&
367  if (mySwapLane2edge) {
368  return myEdgeObjects.lanes;
369  } else {
370  return myLaneObjects.lanes;
371  }
372 }
373 
374 
377  if (mySwapLane2edge) {
378  if (myEdgeObjects.crossings.size() > 0) {
379  return myEdgeObjects.crossings.front();
380  } else {
381  return nullptr;
382  }
383  } else {
384  if (myLaneObjects.crossings.size() > 0) {
385  return myLaneObjects.crossings.front();
386  } else {
387  return nullptr;
388  }
389  }
390 }
391 
392 
395  if (mySwapLane2edge) {
396  if (myEdgeObjects.connections.size() > 0) {
397  return myEdgeObjects.connections.front();
398  } else {
399  return nullptr;
400  }
401  } else {
402  if (myLaneObjects.connections.size() > 0) {
403  return myLaneObjects.connections.front();
404  } else {
405  return nullptr;
406  }
407  }
408 }
409 
410 
413  if (mySwapLane2edge) {
414  if (myEdgeObjects.internalLanes.size() > 0) {
415  return myEdgeObjects.internalLanes.front();
416  } else {
417  return nullptr;
418  }
419  } else {
420  if (myLaneObjects.internalLanes.size() > 0) {
421  return myLaneObjects.internalLanes.front();
422  } else {
423  return nullptr;
424  }
425  }
426 }
427 
428 
429 GNEPOI*
431  if (mySwapLane2edge) {
432  if (myEdgeObjects.POIs.size() > 0) {
433  return myEdgeObjects.POIs.front();
434  } else {
435  return nullptr;
436  }
437  } else {
438  if (myLaneObjects.POIs.size() > 0) {
439  return myLaneObjects.POIs.front();
440  } else {
441  return nullptr;
442  }
443  }
444 }
445 
446 
447 GNEPoly*
449  if (mySwapLane2edge) {
450  if (myEdgeObjects.polys.size() > 0) {
451  return myEdgeObjects.polys.front();
452  } else {
453  return nullptr;
454  }
455  } else {
456  if (myLaneObjects.polys.size() > 0) {
457  return myLaneObjects.polys.front();
458  } else {
459  return nullptr;
460  }
461  }
462 }
463 
464 
465 GNETAZ*
467  if (mySwapLane2edge) {
468  if (myEdgeObjects.TAZs.size() > 0) {
469  return myEdgeObjects.TAZs.front();
470  } else {
471  return nullptr;
472  }
473  } else {
474  if (myLaneObjects.TAZs.size() > 0) {
475  return myLaneObjects.TAZs.front();
476  } else {
477  return nullptr;
478  }
479  }
480 }
481 
482 
485  if (mySwapLane2edge) {
486  if (myEdgeObjects.edgeDatas.size() > 0) {
487  return myEdgeObjects.edgeDatas.front();
488  } else {
489  return nullptr;
490  }
491  } else {
492  if (myLaneObjects.edgeDatas.size() > 0) {
493  return myLaneObjects.edgeDatas.front();
494  } else {
495  return nullptr;
496  }
497  }
498 }
499 
500 
503  if (mySwapLane2edge) {
504  if (myEdgeObjects.edgeRelDatas.size() > 0) {
505  return myEdgeObjects.edgeRelDatas.front();
506  } else {
507  return nullptr;
508  }
509  } else {
510  if (myLaneObjects.edgeRelDatas.size() > 0) {
511  return myLaneObjects.edgeRelDatas.front();
512  } else {
513  return nullptr;
514  }
515  }
516 }
517 
518 
519 const std::vector<GNEAttributeCarrier*>&
521  if (mySwapLane2edge) {
522  return myEdgeObjects.attributeCarriers;
523  } else {
524  return myLaneObjects.attributeCarriers;
525  }
526 }
527 
528 
530 
531 
532 void
534  // just clear all containers
535  GUIGlObjects.clear();
536  attributeCarriers.clear();
537  networkElements.clear();
538  additionals.clear();
539  shapes.clear();
540  TAZElements.clear();
541  demandElements.clear();
542  junctions.clear();
543  edges.clear();
544  lanes.clear();
545  crossings.clear();
546  connections.clear();
547  internalLanes.clear();
548  TAZs.clear();
549  POIs.clear();
550  polys.clear();
551  genericDatas.clear();
552  edgeDatas.clear();
553  edgeRelDatas.clear();
554 }
555 
556 
557 void
558 GNEViewNetHelper::ObjectsUnderCursor::sortGUIGlObjects(const std::vector<GUIGlObject*>& GUIGlObjects) {
559  // declare a map to save GUIGlObjects sorted by GLO_TYPE
560  std::map<double, std::vector<GUIGlObject*> > mySortedGUIGlObjects;
561  // iterate over set
562  for (const auto& GLObject : GUIGlObjects) {
563  // try to parse shape
564  const Shape* shape = dynamic_cast<Shape*>(GLObject);
565  if (shape) {
566  mySortedGUIGlObjects[shape->getShapeLayer()].push_back(GLObject);
567  } else {
568  mySortedGUIGlObjects[GLObject->getType()].push_back(GLObject);
569  }
570  }
571  // move sorted GUIGlObjects into myGUIGlObjectLanes using a reverse iterator
572  for (std::map<double, std::vector<GUIGlObject*> >::reverse_iterator i = mySortedGUIGlObjects.rbegin(); i != mySortedGUIGlObjects.rend(); i++) {
573  for (const auto& GlObject : i->second) {
574  // avoid GLO_NETWORKELEMENT
575  if (GlObject->getType() != GLO_NETWORKELEMENT) {
576  // add it in GUIGlObject splitting by edge/lanes
577  if (GlObject->getType() == GLO_LANE) {
578  myLaneObjects.GUIGlObjects.push_back(GlObject);
579  } else {
580  myEdgeObjects.GUIGlObjects.push_back(GlObject);
581  myLaneObjects.GUIGlObjects.push_back(GlObject);
582  }
583  }
584  }
585  }
586 }
587 
588 
589 void
591  // get front AC
592  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
593  // special case for edges and lanes
594  if (frontAC && (frontAC->getTagProperty().getTag() == SUMO_TAG_EDGE) && (AC->getTagProperty().getTag() == SUMO_TAG_LANE)) {
595  // compare IDs
596  if (AC->getAttribute(GNE_ATTR_PARENT) == frontAC->getID()) {
597  // insert at front
598  container.attributeCarriers.insert(container.attributeCarriers.begin(), AC);
599  } else {
600  // insert at back
601  container.attributeCarriers.push_back(AC);
602  }
603  } else {
604  // add it in attributeCarriers
605  if (AC == frontAC) {
606  // insert at front
607  container.attributeCarriers.insert(container.attributeCarriers.begin(), AC);
608  } else {
609  // insert at back
610  container.attributeCarriers.push_back(AC);
611  }
612  }
613 }
614 
615 
616 void
618  // get front AC
619  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
620  // check front element
621  if (AC == frontAC) {
622  // insert at front
623  container.networkElements.insert(container.networkElements.begin(), dynamic_cast<GNENetworkElement*>(AC));
624  } else {
625  // insert at back
626  container.networkElements.push_back(dynamic_cast<GNENetworkElement*>(AC));
627  }
628  // cast specific network element
629  switch (AC->getGUIGlObject()->getType()) {
630  case GLO_JUNCTION: {
631  // check front element
632  if (AC == frontAC) {
633  // insert at front
634  container.junctions.insert(container.junctions.begin(), dynamic_cast<GNEJunction*>(AC));
635  } else {
636  // insert at back
637  container.junctions.push_back(dynamic_cast<GNEJunction*>(AC));
638  }
639  break;
640  }
641  case GLO_EDGE: {
642  // check front element
643  if (AC == frontAC) {
644  // insert at front
645  container.edges.insert(container.edges.begin(), dynamic_cast<GNEEdge*>(AC));
646  } else {
647  // insert at back
648  container.edges.push_back(dynamic_cast<GNEEdge*>(AC));
649  }
650  break;
651  }
652  case GLO_LANE: {
653  // check front element
654  if (AC == frontAC) {
655  // insert at front
656  container.lanes.insert(container.lanes.begin(), dynamic_cast<GNELane*>(AC));
657  } else {
658  // insert at back
659  container.lanes.push_back(dynamic_cast<GNELane*>(AC));
660  }
661  break;
662  }
663  case GLO_CROSSING: {
664  // check front element
665  if (AC == frontAC) {
666  // insert at front
667  container.crossings.insert(container.crossings.begin(), dynamic_cast<GNECrossing*>(AC));
668  } else {
669  // insert at back
670  container.crossings.push_back(dynamic_cast<GNECrossing*>(AC));
671  }
672  break;
673  }
674  case GLO_CONNECTION: {
675  // check front element
676  if (AC == frontAC) {
677  // insert at front
678  container.connections.insert(container.connections.begin(), dynamic_cast<GNEConnection*>(AC));
679  } else {
680  // insert at back
681  container.connections.push_back(dynamic_cast<GNEConnection*>(AC));
682  }
683  break;
684  }
685  case GLO_TLLOGIC: {
686  // check front element
687  if (AC == frontAC) {
688  // insert at front
689  container.internalLanes.insert(container.internalLanes.begin(), dynamic_cast<GNEInternalLane*>(AC));
690  } else {
691  // insert at back
692  container.internalLanes.push_back(dynamic_cast<GNEInternalLane*>(AC));
693  }
694  break;
695  }
696  default:
697  break;
698  }
699 }
700 
701 
702 void
704  // get additional element
705  GNEAdditional* additionalElement = myViewNet->getNet()->getAttributeCarriers()->retrieveAdditional(AC);
706  // insert depending if is the front attribute carrier
707  if (additionalElement == myViewNet->getFrontAttributeCarrier()) {
708  // insert at front
709  container.additionals.insert(container.additionals.begin(), additionalElement);
710  } else {
711  // insert at back
712  container.additionals.push_back(additionalElement);
713  }
714 }
715 
716 
717 void
719  // get TAZ element
720  GNETAZElement* TAZElement = myViewNet->getNet()->getAttributeCarriers()->retrieveTAZElement(AC);
721  // insert depending if is the front attribute carrier
722  if (TAZElement == myViewNet->getFrontAttributeCarrier()) {
723  // insert at front
724  container.TAZElements.insert(container.TAZElements.begin(), TAZElement);
725  } else {
726  // insert at back
727  container.TAZElements.push_back(TAZElement);
728  }
729  // cast specific TAZ
730  if (AC->getGUIGlObject()->getType() == GLO_TAZ) {
731  // cast TAZ
732  GNETAZ* TAZ = dynamic_cast<GNETAZ*>(TAZElement);
733  if (TAZ) {
734  // check front element
735  if (AC == myViewNet->getFrontAttributeCarrier()) {
736  // insert at front
737  container.TAZs.insert(container.TAZs.begin(), TAZ);
738  } else {
739  // insert at back
740  container.TAZs.push_back(TAZ);
741  }
742  }
743  }
744 }
745 
746 
747 void
749  // get shape element
750  GNEShape* shapeElement = myViewNet->getNet()->getAttributeCarriers()->retrieveShape(AC);
751  // insert depending if is the front attribute carrier
752  if (shapeElement == myViewNet->getFrontAttributeCarrier()) {
753  // insert at front
754  container.shapes.insert(container.shapes.begin(), shapeElement);
755  } else {
756  // insert at back
757  container.shapes.push_back(shapeElement);
758  }
759  // cast specific shape
760  if (AC->getGUIGlObject()->getType() == GLO_POI) {
761  // cast POI
762  GNEPOI* POI = dynamic_cast<GNEPOI*>(shapeElement);
763  if (POI) {
764  // check front element
765  if (AC == myViewNet->getFrontAttributeCarrier()) {
766  // insert at front
767  container.POIs.insert(container.POIs.begin(), POI);
768  } else {
769  // insert at back
770  container.POIs.push_back(POI);
771  }
772  }
773  } else if (AC->getGUIGlObject()->getType() == GLO_POLYGON) {
774  // cast poly
775  GNEPoly* poly = dynamic_cast<GNEPoly*>(shapeElement);
776  if (poly) {
777  // check front element
778  if (AC == myViewNet->getFrontAttributeCarrier()) {
779  // insert at front
780  container.polys.insert(container.polys.begin(), poly);
781  } else {
782  // insert at back
783  container.polys.push_back(poly);
784  }
785  }
786  }
787 }
788 
789 
790 void
792  // get demandElement
793  GNEDemandElement* demandElement = myViewNet->getNet()->getAttributeCarriers()->retrieveDemandElement(AC);
794  // insert depending if is the front attribute carrier
795  if (demandElement == myViewNet->getFrontAttributeCarrier()) {
796  // insert at front
797  container.demandElements.insert(container.demandElements.begin(), demandElement);
798  } else {
799  // insert at back
800  container.demandElements.push_back(demandElement);
801  }
802 }
803 
804 
805 void
807  // get front AC
808  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
809  // cast generic data from attribute carrier
810  if (AC == frontAC) {
811  // insert at front
812  container.genericDatas.insert(container.genericDatas.begin(), dynamic_cast<GNEGenericData*>(AC));
813  } else {
814  // insert at back
815  container.genericDatas.push_back(dynamic_cast<GNEGenericData*>(AC));
816  }
817  // cast specific generic data
818  switch (AC->getGUIGlObject()->getType()) {
819  case GLO_EDGEDATA:
820  // check front element
821  if (AC == frontAC) {
822  // insert at front
823  container.edgeDatas.insert(container.edgeDatas.begin(), dynamic_cast<GNEEdgeData*>(AC));
824  } else {
825  // insert at back
826  container.edgeDatas.push_back(dynamic_cast<GNEEdgeData*>(AC));
827  }
828  break;
829  case GLO_EDGERELDATA:
830  // check front element
831  if (AC == frontAC) {
832  // insert at front
833  container.edgeRelDatas.insert(container.edgeRelDatas.begin(), dynamic_cast<GNEEdgeRelData*>(AC));
834  } else {
835  // insert at back
836  container.edgeRelDatas.push_back(dynamic_cast<GNEEdgeRelData*>(AC));
837  }
838  break;
839  default:
840  break;
841  }
842 }
843 
844 
845 void
847  // first clear GUIGlObjects
848  container.GUIGlObjects.clear();
849  // reserve
850  container.GUIGlObjects.reserve(container.attributeCarriers.size());
851  // iterate over atribute carriers
852  for (const auto& attributeCarrrier : container.attributeCarriers) {
853  // add GUIGlObject in GUIGlObjects container
854  container.GUIGlObjects.push_back(attributeCarrrier->getGUIGlObject());
855  }
856 }
857 
858 
860  myViewNet(nullptr),
861  mySwapLane2edge(false) {
862 }
863 
864 // ---------------------------------------------------------------------------
865 // GNEViewNetHelper::MouseButtonKeyPressed - methods
866 // ---------------------------------------------------------------------------
867 
869  myEventInfo(nullptr) {
870 }
871 
872 
873 void
875  myEventInfo = (FXEvent*) eventData;
876 }
877 
878 
879 bool
881  if (myEventInfo) {
882  return (myEventInfo->state & SHIFTMASK) != 0;
883  } else {
884  return false;
885  }
886 }
887 
888 
889 bool
891  if (myEventInfo) {
892  return (myEventInfo->state & CONTROLMASK) != 0;
893  } else {
894  return false;
895  }
896 }
897 
898 
899 bool
901  if (myEventInfo) {
902  return (myEventInfo->state & ALTMASK) != 0;
903  } else {
904  return false;
905  }
906 }
907 
908 
909 bool
911  if (myEventInfo) {
912  return (myEventInfo->state & LEFTBUTTONMASK) != 0;
913  } else {
914  return false;
915  }
916 }
917 
918 
919 bool
921  if (myEventInfo) {
922  return (myEventInfo->state & RIGHTBUTTONMASK) != 0;
923  } else {
924  return false;
925  }
926 }
927 
928 // ---------------------------------------------------------------------------
929 // GNEViewNetHelper::MoveSingleElementValues - methods
930 // ---------------------------------------------------------------------------
931 
933  myViewNet(viewNet) {
934 }
935 
936 
937 bool
939  // first obtain moving reference (common for all)
940  myRelativeClickedPosition = myViewNet->getPositionInformation();
941  // get edited element
942  const GNENetworkElement* editedElement = myViewNet->myEditNetworkElementShapes.getEditedNetworkElement();
943  // check what type of AC will be moved
944  if (myViewNet->myObjectsUnderCursor.getJunctionFront() && (myViewNet->myObjectsUnderCursor.getJunctionFront() == editedElement)) {
945  // get move operation
946  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getJunctionFront()->getMoveOperation();
947  // continue if move operation is valid
948  if (moveOperation) {
949  myMoveOperations.push_back(moveOperation);
950  return true;
951  } else {
952  return false;
953  }
954  } else if (myViewNet->myObjectsUnderCursor.getLaneFront() && (myViewNet->myObjectsUnderCursor.getLaneFront() == editedElement)) {
955  // get move operation
956  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getLaneFront()->getMoveOperation();
957  // continue if move operation is valid
958  if (moveOperation) {
959  myMoveOperations.push_back(moveOperation);
960  return true;
961  } else {
962  return false;
963  }
964  } else if (myViewNet->myObjectsUnderCursor.getCrossingFront() && (myViewNet->myObjectsUnderCursor.getCrossingFront() == editedElement)) {
965  // get move operation
966  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getCrossingFront()->getMoveOperation();
967  // continue if move operation is valid
968  if (moveOperation) {
969  myMoveOperations.push_back(moveOperation);
970  return true;
971  } else {
972  return false;
973  }
974  } else if (myViewNet->myObjectsUnderCursor.getConnectionFront() && (myViewNet->myObjectsUnderCursor.getConnectionFront() == editedElement)) {
975  // get move operation
976  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getConnectionFront()->getMoveOperation();
977  // continue if move operation is valid
978  if (moveOperation) {
979  myMoveOperations.push_back(moveOperation);
980  return true;
981  } else {
982  return false;
983  }
984  } else {
985  // there isn't moved items, then return false
986  return false;
987  }
988 }
989 
990 
991 bool
993  // first obtain moving reference (common for all)
994  myRelativeClickedPosition = myViewNet->getPositionInformation();
995  // get front AC
996  const GNEAttributeCarrier* frontAC = myViewNet->myObjectsUnderCursor.getAttributeCarrierFront();
997  // check what type of AC will be moved
998  if (myViewNet->myObjectsUnderCursor.getPolyFront() && (frontAC == myViewNet->myObjectsUnderCursor.getPolyFront())) {
999  // get move operation
1000  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getPolyFront()->getMoveOperation();
1001  // continue if move operation is valid
1002  if (moveOperation) {
1003  myMoveOperations.push_back(moveOperation);
1004  return true;
1005  } else {
1006  return false;
1007  }
1008  } else if (myViewNet->myObjectsUnderCursor.getPOIFront() && (frontAC == myViewNet->myObjectsUnderCursor.getPOIFront())) {
1009  // get move operation
1010  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getPOIFront()->getMoveOperation();
1011  // continue if move operation is valid
1012  if (moveOperation) {
1013  myMoveOperations.push_back(moveOperation);
1014  return true;
1015  } else {
1016  return false;
1017  }
1018  } else if (myViewNet->myObjectsUnderCursor.getAdditionalFront() && (frontAC == myViewNet->myObjectsUnderCursor.getAdditionalFront())) {
1019  // get move operation
1020  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getAdditionalFront()->getMoveOperation();
1021  // continue if move operation is valid
1022  if (moveOperation) {
1023  myMoveOperations.push_back(moveOperation);
1024  return true;
1025  } else {
1026  return false;
1027  }
1028  } else if (myViewNet->myObjectsUnderCursor.getTAZFront() && (frontAC == myViewNet->myObjectsUnderCursor.getTAZFront())) {
1029  // get move operation
1030  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getTAZFront()->getMoveOperation();
1031  // continue if move operation is valid
1032  if (moveOperation) {
1033  myMoveOperations.push_back(moveOperation);
1034  return true;
1035  } else {
1036  return false;
1037  }
1038  } else if (myViewNet->myObjectsUnderCursor.getJunctionFront() && (frontAC == myViewNet->myObjectsUnderCursor.getJunctionFront())) {
1039  // get move operation
1040  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getJunctionFront()->getMoveOperation();
1041  // continue if move operation is valid
1042  if (moveOperation) {
1043  myMoveOperations.push_back(moveOperation);
1044  return true;
1045  } else {
1046  return false;
1047  }
1048  } else if ((myViewNet->myObjectsUnderCursor.getEdgeFront() && (frontAC == myViewNet->myObjectsUnderCursor.getEdgeFront())) ||
1049  (myViewNet->myObjectsUnderCursor.getLaneFront() && (frontAC == myViewNet->myObjectsUnderCursor.getLaneFront()))) {
1050  // calculate Edge movement values (can be entire shape, single geometry points, altitude, etc.)
1051  if (myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1052  // edit end point
1053  myViewNet->myObjectsUnderCursor.getEdgeFront()->editEndpoint(myViewNet->getPositionInformation(), myViewNet->myUndoList);
1054  // edge values wasn't calculated, then return false
1055  return false;
1056  } else {
1057  // get move operation
1058  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getEdgeFront()->getMoveOperation();
1059  // continue if move operation is valid
1060  if (moveOperation) {
1061  myMoveOperations.push_back(moveOperation);
1062  return true;
1063  } else {
1064  return false;
1065  }
1066  }
1067  } else {
1068  // there isn't moved items, then return false
1069  return false;
1070  }
1071 }
1072 
1073 
1074 bool
1076  // first obtain moving reference (common for all)
1077  myRelativeClickedPosition = myViewNet->getPositionInformation();
1078  // get front AC
1079  const GNEAttributeCarrier* frontAC = myViewNet->myObjectsUnderCursor.getAttributeCarrierFront();
1080  // check demand element
1081  if (myViewNet->myObjectsUnderCursor.getDemandElementFront() && (frontAC == myViewNet->myObjectsUnderCursor.getDemandElementFront())) {
1082  // get move operation
1083  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getDemandElementFront()->getMoveOperation();
1084  // continue if move operation is valid
1085  if (moveOperation) {
1086  myMoveOperations.push_back(moveOperation);
1087  return true;
1088  } else {
1089  return false;
1090  }
1091 
1092  } else {
1093  // there isn't moved items, then return false
1094  return false;
1095  }
1096 }
1097 
1098 
1099 void
1101  // calculate moveOffset
1102  const GNEMoveOffset moveOffset = calculateMoveOffset();
1103  // check if mouse button is pressed
1104  if (mouseLeftButtonPressed) {
1105  // iterate over all operations
1106  for (const auto& moveOperation : myMoveOperations) {
1107  // move elements
1108  GNEMoveElement::moveElement(myViewNet, moveOperation, moveOffset);
1109  }
1110  } else {
1111  // iterate over all operations
1112  for (const auto& moveOperation : myMoveOperations) {
1113  // commit move
1114  GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1115  // don't forget delete move operation
1116  delete moveOperation;
1117  }
1118  // clear move operations
1119  myMoveOperations.clear();
1120  }
1121 }
1122 
1123 
1124 void
1126  // calculate moveOffset
1127  const GNEMoveOffset moveOffset = calculateMoveOffset();
1128  // finish all move operations
1129  for (const auto& moveOperation : myMoveOperations) {
1130  GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1131  // don't forget delete move operation
1132  delete moveOperation;
1133  }
1134  // clear move operations
1135  myMoveOperations.clear();
1136 }
1137 
1138 
1139 const GNEMoveOffset
1141  // calculate moveOffset depending of current mouse position and relative clicked position
1142  // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1143  Position moveOffset = (myViewNet->getPositionInformation() - myViewNet->myMoveSingleElementValues.myRelativeClickedPosition);
1144  // calculate Z depending of moveElevation
1145  if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1146  // use Y as Z value and return Z move offset
1147  return GNEMoveOffset(moveOffset.y());
1148  } else {
1149  // return X-Y move offset
1150  return GNEMoveOffset(moveOffset.x(), moveOffset.y());
1151  }
1152 }
1153 
1154 // ---------------------------------------------------------------------------
1155 // GNEViewNetHelper::MoveMultipleElementValues - methods
1156 // ---------------------------------------------------------------------------
1157 
1159  myViewNet(viewNet),
1160  myMovingSelectedEdge(false),
1161  myEdgeOffset(0) {
1162 }
1163 
1164 
1165 void
1167  // save clicked position (to calculate offset)
1168  myClickedPosition = myViewNet->getPositionInformation();
1169  // continue depending of clicked element
1170  if (myViewNet->myObjectsUnderCursor.getJunctionFront()) {
1171  calculateJunctionSelection();
1172  } else if (myViewNet->myObjectsUnderCursor.getEdgeFront()) {
1173  calculateEdgeSelection(myViewNet->myObjectsUnderCursor.getEdgeFront());
1174  }
1175 }
1176 
1177 
1178 void
1180  // calculate moveOffset
1181  const GNEMoveOffset moveOffset = calculateMoveOffset();
1182  // check if mouse button is pressed
1183  if (mouseLeftButtonPressed) {
1184  // iterate over all operations
1185  for (const auto& moveOperation : myMoveOperations) {
1186  // move elements
1187  GNEMoveElement::moveElement(myViewNet, moveOperation, moveOffset);
1188  }
1189  } else if (myMoveOperations.size() > 0) {
1190  // begin undo list
1191  myViewNet->getUndoList()->begin(GUIIcon::MODEMOVE, "moving selection");
1192  // iterate over all operations
1193  for (const auto& moveOperation : myMoveOperations) {
1194  // commit move
1195  GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1196  // don't forget delete move operation
1197  delete moveOperation;
1198  }
1199  // end undo list
1200  myViewNet->getUndoList()->end();
1201  // clear move operations
1202  myMoveOperations.clear();
1203  }
1204 }
1205 
1206 
1207 void
1209  // calculate moveOffset
1210  const GNEMoveOffset moveOffset = calculateMoveOffset();
1211  // begin undo list
1212  myViewNet->getUndoList()->begin(GUIIcon::MODEMOVE, "moving selection");
1213  // finish all move operations
1214  for (const auto& moveOperation : myMoveOperations) {
1215  GNEMoveElement::commitMove(myViewNet, moveOperation, moveOffset, myViewNet->getUndoList());
1216  // don't forget delete move operation
1217  delete moveOperation;
1218  }
1219  // end undo list
1220  myViewNet->getUndoList()->end();
1221  // clear move operations
1222  myMoveOperations.clear();
1223 }
1224 
1225 
1226 bool
1228  return (myMoveOperations.size() > 0);
1229 }
1230 
1231 
1232 bool
1234  return myMovingSelectedEdge;
1235 }
1236 
1237 
1238 void
1240  myMovingSelectedEdge = false;
1241 }
1242 
1243 
1244 double
1246  return myEdgeOffset;
1247 }
1248 
1249 
1250 const GNEMoveOffset
1252  // calculate moveOffset depending of current mouse position and relative clicked position
1253  // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1254  Position moveOffset = (myViewNet->getPositionInformation() - myClickedPosition);
1255  // calculate Z depending of moveElevation
1256  if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1257  // use Y for Z and return X move offset
1258  return GNEMoveOffset(moveOffset.y());
1259  } else {
1260  // return X-Y move offset
1261  return GNEMoveOffset(moveOffset.x(), moveOffset.y());
1262  }
1263 }
1264 
1265 
1266 void
1268  // declare move operation
1269  GNEMoveOperation* moveOperation = nullptr;
1270  // first move all selected junctions
1271  const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
1272  // iterate over selected junctions
1273  for (const auto& junction : selectedJunctions) {
1274  moveOperation = junction->getMoveOperation();
1275  if (moveOperation) {
1276  myMoveOperations.push_back(moveOperation);
1277  }
1278  }
1279  // now move all selected edges
1280  const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
1281  // iterate over selected edges
1282  for (const auto& edge : selectedEdges) {
1283  moveOperation = edge->getMoveOperation();
1284  if (moveOperation) {
1285  myMoveOperations.push_back(moveOperation);
1286  }
1287  }
1288 }
1289 
1290 
1291 void
1293  // first move all selected junctions
1294  const auto selectedJunctions = myViewNet->getNet()->getAttributeCarriers()->getSelectedJunctions();
1295  // iterate over selected junctions
1296  for (const auto& junction : selectedJunctions) {
1297  GNEMoveOperation* moveOperation = junction->getMoveOperation();
1298  if (moveOperation) {
1299  myMoveOperations.push_back(moveOperation);
1300  }
1301  }
1302  // enable moving selected edge flag
1303  myMovingSelectedEdge = true;
1304  // get edge shape
1305  const auto& shape = clickedEdge->getNBEdge()->getGeometry();
1306  // calculate offset based on the clicked edge shape and convex angle
1307  if (clickedEdge->isConvexAngle()) {
1308  myEdgeOffset = shape.nearest_offset_to_point2D(myViewNet->getPositionInformation());
1309  } else {
1310  myEdgeOffset = shape.length2D() - shape.nearest_offset_to_point2D(myViewNet->getPositionInformation());
1311  }
1312  // now move all selected edges
1313  const auto selectedEdges = myViewNet->getNet()->getAttributeCarriers()->getSelectedEdges();
1314  // iterate over edges betwen 0 and 180 degrees
1315  for (const auto& edge : selectedEdges) {
1316  GNEMoveOperation* moveOperation = edge->getMoveOperation();
1317  // continue if move operation is valid
1318  if (moveOperation) {
1319  myMoveOperations.push_back(moveOperation);
1320  }
1321  }
1322 }
1323 
1324 // ---------------------------------------------------------------------------
1325 // GNEViewNetHelper::VehicleOptions - methods
1326 // ---------------------------------------------------------------------------
1327 
1329  myViewNet(viewNet) {
1330 }
1331 
1332 
1333 void
1335  UNUSED_PARAMETER(myViewNet);
1336  // currently unused
1337 }
1338 
1339 
1340 void
1342  // currently unused
1343 }
1344 
1345 // ---------------------------------------------------------------------------
1346 // GNEViewNetHelper::VehicleTypeOptions - methods
1347 // ---------------------------------------------------------------------------
1348 
1350  myViewNet(viewNet) {
1351 }
1352 
1353 
1354 void
1356  UNUSED_PARAMETER(myViewNet);
1357  // currently unused
1358 }
1359 
1360 
1361 void
1363  // currently unused
1364 }
1365 
1366 // ---------------------------------------------------------------------------
1367 // GNEViewNetHelper::SelectingArea - methods
1368 // ---------------------------------------------------------------------------
1369 
1371  selectingUsingRectangle(false),
1372  startDrawing(false),
1373  myViewNet(viewNet) {
1374 }
1375 
1376 
1377 void
1379  selectingUsingRectangle = true;
1380  selectionCorner1 = myViewNet->getPositionInformation();
1381  selectionCorner2 = selectionCorner1;
1382 }
1383 
1384 
1385 void
1387  // start drawing
1388  startDrawing = true;
1389  // only update selection corner 2
1390  selectionCorner2 = myViewNet->getPositionInformation();
1391  // update status bar
1392  myViewNet->setStatusBarText("Selection width:" + toString(fabs(selectionCorner1.x() - selectionCorner2.x()))
1393  + " height:" + toString(fabs(selectionCorner1.y() - selectionCorner2.y()))
1394  + " diagonal:" + toString(selectionCorner1.distanceTo2D(selectionCorner2)));
1395 }
1396 
1397 
1398 void
1400  // finish rectangle selection
1401  selectingUsingRectangle = false;
1402  startDrawing = false;
1403 }
1404 
1405 
1406 void
1408  // shift held down on mouse-down and mouse-up and check that rectangle exist
1409  if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1410  (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1411  myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1412  // create boundary between two corners
1413  Boundary rectangleBoundary;
1414  rectangleBoundary.add(selectionCorner1);
1415  rectangleBoundary.add(selectionCorner2);
1416  // process selection within boundary
1417  processBoundarySelection(rectangleBoundary);
1418  }
1419 }
1420 
1421 
1422 std::vector<GNEEdge*>
1424  // declare vector for selection
1425  std::vector<GNEEdge*> result;
1426  // shift held down on mouse-down and mouse-up and check that rectangle exist
1427  if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1428  (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1429  myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1430  // create boundary between two corners
1431  Boundary rectangleBoundary;
1432  rectangleBoundary.add(selectionCorner1);
1433  rectangleBoundary.add(selectionCorner2);
1434  if (myViewNet->makeCurrent()) {
1435  // obtain all ACs in Rectangle BOundary
1436  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundary = myViewNet->getAttributeCarriersInBoundary(rectangleBoundary);
1437  // Filter ACs in Boundary and get only edges
1438  for (const auto& AC : ACsInBoundary) {
1439  if (AC.second->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1440  result.push_back(dynamic_cast<GNEEdge*>(AC.second));
1441  }
1442  }
1443  myViewNet->makeNonCurrent();
1444  }
1445  }
1446  return result;
1447 }
1448 
1449 
1450 void
1452  processBoundarySelection(shape.getBoxBoundary());
1453 }
1454 
1455 
1456 void
1458  if (selectingUsingRectangle) {
1460  glTranslated(0, 0, GLO_RECTANGLESELECTION);
1461  GLHelper::setColor(color);
1462  glLineWidth(2);
1463  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1464  glBegin(GL_QUADS);
1465  glVertex2d(selectionCorner1.x(), selectionCorner1.y());
1466  glVertex2d(selectionCorner1.x(), selectionCorner2.y());
1467  glVertex2d(selectionCorner2.x(), selectionCorner2.y());
1468  glVertex2d(selectionCorner2.x(), selectionCorner1.y());
1469  glEnd();
1471  }
1472 }
1473 
1474 
1475 void
1477  if (myViewNet->makeCurrent()) {
1478  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundary = myViewNet->getAttributeCarriersInBoundary(boundary);
1479  // filter ACsInBoundary depending of current supermode
1480  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundaryFiltered;
1481  for (const auto& AC : ACsInBoundary) {
1482  if (myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
1483  if (AC.second->getTagProperty().isNetworkElement() || AC.second->getTagProperty().isAdditionalElement() ||
1484  AC.second->getTagProperty().isTAZElement() || AC.second->getTagProperty().isShape()) {
1485  ACsInBoundaryFiltered.insert(AC);
1486  }
1487  } else if (myViewNet->myEditModes.isCurrentSupermodeDemand() && AC.second->getTagProperty().isDemandElement()) {
1488  ACsInBoundaryFiltered.insert(AC);
1489  } else if (myViewNet->myEditModes.isCurrentSupermodeData() && AC.second->getTagProperty().isGenericData()) {
1490  ACsInBoundaryFiltered.insert(AC);
1491  }
1492  }
1493  // declare two sets of attribute carriers, one for select and another for unselect
1494  std::vector<GNEAttributeCarrier*> ACToSelect;
1495  std::vector<GNEAttributeCarrier*> ACToUnselect;
1496  // reserve memory (we assume that in the worst case we're going to insert all elements of ACsInBoundaryFiltered
1497  ACToSelect.reserve(ACsInBoundaryFiltered.size());
1498  ACToUnselect.reserve(ACsInBoundaryFiltered.size());
1499  // in restrict AND replace mode all current selected attribute carriers will be unselected
1500  if ((myViewNet->myViewParent->getSelectorFrame()->getModificationModeModule()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::RESTRICT) ||
1501  (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModule()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::REPLACE)) {
1502  // obtain selected ACs depending of current supermode
1503  const auto selectedAC = myViewNet->getNet()->getAttributeCarriers()->getSelectedAttributeCarriers(false);
1504  // add id into ACs to unselect
1505  for (const auto& AC : selectedAC) {
1506  ACToUnselect.push_back(AC);
1507  }
1508  }
1509  // iterate over AtributeCarriers obtained of boundary an place it in ACToSelect or ACToUnselect
1510  for (const auto& AC : ACsInBoundaryFiltered) {
1511  switch (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModule()->getModificationMode()) {
1513  ACToUnselect.push_back(AC.second);
1514  break;
1516  if (std::find(ACToUnselect.begin(), ACToUnselect.end(), AC.second) != ACToUnselect.end()) {
1517  ACToSelect.push_back(AC.second);
1518  }
1519  break;
1520  default:
1521  ACToSelect.push_back(AC.second);
1522  break;
1523  }
1524  }
1525  // select junctions and their connections and crossings if Auto select junctions is enabled (note: only for "add mode")
1526  if (myViewNet->autoSelectNodes() && (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModule()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::ADD)) {
1527  std::vector<GNEEdge*> edgesToSelect;
1528  // iterate over ACToSelect and extract edges
1529  for (const auto& AC : ACToSelect) {
1530  if (AC->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1531  edgesToSelect.push_back(dynamic_cast<GNEEdge*>(AC));
1532  }
1533  }
1534  // iterate over extracted edges
1535  for (const auto& edge : edgesToSelect) {
1536  // select junction source and all their connections and crossings
1537  ACToSelect.push_back(edge->getFromJunction());
1538  for (const auto& connection : edge->getFromJunction()->getGNEConnections()) {
1539  ACToSelect.push_back(connection);
1540  }
1541  for (const auto& crossing : edge->getFromJunction()->getGNECrossings()) {
1542  ACToSelect.push_back(crossing);
1543  }
1544  // select junction destiny and all their connections crossings
1545  ACToSelect.push_back(edge->getToJunction());
1546  for (const auto& connection : edge->getToJunction()->getGNEConnections()) {
1547  ACToSelect.push_back(connection);
1548  }
1549  for (const auto& crossing : edge->getToJunction()->getGNECrossings()) {
1550  ACToSelect.push_back(crossing);
1551  }
1552  }
1553  }
1554  // only continue if there is ACs to select or unselect
1555  if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
1556  // first unselect AC of ACToUnselect and then selects AC of ACToSelect
1557  myViewNet->myUndoList->begin(GUIIcon::MODESELECT, "selection using rectangle");
1558  for (const auto& AC : ACToUnselect) {
1559  AC->setAttribute(GNE_ATTR_SELECTED, "0", myViewNet->myUndoList);
1560  }
1561  for (const auto& AC : ACToSelect) {
1562  if (AC->getTagProperty().isSelectable()) {
1563  AC->setAttribute(GNE_ATTR_SELECTED, "1", myViewNet->myUndoList);
1564  }
1565  }
1566  myViewNet->myUndoList->end();
1567  }
1568  myViewNet->makeNonCurrent();
1569  }
1570 }
1571 
1572 // ---------------------------------------------------------------------------
1573 // GNEViewNetHelper::TestingMode - methods
1574 // ---------------------------------------------------------------------------
1575 
1577  myViewNet(viewNet),
1578  myTestingEnabled(OptionsCont::getOptions().getBool("gui-testing")),
1579  myTestingWidth(0),
1580  myTestingHeight(0) {
1581 }
1582 
1583 
1584 void
1586  // first check if testing mode is enabled and window size is correct
1587  if (myTestingEnabled && OptionsCont::getOptions().isSet("window-size")) {
1588  std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
1589  // make sure that given windows size has exactly two valid int values
1590  if ((windowSize.size() == 2) && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
1591  myTestingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
1592  myTestingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
1593  } else {
1594  WRITE_ERROR("Invalid windows size-format: " + toString(windowSize) + "for option 'window-size'");
1595  }
1596  }
1597 }
1598 
1599 
1600 void
1602  // first check if testing mode is neabled
1603  if (myTestingEnabled) {
1604  // check if main windows has to be resized
1605  if (myTestingWidth > 0) {
1606  mainWindow->resize(myTestingWidth, myTestingHeight);
1607  }
1608  //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
1609  // draw pink square in the upper left corner on top of everything
1611  const double size = myViewNet->p2m(32);
1612  Position center = myViewNet->screenPos2NetPos(8, 8);
1613  // magenta
1616  glTranslated(center.x(), center.y(), GLO_TESTELEMENT);
1617  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1618  glBegin(GL_QUADS);
1619  glVertex2d(0, 0);
1620  glVertex2d(0, -size);
1621  glVertex2d(size, -size);
1622  glVertex2d(size, 0);
1623  glEnd();
1625  // blue
1628  glTranslated(center.x(), center.y(), GLO_TESTELEMENT + 1);
1629  glScaled(0.7, 0.7, 0);
1630  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1631  glBegin(GL_QUADS);
1632  glVertex2d(0, 0);
1633  glVertex2d(0, -size);
1634  glVertex2d(size, -size);
1635  glVertex2d(size, 0);
1636  glEnd();
1638  // yellow
1641  glTranslated(center.x(), center.y(), GLO_TESTELEMENT + 2);
1642  glScaled(0.4, 0.4, 0);
1643  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1644  glBegin(GL_QUADS);
1645  glVertex2d(0, 0);
1646  glVertex2d(0, -size);
1647  glVertex2d(size, -size);
1648  glVertex2d(size, 0);
1649  glEnd();
1651  // show box with the current position relative to pink square
1653  Position posRelative = myViewNet->screenPos2NetPos(myViewNet->getWidth() - 40, myViewNet->getHeight() - 20);
1654  // adjust cursor position (24,25) to show exactly the same position as in function netedit.leftClick(match, X, Y)
1655  GLHelper::drawTextBox(toString(myViewNet->getWindowCursorPosition().x() - 24) + " " + toString(myViewNet->getWindowCursorPosition().y() - 25), posRelative, GLO_TESTELEMENT, myViewNet->p2m(20), RGBColor::BLACK, RGBColor::WHITE);
1657  }
1658 }
1659 
1660 
1661 bool
1663  return myTestingEnabled;
1664 }
1665 
1666 // ---------------------------------------------------------------------------
1667 // GNEViewNetHelper::SaveElements - methods
1668 // ---------------------------------------------------------------------------
1669 
1671  saveAll(nullptr),
1672  saveNetwork(nullptr),
1673  saveAdditionalElements(nullptr),
1674  saveDemandElements(nullptr),
1675  saveDataElements(nullptr),
1676  myViewNet(viewNet) {
1677 }
1678 
1679 
1680 void
1682  // create save network button
1683  saveAll = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1684  "\tSave all\tSave all elements.", GUIIconSubSys::getIcon(GUIIcon::SAVEALLELEMENTS),
1685  myViewNet->getViewParent()->getGNEAppWindows(), MID_GNE_SAVEALLELEMENTS, GUIDesignButtonToolbar);
1686  saveAll->create();
1687  // create save network button
1688  saveNetwork = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1689  "\tSave network\tSave network. (Ctrl+S)", GUIIconSubSys::getIcon(GUIIcon::SAVENETWORKELEMENTS),
1690  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK, GUIDesignButtonToolbar);
1691  saveNetwork->create();
1692  // create save additional elements button
1693  saveAdditionalElements = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1694  "\tSave additional elements\tSave additional elements. (Ctrl+Shift+A)", GUIIconSubSys::getIcon(GUIIcon::SAVEADDITIONALELEMENTS),
1695  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_A_SAVEADDITIONALS, GUIDesignButtonToolbar);
1696  saveAdditionalElements->create();
1697  // create save demand elements button
1698  saveDemandElements = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1699  "\tSave demand elements\tSave demand elements. (Ctrl+Shift+D)", GUIIconSubSys::getIcon(GUIIcon::SAVEDEMANDELEMENTS),
1700  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS, GUIDesignButtonToolbar);
1701  saveDemandElements->create();
1702  // create save data elements button
1703  saveDataElements = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1704  "\tSave data elements\tSave data elements. (Ctrl+Shift+B)", GUIIconSubSys::getIcon(GUIIcon::SAVEDATAELEMENTS),
1705  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS, GUIDesignButtonToolbar);
1706  saveDataElements->create();
1707  // recalc menu bar because there is new elements
1708  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements->recalc();
1709  // show menu bar modes
1710  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements->show();
1711 }
1712 
1713 // ---------------------------------------------------------------------------
1714 // GNEViewNetHelper::EditModes - methods
1715 // ---------------------------------------------------------------------------
1716 
1718  currentSupermode(Supermode::NETWORK),
1720  demandEditMode(DemandEditMode::DEMAND_INSPECT),
1721  dataEditMode(DataEditMode::DATA_INSPECT),
1722  networkButton(nullptr),
1723  demandButton(nullptr),
1724  dataButton(nullptr),
1725  myViewNet(viewNet)
1726 { }
1727 
1728 
1729 void
1731  // create network button
1732  networkButton = new MFXCheckableButton(false,
1733  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes, "Network\t\tSet mode for edit network elements. (F2)",
1735  networkButton->create();
1736  // create demand button
1737  demandButton = new MFXCheckableButton(false,
1738  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes, "Demand\t\tSet mode for edit traffic demand. (F3)",
1740  demandButton->create();
1741  // create data button
1742  dataButton = new MFXCheckableButton(false,
1743  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes, "Data\t\tSet mode for edit data demand. (F4)",
1745  dataButton->create();
1746  // recalc menu bar because there is new elements
1747  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
1748  // show menu bar modes
1749  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes->show();
1750 }
1751 
1752 
1753 void
1755  if (!force && (supermode == currentSupermode)) {
1756  myViewNet->setStatusBarText("Mode already selected");
1757  if (myViewNet->myCurrentFrame != nullptr) {
1758  myViewNet->myCurrentFrame->focusUpperElement();
1759  }
1760  } else {
1761  myViewNet->setStatusBarText("");
1762  // abort current operation
1763  myViewNet->abortOperation(false);
1764  // set super mode
1765  currentSupermode = supermode;
1766  // set supermodes
1767  if (supermode == Supermode::NETWORK) {
1768  // change buttons
1769  networkButton->setChecked(true);
1770  demandButton->setChecked(false);
1771  dataButton->setChecked(false);
1772  // show network buttons
1773  myViewNet->myNetworkCheckableButtons.showNetworkCheckableButtons();
1774  // hide demand buttons
1775  myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
1776  // hide data buttons
1777  myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
1778  // force update network mode
1779  setNetworkEditMode(networkEditMode, true);
1780  } else if (supermode == Supermode::DEMAND) {
1781  // change buttons
1782  networkButton->setChecked(false);
1783  demandButton->setChecked(true);
1784  dataButton->setChecked(false);
1785  // hide network buttons
1786  myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
1787  // show demand buttons
1788  myViewNet->myDemandCheckableButtons.showDemandCheckableButtons();
1789  // hide data buttons
1790  myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
1791  // force update demand mode
1792  setDemandEditMode(demandEditMode, true);
1793  // demand modes require ALWAYS a recomputing
1794  myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
1795  // check if update path calculator
1796  if (!myViewNet->myNet->getPathManager()->getPathCalculator()->isPathCalculatorUpdated()) {
1797  // update DijkstraRouter of RouteCalculatorInstance
1798  myViewNet->myNet->getPathManager()->getPathCalculator()->updatePathCalculator();
1799  // compute all demand elements
1800  myViewNet->myNet->computeDemandElements(myViewNet->myViewParent->getGNEAppWindows());
1801  }
1802  } else if (supermode == Supermode::DATA) {
1803  // change buttons
1804  networkButton->setChecked(false);
1805  demandButton->setChecked(false);
1806  dataButton->setChecked(true);
1807  // hide network buttons
1808  myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
1809  // hide demand buttons
1810  myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
1811  // show data buttons
1812  myViewNet->myDataCheckableButtons.showDataCheckableButtons();
1813  // force update data mode
1814  setDataEditMode(dataEditMode, true);
1815  // check if update path calculator
1816  if (!myViewNet->myNet->getPathManager()->getPathCalculator()->isPathCalculatorUpdated()) {
1817  // update DijkstraRouter of RouteCalculatorInstance
1818  myViewNet->myNet->getPathManager()->getPathCalculator()->updatePathCalculator();
1819  // compute all demand elements
1820  myViewNet->myNet->computeDemandElements(myViewNet->myViewParent->getGNEAppWindows());
1821  }
1822  }
1823  // update buttons
1824  networkButton->update();
1825  demandButton->update();
1826  dataButton->update();
1827  // update Supermode CommandButtons in GNEAppWindows
1828  myViewNet->myViewParent->getGNEAppWindows()->updateSuperModeMenuCommands(currentSupermode);
1829  }
1830 }
1831 
1832 
1833 void
1835  if ((mode == networkEditMode) && !force) {
1836  myViewNet->setStatusBarText("Network mode already selected");
1837  if (myViewNet->myCurrentFrame != nullptr) {
1838  myViewNet->myCurrentFrame->focusUpperElement();
1839  }
1840  } else if (networkEditMode == NetworkEditMode::NETWORK_TLS && !myViewNet->myViewParent->getTLSEditorFrame()->isTLSSaved()) {
1841  myViewNet->setStatusBarText("Save modifications in TLS before change mode");
1842  myViewNet->myCurrentFrame->focusUpperElement();
1843  } else {
1844  myViewNet->setStatusBarText("");
1845  myViewNet->abortOperation(false);
1846  // stop editing of custom shapes
1847  myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
1848  // set new Network mode
1849  networkEditMode = mode;
1850  // for common modes (Inspect/Delete/Select/move) change also the other supermode
1851  if (networkEditMode == NetworkEditMode::NETWORK_INSPECT) {
1852  demandEditMode = DemandEditMode::DEMAND_INSPECT;
1853  dataEditMode = DataEditMode::DATA_INSPECT;
1854  } else if (networkEditMode == NetworkEditMode::NETWORK_DELETE) {
1855  demandEditMode = DemandEditMode::DEMAND_DELETE;
1856  dataEditMode = DataEditMode::DATA_DELETE;
1857  } else if (networkEditMode == NetworkEditMode::NETWORK_SELECT) {
1858  demandEditMode = DemandEditMode::DEMAND_SELECT;
1859  dataEditMode = DataEditMode::DATA_SELECT;
1860  } else if (networkEditMode == NetworkEditMode::NETWORK_MOVE) {
1861  demandEditMode = DemandEditMode::DEMAND_MOVE;
1862  }
1863  // certain modes require a recomputing
1864  switch (mode) {
1868  // modes which depend on computed data
1869  myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
1870  break;
1871  default:
1872  break;
1873  }
1874  // update cursors
1875  myViewNet->updateCursor();
1876  // update network mode specific controls
1877  myViewNet->updateNetworkModeSpecificControls();
1878  }
1879 }
1880 
1881 
1882 void
1884  if ((mode == demandEditMode) && !force) {
1885  myViewNet->setStatusBarText("Demand mode already selected");
1886  if (myViewNet->myCurrentFrame != nullptr) {
1887  myViewNet->myCurrentFrame->focusUpperElement();
1888  }
1889  } else {
1890  myViewNet->setStatusBarText("");
1891  myViewNet->abortOperation(false);
1892  // stop editing of custom shapes
1893  myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
1894  // set new Demand mode
1895  demandEditMode = mode;
1896  // for common modes (Inspect/Delete/Select/Move) change also the other supermode
1897  if (demandEditMode == DemandEditMode::DEMAND_INSPECT) {
1898  networkEditMode = NetworkEditMode::NETWORK_INSPECT;
1899  dataEditMode = DataEditMode::DATA_INSPECT;
1900  } else if (demandEditMode == DemandEditMode::DEMAND_DELETE) {
1901  networkEditMode = NetworkEditMode::NETWORK_DELETE;
1902  dataEditMode = DataEditMode::DATA_DELETE;
1903  } else if (demandEditMode == DemandEditMode::DEMAND_SELECT) {
1904  networkEditMode = NetworkEditMode::NETWORK_SELECT;
1905  dataEditMode = DataEditMode::DATA_SELECT;
1906  } else if (demandEditMode == DemandEditMode::DEMAND_MOVE) {
1907  networkEditMode = NetworkEditMode::NETWORK_MOVE;
1908  }
1909  // update cursors
1910  myViewNet->updateCursor();
1911  // update network mode specific controls
1912  myViewNet->updateDemandModeSpecificControls();
1913  }
1914 }
1915 
1916 
1917 void
1919  if ((mode == dataEditMode) && !force) {
1920  myViewNet->setStatusBarText("Data mode already selected");
1921  if (myViewNet->myCurrentFrame != nullptr) {
1922  myViewNet->myCurrentFrame->focusUpperElement();
1923  }
1924  } else {
1925  myViewNet->setStatusBarText("");
1926  myViewNet->abortOperation(false);
1927  // stop editing of custom shapes
1928  myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
1929  // set new Data mode
1930  dataEditMode = mode;
1931  // for common modes (Inspect/Delete/Select/Move) change also the other supermode
1932  if (dataEditMode == DataEditMode::DATA_INSPECT) {
1933  networkEditMode = NetworkEditMode::NETWORK_INSPECT;
1934  demandEditMode = DemandEditMode::DEMAND_INSPECT;
1935  } else if (dataEditMode == DataEditMode::DATA_DELETE) {
1936  networkEditMode = NetworkEditMode::NETWORK_DELETE;
1937  demandEditMode = DemandEditMode::DEMAND_DELETE;
1938  } else if (dataEditMode == DataEditMode::DATA_SELECT) {
1939  networkEditMode = NetworkEditMode::NETWORK_SELECT;
1940  demandEditMode = DemandEditMode::DEMAND_SELECT;
1941  }
1942  // update all datasets
1943  for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
1944  dataSet->updateAttributeColors();
1945  }
1946  // update cursors
1947  myViewNet->updateCursor();
1948  // update network mode specific controls
1949  myViewNet->updateDataModeSpecificControls();
1950  }
1951 }
1952 
1953 
1954 bool
1956  return (currentSupermode == Supermode::NETWORK);
1957 }
1958 
1959 
1960 bool
1962  return (currentSupermode == Supermode::DEMAND);
1963 }
1964 
1965 
1966 bool
1968  return (currentSupermode == Supermode::DATA);
1969 }
1970 
1971 // ---------------------------------------------------------------------------
1972 // GNEViewNetHelper::NetworkViewOptions - methods
1973 // ---------------------------------------------------------------------------
1974 
1976  menuCheckToggleGrid(nullptr),
1977  menuCheckDrawSpreadVehicles(nullptr),
1978  menuCheckShowDemandElements(nullptr),
1979  menuCheckSelectEdges(nullptr),
1980  menuCheckShowConnections(nullptr),
1981  menuCheckHideConnections(nullptr),
1982  menuCheckShowAdditionalSubElements(nullptr),
1983  menuCheckExtendSelection(nullptr),
1984  menuCheckChangeAllPhases(nullptr),
1985  menuCheckWarnAboutMerge(nullptr),
1986  menuCheckShowJunctionBubble(nullptr),
1987  menuCheckMoveElevation(nullptr),
1988  menuCheckChainEdges(nullptr),
1989  menuCheckAutoOppositeEdge(nullptr),
1990  myViewNet(viewNet) {
1991 }
1992 
1993 
1994 void
1996  // create menu checks
1997  menuCheckToggleGrid = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
1998  ("\t\tShow grid and restrict movement to the grid - define grid size in visualization options. (Ctrl+G)"),
2001  menuCheckToggleGrid->setChecked(false);
2002  menuCheckToggleGrid->create();
2003 
2004  menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2005  ("\t\tDraw vehicles spread in lane or in depart position."),
2008  menuCheckDrawSpreadVehicles->setChecked(false);
2009  menuCheckDrawSpreadVehicles->create();
2010 
2011  menuCheckShowDemandElements = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2012  ("\t\tToggle show demand elements."),
2015  menuCheckShowDemandElements->setChecked(false);
2016  menuCheckShowDemandElements->create();
2017 
2018  menuCheckSelectEdges = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2019  ("\t\tToggle whether clicking should select edges or lanes."),
2022  menuCheckSelectEdges->setChecked(true);
2023  menuCheckSelectEdges->create();
2024 
2025  menuCheckShowConnections = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2026  ("\t\tToggle show connections over junctions."),
2029  menuCheckShowConnections->setChecked(myViewNet->getVisualisationSettings().showLane2Lane);
2030  menuCheckShowConnections->create();
2031 
2032  menuCheckHideConnections = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2033  ("\t\tHide connections."),
2036  menuCheckHideConnections->setChecked(false);
2037  menuCheckHideConnections->create();
2038 
2039  menuCheckShowAdditionalSubElements = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2040  ("\t\tShow additional sub-elements."),
2043  menuCheckShowAdditionalSubElements->setChecked(false);
2044  menuCheckShowAdditionalSubElements->create();
2045 
2046  menuCheckExtendSelection = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2047  ("\t\tToggle whether selecting multiple edges should automatically select their junctions."),
2050  menuCheckExtendSelection->setChecked(true);
2051  menuCheckExtendSelection->create();
2052 
2053  menuCheckChangeAllPhases = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2054  ("\t\tToggle whether clicking should apply state changes to all phases of the current TLS plan."),
2057  menuCheckChangeAllPhases->setChecked(false);
2058  menuCheckChangeAllPhases->create();
2059 
2060  menuCheckWarnAboutMerge = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2061  ("\t\tAsk for confirmation before merging junction."),
2064  menuCheckWarnAboutMerge->setChecked(true);
2065  menuCheckWarnAboutMerge->create();
2066 
2067  menuCheckShowJunctionBubble = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2068  ("\t\tShow bubbles over junctions shapes."),
2071  menuCheckShowJunctionBubble->setChecked(false);
2072  menuCheckShowJunctionBubble->create();
2073 
2074  menuCheckMoveElevation = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2075  ("\t\tApply mouse movement to elevation instead of x,y position."),
2078  menuCheckMoveElevation->setChecked(false);
2079  menuCheckMoveElevation->create();
2080 
2081  menuCheckChainEdges = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2082  ("\t\tCreate consecutive edges with a single click (hit ESC to cancel chain)."),
2085  menuCheckChainEdges->setChecked(false);
2086  menuCheckChainEdges->create();
2087 
2088  menuCheckAutoOppositeEdge = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2089  ("\t\tAutomatically create an edge in the opposite direction."),
2092  menuCheckAutoOppositeEdge->setChecked(false);
2093  menuCheckAutoOppositeEdge->create();
2094 
2095  // always recalc after creating new elements
2096  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2097 }
2098 
2099 
2100 void
2102  menuCheckToggleGrid->hide();
2103  menuCheckDrawSpreadVehicles->hide();
2104  menuCheckShowDemandElements->hide();
2105  menuCheckSelectEdges->hide();
2106  menuCheckShowConnections->hide();
2107  menuCheckHideConnections->hide();
2108  menuCheckShowAdditionalSubElements->hide();
2109  menuCheckExtendSelection->hide();
2110  menuCheckChangeAllPhases->hide();
2111  menuCheckWarnAboutMerge->hide();
2112  menuCheckShowJunctionBubble->hide();
2113  menuCheckMoveElevation->hide();
2114  menuCheckChainEdges->hide();
2115  menuCheckAutoOppositeEdge->hide();
2116  // Also hide toolbar grip
2117  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->show();
2118 }
2119 
2120 
2121 void
2122 GNEViewNetHelper::NetworkViewOptions::getVisibleNetworkMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2123  // save visible menu commands in commands vector
2124  if (menuCheckToggleGrid->shown()) {
2125  commands.push_back(menuCheckToggleGrid);
2126  }
2127  if (menuCheckDrawSpreadVehicles->shown()) {
2128  commands.push_back(menuCheckDrawSpreadVehicles);
2129  }
2130  if (menuCheckShowDemandElements->shown()) {
2131  commands.push_back(menuCheckShowDemandElements);
2132  }
2133  if (menuCheckSelectEdges->shown()) {
2134  commands.push_back(menuCheckSelectEdges);
2135  }
2136  if (menuCheckShowConnections->shown()) {
2137  commands.push_back(menuCheckShowConnections);
2138  }
2139  if (menuCheckHideConnections->shown()) {
2140  commands.push_back(menuCheckHideConnections);
2141  }
2142  if (menuCheckShowAdditionalSubElements->shown()) {
2143  commands.push_back(menuCheckShowAdditionalSubElements);
2144  }
2145  if (menuCheckExtendSelection->shown()) {
2146  commands.push_back(menuCheckExtendSelection);
2147  }
2148  if (menuCheckChangeAllPhases->shown()) {
2149  commands.push_back(menuCheckChangeAllPhases);
2150  }
2151  if (menuCheckWarnAboutMerge->shown()) {
2152  commands.push_back(menuCheckWarnAboutMerge);
2153  }
2154  if (menuCheckShowJunctionBubble->shown()) {
2155  commands.push_back(menuCheckShowJunctionBubble);
2156  }
2157  if (menuCheckMoveElevation->shown()) {
2158  commands.push_back(menuCheckMoveElevation);
2159  }
2160  if (menuCheckChainEdges->shown()) {
2161  commands.push_back(menuCheckChainEdges);
2162  }
2163  if (menuCheckAutoOppositeEdge->shown()) {
2164  commands.push_back(menuCheckAutoOppositeEdge);
2165  }
2166 }
2167 
2168 
2169 bool
2171  return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
2172 }
2173 
2174 
2175 bool
2177  if (menuCheckShowDemandElements->shown()) {
2178  return (menuCheckShowDemandElements->amChecked() == TRUE);
2179  } else {
2180  // by default, if menuCheckShowDemandElements isn't shown, always show demand elements
2181  return true;
2182  }
2183 }
2184 
2185 
2186 bool
2188  if (menuCheckSelectEdges->shown()) {
2189  return (menuCheckSelectEdges->amChecked() == TRUE);
2190  } else {
2191  // by default, if menuCheckSelectEdges isn't shown, always select edges
2192  return true;
2193  }
2194 }
2195 
2196 
2197 bool
2199  if (myViewNet->myEditModes.isCurrentSupermodeData()) {
2200  return false;
2201  } else if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_CONNECT) {
2202  // check if menu check hide connections ins shown
2203  return (menuCheckHideConnections->amChecked() == FALSE);
2204  } else if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_PROHIBITION) {
2205  return true;
2206  } else if (myViewNet->myEditModes.isCurrentSupermodeNetwork() && menuCheckShowConnections->shown() == false) {
2207  return false;
2208  } else {
2209  return (myViewNet->getVisualisationSettings().showLane2Lane);
2210  }
2211 }
2212 
2213 
2214 bool
2216  if (!myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
2217  return false;
2218  } else if (menuCheckShowAdditionalSubElements->shown() == false) {
2219  return false;
2220  } else {
2221  return menuCheckShowAdditionalSubElements->amChecked();
2222  }
2223 }
2224 
2225 
2226 bool
2228  if (menuCheckMoveElevation->shown()) {
2229  return (menuCheckMoveElevation->amChecked() == TRUE);
2230  } else {
2231  return false;
2232  }
2233 }
2234 
2235 // ---------------------------------------------------------------------------
2236 // GNEViewNetHelper::DemandViewOptions - methods
2237 // ---------------------------------------------------------------------------
2238 
2240  menuCheckToggleGrid(nullptr),
2241  menuCheckDrawSpreadVehicles(nullptr),
2242  menuCheckHideShapes(nullptr),
2243  menuCheckShowAllTrips(nullptr),
2244  menuCheckShowAllPersonPlans(nullptr),
2245  menuCheckLockPerson(nullptr),
2246  menuCheckShowAllContainerPlans(nullptr),
2247  menuCheckLockContainer(nullptr),
2248  menuCheckHideNonInspectedDemandElements(nullptr),
2249  menuCheckShowOverlappedRoutes(nullptr),
2250  myViewNet(viewNet),
2251  myLockedPerson(nullptr),
2252  myLockedContainer(nullptr) {
2253 }
2254 
2255 
2256 void
2258  // create menu checks
2259  menuCheckToggleGrid = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2260  ("\t\tShow grid and restrict movement to the grid - define grid size in visualization options. (Ctrl+G)"),
2263  menuCheckToggleGrid->setChecked(false);
2264  menuCheckToggleGrid->create();
2265 
2266  menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2267  ("\t\tDraw vehicles spread in lane or in depart position."),
2270  menuCheckDrawSpreadVehicles->setChecked(false);
2271  menuCheckDrawSpreadVehicles->create();
2272 
2273  menuCheckHideShapes = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2274  ("\t\tToggle show shapes (Polygons and POIs)."),
2277  menuCheckHideShapes->setChecked(false);
2278  menuCheckHideShapes->create();
2279 
2280  menuCheckShowAllTrips = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2281  ("\t\tToggle show all trips (requires updated demand - F5)."),
2284  menuCheckShowAllTrips->setChecked(false);
2285  menuCheckShowAllTrips->create();
2286 
2287  menuCheckShowAllPersonPlans = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2288  ("\t\tShow all person plans."),
2291  menuCheckShowAllPersonPlans->setChecked(false);
2292  menuCheckShowAllPersonPlans->create();
2293 
2294  menuCheckLockPerson = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2295  ("\t\tLock selected person."),
2298  menuCheckLockPerson->setChecked(false);
2299  menuCheckLockPerson->create();
2300 
2301  menuCheckShowAllContainerPlans = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2302  ("\t\tShow all container plans."),
2305  menuCheckShowAllContainerPlans->setChecked(false);
2306  menuCheckShowAllContainerPlans->create();
2307 
2308  menuCheckLockContainer = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2309  ("\t\tLock selected container."),
2312  menuCheckLockContainer->setChecked(false);
2313  menuCheckLockContainer->create();
2314 
2315  menuCheckHideNonInspectedDemandElements = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2316  ("\t\tToggle show non-inspected demand elements."),
2319  menuCheckHideNonInspectedDemandElements->setChecked(false);
2320  menuCheckHideNonInspectedDemandElements->create();
2321 
2322  menuCheckShowOverlappedRoutes = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2323  ("\t\tToggle show number of overlapped routes."),
2326  menuCheckShowOverlappedRoutes->setChecked(false);
2327  menuCheckShowOverlappedRoutes->create();
2328 
2329  // always recalc after creating new elements
2330  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2331 }
2332 
2333 
2334 void
2336  menuCheckToggleGrid->hide();
2337  menuCheckDrawSpreadVehicles->hide();
2338  menuCheckHideShapes->hide();
2339  menuCheckShowAllTrips->hide();
2340  menuCheckShowAllPersonPlans->hide();
2341  menuCheckLockPerson->hide();
2342  menuCheckShowAllContainerPlans->hide();
2343  menuCheckLockContainer->hide();
2344  menuCheckHideNonInspectedDemandElements->hide();
2345  menuCheckShowOverlappedRoutes->hide();
2346  // Also hide toolbar grip
2347  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->show();
2348 }
2349 
2350 
2351 void
2352 GNEViewNetHelper::DemandViewOptions::getVisibleDemandMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2353  // save visible menu commands in commands vector
2354  if (menuCheckToggleGrid->shown()) {
2355  commands.push_back(menuCheckToggleGrid);
2356  }
2357  if (menuCheckDrawSpreadVehicles->shown()) {
2358  commands.push_back(menuCheckDrawSpreadVehicles);
2359  }
2360  if (menuCheckHideShapes->shown()) {
2361  commands.push_back(menuCheckHideShapes);
2362  }
2363  if (menuCheckShowAllTrips->shown()) {
2364  commands.push_back(menuCheckShowAllTrips);
2365  }
2366  if (menuCheckShowAllPersonPlans->shown() && menuCheckShowAllPersonPlans->isEnabled()) {
2367  commands.push_back(menuCheckShowAllPersonPlans);
2368  }
2369  if (menuCheckLockPerson->shown() && menuCheckLockPerson->isEnabled()) {
2370  commands.push_back(menuCheckLockPerson);
2371  }
2372  if (menuCheckShowAllContainerPlans->shown() && menuCheckShowAllContainerPlans->isEnabled()) {
2373  commands.push_back(menuCheckShowAllContainerPlans);
2374  }
2375  if (menuCheckLockContainer->shown() && menuCheckLockContainer->isEnabled()) {
2376  commands.push_back(menuCheckLockContainer);
2377  }
2378  if (menuCheckHideNonInspectedDemandElements->shown()) {
2379  commands.push_back(menuCheckHideNonInspectedDemandElements);
2380  }
2381  if (menuCheckShowOverlappedRoutes->shown()) {
2382  commands.push_back(menuCheckShowOverlappedRoutes);
2383  }
2384 }
2385 
2386 
2387 bool
2389  return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
2390 }
2391 
2392 
2393 bool
2395  if (menuCheckHideNonInspectedDemandElements->shown()) {
2396  // check conditions
2397  if ((menuCheckHideNonInspectedDemandElements->amChecked() == FALSE) || (myViewNet->getInspectedAttributeCarriers().empty())) {
2398  // if checkbox is disabled or there isn't insepected element, then return true
2399  return true;
2400  } else if (myViewNet->getInspectedAttributeCarriers().front()->getTagProperty().isDemandElement()) {
2401  if (myViewNet->isAttributeCarrierInspected(demandElement)) {
2402  // if inspected element correspond to demandElement, return true
2403  return true;
2404  } else {
2405  // if demandElement is a route, check if dottedAC is one of their children (Vehicle or Stop)
2406  for (const auto& i : demandElement->getChildDemandElements()) {
2407  if (myViewNet->isAttributeCarrierInspected(i)) {
2408  return true;
2409  }
2410  }
2411  // if demandElement is a vehicle, check if dottedAC is one of his route Parent
2412  for (const auto& i : demandElement->getParentDemandElements()) {
2413  if (myViewNet->isAttributeCarrierInspected(i)) {
2414  return true;
2415  }
2416  }
2417  // dottedAC isn't one of their parent, then return false
2418  return false;
2419  }
2420  } else {
2421  // we're inspecting a demand element, then return true
2422  return true;
2423  }
2424  } else {
2425  // we're inspecting a demand element, then return true
2426  return true;
2427  }
2428 }
2429 
2430 
2431 bool
2433  if (menuCheckHideShapes->shown()) {
2434  return (menuCheckHideShapes->amChecked() == FALSE);
2435  } else {
2436  return true;
2437  }
2438 }
2439 
2440 
2441 bool
2443  return (menuCheckShowAllTrips->amChecked() == TRUE);
2444 }
2445 
2446 
2447 bool
2449  if (menuCheckShowAllPersonPlans->isEnabled()) {
2450  return (menuCheckShowAllPersonPlans->amChecked() == TRUE);
2451  } else {
2452  return false;
2453  }
2454 }
2455 
2456 
2457 void
2459  myLockedPerson = person;
2460 }
2461 
2462 
2463 void
2465  myLockedPerson = nullptr;
2466 }
2467 
2468 
2469 const GNEDemandElement*
2471  return myLockedPerson;
2472 }
2473 
2474 
2475 bool
2477  if (menuCheckShowAllContainerPlans->isEnabled()) {
2478  return (menuCheckShowAllContainerPlans->amChecked() == TRUE);
2479  } else {
2480  return false;
2481  }
2482 }
2483 
2484 
2485 void
2487  myLockedContainer = container;
2488 }
2489 
2490 
2491 void
2493  myLockedContainer = nullptr;
2494 }
2495 
2496 
2497 bool
2499  if (menuCheckShowOverlappedRoutes->isEnabled()) {
2500  return (menuCheckShowOverlappedRoutes->amChecked() == TRUE);
2501  } else {
2502  return false;
2503  }
2504 }
2505 
2506 
2507 const GNEDemandElement*
2509  return myLockedContainer;
2510 }
2511 
2512 // ---------------------------------------------------------------------------
2513 // GNEViewNetHelper::DataViewOptions - methods
2514 // ---------------------------------------------------------------------------
2515 
2517  menuCheckShowAdditionals(nullptr),
2518  menuCheckShowShapes(nullptr),
2519  menuCheckShowDemandElements(nullptr),
2520  menuCheckToogleTAZRelDrawing(nullptr),
2521  menuCheckToogleTAZDrawFill(nullptr),
2522  menuCheckToogleTAZRelOnlyFrom(nullptr),
2523  menuCheckToogleTAZRelOnlyTo(nullptr),
2524  myViewNet(viewNet) {
2525 }
2526 
2527 
2528 void
2530  // create menu checks
2531  menuCheckShowAdditionals = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2532  ("\t\tToggle show additionals."),
2535  menuCheckShowAdditionals->setChecked(false);
2536  menuCheckShowAdditionals->create();
2537 
2538  menuCheckShowShapes = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2539  ("\t\tToggle show shapes (Polygons and POIs)."),
2542  menuCheckShowShapes->setChecked(false);
2543  menuCheckShowShapes->create();
2544 
2545  menuCheckShowDemandElements = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2546  ("\t\tToggle show demand elements."),
2549  menuCheckShowDemandElements->setChecked(false);
2550  menuCheckShowDemandElements->create();
2551 
2552  menuCheckToogleTAZRelDrawing = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2553  ("\t\tToggle draw TAZREL drawing mode."),
2556  menuCheckToogleTAZRelDrawing->setChecked(true);
2557  menuCheckToogleTAZRelDrawing->create();
2558 
2559  menuCheckToogleTAZDrawFill = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2560  ("\t\tToggle draw TAZ fill"),
2563  menuCheckToogleTAZDrawFill->setChecked(false);
2564  menuCheckToogleTAZDrawFill->create();
2565 
2566  menuCheckToogleTAZRelOnlyFrom = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2567  ("\t\tToggle draw TAZRel only from"),
2570  menuCheckToogleTAZRelOnlyFrom->setChecked(true);
2571  menuCheckToogleTAZRelOnlyFrom->create();
2572 
2573  menuCheckToogleTAZRelOnlyTo = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2574  ("\t\tToggle draw TAZRel only to"),
2577  menuCheckToogleTAZRelOnlyTo->setChecked(true);
2578  menuCheckToogleTAZRelOnlyTo->create();
2579 
2580  // always recalc after creating new elements
2581  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2582 }
2583 
2584 
2585 void
2587  menuCheckShowAdditionals->hide();
2588  menuCheckShowShapes->hide();
2589  menuCheckShowDemandElements->hide();
2590  menuCheckToogleTAZRelDrawing->hide();
2591  menuCheckToogleTAZDrawFill->hide();
2592  menuCheckToogleTAZRelOnlyFrom->hide();
2593  menuCheckToogleTAZRelOnlyTo->hide();
2594  // Also hide toolbar grip
2595  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->show();
2596 }
2597 
2598 
2599 void
2600 GNEViewNetHelper::DataViewOptions::getVisibleDataMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2601  // save visible menu commands in commands vector
2602  if (menuCheckShowAdditionals->shown()) {
2603  commands.push_back(menuCheckShowAdditionals);
2604  }
2605  if (menuCheckShowShapes->shown()) {
2606  commands.push_back(menuCheckShowShapes);
2607  }
2608  if (menuCheckShowDemandElements->shown()) {
2609  commands.push_back(menuCheckShowDemandElements);
2610  }
2611  if (menuCheckToogleTAZRelDrawing->shown()) {
2612  commands.push_back(menuCheckToogleTAZRelDrawing);
2613  }
2614  if (menuCheckToogleTAZDrawFill->shown()) {
2615  commands.push_back(menuCheckToogleTAZDrawFill);
2616  }
2617  if (menuCheckToogleTAZRelOnlyFrom->shown()) {
2618  commands.push_back(menuCheckToogleTAZRelOnlyFrom);
2619  }
2620  if (menuCheckToogleTAZRelOnlyTo->shown()) {
2621  commands.push_back(menuCheckToogleTAZRelOnlyTo);
2622  }
2623 }
2624 
2625 
2626 bool
2628  if (menuCheckShowAdditionals->shown()) {
2629  return (menuCheckShowAdditionals->amChecked() == TRUE);
2630  } else {
2631  return true;
2632  }
2633 }
2634 
2635 
2636 bool
2638  if (menuCheckShowShapes->shown()) {
2639  return (menuCheckShowShapes->amChecked() == TRUE);
2640  } else {
2641  return true;
2642  }
2643 }
2644 
2645 
2646 bool
2648  if (menuCheckShowDemandElements->shown()) {
2649  return (menuCheckShowDemandElements->amChecked() == TRUE);
2650  } else {
2651  return true;
2652  }
2653 }
2654 
2655 
2656 bool
2658  return (menuCheckToogleTAZRelDrawing->amChecked() == TRUE);
2659 }
2660 
2661 
2662 bool
2664  if (menuCheckToogleTAZDrawFill->shown()) {
2665  return (menuCheckToogleTAZDrawFill->amChecked() == TRUE);
2666  } else {
2667  return false;
2668  }
2669 }
2670 
2671 
2672 bool
2674  if (menuCheckToogleTAZRelOnlyFrom->shown()) {
2675  return (menuCheckToogleTAZRelOnlyFrom->amChecked() == TRUE);
2676  } else {
2677  return false;
2678  }
2679 }
2680 
2681 
2682 bool
2684  if (menuCheckToogleTAZRelOnlyTo->shown()) {
2685  return (menuCheckToogleTAZRelOnlyTo->amChecked() == TRUE);
2686  } else {
2687  return false;
2688  }
2689 }
2690 
2691 // ---------------------------------------------------------------------------
2692 // GNEViewNetHelper::IntervalBar - methods
2693 // ---------------------------------------------------------------------------
2694 
2696  myViewNet(viewNet),
2697  myIntervalBarUpdate(true),
2698  myGenericDataTypesComboBox(nullptr),
2699  myDataSetsComboBox(nullptr),
2700  myLimitByIntervalCheckBox(nullptr),
2701  myBeginTextField(nullptr),
2702  myEndTextField(nullptr),
2703  myFilteredAttributesComboBox(nullptr),
2704  myNoGenericDatas("<no types>"),
2705  myAllGenericDatas("<all types>"),
2706  myNoDataSets("<no dataSets>"),
2707  myAllDataSets("<all dataSets>"),
2708  myAllAttributes("<all attributes>") {
2709 }
2710 
2711 
2712 void
2714  // create interval label
2715  FXLabel* genericDataLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2716  "Data type", 0, GUIDesignLabelAttribute);
2717  genericDataLabel->create();
2718  // create combo box for generic datas
2719  myGenericDataTypesComboBox = new FXComboBox(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2721  myGenericDataTypesComboBox->create();
2722  FXLabel* dataSetLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2723  "Data sets", 0, GUIDesignLabelAttribute);
2724  dataSetLabel->create();
2725  // create combo box for sets
2726  myDataSetsComboBox = new FXComboBox(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2728  myDataSetsComboBox->create();
2729  // create checkbutton for myLimitByInterval
2730  myLimitByIntervalCheckBox = new FXCheckButton(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2732  myLimitByIntervalCheckBox->create();
2733  // create textfield for begin
2734  myBeginTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2736  myBeginTextField->create();
2737  // create text field for end
2738  myEndTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2740  myEndTextField->create();
2741  // create attribute label
2742  FXLabel* attributeLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2743  "Attribute", 0, GUIDesignLabelAttribute);
2744  attributeLabel->create();
2745  // create combo box for attributes
2746  myFilteredAttributesComboBox = new FXComboBox(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2748  myFilteredAttributesComboBox->create();
2749  // always recalc after creating new elements
2750  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->recalc();
2751 }
2752 
2753 
2754 void
2756  // enable elements
2757  myGenericDataTypesComboBox->enable();
2758  myDataSetsComboBox->enable();
2759  myLimitByIntervalCheckBox->enable();
2760  if (myLimitByIntervalCheckBox->getCheck() == TRUE) {
2761  myBeginTextField->enable();
2762  myEndTextField->enable();
2763  } else {
2764  myBeginTextField->disable();
2765  myEndTextField->disable();
2766  }
2767  myFilteredAttributesComboBox->enable();
2768 }
2769 
2770 
2771 void
2773  // disable all elements
2774  myGenericDataTypesComboBox->disable();
2775  myDataSetsComboBox->disable();
2776  myLimitByIntervalCheckBox->disable();
2777  myBeginTextField->disable();
2778  myEndTextField->disable();
2779  myFilteredAttributesComboBox->disable();
2780 }
2781 
2782 
2783 void
2785  myIntervalBarUpdate = true;
2786  // now update interval bar
2787  updateIntervalBar();
2788 }
2789 
2790 
2791 void
2793  myIntervalBarUpdate = false;
2794 }
2795 
2796 
2797 void
2799  // check if begin and end textFields has to be updated (only once)
2800  if (myBeginTextField->getText().empty()) {
2801  setBegin();
2802  }
2803  if (myEndTextField->getText().empty()) {
2804  setEnd();
2805  }
2806  // first update interval bar
2807  updateIntervalBar();
2808  // show toolbar grip
2809  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->show();
2810 }
2811 
2812 
2813 void
2815  // hide toolbar grip
2816  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->hide();
2817 }
2818 
2819 
2820 void
2822  if (myIntervalBarUpdate) {
2823  // first save current data set
2824  const std::string previousDataSet = myDataSetsComboBox->getNumItems() > 0 ? myDataSetsComboBox->getItem(myDataSetsComboBox->getCurrentItem()).text() : "";
2825  // first clear items
2826  myDataSetsComboBox->clearItems();
2827  myGenericDataTypesComboBox->clearItems();
2828  if (myViewNet->getNet()) {
2829  if (myViewNet->getNet()->getAttributeCarriers()->getDataSets().size() > 0) {
2830  myGenericDataTypesComboBox->appendItem(myNoGenericDatas);
2831  myDataSetsComboBox->appendItem(myNoDataSets);
2832  // disable elements
2833  disableIntervalBar();
2834  } else {
2835  // declare integer to save previous data set index
2836  int previousDataSetIndex = 0;
2837  // enable elements
2838  enableIntervalBar();
2839  // add "<all>" item
2840  myGenericDataTypesComboBox->appendItem(myAllGenericDatas);
2841  myDataSetsComboBox->appendItem(myAllDataSets);
2842  // get all generic data types
2844  // add all generic data types
2845  for (const auto& dataTag : genericDataTags) {
2846  myGenericDataTypesComboBox->appendItem(dataTag.getFieldString().c_str());
2847  }
2848  myGenericDataTypesComboBox->setNumVisible(myGenericDataTypesComboBox->getNumItems());
2849  // add data sets
2850  for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
2851  // check if current data set is the previous data set
2852  if (dataSet->getID() == previousDataSet) {
2853  previousDataSetIndex = myDataSetsComboBox->getNumItems();
2854  }
2855  myDataSetsComboBox->appendItem(dataSet->getID().c_str());
2856  }
2857  // set visible elements
2858  if (myDataSetsComboBox->getNumItems() < 10) {
2859  myDataSetsComboBox->setNumVisible(myDataSetsComboBox->getNumItems());
2860  } else {
2861  myDataSetsComboBox->setNumVisible(10);
2862  }
2863  // set current data set
2864  myDataSetsComboBox->setCurrentItem(previousDataSetIndex);
2865  }
2866  // update limit by interval
2867  setInterval();
2868  }
2869  }
2870 }
2871 
2872 
2873 std::string
2875  if (myGenericDataTypesComboBox->isEnabled() && (myGenericDataTypesComboBox->getText() == myAllGenericDatas)) {
2876  return "";
2877  } else {
2878  return myGenericDataTypesComboBox->getText().text();
2879  }
2880 }
2881 
2882 
2883 std::string
2885  if (myDataSetsComboBox->isEnabled() && (myDataSetsComboBox->getText() == myAllDataSets)) {
2886  return "";
2887  } else {
2888  return myDataSetsComboBox->getText().text();
2889  }
2890 }
2891 
2892 
2893 std::string
2895  if (myBeginTextField->isEnabled() && GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
2896  return myBeginTextField->getText().text();
2897  } else {
2898  return "";
2899  }
2900 }
2901 
2902 
2903 std::string
2905  if (myEndTextField->isEnabled() && GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
2906  return myEndTextField->getText().text();
2907  } else {
2908  return "";
2909  }
2910 }
2911 
2912 
2913 std::string
2915  if (myFilteredAttributesComboBox->isEnabled() &&
2916  ((myFilteredAttributesComboBox->getText() == myAllAttributes) || (myFilteredAttributesComboBox->getTextColor() != FXRGB(0, 0, 0)))) {
2917  return "";
2918  } else {
2919  return myFilteredAttributesComboBox->getText().text();
2920  }
2921 }
2922 
2923 
2924 void
2926  // check if data set is correct
2927  if (myGenericDataTypesComboBox->getText() == myAllGenericDatas) {
2928  myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
2929  } else if (myGenericDataTypesComboBox->getText().empty()) {
2930  myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
2931  myGenericDataTypesComboBox->setText(myAllGenericDatas);
2932  } else {
2933  // get all generic data types
2935  // set invalid color
2936  myGenericDataTypesComboBox->setTextColor(FXRGB(255, 0, 0));
2937  // set valid color depending of myGenericDataTypesComboBox
2938  for (const auto& genericDataTag : genericDataTags) {
2939  if (genericDataTag.getFieldString() == myGenericDataTypesComboBox->getText().text()) {
2940  myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
2941  }
2942  }
2943  }
2944  // update comboBox attributes
2945  updateComboBoxAttributes();
2946  // update view net
2947  myViewNet->updateViewNet();
2948 }
2949 
2950 
2951 void
2953  // check if data set is correct
2954  if (myDataSetsComboBox->getText() == myAllDataSets) {
2955  myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
2956  } else if (myDataSetsComboBox->getText().empty()) {
2957  myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
2958  myDataSetsComboBox->setText(myAllDataSets);
2959  } else if (myViewNet->getNet()->getAttributeCarriers()->retrieveDataSet(myDataSetsComboBox->getText().text(), false)) {
2960  myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
2961  } else {
2962  myDataSetsComboBox->setTextColor(FXRGB(255, 0, 0));
2963  }
2964  // update comboBox attributes
2965  updateComboBoxAttributes();
2966  // update view net
2967  myViewNet->updateViewNet();
2968 }
2969 
2970 
2971 void
2973  // enable or disable text fields
2974  if (myLimitByIntervalCheckBox->isEnabled() && (myLimitByIntervalCheckBox->getCheck() == TRUE)) {
2975  myBeginTextField->enable();
2976  myEndTextField->enable();
2977  } else {
2978  myBeginTextField->disable();
2979  myEndTextField->disable();
2980  }
2981  // update comboBox attributes
2982  updateComboBoxAttributes();
2983  // update view net
2984  myViewNet->updateViewNet();
2985 }
2986 
2987 
2988 void
2990  if (myBeginTextField->getText().empty()) {
2991  myBeginTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMinimumBegin()).c_str());
2992  myBeginTextField->setTextColor(FXRGB(0, 0, 0));
2993  } else if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
2994  myBeginTextField->setTextColor(FXRGB(0, 0, 0));
2995  } else {
2996  myBeginTextField->setTextColor(FXRGB(255, 0, 0));
2997  }
2998  // update comboBox attributes
2999  updateComboBoxAttributes();
3000  // update view net
3001  myViewNet->updateViewNet();
3002 }
3003 
3004 
3005 void
3007  if (myEndTextField->getText().empty()) {
3008  myEndTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMaximumEnd()).c_str());
3009  myEndTextField->setTextColor(FXRGB(0, 0, 0));
3010  } else if (GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
3011  myEndTextField->setTextColor(FXRGB(0, 0, 0));
3012  } else {
3013  myEndTextField->setTextColor(FXRGB(255, 0, 0));
3014  }
3015  // update comboBox attributes
3016  updateComboBoxAttributes();
3017  // update view net
3018  myViewNet->updateViewNet();
3019 }
3020 
3021 
3022 void
3024  //
3025 }
3026 
3027 
3028 void
3030  // update attributes
3031  myFilteredAttributes = myViewNet->getNet()->getAttributeCarriers()->retrieveGenericDataParameters(
3032  getDataSetStr(), getGenericDataTypeStr(), getBeginStr(), getEndStr());
3033  // clear combo box
3034  myFilteredAttributesComboBox->clearItems();
3035  // check if there is dataSets
3036  if (myDataSetsComboBox->isEnabled()) {
3037  // add wildcard for all attributes
3038  myFilteredAttributesComboBox->appendItem(myAllAttributes);
3039  // add all atributes in ComboBox
3040  for (const auto& attribute : myFilteredAttributes) {
3041  myFilteredAttributesComboBox->appendItem(attribute.c_str());
3042  }
3043  // set visible elements
3044  if (myFilteredAttributesComboBox->getNumItems() < 10) {
3045  myFilteredAttributesComboBox->setNumVisible(myFilteredAttributesComboBox->getNumItems());
3046  } else {
3047  myFilteredAttributesComboBox->setNumVisible(10);
3048  }
3049  } else {
3050  // add wildcard for all attributes
3051  myFilteredAttributesComboBox->appendItem(myNoDataSets);
3052  }
3053 }
3054 
3055 // ---------------------------------------------------------------------------
3056 // GNEViewNetHelper::CommonCheckableButtons - methods
3057 // ---------------------------------------------------------------------------
3058 
3060  inspectButton(nullptr),
3061  deleteButton(nullptr),
3062  selectButton(nullptr),
3063  myViewNet(viewNet) {
3064 }
3065 
3066 
3067 void
3069  // inspect button
3070  inspectButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3071  "\tset inspect mode\tMode for inspect elements and change their attributes. (I)",
3073  inspectButton->create();
3074  // delete button
3075  deleteButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3076  "\tset delete mode\tMode for delete elements. (D)",
3078  deleteButton->create();
3079  // select button
3080  selectButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3081  "\tset select mode\tMode for select elements. (S)",
3083  selectButton->create();
3084  // always recalc menu bar after creating new elements
3085  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
3086 }
3087 
3088 
3089 void
3091  inspectButton->show();
3092  deleteButton->show();
3093  selectButton->show();
3094 }
3095 
3096 
3097 void
3099  inspectButton->hide();
3100  deleteButton->hide();
3101  selectButton->hide();
3102 }
3103 
3104 
3105 void
3107  inspectButton->setChecked(false);
3108  deleteButton->setChecked(false);
3109  selectButton->setChecked(false);
3110 }
3111 
3112 
3113 void
3115  inspectButton->update();
3116  deleteButton->update();
3117  selectButton->update();
3118 }
3119 
3120 // ---------------------------------------------------------------------------
3121 // GNEViewNetHelper::NetworkCheckableButtons - methods
3122 // ---------------------------------------------------------------------------
3123 
3125  moveNetworkElementsButton(nullptr),
3126  createEdgeButton(nullptr),
3127  connectionButton(nullptr),
3128  trafficLightButton(nullptr),
3129  additionalButton(nullptr),
3130  crossingButton(nullptr),
3131  TAZButton(nullptr),
3132  shapeButton(nullptr),
3133  prohibitionButton(nullptr),
3134  myViewNet(viewNet) {
3135 }
3136 
3137 
3138 void
3140  // move button
3141  moveNetworkElementsButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3142  "\tset move mode\tMode for move elements. (M)",
3144  moveNetworkElementsButton->create();
3145  // create edge
3146  createEdgeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3147  "\tset create edge mode\tMode for creating junction and edges. (E)",
3149  createEdgeButton->create();
3150  // connection mode
3151  connectionButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3152  "\tset connection mode\tMode for edit connections between lanes. (C)",
3154  connectionButton->create();
3155  // prohibition mode
3156  prohibitionButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3157  "\tset prohibition mode\tMode for editing connection prohibitions. (W)",
3159  prohibitionButton->create();
3160  // traffic light mode
3161  trafficLightButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3162  "\tset traffic light mode\tMode for edit traffic lights over junctions. (T)",
3164  trafficLightButton->create();
3165  // additional mode
3166  additionalButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3167  "\tset additional mode\tMode for adding additional elements. (A)",
3169  additionalButton->create();
3170  // crossing mode
3171  crossingButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3172  "\tset crossing mode\tMode for creating crossings between edges. (R)",
3174  crossingButton->create();
3175  // TAZ Mode
3176  TAZButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3177  "\tset TAZ mode\tMode for creating Traffic Assignment Zones. (Z)",
3179  TAZButton->create();
3180  // shape mode
3181  shapeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3182  "\tset polygon mode\tMode for creating polygons and POIs. (P)",
3184  shapeButton->create();
3185  // always recalc after creating new elements
3186  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
3187 }
3188 
3189 
3190 void
3192  moveNetworkElementsButton->show();
3193  createEdgeButton->show();
3194  connectionButton->show();
3195  trafficLightButton->show();
3196  additionalButton->show();
3197  crossingButton->show();
3198  TAZButton->show();
3199  shapeButton->show();
3200  prohibitionButton->show();
3201 }
3202 
3203 
3204 void
3206  moveNetworkElementsButton->hide();
3207  createEdgeButton->hide();
3208  connectionButton->hide();
3209  trafficLightButton->hide();
3210  additionalButton->hide();
3211  crossingButton->hide();
3212  TAZButton->hide();
3213  shapeButton->hide();
3214  prohibitionButton->hide();
3215 }
3216 
3217 
3218 void
3220  moveNetworkElementsButton->setChecked(false);
3221  createEdgeButton->setChecked(false);
3222  connectionButton->setChecked(false);
3223  trafficLightButton->setChecked(false);
3224  additionalButton->setChecked(false);
3225  crossingButton->setChecked(false);
3226  TAZButton->setChecked(false);
3227  shapeButton->setChecked(false);
3228  prohibitionButton->setChecked(false);
3229 }
3230 
3231 
3232 void
3234  moveNetworkElementsButton->update();
3235  createEdgeButton->update();
3236  connectionButton->update();
3237  trafficLightButton->update();
3238  additionalButton->update();
3239  crossingButton->update();
3240  TAZButton->update();
3241  shapeButton->update();
3242  prohibitionButton->update();
3243 }
3244 
3245 // ---------------------------------------------------------------------------
3246 // GNEViewNetHelper::DemandCheckableButtons - methods
3247 // ---------------------------------------------------------------------------
3248 
3250  moveDemandElementsButton(nullptr),
3251  routeButton(nullptr),
3252  vehicleButton(nullptr),
3253  typeButton(nullptr),
3254  stopButton(nullptr),
3255  personButton(nullptr),
3256  personPlanButton(nullptr),
3257  containerButton(nullptr),
3258  containerPlanButton(nullptr),
3259  myViewNet(viewNet) {
3260 }
3261 
3262 
3263 void
3265  // move button
3266  moveDemandElementsButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3267  "\tset move mode\tMode for move elements. (M)",
3269  moveDemandElementsButton->create();
3270  // route mode
3271  routeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3272  "\tcreate route mode\tMode for creating routes. (R)",
3274  routeButton->create();
3275  // vehicle mode
3276  vehicleButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3277  "\tcreate vehicle mode\tMode for creating vehicles. (V)",
3279  vehicleButton->create();
3280  // type mode
3281  typeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3282  "\tcreate type mode\tMode for creating types (vehicles, person and containers). (T)",
3284  typeButton->create();
3285  // stop mode
3286  stopButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3287  "\tcreate stop mode\tMode for creating stops. (A)",
3289  stopButton->create();
3290  // person mode
3291  personButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3292  "\tcreate person mode\tMode for creating persons. (P)",
3294  personButton->create();
3295  // person plan mode
3296  personPlanButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3297  "\tcreate person plan mode\tMode for creating person plans. (C)",
3299  personPlanButton->create();
3300  // container mode
3301  containerButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3302  "\tcreate container mode\tMode for creating containers. (P)",
3304  containerButton->create();
3305  // container plan mode
3306  containerPlanButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3307  "\tcreate container plan mode\tMode for creating container plans. (C)",
3309  containerPlanButton->create();
3310  // always recalc after creating new elements
3311  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
3312 }
3313 
3314 
3315 void
3317  moveDemandElementsButton->show();
3318  routeButton->show();
3319  vehicleButton->show();
3320  typeButton->show();
3321  stopButton->show();
3322  personButton->show();
3323  personPlanButton->show();
3324  containerButton->show();
3325  containerPlanButton->show();
3326 }
3327 
3328 
3329 void
3331  moveDemandElementsButton->hide();
3332  routeButton->hide();
3333  vehicleButton->hide();
3334  typeButton->hide();
3335  stopButton->hide();
3336  personButton->hide();
3337  personPlanButton->hide();
3338  containerButton->hide();
3339  containerPlanButton->hide();
3340 }
3341 
3342 
3343 void
3345  moveDemandElementsButton->setChecked(false);
3346  routeButton->setChecked(false);
3347  vehicleButton->setChecked(false);
3348  typeButton->setChecked(false);
3349  stopButton->setChecked(false);
3350  personButton->setChecked(false);
3351  personPlanButton->setChecked(false);
3352  containerButton->setChecked(false);
3353  containerPlanButton->setChecked(false);
3354 }
3355 
3356 
3357 void
3359  moveDemandElementsButton->update();
3360  routeButton->update();
3361  vehicleButton->update();
3362  typeButton->update();
3363  stopButton->update();
3364  personButton->update();
3365  personPlanButton->update();
3366  containerButton->update();
3367  containerPlanButton->update();
3368 }
3369 
3370 // ---------------------------------------------------------------------------
3371 // GNEViewNetHelper::DataCheckableButtons - methods
3372 // ---------------------------------------------------------------------------
3373 
3375  edgeDataButton(nullptr),
3376  edgeRelDataButton(nullptr),
3377  TAZRelDataButton(nullptr),
3378  myViewNet(viewNet) {
3379 }
3380 
3381 
3382 void
3384  // edgeData mode
3385  edgeDataButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3386  "\tcreate edge data mode\tMode for creating edge datas. (E)",
3388  edgeDataButton->create();
3389  // edgeRelData mode
3390  edgeRelDataButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3391  "\tcreate edge relation data mode\tMode for creating edge relation datas. (R)",
3393  edgeRelDataButton->create();
3394  // TAZRelData mode
3395  TAZRelDataButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3396  "\tcreate TAZ relation data mode\tMode for creating TAZ relation datas. (Z)",
3398 
3399  TAZRelDataButton->create();
3400  // always recalc after creating new elements
3401  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
3402 }
3403 
3404 
3405 void
3407  edgeDataButton->show();
3408  edgeRelDataButton->show();
3409  TAZRelDataButton->show();
3410 }
3411 
3412 
3413 void
3415  edgeDataButton->hide();
3416  edgeRelDataButton->hide();
3417  TAZRelDataButton->hide();
3418 }
3419 
3420 
3421 void
3423  edgeDataButton->setChecked(false);
3424  edgeRelDataButton->setChecked(false);
3425  TAZRelDataButton->setChecked(false);
3426 }
3427 
3428 
3429 void
3431  edgeDataButton->update();
3432  edgeRelDataButton->update();
3433  TAZRelDataButton->update();
3434 }
3435 
3436 // ---------------------------------------------------------------------------
3437 // GNEViewNetHelper::EditNetworkElementShapes - methods
3438 // ---------------------------------------------------------------------------
3439 
3441  myViewNet(viewNet),
3442  myEditedNetworkElement(nullptr),
3443  myPreviousNetworkEditMode(NetworkEditMode::NETWORK_NONE) {
3444 }
3445 
3446 
3447 void
3449  if (element && (myEditedNetworkElement == nullptr)) {
3450  // save current edit mode before starting
3451  myPreviousNetworkEditMode = myViewNet->myEditModes.networkEditMode;
3452  // set move mode
3453  myViewNet->myEditModes.setNetworkEditMode(NetworkEditMode::NETWORK_MOVE);
3454  //set editedNetworkElement
3455  myEditedNetworkElement = element;
3456  // enable shape edited flag
3457  myEditedNetworkElement->setShapeEdited(true);
3458  // update view net to show the new editedShapePoly
3459  myViewNet->updateViewNet();
3460  }
3461 }
3462 
3463 
3464 void
3466  // stop edit shape junction deleting editedShapePoly
3467  if (myEditedNetworkElement != nullptr) {
3468  // disable shape edited flag
3469  myEditedNetworkElement->setShapeEdited(false);
3470  // reset editedNetworkElement
3471  myEditedNetworkElement = nullptr;
3472  // restore previous edit mode
3473  if (myViewNet->myEditModes.networkEditMode != myPreviousNetworkEditMode) {
3474  myViewNet->myEditModes.setNetworkEditMode(myPreviousNetworkEditMode);
3475  }
3476  }
3477 }
3478 
3479 
3480 void
3482  // save edited junction's shape
3483  if (myEditedNetworkElement != nullptr) {
3484 
3485  /* */
3486 
3487  // stop edit custom shape
3488  stopEditCustomShape();
3489  }
3490 }
3491 
3492 
3495  return myEditedNetworkElement;
3496 }
3497 
3498 // ---------------------------------------------------------------------------
3499 // GNEViewNetHelper::BlockIcon - methods
3500 // ---------------------------------------------------------------------------
3501 
3502 void
3504  const Position viewPosition, const double exaggeration, const double size,
3505  const double offsetx, const double offsety) {
3506  // first check if icon can be drawn
3507  if (checkDrawing(AC, type, exaggeration)) {
3508  // Start pushing matrix
3510  // Traslate to position
3511  glTranslated(viewPosition.x(), viewPosition.y(), GLO_LOCKICON);
3512  // Traslate depending of the offset
3513  glTranslated(offsetx, offsety, 0);
3514  // rotate to avoid draw invert
3515  glRotated(180, 0, 0, 1);
3516  // Set draw color
3517  glColor3d(1, 1, 1);
3518  // Draw lock icon
3520  // Pop matrix
3522  }
3523 }
3524 
3525 
3527 
3528 
3529 bool
3531  // get view net
3532  const auto viewNet = AC->getNet()->getViewNet();
3533  // get visualization settings
3534  const auto s = viewNet->getVisualisationSettings();
3535  // check exaggeration
3536  if (exaggeration == 0) {
3537  return false;
3538  }
3539  // check supermodes
3540  if (viewNet->getEditModes().isCurrentSupermodeNetwork() &&
3541  !(AC->getTagProperty().isNetworkElement() ||
3543  AC->getTagProperty().isShape() ||
3544  AC->getTagProperty().isTAZElement())) {
3545  return false;
3546  }
3547  if (viewNet->getEditModes().isCurrentSupermodeDemand() && (!AC->getTagProperty().isDemandElement())) {
3548  return false;
3549  }
3550  if (viewNet->getEditModes().isCurrentSupermodeData() && (!AC->getTagProperty().isDataElement())) {
3551  return false;
3552  }
3553  // check if is locked
3554  if (!viewNet->getLockManager().isObjectLocked(type, AC->isAttributeCarrierSelected())) {
3555  return false;
3556  }
3557  // check visualizationSettings
3558  if (s.drawForPositionSelection || s.drawForRectangleSelection) {
3559  return false;
3560  }
3561  // check detail
3562  if (!s.drawDetail(s.detailSettings.lockIcon, exaggeration)) {
3563  return false;
3564  }
3565  // all ok, then draw
3566  return true;
3567 }
3568 
3569 // ---------------------------------------------------------------------------
3570 // GNEViewNetHelper::LockManager - methods
3571 // ---------------------------------------------------------------------------
3572 
3574  myViewNet(viewNet) {
3575  // fill myLockedElements objects
3585  // fill myLockedElements objects
3596  // fill myLockedElements objects
3600 }
3601 
3602 
3604 
3605 
3606 bool
3607 GNEViewNetHelper::LockManager::isObjectLocked(GUIGlObjectType objectType, const bool selected) const {
3608  if (selected && (myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands().menuCheckLockSelectedElements->getCheck() == TRUE)) {
3609  return true;
3610  } else if ((objectType >= GLO_ADDITIONALELEMENT) && (objectType <= GLO_ACCESS)) {
3611  // additionals
3612  return myLockedElements.at(GLO_ADDITIONALELEMENT).lock;
3613  } else if ((objectType >= GLO_VEHICLE) && (objectType <= GLO_ROUTEFLOW)) {
3614  // vehicles
3615  return myLockedElements.at(GLO_VEHICLE).lock;
3616  } else if ((objectType == GLO_PERSON) || (objectType == GLO_PERSONFLOW)) {
3617  // persons
3618  return myLockedElements.at(GLO_PERSON).lock;
3619  } else if ((objectType == GLO_CONTAINER) || (objectType == GLO_CONTAINERFLOW)) {
3620  // containers
3621  return myLockedElements.at(GLO_PERSON).lock;
3622  } else if ((objectType >= GLO_STOP) && (objectType <= GLO_STOP_CONTAINER)) {
3623  // stops
3624  return myLockedElements.at(GLO_ADDITIONALELEMENT).lock;
3625  } else {
3626  return myLockedElements.at(objectType).lock;
3627  }
3628 }
3629 
3630 
3631 void
3633  // get lock menu commands
3634  GNEApplicationWindowHelper::LockMenuCommands& lockMenuCommands = myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands();
3635  // network
3636  myLockedElements[GLO_JUNCTION].lock = lockMenuCommands.menuCheckLockJunction->getCheck() == TRUE;
3637  myLockedElements[GLO_EDGE].lock = lockMenuCommands.menuCheckLockEdges->getCheck() == TRUE;
3638  myLockedElements[GLO_LANE].lock = lockMenuCommands.menuCheckLockLanes->getCheck() == TRUE;
3639  myLockedElements[GLO_CONNECTION].lock = lockMenuCommands.menuCheckLockConnections->getCheck() == TRUE;
3640  myLockedElements[GLO_CROSSING].lock = lockMenuCommands.menuCheckLockCrossings->getCheck() == TRUE;
3641  myLockedElements[GLO_ADDITIONALELEMENT].lock = lockMenuCommands.menuCheckLockAdditionals->getCheck() == TRUE;
3642  myLockedElements[GLO_TAZ].lock = lockMenuCommands.menuCheckLockTAZs->getCheck() == TRUE;
3643  myLockedElements[GLO_POLYGON].lock = lockMenuCommands.menuCheckLockPolygons->getCheck() == TRUE;
3644  myLockedElements[GLO_POI].lock = lockMenuCommands.menuCheckLockPOIs->getCheck() == TRUE;
3645  // demand
3646  myLockedElements[GLO_ROUTE].lock = lockMenuCommands.menuCheckLockRoutes->getCheck() == TRUE;
3647  myLockedElements[GLO_VEHICLE].lock = lockMenuCommands.menuCheckLockVehicles->getCheck() == TRUE;
3648  myLockedElements[GLO_PERSON].lock = lockMenuCommands.menuCheckLockPersons->getCheck() == TRUE;
3649  myLockedElements[GLO_PERSONTRIP].lock = lockMenuCommands.menuCheckLockPersonTrip->getCheck() == TRUE;
3650  myLockedElements[GLO_WALK].lock = lockMenuCommands.menuCheckLockWalk->getCheck() == TRUE;
3651  myLockedElements[GLO_RIDE].lock = lockMenuCommands.menuCheckLockRides->getCheck() == TRUE;
3652  myLockedElements[GLO_CONTAINER].lock = lockMenuCommands.menuCheckLockContainers->getCheck() == TRUE;
3653  myLockedElements[GLO_TRANSPORT].lock = lockMenuCommands.menuCheckLockTransports->getCheck() == TRUE;
3654  myLockedElements[GLO_TRANSHIP].lock = lockMenuCommands.menuCheckLockTranships->getCheck() == TRUE;
3655  myLockedElements[GLO_STOP].lock = lockMenuCommands.menuCheckLockStops->getCheck() == TRUE;
3656  // data
3657  myLockedElements[GLO_EDGEDATA].lock = lockMenuCommands.menuCheckLockEdgeDatas->getCheck() == TRUE;
3658  myLockedElements[GLO_EDGERELDATA].lock = lockMenuCommands.menuCheckLockEdgeRelDatas->getCheck() == TRUE;
3659  myLockedElements[GLO_TAZRELDATA].lock = lockMenuCommands.menuCheckLockEdgeTAZRels->getCheck() == TRUE;
3660 }
3661 
3662 
3663 void
3665  // get lock menu commands
3666  GNEApplicationWindowHelper::LockMenuCommands& lockMenuCommands = myViewNet->getViewParent()->getGNEAppWindows()->getLockMenuCommands();
3667  // network
3668  lockMenuCommands.menuCheckLockJunction->setCheck(myLockedElements[GLO_JUNCTION].lock);
3669  lockMenuCommands.menuCheckLockEdges->setCheck(myLockedElements[GLO_EDGE].lock);
3670  lockMenuCommands.menuCheckLockLanes->setCheck(myLockedElements[GLO_LANE].lock);
3671  lockMenuCommands.menuCheckLockConnections->setCheck(myLockedElements[GLO_CONNECTION].lock);
3672  lockMenuCommands.menuCheckLockCrossings->setCheck(myLockedElements[GLO_CROSSING].lock);
3673  lockMenuCommands.menuCheckLockAdditionals->setCheck(myLockedElements[GLO_ADDITIONALELEMENT].lock);
3674  lockMenuCommands.menuCheckLockTAZs->setCheck(myLockedElements[GLO_TAZ].lock);
3675  lockMenuCommands.menuCheckLockPolygons->setCheck(myLockedElements[GLO_POLYGON].lock);
3676  lockMenuCommands.menuCheckLockPOIs->setCheck(myLockedElements[GLO_POI].lock);
3677  // demand
3678  lockMenuCommands.menuCheckLockRoutes->setCheck(myLockedElements[GLO_ROUTE].lock);
3679  lockMenuCommands.menuCheckLockVehicles->setCheck(myLockedElements[GLO_VEHICLE].lock);
3680  lockMenuCommands.menuCheckLockPersons->setCheck(myLockedElements[GLO_PERSON].lock);
3681  lockMenuCommands.menuCheckLockPersonTrip->setCheck(myLockedElements[GLO_PERSONTRIP].lock);
3682  lockMenuCommands.menuCheckLockWalk->setCheck(myLockedElements[GLO_WALK].lock);
3683  lockMenuCommands.menuCheckLockRides->setCheck(myLockedElements[GLO_RIDE].lock);
3684  lockMenuCommands.menuCheckLockContainers->setCheck(myLockedElements[GLO_CONTAINER].lock);
3685  lockMenuCommands.menuCheckLockTransports->setCheck(myLockedElements[GLO_TRANSPORT].lock);
3686  lockMenuCommands.menuCheckLockTranships->setCheck(myLockedElements[GLO_TRANSHIP].lock);
3687  lockMenuCommands.menuCheckLockStops->setCheck(myLockedElements[GLO_STOP].lock);
3688  // data
3689  lockMenuCommands.menuCheckLockEdgeDatas->setCheck(myLockedElements[GLO_EDGEDATA].lock);
3690  lockMenuCommands.menuCheckLockEdgeRelDatas->setCheck(myLockedElements[GLO_EDGERELDATA].lock);
3691  lockMenuCommands.menuCheckLockEdgeTAZRels->setCheck(myLockedElements[GLO_TAZRELDATA].lock);
3692 }
3693 
3694 
3696  mySupermode(Supermode::NETWORK) {
3697 }
3698 
3699 
3701  mySupermode(supermode) {
3702 }
3703 
3704 
3706 
3707 
3708 Supermode
3710  return mySupermode;
3711 }
3712 
3713 // ---------------------------------------------------------------------------
3714 // GNEViewNetHelper - methods
3715 // ---------------------------------------------------------------------------
3716 
3717 const std::vector<RGBColor>&
3719  // if is empty, fill it
3720  if (myRainbowScaledColors.empty()) {
3721  // fill scale colors (10)
3722  myRainbowScaledColors.push_back(RGBColor(232, 35, 0, 255));
3723  myRainbowScaledColors.push_back(RGBColor(255, 165, 0, 255));
3724  myRainbowScaledColors.push_back(RGBColor(255, 255, 0, 255));
3725  myRainbowScaledColors.push_back(RGBColor(28, 215, 0, 255));
3726  myRainbowScaledColors.push_back(RGBColor(0, 181, 100, 255));
3727  myRainbowScaledColors.push_back(RGBColor(0, 255, 191, 255));
3728  myRainbowScaledColors.push_back(RGBColor(178, 255, 255, 255));
3729  myRainbowScaledColors.push_back(RGBColor(0, 112, 184, 255));
3730  myRainbowScaledColors.push_back(RGBColor(56, 41, 131, 255));
3731  myRainbowScaledColors.push_back(RGBColor(127, 0, 255, 255));
3732  }
3733  return myRainbowScaledColors;
3734 }
3735 
3736 
3737 const RGBColor&
3738 GNEViewNetHelper::getRainbowScaledColor(const double min, const double max, const double value) {
3739  // check extremes
3740  if (value <= min) {
3741  return getRainbowScaledColors().front();
3742  } else if (value >= max) {
3743  return getRainbowScaledColors().back();
3744  } else {
3745  // calculate value procent between [min, max]
3746  const double procent = ((value - min) * 100) / (max - min);
3747  // check if is valid
3748  if (procent <= 0) {
3749  return getRainbowScaledColors().front();
3750  } else if (procent >= 100) {
3751  return getRainbowScaledColors().back();
3752  } else {
3753  // return scaled color
3754  return getRainbowScaledColors().at((int)(procent / 10.0));
3755  }
3756  }
3757 }
3758 
3759 /****************************************************************************/
DataEditMode
@brie 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_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:708
@ MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS
save Data Elements
Definition: GUIAppEnum.h:159
@ MID_HOTKEY_F3_SUPERMODE_DEMAND
select demand supermode in NETEDIT
Definition: GUIAppEnum.h:187
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWALLPERSONPLANS
show all person plans
Definition: GUIAppEnum.h:738
@ MID_GNE_DATAVIEWOPTIONS_TAZRELDRAWING
toogle TAZRel drawing
Definition: GUIAppEnum.h:760
@ MID_GNE_NETWORKVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition: GUIAppEnum.h:684
@ MID_GNE_NETWORKVIEWOPTIONS_MOVEELEVATION
move elevation instead of x,y
Definition: GUIAppEnum.h:704
@ MID_HOTKEY_S_MODES_SELECT
hotkey for mode selecting objects
Definition: GUIAppEnum.h:61
@ MID_GNE_NETWORKVIEWOPTIONS_HIDECONNECTIONS
hide connections
Definition: GUIAppEnum.h:692
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWCONNECTIONS
show connections
Definition: GUIAppEnum.h:690
@ MID_GNE_SAVEALLELEMENTS
save all element
Definition: GUIAppEnum.h:630
@ MID_GNE_INTERVALBAR_BEGIN
begin changed in InterbalBar
Definition: GUIAppEnum.h:780
@ MID_GNE_DATAVIEWOPTIONS_TAZRELONLYTO
toogle draz TAZRel only to
Definition: GUIAppEnum.h:766
@ MID_GNE_DEMANDVIEWOPTIONS_LOCKPERSON
lock person
Definition: GUIAppEnum.h:740
@ MID_HOTKEY_V_MODES_VEHICLE
hotkey for mode create vehicles
Definition: GUIAppEnum.h:67
@ MID_HOTKEY_E_MODES_EDGE_EDGEDATA
hotkey for mode adding edges AND edgeDatas
Definition: GUIAppEnum.h:49
@ MID_GNE_INTERVALBAR_ATTRIBUTE
attribute changed in InterbalBar
Definition: GUIAppEnum.h:784
@ MID_GNE_NETWORKVIEWOPTIONS_ASKFORMERGE
ask before merging junctions
Definition: GUIAppEnum.h:700
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWGRID
show grid
Definition: GUIAppEnum.h:728
@ MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS
Save Demand Elements.
Definition: GUIAppEnum.h:161
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in NETEDIT.
Definition: GUIAppEnum.h:105
@ MID_GNE_NETWORKVIEWOPTIONS_CHAINEDGES
create edges in chain mode
Definition: GUIAppEnum.h:706
@ MID_HOTKEY_R_MODES_CROSSING_ROUTE_EDGERELDATA
hotkey for mode editing crossing, routes and edge rel datas
Definition: GUIAppEnum.h:63
@ MID_GNE_DATAVIEWOPTIONS_SHOWDEMANDELEMENTS
show demand elements
Definition: GUIAppEnum.h:758
@ MID_HOTKEY_I_MODES_INSPECT
hotkey for mode inspecting object attributes
Definition: GUIAppEnum.h:55
@ MID_GNE_DEMANDVIEWOPTIONS_HIDESHAPES
hide shapes
Definition: GUIAppEnum.h:734
@ MID_HOTKEY_P_MODES_POLYGON_PERSON
hotkey for mode creating polygons
Definition: GUIAppEnum.h:59
@ MID_GNE_DATAVIEWOPTIONS_SHOWADDITIONALS
show additionals
Definition: GUIAppEnum.h:754
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWBUBBLES
show junctions as bubbles
Definition: GUIAppEnum.h:702
@ MID_GNE_INTERVALBAR_END
end changed in InterbalBar
Definition: GUIAppEnum.h:782
@ MID_HOTKEY_Z_MODES_TAZ_TAZREL
hotkey for mode editing TAZ and TAZRel
Definition: GUIAppEnum.h:71
@ MID_HOTKEY_M_MODES_MOVE
hotkey for mode moving element
Definition: GUIAppEnum.h:57
@ MID_GNE_NETWORKVIEWOPTIONS_EXTENDSELECTION
extend selection
Definition: GUIAppEnum.h:696
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWSUBADDITIONALS
show sub-additionals
Definition: GUIAppEnum.h:694
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWALLCONTAINERPLANS
show all container plans
Definition: GUIAppEnum.h:742
@ MID_HOTKEY_F4_SUPERMODE_DATA
select data supermode in NETEDIT
Definition: GUIAppEnum.h:189
@ MID_HOTKEY_W_MODES_PROHIBITION
hotkey for mode editing connection prohibitions
Definition: GUIAppEnum.h:69
@ MID_GNE_DATAVIEWOPTIONS_TAZDRAWFILL
toogle draz TAZ fill
Definition: GUIAppEnum.h:762
@ MID_HOTKEY_A_MODES_ADDITIONAL_STOP
hotkey for mode editing additionals AND stops
Definition: GUIAppEnum.h:43
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWDEMANDELEMENTS
show demand elements
Definition: GUIAppEnum.h:686
@ MID_HOTKEY_H_MODE_CONTAINERDATA
hotkey for mode containerData
Definition: GUIAppEnum.h:53
@ MID_GNE_DEMANDVIEWOPTIONS_HIDENONINSPECTED
hide non-inspected demand element
Definition: GUIAppEnum.h:732
@ MID_HOTKEY_C_MODES_CONNECT_PERSONPLAN
hotkey for mode connecting lanes
Definition: GUIAppEnum.h:45
@ MID_HOTKEY_CTRL_SHIFT_A_SAVEADDITIONALS
Save Additional Elements.
Definition: GUIAppEnum.h:155
@ MID_GNE_INTERVALBAR_GENERICDATATYPE
generic data selected
Definition: GUIAppEnum.h:774
@ MID_HOTKEY_G_MODE_CONTAINER
hotkey for mode container
Definition: GUIAppEnum.h:51
@ MID_GNE_NETWORKVIEWOPTIONS_CHANGEALLPHASES
change all phases
Definition: GUIAppEnum.h:698
@ MID_GNE_DATAVIEWOPTIONS_SHOWSHAPES
show shapes
Definition: GUIAppEnum.h:756
@ MID_GNE_DATAVIEWOPTIONS_TAZRELONLYFROM
toogle draz TAZRel only from
Definition: GUIAppEnum.h:764
@ MID_GNE_DEMANDVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition: GUIAppEnum.h:730
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWOVERLAPPEDROUTES
show overlapped routes
Definition: GUIAppEnum.h:746
@ MID_GNE_INTERVALBAR_DATASET
data set selected
Definition: GUIAppEnum.h:776
@ MID_HOTKEY_F2_SUPERMODE_NETWORK
select network supermode in NETEDIT
Definition: GUIAppEnum.h:185
@ MID_GNE_DEMANDVIEWOPTIONS_LOCKCONTAINER
lock container
Definition: GUIAppEnum.h:744
@ MID_HOTKEY_D_MODES_DELETE
hotkey for mode deleting things
Definition: GUIAppEnum.h:47
@ MID_HOTKEY_T_MODES_TLS_TYPE
hotkey for mode editing TLS AND types
Definition: GUIAppEnum.h:65
@ MID_GNE_NETWORKVIEWOPTIONS_SELECTEDGES
select edges
Definition: GUIAppEnum.h:688
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWTRIPS
show all trips
Definition: GUIAppEnum.h:736
@ MID_GNE_NETWORKVIEWOPTIONS_TOGGLEGRID
show grid
Definition: GUIAppEnum.h:682
@ MID_GNE_INTERVALBAR_LIMITED
enable/disable show data elements by interval
Definition: GUIAppEnum.h:778
#define GUIDesignMFXCheckableButton
Definition: GUIDesigns.h:114
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180 (Used in GNEVType)
Definition: GUIDesigns.h:279
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:285
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:217
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:100
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:60
#define GUIDesignTextFielWidth50Real
text field with thick frame and width 50 and limited to doubles
Definition: GUIDesigns.h:54
#define GUIDesignMFXCheckableButtonSupermode
checkable button with icon placed in navigation toolbar for supermodes
Definition: GUIDesigns.h:117
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:151
#define GUIDesignComboBoxWidth120
comboBox with thick frame, width 120
Definition: GUIDesigns.h:282
unsigned int GUIGlID
Definition: GUIGlObject.h:40
GUIGlObjectType
@ GLO_EDGERELDATA
edge relation data
@ GLO_TAZRELDATA
TAZ relation data.
@ GLO_STOP_CONTAINER
a container stop
@ GLO_TESTELEMENT
test element (used in NETEDIT)
@ GLO_TRANSHIP
a container tranship
@ GLO_ACCESS
a Acces
@ GLO_ROUTEFLOW
a routeFlow
@ GLO_WALK
a walk
@ GLO_ROUTE
a route
@ GLO_JUNCTION
a junction
@ GLO_LANE
a lane
@ GLO_RIDE
a ride
@ GLO_TAZ
Traffic Assignment Zones (TAZs)
@ GLO_CONTAINER
a container
@ GLO_EDGEDATA
edge data
@ GLO_CONNECTION
a connection
@ GLO_ADDITIONALELEMENT
reserved GLO type to pack all additionals elements
@ GLO_PERSONTRIP
a person trip
@ GLO_EDGE
an edge
@ GLO_VEHICLE
a vehicle
@ GLO_PERSON
a person
@ GLO_TRANSPORT
a container transport
@ GLO_NETWORK
The network - empty.
@ GLO_POI
a poi
@ GLO_RECTANGLESELECTION
rectangle selection shape (used in NETEDIT)
@ GLO_STOP
a stop
@ GLO_NETWORKELEMENT
reserved GLO type to pack all network elements
@ GLO_CONTAINERFLOW
a person flow
@ GLO_POLYGON
a polygon
@ GLO_TLLOGIC
a tl-logic
@ GLO_CROSSING
a tl-logic
@ GLO_PERSONFLOW
a person flow
@ GLO_LOCKICON
Lock icon (used in NETEDIT)
@ DATAMODE_CHECKBOX_SHOWADDITIONALS
@ SAVEALLELEMENTS
@ NETWORKMODE_CHECKBOX_BUBBLES
@ DATAMODE_CHECKBOX_TAZRELONLYFROM
@ MODEPERSONPLAN
@ MODECROSSING
@ MODEADDITIONAL
@ MODEEDGERELDATA
@ SUPERMODEDEMAND
@ MODEPROHIBITION
@ DEMANDMODE_CHECKBOX_HIDENONINSPECTEDDEMANDELEMENTS
@ NETWORKMODE_CHECKBOX_HIDECONNECTIONS
@ DEMANDMODE_CHECKBOX_SHOWTRIPS
@ DATAMODE_CHECKBOX_SHOWSHAPES
@ NETWORKMODE_CHECKBOX_SELECTEDGES
@ COMMONMODE_CHECKBOX_SHOWDEMANDELEMENTS
@ DEMANDMODE_CHECKBOX_LOCKPERSON
@ NETWORKMODE_CHECKBOX_APPLYTOALLPHASES
@ MODECREATEEDGE
@ DATAMODE_CHECKBOX_TAZRELONLYTO
@ NETWORKMODE_CHECKBOX_AUTOSELECTJUNCTIONS
@ DATAMODE_CHECKBOX_TAZRELDRAWING
@ NETWORKMODE_CHECKBOX_SHOWCONNECTIONS
@ DEMANDMODE_CHECKBOX_SHOWPERSONPLANS
@ MODECONTAINER
@ DEMANDMODE_CHECKBOX_HIDESHAPES
@ SAVEDATAELEMENTS
@ DATAMODE_CHECKBOX_TAZDRAWFILL
@ SAVENETWORKELEMENTS
@ MODEEDGEDATA
@ NETWORKMODE_CHECKBOX_ELEVATION
@ SUPERMODENETWORK
@ COMMONMODE_CHECKBOX_SPREADVEHICLE
@ DEMANDMODE_CHECKBOX_LOCKCONTAINER
@ NETWORKMODE_CHECKBOX_SHOWSUBADDITIONALS
@ SAVEDEMANDELEMENTS
@ SUPERMODEDATA
@ SAVEADDITIONALELEMENTS
@ MODECONNECTION
@ MODECONTAINERPLAN
@ NETWORKMODE_CHECKBOX_CHAIN
@ DEMANDMODE_CHECKBOX_SHOWOVERLAPPEDROUTES
@ NETWORKMODE_CHECKBOX_ASKFORMERGE
@ COMMONMODE_CHECKBOX_TOGGLEGRID
@ MODETAZRELDATA
@ DEMANDMODE_CHECKBOX_SHOWCONTAINERPLANS
@ NETWORKMODE_CHECKBOX_TWOWAY
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:288
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
#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:77
void setCheck(FXbool s=TRUE)
Set check state (TRUE, FALSE or MAYBE)
FXbool getCheck() const
Get check state (TRUE, FALSE or MAYBE)
static void drawTextBox(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &txtColor=RGBColor::BLACK, const RGBColor &bgColor=RGBColor::WHITE, const RGBColor &borderColor=RGBColor::BLACK, const double angle=0, const double relBorder=0.05, const double relMargin=0.5, const int align=0)
draw Text box with given parameters
Definition: GLHelper.cpp:657
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static const std::vector< GNETagProperties > getTagPropertiesByType(const int tagPropertyCategory)
get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT,...
virtual const std::string & getID() const =0
return ID of object
virtual GUIGlObject * getGUIGlObject()=0
get GUIGlObject associated with this AttributeCarrier
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:42
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEEdgeData.h:38
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:1431
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:435
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency 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
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
GNETAZElement * retrieveTAZElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named TAZElement.
GNEShape * retrieveShape(SumoXMLTag, const std::string &id, bool hardFail=true) const
Returns the named shape.
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
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:1964
void setShapeEdited(const bool value)
set shape edited
Definition: GNEPOI.h:43
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
Definition: GNETAZ.h:34
bool isShape() const
return true if tag correspond to a shape
bool isTAZElement() const
return true if tag correspond to a TAZ element
bool isGenericData() const
return true if tag correspond to a generic data element
bool isNetworkElement() const
return true if tag correspond to a network element
bool isDataElement() const
return true if tag correspond to a data element
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDemandElement() const
return true if tag correspond to a demand element
bool isAdditionalElement() const
return true if tag correspond to an additional element
std::string getAttributeStr() const
set attribute
void enableIntervalBarUpdate()
enable interval bar update
std::string getDataSetStr() const
get dataSet
std::string getBeginStr() const
get begin
void hideIntervalBar()
hide all options menu checks
void setGenericDataType()
set generic data type
void showIntervalBar()
show interval option bar
void disableIntervalBar()
disable interval bar
void updateIntervalBar()
update interval bar
void updateComboBoxAttributes()
update combo box attributes
void disableIntervalBarUpdate()
enable interval bar update
void buildIntervalBarElements()
build interval bar elements
std::string getGenericDataTypeStr() const
get generic data type
IntervalBar(GNEViewNet *viewNet)
default constructor
std::string getEndStr() const
get end
void enableIntervalBar()
enable interval bar
void setInterval()
update limit by interval
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
std::vector< GNEEdgeRelData * > edgeRelDatas
vector with the clicked edge relation datas
std::vector< GNENetworkElement * > networkElements
vector with the clicked network elements
std::vector< GNEEdge * > edges
vector with the clicked edges
std::vector< GNEGenericData * > genericDatas
vector with the clicked generic datas
std::vector< GNEJunction * > junctions
vector with the clicked junctions
std::vector< GNEConnection * > connections
vector with the clicked connections
std::vector< GNEEdgeData * > edgeDatas
vector with the clicked edge datas
std::vector< GNECrossing * > crossings
vector with the clicked crossings
std::vector< GNEPOI * > POIs
vector with the clicked POIs
std::vector< GNETAZElement * > TAZElements
vector with the clicked TAZ elements
std::vector< GNEDemandElement * > demandElements
vector with the clicked demand elements
std::vector< GNEAttributeCarrier * > attributeCarriers
vector with the clicked attribute carriers
std::vector< GNEPoly * > polys
vector with the clicked polys
std::vector< GNELane * > lanes
vector with the clicked lanes
std::vector< GNEInternalLane * > internalLanes
vector with the clicked internal lanes
std::vector< GNETAZ * > TAZs
vector with the clicked TAZ elements
std::vector< GNEAdditional * > additionals
vector with the clicked additional elements
std::vector< GUIGlObject * > GUIGlObjects
vector with the clicked GUIGlObjects
std::vector< GNEShape * > shapes
vector with the clicked shape elements (Poly and POIs)
GNEPoly * getPolyFront() const
get front Poly or a pointer to nullptr
void updateObjectUnderCursor(const std::vector< GUIGlObject * > &GUIGlObjects)
update objects under cursor (Called only in onLeftBtnPress(...) function)
void updateNetworkElements(ObjectsContainer &container, GNEAttributeCarrier *AC)
update network elements
void sortGUIGlObjects(const std::vector< GUIGlObject * > &GUIGlObjects)
sort by altitude and update GUIGlObjects
GUIGlID getGlIDFront() const
get front GUI GL ID or a pointer to nullptr
void updateAdditionalElements(ObjectsContainer &container, GNEAttributeCarrier *AC)
update additional elements
GNEGenericData * getGenericDataElementFront() const
get generic data element or a pointer to nullptr
GNENetworkElement * getNetworkElementFront() const
get front network element or a pointer to nullptr
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier or a pointer to nullptr
GNEInternalLane * getInternalLaneFront() const
get front internal lane or a pointer to nullptr
GNECrossing * getCrossingFront() const
get front crossing or a pointer to nullptr
void updateShapeElements(ObjectsContainer &container, GNEAttributeCarrier *AC)
update shape elements
void updateTAZElements(ObjectsContainer &container, GNEAttributeCarrier *AC)
update TAZ elements
GNELane * getLaneFront() const
get front lane or a pointer to nullptr
GNETAZElement * getTAZElementFront() const
get front TAZElement or a pointer to nullptr
void updateGenericDataElements(ObjectsContainer &container, GNEAttributeCarrier *AC)
update generic data elements
void updateGUIGlObjects(ObjectsContainer &container)
updateGUIGlObjects
GNEEdgeData * getEdgeDataElementFront() const
get edge data element or a pointer to nullptr
void updateDemandElements(ObjectsContainer &container, GNEAttributeCarrier *AC)
update demand elements
GNEAdditional * getAdditionalFront() const
get front additional element or a pointer to nullptr
GUIGlObjectType getGlTypeFront() const
get front GUI GL object type or a pointer to nullptr
GNEJunction * getJunctionFront() const
get front junction or a pointer to nullptr
GNEDemandElement * getDemandElementFront() const
get front demand element or a pointer to nullptr
const std::vector< GNELane * > & getLanes() const
get lanes
void updateAttributeCarriers(ObjectsContainer &container, GNEAttributeCarrier *AC)
update attribute carrier elements
GNEShape * getShapeFront() const
get front shape element or a pointer to nullptr
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier or a pointer to nullptr
GNETAZ * getTAZFront() const
get front TAZ or a pointer to nullptr
const std::vector< GNEAttributeCarrier * > & getClickedAttributeCarriers() const
get vector with clicked ACs
GNEEdgeRelData * getEdgeRelDataElementFront() const
get edge rel data element or a pointer to nullptr
GNEConnection * getConnectionFront() const
get front connection or a pointer to nullptr
GNEPOI * getPOIFront() const
get front POI or a pointer to nullptr
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
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.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:752
A storage for options typed value containers)
Definition: OptionsCont.h:89
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
C++ TraCI client API implementation.
Definition: GUI.h:31
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
A list of positions.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
static const RGBColor WHITE
Definition: RGBColor.h:192
static const RGBColor BLUE
Definition: RGBColor.h:187
static const RGBColor YELLOW
Definition: RGBColor.h:188
static const RGBColor BLACK
Definition: RGBColor.h:193
static const RGBColor MAGENTA
Definition: RGBColor.h:190
A 2D- or 3D-Shape.
Definition: Shape.h:37
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:90
FXMenuCheckIcon * menuCheckLockTranships
menu check to lock tranships
FXMenuCheckIcon * menuCheckLockRides
menu check to lock rides
FXMenuCheckIcon * menuCheckLockConnections
menu check to lock connections
FXMenuCheckIcon * menuCheckLockEdgeTAZRels
menu check to lock edgeTAZRels
FXMenuCheckIcon * menuCheckLockEdges
menu check to lock edges
FXMenuCheckIcon * menuCheckLockWalk
menu check to lock walks
FXMenuCheckIcon * menuCheckLockVehicles
menu check to lock vehicles
FXMenuCheckIcon * menuCheckLockAdditionals
menu check to lock additionals
FXMenuCheckIcon * menuCheckLockPersonTrip
menu check to lock personTrips
FXMenuCheckIcon * menuCheckLockLanes
menu check to lock lanes
FXMenuCheckIcon * menuCheckLockPersons
menu check to lock persons
FXMenuCheckIcon * menuCheckLockPolygons
menu check to lock polygons
FXMenuCheckIcon * menuCheckLockTransports
menu check to lock transports
FXMenuCheckIcon * menuCheckLockContainers
menu check to lock containers
FXMenuCheckIcon * menuCheckLockEdgeRelDatas
menu check to lock edgeRelDatas
FXMenuCheckIcon * menuCheckLockStops
menu check to lock stops
FXMenuCheckIcon * menuCheckLockPOIs
menu check to lock POIs
FXMenuCheckIcon * menuCheckLockCrossings
menu check to lock crossings
FXMenuCheckIcon * menuCheckLockTAZs
menu check to lock TAZs
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 toogle 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 toogle TAZRel only from checkbox is enabled
bool TAZDrawFill() const
check if toogle 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 toogle 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 isCurrentSupermodeDemand() const
@check if current supermode is Demand
void setDemandEditMode(DemandEditMode demandMode, const bool force=false)
set Demand edit mode
EditModes(GNEViewNet *viewNet, const bool newNet)
default constructor
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
void setSupermode(Supermode supermode, const bool force)
set supermode
void setNetworkEditMode(NetworkEditMode networkMode, const bool force=false)
set Network edit mode
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 void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
static bool checkDrawing(const GNEAttributeCarrier *AC, GUIGlObjectType type, const double exaggeration)
check if icon can be drawn
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 calculateJunctionSelection()
calculate junction selection
MoveMultipleElementValues(GNEViewNet *viewNet)
constructor
const GNEMoveOffset calculateMoveOffset() const
calculate move offset
void moveSelection(const bool mouseLeftButtonPressed)
move selection
bool isMovingSelection() const
check if currently there is element being moved
bool isMovingSelectedEdge() const
flag for moving edge
void finishMoveSelection()
finish moving selection
void calculateEdgeSelection(const GNEEdge *clickedEdge)
calculate edge selection
void resetMovingSelectedEdge()
reset flag for moving edge
void finishMoveSingleElement()
finish moving single elements in Network AND Demand mode
void moveSingleElement(const bool mouseLeftButtonPressed)
move single element in Network AND Demand mode
MoveSingleElementValues(GNEViewNet *viewNet)
constructor
bool beginMoveSingleElementNetworkMode()
begin move single element in Network mode
bool beginMoveNetworkElementShape()
begin move network elementshape
bool beginMoveSingleElementDemandMode()
begin move single element in Demand mode
const GNEMoveOffset calculateMoveOffset() const
calculate offset
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
NetworkViewOptions(GNEViewNet *viewNet)
default constructor
void hideNetworkViewOptionsMenuChecks()
hide all options menu checks
void buildNetworkViewOptionsMenuChecks()
build menu checks
SaveElements(GNEViewNet *viewNet)
default constructor
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 processShapeSelection(const PositionVector &shape)
process shape selection
void processRectangleSelection()
process rectangle Selection
std::vector< GNEEdge * > processEdgeRectangleSelection()
process rectangle Selection (only limited to Edges)
SelectingArea(GNEViewNet *viewNet)
default constructor
bool isTestingEnabled() const
check if testing mode is enabled
void drawTestingElements(GUIMainWindow *mainWindow)
draw testing element
TestingMode(GNEViewNet *viewNet)
default constructor
void initTestingMode()
init testing mode
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 const std::vector< RGBColor > & getRainbowScaledColors()
get scaled rainbow colors