Stellarium 0.15.2
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:
41  enum Status {
42  INVALID, // not initialized properly
43  UNDEFINED, // it's loaded but with 'activity' undefined
44  INACTIVE, // inactive radiant
45  ACTIVE_CONFIRMED, // active radiant - confirmed data
46  ACTIVE_GENERIC // active radiant - generic data
47  };
48 
50  typedef struct
51  {
52  int year;
53  int zhr;
54  QList<int> variable;
55  QDate start;
56  QDate finish;
57  QDate peak;
58  } Activity;
59 
62  MeteorShower(MeteorShowersMgr* mgr, const QVariantMap& map);
63 
65  ~MeteorShower();
66 
69  void update(StelCore *core, double deltaTime);
70 
72  void draw(StelCore *core);
73 
77  Activity hasGenericShower(QDate date, bool &found) const;
78 
82  Activity hasConfirmedShower(QDate date, bool &found) const;
83 
86  bool enabled() const;
87 
90  QString getDesignation() const;
91 
94  Status getStatus() { return m_status; }
95 
98  QDate getPeak() { return m_activity.peak; }
99 
102  int getZHR() { return m_activity.zhr; }
103 
104  //
105  // Methods defined in StelObject class
106  //
107  virtual QString getInfoString(const StelCore* core, const InfoStringGroup& flags) const;
109  // TODO: Describe the fields!
117  virtual QVariantMap getInfoMap(const StelCore *core) const;
118  virtual QString getType(void) const { return "MeteorShower"; }
119  virtual QString getEnglishName(void) const { return m_designation.trimmed(); }
120  virtual QString getNameI18n(void) const { return q_(m_designation.trimmed()); }
121  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const { return m_position; }
122  virtual float getSelectPriority(const StelCore*) const { return -4.0; }
123  virtual Vec3f getInfoColor(void) const;
124  virtual double getAngularSize(const StelCore*) const { return 0.001; }
125 
126 private:
127  MeteorShowersMgr* m_mgr;
128  Status m_status;
129 
130  // data from catalog
131  QString m_showerID;
132  QString m_designation;
133  QList<Activity> m_activities;
134  int m_speed;
135  float m_rAlphaPeak;
136  float m_rDeltaPeak;
137  float m_driftAlpha;
138  float m_driftDelta;
139  QString m_parentObj;
140  float m_pidx;
141  QList<Meteor::ColorPair> m_colors;
142 
143  //current information
144  Vec3d m_position;
145  double m_radiantAlpha;
146  double m_radiantDelta;
147  Activity m_activity;
148 
149  QList<MeteorObj*> m_activeMeteors;
150 
152  void drawRadiant(StelCore* core);
153 
155  void drawMeteors(StelCore* core);
156 
159  int calculateZHR(const double& currentJD);
160 
164  static QString getSolarLongitude(QDate date);
165 };
166 
167 #endif /*_METEORSHOWER_HPP_*/
virtual QString getEnglishName(void) const
Return object&#39;s name in english.
QDate finish
Initial date of activity.
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 StelObjectModule.
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.