MeteorShower.hpp   MeteorShower.hpp 
/* /*
* Stellarium: Meteor Showers Plug-in * Stellarium: Meteor Showers Plug-in
* Copyright (C) 2013 Marcos Cardinot * Copyright (C) 2013-2015 Marcos Cardinot
* Copyright (C) 2011 Alexander Wolf
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _METEORSHOWER_HPP_ #ifndef _METEORSHOWER_HPP_
#define _METEORSHOWER_HPP_ #define _METEORSHOWER_HPP_
#include <QDateTime> #include "MeteorObj.hpp"
#include "MeteorShowersMgr.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelTextureTypes.hpp" #include "StelTextureTypes.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
//! @class MeteorShower //! @class MeteorShower
//! A MeteorShower object represents one meteor shower on the sky. //! A MeteorShower object represents one meteor shower on the sky.
//! Details about the meteor showers are passed using a QVariant which cont ains //! Details about the meteor showers are passed using a QVariant which cont ains
//! a map of data from the json file. //! a map of data from the json file.
//! @ingroup meteorShowers
class MeteorShower : public StelObject class MeteorShower : public StelObject
{ {
friend class MeteorShowers;
public: public:
enum RadiantStatus { //! @enum Meteor Shower status.
INACTIVE, // inactive radiant. enum Status {
ACTIVE_REAL, // active radiant - real data. INVALID, // not initialized properly
ACTIVE_GENERIC // active radiant - generic data. UNDEFINED, // it's loaded but with 'activity' undefin
ed
INACTIVE, // inactive radiant
ACTIVE_CONFIRMED, // active radiant - confirmed data
ACTIVE_GENERIC // active radiant - generic data
}; };
//! @param id The official ID designation for a meteor shower, e.g. //! @struct Activity
"LYR" typedef struct
MeteorShower(const QVariantMap& map); {
int year; //! The catalog year (0 for gener
ic)
int zhr; //! The ZHR on peak
QList<int> variable; //! The ZHR range when it's varia
ble
QDate start; //! Initial date of activity
QDate finish; //! Last date of activity
QDate peak; //! Peak activity
} Activity;
//! Constructor
//! @param map QVariantMap containing all the data about a Meteor Sh
ower.
MeteorShower(MeteorShowersMgr* mgr, const QVariantMap& map);
//! Destructor
~MeteorShower(); ~MeteorShower();
//! Get a QVariantMap which describes the meteor shower. Could be us //! Update
ed to //! @param deltaTime the time increment in seconds since the last ca
//! create a duplicate. ll.
QVariantMap getMap(void); void update(StelCore *core, double deltaTime);
//! Draw
void draw(StelCore *core);
//! Checks if we have generic data for a given date
//! @param date QDate
//! @return Activity
Activity hasGenericShower(QDate date, bool &found) const;
//! Checks if we have confirmed data for a given date
//! @param date QDate
//! @return Activity
Activity hasConfirmedShower(QDate date, bool &found) const;
//! Checks if this meteor shower is being displayed or not
//! @return true if it's being displayed
bool enabled() const;
//! Gets the meteor shower id
//! //! @return designation
QString getDesignation() const;
//! Gets the current meteor shower status
//! @return status
Status getStatus() { return m_status; }
virtual QString getType(void) const //! Gets the peak
{
return "MeteorShower";
}
virtual float getSelectPriority(const StelCore* core) const;
//! Get an HTML string to describe the object
//! @param core A pointer to the core
//! @flags a set of flags with information types to include.
virtual QString getInfoString(const StelCore* core, const InfoString
Group& flags) const;
virtual Vec3f getInfoColor(void) const;
virtual Vec3d getJ2000EquatorialPos(const StelCore*) const
{
return XYZ;
}
virtual double getAngularSize(const StelCore* core) const;
virtual QString getNameI18n(void) const
{
return q_(designation.trimmed());
}
virtual QString getEnglishName(void) const
{
return designation.trimmed();
}
QString getDesignation(void) const;
void update(double deltaTime);
static bool showLabels;
//! Get current activity status of MS
//! @return 0:inactive 1:activeRealData 2:activeGenericData
int getStatus()
{
return status;
}
//! Get peak
//! @return peak //! @return peak
QDateTime getPeak() QDate getPeak() { return m_activity.peak; }
{
return peak;
}
//! Get zhr //! Gets the current ZHR
//! @return ZHR //! @return ZHR
int getZHR() int getZHR() { return m_activity.zhr; }
{
return zhr;
}
//! <colorName, intensity> //
typedef QPair<QString, int> colorPair; // Methods defined in StelObject class
//
virtual QString getInfoString(const StelCore* core, const InfoString
Group& flags) const;
virtual QString getType(void) const { return "MeteorShower"; }
virtual QString getEnglishName(void) const { return m_designation.tr
immed(); }
virtual QString getNameI18n(void) const { return q_(m_designation.tr
immed()); }
virtual Vec3d getJ2000EquatorialPos(const StelCore*) const { return
m_position; }
virtual float getSelectPriority(const StelCore*) const { return -4.0
; }
virtual Vec3f getInfoColor(void) const;
virtual double getAngularSize(const StelCore*) const { return 0.001;
}
private: private:
Vec3d XYZ; //! Cartesian equatorial position MeteorShowersMgr* m_mgr; //! MeteorShowersMgr instance
Vec3d XY; //! Store temporary 2D position Status m_status; //! Meteor shower status
static StelTextureSP radiantTexture; // data from catalog
static bool radiantMarkerEnabled; QString m_showerID; //! The ID of the meteor shower
static bool showActiveRadiantsOnly; QString m_designation; //! The designation of the meteor
shower
QList<Activity> m_activities; //! Activity list
int m_speed; //! Speed of meteors
float m_rAlphaPeak; //! R.A. for radiant of meteor sh
ower on the peak day
float m_rDeltaPeak; //! Dec. for radiant of meteor sh
ower on the peak day
float m_driftAlpha; //! Drift of R.A. for each day fr
om peak
float m_driftDelta; //! Drift of Dec. for each day fr
om peak
QString m_parentObj; //! Parent object for meteor show
er
float m_pidx; //! The population index
QList<Meteor::ColorPair> m_colors; //! <colorName, 0-100>
LinearFader labelsFader; //current information
Vec3d m_position; //! Cartesian equatorial position
double m_radiantAlpha; //! Current R.A. for radiant of m
eteor shower
double m_radiantDelta; //! Current Dec. for radiant of m
eteor shower
Activity m_activity; //! Current activity
typedef struct QList<MeteorObj*> m_activeMeteors; //! List with all the active mete
{ ors
QString year; //! Value of year for actual data
int zhr; //! ZHR of shower
QString variable; //! value of variable for ZHR
QString start; //! First day for activity
QString finish; //! Latest day for activity
QString peak; //! Day with maximum for activity
} activityData;
bool initialized;
bool active;
QString showerID; //! The ID of the meteor shower
QString designation; //! The designation of the meteor sh
ower
QList<activityData> activity; //! List of activity
int speed; //! Speed of meteors
float rAlphaPeak; //! R.A. for radiant of meteor showe
r on the peak day
float rDeltaPeak; //! Dec. for radiant of meteor showe
r on the peak day
float driftAlpha; //! Drift of R.A.
float driftDelta; //! Drift of Dec.
QString parentObj; //! Parent object for meteor shower
float pidx; //! The population index
QList<colorPair> colors; //! <colorName, 0-100>
//current information //! Draws the radiant
double radiantAlpha; //! Current R.A. for radiant of mete void drawRadiant(StelCore* core);
or shower
double radiantDelta; //! Current Dec. for radiant of mete //! Draws all active meteors
or shower void drawMeteors(StelCore* core);
int zhr; //! ZHR of shower
QString variable; //! value of variable for ZHR //! Calculates the ZHR using normal distribution
QDateTime start; //! First day for activity //! @param current julian day
QDateTime finish; //! Latest day for activity int calculateZHR(const double& currentJD);
QDateTime peak; //! Day with maximum for activity
int status; //! Check if the radiant is active f
or the current sky date
//! 0=inactive; 1=realData 2=generic
Data
void draw(StelPainter &painter);
//! Get a date string from JSON file and parse it for display in inf
o corner
//! @param jsondate A string from JSON file
QString getDateFromJSON(QString jsondate) const;
//! Get a day from JSON file and parse it for display in info corner
//! @param jsondate A string from JSON file
QString getDayFromJSON(QString jsondate) const;
//! Get a month string from JSON file and parse it for display in in
fo corner
//! @param jsondate A string from JSON file
int getMonthFromJSON(QString jsondate) const;
//! Get a month string from JSON file and parse it for display in in
fo corner
//! @param jsondate A string from JSON file
QString getMonthNameFromJSON(QString jsondate) const;
//! Get a month name from month number
//! @param jsondate A string from JSON file
QString getMonthName(int number) const;
//! Get the current sky QDateTime
//! @return Current QDateTime of sky
QDateTime getSkyQDateTime() const;
//! Update value of current information(zhr, variable, stat, finish
and peak)
//! @param current sky QDateTime
void updateCurrentData(QDateTime skyDate);
//! Check if the JSON file has real data to a given year
//! @param yyyy year to check
//! @return index of the year or 0 to generic data
int searchRealData(QString yyyy) const;
//! Get the solar longitude for a specified date //! Gets the solar longitude for a specified date
//! @param QDT QDateTime //! @param date QDate
//! @return solar longitude in degree //! @return solar longitude in degree
float getSolarLongitude(QDateTime QDT) const; QString getSolarLongitude(QDate date) const;
}; };
#endif /*_METEORSHOWER_HPP_*/ #endif /*_METEORSHOWER_HPP_*/
 End of changes. 19 change blocks. 
154 lines changed or deleted 122 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/