Line data Source code
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 : /// @name inherited from GUIGlObject
53 : //@{
54 :
55 : /** @brief Returns an own popup-menu
56 : *
57 : * @param[in] app The application needed to build the popup-menu
58 : * @param[in] parent The parent window needed to build the popup-menu
59 : * @return The built popup-menu
60 : * @see GUIGlObject::getPopUpMenu
61 : */
62 : GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
63 :
64 : /** @brief Returns an own parameter window
65 : *
66 : * @param[in] app The application needed to build the parameter window
67 : * @param[in] parent The parent window needed to build the parameter window
68 : * @return The built parameter window
69 : * @see GUIGlObject::getParameterWindow
70 : */
71 : GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
72 :
73 : /// @brief return exaggeration associated with this GLObject
74 : double getExaggeration(const GUIVisualizationSettings& s) const override;
75 :
76 : /** @brief Returns the boundary to which the view shall be centered in order to show the object
77 : *
78 : * @return The boundary the object is within
79 : * @see GUIGlObject::getCenteringBoundary
80 : */
81 : Boundary getCenteringBoundary() const override;
82 :
83 : /** @brief Draws the object
84 : * @param[in] s The settings for the current view (may influence drawing)
85 : * @see GUIGlObject::drawGL
86 : */
87 : void drawGL(const GUIVisualizationSettings& s) const override;
88 : //@}
89 :
90 : GUIManipulator* openManipulator(GUIMainWindow& app, GUISUMOAbstractView& parent);
91 :
92 : public:
93 : class GUICalibratorPopupMenu : public GUIGLObjectPopupMenu {
94 0 : FXDECLARE(GUICalibratorPopupMenu)
95 : public:
96 :
97 : GUICalibratorPopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o);
98 :
99 : ~GUICalibratorPopupMenu();
100 :
101 : /** @brief Called if the object's manipulator shall be shown */
102 : long onCmdOpenManip(FXObject*, FXSelector, void*);
103 :
104 : protected:
105 0 : GUICalibratorPopupMenu() { }
106 :
107 : };
108 :
109 : class GUIManip_Calibrator : public GUIManipulator {
110 0 : FXDECLARE(GUIManip_Calibrator)
111 : public:
112 : enum {
113 : MID_USER_DEF = FXDialogBox::ID_LAST,
114 : MID_PRE_DEF,
115 : MID_OPTION,
116 : MID_CLOSE,
117 : ID_LAST
118 : };
119 : /// Constructor
120 : GUIManip_Calibrator(GUIMainWindow& app,
121 : const std::string& name, GUICalibrator& o,
122 : int xpos, int ypos);
123 :
124 : /// Destructor
125 : virtual ~GUIManip_Calibrator();
126 :
127 : long onCmdOverride(FXObject*, FXSelector, void*);
128 : long onCmdClose(FXObject*, FXSelector, void*);
129 : long onCmdUserDef(FXObject*, FXSelector, void*);
130 : long onUpdUserDef(FXObject*, FXSelector, void*);
131 : long onCmdPreDef(FXObject*, FXSelector, void*);
132 : long onUpdPreDef(FXObject*, FXSelector, void*);
133 : long onCmdChangeOption(FXObject*, FXSelector, void*);
134 :
135 : private:
136 : GUIMainWindow* myParent;
137 :
138 : FXint myChosenValue;
139 :
140 : FXDataTarget myChosenTarget;
141 :
142 : double mySpeed;
143 :
144 : FXDataTarget mySpeedTarget;
145 :
146 : FXRealSpinner* myUserDefinedSpeed;
147 :
148 : MFXComboBoxIcon* myPredefinedValues;
149 :
150 : GUICalibrator* myObject;
151 :
152 : protected:
153 0 : GUIManip_Calibrator() { }
154 :
155 : };
156 :
157 : private:
158 : /// Definition of a positions container
159 : typedef std::vector<Position> PosCont;
160 :
161 : /// Definition of a rotation container
162 : typedef std::vector<double> RotCont;
163 :
164 : /// @brief the calibrator being wrapped
165 : MSCalibrator* myCalibrator;
166 :
167 : /// The positions in full-geometry mode
168 : PosCont myFGPositions;
169 :
170 : /// The rotations in full-geometry mode
171 : RotCont myFGRotations;
172 :
173 : /// The boundary of this rerouter
174 : Boundary myBoundary;
175 :
176 : /// The information whether the speed shall be shown in m/s or km/h
177 : bool myShowAsKMH;
178 :
179 : };
|