Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUICalibrator.h
169668 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 GUICalibrator.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @date Mon, 26.04.2004
19
///
20
// Changes flow and speed on a set of lanes (gui version)
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <vector>
26
#include <string>
27
#include <microsim/trigger/MSCalibrator.h>
28
#include <utils/gui/globjects/GUIGlObject_AbstractAdd.h>
29
#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
30
#include <gui/GUIManipulator.h>
31
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
/**
37
* @class GUICalibrator
38
* @brief Changes the speed allowed on a set of lanes (gui version)
39
*
40
* This is the gui-version of the MSCalibrator-object
41
*/
42
class GUICalibrator : public GUIGlObject_AbstractAdd {
43
public:
44
/** @brief Constructor
45
* @param[in] calibrator MSCalibrator or METriggeredCalibrator to be wrapped
46
*/
47
GUICalibrator(MSCalibrator* calibrator);
48
49
/** destructor */
50
~GUICalibrator();
51
52
53
54
/// @name inherited from GUIGlObject
55
//@{
56
57
/** @brief Returns an own popup-menu
58
*
59
* @param[in] app The application needed to build the popup-menu
60
* @param[in] parent The parent window needed to build the popup-menu
61
* @return The built popup-menu
62
* @see GUIGlObject::getPopUpMenu
63
*/
64
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app,
65
GUISUMOAbstractView& parent);
66
67
/** @brief Returns an own parameter window
68
*
69
* @param[in] app The application needed to build the parameter window
70
* @param[in] parent The parent window needed to build the parameter window
71
* @return The built parameter window
72
* @see GUIGlObject::getParameterWindow
73
*/
74
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,
75
GUISUMOAbstractView& parent);
76
77
/// @brief return exaggeration associated with this GLObject
78
double getExaggeration(const GUIVisualizationSettings& s) const;
79
80
/** @brief Returns the boundary to which the view shall be centered in order to show the object
81
*
82
* @return The boundary the object is within
83
* @see GUIGlObject::getCenteringBoundary
84
*/
85
Boundary getCenteringBoundary() const;
86
87
/** @brief Draws the object
88
* @param[in] s The settings for the current view (may influence drawing)
89
* @see GUIGlObject::drawGL
90
*/
91
void drawGL(const GUIVisualizationSettings& s) const;
92
//@}
93
94
95
96
GUIManipulator* openManipulator(GUIMainWindow& app, GUISUMOAbstractView& parent);
97
98
public:
99
class GUICalibratorPopupMenu : public GUIGLObjectPopupMenu {
100
FXDECLARE(GUICalibratorPopupMenu)
101
public:
102
103
GUICalibratorPopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o);
104
105
~GUICalibratorPopupMenu();
106
107
/** @brief Called if the object's manipulator shall be shown */
108
long onCmdOpenManip(FXObject*, FXSelector, void*);
109
110
protected:
111
GUICalibratorPopupMenu() { }
112
113
};
114
115
class GUIManip_Calibrator : public GUIManipulator {
116
FXDECLARE(GUIManip_Calibrator)
117
public:
118
enum {
119
MID_USER_DEF = FXDialogBox::ID_LAST,
120
MID_PRE_DEF,
121
MID_OPTION,
122
MID_CLOSE,
123
ID_LAST
124
};
125
/// Constructor
126
GUIManip_Calibrator(GUIMainWindow& app,
127
const std::string& name, GUICalibrator& o,
128
int xpos, int ypos);
129
130
/// Destructor
131
virtual ~GUIManip_Calibrator();
132
133
long onCmdOverride(FXObject*, FXSelector, void*);
134
long onCmdClose(FXObject*, FXSelector, void*);
135
long onCmdUserDef(FXObject*, FXSelector, void*);
136
long onUpdUserDef(FXObject*, FXSelector, void*);
137
long onCmdPreDef(FXObject*, FXSelector, void*);
138
long onUpdPreDef(FXObject*, FXSelector, void*);
139
long onCmdChangeOption(FXObject*, FXSelector, void*);
140
141
private:
142
GUIMainWindow* myParent;
143
144
FXint myChosenValue;
145
146
FXDataTarget myChosenTarget;
147
148
double mySpeed;
149
150
FXDataTarget mySpeedTarget;
151
152
FXRealSpinner* myUserDefinedSpeed;
153
154
MFXComboBoxIcon* myPredefinedValues;
155
156
GUICalibrator* myObject;
157
158
protected:
159
GUIManip_Calibrator() { }
160
161
};
162
163
private:
164
/// Definition of a positions container
165
typedef std::vector<Position> PosCont;
166
167
/// Definition of a rotation container
168
typedef std::vector<double> RotCont;
169
170
/// @brief the calibrator being wrapped
171
MSCalibrator* myCalibrator;
172
173
/// The positions in full-geometry mode
174
PosCont myFGPositions;
175
176
/// The rotations in full-geometry mode
177
RotCont myFGRotations;
178
179
/// The boundary of this rerouter
180
Boundary myBoundary;
181
182
/// The information whether the speed shall be shown in m/s or km/h
183
bool myShowAsKMH;
184
185
};
186
187