Kstars

altvstime.h
1 /*
2  SPDX-FileCopyrightText: 2002 Pablo de Vicente <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QList>
10 #include <QDialog>
11 
12 #include "ui_altvstime.h"
13 
15 class QCPItemPixmap;
16 class QCPRange;
17 class QMouseEvent;
18 class QPixmap;
19 
20 class GeoLocation;
21 class KStarsDateTime;
22 class SkyObject;
23 class SkyPoint;
24 
25 class AltVsTimeUI : public QFrame, public Ui::AltVsTime
26 {
27  Q_OBJECT
28  public:
29  explicit AltVsTimeUI(QWidget *p = nullptr);
30 };
31 
32 /**
33  * @class AltVsTime
34  * @short the Altitude vs. Time Tool.
35  * Plot the altitude as a function of time for any list of
36  * objects, as seen from any location, on any date.
37  *
38  * @author Jason Harris
39  */
40 class AltVsTime : public QDialog
41 {
42  Q_OBJECT
43 
44  public:
45  /** Constructor */
46  explicit AltVsTime(QWidget *parent = nullptr);
47 
48  /** Destructor */
49  ~AltVsTime() override;
50 
51  /**
52  * Determine the limits for the sideral time axis, using
53  * the sidereal time at midnight for the current date
54  * and location settings.
55  */
56  void setLSTLimits();
57 
58  /**
59  * Set the AltVsTime Date according to the current Date
60  * in the KStars main window. Currently, this is only
61  * used in the ctor to initialize the Date.
62  */
63  void showCurrentDate();
64 
65  /**
66  * @return a KStarsDateTime object constructed from the
67  * current setting in the Date widget.
68  */
70 
71  /**
72  * Determine the time of sunset and sunrise for the current
73  * date and location settings. Convert the times to doubles,
74  * expressing the times as fractions of a full day.
75  * Calls AVTPlotWidget::setSunRiseSetTimes() to send the
76  * numbers to the plot widget.
77  */
79 
80  /**
81  * Parse a string as an epoch number. If the string can't
82  * be parsed, return 2000.0.
83  * @param eName the epoch string to be parsed
84  * @return the epoch number
85  */
86  double getEpoch(const QString &eName);
87 
88  /**
89  * @short Add a SkyObject to the display.
90  * Constructs a PLotObject representing the Alt-vs-time curve for the object.
91  * @param o pointer to the SkyObject to be added
92  * @param forceAdd if true, then the object will be added, even if there
93  * is already a curve for the same coordinates.
94  */
95  void processObject(SkyObject *o, bool forceAdd = false);
96 
97  /**
98  * @short Determine the altitude coordinate of a SkyPoint,
99  * given an hour of the day.
100  *
101  * This is called for every 30-minute interval in the displayed Day,
102  * in order to construct the altitude curve for a given object.
103  * @param p the skypoint whose altitude is to be found
104  * @param hour the time in the displayed day, expressed in hours
105  * @return the Altitude, expressed in degrees
106  */
107  double findAltitude(SkyPoint *p, double hour);
108 
109  /**
110  * @short get object name. If star has no name, generate a name based on catalog number.
111  * @param o sky object.
112  * @param translated set to true if the translated name is required.
113  */
114  QString getObjectName(const SkyObject *o, bool translated = true);
115 
116  void drawGradient();
117 
118  public slots:
119  /** @short Update the plot to reflec new Date and Location settings. */
120  void slotUpdateDateLoc();
121 
122  /** @short Clear the list of displayed objects. */
123  void slotClear();
124 
125  /** @short Show information from the curve as a tooltip. */
126  void plotMousePress(QCPAbstractPlottable *abstractPlottable, int dataIndex, QMouseEvent *event);
127 
128  /** @short Update the X axis on Zoom and Drag. */
129  void onXRangeChanged(const QCPRange &range);
130 
131  /** @short Update the Y axis on Zoom and Drag. */
132  void onYRangeChanged(const QCPRange &range);
133 
134  /** @short Compute the altitude for a certain time. */
136 
137  /** @short Mark the rise time on the curve. */
138  void slotMarkRiseTime();
139 
140  /** @short Mark the set time on the curve. */
141  void slotMarkSetTime();
142 
143  /** @short Mark the transit time on the curve. */
144  void slotMarkTransitTime();
145 
146  /** @short Draw the white vertical line on click. */
148 
149  /** @short Clear the edit boxes for specifying a new object. */
150  void slotClearBoxes();
151 
152  /**
153  * @short Add an object to the list of displayed objects, according
154  * to the data entered in the edit boxes.
155  */
156  void slotAddSource();
157 
158  /**
159  * @short Launch the Find Object window to select a new object for
160  * the list of displayed objects.
161  */
162  void slotBrowseObject();
163 
164  /** @short Launch the Location dialog to choose a new location. */
165  void slotChooseCity();
166 
167  /**
168  * @short Move input keyboard focus to the next logical widget.
169  * We need a separate slot for this because we are intercepting
170  * Enter key events, which close the window by default, to
171  * advance input focus instead (when the Enter events occur in
172  * certain Edit boxes).
173  */
174  void slotAdvanceFocus();
175 
176  /**
177  * Update the plot to highlight the altitude curve of the objects
178  * which is highlighted in the listbox.
179  */
180  void slotHighlight(int);
181 
182  /** @short Print plot widget */
183  void slotPrint();
184 
185  private:
186  /** @short find start of dawn, end of dusk, maximum and minimum elevation of the sun */
187  void setDawnDusk();
188 
189  AltVsTimeUI *avtUI { nullptr };
190 
191  GeoLocation *geo { nullptr };
192  QList<SkyObject *> pList;
193  QList<SkyObject *> deleteList;
194  int DayOffset { 0 };
195  int minAlt { 0 };
196  int maxAlt { 0 };
197  QCPItemPixmap *background { nullptr };
198  QPixmap *gradient { nullptr };
199 };
Q_OBJECTQ_OBJECT
An arbitrary pixmap.
Definition: qcustomplot.h:6730
void slotAddSource()
Add an object to the list of displayed objects, according to the data entered in the edit boxes.
Definition: altvstime.cpp:252
AltVsTime(QWidget *parent=nullptr)
Constructor.
Definition: altvstime.cpp:41
void slotBrowseObject()
Launch the Find Object window to select a new object for the list of displayed objects.
Definition: altvstime.cpp:348
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
void onYRangeChanged(const QCPRange &range)
Update the Y axis on Zoom and Drag.
Definition: altvstime.cpp:544
void slotComputeAltitudeByTime()
Compute the altitude for a certain time.
Definition: altvstime.cpp:668
void processObject(SkyObject *o, bool forceAdd=false)
Add a SkyObject to the display.
Definition: altvstime.cpp:360
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
void slotMarkTransitTime()
Mark the transit time on the curve.
Definition: altvstime.cpp:792
void slotMarkRiseTime()
Mark the rise time on the curve.
Definition: altvstime.cpp:701
void slotMarkSetTime()
Mark the set time on the curve.
Definition: altvstime.cpp:745
virtual bool event(QEvent *event) override
KStarsDateTime getDate()
Definition: altvstime.cpp:1342
double getEpoch(const QString &eName)
Parse a string as an epoch number.
Definition: altvstime.cpp:1349
void slotClearBoxes()
Clear the edit boxes for specifying a new object.
Definition: altvstime.cpp:660
void mouseOverLine(QMouseEvent *event)
Draw the white vertical line on click.
Definition: altvstime.cpp:913
void onXRangeChanged(const QCPRange &range)
Update the X axis on Zoom and Drag.
Definition: altvstime.cpp:526
~AltVsTime() override
Destructor.
Definition: altvstime.cpp:248
the Altitude vs. Time Tool. Plot the altitude as a function of time for any list of objects,...
Definition: altvstime.h:40
void slotClear()
Clear the list of displayed objects.
Definition: altvstime.cpp:621
void setLSTLimits()
Determine the limits for the sideral time axis, using the sidereal time at midnight for the current d...
Definition: altvstime.cpp:1120
void slotPrint()
Print plot widget.
Definition: altvstime.cpp:1376
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:3440
void slotAdvanceFocus()
Move input keyboard focus to the next logical widget.
Definition: altvstime.cpp:607
Represents the range an axis is encompassing.
Definition: qcustomplot.h:778
void slotUpdateDateLoc()
Update the plot to reflec new Date and Location settings.
Definition: altvstime.cpp:967
void slotHighlight(int)
Update the plot to highlight the altitude curve of the objects which is highlighted in the listbox.
Definition: altvstime.cpp:478
double findAltitude(SkyPoint *p, double hour)
Determine the altitude coordinate of a SkyPoint, given an hour of the day.
Definition: altvstime.cpp:466
void computeSunRiseSetTimes()
Determine the time of sunset and sunrise for the current date and location settings.
Definition: altvstime.cpp:837
QString getObjectName(const SkyObject *o, bool translated=true)
get object name.
Definition: altvstime.cpp:1447
void showCurrentDate()
Set the AltVsTime Date according to the current Date in the KStars main window.
Definition: altvstime.cpp:1135
void plotMousePress(QCPAbstractPlottable *abstractPlottable, int dataIndex, QMouseEvent *event)
Show information from the curve as a tooltip.
Definition: altvstime.cpp:550
void slotChooseCity()
Launch the Location dialog to choose a new location.
Definition: altvstime.cpp:1103
Information about an object in the sky.
Definition: skyobject.h:41
QObject * parent() const const
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 11 2022 03:59:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.