Stellarium 0.12.4
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 "StelLocation.hpp"
24 #include <QObject>
25 #include <QString>
26 #include <QSharedPointer>
27 #include "VecMath.hpp"
28 #include "Planet.hpp"
29 
30 class ArtificialPlanet;
31 class StelObserver;
32 
35 class StelObserver : public QObject
36 {
37  Q_OBJECT
38 
39 public:
41  StelObserver(const StelLocation& loc);
42  ~StelObserver();
43 
45  virtual void update(double) {;}
46 
48  Vec3d getCenterVsop87Pos(void) const;
50  double getDistanceFromCenter(void) const;
51  Mat4d getRotAltAzToEquatorial(double jd) const;
52  Mat4d getRotEquatorialToVsop87(void) const;
53 
54  virtual const QSharedPointer<Planet> getHomePlanet(void) const;
55 
57  virtual const StelLocation& getCurrentLocation() const {return currentLocation;}
58 
61  virtual bool isObserverLifeOver() const {return false;}
62 
64  virtual bool isTraveling() const {return false;}
65 
67  virtual StelObserver* getNextObserver() const {return new StelObserver(currentLocation);}
68 
69 protected:
70  StelLocation currentLocation;
71  QSharedPointer<Planet> planet;
72 };
73 
77 {
78 public:
79  SpaceShipObserver(const StelLocation& startLoc, const StelLocation& target, double transitSeconds=1.f);
81 
83  virtual void update(double deltaTime);
84  virtual const QSharedPointer<Planet> getHomePlanet() const;
85  virtual bool isObserverLifeOver() const {return timeToGo <= 0.;}
86  virtual bool isTraveling() const {return !isObserverLifeOver();}
87  virtual StelObserver* getNextObserver() const {return new StelObserver(moveTargetLocation);}
88 
89 private:
90  StelLocation moveStartLocation;
91  StelLocation moveTargetLocation;
92  QSharedPointer<Planet> artificialPlanet;
93  double timeToGo;
94  double transitSeconds;
95 };
96 
97 #endif // _STELOBSERVER_HPP_
98