Stellarium  0.16.1
StelObserver.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _STELOBSERVER_HPP_
21 #define _STELOBSERVER_HPP_
22 
23 #include "Planet.hpp"
24 #include "StelLocation.hpp"
25 #include "VecMath.hpp"
26 
27 #include <QObject>
28 #include <QString>
29 #include <QSharedPointer>
30 
31 
32 class ArtificialPlanet;
33 class StelObserver;
34 
37 class StelObserver : public QObject
38 {
39  Q_OBJECT
40 
41 public:
43  StelObserver(const StelLocation& loc);
44  ~StelObserver();
45 
48  virtual bool update(double) {return false;}
49 
51  Vec3d getCenterVsop87Pos(void) const;
54  double getDistanceFromCenter(void) const;
59 
62  Mat4d getRotAltAzToEquatorial(double JD, double JDE) const;
63  Mat4d getRotEquatorialToVsop87(void) const;
64 
65  virtual const QSharedPointer<Planet> getHomePlanet(void) const;
66 
68  virtual const StelLocation& getCurrentLocation() const {return currentLocation;}
69 
72  virtual bool isObserverLifeOver() const {return false;}
73 
75  virtual bool isTraveling() const {return false;}
76 
78  virtual StelObserver* getNextObserver() const {return new StelObserver(currentLocation);}
79 
80 protected:
81  StelLocation currentLocation;
82  QSharedPointer<Planet> planet;
83 };
84 
88 {
89  Q_OBJECT
90 public:
91  SpaceShipObserver(const StelLocation& startLoc, const StelLocation& target, double transitSeconds=1.f, double timeToGo=-1.0);
93 
95  virtual bool update(double deltaTime);
96  virtual const QSharedPointer<Planet> getHomePlanet() const;
97  virtual bool isObserverLifeOver() const {return timeToGo <= 0.;}
98  virtual bool isTraveling() const {return !isObserverLifeOver();}
99  virtual StelObserver* getNextObserver() const {return new StelObserver(moveTargetLocation);}
100 
102  StelLocation getTargetLocation() const { return moveTargetLocation; }
104  double getRemainingTime() const { return timeToGo; }
106  double getTransitTime() const { return transitSeconds; }
107 
108 private:
109  StelLocation moveStartLocation;
110  StelLocation moveTargetLocation;
111  QSharedPointer<Planet> artificialPlanet;
112  double timeToGo;
113  double transitSeconds;
114 };
115 
116 #endif // _STELOBSERVER_HPP_
117 
virtual bool isObserverLifeOver() const
Get whether the life of this observer is over, and therefore that it should be changed to the next on...
virtual const StelLocation & getCurrentLocation() const
Get the informations on the current location.
Store the informations for a location on a planet.
double getDistanceFromCenter(void) const
Get the distance between observer and home planet center in AU.
Vec3d getCenterVsop87Pos(void) const
Get the position of the home planet center in the heliocentric VSOP87 frame in AU.
StelLocation getTargetLocation() const
Returns the target location.
virtual bool isObserverLifeOver() const
Get whether the life of this observer is over, and therefore that it should be changed to the next on...
StelObserver(const StelLocation &loc)
Create a new StelObserver instance which is at a fixed Location.
virtual bool update(double)
Update StelObserver info if needed.
double getTransitTime() const
Returns the total movement time.
double getRemainingTime() const
Returns the remaining movement time.
virtual bool isTraveling() const
Get whether the location is a moving one.
Should be renamed as PlanetBasedObserver and derive from a more generical StelObserver class...
An observer which moves from from one position to another one and/or from one planet to another one...
virtual StelObserver * getNextObserver() const
Get the next observer to use once the life of this one is over.
virtual bool isTraveling() const
Get whether the location is a moving one.
Mat4d getRotAltAzToEquatorial(double JD, double JDE) const
returns rotation matrix for conversion of alt-azimuthal to equatorial coordinates For Earth we need J...
virtual StelObserver * getNextObserver() const
Get the next observer to use once the life of this one is over.
Vec3d getTopographicOffsetFromCenter(void) const
Get the geocentric rectangular coordinates of the observer in AU, plus geocentric latitude φ&#39;...