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-2026 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
453std::vector<GUIGlID>
454GNEViewParent::getObjectIDs(int messageId) const {
455 std::vector<GUIGlID> ids;
456 GNEViewNet* viewNet = dynamic_cast<GNEViewNet*>(myView);
457 if (viewNet == nullptr || viewNet->getNet() == nullptr) {
458 return ids;
459 }
460 switch (messageId) {
462 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
463 ids.push_back(junction.second->getGUIGlObject()->getGlID());
464 }
465 break;
467 for (const auto& edge : viewNet->getNet()->getAttributeCarriers()->getEdges()) {
468 ids.push_back(edge.second->getGUIGlObject()->getGlID());
469 }
470 break;
472 for (const auto& walkingArea : viewNet->getNet()->getAttributeCarriers()->getWalkingAreas()) {
473 ids.push_back(walkingArea.second->getGUIGlObject()->getGlID());
474 }
475 break;
477 for (const auto& vehicleTag : NamespaceIDs::vehicles) {
478 for (const auto& vehicle : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(vehicleTag)) {
479 ids.push_back(vehicle.second->getGUIGlObject()->getGlID());
480 }
481 }
482 break;
483 }
485 for (const auto& personTag : NamespaceIDs::persons) {
486 for (const auto& person : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(personTag)) {
487 ids.push_back(person.second->getGUIGlObject()->getGlID());
488 }
489 }
490 break;
492 for (const auto& containerTag : NamespaceIDs::containers) {
493 for (const auto& container : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(containerTag)) {
494 ids.push_back(container.second->getGUIGlObject()->getGlID());
495 }
496 }
497 break;
499 for (const auto& route : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
500 ids.push_back(route.second->getGUIGlObject()->getGlID());
501 }
502 break;
504 for (const auto& stopTag : NamespaceIDs::stops) {
505 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(stopTag)) {
506 ids.push_back(flowTAZ.second->getGUIGlObject()->getGlID());
507 }
508 }
509 break;
510 }
512 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
513 if (junction.second->getNBNode()->getControllingTLS().size() > 0) {
514 ids.push_back(junction.second->getGUIGlObject()->getGlID());
515 }
516 }
517 break;
519 for (const auto& additionalTag : viewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
520 const auto tagProperty = viewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionalTag.first, true);
521 if (!tagProperty->isShapeElement() && !tagProperty->isTAZElement()) {
522 for (const auto& additional : additionalTag.second) {
523 ids.push_back(additional.second->getGUIGlObject()->getGlID());
524 }
525 }
526 }
527 break;
529 for (const auto& POITag : NamespaceIDs::POIs) {
530 for (const auto& poi : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(POITag)) {
531 ids.push_back(poi.second->getGUIGlObject()->getGlID());
532 }
533 }
534 break;
536 for (const auto& polygonTag : NamespaceIDs::polygons) {
537 for (const auto& polygon : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(polygonTag)) {
538 ids.push_back(polygon.second->getGUIGlObject()->getGlID());
539 }
540 }
541 break;
542 default:
543 break;
544 }
545 return ids;
546}
547
548
549FXVerticalFrame*
553
554
555int
557 return myFramesArea->getWidth();
558}
559
560
561void
562GNEViewParent::setFrameAreaWidth(const int frameAreaWith) {
563 myFramesArea->setWidth(frameAreaWith);
565}
566
567
568long
569GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
570 // get the new file name
571 FXFileDialog opendialog(this, TL("Save Snapshot"));
572 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::CAMERA));
573 opendialog.setSelectMode(SELECTFILE_ANY);
574 opendialog.setPatternList(SUMOXMLDefinitions::ImageFileExtensions.getMultilineString().c_str());
575 if (gCurrentFolder.length() != 0) {
576 opendialog.setDirectory(gCurrentFolder);
577 }
578 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
579 return 1;
580 }
581 gCurrentFolder = opendialog.getDirectory();
582 std::string file = opendialog.getFilename().text();
583 if (file.find(".") == std::string::npos) {
584 file.append(".png");
585 WRITE_MESSAGE(TL("No file extension was specified - saving Snapshot as PNG."));
586 }
587 const std::string error = myView->makeSnapshot(file);
588 if (error.size() > 0) {
589 // open error message box
590 GNEErrorBasicDialog(myGNEAppWindows, TL("Saving failed."), error.c_str());
591 } else {
592 WRITE_MESSAGE(TL("Snapshot successfully saved!"));
593 }
594 return 1;
595}
596
597
598long
599GNEViewParent::onCmdClose(FXObject*, FXSelector /* sel */, void*) {
600 myGUIMainWindowParent->handle(this, FXSEL(SEL_COMMAND, MID_HOTKEY_CTRL_W_CLOSESIMULATION), nullptr);
601 return 1;
602}
603
604
605long
606GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) {
607 GNEViewNet* viewNet = dynamic_cast<GNEViewNet*>(myView);
608 // check that viewNet exist
609 if (viewNet) {
610 // declare a vector in which save attribute carriers to locate
611 std::map<std::string, GNEAttributeCarrier*> ACsToLocate;
612 int messageId = FXSELID(sel);
613 GNEACChooserDialog** chooserLoc = nullptr;
614 std::string locateTitle;
615 switch (messageId) {
617 chooserLoc = &myACChoosers.ACChooserJunction;
618 locateTitle = TL("Junction Chooser");
619 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
620 ACsToLocate[junction.second->getID()] = junction.second;
621 }
622 break;
624 chooserLoc = &myACChoosers.ACChooserEdges;
625 locateTitle = TL("Edge Chooser");
626 for (const auto& edge : viewNet->getNet()->getAttributeCarriers()->getEdges()) {
627 ACsToLocate[edge.second->getID()] = edge.second;
628 }
629 break;
632 locateTitle = TL("WalkingArea Chooser");
633 for (const auto& walkingArea : viewNet->getNet()->getAttributeCarriers()->getWalkingAreas()) {
634 ACsToLocate[walkingArea.second->getID()] = walkingArea.second;
635 }
636 break;
638 chooserLoc = &myACChoosers.ACChooserVehicles;
639 locateTitle = TL("Vehicle Chooser");
640 // fill ACsToLocate with all vehicles
641 for (const auto& vehicleTag : NamespaceIDs::vehicles) {
642 for (const auto& vehicle : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(vehicleTag)) {
643 ACsToLocate[vehicle.second->getID()] = vehicle.second;
644 }
645 }
646 break;
647 }
649 chooserLoc = &myACChoosers.ACChooserPersons;
650 locateTitle = TL("Person Chooser");
651 // fill ACsToLocate with all persons
652 for (const auto& personTag : NamespaceIDs::persons) {
653 for (const auto& person : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(personTag)) {
654 ACsToLocate[person.second->getID()] = person.second;
655 }
656 }
657 break;
659 chooserLoc = &myACChoosers.ACChooserContainers;
660 locateTitle = TL("Container Chooser");
661 // fill ACsToLocate with all containers
662 for (const auto& containerTag : NamespaceIDs::containers) {
663 for (const auto& container : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(containerTag)) {
664 ACsToLocate[container.second->getID()] = container.second;
665 }
666 }
667 break;
669 chooserLoc = &myACChoosers.ACChooserRoutes;
670 locateTitle = TL("Route Chooser");
671 for (const auto& route : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
672 ACsToLocate[route.second->getID()] = route.second;
673 }
674 break;
676 chooserLoc = &myACChoosers.ACChooserStops;
677 locateTitle = TL("Stop Chooser");
678 // fill ACsToLocate with all vehicles
679 for (const auto& stopTag : NamespaceIDs::stops) {
680 for (const auto& flowTAZ : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(stopTag)) {
681 ACsToLocate[flowTAZ.second->getID()] = flowTAZ.second;
682 }
683 }
684 break;
685 }
687 chooserLoc = &myACChoosers.ACChooserTLS;
688 locateTitle = TL("TLS Chooser");
689 // fill ACsToLocate with junctions that haven TLS
690 for (const auto& junction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
691 if (junction.second->getNBNode()->getControllingTLS().size() > 0) {
692 ACsToLocate[junction.second->getID()] = junction.second;
693 }
694 }
695 break;
697 chooserLoc = &myACChoosers.ACChooserAdditional;
698 locateTitle = TL("Additional Chooser");
699 for (const auto& additionalTag : viewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
700 const auto tagProperty = viewNet->getNet()->getTagPropertiesDatabase()->getTagProperty(additionalTag.first, true);
701 // avoid shapes and TAZs
702 if (!tagProperty->isShapeElement() && !tagProperty->isTAZElement()) {
703 for (const auto& additional : additionalTag.second) {
704 ACsToLocate[additional.second->getID()] = additional.second;
705 }
706 }
707 }
708 break;
710 chooserLoc = &myACChoosers.ACChooserPOI;
711 locateTitle = TL("POI Chooser");
712 // fill ACsToLocate with all POIs
713 for (const auto& POITag : NamespaceIDs::POIs) {
714 for (const auto& poi : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(POITag)) {
715 ACsToLocate[poi.second->getID()] = poi.second;
716 }
717 }
718 break;
720 chooserLoc = &myACChoosers.ACChooserPolygon;
721 locateTitle = TL("Poly Chooser");
722 // fill ACsToLocate with all polygons
723 for (const auto& polygonTag : NamespaceIDs::polygons) {
724 for (const auto& polygon : viewNet->getNet()->getAttributeCarriers()->getAdditionals().at(polygonTag)) {
725 ACsToLocate[polygon.second->getID()] = polygon.second;
726 }
727 }
728 break;
729 default:
730 throw ProcessError("Unknown Message ID in onCmdLocate");
731 }
732 if (*chooserLoc) {
733 // restore focus in the existent chooser dialog
734 GNEACChooserDialog* chooser = *chooserLoc;
735 chooser->restore();
736 chooser->setFocus();
737 chooser->raise();
738 } else {
739 GNEACChooserDialog* chooser = new GNEACChooserDialog(this, messageId, GUIIconSubSys::getIcon(GUIIcon::LOCATEJUNCTION), locateTitle, ACsToLocate);
740 *chooserLoc = chooser;
741 }
742 // update locator popup
743 myLocatorPopup->popdown();
744 myLocatorButton->killFocus();
745 myLocatorPopup->update();
746 }
747 return 1;
748}
749
750
751long
752GNEViewParent::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
753 myView->onKeyPress(o, sel, eventData);
754 return 0;
755}
756
757
758long
759GNEViewParent::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
760 myView->onKeyRelease(o, sel, eventData);
761 return 0;
762}
763
764
765long
766GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) {
767 const int framesAreaWidth = myFramesArea->getWidth();
768 // set width of FramesArea in all frames
769 myCommonFrames.setCommonFramesWidth(framesAreaWidth);
770 myNetworkFrames.setNetworkFramesWidth(framesAreaWidth);
771 myDemandFrames.setDemandFramesWidth(framesAreaWidth);
772 myDataFrames.setDataFramesWidth(framesAreaWidth);
773 return 0;
774}
775
776// ---------------------------------------------------------------------------
777// GNEViewParent::CommonFrames - methods
778// ---------------------------------------------------------------------------
779
782
783
784void
786 inspectorFrame = new GNEInspectorFrame(viewParent, viewNet);
787 selectorFrame = new GNESelectorFrame(viewParent, viewNet);
788 moveFrame = new GNEMoveFrame(viewParent, viewNet);
789 deleteFrame = new GNEDeleteFrame(viewParent, viewNet);
790}
791
792
793void
795 inspectorFrame->hide();
796 deleteFrame->hide();
797 selectorFrame->hide();
798 moveFrame->hide();
799}
800
801
802void
804 // set width in all frames
805 inspectorFrame->setFrameWidth(frameWidth);
806 deleteFrame->setFrameWidth(frameWidth);
807 selectorFrame->setFrameWidth(frameWidth);
808 moveFrame->setFrameWidth(frameWidth);
809}
810
811
812bool
814 // check all frames
815 if (inspectorFrame->shown()) {
816 return true;
817 } else if (deleteFrame->shown()) {
818 return true;
819 } else if (selectorFrame->shown()) {
820 return true;
821 } else if (moveFrame->shown()) {
822 return true;
823 } else {
824 return false;
825 }
826}
827
828
831 // check all frames
832 if (inspectorFrame->shown()) {
833 return inspectorFrame;
834 } else if (deleteFrame->shown()) {
835 return deleteFrame;
836 } else if (selectorFrame->shown()) {
837 return selectorFrame;
838 } else if (moveFrame->shown()) {
839 return moveFrame;
840 } else {
841 return nullptr;
842 }
843}
844
845// ---------------------------------------------------------------------------
846// GNEViewParent::NetworkFrames - methods
847// ---------------------------------------------------------------------------
848
850
851
852void
854 connectorFrame = new GNEConnectorFrame(viewParent, viewNet);
855 TLSEditorFrame = new GNETLSEditorFrame(viewParent, viewNet);
856 additionalFrame = new GNEAdditionalFrame(viewParent, viewNet);
857 crossingFrame = new GNECrossingFrame(viewParent, viewNet);
858 TAZFrame = new GNETAZFrame(viewParent, viewNet);
859 polygonFrame = new GNEShapeFrame(viewParent, viewNet);
860 prohibitionFrame = new GNEProhibitionFrame(viewParent, viewNet);
861 wireFrame = new GNEWireFrame(viewParent, viewNet);
862 decalFrame = new GNEDecalFrame(viewParent, viewNet);
863 createEdgeFrame = new GNECreateEdgeFrame(viewParent, viewNet);
864}
865
866
867void
869 connectorFrame->hide();
870 TLSEditorFrame->hide();
871 additionalFrame->hide();
872 crossingFrame->hide();
873 TAZFrame->hide();
874 polygonFrame->hide();
875 prohibitionFrame->hide();
876 wireFrame->hide();
877 decalFrame->hide();
878 createEdgeFrame->hide();
879}
880
881
882void
884 // set width in all frames
885 connectorFrame->setFrameWidth(frameWidth);
886 TLSEditorFrame->setFrameWidth(frameWidth);
887 additionalFrame->setFrameWidth(frameWidth);
888 crossingFrame->setFrameWidth(frameWidth);
889 TAZFrame->setFrameWidth(frameWidth);
890 polygonFrame->setFrameWidth(frameWidth);
891 prohibitionFrame->setFrameWidth(frameWidth);
892 wireFrame->setFrameWidth(frameWidth);
893 decalFrame->setFrameWidth(frameWidth);
894 createEdgeFrame->setFrameWidth(frameWidth);
895}
896
897
898bool
900 // check all frames
901 if (connectorFrame->shown()) {
902 return true;
903 } else if (TLSEditorFrame->shown()) {
904 return true;
905 } else if (additionalFrame->shown()) {
906 return true;
907 } else if (crossingFrame->shown()) {
908 return true;
909 } else if (TAZFrame->shown()) {
910 return true;
911 } else if (polygonFrame->shown()) {
912 return true;
913 } else if (prohibitionFrame->shown()) {
914 return true;
915 } else if (wireFrame->shown()) {
916 return true;
917 } else if (decalFrame->shown()) {
918 return true;
919 } else if (createEdgeFrame->shown()) {
920 return true;
921 } else {
922 return false;
923 }
924}
925
926
929 // check all frames
930 if (connectorFrame->shown()) {
931 return connectorFrame;
932 } else if (TLSEditorFrame->shown()) {
933 return TLSEditorFrame;
934 } else if (additionalFrame->shown()) {
935 return additionalFrame;
936 } else if (crossingFrame->shown()) {
937 return crossingFrame;
938 } else if (TAZFrame->shown()) {
939 return TAZFrame;
940 } else if (polygonFrame->shown()) {
941 return polygonFrame;
942 } else if (prohibitionFrame->shown()) {
943 return prohibitionFrame;
944 } else if (wireFrame->shown()) {
945 return wireFrame;
946 } else if (decalFrame->shown()) {
947 return decalFrame;
948 } else if (createEdgeFrame->shown()) {
949 return createEdgeFrame;
950 } else {
951 return nullptr;
952 }
953}
954
955// ---------------------------------------------------------------------------
956// GNEViewParent::DemandFrames - methods
957// ---------------------------------------------------------------------------
958
961
962
963void
965 routeFrame = new GNERouteFrame(viewParent, viewNet);
966 routeDistributionFrame = new GNERouteDistributionFrame(viewParent, viewNet);
967 vehicleFrame = new GNEVehicleFrame(viewParent, viewNet);
968 typeFrame = new GNETypeFrame(viewParent, viewNet);
969 typeDistributionFrame = new GNETypeDistributionFrame(viewParent, viewNet);
970 stopFrame = new GNEStopFrame(viewParent, viewNet);
971 personFrame = new GNEPersonFrame(viewParent, viewNet);
972 personPlanFrame = new GNEPersonPlanFrame(viewParent, viewNet);
973 containerFrame = new GNEContainerFrame(viewParent, viewNet);
974 containerPlanFrame = new GNEContainerPlanFrame(viewParent, viewNet);
975}
976
977
978void
980 routeFrame->hide();
981 routeDistributionFrame->hide();
982 vehicleFrame->hide();
983 typeFrame->hide();
984 typeDistributionFrame->hide();
985 stopFrame->hide();
986 personFrame->hide();
987 personPlanFrame->hide();
988 containerFrame->hide();
989 containerPlanFrame->hide();
990}
991
992
993void
995 // set width in all frames
996 routeFrame->setFrameWidth(frameWidth);
997 routeDistributionFrame->setFrameWidth(frameWidth);
998 vehicleFrame->setFrameWidth(frameWidth);
999 typeFrame->setFrameWidth(frameWidth);
1000 typeDistributionFrame->setFrameWidth(frameWidth);
1001 stopFrame->setFrameWidth(frameWidth);
1002 personFrame->setFrameWidth(frameWidth);
1003 personPlanFrame->setFrameWidth(frameWidth);
1004 containerFrame->setFrameWidth(frameWidth);
1005 containerPlanFrame->setFrameWidth(frameWidth);
1006}
1007
1008
1009bool
1011 // check all frames
1012 if (routeFrame->shown()) {
1013 return true;
1014 } else if (routeDistributionFrame->shown()) {
1015 return true;
1016 } else if (vehicleFrame->shown()) {
1017 return true;
1018 } else if (typeFrame->shown()) {
1019 return true;
1020 } else if (typeDistributionFrame->shown()) {
1021 return true;
1022 } else if (stopFrame->shown()) {
1023 return true;
1024 } else if (personFrame->shown()) {
1025 return true;
1026 } else if (personPlanFrame->shown()) {
1027 return true;
1028 } else if (containerFrame->shown()) {
1029 return true;
1030 } else if (containerPlanFrame->shown()) {
1031 return true;
1032 } else {
1033 return false;
1034 }
1035}
1036
1037
1038GNEFrame*
1040 // check all frames
1041 if (routeFrame->shown()) {
1042 return routeFrame;
1043 } else if (routeDistributionFrame->shown()) {
1044 return routeDistributionFrame;
1045 } else if (vehicleFrame->shown()) {
1046 return vehicleFrame;
1047 } else if (typeFrame->shown()) {
1048 return typeFrame;
1049 } else if (typeDistributionFrame->shown()) {
1050 return typeDistributionFrame;
1051 } else if (stopFrame->shown()) {
1052 return stopFrame;
1053 } else if (personFrame->shown()) {
1054 return personFrame;
1055 } else if (personPlanFrame->shown()) {
1056 return personPlanFrame;
1057 } else if (containerFrame->shown()) {
1058 return containerFrame;
1059 } else if (containerPlanFrame->shown()) {
1060 return containerPlanFrame;
1061 } else {
1062 return nullptr;
1063 }
1064}
1065
1066// ---------------------------------------------------------------------------
1067// GNEViewParent::DataFrames - methods
1068// ---------------------------------------------------------------------------
1069
1072
1073
1074void
1076 edgeDataFrame = new GNEEdgeDataFrame(viewParent, viewNet);
1077 edgeRelDataFrame = new GNEEdgeRelDataFrame(viewParent, viewNet);
1078 TAZRelDataFrame = new GNETAZRelDataFrame(viewParent, viewNet);
1079 meanDataFrame = new GNEMeanDataFrame(viewParent, viewNet);
1080}
1081
1082
1083void
1085 edgeDataFrame->hide();
1086 edgeRelDataFrame->hide();
1087 TAZRelDataFrame->hide();
1088 meanDataFrame->hide();
1089}
1090
1091
1092void
1094 // set width in all frames
1095 edgeDataFrame->setFrameWidth(frameWidth);
1096 edgeRelDataFrame->setFrameWidth(frameWidth);
1097 TAZRelDataFrame->setFrameWidth(frameWidth);
1098 meanDataFrame->setFrameWidth(frameWidth);
1099}
1100
1101
1102bool
1104 // check all frames
1105 if (edgeDataFrame->shown()) {
1106 return true;
1107 } else if (edgeRelDataFrame->shown()) {
1108 return true;
1109 } else if (TAZRelDataFrame->shown()) {
1110 return true;
1111 } else if (meanDataFrame->shown()) {
1112 return true;
1113 } else {
1114 return false;
1115 }
1116}
1117
1118
1119GNEFrame*
1121 // check all frames
1122 if (edgeDataFrame->shown()) {
1123 return edgeDataFrame;
1124 } else if (edgeRelDataFrame->shown()) {
1125 return edgeRelDataFrame;
1126 } else if (TAZRelDataFrame->shown()) {
1127 return TAZRelDataFrame;
1128 } else if (meanDataFrame->shown()) {
1129 return meanDataFrame;
1130 } else {
1131 return nullptr;
1132 }
1133}
1134
1135// ---------------------------------------------------------------------------
1136// GNEViewParent::ACChoosers - methods
1137// ---------------------------------------------------------------------------
1138
1141
1142
1144 // remove all dialogs if are active
1145 if (ACChooserJunction) {
1146 delete ACChooserJunction;
1147 }
1148 if (ACChooserEdges) {
1149 delete ACChooserEdges;
1150 }
1151 if (ACChooserWalkingAreas) {
1152 delete ACChooserWalkingAreas;
1153 }
1154 if (ACChooserRoutes) {
1155 delete ACChooserRoutes;
1156 }
1157 if (ACChooserStops) {
1158 delete ACChooserStops;
1159 }
1160 if (ACChooserVehicles) {
1161 delete ACChooserVehicles;
1162 }
1163 if (ACChooserPersons) {
1164 delete ACChooserPersons;
1165 }
1166 if (ACChooserContainers) {
1167 delete ACChooserContainers;
1168 }
1169 if (ACChooserTLS) {
1170 delete ACChooserTLS;
1171 }
1172 if (ACChooserAdditional) {
1173 delete ACChooserAdditional;
1174 }
1175 if (ACChooserPOI) {
1176 delete ACChooserPOI;
1177 }
1178 if (ACChooserPolygon) {
1179 delete ACChooserPolygon;
1180 }
1181 if (ACChooserProhibition) {
1182 delete ACChooserProhibition;
1183 }
1184 if (ACChooserWire) {
1185 delete ACChooserWire;
1186 }
1187}
1188
1189
1190/****************************************************************************/
FXDEFMAP(GNEViewParent) GNEViewParentMap[]
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition GUIAppEnum.h:395
@ 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:831
@ 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:815
#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
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
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
const GNETagPropertiesDatabase * getTagPropertiesDatabase() const
get tag properties database (used for simplify code)
Definition GNENet.cpp:162
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)
std::vector< GUIGlID > getObjectIDs(int messageId) const
get object IDs
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:41
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