SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // A MSVehicle extended by some values for usage within the gui 00011 /****************************************************************************/ 00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00014 /****************************************************************************/ 00015 // 00016 // This file is part of SUMO. 00017 // SUMO is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation, either version 3 of the License, or 00020 // (at your option) any later version. 00021 // 00022 /****************************************************************************/ 00023 #ifndef GUIVehicle_h 00024 #define GUIVehicle_h 00025 00026 00027 // =========================================================================== 00028 // included modules 00029 // =========================================================================== 00030 #ifdef _MSC_VER 00031 #include <windows_config.h> 00032 #else 00033 #include <config.h> 00034 #endif 00035 00036 #include <vector> 00037 #include <set> 00038 #include <string> 00039 #include <utils/gui/globjects/GUIGlObject.h> 00040 #include <utils/common/RGBColor.h> 00041 #include <microsim/MSVehicle.h> 00042 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h> 00043 #include <utils/foxtools/MFXMutex.h> 00044 #include <utils/gui/settings/GUIColorer.h> 00045 00046 00047 // =========================================================================== 00048 // class declarations 00049 // =========================================================================== 00050 class GUISUMOAbstractView; 00051 class GUIGLObjectPopupMenu; 00052 class MSDevice_Vehroutes; 00053 00054 00055 // =========================================================================== 00056 // class definitions 00057 // =========================================================================== 00067 class GUIVehicle : public MSVehicle, public GUIGlObject { 00068 public: 00076 GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route, 00077 const MSVehicleType* type, int vehicleIndex) ; 00078 00079 00081 ~GUIVehicle() ; 00082 00083 00085 00086 00094 GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) ; 00095 00096 00104 GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) ; 00105 00106 00112 Boundary getCenteringBoundary() const ; 00113 00114 00119 void drawGL(const GUIVisualizationSettings& s) const ; 00120 00121 00122 00127 virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const ; 00129 00130 00131 00134 00140 bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const ; 00141 00142 00149 bool addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) ; 00150 00151 00158 bool removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) ; 00160 00161 00162 00167 SUMOReal getLastLaneChangeOffset() const { 00168 return STEPS2TIME(myLastLaneChangeOffset); 00169 } 00170 00171 00179 const std::vector<LaneQ> &getBestLanes() const ; 00180 00187 class GUIVehiclePopupMenu : public GUIGLObjectPopupMenu { 00188 FXDECLARE(GUIVehiclePopupMenu) 00189 public: 00196 GUIVehiclePopupMenu(GUIMainWindow& app, 00197 GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int> &additionalVisualizations); 00198 00200 ~GUIVehiclePopupMenu() ; 00201 00203 long onCmdShowAllRoutes(FXObject*, FXSelector, void*); 00205 long onCmdHideAllRoutes(FXObject*, FXSelector, void*); 00207 long onCmdShowCurrentRoute(FXObject*, FXSelector, void*); 00209 long onCmdHideCurrentRoute(FXObject*, FXSelector, void*); 00211 long onCmdShowBestLanes(FXObject*, FXSelector, void*); 00213 long onCmdHideBestLanes(FXObject*, FXSelector, void*); 00215 long onCmdStartTrack(FXObject*, FXSelector, void*); 00217 long onCmdStopTrack(FXObject*, FXSelector, void*); 00219 long onCmdShowLFLinkItems(FXObject*, FXSelector, void*); 00221 long onCmdHideLFLinkItems(FXObject*, FXSelector, void*); 00222 00223 protected: 00225 std::map<GUISUMOAbstractView*, int> &myVehiclesAdditionalVisualizations; 00227 std::map<GUISUMOAbstractView*, int> dummy; 00228 00229 protected: 00231 GUIVehiclePopupMenu() : myVehiclesAdditionalVisualizations(dummy) { } 00232 00233 }; 00234 00235 00238 00241 enum VisualisationFeatures { 00243 VO_SHOW_BEST_LANES = 1, 00245 VO_SHOW_ROUTE = 2, 00247 VO_SHOW_ALL_ROUTES = 4, 00249 VO_TRACKED = 8, 00251 VO_SHOW_LFLINKITEMS = 16 00252 }; 00253 00255 std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations; 00256 00257 00261 void draw(const MSRoute& r) const ; 00262 00263 00269 void drawRoute(const GUIVisualizationSettings& s, int routeNo, SUMOReal darken) const ; 00270 00271 00274 void drawBestLanes() const ; 00276 00277 00278 private: 00280 mutable MFXMutex myLock; 00281 00282 MSDevice_Vehroutes* myRoutes; 00283 00285 void setColor(const GUIVisualizationSettings& s) const; 00286 00288 SUMOReal getColorValue(size_t activeScheme) const; 00289 00291 bool setFunctionalColor(size_t activeScheme) const; 00292 }; 00293 00294 00295 #endif 00296 00297 /****************************************************************************/ 00298