SUMO - Simulation of Urban MObility

GUIVehicle.h

Go to the documentation of this file.
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*);
00218 
00219     protected:
00221         std::map<GUISUMOAbstractView*, int> &myVehiclesAdditionalVisualizations;
00223         std::map<GUISUMOAbstractView*, int> dummy;
00224 
00225     protected:
00227         GUIVehiclePopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
00228 
00229     };
00230 
00231 
00234 
00237     enum VisualisationFeatures {
00239         VO_SHOW_BEST_LANES = 1,
00241         VO_SHOW_ROUTE = 2,
00243         VO_SHOW_ALL_ROUTES = 4,
00245         VO_TRACKED = 8
00246     };
00247 
00249     std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
00250 
00251 
00255     void draw(const MSRoute& r) const ;
00256 
00257 
00263     void drawRoute(const GUIVisualizationSettings& s, int routeNo, SUMOReal darken) const ;
00264 
00265 
00268     void drawBestLanes() const ;
00270 
00271 
00272 private:
00274     mutable MFXMutex myLock;
00275 
00276     MSDevice_Vehroutes* myRoutes;
00277 
00279     void setColor(const GUIVisualizationSettings& s) const;
00280 
00282     SUMOReal getColorValue(size_t activeScheme) const;
00283 
00285     bool setFunctionalColor(size_t activeScheme) const;
00286 };
00287 
00288 
00289 #endif
00290 
00291 /****************************************************************************/
00292 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines