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-2020 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 /****************************************************************************/
33 #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 
367  if (mySwapLane2edge) {
368  if (myEdgeObjects.crossings.size() > 0) {
369  return myEdgeObjects.crossings.front();
370  } else {
371  return nullptr;
372  }
373  } else {
374  if (myLaneObjects.crossings.size() > 0) {
375  return myLaneObjects.crossings.front();
376  } else {
377  return nullptr;
378  }
379  }
380 }
381 
382 
385  if (mySwapLane2edge) {
386  if (myEdgeObjects.connections.size() > 0) {
387  return myEdgeObjects.connections.front();
388  } else {
389  return nullptr;
390  }
391  } else {
392  if (myLaneObjects.connections.size() > 0) {
393  return myLaneObjects.connections.front();
394  } else {
395  return nullptr;
396  }
397  }
398 }
399 
400 
403  if (mySwapLane2edge) {
404  if (myEdgeObjects.internalLanes.size() > 0) {
405  return myEdgeObjects.internalLanes.front();
406  } else {
407  return nullptr;
408  }
409  } else {
410  if (myLaneObjects.internalLanes.size() > 0) {
411  return myLaneObjects.internalLanes.front();
412  } else {
413  return nullptr;
414  }
415  }
416 }
417 
418 
419 GNEPOI*
421  if (mySwapLane2edge) {
422  if (myEdgeObjects.POIs.size() > 0) {
423  return myEdgeObjects.POIs.front();
424  } else {
425  return nullptr;
426  }
427  } else {
428  if (myLaneObjects.POIs.size() > 0) {
429  return myLaneObjects.POIs.front();
430  } else {
431  return nullptr;
432  }
433  }
434 }
435 
436 
437 GNEPoly*
439  if (mySwapLane2edge) {
440  if (myEdgeObjects.polys.size() > 0) {
441  return myEdgeObjects.polys.front();
442  } else {
443  return nullptr;
444  }
445  } else {
446  if (myLaneObjects.polys.size() > 0) {
447  return myLaneObjects.polys.front();
448  } else {
449  return nullptr;
450  }
451  }
452 }
453 
454 
455 GNETAZ*
457  if (mySwapLane2edge) {
458  if (myEdgeObjects.TAZs.size() > 0) {
459  return myEdgeObjects.TAZs.front();
460  } else {
461  return nullptr;
462  }
463  } else {
464  if (myLaneObjects.TAZs.size() > 0) {
465  return myLaneObjects.TAZs.front();
466  } else {
467  return nullptr;
468  }
469  }
470 }
471 
472 
475  if (mySwapLane2edge) {
476  if (myEdgeObjects.edgeDatas.size() > 0) {
477  return myEdgeObjects.edgeDatas.front();
478  } else {
479  return nullptr;
480  }
481  } else {
482  if (myLaneObjects.edgeDatas.size() > 0) {
483  return myLaneObjects.edgeDatas.front();
484  } else {
485  return nullptr;
486  }
487  }
488 }
489 
490 
493  if (mySwapLane2edge) {
494  if (myEdgeObjects.edgeRelDatas.size() > 0) {
495  return myEdgeObjects.edgeRelDatas.front();
496  } else {
497  return nullptr;
498  }
499  } else {
500  if (myLaneObjects.edgeRelDatas.size() > 0) {
501  return myLaneObjects.edgeRelDatas.front();
502  } else {
503  return nullptr;
504  }
505  }
506 }
507 
508 
509 const std::vector<GNEAttributeCarrier*>&
511  if (mySwapLane2edge) {
512  return myEdgeObjects.attributeCarriers;
513  } else {
514  return myLaneObjects.attributeCarriers;
515  }
516 }
517 
518 
520 
521 
522 void
524  // just clear all containers
525  GUIGlObjects.clear();
526  attributeCarriers.clear();
527  networkElements.clear();
528  additionals.clear();
529  shapes.clear();
530  TAZElements.clear();
531  demandElements.clear();
532  junctions.clear();
533  edges.clear();
534  lanes.clear();
535  crossings.clear();
536  connections.clear();
537  internalLanes.clear();
538  TAZs.clear();
539  POIs.clear();
540  polys.clear();
541  genericDatas.clear();
542  edgeDatas.clear();
543  edgeRelDatas.clear();
544 }
545 
546 
547 void
548 GNEViewNetHelper::ObjectsUnderCursor::sortGUIGlObjects(const std::vector<GUIGlObject*>& GUIGlObjects) {
549  // declare a map to save GUIGlObjects sorted by GLO_TYPE
550  std::map<GUIGlObjectType, std::vector<GUIGlObject*> > mySortedGUIGlObjects;
551  // iterate over set
552  for (const auto& GLObject : GUIGlObjects) {
553  mySortedGUIGlObjects[GLObject->getType()].push_back(GLObject);
554  }
555  // move sorted GUIGlObjects into myGUIGlObjectLanes using a reverse iterator
556  for (std::map<GUIGlObjectType, std::vector<GUIGlObject*> >::reverse_iterator i = mySortedGUIGlObjects.rbegin(); i != mySortedGUIGlObjects.rend(); i++) {
557  for (const auto& GlObject : i->second) {
558  // avoid GLO_NETWORKELEMENT
559  if (GlObject->getType() != GLO_NETWORKELEMENT) {
560  // add it in GUIGlObject splitting by edge/lanes
561  if (GlObject->getType() == GLO_LANE) {
562  myLaneObjects.GUIGlObjects.push_back(GlObject);
563  } else {
564  myEdgeObjects.GUIGlObjects.push_back(GlObject);
565  myLaneObjects.GUIGlObjects.push_back(GlObject);
566  }
567  }
568  }
569  }
570 }
571 
572 
573 void
575  // get front AC
576  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
577  // special case for edges and lanes
578  if (frontAC && (frontAC->getTagProperty().getTag() == SUMO_TAG_EDGE) && (AC->getTagProperty().getTag() == SUMO_TAG_LANE)) {
579  // compare IDs
580  if (AC->getAttribute(GNE_ATTR_PARENT) == frontAC->getID()) {
581  // insert at front
582  container.attributeCarriers.insert(container.attributeCarriers.begin(), AC);
583  } else {
584  // insert at back
585  container.attributeCarriers.push_back(AC);
586  }
587  } else {
588  // add it in attributeCarriers
589  if (AC == frontAC) {
590  // insert at front
591  container.attributeCarriers.insert(container.attributeCarriers.begin(), AC);
592  } else {
593  // insert at back
594  container.attributeCarriers.push_back(AC);
595  }
596  }
597 }
598 
599 
600 void
602  // get front AC
603  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
604  // check front element
605  if (AC == frontAC) {
606  // insert at front
607  container.networkElements.insert(container.networkElements.begin(), dynamic_cast<GNENetworkElement*>(AC));
608  } else {
609  // insert at back
610  container.networkElements.push_back(dynamic_cast<GNENetworkElement*>(AC));
611  }
612  // cast specific network element
613  switch (AC->getGUIGlObject()->getType()) {
614  case GLO_JUNCTION: {
615  // check front element
616  if (AC == frontAC) {
617  // insert at front
618  container.junctions.insert(container.junctions.begin(), dynamic_cast<GNEJunction*>(AC));
619  } else {
620  // insert at back
621  container.junctions.push_back(dynamic_cast<GNEJunction*>(AC));
622  }
623  break;
624  }
625  case GLO_EDGE: {
626  // check front element
627  if (AC == frontAC) {
628  // insert at front
629  container.edges.insert(container.edges.begin(), dynamic_cast<GNEEdge*>(AC));
630  } else {
631  // insert at back
632  container.edges.push_back(dynamic_cast<GNEEdge*>(AC));
633  }
634  break;
635  }
636  case GLO_LANE: {
637  // check front element
638  if (AC == frontAC) {
639  // insert at front
640  container.lanes.insert(container.lanes.begin(), dynamic_cast<GNELane*>(AC));
641  } else {
642  // insert at back
643  container.lanes.push_back(dynamic_cast<GNELane*>(AC));
644  }
645  break;
646  }
647  case GLO_CROSSING: {
648  // check front element
649  if (AC == frontAC) {
650  // insert at front
651  container.crossings.insert(container.crossings.begin(), dynamic_cast<GNECrossing*>(AC));
652  } else {
653  // insert at back
654  container.crossings.push_back(dynamic_cast<GNECrossing*>(AC));
655  }
656  break;
657  }
658  case GLO_CONNECTION: {
659  // check front element
660  if (AC == frontAC) {
661  // insert at front
662  container.connections.insert(container.connections.begin(), dynamic_cast<GNEConnection*>(AC));
663  } else {
664  // insert at back
665  container.connections.push_back(dynamic_cast<GNEConnection*>(AC));
666  }
667  break;
668  }
669  case GLO_TLLOGIC: {
670  // check front element
671  if (AC == frontAC) {
672  // insert at front
673  container.internalLanes.insert(container.internalLanes.begin(), dynamic_cast<GNEInternalLane*>(AC));
674  } else {
675  // insert at back
676  container.internalLanes.push_back(dynamic_cast<GNEInternalLane*>(AC));
677  }
678  break;
679  }
680  default:
681  break;
682  }
683 }
684 
685 
686 void
688  // get front AC
689  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
690  // cast additional element from attribute carrier
691  if (AC == frontAC) {
692  // insert at front
693  container.additionals.insert(container.additionals.begin(), dynamic_cast<GNEAdditional*>(AC));
694  } else {
695  // insert at back
696  container.additionals.push_back(dynamic_cast<GNEAdditional*>(AC));
697  }
698 }
699 
700 
701 void
703  // get front AC
704  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
705  // cast TAZ element from attribute carrier
706  if (AC == frontAC) {
707  // insert at front
708  container.TAZElements.insert(container.TAZElements.begin(), dynamic_cast<GNETAZElement*>(AC));
709  } else {
710  // insert at back
711  container.TAZElements.push_back(dynamic_cast<GNETAZElement*>(AC));
712  }
713  // cast specific TAZ
714  switch (AC->getGUIGlObject()->getType()) {
715  case GLO_TAZ:
716  // check front element
717  if (AC == frontAC) {
718  // insert at front
719  container.TAZs.insert(container.TAZs.begin(), dynamic_cast<GNETAZ*>(AC));
720  } else {
721  // insert at back
722  container.TAZs.push_back(dynamic_cast<GNETAZ*>(AC));
723  }
724  break;
725  default:
726  break;
727  }
728 }
729 
730 
731 void
733  // get front AC
734  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
735  // cast shape element from attribute carrier
736  if (AC == frontAC) {
737  // insert at front
738  container.shapes.insert(container.shapes.begin(), dynamic_cast<GNEShape*>(AC));
739  } else {
740  // insert at back
741  container.shapes.push_back(dynamic_cast<GNEShape*>(AC));
742  }
743  // cast specific shape
744  switch (AC->getGUIGlObject()->getType()) {
745  case GLO_POI:
746  // check front element
747  if (AC == frontAC) {
748  // insert at front
749  container.POIs.insert(container.POIs.begin(), dynamic_cast<GNEPOI*>(AC));
750  } else {
751  // insert at back
752  container.POIs.push_back(dynamic_cast<GNEPOI*>(AC));
753  }
754  break;
755  case GLO_POLYGON:
756  // check front element
757  if (AC == frontAC) {
758  // insert at front
759  container.polys.insert(container.polys.begin(), dynamic_cast<GNEPoly*>(AC));
760  } else {
761  // insert at back
762  container.polys.push_back(dynamic_cast<GNEPoly*>(AC));
763  }
764  break;
765  default:
766  break;
767  }
768 }
769 
770 
771 void
773  // get front AC
774  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
775  // cast demand element from attribute carrier
776  if (AC == frontAC) {
777  // insert at front
778  container.demandElements.insert(container.demandElements.begin(), dynamic_cast<GNEDemandElement*>(AC));
779  } else {
780  // insert at back
781  container.demandElements.push_back(dynamic_cast<GNEDemandElement*>(AC));
782  }
783 }
784 
785 
786 void
788  // get front AC
789  const GNEAttributeCarrier* frontAC = myViewNet->getFrontAttributeCarrier();
790  // cast generic data from attribute carrier
791  if (AC == frontAC) {
792  // insert at front
793  container.genericDatas.insert(container.genericDatas.begin(), dynamic_cast<GNEGenericData*>(AC));
794  } else {
795  // insert at back
796  container.genericDatas.push_back(dynamic_cast<GNEGenericData*>(AC));
797  }
798  // cast specific generic data
799  switch (AC->getGUIGlObject()->getType()) {
800  case GLO_EDGEDATA:
801  // check front element
802  if (AC == frontAC) {
803  // insert at front
804  container.edgeDatas.insert(container.edgeDatas.begin(), dynamic_cast<GNEEdgeData*>(AC));
805  } else {
806  // insert at back
807  container.edgeDatas.push_back(dynamic_cast<GNEEdgeData*>(AC));
808  }
809  break;
810  case GLO_EDGERELDATA:
811  // check front element
812  if (AC == frontAC) {
813  // insert at front
814  container.edgeRelDatas.insert(container.edgeRelDatas.begin(), dynamic_cast<GNEEdgeRelData*>(AC));
815  } else {
816  // insert at back
817  container.edgeRelDatas.push_back(dynamic_cast<GNEEdgeRelData*>(AC));
818  }
819  break;
820  default:
821  break;
822  }
823 }
824 
825 
826 void
828  // first clear GUIGlObjects
829  container.GUIGlObjects.clear();
830  // reserve
831  container.GUIGlObjects.reserve(container.attributeCarriers.size());
832  // iterate over atribute carriers
833  for (const auto& attributeCarrrier : container.attributeCarriers) {
834  // add GUIGlObject in GUIGlObjects container
835  container.GUIGlObjects.push_back(attributeCarrrier->getGUIGlObject());
836  }
837 }
838 
839 
841  myViewNet(nullptr),
842  mySwapLane2edge(false) {
843 }
844 
845 // ---------------------------------------------------------------------------
846 // GNEViewNetHelper::MouseButtonKeyPressed - methods
847 // ---------------------------------------------------------------------------
848 
850  myEventInfo(nullptr) {
851 }
852 
853 
854 void
856  myEventInfo = (FXEvent*) eventData;
857 }
858 
859 
860 bool
862  if (myEventInfo) {
863  return (myEventInfo->state & SHIFTMASK) != 0;
864  } else {
865  return false;
866  }
867 }
868 
869 
870 bool
872  if (myEventInfo) {
873  return (myEventInfo->state & CONTROLMASK) != 0;
874  } else {
875  return false;
876  }
877 }
878 
879 
880 bool
882  if (myEventInfo) {
883  return (myEventInfo->state & ALTMASK) != 0;
884  } else {
885  return false;
886  }
887 }
888 
889 
890 bool
892  if (myEventInfo) {
893  return (myEventInfo->state & LEFTBUTTONMASK) != 0;
894  } else {
895  return false;
896  }
897 }
898 
899 
900 bool
902  if (myEventInfo) {
903  return (myEventInfo->state & RIGHTBUTTONMASK) != 0;
904  } else {
905  return false;
906  }
907 }
908 
909 // ---------------------------------------------------------------------------
910 // GNEViewNetHelper::MoveSingleElementValues - methods
911 // ---------------------------------------------------------------------------
912 
914  myViewNet(viewNet),
915  myDemandElementToMove(nullptr) {
916 }
917 
918 
919 bool
921  // first obtain moving reference (common for all)
922  myRelativeClickedPosition = myViewNet->getPositionInformation();
923  // get edited element
924  const GNENetworkElement* editedElement = myViewNet->myEditNetworkElementShapes.getEditedNetworkElement();
925  // check what type of AC will be moved
926  if (myViewNet->myObjectsUnderCursor.getJunctionFront() && (myViewNet->myObjectsUnderCursor.getJunctionFront() == editedElement)) {
927  return calculateMoveOperationShape(myViewNet->myObjectsUnderCursor.getJunctionFront(),
928  myViewNet->myObjectsUnderCursor.getJunctionFront()->getNBNode()->getShape(),
929  myViewNet->getVisualisationSettings().neteditSizeSettings.junctionGeometryPointRadius);
930  } else if (myViewNet->myObjectsUnderCursor.getCrossingFront() && (myViewNet->myObjectsUnderCursor.getCrossingFront() == editedElement)) {
931  return calculateMoveOperationShape(myViewNet->myObjectsUnderCursor.getCrossingFront(),
932  myViewNet->myObjectsUnderCursor.getCrossingFront()->getCrossingShape(),
933  myViewNet->getVisualisationSettings().neteditSizeSettings.crossingGeometryPointRadius);
934  } else if (myViewNet->myObjectsUnderCursor.getConnectionFront() && (myViewNet->myObjectsUnderCursor.getConnectionFront() == editedElement)) {
935  return calculateMoveOperationShape(myViewNet->myObjectsUnderCursor.getConnectionFront(),
936  myViewNet->myObjectsUnderCursor.getConnectionFront()->getConnectionShape(),
937  myViewNet->getVisualisationSettings().neteditSizeSettings.connectionGeometryPointRadius);
938  } else {
939  // there isn't moved items, then return false
940  return false;
941  }
942 }
943 
944 
945 bool
947  // first obtain moving reference (common for all)
948  myRelativeClickedPosition = myViewNet->getPositionInformation();
949  // get front AC
950  const GNEAttributeCarrier* frontAC = myViewNet->myObjectsUnderCursor.getAttributeCarrierFront();
951  // check what type of AC will be moved
952  if (myViewNet->myObjectsUnderCursor.getPolyFront() && (frontAC == myViewNet->myObjectsUnderCursor.getPolyFront())) {
953  // calculate polygonShapeOffset
954  const double polygonShapeOffset = myViewNet->myObjectsUnderCursor.getPolyFront()->getShape().nearest_offset_to_point2D(myViewNet->getPositionInformation(), false);
955  // calculate distance to shape
956  const double distanceToShape = myViewNet->myObjectsUnderCursor.getPolyFront()->getShape().distance2D(myViewNet->getPositionInformation());
957  // get snap radius
958  const double snap_radius = myViewNet->getVisualisationSettings().neteditSizeSettings.polygonGeometryPointRadius;
959  // check if we clicked over shape
960  if (distanceToShape <= snap_radius) {
961  // get move operation
962  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getPolyFront()->getMoveOperation(polygonShapeOffset);
963  // continue if move operation is valid
964  if (moveOperation) {
965  myMoveOperations.push_back(moveOperation);
966  return true;
967  }
968  }
969  // shape operation value wasn't calculated, then return false
970  return false;
971  } else if (myViewNet->myObjectsUnderCursor.getPOIFront() && (frontAC == myViewNet->myObjectsUnderCursor.getPOIFront())) {
972  // get move operation
973  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getPOIFront()->getMoveOperation(0);
974  // continue if move operation is valid
975  if (moveOperation) {
976  myMoveOperations.push_back(moveOperation);
977  return true;
978  } else {
979  return false;
980  }
981  } else if (myViewNet->myObjectsUnderCursor.getAdditionalFront() && (frontAC == myViewNet->myObjectsUnderCursor.getAdditionalFront())) {
982  // get move operation
983  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getAdditionalFront()->getMoveOperation(0);
984  // continue if move operation is valid
985  if (moveOperation) {
986  myMoveOperations.push_back(moveOperation);
987  return true;
988  } else {
989  return false;
990  }
991  } else if (myViewNet->myObjectsUnderCursor.getTAZFront() && (frontAC == myViewNet->myObjectsUnderCursor.getTAZFront())) {
992  // calculate TAZShapeOffset
993  const double TAZShapeOffset = myViewNet->myObjectsUnderCursor.getTAZFront()->getTAZElementShape().nearest_offset_to_point2D(myViewNet->getPositionInformation(), false);
994  // calculate distance to TAZ
995  const double distanceToShape = myViewNet->myObjectsUnderCursor.getTAZFront()->getTAZElementShape().distance2D(myViewNet->getPositionInformation());
996  // get snap radius
997  const double snap_radius = myViewNet->getVisualisationSettings().neteditSizeSettings.polygonGeometryPointRadius;
998  // check if we clicked over TAZ
999  if (distanceToShape <= snap_radius) {
1000  // get move operation
1001  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getTAZFront()->getMoveOperation(TAZShapeOffset);
1002  // continue if move operation is valid
1003  if (moveOperation) {
1004  myMoveOperations.push_back(moveOperation);
1005  return true;
1006  }
1007  }
1008  // TAZ operation value wasn't calculated, then return false
1009  return false;
1010  } else if (myViewNet->myObjectsUnderCursor.getJunctionFront() && (frontAC == myViewNet->myObjectsUnderCursor.getJunctionFront())) {
1011  if (myViewNet->myObjectsUnderCursor.getJunctionFront()->isShapeEdited()) {
1012  return false;
1013  } else {
1014  // get move operation
1015  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getJunctionFront()->getMoveOperation(0);
1016  // continue if move operation is valid
1017  if (moveOperation) {
1018  myMoveOperations.push_back(moveOperation);
1019  return true;
1020  } else {
1021  return false;
1022  }
1023  }
1024  } else if ((myViewNet->myObjectsUnderCursor.getEdgeFront() && (frontAC == myViewNet->myObjectsUnderCursor.getEdgeFront())) ||
1025  (myViewNet->myObjectsUnderCursor.getLaneFront() && (frontAC == myViewNet->myObjectsUnderCursor.getLaneFront()))) {
1026  // calculate Edge movement values (can be entire shape, single geometry points, altitude, etc.)
1027  if (myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1028  // edit end point
1029  myViewNet->myObjectsUnderCursor.getEdgeFront()->editEndpoint(myViewNet->getPositionInformation(), myViewNet->myUndoList);
1030  // edge values wasn't calculated, then return false
1031  return false;
1032  } else {
1033  // calculate shape offset
1034  const double shapeOffset = myViewNet->myObjectsUnderCursor.getEdgeFront()->getNBEdge()->getGeometry().nearest_offset_to_point2D(myViewNet->getPositionInformation());
1035  // get move operation
1036  GNEMoveOperation* moveOperation = myViewNet->myObjectsUnderCursor.getEdgeFront()->getMoveOperation(shapeOffset);
1037  // continue if move operation is valid
1038  if (moveOperation) {
1039  myMoveOperations.push_back(moveOperation);
1040  return true;
1041  } else {
1042  return false;
1043  }
1044  }
1045  } else {
1046  // there isn't moved items, then return false
1047  return false;
1048  }
1049 }
1050 
1051 
1052 bool
1054  // first obtain moving reference (common for all)
1055  myRelativeClickedPosition = myViewNet->getPositionInformation();
1056  // check what type of AC will be moved
1057  if (myViewNet->myObjectsUnderCursor.getDemandElementFront() &&
1058  (myViewNet->myObjectsUnderCursor.getAttributeCarrierFront() == myViewNet->myObjectsUnderCursor.getDemandElementFront())) {
1059  // set additionals moved object
1060  myDemandElementToMove = myViewNet->myObjectsUnderCursor.getDemandElementFront();
1061  // start demand element geometry moving
1062  myDemandElementToMove->startGeometryMoving();
1063  // there is moved items, then return true
1064  return true;
1065  } else {
1066  // there isn't moved items, then return false
1067  return false;
1068  }
1069 }
1070 
1071 
1072 void
1074  // calculate offsetMovement
1075  const Position offsetMovement = calculateOffset();
1076  // calculate movement for demand (temporal)
1077  if (myDemandElementToMove/* && (myDemandElementToMove->isDemandElementBlocked() == false)*/) {
1078  // Move DemandElement geometry without commiting changes
1079  myDemandElementToMove->moveGeometry(offsetMovement);
1080  }
1081  // check if mouse button is pressed
1082  if (mouseLeftButtonPressed) {
1083  // iterate over all operations
1084  for (const auto& moveOperation : myMoveOperations) {
1085  // move elements
1086  GNEMoveElement::moveElement(myViewNet, moveOperation, offsetMovement);
1087  }
1088  } else {
1089  // iterate over all operations
1090  for (const auto& moveOperation : myMoveOperations) {
1091  // commit move
1092  GNEMoveElement::commitMove(myViewNet, moveOperation, offsetMovement, myViewNet->getUndoList());
1093  // don't forget delete move operation
1094  delete moveOperation;
1095  }
1096  // clear move operations
1097  myMoveOperations.clear();
1098  }
1099 }
1100 
1101 
1102 void
1104  // calculate offsetMovement
1105  const Position offsetMovement = calculateOffset();
1106  // finish demand (temporal)
1107  if (myDemandElementToMove) {
1108  myDemandElementToMove->commitGeometryMoving(myViewNet->getUndoList());
1109  myDemandElementToMove->endGeometryMoving();
1110  myDemandElementToMove = nullptr;
1111  }
1112  // finish all move operations
1113  for (const auto& moveOperation : myMoveOperations) {
1114  GNEMoveElement::commitMove(myViewNet, moveOperation, offsetMovement, myViewNet->getUndoList());
1115  // don't forget delete move operation
1116  delete moveOperation;
1117  }
1118  // clear move operations
1119  myMoveOperations.clear();
1120 }
1121 
1122 
1123 Position
1125  // calculate offsetMovement depending of current mouse position and relative clicked position
1126  // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1127  Position offsetMovement = (myViewNet->getPositionInformation() - myViewNet->myMoveSingleElementValues.myRelativeClickedPosition);
1128  // calculate Z depending of moveElevation
1129  if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1130  // reset offset X and Y and use Y for Z
1131  offsetMovement = Position(0, 0, offsetMovement.y());
1132  } else {
1133  // leave z empty (because in this case offset only actuates over X-Y)
1134  offsetMovement.setz(0);
1135  }
1136  // return offset
1137  return offsetMovement;
1138 }
1139 
1140 
1141 bool
1143  // calculate junctionShapeOffset
1144  const double junctionShapeOffset = shape.nearest_offset_to_point2D(myViewNet->getPositionInformation(), false);
1145  // calculate distance to shape
1146  const double distanceToShape = shape.distance2D(myViewNet->getPositionInformation());
1147  // check if we clicked over shape
1148  if (distanceToShape <= radius) {
1149  // get move operation
1150  GNEMoveOperation* moveOperation = moveElement->getMoveOperation(junctionShapeOffset);
1151  // continue if move operation is valid
1152  if (moveOperation) {
1153  myMoveOperations.push_back(moveOperation);
1154  return true;
1155  }
1156  }
1157  // shape operation value wasn't calculated, then return false
1158  return false;
1159 }
1160 
1161 // ---------------------------------------------------------------------------
1162 // GNEViewNetHelper::MoveMultipleElementValues - methods
1163 // ---------------------------------------------------------------------------
1164 
1166  myViewNet(viewNet) {
1167 }
1168 
1169 
1170 void
1172  // save clicked position (to calculate offset)
1173  myClickedPosition = myViewNet->getPositionInformation();
1174  // obtain Junctions and edges selected
1175  const auto movedJunctions = myViewNet->getNet()->retrieveJunctions(true);
1176  const auto movedEdges = myViewNet->getNet()->retrieveEdges(true);
1177  // continue depending of clicked element
1178  if (myViewNet->myObjectsUnderCursor.getJunctionFront()) {
1179  calculateJunctionSelection();
1180  } else if (myViewNet->myObjectsUnderCursor.getEdgeFront()) {
1181  calculateEdgeSelection(myViewNet->myObjectsUnderCursor.getEdgeFront());
1182  }
1183 }
1184 
1185 
1186 void
1188  // calculate offsetMovement
1189  const Position offsetMovement = calculateOffset();
1190  // check if mouse button is pressed
1191  if (mouseLeftButtonPressed) {
1192  // iterate over all operations
1193  for (const auto& moveOperation : myMoveOperations) {
1194  // move elements
1195  GNEMoveElement::moveElement(myViewNet, moveOperation, offsetMovement);
1196  }
1197  } else if (myMoveOperations.size() > 0) {
1198  // begin undo list
1199  myViewNet->getUndoList()->p_begin("moving selection");
1200  // iterate over all operations
1201  for (const auto& moveOperation : myMoveOperations) {
1202  // commit move
1203  GNEMoveElement::commitMove(myViewNet, moveOperation, offsetMovement, myViewNet->getUndoList());
1204  // don't forget delete move operation
1205  delete moveOperation;
1206  }
1207  // end undo list
1208  myViewNet->getUndoList()->p_end();
1209  // clear move operations
1210  myMoveOperations.clear();
1211  }
1212 }
1213 
1214 
1215 void
1217  // calculate offsetMovement
1218  const Position offsetMovement = calculateOffset();
1219  // begin undo list
1220  myViewNet->getUndoList()->p_begin("moving selection");
1221  // finish all move operations
1222  for (const auto& moveOperation : myMoveOperations) {
1223  GNEMoveElement::commitMove(myViewNet, moveOperation, offsetMovement, myViewNet->getUndoList());
1224  // don't forget delete move operation
1225  delete moveOperation;
1226  }
1227  // end undo list
1228  myViewNet->getUndoList()->p_end();
1229  // clear move operations
1230  myMoveOperations.clear();
1231 }
1232 
1233 
1234 bool
1236  return (myMoveOperations.size() > 0);
1237 }
1238 
1239 
1240 Position
1242  // calculate offsetMovement depending of current mouse position and relative clicked position
1243  // @note #3521: Add checkBox to allow moving elements... has to be implemented and used here
1244  Position offsetMovement = (myViewNet->getPositionInformation() - myClickedPosition);
1245  // calculate Z depending of moveElevation
1246  if (myViewNet->myNetworkViewOptions.menuCheckMoveElevation->shown() && myViewNet->myNetworkViewOptions.menuCheckMoveElevation->amChecked() == TRUE) {
1247  // reset offset X and Y and use Y for Z
1248  offsetMovement = Position(0, 0, offsetMovement.y());
1249  } else {
1250  // leave z empty (because in this case offset only actuates over X-Y)
1251  offsetMovement.setz(0);
1252  }
1253  // return offset
1254  return offsetMovement;
1255 }
1256 
1257 
1258 void
1260  // declare move operation
1261  GNEMoveOperation* moveOperation = nullptr;
1262  // first move all selected junctions
1263  const auto selectedJunctions = myViewNet->getNet()->retrieveJunctions(true);
1264  // iterate over selected junctions
1265  for (const auto& junction : selectedJunctions) {
1266  moveOperation = junction->getMoveOperation(0);
1267  if (moveOperation) {
1268  myMoveOperations.push_back(moveOperation);
1269  }
1270  }
1271  // now move all selected edges
1272  const auto selectedEdges = myViewNet->getNet()->retrieveEdges(true);
1273  // iterate over selected edges
1274  for (const auto& edge : selectedEdges) {
1275  moveOperation = edge->getMoveOperation(0);
1276  if (moveOperation) {
1277  myMoveOperations.push_back(moveOperation);
1278  }
1279  }
1280 }
1281 
1282 
1283 void
1285  // declare move operation
1286  GNEMoveOperation* moveOperation = nullptr;
1287  // first move all selected junctions
1288  const auto selectedJunctions = myViewNet->getNet()->retrieveJunctions(true);
1289  // iterate over selected junctions
1290  for (const auto& junction : selectedJunctions) {
1291  moveOperation = junction->getMoveOperation(0);
1292  if (moveOperation) {
1293  myMoveOperations.push_back(moveOperation);
1294  }
1295  }
1296  // obtain selected edges in two groups (depending of angle)
1297  const auto selectedEdges000180 = myViewNet->getNet()->retrieve000180AngleEdges(true);
1298  const auto selectedEdges180360 = myViewNet->getNet()->retrieve180360AngleEdges(true);
1299  // calculate shape offset for clicked edge
1300  const double shapeOffset = clickedEdge->getNBEdge()->getGeometry().nearest_offset_to_point2D(myViewNet->getPositionInformation());
1301  // get flag for inverse offset
1302  const bool useInverseOffset = (std::find(selectedEdges000180.begin(), selectedEdges000180.end(), clickedEdge) != selectedEdges000180.end());
1303  // iterate over edges betwen 0 and 180 degrees
1304  for (const auto& edge : selectedEdges000180) {
1305  // get move operation depending of useInverseOffset
1306  if (useInverseOffset) {
1307  moveOperation = edge->getMoveOperation(shapeOffset);
1308  } else {
1309  moveOperation = edge->getMoveOperation(edge->getNBEdge()->getGeometry().length2D() - shapeOffset);
1310  }
1311  // continue if move operation is valid
1312  if (moveOperation) {
1313  myMoveOperations.push_back(moveOperation);
1314  }
1315  }
1316  // iterate over edges betwen 180 and 360 degrees
1317  for (const auto& edge : selectedEdges180360) {
1318  // get move operation depending of useInverseOffset
1319  if (useInverseOffset) {
1320  moveOperation = edge->getMoveOperation(edge->getNBEdge()->getGeometry().length2D() - shapeOffset);
1321  } else {
1322  moveOperation = edge->getMoveOperation(shapeOffset);
1323  }
1324  // continue if move operation is valid
1325  if (moveOperation) {
1326  myMoveOperations.push_back(moveOperation);
1327  }
1328  }
1329 }
1330 
1331 // ---------------------------------------------------------------------------
1332 // GNEViewNetHelper::VehicleOptions - methods
1333 // ---------------------------------------------------------------------------
1334 
1336  myViewNet(viewNet) {
1337 }
1338 
1339 
1340 void
1342  UNUSED_PARAMETER(myViewNet);
1343  // currently unused
1344 }
1345 
1346 
1347 void
1349  // currently unused
1350 }
1351 
1352 // ---------------------------------------------------------------------------
1353 // GNEViewNetHelper::VehicleTypeOptions - methods
1354 // ---------------------------------------------------------------------------
1355 
1357  myViewNet(viewNet) {
1358 }
1359 
1360 
1361 void
1363  UNUSED_PARAMETER(myViewNet);
1364  // currently unused
1365 }
1366 
1367 
1368 void
1370  // currently unused
1371 }
1372 
1373 // ---------------------------------------------------------------------------
1374 // GNEViewNetHelper::SelectingArea - methods
1375 // ---------------------------------------------------------------------------
1376 
1378  selectingUsingRectangle(false),
1379  startDrawing(false),
1380  myViewNet(viewNet) {
1381 }
1382 
1383 
1384 void
1386  selectingUsingRectangle = true;
1387  selectionCorner1 = myViewNet->getPositionInformation();
1388  selectionCorner2 = selectionCorner1;
1389 }
1390 
1391 
1392 void
1394  // start drawing
1395  startDrawing = true;
1396  // only update selection corner 2
1397  selectionCorner2 = myViewNet->getPositionInformation();
1398  // update status bar
1399  myViewNet->setStatusBarText("Selection width:" + toString(fabs(selectionCorner1.x() - selectionCorner2.x()))
1400  + " height:" + toString(fabs(selectionCorner1.y() - selectionCorner2.y()))
1401  + " diagonal:" + toString(selectionCorner1.distanceTo2D(selectionCorner2)));
1402 }
1403 
1404 
1405 void
1407  // finish rectangle selection
1408  selectingUsingRectangle = false;
1409  startDrawing = false;
1410 }
1411 
1412 
1413 void
1415  // shift held down on mouse-down and mouse-up and check that rectangle exist
1416  if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1417  (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1418  myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1419  // create boundary between two corners
1420  Boundary rectangleBoundary;
1421  rectangleBoundary.add(selectionCorner1);
1422  rectangleBoundary.add(selectionCorner2);
1423  // process selection within boundary
1424  processBoundarySelection(rectangleBoundary);
1425  }
1426 }
1427 
1428 
1429 std::vector<GNEEdge*>
1431  // declare vector for selection
1432  std::vector<GNEEdge*> result;
1433  // shift held down on mouse-down and mouse-up and check that rectangle exist
1434  if ((abs(selectionCorner1.x() - selectionCorner2.x()) > 0.01) &&
1435  (abs(selectionCorner1.y() - selectionCorner2.y()) > 0.01) &&
1436  myViewNet->myMouseButtonKeyPressed.shiftKeyPressed()) {
1437  // create boundary between two corners
1438  Boundary rectangleBoundary;
1439  rectangleBoundary.add(selectionCorner1);
1440  rectangleBoundary.add(selectionCorner2);
1441  if (myViewNet->makeCurrent()) {
1442  // obtain all ACs in Rectangle BOundary
1443  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundary = myViewNet->getAttributeCarriersInBoundary(rectangleBoundary);
1444  // Filter ACs in Boundary and get only edges
1445  for (auto i : ACsInBoundary) {
1446  if (i.second->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1447  result.push_back(dynamic_cast<GNEEdge*>(i.second));
1448  }
1449  }
1450  myViewNet->makeNonCurrent();
1451  }
1452  }
1453  return result;
1454 }
1455 
1456 
1457 void
1459  processBoundarySelection(shape.getBoxBoundary());
1460 }
1461 
1462 
1463 void
1465  if (selectingUsingRectangle) {
1466  glPushMatrix();
1467  glTranslated(0, 0, GLO_RECTANGLESELECTION);
1468  GLHelper::setColor(color);
1469  glLineWidth(2);
1470  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1471  glBegin(GL_QUADS);
1472  glVertex2d(selectionCorner1.x(), selectionCorner1.y());
1473  glVertex2d(selectionCorner1.x(), selectionCorner2.y());
1474  glVertex2d(selectionCorner2.x(), selectionCorner2.y());
1475  glVertex2d(selectionCorner2.x(), selectionCorner1.y());
1476  glEnd();
1477  glPopMatrix();
1478  }
1479 }
1480 
1481 
1482 void
1484  if (myViewNet->makeCurrent()) {
1485  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundary = myViewNet->getAttributeCarriersInBoundary(boundary);
1486  // filter ACsInBoundary depending of current supermode
1487  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsInBoundaryFiltered;
1488  for (const auto& AC : ACsInBoundary) {
1489  if (myViewNet->myEditModes.isCurrentSupermodeNetwork()) {
1490  if (AC.second->getTagProperty().isNetworkElement() || AC.second->getTagProperty().isAdditionalElement() ||
1491  AC.second->getTagProperty().isTAZElement() || AC.second->getTagProperty().isShape()) {
1492  ACsInBoundaryFiltered.insert(AC);
1493  }
1494  } else if (myViewNet->myEditModes.isCurrentSupermodeDemand() && AC.second->getTagProperty().isDemandElement()) {
1495  ACsInBoundaryFiltered.insert(AC);
1496  } else if (myViewNet->myEditModes.isCurrentSupermodeData() && AC.second->getTagProperty().isGenericData()) {
1497  ACsInBoundaryFiltered.insert(AC);
1498  }
1499  }
1500  // declare two sets of attribute carriers, one for select and another for unselect
1501  std::vector<GNEAttributeCarrier*> ACToSelect;
1502  std::vector<GNEAttributeCarrier*> ACToUnselect;
1503  // reserve memory (we assume that in the worst case we're going to insert all elements of ACsInBoundaryFiltered
1504  ACToSelect.reserve(ACsInBoundaryFiltered.size());
1505  ACToUnselect.reserve(ACsInBoundaryFiltered.size());
1506  // in restrict AND replace mode all current selected attribute carriers will be unselected
1507  if ((myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::RESTRICT) ||
1508  (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::REPLACE)) {
1509  // obtain selected ACs depending of current supermode
1510  std::vector<GNEAttributeCarrier*> selectedAC = myViewNet->getNet()->getSelectedAttributeCarriers(false);
1511  // add id into ACs to unselect
1512  for (auto i : selectedAC) {
1513  ACToUnselect.push_back(i);
1514  }
1515  }
1516  // iterate over AtributeCarriers obtained of boundary an place it in ACToSelect or ACToUnselect
1517  for (auto i : ACsInBoundaryFiltered) {
1518  switch (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode()) {
1520  ACToUnselect.push_back(i.second);
1521  break;
1523  if (std::find(ACToUnselect.begin(), ACToUnselect.end(), i.second) != ACToUnselect.end()) {
1524  ACToSelect.push_back(i.second);
1525  }
1526  break;
1527  default:
1528  ACToSelect.push_back(i.second);
1529  break;
1530  }
1531  }
1532  // select junctions and their connections and crossings if Auto select junctions is enabled (note: only for "add mode")
1533  if (myViewNet->autoSelectNodes() && (myViewNet->myViewParent->getSelectorFrame()->getModificationModeModul()->getModificationMode() == GNESelectorFrame::ModificationMode::Operation::ADD)) {
1534  std::vector<GNEEdge*> edgesToSelect;
1535  // iterate over ACToSelect and extract edges
1536  for (auto i : ACToSelect) {
1537  if (i->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1538  edgesToSelect.push_back(dynamic_cast<GNEEdge*>(i));
1539  }
1540  }
1541  // iterate over extracted edges
1542  for (auto i : edgesToSelect) {
1543  // select junction source and all their connections and crossings
1544  ACToSelect.push_back(i->getParentJunctions().front());
1545  for (auto j : i->getParentJunctions().front()->getGNEConnections()) {
1546  ACToSelect.push_back(j);
1547  }
1548  for (auto j : i->getParentJunctions().front()->getGNECrossings()) {
1549  ACToSelect.push_back(j);
1550  }
1551  // select junction destiny and all their connections crossings
1552  ACToSelect.push_back(i->getParentJunctions().back());
1553  for (auto j : i->getParentJunctions().back()->getGNEConnections()) {
1554  ACToSelect.push_back(j);
1555  }
1556  for (auto j : i->getParentJunctions().back()->getGNECrossings()) {
1557  ACToSelect.push_back(j);
1558  }
1559  }
1560  }
1561  // only continue if there is ACs to select or unselect
1562  if ((ACToSelect.size() + ACToUnselect.size()) > 0) {
1563  // first unselect AC of ACToUnselect and then selects AC of ACToSelect
1564  myViewNet->myUndoList->p_begin("selection using rectangle");
1565  for (auto i : ACToUnselect) {
1566  i->setAttribute(GNE_ATTR_SELECTED, "0", myViewNet->myUndoList);
1567  }
1568  for (auto i : ACToSelect) {
1569  if (i->getTagProperty().isSelectable()) {
1570  i->setAttribute(GNE_ATTR_SELECTED, "1", myViewNet->myUndoList);
1571  }
1572  }
1573  myViewNet->myUndoList->p_end();
1574  }
1575  myViewNet->makeNonCurrent();
1576  }
1577 }
1578 
1579 // ---------------------------------------------------------------------------
1580 // GNEViewNetHelper::TestingMode - methods
1581 // ---------------------------------------------------------------------------
1582 
1584  myViewNet(viewNet),
1585  myTestingEnabled(OptionsCont::getOptions().getBool("gui-testing")),
1586  myTestingWidth(0),
1587  myTestingHeight(0) {
1588 }
1589 
1590 
1591 void
1593  // first check if testing mode is enabled and window size is correct
1594  if (myTestingEnabled && OptionsCont::getOptions().isSet("window-size")) {
1595  std::vector<std::string> windowSize = OptionsCont::getOptions().getStringVector("window-size");
1596  // make sure that given windows size has exactly two valid int values
1597  if ((windowSize.size() == 2) && GNEAttributeCarrier::canParse<int>(windowSize[0]) && GNEAttributeCarrier::canParse<int>(windowSize[1])) {
1598  myTestingWidth = GNEAttributeCarrier::parse<int>(windowSize[0]);
1599  myTestingHeight = GNEAttributeCarrier::parse<int>(windowSize[1]);
1600  } else {
1601  WRITE_ERROR("Invalid windows size-format: " + toString(windowSize) + "for option 'window-size'");
1602  }
1603  }
1604 }
1605 
1606 
1607 void
1609  // first check if testing mode is neabled
1610  if (myTestingEnabled) {
1611  // check if main windows has to be resized
1612  if (myTestingWidth > 0 && ((myViewNet->getWidth() != myTestingWidth) || (myViewNet->getHeight() != myTestingHeight))) {
1613  // only resize once to avoid flickering
1614  //std::cout << " before resize: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
1615  mainWindow->resize(myTestingWidth + myTestingWidth - myViewNet->getWidth(), myTestingHeight + myTestingHeight - myViewNet->getHeight());
1616  //std::cout << " directly after resize: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
1617  myTestingWidth = 0;
1618  }
1619  //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << mainWindow->getWidth() << ", " << mainWindow->getHeight() << "\n";
1620  // draw pink square in the upper left corner on top of everything
1621  glPushMatrix();
1622  const double size = myViewNet->p2m(32);
1623  Position center = myViewNet->screenPos2NetPos(8, 8);
1625  glTranslated(center.x(), center.y(), GLO_TESTELEMENT);
1626  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1627  glBegin(GL_QUADS);
1628  glVertex2d(0, 0);
1629  glVertex2d(0, -size);
1630  glVertex2d(size, -size);
1631  glVertex2d(size, 0);
1632  glEnd();
1633  glPopMatrix();
1634  glPushMatrix();
1635  // show box with the current position relative to pink square
1636  Position posRelative = myViewNet->screenPos2NetPos(myViewNet->getWidth() - 40, myViewNet->getHeight() - 20);
1637  // adjust cursor position (24,25) to show exactly the same position as in function netedit.leftClick(match, X, Y)
1638  GLHelper::drawTextBox(toString(myViewNet->getWindowCursorPosition().x() - 24) + " " + toString(myViewNet->getWindowCursorPosition().y() - 25), posRelative, GLO_TESTELEMENT, myViewNet->p2m(20), RGBColor::BLACK, RGBColor::WHITE);
1639  glPopMatrix();
1640  }
1641 }
1642 
1643 
1644 bool
1646  return myTestingEnabled;
1647 }
1648 
1649 // ---------------------------------------------------------------------------
1650 // GNEViewNetHelper::SaveElements - methods
1651 // ---------------------------------------------------------------------------
1652 
1654  saveNetwork(nullptr),
1655  saveAdditionalElements(nullptr),
1656  saveDemandElements(nullptr),
1657  saveDataElements(nullptr),
1658  myViewNet(viewNet) {
1659 }
1660 
1661 
1662 void
1664  // create save network button
1665  saveNetwork = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1666  "\tSave network\tSave network. (Ctrl+S)", GUIIconSubSys::getIcon(GUIIcon::SAVENETWORKELEMENTS),
1667  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK, GUIDesignButtonToolbar);
1668  saveNetwork->create();
1669  // create save additional elements button
1670  saveAdditionalElements = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1671  "\tSave additional elements\tSave additional elements. (Ctrl+Shift+A)", GUIIconSubSys::getIcon(GUIIcon::SAVEADDITIONALELEMENTS),
1672  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_A_SAVEADDITIONALS, GUIDesignButtonToolbar);
1673  saveAdditionalElements->create();
1674  // create save demand elements button
1675  saveDemandElements = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1676  "\tSave demand elements\tSave demand elements. (Ctrl+Shift+D)", GUIIconSubSys::getIcon(GUIIcon::SAVEDEMANDELEMENTS),
1677  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS, GUIDesignButtonToolbar);
1678  saveDemandElements->create();
1679  // create save data elements button
1680  saveDataElements = new FXButton(myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements,
1681  "\tSave data elements\tSave data elements. (Ctrl+Shift+B)", GUIIconSubSys::getIcon(GUIIcon::SAVEDATAELEMENTS),
1682  myViewNet->getViewParent()->getGNEAppWindows(), MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS, GUIDesignButtonToolbar);
1683  saveDataElements->create();
1684  // recalc menu bar because there is new elements
1685  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements->recalc();
1686  // show menu bar modes
1687  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().saveElements->show();
1688 }
1689 
1690 // ---------------------------------------------------------------------------
1691 // GNEViewNetHelper::EditModes - methods
1692 // ---------------------------------------------------------------------------
1693 
1695  networkEditMode(NetworkEditMode::NETWORK_INSPECT),
1696  demandEditMode(DemandEditMode::DEMAND_INSPECT),
1697  dataEditMode(DataEditMode::DATA_INSPECT),
1698  networkButton(nullptr),
1699  demandButton(nullptr),
1700  dataButton(nullptr),
1701  myViewNet(viewNet),
1702  myCurrentSupermode(Supermode::NETWORK) {
1703 }
1704 
1705 
1706 void
1708  // create network button
1709  networkButton = new MFXCheckableButton(false,
1710  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes, "Network\t\tSet mode for edit network elements. (F2)",
1712  networkButton->create();
1713  // create demand button
1714  demandButton = new MFXCheckableButton(false,
1715  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes, "Demand\t\tSet mode for edit traffic demand. (F3)",
1717  demandButton->create();
1718  // create data button
1719  dataButton = new MFXCheckableButton(false,
1720  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().superModes, "Data\t\tSet mode for edit data demand. (F4)",
1722  dataButton->create();
1723  // recalc menu bar because there is new elements
1724  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
1725  // show menu bar modes
1726  myViewNet->getViewParent()->getGNEAppWindows()->getToolbarsGrip().modes->show();
1727 }
1728 
1729 
1730 void
1732  if (!force && (supermode == myCurrentSupermode)) {
1733  myViewNet->setStatusBarText("Mode already selected");
1734  if (myViewNet->myCurrentFrame != nullptr) {
1735  myViewNet->myCurrentFrame->focusUpperElement();
1736  }
1737  } else {
1738  myViewNet->setStatusBarText("");
1739  // abort current operation
1740  myViewNet->abortOperation(false);
1741  // set super mode
1742  myCurrentSupermode = supermode;
1743  // set supermodes
1744  if (supermode == Supermode::NETWORK) {
1745  // change buttons
1746  networkButton->setChecked(true);
1747  demandButton->setChecked(false);
1748  dataButton->setChecked(false);
1749  // show network buttons
1750  myViewNet->myNetworkCheckableButtons.showNetworkCheckableButtons();
1751  // hide demand buttons
1752  myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
1753  // hide data buttons
1754  myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
1755  // force update network mode
1756  setNetworkEditMode(networkEditMode, true);
1757  } else if (supermode == Supermode::DEMAND) {
1758  // change buttons
1759  networkButton->setChecked(false);
1760  demandButton->setChecked(true);
1761  dataButton->setChecked(false);
1762  // hide network buttons
1763  myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
1764  // show demand buttons
1765  myViewNet->myDemandCheckableButtons.showDemandCheckableButtons();
1766  // hide data buttons
1767  myViewNet->myDataCheckableButtons.hideDataCheckableButtons();
1768  // force update demand mode
1769  setDemandEditMode(demandEditMode, true);
1770  } else if (supermode == Supermode::DATA) {
1771  // change buttons
1772  networkButton->setChecked(false);
1773  demandButton->setChecked(false);
1774  dataButton->setChecked(true);
1775  // hide network buttons
1776  myViewNet->myNetworkCheckableButtons.hideNetworkCheckableButtons();
1777  // hide demand buttons
1778  myViewNet->myDemandCheckableButtons.hideDemandCheckableButtons();
1779  // show data buttons
1780  myViewNet->myDataCheckableButtons.showDataCheckableButtons();
1781  // force update data mode
1782  setDataEditMode(dataEditMode, true);
1783  }
1784  // update buttons
1785  networkButton->update();
1786  demandButton->update();
1787  dataButton->update();
1788  // update Supermode CommandButtons in GNEAppWindows
1789  myViewNet->myViewParent->getGNEAppWindows()->updateSuperModeMenuCommands(myCurrentSupermode);
1790  }
1791 }
1792 
1793 
1794 void
1796  if ((mode == networkEditMode) && !force) {
1797  myViewNet->setStatusBarText("Network mode already selected");
1798  if (myViewNet->myCurrentFrame != nullptr) {
1799  myViewNet->myCurrentFrame->focusUpperElement();
1800  }
1801  } else if (networkEditMode == NetworkEditMode::NETWORK_TLS && !myViewNet->myViewParent->getTLSEditorFrame()->isTLSSaved()) {
1802  myViewNet->setStatusBarText("Save modifications in TLS before change mode");
1803  myViewNet->myCurrentFrame->focusUpperElement();
1804  } else {
1805  myViewNet->setStatusBarText("");
1806  myViewNet->abortOperation(false);
1807  // stop editing of custom shapes
1808  myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
1809  // set new Network mode
1810  networkEditMode = mode;
1811  // for common modes (Inspect/Delete/Select/move) change also the other supermode
1812  if (networkEditMode == NetworkEditMode::NETWORK_INSPECT) {
1813  demandEditMode = DemandEditMode::DEMAND_INSPECT;
1814  dataEditMode = DataEditMode::DATA_INSPECT;
1815  } else if (networkEditMode == NetworkEditMode::NETWORK_DELETE) {
1816  demandEditMode = DemandEditMode::DEMAND_DELETE;
1817  dataEditMode = DataEditMode::DATA_DELETE;
1818  } else if (networkEditMode == NetworkEditMode::NETWORK_SELECT) {
1819  demandEditMode = DemandEditMode::DEMAND_SELECT;
1820  dataEditMode = DataEditMode::DATA_SELECT;
1821  } else if (networkEditMode == NetworkEditMode::NETWORK_MOVE) {
1822  demandEditMode = DemandEditMode::DEMAND_MOVE;
1823  }
1824  // certain modes require a recomputing
1825  switch (mode) {
1829  // modes which depend on computed data
1830  myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
1831  break;
1832  default:
1833  break;
1834  }
1835  // update network mode specific controls
1836  myViewNet->updateNetworkModeSpecificControls();
1837  }
1838 }
1839 
1840 
1841 void
1843  if ((mode == demandEditMode) && !force) {
1844  myViewNet->setStatusBarText("Demand mode already selected");
1845  if (myViewNet->myCurrentFrame != nullptr) {
1846  myViewNet->myCurrentFrame->focusUpperElement();
1847  }
1848  } else {
1849  myViewNet->setStatusBarText("");
1850  myViewNet->abortOperation(false);
1851  // stop editing of custom shapes
1852  myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
1853  // set new Demand mode
1854  demandEditMode = mode;
1855  // for common modes (Inspect/Delete/Select/Move) change also the other supermode
1856  if (demandEditMode == DemandEditMode::DEMAND_INSPECT) {
1857  networkEditMode = NetworkEditMode::NETWORK_INSPECT;
1858  dataEditMode = DataEditMode::DATA_INSPECT;
1859  } else if (demandEditMode == DemandEditMode::DEMAND_DELETE) {
1860  networkEditMode = NetworkEditMode::NETWORK_DELETE;
1861  dataEditMode = DataEditMode::DATA_DELETE;
1862  } else if (demandEditMode == DemandEditMode::DEMAND_SELECT) {
1863  networkEditMode = NetworkEditMode::NETWORK_SELECT;
1864  dataEditMode = DataEditMode::DATA_SELECT;
1865  } else if (demandEditMode == DemandEditMode::DEMAND_MOVE) {
1866  networkEditMode = NetworkEditMode::NETWORK_MOVE;
1867  }
1868  // demand modes require ALWAYS a recomputing
1869  myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
1870  // update DijkstraRouter of RouteCalculatorInstance
1871  myViewNet->myNet->getPathCalculator()->updatePathCalculator();
1872  // update network mode specific controls
1873  myViewNet->updateDemandModeSpecificControls();
1874  }
1875 }
1876 
1877 
1878 void
1880  if ((mode == dataEditMode) && !force) {
1881  myViewNet->setStatusBarText("Data mode already selected");
1882  if (myViewNet->myCurrentFrame != nullptr) {
1883  myViewNet->myCurrentFrame->focusUpperElement();
1884  }
1885  } else {
1886  myViewNet->setStatusBarText("");
1887  myViewNet->abortOperation(false);
1888  // stop editing of custom shapes
1889  myViewNet->myEditNetworkElementShapes.stopEditCustomShape();
1890  // set new Data mode
1891  dataEditMode = mode;
1892  // for common modes (Inspect/Delete/Select/Move) change also the other supermode
1893  if (dataEditMode == DataEditMode::DATA_INSPECT) {
1894  networkEditMode = NetworkEditMode::NETWORK_INSPECT;
1895  demandEditMode = DemandEditMode::DEMAND_INSPECT;
1896  } else if (dataEditMode == DataEditMode::DATA_DELETE) {
1897  networkEditMode = NetworkEditMode::NETWORK_DELETE;
1898  demandEditMode = DemandEditMode::DEMAND_DELETE;
1899  } else if (dataEditMode == DataEditMode::DATA_SELECT) {
1900  networkEditMode = NetworkEditMode::NETWORK_SELECT;
1901  demandEditMode = DemandEditMode::DEMAND_SELECT;
1902  }
1903  // data modes require ALWAYS a recomputing
1904  myViewNet->myNet->computeNetwork(myViewNet->myViewParent->getGNEAppWindows());
1905  // update DijkstraRouter of RouteCalculatorInstance
1906  myViewNet->myNet->getPathCalculator()->updatePathCalculator();
1907  // update all datasets
1908  for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
1909  dataSet.second->updateAttributeColors();
1910  }
1911  // update network mode specific controls
1912  myViewNet->updateDataModeSpecificControls();
1913  }
1914 }
1915 
1916 
1917 bool
1919  return (myCurrentSupermode == Supermode::NETWORK);
1920 }
1921 
1922 
1923 bool
1925  return (myCurrentSupermode == Supermode::DEMAND);
1926 }
1927 
1928 
1929 bool
1931  return (myCurrentSupermode == Supermode::DATA);
1932 }
1933 
1934 // ---------------------------------------------------------------------------
1935 // GNEViewNetHelper::NetworkViewOptions - methods
1936 // ---------------------------------------------------------------------------
1937 
1939  menuCheckShowGrid(nullptr),
1940  menuCheckDrawSpreadVehicles(nullptr),
1941  menuCheckShowDemandElements(nullptr),
1942  menuCheckSelectEdges(nullptr),
1943  menuCheckShowConnections(nullptr),
1944  menuCheckHideConnections(nullptr),
1945  menuCheckExtendSelection(nullptr),
1946  menuCheckChangeAllPhases(nullptr),
1947  menuCheckWarnAboutMerge(nullptr),
1948  menuCheckShowJunctionBubble(nullptr),
1949  menuCheckMoveElevation(nullptr),
1950  menuCheckChainEdges(nullptr),
1951  menuCheckAutoOppositeEdge(nullptr),
1952  myViewNet(viewNet) {
1953 }
1954 
1955 
1956 void
1958  // create menu checks
1959  menuCheckShowGrid = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
1960  ("\t\tShow grid and restrict movement to the grid - define grid size in visualization options (Ctrl+G)"),
1963  menuCheckShowGrid->setChecked(false);
1964  menuCheckShowGrid->create();
1965 
1966  menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
1967  ("\t\tDraw vehicles spread in lane or in depart position"),
1970  menuCheckDrawSpreadVehicles->setChecked(false);
1971  menuCheckDrawSpreadVehicles->create();
1972 
1973  menuCheckShowDemandElements = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
1974  ("\t\tToggle show demand elements"),
1977  menuCheckShowDemandElements->setChecked(false);
1978  menuCheckShowDemandElements->create();
1979 
1980  menuCheckSelectEdges = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
1981  ("\t\tToggle whether clicking should select edges or lanes"),
1984  menuCheckSelectEdges->setChecked(true);
1985  menuCheckSelectEdges->create();
1986 
1987  menuCheckShowConnections = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
1988  ("\t\tToggle show connections over junctions"),
1991  menuCheckShowConnections->setChecked(myViewNet->getVisualisationSettings().showLane2Lane);
1992  menuCheckShowConnections->create();
1993 
1994  menuCheckHideConnections = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
1995  ("\t\tHide connections"),
1998  menuCheckHideConnections->setChecked(false);
1999  menuCheckHideConnections->create();
2000 
2001  menuCheckExtendSelection = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2002  ("\t\tToggle whether selecting multiple edges should automatically select their junctions"),
2005  menuCheckExtendSelection->setChecked(false);
2006  menuCheckExtendSelection->create();
2007 
2008  menuCheckChangeAllPhases = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2009  ("\t\tToggle whether clicking should apply state changes to all phases of the current TLS plan"),
2012  menuCheckChangeAllPhases->setChecked(false);
2013  menuCheckChangeAllPhases->create();
2014 
2015  menuCheckWarnAboutMerge = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2016  ("\t\tAsk for confirmation before merging junction."),
2019  menuCheckWarnAboutMerge->setChecked(true);
2020  menuCheckWarnAboutMerge->create();
2021 
2022  menuCheckShowJunctionBubble = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2023  ("\t\tShow bubbles over junction's shapes."),
2026  menuCheckShowJunctionBubble->setChecked(false);
2027  menuCheckShowJunctionBubble->create();
2028 
2029  menuCheckMoveElevation = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2030  ("\t\tApply mouse movement to elevation instead of x,y position"),
2033  menuCheckMoveElevation->setChecked(false);
2034  menuCheckMoveElevation->create();
2035 
2036  menuCheckChainEdges = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2037  ("\t\tCreate consecutive edges with a single click (hit ESC to cancel chain)."),
2040  menuCheckChainEdges->setChecked(false);
2041  menuCheckChainEdges->create();
2042 
2043  menuCheckAutoOppositeEdge = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2044  ("\t\tAutomatically create an edge in the opposite direction"),
2047  menuCheckAutoOppositeEdge->setChecked(false);
2048  menuCheckAutoOppositeEdge->create();
2049 
2050  // always recalc after creating new elements
2051  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2052 }
2053 
2054 
2055 void
2057  menuCheckShowGrid->hide();
2058  menuCheckDrawSpreadVehicles->hide();
2059  menuCheckShowDemandElements->hide();
2060  menuCheckSelectEdges->hide();
2061  menuCheckShowConnections->hide();
2062  menuCheckHideConnections->hide();
2063  menuCheckExtendSelection->hide();
2064  menuCheckChangeAllPhases->hide();
2065  menuCheckWarnAboutMerge->hide();
2066  menuCheckShowJunctionBubble->hide();
2067  menuCheckMoveElevation->hide();
2068  menuCheckChainEdges->hide();
2069  menuCheckAutoOppositeEdge->hide();
2070  // Also hide toolbar grip
2071  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->show();
2072 }
2073 
2074 
2075 void
2076 GNEViewNetHelper::NetworkViewOptions::getVisibleNetworkMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2077  // save visible menu commands in commands vector
2078  if (menuCheckShowGrid->shown()) {
2079  commands.push_back(menuCheckShowGrid);
2080  }
2081  if (menuCheckDrawSpreadVehicles->shown()) {
2082  commands.push_back(menuCheckDrawSpreadVehicles);
2083  }
2084  if (menuCheckShowDemandElements->shown()) {
2085  commands.push_back(menuCheckShowDemandElements);
2086  }
2087  if (menuCheckSelectEdges->shown()) {
2088  commands.push_back(menuCheckSelectEdges);
2089  }
2090  if (menuCheckShowConnections->shown()) {
2091  commands.push_back(menuCheckShowConnections);
2092  }
2093  if (menuCheckHideConnections->shown()) {
2094  commands.push_back(menuCheckHideConnections);
2095  }
2096  if (menuCheckExtendSelection->shown()) {
2097  commands.push_back(menuCheckExtendSelection);
2098  }
2099  if (menuCheckChangeAllPhases->shown()) {
2100  commands.push_back(menuCheckChangeAllPhases);
2101  }
2102  if (menuCheckWarnAboutMerge->shown()) {
2103  commands.push_back(menuCheckWarnAboutMerge);
2104  }
2105  if (menuCheckShowJunctionBubble->shown()) {
2106  commands.push_back(menuCheckShowJunctionBubble);
2107  }
2108  if (menuCheckMoveElevation->shown()) {
2109  commands.push_back(menuCheckMoveElevation);
2110  }
2111  if (menuCheckChainEdges->shown()) {
2112  commands.push_back(menuCheckChainEdges);
2113  }
2114  if (menuCheckAutoOppositeEdge->shown()) {
2115  commands.push_back(menuCheckAutoOppositeEdge);
2116  }
2117 }
2118 
2119 
2120 bool
2122  return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
2123 }
2124 
2125 
2126 bool
2128  if (menuCheckShowDemandElements->shown()) {
2129  return (menuCheckShowDemandElements->amChecked() == TRUE);
2130  } else {
2131  // by default, if menuCheckShowDemandElements isn't shown, always show demand elements
2132  return true;
2133  }
2134 }
2135 
2136 
2137 bool
2139  if (menuCheckSelectEdges->shown()) {
2140  return (menuCheckSelectEdges->amChecked() == TRUE);
2141  } else {
2142  // by default, if menuCheckSelectEdges isn't shown, always select edges
2143  return true;
2144  }
2145 }
2146 
2147 
2148 bool
2150  if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_CONNECT) {
2151  // check if menu check hide connections ins shown
2152  return (menuCheckHideConnections->amChecked() == FALSE);
2153  } else if (myViewNet->myEditModes.networkEditMode == NetworkEditMode::NETWORK_PROHIBITION) {
2154  return true;
2155  } else if (menuCheckShowConnections->shown() == false) {
2156  return false;
2157  } else {
2158  return (myViewNet->getVisualisationSettings().showLane2Lane);
2159  }
2160 }
2161 
2162 
2163 bool
2165  if (menuCheckMoveElevation->shown()) {
2166  return (menuCheckMoveElevation->amChecked() == TRUE);
2167  } else {
2168  return false;
2169  }
2170 }
2171 
2172 // ---------------------------------------------------------------------------
2173 // GNEViewNetHelper::DemandViewOptions - methods
2174 // ---------------------------------------------------------------------------
2175 
2177  menuCheckShowGrid(nullptr),
2178  menuCheckDrawSpreadVehicles(nullptr),
2179  menuCheckHideShapes(nullptr),
2180  menuCheckHideNonInspectedDemandElements(nullptr),
2181  menuCheckShowAllPersonPlans(nullptr),
2182  menuCheckLockPerson(nullptr),
2183  myViewNet(viewNet),
2184  myLockedPerson(nullptr) {
2185 }
2186 
2187 
2188 void
2190  // create menu checks
2191  menuCheckShowGrid = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2192  ("\t\tShow grid and restrict movement to the grid - define grid size in visualization options (Ctrl+G)"),
2195  menuCheckShowGrid->setChecked(false);
2196  menuCheckShowGrid->create();
2197 
2198  menuCheckDrawSpreadVehicles = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2199  ("\t\tDraw vehicles spread in lane or in depart position"),
2202  menuCheckDrawSpreadVehicles->setChecked(false);
2203  menuCheckDrawSpreadVehicles->create();
2204 
2205  menuCheckHideShapes = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2206  ("\t\tToggle show shapes (Polygons and POIs)"),
2209  menuCheckHideShapes->setChecked(false);
2210  menuCheckHideShapes->create();
2211 
2212  menuCheckHideNonInspectedDemandElements = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2213  ("\t\tToggle show non-inspected demand elements"),
2216  menuCheckHideNonInspectedDemandElements->setChecked(false);
2217  menuCheckHideNonInspectedDemandElements->create();
2218 
2219  menuCheckShowAllPersonPlans = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2220  ("\t\tShow all person plans"),
2223  menuCheckShowAllPersonPlans->setChecked(false);
2224  menuCheckShowAllPersonPlans->create();
2225 
2226  menuCheckLockPerson = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2227  ("\t\tLock selected person"),
2230  menuCheckLockPerson->setChecked(false);
2231  menuCheckLockPerson->create();
2232 
2233  // always recalc after creating new elements
2234  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2235 }
2236 
2237 
2238 void
2240  menuCheckShowGrid->hide();
2241  menuCheckDrawSpreadVehicles->hide();
2242  menuCheckHideShapes->hide();
2243  menuCheckHideNonInspectedDemandElements->hide();
2244  menuCheckShowAllPersonPlans->hide();
2245  menuCheckLockPerson->hide();
2246  // Also hide toolbar grip
2247  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->show();
2248 }
2249 
2250 
2251 void
2252 GNEViewNetHelper::DemandViewOptions::getVisibleDemandMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2253  // save visible menu commands in commands vector
2254  if (menuCheckShowGrid->shown()) {
2255  commands.push_back(menuCheckShowGrid);
2256  }
2257  if (menuCheckDrawSpreadVehicles->shown()) {
2258  commands.push_back(menuCheckDrawSpreadVehicles);
2259  }
2260  if (menuCheckHideShapes->shown()) {
2261  commands.push_back(menuCheckHideShapes);
2262  }
2263  if (menuCheckHideNonInspectedDemandElements->shown()) {
2264  commands.push_back(menuCheckHideNonInspectedDemandElements);
2265  }
2266  if (menuCheckShowAllPersonPlans->shown() && menuCheckShowAllPersonPlans->isEnabled()) {
2267  commands.push_back(menuCheckShowAllPersonPlans);
2268  }
2269  if (menuCheckLockPerson->shown() && menuCheckLockPerson->isEnabled()) {
2270  commands.push_back(menuCheckLockPerson);
2271  }
2272 }
2273 
2274 
2275 bool
2277  return (menuCheckDrawSpreadVehicles->amChecked() == TRUE);
2278 }
2279 
2280 
2281 bool
2283  if (menuCheckHideNonInspectedDemandElements->shown()) {
2284  // check conditions
2285  if ((menuCheckHideNonInspectedDemandElements->amChecked() == FALSE) || (myViewNet->getInspectedAttributeCarriers().empty())) {
2286  // if checkbox is disabled or there isn't insepected element, then return true
2287  return true;
2288  } else if (myViewNet->getInspectedAttributeCarriers().front()->getTagProperty().isDemandElement()) {
2289  if (myViewNet->isAttributeCarrierInspected(demandElement)) {
2290  // if inspected element correspond to demandElement, return true
2291  return true;
2292  } else {
2293  // if demandElement is a route, check if dottedAC is one of their children (Vehicle or Stop)
2294  for (const auto& i : demandElement->getChildDemandElements()) {
2295  if (myViewNet->isAttributeCarrierInspected(i)) {
2296  return true;
2297  }
2298  }
2299  // if demandElement is a vehicle, check if dottedAC is one of his route Parent
2300  for (const auto& i : demandElement->getParentDemandElements()) {
2301  if (myViewNet->isAttributeCarrierInspected(i)) {
2302  return true;
2303  }
2304  }
2305  // dottedAC isn't one of their parent, then return false
2306  return false;
2307  }
2308  } else {
2309  // we're inspecting a demand element, then return true
2310  return true;
2311  }
2312  } else {
2313  // we're inspecting a demand element, then return true
2314  return true;
2315  }
2316 }
2317 
2318 
2319 bool
2321  if (menuCheckHideShapes->shown()) {
2322  return (menuCheckHideShapes->amChecked() == FALSE);
2323  } else {
2324  return true;
2325  }
2326 }
2327 
2328 
2329 bool
2331  if (menuCheckShowAllPersonPlans->shown() && menuCheckShowAllPersonPlans->isEnabled()) {
2332  return (menuCheckShowAllPersonPlans->amChecked() == TRUE);
2333  } else {
2334  return false;
2335  }
2336 }
2337 
2338 
2339 void
2341  myLockedPerson = person;
2342 }
2343 
2344 
2345 void
2347  myLockedPerson = nullptr;
2348 }
2349 
2350 
2351 const GNEDemandElement*
2353  return myLockedPerson;
2354 }
2355 
2356 // ---------------------------------------------------------------------------
2357 // GNEViewNetHelper::DataViewOptions - methods
2358 // ---------------------------------------------------------------------------
2359 
2361  menuCheckShowAdditionals(nullptr),
2362  menuCheckShowShapes(nullptr),
2363  menuCheckShowDemandElements(nullptr),
2364  myViewNet(viewNet) {
2365 }
2366 
2367 
2368 void
2370  // create menu checks
2371  menuCheckShowAdditionals = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2372  ("\t\tToggle show additionals"),
2375  menuCheckShowAdditionals->setChecked(false);
2376  menuCheckShowAdditionals->create();
2377 
2378  menuCheckShowShapes = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2379  ("\t\tToggle show shapes (Polygons and POIs)"),
2382  menuCheckShowShapes->setChecked(false);
2383  menuCheckShowShapes->create();
2384 
2385  menuCheckShowDemandElements = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2386  ("\t\tToggle show demand elements"),
2389  menuCheckShowDemandElements->setChecked(false);
2390  menuCheckShowDemandElements->create();
2391 
2392  // always recalc after creating new elements
2393  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2394 }
2395 
2396 
2397 void
2399  menuCheckShowAdditionals->hide();
2400  menuCheckShowShapes->hide();
2401  menuCheckShowDemandElements->hide();
2402  // Also hide toolbar grip
2403  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->show();
2404 }
2405 
2406 
2407 void
2408 GNEViewNetHelper::DataViewOptions::getVisibleDataMenuCommands(std::vector<MFXCheckableButton*>& commands) const {
2409  // save visible menu commands in commands vector
2410  if (menuCheckShowAdditionals->shown()) {
2411  commands.push_back(menuCheckShowAdditionals);
2412  }
2413  if (menuCheckShowShapes->shown()) {
2414  commands.push_back(menuCheckShowShapes);
2415  }
2416  if (menuCheckShowDemandElements->shown()) {
2417  commands.push_back(menuCheckShowDemandElements);
2418  }
2419 }
2420 
2421 
2422 bool
2424  if (menuCheckShowAdditionals->shown()) {
2425  return (menuCheckShowAdditionals->amChecked() == TRUE);
2426  } else {
2427  return true;
2428  }
2429 }
2430 
2431 
2432 bool
2434  if (menuCheckShowShapes->shown()) {
2435  return (menuCheckShowShapes->amChecked() == TRUE);
2436  } else {
2437  return true;
2438  }
2439 }
2440 
2441 
2442 bool
2444  if (menuCheckShowDemandElements->shown()) {
2445  return (menuCheckShowDemandElements->amChecked() == TRUE);
2446  } else {
2447  return true;
2448  }
2449 }
2450 
2451 // ---------------------------------------------------------------------------
2452 // GNEViewNetHelper::IntervalBar - methods
2453 // ---------------------------------------------------------------------------
2454 
2456  myViewNet(viewNet),
2457  myIntervalBarUpdate(true),
2458  myGenericDataTypesComboBox(nullptr),
2459  myDataSetsComboBox(nullptr),
2460  myLimitByIntervalCheckBox(nullptr),
2461  myBeginTextField(nullptr),
2462  myEndTextField(nullptr),
2463  myFilteredAttributesComboBox(nullptr),
2464  myNoGenericDatas("<no types>"),
2465  myAllGenericDatas("<all types>"),
2466  myNoDataSets("<no dataSets>"),
2467  myAllDataSets("<all dataSets>"),
2468  myAllAttributes("<all attributes>") {
2469 }
2470 
2471 
2472 void
2474  // create interval label
2475  FXLabel* genericDataLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2476  "Data type", 0, GUIDesignLabelAttribute);
2477  genericDataLabel->create();
2478  // create combo box for generic datas
2479  myGenericDataTypesComboBox = new FXComboBox(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2481  myGenericDataTypesComboBox->create();
2482  FXLabel* dataSetLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2483  "Data sets", 0, GUIDesignLabelAttribute);
2484  dataSetLabel->create();
2485  // create combo box for sets
2486  myDataSetsComboBox = new FXComboBox(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2488  myDataSetsComboBox->create();
2489  // create checkbutton for myLimitByInterval
2490  myLimitByIntervalCheckBox = new FXCheckButton(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2492  myLimitByIntervalCheckBox->create();
2493  // create textfield for begin
2494  myBeginTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2496  myBeginTextField->create();
2497  // create text field for end
2498  myEndTextField = new FXTextField(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2500  myEndTextField->create();
2501  // create attribute label
2502  FXLabel* attributeLabel = new FXLabel(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2503  "Attribute", 0, GUIDesignLabelAttribute);
2504  attributeLabel->create();
2505  // create combo box for attributes
2506  myFilteredAttributesComboBox = new FXComboBox(myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar,
2508  myFilteredAttributesComboBox->create();
2509  // always recalc after creating new elements
2510  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->recalc();
2511 }
2512 
2513 
2514 void
2516  // enable elements
2517  myGenericDataTypesComboBox->enable();
2518  myDataSetsComboBox->enable();
2519  myLimitByIntervalCheckBox->enable();
2520  if (myLimitByIntervalCheckBox->getCheck() == TRUE) {
2521  myBeginTextField->enable();
2522  myEndTextField->enable();
2523  } else {
2524  myBeginTextField->disable();
2525  myEndTextField->disable();
2526  }
2527  myFilteredAttributesComboBox->enable();
2528 }
2529 
2530 
2531 void
2533  // disable all elements
2534  myGenericDataTypesComboBox->disable();
2535  myDataSetsComboBox->disable();
2536  myLimitByIntervalCheckBox->disable();
2537  myBeginTextField->disable();
2538  myEndTextField->disable();
2539  myFilteredAttributesComboBox->disable();
2540 }
2541 
2542 
2543 void
2545  myIntervalBarUpdate = true;
2546  // now update interval bar
2547  updateIntervalBar();
2548 }
2549 
2550 
2551 void
2553  myIntervalBarUpdate = false;
2554 }
2555 
2556 
2557 void
2559  // check if begin and end textFields has to be updated (only once)
2560  if (myBeginTextField->getText().empty()) {
2561  setBegin();
2562  }
2563  if (myEndTextField->getText().empty()) {
2564  setEnd();
2565  }
2566  // first update interval bar
2567  updateIntervalBar();
2568  // show toolbar grip
2569  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->show();
2570 }
2571 
2572 
2573 void
2575  // hide toolbar grip
2576  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().intervalBar->hide();
2577 }
2578 
2579 
2580 void
2582  if (myIntervalBarUpdate) {
2583  // first save current data set
2584  const std::string previousDataSet = myDataSetsComboBox->getNumItems() > 0 ? myDataSetsComboBox->getItem(myDataSetsComboBox->getCurrentItem()).text() : "";
2585  // first clear items
2586  myDataSetsComboBox->clearItems();
2587  myGenericDataTypesComboBox->clearItems();
2588  if (myViewNet->getNet()) {
2589  // retrieve data sets
2590  const auto dataSets = myViewNet->getNet()->retrieveDataSets();
2591  if (dataSets.empty()) {
2592  myGenericDataTypesComboBox->appendItem(myNoGenericDatas);
2593  myDataSetsComboBox->appendItem(myNoDataSets);
2594  // disable elements
2595  disableIntervalBar();
2596  } else {
2597  // declare integer to save previous data set index
2598  int previousDataSetIndex = 0;
2599  // enable elements
2600  enableIntervalBar();
2601  // add "<all>" item
2602  myGenericDataTypesComboBox->appendItem(myAllGenericDatas);
2603  myDataSetsComboBox->appendItem(myAllDataSets);
2604  // get all generic data types
2606  // add all generic data types
2607  for (const auto& dataTag : genericDataTags) {
2608  myGenericDataTypesComboBox->appendItem(dataTag.second.c_str());
2609  }
2610  myGenericDataTypesComboBox->setNumVisible(myGenericDataTypesComboBox->getNumItems());
2611  // add data sets
2612  for (const auto& dataSet : dataSets) {
2613  // check if current data set is the previous data set
2614  if (dataSet->getID() == previousDataSet) {
2615  previousDataSetIndex = myDataSetsComboBox->getNumItems();
2616  }
2617  myDataSetsComboBox->appendItem(dataSet->getID().c_str());
2618  }
2619  // set visible elements
2620  if (myDataSetsComboBox->getNumItems() < 10) {
2621  myDataSetsComboBox->setNumVisible(myDataSetsComboBox->getNumItems());
2622  } else {
2623  myDataSetsComboBox->setNumVisible(10);
2624  }
2625  // set current data set
2626  myDataSetsComboBox->setCurrentItem(previousDataSetIndex);
2627  }
2628  // update limit by interval
2629  setInterval();
2630  }
2631  }
2632 }
2633 
2634 
2635 std::string
2637  if (myGenericDataTypesComboBox->isEnabled() && (myGenericDataTypesComboBox->getText() == myAllGenericDatas)) {
2638  return "";
2639  } else {
2640  return myGenericDataTypesComboBox->getText().text();
2641  }
2642 }
2643 
2644 
2645 std::string
2647  if (myDataSetsComboBox->isEnabled() && (myDataSetsComboBox->getText() == myAllDataSets)) {
2648  return "";
2649  } else {
2650  return myDataSetsComboBox->getText().text();
2651  }
2652 }
2653 
2654 
2655 std::string
2657  if (myBeginTextField->isEnabled() && GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
2658  return myBeginTextField->getText().text();
2659  } else {
2660  return "";
2661  }
2662 }
2663 
2664 
2665 std::string
2667  if (myEndTextField->isEnabled() && GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
2668  return myEndTextField->getText().text();
2669  } else {
2670  return "";
2671  }
2672 }
2673 
2674 
2675 std::string
2677  if (myFilteredAttributesComboBox->isEnabled() &&
2678  ((myFilteredAttributesComboBox->getText() == myAllAttributes) || (myFilteredAttributesComboBox->getTextColor() != FXRGB(0, 0, 0)))) {
2679  return "";
2680  } else {
2681  return myFilteredAttributesComboBox->getText().text();
2682  }
2683 }
2684 
2685 
2686 void
2688  // check if data set is correct
2689  if (myGenericDataTypesComboBox->getText() == myAllGenericDatas) {
2690  myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
2691  } else if (myGenericDataTypesComboBox->getText().empty()) {
2692  myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
2693  myGenericDataTypesComboBox->setText(myAllGenericDatas);
2694  } else {
2695  // get all generic data types
2697  // set invalid color
2698  myGenericDataTypesComboBox->setTextColor(FXRGB(255, 0, 0));
2699  // set valid color depending of myGenericDataTypesComboBox
2700  for (const auto& genericDataTag : genericDataTags) {
2701  if (genericDataTag.second == myGenericDataTypesComboBox->getText().text()) {
2702  myGenericDataTypesComboBox->setTextColor(FXRGB(0, 0, 0));
2703  }
2704  }
2705  }
2706  // update comboBox attributes
2707  updateComboBoxAttributes();
2708  // update view net
2709  myViewNet->updateViewNet();
2710 }
2711 
2712 
2713 void
2715  // check if data set is correct
2716  if (myDataSetsComboBox->getText() == myAllDataSets) {
2717  myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
2718  } else if (myDataSetsComboBox->getText().empty()) {
2719  myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
2720  myDataSetsComboBox->setText(myAllDataSets);
2721  } else if (myViewNet->getNet()->retrieveDataSet(myDataSetsComboBox->getText().text(), false)) {
2722  myDataSetsComboBox->setTextColor(FXRGB(0, 0, 0));
2723  } else {
2724  myDataSetsComboBox->setTextColor(FXRGB(255, 0, 0));
2725  }
2726  // update comboBox attributes
2727  updateComboBoxAttributes();
2728  // update view net
2729  myViewNet->updateViewNet();
2730 }
2731 
2732 
2733 void
2735  // enable or disable text fields
2736  if (myLimitByIntervalCheckBox->isEnabled() && (myLimitByIntervalCheckBox->getCheck() == TRUE)) {
2737  myBeginTextField->enable();
2738  myEndTextField->enable();
2739  } else {
2740  myBeginTextField->disable();
2741  myEndTextField->disable();
2742  }
2743  // update comboBox attributes
2744  updateComboBoxAttributes();
2745  // update view net
2746  myViewNet->updateViewNet();
2747 }
2748 
2749 
2750 void
2752  if (myBeginTextField->getText().empty()) {
2753  myBeginTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMinimumBegin()).c_str());
2754  myBeginTextField->setTextColor(FXRGB(0, 0, 0));
2755  } else if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text())) {
2756  myBeginTextField->setTextColor(FXRGB(0, 0, 0));
2757  } else {
2758  myBeginTextField->setTextColor(FXRGB(255, 0, 0));
2759  }
2760  // update comboBox attributes
2761  updateComboBoxAttributes();
2762  // update view net
2763  myViewNet->updateViewNet();
2764 }
2765 
2766 
2767 void
2769  if (myEndTextField->getText().empty()) {
2770  myEndTextField->setText(toString(myViewNet->getNet()->getDataSetIntervalMaximumEnd()).c_str());
2771  myEndTextField->setTextColor(FXRGB(0, 0, 0));
2772  } else if (GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text())) {
2773  myEndTextField->setTextColor(FXRGB(0, 0, 0));
2774  } else {
2775  myEndTextField->setTextColor(FXRGB(255, 0, 0));
2776  }
2777  // update comboBox attributes
2778  updateComboBoxAttributes();
2779  // update view net
2780  myViewNet->updateViewNet();
2781 }
2782 
2783 
2784 void
2786  //
2787 }
2788 
2789 
2790 void
2792  // update attributes
2793  myFilteredAttributes = myViewNet->getNet()->retrieveGenericDataParameters(getDataSetStr(),
2794  getGenericDataTypeStr(), getBeginStr(), getEndStr());
2795  // clear combo box
2796  myFilteredAttributesComboBox->clearItems();
2797  // check if there is dataSets
2798  if (myDataSetsComboBox->isEnabled()) {
2799  // add wildcard for all attributes
2800  myFilteredAttributesComboBox->appendItem(myAllAttributes);
2801  // add all atributes in ComboBox
2802  for (const auto& attribute : myFilteredAttributes) {
2803  myFilteredAttributesComboBox->appendItem(attribute.c_str());
2804  }
2805  // set visible elements
2806  if (myFilteredAttributesComboBox->getNumItems() < 10) {
2807  myFilteredAttributesComboBox->setNumVisible(myFilteredAttributesComboBox->getNumItems());
2808  } else {
2809  myFilteredAttributesComboBox->setNumVisible(10);
2810  }
2811  } else {
2812  // add wildcard for all attributes
2813  myFilteredAttributesComboBox->appendItem(myNoDataSets);
2814  }
2815 }
2816 
2817 // ---------------------------------------------------------------------------
2818 // GNEViewNetHelper::CommonCheckableButtons - methods
2819 // ---------------------------------------------------------------------------
2820 
2822  inspectButton(nullptr),
2823  deleteButton(nullptr),
2824  selectButton(nullptr),
2825  myViewNet(viewNet) {
2826 }
2827 
2828 
2829 void
2831  // inspect button
2832  inspectButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2833  "\tset inspect mode\tMode for inspect elements and change their attributes. (I)",
2835  inspectButton->create();
2836  // delete button
2837  deleteButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2838  "\tset delete mode\tMode for delete elements. (D)",
2840  deleteButton->create();
2841  // select button
2842  selectButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2843  "\tset select mode\tMode for select elements. (S)",
2845  selectButton->create();
2846  // always recalc menu bar after creating new elements
2847  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2848 }
2849 
2850 
2851 void
2853  inspectButton->show();
2854  deleteButton->show();
2855  selectButton->show();
2856 }
2857 
2858 
2859 void
2861  inspectButton->hide();
2862  deleteButton->hide();
2863  selectButton->hide();
2864 }
2865 
2866 
2867 void
2869  inspectButton->setChecked(false);
2870  deleteButton->setChecked(false);
2871  selectButton->setChecked(false);
2872 }
2873 
2874 
2875 void
2877  inspectButton->update();
2878  deleteButton->update();
2879  selectButton->update();
2880 }
2881 
2882 // ---------------------------------------------------------------------------
2883 // GNEViewNetHelper::NetworkCheckableButtons - methods
2884 // ---------------------------------------------------------------------------
2885 
2887  moveNetworkElementsButton(nullptr),
2888  createEdgeButton(nullptr),
2889  connectionButton(nullptr),
2890  trafficLightButton(nullptr),
2891  additionalButton(nullptr),
2892  crossingButton(nullptr),
2893  TAZButton(nullptr),
2894  shapeButton(nullptr),
2895  prohibitionButton(nullptr),
2896  myViewNet(viewNet) {
2897 }
2898 
2899 
2900 void
2902  // move button
2903  moveNetworkElementsButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2904  "\tset move mode\tMode for move elements. (M)",
2906  moveNetworkElementsButton->create();
2907  // create edge
2908  createEdgeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2909  "\tset create edge mode\tMode for creating junction and edges. (E)",
2911  createEdgeButton->create();
2912  // connection mode
2913  connectionButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2914  "\tset connection mode\tMode for edit connections between lanes. (C)",
2916  connectionButton->create();
2917  // prohibition mode
2918  prohibitionButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2919  "\tset prohibition mode\tMode for editing connection prohibitions. (W)",
2921  prohibitionButton->create();
2922  // traffic light mode
2923  trafficLightButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2924  "\tset traffic light mode\tMode for edit traffic lights over junctions. (T)",
2926  trafficLightButton->create();
2927  // additional mode
2928  additionalButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2929  "\tset additional mode\tMode for adding additional elements. (A)",
2931  additionalButton->create();
2932  // crossing mode
2933  crossingButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2934  "\tset crossing mode\tMode for creating crossings between edges. (R)",
2936  crossingButton->create();
2937  // TAZ Mode
2938  TAZButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2939  "\tset TAZ mode\tMode for creating Traffic Assignment Zones. (Z)",
2941  TAZButton->create();
2942  // shape mode
2943  shapeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
2944  "\tset polygon mode\tMode for creating polygons and POIs. (P)",
2946  shapeButton->create();
2947  // always recalc after creating new elements
2948  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
2949 }
2950 
2951 
2952 void
2954  moveNetworkElementsButton->show();
2955  createEdgeButton->show();
2956  connectionButton->show();
2957  trafficLightButton->show();
2958  additionalButton->show();
2959  crossingButton->show();
2960  TAZButton->show();
2961  shapeButton->show();
2962  prohibitionButton->show();
2963 }
2964 
2965 
2966 void
2968  moveNetworkElementsButton->hide();
2969  createEdgeButton->hide();
2970  connectionButton->hide();
2971  trafficLightButton->hide();
2972  additionalButton->hide();
2973  crossingButton->hide();
2974  TAZButton->hide();
2975  shapeButton->hide();
2976  prohibitionButton->hide();
2977 }
2978 
2979 
2980 void
2982  moveNetworkElementsButton->setChecked(false);
2983  createEdgeButton->setChecked(false);
2984  connectionButton->setChecked(false);
2985  trafficLightButton->setChecked(false);
2986  additionalButton->setChecked(false);
2987  crossingButton->setChecked(false);
2988  TAZButton->setChecked(false);
2989  shapeButton->setChecked(false);
2990  prohibitionButton->setChecked(false);
2991 }
2992 
2993 
2994 void
2996  moveNetworkElementsButton->update();
2997  createEdgeButton->update();
2998  connectionButton->update();
2999  trafficLightButton->update();
3000  additionalButton->update();
3001  crossingButton->update();
3002  TAZButton->update();
3003  shapeButton->update();
3004  prohibitionButton->update();
3005 }
3006 
3007 // ---------------------------------------------------------------------------
3008 // GNEViewNetHelper::DemandCheckableButtons - methods
3009 // ---------------------------------------------------------------------------
3010 
3012  moveDemandElementsButton(nullptr),
3013  routeButton(nullptr),
3014  vehicleButton(nullptr),
3015  vehicleTypeButton(nullptr),
3016  stopButton(nullptr),
3017  personTypeButton(nullptr),
3018  personButton(nullptr),
3019  personPlanButton(nullptr),
3020  myViewNet(viewNet) {
3021 }
3022 
3023 
3024 void
3026  // move button
3027  moveDemandElementsButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3028  "\tset move mode\tMode for move elements.",
3030  moveDemandElementsButton->create();
3031  // route mode
3032  routeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3033  "\tcreate route mode\tMode for creating routes.",
3035  routeButton->create();
3036  // vehicle mode
3037  vehicleButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3038  "\tcreate vehicle mode\tMode for creating vehicles.",
3040  vehicleButton->create();
3041  // vehicle type mode
3042  vehicleTypeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3043  "\tcreate vehicle type mode\tMode for creating vehicle types.",
3045  vehicleTypeButton->create();
3046  // stop mode
3047  stopButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3048  "\tcreate stop mode\tMode for creating stops.",
3050  stopButton->create();
3051  // person type mode
3052  personTypeButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3053  "\tcreate person type mode\tMode for creating person types.",
3055  personTypeButton->create();
3056  // person mode
3057  personButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3058  "\tcreate person mode\tMode for creating persons.",
3060  personButton->create();
3061  // person plan mode
3062  personPlanButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3063  "\tcreate person plan mode\tMode for creating person plans.",
3065  personPlanButton->create();
3066  // always recalc after creating new elements
3067  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
3068 }
3069 
3070 
3071 void
3073  moveDemandElementsButton->show();
3074  routeButton->show();
3075  vehicleButton->show();
3076  vehicleTypeButton->show();
3077  stopButton->show();
3078  personTypeButton->show();
3079  personButton->show();
3080  personPlanButton->show();
3081 }
3082 
3083 
3084 void
3086  moveDemandElementsButton->hide();
3087  routeButton->hide();
3088  vehicleButton->hide();
3089  vehicleTypeButton->hide();
3090  stopButton->hide();
3091  personTypeButton->hide();
3092  personButton->hide();
3093  personPlanButton->hide();
3094 }
3095 
3096 
3097 void
3099  moveDemandElementsButton->setChecked(false);
3100  routeButton->setChecked(false);
3101  vehicleButton->setChecked(false);
3102  vehicleTypeButton->setChecked(false);
3103  stopButton->setChecked(false);
3104  personTypeButton->setChecked(false);
3105  personButton->setChecked(false);
3106  personPlanButton->setChecked(false);
3107 }
3108 
3109 
3110 void
3112  moveDemandElementsButton->update();
3113  routeButton->update();
3114  vehicleButton->update();
3115  vehicleTypeButton->update();
3116  stopButton->update();
3117  personTypeButton->update();
3118  personButton->update();
3119  personPlanButton->update();
3120 }
3121 
3122 // ---------------------------------------------------------------------------
3123 // GNEViewNetHelper::DataCheckableButtons - methods
3124 // ---------------------------------------------------------------------------
3125 
3127  edgeDataButton(nullptr),
3128  edgeRelDataButton(nullptr),
3129  TAZRelDataButton(nullptr),
3130  myViewNet(viewNet) {
3131 }
3132 
3133 
3134 void
3136  // edgeData mode
3137  edgeDataButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3138  "\tcreate edge data mode\tMode for creating edge datas.",
3140  edgeDataButton->create();
3141  // edgeRelData mode
3142  edgeRelDataButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3143  "\tcreate edge relation data mode\tMode for creating edge relation datas.",
3145  edgeRelDataButton->create();
3146  // TAZRelData mode
3147  TAZRelDataButton = new MFXCheckableButton(false, myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes,
3148  "\tcreate TAZ relation data mode\tMode for creating TAZ relation datas.",
3150 
3151  TAZRelDataButton->create();
3152  // always recalc after creating new elements
3153  myViewNet->myViewParent->getGNEAppWindows()->getToolbarsGrip().modes->recalc();
3154 }
3155 
3156 
3157 void
3159  edgeDataButton->show();
3160  edgeRelDataButton->show();
3161  TAZRelDataButton->show();
3162 }
3163 
3164 
3165 void
3167  edgeDataButton->hide();
3168  edgeRelDataButton->hide();
3169  TAZRelDataButton->hide();
3170 }
3171 
3172 
3173 void
3175  edgeDataButton->setChecked(false);
3176  edgeRelDataButton->setChecked(false);
3177  TAZRelDataButton->setChecked(false);
3178 }
3179 
3180 
3181 void
3183  edgeDataButton->update();
3184  edgeRelDataButton->update();
3185  TAZRelDataButton->update();
3186 }
3187 
3188 // ---------------------------------------------------------------------------
3189 // GNEViewNetHelper::EditNetworkElementShapes - methods
3190 // ---------------------------------------------------------------------------
3191 
3193  myViewNet(viewNet),
3194  myEditedNetworkElement(nullptr),
3195  myPreviousNetworkEditMode(NetworkEditMode::NETWORK_NONE) {
3196 }
3197 
3198 
3199 void
3201  if (element && (myEditedNetworkElement == nullptr)) {
3202  // save current edit mode before starting
3203  myPreviousNetworkEditMode = myViewNet->myEditModes.networkEditMode;
3204  // set move mode
3205  myViewNet->myEditModes.setNetworkEditMode(NetworkEditMode::NETWORK_MOVE);
3206  //set editedNetworkElement
3207  myEditedNetworkElement = element;
3208  // enable shape edited flag
3209  myEditedNetworkElement->setShapeEdited(true);
3210  // update view net to show the new editedShapePoly
3211  myViewNet->updateViewNet();
3212  }
3213 }
3214 
3215 
3216 void
3218  // stop edit shape junction deleting editedShapePoly
3219  if (myEditedNetworkElement != nullptr) {
3220  // disable shape edited flag
3221  myEditedNetworkElement->setShapeEdited(false);
3222  // reset editedNetworkElement
3223  myEditedNetworkElement = nullptr;
3224  // restore previous edit mode
3225  if (myViewNet->myEditModes.networkEditMode != myPreviousNetworkEditMode) {
3226  myViewNet->myEditModes.setNetworkEditMode(myPreviousNetworkEditMode);
3227  }
3228  }
3229 }
3230 
3231 
3232 void
3234  // save edited junction's shape
3235  if (myEditedNetworkElement != nullptr) {
3236 
3237  /* */
3238 
3239  // stop edit custom shape
3240  stopEditCustomShape();
3241  }
3242 }
3243 
3244 
3247  return myEditedNetworkElement;
3248 }
3249 
3250 // ---------------------------------------------------------------------------
3251 // GNEViewNetHelper::BlockIcon - methods
3252 // ---------------------------------------------------------------------------
3253 
3254 void
3256  const double exaggeration, const double offsetx, const double offsety, const bool overlane, const double size) {
3257  // first check if icon can be drawn
3258  if (checkDrawing(AC, exaggeration) && (geometry.getShape().size() > 0)) {
3259  // calculate middle point
3260  const double middlePoint = (geometry.getShape().length2D() * 0.5);
3261  // calculate position
3262  const Position pos = (geometry.getShape().size() == 1) ? geometry.getShape().front() : geometry.getShape().positionAtOffset2D(middlePoint);
3263  // calculate rotation
3264  double rot = 0;
3265  if ((geometry.getShape().size() == 1) && (geometry.getShapeRotations().size() > 0)) {
3266  rot = geometry.getShapeRotations().front();
3267  } else if (geometry.getShape().size() > 1) {
3268  rot = geometry.getShape().rotationDegreeAtOffset(middlePoint);
3269  }
3270  // get texture
3271  const GUIGlID lockTexture = getLockIcon(AC);
3272  // Start pushing matrix
3273  glPushMatrix();
3274  // Traslate to position
3275  glTranslated(pos.x(), pos.y(), 0.1);
3276  // rotate depending of overlane
3277  if (overlane) {
3279  } else {
3280  // avoid draw invert
3281  glRotated(180, 0, 0, 1);
3282  }
3283  // Set draw color
3284  glColor3d(1, 1, 1);
3285  // Traslate depending of the offset
3286  glTranslated(offsetx, offsety, 0);
3287  // Draw lock icon
3288  GUITexturesHelper::drawTexturedBox(lockTexture, size);
3289  // Pop matrix
3290  glPopMatrix();
3291  }
3292 }
3293 
3294 
3296 
3297 
3298 bool
3299 GNEViewNetHelper::LockIcon::checkDrawing(const GNEAttributeCarrier* AC, const double exaggeration) {
3300  // get visualization settings
3301  const auto s = AC->getNet()->getViewNet()->getVisualisationSettings();
3302  // check exaggeration
3303  if (exaggeration == 0) {
3304  return false;
3305  }
3306  // check visualizationSettings
3307  if (s.drawForPositionSelection || s.drawForRectangleSelection) {
3308  return false;
3309  }
3310  // check detail
3311  if (!s.drawDetail(s.detailSettings.lockIcon, exaggeration)) {
3312  return false;
3313  }
3314  // check modes
3315  if (!AC->getNet()->getViewNet()->showLockIcon()) {
3316  return false;
3317  }
3318  return true;
3319 }
3320 
3321 
3322 GUIGlID
3324  // Draw icon depending of the state of additional
3325  if (AC->drawUsingSelectColor()) {
3326  if (!AC->getTagProperty().canBlockMovement()) {
3327  // Draw not movable texture if additional isn't movable and is selected
3329  } else if (AC->getAttribute(GNE_ATTR_BLOCK_MOVEMENT) == toString(true)) {
3330  // Draw lock texture if additional is movable, is blocked and is selected
3332  } else {
3333  // Draw empty texture if additional is movable, isn't blocked and is selected
3335  }
3336  } else {
3337  if (!AC->getTagProperty().canBlockMovement()) {
3338  // Draw not movable texture if additional isn't movable
3340  } else if (AC->getAttribute(GNE_ATTR_BLOCK_MOVEMENT) == toString(true)) {
3341  // Draw lock texture if additional is movable and is blocked
3343  } else {
3344  // Draw empty texture if additional is movable and isn't blocked
3346  }
3347  }
3348 }
3349 
3350 // ---------------------------------------------------------------------------
3351 // GNEViewNetHelper - methods
3352 // ---------------------------------------------------------------------------
3353 
3354 const std::vector<RGBColor>&
3356  // if is empty, fill it
3357  if (myRainbowScaledColors.empty()) {
3358  // fill scale colors (10)
3359  myRainbowScaledColors.push_back(RGBColor(232, 35, 0, 255));
3360  myRainbowScaledColors.push_back(RGBColor(255, 165, 0, 255));
3361  myRainbowScaledColors.push_back(RGBColor(255, 255, 0, 255));
3362  myRainbowScaledColors.push_back(RGBColor(28, 215, 0, 255));
3363  myRainbowScaledColors.push_back(RGBColor(0, 181, 100, 255));
3364  myRainbowScaledColors.push_back(RGBColor(0, 255, 191, 255));
3365  myRainbowScaledColors.push_back(RGBColor(178, 255, 255, 255));
3366  myRainbowScaledColors.push_back(RGBColor(0, 112, 184, 255));
3367  myRainbowScaledColors.push_back(RGBColor(56, 41, 131, 255));
3368  myRainbowScaledColors.push_back(RGBColor(127, 0, 255, 255));
3369  }
3370  return myRainbowScaledColors;
3371 }
3372 
3373 
3374 const RGBColor&
3375 GNEViewNetHelper::getRainbowScaledColor(const double min, const double max, const double value) {
3376  // check extremes
3377  if (value <= min) {
3378  return getRainbowScaledColors().front();
3379  } else if (value >= max) {
3380  return getRainbowScaledColors().back();
3381  } else {
3382  // calculate value procent between [min, max]
3383  const double procent = ((value - min) * 100) / (max - min);
3384  // check if is valid
3385  if (procent <= 0) {
3386  return getRainbowScaledColors().front();
3387  } else if (procent >= 100) {
3388  return getRainbowScaledColors().back();
3389  } else {
3390  // return scaled color
3391  return getRainbowScaledColors().at((int)(procent / 10.0));
3392  }
3393  }
3394 }
3395 
3396 /****************************************************************************/
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_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:656
@ MID_HOTKEY_CTRL_SHIFT_B_SAVEDATAELEMENTS
save Data Elements
Definition: GUIAppEnum.h:155
@ MID_HOTKEY_F3_SUPERMODE_DEMAND
select demand supermode in NETEDIT
Definition: GUIAppEnum.h:181
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWALLPERSONPLANS
show all person plans
Definition: GUIAppEnum.h:672
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWGRID
show grid
Definition: GUIAppEnum.h:632
@ MID_HOTKEY_T_MODES_TLS_VTYPE
hotkey for mode editing TLS AND Vehicle Types
Definition: GUIAppEnum.h:61
@ MID_GNE_NETWORKVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition: GUIAppEnum.h:634
@ MID_GNE_NETWORKVIEWOPTIONS_MOVEELEVATION
move elevation instead of x,y
Definition: GUIAppEnum.h:652
@ MID_HOTKEY_S_MODES_SELECT
hotkey for mode selecting objects
Definition: GUIAppEnum.h:57
@ MID_GNE_NETWORKVIEWOPTIONS_HIDECONNECTIONS
hide connections
Definition: GUIAppEnum.h:642
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWCONNECTIONS
show connections
Definition: GUIAppEnum.h:640
@ MID_GNE_INTERVALBAR_BEGIN
begin changed in InterbalBar
Definition: GUIAppEnum.h:700
@ MID_GNE_DEMANDVIEWOPTIONS_LOCKPERSON
lock person
Definition: GUIAppEnum.h:674
@ MID_HOTKEY_V_MODES_VEHICLE
hotkey for mode create vehicles
Definition: GUIAppEnum.h:63
@ 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:704
@ MID_GNE_NETWORKVIEWOPTIONS_ASKFORMERGE
ask before merging junctions
Definition: GUIAppEnum.h:648
@ MID_GNE_DEMANDVIEWOPTIONS_SHOWGRID
show grid
Definition: GUIAppEnum.h:664
@ MID_HOTKEY_CTRL_SHIFT_D_SAVEDEMANDELEMENTS
Save Demand Elements.
Definition: GUIAppEnum.h:157
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in NETEDIT.
Definition: GUIAppEnum.h:101
@ MID_HOTKEY_W_MODES_PROHIBITION_PERSONTYPE
hotkey for mode editing connection prohibitions AND person types
Definition: GUIAppEnum.h:65
@ MID_GNE_NETWORKVIEWOPTIONS_CHAINEDGES
create edges in chain mode
Definition: GUIAppEnum.h:654
@ MID_HOTKEY_R_MODES_CROSSING_ROUTE_EDGERELDATA
hotkey for mode editing crossing, routes and edge rel datas
Definition: GUIAppEnum.h:59
@ MID_GNE_DATAVIEWOPTIONS_SHOWDEMANDELEMENTS
show demand elements
Definition: GUIAppEnum.h:686
@ MID_HOTKEY_I_MODES_INSPECT
hotkey for mode inspecting object attributes
Definition: GUIAppEnum.h:51
@ MID_GNE_DEMANDVIEWOPTIONS_HIDESHAPES
hide shapes
Definition: GUIAppEnum.h:670
@ MID_HOTKEY_P_MODES_POLYGON_PERSON
hotkey for mode creating polygons
Definition: GUIAppEnum.h:55
@ MID_GNE_DATAVIEWOPTIONS_SHOWADDITIONALS
show additionals
Definition: GUIAppEnum.h:682
@ MID_GNE_NETWORKVIEWOPTIONS_SHOWBUBBLES
show junctions as bubbles
Definition: GUIAppEnum.h:650
@ MID_GNE_INTERVALBAR_END
end changed in InterbalBar
Definition: GUIAppEnum.h:702
@ MID_HOTKEY_Z_MODES_TAZ_TAZREL
hotkey for mode editing TAZ and TAZRel
Definition: GUIAppEnum.h:67
@ MID_HOTKEY_M_MODES_MOVE
hotkey for mode moving element
Definition: GUIAppEnum.h:53
@ MID_GNE_NETWORKVIEWOPTIONS_EXTENDSELECTION
extend selection
Definition: GUIAppEnum.h:644
@ MID_HOTKEY_F4_SUPERMODE_DATA
select data supermode in NETEDIT
Definition: GUIAppEnum.h:183
@ 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:636
@ MID_GNE_DEMANDVIEWOPTIONS_HIDENONINSPECTED
hide non-inspected demand element
Definition: GUIAppEnum.h:668
@ 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:151
@ MID_GNE_INTERVALBAR_GENERICDATATYPE
generic data selected
Definition: GUIAppEnum.h:694
@ MID_GNE_NETWORKVIEWOPTIONS_CHANGEALLPHASES
change all phases
Definition: GUIAppEnum.h:646
@ MID_GNE_DATAVIEWOPTIONS_SHOWSHAPES
show shapes
Definition: GUIAppEnum.h:684
@ MID_GNE_DEMANDVIEWOPTIONS_DRAWSPREADVEHICLES
Draw vehicles in begin position or spread in lane.
Definition: GUIAppEnum.h:666
@ MID_GNE_INTERVALBAR_DATASET
data set selected
Definition: GUIAppEnum.h:696
@ MID_HOTKEY_F2_SUPERMODE_NETWORK
select network supermode in NETEDIT
Definition: GUIAppEnum.h:179
@ MID_HOTKEY_D_MODES_DELETE
hotkey for mode deleting things
Definition: GUIAppEnum.h:47
@ MID_GNE_NETWORKVIEWOPTIONS_SELECTEDGES
select edges
Definition: GUIAppEnum.h:638
@ MID_GNE_INTERVALBAR_LIMITED
enable/disable show data elements by interval
Definition: GUIAppEnum.h:698
#define GUIDesignMFXCheckableButton
Definition: GUIDesigns.h:105
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180 (Used in GNEVehicleType)
Definition: GUIDesigns.h:249
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:255
#define GUIDesignLabelAttribute
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:199
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:91
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:54
#define GUIDesignTextFielWidth50Real
text field with thick frame and width 50 and limited to doubles
Definition: GUIDesigns.h:48
#define GUIDesignMFXCheckableButtonSupermode
checkable button with icon placed in navigation toolbar for supermodes
Definition: GUIDesigns.h:108
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:139
#define GUIDesignComboBoxWidth120
comboBox with thick frame, width 120
Definition: GUIDesigns.h:252
unsigned int GUIGlID
Definition: GUIGlObject.h:40
GUIGlObjectType
@ GLO_EDGERELDATA
edge relation data
@ GLO_TESTELEMENT
test element (used in NETEDIT)
@ GLO_JUNCTION
a junction
@ GLO_LANE
a lane
@ GLO_TAZ
Traffic Assignment Zones (TAZs)
@ GLO_EDGEDATA
edge data
@ GLO_CONNECTION
a connection
@ GLO_EDGE
an edge
@ GLO_NETWORK
The network - empty.
@ GLO_POI
a poi
@ GLO_RECTANGLESELECTION
rectangle selection shape (used in NETEDIT)
@ GLO_NETWORKELEMENT
reserved GLO type to pack all network elements
@ GLO_POLYGON
a polygon
@ GLO_TLLOGIC
a tl-logic
@ GLO_CROSSING
a tl-logic
@ DATAMODE_CHECKBOX_SHOWADDITIONALS
@ MODEVEHICLETYPE
@ NETWORKMODE_CHECKBOX_BUBBLES
@ MODEPERSONPLAN
@ MODECROSSING
@ MODEADDITIONAL
@ MODEEDGERELDATA
@ SUPERMODEDEMAND
@ MODEPROHIBITION
@ DEMANDMODE_CHECKBOX_HIDENONINSPECTEDDEMANDELEMENTS
@ NETWORKMODE_CHECKBOX_HIDECONNECTIONS
@ DATAMODE_CHECKBOX_SHOWSHAPES
@ NETWORKMODE_CHECKBOX_SELECTEDGES
@ COMMONMODE_CHECKBOX_SHOWDEMANDELEMENTS
@ DEMANDMODE_CHECKBOX_LOCKPERSON
@ NETWORKMODE_CHECKBOX_APPLYTOALLPHASES
@ MODECREATEEDGE
@ NETWORKMODE_CHECKBOX_AUTOSELECTJUNCTIONS
@ NETWORKMODE_CHECKBOX_SHOWCONNECTIONS
@ DEMANDMODE_CHECKBOX_SHOWPERSONPLANS
@ DEMANDMODE_CHECKBOX_HIDESHAPES
@ SAVEDATAELEMENTS
@ COMMONMODE_CHECKBOX_GRID
@ SAVENETWORKELEMENTS
@ MODEEDGEDATA
@ NETWORKMODE_CHECKBOX_ELEVATION
@ SUPERMODENETWORK
@ COMMONMODE_CHECKBOX_SPREADVEHICLE
@ SAVEDEMANDELEMENTS
@ SUPERMODEDATA
@ SAVEADDITIONALELEMENTS
@ MODECONNECTION
@ NETWORKMODE_CHECKBOX_CHAIN
@ NETWORKMODE_CHECKBOX_ASKFORMERGE
@ MODEPERSONTYPE
@ MODETAZRELDATA
@ NETWORKMODE_CHECKBOX_TWOWAY
@ GNETEXTURE_EMPTYSELECTED
Definition: GUITextures.h:35
@ GNETEXTURE_NOTMOVING
Definition: GUITextures.h:38
@ GNETEXTURE_NOTMOVINGSELECTED
Definition: GUITextures.h:39
@ GNETEXTURE_LOCKSELECTED
Definition: GUITextures.h:37
@ GNETEXTURE_EMPTY
Definition: GUITextures.h:34
@ GNETEXTURE_LOCK
Definition: GUITextures.h:36
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:284
@ 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_BLOCK_MOVEMENT
block movement of a graphic element
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:29
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
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
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:546
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:446
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
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 Tag Property assigned to this object
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static std::vector< std::pair< SumoXMLTag, const std::string > > getAllowedTagsByCategory(const int tagPropertyCategory, const bool onlyDrawables)
get tags of all editable element types using TagProperty Type (NetworkEditMode::NETWORKELEMENT,...
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:41
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:37
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:399
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.
class for NETEDIT geometries over lanes
Definition: GNEGeometry.h:76
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
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:45
move element
virtual GNEMoveOperation * getMoveOperation(const double shapeOffset)=0
get move operation for the given shapeOffset
static void commitMove(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const Position &offset, GNEUndoList *undoList)
commit move element for the given offset
static void moveElement(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const Position &offset)
move element the for given offset (note: offset can be X-Y-0, 0-0-Z or X-Y-Z)
move operation
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
void setShapeEdited(const bool value)
set shape edited
Definition: GNEPOI.h:41
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
Definition: GNETAZ.h:33
bool isShape() const
return true if tag correspond to a shape
bool canBlockMovement() const
return true if tag correspond to an element that can block their movement
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
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
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
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
bool showLockIcon() const
check if lock icon should be visible
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:716
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
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
double x() const
Returns the x-position.
Definition: Position.h:54
void setz(double z)
set position z
Definition: Position.h:79
double y() const
Returns the y-position.
Definition: Position.h:59
A list of positions.
double length2D() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
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.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
Definition: RGBColor.h:187
static const RGBColor BLACK
Definition: RGBColor.h:188
static const RGBColor MAGENTA
Definition: RGBColor.h:185
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
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
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
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
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 buildDemandViewOptionsMenuChecks()
build menu checks
const GNEDemandElement * getLockedPerson() const
get locked person
bool showShapes() const
check if shapes has to be drawn
void hideDemandViewOptionsMenuChecks()
hide all options menu checks
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
void getVisibleDemandMenuCommands(std::vector< MFXCheckableButton * > &commands) const
get visible demand menu commands
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
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
EditModes(GNEViewNet *viewNet)
default constructor
void setDataEditMode(DataEditMode dataMode, const bool force=false)
set Data edit mode
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
EditNetworkElementShapes(GNEViewNet *viewNet)
default constructor
void startEditCustomShape(GNENetworkElement *element)
start edit custom shape
static void drawLockIcon(const GNEAttributeCarrier *AC, const GNEGeometry::Geometry &geometry, const double exaggeration, const double offsetx, const double offsety, const bool overlane, const double size=0.5)
draw lock icon
static GUIGlID getLockIcon(const GNEAttributeCarrier *AC)
get lock icon
static bool checkDrawing(const GNEAttributeCarrier *AC, const double exaggeration)
check drawing
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
Position calculateOffset() const
calculate offset
void moveSelection(const bool mouseLeftButtonPressed)
move selection
bool isMovingSelection() const
check if currently there is element being moved
void finishMoveSelection()
finish moving selection
void calculateEdgeSelection(const GNEEdge *clickedEdge)
calculate edge selection
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 calculateMoveOperationShape(GNEMoveElement *moveElement, const PositionVector &shape, const double radius)
calculate move operation for shape
Position calculateOffset() const
calculate offset
bool beginMoveSingleElementDemandMode()
begin move single element in Demand mode
void updateNetworkCheckableButtons()
update network checkable buttons
void showNetworkCheckableButtons()
show all Network Checkable Buttons
void buildNetworkCheckableButtons()
build checkable buttons
NetworkCheckableButtons(GNEViewNet *viewNet)
default constructor
void hideNetworkCheckableButtons()
hide all Network Checkable Buttons
void disableNetworkCheckableButtons()
hide all options menu checks
bool showConnections() const
check if select show connections checkbox is enabled
bool drawSpreadVehicles() const
check if vehicles must be drawn spread
bool editingElevation() const
check if we're editing elevation
void getVisibleNetworkMenuCommands(std::vector< MFXCheckableButton * > &commands) const
get visible network menu commands
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool 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