summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/starobject.h
blob: 2d0dd4b1f19e7dc7f94b547e91a0e7187e51634e (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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/***************************************************************************
                          starobject.h  -  Trinity Desktop Planetarium
                             -------------------
    begin                : Tue Sep 18 2001
    copyright            : (C) 2001 by Thomas Kabelmann
    email                : tk78@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 STAROBJECT_H
#define STAROBJECT_H

#include <tqpoint.h>

#include "skyobject.h"

class TQPainter;
class TQString;
class KSPopupMenu;

/**@class StarObject 
	*This is a subclass of SkyObject.  It adds the Spectral type, and flags
	*for variability and multiplicity.
	*For stars, the primary name (n) is the latin name (e.g., "Betelgeuse").  The
	*secondary name (n2) is the genetive name (e.g., "alpha Orionis").
	*@short subclass of SkyObject specialized for stars.
	*@author Thomas Kabelmann
	*@version 1.0
	*/

class StarObject : public SkyObject {
	public:

/**
	*Copy constructor
	*/
		StarObject(StarObject & o);

/**
	*Constructor.  Sets sky coordinates, magnitude, latin name, genetive name, and
	*spectral type.
	*@param r Right Ascension
	*@param d Declination
	*@param m magnitude
	*@param n common name
	*@param n2 genetive name
	*@param sptype Spectral Type
	*@param pmra Proper motion in RA direction [mas/yr]
	*@param pmdec Proper motion in Dec direction [mas/yr]
	*@param par Parallax angle [mas]
	*@param mult Multiplicity flag (false=dingle star; true=multiple star)
	*@param var Variability flag (true if star is a known periodic variable)
	*/
	StarObject( dms r=dms(0.0), dms d=dms(0.0), float m=0.0, TQString n="",
				TQString n2="", TQString sptype="--", double pmra=0.0, double pmdec=0.0,
				double par=0.0, bool mult=false, bool var=false );
/**
	*Constructor.  Sets sky coordinates, magnitude, latin name, genetive name, and
	*spectral type.  Differs from above function only in data type of RA and Dec.
	*@param r Right Ascension
	*@param d Declination
	*@param m magnitude
	*@param n common name
	*@param n2 genetive name
	*@param sptype Spectral Type
	*@param pmra Proper motion in RA direction [mas/yr]
	*@param pmdec Proper motion in Dec direction [mas/yr]
	*@param par Parallax angle [mas]
	*@param mult Multiplicity flag (false=dingle star; true=multiple star)
	*@param var Variability flag (true if star is a known periodic variable)
	*/
	StarObject( double r, double d, float m=0.0, TQString n="",
				TQString n2="", TQString sptype="--", double pmra=0.0, double pmdec=0.0,
				double par=0.0, bool mult=false, bool var=false );

/**
	*Empty destructor.
	*/
	~StarObject() {}

/**
	*If star is unnamed return "star" otherwise return the name
	*/
	virtual TQString name( void ) const { return hasName() ? *Name : starString;}

/**
	*If star is unnamed return "star" otherwise return the longname
	*/
	virtual TQString longname( void ) const { return hasLongName() ? *LongName : starString; }
/**
	*Returns first character of Spectral Type string, which is used to
	*select the temperature-color of the star.
	*@return first character of Spectral Type string
	*/
	TQChar color( void ) const { return SpType.at(0); }

/**
	*Returns entire spectral type string
	*@return Spectral Type string
	*/
	TQString sptype( void ) const;

/**
	*Returns the genetive name of the star.
	*@return genetive name of the star
	*/
	TQString gname( bool useGreekChars=true ) const;

/**
	*Returns the greek letter portion of the star's genetive name.
	*Returns empty string if star has no genetive name defined.
	*@return greek letter portion of genetive name
	*/
	TQString greekLetter( bool useGreekChars=true ) const;

/**@return the genitive form of the star's constellation.
	*/
	TQString constell( void ) const;

/**Determine the current coordinates (RA, Dec) from the catalog
	*coordinates (RA0, Dec0), accounting for both precession and nutation.
	*@param num pointer to KSNumbers object containing current values of
	*time-dependent variables.
	*@param includePlanets does nothing in this implementation (see KSPlanetBase::updateCoords()).
	*@param lat does nothing in this implementation (see KSPlanetBase::updateCoords()).
	*@param LST does nothing in this implementation (see KSPlanetBase::updateCoords()).
	*/
	virtual void updateCoords( KSNumbers *num, bool includePlanets=true, const dms *lat=0, const dms *LST=0 );

/**@short Set the Ra and Dec components of the star's proper motion, in milliarcsec/year.
	*Note that the RA component is multiplied by cos(dec).
	*@param pmra the new RA propoer motion
	*@param pmdec the new Dec proper motion
	*/
	void setProperMotion( double pmra, double pmdec ) { PM_RA = pmra; PM_Dec = pmdec; }

/**@return the RA component of the star's proper motion, in mas/yr (multiplied by cos(dec))
	*/
	double pmRA() const { return PM_RA; }

/**@return the Dec component of the star's proper motion, in mas/yr
	*/
	double pmDec() const { return PM_Dec; }

/**@short set the star's parallax angle, in milliarcsec
	*/
	void setParallax( double plx ) { Parallax = plx; }

/**@return the star's parallax angle, in milliarcsec
	*/
	double parallax() const { return Parallax; }

/**@return the star's distance from the Sun in parsecs, as computed from the parallax.
	*/
	double distance() const { return 1000./parallax(); }

/**@short set the star's multiplicity flag (i.e., is it a binary or multiple star?)
	*@param m true if binary/multiple star system
	*/
	void setMultiple( bool m ) { Multiplicity = m; }

/**@return whether the star is a binary or multiple starobject
	*/
	bool isMultiple() const { return Multiplicity; }

/**@short set the star's variability flag
	*@param v true if star is variable
	*/
	void setVariable( bool v ) { Variability = v; }

/**@return whether the star is a binary or multiple starobject
	*/
	bool isVariable() const { return Variability; }

//Not using VRange, VPeriod currently (to save memory)
///**@short set the range in brightness covered by the star's variability
//	*@param r the range of brightness, in magnitudes
//	*/
//	void setVRange( double r ) { VRange = r; }
//
///**@return the range in brightness covered by the star's variability, in magnitudes
//	*/
//	double vrange() const { return VRange; }
//
///**@short set the period of the star's brightness variation, in days.
//	*/
//	void setVPeriod( double p ) { VPeriod = p; }
//
///**@return the period of the star's brightness variation, in days.
//	*/
//	double vperiod() const { return VPeriod; }

	void draw( TQPainter &psky, TQPixmap *sky, TQPixmap *starpix, int x, int y, bool drawMultiple=true, double scale=1.0 );

	//overloaded from SkyObject
	void drawLabel( TQPainter &psky, int x, int y, double zoom, bool drawName, bool drawMag, double scale );

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

private:
	TQString SpType;

	double PM_RA, PM_Dec, Parallax;  //, VRange, VPeriod;
	bool Multiplicity, Variability;
};

#endif