Observer.hpp   StelObserver.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 _OBSERVER_HPP_ #ifndef _STELOBSERVER_HPP_
#define _OBSERVER_HPP_ #define _STELOBSERVER_HPP_
#include "Location.hpp" #include "StelLocation.hpp"
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include "vecmath.h" #include "VecMath.hpp"
class Planet; class Planet;
class ArtificialPlanet; class ArtificialPlanet;
class Observer; class StelObserver;
//! @class Observer //! @class StelObserver
//! Should be renamed as PlanetBasedObserver and derive from a more generic //! Should be renamed as PlanetBasedObserver and derive from a more generic
al Observer class al StelObserver class
class Observer : public QObject class StelObserver : public QObject
{ {
Q_OBJECT; Q_OBJECT
public: public:
//! Create a new Observer instance which is at a fixed Location //! Create a new StelObserver instance which is at a fixed Location
Observer(const Location& loc); StelObserver(const StelLocation& loc);
~Observer(); ~StelObserver();
//! Update Observer info if needed. Default implementation does noth ing. //! Update StelObserver info if needed. Default implementation does nothing.
virtual void update(double deltaTime) {;} virtual void update(double deltaTime) {;}
//! Get the position of the home planet center in the heliocentric V SOP87 frame in AU
Vec3d getCenterVsop87Pos(void) const; Vec3d getCenterVsop87Pos(void) const;
//! Get the distance between observer and home planet center in AU
double getDistanceFromCenter(void) const; double getDistanceFromCenter(void) const;
Mat4d getRotLocalToEquatorial(double jd) const; Mat4d getRotAltAzToEquatorial(double jd) const;
Mat4d getRotEquatorialToVsop87(void) const; Mat4d getRotEquatorialToVsop87(void) const;
virtual const Planet* getHomePlanet(void) const {return planet;} virtual const Planet* getHomePlanet(void) const {return planet;}
//! Get the informations on the current location //! Get the informations on the current location
const Location& getCurrentLocation() const {return currentLocation;} const StelLocation& getCurrentLocation() const {return currentLocati on;}
//! Get whether the life of this observer is over, and therefore tha t it should be changed to the next one //! Get whether the life of this observer is over, and therefore tha t it should be changed to the next one
//! provided by the getNextObserver() method //! provided by the getNextObserver() method
virtual bool isObserverLifeOver() const {return false;} virtual bool isObserverLifeOver() const {return false;}
//! Get the next observer to use once the life of this one is over //! Get the next observer to use once the life of this one is over
virtual Observer* getNextObserver() const {return new Observer(curre ntLocation);} virtual StelObserver* getNextObserver() const {return new StelObserv er(currentLocation);}
protected: protected:
Location currentLocation; StelLocation currentLocation;
const Planet* planet; const Planet* planet;
}; };
//! @class SpaceShipObserver //! @class SpaceShipObserver
//! An observer which moves from from one position to another one and/or fr om one planet to another one //! An observer which moves from from one position to another one and/or fr om one planet to another one
class SpaceShipObserver : public Observer class SpaceShipObserver : public StelObserver
{ {
public: public:
SpaceShipObserver(const Location& startLoc, const Location& target, double transitSeconds=1.f); SpaceShipObserver(const StelLocation& startLoc, const StelLocation& target, double transitSeconds=1.f);
~SpaceShipObserver(); ~SpaceShipObserver();
//! Update Observer info if needed. Default implementation does noth ing. //! Update StelObserver info if needed. Default implementation does nothing.
virtual void update(double deltaTime); virtual void update(double deltaTime);
virtual const Planet* getHomePlanet(void) const {return (isObserverL ifeOver() || artificialPlanet==NULL) ? planet : (Planet*)artificialPlanet; } virtual const Planet* getHomePlanet(void) const {return (isObserverL ifeOver() || artificialPlanet==NULL) ? planet : (Planet*)artificialPlanet; }
virtual bool isObserverLifeOver() const {return timeToGo <= 0.;} virtual bool isObserverLifeOver() const {return timeToGo <= 0.;}
virtual Observer* getNextObserver() const {return new Observer(moveT argetLocation);} virtual StelObserver* getNextObserver() const {return new StelObserv er(moveTargetLocation);}
private: private:
Location moveStartLocation; StelLocation moveStartLocation;
Location moveTargetLocation; StelLocation moveTargetLocation;
ArtificialPlanet* artificialPlanet; ArtificialPlanet* artificialPlanet;
double timeToGo; double timeToGo;
double transitSeconds; double transitSeconds;
}; };
#endif // _OBSERVER_HPP_ #endif // _STELOBSERVER_HPP_
 End of changes. 20 change blocks. 
24 lines changed or deleted 26 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/