Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/StelCore_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:34:14 2014
Кодировка:

Поисковые слова: deep sky
Stellarium: core/StelCore.hpp Source File
Stellarium 0.12.3
StelCore.hpp
1 /*
2  * Copyright (C) 2003 Fabien Chereau
3  * Copyright (C) 2012 Matthew Gates
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 _STELCORE_HPP_
21 #define _STELCORE_HPP_
22 
23 #include "StelProjector.hpp"
24 #include "StelProjectorType.hpp"
25 #include "StelLocation.hpp"
26 #include "StelSkyDrawer.hpp"
27 #include <QString>
28 #include <QStringList>
29 #include <QTime>
30 
31 class StelToneReproducer;
32 class StelSkyDrawer;
33 class StelGeodesicGrid;
34 class StelMovementMgr;
35 class StelObserver;
36 
46 class StelCore : public QObject
47 {
48  Q_OBJECT
49  Q_ENUMS(ProjectionType)
50  Q_ENUMS(DeltaTAlgorithm)
51 
52 public:
55  enum FrameType
56  {
57  FrameUninitialized,
58  FrameAltAz,
59  FrameHeliocentricEcliptic,
60  FrameObservercentricEcliptic,
61  FrameEquinoxEqu,
62 
63  FrameJ2000,
64 
65  FrameGalactic
66  };
67 
69  enum ProjectionType
70  {
71  ProjectionPerspective,
72  ProjectionEqualArea,
73  ProjectionStereographic,
74  ProjectionFisheye,
75  ProjectionHammer,
76  ProjectionCylinder,
77  ProjectionMercator,
78  ProjectionOrthographic
79  };
80 
82  enum RefractionMode
83  {
84  RefractionAuto,
85  RefractionOn,
86  RefractionOff
87  };
88 
91  enum DeltaTAlgorithm
92  {
93  WithoutCorrection,
94  Schoch,
95  Clemence,
96  IAU,
97  AstronomicalEphemeris,
98  TuckermanGoldstine,
99  MullerStephenson,
100  Stephenson1978,
101  SchmadelZech1979,
102  MorrisonStephenson1982,
103  StephensonMorrison1984,
104  StephensonHoulden,
105  Espenak,
106  Borkowski,
107  SchmadelZech1988,
108  ChaprontTouze,
109  StephensonMorrison1995,
110  Stephenson1997,
111  ChaprontMeeus,
112  JPLHorizons,
113  MeeusSimons,
114  MontenbruckPfleger,
115  ReingoldDershowitz,
116  MorrisonStephenson2004,
117  Reijs,
118  EspenakMeeus,
119  Banjevic,
120  IslamSadiqQureshi,
121  Custom
122  };
123 
124  StelCore();
125  virtual ~StelCore();
126 
128  void init(class StelRenderer* renderer);
129 
132  void update(double deltaTime);
133 
135  void windowHasBeenResized(float x, float y, float width, float height);
136 
138  void preDraw();
139 
141  void postDraw(StelRenderer* renderer);
142 
145  StelProjectorP getProjection2d() const;
146 
149  StelProjectorP getProjection(FrameType frameType, RefractionMode refractionMode=RefractionAuto) const;
150 
153  StelProjectorP getProjection(StelProjector::ModelViewTranformP modelViewTransform, ProjectionType projType=(ProjectionType)1000) const;
154 
156  StelToneReproducer* getToneReproducer();
158  const StelToneReproducer* getToneReproducer() const;
159 
161  StelSkyDrawer* getSkyDrawer();
163  const StelSkyDrawer* getSkyDrawer() const;
164 
166  const StelGeodesicGrid* getGeodesicGrid(int maxLevel) const;
167 
169  StelMovementMgr* getMovementMgr();
171  const StelMovementMgr* getMovementMgr() const;
172 
174  void setClippingPlanes(double znear, double zfar);
176  void getClippingPlanes(double* zn, double* zf) const;
177 
179  QString projectionTypeKeyToNameI18n(const QString& key) const;
180 
182  QString projectionNameI18nToTypeKey(const QString& nameI18n) const;
183 
185  StelProjector::StelProjectorParams getCurrentStelProjectorParams() const;
187  void setCurrentStelProjectorParams(const StelProjector::StelProjectorParams& newParams);
188 
190  void lookAtJ2000(const Vec3d& pos, const Vec3d& up);
191 
192  Vec3d altAzToEquinoxEqu(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
193  Vec3d equinoxEquToAltAz(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
194  Vec3d altAzToJ2000(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
195  Vec3d j2000ToAltAz(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
196  Vec3d galacticToJ2000(const Vec3d& v) const;
197  Vec3d equinoxEquToJ2000(const Vec3d& v) const;
198  Vec3d j2000ToEquinoxEqu(const Vec3d& v) const;
199  Vec3d j2000ToGalactic(const Vec3d& v) const;
200 
202  Vec3d heliocentricEclipticToAltAz(const Vec3d& v, RefractionMode refMode=RefractionAuto) const;
203 
205  Vec3d heliocentricEclipticToEquinoxEqu(const Vec3d& v) const;
208  Vec3d heliocentricEclipticToEarthPosEquinoxEqu(const Vec3d& v) const;
209 
211  StelProjector::ModelViewTranformP getHeliocentricEclipticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
212 
214  StelProjector::ModelViewTranformP getObservercentricEclipticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
215 
217  StelProjector::ModelViewTranformP getEquinoxEquModelViewTransform(RefractionMode refMode=RefractionAuto) const;
218 
220  StelProjector::ModelViewTranformP getAltAzModelViewTransform(RefractionMode refMode=RefractionAuto) const;
221 
223  StelProjector::ModelViewTranformP getJ2000ModelViewTransform(RefractionMode refMode=RefractionAuto) const;
224 
226  StelProjector::ModelViewTranformP getGalacticModelViewTransform(RefractionMode refMode=RefractionAuto) const;
227 
229  static const Mat4d matJ2000ToVsop87;
231  static const Mat4d matVsop87ToJ2000;
233  static const Mat4d matJ2000ToGalactic;
235  static const Mat4d matGalacticToJ2000;
236 
238  Vec3d getObserverHeliocentricEclipticPos() const;
239 
241  const StelLocation& getCurrentLocation() const;
242 
243  const QSharedPointer<class Planet> getCurrentPlanet() const;
244 
250  void moveObserverTo(const StelLocation& target, double duration=1., double durationIfPlanetChange=1.);
251 
252  // Conversion in standar Julian time format
253  static const double JD_SECOND;
254  static const double JD_MINUTE;
255  static const double JD_HOUR;
256  static const double JD_DAY;
257 
260  double getLocalSideralTime() const;
261 
263  double getLocalSideralDayLength() const;
264 
266  double getLocalSideralYearLength() const;
267 
269  QString getStartupTimeMode();
270  void setStartupTimeMode(const QString& s);
271 
276  double getDeltaT(double jDay) const;
277 
282  QString getCurrentDeltaTAlgorithmValidRange(double jDay, QString* marker) const;
283 
284 public slots:
286  void setCurrentProjectionType(ProjectionType type);
287  ProjectionType getCurrentProjectionType() const;
288 
290  QString getCurrentProjectionTypeKey(void) const;
292  void setCurrentProjectionTypeKey(QString type);
293 
295  QStringList getAllProjectionTypeKeys() const;
296 
298  void setCurrentDeltaTAlgorithm(DeltaTAlgorithm algorithm) { currentDeltaTAlgorithm=algorithm; }
300  DeltaTAlgorithm getCurrentDeltaTAlgorithm() const { return currentDeltaTAlgorithm; }
302  QString getCurrentDeltaTAlgorithmDescription(void) const;
304  QString getCurrentDeltaTAlgorithmKey(void) const;
306  void setCurrentDeltaTAlgorithmKey(QString type);
307 
310 
313  void setFlagGravityLabels(bool gravity);
315  void setDefautAngleForGravityText(float a);
318  void setFlipHorz(bool flip);
321  void setFlipVert(bool flip);
324  bool getFlipHorz(void) const;
327  bool getFlipVert(void) const;
328 
330  QString getDefaultLocationID() const;
332  void setDefaultLocationID(const QString& id);
336  void returnToHome();
337 
339  void setJDay(double JD);
341  double getJDay() const;
342 
344  void setMJDay(double MJD);
346  double getMJDay() const;
347 
349  double getPresetSkyTime() const;
351  void setPresetSkyTime(double d);
352 
354  void setTimeRate(double ts);
356  double getTimeRate() const;
357 
359  void increaseTimeSpeed();
361  void decreaseTimeSpeed();
363  void increaseTimeSpeedLess();
365  void decreaseTimeSpeedLess();
366 
368  void setZeroTimeSpeed();
370  void setRealTimeSpeed();
372  void toggleRealTimeSpeed();
374  bool getRealTimeSpeed() const;
375 
377  void setTimeNow();
379  void setTodayTime(const QTime& target);
381  bool getIsTimeNow() const;
382 
384  QTime getInitTodayTime(void);
386  void setInitTodayTime(const QTime& t);
388  void setPresetSkyTime(QDateTime dt);
389 
391  void addHour();
393  void addDay();
395  void addWeek();
396 
399  void addSiderealDay();
402  void addSiderealWeek();
406  void addSiderealMonth();
410  void addSiderealYear();
414  void addSiderealCentury();
415 
417  void subtractHour();
419  void subtractDay();
421  void subtractWeek();
422 
425  void subtractSiderealDay();
428  void subtractSiderealWeek();
432  void subtractSiderealMonth();
436  void subtractSiderealYear();
441 
443  void addSynodicMonth();
444 
446  void addDraconicYear();
448  void addDraconicMonth();
449 
451  void addAnomalisticMonth();
452 
454  void addTropicalMonth();
456  void addTropicalYear();
458  void addTropicalCentury();
459 
461  void subtractSynodicMonth();
462 
464  void subtractDraconicYear();
466  void subtractDraconicMonth();
467 
470 
472  void subtractTropicalMonth();
474  void subtractTropicalYear();
477 
480  void addSolarDays(double d);
484  void addSiderealDays(double d);
485 
488  void moveObserverToSelected();
489 
492  void setCustomYear(float y) { customYear=y; }
495  void setCustomNDot(float v) { customNDot=v; }
498  void setCustomEquationCoefficients(Vec3f c) { customEquationCoeff=c; }
499 
501  float getCustomYear() const { return customYear; }
503  float getCustomNDot() const { return customNDot; }
505  Vec3f getCustomEquationCoefficients() const { return customEquationCoeff; }
506 
507 signals:
511  void timeRateChanged(double rate);
512 
513 private:
514  StelToneReproducer* toneConverter; // Tones conversion between stellarium world and display device
515  StelSkyDrawer* skyDrawer;
516  StelMovementMgr* movementMgr; // Manage vision movements
517 
518  // Manage geodesic grid
519  mutable StelGeodesicGrid* geodesicGrid;
520 
521  // The currently used projection type
522  ProjectionType currentProjectionType;
523 
524  // The currentrly used time correction (DeltaT)
525  DeltaTAlgorithm currentDeltaTAlgorithm;
526 
527  // Parameters to use when creating new instances of StelProjector
528  StelProjector::StelProjectorParams currentProjectorParams;
529 
530  void updateTransformMatrices();
531  void updateTime(double deltaTime);
532 
533  // Matrices used for every coordinate transfo
534  Mat4d matHeliocentricEclipticToAltAz; // Transform from heliocentric ecliptic (Vsop87) to observer-centric altazimuthal coordinate
535  Mat4d matAltAzToHeliocentricEcliptic; // Transform from observer-centric altazimuthal coordinate to heliocentric ecliptic (Vsop87)
536  Mat4d matAltAzToEquinoxEqu; // Transform from observer-centric altazimuthal coordinate to Earth Equatorial
537  Mat4d matEquinoxEquToAltAz; // Transform from observer-centric altazimuthal coordinate to Earth Equatorial
538  Mat4d matHeliocentricEclipticToEquinoxEqu; // Transform from heliocentric ecliptic (Vsop87) to earth equatorial coordinate
539  Mat4d matEquinoxEquToJ2000;
540  Mat4d matJ2000ToEquinoxEqu;
541  Mat4d matJ2000ToAltAz;
542 
543  Mat4d matAltAzModelView; // Modelview matrix for observer-centric altazimuthal drawing
544  Mat4d invertMatAltAzModelView; // Inverted modelview matrix for observer-centric altazimuthal drawing
545 
546  // Position variables
547  StelObserver* position;
548  // The ID of the default startup location
549  QString defaultLocationID;
550 
551  // Time variables
552  double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec
553  double JDay; // Curent time in Julian day
554  double presetSkyTime;
555  QTime initTodayTime;
556  QString startupTimeMode;
557 
558  // Variables for custom equation of Delta-T
559  Vec3f customEquationCoeff;
560  float customNDot;
561  float customYear;
562 
563 };
564 
565 #endif // _STELCORE_HPP_