Navigator.hpp   StelNavigator.hpp 
skipping to change at line 20 skipping to change at line 20
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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 _NAVIGATOR_HPP_ #ifndef _STELNAVIGATOR_HPP_
#define _NAVIGATOR_HPP_ #define _STELNAVIGATOR_HPP_
#include "vecmath.h" #include "VecMath.hpp"
#include "fixx11h.h" #include "fixx11h.h"
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QTime> #include <QTime>
#include <QDateTime> #include <QDateTime>
// Conversion in standar Julian time format // Conversion in standar Julian time format
#define JD_SECOND 0.000011574074074074074074 #define JD_SECOND 0.000011574074074074074074
#define JD_MINUTE 0.00069444444444444444444 #define JD_MINUTE 0.00069444444444444444444
#define JD_HOUR 0.041666666666666666666 #define JD_HOUR 0.041666666666666666666
#define JD_DAY 1. #define JD_DAY 1.
extern const Mat4d matJ2000ToVsop87; class StelObserver;
extern const Mat4d matVsop87ToJ2000;
class Observer;
class StelObject; class StelObject;
class LoadingBar; class StelLoadingBar;
class Planet; class Planet;
class Location; class StelLocation;
//! @class Navigator //! @class StelNavigator
//! Manages a navigation context. This includes: //! Manages a navigation context. This includes:
//! - date/time //! - date/time
//! - viewing direction/fov //! - viewing direction/fov
//! - observer position //! - observer position
//! - coordinate changes //! - coordinate changes
class Navigator : public QObject class StelNavigator : public QObject
{ {
Q_OBJECT; Q_OBJECT
public: public:
enum ViewingModeType enum ViewingModeType
{ {
ViewHorizon, ViewHorizon,
ViewEquator ViewEquator
}; };
//! Possible mount modes //! Possible mount modes
enum MountMode { MountAltAzimuthal, MountEquatorial }; enum MountMode { MountAltAzimuthal, MountEquatorial };
// Create and initialise to default a navigation context // Create and initialise to default a navigation context
Navigator(); StelNavigator();
~Navigator(); ~StelNavigator();
void init(); void init();
void updateTime(double deltaTime); void updateTime(double deltaTime);
void updateTransformMatrices(void); void updateTransformMatrices(void);
//! Set current mount type //! Set current mount type
void setMountMode(MountMode m) {setViewingMode((m==MountAltAzimuthal ) ? Navigator::ViewHorizon : Navigator::ViewEquator);} void setMountMode(MountMode m) {setViewingMode((m==MountAltAzimuthal ) ? StelNavigator::ViewHorizon : StelNavigator::ViewEquator);}
//! Get current mount type //! Get current mount type
MountMode getMountMode(void) {return ((getViewingMode()==Navigator:: ViewHorizon) ? MountAltAzimuthal : MountEquatorial);} MountMode getMountMode(void) {return ((getViewingMode()==StelNavigat or::ViewHorizon) ? MountAltAzimuthal : MountEquatorial);}
//! Get vision direction //! Get vision direction
const Vec3d& getEquVision(void) const {return equVision;} const Vec3d& getEquinoxEquVisionDirection(void) const {return earthE
const Vec3d& getJ2000EquVision(void) const {return J2000EquVision;} quVisionDirection;}
const Vec3d& getLocalVision(void) const {return localVision;} const Vec3d& getJ2000EquVisionDirection(void) const {return J2000Equ
void setLocalVision(const Vec3d& _pos); VisionDirection;}
void setEquVision(const Vec3d& _pos); const Vec3d& getAltAzVisionDirection(void) const {return altAzVision
void setJ2000EquVision(const Vec3d& _pos); Direction;}
void setAltAzVisionDirection(const Vec3d& _pos);
void setEquinoxEquVisionDirection(const Vec3d& _pos);
void setJ2000EquVisionDirection(const Vec3d& _pos);
//! Get the informations on the current location //! Get the informations on the current location
const Location& getCurrentLocation() const; const StelLocation& getCurrentLocation() const;
//! Smoothly move the observer to the given location //! Smoothly move the observer to the given location
//! @param target the target location
//! @param duration direction of view move duration in s //! @param duration direction of view move duration in s
//! @param durationIfPlanetChange direction of view + planet travel move duration in s. //! @param durationIfPlanetChange direction of view + planet travel move duration in s.
//! This is used only if the destination planet is different from th e starting one. //! This is used only if the destination planet is different from th e starting one.
void moveObserverTo(const Location& target, double duration=1., doub le durationIfPlanetChange=1.); void moveObserverTo(const StelLocation& target, double duration=1., double durationIfPlanetChange=1.);
//! Get the sideral time shifted by the observer longitude //! Get the sideral time shifted by the observer longitude
//! @return the locale sideral time in radian //! @return the locale sideral time in radian
double getLocalSideralTime() const; double getLocalSideralTime() const;
const Planet *getHomePlanet(void) const; const Planet *getHomePlanet(void) const;
//! Return the observer heliocentric position //! Return the observer heliocentric ecliptic position
Vec3d getObserverHelioPos(void) const; Vec3d getObserverHeliocentricEclipticPos(void) const;
//! Transform vector from local coordinate to equatorial
Vec3d localToEarthEqu(const Vec3d& v) const { return matLocalToEarth
Equ*v; }
//! Transform vector from equatorial coordinate to local //! Transform vector from altazimuthal coordinate to equatorial
Vec3d earthEquToLocal(const Vec3d& v) const { return matEarthEquToLo Vec3d altAzToEquinoxEqu(const Vec3d& v) const { return matAltAzToEqu
cal*v; } inoxEqu*v; }
Vec3d earthEquToJ2000(const Vec3d& v) const { return matEarthEquToJ2 //! Transform vector from equatorial coordinate to altazimuthal
000*v; } Vec3d equinoxEquToAltAz(const Vec3d& v) const { return matEquinoxEqu
Vec3d j2000ToEarthEqu(const Vec3d& v) const { return matJ2000ToEarth ToAltAz*v; }
Equ*v; } Vec3d equinoxEquToJ2000(const Vec3d& v) const { return matEquinoxEqu
Vec3d j2000ToLocal(const Vec3d& v) const { return matJ2000ToLocal*v; ToJ2000*v; }
} Vec3d j2000ToEquinoxEqu(const Vec3d& v) const { return matJ2000ToEqu
inoxEqu*v; }
Vec3d j2000ToAltAz(const Vec3d& v) const { return matJ2000ToAltAz*v;
}
//! Transform vector from heliocentric coordinate to local //! Transform vector from heliocentric ecliptic coordinate to altazi
Vec3d helioToLocal(const Vec3d& v) const { return matHelioToLocal*v; muthal
} Vec3d heliocentricEclipticToAltAz(const Vec3d& v) const { return mat
HeliocentricEclipticToAltAz*v; }
//! Transform vector from heliocentric coordinate to earth equatoria //! Transform from heliocentric coordinate to equatorial at current
l, equinox (for the planet where the observer stands)
//! only needed in meteor.cpp Vec3d heliocentricEclipticToEquinoxEqu(const Vec3d& v) const { retur
Vec3d helioToEarthEqu(const Vec3d& v) const { return matHelioToEarth n matHeliocentricEclipticToEquinoxEqu*v; }
Equ*v; }
//! Transform vector from heliocentric coordinate to false equatoria l : equatorial //! Transform vector from heliocentric coordinate to false equatoria l : equatorial
//! coordinate but centered on the observer position (usefull for ob jects close to earth) //! coordinate but centered on the observer position (usefull for ob jects close to earth)
Vec3d helioToEarthPosEqu(const Vec3d& v) const { return matLocalToEa rthEqu*matHelioToLocal*v; } Vec3d heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) const { return matAltAzToEquinoxEqu*matHeliocentricEclipticToAltAz*v; }
//! Return the modelview matrix for some coordinate systems //! Get the modelview matrix for heliocentric ecliptic (Vsop87) draw
const Mat4d& getHelioToEyeMat(void) const {return matHelioToEye;} ing
const Mat4d& getEarthEquToEyeMat(void) const {return matEarthEquToEy const Mat4d getHeliocentricEclipticModelViewMat(void) const {return
e;} matAltAzModelView*matHeliocentricEclipticToAltAz;}
const Mat4d& getLocalToEyeMat(void) const {return matLocalToEye;} //! Get the modelview matrix for observer-centric ecliptic (Vsop87)
const Mat4d& getJ2000ToEyeMat(void) const {return matJ2000ToEye;} drawing
const Mat4d getObservercentricEclipticModelViewMat(void) const {retu
rn matAltAzModelView*matJ2000ToAltAz*matVsop87ToJ2000;}
//! Get the modelview matrix for observer-centric equatorial at equi
nox drawing
const Mat4d getEquinoxEquModelViewMat(void) const {return matAltAzMo
delView*matEquinoxEquToAltAz;}
//! Get the modelview matrix for observer-centric altazimuthal drawi
ng
const Mat4d& getAltAzModelViewMat(void) const {return matAltAzModelV
iew;}
//! Get the modelview matrix for observer-centric J2000 equatorial d
rawing
const Mat4d getJ2000ModelViewMat(void) const {return matAltAzModelVi
ew*matEquinoxEquToAltAz*matJ2000ToEquinoxEqu;}
void setViewingMode(ViewingModeType viewMode); void setViewingMode(ViewingModeType viewMode);
ViewingModeType getViewingMode(void) const {return viewingMode;} ViewingModeType getViewingMode(void) const {return viewingMode;}
//! Return the inital viewing direction in altazimutal coordinates //! Return the inital viewing direction in altazimuthal coordinates
const Vec3d& getInitViewingDirection() {return initViewPos;} const Vec3d& getInitViewingDirection() {return initViewPos;}
//! Return the preset sky time in JD //! Return the preset sky time in JD
double getPresetSkyTime() const {return presetSkyTime;} double getPresetSkyTime() const {return presetSkyTime;}
//! Set the preset sky time from a JD //! Set the preset sky time from a JD
void setPresetSkyTime(double d) {presetSkyTime=d;} void setPresetSkyTime(double d) {presetSkyTime=d;}
//! Return the startup mode, can be preset|Preset or anything else //! Return the startup mode, can be preset|Preset or anything else
QString getStartupTimeMode() {return startupTimeMode;} QString getStartupTimeMode() {return startupTimeMode;}
void setStartupTimeMode(const QString& s); void setStartupTimeMode(const QString& s);
//! Update the modelview matrices //! Rotation matrix from equatorial J2000 to ecliptic (Vsop87)
void updateModelViewMat(void); static const Mat4d matJ2000ToVsop87;
//! Rotation matrix from ecliptic (Vsop87) to equatorial J2000
static const Mat4d matVsop87ToJ2000;
public slots: public slots:
//! Toggle current mount mode between equatorial and altazimutal //! Toggle current mount mode between equatorial and altazimuthal
void toggleMountMode() {if (getMountMode()==MountAltAzimuthal) setMo untMode(MountEquatorial); else setMountMode(MountAltAzimuthal);} void toggleMountMode() {if (getMountMode()==MountAltAzimuthal) setMo untMode(MountEquatorial); else setMountMode(MountAltAzimuthal);}
//! Define whether we should use equatorial mount or altazimutal //! Define whether we should use equatorial mount or altazimuthal
void setEquatorialMount(bool b) {setMountMode(b ? MountEquatorial : MountAltAzimuthal);} void setEquatorialMount(bool b) {setMountMode(b ? MountEquatorial : MountAltAzimuthal);}
//! Set the current date in Julian Day //! Set the current date in Julian Day
void setJDay(double JD) {JDay=JD;} void setJDay(double JD) {JDay=JD;}
//! Get the current date in Julian Day //! Get the current date in Julian Day
double getJDay() const {return JDay;} double getJDay() const {return JDay;}
//! Set time speed in JDay/sec //! Set time speed in JDay/sec
void setTimeSpeed(double ts) {timeSpeed=ts;} void setTimeRate(double ts) {timeSpeed=ts;}
//! Get time speed in JDay/sec //! Get time speed in JDay/sec
double getTimeSpeed() const {return timeSpeed;} double getTimeRate() const {return timeSpeed;}
//! Increase the time speed //! Increase the time speed
void increaseTimeSpeed(); void increaseTimeSpeed();
//! Decrease the time speed //! Decrease the time speed
void decreaseTimeSpeed(); void decreaseTimeSpeed();
//! Set time speed to 0, i.e. freeze the passage of simulation time
void setZeroTimeSpeed() {setTimeRate(0);}
//! Set real time speed, i.e. 1 sec/sec //! Set real time speed, i.e. 1 sec/sec
void setRealTimeSpeed() {setTimeSpeed(JD_SECOND);} void setRealTimeSpeed() {setTimeRate(JD_SECOND);}
//! Get whether it is real time speed, i.e. 1 sec/sec //! Get whether it is real time speed, i.e. 1 sec/sec
bool getRealTimeSpeed() const {return (fabs(timeSpeed-JD_SECOND)<0.0 000001);} bool getRealTimeSpeed() const {return (fabs(timeSpeed-JD_SECOND)<0.0 000001);}
//! Set stellarium time to current real world time //! Set stellarium time to current real world time
void setTimeNow(); void setTimeNow();
//! Set the time to some value, leaving the day the same. //! Set the time to some value, leaving the day the same.
void setTodayTime(const QTime& target); void setTodayTime(const QTime& target);
//! Get wether the current stellarium time is the real world time //! Get wether the current stellarium time is the real world time
bool getIsTimeNow() const; bool getIsTimeNow() const;
skipping to change at line 241 skipping to change at line 247
//! Get the location used by default at startup //! Get the location used by default at startup
QString getDefaultLocationID() const {return defaultLocationID;} QString getDefaultLocationID() const {return defaultLocationID;}
//! Set the location to use by default at startup //! Set the location to use by default at startup
void setDefaultLocationID(const QString& id); void setDefaultLocationID(const QString& id);
//! Sets the initial direction of view to the current altitude and a zimuth. //! Sets the initial direction of view to the current altitude and a zimuth.
//! Note: Updates the configuration file. //! Note: Updates the configuration file.
void setInitViewDirectionToCurrent(void); void setInitViewDirectionToCurrent(void);
private: private:
//! Update the modelview matrices
void updateModelViewMat(void);
// Matrices used for every coordinate transfo // Matrices used for every coordinate transfo
Mat4d matHelioToLocal; // Transform from Heliocentric to Observer Mat4d matHeliocentricEclipticToAltAz; // Transform from heliocentr
local coordinate ic ecliptic (Vsop87) to observer-centric altazimuthal coordinate
Mat4d matLocalToHelio; // Transform from Observer local coordinat Mat4d matAltAzToHeliocentricEcliptic; // Transform from observer-c
e to Heliocentric entric altazimuthal coordinate to heliocentric ecliptic (Vsop87)
Mat4d matLocalToEarthEqu; // Transform from Observer local coordinat Mat4d matAltAzToEquinoxEqu; // Transform
e to Earth Equatorial from observer-centric altazimuthal coordinate to Earth Equatorial
Mat4d matEarthEquToLocal; // Transform from Observer local coordinat Mat4d matEquinoxEquToAltAz; // Transform
e to Earth Equatorial from observer-centric altazimuthal coordinate to Earth Equatorial
Mat4d matHelioToEarthEqu; // Transform from Heliocentric to earth eq Mat4d matHeliocentricEclipticToEquinoxEqu;// Transform from heliocen
uatorial coordinate tric ecliptic (Vsop87) to earth equatorial coordinate
Mat4d matEarthEquToJ2000; Mat4d matEquinoxEquToJ2000;
Mat4d matJ2000ToEarthEqu; Mat4d matJ2000ToEquinoxEqu;
Mat4d matJ2000ToLocal; Mat4d matJ2000ToAltAz;
Mat4d matLocalToEye; // Modelview matrix for observer local dra Mat4d matAltAzModelView; // M
wing odelview matrix for observer-centric altazimuthal drawing
Mat4d matEarthEquToEye; // Modelview matrix for geocentric equator
ial drawing
Mat4d matJ2000ToEye; // precessed version
Mat4d matHelioToEye; // Modelview matrix for heliocentric equat
orial drawing
// Vision variables // Vision variables
// Viewing direction in local and equatorial coordinates // Viewing direction in altazimuthal and equatorial coordinates
Vec3d localVision, equVision, J2000EquVision; Vec3d altAzVisionDirection, earthEquVisionDirection, J2000EquVisionD
irection;
// Time variable // Time variable
double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec
double JDay; // Curent time in Julian day double JDay; // Curent time in Julian day
double presetSkyTime; double presetSkyTime;
QTime initTodayTime; QTime initTodayTime;
QString startupTimeMode; QString startupTimeMode;
// The ID of the default startup location // The ID of the default startup location
QString defaultLocationID; QString defaultLocationID;
// Position variables // Position variables
Observer* position; StelObserver* position;
Vec3d initViewPos; // Default viewing direction Vec3d initViewPos; // Default viewing direction
// defines if view corrects for horizon, or uses equatorial coordina tes // defines if view corrects for horizon, or uses equatorial coordina tes
ViewingModeType viewingMode; ViewingModeType viewingMode;
}; };
#endif // _NAVIGATOR_HPP_ #endif // _STELNAVIGATOR_HPP_
 End of changes. 35 change blocks. 
86 lines changed or deleted 104 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/