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
11#include "indi/indicommon.h"
12
13#include <QWidget>
14
15class FITSData;
16
17class CaptureProcessOverlay : public QWidget, public Ui::CaptureProcessOverlay
18{
20
21public:
22 explicit CaptureProcessOverlay(QWidget *parent = nullptr);
23
24 // data describing a single frame
25 struct FrameData
26 {
27 QString target;
28 CCDFrameType frameType;
29 QString filterName;
30 QString filename;
31 double exptime;
32 double targetdrift;
33 QPoint binning;
34 int width;
35 int height;
36 double gain;
37 double offset;
38 QString iso;
39 };
40
41 // structs for frame statistics
42 // map (frame type, filter) --> (exp time * 100, counter)
44 // map target --> frame statistics
45 typedef QMap<QString, FrameStatistics> TargetStatistics;
46
47 /**
48 * @brief Navigator through the capture history.
49 */
51 public:
52 /**
53 * @brief Add a newly captured frame to the history
54 * @param data frame data
55 * @return true iff this is a new frame, i.e. its filename does not exist in the history
56 */
57 bool addFrame(FrameData data);
58
59 /**
60 * @brief Delete the current frame and (if possible) the corresponding file.
61 * If the last one has been deleted, navigate to the frame before, if possible.
62 * @return true iff deleting was successful
63 */
64 bool deleteFrame(int pos);
65
66 /**
67 * @brief the currently pointed capture frame
68 */
69 const FrameData currentFrame() {return m_history.at(m_position);}
70
71 /**
72 * @brief The current navigation position in the capture history
73 */
74 int position() {return m_position;}
75 /**
76 * @brief Obtain the frame from the given position in the history
77 */
78 const FrameData getFrame(int pos) {return m_history.at(pos);}
79 /**
80 * @brief Capture history size
81 */
82 int size() {return m_history.size();}
83 /**
84 * @brief Reset the history
85 */
86 void reset();
87 /**
88 * @brief Move one step forward in the history
89 * @return true iff the move was possible within the limits
90 */
91 bool forward();
92 /**
93 * @brief Move one step backwards in the history
94 * @return true iff the move was possible within the limits
95 */
96 bool backward();
97 /**
98 * @brief Iterate over the current target history and add all
99 * those where the corresponding file exists.
100 */
102
103 // capture statistics
104 TargetStatistics statistics;
105
106 private:
107 QList<FrameData> m_history;
108 int m_position = -1;
109
110 /**
111 * @brief Add a new frame to the statistics
112 * @param target current target being processed
113 * @param frameType type of the currently captured frame
114 * @param filter selected filter for the captured frame
115 * @param exptime exposure time of the captured frame
116 */
117 void countNewFrame(QString target, CCDFrameType frameType, QString filter, double exptime);
118 };
119
120 bool addFrameData(FrameData data);
121 /**
122 * @brief Update the overlay with the meta data of the current frame and add it to the history
123 */
124 void updateFrameData();
125
126 /**
127 * @brief Update the current target distance.
128 * @param targetDiff distance to the target in arcseconds.
129 */
130 void updateTargetDistance(double targetDiff);
131
132 /**
133 * @brief Obtain the position of the current frame from the history
134 */
135 int currentPosition() {return m_captureHistory.position();}
136
137 /**
138 * @brief Retrieve the currently selected frame
139 */
140 const FrameData currentFrame() {return m_captureHistory.currentFrame();}
141
142 /**
143 * @brief Obtain the frame from the given position in the history
144 */
145 const FrameData getFrame(int pos) {return m_captureHistory.getFrame(pos);}
146
147 /**
148 * @brief Obtain the position of the current frame from the history
149 */
150
151 /**
152 * @brief Returns true iff there are frames in the capture history
153 */
154 bool hasFrames() {return m_captureHistory.size() > 0;}
155
156 /**
157 * @brief Update the statistics display for captured frames
158 */
159 void displayTargetStatistics();
160
161 /**
162 * @brief Loads a new frame into the view and displays meta data in the overlay
163 * @param data pointer to FITSData object
164 */
165 bool addFrame(const QSharedPointer<FITSData> &data);
166
167 /**
168 * @brief Show the next frame from the capture history
169 */
170 bool showNextFrame();
171
172 /**
173 * @brief Show the previous frame from the capture history
174 */
175 bool showPreviousFrame();
176
177 /**
178 * @brief Delete the currently displayed frame
179 */
180 bool deleteFrame(int pos);
181
182private:
183 //capture history
184 CaptureHistory m_captureHistory;
185
186};
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 Tue Mar 26 2024 11:19:02 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.