|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // Base class for all objects that may be displayed within the openGL-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 GUIGlObject_h 00024 #define GUIGlObject_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 <string> 00037 #include <set> 00038 #include "GUIGlObjectTypes.h" 00039 #include <utils/geom/Boundary.h> 00040 #include <utils/common/StdDefs.h> 00041 #include <utils/common/StringBijection.h> 00042 #include <utils/common/RGBColor.h> 00043 00044 00045 // =========================================================================== 00046 // definitions 00047 // =========================================================================== 00048 typedef unsigned int GUIGlID; 00049 00050 00051 // =========================================================================== 00052 // class declarations 00053 // =========================================================================== 00054 class GUIGlObjectStorage; 00055 class GUIParameterTableWindow; 00056 class GUIMainWindow; 00057 class GUIGLObjectPopupMenu; 00058 class GUISUMOAbstractView; 00059 class GUIVisualizationSettings; 00060 struct GUIVisualizationTextSettings; 00061 00062 00063 // =========================================================================== 00064 // class definitions 00065 // =========================================================================== 00066 class GUIGlObject { 00067 public: 00076 GUIGlObject(GUIGlObjectType type, const std::string& microsimID); 00077 00078 00087 GUIGlObject(const std::string& prefix, GUIGlObjectType type, const std::string& microsimID); 00088 00089 00091 virtual ~GUIGlObject() ; 00092 00094 static StringBijection<GUIGlObjectType> TypeNames; 00095 00098 00102 const std::string& getFullName() const { 00103 return myFullName; 00104 } 00105 00106 00110 GUIGlID getGlID() const { 00111 return myGlID; 00112 } 00114 00115 00117 00118 00125 virtual GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0; 00126 00127 00134 virtual GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0; 00135 00136 00141 const std::string& getMicrosimID() const { 00142 return myMicrosimID; 00143 }; 00144 00145 00147 void setMicrosimID(const std::string& newID); 00148 00149 00154 GUIGlObjectType getType() const { 00155 return myGLObjectType; 00156 }; 00157 00158 00163 virtual Boundary getCenteringBoundary() const = 0; 00164 00165 00169 virtual void drawGL(const GUIVisualizationSettings& s) const = 0; 00171 00172 00177 virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const { 00178 UNUSED_PARAMETER(&s); 00179 UNUSED_PARAMETER(parent); 00180 }; 00181 00182 00183 00186 00190 void addParameterTable(GUIParameterTableWindow* w) ; 00191 00192 00196 void removeParameterTable(GUIParameterTableWindow* w) ; 00198 00199 00200 void drawName(const Position& pos, const SUMOReal scale, 00201 const GUIVisualizationTextSettings& settings, const SUMOReal angle = 0) const; 00202 00203 00204 protected: 00206 00207 00212 void buildPopupHeader(GUIGLObjectPopupMenu* ret, GUIMainWindow& app, bool addSeparator = true) ; 00213 00214 00219 void buildCenterPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true) ; 00220 00221 00226 void buildNameCopyPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true) ; 00227 00228 00233 void buildSelectionPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true) ; 00234 00235 00240 void buildShowParamsPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true) ; 00241 00242 00248 void buildPositionCopyEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true) ; 00249 00250 00255 void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu* ret, bool addSeparator = true) ; 00257 00258 protected: 00259 /* usually names are prefixed by a type-specific string. this method can be 00260 * used to change the default */ 00261 void setPrefix(const std::string& prefix); 00262 00263 private: 00265 GUIGlID myGlID; 00266 00268 const GUIGlObjectType myGLObjectType; 00269 00270 std::string myMicrosimID; 00271 00272 std::string myPrefix; 00273 00274 std::string myFullName; 00275 00277 std::set<GUIParameterTableWindow*> myParamWindows; 00278 00279 std::string createFullName() const; 00280 00281 00282 // static StringBijection<SumoXMLLinkStateValue> LinkStates; 00283 00284 static StringBijection<GUIGlObjectType>::Entry GUIGlObjectTypeNamesInitializer[]; 00285 00286 }; 00287 #endif 00288 00289 /****************************************************************************/ 00290