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-2015 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 
40 #include <utils/common/ToString.h>
43 #include <utils/xml/XMLSubSys.h>
56 #include <netimport/NIFrame.h>
57 
58 #include "GNEApplicationWindow.h"
59 #include "GNELoadThread.h"
60 #include "GNEEvent_NetworkLoaded.h"
61 #include "GNEViewParent.h"
62 #include "GNEViewNet.h"
63 #include "GNEDialog_About.h"
64 #include "GNEDialog_Wizard.h"
65 #include "GNENet.h"
66 #include "GNEEdge.h"
67 #include "GNEJunction.h"
68 #include "GNEUndoList.h"
69 #include "GNEPOI.h"
70 
71 
72 #ifdef CHECK_MEMORY_LEAKS
73 #include <foreign/nvwa/debug_new.h>
74 #endif
75 
76 
77 // ===========================================================================
78 // FOX-declarations
79 // ===========================================================================
80 FXDEFMAP(GNEApplicationWindow) GNEApplicationWindowMap[] = {
81  //________Message_Type____________ID________________________Message_Handler________
82  FXMAPFUNC(SEL_COMMAND, MID_QUIT, GNEApplicationWindow::onCmdQuit),
83  FXMAPFUNC(SEL_SIGNAL, MID_QUIT, GNEApplicationWindow::onCmdQuit),
84  FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GNEApplicationWindow::onCmdQuit),
85 
92  FXMAPFUNC(SEL_COMMAND, MID_RELOAD, GNEApplicationWindow::onCmdReload),
93  FXMAPFUNC(SEL_COMMAND, MID_CLOSE, GNEApplicationWindow::onCmdClose),
94  FXMAPFUNC(SEL_UPDATE, MID_CLOSE, GNEApplicationWindow::onUpdNeedsNetwork),
95 
96  FXMAPFUNC(SEL_COMMAND, MID_ABOUT, GNEApplicationWindow::onCmdAbout),
98 
100  FXMAPFUNC(SEL_UPDATE, MID_OPEN_CONFIG, GNEApplicationWindow::onUpdOpen),
101  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 
122  FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_MOVE, GNEApplicationWindow::onCmdSetMode),
127  FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_TLS, GNEApplicationWindow::onCmdSetMode),
128 
134  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_PLAIN_XML, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
136  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_JOINED, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
138  FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_POIS, GNEApplicationWindow::onUpdNeedsNetwork), // same condition
139  FXMAPFUNC(SEL_COMMAND, MID_GNE_ABORT, GNEApplicationWindow::onCmdAbort),
140  FXMAPFUNC(SEL_COMMAND, MID_GNE_HOTKEY_DEL, GNEApplicationWindow::onCmdDel),
142  FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEApplicationWindow::onCmdHelp),
149  FXMAPFUNC(SEL_COMMAND, MID_GNE_OPTIONS, GNEApplicationWindow::onCmdOptions),
150 };
151 
152 // Object implementation
153 FXIMPLEMENT(GNEApplicationWindow, FXMainWindow, GNEApplicationWindowMap, ARRAYNUMBER(GNEApplicationWindowMap))
154 
155 // ===========================================================================
156 // member method definitions
157 // ===========================================================================
158 #ifdef _MSC_VER
159 #pragma warning(disable: 4355)
160 #endif
162  const std::string& configPattern)
163  : GUIMainWindow(a),
164  myLoadThread(0),
165  myAmLoading(false),
166  myRecentNets(a, "nets"),
167  myConfigPattern(configPattern),
168  hadDependentBuild(false),
169  myNet(0),
170  myUndoList(new GNEUndoList(this)),
171  myTitlePrefix(("NETEDIT " + getBuildName(VERSION_STRING)).c_str()) {
173 }
174 #ifdef _MSC_VER
175 #pragma warning(default: 4355)
176 #endif
177 
178 
179 void
181  // do this not twice
182  if (hadDependentBuild) {
183  WRITE_ERROR("DEBUG: GNEApplicationWindow::dependentBuild called twice");
184  return;
185  }
186  hadDependentBuild = true;
187 
188  setTarget(this);
189  setSelector(MID_WINDOW);
190 
191  // build menu bar
192  myMenuBarDrag = new FXToolBarShell(this, FRAME_NORMAL);
193  myMenuBar = new FXMenuBar(myTopDock, myMenuBarDrag,
194  LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED);
195  new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP,
196  TOOLBARGRIP_DOUBLE);
197  // build the thread - io
200 
201  // build the status bar
202  myStatusbar = new FXStatusBar(this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X | FRAME_RAISED);
203  {
204  myGeoFrame =
205  new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN,
206  0, 0, 20, 0, 0, 0, 0, 0, 0, 0);
207  myGeoCoordinate = new FXLabel(myGeoFrame, "N/A\t\tOriginal coordinate (before coordinate transformation in NETCONVERT)", 0, LAYOUT_CENTER_Y);
209  new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN,
210  0, 0, 20, 0, 0, 0, 0, 0, 0, 0);
211  myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A\t\tNetwork coordinate", 0, LAYOUT_CENTER_Y);
212  }
213  // make the window a mdi-window
214  myMainSplitter = new FXSplitter(this,
215  SPLITTER_REVERSED | SPLITTER_VERTICAL | LAYOUT_FILL_X | LAYOUT_FILL_Y | SPLITTER_TRACKING | FRAME_RAISED | FRAME_THICK);
216  myMDIClient = new FXMDIClient(myMainSplitter,
217  LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK);
218  myMDIMenu = new FXMDIMenu(this, myMDIClient);
219  new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient,
220  FXMDIClient::ID_MDI_MENUWINDOW, LAYOUT_LEFT);
221  new FXMDIDeleteButton(myMenuBar, myMDIClient,
222  FXMDIClient::ID_MDI_MENUCLOSE, FRAME_RAISED | LAYOUT_RIGHT);
223  new FXMDIRestoreButton(myMenuBar, myMDIClient,
224  FXMDIClient::ID_MDI_MENURESTORE, FRAME_RAISED | LAYOUT_RIGHT);
225  new FXMDIMinimizeButton(myMenuBar, myMDIClient,
226  FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED | LAYOUT_RIGHT);
227 
228  // build the message window
230  myMainSplitter->setSplit(1, 65);
231  // fill menu and tool bar
232  fillMenuBar();
233  // build additional threads
234  myLoadThread = new GNELoadThread(getApp(), this, myEvents, myLoadThreadEvent);
235  // set the status bar
236  myStatusbar->getStatusLine()->setText("Ready.");
237  // set the caption
238  setTitle(myTitlePrefix);
239 
241 
242  //initialize some hotkeys
243  getAccelTable()->addAccel(parseAccel("e"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_CREATE_EDGE));
244  getAccelTable()->addAccel(parseAccel("m"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_MOVE));
245  getAccelTable()->addAccel(parseAccel("d"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_DELETE));
246  getAccelTable()->addAccel(parseAccel("i"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_INSPECT));
247  getAccelTable()->addAccel(parseAccel("s"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_SELECT));
248  getAccelTable()->addAccel(parseAccel("c"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_CONNECT));
249  getAccelTable()->addAccel(parseAccel("t"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_TLS));
250  getAccelTable()->addAccel(parseAccel("Esc"), this, FXSEL(SEL_COMMAND, MID_GNE_ABORT));
251  getAccelTable()->addAccel(parseAccel("Del"), this, FXSEL(SEL_COMMAND, MID_GNE_HOTKEY_DEL));
252  getAccelTable()->addAccel(parseAccel("Enter"), this, FXSEL(SEL_COMMAND, MID_GNE_HOTKEY_ENTER));
253 }
254 
255 void
257  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0) {
258  setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
259  setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
260  setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
261  setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
262  }
263  gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
264  FXMainWindow::create();
265  myMenuBarDrag->create();
266  myFileMenu->create();
267  myEditMenu->create();
268  //mySettingsMenu->create();
269  myWindowsMenu->create();
270  myHelpMenu->create();
271 
272  FXint width = getApp()->getNormalFont()->getTextWidth("8", 1) * 22;
273  myCartesianFrame->setWidth(width);
274  myGeoFrame->setWidth(width);
275 
276  show(PLACEMENT_SCREEN);
277  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
278  maximize();
279  }
280 }
281 
282 
284  closeAllWindows();
285  //
287  delete myGLVisual;
288  // must delete menus to avoid segfault on removing accelerators
289  // (http://www.fox-toolkit.net/faq#TOC-What-happens-when-the-application-s)
290  delete myFileMenu;
291  delete myEditMenu;
292  delete myProcessingMenu;
293  delete myWindowsMenu;
294  delete myHelpMenu;
295 
296  delete myLoadThread;
297 
298  while (!myEvents.empty()) {
299  // get the next event
300  GUIEvent* e = myEvents.top();
301  myEvents.pop();
302  delete e;
303  }
304  delete myUndoList;
305 }
306 
307 
308 void
310  FXMainWindow::detach();
311  myMenuBarDrag->detach();
312 }
313 
314 
315 void
317  // build file menu
318  myFileMenu = new FXMenuPane(this);
319  new FXMenuTitle(myMenuBar, "&File", 0, myFileMenu);
320  new FXMenuCommand(myFileMenu,
321  "&New Network...\tCtrl+A\tCreate a new network.",
323  new FXMenuCommand(myFileMenu,
324  "Open &Network...\tCtrl+N\tOpen a SUMO network.",
326  new FXMenuCommand(myFileMenu,
327  "&Open Configuration...\tCtrl+O\tOpen a NETCONVERT configuration file.",
329  new FXMenuCommand(myFileMenu,
330  "Import &Foreign Network...\t\tImport a foreign network such as OSM.",
332  new FXMenuCommand(myFileMenu,
333  "Load &Shapes...\tCtrl+P\tLoad shapes into the network view.",
335  new FXMenuCommand(myFileMenu,
336  "&Reload\tCtrl+R\tReloads the network.",
338  new FXMenuCommand(myFileMenu,
339  "&Save Network...\tCtrl+S\tSave the network.",
341  new FXMenuCommand(myFileMenu,
342  "&Save Network As...\tCtrl+Shift-S\tSave the network.",
344  new FXMenuCommand(myFileMenu,
345  "&Save plain xml...\t\tSave plain xml representation the network.",
347  new FXMenuCommand(myFileMenu,
348  "&Save joined junctions...\t\tSave log of joined junctions (allows reproduction of joins).",
350  new FXMenuCommand(myFileMenu,
351  "&Save POIs As ...\t\tSave the POIs.",
353  new FXMenuSeparator(myFileMenu);
354  new FXMenuCommand(myFileMenu,
355  "Close\tCtrl+W\tClose the network.",
357  // Recent files
358  FXMenuSeparator* sep1 = new FXMenuSeparator(myFileMenu);
359  sep1->setTarget(&myRecentConfigs);
360  sep1->setSelector(FXRecentFiles::ID_ANYFILES);
361  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_1);
362  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_2);
363  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_3);
364  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_4);
365  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_5);
366  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_6);
367  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_7);
368  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_8);
369  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_9);
370  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_10);
371  new FXMenuCommand(myFileMenu, "C&lear Recent Configurations", 0, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
372  myRecentConfigs.setTarget(this);
373  myRecentConfigs.setSelector(MID_RECENTFILE);
374  FXMenuSeparator* sep2 = new FXMenuSeparator(myFileMenu);
375  sep2->setTarget(&myRecentNets);
376  sep2->setSelector(FXRecentFiles::ID_ANYFILES);
377  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_1);
378  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_2);
379  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_3);
380  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_4);
381  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_5);
382  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_6);
383  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_7);
384  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_8);
385  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_9);
386  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_10);
387  new FXMenuCommand(myFileMenu, "Cl&ear Recent Networks", 0, &myRecentNets, FXRecentFiles::ID_CLEAR);
388  myRecentNets.setTarget(this);
389  myRecentNets.setSelector(MID_RECENTFILE);
390  new FXMenuSeparator(myFileMenu);
391  new FXMenuCommand(myFileMenu,
392  "&Quit\tCtrl+Q\tQuit the Application.",
393  0, this, MID_QUIT, 0);
394 
395  // build edit menu
396  myEditMenu = new FXMenuPane(this);
397  new FXMenuTitle(myMenuBar, "&Edit", 0, myEditMenu);
398  new FXMenuCommand(myEditMenu,
399  "Undo\tCtrl+Z\tUndo the last change.",
400  GUIIconSubSys::getIcon(ICON_UNDO), myUndoList, FXUndoList::ID_UNDO);
401  new FXMenuCommand(myEditMenu,
402  "Redo\tCtrl+Y\tRedo the last change.",
403  GUIIconSubSys::getIcon(ICON_REDO), myUndoList, FXUndoList::ID_REDO);
404 
405 
406  /*
407  new FXMenuSeparator(myEditMenu);
408  new FXMenuCommand(myEditMenu,
409  "Edit Breakpoints...\t\tOpens a Dialog for editing breakpoints.",
410  0, this, MID_EDIT_BREAKPOINTS);
411  */
412 
413  // processing menu (trigger netbuild computations)
414  myProcessingMenu = new FXMenuPane(this);
415  new FXMenuTitle(myMenuBar, "Processing", 0, myProcessingMenu);
416  new FXMenuCommand(myProcessingMenu,
417  "Compute Junctions\tF5\tComputes junction shape and logic.",
418  0, this, MID_GNE_COMPUTE_JUNCTIONS);
419  new FXMenuCommand(myProcessingMenu,
420  "Clean Junctions\tF6\tRemoves solitary junctions.",
421  0, this, MID_GNE_CLEAN_JUNCTIONS);
422  new FXMenuCommand(myProcessingMenu,
423  "Join Selected Junctions\tF7\tJoins selected junctions into a single junction.",
424  0, this, MID_GNE_JOIN_JUNCTIONS);
425  new FXMenuCommand(myProcessingMenu,
426  "Options\t\tConfigure Processing Options.",
427  0, this, MID_GNE_OPTIONS);
428 
429  // build settings menu
430  /*
431  mySettingsMenu = new FXMenuPane(this);
432  new FXMenuTitle(myMenuBar,"&Settings",0,mySettingsMenu);
433  new FXMenuCheck(mySettingsMenu,
434  "Gaming Mode\t\tToggle gaming mode on/off.",
435  this,MID_GAMING);
436  */
437  // build Locate menu
438  myLocatorMenu = new FXMenuPane(this);
439  new FXMenuTitle(myMenuBar, "&Locate", NULL, myLocatorMenu);
440  new FXMenuCommand(myLocatorMenu,
441  "Locate &Junctions\t\tOpen a Dialog for Locating a Junction.",
443  new FXMenuCommand(myLocatorMenu,
444  "Locate &Edges\t\tOpen a Dialog for Locating an Edge.",
446  new FXMenuCommand(myLocatorMenu,
447  "Locate &TLS\t\tOpen a Dialog for Locating a Traffic Light.",
449 
450  // build windows menu
451  myWindowsMenu = new FXMenuPane(this);
452  new FXMenuTitle(myMenuBar, "&Windows", 0, myWindowsMenu);
453  new FXMenuCheck(myWindowsMenu,
454  "Show Status Line\t\tToggle this Status Bar on/off.",
455  myStatusbar, FXWindow::ID_TOGGLESHOWN);
456  new FXMenuCheck(myWindowsMenu,
457  "Show Message Window\t\tToggle the Message Window on/off.",
458  myMessageWindow, FXWindow::ID_TOGGLESHOWN);
459  /*
460  new FXMenuSeparator(myWindowsMenu);
461  new FXMenuCommand(myWindowsMenu,"Tile &Horizontally",
462  GUIIconSubSys::getIcon(ICON_WINDOWS_TILE_HORI),
463  myMDIClient,FXMDIClient::ID_MDI_TILEHORIZONTAL);
464  new FXMenuCommand(myWindowsMenu,"Tile &Vertically",
465  GUIIconSubSys::getIcon(ICON_WINDOWS_TILE_VERT),
466  myMDIClient,FXMDIClient::ID_MDI_TILEVERTICAL);
467  new FXMenuCommand(myWindowsMenu,"C&ascade",
468  GUIIconSubSys::getIcon(ICON_WINDOWS_CASCADE),
469  myMDIClient,FXMDIClient::ID_MDI_CASCADE);
470  new FXMenuCommand(myWindowsMenu,"&Close",0,
471  myMDIClient,FXMDIClient::ID_MDI_CLOSE);
472  sep1=new FXMenuSeparator(myWindowsMenu);
473  sep1->setTarget(myMDIClient);
474  sep1->setSelector(FXMDIClient::ID_MDI_ANY);
475  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_1);
476  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_2);
477  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_3);
478  new FXMenuCommand(myWindowsMenu,"",0,myMDIClient,FXMDIClient::ID_MDI_4);
479  new FXMenuCommand(myWindowsMenu,"&Others...",0,myMDIClient,FXMDIClient::ID_MDI_OVER_5);
480  new FXMenuSeparator(myWindowsMenu);
481  */
482  new FXMenuCommand(myWindowsMenu,
483  "Clear Message Window\t\tClear the message window.",
484  0, this, MID_CLEARMESSAGEWINDOW);
485 
486  // build help menu
487  myHelpMenu = new FXMenuPane(this);
488  new FXMenuTitle(myMenuBar, "&Help", 0, myHelpMenu);
489  new FXMenuCommand(myHelpMenu, "&Online Documentation", 0, this, MID_HELP);
490  new FXMenuCommand(myHelpMenu, "&About", 0, this, MID_ABOUT);
491 }
492 
493 
494 long
495 GNEApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
497  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
498  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
499  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
500  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
501  getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
502  if (isMaximized()) {
503  getApp()->reg().writeIntEntry("SETTINGS", "maximized", 1);
504  } else {
505  getApp()->reg().writeIntEntry("SETTINGS", "maximized", 0);
506  }
507  getApp()->exit(0);
508  }
509  return 1;
510 }
511 
512 
513 long
514 GNEApplicationWindow::onCmdEditChosen(FXObject*, FXSelector, void*) {
515  GUIDialog_GLChosenEditor* chooser =
517  chooser->create();
518  chooser->show();
519  return 1;
520 }
521 
522 
523 long
524 GNEApplicationWindow::onCmdNewNetwork(FXObject*, FXSelector, void*) {
525  // ask before we clobber options
527  return 1;
528  }
532  loadConfigOrNet("", true, false, true, true);
533  return 1;
534 }
535 
536 
537 long
538 GNEApplicationWindow::onCmdOpenConfiguration(FXObject*, FXSelector, void*) {
539  // get the new file name
540  FXFileDialog opendialog(this, "Open Netconvert Configuration");
541  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
542  opendialog.setSelectMode(SELECTFILE_EXISTING);
543  opendialog.setPatternList(myConfigPattern.c_str());
544  if (gCurrentFolder.length() != 0) {
545  opendialog.setDirectory(gCurrentFolder);
546  }
547  if (opendialog.execute()) {
548  gCurrentFolder = opendialog.getDirectory();
549  std::string file = opendialog.getFilename().text();
550  loadConfigOrNet(file, false);
551  myRecentConfigs.appendFile(file.c_str());
552  }
553  return 1;
554 }
555 
556 
557 long
558 GNEApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
559  // get the new file name
560  FXFileDialog opendialog(this, "Open Network");
561  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
562  opendialog.setSelectMode(SELECTFILE_EXISTING);
563  opendialog.setPatternList("SUMO nets (*.net.xml)\nAll files (*)");
564  if (gCurrentFolder.length() != 0) {
565  opendialog.setDirectory(gCurrentFolder);
566  }
567  if (opendialog.execute()) {
568  gCurrentFolder = opendialog.getDirectory();
569  std::string file = opendialog.getFilename().text();
570  loadConfigOrNet(file, true);
571  myRecentNets.appendFile(file.c_str());
572  }
573  return 1;
574 }
575 
576 
577 long
578 GNEApplicationWindow::onCmdOpenForeign(FXObject*, FXSelector, void*) {
579  // ask before we clobber options
581  return 1;
582  }
583  // get the new file name
584  FXFileDialog opendialog(this, "Import Foreign Network");
585  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
586  opendialog.setSelectMode(SELECTFILE_EXISTING);
587  FXString osmPattern("OSM net (*.osm.xml,*.osm)");
588  opendialog.setPatternText(0, osmPattern);
589  if (gCurrentFolder.length() != 0) {
590  opendialog.setDirectory(gCurrentFolder);
591  }
592  if (opendialog.execute()) {
593  gCurrentFolder = opendialog.getDirectory();
594  std::string file = opendialog.getFilename().text();
595 
598  if (osmPattern.contains(opendialog.getPattern())) {
599  oc.set("osm-files", file);
600  oc.set("ramps.guess", "true");
601  oc.set("tls.guess", "true");
602  } else {
603  throw ProcessError("Attempted to import unknown file format '" + file + "'.");
604  }
605 
606  GNEDialog_Wizard* wizard =
607  new GNEDialog_Wizard(this, "Select Import Options", getWidth(), getHeight());
608 
609  if (wizard->execute()) {
610  NIFrame::checkOptions(); // needed to set projection parameters
611  loadConfigOrNet(file, false, false, true);
612  }
613  }
614  return 1;
615 }
616 
617 
618 long
619 GNEApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
620  // get the shape file name
621  FXFileDialog opendialog(this, "Open Shapes");
622  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
623  opendialog.setSelectMode(SELECTFILE_EXISTING);
624  opendialog.setPatternList("Additional files (*.xml)\nAll files (*)");
625  if (gCurrentFolder.length() != 0) {
626  opendialog.setDirectory(gCurrentFolder);
627  }
628  if (opendialog.execute()) {
629  gCurrentFolder = opendialog.getDirectory();
630  std::string file = opendialog.getFilename().text();
631  GNEShapeHandler handler(file, myNet, myNet->getShapeContainer());
632  if (!XMLSubSys::runParser(handler, file, false)) {
633  WRITE_MESSAGE("Loading of " + file + " failed.");
634  }
635  update();
636  }
637  return 1;
638 }
639 
640 
641 long
642 GNEApplicationWindow::onCmdOpenRecent(FXObject* sender, FXSelector, void* data) {
643  if (myAmLoading) {
644  myStatusbar->getStatusLine()->setText("Already loading!");
645  return 1;
646  }
647  std::string file((const char*)data);
648  loadConfigOrNet(file, sender == &myRecentNets);
649  return 1;
650 }
651 
652 
653 long
654 GNEApplicationWindow::onCmdReload(FXObject*, FXSelector, void*) {
655  loadConfigOrNet(OptionsCont::getOptions().getString("sumo-net-file"), true, true);
656  return 1;
657 }
658 
659 
660 long
661 GNEApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
663  closeAllWindows();
664  }
665  return 1;
666 }
667 
668 
669 long
670 GNEApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
671  if (myMDIClient->numChildren() > 0) {
672  GNEViewParent* w = dynamic_cast<GNEViewParent*>(myMDIClient->getActiveChild());
673  if (w != 0) {
674  w->onCmdLocate(0, sel, 0);
675  }
676  }
677  return 1;
678 }
679 
680 long
681 GNEApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void*) {
682  sender->handle(this, myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
683  return 1;
684 }
685 
686 
687 long
688 GNEApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
690  return 1;
691 }
692 
693 
694 long
695 GNEApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
696  GNEDialog_About* about =
697  new GNEDialog_About(this);
698  about->create();
699  about->show(PLACEMENT_OWNER);
700  return 1;
701 }
702 
703 
704 long GNEApplicationWindow::onClipboardRequest(FXObject*, FXSelector, void* ptr) {
705  FXEvent* event = (FXEvent*)ptr;
706  FXString string = GUIUserIO::clipped.c_str();
707  setDNDData(FROM_CLIPBOARD, event->target, string);
708  return 1;
709 }
710 
711 
712 long
713 GNEApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
714  eventOccured();
715  return 1;
716 }
717 
718 
719 void
721  while (!myEvents.empty()) {
722  // get the next event
723  GUIEvent* e = myEvents.top();
724  myEvents.pop();
725  // process
726  switch (e->getOwnType()) {
729  break;
732  case EVENT_ERROR_OCCURED:
734  break;
735  default:
736  break;
737  }
738  delete e;
739  }
740 }
741 
742 
743 void
745  myAmLoading = false;
746  GNEEvent_NetworkLoaded* ec = static_cast<GNEEvent_NetworkLoaded*>(e);
747  // check whether the loading was successfull
748  if (ec->myNet == 0) {
749  // report failure
750  setStatusBarText("Loading of '" + ec->myFile + "' failed!");
751  } else {
752  myNet = ec->myNet;
753  // report success
754  setStatusBarText("'" + ec->myFile + "' loaded.");
755  // initialise views
756  myViewNumber = 0;
758  if (view && ec->mySettingsFile != "") {
759  GUISettingsHandler settings(ec->mySettingsFile);
760  std::string settingsName = settings.addSettings(view);
761  view->addDecals(settings.getDecals());
762  settings.setViewport(view);
763  settings.setSnapshots(view);
764  }
765  // set network name on the caption
766  setTitle(MFXUtils::getTitleText(myTitlePrefix, ec->myFile.c_str()));
768  gSchemeStorage.setViewport(getView()); // refit the network to accomodate mode specific panel
769  if (ec->myViewportFromRegistry) {
770  Position off, p;
771  off.set(getApp()->reg().readIntEntry("viewport", "x"), getApp()->reg().readIntEntry("viewport", "y"), getApp()->reg().readIntEntry("viewport", "z"));
772  getView()->setViewport(off, p);
773  }
774  }
775  getApp()->endWaitCursor();
777  update();
778 }
779 
780 
781 void
783  GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
785 }
786 
787 
788 void
789 GNEApplicationWindow::loadConfigOrNet(const std::string file, bool isNet, bool isReload, bool optionsReady, bool newNet) {
791  return;
792  }
793  getApp()->beginWaitCursor();
794  myAmLoading = true;
795  closeAllWindows();
796  if (isReload) {
797  myLoadThread->start();
798  setStatusBarText("Reloading.");
799  } else {
800  gSchemeStorage.saveViewport(0, 0, -1); // recenter view
801  myLoadThread->loadConfigOrNet(file, isNet, optionsReady, newNet);
802  setStatusBarText("Loading '" + file + "'.");
803  }
804  update();
805 }
806 
807 
808 
811  std::string caption = "View #" + toString(myViewNumber++);
812  FXuint opts = MDI_TRACKING;
814  myMDIMenu, FXString(caption.c_str()), this,
817  opts, 10, 10, 300, 200);
818  if (myMDIClient->numChildren() == 1) {
819  w->maximize();
820  } else {
821  myMDIClient->vertical(true);
822  }
823  myMDIClient->setActiveChild(w);
824  //v->grabKeyboard();
825  return w->getView();
826 }
827 
828 
829 FXGLCanvas*
831  if (myMDIClient->numChildren() == 0) {
832  return 0;
833  }
834  GNEViewParent* share_tmp1 =
835  static_cast<GNEViewParent*>(myMDIClient->childAtIndex(0));
836  return share_tmp1->getBuildGLCanvas();
837 }
838 
839 
840 void
843  // remove trackers and other external windows
844  size_t i;
845  for (i = 0; i < mySubWindows.size(); ++i) {
846  mySubWindows[i]->destroy();
847  }
848  for (i = 0; i < myTrackerWindows.size(); ++i) {
849  myTrackerWindows[i]->destroy();
850  }
851  // reset the caption
852  setTitle(myTitlePrefix);
853  // delete other children
854  while (myTrackerWindows.size() != 0) {
855  delete myTrackerWindows[0];
856  }
857  while (mySubWindows.size() != 0) {
858  delete mySubWindows[0];
859  }
860  mySubWindows.clear();
861  // clear selected items
862  gSelected.clear();
863  // add a separator to the log
866  // remove coordinate information
867  myGeoCoordinate->setText("N/A");
868  myCartesianCoordinate->setText("N/A");
869 
870  myUndoList->p_clear();
871  if (myNet != 0) {
872  delete myNet;
873  myNet = 0;
875  }
878 }
879 
880 
881 FXCursor*
883  return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
884 }
885 
886 
887 void
890  if (oc.isSet("configuration-file")) {
891  loadConfigOrNet(oc.getString("configuration-file"), false, false, true);
892  } else {
893  loadConfigOrNet(oc.getString("sumo-net-file"), true, false, true);
894  oc.resetWritable();
895  oc.set("output-file", oc.getString("sumo-net-file"));
896  }
897 }
898 
899 /*
900 long
901 GNEApplicationWindow::onCmdCutSwell(FXObject*, FXSelector, void*)
902 {
903  /
904  GUIDialog_CutSwell *about =
905  new GUIDialog_CutSwell(this, "Simulating...", 0, 0);
906  about->create();
907  about->show(PLACEMENT_OWNER);
908  /
909  std::string prev = myStatusbar->getStatusLine()->getText().text();
910  std::string text = std::string("Computing strategies.");
911  myStatusbar->getStatusLine()->setText(text.c_str());
912  myStatusbar->getStatusLine()->setNormalText(text.c_str());
913  for(int i=0; i<100; ++i) {
914  fxsleep(3000);
915  myProgressBar->setProgress(i);
916  }
917 // delete about;
918  myProgressBar->setProgress(0);
919  myStatusbar->getStatusLine()->setText(prev.c_str());
920  myStatusbar->getStatusLine()->setNormalText(prev.c_str());
921  return 1;
922 }
923 */
924 
925 
926 void
927 GNEApplicationWindow::setStatusBarText(const std::string& text) {
928  myStatusbar->getStatusLine()->setText(text.c_str());
929  myStatusbar->getStatusLine()->setNormalText(text.c_str());
930 }
931 
932 
933 long
934 GNEApplicationWindow::onCmdSetMode(FXObject*, FXSelector sel, void*) {
935  if (getView()) {
936  getView()->setEditModeFromHotkey(FXSELID(sel));
937  }
938  return 1;
939 }
940 
941 
942 long
943 GNEApplicationWindow::onCmdAbort(FXObject*, FXSelector, void*) {
944  if (getView()) {
945  getView()->abortOperation();
946  getView()->update();
947  }
948  return 1;
949 }
950 
951 
952 long
953 GNEApplicationWindow::onCmdDel(FXObject*, FXSelector, void*) {
954  if (getView()) {
955  getView()->hotkeyDel();
956  }
957  return 1;
958 }
959 
960 
961 long
962 GNEApplicationWindow::onCmdEnter(FXObject*, FXSelector, void*) {
963  if (getView()) {
964  getView()->hotkeyEnter();
965  }
966  return 1;
967 }
968 
969 
970 long
971 GNEApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
972  FXLinkLabel::fxexecute("http://sumo.dlr.de/wiki/NETEDIT");
973  return 1;
974 }
975 
976 
977 long
978 GNEApplicationWindow::onCmdComputeJunctions(FXObject*, FXSelector, void*) {
979  myNet->computeEverything(this, true);
980  updateControls();
981  return 1;
982 }
983 
984 
985 long
986 GNEApplicationWindow::onCmdCleanJunctions(FXObject*, FXSelector, void*) {
988  return 1;
989 }
990 
991 
992 long
993 GNEApplicationWindow::onCmdJoinJunctions(FXObject*, FXSelector, void*) {
995  return 1;
996 }
997 
998 
999 long
1000 GNEApplicationWindow::onCmdOptions(FXObject*, FXSelector, void*) {
1001  GNEDialog_Wizard* wizard =
1002  new GNEDialog_Wizard(this, "Configure Options", getWidth(), getHeight());
1003 
1004  if (wizard->execute()) {
1005  NIFrame::checkOptions(); // needed to set projection parameters
1006  }
1007  return 1;
1008 }
1009 
1010 
1011 long
1012 GNEApplicationWindow::onCmdSaveAsNetwork(FXObject*, FXSelector, void*) {
1013  FXString file = MFXUtils::getFilename2Write(this,
1014  "Save Network as", ".net.xml",
1016  gCurrentFolder);
1017  if (file == "") {
1018  return 1;
1019  }
1021  oc.resetWritable();
1022  oc.set("output-file", file.text());
1023  setTitle(MFXUtils::getTitleText(myTitlePrefix, file));
1024  onCmdSaveNetwork(0, 0, 0);
1025  return 1;
1026 }
1027 
1028 
1029 long
1030 GNEApplicationWindow::onCmdSaveAsPlainXML(FXObject*, FXSelector, void*) {
1031  FXString file = MFXUtils::getFilename2Write(this,
1032  "Select name of the plain-xml edge-file (other names will be deduced from this)", ".edg.xml",
1034  gCurrentFolder);
1035  if (file == "") {
1036  return 1;
1037  }
1039  bool wasSet = oc.isSet("plain-output-prefix");
1040  std::string oldPrefix = oc.getString("plain-output-prefix");
1041  oc.resetWritable();
1042  std::string prefix = file.text();
1043  prefix = prefix.substr(0, prefix.size() - 8);
1044  oc.set("plain-output-prefix", prefix);
1045  getApp()->beginWaitCursor();
1046  try {
1047  myNet->savePlain(oc);
1048  myUndoList->unmark();
1049  myUndoList->mark();
1050  } catch (IOError& e) {
1051  FXMessageBox::error(this, MBOX_OK, "Saving plain xml failed!", "%s", e.what());
1052  }
1053  myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Plain XML saved with prefix '" + prefix + "'.\n");
1055  if (wasSet) {
1056  oc.resetWritable();
1057  oc.set("plain-output-prefix", oldPrefix);
1058  } else {
1059  oc.unSet("plain-output-prefix");
1060  }
1061  getApp()->endWaitCursor();
1062  return 1;
1063 }
1064 
1065 
1066 long
1067 GNEApplicationWindow::onCmdSaveJoined(FXObject*, FXSelector, void*) {
1068  FXString file = MFXUtils::getFilename2Write(this,
1069  "Select name of the joined-junctions file", ".nod.xml",
1071  gCurrentFolder);
1072  if (file == "") {
1073  return 1;
1074  }
1076  bool wasSet = oc.isSet("junctions.join-output");
1077  std::string oldFile = oc.getString("junctions.join-output");
1078  oc.resetWritable();
1079  std::string filename = file.text();
1080  oc.set("junctions.join-output", filename);
1081  getApp()->beginWaitCursor();
1082  try {
1083  myNet->saveJoined(oc);
1084  } catch (IOError& e) {
1085  FXMessageBox::error(this, MBOX_OK, "Saving joined junctions failed!", "%s", e.what());
1086  }
1087  myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Joined junctions saved to '" + filename + "'.\n");
1089  if (wasSet) {
1090  oc.resetWritable();
1091  oc.set("junctions.join-output", oldFile);
1092  } else {
1093  oc.unSet("junctions.join-output");
1094  }
1095  getApp()->endWaitCursor();
1096  return 1;
1097 }
1098 
1099 
1100 long
1101 GNEApplicationWindow::onCmdSavePois(FXObject*, FXSelector, void*) {
1102  FXString file = MFXUtils::getFilename2Write(this,
1103  "Select name of the POI file", ".xml",
1105  gCurrentFolder);
1106  if (file == "") {
1107  return 1;
1108  }
1109  std::string filename = file.text();
1110  // XXX Not yet implemented
1111  getApp()->beginWaitCursor();
1112  try {
1113  GNEPOI::saveToFile(filename);
1114  } catch (IOError& e) {
1115  FXMessageBox::error(this, MBOX_OK, "Saving POIs failed!", "%s", e.what());
1116  }
1118  getApp()->endWaitCursor();
1119  return 1;
1120 }
1121 
1122 
1123 long
1124 GNEApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void*) {
1125  sender->handle(this, myNet == 0 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
1126  return 1;
1127 }
1128 
1129 
1130 long
1131 GNEApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void*) {
1132  sender->handle(this, myNet == 0 || !OptionsCont::getOptions().isSet("sumo-net-file")
1133  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
1134  return 1;
1135 }
1136 
1137 
1138 long
1139 GNEApplicationWindow::onCmdSaveNetwork(FXObject*, FXSelector, void*) {
1140  getApp()->beginWaitCursor();
1141  try {
1143  myNet->save(oc);
1144  myUndoList->unmark();
1145  myUndoList->mark();
1146  } catch (IOError& e) {
1147  FXMessageBox::error(this, MBOX_OK, "Saving Network failed!", "%s", e.what());
1148  }
1149  myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Network saved.\n");
1151  getApp()->endWaitCursor();
1152  return 1;
1153 }
1154 
1155 
1156 long
1157 GNEApplicationWindow::onUpdSaveNetwork(FXObject* sender, FXSelector, void*) {
1159  bool enable = myNet != 0 && oc.isSet("output-file");
1160  sender->handle(this, FXSEL(SEL_COMMAND, enable ? ID_ENABLE : ID_DISABLE), 0);
1161  if (enable) {
1162  FXString caption = ("Save " + oc.getString("output-file")).c_str();
1163  sender->handle(this, FXSEL(SEL_COMMAND, FXMenuCaption::ID_SETSTRINGVALUE), (void*)&caption);
1164  }
1165  return 1;
1166 }
1167 
1168 
1169 GNEViewNet*
1171  if (mySubWindows.size() != 0) {
1172  return (GNEViewNet*)(((GUIGlChildWindow*)mySubWindows[0])->getView());
1173  } else {
1174  return 0;
1175  }
1176 }
1177 
1178 
1179 bool
1181  if (myUndoList->canUndo() && !myUndoList->marked()) {
1182  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO,
1183  "Confirm Closing Network", "%s",
1184  "You have unsaved changes. Do you wish to close the network and discard all changes?");
1185  if (answer == 1) { //1:yes, 2:no, 4:esc
1186  myUndoList->p_clear(); // only ask once
1187  return true;
1188  } else {
1189  return false;
1190  }
1191  } else {
1192  return true;
1193  }
1194 }
1195 
1196 
1197 Position
1198 GNEApplicationWindow::GNEShapeHandler::getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos) {
1199  std::string edgeID = laneID;
1200  unsigned int lane = 0;
1201  size_t underscore = laneID.rfind('_');
1202 
1203  if (underscore != std::string::npos) {
1204  edgeID = laneID.substr(0, underscore);
1205  lane = static_cast<unsigned int>(TplConvert::_2intSec(laneID.substr(underscore).c_str(), 0));
1206  }
1207  NBEdge* edge = myNet->retrieveEdge(edgeID)->getNBEdge();
1208  if (edge == 0 || edge->getNumLanes() <= lane) {
1209  WRITE_ERROR("Lane '" + laneID + "' to place poi '" + poiID + "' on is not known.");
1210  return Position::INVALID;
1211  }
1212  if (lanePos < 0) {
1213  lanePos = edge->getLength() + lanePos;
1214  }
1215  return edge->getLanes()[lane].shape.positionAtOffset(lanePos);
1216 }
1217 
1218 
1219 void
1221  GNEViewNet* view = getView();
1222  if (view != 0) {
1223  view->updateControls();
1224  }
1225 }
1226 
1227 
1228 long
1229 GNEApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* data) {
1230  const long handled = FXMainWindow::onKeyPress(o, sel, data);
1231  if (handled == 0 && myMDIClient->numChildren() > 0) {
1232  GNEViewParent* w = dynamic_cast<GNEViewParent*>(myMDIClient->getActiveChild());
1233  if (w != 0) {
1234  w->onKeyPress(0, sel, data);
1235  }
1236  }
1237  return 0;
1238 }
1239 
1240 
1241 long
1242 GNEApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* data) {
1243  const long handled = FXMainWindow::onKeyRelease(o, sel, data);
1244  if (handled == 0 && myMDIClient->numChildren() > 0) {
1245  GNEViewParent* w = dynamic_cast<GNEViewParent*>(myMDIClient->getActiveChild());
1246  if (w != 0) {
1247  w->onKeyRelease(0, sel, data);
1248  }
1249  }
1250  return 0;
1251 }
1252 
1253 /****************************************************************************/
std::vector< FXMainWindow * > myTrackerWindows
std::string myConfigPattern
Input file pattern.
FXLabel * myGeoCoordinate
GUISUMOAbstractView * getView() const
FXMenuBar * myMenuBar
The application menu bar.
bool myAmLoading
information whether the gui is currently loading and the load-options shall be greyed out ...
size_t myViewNumber
The current view number.
GUICompleteSchemeStorage gSchemeStorage
Main window closes.
Definition: GUIAppEnum.h:55
void pop()
Definition: MFXEventQue.h:53
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
static std::string clipped
Definition: GUIUserIO.h:64
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:541
long onCmdNewNetwork(FXObject *, FXSelector, void *)
FXEX::FXThreadEvent myLoadThreadEvent
io-event with the load-thread
void abortOperation(bool clearSelection=true)
Definition: GNEViewNet.cpp:653
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.
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
long onCmdReload(FXObject *, FXSelector, void *)
virtual void setViewport(const Position &lookFrom, const Position &lookAt)
applies the given viewport settings
void create()
Creates the widget (and the icons)
void joinSelectedJunctions(GNEUndoList *undoList)
Definition: GNENet.cpp:729
send when a message occured
Definition: GUIEvent.h:50
FXRecentFiles myRecentConfigs
List of recent config files.
bool empty()
Definition: MFXEventQue.h:72
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
The main window of the Netedit.
Locate TLS - button.
Definition: GUIAppEnum.h:171
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Loads a file previously loaded.
Definition: GUIAppEnum.h:81
const std::string & getMsg() const
Returns the message.
virtual void create()
Creates the main window (required by FOX)
long onCmdJoinJunctions(FXObject *, FXSelector, void *)
called if the user selects Processing->join junctions
void unSet(const std::string &name, bool failOnNonExistant=true) const
Marks the option as unset.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:500
static void resetDecal()
Definition: GNEJunction.h:214
The representation of a single edge during network building.
Definition: NBEdge.h:70
GNEUndoList * myUndoList
the one and only undo list
long onCmdComputeJunctions(FXObject *, FXSelector, void *)
called if the user selects Processing->compute junctions
void registerMsgHandlers()
register and unregister message handlers
void computeEverything(GNEApplicationWindow *window, bool force=false)
Definition: GNENet.cpp:687
long onCmdSetMode(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits an edit-mode hotkey
void handleEvent_NetworkLoaded(GUIEvent *e)
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
Editor for the list of chosen objects.
FXGLVisual * myGLVisual
The gl-visual used.
long onCmdOpenForeign(FXObject *, FXSelector, void *)
long onCmdSaveNetwork(FXObject *, FXSelector, void *)
Main window-ID.
Definition: GUIAppEnum.h:53
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
void setEditModeFromHotkey(FXushort selid)
sets edit mode (from hotkey)
Definition: GNEViewNet.cpp:711
FXString gCurrentFolder
The folder used as last.
long onUpdNeedsNetwork(FXObject *, FXSelector, void *)
std::string myFile
the name of the loaded file
long onLoadThreadEvent(FXObject *, FXSelector, void *)
static void resetLoaded()
resets loaded location elements
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
Reload the previously loaded simulation.
Definition: GUIAppEnum.h:79
void loadConfigOrNet(const std::string file, bool isNet, bool isReload=false, bool optionsReady=false, bool newNet=false)
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:114
void updateControls()
update control contents after undo/redo or recompute
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString &currentFolder)
Returns the file name to write.
Definition: MFXUtils.cpp:95
Open network - ID.
Definition: GUIAppEnum.h:75
virtual FXGLCanvas * getBuildGLCanvas() const
long onCmdEditChosen(FXObject *, FXSelector, void *)
void updateControls()
update control contents after undo/redo or recompute
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
void addDecals(const std::vector< Decal > &decals)
GUISUMOAbstractView * openNewView()
GNENet * myNet
the loaded net
long onUpdReload(FXObject *, FXSelector, void *)
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:65
void setViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
The application&#39;s "About" - dialog.
void addSeparator()
Adds a a separator to this log window.
void p_clear()
Definition: GNEUndoList.cpp:89
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
static void setDefaultOptions(OptionsCont &oc)
sets required options for proper functioning
Open configuration - ID.
Definition: GUIAppEnum.h:73
FXHorizontalFrame * myCartesianFrame
FXDEFMAP(GNEApplicationWindow) GNEApplicationWindowMap[]
#define new
Definition: debug_new.h:121
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
std::vector< FXMDIChild * > mySubWindows
long onCmdOptions(FXObject *, FXSelector, void *)
called if the user selects Processing->Configure Options
GUIEventType getOwnType() const
returns the event type
Definition: GUIEvent.h:81
GNEApplicationWindow()
FOX needs this for static members.
ShapeContainer & getShapeContainer()
Definition: GNENet.h:402
FXSplitter * myMainSplitter
The splitter that divides the main window into vies and the log window.
long onCmdOpenRecent(FXObject *, FXSelector, void *)
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
Locate edge - button.
Definition: GUIAppEnum.h:165
virtual void fillMenuBar()
Builds the menu bar.
static void init(FXApp *a)
static void saveToFile(const std::string &file)
save POIs to file
Definition: GNEPOI.cpp:183
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
unsigned int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:345
const std::string getBuildName(const std::string &version)
attach some build flags to the version string
Definition: StdDefs.cpp:91
long onCmdSaveAsPlainXML(FXObject *, FXSelector, void *)
void save(OptionsCont &oc)
save the network
Definition: GNENet.cpp:508
Locate junction - button.
Definition: GUIAppEnum.h:163
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
std::string mySettingsFile
the name of the settings file to load
void saveViewport(const SUMOReal x, const SUMOReal y, const SUMOReal zoom)
Makes the given viewport the default.
send when a error occured
Definition: GUIEvent.h:56
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
Definition: NIFrame.cpp:273
Load additional file with poi and polygons.
Definition: GUIAppEnum.h:77
long onCmdLocate(FXObject *, FXSelector, void *)
Called on menu commands from the Locator menu.
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:137
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
Position getLanePos(const std::string &poiID, const std::string &laneID, SUMOReal lanePos)
get position for a given laneID
long onCmdCleanJunctions(FXObject *, FXSelector, void *)
called if the user selects Processing->clean junctions
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.h:132
#define VERSION_STRING
Definition: config.h:226
The XML-Handler for shapes loading network loading.
virtual ~GNEApplicationWindow()
Destructor.
long onUpdOpen(FXObject *, FXSelector, void *)
GNELoadThread * myLoadThread
FXStatusBar * myStatusbar
The status bar.
long onCmdOpenShapes(FXObject *, FXSelector, void *)
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:205
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
long onCmdEnter(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits enter
bool myViewportFromRegistry
whether loading viewport from registry
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed Called either by FileMenu->Quit, the normal close-me...
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.
About SUMO - ID.
Definition: GUIAppEnum.h:85
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
The loading thread.
Definition: GUIAppEnum.h:115
long onCmdDel(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits del
FXRecentFiles myRecentNets
List of recent nets.
void removeSolitaryJunctions(GNEUndoList *undoList)
Definition: GNENet.cpp:779
static void close()
FXToolBarShell * myMenuBarDrag
FXHorizontalFrame * myGeoFrame
FXDockSite * myTopDock
A storage for options typed value containers)
Definition: OptionsCont.h:108
void set(SUMOReal x, SUMOReal y)
Definition: Position.h:78
long onCmdClose(FXObject *, FXSelector, void *)
void clear()
Clears the list of selected objects.
void lock()
lock mutex
Definition: MFXMutex.cpp:86
FXMDIClient * myMDIClient
The multi view panel.
send when a simulation has been loaded
Definition: GUIEvent.h:44
void handleEvent_Message(GUIEvent *e)
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
Definition: GNENet.cpp:522
FXGLCanvas * getBuildGLCanvas() const
send when a warning occured
Definition: GUIEvent.h:53
long onCmdAbort(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits esc
#define SUMOReal
Definition: config.h:214
void loadConfigOrNet(const std::string &file, bool isNet, bool optionsReady=false, bool newNet=false)
begins the loading of a netconvert configuration or a a network
long onCmdSaveJoined(FXObject *, FXSelector, void *)
An XML-handler for visualisation schemes.
const FXString myTitlePrefix
the prefix for the window title
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependance to an optional file name.
Definition: MFXUtils.cpp:73
Close simulation - ID.
Definition: GUIAppEnum.h:83
GNENet * myNet
we are responsible for the net
void clear()
Clears the window.
processing menu messages
Definition: GUIAppEnum.h:401
static int _2intSec(const E *const data, int def)
Definition: TplConvert.h:341
void hotkeyDel()
Definition: GNEViewNet.cpp:675
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
GUISelectedStorage gSelected
A global holder of selected objects.
void hotkeyEnter()
Definition: GNEViewNet.cpp:688
long onCmdSaveAsNetwork(FXObject *, FXSelector, void *)
A logging window for the gui.
static FXIcon * getIcon(GUIIcon which)
void setStatusBarText(const std::string &)
misc messages
Definition: GUIAppEnum.h:423
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
Definition: GNENet.cpp:515
static void fillOptions(OptionsCont &oc)
clears and initializes the OptionsCont
FXMenuPane * myFileMenu
the submenus
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
long onUpdSaveNetwork(FXObject *, FXSelector, void *)
long onCmdSavePois(FXObject *, FXSelector, void *)
static const Position INVALID
Definition: Position.h:261
SUMOReal getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:404
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.