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