Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
58
61#include "GNENet.h"
62#include "GNEUndoList.h"
63#include "GNEViewNet.h"
64#include "GNEViewParent.h"
65
66// ===========================================================================
67// FOX callback mapping
68// ===========================================================================
69
87
88// Object implementation
89FXIMPLEMENT(GNEViewParent, GUIGlChildWindow, GNEViewParentMap, ARRAYNUMBER(GNEViewParentMap))
90
91
92// ===========================================================================
93// member method definitions
94// ===========================================================================
95
96GNEViewParent::GNEViewParent(FXMDIClient* p, FXMDIMenu* mdimenu, const FXString& name, GNEApplicationWindow* parentWindow,
97 FXGLCanvas* share, GNENet* net, GNEUndoList* undoList, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
98 GUIGlChildWindow(p, parentWindow, mdimenu, name, parentWindow->getToolbarsGrip().navigation, ic, opts, x, y, w, h),
99 myGNEAppWindows(parentWindow) {
100 // Add child to parent
101 myGUIMainWindowParent->addGLChild(this);
102
103 // Create Vertical separator
104 new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
105
106 // Create undo/redo buttons
107 myUndoButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
108 std::string("\t") + TL("Undo") + std::string("\t") + TL("Undo the last change. (Ctrl+Z)"),
110 myRedoButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
111 std::string("\t") + TL("Redo") + std::string("\t") + TL("Redo the last change. (Ctrl+Y)"),
113
114 // Create Vertical separator
115 new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
116
117 // create compute path manager button
118 myComputePathManagerButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
119 std::string("\t") + TL("Compute path manager") + std::string("\t") + TL("Compute path manager."),
121
122 // Create Frame Splitter
123 myFramesSplitter = new FXSplitter(myChildWindowContentFrame, this, MID_GNE_VIEWPARENT_FRAMEAREAWIDTH, GUIDesignSplitter | SPLITTER_HORIZONTAL);
124
125 // Create frames Area (vertical frame)
126 myFramesArea = new FXVerticalFrame(myFramesSplitter, GUIDesignFrameArea);
127
128 // Create view area
129 myViewArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignViewnArea);
130
131 // Add the view to a temporary parent so that we can add items to myViewArea in the desired order
132 FXComposite* tmp = new FXComposite(this);
133
134 // Create view net
135 GNEViewNet* viewNet = new GNEViewNet(tmp, myViewArea, *myGUIMainWindowParent, this, net, undoList, myGUIMainWindowParent->getGLVisual(), share);
136
137 // show toolbar grips
138 myGNEAppWindows->getToolbarsGrip().buildMenuToolbarsGrip();
139
140 // Set pointer myView with the created view net
141 myView = viewNet;
142
143 // build frames
144 myCommonFrames.buildCommonFrames(this, viewNet);
145 myNetworkFrames.buildNetworkFrames(this, viewNet);
146 myDemandFrames.buildDemandFrames(this, viewNet);
147 myDataFrames.buildDataFrames(this, viewNet);
148
149 // set default frames area width
150 myFramesArea->setWidth(GUIDesignFramesAreaDefaultWidth);
151
152 // Update frame areas after creation
153 onCmdUpdateFrameAreaWidth(nullptr, 0, nullptr);
154
155 // Hide all Frames Area
156 hideFramesArea();
157
158 // Build view toolBars
159 myView->buildViewToolBars(this);
160
161 // create windows
163}
164
165
167 // delete toolbar grips
169 // Remove child before remove
171}
172
173
174void
181
182
189 } else if (myDemandFrames.isDemandFrameShown()) {
191 } else if (myDataFrames.isDataFrameShown()) {
193 } else {
194 return nullptr;
195 }
196}
197
198
203
204
209
210
215
216
221
222
227
228
233
234
239
240
245
246
251
252
257
258
263
264
269
270
275
276
281
282
287
288
293
294
299
300
305
306
311
312
317
318
323
324
329
330
335
336
341
342
347
348
353
354
359
360
365
366
367void
369 const bool frameShown = myCommonFrames.isCommonFrameShown() ||
373 // show and recalc framesArea if at least there is a frame shown
374 if (frameShown) {
375 myFramesArea->recalc();
376 myFramesArea->show();
377 }
378}
379
380
381void
383 const bool frameShown = myCommonFrames.isCommonFrameShown() ||
387 // hide and recalc frames Area if all frames are hidden is enabled
388 if (!frameShown) {
389 myFramesArea->hide();
390 myFramesArea->recalc();
391 }
392}
393
394
399
400
405
406
407void
409 if (chooserDialog == nullptr) {
410 throw ProcessError("ChooserDialog already deleted");
411 } else if (chooserDialog == myACChoosers.ACChooserJunction) {
413 } else if (chooserDialog == myACChoosers.ACChooserEdges) {
415 } else if (chooserDialog == myACChoosers.ACChooserWalkingAreas) {
417 } else if (chooserDialog == myACChoosers.ACChooserVehicles) {
419 } else if (chooserDialog == myACChoosers.ACChooserPersons) {
421 } else if (chooserDialog == myACChoosers.ACChooserContainers) {
423 } else if (chooserDialog == myACChoosers.ACChooserRoutes) {
425 } else if (chooserDialog == myACChoosers.ACChooserStops) {
427 } else if (chooserDialog == myACChoosers.ACChooserTLS) {
428 myACChoosers.ACChooserTLS = nullptr;
429 } else if (chooserDialog == myACChoosers.ACChooserAdditional) {
431 } else if (chooserDialog == myACChoosers.ACChooserPOI) {
432 myACChoosers.ACChooserPOI = nullptr;
433 } else if (chooserDialog == myACChoosers.ACChooserPolygon) {
435 } else if (chooserDialog == myACChoosers.ACChooserProhibition) {
437 } else if (chooserDialog == myACChoosers.ACChooserWire) {
438 myACChoosers.ACChooserWire = nullptr;
439 } else {
440 throw ProcessError("Unregistered chooserDialog");
441 }
442}
443
444
445void
450
451
452FXVerticalFrame*
456
457
458int
460 return myFramesArea->getWidth();
461}
462
463
464void
465GNEViewParent::setFrameAreaWidth(const int frameAreaWith) {
466 myFramesArea->setWidth(frameAreaWith);
468}
469
470
471long
472GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
473 // get the new file name
474 FXFileDialog opendialog(this, TL("Save Snapshot"));
475 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::CAMERA));
476 opendialog.setSelectMode(SELECTFILE_ANY);
477 opendialog.setPatternList(SUMOXMLDefinitions::ImageFileExtensions.getMultilineString().c_str());
478 if (gCurrentFolder.length() != 0) {
479 opendialog.setDirectory(gCurrentFolder);
480 }
481 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
482 return 1;
483 }
484 gCurrentFolder = opendialog.getDirectory();
485 std::string file = opendialog.getFilename().text();
486 if (file.find(".") == std::string::npos) {
487 file.append(".png");
488 WRITE_MESSAGE(TL("No file extension was specified - saving Snapshot as PNG."));
489 }
490 std::string error = myView->makeSnapshot(file);
491 if (error != "") {
492 // open message box
493 FXMessageBox::error(this, MBOX_OK, TL("Saving failed."), "%s", error.c_str());
494 } else {
495 WRITE_MESSAGE(TL("Snapshot successfully saved!"));
496 }
497 return 1;
498}
499
500
501long
502GNEViewParent::onCmdClose(FXObject*, FXSelector /* sel */, void*) {
503 myGUIMainWindowParent->handle(this, FXSEL(SEL_COMMAND, MID_HOTKEY_CTRL_W_CLOSESIMULATION), nullptr);
504 return 1;
505}
506
507
508long
509GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) {
510 GNEViewNet* viewNet = dynamic_cast<GNEViewNet*>(myView);
511 // check that viewNet exist
512 if (viewNet) {
513 // declare a vector in which save attribute carriers to locate
514 std::vector<GNEAttributeCarrier*> ACsToLocate;
515 int messageId = FXSELID(sel);
516 GNEDialogACChooser** chooserLoc = nullptr;
517 std::string locateTitle;
518 switch (messageId) {
520 chooserLoc = &myACChoosers.ACChooserJunction;
521 locateTitle = TL("Junction Chooser");
522 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
523 ACsToLocate.push_back(junction.second);
524 }
525 break;
527 chooserLoc = &myACChoosers.ACChooserEdges;
528 locateTitle = TL("Edge Chooser");
529 for (const auto& edge : viewNet->getNet()->getAttributeCarriers()->getEdges()) {
530 ACsToLocate.push_back(edge.second);
531 }
532 break;
535 locateTitle = TL("WalkingArea Chooser");
536 for (const auto& walkingArea : viewNet->getNet()->getAttributeCarriers()->getWalkingAreas()) {
537 ACsToLocate.push_back(walkingArea.second);
538 }
539 break;
541 chooserLoc = &myACChoosers.ACChooserVehicles;
542 locateTitle = TL("Vehicle Chooser");
543 // fill ACsToLocate with all vehicles
544 for (const auto& vehicleTag : NamespaceIDs::vehicles) {
545 for (const auto& vehicle : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(vehicleTag)) {
546 ACsToLocate.push_back(vehicle.second);
547 }
548 }
549 break;
550 }
552 chooserLoc = &myACChoosers.ACChooserPersons;
553 locateTitle = TL("Person Chooser");
554 // fill ACsToLocate with all persons
555 for (const auto& personTag : NamespaceIDs::persons) {
556 for (const auto& person : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(personTag)) {
557 ACsToLocate.push_back(person.second);
558 }
559 }
560 break;
562 chooserLoc = &myACChoosers.ACChooserContainers;
563 locateTitle = TL("Container Chooser");
564 // fill ACsToLocate with all containers
565 for (const auto& containerTag : NamespaceIDs::containers) {
566 for (const auto& container : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(containerTag)) {
567 ACsToLocate.push_back(container.second);
568 }
569 }
570 break;
572 chooserLoc = &myACChoosers.ACChooserRoutes;
573 locateTitle = TL("Route Chooser");
574 for (const auto& route : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
575 ACsToLocate.push_back(route.second);
576 }
577 break;
579 chooserLoc = &myACChoosers.ACChooserStops;
580 locateTitle = TL("Stop Chooser");
581 // fill ACsToLocate with all vehicles
582 for (const auto& stopTag : NamespaceIDs::stops) {
583 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(stopTag)) {
584 ACsToLocate.push_back(flowTAZ.second);
585 }
586 }
587 break;
588 }
590 chooserLoc = &myACChoosers.ACChooserTLS;
591 locateTitle = TL("TLS Chooser");
592 // fill ACsToLocate with junctions that haven TLS
593 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
594 if (junction.second->getNBNode()->getControllingTLS().size() > 0) {
595 ACsToLocate.push_back(junction.second);
596 }
597 }
598 break;
600 chooserLoc = &myACChoosers.ACChooserAdditional;
601 locateTitle = TL("Additional Chooser");
602 for (const auto& additionalTag : viewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
603 const auto tagProperty = viewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionalTag.first, true);
604 // avoid shapes and TAZs
605 if (!tagProperty->isShapeElement() && !tagProperty->isTAZElement()) {
606 for (const auto& additional : additionalTag.second) {
607 ACsToLocate.push_back(additional.second);
608 }
609 }
610 }
611 break;
613 chooserLoc = &myACChoosers.ACChooserPOI;
614 locateTitle = TL("POI Chooser");
615 // fill ACsToLocate with all POIs
616 for (const auto& POITag : NamespaceIDs::POIs) {
617 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(POITag)) {
618 ACsToLocate.push_back(flowTAZ.second);
619 }
620 }
621 break;
623 chooserLoc = &myACChoosers.ACChooserPolygon;
624 locateTitle = TL("Poly Chooser");
625 // fill ACsToLocate with all polygons
626 for (const auto& polygonTag : NamespaceIDs::polygons) {
627 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(polygonTag)) {
628 ACsToLocate.push_back(flowTAZ.second);
629 }
630 }
631 break;
632 default:
633 throw ProcessError("Unknown Message ID in onCmdLocate");
634 }
635 if (*chooserLoc) {
636 // restore focus in the existent chooser dialog
637 GNEDialogACChooser* chooser = *chooserLoc;
638 chooser->restore();
639 chooser->setFocus();
640 chooser->raise();
641 } else {
642 GNEDialogACChooser* chooser = new GNEDialogACChooser(this, messageId, GUIIconSubSys::getIcon(GUIIcon::LOCATEJUNCTION), locateTitle, ACsToLocate);
643 *chooserLoc = chooser;
644 }
645 // update locator popup
646 myLocatorPopup->popdown();
647 myLocatorButton->killFocus();
648 myLocatorPopup->update();
649 }
650 return 1;
651}
652
653
654long
655GNEViewParent::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
656 myView->onKeyPress(o, sel, eventData);
657 return 0;
658}
659
660
661long
662GNEViewParent::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
663 myView->onKeyRelease(o, sel, eventData);
664 return 0;
665}
666
667
668long
669GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) {
670 const int framesAreaWidth = myFramesArea->getWidth();
671 // set width of FramesArea in all frames
672 myCommonFrames.setCommonFramesWidth(framesAreaWidth);
673 myNetworkFrames.setNetworkFramesWidth(framesAreaWidth);
674 myDemandFrames.setDemandFramesWidth(framesAreaWidth);
675 myDataFrames.setDataFramesWidth(framesAreaWidth);
676 return 0;
677}
678
679// ---------------------------------------------------------------------------
680// GNEViewParent::CommonFrames - methods
681// ---------------------------------------------------------------------------
682
685
686
687void
689 inspectorFrame = new GNEInspectorFrame(viewParent, viewNet);
690 selectorFrame = new GNESelectorFrame(viewParent, viewNet);
691 moveFrame = new GNEMoveFrame(viewParent, viewNet);
692 deleteFrame = new GNEDeleteFrame(viewParent, viewNet);
693}
694
695
696void
698 inspectorFrame->hide();
699 deleteFrame->hide();
700 selectorFrame->hide();
701 moveFrame->hide();
702}
703
704
705void
707 // set width in all frames
708 inspectorFrame->setFrameWidth(frameWidth);
709 deleteFrame->setFrameWidth(frameWidth);
710 selectorFrame->setFrameWidth(frameWidth);
711 moveFrame->setFrameWidth(frameWidth);
712}
713
714
715bool
717 // check all frames
718 if (inspectorFrame->shown()) {
719 return true;
720 } else if (deleteFrame->shown()) {
721 return true;
722 } else if (selectorFrame->shown()) {
723 return true;
724 } else if (moveFrame->shown()) {
725 return true;
726 } else {
727 return false;
728 }
729}
730
731
734 // check all frames
735 if (inspectorFrame->shown()) {
736 return inspectorFrame;
737 } else if (deleteFrame->shown()) {
738 return deleteFrame;
739 } else if (selectorFrame->shown()) {
740 return selectorFrame;
741 } else if (moveFrame->shown()) {
742 return moveFrame;
743 } else {
744 return nullptr;
745 }
746}
747
748// ---------------------------------------------------------------------------
749// GNEViewParent::NetworkFrames - methods
750// ---------------------------------------------------------------------------
751
753
754
755void
757 connectorFrame = new GNEConnectorFrame(viewParent, viewNet);
758 TLSEditorFrame = new GNETLSEditorFrame(viewParent, viewNet);
759 additionalFrame = new GNEAdditionalFrame(viewParent, viewNet);
760 crossingFrame = new GNECrossingFrame(viewParent, viewNet);
761 TAZFrame = new GNETAZFrame(viewParent, viewNet);
762 polygonFrame = new GNEShapeFrame(viewParent, viewNet);
763 prohibitionFrame = new GNEProhibitionFrame(viewParent, viewNet);
764 wireFrame = new GNEWireFrame(viewParent, viewNet);
765 decalFrame = new GNEDecalFrame(viewParent, viewNet);
766 createEdgeFrame = new GNECreateEdgeFrame(viewParent, viewNet);
767}
768
769
770void
772 connectorFrame->hide();
773 TLSEditorFrame->hide();
774 additionalFrame->hide();
775 crossingFrame->hide();
776 TAZFrame->hide();
777 polygonFrame->hide();
778 prohibitionFrame->hide();
779 wireFrame->hide();
780 decalFrame->hide();
781 createEdgeFrame->hide();
782}
783
784
785void
787 // set width in all frames
788 connectorFrame->setFrameWidth(frameWidth);
789 TLSEditorFrame->setFrameWidth(frameWidth);
790 additionalFrame->setFrameWidth(frameWidth);
791 crossingFrame->setFrameWidth(frameWidth);
792 TAZFrame->setFrameWidth(frameWidth);
793 polygonFrame->setFrameWidth(frameWidth);
794 prohibitionFrame->setFrameWidth(frameWidth);
795 wireFrame->setFrameWidth(frameWidth);
796 decalFrame->setFrameWidth(frameWidth);
797 createEdgeFrame->setFrameWidth(frameWidth);
798}
799
800
801bool
803 // check all frames
804 if (connectorFrame->shown()) {
805 return true;
806 } else if (TLSEditorFrame->shown()) {
807 return true;
808 } else if (additionalFrame->shown()) {
809 return true;
810 } else if (crossingFrame->shown()) {
811 return true;
812 } else if (TAZFrame->shown()) {
813 return true;
814 } else if (polygonFrame->shown()) {
815 return true;
816 } else if (prohibitionFrame->shown()) {
817 return true;
818 } else if (wireFrame->shown()) {
819 return true;
820 } else if (decalFrame->shown()) {
821 return true;
822 } else if (createEdgeFrame->shown()) {
823 return true;
824 } else {
825 return false;
826 }
827}
828
829
832 // check all frames
833 if (connectorFrame->shown()) {
834 return connectorFrame;
835 } else if (TLSEditorFrame->shown()) {
836 return TLSEditorFrame;
837 } else if (additionalFrame->shown()) {
838 return additionalFrame;
839 } else if (crossingFrame->shown()) {
840 return crossingFrame;
841 } else if (TAZFrame->shown()) {
842 return TAZFrame;
843 } else if (polygonFrame->shown()) {
844 return polygonFrame;
845 } else if (prohibitionFrame->shown()) {
846 return prohibitionFrame;
847 } else if (wireFrame->shown()) {
848 return wireFrame;
849 } else if (decalFrame->shown()) {
850 return decalFrame;
851 } else if (createEdgeFrame->shown()) {
852 return createEdgeFrame;
853 } else {
854 return nullptr;
855 }
856}
857
858// ---------------------------------------------------------------------------
859// GNEViewParent::DemandFrames - methods
860// ---------------------------------------------------------------------------
861
864
865
866void
868 routeFrame = new GNERouteFrame(viewParent, viewNet);
869 routeDistributionFrame = new GNERouteDistributionFrame(viewParent, viewNet);
870 vehicleFrame = new GNEVehicleFrame(viewParent, viewNet);
871 typeFrame = new GNETypeFrame(viewParent, viewNet);
872 typeDistributionFrame = new GNETypeDistributionFrame(viewParent, viewNet);
873 stopFrame = new GNEStopFrame(viewParent, viewNet);
874 personFrame = new GNEPersonFrame(viewParent, viewNet);
875 personPlanFrame = new GNEPersonPlanFrame(viewParent, viewNet);
876 containerFrame = new GNEContainerFrame(viewParent, viewNet);
877 containerPlanFrame = new GNEContainerPlanFrame(viewParent, viewNet);
878}
879
880
881void
883 routeFrame->hide();
884 routeDistributionFrame->hide();
885 vehicleFrame->hide();
886 typeFrame->hide();
887 typeDistributionFrame->hide();
888 stopFrame->hide();
889 personFrame->hide();
890 personPlanFrame->hide();
891 containerFrame->hide();
892 containerPlanFrame->hide();
893}
894
895
896void
898 // set width in all frames
899 routeFrame->setFrameWidth(frameWidth);
900 routeDistributionFrame->setFrameWidth(frameWidth);
901 vehicleFrame->setFrameWidth(frameWidth);
902 typeFrame->setFrameWidth(frameWidth);
903 typeDistributionFrame->setFrameWidth(frameWidth);
904 stopFrame->setFrameWidth(frameWidth);
905 personFrame->setFrameWidth(frameWidth);
906 personPlanFrame->setFrameWidth(frameWidth);
907 containerFrame->setFrameWidth(frameWidth);
908 containerPlanFrame->setFrameWidth(frameWidth);
909}
910
911
912bool
914 // check all frames
915 if (routeFrame->shown()) {
916 return true;
917 } else if (routeDistributionFrame->shown()) {
918 return true;
919 } else if (vehicleFrame->shown()) {
920 return true;
921 } else if (typeFrame->shown()) {
922 return true;
923 } else if (typeDistributionFrame->shown()) {
924 return true;
925 } else if (stopFrame->shown()) {
926 return true;
927 } else if (personFrame->shown()) {
928 return true;
929 } else if (personPlanFrame->shown()) {
930 return true;
931 } else if (containerFrame->shown()) {
932 return true;
933 } else if (containerPlanFrame->shown()) {
934 return true;
935 } else {
936 return false;
937 }
938}
939
940
943 // check all frames
944 if (routeFrame->shown()) {
945 return routeFrame;
946 } else if (routeDistributionFrame->shown()) {
947 return routeDistributionFrame;
948 } else if (vehicleFrame->shown()) {
949 return vehicleFrame;
950 } else if (typeFrame->shown()) {
951 return typeFrame;
952 } else if (typeDistributionFrame->shown()) {
953 return typeDistributionFrame;
954 } else if (stopFrame->shown()) {
955 return stopFrame;
956 } else if (personFrame->shown()) {
957 return personFrame;
958 } else if (personPlanFrame->shown()) {
959 return personPlanFrame;
960 } else if (containerFrame->shown()) {
961 return containerFrame;
962 } else if (containerPlanFrame->shown()) {
963 return containerPlanFrame;
964 } else {
965 return nullptr;
966 }
967}
968
969// ---------------------------------------------------------------------------
970// GNEViewParent::DataFrames - methods
971// ---------------------------------------------------------------------------
972
975
976
977void
979 edgeDataFrame = new GNEEdgeDataFrame(viewParent, viewNet);
980 edgeRelDataFrame = new GNEEdgeRelDataFrame(viewParent, viewNet);
981 TAZRelDataFrame = new GNETAZRelDataFrame(viewParent, viewNet);
982 meanDataFrame = new GNEMeanDataFrame(viewParent, viewNet);
983}
984
985
986void
988 edgeDataFrame->hide();
989 edgeRelDataFrame->hide();
990 TAZRelDataFrame->hide();
991 meanDataFrame->hide();
992}
993
994
995void
997 // set width in all frames
998 edgeDataFrame->setFrameWidth(frameWidth);
999 edgeRelDataFrame->setFrameWidth(frameWidth);
1000 TAZRelDataFrame->setFrameWidth(frameWidth);
1001 meanDataFrame->setFrameWidth(frameWidth);
1002}
1003
1004
1005bool
1007 // check all frames
1008 if (edgeDataFrame->shown()) {
1009 return true;
1010 } else if (edgeRelDataFrame->shown()) {
1011 return true;
1012 } else if (TAZRelDataFrame->shown()) {
1013 return true;
1014 } else if (meanDataFrame->shown()) {
1015 return true;
1016 } else {
1017 return false;
1018 }
1019}
1020
1021
1022GNEFrame*
1024 // check all frames
1025 if (edgeDataFrame->shown()) {
1026 return edgeDataFrame;
1027 } else if (edgeRelDataFrame->shown()) {
1028 return edgeRelDataFrame;
1029 } else if (TAZRelDataFrame->shown()) {
1030 return TAZRelDataFrame;
1031 } else if (meanDataFrame->shown()) {
1032 return meanDataFrame;
1033 } else {
1034 return nullptr;
1035 }
1036}
1037
1038// ---------------------------------------------------------------------------
1039// GNEViewParent::ACChoosers - methods
1040// ---------------------------------------------------------------------------
1041
1044
1045
1047 // remove all dialogs if are active
1048 if (ACChooserJunction) {
1049 delete ACChooserJunction;
1050 }
1051 if (ACChooserEdges) {
1052 delete ACChooserEdges;
1053 }
1054 if (ACChooserWalkingAreas) {
1055 delete ACChooserWalkingAreas;
1056 }
1057 if (ACChooserRoutes) {
1058 delete ACChooserRoutes;
1059 }
1060 if (ACChooserStops) {
1061 delete ACChooserStops;
1062 }
1063 if (ACChooserVehicles) {
1064 delete ACChooserVehicles;
1065 }
1066 if (ACChooserPersons) {
1067 delete ACChooserPersons;
1068 }
1069 if (ACChooserContainers) {
1070 delete ACChooserContainers;
1071 }
1072 if (ACChooserTLS) {
1073 delete ACChooserTLS;
1074 }
1075 if (ACChooserAdditional) {
1076 delete ACChooserAdditional;
1077 }
1078 if (ACChooserPOI) {
1079 delete ACChooserPOI;
1080 }
1081 if (ACChooserPolygon) {
1082 delete ACChooserPolygon;
1083 }
1084 if (ACChooserProhibition) {
1085 delete ACChooserProhibition;
1086 }
1087 if (ACChooserWire) {
1088 delete ACChooserWire;
1089 }
1090}
1091
1092
1093/****************************************************************************/
FXDEFMAP(GNEViewParent) GNEViewParentMap[]
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition GUIAppEnum.h:389
@ 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:809
@ 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:793
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:123
#define GUIDesignFrameArea
Definition GUIDesigns.h:369
#define GUIDesignVerticalSeparator
vertical separator
Definition GUIDesigns.h:466
#define GUIDesignSplitter
Definition GUIDesigns.h:474
#define GUIDesignViewnArea
design for view area
Definition GUIDesigns.h:372
#define GUIDesignFramesAreaDefaultWidth
define the default frames area width
Definition GUIDesigns.h:38
FXString gCurrentFolder
The folder used as last.
@ COMPUTEPATHMANAGER
@ LOCATEJUNCTION
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:289
#define TL(string)
Definition MsgHandler.h:305
@ 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:146
const GNETagPropertiesDatabase * getTagPropertiesDatabase() const
get tag properties database
Definition GNENet.cpp:140
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
GNEDialogACChooser * ACChooserWalkingAreas
pointer to ACChooser dialog used for locate walkingareas
GNEDialogACChooser * ACChooserStops
pointer to ACChooser dialog used for locate stops
GNEDialogACChooser * ACChooserEdges
pointer to ACChooser dialog used for locate edges
GNEDialogACChooser * ACChooserPolygon
pointer to ACChooser dialog used for locate Polygons
GNEDialogACChooser * ACChooserPOI
pointer to ACChooser dialog used for locate POIs
GNEDialogACChooser * ACChooserContainers
pointer to ACChooser dialog used for locate containers
GNEDialogACChooser * ACChooserRoutes
pointer to ACChooser dialog used for locate routes
GNEDialogACChooser * ACChooserJunction
pointer to ACChooser dialog used for locate junctions
GNEDialogACChooser * ACChooserWire
pointer to ACChooser dialog used for locate Wires
GNEDialogACChooser * ACChooserVehicles
pointer to ACChooser dialog used for locate vehicles
GNEDialogACChooser * ACChooserTLS
pointer to ACChooser dialog used for locate TLSs
GNEDialogACChooser * ACChooserProhibition
pointer to ACChooser dialog used for locate Prohibitions
GNEDialogACChooser * ACChooserPersons
pointer to ACChooser dialog used for locate persons
GNEDialogACChooser * ACChooserAdditional
pointer to ACChooser dialog used for locate additional
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
void eraseACChooserDialog(GNEDialogACChooser *chooserDialog)
remove created chooser dialog
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
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