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-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
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
57
59#include "GNEViewNet.h"
60#include "GNENet.h"
61#include "GNEViewParent.h"
62#include "GNEUndoList.h"
63
64
65// ===========================================================================
66// FOX callback mapping
67// ===========================================================================
68
86
87// Object implementation
88FXIMPLEMENT(GNEViewParent, GUIGlChildWindow, GNEViewParentMap, ARRAYNUMBER(GNEViewParentMap))
89
90
91// ===========================================================================
92// member method definitions
93// ===========================================================================
94
95GNEViewParent::GNEViewParent(FXMDIClient* p, FXMDIMenu* mdimenu, const FXString& name, GNEApplicationWindow* parentWindow,
96 FXGLCanvas* share, GNENet* net, GNEUndoList* undoList, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
97 GUIGlChildWindow(p, parentWindow, mdimenu, name, parentWindow->getToolbarsGrip().navigation, ic, opts, x, y, w, h),
98 myGNEAppWindows(parentWindow) {
99 // Add child to parent
100 myGUIMainWindowParent->addGLChild(this);
101
102 // Create Vertical separator
103 new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
104
105 // Create undo/redo buttons
106 myUndoButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
107 std::string("\t") + TL("Undo") + std::string("\t") + TL("Undo the last change. (Ctrl+Z)"),
109 myRedoButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
110 std::string("\t") + TL("Redo") + std::string("\t") + TL("Redo the last change. (Ctrl+Y)"),
112
113 // Create Vertical separator
114 new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
115
116 // create compute path manager button
117 myComputePathManagerButton = new MFXButtonTooltip(myGripNavigationToolbar, myGNEAppWindows->getStaticTooltipMenu(),
118 std::string("\t") + TL("Compute path manager") + std::string("\t") + TL("Compute path manager."),
120
121 // Create Frame Splitter
122 myFramesSplitter = new FXSplitter(myChildWindowContentFrame, this, MID_GNE_VIEWPARENT_FRAMEAREAWIDTH, GUIDesignSplitter | SPLITTER_HORIZONTAL);
123
124 // Create frames Area (vertical frame)
125 myFramesArea = new FXVerticalFrame(myFramesSplitter, GUIDesignFrameArea);
126
127 // Create view area
128 myViewArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignViewnArea);
129
130 // Add the view to a temporary parent so that we can add items to myViewArea in the desired order
131 FXComposite* tmp = new FXComposite(this);
132
133 // Create view net
134 GNEViewNet* viewNet = new GNEViewNet(tmp, myViewArea, *myGUIMainWindowParent, this, net, undoList, myGUIMainWindowParent->getGLVisual(), share);
135
136 // show toolbar grips
137 myGNEAppWindows->getToolbarsGrip().buildMenuToolbarsGrip();
138
139 // Set pointer myView with the created view net
140 myView = viewNet;
141
142 // build frames
143 myCommonFrames.buildCommonFrames(this, viewNet);
144 myNetworkFrames.buildNetworkFrames(this, viewNet);
145 myDemandFrames.buildDemandFrames(this, viewNet);
146 myDataFrames.buildDataFrames(this, viewNet);
147
148 // set default frames area width
149 myFramesArea->setWidth(GUIDesignFramesAreaDefaultWidth);
150
151 // Update frame areas after creation
152 onCmdUpdateFrameAreaWidth(nullptr, 0, nullptr);
153
154 // Hide all Frames Area
155 hideFramesArea();
156
157 // Build view toolBars
158 myView->buildViewToolBars(this);
159
160 // create windows
162}
163
164
166 // delete toolbar grips
168 // Remove child before remove
170}
171
172
173void
180
181
188 } else if (myDemandFrames.isDemandFrameShown()) {
190 } else if (myDataFrames.isDataFrameShown()) {
192 } else {
193 return nullptr;
194 }
195}
196
197
202
203
208
209
214
215
220
221
226
227
232
233
238
239
244
245
250
251
256
257
262
263
268
269
274
275
280
281
286
287
292
293
298
299
304
305
310
311
316
317
322
323
328
329
334
335
340
341
346
347
352
353
358
359
364
365
366void
368 const bool frameShown = myCommonFrames.isCommonFrameShown() ||
372 // show and recalc framesArea if at least there is a frame shown
373 if (frameShown) {
374 myFramesArea->recalc();
375 myFramesArea->show();
376 }
377}
378
379
380void
382 const bool frameShown = myCommonFrames.isCommonFrameShown() ||
386 // hide and recalc frames Area if all frames are hidden is enabled
387 if (!frameShown) {
388 myFramesArea->hide();
389 myFramesArea->recalc();
390 }
391}
392
393
398
399
404
405
406void
408 if (chooserDialog == nullptr) {
409 throw ProcessError("ChooserDialog already deleted");
410 } else if (chooserDialog == myACChoosers.ACChooserJunction) {
412 } else if (chooserDialog == myACChoosers.ACChooserEdges) {
414 } else if (chooserDialog == myACChoosers.ACChooserWalkingAreas) {
416 } else if (chooserDialog == myACChoosers.ACChooserVehicles) {
418 } else if (chooserDialog == myACChoosers.ACChooserPersons) {
420 } else if (chooserDialog == myACChoosers.ACChooserContainers) {
422 } else if (chooserDialog == myACChoosers.ACChooserRoutes) {
424 } else if (chooserDialog == myACChoosers.ACChooserStops) {
426 } else if (chooserDialog == myACChoosers.ACChooserTLS) {
427 myACChoosers.ACChooserTLS = nullptr;
428 } else if (chooserDialog == myACChoosers.ACChooserAdditional) {
430 } else if (chooserDialog == myACChoosers.ACChooserPOI) {
431 myACChoosers.ACChooserPOI = nullptr;
432 } else if (chooserDialog == myACChoosers.ACChooserPolygon) {
434 } else if (chooserDialog == myACChoosers.ACChooserProhibition) {
436 } else if (chooserDialog == myACChoosers.ACChooserWire) {
437 myACChoosers.ACChooserWire = nullptr;
438 } else {
439 throw ProcessError("Unregistered chooserDialog");
440 }
441}
442
443
444void
449
450
451FXVerticalFrame*
455
456
457int
459 return myFramesArea->getWidth();
460}
461
462
463void
464GNEViewParent::setFrameAreaWidth(const int frameAreaWith) {
465 myFramesArea->setWidth(frameAreaWith);
467}
468
469
470long
471GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
472 // get the new file name
473 FXFileDialog opendialog(this, TL("Save Snapshot"));
474 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::CAMERA));
475 opendialog.setSelectMode(SELECTFILE_ANY);
476 opendialog.setPatternList("All Image Files (*.gif, *.bmp, *.xpm, *.pcx, *.ico, *.rgb, *.xbm, *.tga, *.png, *.jpg, *.jpeg, *.tif, *.tiff, *.ps, *.eps, *.pdf, *.svg, *.tex, *.pgf)\n"
477 "GIF Image (*.gif)\nBMP Image (*.bmp)\nXPM Image (*.xpm)\nPCX Image (*.pcx)\nICO Image (*.ico)\n"
478 "RGB Image (*.rgb)\nXBM Image (*.xbm)\nTARGA Image (*.tga)\nPNG Image (*.png)\n"
479 "JPEG Image (*.jpg, *.jpeg)\nTIFF Image (*.tif, *.tiff)\n"
480 "Postscript (*.ps)\nEncapsulated Postscript (*.eps)\nPortable Document Format (*.pdf)\n"
481 "Scalable Vector Graphics (*.svg)\nLATEX text strings (*.tex)\nPortable LaTeX Graphics (*.pgf)\n"
482 "All Files (*)");
483 if (gCurrentFolder.length() != 0) {
484 opendialog.setDirectory(gCurrentFolder);
485 }
486 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
487 return 1;
488 }
489 gCurrentFolder = opendialog.getDirectory();
490 std::string file = opendialog.getFilename().text();
491 if (file.find(".") == std::string::npos) {
492 file.append(".png");
493 WRITE_MESSAGE(TL("No file extension was specified - saving Snapshot as PNG."));
494 }
495 std::string error = myView->makeSnapshot(file);
496 if (error != "") {
497 // write warning if netedit is running in testing mode
498 WRITE_DEBUG("Opening FXMessageBox 'error saving snapshot'");
499 // open message box
500 FXMessageBox::error(this, MBOX_OK, TL("Saving failed."), "%s", error.c_str());
501 // write warning if netedit is running in testing mode
502 WRITE_DEBUG("Closed FXMessageBox 'error saving snapshot' with 'OK'");
503 } else {
504 WRITE_MESSAGE(TL("Snapshot successfully saved!"));
505 }
506 return 1;
507}
508
509
510long
511GNEViewParent::onCmdClose(FXObject*, FXSelector /* sel */, void*) {
512 myGUIMainWindowParent->handle(this, FXSEL(SEL_COMMAND, MID_HOTKEY_CTRL_W_CLOSESIMULATION), nullptr);
513 return 1;
514}
515
516
517long
518GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) {
519 GNEViewNet* viewNet = dynamic_cast<GNEViewNet*>(myView);
520 // check that viewNet exist
521 if (viewNet) {
522 // declare a vector in which save attribute carriers to locate
523 std::vector<GNEAttributeCarrier*> ACsToLocate;
524 int messageId = FXSELID(sel);
525 GNEDialogACChooser** chooserLoc = nullptr;
526 std::string locateTitle;
527 switch (messageId) {
529 chooserLoc = &myACChoosers.ACChooserJunction;
530 locateTitle = TL("Junction Chooser");
531 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
532 ACsToLocate.push_back(junction.second);
533 }
534 break;
536 chooserLoc = &myACChoosers.ACChooserEdges;
537 locateTitle = TL("Edge Chooser");
538 for (const auto& edge : viewNet->getNet()->getAttributeCarriers()->getEdges()) {
539 ACsToLocate.push_back(edge.second);
540 }
541 break;
544 locateTitle = TL("WalkingArea Chooser");
545 for (const auto& walkingArea : viewNet->getNet()->getAttributeCarriers()->getWalkingAreas()) {
546 ACsToLocate.push_back(walkingArea.second);
547 }
548 break;
550 chooserLoc = &myACChoosers.ACChooserVehicles;
551 locateTitle = TL("Vehicle Chooser");
552 // fill ACsToLocate with all vehicles
553 for (const auto& vehicleTag : NamespaceIDs::vehicles) {
554 for (const auto& vehicle : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(vehicleTag)) {
555 ACsToLocate.push_back(vehicle.second);
556 }
557 }
558 break;
559 }
561 chooserLoc = &myACChoosers.ACChooserPersons;
562 locateTitle = TL("Person Chooser");
563 // fill ACsToLocate with all persons
564 for (const auto& personTag : NamespaceIDs::persons) {
565 for (const auto& person : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(personTag)) {
566 ACsToLocate.push_back(person.second);
567 }
568 }
569 break;
571 chooserLoc = &myACChoosers.ACChooserContainers;
572 locateTitle = TL("Container Chooser");
573 // fill ACsToLocate with all containers
574 for (const auto& containerTag : NamespaceIDs::containers) {
575 for (const auto& container : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(containerTag)) {
576 ACsToLocate.push_back(container.second);
577 }
578 }
579 break;
581 chooserLoc = &myACChoosers.ACChooserRoutes;
582 locateTitle = TL("Route Chooser");
583 for (const auto& route : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
584 ACsToLocate.push_back(route.second);
585 }
586 break;
588 chooserLoc = &myACChoosers.ACChooserStops;
589 locateTitle = TL("Stop Chooser");
590 // fill ACsToLocate with all vehicles
591 for (const auto& stopTag : NamespaceIDs::stops) {
592 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(stopTag)) {
593 ACsToLocate.push_back(flowTAZ.second);
594 }
595 }
596 break;
597 }
599 chooserLoc = &myACChoosers.ACChooserTLS;
600 locateTitle = TL("TLS Chooser");
601 // fill ACsToLocate with junctions that haven TLS
602 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
603 if (junction.second->getNBNode()->getControllingTLS().size() > 0) {
604 ACsToLocate.push_back(junction.second);
605 }
606 }
607 break;
609 chooserLoc = &myACChoosers.ACChooserAdditional;
610 locateTitle = TL("Additional Chooser");
611 for (const auto& additionalTag : viewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
612 // avoid shapes and TAZs
613 if (!GNEAttributeCarrier::getTagProperty(additionalTag.first).isShapeElement() &&
614 !GNEAttributeCarrier::getTagProperty(additionalTag.first).isTAZElement()) {
615 for (const auto& additional : additionalTag.second) {
616 ACsToLocate.push_back(additional.second);
617 }
618 }
619 }
620 break;
622 chooserLoc = &myACChoosers.ACChooserPOI;
623 locateTitle = TL("POI Chooser");
624 // fill ACsToLocate with all POIs
625 for (const auto& POITag : NamespaceIDs::POIs) {
626 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(POITag)) {
627 ACsToLocate.push_back(flowTAZ.second);
628 }
629 }
630 break;
632 chooserLoc = &myACChoosers.ACChooserPolygon;
633 locateTitle = TL("Poly Chooser");
634 // fill ACsToLocate with all polygons
635 for (const auto& polygonTag : NamespaceIDs::polygons) {
636 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(polygonTag)) {
637 ACsToLocate.push_back(flowTAZ.second);
638 }
639 }
640 break;
641 default:
642 throw ProcessError("Unknown Message ID in onCmdLocate");
643 }
644 if (*chooserLoc) {
645 // restore focus in the existent chooser dialog
646 GNEDialogACChooser* chooser = *chooserLoc;
647 chooser->restore();
648 chooser->setFocus();
649 chooser->raise();
650 } else {
651 GNEDialogACChooser* chooser = new GNEDialogACChooser(this, messageId, GUIIconSubSys::getIcon(GUIIcon::LOCATEJUNCTION), locateTitle, ACsToLocate);
652 *chooserLoc = chooser;
653 }
654 // update locator popup
655 myLocatorPopup->popdown();
656 myLocatorButton->killFocus();
657 myLocatorPopup->update();
658 }
659 return 1;
660}
661
662
663long
664GNEViewParent::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
665 myView->onKeyPress(o, sel, eventData);
666 return 0;
667}
668
669
670long
671GNEViewParent::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
672 myView->onKeyRelease(o, sel, eventData);
673 return 0;
674}
675
676
677long
678GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) {
679 const int framesAreaWidth = myFramesArea->getWidth();
680 // set width of FramesArea in all frames
681 myCommonFrames.setCommonFramesWidth(framesAreaWidth);
682 myNetworkFrames.setNetworkFramesWidth(framesAreaWidth);
683 myDemandFrames.setDemandFramesWidth(framesAreaWidth);
684 myDataFrames.setDataFramesWidth(framesAreaWidth);
685 return 0;
686}
687
688// ---------------------------------------------------------------------------
689// GNEViewParent::CommonFrames - methods
690// ---------------------------------------------------------------------------
691
694
695
696void
698 inspectorFrame = new GNEInspectorFrame(viewParent, viewNet);
699 selectorFrame = new GNESelectorFrame(viewParent, viewNet);
700 moveFrame = new GNEMoveFrame(viewParent, viewNet);
701 deleteFrame = new GNEDeleteFrame(viewParent, viewNet);
702}
703
704
705void
707 inspectorFrame->hide();
708 deleteFrame->hide();
709 selectorFrame->hide();
710 moveFrame->hide();
711}
712
713
714void
716 // set width in all frames
717 inspectorFrame->setFrameWidth(frameWidth);
718 deleteFrame->setFrameWidth(frameWidth);
719 selectorFrame->setFrameWidth(frameWidth);
720 moveFrame->setFrameWidth(frameWidth);
721}
722
723
724bool
726 // check all frames
727 if (inspectorFrame->shown()) {
728 return true;
729 } else if (deleteFrame->shown()) {
730 return true;
731 } else if (selectorFrame->shown()) {
732 return true;
733 } else if (moveFrame->shown()) {
734 return true;
735 } else {
736 return false;
737 }
738}
739
740
743 // check all frames
744 if (inspectorFrame->shown()) {
745 return inspectorFrame;
746 } else if (deleteFrame->shown()) {
747 return deleteFrame;
748 } else if (selectorFrame->shown()) {
749 return selectorFrame;
750 } else if (moveFrame->shown()) {
751 return moveFrame;
752 } else {
753 return nullptr;
754 }
755}
756
757// ---------------------------------------------------------------------------
758// GNEViewParent::NetworkFrames - methods
759// ---------------------------------------------------------------------------
760
762
763
764void
766 connectorFrame = new GNEConnectorFrame(viewParent, viewNet);
767 TLSEditorFrame = new GNETLSEditorFrame(viewParent, viewNet);
768 additionalFrame = new GNEAdditionalFrame(viewParent, viewNet);
769 crossingFrame = new GNECrossingFrame(viewParent, viewNet);
770 TAZFrame = new GNETAZFrame(viewParent, viewNet);
771 polygonFrame = new GNEShapeFrame(viewParent, viewNet);
772 prohibitionFrame = new GNEProhibitionFrame(viewParent, viewNet);
773 wireFrame = new GNEWireFrame(viewParent, viewNet);
774 decalFrame = new GNEDecalFrame(viewParent, viewNet);
775 createEdgeFrame = new GNECreateEdgeFrame(viewParent, viewNet);
776}
777
778
779void
781 connectorFrame->hide();
782 TLSEditorFrame->hide();
783 additionalFrame->hide();
784 crossingFrame->hide();
785 TAZFrame->hide();
786 polygonFrame->hide();
787 prohibitionFrame->hide();
788 wireFrame->hide();
789 decalFrame->hide();
790 createEdgeFrame->hide();
791}
792
793
794void
796 // set width in all frames
797 connectorFrame->setFrameWidth(frameWidth);
798 TLSEditorFrame->setFrameWidth(frameWidth);
799 additionalFrame->setFrameWidth(frameWidth);
800 crossingFrame->setFrameWidth(frameWidth);
801 TAZFrame->setFrameWidth(frameWidth);
802 polygonFrame->setFrameWidth(frameWidth);
803 prohibitionFrame->setFrameWidth(frameWidth);
804 wireFrame->setFrameWidth(frameWidth);
805 decalFrame->setFrameWidth(frameWidth);
806 createEdgeFrame->setFrameWidth(frameWidth);
807}
808
809
810bool
812 // check all frames
813 if (connectorFrame->shown()) {
814 return true;
815 } else if (TLSEditorFrame->shown()) {
816 return true;
817 } else if (additionalFrame->shown()) {
818 return true;
819 } else if (crossingFrame->shown()) {
820 return true;
821 } else if (TAZFrame->shown()) {
822 return true;
823 } else if (polygonFrame->shown()) {
824 return true;
825 } else if (prohibitionFrame->shown()) {
826 return true;
827 } else if (wireFrame->shown()) {
828 return true;
829 } else if (decalFrame->shown()) {
830 return true;
831 } else if (createEdgeFrame->shown()) {
832 return true;
833 } else {
834 return false;
835 }
836}
837
838
841 // check all frames
842 if (connectorFrame->shown()) {
843 return connectorFrame;
844 } else if (TLSEditorFrame->shown()) {
845 return TLSEditorFrame;
846 } else if (additionalFrame->shown()) {
847 return additionalFrame;
848 } else if (crossingFrame->shown()) {
849 return crossingFrame;
850 } else if (TAZFrame->shown()) {
851 return TAZFrame;
852 } else if (polygonFrame->shown()) {
853 return polygonFrame;
854 } else if (prohibitionFrame->shown()) {
855 return prohibitionFrame;
856 } else if (wireFrame->shown()) {
857 return wireFrame;
858 } else if (decalFrame->shown()) {
859 return decalFrame;
860 } else if (createEdgeFrame->shown()) {
861 return createEdgeFrame;
862 } else {
863 return nullptr;
864 }
865}
866
867// ---------------------------------------------------------------------------
868// GNEViewParent::DemandFrames - methods
869// ---------------------------------------------------------------------------
870
873
874
875void
877 routeFrame = new GNERouteFrame(viewParent, viewNet);
878 routeDistributionFrame = new GNERouteDistributionFrame(viewParent, viewNet);
879 vehicleFrame = new GNEVehicleFrame(viewParent, viewNet);
880 typeFrame = new GNETypeFrame(viewParent, viewNet);
881 typeDistributionFrame = new GNETypeDistributionFrame(viewParent, viewNet);
882 stopFrame = new GNEStopFrame(viewParent, viewNet);
883 personFrame = new GNEPersonFrame(viewParent, viewNet);
884 personPlanFrame = new GNEPersonPlanFrame(viewParent, viewNet);
885 containerFrame = new GNEContainerFrame(viewParent, viewNet);
886 containerPlanFrame = new GNEContainerPlanFrame(viewParent, viewNet);
887}
888
889
890void
892 routeFrame->hide();
893 routeDistributionFrame->hide();
894 vehicleFrame->hide();
895 typeFrame->hide();
896 typeDistributionFrame->hide();
897 stopFrame->hide();
898 personFrame->hide();
899 personPlanFrame->hide();
900 containerFrame->hide();
901 containerPlanFrame->hide();
902}
903
904
905void
907 // set width in all frames
908 routeFrame->setFrameWidth(frameWidth);
909 routeDistributionFrame->setFrameWidth(frameWidth);
910 vehicleFrame->setFrameWidth(frameWidth);
911 typeFrame->setFrameWidth(frameWidth);
912 typeDistributionFrame->setFrameWidth(frameWidth);
913 stopFrame->setFrameWidth(frameWidth);
914 personFrame->setFrameWidth(frameWidth);
915 personPlanFrame->setFrameWidth(frameWidth);
916 containerFrame->setFrameWidth(frameWidth);
917 containerPlanFrame->setFrameWidth(frameWidth);
918}
919
920
921bool
923 // check all frames
924 if (routeFrame->shown()) {
925 return true;
926 } else if (routeDistributionFrame->shown()) {
927 return true;
928 } else if (vehicleFrame->shown()) {
929 return true;
930 } else if (typeFrame->shown()) {
931 return true;
932 } else if (typeDistributionFrame->shown()) {
933 return true;
934 } else if (stopFrame->shown()) {
935 return true;
936 } else if (personFrame->shown()) {
937 return true;
938 } else if (personPlanFrame->shown()) {
939 return true;
940 } else if (containerFrame->shown()) {
941 return true;
942 } else if (containerPlanFrame->shown()) {
943 return true;
944 } else {
945 return false;
946 }
947}
948
949
952 // check all frames
953 if (routeFrame->shown()) {
954 return routeFrame;
955 } else if (routeDistributionFrame->shown()) {
956 return routeDistributionFrame;
957 } else if (vehicleFrame->shown()) {
958 return vehicleFrame;
959 } else if (typeFrame->shown()) {
960 return typeFrame;
961 } else if (typeDistributionFrame->shown()) {
962 return typeDistributionFrame;
963 } else if (stopFrame->shown()) {
964 return stopFrame;
965 } else if (personFrame->shown()) {
966 return personFrame;
967 } else if (personPlanFrame->shown()) {
968 return personPlanFrame;
969 } else if (containerFrame->shown()) {
970 return containerFrame;
971 } else if (containerPlanFrame->shown()) {
972 return containerPlanFrame;
973 } else {
974 return nullptr;
975 }
976}
977
978// ---------------------------------------------------------------------------
979// GNEViewParent::DataFrames - methods
980// ---------------------------------------------------------------------------
981
984
985
986void
988 edgeDataFrame = new GNEEdgeDataFrame(viewParent, viewNet);
989 edgeRelDataFrame = new GNEEdgeRelDataFrame(viewParent, viewNet);
990 TAZRelDataFrame = new GNETAZRelDataFrame(viewParent, viewNet);
991 meanDataFrame = new GNEMeanDataFrame(viewParent, viewNet);
992}
993
994
995void
997 edgeDataFrame->hide();
998 edgeRelDataFrame->hide();
999 TAZRelDataFrame->hide();
1000 meanDataFrame->hide();
1001}
1002
1003
1004void
1006 // set width in all frames
1007 edgeDataFrame->setFrameWidth(frameWidth);
1008 edgeRelDataFrame->setFrameWidth(frameWidth);
1009 TAZRelDataFrame->setFrameWidth(frameWidth);
1010 meanDataFrame->setFrameWidth(frameWidth);
1011}
1012
1013
1014bool
1016 // check all frames
1017 if (edgeDataFrame->shown()) {
1018 return true;
1019 } else if (edgeRelDataFrame->shown()) {
1020 return true;
1021 } else if (TAZRelDataFrame->shown()) {
1022 return true;
1023 } else if (meanDataFrame->shown()) {
1024 return true;
1025 } else {
1026 return false;
1027 }
1028}
1029
1030
1031GNEFrame*
1033 // check all frames
1034 if (edgeDataFrame->shown()) {
1035 return edgeDataFrame;
1036 } else if (edgeRelDataFrame->shown()) {
1037 return edgeRelDataFrame;
1038 } else if (TAZRelDataFrame->shown()) {
1039 return TAZRelDataFrame;
1040 } else if (meanDataFrame->shown()) {
1041 return meanDataFrame;
1042 } else {
1043 return nullptr;
1044 }
1045}
1046
1047// ---------------------------------------------------------------------------
1048// GNEViewParent::ACChoosers - methods
1049// ---------------------------------------------------------------------------
1050
1053
1054
1056 // remove all dialogs if are active
1057 if (ACChooserJunction) {
1058 delete ACChooserJunction;
1059 }
1060 if (ACChooserEdges) {
1061 delete ACChooserEdges;
1062 }
1063 if (ACChooserWalkingAreas) {
1064 delete ACChooserWalkingAreas;
1065 }
1066 if (ACChooserRoutes) {
1067 delete ACChooserRoutes;
1068 }
1069 if (ACChooserStops) {
1070 delete ACChooserStops;
1071 }
1072 if (ACChooserVehicles) {
1073 delete ACChooserVehicles;
1074 }
1075 if (ACChooserPersons) {
1076 delete ACChooserPersons;
1077 }
1078 if (ACChooserContainers) {
1079 delete ACChooserContainers;
1080 }
1081 if (ACChooserTLS) {
1082 delete ACChooserTLS;
1083 }
1084 if (ACChooserAdditional) {
1085 delete ACChooserAdditional;
1086 }
1087 if (ACChooserPOI) {
1088 delete ACChooserPOI;
1089 }
1090 if (ACChooserPolygon) {
1091 delete ACChooserPolygon;
1092 }
1093 if (ACChooserProhibition) {
1094 delete ACChooserProhibition;
1095 }
1096 if (ACChooserWire) {
1097 delete ACChooserWire;
1098 }
1099}
1100
1101
1102/****************************************************************************/
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:129
#define GUIDesignFrameArea
Definition GUIDesigns.h:375
#define GUIDesignVerticalSeparator
vertical separator
Definition GUIDesigns.h:469
#define GUIDesignSplitter
Definition GUIDesigns.h:477
#define GUIDesignViewnArea
design for view area
Definition GUIDesigns.h:378
#define GUIDesignFramesAreaDefaultWidth
define the default frames area width
Definition GUIDesigns.h:38
FXString gCurrentFolder
The folder used as last.
@ COMPUTEPATHMANAGER
@ LOCATEJUNCTION
#define WRITE_DEBUG(msg)
Definition MsgHandler.h:306
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:297
#define TL(string)
Definition MsgHandler.h:315
@ SUMO_TAG_ROUTE
begin/end of the description of a route
The main window of Netedit.
GNEUndoList * getUndoList()
get pointer to undoList
GNEApplicationWindowHelper::ToolbarsGrip & getToolbarsGrip()
get ToolbarsGrip
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
const std::map< const GUIGlObject *, GNEWalkingArea * > & getWalkingAreas() const
get walkingAreas
const std::map< SumoXMLTag, std::map< const GUIGlObject *, GNEAdditional * > > & getAdditionals() const
get additionals
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::map< SumoXMLTag, std::map< const GUIGlObject *, GNEDemandElement * > > & getDemandElements() const
get demand elements
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:125
bool isShapeElement() const
return true if tag correspond to a shape
bool isTAZElement() const
return true if tag correspond to a TAZ element
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:39
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