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 2001-2010 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 #ifdef WIN32
00033 #include <windows.h>
00034 #endif
00035 
00036 #include <GL/gl.h>
00037 
00038 #include <vector>
00039 #include <set>
00040 #include <string>
00041 #include <utils/gui/globjects/GUIGlObject.h>
00042 #include <utils/common/RGBColor.h>
00043 #include <microsim/MSVehicle.h>
00044 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
00045 #include <utils/foxtools/MFXMutex.h>
00046 #include <utils/gui/settings/GUIColorer.h>
00047 
00048 
00049 // ===========================================================================
00050 // class declarations
00051 // ===========================================================================
00052 class GUISUMOAbstractView;
00053 class GUIGLObjectPopupMenu;
00054 
00055 
00056 // ===========================================================================
00057 // class definitions
00058 // ===========================================================================
00067 class GUIVehicle : public MSVehicle, public GUIGlObject {
00068 public:
00070     GUIVehicle(GUIGlObjectStorage &idStorage,
00071                SUMOVehicleParameter* pars, const MSRoute* route,
00072                const MSVehicleType* type,
00073                int vehicleIndex) throw(ProcessError);
00074 
00076     ~GUIVehicle() throw();
00077 
00078     inline void setOwnDefinedColor() const {
00079         const RGBColor &col = myParameter->color;
00080         glColor3d(col.red(), col.green(), col.blue());
00081     }
00082 
00083     inline void setOwnTypeColor() const {
00084         const RGBColor &col = myType->getColor();
00085         glColor3d(col.red(), col.green(), col.blue());
00086     }
00087 
00088     inline void setOwnRouteColor() const {
00089         const RGBColor &col = myRoute->getColor();
00090         glColor3d(col.red(), col.green(), col.blue());
00091     }
00092 
00093     static void initShapes() throw();
00094 
00095 
00096 
00098 
00099 
00107     GUIGLObjectPopupMenu *getPopUpMenu(GUIMainWindow &app,
00108                                        GUISUMOAbstractView &parent) throw();
00109 
00110 
00118     GUIParameterTableWindow *getParameterWindow(
00119         GUIMainWindow &app, GUISUMOAbstractView &parent) throw();
00120 
00121 
00127     const std::string &getMicrosimID() const throw();
00128 
00129 
00136     GUIGlObjectType getType() const throw() {
00137         return GLO_VEHICLE;
00138     }
00139 
00140 
00146     Boundary getCenteringBoundary() const throw();
00147 
00148 
00153     void drawGL(const GUIVisualizationSettings &s) const throw();
00154 
00155 
00161     bool active() const throw();
00163 
00164 
00165     void setRemoved();
00166 
00167 
00172     SUMOReal getLastLaneChangeOffset() const throw() {
00173         return myLastLaneChangeOffset;
00174     }
00175 
00176 
00184     const std::vector<LaneQ> &getBestLanes() const throw();
00185 
00186     class Colorer : public GUIColorer<GUIVehicle> {
00187     public:
00188         Colorer();
00189         SUMOReal getColorValue(const GUIVehicle& vehicle) const;
00190         bool setFunctionalColor(const GUIVehicle& vehicle) const;
00191     };
00192 
00199     class GUIVehiclePopupMenu : public GUIGLObjectPopupMenu {
00200         FXDECLARE(GUIVehiclePopupMenu)
00201     public:
00203         GUIVehiclePopupMenu(GUIMainWindow &app,
00204                             GUISUMOAbstractView &parent, GUIGlObject &o);
00205 
00207         ~GUIVehiclePopupMenu() throw();
00208 
00210         long onCmdShowAllRoutes(FXObject*,FXSelector,void*);
00211 
00213         long onCmdHideAllRoutes(FXObject*,FXSelector,void*);
00214 
00216         long onCmdShowCurrentRoute(FXObject*,FXSelector,void*);
00217 
00219         long onCmdHideCurrentRoute(FXObject*,FXSelector,void*);
00220 
00222         long onCmdShowBestLanes(FXObject*,FXSelector,void*);
00223 
00225         long onCmdHideBestLanes(FXObject*,FXSelector,void*);
00226 
00228         long onCmdStartTrack(FXObject*,FXSelector,void*);
00229 
00231         long onCmdStopTrack(FXObject*,FXSelector,void*);
00232 
00233     protected:
00234         GUIVehiclePopupMenu() { }
00235 
00236     };
00237 
00238 
00239 protected:
00240     void setBlinkerInformation();
00241 
00242 private:
00244     mutable MFXMutex myLock;
00245 
00246 };
00247 
00248 
00249 #endif
00250 
00251 /****************************************************************************/
00252 

Generated on Wed May 5 00:06:30 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6