Updraft  1.0
Open source glider flight visualisation tool.
scenemanager.h
Go to the documentation of this file.
00001 #ifndef UPDRAFT_SRC_CORE_SCENEMANAGER_H_
00002 #define UPDRAFT_SRC_CORE_SCENEMANAGER_H_
00003 
00004 #include <QWidget>
00005 #include <osg/ref_ptr>
00006 #include <osgQt/GraphicsWindowQt>
00007 #include <osgViewer/Viewer>
00008 #include <osgViewer/ViewerEventHandlers>
00009 #include <osgEarth/Viewpoint>
00010 #include <QTimer>
00011 #include <QHash>
00012 #include <string>
00013 #include "mapmanager.h"
00014 #include "../mapobject.h"
00015 
00016 namespace osgEarth {
00017 namespace Util {
00018   class ElevationManager;
00019 }
00020 }
00021 
00022 namespace Updraft {
00023 namespace Core {
00024 
00026 class SceneManager: public QObject {
00027   Q_OBJECT
00028 
00029  public:
00030   SceneManager();
00031   ~SceneManager();
00032 
00035   QWidget* getWidget();
00036 
00039   osg::Group* getRoot();
00040 
00044   osgEarth::MapNode* getMapNode();
00045 
00049   MapManager* getMapManager();
00050 
00052   void createMaps();
00053 
00055   void destroyMaps();
00056 
00058   bool removeGroup(osg::Group* group);
00059 
00061   osg::Group* getSimpleGroup();
00062 
00066   void registerOsgNode(osg::Node* node, MapObject* mapObject);
00067 
00070   void unregisterOsgNode(osg::Node* node);
00071 
00076   MapObject* getNodeMapObject(osg::Node* node);
00077 
00081   osgEarth::Util::ElevationManager* getElevationManager();
00082 
00086   const osg::EllipsoidModel* getCurrentMapEllipsoid();
00087 
00091   osgEarth::Util::ObjectPlacer* getObjectPlacer();
00092 
00095   osgEarth::Util::Viewpoint getViewpoint();
00096 
00097  public slots:
00098   void redrawScene();
00099   void resetNorth();
00100   void untilt();
00101   void saveHomePosition();
00102 
00103  private slots:
00104   void checkedMap(bool value, MapLayerInterface* layer);
00105 
00106  private:
00108   void createMapManagers();
00109 
00111   void menuItems();
00112 
00114   void mapLayerGroup();
00115 
00116   osgEarth::Util::ElevationManager* createElevationManager();
00117 
00118   osgEarth::Util::ObjectPlacer* placer;
00119 
00120   osgViewer::Viewer* viewer;
00121   osg::Group* sceneRoot;
00122 
00124   osg::ClearNode* background;
00125   osgEarth::MapNode* mapNode;
00126   osg::Group* simpleGroup;
00127 
00128   QVector<MapManager*> mapManagers;
00129   QVector<MapLayerInterface*> layers;
00130   int activeMapIndex;
00131   osg::Camera* camera;
00132   MapManipulator* manipulator;
00133   osgEarth::Viewpoint saveViewpoint;
00134   osgEarth::Util::ElevationManager* elevationManager;
00135   osgQt::GraphicsWindowQt* graphicsWindow;
00136 
00138   QTimer* timer;
00139 
00140   osg::GraphicsContext::Traits* createGraphicsTraits
00141     (int x, int y, int w, int h, const std::string& name = "",
00142     bool windowDecoration = false);
00143   osgQt::GraphicsWindowQt* createGraphicsWindow
00144     (osg::GraphicsContext::Traits* traits);
00145   osg::Camera* createCamera(osg::GraphicsContext::Traits* traits);
00146 
00148   QHash<osg::Node*, MapObject*> pickingMap;
00149 
00150   osgEarth::Viewpoint getHomePosition();
00151   osgEarth::Util::Viewpoint getInitialPosition();
00152   void startInitialAnimation();
00153   void updateCameraProjection();
00154 
00155   void insertMenuItems();
00156 
00157   double getAspectRatio();
00158 
00159   SettingInterface* homePositionSetting;
00160   static const float flyToHomeDuration;
00161 };
00162 
00163 }  // end namespace Core
00164 }  // end namespace Updraft
00165 
00166 #endif  // UPDRAFT_SRC_CORE_SCENEMANAGER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines