Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/gui/settings/GUICompleteSchemeStorage.h
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-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 GUICompleteSchemeStorage.h
15
/// @author Daniel Krajzewicz
16
/// @author Michael Behrisch
17
/// @date :find(mySortedSchemeNames.begin(), mySortedSchemeNames.end(), name)==mySortedSchemeNames.end()) {
18
///
19
// Storage for available visualization settings
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <string>
25
#include <vector>
26
#include <algorithm>
27
#include <map>
28
#include <utils/gui/windows/GUISUMOAbstractView.h>
29
30
31
// ===========================================================================
32
// class definitions
33
// ===========================================================================
34
/**
35
* @class GUICompleteSchemeStorage
36
* @brief Storage for available visualization settings
37
*/
38
class GUICompleteSchemeStorage {
39
public:
40
/// @brief Constructor
41
GUICompleteSchemeStorage();
42
43
44
/// @brief Destructor
45
~GUICompleteSchemeStorage();
46
47
48
/** @brief Adds a visualization scheme
49
* @param[in] scheme The visualization scheme to add
50
*/
51
void add(const GUIVisualizationSettings& scheme);
52
53
54
/** @brief Returns the named scheme
55
* @param[in] name The name of the visualization scheme to return
56
* @return The named visualization scheme
57
*/
58
GUIVisualizationSettings& get(const std::string& name);
59
60
61
/** @brief Returns the default scheme
62
* @return The default visualization scheme
63
*/
64
GUIVisualizationSettings& getDefault();
65
66
67
/** @brief Returns the information whether a setting with the given name is stored
68
* @param[in] name The name of regarded scheme
69
* @return Whether the named scheme is known
70
*/
71
bool contains(const std::string& name) const;
72
73
74
/** @brief Removes the setting with the given name
75
* @param[in] name The name of the scheme to remove
76
*/
77
void remove(const std::string name);
78
79
80
/** @brief Makes the scheme with the given name the default
81
* @param[in] name The name of the scheme to marks as default
82
*/
83
void setDefault(const std::string& name);
84
85
86
/** @brief Returns a list of stored settings names
87
* @return The names of known schemes
88
*/
89
const std::vector<std::string>& getNames() const;
90
91
92
/** @brief Returns the number of initial settings
93
* @return The number of default schemes
94
*/
95
int getNumInitialSettings() const;
96
97
98
/** @brief Initialises the storage with some default settings
99
* @param[in] app The application
100
*/
101
void init(FXApp* app, bool netedit = false);
102
103
104
/** @brief Writes the current scheme into the registry
105
* @param[in] app The application
106
*/
107
void writeSettings(FXApp* app);
108
109
110
/** @brief Makes the given viewport the default
111
* @param[in] x The x-offset
112
* @param[in] y The y-offset
113
* @param[in] z The camera height
114
*/
115
void saveViewport(const double x, const double y, const double z, const double rot);
116
117
/** @brief Makes the given decals the default
118
*/
119
void saveDecals(const std::vector<GUISUMOAbstractView::Decal>& decals);
120
121
/** @brief Sets the default viewport
122
* @param[in] parent the view for which the viewport has to be set
123
*/
124
void setViewport(GUISUMOAbstractView* view);
125
126
/** @brief Returns the default decals
127
*/
128
const std::vector<GUISUMOAbstractView::Decal>& getDecals() {
129
return myDecals;
130
}
131
132
/** @brief Clear the default decals
133
*/
134
void clearDecals() {
135
myDecals.clear();
136
}
137
138
protected:
139
/// @brief A map of settings referenced by their names
140
std::map<std::string, GUIVisualizationSettings*> mySettings;
141
142
/// @brief List of known setting names
143
std::vector<std::string> mySortedSchemeNames;
144
145
/// @brief Name of the default setting
146
std::string myDefaultSettingName;
147
148
/// @brief The number of settings which were present at startup
149
int myNumInitialSettings;
150
151
/// @brief The default viewport
152
Position myLookFrom, myLookAt;
153
double myRotation;
154
155
/// @brief The default decals
156
std::vector<GUISUMOAbstractView::Decal> myDecals;
157
158
};
159
160
extern GUICompleteSchemeStorage gSchemeStorage;
161
162