Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2001-2024 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, 97 : GUISUMOAbstractView& parent); 98 : 99 : public: 100 : class GUICalibratorPopupMenu : public GUIGLObjectPopupMenu { 101 0 : FXDECLARE(GUICalibratorPopupMenu) 102 : public: 103 : 104 : GUICalibratorPopupMenu(GUIMainWindow& app, 105 : GUISUMOAbstractView& parent, GUIGlObject& o); 106 : 107 : ~GUICalibratorPopupMenu(); 108 : 109 : /** @brief Called if the object's manipulator shall be shown */ 110 : long onCmdOpenManip(FXObject*, FXSelector, void*); 111 : 112 : protected: 113 0 : GUICalibratorPopupMenu() { } 114 : 115 : }; 116 : 117 : class GUIManip_Calibrator : public GUIManipulator { 118 0 : FXDECLARE(GUIManip_Calibrator) 119 : public: 120 : enum { 121 : MID_USER_DEF = FXDialogBox::ID_LAST, 122 : MID_PRE_DEF, 123 : MID_OPTION, 124 : MID_CLOSE, 125 : ID_LAST 126 : }; 127 : /// Constructor 128 : GUIManip_Calibrator(GUIMainWindow& app, 129 : const std::string& name, GUICalibrator& o, 130 : int xpos, int ypos); 131 : 132 : /// Destructor 133 : virtual ~GUIManip_Calibrator(); 134 : 135 : long onCmdOverride(FXObject*, FXSelector, void*); 136 : long onCmdClose(FXObject*, FXSelector, void*); 137 : long onCmdUserDef(FXObject*, FXSelector, void*); 138 : long onUpdUserDef(FXObject*, FXSelector, void*); 139 : long onCmdPreDef(FXObject*, FXSelector, void*); 140 : long onUpdPreDef(FXObject*, FXSelector, void*); 141 : long onCmdChangeOption(FXObject*, FXSelector, void*); 142 : 143 : private: 144 : GUIMainWindow* myParent; 145 : 146 : FXint myChosenValue; 147 : 148 : FXDataTarget myChosenTarget; 149 : 150 : double mySpeed; 151 : 152 : FXDataTarget mySpeedTarget; 153 : 154 : FXRealSpinner* myUserDefinedSpeed; 155 : 156 : MFXComboBoxIcon* myPredefinedValues; 157 : 158 : GUICalibrator* myObject; 159 : 160 : protected: 161 0 : GUIManip_Calibrator() { } 162 : 163 : }; 164 : 165 : private: 166 : /// Definition of a positions container 167 : typedef std::vector<Position> PosCont; 168 : 169 : /// Definition of a rotation container 170 : typedef std::vector<double> RotCont; 171 : 172 : /// @brief the calibrator being wrapped 173 : MSCalibrator* myCalibrator; 174 : 175 : /// The positions in full-geometry mode 176 : PosCont myFGPositions; 177 : 178 : /// The rotations in full-geometry mode 179 : RotCont myFGRotations; 180 : 181 : /// The boundary of this rerouter 182 : Boundary myBoundary; 183 : 184 : /// The information whether the speed shall be shown in m/s or km/h 185 : bool myShowAsKMH; 186 : 187 : };