Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

core/StelCore.hpp

00001 /*
00002  * Copyright (C) 2003 Fabien Chereau
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  */
00018 
00019 #ifndef _STELCORE_HPP_
00020 #define _STELCORE_HPP_
00021 
00022 #include "StelProjector.hpp"
00023 #include "StelProjectorType.hpp"
00024 #include <QString>
00025 #include <QStringList>
00026 
00027 class StelNavigator;
00028 class StelToneReproducer;
00029 class StelSkyDrawer;
00030 class StelGeodesicGrid;
00031 class StelMovementMgr;
00032 
00042 class StelCore : public QObject
00043 {
00044     Q_OBJECT
00045     Q_ENUMS(ProjectionType);
00046 
00047 public: 
00050     enum FrameType
00051     {
00052         FrameAltAz,                   
00053         FrameHeliocentricEcliptic,    
00054         FrameObservercentricEcliptic, 
00055         FrameEquinoxEqu,              
00056         FrameJ2000                    
00057     };
00058     
00060     enum ProjectionType
00061     {
00062         ProjectionPerspective,    
00063         ProjectionEqualArea,      
00064         ProjectionStereographic,  
00065         ProjectionFisheye,        
00066         ProjectionHammer,         
00067         ProjectionCylinder,       
00068         ProjectionMercator,       
00069         ProjectionOrthographic    
00070     };
00071     
00072     StelCore();
00073     virtual ~StelCore();
00074 
00076     void init();
00077 
00080     void update(double deltaTime);
00081 
00083     void windowHasBeenResized(int width,int height);
00084     
00086     void preDraw();
00087 
00089     void postDraw();
00090         
00093     const StelProjectorP getProjection2d() const;
00094             
00098     const StelProjectorP getProjection(FrameType frameType, ProjectionType projType=(ProjectionType)1000) const;
00099     
00103     const StelProjectorP getProjection(const Mat4d& modelViewMat, ProjectionType projType=(ProjectionType)1000) const;
00104             
00106     StelNavigator* getNavigator() {return navigation;}
00108     const StelNavigator* getNavigator() const {return navigation;}
00109 
00111     StelToneReproducer* getToneReproducer() {return toneConverter;}
00113     const StelToneReproducer* getToneReproducer() const {return toneConverter;}
00114 
00116     StelSkyDrawer* getSkyDrawer() {return skyDrawer;}
00118     const StelSkyDrawer* getSkyDrawer() const {return skyDrawer;}
00119 
00121     const StelGeodesicGrid* getGeodesicGrid(int maxLevel) const;
00122     
00124     StelMovementMgr* getMovementMgr() {return movementMgr;}
00126     const StelMovementMgr* getMovementMgr() const {return movementMgr;}
00127     
00129     void setClippingPlanes(double znear, double zfar) {currentProjectorParams.zNear=znear;currentProjectorParams.zFar=zfar;} 
00131     void getClippingPlanes(double* zn, double* zf) const {*zn = currentProjectorParams.zNear; *zf = currentProjectorParams.zFar;}
00132     
00134     QString projectionTypeKeyToNameI18n(const QString& key) const;
00135     
00137     QString projectionNameI18nToTypeKey(const QString& nameI18n) const;
00138     
00140     StelProjector::StelProjectorParams getCurrentStelProjectorParams() const {return currentProjectorParams;}
00142     void setCurrentStelProjectorParams(const StelProjector::StelProjectorParams& newParams) {currentProjectorParams=newParams;}
00143     
00144 public slots:
00146     void setCurrentProjectionType(ProjectionType type) {currentProjectionType=type;}
00147     
00149     QString getCurrentProjectionTypeKey(void) const;
00151     void setCurrentProjectionTypeKey(QString type);
00152     
00154     QStringList getAllProjectionTypeKeys() const;
00155                 
00157     void setMaskType(StelProjector::StelProjectorMaskType m) {currentProjectorParams.maskType = m; }
00158     
00161     void setFlagGravityLabels(bool gravity) { currentProjectorParams.gravityLabels = gravity; } 
00164     void setFlipHorz(bool flip) {currentProjectorParams.flipHorz = flip;}
00167     void setFlipVert(bool flip) {currentProjectorParams.flipVert = flip;}
00170     bool getFlipHorz(void) const {return currentProjectorParams.flipHorz;}
00173     bool getFlipVert(void) const {return currentProjectorParams.flipVert;}
00174     
00175 private:
00176     StelNavigator* navigation;          // Manage all navigation parameters, coordinate transformations etc..
00177     StelToneReproducer* toneConverter;      // Tones conversion between stellarium world and display device
00178     StelSkyDrawer* skyDrawer;
00179     StelMovementMgr* movementMgr;       // Manage vision movements
00180     
00181     // Manage geodesic grid
00182     mutable StelGeodesicGrid* geodesicGrid;
00183     
00184     // The currently used projection type
00185     ProjectionType currentProjectionType;
00186     
00187     // Parameters to use when creating new instances of StelProjector
00188     StelProjector::StelProjectorParams currentProjectorParams;
00189 };
00190 
00191 #endif // _STELCORE_HPP_

Generated on Mon Mar 9 16:16:15 2009 for Stellarium by  doxygen 1.5.5