SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Changes the speed allowed on a set of lanes (gui version) 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 #ifndef GUILaneSpeedTrigger_h 00023 #define GUILaneSpeedTrigger_h 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <vector> 00036 #include <string> 00037 #include <microsim/trigger/MSLaneSpeedTrigger.h> 00038 #include <utils/gui/globjects/GUIGlObject_AbstractAdd.h> 00039 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h> 00040 #include <utils/foxtools/FXRealSpinDial.h> 00041 #include <gui/GUIManipulator.h> 00042 00043 00044 // =========================================================================== 00045 // class definitions 00046 // =========================================================================== 00053 class GUILaneSpeedTrigger 00054 : public MSLaneSpeedTrigger, 00055 public GUIGlObject_AbstractAdd { 00056 public: 00063 GUILaneSpeedTrigger(const std::string& id, 00064 const std::vector<MSLane*> &destLanes, 00065 const std::string& file) ; 00066 00067 00069 ~GUILaneSpeedTrigger() ; 00070 00071 00072 00074 00075 00083 GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, 00084 GUISUMOAbstractView& parent) ; 00085 00086 00094 GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, 00095 GUISUMOAbstractView& parent) ; 00096 00097 00103 Boundary getCenteringBoundary() const ; 00104 00105 00110 void drawGL(const GUIVisualizationSettings& s) const ; 00112 00113 00114 00115 GUIManipulator* openManipulator(GUIMainWindow& app, 00116 GUISUMOAbstractView& parent); 00117 00118 public: 00119 class GUILaneSpeedTriggerPopupMenu : public GUIGLObjectPopupMenu { 00120 FXDECLARE(GUILaneSpeedTriggerPopupMenu) 00121 public: 00122 00123 GUILaneSpeedTriggerPopupMenu(GUIMainWindow& app, 00124 GUISUMOAbstractView& parent, GUIGlObject& o); 00125 00126 ~GUILaneSpeedTriggerPopupMenu() ; 00127 00129 long onCmdOpenManip(FXObject*, FXSelector, void*); 00130 00131 protected: 00132 GUILaneSpeedTriggerPopupMenu() { } 00133 00134 }; 00135 00136 class GUIManip_LaneSpeedTrigger : public GUIManipulator { 00137 FXDECLARE(GUIManip_LaneSpeedTrigger) 00138 public: 00139 enum { 00140 MID_USER_DEF = FXDialogBox::ID_LAST, 00141 MID_PRE_DEF, 00142 MID_OPTION, 00143 MID_CLOSE, 00144 ID_LAST 00145 }; 00147 GUIManip_LaneSpeedTrigger(GUIMainWindow& app, 00148 const std::string& name, GUILaneSpeedTrigger& o, 00149 int xpos, int ypos); 00150 00152 virtual ~GUIManip_LaneSpeedTrigger(); 00153 00154 long onCmdOverride(FXObject*, FXSelector, void*); 00155 long onCmdClose(FXObject*, FXSelector, void*); 00156 long onCmdUserDef(FXObject*, FXSelector, void*); 00157 long onUpdUserDef(FXObject*, FXSelector, void*); 00158 long onCmdPreDef(FXObject*, FXSelector, void*); 00159 long onUpdPreDef(FXObject*, FXSelector, void*); 00160 long onCmdChangeOption(FXObject*, FXSelector, void*); 00161 00162 private: 00163 GUIMainWindow* myParent; 00164 00165 FXint myChosenValue; 00166 00167 FXDataTarget myChosenTarget; 00168 00169 SUMOReal mySpeed; 00170 00171 FXDataTarget mySpeedTarget; 00172 00173 FXRealSpinDial* myUserDefinedSpeed; 00174 00175 FXComboBox* myPredefinedValues; 00176 00177 GUILaneSpeedTrigger* myObject; 00178 00179 protected: 00180 GUIManip_LaneSpeedTrigger() { } 00181 00182 }; 00183 00184 private: 00186 typedef std::vector<Position> PosCont; 00187 00189 typedef std::vector<SUMOReal> RotCont; 00190 00191 private: 00193 PosCont myFGPositions; 00194 00196 RotCont myFGRotations; 00197 00199 Boundary myBoundary; 00200 00202 bool myShowAsKMH; 00203 00205 mutable SUMOReal myLastValue; 00206 00208 mutable std::string myLastValueString; 00209 00210 }; 00211 00212 00213 #endif 00214 00215 /****************************************************************************/ 00216