1 /***************************************************************************
2 deepskyobject.h - K Desktop Planetarium
4 begin : Sun Feb 11 2001
5 copyright : (C) 2001 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
18 #ifndef DEEPSKYOBJECT_H
19 #define DEEPSKYOBJECT_H
23 #include "skyobject.h"
26 /**@class DeepSkyObject
27 *Provides all necessary information about a deep-sky object:
28 *data inherited from SkyObject (coordinates, type, magnitude,
29 *2 names, and URLs) and data specific to DeepSkyObjects
30 *(common name, angular size, position angle, Image, catalog)
31 *@short Information about a "dep-sky" object; i.e., anything
32 *that's not a solar system body or a star.
42 class DeepSkyObject
: public SkyObject
{
44 /**Constructor. Create DeepSkyObject with data according to arguments.
45 *@param t Type of object
46 *@param r catalog Right Ascension
47 *@param d catalog Declination
48 *@param m magnitude (brightness)
49 *@param n Primary name
50 *@param n2 Secondary name
51 *@param lname Long name (common name)
52 *@param cat catalog ID
53 *@param a major axis (arcminutes)
54 *@param b minor axis (arcminutes)
55 *@param pa position angle (degrees)
56 *@param pgc PGC catalog number
57 *@param ugc UGC catalog number
59 DeepSkyObject( int t
=SkyObject::STAR
, dms r
=dms(0.0), dms d
=dms(0.0),
60 float m
=0.0, QString n
="unnamed", QString n2
="",
61 QString lname
="", QString cat
="",
62 float a
=0.0, float b
=0.0, double pa
=0.0,
63 int pgc
=0, int ugc
=0 );
65 /**Constructor. Create DeepSkyObject with data according to arguments.
66 *Differs from above function only in data type of RA and Dec.
67 *@param t Type of object
68 *@param r catalog Right Ascension
69 *@param d catalog Declination
70 *@param m magnitude (brightness)
71 *@param n Primary name
72 *@param n2 Secondary name
73 *@param lname Long name (common name)
74 *@param cat catalog ID
75 *@param a major axis (arcminutes)
76 *@param b minor axis (arcminutes)
77 *@param pa position angle (degrees)
78 *@param pgc PGC catalog number
79 *@param ugc UGC catalog number
81 DeepSkyObject( int t
, double r
, double d
, float m
=0.0,
82 QString n
="unnamed", QString n2
="", QString lname
="",
83 QString cat
="", float a
=0.0, float b
=0.0,
84 double pa
=0.0, int pgc
=0, int ugc
=0 );
87 *@param o SkyObject from which to copy data
89 DeepSkyObject( DeepSkyObject
&o
);
94 ~DeepSkyObject() { if ( Image
) { deleteImage(); } }
97 *The catalog ID of the DeepSkyObject.
99 enum CATALOG
{ CAT_MESSIER
=0, CAT_NGC
=1, CAT_IC
=2, CAT_UNKNOWN
};
101 /**@return a QString identifying the object's primary catalog.
102 *@warning this is only used for deep-sky objects. Possible values are:
103 *- "M" for Messier catalog
104 *- "NGC" for NGC catalog
105 *- "IC" for IC catalog
106 *- empty string is presumed to be an object in a custom catalog
108 QString
catalog( void ) const;
110 /**Set the internal Catalog value according to the QString
116 void setCatalog( const QString
&s
);
118 /**@return the object's major axis length, in arcminute.
120 float a( void ) const { return MajorAxis
; }
122 /**@return the object's minor axis length, in arcminutes.
124 float b( void ) const { return MinorAxis
; }
126 /**@return the object's aspect ratio (MinorAxis/MajorAxis). Returns 1.0
127 *if the object's MinorAxis=0.0.
129 float e( void ) const;
131 /**@return the object's position angle, meausred clockwise from North.
133 virtual double pa() const { return PositionAngle
; }
135 /**@return the object's UGC catalog number. Return 0 if the object is not in UGC.
137 int ugc( void ) const { return UGC
; }
139 /**@return the object's PGC catalog number. Return 0 if the object is not in PGC.
141 int pgc( void ) const { return PGC
; }
143 /**Read in this object's image from disk, unless it already exists in memory.
144 *@returns pointer to newly-created image.
148 /**@return pointer to the object's inline image. If it is currently
149 *a null pointer, it loads the image from disk.
151 QImage
*image() const { return Image
; }
153 /**delete the Image pointer, and set it to 0.
157 /**@return true if the object is in the Messier catalog
159 bool isCatalogM() const { return (Catalog
== CAT_MESSIER
); }
161 /**@return true if the object is in the NGC catalog
163 bool isCatalogNGC() const { return (Catalog
== CAT_NGC
); }
165 /**@return true if the object is in the IC catalog
167 bool isCatalogIC() const { return (Catalog
== CAT_IC
); }
169 /**@return true if the object is not in a catalog
171 bool isCatalogNone() const { return (Catalog
== CAT_UNKNOWN
); }
173 /**Draw the object's symbol on the map
175 void drawSymbol( QPainter
&psky
, int x
, int y
, double PositionAngle
, double zoom
, double scale
=1.0 );
177 /**Draw the Object's image on the map
179 void drawImage( QPainter
&psky
, int x
, int y
, double PositionAngle
, double zoom
, double scale
=1.0 );
181 /**Show Deep-sky object popup menu. Overloaded from virtual
182 *SkyObject::showPopupMenu()
183 *@param pmenu pointer to the KSPopupMenu object
184 *@param pos QPojnt holding the x,y coordinates for the menu
186 virtual void showPopupMenu( KSPopupMenu
*pmenu
, QPoint pos
) { pmenu
->createDeepSkyObjectMenu( this ); pmenu
->popup( pos
); }
189 unsigned char Catalog
;
190 double PositionAngle
;
192 float MajorAxis
, MinorAxis
;