summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/deepskyobject.h
blob: e1712c7fa504554629b00dbfdba01912ef0bd6cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/***************************************************************************
                          deepskyobject.h  -  K Desktop Planetarium
                             -------------------
    begin                : Sun Feb 11 2001
    copyright            : (C) 2001 by Jason Harris
    email                : jharris@30doradus.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef DEEPSKYOBJECT_H
#define DEEPSKYOBJECT_H

#include <tqpoint.h>

#include "skyobject.h"
#include "dms.h"

/**@class DeepSkyObject
	*Provides all necessary information about a deep-sky object:
	*data inherited from SkyObject (coordinates, type, magnitude, 
	*2 names, and URLs) and data specific to DeepSkyObjects
	*(common name, angular size, position angle, Image, catalog)
	*@short Information about a "dep-sky" object; i.e., anything 
	*that's not a solar system body or a star.
	*@author Jason Harris
	*@version 1.0
	*/

class QPainter;
class QImage;
class QString;
class KSPopupMenu;

class DeepSkyObject : public SkyObject {
public:
/**Constructor.  Create DeepSkyObject with data according to arguments.
	*@param t Type of object
	*@param r catalog Right Ascension
	*@param d catalog Declination
	*@param m magnitude (brightness)
	*@param n Primary name
	*@param n2 Secondary name
	*@param lname Long name (common name)
	*@param cat catalog ID
	*@param a major axis (arcminutes)
	*@param b minor axis (arcminutes)
	*@param pa position angle (degrees)
	*@param pgc PGC catalog number
	*@param ugc UGC catalog number
	*/
	DeepSkyObject( int t=SkyObject::STAR, dms r=dms(0.0), dms d=dms(0.0), 
			float m=0.0, TQString n="unnamed", TQString n2="", 
			TQString lname="", TQString cat="", 
			float a=0.0, float b=0.0, double pa=0.0, 
			int pgc=0, int ugc=0 );

/**Constructor.  Create DeepSkyObject with data according to arguments.  
	*Differs from above function only in data type of RA and Dec.
	*@param t Type of object
	*@param r catalog Right Ascension
	*@param d catalog Declination
	*@param m magnitude (brightness)
	*@param n Primary name
	*@param n2 Secondary name
	*@param lname Long name (common name)
	*@param cat catalog ID
	*@param a major axis (arcminutes)
	*@param b minor axis (arcminutes)
	*@param pa position angle (degrees)
	*@param pgc PGC catalog number
	*@param ugc UGC catalog number
	*/
	DeepSkyObject( int t, double r, double d, float m=0.0,
			TQString n="unnamed", TQString n2="", TQString lname="", 
			TQString cat="", float a=0.0, float b=0.0,
			double pa=0.0, int pgc=0, int ugc=0 );

/**Copy constructor.
	*@param o SkyObject from which to copy data
	*/
	DeepSkyObject( DeepSkyObject &o );

/**
	*Destructor 
	*/
	~DeepSkyObject() { if ( Image ) { deleteImage(); } }

/**@enum CATALOG
	*The catalog ID of the DeepSkyObject.
	*/
	enum CATALOG { CAT_MESSIER=0, CAT_NGC=1, CAT_IC=2, CAT_UNKNOWN };

/**@return a TQString identifying the object's primary catalog.
	*@warning this is only used for deep-sky objects.  Possible values are:
	*- "M" for Messier catalog
	*- "NGC" for NGC catalog
	*- "IC" for IC catalog
	*- empty string is presumed to be an object in a custom catalog
	*/
	TQString catalog( void ) const;

/**Set the internal Catalog value according to the QString
	*argument:
	* "M"   : CAT_MESSIER
	* "NGC" : CAT_NGC
	* "IC"  : CAT_IC
	*/
	void setCatalog( const TQString &s );

/**@return the object's major axis length, in arcminute.
	*/
	float a( void ) const { return MajorAxis; }

/**@return the object's minor axis length, in arcminutes.
	*/
	float b( void ) const { return MinorAxis; }

/**@return the object's aspect ratio (MinorAxis/MajorAxis).  Returns 1.0
	*if the object's MinorAxis=0.0.
	*/
	float e( void ) const;

/**@return the object's position angle, meausred clockwise from North.
	*/
	virtual double pa() const { return PositionAngle; }

/**@return the object's UGC catalog number.  Return 0 if the object is not in UGC.
	*/
	int ugc( void ) const { return UGC; }

/**@return the object's PGC catalog number.  Return 0 if the object is not in PGC.
	*/
	int pgc( void ) const { return PGC; }

/**Read in this object's image from disk, unless it already exists in memory.
	*@returns pointer to newly-created image.
	*/
	TQImage *readImage();

/**@return pointer to the object's inline image.  If it is currently
	*a null pointer, it loads the image from disk.
	*/
	TQImage *image() const { return Image; }

/**delete the Image pointer, and set it to 0.
	*/
	void deleteImage();

/**@return true if the object is in the Messier catalog
	*/
	bool isCatalogM() const { return (Catalog == CAT_MESSIER); }

/**@return true if the object is in the NGC catalog
	*/
	bool isCatalogNGC() const { return (Catalog == CAT_NGC); }

/**@return true if the object is in the IC catalog
	*/
	bool isCatalogIC() const { return (Catalog == CAT_IC); }

/**@return true if the object is not in a catalog
	*/
	bool isCatalogNone() const { return (Catalog == CAT_UNKNOWN); }

/**Draw the object's symbol on the map
	*/
	void drawSymbol( TQPainter &psky, int x, int y, double PositionAngle, double zoom, double scale=1.0 );

/**Draw the Object's image on the map
	*/
	void drawImage( TQPainter &psky, int x, int y, double PositionAngle, double zoom, double scale=1.0 );

/**Show Deep-sky object popup menu.  Overloaded from virtual 
	*SkyObject::showPopupMenu()
	*@param pmenu pointer to the KSPopupMenu object
	*@param pos QPojnt holding the x,y coordinates for the menu
	*/
	virtual void showPopupMenu( KSPopupMenu *pmenu, TQPoint pos ) { pmenu->createDeepSkyObjectMenu( this ); pmenu->popup( pos ); }

private:
	unsigned char Catalog; 
        double PositionAngle;
	int UGC, PGC;
	float MajorAxis, MinorAxis;
	TQImage *Image;
};

#endif