SUMO - Simulation of Urban MObility

GUIVehicle.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A MSVehicle extended by some values for usage within the gui
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 GUIVehicle_h
00020 #define GUIVehicle_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 <set>
00034 #include <string>
00035 #include <utils/gui/globjects/GUIGlObject.h>
00036 #include <utils/common/RGBColor.h>
00037 #include <microsim/MSVehicle.h>
00038 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
00039 #include <utils/foxtools/MFXMutex.h>
00040 #include <utils/gui/settings/GUIColorer.h>
00041 
00042 
00043 // ===========================================================================
00044 // class declarations
00045 // ===========================================================================
00046 class GUISUMOAbstractView;
00047 class GUIGLObjectPopupMenu;
00048 class MSDevice_Vehroutes;
00049 
00050 
00051 // ===========================================================================
00052 // class definitions
00053 // ===========================================================================
00063 class GUIVehicle : public MSVehicle, public GUIGlObject {
00064 public:
00072     GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
00073                const MSVehicleType* type, int vehicleIndex) throw(ProcessError);
00074 
00075 
00077     ~GUIVehicle() throw();
00078 
00079 
00081 
00082 
00090     GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) throw();
00091 
00092 
00100     GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) throw();
00101 
00102 
00108     Boundary getCenteringBoundary() const throw();
00109 
00110 
00115     void drawGL(const GUIVisualizationSettings& s) const throw();
00116 
00117 
00118 
00123     virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const throw();
00125 
00126 
00127 
00130 
00136     bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const throw();
00137 
00138 
00145     bool addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) throw();
00146 
00147 
00154     bool removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) throw();
00156 
00157 
00158 
00163     SUMOReal getLastLaneChangeOffset() const throw() {
00164         return STEPS2TIME(myLastLaneChangeOffset);
00165     }
00166 
00167 
00175     const std::vector<LaneQ> &getBestLanes() const throw();
00176 
00183     class GUIVehiclePopupMenu : public GUIGLObjectPopupMenu {
00184         FXDECLARE(GUIVehiclePopupMenu)
00185     public:
00192         GUIVehiclePopupMenu(GUIMainWindow& app,
00193                             GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int> &additionalVisualizations);
00194 
00196         ~GUIVehiclePopupMenu() throw();
00197 
00199         long onCmdShowAllRoutes(FXObject*,FXSelector,void*);
00201         long onCmdHideAllRoutes(FXObject*,FXSelector,void*);
00203         long onCmdShowCurrentRoute(FXObject*,FXSelector,void*);
00205         long onCmdHideCurrentRoute(FXObject*,FXSelector,void*);
00207         long onCmdShowBestLanes(FXObject*,FXSelector,void*);
00209         long onCmdHideBestLanes(FXObject*,FXSelector,void*);
00211         long onCmdStartTrack(FXObject*,FXSelector,void*);
00213         long onCmdStopTrack(FXObject*,FXSelector,void*);
00214 
00215     protected:
00217         std::map<GUISUMOAbstractView*, int> &myVehiclesAdditionalVisualizations;
00219         std::map<GUISUMOAbstractView*, int> dummy;
00220 
00221     protected:
00223         GUIVehiclePopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
00224 
00225     };
00226 
00227 
00230 
00233     enum VisualisationFeatures {
00235         VO_SHOW_BEST_LANES = 1,
00237         VO_SHOW_ROUTE = 2,
00239         VO_SHOW_ALL_ROUTES = 4,
00241         VO_TRACKED = 8
00242     };
00243 
00245     std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
00246 
00247 
00251     void draw(const MSRoute& r) const throw();
00252 
00253 
00259     void drawRoute(const GUIVisualizationSettings& s, int routeNo, SUMOReal darken) const throw();
00260 
00261 
00264     void drawBestLanes() const throw();
00266 
00267 
00268 private:
00270     mutable MFXMutex myLock;
00271 
00272     MSDevice_Vehroutes* myRoutes;
00273 
00275     void setColor(const GUIVisualizationSettings& s) const;
00276 
00278     SUMOReal getColorValue(size_t activeScheme) const;
00279 
00281     bool setFunctionalColor(size_t activeScheme) const;
00282 };
00283 
00284 
00285 #endif
00286 
00287 /****************************************************************************/
00288 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines