guisim_main.cpp File Reference


Detailed Description

Author:
Daniel Krajzewicz
Date:
Tue, 20 Nov 2001
Version:
Id
guisim_main.cpp 8572 2010-04-06 22:36:56Z behrisch

Definition in file guisim_main.cpp.

#include <config.h>
#include <ctime>
#include <signal.h>
#include <iostream>
#include <fx.h>
#include <fx3d.h>
#include <microsim/MSNet.h>
#include <microsim/MSEmitControl.h>
#include <utils/options/Option.h>
#include <utils/options/OptionsCont.h>
#include <utils/options/OptionsIO.h>
#include <utils/common/UtilExceptions.h>
#include <utils/common/FileHelpers.h>
#include <utils/common/MsgHandler.h>
#include <utils/common/SystemFrame.h>
#include <utils/xml/XMLSubSys.h>
#include <gui/GUIApplicationWindow.h>
#include <utils/gui/windows/GUIAppEnum.h>
#include <gui/GUIGlobals.h>
#include <guisim/GUIEdge.h>
#include <utils/gui/windows/GUIAppGlobals.h>
#include <utils/gui/images/GUIImageGlobals.h>
#include <utils/gui/settings/GUICompleteSchemeStorage.h>
#include <gui/GUIViewTraffic.h>
#include <guisim/GUIVehicle.h>

Go to the source code of this file.

Functions

void fillOptions ()
int main (int argc, char **argv)


Function Documentation

void fillOptions (  ) 

Definition at line 71 of file guisim_main.cpp.

References OptionsCont::addCallExample(), OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), OptionsCont::addSynonyme(), OptionsCont::doRegister(), and OptionsCont::getOptions().

Referenced by main().

00071               {
00072     OptionsCont &oc = OptionsCont::getOptions();
00073     oc.addCallExample("");
00074     oc.addCallExample("-c <CONFIGURATION>");
00075 
00076     // insert options sub-topics
00077     oc.addOptionSubTopic("Process");
00078     oc.addOptionSubTopic("Visualisation");
00079 
00080     oc.doRegister("configuration-file", 'c', new Option_FileName());
00081     oc.addSynonyme("configuration-file", "configuration");
00082     oc.addDescription("configuration-file", "Process", "Loads the named config on startup");
00083 
00084     oc.doRegister("quit-on-end", 'Q', new Option_Bool(false));
00085     oc.addDescription("quit-on-end", "Process", "Quits the gui when the simulation stops");
00086 
00087     oc.doRegister("game", 'G', new Option_Bool(false));
00088     oc.addDescription("game", "Process", "Start the GUI in gaming mode");
00089 
00090     oc.doRegister("no-start", 'N', new Option_Bool(false));
00091     oc.addDescription("no-start", "Process", "Does not start the simulation after loading");
00092 
00093     oc.doRegister("disable-textures", 'T', new Option_Bool(false)); // !!!
00094     oc.addDescription("disable-textures", "Visualisation", "");
00095 }

int main ( int  argc,
char **  argv 
)

Definition at line 102 of file guisim_main.cpp.

References MsgHandler::assignLock(), SystemFrame::close(), GUIApplicationWindow::dependentBuild(), fillOptions(), gAllowTextures, OptionsCont::getBool(), MsgHandler::getErrorInstance(), MsgHandler::getMessageInstance(), OptionsIO::getOptions(), OptionsCont::getOptions(), OptionsCont::getString(), MsgHandler::getWarningInstance(), gFXApp, gQuitOnEnd, gSchemeStorage, MsgHandler::inform(), GUICompleteSchemeStorage::init(), XMLSubSys::init(), initGuiShapeNames(), OptionsCont::isSet(), GUIApplicationWindow::loadOnStartup(), MID_QUIT, MsgHandler::report2cerr(), MsgHandler::report2cout(), OptionsCont::setApplicationDescription(), and OptionsCont::setApplicationName().

00102                             {
00103     // make the output aware of threading
00104     MFXMutex lock;
00105     MsgHandler::assignLock(&lock);
00106     // get the options
00107     OptionsCont &oc = OptionsCont::getOptions();
00108     // give some application descriptions
00109     oc.setApplicationDescription("GUI version of the simulation SUMO.");
00110     oc.setApplicationName("sumo-gui.exe", "SUMO gui Version " + (std::string)VERSION_STRING);
00111     int ret = 0;
00112 #ifndef _DEBUG
00113     try {
00114 #else
00115     {
00116 #endif
00117         // initialise subsystems
00118         XMLSubSys::init(false);
00119         fillOptions();
00120         OptionsIO::getOptions(false, argc, argv);
00121         // within gui-based applications, nothing is reported to the console
00122         MsgHandler::getErrorInstance()->report2cout(false);
00123         MsgHandler::getErrorInstance()->report2cerr(false);
00124         MsgHandler::getWarningInstance()->report2cout(false);
00125         MsgHandler::getWarningInstance()->report2cerr(false);
00126         MsgHandler::getMessageInstance()->report2cout(false);
00127         MsgHandler::getMessageInstance()->report2cerr(false);
00128         // Make application
00129         FXApp application("SUMO GUISimulation", "DLR");
00130         gFXApp = &application;
00131         // Open display
00132         application.init(argc,argv);
00133         int minor, major;
00134         if (!FXGLVisual::supported(&application, major, minor)) {
00135             throw ProcessError("This system has no OpenGL support. Exiting.");
00136         }
00137         // initialise global settings
00138         gQuitOnEnd = oc.getBool("quit-on-end");
00139         gAllowTextures = !oc.getBool("disable-textures");
00140 
00141         // build the main window
00142         GUIApplicationWindow * window =
00143             new GUIApplicationWindow(&application, "*.sumo.cfg");
00144         window->dependentBuild(oc.getBool("game"));
00145         gSchemeStorage.init(&application);
00146         // init simulation and visualization structures
00147         initGuiShapeNames();
00148         // Create app
00149         application.addSignal(SIGINT,window, MID_QUIT);
00150         application.create();
00151         // Load configuration given on command line
00152         if (oc.isSet("configuration-file")) {
00153             window->loadOnStartup(oc.getString("configuration-file"),
00154                                   !oc.getBool("no-start"));
00155         }
00156         // Run
00157         ret = application.run();
00158 #ifndef _DEBUG
00159     } catch (...) {
00160         MsgHandler::getErrorInstance()->inform("Quitting (on error).", false);
00161         ret = 1;
00162     }
00163 #else
00164     }
00165 #endif
00166     SystemFrame::close();
00167     return ret;
00168 }


Generated on Wed May 5 00:06:38 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6