SUMO - Simulation of Urban MObility
GNEApplicationWindow.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // The main window of Netedit (adapted from GUIApplicationWindow)
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #ifdef HAVE_VERSION_H
32 #include <version.h>
33 #endif
34 
35 #include <string>
36 #include <sstream>
37 #include <algorithm>
38 
39 #include <utils/common/ToString.h>
42 #include <utils/xml/XMLSubSys.h>
58 #include <netimport/NIFrame.h>
59 
60 #include "GNEApplicationWindow.h"
61 #include "GNELoadThread.h"
62 #include "GNEEvent_NetworkLoaded.h"
63 #include "GNEViewParent.h"
64 #include "GNEViewNet.h"
65 #include "GNEDialog_About.h"
66 #include "GNEDialog_Wizard.h"
67 #include "GNENet.h"
68 #include "GNEEdge.h"
69 #include "GNEJunction.h"
70 #include "GNEUndoList.h"
71 #include "GNEPOI.h"
72 #include "GNEAdditionalHandler.h"
73 
74 
75 // ===========================================================================
76 // FOX-declarations
77 // ===========================================================================
78 FXDEFMAP(GNEApplicationWindow) GNEApplicationWindowMap[] = {
79  //________Message_Type____________ID________________________Message_Handler________
80  FXMAPFUNC(SEL_COMMAND, MID_QUIT, GNEApplicationWindow::onCmdQuit),
81  FXMAPFUNC(SEL_SIGNAL, MID_QUIT, GNEApplicationWindow::onCmdQuit),
82  FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GNEApplicationWindow::onCmdQuit),
83 
91  FXMAPFUNC(SEL_COMMAND, MID_RELOAD, GNEApplicationWindow::onCmdReload),
92  FXMAPFUNC(SEL_COMMAND, MID_CLOSE, GNEApplicationWindow::onCmdClose),
93  FXMAPFUNC(SEL_UPDATE, MID_CLOSE, GNEApplicationWindow::onUpdNeedsNetwork),
94 
95  FXMAPFUNC(SEL_COMMAND, MID_ABOUT, GNEApplicationWindow::onCmdAbout),
97 
99  FXMAPFUNC(SEL_UPDATE, MID_OPEN_CONFIG, GNEApplicationWindow::onUpdOpen),
100  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GNEApplicationWindow::onUpdOpen),
104  FXMAPFUNC(SEL_UPDATE, MID_RELOAD, GNEApplicationWindow::onUpdReload),
105  FXMAPFUNC(SEL_UPDATE, MID_RECENTFILE, GNEApplicationWindow::onUpdOpen),
106  FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GNEApplicationWindow::onClipboardRequest),
107 
108  // forward requests to the active view
109  FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GNEApplicationWindow::onCmdLocate),
110  FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GNEApplicationWindow::onCmdLocate),
111  FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GNEApplicationWindow::onCmdLocate),
115  FXMAPFUNC(SEL_KEYPRESS, 0, GNEApplicationWindow::onKeyPress),
116  FXMAPFUNC(SEL_KEYRELEASE, 0, GNEApplicationWindow::onKeyRelease),
117 
120 
123  FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_MOVE, GNEApplicationWindow::onCmdSetMode),
133  FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_TLS, GNEApplicationWindow::onCmdSetMode),
139 
145  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_PLAIN_XML, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
147  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_JOINED, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
149  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_POIS, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
151  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_ADDITIONALS, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
153  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_ADDITIONALS_AS, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
154 
155  FXMAPFUNC(SEL_COMMAND, MID_GNE_ABORT, GNEApplicationWindow::onCmdAbort),
156  FXMAPFUNC(SEL_COMMAND, MID_GNE_HOTKEY_DEL, GNEApplicationWindow::onCmdDel),
159  FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEApplicationWindow::onCmdHelp),
166  FXMAPFUNC(SEL_COMMAND, MID_GNE_OPTIONS, GNEApplicationWindow::onCmdOptions),
168 };
169 
170 // Object implementation
171 FXIMPLEMENT(GNEApplicationWindow, FXMainWindow, GNEApplicationWindowMap, ARRAYNUMBER(GNEApplicationWindowMap))
172 
173 // ===========================================================================
174 // member method definitions
175 // ===========================================================================
176 #ifdef _MSC_VER
177 #pragma warning(push)
178 #pragma warning(disable: 4355)
179 #endif
180 GNEApplicationWindow::GNEApplicationWindow(FXApp* a, const std::string& configPattern) :
181  GUIMainWindow(a),
182  myLoadThread(0),
183  myAmLoading(false),
184  myRecentNets(a, "nets"),
185  myConfigPattern(configPattern),
186  hadDependentBuild(false),
187  myNet(0),
188  myUndoList(new GNEUndoList(this)),
189  myTitlePrefix("NETEDIT " VERSION_STRING) {
190  // init icons
192  // init Textures
194 }
195 #ifdef _MSC_VER
196 #pragma warning(pop)
197 #endif
198 
199 
200 void
202  // do this not twice
203  if (hadDependentBuild) {
204  WRITE_ERROR("DEBUG: GNEApplicationWindow::dependentBuild called twice");
205  return;
206  }
207  hadDependentBuild = true;
208 
209  setTarget(this);
210  setSelector(MID_WINDOW);
211 
212  // build menu bar
213  myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBarShell3);
214  myMenuBar = new FXMenuBar(myTopDock, myMenuBarDrag, GUIDesignBar);
215  new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
216  // build the thread - io
219 
220  // build the status bar
221  myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
222  {
223  myGeoFrame =
224  new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar);
225  myGeoCoordinate = new FXLabel(myGeoFrame, "N/A\t\tOriginal coordinate (before coordinate transformation in NETCONVERT)", 0, LAYOUT_CENTER_Y);
227  new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar);
228  myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A\t\tNetwork coordinate", 0, LAYOUT_CENTER_Y);
229  }
230  // make the window a mdi-window
231  myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
232  myMDIClient = new FXMDIClient(myMainSplitter, GUIDesignSplitterMDI);
233  myMDIMenu = new FXMDIMenu(this, myMDIClient);
234  // Due netedit only have a view, this buttons must be disabled (see #2807)
235  //new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
236  //new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
237  //new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
238  //new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
239 
240  // build the message window
242  myMainSplitter->setSplit(1, 65);
243  // fill menu and tool bar
244  fillMenuBar();
245  // build additional threads
246  myLoadThread = new GNELoadThread(getApp(), this, myEvents, myLoadThreadEvent);
247  // set the status bar
248  myStatusbar->getStatusLine()->setText("Ready.");
249  // set the caption
250  setTitle(myTitlePrefix);
251 
253 
254  //initialize some hotkeys
255  getAccelTable()->addAccel(parseAccel("e"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_CREATE_EDGE));
256  getAccelTable()->addAccel(parseAccel("m"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_MOVE));
257  getAccelTable()->addAccel(parseAccel("d"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_DELETE));
258  getAccelTable()->addAccel(parseAccel("i"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_INSPECT));
259  getAccelTable()->addAccel(parseAccel("s"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_SELECT));
260  getAccelTable()->addAccel(parseAccel("c"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_CONNECT));
261  getAccelTable()->addAccel(parseAccel("t"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_TLS));
262  getAccelTable()->addAccel(parseAccel("a"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL));
263  getAccelTable()->addAccel(parseAccel("r"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_CROSSING));
264  getAccelTable()->addAccel(parseAccel("Esc"), this, FXSEL(SEL_COMMAND, MID_GNE_ABORT));
265  getAccelTable()->addAccel(parseAccel("Del"), this, FXSEL(SEL_COMMAND, MID_GNE_HOTKEY_DEL));
266  getAccelTable()->addAccel(parseAccel("Enter"), this, FXSEL(SEL_COMMAND, MID_GNE_HOTKEY_ENTER));
267  getAccelTable()->addAccel(parseAccel("f"), this, FXSEL(SEL_COMMAND, MID_GNE_FOCUS_FRAME));
268  getAccelTable()->addAccel(parseAccel("v"), this, FXSEL(SEL_COMMAND, MID_EDITVIEWPORT));
269 }
270 
271 void
274  gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
275  FXMainWindow::create();
276  myMenuBarDrag->create();
277  myFileMenu->create();
278  myEditMenu->create();
279  //mySettingsMenu->create();
280  myWindowsMenu->create();
281  myHelpMenu->create();
282 
283  FXint width = getApp()->getNormalFont()->getTextWidth("8", 1) * 22;
284  myCartesianFrame->setWidth(width);
285  myGeoFrame->setWidth(width);
286 
287  show(PLACEMENT_DEFAULT);
288  if (!OptionsCont::getOptions().isSet("window-size")) {
289  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
290  maximize();
291  }
292  }
293 
294 }
295 
296 
298  closeAllWindows();
299  // Close icons
301  // Close gifs (Textures)
303  delete myGLVisual;
304  // must delete menus to avoid segfault on removing accelerators
305  // (http://www.fox-toolkit.net/faq#TOC-What-happens-when-the-application-s)
306  delete myFileMenu;
307  delete myEditMenu;
308  delete myLocatorMenu;
309  delete myProcessingMenu;
310  delete myWindowsMenu;
311  delete myHelpMenu;
312 
313  delete myLoadThread;
314 
315  while (!myEvents.empty()) {
316  // get the next event
317  GUIEvent* e = myEvents.top();
318  myEvents.pop();
319  delete e;
320  }
321  delete myUndoList;
322 }
323 
324 
325 void
327  FXMainWindow::detach();
328  myMenuBarDrag->detach();
329 }
330 
331 
332 void
334  // build file menu
335  myFileMenu = new FXMenuPane(this);
336  new FXMenuTitle(myMenuBar, "&File", 0, myFileMenu);
337  new FXMenuCommand(myFileMenu,
338  "&New Network...\tCtrl+N\tCreate a new network.",
340  new FXMenuCommand(myFileMenu,
341  "&Open Network...\tCtrl+O\tOpen a SUMO network.",
343  new FXMenuCommand(myFileMenu,
344  "Open Configura&tion...\tCtrl+T\tOpen a NETCONVERT configuration file.",
346  new FXMenuCommand(myFileMenu,
347  "Import &Foreign Network...\t\tImport a foreign network such as OSM.",
349  new FXMenuCommand(myFileMenu,
350  "Load S&hapes...\tCtrl+P\tLoad shapes into the network view.",
352  new FXMenuCommand(myFileMenu,
353  "Load A&dditionals...\tCtrl+D\tLoad additional elements.",
355  new FXMenuCommand(myFileMenu,
356  "&Reload\tCtrl+R\tReloads the network.",
358  new FXMenuCommand(myFileMenu,
359  "&Save Network...\tCtrl+S\tSave the network.",
361  new FXMenuCommand(myFileMenu,
362  "Save Net&work As...\tCtrl+Shift+S\tSave the network in another file.",
364  new FXMenuCommand(myFileMenu,
365  "Save plain XM&L...\tCtrl+L\tSave plain xml representation the network.",
367  new FXMenuCommand(myFileMenu,
368  "Save &joined junctions...\tCtrl+J\tSave log of joined junctions (allows reproduction of joins).",
370  new FXMenuCommand(myFileMenu,
371  "Save POIs As ...\tCtrl+Shift+P\tSave the POIs.",
373  new FXMenuCommand(myFileMenu,
374  "Save additionals\tCtrl+Shift+D\tSave additional elements.",
376  new FXMenuCommand(myFileMenu,
377  "Save additionals As...\t\tSave additional elements in another file.",
379  new FXMenuSeparator(myFileMenu);
380  new FXMenuCommand(myFileMenu,
381  "Close\tCtrl+W\tClose the net&work.",
383  // Recent files
384  FXMenuSeparator* sep1 = new FXMenuSeparator(myFileMenu);
385  sep1->setTarget(&myRecentConfigs);
386  sep1->setSelector(FXRecentFiles::ID_ANYFILES);
387  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_1);
388  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_2);
389  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_3);
390  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_4);
391  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_5);
392  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_6);
393  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_7);
394  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_8);
395  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_9);
396  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_10);
397  new FXMenuCommand(myFileMenu, "Clear Recent Configurat&ions", 0, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
398  myRecentConfigs.setTarget(this);
399  myRecentConfigs.setSelector(MID_RECENTFILE);
400  FXMenuSeparator* sep2 = new FXMenuSeparator(myFileMenu);
401  sep2->setTarget(&myRecentNets);
402  sep2->setSelector(FXRecentFiles::ID_ANYFILES);
403  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_1);
404  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_2);
405  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_3);
406  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_4);
407  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_5);
408  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_6);
409  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_7);
410  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_8);
411  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_9);
412  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_10);
413  new FXMenuCommand(myFileMenu, "Cl&ear Recent Networks", 0, &myRecentNets, FXRecentFiles::ID_CLEAR);
414  myRecentNets.setTarget(this);
415  myRecentNets.setSelector(MID_RECENTFILE);
416  new FXMenuSeparator(myFileMenu);
417  new FXMenuCommand(myFileMenu,
418  "&Quit\tCtrl+Q\tQuit the Application.",
419  0, this, MID_QUIT, 0);
420 
421  // build edit menu
422  myEditMenu = new FXMenuPane(this);
423  new FXMenuTitle(myMenuBar, "&Edit", 0, myEditMenu);
424 
425  // build undo/redo command
426  new FXMenuCommand(myEditMenu,
427  "&Undo\tCtrl+Z\tUndo the last change.",
428  GUIIconSubSys::getIcon(ICON_UNDO), myUndoList, FXUndoList::ID_UNDO);
429  new FXMenuCommand(myEditMenu,
430  "&Redo\tCtrl+Y\tRedo the last change.",
431  GUIIconSubSys::getIcon(ICON_REDO), myUndoList, FXUndoList::ID_REDO);
432 
433  new FXMenuSeparator(myEditMenu);
434 
435  // build modes command
436  new FXMenuCommand(myEditMenu,
437  "&Edge mode\tE\tCreate junction and edges.",
439  new FXMenuCommand(myEditMenu,
440  "&Move mode\tM\tMove elements.",
442  new FXMenuCommand(myEditMenu,
443  "&Delete mode\tD\tDelete elements.",
445  new FXMenuCommand(myEditMenu,
446  "&Inspect mode\tI\tInspect elements and change their attributes.",
448  new FXMenuCommand(myEditMenu,
449  "&Select mode\tS\tSelect elements.",
451  new FXMenuCommand(myEditMenu,
452  "&Connection mode\tC\tEdit connections between lanes.",
454  new FXMenuCommand(myEditMenu,
455  "&Traffic light mode\tT\tEdit traffic lights over junctions.",
457  new FXMenuCommand(myEditMenu,
458  "&Additional mode\tA\tCreate additional elements.",
460  new FXMenuCommand(myEditMenu,
461  "C&rossing mode\tR\tCreate crossings between edges.",
463 
464  /*
465  new FXMenuSeparator(myEditMenu);
466  new FXMenuCommand(myEditMenu,
467  "Edit Breakpoints...\t\tOpens a Dialog for editing breakpoints.",
468  0, this, MID_EDIT_BREAKPOINTS);
469  */
470 
471  // processing menu (trigger netbuild computations)
472  myProcessingMenu = new FXMenuPane(this);
473  new FXMenuTitle(myMenuBar, "&Processing", 0, myProcessingMenu);
474  new FXMenuCommand(myProcessingMenu,
475  "Compute Junctions\tF5\tComputes junction shape and logic.",
477  new FXMenuCommand(myProcessingMenu,
478  "Clean Junctions\tF6\tRemoves solitary junctions.",
480  new FXMenuCommand(myProcessingMenu,
481  "Join Selected Junctions\tF7\tJoins selected junctions into a single junction.",
483  new FXMenuCommand(myProcessingMenu,
484  "Options\tF10\t\tConfigure Processing Options.",
486  // build settings menu
487  /*
488  mySettingsMenu = new FXMenuPane(this);
489  new FXMenuTitle(myMenuBar,"&Settings",0,mySettingsMenu);
490  new FXMenuCheck(mySettingsMenu,
491  "Gaming Mode\t\tToggle gaming mode on/off.",
492  this,MID_GAMING);
493  */
494  // build Locate menu
495  myLocatorMenu = new FXMenuPane(this);
496  new FXMenuTitle(myMenuBar, "&Locate", NULL, myLocatorMenu);
497  new FXMenuCommand(myLocatorMenu,
498  "Locate &Junctions\tShift+J\tOpen a Dialog for Locating a Junction.",
500  new FXMenuCommand(myLocatorMenu,
501  "Locate &Edges\tShift+E\tOpen a Dialog for Locating an Edge.",
503  new FXMenuCommand(myLocatorMenu,
504  "Locate &TLS\tShift+T\tOpen a Dialog for Locating a Traffic Light.",
506 
507  // build windows menu
508  myWindowsMenu = new FXMenuPane(this);
509  new FXMenuTitle(myMenuBar, "&Windows", 0, myWindowsMenu);
510  new FXMenuCheck(myWindowsMenu,
511  "&Show Status Line\t\tToggle this Status Bar on/off.",
512  myStatusbar, FXWindow::ID_TOGGLESHOWN);
513  new FXMenuCheck(myWindowsMenu,
514  "Show &Message Window\t\tToggle the Message Window on/off.",
515  myMessageWindow, FXWindow::ID_TOGGLESHOWN);
516  /*
517  new FXMenuSeparator(myWindowsMenu);
518  new FXMenuCommand(myWindowsMenu,"Tile &Horizontally",
519  GUIIconSubSys::getIcon(ICON_WINDOWS_TILE_HORI),
520  myMDIClient,FXMDIClient::ID_MDI_TILEHORIZONTAL);
521  new FXMenuCommand(myWindowsMenu,"Tile &Vertically",
522  GUIIconSubSys::getIcon(ICON_WINDOWS_TILE_VERT),
523  myMDIClient,FXMDIClient::ID_MDI_TILEVERTICAL);
524  new FXMenuCommand(myWindowsMenu,"C&ascade",
525  GUIIconSubSys::getIcon(ICON_WINDOWS_CASCADE),
526  myMDIClient,FXMDIClient::ID_MDI_CASCADE);
527  new FXMenuCommand(myWindowsMenu,"&Close",0,
528  myMDIClient,FXMDIClient::ID_MDI_CLOSE);
529  sep1=new FXMenuSeparator(myWindowsMenu);
530  sep1->setTarget(myMDIClient);
531  sep1->setSelector(FXMDIClient::ID_MDI_ANY);
532  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_1);
533  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_2);
534  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_3);
535  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_4);
536  new FXMenuCommand(myWindowsMenu,"&Others...",0,myMDIClient,FXMDIClient::ID_MDI_OVER_5);
537  new FXMenuSeparator(myWindowsMenu);
538  */
539  new FXMenuCommand(myWindowsMenu,
540  "&Clear Message Window\t\tClear the message window.",
541  0, this, MID_CLEARMESSAGEWINDOW);
542 
543  // build help menu
544  myHelpMenu = new FXMenuPane(this);
545  new FXMenuTitle(myMenuBar,
546  "&Help",
547  0, myHelpMenu);
548  new FXMenuCommand(myHelpMenu,
549  "&Online Documentation\tF1\tOpen Online documentation.",
550  0, this, MID_HELP);
551  new FXMenuCommand(myHelpMenu,
552  "&About\tF2\tAbout netedit.",
553  0, this, MID_ABOUT);
554 }
555 
556 
557 long
558 GNEApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
560  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
561  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
562  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
563  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
564  getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
565  if (isMaximized()) {
566  getApp()->reg().writeIntEntry("SETTINGS", "maximized", 1);
567  } else {
568  getApp()->reg().writeIntEntry("SETTINGS", "maximized", 0);
569  }
570  getApp()->exit(0);
571  }
572  return 1;
573 }
574 
575 
576 long
577 GNEApplicationWindow::onCmdEditChosen(FXObject*, FXSelector, void*) {
578  GUIDialog_GLChosenEditor* chooser =
580  chooser->create();
581  chooser->show();
582  return 1;
583 }
584 
585 
586 long
587 GNEApplicationWindow::onCmdNewNetwork(FXObject*, FXSelector, void*) {
588  // ask before we clobber options
590  return 1;
591  }
595  loadConfigOrNet("", true, false, true, true);
596  return 1;
597 }
598 
599 
600 long
601 GNEApplicationWindow::onCmdOpenConfiguration(FXObject*, FXSelector, void*) {
602  // get the new file name
603  FXFileDialog opendialog(this, "Open Netconvert Configuration");
604  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
605  opendialog.setSelectMode(SELECTFILE_EXISTING);
606  opendialog.setPatternList(myConfigPattern.c_str());
607  if (gCurrentFolder.length() != 0) {
608  opendialog.setDirectory(gCurrentFolder);
609  }
610  if (opendialog.execute()) {
611  gCurrentFolder = opendialog.getDirectory();
612  std::string file = opendialog.getFilename().text();
613  loadConfigOrNet(file, false);
614  myRecentConfigs.appendFile(file.c_str());
615  }
616  return 1;
617 }
618 
619 
620 long
621 GNEApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
622  // get the new file name
623  FXFileDialog opendialog(this, "Open Network");
624  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
625  opendialog.setSelectMode(SELECTFILE_EXISTING);
626  opendialog.setPatternList("SUMO nets (*.net.xml)\nAll files (*)");
627  if (gCurrentFolder.length() != 0) {
628  opendialog.setDirectory(gCurrentFolder);
629  }
630  if (opendialog.execute()) {
631  gCurrentFolder = opendialog.getDirectory();
632  std::string file = opendialog.getFilename().text();
633  loadConfigOrNet(file, true);
634  myRecentNets.appendFile(file.c_str());
635  }
636  return 1;
637 }
638 
639 
640 long
641 GNEApplicationWindow::onCmdOpenForeign(FXObject*, FXSelector, void*) {
642  // ask before we clobber options
644  return 1;
645  }
646  // get the new file name
647  FXFileDialog opendialog(this, "Import Foreign Network");
648  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
649  opendialog.setSelectMode(SELECTFILE_EXISTING);
650  FXString osmPattern("OSM net (*.osm.xml,*.osm)");
651  opendialog.setPatternText(0, osmPattern);
652  if (gCurrentFolder.length() != 0) {
653  opendialog.setDirectory(gCurrentFolder);
654  }
655  if (opendialog.execute()) {
656  gCurrentFolder = opendialog.getDirectory();
657  std::string file = opendialog.getFilename().text();
658 
661  if (osmPattern.contains(opendialog.getPattern())) {
662  oc.set("osm-files", file);
663  oc.set("ramps.guess", "true");
664  oc.set("tls.guess", "true");
665  } else {
666  throw ProcessError("Attempted to import unknown file format '" + file + "'.");
667  }
668 
669  GNEDialog_Wizard* wizard =
670  new GNEDialog_Wizard(this, "Select Import Options", getWidth(), getHeight());
671 
672  if (wizard->execute()) {
673  NIFrame::checkOptions(); // needed to set projection parameters
674  loadConfigOrNet(file, false, false, false);
675  }
676  }
677  return 1;
678 }
679 
680 
681 long
682 GNEApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
683  // get the shape file name
684  FXFileDialog opendialog(this, "Open Shapes");
685  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
686  opendialog.setSelectMode(SELECTFILE_EXISTING);
687  opendialog.setPatternList("Additional files (*.xml)\nAll files (*)");
688  if (gCurrentFolder.length() != 0) {
689  opendialog.setDirectory(gCurrentFolder);
690  }
691  if (opendialog.execute()) {
692  gCurrentFolder = opendialog.getDirectory();
693  std::string file = opendialog.getFilename().text();
694  GNEShapeHandler handler(file, myNet, myNet->getShapeContainer());
695  if (!XMLSubSys::runParser(handler, file, false)) {
696  WRITE_MESSAGE("Loading of " + file + " failed.");
697  }
698  update();
699  }
700  return 1;
701 }
702 
703 
704 long
705 GNEApplicationWindow::onCmdOpenAdditionals(FXObject*, FXSelector, void*) {
706  // get the shape file name
707  FXFileDialog opendialog(this, "Open Additional");
708  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
709  opendialog.setSelectMode(SELECTFILE_EXISTING);
710  opendialog.setPatternList("Additional files (*.xml)\nAll files (*)");
711  if (gCurrentFolder.length() != 0) {
712  opendialog.setDirectory(gCurrentFolder);
713  }
714  if (opendialog.execute()) {
715  gCurrentFolder = opendialog.getDirectory();
716  std::string file = opendialog.getFilename().text();
717  // Start operation for undo/redo
718  myUndoList->p_begin("load additionals");
719  // Create additional handler
720  GNEAdditionalHandler additionalHandler(file, myNet->getViewNet());
721  // Run parser
722  if (!XMLSubSys::runParser(additionalHandler, file, false)) {
723  WRITE_MESSAGE("Loading of " + file + " failed.");
724  // Abort undo/redo
725  myUndoList->abort();
726  } else {
727  // reset last tag (needed if user want to load more additionals)
728  additionalHandler.resetLastTag();
729  // commit undo/redo operation
730  myUndoList->p_end();
731  update();
732  }
733  }
734  return 1;
735 }
736 
737 
738 long
739 GNEApplicationWindow::onCmdOpenRecent(FXObject* sender, FXSelector, void* data) {
740  if (myAmLoading) {
741  myStatusbar->getStatusLine()->setText("Already loading!");
742  return 1;
743  }
744  std::string file((const char*)data);
745  loadConfigOrNet(file, sender == &myRecentNets);
746  return 1;
747 }
748 
749 
750 long
751 GNEApplicationWindow::onCmdReload(FXObject*, FXSelector, void*) {
752  // @note. If another network has been load during this session, it might not be desirable to set useStartupOptions
753  loadConfigOrNet(OptionsCont::getOptions().getString("sumo-net-file"), true, true);
754  return 1;
755 }
756 
757 
758 long
759 GNEApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
761  closeAllWindows();
762  }
763  return 1;
764 }
765 
766 
767 long
768 GNEApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
769  if (myMDIClient->numChildren() > 0) {
770  GNEViewParent* w = dynamic_cast<GNEViewParent*>(myMDIClient->getActiveChild());
771  if (w != 0) {
772  w->onCmdLocate(0, sel, 0);
773  }
774  }
775  return 1;
776 }
777 
778 long
779 GNEApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void*) {
780  sender->handle(this, myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
781  return 1;
782 }
783 
784 
785 long
786 GNEApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
788  return 1;
789 }
790 
791 
792 long
793 GNEApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
794  GNEDialog_About* about = new GNEDialog_About(this);
795  about->create();
796  about->show(PLACEMENT_OWNER);
797  return 1;
798 }
799 
800 
801 long GNEApplicationWindow::onClipboardRequest(FXObject*, FXSelector, void* ptr) {
802  FXEvent* event = (FXEvent*)ptr;
803  FXString string = GUIUserIO::clipped.c_str();
804  setDNDData(FROM_CLIPBOARD, event->target, string);
805  return 1;
806 }
807 
808 
809 long
810 GNEApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
811  eventOccured();
812  return 1;
813 }
814 
815 
816 void
818  while (!myEvents.empty()) {
819  // get the next event
820  GUIEvent* e = myEvents.top();
821  myEvents.pop();
822  // process
823  switch (e->getOwnType()) {
826  break;
829  case EVENT_ERROR_OCCURED:
831  break;
832  default:
833  break;
834  }
835  delete e;
836  }
837 }
838 
839 
840 void
842  myAmLoading = false;
843  GNEEvent_NetworkLoaded* ec = static_cast<GNEEvent_NetworkLoaded*>(e);
844  // check whether the loading was successfull
845  if (ec->myNet == 0) {
846  // report failure
847  setStatusBarText("Loading of '" + ec->myFile + "' failed!");
848  } else {
849  myNet = ec->myNet;
850  // report success
851  setStatusBarText("'" + ec->myFile + "' loaded.");
852  // initialise views
853  myViewNumber = 0;
855  if (view && ec->mySettingsFile != "") {
856  GUISettingsHandler settings(ec->mySettingsFile);
857  std::string settingsName = settings.addSettings(view);
858  view->addDecals(settings.getDecals());
859  settings.applyViewport(view);
860  settings.setSnapshots(view);
861  }
862  // set network name on the caption
863  setTitle(MFXUtils::getTitleText(myTitlePrefix, ec->myFile.c_str()));
865  gSchemeStorage.setViewport(getView()); // refit the network to accomodate mode specific panel
866  if (ec->myViewportFromRegistry) {
867  Position off, p;
868  off.set(getApp()->reg().readRealEntry("viewport", "x"), getApp()->reg().readRealEntry("viewport", "y"), getApp()->reg().readRealEntry("viewport", "z"));
869  getView()->setViewportFromTo(off, p);
870  }
871  }
872  getApp()->endWaitCursor();
874  // check if additionals has to be loaded at start
875  if (OptionsCont::getOptions().isSet("sumo-additionals-file") && myNet) {
876  myAdditionalsFile = OptionsCont::getOptions().getString("sumo-additionals-file");
877  WRITE_MESSAGE("Loading additionals from '" + myAdditionalsFile + "'");
879  // Run parser
880  if (!XMLSubSys::runParser(additionalHandler, myAdditionalsFile, false)) {
881  WRITE_ERROR("Loading of " + myAdditionalsFile + " failed.");
882  } else {
883  // reset last tag (needed if user want to load more additionals)
884  additionalHandler.resetLastTag();
885  }
886  }
887  // check if additionals output must be changed
888  if (OptionsCont::getOptions().isSet("additionals-output")) {
889  myAdditionalsFile = OptionsCont::getOptions().getString("additionals-output");
890  }
891 
892  update();
893 }
894 
895 
896 void
898  GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
900 }
901 
902 
903 void
904 GNEApplicationWindow::loadConfigOrNet(const std::string file, bool isNet, bool isReload, bool useStartupOptions, bool newNet) {
906  return;
907  }
908  getApp()->beginWaitCursor();
909  myAmLoading = true;
910  closeAllWindows();
911  if (isReload) {
912  myLoadThread->start();
913  setStatusBarText("Reloading.");
914  } else {
915  gSchemeStorage.saveViewport(0, 0, -1); // recenter view
916  myLoadThread->loadConfigOrNet(file, isNet, useStartupOptions, newNet);
917  setStatusBarText("Loading '" + file + "'.");
918  }
919  update();
920 }
921 
922 
923 
926  std::string caption = "View #" + toString(myViewNumber++);
927  FXuint opts = MDI_TRACKING;
928  GNEViewParent* viewParent = new GNEViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()), this, getBuildGLCanvas(),
929  myNet, myUndoList, NULL, opts, 10, 10, 300, 200);
930  if (myMDIClient->numChildren() == 1) {
931  viewParent->maximize();
932  } else {
933  myMDIClient->vertical(true);
934  }
935  myMDIClient->setActiveChild(viewParent);
936  //v->grabKeyboard();
937  return viewParent->getView();
938 }
939 
940 
941 FXGLCanvas*
943  if (myMDIClient->numChildren() == 0) {
944  return 0;
945  }
946  GNEViewParent* share_tmp1 =
947  static_cast<GNEViewParent*>(myMDIClient->childAtIndex(0));
948  return share_tmp1->getBuildGLCanvas();
949 }
950 
951 
952 SUMOTime
954  return 0;
955 }
956 
957 
960  return myUndoList;
961 }
962 
963 
964 void
967  // remove trackers and other external windows
968  for (int i = 0; i < (int)mySubWindows.size(); ++i) {
969  mySubWindows[i]->destroy();
970  }
971  for (int i = 0; i < (int)myTrackerWindows.size(); ++i) {
972  myTrackerWindows[i]->destroy();
973  }
974  // reset the caption
975  setTitle(myTitlePrefix);
976  // delete other children
977  while (myTrackerWindows.size() != 0) {
978  delete myTrackerWindows[0];
979  }
980  while (mySubWindows.size() != 0) {
981  delete mySubWindows[0];
982  }
983  mySubWindows.clear();
984  // clear selected items
985  gSelected.clear();
986  // add a separator to the log
989  // remove coordinate information
990  myGeoCoordinate->setText("N/A");
991  myCartesianCoordinate->setText("N/A");
992 
993  myUndoList->p_clear();
994  if (myNet != 0) {
995  delete myNet;
996  myNet = 0;
998  }
1000  // Reset textures
1002 }
1003 
1004 
1005 FXCursor*
1007  return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
1008 }
1009 
1010 
1011 void
1013  const OptionsCont& oc = OptionsCont::getOptions();
1014  loadConfigOrNet("", true, false, true, oc.getBool("new"));
1015 }
1016 
1017 
1018 void
1019 GNEApplicationWindow::setStatusBarText(const std::string& statusBarText) {
1020  myStatusbar->getStatusLine()->setText(statusBarText.c_str());
1021  myStatusbar->getStatusLine()->setNormalText(statusBarText.c_str());
1022 }
1023 
1024 
1025 void
1026 GNEApplicationWindow::setAdditionalsFile(const std::string& additionalsFile) {
1027  myAdditionalsFile = additionalsFile;
1028 }
1029 
1030 
1031 long
1032 GNEApplicationWindow::onCmdSetMode(FXObject*, FXSelector sel, void*) {
1033  if (getView()) {
1034  getView()->setEditModeFromHotkey(FXSELID(sel));
1035  }
1036  return 1;
1037 }
1038 
1039 
1040 long
1041 GNEApplicationWindow::onCmdAbort(FXObject*, FXSelector, void*) {
1042  if (getView()) {
1043  getView()->abortOperation();
1044  getView()->update();
1045  }
1046  return 1;
1047 }
1048 
1049 
1050 long
1051 GNEApplicationWindow::onCmdDel(FXObject*, FXSelector, void*) {
1052  if (getView()) {
1053  getView()->hotkeyDel();
1054  }
1055  return 1;
1056 }
1057 
1058 
1059 long
1060 GNEApplicationWindow::onCmdEnter(FXObject*, FXSelector, void*) {
1061  if (getView()) {
1062  getView()->hotkeyEnter();
1063  }
1064  return 1;
1065 }
1066 
1067 
1068 long
1069 GNEApplicationWindow::onCmdFocusFrame(FXObject*, FXSelector, void*) {
1070  if (getView()) {
1072  }
1073  return 1;
1074 }
1075 
1076 
1077 long
1078 GNEApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
1079  if (getView()) {
1081  }
1082  return 1;
1083 }
1084 
1085 
1086 long
1087 GNEApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
1088  FXLinkLabel::fxexecute("http://sumo.dlr.de/wiki/NETEDIT");
1089  return 1;
1090 }
1091 
1092 
1093 long
1094 GNEApplicationWindow::onCmdComputeJunctions(FXObject*, FXSelector, void*) {
1095  myNet->computeEverything(this, true);
1096  updateControls();
1097  return 1;
1098 }
1099 
1100 
1101 long
1102 GNEApplicationWindow::onCmdCleanJunctions(FXObject*, FXSelector, void*) {
1104  return 1;
1105 }
1106 
1107 
1108 long
1109 GNEApplicationWindow::onCmdJoinJunctions(FXObject*, FXSelector, void*) {
1111  return 1;
1112 }
1113 
1114 
1115 long
1116 GNEApplicationWindow::onCmdOptions(FXObject*, FXSelector, void*) {
1117  GNEDialog_Wizard* wizard =
1118  new GNEDialog_Wizard(this, "Configure Options", getWidth(), getHeight());
1119 
1120  if (wizard->execute()) {
1121  NIFrame::checkOptions(); // needed to set projection parameters
1122  }
1123  return 1;
1124 }
1125 
1126 
1127 long
1128 GNEApplicationWindow::onCmdSaveAsNetwork(FXObject*, FXSelector, void*) {
1129  FXString file = MFXUtils::getFilename2Write(this,
1130  "Save Network as", ".net.xml",
1132  gCurrentFolder);
1133  if (file == "") {
1134  return 1;
1135  }
1137  oc.resetWritable();
1138  oc.set("output-file", file.text());
1139  setTitle(MFXUtils::getTitleText(myTitlePrefix, file));
1140  onCmdSaveNetwork(0, 0, 0);
1141  return 1;
1142 }
1143 
1144 
1145 long
1146 GNEApplicationWindow::onCmdSaveAsPlainXML(FXObject*, FXSelector, void*) {
1147  FXString file = MFXUtils::getFilename2Write(this,
1148  "Select name of the plain-xml edge-file (other names will be deduced from this)", "",
1150  gCurrentFolder);
1151  if (file == "") {
1152  return 1;
1153  }
1155  bool wasSet = oc.isSet("plain-output-prefix");
1156  std::string oldPrefix = oc.getString("plain-output-prefix");
1157  oc.resetWritable();
1158  std::string prefix = file.text();
1159  // if last character is a dot, remove it
1160  if (prefix.at(prefix.size() - 1) == '.') {
1161  prefix = prefix.substr(0, prefix.size() - 1);
1162  }
1163  oc.set("plain-output-prefix", prefix);
1164  getApp()->beginWaitCursor();
1165  try {
1166  myNet->savePlain(oc);
1167  myUndoList->unmark();
1168  myUndoList->mark();
1169  } catch (IOError& e) {
1170  // write warning if netedit is running in testing mode
1171  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1172  WRITE_WARNING("Opening FXMessageBox of type 'error'");
1173  }
1174  // open message box
1175  FXMessageBox::error(this, MBOX_OK, "Saving plain xml failed!", "%s", e.what());
1176  // write warning if netedit is running in testing mode
1177  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1178  WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
1179  }
1180  }
1181  myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Plain XML saved with prefix '" + prefix + "'.\n");
1183  if (wasSet) {
1184  oc.resetWritable();
1185  oc.set("plain-output-prefix", oldPrefix);
1186  } else {
1187  oc.unSet("plain-output-prefix");
1188  }
1189  getApp()->endWaitCursor();
1190  return 1;
1191 }
1192 
1193 
1194 long
1195 GNEApplicationWindow::onCmdSaveJoined(FXObject*, FXSelector, void*) {
1196  FXString file = MFXUtils::getFilename2Write(this,
1197  "Select name of the joined-junctions file", ".nod.xml",
1199  gCurrentFolder);
1200  if (file == "") {
1201  return 1;
1202  }
1204  bool wasSet = oc.isSet("junctions.join-output");
1205  std::string oldFile = oc.getString("junctions.join-output");
1206  oc.resetWritable();
1207  std::string filename = file.text();
1208  oc.set("junctions.join-output", filename);
1209  getApp()->beginWaitCursor();
1210  try {
1211  myNet->saveJoined(oc);
1212  } catch (IOError& e) {
1213  // write warning if netedit is running in testing mode
1214  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1215  WRITE_WARNING("Opening FXMessageBox of type 'error'");
1216  }
1217  // opening error message
1218  FXMessageBox::error(this, MBOX_OK, "Saving joined junctions failed!", "%s", e.what());
1219  // write warning if netedit is running in testing mode
1220  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1221  WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
1222  }
1223  }
1224  myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Joined junctions saved to '" + filename + "'.\n");
1226  if (wasSet) {
1227  oc.resetWritable();
1228  oc.set("junctions.join-output", oldFile);
1229  } else {
1230  oc.unSet("junctions.join-output");
1231  }
1232  getApp()->endWaitCursor();
1233  return 1;
1234 }
1235 
1236 
1237 long
1238 GNEApplicationWindow::onCmdSavePois(FXObject*, FXSelector, void*) {
1239  FXString file = MFXUtils::getFilename2Write(this,
1240  "Select name of the POI file", ".xml",
1242  gCurrentFolder);
1243  if (file == "") {
1244  return 1;
1245  }
1246  std::string filename = file.text();
1247  // XXX Not yet implemented
1248  getApp()->beginWaitCursor();
1249  try {
1250  GNEPOI::saveToFile(filename);
1251  } catch (IOError& e) {
1252  // write warning if netedit is running in testing mode
1253  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1254  WRITE_WARNING("Opening FXMessageBox of type 'error'");
1255  }
1256  // open error dialog box
1257  FXMessageBox::error(this, MBOX_OK, "Saving POIs failed!", "%s", e.what());
1258  // write warning if netedit is running in testing mode
1259  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1260  WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
1261  }
1262  }
1264  getApp()->endWaitCursor();
1265  return 1;
1266 }
1267 
1268 
1269 long
1270 GNEApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void*) {
1271  sender->handle(this, myNet == 0 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
1272  return 1;
1273 }
1274 
1275 
1276 long
1277 GNEApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void*) {
1278  sender->handle(this, myNet == 0 || !OptionsCont::getOptions().isSet("sumo-net-file") ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
1279  return 1;
1280 }
1281 
1282 
1283 long
1284 GNEApplicationWindow::onCmdSaveNetwork(FXObject*, FXSelector, void*) {
1286  // function onCmdSaveAsNetwork must be executed if this is the first save
1287  if (oc.getString("output-file") == "") {
1288  return onCmdSaveAsNetwork(0, 0, 0);
1289  } else {
1290  getApp()->beginWaitCursor();
1291  try {
1292  myNet->save(oc);
1293  myUndoList->unmark();
1294  myUndoList->mark();
1295  } catch (IOError& e) {
1296  // write warning if netedit is running in testing mode
1297  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1298  WRITE_WARNING("Opening FXMessageBox of type 'error'");
1299  }
1300  // open error message box
1301  FXMessageBox::error(this, MBOX_OK, "Saving Network failed!", "%s", e.what());
1302  // write warning if netedit is running in testing mode
1303  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1304  WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
1305  }
1306  }
1307  myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Network saved in " + oc.getString("output-file") + ".\n");
1309  getApp()->endWaitCursor();
1310  return 1;
1311  }
1312 }
1313 
1314 
1315 long
1316 GNEApplicationWindow::onCmdSaveAdditionals(FXObject*, FXSelector, void*) {
1317  // Check if additionals file was already set at start of netedit or with a previous save
1318  if (myAdditionalsFile == "") {
1319  FXString file = MFXUtils::getFilename2Write(this,
1320  "Select name of the additional file", ".xml",
1322  gCurrentFolder);
1323  if (file == "") {
1324  // None additionals file was selected, then stop function
1325  return 0;
1326  } else {
1327  myAdditionalsFile = file.text();
1328  }
1329  }
1330  // Start saving additionals
1331  getApp()->beginWaitCursor();
1332  try {
1334  myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Additionals saved in " + myAdditionalsFile + ".\n");
1335  } catch (IOError& e) {
1336  // write warning if netedit is running in testing mode
1337  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1338  WRITE_WARNING("Opening FXMessageBox of type 'error'");
1339  }
1340  // open error message box
1341  FXMessageBox::error(this, MBOX_OK, "Saving additionals failed!", "%s", e.what());
1342  // write warning if netedit is running in testing mode
1343  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1344  WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
1345  }
1346  }
1348  getApp()->endWaitCursor();
1349  return 1;
1350 }
1351 
1352 
1353 long
1354 GNEApplicationWindow::onCmdSaveAdditionalsAs(FXObject*, FXSelector, void*) {
1355  // Open window to select additionasl file
1356  FXString file = MFXUtils::getFilename2Write(this,
1357  "Select name of the additional file", ".xml",
1359  gCurrentFolder);
1360  if (file != "") {
1361  // Set new additional file
1362  myAdditionalsFile = file.text();
1363  // save additionals
1364  return onCmdSaveAdditionals(0, 0, 0);
1365  } else {
1366  return 1;
1367  }
1368 }
1369 
1370 
1371 long
1372 GNEApplicationWindow::onUpdSaveNetwork(FXObject* sender, FXSelector, void*) {
1374  bool enable = myNet != 0 && oc.isSet("output-file");
1375  sender->handle(this, FXSEL(SEL_COMMAND, enable ? ID_ENABLE : ID_DISABLE), 0);
1376  if (enable) {
1377  FXString caption = ("Save " + oc.getString("output-file")).c_str();
1378  sender->handle(this, FXSEL(SEL_COMMAND, FXMenuCaption::ID_SETSTRINGVALUE), (void*)&caption);
1379  }
1380  return 1;
1381 }
1382 
1383 
1384 GNEViewNet*
1386  if (mySubWindows.size() != 0) {
1387  return (GNEViewNet*)(((GUIGlChildWindow*)mySubWindows[0])->getView());
1388  } else {
1389  return 0;
1390  }
1391 }
1392 
1393 
1394 bool
1396  FXuint answer = 0;
1397  if (myUndoList->canUndo() && !myUndoList->marked()) {
1398  // write warning if netedit is running in testing mode
1399  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1400  WRITE_WARNING("Opening FXMessageBox of type 'question'");
1401  }
1402  // open question box
1403  answer = FXMessageBox::question(this, MBOX_QUIT_SAVE_CANCEL,
1404  "Confirm closing Network", "%s",
1405  "You have unsaved changes in the network. Do you wish to quit and discard all changes?");
1406  if (answer == MBOX_CLICKED_QUIT) {
1407  // write warning if netedit is running in testing mode
1408  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1409  WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Quit'");
1410  }
1412  } else if (answer == MBOX_CLICKED_SAVE) {
1413  onCmdSaveNetwork(0, 0, 0);
1414  if (!myUndoList->marked()) {
1415  // saving failed
1416  return false;
1417  }
1419  } else {
1420  // write warning if netedit is running in testing mode
1421  if ((answer == 2) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
1422  WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
1423  } else if ((answer == 4) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
1424  WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
1425  }
1426  // return false to stop closing/reloading
1427  return false;
1428  }
1429  } else {
1431  }
1432 }
1433 
1434 bool
1436  // Check if there are non saved additionals
1437  if ((myNet != NULL) && (myNet->getNumberOfAdditionals() > 0) && (myNet->isAdditionalsSaved() == false)) {
1438  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1439  WRITE_WARNING("Opening FXMessageBox of type 'question'");
1440  }
1441  // open question box
1442  FXuint answer = FXMessageBox::question(this, MBOX_QUIT_SAVE_CANCEL,
1443  "Save additionals before exit", "%s",
1444  "You have unsaved additionals. Do you wish to quit and discard all changes?");
1445  // if answer was affirmative, but there was an error during saving additional, return false to stop closing/reloading
1446  if (answer == MBOX_CLICKED_QUIT) {
1447  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1448  WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Quit'");
1449  }
1450  return true;
1451  } else if (answer == MBOX_CLICKED_SAVE) {
1452  // write warning if netedit is running in testing mode
1453  if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
1454  WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'");
1455  }
1456  if (onCmdSaveAdditionals(0, 0, 0) == 0) {
1457  return false;
1458  }
1459  } else {
1460  // write warning if netedit is running in testing mode
1461  if ((answer == 2) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
1462  WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
1463  } else if ((answer == 4) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
1464  WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
1465  }
1466  return false;
1467  }
1468  }
1469  // clear undo list and return true to continue with closing/reload
1470  myUndoList->p_clear(); //only ask once
1471  return true;
1472 }
1473 
1474 
1476  ShapeHandler(file, sc),
1477  myNet(net) {}
1478 
1479 
1481 
1482 
1483 Position
1484 GNEApplicationWindow::GNEShapeHandler::getLanePos(const std::string& poiID, const std::string& laneID, double lanePos) {
1485  std::string edgeID = laneID;
1486  int lane = 0;
1487  const std::string::size_type underscore = laneID.rfind('_');
1488 
1489  if (underscore != std::string::npos) {
1490  edgeID = laneID.substr(0, underscore);
1491  if (laneID.substr(underscore).empty()) {
1492  lane = 0;
1493  } else {
1494  lane = GNEAttributeCarrier::parse<int>(laneID.substr(underscore).c_str());
1495  }
1496  }
1497  NBEdge* edge = myNet->retrieveEdge(edgeID)->getNBEdge();
1498  if (edge == 0 || edge->getNumLanes() <= lane) {
1499  WRITE_ERROR("Lane '" + laneID + "' to place poi '" + poiID + "' on is not known.");
1500  return Position::INVALID;
1501  }
1502  if (lanePos < 0) {
1503  lanePos = edge->getLength() + lanePos;
1504  }
1505  return edge->getLanes()[lane].shape.positionAtOffset(lanePos);
1506 }
1507 
1508 
1509 void
1511  GNEViewNet* view = getView();
1512  if (view != 0) {
1513  view->updateControls();
1514  }
1515 }
1516 
1517 
1518 long
1519 GNEApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* data) {
1520  const long handled = FXMainWindow::onKeyPress(o, sel, data);
1521  if (handled == 0 && myMDIClient->numChildren() > 0) {
1522  GNEViewParent* w = dynamic_cast<GNEViewParent*>(myMDIClient->getActiveChild());
1523  if (w != 0) {
1524  w->onKeyPress(0, sel, data);
1525  }
1526  }
1527  return 0;
1528 }
1529 
1530 
1531 long
1532 GNEApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* data) {
1533  const long handled = FXMainWindow::onKeyRelease(o, sel, data);
1534  if (handled == 0 && myMDIClient->numChildren() > 0) {
1535  GNEViewParent* w = dynamic_cast<GNEViewParent*>(myMDIClient->getActiveChild());
1536  if (w != 0) {
1537  w->onKeyRelease(0, sel, data);
1538  }
1539  }
1540  return 0;
1541 }
1542 
1543 /****************************************************************************/
Locate TLS - button.
Definition: GUIAppEnum.h:181
std::vector< FXMainWindow * > myTrackerWindows
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
std::string myConfigPattern
Input file pattern.
FXLabel * myGeoCoordinate
ShapeContainer & getShapeContainer()
get shape container
Definition: GNENet.cpp:1252
FXMenuBar * myMenuBar
The application menu bar.
GUISUMOAbstractView * getView() const
bool myAmLoading
information whether the gui is currently loading and the load-options shall be greyed out ...
SUMOTime getCurrentSimTime() const
get current simulation time (pure virtual but we don&#39;t need it)
GUICompleteSchemeStorage gSchemeStorage
void pop()
Definition: MFXEventQue.h:53
long onKeyPress(FXObject *o, FXSelector sel, void *data)
Called when user press a key.
static std::string clipped
Definition: GUIUserIO.h:64
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:743
Locate edge - button.
Definition: GUIAppEnum.h:175
long onCmdNewNetwork(FXObject *, FXSelector, void *)
FXEX::FXThreadEvent myLoadThreadEvent
io-event with the load-thread
void setAdditionalsFile(const std::string &additionalsFile)
set additionals file
void abortOperation(bool clearSelection=true)
abort current edition operation
Definition: GNEViewNet.cpp:955
Open viewport editor - button.
Definition: GUIAppEnum.h:193
void setStatusBarText(const std::string &statusBarText)
set text of the statusBar
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
MFXEventQue< GUIEvent * > myEvents
List of got requests.
void resetWritable()
Resets all options to be writeable.
GNEUndoList * getUndoList()
get pointer to undoList
long onCmdReload(FXObject *, FXSelector, void *)
called when the command/FXCall reload is executed
void create()
Creates the widget.
void closeAllWindows()
this method closes all windows and deletes the current simulation */
virtual FXGLCanvas * getBuildGLCanvas() const
virtual void setViewportFromTo(const Position &lookFrom, const Position &lookAt)
applies the given viewport settings
void joinSelectedJunctions(GNEUndoList *undoList)
Definition: GNENet.cpp:1053
send when a message occured
Definition: GUIEvent.h:50
FXRecentFiles myRecentConfigs
List of recent config files.
long onCmdSaveAdditionals(FXObject *, FXSelector, void *)
called when the command/FXCall save additionals is executed
bool empty()
Definition: MFXEventQue.h:72
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
focus upper element of current frame
Definition: GUIAppEnum.h:421
The main window of the Netedit.
Open network - ID.
Definition: GUIAppEnum.h:75
#define GUIDesignSplitterMDI
MDI Splitter.
Definition: GUIDesigns.h:294
void hotkeyFocusFrame()
handle focus frame keypress
mode for deleting things
Definition: GUIAppEnum.h:440
abort current edit operation
Definition: GUIAppEnum.h:419
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
called when the command/FXCall clear message windows is executed
void loadConfigOrNet(const std::string &file, bool isNet, bool useStartupOptions, bool newNet=false)
begins the loading of a netconvert configuration or a a network
virtual void create()
Creates the main window (required by FOX)
long onCmdJoinJunctions(FXObject *, FXSelector, void *)
called if the user selects Processing->join junctions
bool hadDependentBuild
check if had dependent build
The representation of a single edge during network building.
Definition: NBEdge.h:71
static void initIcons(FXApp *a)
Initiate GUIIconSubSys.
GNEUndoList * myUndoList
the one and only undo list
mode for editing tls
Definition: GUIAppEnum.h:448
long onCmdComputeJunctions(FXObject *, FXSelector, void *)
called if the user selects Processing->compute junctions
static void resetTextures()
Reset textures.
void registerMsgHandlers()
register and unregister message handlers
void computeEverything(GNEApplicationWindow *window, bool force=false)
Definition: GNENet.cpp:983
long onCmdSetMode(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits an edit-mode hotkey
void handleEvent_NetworkLoaded(GUIEvent *e)
handle event of type Network loaded
#define GUIDesignStatusBar
design used in status bar
Definition: GUIDesigns.h:263
Close simulation - ID.
Definition: GUIAppEnum.h:85
void loadConfigOrNet(const std::string file, bool isNet, bool isReload=false, bool useStartupOptions=false, bool newNet=false)
starts to load a netimport configuration or a network */
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call ...
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition: GUIDesigns.h:266
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
called when a key is released
#define GUIDesignSplitter
Definition: GUIDesigns.h:291
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
Called when user releases a key.
Editor for the list of chosen objects.
bool continueWithUnsavedChanges()
warns about unsaved changes and gives the user the option to abort
Save additionals.
Definition: GUIAppEnum.h:557
FXGLVisual * myGLVisual
The gl-visual used.
long onCmdOpenForeign(FXObject *, FXSelector, void *)
called when the command/FXCall open foreign is executed
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:88
long onCmdSaveNetwork(FXObject *, FXSelector, void *)
called when the command/FXCall save network is executed
mode for selecting objects
Definition: GUIAppEnum.h:444
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:82
long onCmdAbout(FXObject *, FXSelector, void *)
called when the command/FXCall show about dialog is executed
void setEditModeFromHotkey(FXushort selid)
sets edit mode (from hotkey)
FXString gCurrentFolder
The folder used as last.
int getNumberOfAdditionals(SumoXMLTag type=SUMO_TAG_NOTHING) const
Returns the number of additionals of the net.
Definition: GNENet.cpp:1366
Storage for geometrical objects.
long onUpdNeedsNetwork(FXObject *, FXSelector, void *)
called when the upadte/FXCall needs network is executed
void saveViewport(const double x, const double y, const double z)
Makes the given viewport the default.
misc messages
Definition: GUIAppEnum.h:545
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
std::string myFile
the name of the loaded file
long onLoadThreadEvent(FXObject *, FXSelector, void *)
called when the command/FXCall load thread is executed
static void resetLoaded()
resets loaded location elements
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
void set(double x, double y)
set positions x and y
Definition: Position.h:93
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything&#39;s ok.
Definition: XMLSubSys.cpp:110
void updateControls()
update control contents after undo/redo or recompute
hot key <DEL>
Definition: GUIAppEnum.h:423
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString &currentFolder)
Returns the file name to write.
Definition: MFXUtils.cpp:91
long onCmdEditChosen(FXObject *, FXSelector, void *)
called when the command/FXCall edit chosen is executed
void updateControls()
update control contents after undo/redo or recompute
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
void addDecals(const std::vector< Decal > &decals)
add decals
GUISUMOAbstractView * openNewView()
opens a new simulation display
GNENet * myNet
the loaded net
long onUpdReload(FXObject *, FXSelector, void *)
called when the update/FXCall reload is executed
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:72
Position getLanePos(const std::string &poiID, const std::string &laneID, double lanePos)
get lane position
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
bool isTestingModeEnabled() const
check if netedit is running in testing mode
Definition: GNEViewNet.cpp:405
The application&#39;s "About" - dialog.
void addSeparator()
Adds a a separator to this log window.
void p_clear()
clears the undo list (implies abort)
Definition: GNEUndoList.cpp:96
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
called when the command/FXCall clipboard request is executed
The XML-Handler for network loading.
Definition: ShapeHandler.h:56
static void setDefaultOptions(OptionsCont &oc)
sets required options for proper functioning
help button
Definition: GUIAppEnum.h:404
FXHorizontalFrame * myCartesianFrame
FXDEFMAP(GNEApplicationWindow) GNEApplicationWindowMap[]
long onCmdSaveAdditionalsAs(FXObject *, FXSelector, void *)
called when the command/FXCall save additionals as is executed
const std::string & getMsg() const
Returns the message.
Load additional file with poi and polygons.
Definition: GUIAppEnum.h:77
The loading thread.
Definition: GUIAppEnum.h:117
long onCmdEditViewport(FXObject *, FXSelector, void *)
called if the user press key v to open zoom editor
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
mode for inspecting object attributes
Definition: GUIAppEnum.h:442
std::vector< FXMDIChild * > mySubWindows
long onCmdOptions(FXObject *, FXSelector, void *)
called if the user selects Processing->Configure Options
static void close()
close GUITextureSubSys
GNEApplicationWindow()
FOX needs this for static members.
FXSplitter * myMainSplitter
The splitter that divides the main window into view and the log window.
Reload the previously loaded simulation.
Definition: GUIAppEnum.h:81
processing menu messages
Definition: GUIAppEnum.h:514
Loads a file previously loaded.
Definition: GUIAppEnum.h:83
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
long onCmdOpenRecent(FXObject *, FXSelector, void *)
called when the command/FXCall open recent is executed
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
called when the command/FXCall open network is executed
FXGLCanvas * getBuildGLCanvas() const
get build OpenGL Canvas
int myViewNumber
The current view number.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:89
save network
Definition: GUIAppEnum.h:551
mode for adding edges
Definition: GUIAppEnum.h:436
Main window-ID.
Definition: GUIAppEnum.h:53
virtual void fillMenuBar()
Builds the menu bar.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static void saveToFile(const std::string &file)
save POIs to file
Definition: GNEPOI.cpp:173
hot key <ENTER>
Definition: GUIAppEnum.h:425
bool isAdditionalsSaved() const
check if additional are saved
Definition: GNENet.cpp:1621
long onCmdSaveAsPlainXML(FXObject *, FXSelector, void *)
called when the command/FXCall save as plain xml is executed
void save(OptionsCont &oc)
save the network
Definition: GNENet.cpp:688
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
called when the command/FXCall open configuration is executed
std::string mySettingsFile
the name of the settings file to load
long onCmdOpenAdditionals(FXObject *, FXSelector, void *)
called when the command/FXCall open additionals is executed
send when a error occured
Definition: GUIEvent.h:56
mode for editing crossing
Definition: GUIAppEnum.h:452
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
Definition: NIFrame.cpp:289
long onCmdLocate(FXObject *, FXSelector, void *)
called when the command/FXCall locate is executed
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:137
FXCursor * getDefaultCursor()
get default cursor
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
long onCmdCleanJunctions(FXObject *, FXSelector, void *)
called if the user selects Processing->clean junctions
Main window closes.
Definition: GUIAppEnum.h:55
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
#define VERSION_STRING
Definition: config.h:210
mode for editing additional
Definition: GUIAppEnum.h:450
The XML-Handler for shapes loading network loading.
virtual ~GNEApplicationWindow()
Destructor.
long onUpdOpen(FXObject *, FXSelector, void *)
called when the command/FXCall on update open executed
GNELoadThread * myLoadThread
the thread that loads the network
FXStatusBar * myStatusbar
The status bar.
long onCmdOpenShapes(FXObject *, FXSelector, void *)
called when the command/FXCall open shapes is executed
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
void unlock()
release mutex lock
Definition: MFXMutex.cpp:92
long onCmdEnter(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits enter
virtual void showViewportEditor()
show viewport editor
#define GUIDesignBar
Definition: GUIDesigns.h:260
bool myViewportFromRegistry
whether loading viewport from registry
long onCmdFocusFrame(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits f
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
virtual void detach()
detaches the tool/menu bar
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
void setViewport(GUISUMOAbstractView *view)
Sets the default viewport.
MFXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:147
void unSet(const std::string &name, bool failOnNonExistant=true) const
Marks the option as unset.
long onCmdDel(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits del
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
FXRecentFiles myRecentNets
List of recent nets.
void loadOptionOnStartup()
load net on startup
void removeSolitaryJunctions(GNEUndoList *undoList)
removes junctions that have no edges
Definition: GNENet.cpp:1103
static void close()
close GUIIconSubSys
FXToolBarShell * myMenuBarDrag
FXHorizontalFrame * myGeoFrame
mode for moving things
Definition: GUIAppEnum.h:438
FXDockSite * myTopDock
A storage for options typed value containers)
Definition: OptionsCont.h:99
Load additional file with additional elements.
Definition: GUIAppEnum.h:79
long onCmdClose(FXObject *, FXSelector, void *)
called when the command/FXCall close is executed
void clear()
Clears the list of selected objects.
std::string myAdditionalsFile
filename for load/save additionals
void lock()
lock mutex
Definition: MFXMutex.cpp:82
FXMDIClient * myMDIClient
The multi view panel.
send when a simulation has been loaded
Definition: GUIEvent.h:44
void handleEvent_Message(GUIEvent *e)
hanlde event of type message
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
Definition: GNENet.cpp:717
send when a warning occured
Definition: GUIEvent.h:53
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition: GUIDesigns.h:213
mode for connecting lanes
Definition: GUIAppEnum.h:446
long onCmdAbort(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits esc
long onCmdSaveJoined(FXObject *, FXSelector, void *)
called when the command/FXCall save joined is executed
An XML-handler for visualisation schemes.
const FXString myTitlePrefix
the prefix for the window title
GUIEventType getOwnType() const
returns the event type
Definition: GUIEvent.h:84
long long int SUMOTime
Definition: TraCIDefs.h:52
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependance to an optional file name.
Definition: MFXUtils.cpp:69
GNEShapeHandler(const std::string &file, GNENet *net, ShapeContainer &sc)
Constructor.
Locate junction - button.
Definition: GUIAppEnum.h:173
GNENet * myNet
we are responsible for the net
#define GUIDesignToolBarShell3
Definition: GUIDesigns.h:274
Clear simulation output.
Definition: GUIAppEnum.h:156
void dependentBuild()
build dependent
void clear()
Clears the window.
Open configuration - ID.
Definition: GUIAppEnum.h:73
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:261
void hotkeyDel()
handle del keypress
Definition: GNEViewNet.cpp:979
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
static void initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
GUISelectedStorage gSelected
A global holder of selected objects.
void hotkeyEnter()
handle enter keypress
Definition: GNEViewNet.cpp:994
long onCmdSaveAsNetwork(FXObject *, FXSelector, void *)
called when the command/FXCall save network as is executed
GNEViewNet * getView()
convenience method
A logging window for the gui.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void saveAdditionals(const std::string &filename)
save additional elements of the network
Definition: GNENet.cpp:697
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
Definition: GNENet.cpp:710
static void fillOptions(OptionsCont &oc)
clears and initializes the OptionsCont
FXMenuPane * myFileMenu
the submenus
long onKeyPress(FXObject *o, FXSelector sel, void *data)
called when a key is pressed
long onUpdSaveNetwork(FXObject *, FXSelector, void *)
called when the update/FXCall save network is executed
About SUMO - ID.
Definition: GUIAppEnum.h:87
long onCmdSavePois(FXObject *, FXSelector, void *)
called when the command/FXCall save pois is executed
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:278
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1165