Kstars

altvstime.h
1/*
2 SPDX-FileCopyrightText: 2002 Pablo de Vicente <vicente@oan.es>
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
15class QCPItemPixmap;
16class QCPRange;
17class QMouseEvent;
18class QPixmap;
19
20class GeoLocation;
21class KStarsDateTime;
22class SkyObject;
23class SkyPoint;
24
25class AltVsTimeUI : public QFrame, public Ui::AltVsTime
26{
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 */
40class AltVsTime : public QDialog
41{
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};
the Altitude vs.
Definition altvstime.h:41
AltVsTime(QWidget *parent=nullptr)
Constructor.
Definition altvstime.cpp:42
void slotAddSource()
Add an object to the list of displayed objects, according to the data entered in the edit boxes.
void slotHighlight(int)
Update the plot to highlight the altitude curve of the objects which is highlighted in the listbox.
double findAltitude(SkyPoint *p, double hour)
Determine the altitude coordinate of a SkyPoint, given an hour of the day.
void slotPrint()
Print plot widget.
void slotMarkSetTime()
Mark the set time on the curve.
void showCurrentDate()
Set the AltVsTime Date according to the current Date in the KStars main window.
void setLSTLimits()
Determine the limits for the sideral time axis, using the sidereal time at midnight for the current d...
void plotMousePress(QCPAbstractPlottable *abstractPlottable, int dataIndex, QMouseEvent *event)
Show information from the curve as a tooltip.
void slotBrowseObject()
Launch the Find Object window to select a new object for the list of displayed objects.
void slotClearBoxes()
Clear the edit boxes for specifying a new object.
void slotChooseCity()
Launch the Location dialog to choose a new location.
void slotMarkTransitTime()
Mark the transit time on the curve.
KStarsDateTime getDate()
double getEpoch(const QString &eName)
Parse a string as an epoch number.
void mouseOverLine(QMouseEvent *event)
Draw the white vertical line on click.
void onXRangeChanged(const QCPRange &range)
Update the X axis on Zoom and Drag.
void computeSunRiseSetTimes()
Determine the time of sunset and sunrise for the current date and location settings.
void slotUpdateDateLoc()
Update the plot to reflec new Date and Location settings.
void slotClear()
Clear the list of displayed objects.
void processObject(SkyObject *o, bool forceAdd=false)
Add a SkyObject to the display.
void slotMarkRiseTime()
Mark the rise time on the curve.
~AltVsTime() override
Destructor.
void onYRangeChanged(const QCPRange &range)
Update the Y axis on Zoom and Drag.
void slotAdvanceFocus()
Move input keyboard focus to the next logical widget.
void slotComputeAltitudeByTime()
Compute the altitude for a certain time.
QString getObjectName(const SkyObject *o, bool translated=true)
get object name.
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
Definition geolocation.h:28
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
The abstract base class for all data representing objects in a plot.
An arbitrary pixmap.
Represents the range an axis is encompassing.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
The sky coordinates of a point in the sky.
Definition skypoint.h:45
Q_OBJECTQ_OBJECT
QObject * parent() const const
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.