Home · All Namespaces · All Classes · Functions · Coding Style · 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _STELOBSERVER_HPP_
00021 #define _STELOBSERVER_HPP_
00022 
00023 #include "StelLocation.hpp"
00024 #include <QObject>
00025 #include <QString>
00026 #include "VecMath.hpp"
00027 
00028 class Planet;
00029 class ArtificialPlanet;
00030 class StelObserver;
00031 
00034 class StelObserver : public QObject
00035 {
00036     Q_OBJECT
00037     
00038 public:
00040     StelObserver(const StelLocation& loc);
00041     ~StelObserver();
00042 
00044     virtual void update(double deltaTime) {;}
00045     
00047     Vec3d getCenterVsop87Pos(void) const;
00049     double getDistanceFromCenter(void) const;
00050     Mat4d getRotAltAzToEquatorial(double jd) const;
00051     Mat4d getRotEquatorialToVsop87(void) const;
00052     
00053     virtual const Planet* getHomePlanet(void) const {return planet;}
00054     
00056     const StelLocation& getCurrentLocation() const {return currentLocation;}
00057     
00060     virtual bool isObserverLifeOver() const {return false;}
00061     
00063     virtual StelObserver* getNextObserver() const {return new StelObserver(currentLocation);}
00064     
00065 protected:
00066     StelLocation currentLocation;
00067     const Planet* planet;    
00068 };
00069 
00072 class SpaceShipObserver : public StelObserver
00073 {
00074 public:
00075     SpaceShipObserver(const StelLocation& startLoc, const StelLocation& target, double transitSeconds=1.f);
00076     ~SpaceShipObserver();
00077     
00079     virtual void update(double deltaTime);
00080     virtual const Planet* getHomePlanet(void) const {return (isObserverLifeOver() || artificialPlanet==NULL)  ? planet : (Planet*)artificialPlanet;}
00081     virtual bool isObserverLifeOver() const {return timeToGo <= 0.;}
00082     virtual StelObserver* getNextObserver() const {return new StelObserver(moveTargetLocation);}
00083     
00084 private:
00085     StelLocation moveStartLocation;
00086     StelLocation moveTargetLocation;
00087     ArtificialPlanet* artificialPlanet;
00088     double timeToGo;
00089     double transitSeconds;
00090 };
00091 
00092 #endif // _STELOBSERVER_HPP_
00093 

Generated on Mon Feb 2 17:23:47 2009 for Stellarium by  doxygen 1.5.5