Stellarium 0.12.3
Observability.hpp
1 /*
2  * Copyright (C) 2012 Ivan Marti-Vidal
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 #ifndef OBSERVABILITY_HPP_
19 #define OBSERVABILITY_HPP_
20 
21 #include "StelModule.hpp"
22 #include <QFont>
23 #include <QString>
24 #include "VecMath.hpp"
25 #include "SolarSystem.hpp"
26 #include "Planet.hpp"
27 #include "StelFader.hpp"
28 
29 class QPixmap;
30 class StelButton;
32 
33 class Observability : public StelModule
34 {
35  Q_OBJECT
36 public:
37  Observability();
38  virtual ~Observability();
39  virtual void init();
40  virtual void update(double) {;}
41  virtual void draw(StelCore* core, class StelRenderer* renderer);
42  virtual double getCallOrder(StelModuleActionName actionName) const;
43 
44 
46  virtual bool configureGui(bool show=true);
47 
48 
50  void restoreDefaults(void);
51  void restoreDefaultConfigIni(void);
52 
55  void readSettingsFromConfig(void);
56 
58  void saveSettingsToConfig(void);
59 
63  void setShow(int output, bool show);
64 
66  void setFontColor(int Color, int Value);
67 
69  void setFontSize(int);
70 
72  void setSunAltitude(int);
73 
75  void setHorizAltitude(int);
76 
77 
79  bool getShowFlags(int);
80 
82  Vec3f getFontColor(void);
83 
85  int getFontSize(void);
86 
88  int getSunAltitude(void);
89 
91  int getHorizAltitude(void);
92 
93 
94 public slots:
96  void enableObservability(bool b);
97 
98 private slots:
99  void updateMessageText();
100 
101 private:
102 
103 
105  ObservabilityDialog* configDialog;
106  QByteArray normalStyleSheet;
107  QByteArray nightStyleSheet;
108 
109  void setDateFormat(bool b) { dmyFormat=b; }
110  bool getDateFormat(void) { return dmyFormat; }
111 
116  virtual double HourAngle(double latitude,double elevation,double declination);
117 
121  virtual double HourAngle2(double RA, double ST);
122 
125  virtual bool SolarSystemSolve(StelCore* core, int Kind);
126 
132  virtual int CheckAcro(int &Rise, int &Set, int &Rise2, int &Set2);
133 
134 
144  virtual void getSunMoonCoords(StelCore* core, double JD, double &RASun, double &DecSun, double &RAMoon, double &DecMoon, double &EclLon, bool getBack);
145 
146 
153  virtual void getPlanetCoords(StelCore* core, double JD, double &RA, double &Dec, bool getBack);
154 
156  virtual void getMoonDistance(StelCore* core, double JD, double &Distance, bool getBack);
157 
163  virtual double Lambda(double RA1, double Dec1, double RA2, double Dec2);
164 
170  virtual void double2hms(double t, int &h,int &m,int &s);
171 
173  virtual double sign(double d);
174 
177  virtual QString CalenDate(int DoY);
178 
182  virtual QString RangeCalenDates(int fDoY, int sDoY);
183 
186  virtual double toUnsignedRA(double RA);
187 
190  virtual void PlanetRADec(StelCore *core);
191 
194  virtual void SunRADec(StelCore* core);
195 
197  virtual void SunHTwi();
198 
200  virtual void toRADec(Vec3d TempLoc, double &RA, double &Dec);
201 
203  double yearJD[366];
204 
207  virtual bool CheckRise(int i);
208 
210  double Rad2Deg, Rad2Hr, AstroTwiAlti, UA, TFrac, JDsec, Jan1stJD, halfpi, MoonT, nextFullMoon, prevFullMoon, RefFullMoon, GMTShift, MoonPerilune,RefracHoriz,HorizAlti;
211 
213  double selRA, selDec, mylat, mylon, alti, horizH, culmAlt, myJD;
214 
216  double SunRA[366], SunDec[366], SunSidT[4][366];
217 
219  double ObjectRA[366], ObjectDec[366], ObjectH0[366], ObjectSidT[2][366];
220 
222  double MoonRise, MoonSet, MoonCulm, lastJDMoon;
223 
225  Vec3d EarthPos[366];
226 
228  Vec3d ObserverLoc, Pos0, Pos1, Pos2, RotObserver; //, Pos3;
229 
231  Mat4d LocTrans;
232 
234  Planet* myEarth;
235  Planet* myMoon;
236  Planet* myPlanet;
237 
238 
240  int currYear, nDays, iAltitude, iHorizAltitude;
241 
243  QString selName, bestNight, ObsRange, objname, AcroCos;
244 
246  QString RiseTime, SetTime, CulmTime;
247 
249  QString months[12];
250 
252  bool dmyFormat;
253 
255  Vec3d EquPos, LocPos;
256 
258  bool isStar,isMoon,isSun,isScreen, raised, configChanged, souChanged;
259  int LastObject;
260 
262  bool show_AcroCos, show_Good_Nights, show_Best_Night, show_Today, show_FullMoon; //, show_Crescent, show_SuperMoon;
263 
265  QFont font;
266  Vec3f fontColor;
267  bool flagShowObservability;
268  int fontSize;
269  QPixmap* OnIcon;
270  QPixmap* OffIcon;
271  QPixmap* GlowIcon;
272  StelButton* toolbarButton;
273 
274  QString msgSetsAt, msgRoseAt, msgSetAt, msgRisesAt, msgCircumpolar, msgNoRise, msgCulminatesAt, msgCulminatedAt, msgH, msgM, msgS;
275  QString msgSrcNotObs, msgNoACRise, msgGreatElong, msgLargSSep, msgAtDeg, msgNone, msgAcroRise, msgNoAcroRise, msgCosmRise, msgNoCosmRise;
276  QString msgWholeYear, msgNotObs, msgAboveHoriz, msgToday, msgThisYear, msgPrevFullMoon, msgNextFullMoon;
277 
278 };
279 
280 #include "fixx11h.h"
281 #include <QObject>
282 #include "StelPluginInterface.hpp"
283 
285 {
286  Q_OBJECT
287  Q_INTERFACES(StelPluginInterface)
288 public:
289  virtual StelModule* getStelModule() const;
290  virtual StelPluginInfo getPluginInfo() const;
291 };
292 
293 #endif /*OBSERVABILITY_HPP_*/