Kstars

planetviewer.h
1 /*
2  SPDX-FileCopyrightText: 2003 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "kstarsdatetime.h"
10 #include "ui_planetviewer.h"
11 
12 #include <QDialog>
13 #include <QTimer>
14 
15 class QKeyEvent;
16 class QPaintEvent;
17 
18 #define AUMAX 48
19 
20 class KSPlanetBase;
21 
22 class PlanetViewerUI : public QFrame, public Ui::PlanetViewer
23 {
24  Q_OBJECT
25 
26  public:
27  explicit PlanetViewerUI(QWidget *parent = nullptr);
28 };
29 
30 /**
31  * @class PlanetViewer
32  * @short Display an overhead view of the solar system
33  *
34  * @version 1.0
35  * @author Jason Harris
36  */
37 class PlanetViewer : public QDialog
38 {
39  Q_OBJECT
40 
41  public:
42  explicit PlanetViewer(QWidget *parent = nullptr);
43 
44  inline QString centerPlanet() const { return CenterPlanet; }
45  inline void setCenterPlanet(const QString &cp) { CenterPlanet = cp; }
46 
47  inline KPlotObject *planetObject(uint i) const { return planet[i]; }
48  QString planetName(uint i) const;
49 
50  protected:
51  void keyPressEvent(QKeyEvent *e) override;
52  void paintEvent(QPaintEvent *) override;
53 
54  private slots:
55  void initPlotObjects();
56  void tick();
57  void setTimeScale(float);
58  void slotChangeDate();
59  void slotRunClock();
60  void slotToday();
61  void slotCloseWindow();
62 
63  private:
64  void updatePlanets();
65 
66  PlanetViewerUI *pw { nullptr };
67  KStarsDateTime ut;
68  double scale { 0 };
69  bool isClockRunning { false };
70  QTimer tmr;
71  int UpdateInterval[9], LastUpdate[9];
72  QString CenterPlanet;
73  QList<KSPlanetBase *> PlanetList;
74  KPlotObject *ksun { nullptr };
75  KPlotObject *planet[9] { nullptr };
76 };
Q_OBJECTQ_OBJECT
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
Display an overhead view of the solar system.
Definition: planetviewer.h:37
QObject * parent() const const
Provides necessary information about objects in the solar system.
Definition: ksplanetbase.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.