1 /*
2  * Copyright (C) 2011, 2018 Alexander Wolf
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
17  */
18 
19 #ifndef QUASAR_HPP
20 #define QUASAR_HPP
21 
22 #include <QVariant>
23 #include <QString>
24 #include <QStringList>
25 #include <QFont>
26 #include <QList>
27 #include <QDateTime>
28 
29 #include "StelObject.hpp"
30 #include "StelTextureTypes.hpp"
31 #include "StelFader.hpp"
32 
33 class StelPainter;
34 
35 //! @class Quasar
36 //! A Quasar object represents one Quasar on the sky.
37 //! Details about the Quasars are passed using a QVariant which contains
38 //! a map of data from the json file.
39 //! @ingroup quasars
40 
41 class Quasar : public StelObject
42 {
43 	friend class Quasars;
44 public:
45 	static const QString QUASAR_TYPE;
46 
47 	//! @param id The official designation for a quasar, e.g. "RXS J00066+4342"
48 	Quasar(const QVariantMap& map);
49 	~Quasar();
50 
51 	//! Get a QVariantMap which describes the Quasar.  Could be used to create a duplicate.
52 	//! - designation
53 	//! - Vmag
54 	//! - Amag
55 	//! - bV
56 	//! - RA
57 	//! - DE
58 	//! - z
59 	//! - f6
60 	//! - f20
61 	//! - sclass
62 	QVariantMap getMap(void) const;
63 
getType(void) const64 	virtual QString getType(void) const
65 	{
66 		return QUASAR_TYPE;
67 	}
68 
getID(void) const69 	virtual QString getID(void) const
70 	{
71 		return designation;
72 	}
73 
74 	virtual float getSelectPriority(const StelCore *core) const;
75 
76 	//! Get an HTML string to describe the object
77 	//! @param core A pointer to the core
78 	//! @flags a set of flags with information types to include.
79 	virtual QString getInfoString(const StelCore* core, const InfoStringGroup& flags) const;
80 	//! Return a map like StelObject::getInfoMap(), but with a few extra tags also available in getMap().
81 	// TODO: Describe the fields.
82 	//! - amag
83 	//! - bV
84 	//! - redshift
85 	virtual QVariantMap getInfoMap(const StelCore *core) const;
86 	virtual Vec3f getInfoColor(void) const;
87 	virtual Vec3d getJ2000EquatorialPos(const StelCore* core) const;
88         virtual float getVMagnitude(const StelCore* core) const;
89 	virtual double getAngularSize(const StelCore* core) const;
getNameI18n(void) const90 	virtual QString getNameI18n(void) const
91 	{
92 		return designation;
93 	}
getEnglishName(void) const94 	virtual QString getEnglishName(void) const
95 	{
96 		return designation;
97 	}
98 
99 	void update(double deltaTime);
100 
101 private:
102 	bool initialized;
103 	float shiftVisibility;
104 
105 	Vec3d XYZ;                         // holds J2000 position
106 
107 	static StelTextureSP hintTexture;
108 	static StelTextureSP markerTexture;
109 	static bool distributionMode;
110 	static bool useMarkers;
111 	static Vec3f markerColor;
112 
113 	void draw(StelCore* core, StelPainter& painter);
114 	//! Calculate a color of quasar
115 	//! @param b_v value of B-V color index
116 	unsigned char BvToColorIndex(float b_v);
117 
118 	// Quasar
119 	QString designation;		//! The ID of the quasar
120 	float VMagnitude;		//! Visual magnitude
121 	float AMagnitude;		//! Absolute magnitude
122 	float bV;			//! B-V color index
123 	double qRA;			//! R.A. J2000 for the quasar
124 	double qDE;			//! Dec. J2000 for the quasar
125 	float redshift;			//! Distance to quasar (redshift)
126 	float f6;			//! Radio flux density around 5GHz (6cm)
127 	float f20;			//! Radio flux density around 1.4GHz (21cm)
128 	QString sclass;			//! Spectrum classification
129 
130 	LinearFader labelsFader;
131 };
132 
133 #endif // QUASAR_HPP
134