Stellarium 0.11.4
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/StelObserver.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
00018  */
00019 
00020 #ifndef _STELOBSERVER_HPP_
00021 #define _STELOBSERVER_HPP_
00022 
00023 #include "StelLocation.hpp"
00024 #include <QObject>
00025 #include <QString>
00026 #include <QSharedPointer>
00027 #include "VecMath.hpp"
00028 #include "Planet.hpp"
00029 
00030 class ArtificialPlanet;
00031 class StelObserver;
00032 
00035 class StelObserver : public QObject
00036 {
00037     Q_OBJECT
00038 
00039 public:
00041     StelObserver(const StelLocation& loc);
00042     ~StelObserver();
00043 
00045     virtual void update(double) {;}
00046 
00048     Vec3d getCenterVsop87Pos(void) const;
00050     double getDistanceFromCenter(void) const;
00051     Mat4d getRotAltAzToEquatorial(double jd) const;
00052     Mat4d getRotEquatorialToVsop87(void) const;
00053 
00054     virtual const QSharedPointer<Planet> getHomePlanet(void) const;
00055 
00057     virtual const StelLocation& getCurrentLocation() const {return currentLocation;}
00058 
00061     virtual bool isObserverLifeOver() const {return false;}
00062 
00064     virtual bool isTraveling() const {return false;}
00065 
00067     virtual StelObserver* getNextObserver() const {return new StelObserver(currentLocation);}
00068 
00069 protected:
00070     StelLocation currentLocation;
00071     QSharedPointer<Planet> planet;
00072 };
00073 
00076 class SpaceShipObserver : public StelObserver
00077 {
00078 public:
00079     SpaceShipObserver(const StelLocation& startLoc, const StelLocation& target, double transitSeconds=1.f);
00080     ~SpaceShipObserver();
00081 
00083     virtual void update(double deltaTime);
00084     virtual const QSharedPointer<Planet> getHomePlanet() const;
00085     virtual bool isObserverLifeOver() const {return timeToGo <= 0.;}
00086     virtual bool isTraveling() const {return !isObserverLifeOver();}
00087     virtual StelObserver* getNextObserver() const {return new StelObserver(moveTargetLocation);}
00088 
00089 private:
00090     StelLocation moveStartLocation;
00091     StelLocation moveTargetLocation;
00092     QSharedPointer<Planet> artificialPlanet;
00093     double timeToGo;
00094     double transitSeconds;
00095 };
00096 
00097 #endif // _STELOBSERVER_HPP_
00098 
Generated on Sat Aug 25 22:13:30 2012 for Stellarium by  doxygen 1.6.3