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         ProjectionCylinder,       
00067         ProjectionMercator,       
00068         ProjectionOrthographic    
00069     };
00070     
00071     StelCore();
00072     virtual ~StelCore();
00073 
00075     void init();
00076 
00079     void update(double deltaTime);
00080 
00082     void windowHasBeenResized(int width,int height);
00083     
00085     void preDraw();
00086 
00088     void postDraw();
00089         
00092     const StelProjectorP getProjection2d() const;
00093             
00097     const StelProjectorP getProjection(FrameType frameType, ProjectionType projType=(ProjectionType)1000) const;
00098     
00102     const StelProjectorP getProjection(const Mat4d& modelViewMat, ProjectionType projType=(ProjectionType)1000) const;
00103             
00105     StelNavigator* getNavigator() {return navigation;}
00107     const StelNavigator* getNavigator() const {return navigation;}
00108 
00110     StelToneReproducer* getToneReproducer() {return toneConverter;}
00112     const StelToneReproducer* getToneReproducer() const {return toneConverter;}
00113 
00115     StelSkyDrawer* getSkyDrawer() {return skyDrawer;}
00117     const StelSkyDrawer* getSkyDrawer() const {return skyDrawer;}
00118 
00120     const StelGeodesicGrid* getGeodesicGrid(int maxLevel) const;
00121     
00123     StelMovementMgr* getMovementMgr() {return movementMgr;}
00125     const StelMovementMgr* getMovementMgr() const {return movementMgr;}
00126     
00128     void setClippingPlanes(double znear, double zfar) {currentProjectorParams.zNear=znear;currentProjectorParams.zFar=zfar;} 
00130     void getClippingPlanes(double* zn, double* zf) const {*zn = currentProjectorParams.zNear; *zf = currentProjectorParams.zFar;}
00131     
00133     QString projectionTypeKeyToNameI18n(const QString& key) const;
00134     
00136     QString projectionNameI18nToTypeKey(const QString& nameI18n) const;
00137     
00139     StelProjector::StelProjectorParams getCurrentStelProjectorParams() const {return currentProjectorParams;}
00141     void setCurrentStelProjectorParams(const StelProjector::StelProjectorParams& newParams) {currentProjectorParams=newParams;}
00142     
00143 public slots:
00145     void setCurrentProjectionType(ProjectionType type) {currentProjectionType=type;}
00146     
00148     QString getCurrentProjectionTypeKey(void) const;
00150     void setCurrentProjectionTypeKey(QString type);
00151     
00153     QStringList getAllProjectionTypeKeys() const;
00154                 
00156     void setMaskType(StelProjector::StelProjectorMaskType m) {currentProjectorParams.maskType = m; }
00157     
00160     void setFlagGravityLabels(bool gravity) { currentProjectorParams.gravityLabels = gravity; } 
00163     void setFlipHorz(bool flip) {currentProjectorParams.flipHorz = flip;}
00166     void setFlipVert(bool flip) {currentProjectorParams.flipVert = flip;}
00169     bool getFlipHorz(void) const {return currentProjectorParams.flipHorz;}
00172     bool getFlipVert(void) const {return currentProjectorParams.flipVert;}
00173     
00174 private:
00175     StelNavigator* navigation;          // Manage all navigation parameters, coordinate transformations etc..
00176     StelToneReproducer* toneConverter;      // Tones conversion between stellarium world and display device
00177     StelSkyDrawer* skyDrawer;
00178     StelMovementMgr* movementMgr;       // Manage vision movements
00179     
00180     // Manage geodesic grid
00181     mutable StelGeodesicGrid* geodesicGrid;
00182     
00183     // The currently used projection type
00184     ProjectionType currentProjectionType;
00185     
00186     // Parameters to use when creating new instances of StelProjector
00187     StelProjector::StelProjectorParams currentProjectorParams;
00188 };
00189 
00190 #endif // _STELCORE_HPP_

Generated on Mon Feb 2 17:23:47 2009 for Stellarium by  doxygen 1.5.5