1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    GNEViewParent.cpp
11 /// @author  Jakob Erdmann
12 /// @date    Feb 2011
13 /// @version $Id$
14 ///
15 // A single child window which contains a view of the edited network (adapted
16 // from GUISUMOViewParent)
17 // While we don't actually need MDI for netedit it is easier to adapt existing
18 // structures than to write everything from scratch.
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <netedit/additionals/GNEAdditional.h>
26 #include <netedit/dialogs/GNEDialogACChooser.h>
27 #include <netedit/frames/GNEAdditionalFrame.h>
28 #include <netedit/frames/GNEConnectorFrame.h>
29 #include <netedit/frames/GNECreateEdgeFrame.h>
30 #include <netedit/frames/GNECrossingFrame.h>
31 #include <netedit/frames/GNEDeleteFrame.h>
32 #include <netedit/frames/GNEInspectorFrame.h>
33 #include <netedit/frames/GNEPolygonFrame.h>
34 #include <netedit/frames/GNEProhibitionFrame.h>
35 #include <netedit/frames/GNERouteFrame.h>
36 #include <netedit/frames/GNESelectorFrame.h>
37 #include <netedit/frames/GNETAZFrame.h>
38 #include <netedit/frames/GNETLSEditorFrame.h>
39 #include <netedit/frames/GNEVehicleFrame.h>
40 #include <netedit/frames/GNEVehicleTypeFrame.h>
41 #include <netedit/frames/GNEStopFrame.h>
42 #include <netedit/netelements/GNEEdge.h>
43 #include <netedit/netelements/GNEJunction.h>
44 #include <utils/foxtools/MFXUtils.h>
45 #include <utils/gui/div/GUIDesigns.h>
46 #include <utils/gui/images/GUIIconSubSys.h>
47 #include <utils/gui/windows/GUIAppEnum.h>
48 
49 #include "GNEApplicationWindow.h"
50 #include "GNEViewNet.h"
51 #include "GNENet.h"
52 #include "GNEUndoList.h"
53 #include "GNEViewParent.h"
54 
55 
56 // ===========================================================================
57 // FOX callback mapping
58 // ===========================================================================
59 
60 FXDEFMAP(GNEViewParent) GNEViewParentMap[] = {
61     FXMAPFUNC(SEL_COMMAND,  MID_MAKESNAPSHOT,                       GNEViewParent::onCmdMakeSnapshot),
62     FXMAPFUNC(SEL_COMMAND,  MID_LOCATEJUNCTION,                     GNEViewParent::onCmdLocate),
63     FXMAPFUNC(SEL_COMMAND,  MID_LOCATEEDGE,                         GNEViewParent::onCmdLocate),
64     FXMAPFUNC(SEL_COMMAND,  MID_LOCATETLS,                          GNEViewParent::onCmdLocate),
65     FXMAPFUNC(SEL_COMMAND,  MID_LOCATEADD,                          GNEViewParent::onCmdLocate),
66     FXMAPFUNC(SEL_COMMAND,  MID_LOCATEPOI,                          GNEViewParent::onCmdLocate),
67     FXMAPFUNC(SEL_COMMAND,  MID_LOCATEPOLY,                         GNEViewParent::onCmdLocate),
68     FXMAPFUNC(SEL_COMMAND,  FXMDIChild::ID_MDI_MENUCLOSE,           GNEViewParent::onCmdClose),
69     FXMAPFUNC(SEL_CHANGED,  MID_GNE_VIEWPARENT_FRAMEAREAWIDTH,      GNEViewParent::onCmdUpdateFrameAreaWidth),
70 };
71 
72 // Object implementation
FXIMPLEMENT(GNEViewParent,GUIGlChildWindow,GNEViewParentMap,ARRAYNUMBER (GNEViewParentMap))73 FXIMPLEMENT(GNEViewParent, GUIGlChildWindow, GNEViewParentMap, ARRAYNUMBER(GNEViewParentMap))
74 
75 
76 // ===========================================================================
77 // member method definitions
78 // ===========================================================================
79 
80 GNEViewParent::GNEViewParent(FXMDIClient* p, FXMDIMenu* mdimenu, const FXString& name, GNEApplicationWindow* parentWindow,
81                              FXGLCanvas* share, GNENet* net, GNEUndoList* undoList, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
82     GUIGlChildWindow(p, parentWindow, mdimenu, name, parentWindow->getToolbarsGrip().navigation, ic, opts, x, y, w, h),
83     myGNEAppWindows(parentWindow) {
84     // Add child to parent
85     myParent->addGLChild(this);
86 
87     // Create Vertical separator
88     new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
89 
90     // add undo/redo buttons
91     new FXButton(myGripNavigationToolbar, "\tUndo\tUndo the last Change.", GUIIconSubSys::getIcon(ICON_UNDO), parentWindow, MID_HOTKEY_CTRL_Z_UNDO, GUIDesignButtonToolbar);
92     new FXButton(myGripNavigationToolbar, "\tRedo\tRedo the last Change.", GUIIconSubSys::getIcon(ICON_REDO), parentWindow, MID_HOTKEY_CTRL_Y_REDO, GUIDesignButtonToolbar);
93 
94     // Create Frame Splitter
95     myFramesSplitter = new FXSplitter(myContentFrame, this, MID_GNE_VIEWPARENT_FRAMEAREAWIDTH, GUIDesignSplitter | SPLITTER_HORIZONTAL);
96 
97     // Create frames Area
98     myFramesArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignFrameArea);
99 
100     // Set default width of frames area
101     myFramesArea->setWidth(220);
102 
103     // Create view area
104     myViewArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignViewnArea);
105 
106     // Add the view to a temporary parent so that we can add items to myViewArea in the desired order
107     FXComposite* tmp = new FXComposite(this);
108 
109     // Create view net
110     GNEViewNet* viewNet = new GNEViewNet(tmp, myViewArea, *myParent, this, net, undoList, myParent->getGLVisual(), share);
111 
112     // show toolbar grips
113     myGNEAppWindows->getToolbarsGrip().buildMenuToolbarsGrip();
114 
115     // Set pointer myView with the created view net
116     myView = viewNet;
117 
118     // Create Network frames
119     myFrames.inspectorFrame = new GNEInspectorFrame(myFramesArea, viewNet);
120     myFrames.selectorFrame = new GNESelectorFrame(myFramesArea, viewNet);
121     myFrames.connectorFrame = new GNEConnectorFrame(myFramesArea, viewNet);
122     myFrames.prohibitionFrame = new GNEProhibitionFrame(myFramesArea, viewNet);
123     myFrames.TLSEditorFrame = new GNETLSEditorFrame(myFramesArea, viewNet);
124     myFrames.additionalFrame = new GNEAdditionalFrame(myFramesArea, viewNet);
125     myFrames.crossingFrame = new GNECrossingFrame(myFramesArea, viewNet);
126     myFrames.TAZFrame = new GNETAZFrame(myFramesArea, viewNet);
127     myFrames.deleteFrame = new GNEDeleteFrame(myFramesArea, viewNet);
128     myFrames.polygonFrame = new GNEPolygonFrame(myFramesArea, viewNet);
129     myFrames.createEdgeFrame = new GNECreateEdgeFrame(myFramesArea, viewNet);
130 
131     // Create Demand frames
132     myFrames.routeFrame = new GNERouteFrame(myFramesArea, viewNet);
133     myFrames.vehicleFrame = new GNEVehicleFrame(myFramesArea, viewNet);
134     myFrames.vehicleTypeFrame = new GNEVehicleTypeFrame(myFramesArea, viewNet);
135     myFrames.stopFrame = new GNEStopFrame(myFramesArea, viewNet);
136 
137     // Update frame areas after creation
138     onCmdUpdateFrameAreaWidth(nullptr, 0, nullptr);
139 
140     // Hidde all Frames Area
141     hideFramesArea();
142 
143     //  Buld view toolBars
144     myView->buildViewToolBars(*this);
145 
146     // create windows
147     GUIGlChildWindow::create();
148 }
149 
150 
~GNEViewParent()151 GNEViewParent::~GNEViewParent() {
152     // delete toolbar grips
153     myGNEAppWindows->getToolbarsGrip().destroyParentToolbarsGrips();
154     // Remove child before remove
155     myParent->removeGLChild(this);
156 }
157 
158 
159 void
hideAllFrames()160 GNEViewParent::hideAllFrames() {
161     myFrames.hideFrames();
162 }
163 
164 
165 GNEFrame*
getCurrentShownFrame() const166 GNEViewParent::getCurrentShownFrame() const {
167     return myFrames.getCurrentShownFrame();
168 }
169 
170 
171 GNEInspectorFrame*
getInspectorFrame() const172 GNEViewParent::getInspectorFrame() const {
173     return myFrames.inspectorFrame;
174 }
175 
176 
177 GNESelectorFrame*
getSelectorFrame() const178 GNEViewParent::getSelectorFrame() const {
179     return myFrames.selectorFrame;
180 }
181 
182 
183 GNEConnectorFrame*
getConnectorFrame() const184 GNEViewParent::getConnectorFrame() const {
185     return myFrames.connectorFrame;
186 }
187 
188 
189 GNETLSEditorFrame*
getTLSEditorFrame() const190 GNEViewParent::getTLSEditorFrame() const {
191     return myFrames.TLSEditorFrame;
192 }
193 
194 
195 GNEAdditionalFrame*
getAdditionalFrame() const196 GNEViewParent::getAdditionalFrame() const {
197     return myFrames.additionalFrame;
198 }
199 
200 
201 GNECrossingFrame*
getCrossingFrame() const202 GNEViewParent::getCrossingFrame() const {
203     return myFrames.crossingFrame;
204 }
205 
206 
207 GNETAZFrame*
getTAZFrame() const208 GNEViewParent::getTAZFrame() const {
209     return myFrames.TAZFrame;
210 }
211 
212 
213 GNEDeleteFrame*
getDeleteFrame() const214 GNEViewParent::getDeleteFrame() const {
215     return myFrames.deleteFrame;
216 }
217 
218 
219 GNEPolygonFrame*
getPolygonFrame() const220 GNEViewParent::getPolygonFrame() const {
221     return myFrames.polygonFrame;
222 }
223 
224 
225 GNEProhibitionFrame*
getProhibitionFrame() const226 GNEViewParent::getProhibitionFrame() const {
227     return myFrames.prohibitionFrame;
228 }
229 
230 
231 GNECreateEdgeFrame*
getCreateEdgeFrame() const232 GNEViewParent::getCreateEdgeFrame() const {
233     return myFrames.createEdgeFrame;
234 }
235 
236 
237 GNERouteFrame*
getRouteFrame() const238 GNEViewParent::getRouteFrame() const {
239     return myFrames.routeFrame;
240 }
241 
242 
243 GNEVehicleFrame*
getVehicleFrame() const244 GNEViewParent::getVehicleFrame() const {
245     return myFrames.vehicleFrame;
246 }
247 
248 
249 GNEVehicleTypeFrame*
getVehicleTypeFrame() const250 GNEViewParent::getVehicleTypeFrame() const {
251     return myFrames.vehicleTypeFrame;
252 }
253 
254 
255 GNEStopFrame*
getStopFrame() const256 GNEViewParent::getStopFrame() const {
257     return myFrames.stopFrame;
258 }
259 
260 
261 void
showFramesArea()262 GNEViewParent::showFramesArea() {
263     // show and recalc framesArea if at least there is a frame shown
264     if (myFrames.isFrameShown()) {
265         myFramesArea->recalc();
266         myFramesArea->show();
267     }
268 }
269 
270 
271 void
hideFramesArea()272 GNEViewParent::hideFramesArea() {
273     // hide and recalc frames Area if all frames are hidden is enabled
274     if (!myFrames.isFrameShown()) {
275         myFramesArea->hide();
276         myFramesArea->recalc();
277     }
278 }
279 
280 
281 GUIMainWindow*
getGUIMainWindow() const282 GNEViewParent::getGUIMainWindow() const {
283     return myParent;
284 }
285 
286 
287 GNEApplicationWindow*
getGNEAppWindows() const288 GNEViewParent::getGNEAppWindows() const {
289     return myGNEAppWindows;
290 }
291 
292 
293 void
eraseACChooserDialog(GNEDialogACChooser * chooserDialog)294 GNEViewParent::eraseACChooserDialog(GNEDialogACChooser* chooserDialog) {
295     if (chooserDialog == nullptr) {
296         throw ProcessError("ChooserDialog already deleted");
297     } else if (chooserDialog == myACChoosers.ACChooserJunction) {
298         myACChoosers.ACChooserJunction = nullptr;
299     } else if (chooserDialog == myACChoosers.ACChooserEdges) {
300         myACChoosers.ACChooserEdges = nullptr;
301     } else if (chooserDialog == myACChoosers.ACChooserTLS) {
302         myACChoosers.ACChooserTLS = nullptr;
303     } else if (chooserDialog == myACChoosers.ACChooserAdditional) {
304         myACChoosers.ACChooserAdditional = nullptr;
305     } else if (chooserDialog == myACChoosers.ACChooserPOI) {
306         myACChoosers.ACChooserPOI = nullptr;
307     } else if (chooserDialog == myACChoosers.ACChooserPolygon) {
308         myACChoosers.ACChooserPolygon = nullptr;
309     } else if (chooserDialog == myACChoosers.ACChooserProhibition) {
310         myACChoosers.ACChooserProhibition = nullptr;
311     } else {
312         throw ProcessError("Unregistered chooserDialog");
313     }
314 }
315 
316 
317 long
onCmdMakeSnapshot(FXObject *,FXSelector,void *)318 GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
319     // get the new file name
320     FXFileDialog opendialog(this, "Save Snapshot");
321     opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
322     opendialog.setSelectMode(SELECTFILE_ANY);
323     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"
324                               "GIF Image (*.gif)\nBMP Image (*.bmp)\nXPM Image (*.xpm)\nPCX Image (*.pcx)\nICO Image (*.ico)\n"
325                               "RGB Image (*.rgb)\nXBM Image (*.xbm)\nTARGA Image (*.tga)\nPNG Image  (*.png)\n"
326                               "JPEG Image (*.jpg, *.jpeg)\nTIFF Image (*.tif, *.tiff)\n"
327                               "Postscript (*.ps)\nEncapsulated Postscript (*.eps)\nPortable Document Format (*.pdf)\n"
328                               "Scalable Vector Graphics (*.svg)\nLATEX text strings (*.tex)\nPortable LaTeX Graphics (*.pgf)\n"
329                               "All Files (*)");
330     if (gCurrentFolder.length() != 0) {
331         opendialog.setDirectory(gCurrentFolder);
332     }
333     if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
334         return 1;
335     }
336     gCurrentFolder = opendialog.getDirectory();
337     std::string file = opendialog.getFilename().text();
338     std::string error = myView->makeSnapshot(file);
339     if (error != "") {
340         // write warning if netedit is running in testing mode
341         WRITE_DEBUG("Opening FXMessageBox 'error saving snapshot'");
342         // open message box
343         FXMessageBox::error(this, MBOX_OK, "Saving failed.", "%s", error.c_str());
344         // write warning if netedit is running in testing mode
345         WRITE_DEBUG("Closed FXMessageBox 'error saving snapshot' with 'OK'");
346     }
347     return 1;
348 }
349 
350 
351 long
onCmdClose(FXObject *,FXSelector,void *)352 GNEViewParent::onCmdClose(FXObject*, FXSelector /* sel */, void*) {
353     myParent->handle(this, FXSEL(SEL_COMMAND, MID_HOTKEY_CTRL_W_CLOSESIMULATION), nullptr);
354     return 1;
355 }
356 
357 
358 long
onCmdLocate(FXObject *,FXSelector sel,void *)359 GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) {
360     GNEViewNet* view = dynamic_cast<GNEViewNet*>(myView);
361     assert(view);
362     std::vector<GNEAttributeCarrier*> ACsToLocate;
363     switch (FXSELID(sel)) {
364         case MID_LOCATEJUNCTION: {
365             if (myACChoosers.ACChooserJunction) {
366                 // set focus in the existent chooser dialog
367                 myACChoosers.ACChooserJunction->setFocus();
368             } else {
369                 // fill ACsToLocate with junctions
370                 std::vector<GNEJunction*> junctions = view->getNet()->retrieveJunctions();
371                 ACsToLocate.reserve(junctions.size());
372                 for (auto i : junctions) {
373                     ACsToLocate.push_back(i);
374                 }
375                 myACChoosers.ACChooserJunction = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEJUNCTION), "Junction Chooser", ACsToLocate);
376             }
377             break;
378         }
379         case MID_LOCATEEDGE: {
380             if (myACChoosers.ACChooserEdges) {
381                 // set focus in the existent chooser dialog
382                 myACChoosers.ACChooserEdges->setFocus();
383             } else {
384                 // fill ACsToLocate with edges
385                 std::vector<GNEEdge*> edges = view->getNet()->retrieveEdges();
386                 ACsToLocate.reserve(edges.size());
387                 for (auto i : edges) {
388                     ACsToLocate.push_back(i);
389                 }
390                 myACChoosers.ACChooserEdges = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEEDGE), "Edge Chooser", ACsToLocate);
391             }
392             break;
393         }
394         case MID_LOCATETLS: {
395             if (myACChoosers.ACChooserTLS) {
396                 // set focus in the existent chooser dialog
397                 myACChoosers.ACChooserTLS->setFocus();
398             } else {
399                 // fill ACsToLocate with junctions that haven TLS
400                 std::vector<GNEJunction*> junctions = view->getNet()->retrieveJunctions();
401                 ACsToLocate.reserve(junctions.size());
402                 for (auto i : junctions) {
403                     if (i->getNBNode()->getControllingTLS().size() > 0) {
404                         ACsToLocate.push_back(i);
405                     }
406                 }
407                 myACChoosers.ACChooserTLS = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATETLS), "TLS Chooser", ACsToLocate);
408             }
409             break;
410         }
411         case MID_LOCATEADD: {
412             if (myACChoosers.ACChooserAdditional) {
413                 // set focus in the existent chooser dialog
414                 myACChoosers.ACChooserAdditional->setFocus();
415             } else {
416                 // fill ACsToLocate with additionals
417                 std::vector<GNEAdditional*> additionals = view->getNet()->retrieveAdditionals();
418                 ACsToLocate.reserve(additionals.size());
419                 for (auto i : additionals) {
420                     ACsToLocate.push_back(i);
421                 }
422                 myACChoosers.ACChooserAdditional = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEADD), "Additional Chooser", ACsToLocate);
423             }
424             break;
425         }
426         case MID_LOCATEPOI: {
427             if (myACChoosers.ACChooserPOI) {
428                 // set focus in the existent chooser dialog
429                 myACChoosers.ACChooserPOI->setFocus();
430             } else {
431                 // fill ACsToLocate with POIs
432                 for (auto i : view->getNet()->getPOIs()) {
433                     ACsToLocate.push_back(dynamic_cast<GNEAttributeCarrier*>(i.second));
434                 }
435                 myACChoosers.ACChooserPOI = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEPOI), "POI Chooser", ACsToLocate);
436             }
437             break;
438         }
439         case MID_LOCATEPOLY: {
440             if (myACChoosers.ACChooserPolygon) {
441                 // set focus in the existent chooser dialog
442                 myACChoosers.ACChooserPolygon->setFocus();
443             } else {
444                 // fill ACsToLocate with polys
445                 for (auto i : view->getNet()->getPolygons()) {
446                     ACsToLocate.push_back(dynamic_cast<GNEAttributeCarrier*>(i.second));
447                 }
448                 myACChoosers.ACChooserPolygon = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEPOLY), "Poly Chooser", ACsToLocate);
449             }
450             break;
451         }
452         default:
453             throw ProcessError("Unknown Message ID in onCmdLocate");
454     }
455     // update locator popup
456     myLocatorPopup->popdown();
457     myLocatorButton->killFocus();
458     myLocatorPopup->update();
459     return 1;
460 }
461 
462 
463 long
onKeyPress(FXObject * o,FXSelector sel,void * eventData)464 GNEViewParent::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
465     myView->onKeyPress(o, sel, eventData);
466     return 0;
467 }
468 
469 
470 long
onKeyRelease(FXObject * o,FXSelector sel,void * eventData)471 GNEViewParent::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
472     myView->onKeyRelease(o, sel, eventData);
473     return 0;
474 }
475 
476 
477 long
onCmdUpdateFrameAreaWidth(FXObject *,FXSelector,void *)478 GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) {
479     // set width of FramesArea in all frames
480     myFrames.setWidth(myFramesArea->getWidth());
481     return 0;
482 }
483 
484 // ---------------------------------------------------------------------------
485 // GNEViewParent::Frames - methods
486 // ---------------------------------------------------------------------------
487 
Frames()488 GNEViewParent::Frames::Frames() :
489     inspectorFrame(nullptr),
490     selectorFrame(nullptr),
491     connectorFrame(nullptr),
492     TLSEditorFrame(nullptr),
493     additionalFrame(nullptr),
494     crossingFrame(nullptr),
495     TAZFrame(nullptr),
496     deleteFrame(nullptr),
497     polygonFrame(nullptr),
498     prohibitionFrame(nullptr),
499     createEdgeFrame(nullptr),
500     routeFrame(nullptr),
501     vehicleFrame(nullptr),
502     vehicleTypeFrame(nullptr),
503     stopFrame(nullptr) {
504 }
505 
506 
507 void
hideFrames()508 GNEViewParent::Frames::hideFrames() {
509     inspectorFrame->hide();
510     selectorFrame->hide();
511     connectorFrame->hide();
512     TLSEditorFrame->hide();
513     additionalFrame->hide();
514     crossingFrame->hide();
515     TAZFrame->hide();
516     deleteFrame->hide();
517     polygonFrame->hide();
518     prohibitionFrame->hide();
519     /** currently createEdgeFrame unused
520     createEdgeFrame->hide();
521     **/
522     routeFrame->hide();
523     vehicleFrame->hide();
524     vehicleTypeFrame->hide();
525     stopFrame->hide();
526 }
527 
528 
529 void
setWidth(int frameWidth)530 GNEViewParent::Frames::setWidth(int frameWidth) {
531     // set width in all frames
532     inspectorFrame->setFrameWidth(frameWidth);
533     selectorFrame->setFrameWidth(frameWidth);
534     connectorFrame->setFrameWidth(frameWidth);
535     TLSEditorFrame->setFrameWidth(frameWidth);
536     additionalFrame->setFrameWidth(frameWidth);
537     crossingFrame->setFrameWidth(frameWidth);
538     TAZFrame->setFrameWidth(frameWidth);
539     deleteFrame->setFrameWidth(frameWidth);
540     polygonFrame->setFrameWidth(frameWidth);
541     prohibitionFrame->setFrameWidth(frameWidth);
542     /** currently createEdgeFrame unused
543     createEdgeFrame->setFrameWidth(frameWidth);
544     **/
545     routeFrame->setFrameWidth(frameWidth);
546     vehicleFrame->setFrameWidth(frameWidth);
547     vehicleTypeFrame->setFrameWidth(frameWidth);
548     stopFrame->setFrameWidth(frameWidth);
549 }
550 
551 
552 bool
isFrameShown() const553 GNEViewParent::Frames::isFrameShown() const {
554     // check all frames
555     if (inspectorFrame->shown()) {
556         return true;
557     } else if (selectorFrame->shown()) {
558         return true;
559     } else if (connectorFrame->shown()) {
560         return true;
561     } else if (TLSEditorFrame->shown()) {
562         return true;
563     } else if (additionalFrame->shown()) {
564         return true;
565     } else if (crossingFrame->shown()) {
566         return true;
567     } else if (TAZFrame->shown()) {
568         return true;
569     } else if (deleteFrame->shown()) {
570         return true;
571     } else if (polygonFrame->shown()) {
572         return true;
573     } else if (prohibitionFrame->shown()) {
574         return true;
575         /** currently createEdgeFrame unused
576         } else if (createEdgeFrame->shown()) {
577             return true;
578         **/
579     } else if (routeFrame->shown()) {
580         return true;
581     } else if (vehicleFrame->shown()) {
582         return true;
583     } else if (vehicleTypeFrame->shown()) {
584         return true;
585     } else if (stopFrame->shown()) {
586         return true;
587     } else {
588         return false;
589     }
590 }
591 
592 
593 GNEFrame*
getCurrentShownFrame() const594 GNEViewParent::Frames::getCurrentShownFrame() const {
595     // check all frames
596     if (inspectorFrame->shown()) {
597         return inspectorFrame;
598     } else if (selectorFrame->shown()) {
599         return selectorFrame;
600     } else if (connectorFrame->shown()) {
601         return connectorFrame;
602     } else if (TLSEditorFrame->shown()) {
603         return TLSEditorFrame;
604     } else if (additionalFrame->shown()) {
605         return additionalFrame;
606     } else if (crossingFrame->shown()) {
607         return crossingFrame;
608     } else if (TAZFrame->shown()) {
609         return TAZFrame;
610     } else if (deleteFrame->shown()) {
611         return deleteFrame;
612     } else if (polygonFrame->shown()) {
613         return polygonFrame;
614     } else if (prohibitionFrame->shown()) {
615         return prohibitionFrame;
616         /** currently createEdgeFrame unused
617         } else if (createEdgeFrame->shown()) {
618             return true;
619         **/
620     } else if (routeFrame->shown()) {
621         return routeFrame;
622     } else if (vehicleFrame->shown()) {
623         return vehicleFrame;
624     } else if (vehicleTypeFrame->shown()) {
625         return vehicleTypeFrame;
626     } else if (stopFrame->shown()) {
627         return stopFrame;
628     } else {
629         return nullptr;
630     }
631 }
632 
633 // ---------------------------------------------------------------------------
634 // GNEViewParent::ACChoosers - methods
635 // ---------------------------------------------------------------------------
636 
ACChoosers()637 GNEViewParent::ACChoosers::ACChoosers() :
638     ACChooserJunction(nullptr),
639     ACChooserEdges(nullptr),
640     ACChooserTLS(nullptr),
641     ACChooserAdditional(nullptr),
642     ACChooserPOI(nullptr),
643     ACChooserPolygon(nullptr),
644     ACChooserProhibition(nullptr) {
645 }
646 
647 
~ACChoosers()648 GNEViewParent::ACChoosers::~ACChoosers() {
649     // remove all  dialogs if are active
650     if (ACChooserJunction) {
651         delete ACChooserJunction ;
652     }
653     if (ACChooserEdges) {
654         delete ACChooserEdges ;
655     }
656     if (ACChooserTLS) {
657         delete ACChooserTLS ;
658     }
659     if (ACChooserAdditional) {
660         delete ACChooserAdditional ;
661     }
662     if (ACChooserPOI) {
663         delete ACChooserPOI ;
664     }
665     if (ACChooserPolygon) {
666         delete ACChooserPolygon ;
667     }
668     if (ACChooserProhibition) {
669         delete ACChooserProhibition;
670     }
671 }
672 
673 /****************************************************************************/
674 
675