Observability.hpp   Observability.hpp 
skipping to change at line 24 skipping to change at line 24
* 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 OBSERVABILITY_HPP_ #ifndef OBSERVABILITY_HPP_
#define OBSERVABILITY_HPP_ #define OBSERVABILITY_HPP_
#include "StelModule.hpp" #include "StelModule.hpp"
#include <QFont> #include <QFont>
#include <QString> #include <QString>
#include <QPair>
#include "VecMath.hpp" #include "VecMath.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
class QPixmap; class QPixmap;
class StelButton; class StelButton;
class ObservabilityDialog; class ObservabilityDialog;
/*! @defgroup observability Observability Analysis Plug-in
@{
It provides an observability report for the currently selected object, or f
or
the point in the center of the screen if no object is selected.
The output is drawn directly onto the viewport. The color and font size can
be
selected by the user from the plug-in's configuration window.
@see ObservabilityDialog
@todo Find a way to (optionally) put the report in the upper left corner in
fobox.
@todo Decide whether to use flags or separate getters/setters to communicat
e with
the configuration window; if using flags, implement them properly w Qt.
@todo Handle re-loading of the Solar System at runtime.
@todo For each suspicious member variable, check if it can't be actually a
local variable.
@}
*/
//! Main class of the %Observability Analysis plug-in. //! Main class of the %Observability Analysis plug-in.
//! It provides an observability report for the currently selected object, //! @ingroup observability
//! or for the point in the center of the screen if no object is selected. //! @class Observability
//! The output is drawn directly onto the viewport. The color and font size
can
//! be selected by the user from the plug-in's configuration window.
//! @see ObservabilityDialog
//! @todo Find a way to (optionally) put the report in the upper left corne
r
//! infobox.
//! @todo Decide whether to use flags or separate getters/setters to commun
icate
//! with the configuration window; if using flags, implement them properly
w Qt.
//! @todo Handle re-loading of the Solar System at runtime.
//! @todo For each suspicious member variable, check if it can't be actuall
y
//! a local variable.
class Observability : public StelModule class Observability : public StelModule
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool flagShowReport READ isShownReport WRITE showReport) Q_PROPERTY(bool flagShowReport READ isShownReport WRITE showReport)
public: public:
Observability(); Observability();
virtual ~Observability(); virtual ~Observability();
virtual void init(); virtual void init();
virtual void update(double) {;} virtual void update(double) {;}
virtual void draw(StelCore* core); virtual void draw(StelCore* core);
skipping to change at line 141 skipping to change at line 149
//! Retranslates the user-visible strings when the language is chang ed. //! Retranslates the user-visible strings when the language is chang ed.
void updateMessageText(); void updateMessageText();
private: private:
//! Configuration window. //! Configuration window.
ObservabilityDialog* configDialog; ObservabilityDialog* configDialog;
void setDateFormat(bool b) { dmyFormat=b; } void setDateFormat(bool b) { dmyFormat=b; }
bool getDateFormat(void) { return dmyFormat; } bool getDateFormat(void) { return dmyFormat; }
//! Computes the Hour Angle (culmination=0h) in absolute value (from 0h to //! Computes the Hour Angle (culmination=0h) in absolute value (from
12h). 0h to 12h).
//! @todo The hour angle of what, exactly? --BM //! @todo The hour angle of what, exactly? --BM
//! @param latitude latitude of the observer (in radians). //! @param latitude latitude of the observer (in radians).
//! @param elevation elevation angle of the object (horizon=0) in radians. //! @param elevation elevation angle of the object (horizon=0) in ra
//! @param declination declination of the object in radians. dians.
double calculateHourAngle(double latitude, //! @param declination declination of the object in radians.
double elevation, double calculateHourAngle(double latitude, double elevation, double
double declination); declination);
//! Computes the Hour Angle for a given Right Ascension and Sidereal Time. //! Computes the Hour Angle for a given Right Ascension and Sidereal
//! @param RA right ascension (hours). Time.
//! @param ST sidereal time (degrees). //! @param RA right ascension (hours).
//! @param ST sidereal time (degrees).
double HourAngle2(double RA, double ST); double HourAngle2(double RA, double ST);
//! Solves Moon/Sun/Planet Rise/Set/Transit times for the current Julian da //! Solves Moon/Sun/Planet Rise/Set/Transit times for the current Ju
y. lian day.
//! This function updates the variables MoonRise, MoonSet, MoonCulm. //! This function updates the variables MoonRise, MoonSet, MoonCulm.
//! Returns success status. //! Returns success status.
//! @param[in] bodyType is 1 for Sun, 2 for Moon, 3 for Solar System object //! @param[in] bodyType is 1 for Sun, 2 for Moon, 3 for Solar System
. object.
bool calculateSolarSystemEvents(StelCore* core, int bodyType); bool calculateSolarSystemEvents(StelCore* core, int bodyType);
//! Finds the acronycal and cosmical rise/set dates of the year for the cur //! Finds the acronycal and cosmical rise/set dates of the year for
rently-selected object. the currently-selected object.
//! @param[out] acroRise day of year of the Acronycal rise. //! @param[out] acroRise day of year of the Acronycal rise.
//! @param[out] acroSet day of year of the Acronycal set. //! @param[out] acroSet day of year of the Acronycal set.
//! @param[out] cosRise day of year of the Cosmical rise. //! @param[out] cosRise day of year of the Cosmical rise.
//! @param[out] cosSet day of year of the Cosmical set. //! @param[out] cosSet day of year of the Cosmical set.
//! @returns 0 if no dates found, 1 if acronycal dates exist, //! @returns 0 if no dates found, 1 if acronycal dates exist,
//! 2 if cosmical dates exist, and 3 if both are found. //! 2 if cosmical dates exist, and 3 if both are found.
int calculateAcroCos(int& acroRise, int& acroSet, int calculateAcroCos(int& acroRise, int& acroSet, int& cosRise, int&
int& cosRise, int& cosSet); cosSet);
//! Finds the Heliacal rise/set dates of the year for the currently-selecte //! Finds the Heliacal rise/set dates of the year for the currently-
d object. selected object.
//! @param imethod Determines the algorithm to use (not yet implemented). //! @param imethod Determines the algorithm to use (not yet implemen
//! @param[out] heliRise day of year of the Heliacal rise. ted).
//! @param[out] heliSet day of year of the Heliacal set. //! @param[out] heliRise day of year of the Heliacal rise.
//! @returns 0 if no dates found and 1 otherwise. //! @param[out] heliSet day of year of the Heliacal set.
//! @returns 0 if no dates found and 1 otherwise.
int calculateHeli(int imethod, int& heliRise, int& heliSet); int calculateHeli(int imethod, int& heliRise, int& heliSet);
//! Computes the Sun or Moon coordinates at a given Julian date. //! Computes the Sun or Moon coordinates at a given Julian date.
//! @param core the stellarium core. //! @param core the stellarium core.
//! @param JD double for the Julian date. //! @param JD QPair of double for the Julian date: first=JD_UT and .
//! @param RASun right ascension of the Sun (in hours). second=JDE_DT
//! @param DecSun declination of the Sun (in radians). //! @param RASun right ascension of the Sun (in hours).
//! @param RAMoon idem for the Moon. //! @param DecSun declination of the Sun (in radians).
//! @param DecMoon idem for the Moon. //! @param RAMoon idem for the Moon.
//! @param EclLon is the module of the vector product of Heliocentric Eclip //! @param DecMoon idem for the Moon.
tic Coordinates of Sun and Moon (projected over the Ecliptic plane). Useful //! @param EclLon is the module of the vector product of Heliocentri
to derive the dates of Full Moon. c Ecliptic Coordinates
//! @param getBack controls whether Earth and Moon must be returned to thei //! of Sun and Moon (projected over the Ecliptic plane). Usef
r original positions after computation. ul to derive the dates
void getSunMoonCoords(StelCore* core, double jd, //! of Full Moon.
double& raSun, double& decSun, //! @param getBack controls whether Earth and Moon must be returned
double& raMoon, double& decMoon, to their original
double& eclLon, bool getBack); //! positions after computation.
void getSunMoonCoords(StelCore* core, QPair<double, double> JD,
//! computes the selected-planet coordinates at a given Julian date. double& raSun, double& decSun,
//! @param core the stellarium core. double& raMoon, double& decMoon,
//! @param JD double for the Julian date. double& eclLon, bool getBack);
//! @param RA right ascension of the planet (in hours).
//! @param Dec declination of the planet (in radians). //! computes the selected-planet coordinates at a given Julian date.
//! @param getBack controls whether the planet must be returned to its orig //! @param core the stellarium core.
inal positions after computation. //! @param JD QPair for the Julian date: .first=JD(UT), .second=JDE
void getPlanetCoords(StelCore* core, double JD, double &RA, double & //! @param RA right ascension of the planet (in hours).
Dec, bool getBack); //! @param Dec declination of the planet (in radians).
//! @param getBack controls whether the planet must be returned to i
//! Comptues the Earth-Moon distance (in AU) at a given Julian date. ts original positions
//! The parameters are similar to those of getSunMoonCoords or getPlanetCoo //! after computation.
rds. void getPlanetCoords(StelCore* core,QPair<double, double> JD,
void getMoonDistance(StelCore* core, double &RA, double &Dec, bool getBack);
double jd,
double& distance, //! Computes the Earth-Moon distance (in AU) at a given Julian date.
bool getBack); //! The parameters are similar to those of getSunMoonCoords() or get
PlanetCoords().
//! Returns the angular separation (in radians) between two points. void getMoonDistance(StelCore* core, QPair<double, double> JD,
//! @param RA1 right ascension of point 1 (in hours) double& distance, bool getBack);
//! @param Dec1 declination of point 1 (in radians)
//! @param RA2 idem for point 2 //! Returns the angular separation (in radians) between two points.
//! @param Dec2 idem for point 2 //! @param RA1 right ascension of point 1 (in hours)
//! @param Dec1 declination of point 1 (in radians)
//! @param RA2 idem for point 2
//! @param Dec2 idem for point 2
double Lambda(double RA1, double Dec1, double RA2, double Dec2); double Lambda(double RA1, double Dec1, double RA2, double Dec2);
//! Converts a time span in hours (given as double) in hh:mm:ss (integers). //! Converts a time span in hours (given as double) in hh:mm:ss (int
//! @param t time span (double, in hours). egers).
//! @param h hour (integer). //! @param t time span (double, in hours).
//! @param m minute (integer). //! @param h hour (integer).
//! @param s second (integer). //! @param m minute (integer).
//! @param s second (integer).
void double2hms(double t, int &h,int &m,int &s); void double2hms(double t, int &h,int &m,int &s);
//! Just returns the sign of a double; //! Just returns the sign of a double;
double sign(double d); double sign(double d);
//! Get a date string ("25 Apr") from an ordinal date (Xth day of the year) //! Get a date string ("25 Apr") from an ordinal date (Xth day of th
. e year).
//! @param dayNumber The ordinal number of a day of the year. (For example, //! @param dayNumber The ordinal number of a day of the year. (For e
//! 25 April is the 115 or 116 day of the year.) xample,
//! @todo Determine the exact format - leap year handling, etc. //! 25 April is the 115 or 116 day of the year.)
//! @todo Determine the exact format - leap year handling, etc.
QString formatAsDate(int dayNumber); QString formatAsDate(int dayNumber);
//! Get a date range string ("25 Apr - 10 May") from two ordinal dates. //! Get a date range string ("25 Apr - 10 May") from two ordinal dat
//! @see formatAsDate() es.
//! @param startDay number of the first day in the period. //! @see formatAsDate()
//! @param endDay number of the last day in the period. //! @param startDay number of the first day in the period.
//! @param endDay number of the last day in the period.
QString formatAsDateRange(int startDay, int endDay); QString formatAsDateRange(int startDay, int endDay);
//! Just subtracts/adds 24h to a RA (or HA), to make it fall within 0-24h. //! Just subtracts/adds 24h to a RA (or HA), to make it fall within
//! @param RA right ascension (in hours). 0-24h.
//! @param RA right ascension (in hours).
double toUnsignedRA(double RA); double toUnsignedRA(double RA);
//! Prepare arrays with data for the selected object for each day of the ye //! Prepare arrays with data for the selected object for each day of
ar. the year.
//! Computes the RA, Dec and rise/set sidereal times of the selected planet //! Computes the RA, Dec and rise/set sidereal times of the selected
//! for each day of the current year. planet
//! @param core the current Stellarium core. //! for each day of the current year.
//! @param core the current Stellarium core.
void updatePlanetData(StelCore* core); void updatePlanetData(StelCore* core);
//! Computes the Sun's RA and Dec for each day of a given year. //! Computes the Sun's RA and Dec for each day of a given year.
//! @param core current Stellarium core. //! @param core current Stellarium core.
void updateSunData(StelCore* core); void updateSunData(StelCore* core);
//! Computes the Sun's Sid. Times at astronomical twilight (for each year's day) //! Computes the Sun's Sid. Times at astronomical twilight (for each year's day)
void updateSunH(); void updateSunH();
//! Convert an equatorial position vector to RA/Dec. //! Convert an equatorial position vector to RA/Dec.
void toRADec(Vec3d vec3d, double& ra, double& dec); void toRADec(Vec3d vec3d, double& ra, double& dec);
//! Table containing the Julian Dates of the days of the current yea r. //! Table containing the Julian Dates of the days of the current yea r.
double yearJD[366]; QPair<double, double> yearJD[366]; // GZ: This had to become a QPair of JD.first=JD_UT, JD.second=JDE
//! Check if a source is observable during a given date. //! Check if a source is observable during a given date.
//! @param i the day of the year. //! @param i the day of the year.
bool CheckRise(int day); bool CheckRise(int day);
//! Some useful constants and variables(almost self-explanatory). //! Some useful constants (almost self-explanatory).
double Rad2Deg, Rad2Hr, UA, TFrac, JDsec, Jan1stJD, halfpi, MoonT, n // GZ: Made true constants out of those, and improved accuracy of so
extFullMoon, prevFullMoon, RefFullMoon, GMTShift, MoonPerilune; me.
static const double Rad2Deg, Rad2Hr, UA, TFrac, JDsec, halfpi, MoonT
, RefFullMoon, MoonPerilune;
//! Some useful variables(almost self-explanatory).
double nextFullMoon, prevFullMoon, GMTShift, Jan1stJD;
//! User-defined angular altitude of astronomical twilight in radian s. //! User-defined angular altitude of astronomical twilight in radian s.
//! See setTwilightAltitude() and getTwilightAltitude(). //! See setTwilightAltitude() and getTwilightAltitude().
double twilightAltRad; double twilightAltRad;
//! User-defined angular altitude of astronomical twilight in degree s. //! User-defined angular altitude of astronomical twilight in degree s.
//! See setTwilightAltitude() and getTwilightAltitude(). //! See setTwilightAltitude() and getTwilightAltitude().
int twilightAltDeg; int twilightAltDeg;
//! Geometric altitude at refraction-corrected horizon. //! Geometric altitude at refraction-corrected horizon.
double refractedHorizonAlt; double refractedHorizonAlt;
//! User-defined angular altitude of the visual horizon in radians. //! User-defined angular altitude of the visual horizon in radians.
double horizonAltitude; double horizonAltitude;
//! User-defined angular altitude of the visual horizon in degrees. //! User-defined angular altitude of the visual horizon in degrees.
int horizonAltDeg; int horizonAltDeg;
//! RA, Dec, observer latitude, object's elevation, and Hour Angle at horiz //! RA, Dec, observer latitude, object's elevation, and Hour Angle a
on. t horizon.
double selRA, selDec, mylat, mylon, alti, horizH, culmAlt, myJD; double selRA, selDec, mylat, mylon, alti, horizH, culmAlt;
//! Some place to keep JD and JDE. .first is JD(UT), .second is for
the fitting JDE.
QPair<double, double> myJD;
//! Vectors to store Sun's RA, Dec, and Sid. Time at twilight and rise/set. //! Vectors to store Sun's RA, Dec, and Sid. Time at twilight and ri se/set.
double sunRA[366]; double sunRA[366];
double sunDec[366]; double sunDec[366];
//! Sidereal time of the Sun at twilight and rise/set through the ye ar. //! Sidereal time of the Sun at twilight and rise/set through the ye ar.
double sunSidT[4][366]; double sunSidT[4][366];
//! Vectors to store planet's RA, Dec, and Sid. Time at rise/set. //! Vectors to store planet's RA, Dec, and Sid. Time at rise/set.
double objectRA[366]; double objectRA[366];
double objectDec[366]; double objectDec[366];
double objectH0[366]; double objectH0[366];
//! Table of the sidereal time of the object's rising/setting. //! Table of the sidereal time of the object's rising/setting.
double objectSidT[2][366]; double objectSidT[2][366];
//! Rise/Set/Transit times for the Moon at current day: //! Rise/Set/Transit times for the Moon at current day:
double MoonRise, MoonSet, MoonCulm, lastJDMoon; double MoonRise, MoonSet, MoonCulm, lastJDMoon;
//! Vector of Earth position through the year. //! Vector of Earth position through the year.
Vec3d EarthPos[366]; Vec3d EarthPos[366];
//! Position of the observer relative to the Earth Center or other coordina tes: //! Position of the observer relative to the Earth Center or other c oordinates:
Vec3d ObserverLoc, Pos1, Pos2, RotObserver; //, Pos3; Vec3d ObserverLoc, Pos1, Pos2, RotObserver; //, Pos3;
//! Matrix to transform coordinates for Sun/Moon ephemeris: //! Matrix to transform coordinates for Sun/Moon ephemeris:
Mat4d LocTrans; Mat4d LocTrans;
//! Pointer to the Earth, Moon, and planet: //! Pointer to the Earth, Moon, and planet:
Planet* myEarth; Planet* myEarth;
Planet* myMoon; Planet* myMoon;
Planet* myPlanet; Planet* myPlanet;
//! Current simulation year. //! Current simulation year.
int curYear; int curYear;
//! Days in the current year (366 on leap years). //! Days in the current year (366 on leap years).
int nDays; int nDays;
//! Untranslated name of the currently selected object. //! Untranslated name of the currently selected object.
//! Used to check if the selection has changed. //! Used to check if the selection has changed.
QString selName; QString selName;
//! Cached copy of the "best night" line in the report. //! Cached copy of the "best night" line in the report.
QString lineBestNight; QString lineBestNight;
//! Cached copy of the line reporting when the target is observable. //! Cached copy of the line reporting when the target is observable.
QString lineObservableRange; QString lineObservableRange;
//! Cached copy of the line reporting the acronical/cosmical rise an d set. //! Cached copy of the line reporting the acronical/cosmical rise an d set.
QString lineAcroCos, lineHeli; QString lineAcroCos, lineHeli;
//! Strings to save ephemeris Times: //! Strings to save ephemeris Times:
QString RiseTime, SetTime, CulmTime; QString RiseTime, SetTime, CulmTime;
//! Just the names of the months. //! Just the names of the months.
QStringList monthNames; QStringList monthNames;
//! Using for storage date format [i18n] //! Using for storage date format [i18n]
bool dmyFormat; bool dmyFormat;
//! Equatorial and local coordinates of currently-selected source. //! Equatorial and local coordinates of currently-selected source.
Vec3d EquPos, LocPos; Vec3d EquPos, LocPos;
//! Some booleans to check the kind of source selected and the kind of outp ut to produce. //! Some booleans to check the kind of source selected and the kind of output to produce.
bool isStar, isMoon, isSun, isScreen; bool isStar, isMoon, isSun, isScreen;
//! This really shouldn't be handled like this... //! This really shouldn't be handled like this...
bool hasRisen; bool hasRisen;
bool configChanged; bool configChanged;
bool souChanged; bool souChanged;
//! The last object type for which calculateSolarSystemEvents() was called. //! The last object type for which calculateSolarSystemEvents() was called.
int lastType; int lastType;
//! @name Flags controlling report contents. //! @name Flags controlling report contents.
 End of changes. 34 change blocks. 
137 lines changed or deleted 169 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/