72 #ifdef CHECK_MEMORY_LEAKS 153 FXIMPLEMENT(
GNEApplicationWindow, FXMainWindow, GNEApplicationWindowMap, ARRAYNUMBER(GNEApplicationWindowMap))
159 #pragma warning(disable: 4355) 162 const std::string& configPattern)
166 myRecentNets(a,
"nets"),
167 myConfigPattern(configPattern),
168 hadDependentBuild(false),
175 #pragma warning(default: 4355) 183 WRITE_ERROR(
"DEBUG: GNEApplicationWindow::dependentBuild called twice");
194 LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED);
202 myStatusbar =
new FXStatusBar(
this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X | FRAME_RAISED);
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);
215 SPLITTER_REVERSED | SPLITTER_VERTICAL | LAYOUT_FILL_X | LAYOUT_FILL_Y | SPLITTER_TRACKING | FRAME_RAISED | FRAME_THICK);
217 LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK);
220 FXMDIClient::ID_MDI_MENUWINDOW, LAYOUT_LEFT);
222 FXMDIClient::ID_MDI_MENUCLOSE, FRAME_RAISED | LAYOUT_RIGHT);
224 FXMDIClient::ID_MDI_MENURESTORE, FRAME_RAISED | LAYOUT_RIGHT);
226 FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED | LAYOUT_RIGHT);
244 getAccelTable()->addAccel(parseAccel(
"m"),
this, FXSEL(SEL_COMMAND,
MID_GNE_MODE_MOVE));
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));
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));
263 gCurrentFolder = getApp()->reg().readStringEntry(
"SETTINGS",
"basedir",
"");
264 FXMainWindow::create();
272 FXint width = getApp()->getNormalFont()->getTextWidth(
"8", 1) * 22;
276 show(PLACEMENT_SCREEN);
277 if (getApp()->reg().readIntEntry(
"SETTINGS",
"maximized", 0) == 1) {
310 FXMainWindow::detach();
321 "&New Network...\tCtrl+A\tCreate a new network.",
324 "Open &Network...\tCtrl+N\tOpen a SUMO network.",
327 "&Open Configuration...\tCtrl+O\tOpen a NETCONVERT configuration file.",
330 "Import &Foreign Network...\t\tImport a foreign network such as OSM.",
333 "Load &Shapes...\tCtrl+P\tLoad shapes into the network view.",
336 "&Reload\tCtrl+R\tReloads the network.",
339 "&Save Network...\tCtrl+S\tSave the network.",
342 "&Save Network As...\tCtrl+Shift-S\tSave the network.",
345 "&Save plain xml...\t\tSave plain xml representation the network.",
348 "&Save joined junctions...\t\tSave log of joined junctions (allows reproduction of joins).",
351 "&Save POIs As ...\t\tSave the POIs.",
355 "Close\tCtrl+W\tClose the network.",
358 FXMenuSeparator* sep1 =
new FXMenuSeparator(
myFileMenu);
360 sep1->setSelector(FXRecentFiles::ID_ANYFILES);
374 FXMenuSeparator* sep2 =
new FXMenuSeparator(
myFileMenu);
376 sep2->setSelector(FXRecentFiles::ID_ANYFILES);
392 "&Quit\tCtrl+Q\tQuit the Application.",
399 "Undo\tCtrl+Z\tUndo the last change.",
402 "Redo\tCtrl+Y\tRedo the last change.",
417 "Compute Junctions\tF5\tComputes junction shape and logic.",
420 "Clean Junctions\tF6\tRemoves solitary junctions.",
423 "Join Selected Junctions\tF7\tJoins selected junctions into a single junction.",
426 "Options\t\tConfigure Processing Options.",
441 "Locate &Junctions\t\tOpen a Dialog for Locating a Junction.",
444 "Locate &Edges\t\tOpen a Dialog for Locating an Edge.",
447 "Locate &TLS\t\tOpen a Dialog for Locating a Traffic Light.",
454 "Show Status Line\t\tToggle this Status Bar on/off.",
457 "Show Message Window\t\tToggle the Message Window on/off.",
483 "Clear Message Window\t\tClear the message window.",
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());
503 getApp()->reg().writeIntEntry(
"SETTINGS",
"maximized", 1);
505 getApp()->reg().writeIntEntry(
"SETTINGS",
"maximized", 0);
540 FXFileDialog opendialog(
this,
"Open Netconvert Configuration");
542 opendialog.setSelectMode(SELECTFILE_EXISTING);
547 if (opendialog.execute()) {
549 std::string file = opendialog.getFilename().text();
560 FXFileDialog opendialog(
this,
"Open Network");
562 opendialog.setSelectMode(SELECTFILE_EXISTING);
563 opendialog.setPatternList(
"SUMO nets (*.net.xml)\nAll files (*)");
567 if (opendialog.execute()) {
569 std::string file = opendialog.getFilename().text();
584 FXFileDialog opendialog(
this,
"Import Foreign Network");
586 opendialog.setSelectMode(SELECTFILE_EXISTING);
587 FXString osmPattern(
"OSM net (*.osm.xml,*.osm)");
588 opendialog.setPatternText(0, osmPattern);
592 if (opendialog.execute()) {
594 std::string file = opendialog.getFilename().text();
598 if (osmPattern.contains(opendialog.getPattern())) {
599 oc.
set(
"osm-files", file);
600 oc.
set(
"ramps.guess",
"true");
601 oc.
set(
"tls.guess",
"true");
603 throw ProcessError(
"Attempted to import unknown file format '" + file +
"'.");
607 new GNEDialog_Wizard(
this,
"Select Import Options", getWidth(), getHeight());
609 if (wizard->execute()) {
621 FXFileDialog opendialog(
this,
"Open Shapes");
623 opendialog.setSelectMode(SELECTFILE_EXISTING);
624 opendialog.setPatternList(
"Additional files (*.xml)\nAll files (*)");
628 if (opendialog.execute()) {
630 std::string file = opendialog.getFilename().text();
644 myStatusbar->getStatusLine()->setText(
"Already loading!");
647 std::string file((
const char*)data);
682 sender->handle(
this,
myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
699 about->show(PLACEMENT_OWNER);
705 FXEvent*
event = (FXEvent*)ptr;
707 setDNDData(FROM_CLIPBOARD, event->target,
string);
748 if (ec->
myNet == 0) {
760 std::string settingsName = settings.
addSettings(view);
771 off.
set(getApp()->reg().readIntEntry(
"viewport",
"x"), getApp()->reg().readIntEntry(
"viewport",
"y"), getApp()->reg().readIntEntry(
"viewport",
"z"));
775 getApp()->endWaitCursor();
793 getApp()->beginWaitCursor();
812 FXuint opts = MDI_TRACKING;
814 myMDIMenu, FXString(caption.c_str()),
this,
817 opts, 10, 10, 300, 200);
883 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
890 if (oc.
isSet(
"configuration-file")) {
928 myStatusbar->getStatusLine()->setText(text.c_str());
929 myStatusbar->getStatusLine()->setNormalText(text.c_str());
1004 if (wizard->execute()) {
1014 "Save Network as",
".net.xml",
1022 oc.
set(
"output-file", file.text());
1032 "Select name of the plain-xml edge-file (other names will be deduced from this)",
".edg.xml",
1039 bool wasSet = oc.
isSet(
"plain-output-prefix");
1040 std::string oldPrefix = oc.
getString(
"plain-output-prefix");
1042 std::string prefix = file.text();
1043 prefix = prefix.substr(0, prefix.size() - 8);
1044 oc.
set(
"plain-output-prefix", prefix);
1045 getApp()->beginWaitCursor();
1051 FXMessageBox::error(
this, MBOX_OK,
"Saving plain xml failed!",
"%s", e.what());
1057 oc.
set(
"plain-output-prefix", oldPrefix);
1059 oc.
unSet(
"plain-output-prefix");
1061 getApp()->endWaitCursor();
1069 "Select name of the joined-junctions file",
".nod.xml",
1076 bool wasSet = oc.
isSet(
"junctions.join-output");
1077 std::string oldFile = oc.
getString(
"junctions.join-output");
1079 std::string filename = file.text();
1080 oc.
set(
"junctions.join-output", filename);
1081 getApp()->beginWaitCursor();
1085 FXMessageBox::error(
this, MBOX_OK,
"Saving joined junctions failed!",
"%s", e.what());
1091 oc.
set(
"junctions.join-output", oldFile);
1093 oc.
unSet(
"junctions.join-output");
1095 getApp()->endWaitCursor();
1103 "Select name of the POI file",
".xml",
1109 std::string filename = file.text();
1111 getApp()->beginWaitCursor();
1115 FXMessageBox::error(
this, MBOX_OK,
"Saving POIs failed!",
"%s", e.what());
1118 getApp()->endWaitCursor();
1125 sender->handle(
this,
myNet == 0 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
1133 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), 0);
1140 getApp()->beginWaitCursor();
1147 FXMessageBox::error(
this, MBOX_OK,
"Saving Network failed!",
"%s", e.what());
1151 getApp()->endWaitCursor();
1159 bool enable =
myNet != 0 && oc.
isSet(
"output-file");
1160 sender->handle(
this, FXSEL(SEL_COMMAND, enable ? ID_ENABLE : ID_DISABLE), 0);
1162 FXString caption = (
"Save " + oc.
getString(
"output-file")).c_str();
1163 sender->handle(
this, FXSEL(SEL_COMMAND, FXMenuCaption::ID_SETSTRINGVALUE), (
void*)&caption);
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?");
1199 std::string edgeID = laneID;
1200 unsigned int lane = 0;
1201 size_t underscore = laneID.rfind(
'_');
1203 if (underscore != std::string::npos) {
1204 edgeID = laneID.substr(0, underscore);
1209 WRITE_ERROR(
"Lane '" + laneID +
"' to place poi '" + poiID +
"' on is not known.");
1215 return edge->
getLanes()[lane].shape.positionAtOffset(lanePos);
1230 const long handled = FXMainWindow::onKeyPress(o, sel, data);
1231 if (handled == 0 &&
myMDIClient->numChildren() > 0) {
1243 const long handled = FXMainWindow::onKeyRelease(o, sel, data);
1244 if (handled == 0 &&
myMDIClient->numChildren() > 0) {
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
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
static std::string clipped
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
long onCmdNewNetwork(FXObject *, FXSelector, void *)
FXEX::FXThreadEvent myLoadThreadEvent
io-event with the load-thread
void abortOperation(bool clearSelection=true)
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)
send when a message occured
FXRecentFiles myRecentConfigs
List of recent config files.
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
The main window of the Netedit.
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Loads a file previously loaded.
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.
The representation of a single edge during network building.
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)
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.
bool continueWithUnsavedChanges()
FXGLVisual * myGLVisual
The gl-visual used.
long onCmdOpenForeign(FXObject *, FXSelector, void *)
long onCmdSaveNetwork(FXObject *, FXSelector, void *)
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
void setEditModeFromHotkey(FXushort selid)
sets edit mode (from hotkey)
FXString gCurrentFolder
The folder used as last.
long onUpdNeedsNetwork(FXObject *, FXSelector, void *)
virtual void eventOccured()
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.
void unregisterMsgHandlers()
Reload the previously loaded simulation.
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's ok.
void updateControls()
update control contents after undo/redo or recompute
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
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.
void setViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
static OptionsCont & getOptions()
Retrieves the options.
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
The application's "About" - dialog.
void addSeparator()
Adds a a separator to this log window.
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
static void setDefaultOptions(OptionsCont &oc)
sets required options for proper functioning
FXHorizontalFrame * myCartesianFrame
FXDEFMAP(GNEApplicationWindow) GNEApplicationWindowMap[]
FXMenuPane * myProcessingMenu
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static FXint fxexecute(FXString link)
std::vector< FXMDIChild * > mySubWindows
long onCmdOptions(FXObject *, FXSelector, void *)
called if the user selects Processing->Configure Options
GUIEventType getOwnType() const
returns the event type
FXMenuPane * myWindowsMenu
GNEApplicationWindow()
FOX needs this for static members.
ShapeContainer & getShapeContainer()
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.
virtual void fillMenuBar()
Builds the menu bar.
static void init(FXApp *a)
static void saveToFile(const std::string &file)
save POIs to file
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
unsigned int getNumLanes() const
Returns the number of lanes.
const std::string getBuildName(const std::string &version)
attach some build flags to the version string
long onCmdSaveAsPlainXML(FXObject *, FXSelector, void *)
void save(OptionsCont &oc)
save the network
Locate junction - button.
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
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
Load additional file with poi and polygons.
long onCmdLocate(FXObject *, FXSelector, void *)
Called on menu commands from the Locator menu.
void setTarget(FXObject *tgt)
set the target
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
FXCursor * getDefaultCursor()
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
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 *)
void unlock()
release mutex lock
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.
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
long onCmdDel(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits del
FXRecentFiles myRecentNets
List of recent nets.
void removeSolitaryJunctions(GNEUndoList *undoList)
FXToolBarShell * myMenuBarDrag
FXHorizontalFrame * myGeoFrame
A storage for options typed value containers)
void set(SUMOReal x, SUMOReal y)
long onCmdClose(FXObject *, FXSelector, void *)
void clear()
Clears the list of selected objects.
FXMDIClient * myMDIClient
The multi view panel.
send when a simulation has been loaded
void handleEvent_Message(GUIEvent *e)
void saveJoined(OptionsCont &oc)
save log of joined junctions (and nothing else)
FXGLCanvas * getBuildGLCanvas() const
send when a warning occured
long onCmdAbort(FXObject *sender, FXSelector sel, void *ptr)
called if the user hits esc
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.
GNENet * myNet
we are responsible for the net
void clear()
Clears the window.
static int _2intSec(const E *const data, int def)
#define WRITE_MESSAGE(msg)
GUISelectedStorage gSelected
A global holder of selected objects.
long onCmdSaveAsNetwork(FXObject *, FXSelector, void *)
A logging window for the gui.
static FXIcon * getIcon(GUIIcon which)
void setStatusBarText(const std::string &)
void savePlain(OptionsCont &oc)
save plain xml representation of the network (and nothing else)
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 *)
FXMenuPane * myLocatorMenu
long onCmdSavePois(FXObject *, FXSelector, void *)
static const Position INVALID
SUMOReal getLength() const
Returns the computed length of the edge.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.