Stellarium  0.16.1
MeteorShower.hpp
1 /*
2  * Stellarium: Meteor Showers Plug-in
3  * Copyright (C) 2013-2015 Marcos Cardinot
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _METEORSHOWER_HPP_
21 #define _METEORSHOWER_HPP_
22 
23 #include "MeteorObj.hpp"
24 #include "MeteorShowersMgr.hpp"
25 #include "StelFader.hpp"
26 #include "StelObject.hpp"
27 #include "StelPainter.hpp"
28 #include "StelTextureTypes.hpp"
29 #include "StelTranslator.hpp"
30 
36 
37 class MeteorShower : public StelObject
38 {
39 public:
40  static const QString METEORSHOWER_TYPE;
41 
43  enum Status {
44  INVALID, // not initialized properly
45  UNDEFINED, // it's loaded but with 'activity' undefined
46  INACTIVE, // inactive radiant
47  ACTIVE_CONFIRMED, // active radiant - confirmed data
48  ACTIVE_GENERIC // active radiant - generic data
49  };
50 
52  typedef struct
53  {
54  int year;
55  int zhr;
56  QList<int> variable;
57  QDate start;
58  QDate finish;
59  QDate peak;
60  } Activity;
61 
64  MeteorShower(MeteorShowersMgr* mgr, const QVariantMap& map);
65 
67  ~MeteorShower();
68 
71  void update(StelCore *core, double deltaTime);
72 
74  void draw(StelCore *core);
75 
79  Activity hasGenericShower(QDate date, bool &found) const;
80 
84  Activity hasConfirmedShower(QDate date, bool &found) const;
85 
88  bool enabled() const;
89 
92  QString getDesignation() const;
93 
96  Status getStatus() { return m_status; }
97 
100  QDate getPeak() { return m_activity.peak; }
101 
104  int getZHR() { return m_activity.zhr; }
105 
106  //
107  // Methods defined in StelObject class
108  //
109  virtual QString getInfoString(const StelCore* core, const InfoStringGroup& flags) const;
110 
112  // TODO: Describe the fields!
120  virtual QVariantMap getInfoMap(const StelCore *core) const;
121  virtual QString getType(void) const { return METEORSHOWER_TYPE; }
122  virtual QString getID(void) const { return m_showerID; }
123  virtual QString getEnglishName(void) const { return m_designation.trimmed(); }
124  virtual QString getNameI18n(void) const { return q_(m_designation.trimmed()); }
125  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const { return m_position; }
126  virtual float getSelectPriority(const StelCore*) const { return -4.0; }
127  virtual Vec3f getInfoColor(void) const;
128  virtual double getAngularSize(const StelCore*) const { return 0.001; }
129 
130 private:
131  MeteorShowersMgr* m_mgr;
132  Status m_status;
133 
134  // data from catalog
135  QString m_showerID;
136  QString m_designation;
137  QList<Activity> m_activities;
138  int m_speed;
139  float m_rAlphaPeak;
140  float m_rDeltaPeak;
141  float m_driftAlpha;
142  float m_driftDelta;
143  QString m_parentObj;
144  float m_pidx;
145  QList<Meteor::ColorPair> m_colors;
146 
147  //current information
148  Vec3d m_position;
149  double m_radiantAlpha;
150  double m_radiantDelta;
151  Activity m_activity;
152 
153  QList<MeteorObj*> m_activeMeteors;
154 
156  void drawRadiant(StelCore* core);
157 
159  void drawMeteors(StelCore* core);
160 
163  int calculateZHR(const double& currentJD);
164 
168  static QString getSolarLongitude(QDate date);
169 };
170 
171 #endif /*_METEORSHOWER_HPP_*/
virtual QString getEnglishName(void) const
Return object&#39;s name in english.
QDate finish
Initial date of activity.
virtual QString getID(void) const
Returns a unique identifier for this object.
The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
Definition: StelObject.hpp:36
QDate peak
Last date of activity.
Define the StelTextureSP type.
Status getStatus()
Gets the current meteor shower status.
~MeteorShower()
Destructor.
int getZHR()
Gets the current ZHR.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
Main class of the Meteor Showers plugin, inherits from StelModule.
int zhr
The catalog year (0 for generic)
#define q_(str)
Return the gettext translated english text str using the current global translator.
Activity hasConfirmedShower(QDate date, bool &found) const
Checks if we have confirmed data for a given date.
QDate getPeak()
Gets the peak.
Define some translation macros.
QString getDesignation() const
Gets the meteor shower id //!
A MeteorShower object represents one meteor shower on the sky.
QList< int > variable
The ZHR on peak.
virtual Vec3d getJ2000EquatorialPos(const StelCore *) const
Get observer-centered equatorial coordinates at equinox J2000.
void draw(StelCore *core)
Draw.
MeteorShower(MeteorShowersMgr *mgr, const QVariantMap &map)
Constructor.
virtual float getSelectPriority(const StelCore *) const
Return a priority value which is used to discriminate objects by priority As for magnitudes, the lower is the higher priority.
virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
Write I18n information about the object in QString.
bool enabled() const
Checks if this meteor shower is being displayed or not.
Activity hasGenericShower(QDate date, bool &found) const
Checks if we have generic data for a given date.
virtual QString getNameI18n(void) const
Return translated object&#39;s name.
virtual Vec3f getInfoColor(void) const
Get a color used to display info about the object.
QDate start
The ZHR range when it&#39;s variable.
virtual QVariantMap getInfoMap(const StelCore *core) const
Return a map like StelObject, but with a few extra tags:
virtual double getAngularSize(const StelCore *) const
Return the angular radius of a circle containing the object as seen from the observer with the circle...
virtual QString getType(void) const
Return object&#39;s type. It should be the name of the class.
void update(StelCore *core, double deltaTime)
Update.