Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/gui/GUILoadThread.h
169665 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2002-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GUILoadThread.h
15
/// @author Daniel Krajzewicz
16
/// @author Sascha Krieg
17
/// @author Michael Behrisch
18
/// @author Jakob Erdmann
19
/// @date Sept 2002
20
///
21
// Class describing the thread that performs the loading of a simulation
22
/****************************************************************************/
23
#pragma once
24
#include <config.h>
25
26
#include <utils/common/SUMOTime.h>
27
#include <utils/common/MsgHandler.h>
28
#include <utils/foxtools/MFXSingleEventThread.h>
29
#include <utils/foxtools/MFXThreadEvent.h>
30
#include <utils/foxtools/MFXSynchQue.h>
31
32
33
// ===========================================================================
34
// class declarations
35
// ===========================================================================
36
class GUIApplicationWindow;
37
class GUINet;
38
class GUIEvent;
39
40
41
// ===========================================================================
42
// class definitions
43
// ===========================================================================
44
/**
45
* @class GUILoadThread
46
*/
47
class GUILoadThread : public MFXSingleEventThread {
48
public:
49
/// constructor
50
GUILoadThread(FXApp* app, GUIApplicationWindow* mw, MFXSynchQue<GUIEvent*>& eq,
51
FXEX::MFXThreadEvent& ev, const bool isLibsumo);
52
53
/// destructor
54
virtual ~GUILoadThread();
55
56
/** starts the thread
57
the thread ends after the net has been loaded */
58
FXint run();
59
60
/// begins the loading of the given file
61
void loadConfigOrNet(const std::string& file);
62
63
/// Retrieves messages from the loading module
64
void retrieveMessage(const MsgHandler::MsgType type, const std::string& msg);
65
66
const std::string& getFileName() const;
67
68
protected:
69
/** @brief Closes the loading process
70
*
71
* This method is called both on success and failure.
72
* All message callbacks to this instance are removed and the parent
73
* application is informed about the loading */
74
void submitEndAndCleanup(GUINet* net, const SUMOTime simStartTime, const SUMOTime simEndTime,
75
const std::vector<std::string>& guiSettingsFiles = std::vector<std::string>(),
76
const bool osgView = false,
77
const bool viewportFromRegistry = false);
78
79
protected:
80
/// the parent window to inform about the loading
81
GUIApplicationWindow* myParent;
82
83
/// the path to load the simulation from
84
std::string myFile;
85
86
/// the title string for the application
87
std::string myTitle;
88
89
/** @brief The instances of message retriever encapsulations
90
Needed to be deleted from the handler later on */
91
OutputDevice* myErrorRetriever, *myMessageRetriever, *myWarningRetriever;
92
93
MFXSynchQue<GUIEvent*>& myEventQue;
94
95
FXEX::MFXThreadEvent& myEventThrow;
96
97
/// whether we are running in libsumo
98
const bool myAmLibsumo;
99
100
};
101
102