Stellarium 0.14.3
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;
108  virtual QString getType(void) const { return "MeteorShower"; }
109  virtual QString getEnglishName(void) const { return m_designation.trimmed(); }
110  virtual QString getNameI18n(void) const { return q_(m_designation.trimmed()); }
111  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const { return m_position; }
112  virtual float getSelectPriority(const StelCore*) const { return -4.0; }
113  virtual Vec3f getInfoColor(void) const;
114  virtual double getAngularSize(const StelCore*) const { return 0.001; }
115 
116 private:
117  MeteorShowersMgr* m_mgr;
118  Status m_status;
119 
120  // data from catalog
121  QString m_showerID;
122  QString m_designation;
123  QList<Activity> m_activities;
124  int m_speed;
125  float m_rAlphaPeak;
126  float m_rDeltaPeak;
127  float m_driftAlpha;
128  float m_driftDelta;
129  QString m_parentObj;
130  float m_pidx;
131  QList<Meteor::ColorPair> m_colors;
132 
133  //current information
134  Vec3d m_position;
135  double m_radiantAlpha;
136  double m_radiantDelta;
137  Activity m_activity;
138 
139  QList<MeteorObj*> m_activeMeteors;
140 
142  void drawRadiant(StelCore* core);
143 
145  void drawMeteors(StelCore* core);
146 
149  int calculateZHR(const double& currentJD);
150 
154  QString getSolarLongitude(QDate date) const;
155 };
156 
157 #endif /*_METEORSHOWER_HPP_*/
QDate finish
Initial date of activity.
QDate peak
Last date of activity.
Status getStatus()
Gets the current meteor shower status.
~MeteorShower()
Destructor.
int getZHR()
Gets the current ZHR.
Main class of the Meteor Showers plugin, inherits from StelObjectModule.
int zhr
The catalog year (0 for generic)
#define q_(str)
Activity hasConfirmedShower(QDate date, bool &found) const
Checks if we have confirmed data for a given date.
QDate getPeak()
Gets the peak.
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.
void draw(StelCore *core)
Draw.
MeteorShower(MeteorShowersMgr *mgr, const QVariantMap &map)
Constructor.
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.
QDate start
The ZHR range when it's variable.
void update(StelCore *core, double deltaTime)
Update.