Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/GNELoadThread.h
193716 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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 GNELoadThread.h
15
/// @author Jakob Erdmann
16
/// @date Feb 2011
17
///
18
// The thread that performs the loading of a Netedit-net (adapted from
19
// GUILoadThread)
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <utils/common/MsgHandler.h>
25
#include <utils/foxtools/MFXSingleEventThread.h>
26
#include <utils/foxtools/MFXSynchQue.h>
27
#include <utils/foxtools/MFXInterThreadEventClient.h>
28
29
#include "GNEEvent_FileLoaded.h"
30
31
// ===========================================================================
32
// class declarations
33
// ===========================================================================
34
35
class GNEApplicationWindow;
36
37
// ===========================================================================
38
// class definitions
39
// ===========================================================================
40
41
class GNELoadThread : protected MFXSingleEventThread {
42
43
public:
44
/// @brief constructor
45
GNELoadThread(GNEApplicationWindow* applicationWindow, MFXSynchQue<GUIEvent*>& eq, FXEX::MFXThreadEvent& ev);
46
47
/// @brief destructor
48
virtual ~GNELoadThread();
49
50
/// @brief starts the thread. The thread ends after the net has been loaded
51
FXint run();
52
53
/// @brief begins the creation of an empty network
54
void newNetwork();
55
56
/// @brief begins the loading of an existent network or config
57
void loadNetworkOrConfig();
58
59
/// @brief Retrieves messages from the loading module
60
void retrieveMessage(const MsgHandler::MsgType type, const std::string& msg);
61
62
/// @brief clears and initializes the OptionsCont
63
static void fillOptions(OptionsCont& neteditOptions);
64
65
/// @brief sets required options for proper functioning
66
static void setDefaultOptions(OptionsCont& neteditOptions);
67
68
private:
69
/// @brief load options through console
70
bool loadConsoleOptions();
71
72
/**@brief Closes the loading process
73
*
74
* This method is called both on success and failure.
75
* All message callbacks to this instance are removed and the parent
76
* application is informed about the loading
77
*/
78
FXint submitEndAndCleanup(GNEEvent_FileLoaded::Type type, GNENet* net, const std::string& loadedFile,
79
const std::string& guiSettingsFile = "", const bool viewportFromRegistry = false);
80
81
/// @brief netedit application windows
82
GNEApplicationWindow* myApplicationWindow;
83
84
/// @brief @brief The instances of message retriever encapsulations Needed to be deleted from the handler later on
85
OutputDevice* myErrorRetriever, *myMessageRetriever, *myWarningRetriever, *myDebugRetriever, *myGLDebugRetriever;
86
87
/// @brief event Queue
88
MFXSynchQue<GUIEvent*>& myEventQueue;
89
90
/// @brief event throw
91
FXEX::MFXThreadEvent& myEventThrow;
92
};
93
94