Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEViewParent.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A single child window which contains a view of the edited network (adapted
19// from GUISUMOViewParent)
20// While we don't actually need MDI for netedit it is easier to adapt existing
21// structures than to write everything from scratch.
22/****************************************************************************/
23
59
62#include "GNENet.h"
63#include "GNEUndoList.h"
64#include "GNEViewNet.h"
65#include "GNEViewParent.h"
66
67// ===========================================================================
68// FOX callback mapping
69// ===========================================================================
70
88
89// Object implementation
90FXIMPLEMENT(GNEViewParent, GUIGlChildWindow, GNEViewParentMap, ARRAYNUMBER(GNEViewParentMap))
91
92
93// ===========================================================================
94// member method definitions
95// ===========================================================================
96
97GNEViewParent::GNEViewParent(FXMDIClient* p, FXMDIMenu* mdimenu, const FXString& name, GNEApplicationWindow* parentWindow,
98 FXGLCanvas* share, GNENet* net, GNEUndoList* undoList, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
99 GUIGlChildWindow(p, parentWindow, mdimenu, name, parentWindow->getToolbarsGrip().navigation, ic, opts, x, y, w, h),
100 myGNEAppWindows(parentWindow) {
101 // Add child to parent
102 myGUIMainWindowParent->addGLChild(this);
103
104 // Create Vertical separator
105 new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
106
107 // Create undo/redo buttons
108 myUndoButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
109 std::string("\t") + TL("Undo") + std::string("\t") + TL("Undo the last change. (Ctrl+Z)"),
111 myRedoButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
112 std::string("\t") + TL("Redo") + std::string("\t") + TL("Redo the last change. (Ctrl+Y)"),
114
115 // Create Vertical separator
116 new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
117
118 // create compute path manager button
119 myComputePathManagerButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
120 std::string("\t") + TL("Compute path manager") + std::string("\t") + TL("Compute path manager."),
122
123 // Create Frame Splitter
124 myFramesSplitter = new FXSplitter(myChildWindowContentFrame, this, MID_GNE_VIEWPARENT_FRAMEAREAWIDTH, GUIDesignSplitter | SPLITTER_HORIZONTAL);
125
126 // Create frames Area (vertical frame)
127 myFramesArea = new FXVerticalFrame(myFramesSplitter, GUIDesignFrameArea);
128
129 // Create view area
130 myViewArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignViewnArea);
131
132 // Add the view to a temporary parent so that we can add items to myViewArea in the desired order
133 FXComposite* tmp = new FXComposite(this);
134
135 // Create view net
136 GNEViewNet* viewNet = new GNEViewNet(tmp, myViewArea, *myGUIMainWindowParent, this, net, undoList, myGUIMainWindowParent->getGLVisual(), share);
137
138 // show toolbar grips
139 myGNEAppWindows->getToolbarsGrip().buildMenuToolbarsGrip();
140
141 // Set pointer myView with the created view net
142 myView = viewNet;
143
144 // build frames
145 myCommonFrames.buildCommonFrames(this, viewNet);
146 myNetworkFrames.buildNetworkFrames(this, viewNet);
147 myDemandFrames.buildDemandFrames(this, viewNet);
148 myDataFrames.buildDataFrames(this, viewNet);
149
150 // set default frames area width
151 myFramesArea->setWidth(GUIDesignFramesAreaDefaultWidth);
152
153 // Update frame areas after creation
154 onCmdUpdateFrameAreaWidth(nullptr, 0, nullptr);
155
156 // Hide all Frames Area
157 hideFramesArea();
158
159 // Build view toolBars
160 myView->buildViewToolBars(this);
161
162 // create windows
164}
165
166
168 // delete toolbar grips
170 // Remove child before remove
172}
173
174
175void
182
183
190 } else if (myDemandFrames.isDemandFrameShown()) {
192 } else if (myDataFrames.isDataFrameShown()) {
194 } else {
195 return nullptr;
196 }
197}
198
199
204
205
210
211
216
217
222
223
228
229
234
235
240
241
246
247
252
253
258
259
264
265
270
271
276
277
282
283
288
289
294
295
300
301
306
307
312
313
318
319
324
325
330
331
336
337
342
343
348
349
354
355
360
361
366
367
368void
370 const bool frameShown = myCommonFrames.isCommonFrameShown() ||
374 // show and recalc framesArea if at least there is a frame shown
375 if (frameShown) {
376 myFramesArea->recalc();
377 myFramesArea->show();
378 }
379}
380
381
382void
384 const bool frameShown = myCommonFrames.isCommonFrameShown() ||
388 // hide and recalc frames Area if all frames are hidden is enabled
389 if (!frameShown) {
390 myFramesArea->hide();
391 myFramesArea->recalc();
392 }
393}
394
395
400
401
406
407
408void
410 if (chooserDialog == nullptr) {
411 throw ProcessError("ChooserDialog already deleted");
412 } else if (chooserDialog == myACChoosers.ACChooserJunction) {
414 } else if (chooserDialog == myACChoosers.ACChooserEdges) {
416 } else if (chooserDialog == myACChoosers.ACChooserWalkingAreas) {
418 } else if (chooserDialog == myACChoosers.ACChooserVehicles) {
420 } else if (chooserDialog == myACChoosers.ACChooserPersons) {
422 } else if (chooserDialog == myACChoosers.ACChooserContainers) {
424 } else if (chooserDialog == myACChoosers.ACChooserRoutes) {
426 } else if (chooserDialog == myACChoosers.ACChooserStops) {
428 } else if (chooserDialog == myACChoosers.ACChooserTLS) {
429 myACChoosers.ACChooserTLS = nullptr;
430 } else if (chooserDialog == myACChoosers.ACChooserAdditional) {
432 } else if (chooserDialog == myACChoosers.ACChooserPOI) {
433 myACChoosers.ACChooserPOI = nullptr;
434 } else if (chooserDialog == myACChoosers.ACChooserPolygon) {
436 } else if (chooserDialog == myACChoosers.ACChooserProhibition) {
438 } else if (chooserDialog == myACChoosers.ACChooserWire) {
439 myACChoosers.ACChooserWire = nullptr;
440 } else {
441 throw ProcessError("Unregistered chooserDialog");
442 }
443}
444
445
446void
451
452
453FXVerticalFrame*
457
458
459int
461 return myFramesArea->getWidth();
462}
463
464
465void
466GNEViewParent::setFrameAreaWidth(const int frameAreaWith) {
467 myFramesArea->setWidth(frameAreaWith);
469}
470
471
472long
473GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
474 // get the new file name
475 FXFileDialog opendialog(this, TL("Save Snapshot"));
476 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::CAMERA));
477 opendialog.setSelectMode(SELECTFILE_ANY);
478 opendialog.setPatternList(SUMOXMLDefinitions::ImageFileExtensions.getMultilineString().c_str());
479 if (gCurrentFolder.length() != 0) {
480 opendialog.setDirectory(gCurrentFolder);
481 }
482 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
483 return 1;
484 }
485 gCurrentFolder = opendialog.getDirectory();
486 std::string file = opendialog.getFilename().text();
487 if (file.find(".") == std::string::npos) {
488 file.append(".png");
489 WRITE_MESSAGE(TL("No file extension was specified - saving Snapshot as PNG."));
490 }
491 const std::string error = myView->makeSnapshot(file);
492 if (error.size() > 0) {
493 // open error message box
494 GNEErrorBasicDialog(myGNEAppWindows, TL("Saving failed."), error.c_str());
495 } else {
496 WRITE_MESSAGE(TL("Snapshot successfully saved!"));
497 }
498 return 1;
499}
500
501
502long
503GNEViewParent::onCmdClose(FXObject*, FXSelector /* sel */, void*) {
504 myGUIMainWindowParent->handle(this, FXSEL(SEL_COMMAND, MID_HOTKEY_CTRL_W_CLOSESIMULATION), nullptr);
505 return 1;
506}
507
508
509long
510GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) {
511 GNEViewNet* viewNet = dynamic_cast<GNEViewNet*>(myView);
512 // check that viewNet exist
513 if (viewNet) {
514 // declare a vector in which save attribute carriers to locate
515 std::map<std::string, GNEAttributeCarrier*> ACsToLocate;
516 int messageId = FXSELID(sel);
517 GNEACChooserDialog** chooserLoc = nullptr;
518 std::string locateTitle;
519 switch (messageId) {
521 chooserLoc = &myACChoosers.ACChooserJunction;
522 locateTitle = TL("Junction Chooser");
523 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
524 ACsToLocate[junction.second->getID()] = junction.second;
525 }
526 break;
528 chooserLoc = &myACChoosers.ACChooserEdges;
529 locateTitle = TL("Edge Chooser");
530 for (const auto& edge : viewNet->getNet()->getAttributeCarriers()->getEdges()) {
531 ACsToLocate[edge.second->getID()] = edge.second;
532 }
533 break;
536 locateTitle = TL("WalkingArea Chooser");
537 for (const auto& walkingArea : viewNet->getNet()->getAttributeCarriers()->getWalkingAreas()) {
538 ACsToLocate[walkingArea.second->getID()] = walkingArea.second;
539 }
540 break;
542 chooserLoc = &myACChoosers.ACChooserVehicles;
543 locateTitle = TL("Vehicle Chooser");
544 // fill ACsToLocate with all vehicles
545 for (const auto& vehicleTag : NamespaceIDs::vehicles) {
546 for (const auto& vehicle : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(vehicleTag)) {
547 ACsToLocate[vehicle.second->getID()] = vehicle.second;
548 }
549 }
550 break;
551 }
553 chooserLoc = &myACChoosers.ACChooserPersons;
554 locateTitle = TL("Person Chooser");
555 // fill ACsToLocate with all persons
556 for (const auto& personTag : NamespaceIDs::persons) {
557 for (const auto& person : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(personTag)) {
558 ACsToLocate[person.second->getID()] = person.second;
559 }
560 }
561 break;
563 chooserLoc = &myACChoosers.ACChooserContainers;
564 locateTitle = TL("Container Chooser");
565 // fill ACsToLocate with all containers
566 for (const auto& containerTag : NamespaceIDs::containers) {
567 for (const auto& container : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(containerTag)) {
568 ACsToLocate[container.second->getID()] = container.second;
569 }
570 }
571 break;
573 chooserLoc = &myACChoosers.ACChooserRoutes;
574 locateTitle = TL("Route Chooser");
575 for (const auto& route : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
576 ACsToLocate[route.second->getID()] = route.second;
577 }
578 break;
580 chooserLoc = &myACChoosers.ACChooserStops;
581 locateTitle = TL("Stop Chooser");
582 // fill ACsToLocate with all vehicles
583 for (const auto& stopTag : NamespaceIDs::stops) {
584 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(stopTag)) {
585 ACsToLocate[flowTAZ.second->getID()] = flowTAZ.second;
586 }
587 }
588 break;
589 }
591 chooserLoc = &myACChoosers.ACChooserTLS;
592 locateTitle = TL("TLS Chooser");
593 // fill ACsToLocate with junctions that haven TLS
594 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
595 if (junction.second->getNBNode()->getControllingTLS().size() > 0) {
596 ACsToLocate[junction.second->getID()] = junction.second;
597 }
598 }
599 break;
601 chooserLoc = &myACChoosers.ACChooserAdditional;
602 locateTitle = TL("Additional Chooser");
603 for (const auto& additionalTag : viewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
604 const auto tagProperty = viewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionalTag.first, true);
605 // avoid shapes and TAZs
606 if (!tagProperty->isShapeElement() && !tagProperty->isTAZElement()) {
607 for (const auto& additional : additionalTag.second) {
608 ACsToLocate[additional.second->getID()] = additional.second;
609 }
610 }
611 }
612 break;
614 chooserLoc = &myACChoosers.ACChooserPOI;
615 locateTitle = TL("POI Chooser");
616 // fill ACsToLocate with all POIs
617 for (const auto& POITag : NamespaceIDs::POIs) {
618 for (const auto& poi : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(POITag)) {
619 ACsToLocate[poi.second->getID()] = poi.second;
620 }
621 }
622 break;
624 chooserLoc = &myACChoosers.ACChooserPolygon;
625 locateTitle = TL("Poly Chooser");
626 // fill ACsToLocate with all polygons
627 for (const auto& polygonTag : NamespaceIDs::polygons) {
628 for (const auto& polygon : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(polygonTag)) {
629 ACsToLocate[polygon.second->getID()] = polygon.second;
630 }
631 }
632 break;
633 default:
634 throw ProcessError("Unknown Message ID in onCmdLocate");
635 }
636 if (*chooserLoc) {
637 // restore focus in the existent chooser dialog
638 GNEACChooserDialog* chooser = *chooserLoc;
639 chooser->restore();
640 chooser->setFocus();
641 chooser->raise();
642 } else {
643 GNEACChooserDialog* chooser = new GNEACChooserDialog(this, messageId, GUIIconSubSys::getIcon(GUIIcon::LOCATEJUNCTION), locateTitle, ACsToLocate);
644 *chooserLoc = chooser;
645 }
646 // update locator popup
647 myLocatorPopup->popdown();
648 myLocatorButton->killFocus();
649 myLocatorPopup->update();
650 }
651 return 1;
652}
653
654
655long
656GNEViewParent::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
657 myView->onKeyPress(o, sel, eventData);
658 return 0;
659}
660
661
662long
663GNEViewParent::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
664 myView->onKeyRelease(o, sel, eventData);
665 return 0;
666}
667
668
669long
670GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) {
671 const int framesAreaWidth = myFramesArea->getWidth();
672 // set width of FramesArea in all frames
673 myCommonFrames.setCommonFramesWidth(framesAreaWidth);
674 myNetworkFrames.setNetworkFramesWidth(framesAreaWidth);
675 myDemandFrames.setDemandFramesWidth(framesAreaWidth);
676 myDataFrames.setDataFramesWidth(framesAreaWidth);
677 return 0;
678}
679
680// ---------------------------------------------------------------------------
681// GNEViewParent::CommonFrames - methods
682// ---------------------------------------------------------------------------
683
686
687
688void
690 inspectorFrame = new GNEInspectorFrame(viewParent, viewNet);
691 selectorFrame = new GNESelectorFrame(viewParent, viewNet);
692 moveFrame = new GNEMoveFrame(viewParent, viewNet);
693 deleteFrame = new GNEDeleteFrame(viewParent, viewNet);
694}
695
696
697void
699 inspectorFrame->hide();
700 deleteFrame->hide();
701 selectorFrame->hide();
702 moveFrame->hide();
703}
704
705
706void
708 // set width in all frames
709 inspectorFrame->setFrameWidth(frameWidth);
710 deleteFrame->setFrameWidth(frameWidth);
711 selectorFrame->setFrameWidth(frameWidth);
712 moveFrame->setFrameWidth(frameWidth);
713}
714
715
716bool
718 // check all frames
719 if (inspectorFrame->shown()) {
720 return true;
721 } else if (deleteFrame->shown()) {
722 return true;
723 } else if (selectorFrame->shown()) {
724 return true;
725 } else if (moveFrame->shown()) {
726 return true;
727 } else {
728 return false;
729 }
730}
731
732
735 // check all frames
736 if (inspectorFrame->shown()) {
737 return inspectorFrame;
738 } else if (deleteFrame->shown()) {
739 return deleteFrame;
740 } else if (selectorFrame->shown()) {
741 return selectorFrame;
742 } else if (moveFrame->shown()) {
743 return moveFrame;
744 } else {
745 return nullptr;
746 }
747}
748
749// ---------------------------------------------------------------------------
750// GNEViewParent::NetworkFrames - methods
751// ---------------------------------------------------------------------------
752
754
755
756void
758 connectorFrame = new GNEConnectorFrame(viewParent, viewNet);
759 TLSEditorFrame = new GNETLSEditorFrame(viewParent, viewNet);
760 additionalFrame = new GNEAdditionalFrame(viewParent, viewNet);
761 crossingFrame = new GNECrossingFrame(viewParent, viewNet);
762 TAZFrame = new GNETAZFrame(viewParent, viewNet);
763 polygonFrame = new GNEShapeFrame(viewParent, viewNet);
764 prohibitionFrame = new GNEProhibitionFrame(viewParent, viewNet);
765 wireFrame = new GNEWireFrame(viewParent, viewNet);
766 decalFrame = new GNEDecalFrame(viewParent, viewNet);
767 createEdgeFrame = new GNECreateEdgeFrame(viewParent, viewNet);
768}
769
770
771void
773 connectorFrame->hide();
774 TLSEditorFrame->hide();
775 additionalFrame->hide();
776 crossingFrame->hide();
777 TAZFrame->hide();
778 polygonFrame->hide();
779 prohibitionFrame->hide();
780 wireFrame->hide();
781 decalFrame->hide();
782 createEdgeFrame->hide();
783}
784
785
786void
788 // set width in all frames
789 connectorFrame->setFrameWidth(frameWidth);
790 TLSEditorFrame->setFrameWidth(frameWidth);
791 additionalFrame->setFrameWidth(frameWidth);
792 crossingFrame->setFrameWidth(frameWidth);
793 TAZFrame->setFrameWidth(frameWidth);
794 polygonFrame->setFrameWidth(frameWidth);
795 prohibitionFrame->setFrameWidth(frameWidth);
796 wireFrame->setFrameWidth(frameWidth);
797 decalFrame->setFrameWidth(frameWidth);
798 createEdgeFrame->setFrameWidth(frameWidth);
799}
800
801
802bool
804 // check all frames
805 if (connectorFrame->shown()) {
806 return true;
807 } else if (TLSEditorFrame->shown()) {
808 return true;
809 } else if (additionalFrame->shown()) {
810 return true;
811 } else if (crossingFrame->shown()) {
812 return true;
813 } else if (TAZFrame->shown()) {
814 return true;
815 } else if (polygonFrame->shown()) {
816 return true;
817 } else if (prohibitionFrame->shown()) {
818 return true;
819 } else if (wireFrame->shown()) {
820 return true;
821 } else if (decalFrame->shown()) {
822 return true;
823 } else if (createEdgeFrame->shown()) {
824 return true;
825 } else {
826 return false;
827 }
828}
829
830
833 // check all frames
834 if (connectorFrame->shown()) {
835 return connectorFrame;
836 } else if (TLSEditorFrame->shown()) {
837 return TLSEditorFrame;
838 } else if (additionalFrame->shown()) {
839 return additionalFrame;
840 } else if (crossingFrame->shown()) {
841 return crossingFrame;
842 } else if (TAZFrame->shown()) {
843 return TAZFrame;
844 } else if (polygonFrame->shown()) {
845 return polygonFrame;
846 } else if (prohibitionFrame->shown()) {
847 return prohibitionFrame;
848 } else if (wireFrame->shown()) {
849 return wireFrame;
850 } else if (decalFrame->shown()) {
851 return decalFrame;
852 } else if (createEdgeFrame->shown()) {
853 return createEdgeFrame;
854 } else {
855 return nullptr;
856 }
857}
858
859// ---------------------------------------------------------------------------
860// GNEViewParent::DemandFrames - methods
861// ---------------------------------------------------------------------------
862
865
866
867void
869 routeFrame = new GNERouteFrame(viewParent, viewNet);
870 routeDistributionFrame = new GNERouteDistributionFrame(viewParent, viewNet);
871 vehicleFrame = new GNEVehicleFrame(viewParent, viewNet);
872 typeFrame = new GNETypeFrame(viewParent, viewNet);
873 typeDistributionFrame = new GNETypeDistributionFrame(viewParent, viewNet);
874 stopFrame = new GNEStopFrame(viewParent, viewNet);
875 personFrame = new GNEPersonFrame(viewParent, viewNet);
876 personPlanFrame = new GNEPersonPlanFrame(viewParent, viewNet);
877 containerFrame = new GNEContainerFrame(viewParent, viewNet);
878 containerPlanFrame = new GNEContainerPlanFrame(viewParent, viewNet);
879}
880
881
882void
884 routeFrame->hide();
885 routeDistributionFrame->hide();
886 vehicleFrame->hide();
887 typeFrame->hide();
888 typeDistributionFrame->hide();
889 stopFrame->hide();
890 personFrame->hide();
891 personPlanFrame->hide();
892 containerFrame->hide();
893 containerPlanFrame->hide();
894}
895
896
897void
899 // set width in all frames
900 routeFrame->setFrameWidth(frameWidth);
901 routeDistributionFrame->setFrameWidth(frameWidth);
902 vehicleFrame->setFrameWidth(frameWidth);
903 typeFrame->setFrameWidth(frameWidth);
904 typeDistributionFrame->setFrameWidth(frameWidth);
905 stopFrame->setFrameWidth(frameWidth);
906 personFrame->setFrameWidth(frameWidth);
907 personPlanFrame->setFrameWidth(frameWidth);
908 containerFrame->setFrameWidth(frameWidth);
909 containerPlanFrame->setFrameWidth(frameWidth);
910}
911
912
913bool
915 // check all frames
916 if (routeFrame->shown()) {
917 return true;
918 } else if (routeDistributionFrame->shown()) {
919 return true;
920 } else if (vehicleFrame->shown()) {
921 return true;
922 } else if (typeFrame->shown()) {
923 return true;
924 } else if (typeDistributionFrame->shown()) {
925 return true;
926 } else if (stopFrame->shown()) {
927 return true;
928 } else if (personFrame->shown()) {
929 return true;
930 } else if (personPlanFrame->shown()) {
931 return true;
932 } else if (containerFrame->shown()) {
933 return true;
934 } else if (containerPlanFrame->shown()) {
935 return true;
936 } else {
937 return false;
938 }
939}
940
941
944 // check all frames
945 if (routeFrame->shown()) {
946 return routeFrame;
947 } else if (routeDistributionFrame->shown()) {
948 return routeDistributionFrame;
949 } else if (vehicleFrame->shown()) {
950 return vehicleFrame;
951 } else if (typeFrame->shown()) {
952 return typeFrame;
953 } else if (typeDistributionFrame->shown()) {
954 return typeDistributionFrame;
955 } else if (stopFrame->shown()) {
956 return stopFrame;
957 } else if (personFrame->shown()) {
958 return personFrame;
959 } else if (personPlanFrame->shown()) {
960 return personPlanFrame;
961 } else if (containerFrame->shown()) {
962 return containerFrame;
963 } else if (containerPlanFrame->shown()) {
964 return containerPlanFrame;
965 } else {
966 return nullptr;
967 }
968}
969
970// ---------------------------------------------------------------------------
971// GNEViewParent::DataFrames - methods
972// ---------------------------------------------------------------------------
973
976
977
978void
980 edgeDataFrame = new GNEEdgeDataFrame(viewParent, viewNet);
981 edgeRelDataFrame = new GNEEdgeRelDataFrame(viewParent, viewNet);
982 TAZRelDataFrame = new GNETAZRelDataFrame(viewParent, viewNet);
983 meanDataFrame = new GNEMeanDataFrame(viewParent, viewNet);
984}
985
986
987void
989 edgeDataFrame->hide();
990 edgeRelDataFrame->hide();
991 TAZRelDataFrame->hide();
992 meanDataFrame->hide();
993}
994
995
996void
998 // set width in all frames
999 edgeDataFrame->setFrameWidth(frameWidth);
1000 edgeRelDataFrame->setFrameWidth(frameWidth);
1001 TAZRelDataFrame->setFrameWidth(frameWidth);
1002 meanDataFrame->setFrameWidth(frameWidth);
1003}
1004
1005
1006bool
1008 // check all frames
1009 if (edgeDataFrame->shown()) {
1010 return true;
1011 } else if (edgeRelDataFrame->shown()) {
1012 return true;
1013 } else if (TAZRelDataFrame->shown()) {
1014 return true;
1015 } else if (meanDataFrame->shown()) {
1016 return true;
1017 } else {
1018 return false;
1019 }
1020}
1021
1022
1023GNEFrame*
1025 // check all frames
1026 if (edgeDataFrame->shown()) {
1027 return edgeDataFrame;
1028 } else if (edgeRelDataFrame->shown()) {
1029 return edgeRelDataFrame;
1030 } else if (TAZRelDataFrame->shown()) {
1031 return TAZRelDataFrame;
1032 } else if (meanDataFrame->shown()) {
1033 return meanDataFrame;
1034 } else {
1035 return nullptr;
1036 }
1037}
1038
1039// ---------------------------------------------------------------------------
1040// GNEViewParent::ACChoosers - methods
1041// ---------------------------------------------------------------------------
1042
1045
1046
1048 // remove all dialogs if are active
1049 if (ACChooserJunction) {
1050 delete ACChooserJunction;
1051 }
1052 if (ACChooserEdges) {
1053 delete ACChooserEdges;
1054 }
1055 if (ACChooserWalkingAreas) {
1056 delete ACChooserWalkingAreas;
1057 }
1058 if (ACChooserRoutes) {
1059 delete ACChooserRoutes;
1060 }
1061 if (ACChooserStops) {
1062 delete ACChooserStops;
1063 }
1064 if (ACChooserVehicles) {
1065 delete ACChooserVehicles;
1066 }
1067 if (ACChooserPersons) {
1068 delete ACChooserPersons;
1069 }
1070 if (ACChooserContainers) {
1071 delete ACChooserContainers;
1072 }
1073 if (ACChooserTLS) {
1074 delete ACChooserTLS;
1075 }
1076 if (ACChooserAdditional) {
1077 delete ACChooserAdditional;
1078 }
1079 if (ACChooserPOI) {
1080 delete ACChooserPOI;
1081 }
1082 if (ACChooserPolygon) {
1083 delete ACChooserPolygon;
1084 }
1085 if (ACChooserProhibition) {
1086 delete ACChooserProhibition;
1087 }
1088 if (ACChooserWire) {
1089 delete ACChooserWire;
1090 }
1091}
1092
1093
1094/****************************************************************************/
FXDEFMAP(GNEViewParent) GNEViewParentMap[]
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition GUIAppEnum.h:391
@ MID_HOTKEY_SHIFT_S_LOCATESTOP
Locate stop - button.
Definition GUIAppEnum.h:188
@ MID_HOTKEY_CTRL_Y_REDO
Undo.
Definition GUIAppEnum.h:133
@ MID_HOTKEY_CTRL_W_CLOSESIMULATION
Close simulation - ID.
Definition GUIAppEnum.h:129
@ MID_HOTKEY_SHIFT_O_LOCATEPOI
Locate poi - button.
Definition GUIAppEnum.h:182
@ MID_HOTKEY_SHIFT_A_LOCATEADDITIONAL
Locate additional structure - button.
Definition GUIAppEnum.h:172
@ MID_HOTKEY_SHIFT_R_LOCATEROUTE
Locate route - button.
Definition GUIAppEnum.h:186
@ MID_HOTKEY_SHIFT_W_LOCATEWALKINGAREA
Locate edge - button.
Definition GUIAppEnum.h:194
@ MID_HOTKEY_SHIFT_C_LOCATECONTAINER
Locate container - button.
Definition GUIAppEnum.h:174
@ MID_HOTKEY_SHIFT_V_LOCATEVEHICLE
Locate vehicle - button.
Definition GUIAppEnum.h:192
@ MID_HOTKEY_SHIFT_L_LOCATEPOLY
Locate polygons - button.
Definition GUIAppEnum.h:180
@ MID_HOTKEY_SHIFT_E_LOCATEEDGE
Locate edge - button.
Definition GUIAppEnum.h:176
@ MID_GNE_VIEWPARENT_FRAMEAREAWIDTH
Size of frame area updated.
Definition GUIAppEnum.h:811
@ MID_HOTKEY_SHIFT_P_LOCATEPERSON
Locate person - button.
Definition GUIAppEnum.h:184
@ MID_HOTKEY_SHIFT_J_LOCATEJUNCTION
Locate junction - button.
Definition GUIAppEnum.h:178
@ MID_HOTKEY_CTRL_Z_UNDO
Redo.
Definition GUIAppEnum.h:135
@ MID_HOTKEY_SHIFT_T_LOCATETLS
Locate TLS - button.
Definition GUIAppEnum.h:190
@ MID_GNE_TOOLBAREDIT_COMPUTEPATHMANAGER
compute path manager
Definition GUIAppEnum.h:795
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:144
#define GUIDesignFrameArea
Definition GUIDesigns.h:388
#define GUIDesignVerticalSeparator
vertical separator
Definition GUIDesigns.h:497
#define GUIDesignSplitter
Definition GUIDesigns.h:505
#define GUIDesignViewnArea
design for view area
Definition GUIDesigns.h:391
#define GUIDesignFramesAreaDefaultWidth
define the default frames area width
Definition GUIDesigns.h:53
FXString gCurrentFolder
The folder used as last.
@ COMPUTEPATHMANAGER
@ LOCATEJUNCTION
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:288
#define TL(string)
Definition MsgHandler.h:304
@ SUMO_TAG_ROUTE
description of a route
The main window of Netedit.
GNEUndoList * getUndoList()
get pointer to undoList
GNEApplicationWindowHelper::ToolbarsGrip & getToolbarsGrip()
get ToolbarsGrip
const std::unordered_map< SumoXMLTag, std::unordered_map< const GUIGlObject *, GNEDemandElement * >, std::hash< int > > & getDemandElements() const
get demand elements
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
const std::map< std::string, GNEJunction * > & getJunctions() const
get junctions
const std::unordered_map< const GUIGlObject *, GNEWalkingArea * > & getWalkingAreas() const
get walkingAreas
const std::unordered_map< SumoXMLTag, std::unordered_map< const GUIGlObject *, GNEAdditional * >, std::hash< int > > & getAdditionals() const
get additionals
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
const GNETagPropertiesDatabase * getTagPropertiesDatabase() const
get tag properties database
Definition GNENet.cpp:138
const GNETagProperties * getTagProperty(const SumoXMLTag tag, const bool hardFail) const
get tagProperty associated to the given tag
long onUpdUndo(FXObject *, FXSelector, void *)
event after Undo
long onUpdRedo(FXObject *, FXSelector, void *)
event after Redo
GNENet * getNet() const
get the net object
GNEACChooserDialog * ACChooserPOI
pointer to ACChooser dialog used for locate POIs
GNEACChooserDialog * ACChooserPersons
pointer to ACChooser dialog used for locate persons
GNEACChooserDialog * ACChooserAdditional
pointer to ACChooser dialog used for locate additional
GNEACChooserDialog * ACChooserWire
pointer to ACChooser dialog used for locate Wires
GNEACChooserDialog * ACChooserTLS
pointer to ACChooser dialog used for locate TLSs
GNEACChooserDialog * ACChooserJunction
pointer to ACChooser dialog used for locate junctions
GNEACChooserDialog * ACChooserProhibition
pointer to ACChooser dialog used for locate Prohibitions
GNEACChooserDialog * ACChooserWalkingAreas
pointer to ACChooser dialog used for locate walkingareas
GNEACChooserDialog * ACChooserEdges
pointer to ACChooser dialog used for locate edges
GNEACChooserDialog * ACChooserVehicles
pointer to ACChooser dialog used for locate vehicles
GNEACChooserDialog * ACChooserStops
pointer to ACChooser dialog used for locate stops
GNEACChooserDialog * ACChooserContainers
pointer to ACChooser dialog used for locate containers
GNEACChooserDialog * ACChooserPolygon
pointer to ACChooser dialog used for locate Polygons
GNEACChooserDialog * ACChooserRoutes
pointer to ACChooser dialog used for locate routes
GNEMoveFrame * moveFrame
frame for move elements
GNEFrame * getCurrentShownFrame() const
get current common frame show
bool isCommonFrameShown() const
return true if at least there is a common frame shown
GNEDeleteFrame * deleteFrame
frame for delete elements
void buildCommonFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build common frames
GNESelectorFrame * selectorFrame
frame for select elements
void hideCommonFrames()
hide common frames
GNEInspectorFrame * inspectorFrame
frame for inspect elements
void setCommonFramesWidth(int frameWidth)
set new width in all common frames
GNEEdgeDataFrame * edgeDataFrame
frame for DATA_EDGEDATA
void setDataFramesWidth(int frameWidth)
set new width in all data frames
GNEFrame * getCurrentShownFrame() const
get current data frame show
GNETAZRelDataFrame * TAZRelDataFrame
frame for DATA_TAZRELDATA
GNEEdgeRelDataFrame * edgeRelDataFrame
frame for DATA_EDGERELDATA
bool isDataFrameShown() const
return true if at least there is a data frame shown
void hideDataFrames()
hide data frames
void buildDataFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build data frames
GNEMeanDataFrame * meanDataFrame
frame for DATA_MEANDATA
GNEPersonFrame * personFrame
frame for DEMAND_PERSON
GNERouteDistributionFrame * routeDistributionFrame
frame for DEMAND_ROUTEDISTRIBUTION
GNEStopFrame * stopFrame
frame for DEMAND_STOP
GNERouteFrame * routeFrame
frame for DEMAND_ROUTE
GNEContainerFrame * containerFrame
frame for DEMAND_CONTAINER
GNETypeDistributionFrame * typeDistributionFrame
frame for DEMAND_TYPEDISTRIBUTION
GNEContainerPlanFrame * containerPlanFrame
frame for DEMAND_CONTAINERPLAN
GNEVehicleFrame * vehicleFrame
frame for DEMAND_VEHICLE
GNEFrame * getCurrentShownFrame() const
get current demand frame show
void setDemandFramesWidth(int frameWidth)
set new width in all demand frames
void buildDemandFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build demand frames
GNEPersonPlanFrame * personPlanFrame
frame for DEMAND_PERSONPLAN
GNETypeFrame * typeFrame
frame for DEMAND_TYPE
bool isDemandFrameShown() const
return true if at least there is a demand frame shown
void hideDemandFrames()
hide demand frames
GNEAdditionalFrame * additionalFrame
frame for NETWORK_ADDITIONAL
bool isNetworkFrameShown() const
return true if at least there is a network frame shown
GNECrossingFrame * crossingFrame
frame for NETWORK_CROSSING
GNEDecalFrame * decalFrame
frame for NETWORK_DECAL
GNEConnectorFrame * connectorFrame
frame for NETWORK_CONNECT
GNECreateEdgeFrame * createEdgeFrame
frame for NETWORK_CREATEDGE
GNEProhibitionFrame * prohibitionFrame
frame for NETWORK_PROHIBITION
GNEShapeFrame * polygonFrame
frame for NETWORK_SHAPE
GNETAZFrame * TAZFrame
frame for NETWORK_TAZ
GNETLSEditorFrame * TLSEditorFrame
frame for NETWORK_TLS
GNEFrame * getCurrentShownFrame() const
get current network frame show
GNEWireFrame * wireFrame
frame for NETWORK_WIRE
void hideNetworkFrames()
hide network frames
void setNetworkFramesWidth(int frameWidth)
set new width in all network frames
void buildNetworkFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build network frames
A single child window which contains a view of the simulation area.
long onCmdMakeSnapshot(FXObject *sender, FXSelector, void *)
GNECrossingFrame * getCrossingFrame() const
get frame for NETWORK_CROSSING
GUIMainWindow * getGUIMainWindow() const
get GUIMainWindow App
GNEConnectorFrame * getConnectorFrame() const
get frame for NETWORK_CONNECT
GNEStopFrame * getStopFrame() const
get frame for DEMAND_STOP
void updateUndoRedoButtons()
update toolbar undo/redo buttons (called when user press Ctrl+Z/Y)
long onCmdUpdateFrameAreaWidth(FXObject *, FXSelector, void *)
Called when user change the splitter between FrameArea and ViewNet.
GNEProhibitionFrame * getProhibitionFrame() const
get frame for NETWORK_PROHIBITION
long onKeyPress(FXObject *o, FXSelector sel, void *data)
Called when user press a key.
GNEPersonPlanFrame * getPersonPlanFrame() const
get frame for DEMAND_PERSONFRAME
DemandFrames myDemandFrames
struct for demand frames
MFXButtonTooltip * myUndoButton
toolbar undo button
GNEMeanDataFrame * getMeanDataFrame() const
get frame for DATA_TAZRELDATA
GNEShapeFrame * getShapeFrame() const
get frame for NETWORK_SHAPE
void setFrameAreaWidth(const int frameAreaWith)
set frame area width
GNETAZRelDataFrame * getTAZRelDataFrame() const
get frame for DATA_TAZRELDATA
GNEMoveFrame * getMoveFrame() const
get frame for move elements
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user hits the close button (x)
GNESelectorFrame * getSelectorFrame() const
get frame for select elements
GNEContainerPlanFrame * getContainerPlanFrame() const
get frame for DEMAND_CONTAINERFRAME
void hideFramesArea()
hide frames area if all GNEFrames are hidden
GNEEdgeDataFrame * getEdgeDataFrame() const
get frame for DATA_EDGEDATA
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
NetworkFrames myNetworkFrames
struct for network frames
GNETypeDistributionFrame * getTypeDistributionFrame() const
get frame for DEMAND_TYPEDISTRIBUTION
ACChoosers myACChoosers
struct for ACChoosers
GNEVehicleFrame * getVehicleFrame() const
get frame for DEMAND_VEHICLE
void showFramesArea()
show frames area if at least a GNEFrame is showed
GNEDecalFrame * getDecalFrame() const
get frame for NETWORK_DECAL
void hideAllFrames()
hide all frames
GNETypeFrame * getTypeFrame() const
get frame for DEMAND_TYPE
FXVerticalFrame * myFramesArea
frame to hold GNEFrames
GNETAZFrame * getTAZFrame() const
get frame for NETWORK_TAZ
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
CommonFrames myCommonFrames
struct for common frames
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
DataFrames myDataFrames
struct for data frames
GNEContainerFrame * getContainerFrame() const
get frame for DEMAND_CONTAINER
GNEAdditionalFrame * getAdditionalFrame() const
get frame for NETWORK_ADDITIONAL
GNERouteDistributionFrame * getRouteDistributionFrame() const
get frame for DEMAND_ROUTEDISTRIBUTION
GNEWireFrame * getWireFrame() const
get frame for NETWORK_WIRE
FXVerticalFrame * getFramesArea() const
get frame area
GNEPersonFrame * getPersonFrame() const
get frame for DEMAND_PERSON
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
GNEApplicationWindow * myGNEAppWindows
pointer to GNEApplicationWindow
GNEEdgeRelDataFrame * getEdgeRelDataFrame() const
get frame for DATA_EDGERELDATA
MFXButtonTooltip * myRedoButton
toolbar redo button
GNECreateEdgeFrame * getCreateEdgeFrame() const
get frame for NETWORK_CREATEEDGE
int getFrameAreaWidth() const
get frame area width
GNERouteFrame * getRouteFrame() const
get frame for DEMAND_ROUTE
void eraseACChooserDialog(GNEACChooserDialog *chooserDialog)
remove created chooser dialog
GNEFrame * getCurrentShownFrame() const
get current frame (note: it can be null)
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
~GNEViewParent()
Destructor.
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
Called when user releases a key.
GUIMainWindow * myGUIMainWindowParent
FOX needs this.
virtual void create()
create GUIGlChildWindow
GUISUMOAbstractView * myView
The view.
FXPopup * myLocatorPopup
The locator menu.
MFXMenuButtonTooltip * myLocatorButton
The locator button.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list (GUIGlChildWindow)
std::string makeSnapshot(const std::string &destFile, const int w=-1, const int h=-1)
Takes a snapshots and writes it into the given file.
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
Definition MFXUtils.cpp:40
static const std::vector< SumoXMLTag > stops
vehicle stops namespace
static const std::vector< SumoXMLTag > vehicles
vehicles namespace
static const std::vector< SumoXMLTag > POIs
POIs namespace.
static const std::vector< SumoXMLTag > persons
persons namespace
static const std::vector< SumoXMLTag > polygons
polygon namespace
static const std::vector< SumoXMLTag > containers
containers namespace
static StringBijection< ImageFileExtension > ImageFileExtensions
image file extensions