StelCore.hpp   StelCore.hpp 
skipping to change at line 22 skipping to change at line 22
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#ifndef _STELCORE_HPP_ #ifndef _STELCORE_HPP_
#define _STELCORE_HPP_ #define _STELCORE_HPP_
#include "StelProjector.hpp"
#include "StelProjectorType.hpp"
#include <QString> #include <QString>
#include <QStringList>
class Navigator; class StelNavigator;
class Projector; class StelToneReproducer;
class ToneReproducer; class StelSkyDrawer;
class SkyDrawer; class StelGeodesicGrid;
class LoadingBar; class StelMovementMgr;
class Observer;
class GeodesicGrid;
//! @class StelCore //! @class StelCore
//! Main class for Stellarium core processing. //! Main class for Stellarium core processing.
//! This class provides services like management of sky projections, //! This class provides services like management of sky projections,
//! tone conversion, or reference frame conversion. It is used by the //! tone conversion, or reference frame conversion. It is used by the
//! various StelModules to update and display themself. //! various StelModules to update and display themself.
//! There is currently only one StelCore instance in Stellarium, but //! There is currently only one StelCore instance in Stellarium, but
//! in the future they may be more, allowing for example to display //! in the future they may be more, allowing for example to display
//! several independent views of the sky at the same time. //! several independent views of the sky at the same time.
//! @author Fabien Chereau //! @author Fabien Chereau
class StelCore class StelCore : public QObject
{ {
Q_OBJECT
Q_ENUMS(ProjectionType);
public: public:
//! @enum FrameType
//! Supported reference frame types
enum FrameType
{
FrameAltAz, //!< Altazimuthal reference fr
ame centered on observer.
FrameHeliocentricEcliptic, //!< Ecliptic reference frame
centered on the Sun
FrameObservercentricEcliptic, //!< Ecliptic reference frame
centered on the Observer
FrameEquinoxEqu, //!< Equatorial reference fram
e at the current equinox centered on the observer. The north pole follow th
e precession of the planet on which the observer is located.
FrameJ2000 //!< Equatorial reference fram
e at the J2000 equinox centered on the observer. This is also the ICRS refe
rence frame.
};
//! Available projection types. A value of 1000 indicate the default
projection
enum ProjectionType
{
ProjectionPerspective, //!< Perspective projection
ProjectionEqualArea, //!< Equal Area projection
ProjectionStereographic, //!< Stereograhic projection
ProjectionFisheye, //!< Fisheye projection
ProjectionCylinder, //!< Cylinder projection
ProjectionMercator, //!< Mercator projection
ProjectionOrthographic //!< Orthographic projection
};
StelCore(); StelCore();
virtual ~StelCore(); virtual ~StelCore();
//! Init and load all main core components. //! Init and load all main core components.
void init(); void init();
//! Update all the objects with respect to the time. //! Update all the objects with respect to the time.
//! @param deltaTime the time increment in sec. //! @param deltaTime the time increment in sec.
void update(double deltaTime); void update(double deltaTime);
//! Handle the resizing of the window
void windowHasBeenResized(int width,int height);
//! Update core state before drawing modules. //! Update core state before drawing modules.
void preDraw(); void preDraw();
//! Update core state after drawing modules. //! Update core state after drawing modules.
void postDraw(); void postDraw();
//! Get the current projector used in the core. //! Get a new instance of a simple 2d projection. This projection ca
Projector* getProjection() {return projection;} nnot be used to project or unproject but
//! Get the current projector used in the core. //! only for 2d painting
const Projector* getProjection() const {return projection;} const StelProjectorP getProjection2d() const;
//! Get a new instance of projector using the current display parame
ters from Navigation, StelMovementMgr, etc...
//! If not specified the projection type is the default one set in t
he core.
//! This is a smart pointer, you don't need to delete it.
const StelProjectorP getProjection(FrameType frameType, ProjectionTy
pe projType=(ProjectionType)1000) const;
//! Get an instance of projector using the current display parameter
s from Navigation, StelMovementMgr
//! and using the given modelview matrix.
//! If not specified default the projection type is the default one
set in the core.
const StelProjectorP getProjection(const Mat4d& modelViewMat, Projec
tionType projType=(ProjectionType)1000) const;
//! Get the current navigation (manages frame transformation) used i n the core. //! Get the current navigation (manages frame transformation) used i n the core.
Navigator* getNavigation() {return navigation;} StelNavigator* getNavigator() {return navigation;}
//! Get the current navigation (manages frame transformation) used i n the core. //! Get the current navigation (manages frame transformation) used i n the core.
const Navigator* getNavigation() const {return navigation;} const StelNavigator* getNavigator() const {return navigation;}
//! Get the current tone reproducer used in the core. //! Get the current tone reproducer used in the core.
ToneReproducer* getToneReproducer() {return toneConverter;} StelToneReproducer* getToneReproducer() {return toneConverter;}
//! Get the current tone reproducer used in the core. //! Get the current tone reproducer used in the core.
const ToneReproducer* getToneReproducer() const {return toneConverte r;} const StelToneReproducer* getToneReproducer() const {return toneConv erter;}
//! Get the current SkyDrawer used in the core. //! Get the current StelSkyDrawer used in the core.
SkyDrawer* getSkyDrawer() {return skyDrawer;} StelSkyDrawer* getSkyDrawer() {return skyDrawer;}
//! Get the current SkyDrawer used in the core. //! Get the current StelSkyDrawer used in the core.
const SkyDrawer* getSkyDrawer() const {return skyDrawer;} const StelSkyDrawer* getSkyDrawer() const {return skyDrawer;}
//! Get the shared instance of GeodesicGrid //! Get an instance of StelGeodesicGrid which is garanteed to allow
GeodesicGrid* getGeodesicGrid() {return geodesicGrid;} for at least maxLevel levels
//! Get the shared instance of GeodesicGrid const StelGeodesicGrid* getGeodesicGrid(int maxLevel) const;
const GeodesicGrid* getGeodesicGrid() const {return geodesicGrid;}
//! Get the instance of movement manager.
StelMovementMgr* getMovementMgr() {return movementMgr;}
//! Get the const instance of movement manager.
const StelMovementMgr* getMovementMgr() const {return movementMgr;}
//! Set the near and far clipping planes.
void setClippingPlanes(double znear, double zfar) {currentProjectorP
arams.zNear=znear;currentProjectorParams.zFar=zfar;}
//! Get the near and far clipping planes.
void getClippingPlanes(double* zn, double* zf) const {*zn = currentP
rojectorParams.zNear; *zf = currentProjectorParams.zFar;}
//! Get the translated projection name from its TypeKey for the curr
ent locale.
QString projectionTypeKeyToNameI18n(const QString& key) const;
//! Get the projection TypeKey from its translated name for the curr
ent locale.
QString projectionNameI18nToTypeKey(const QString& nameI18n) const;
//! Get the current set of parameters to use when creating a new Ste
lProjector.
StelProjector::StelProjectorParams getCurrentStelProjectorParams() c
onst {return currentProjectorParams;}
//! Set the set of parameters to use when creating a new StelProject
or.
void setCurrentStelProjectorParams(const StelProjector::StelProjecto
rParams& newParams) {currentProjectorParams=newParams;}
public slots:
//! Set the current ProjectionType to use
void setCurrentProjectionType(ProjectionType type) {currentProjectio
nType=type;}
//! Get the current Mapping used by the Projection
QString getCurrentProjectionTypeKey(void) const;
//! Set the current ProjectionType to use from its key
void setCurrentProjectionTypeKey(QString type);
//! Get the list of all the available projections
QStringList getAllProjectionTypeKeys() const;
//! Set the mask type.
void setMaskType(StelProjector::StelProjectorMaskType m) {currentPro
jectorParams.maskType = m; }
//! Set the flag with decides whether to arrage labels so that
//! they are aligned with the bottom of a 2d screen, or a 3d dome.
void setFlagGravityLabels(bool gravity) { currentProjectorParams.gra
vityLabels = gravity; }
//! Set the horizontal flip status.
//! @param flip The new value (true = flipped, false = unflipped).
void setFlipHorz(bool flip) {currentProjectorParams.flipHorz = flip;
}
//! Set the vertical flip status.
//! @param flip The new value (true = flipped, false = unflipped).
void setFlipVert(bool flip) {currentProjectorParams.flipVert = flip;
}
//! Get the state of the horizontal flip.
//! @return True if flipped horizontally, else false.
bool getFlipHorz(void) const {return currentProjectorParams.flipHorz
;}
//! Get the state of the vertical flip.
//! @return True if flipped vertically, else false.
bool getFlipVert(void) const {return currentProjectorParams.flipVert
;}
private: private:
Navigator* navigation; // Manage all navigation par StelNavigator* navigation; // Manage all naviga
ameters, coordinate transformations etc.. tion parameters, coordinate transformations etc..
Projector* projection; // Manage the projection mod StelToneReproducer* toneConverter; // Tones conversion
e and matrix between stellarium world and display device
ToneReproducer* toneConverter; // Tones conversion between StelSkyDrawer* skyDrawer;
stellarium world and display device StelMovementMgr* movementMgr; // Manage vision movements
SkyDrawer* skyDrawer;
class MovementMgr* movementMgr; // Manage vision movements
// Manage geodesic grid // Manage geodesic grid
GeodesicGrid* geodesicGrid; mutable StelGeodesicGrid* geodesicGrid;
// The currently used projection type
ProjectionType currentProjectionType;
// Parameters to use when creating new instances of StelProjector
StelProjector::StelProjectorParams currentProjectorParams;
}; };
#endif // _STELCORE_HPP_ #endif // _STELCORE_HPP_
 End of changes. 15 change blocks. 
34 lines changed or deleted 158 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/