57 mySimulationInProgress(false),
59 myHaveSignaledEnd(false),
105 if (std::string(e2.what()) != std::string(
"Process Error") && std::string(e2.what()) != std::string(
"")) {
230 if (std::string(e2.what()) != std::string(
"Process Error") && std::string(e2.what()) != std::string(
"")) {
287 return myNet !=
nullptr;
302 if (
myNet !=
nullptr) {
361 window->getView()->waitForSnapshots(snapshotTime);
#define WRITE_MESSAGEF(...)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Event sent when the simulation is over.
void clear()
Clears this container.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
const std::vector< GUIGlChildWindow * > & getViews() const
get views
static GUIMainWindow * getInstance()
get instance
A MSNet extended by some values for usage within the gui.
void setIdleDuration(int val)
Sets the duration of the last step's idle part.
void simulationStep()
Performs a single simulation step (locking the simulation)
void setSimDuration(int val)
Sets the duration of the last step's simulation part.
void guiSimulationStep()
Some further steps needed for gui processing.
double & mySimDelay
simulation delay
void singleStep()
called when the user presses the "single step"-button
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations.
GUINet * myNet
the loaded simulation network
FXMutex myBreakpointLock
Lock for modifying the list of breakpoints.
GUINet & getNet() const
returns the loaded network
std::vector< SUMOTime > myBreakpoints
List of breakpoints.
virtual FXint run()
starts the execution
virtual void begin()
starts the simulation (execution of one step after another)
void resume()
called when the user presses the "resume"-button
FXEX::MFXThreadEvent & myEventThrow
thrower events
virtual bool simulationIsStartable() const
check if simulation is startable
bool networkAvailable() const
returns the information whether a network has been loaded
bool myOk
flag to check if all is ok
virtual bool simulationIsStepable() const
check if simulation is stepable
bool mySimulationInProgress
information whether a simulation step is being performed
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
void makeStep()
make simulation step
bool myHalting
information whether the simulation is halting (is not being executed)
virtual ~GUIRunThread()
destructor
void tryStep()
try simulation step
virtual bool simulationIsStopable() const
check if simulation is stopableo
OutputDevice * myMessageRetriever
long myLastEndMillis
end of the last simulation step
bool mySingle
information whether the thread is running in single step mode
OutputDevice * myWarningRetriever
virtual void deleteSim()
deletes the existing simulation
void retrieveMessage(const MsgHandler::MsgType type, const std::string &msg)
Retrieves messages from the loading module.
void waitForSnapshots(const SUMOTime snapshotTime)
wait for snapshots
SUMOTime mySimStartTime
the times the simulation starts and ends with
bool myQuit
information whether the thread shall be stopped
void stop()
halts the simulation execution
bool myAmLibsumo
whether we are running in libsumo
void prepareDestruction()
halts the thread before it shall be deleted
long myLastBreakMillis
last time the simulation took a microsecond break for the fox event loop to catch up (#9028)
MFXSynchQue< GUIEvent * > & myEventQue
event queue
FXMutex mySimulationLock
mutex for lock simulation
GUIRunThread(FXApp *app, MFXInterThreadEventClient *mw, double &simDelay, MFXSynchQue< GUIEvent * > &eq, FXEX::MFXThreadEvent &ev)
constructor
bool myHaveSignaledEnd
whether the simulation already ended
static void sleep(long ms)
FXApp * myApp
pointer to APP
SimulationState adaptToState(const SimulationState state, const bool isLibsumo=false) const
Called after a simulation step, this method adapts the current simulation state if necessary.
SimulationState
Possible states of a simulation - running or stopped with different reasons.
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
@ SIMSTATE_LOADING
The simulation is loading.
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
void loadRoutes()
loads routes for the next few steps
virtual void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
static void cleanupOnEnd()
Removes pending handler.
virtual void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
@ MT_MESSAGE
The message is only something to show.
@ MT_ERROR
The message is an error.
@ MT_WARNING
The message is a warning.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Encapsulates an object's method for using it as a message retriever.
static OptionsCont & getOptions()
Retrieves the options.
static void closeAll(bool keepErrorRetrievers=false)
static long getCurrentMillis()
Returns the current time in milliseconds.