• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

ksplanetbase.h

Go to the documentation of this file.
00001 
00002 /***************************************************************************
00003                           ksplanetbase.h  -  K Desktop Planetarium
00004                              -------------------
00005     begin                : Sun Jan 29 2002
00006     copyright            : (C) 2002 by Mark Hollomon
00007     email                : mhh@mindspring.com
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef KSPLANETBASE_H
00020 #define KSPLANETBASE_H
00021 
00022 #include <qstring.h>
00023 #include <qptrlist.h>
00024 #include <qimage.h>
00025 
00026 #include <kdebug.h>
00027 
00028 #include "skyobject.h"
00029 #include "dms.h"
00030 
00031 #define MAXTRAIL 400  //maximum number of points in a planet trail
00032 
00033 class QPoint;
00034 class KSNumbers;
00035 class KSPopupMenu;
00036 
00042 class EclipticPosition {
00043     public:
00044         dms longitude;
00045         dms latitude;
00046         double radius;
00047 
00049         EclipticPosition(dms plong = 0.0, dms plat = 0.0, double prad = 0.0) :
00050             longitude(plong), latitude(plat), radius(prad) {}
00051 
00053         EclipticPosition &operator=(EclipticPosition &r) {
00054             this->longitude = r.longitude;
00055             this->latitude = r.latitude;
00056             this->radius = r.radius;
00057             return *this;
00058         }
00059 };
00060 
00070 class KStarsData;
00071 class KSPlanetBase : public SkyObject {
00072 public:
00073 
00083     KSPlanetBase( KStarsData *kd, QString s = i18n("unnamed"), QString image_file="", double pSize=0 );
00084 
00088     virtual ~KSPlanetBase() {}
00089 
00092     const dms* ecLong( void ) const { return &ep.longitude; }
00093 
00097     const dms* ecLat( void ) const { return &ep.latitude; }
00098 
00102     void setEcLong( dms elong ) { ep.longitude = elong; }
00103 
00108     void setEcLong( double elong ) { ep.longitude.setD( elong ); }
00109 
00113     void setEcLat( dms elat ) { ep.latitude = elat; }
00114 
00119     void setEcLat( double elat ) { ep.latitude.setD( elat ); }
00120     
00123     const dms* helEcLong( void ) const { return &helEcPos.longitude; }
00124 
00128     const dms* helEcLat( void ) const { return &helEcPos.latitude; }
00129 
00133     void setHelEcLong( dms elong ) { helEcPos.longitude = elong; }
00134 
00139     void setHelEcLong( double elong ) { helEcPos.longitude.setD( elong ); }
00140 
00144     void setHelEcLat( dms elat ) { helEcPos.latitude = elat; }
00145 
00150     void setHelEcLat( double elat ) { helEcPos.latitude.setD( elat ); }
00151 
00155     virtual bool loadData() = 0;
00156 
00160     void EclipticToEquatorial( const dms *Obliquity );
00161 
00165     void EquatorialToEcliptic( const dms *Obliquity );
00166 
00169     QImage* image( void ) { return &Image; }
00170 
00173     QImage* image0( void ) { return &Image0; }
00174 
00177     double rsun( void ) const { return ep.radius; }
00178 
00182     void setRsun( double r ) { ep.radius = r; }
00183 
00186     double rearth() const { return Rearth; }
00187 
00191     void setRearth( double r ) { Rearth = r; }
00192 
00196     void setRearth( const KSPlanetBase *Earth );
00197 
00204     virtual void updateCoords( KSNumbers *num, bool includePlanets=true, const dms *lat=0, const dms *LST=0 );
00205 
00213     void findPosition( const KSNumbers *num, const dms *lat=0, const dms *LST=0, const KSPlanetBase *Earth = 0 );
00214 
00217         virtual double pa() const { return PositionAngle; }
00218 
00222         void setPA( double p ) { PositionAngle = p; }
00223 
00226         double angSize() const { return AngularSize; }
00227 
00231     void setAngularSize( double size ) { AngularSize = size; }
00232 
00235         double physicalSize() const { return PhysicalSize; }
00236 
00240     void setPhysicalSize( double size ) { PhysicalSize = size; }
00241 
00244     bool isMajorPlanet() const;
00245 
00248     bool hasTrail() const { return ( Trail.count() > 0 ); }
00249 
00252         QPtrList<SkyPoint>* trail() { return &Trail; }
00253 
00256         void addToTrail() { Trail.append( new SkyPoint( ra(), dec() ) ); }
00257 
00260         void clipTrail() { Trail.removeFirst(); }
00261 
00264         void clearTrail() { Trail.clear(); }
00265 
00268         void updateTrail( dms *LST, const dms *lat );
00269 
00273     void rotateImage( double imageAngle );
00274 
00279     void scaleRotateImage( int scale, double imageAngle );
00280 
00286     virtual void showPopupMenu( KSPopupMenu *pmenu, QPoint pos ) { pmenu->createPlanetMenu( this ); pmenu->popup( pos ); }
00287 
00288 protected:
00289     virtual bool loadData(QString n) {
00290         kdDebug() << "didn't reimplement for " << n << endl; return false;
00291     }
00292 
00301     virtual bool findGeocentricPosition( const KSNumbers *num, const KSPlanetBase *Earth=NULL ) = 0;
00302 
00306     void findPA( const KSNumbers *num );
00307 
00308     // Geocentric ecliptic position, but distance to the Sun
00309     EclipticPosition ep;
00310 
00311     // Heliocentric ecliptic position referred to the equinox of the epoch 
00312     // as obtained from VSOP.
00313     EclipticPosition helEcPos;
00314     QPtrList<SkyPoint> Trail;
00315     double  Rearth;
00316 
00317 private:
00326     void localizeCoords( const KSNumbers *num, const dms *lat, const dms *LST );
00327 
00328     /* Computes the visual magnitude for the major planets. 
00329      * @param num pointer to a ksnumbers object. Needed for the saturn rings contribution to 
00330      *        saturn magnitude.
00331      * @param Earth pointer to an Earth object. Needed to know the distance between the Earth and the
00332      *        Sun.
00333      */
00334     void findMagnitude(const KSNumbers *num);
00335 
00336     QImage Image0, Image;
00337     double PositionAngle, ImageAngle, AngularSize, PhysicalSize;
00338     KStarsData *data;
00339 };
00340 
00341 #endif

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal