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 * Set the AltVsTime Date according to the current Date
53 * in the KStars main window. Currently, this is only
54 * used in the ctor to initialize the Date.
55 */
56 void showCurrentDate();
57
58 /**
59 * @return a KStarsDateTime object constructed from the
60 * current setting in the Date widget.
61 */
63
64 /**
65 * Parse a string as an epoch number. If the string can't
66 * be parsed, return 2000.0.
67 * @param eName the epoch string to be parsed
68 * @return the epoch number
69 */
70 double getEpoch(const QString &eName);
71
72 /**
73 * @short Add a SkyObject to the display.
74 * Constructs a PLotObject representing the Alt-vs-time curve for the object.
75 * @param o pointer to the SkyObject to be added
76 * @param forceAdd if true, then the object will be added, even if there
77 * is already a curve for the same coordinates.
78 */
79 void processObject(SkyObject *o, bool forceAdd = false);
80
81 /**
82 * @short Determine the altitude coordinate of a SkyPoint,
83 * given an hour of the day.
84 *
85 * This is called for every 30-minute interval in the displayed Day,
86 * in order to construct the altitude curve for a given object.
87 * @param p the skypoint whose altitude is to be found
88 * @param hour the time in the displayed day, expressed in hours
89 * @return the Altitude, expressed in degrees
90 */
91 double findAltitude(SkyPoint *p, double hour);
92
93 /**
94 * @short get object name. If star has no name, generate a name based on catalog number.
95 * @param o sky object.
96 * @param translated set to true if the translated name is required.
97 */
98 QString getObjectName(const SkyObject *o, bool translated = true);
99
100 void drawGradient();
101
102 public slots:
103 /** @short Update the plot to reflec new Date and Location settings. */
104 void slotUpdateDateLoc();
105
106 /** @short Clear the list of displayed objects. */
107 void slotClear();
108
109 /** @short Show information from the curve as a tooltip. */
110 void plotMousePress(QCPAbstractPlottable *abstractPlottable, int dataIndex, QMouseEvent *event);
111
112 /** @short Update the X axis on Zoom and Drag. */
113 void onXRangeChanged(const QCPRange &range);
114
115 /** @short Update the Y axis on Zoom and Drag. */
116 void onYRangeChanged(const QCPRange &range);
117
118 /** @short Compute the altitude for a certain time. */
120
121 /** @short Mark the rise time on the curve. */
122 void slotMarkRiseTime();
123
124 /** @short Mark the set time on the curve. */
125 void slotMarkSetTime();
126
127 /** @short Mark the transit time on the curve. */
128 void slotMarkTransitTime();
129
130 /** @short Draw the white vertical line on click. */
132
133 /** @short Clear the edit boxes for specifying a new object. */
134 void slotClearBoxes();
135
136 /**
137 * @short Add an object to the list of displayed objects, according
138 * to the data entered in the edit boxes.
139 */
140 void slotAddSource();
141
142 /**
143 * @short Launch the Find Object window to select a new object for
144 * the list of displayed objects.
145 */
146 void slotBrowseObject();
147
148 /** @short Launch the Location dialog to choose a new location. */
149 void slotChooseCity();
150
151 /**
152 * @short Move input keyboard focus to the next logical widget.
153 * We need a separate slot for this because we are intercepting
154 * Enter key events, which close the window by default, to
155 * advance input focus instead (when the Enter events occur in
156 * certain Edit boxes).
157 */
158 void slotAdvanceFocus();
159
160 /**
161 * Update the plot to highlight the altitude curve of the objects
162 * which is highlighted in the listbox.
163 */
164 void slotHighlight(int);
165
166 /** @short Print plot widget */
167 void slotPrint();
168
169 private:
170 AltVsTimeUI *avtUI { nullptr };
171
172 GeoLocation *geo { nullptr };
173 QList<SkyObject *> pList;
174 QList<SkyObject *> deleteList;
175 int DayOffset { 0 };
176 int minAlt { 0 };
177 int maxAlt { 0 };
178 QCPItemPixmap *background { nullptr };
179 QPixmap *gradient { nullptr };
180};
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 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 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:50
The sky coordinates of a point in the sky.
Definition skypoint.h:45
QDialog(QWidget *parent, Qt::WindowFlags f)
Q_OBJECTQ_OBJECT
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Mar 7 2025 11:55:45 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.