Kstars

captureprocessoverlay.h
1/*
2 SPDX-FileCopyrightText: 2021 Wolfgang Reissenberger <sterne-jaeger@openfuture.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#pragma once
8
9#include "ui_captureprocessoverlay.h"
10#include "sequencejob.h"
11
12#include "indi/indicommon.h"
13
14#include <QWidget>
15
16class FITSData;
17
18class CaptureProcessOverlay : public QWidget, public Ui::CaptureProcessOverlay
19{
21
22public:
23 explicit CaptureProcessOverlay(QWidget *parent = nullptr);
24
25 // data describing a single frame
26 struct FrameData
27 {
28 QString target;
29 CCDFrameType frameType;
30 Ekos::SequenceJob::SequenceJobType jobType;
31 QString filterName;
32 QString filename;
33 double exptime;
34 double targetdrift;
35 QPoint binning;
36 int width;
37 int height;
38 double gain;
39 double offset;
40 QString iso;
41 int count, completed;
42 };
43
44 // structs for frame statistics
45 // map (frame type, filter) --> (exp time * 100, counter)
47 // map target --> frame statistics
48 typedef QMap<QString, FrameStatistics> TargetStatistics;
49
50 /**
51 * @brief Navigator through the capture history.
52 */
54 public:
55 /**
56 * @brief Add a newly captured frame to the history
57 * @param data frame data
58 * @return true iff this is a new frame, i.e. its filename does not exist in the history
59 */
60 bool addFrame(FrameData data);
61
62 /**
63 * @brief Delete the current frame and (if possible) the corresponding file.
64 * If the last one has been deleted, navigate to the frame before, if possible.
65 * @return true iff deleting was successful
66 */
67 bool deleteFrame(int pos);
68
69 /**
70 * @brief the currently pointed capture frame
71 */
72 const FrameData currentFrame() {return m_history.at(m_position);}
73
74 /**
75 * @brief The current navigation position in the capture history
76 */
77 int position() {return m_position;}
78 /**
79 * @brief Obtain the frame from the given position in the history
80 */
81 const FrameData getFrame(int pos) {return m_history.at(pos);}
82 /**
83 * @brief Capture history size
84 */
85 int size() {return m_history.size();}
86 /**
87 * @brief Reset the history
88 */
89 void reset();
90 /**
91 * @brief Move one step forward in the history
92 * @return true iff the move was possible within the limits
93 */
94 bool forward();
95 /**
96 * @brief Move one step backwards in the history
97 * @return true iff the move was possible within the limits
98 */
99 bool backward();
100 /**
101 * @brief Iterate over the current target history and add all
102 * those where the corresponding file exists.
103 */
105
106 // capture statistics
107 TargetStatistics statistics;
108
109 private:
110 QList<FrameData> m_history;
111 int m_position = -1;
112
113 /**
114 * @brief Add a new frame to the statistics
115 * @param target current target being processed
116 * @param frameType type of the currently captured frame
117 * @param filter selected filter for the captured frame
118 * @param exptime exposure time of the captured frame
119 */
120 void countNewFrame(QString target, CCDFrameType frameType, QString filter, double exptime);
121 };
122
123 bool addFrameData(FrameData data, const QString &devicename);
124 /**
125 * @brief Update the overlay with the meta data of the current frame and add it to the history
126 */
127 void updateFrameData();
128
129 /**
130 * @brief Update the current target distance.
131 * @param targetDiff distance to the target in arcseconds.
132 */
133 void updateTargetDistance(double targetDiff);
134
135 /**
136 * @brief Obtain the position of the current frame from the history
137 */
138 int currentPosition() {return captureHistory().position();}
139
140 /**
141 * @brief Retrieve the currently selected frame
142 */
143 const FrameData currentFrame() {return captureHistory().currentFrame();}
144
145 /**
146 * @brief Obtain the frame from the given position in the history
147 */
148 const FrameData getFrame(int pos) {return captureHistory().getFrame(pos);}
149
150 /**
151 * @brief Obtain the position of the current frame from the history
152 */
153
154 /**
155 * @brief Returns true iff there are frames in the capture history
156 */
157 bool hasFrames();
158
159 /**
160 * @brief Update the statistics display for captured frames
161 */
162 void displayTargetStatistics();
163
164 /**
165 * @brief Loads a new frame into the view and displays meta data in the overlay
166 * @param data pointer to FITSData object
167 */
168 bool addFrame(const QString &devicename, const QSharedPointer<FITSData> &data);
169
170 /**
171 * @brief Show the next frame from the capture history
172 */
173 bool showNextFrame();
174
175 /**
176 * @brief Show the previous frame from the capture history
177 */
178 bool showPreviousFrame();
179
180 /**
181 * @brief Delete the currently displayed frame
182 */
183 bool deleteFrame(int pos);
184
185 void setCurrentTrainName(const QString &devicename);
186
187 /**
188 * @brief Capture history of the current camera device
189 */
190 CaptureHistory &captureHistory()
191 {
192 return m_captureHistory[m_currentTrainName];
193 }
194
195 /**
196 * @brief refresh frame data and statistics
197 */
198 void refresh();
199
200private:
201 //capture history
202 QMap<QString, CaptureHistory> m_captureHistory;
203 // current camera device name
204 QString m_currentTrainName = "";
205
206};
Navigator through the capture history.
bool deleteFrame(int pos)
Delete the current frame and (if possible) the corresponding file.
bool forward()
Move one step forward in the history.
bool addFrame(FrameData data)
Add a newly captured frame to the history.
int position()
The current navigation position in the capture history.
bool backward()
Move one step backwards in the history.
const FrameData currentFrame()
the currently pointed capture frame
const FrameData getFrame(int pos)
Obtain the frame from the given position in the history.
void updateTargetStatistics()
Iterate over the current target history and add all those where the corresponding file exists.
const_reference at(qsizetype i) const const
qsizetype size() const const
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.