#include <signal.h>
#include <utils/common/SystemFrame.h>
#include <utils/foxtools/MsgHandlerSynchronized.h>
#include <utils/gui/settings/GUICompleteSchemeStorage.h>
#include <utils/options/OptionsIO.h>
#include <utils/xml/XMLSubSys.h>
#include <netedit/dialogs/GNECrashDialog.h>
#ifdef HAVE_VERSION_H
#include <version.h>
#endif
#include "GNEApplicationWindow.h"
#include "GNEExternalRunner.h"
#include "GNELoadThread.h"
#include "GNETagPropertiesDatabase.h"
int
main(int argc, char** argv) {
MsgHandler::setFactory(&MsgHandlerSynchronized::create);
auto& neteditOptions = OptionsCont::getOptions();
neteditOptions.setApplicationDescription(TL("Graphical editor for SUMO networks, demand and additional infrastructure."));
neteditOptions.setApplicationName("netedit", "Eclipse SUMO netedit " VERSION_STRING);
FXRegistry reg("SUMO GUI", "sumo-gui");
reg.read();
gLanguage = reg.readStringEntry("gui", "language", gLanguage.c_str());
int ret = 0;
#ifndef _DEBUG
try {
#endif
XMLSubSys::init();
GNELoadThread::fillOptions(neteditOptions);
GNELoadThread::setDefaultOptions(neteditOptions);
OptionsIO::setArgs(argc, argv);
OptionsIO::getOptions(true);
if (neteditOptions.processMetaOptions(false)) {
SystemFrame::close();
} else {
const GNETagPropertiesDatabase* tagPropertiesDatabase = new GNETagPropertiesDatabase();
if (neteditOptions.isSet("attribute-help-output")) {
tagPropertiesDatabase->writeAttributeHelp();
} else {
FXApp application("SUMO netedit", "netedit");
application.init(argc, argv);
int minor, major;
if (!FXGLVisual::supported(&application, major, minor)) {
throw ProcessError(TL("This system has no OpenGL support. Exiting."));
} else {
GNEApplicationWindow* netedit = new GNEApplicationWindow(&application, tagPropertiesDatabase, "*.netc.cfg,*.netccfg");
#ifndef _DEBUG
try {
#endif
GNEExternalRunner* externalRunner = new GNEExternalRunner(netedit);
gLanguage = neteditOptions.getString("language");
gSchemeStorage.init(&application, true);
netedit->dependentBuild();
application.addSignal(SIGINT, netedit, MID_HOTKEY_CTRL_Q_CLOSE);
application.create();
if (argc > 1) {
OptionsIO::setArgs(argc, argv);
netedit->loadOptionOnStartup();
}
netedit->setFocus();
ret = application.run();
delete externalRunner;
delete netedit;
#ifndef _DEBUG
} catch (const ProcessError& e) {
if (std::string(e.what()).length() > 0) {
WRITE_ERROR(e.what());
}
MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
ret = 1;
GNECrashDialog(netedit, e);
}
#endif
}
}
delete tagPropertiesDatabase;
}
#ifndef _DEBUG
} catch (const std::exception& e) {
if (std::string(e.what()).length() > 0) {
WRITE_ERROR(e.what());
}
MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
ret = 1;
} catch (...) {
MsgHandler::getErrorInstance()->inform("Quitting (on unknown error).", false);
ret = 1;
}
#endif
SystemFrame::close();
return ret;
}