moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / planetcatalog.h
blobaa56e34af1ca6ecdbfff39e0d4a756c0bbb82594
1 /***************************************************************************
2 planetcatalog.h - description
3 -------------------
4 begin : Mon Feb 18 2002
5 copyright : (C) 2002 by Mark Hollomon
6 email : mhh@mindspring.com
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef PLANETCATALOG_H
19 #define PLANETCATALOG_H
21 /**@class PlanetCatalog
22 *This class contains a QPtrList of the eight major planets, as well as pointers
23 *to objects representing the Earth and Sun. Note that the Sun also exists
24 *in the QPtrList, the external pointer is just for convenience.
25 *There are methods to search
26 *the collection by name, identify if a given object pointer is a planet,
27 *find the coordinates of a planet, and find the planet closest to a given
28 *SkyPoint.
29 *@short the collection of planet objects.
30 *@author Mark Hollomon
31 *@version 1.0
34 #include <qglobal.h>
35 #include <qobject.h>
36 #include <qptrlist.h>
38 class QString;
39 class KStarsData;
40 class KSNumbers;
41 class KSPlanetBase;
42 class KSPlanet;
43 class KSSun;
44 class SkyPoint;
45 class SkyObject;
46 class ObjectNameList;
47 class dms;
49 class PlanetCatalog : public QObject {
50 Q_OBJECT
52 public:
53 /**Constructor. */
54 PlanetCatalog(KStarsData *dat);
56 /**Destructor. Delete the Earth object (all others auto-deleted by QPtrList)*/
57 ~PlanetCatalog();
59 /**Loads all planetary data from files on disk into the appropriate objects. */
60 bool initialize();
62 /**Add pointers to the planetary objects to the ObjNames list.
63 *@p ObjNames the list of all named objects to which we will add the planets.
65 void addObject( ObjectNameList &ObjNames ) const;
67 /**Determine the coordinates for all of the planets
68 *@param num pointer to a ksnumbers object for the target date/time
69 *@param lat pointer to the geographic latitude
70 *@param LST pointer to the local sidereal time
72 void findPosition( const KSNumbers *num, const dms *lat, const dms *LST );
74 /**@return pointer to the Sun. */
75 const KSSun *planetSun() const { return Sun; };
77 /**@return pointer to the Earth. (must not be const because we call findPosition on it in KSPlanetBase::updateCoords() )*/
78 KSPlanet *earth() { return Earth; };
80 /**Compute the present Horizontal coordinates of all planets.
81 *@p LST pointer to the current local sidereal time
82 *@p lat pointer to the current geographic latitude
84 void EquatorialToHorizontal( dms *LST, const dms *lat );
86 /**@return true if the SkyObject argument is a planet.
87 *@p so pointer to the SkyObject to be tested
89 bool isPlanet(SkyObject *so) const;
91 /**@return a pointer to the KSPlanetBase of the planet named in the argument.
92 *@p n the name of the planet to point to
93 *@note if no planet with this name is found, return the NULL pointer.
95 KSPlanetBase *findByName( const QString n) const;
97 /**@return a pointer to the planet closest to the given SkyPoint
98 *(within a maximum angular search radius)
99 *@p p the Sky point to find a planet near
100 *@p r the maximum angular search radius
102 SkyObject *findClosest(const SkyPoint *p, double &r) const;
104 private:
105 QPtrList<KSPlanetBase> planets;
106 KSPlanet *Earth;
107 KSSun *Sun;
108 KStarsData *kd;
111 #endif