Kstars

mosaictiles.h
1/*
2 SPDX-FileCopyrightText: 2022 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "skyobject.h"
10#include "config-kstars.h"
11
12#include <QBrush>
13#include <QPen>
14#include <memory>
15
16#ifdef HAVE_INDI
17#include <lilxml.h>
18#endif
19
20class QPainter;
21
22class MosaicTiles : public SkyObject
23{
24 public:
25 MosaicTiles();
26 ~MosaicTiles();
27
28 public:
29
30 /***************************************************************************************************
31 * Import/Export Functions.
32 ***************************************************************************************************/
33#ifdef HAVE_INDI
34 /**
35 * @brief fromXML Load Scheduler XML file and parse it to create tiles in operation mode.
36 * @param filename full path to filename
37 * @return True if parsing is successful, false otherwise.
38 */
39 bool fromXML(const QString &filename);
40#endif
41
42 /**
43 * @brief toJSON
44 * @param output
45 * @return
46 */
47 //bool toJSON(QJsonObject &output);
48
49 /**
50 * @brief fromJSON
51 * @param input
52 * @return
53 */
54 //bool fromJSON(const QJsonObject &input);
55
56 /***************************************************************************************************
57 * Operation Modes
58 ***************************************************************************************************/
59 typedef enum
60 {
61 MODE_PLANNING,
62 MODE_OPERATION
63 } OperationMode;
64
65 OperationMode m_OperationMode {MODE_PLANNING};
66 OperationMode operationMode() const { return m_OperationMode;}
67 void setOperationMode(OperationMode value) {m_OperationMode = value;}
68
69 /***************************************************************************************************
70 * Tile Functions.
71 ***************************************************************************************************/
72 typedef struct
73 {
74 QPointF pos;
76 SkyPoint skyCenter;
77 double rotation;
78 int index;
79 } OneTile;
80
81 bool isValid() const;
82 void createTiles(bool s_shaped);
83 void appendTile(const OneTile &value);
84 void appendEmptyTile();
85 void clearTiles();
86 void draw(QPainter *painter);
87
88 /**
89 * @brief syncFOVs Update camera and mosaic overall FOV from current settings.
90 */
91 void syncFOVs();
92
93 // Getters
94 // Return Sky Point
95 double focalLength() const
96 {
97 return m_FocalLength;
98 }
99 double focalReducer() const
100 {
101 return m_FocalReducer;
102 }
103 double positionAngle() const
104 {
105 return m_PositionAngle;
106 }
107 QSize cameraSize() const
108 {
109 return m_CameraSize;
110 }
111 QSizeF pixelSize() const
112 {
113 return m_PixelSize;
114 }
115 QSize gridSize() const
116 {
117 return m_GridSize;
118 }
119 double overlap() const
120 {
121 return m_Overlap;
122 }
123 // Return Camera Field of View in arcminutes
124 QSizeF cameraFOV() const
125 {
126 return m_CameraFOV;
127 }
128 // Return Mosaic Field of View in arcminutes
129 QSizeF mosaicFOV() const
130 {
131 return m_MosaicFOV;
132 }
133
134 // Setters
135 void setFocalLength(double value)
136 {
137 m_FocalLength = value;
138 }
139 void setFocalReducer(double value)
140 {
141 m_FocalReducer = value;
142 }
143 void setPositionAngle(double value);
144 void setCameraSize(const QSize &value)
145 {
146 m_CameraSize = value;
147 }
148 void setPixelSize(const QSizeF &value)
149 {
150 m_PixelSize = value;
151 }
152 void setGridSize(const QSize &value)
153 {
154 m_GridSize = value;
155 }
156 void setOverlap(double value);
157 void setCameraFOV(const QSizeF &value)
158 {
159 m_CameraFOV = value;
160 }
161 void setMosaicFOV(const QSizeF &value)
162 {
163 m_MosaicFOV = value;
164 }
165 void setPainterAlpha(int value)
166 {
167 m_PainterAlpha = value;
168 }
169 void setPainterAlphaAuto(bool value)
170 {
171 m_PainterAlphaAuto = value;
172 }
173 const QString &targetName() const {return m_TargetName;}
174 void setTargetName(const QString &value)
175 {
176 m_TargetName = value;
177 }
178 const QString &group() const {return m_Group;}
179 void setGroup(const QString &value)
180 {
181 m_Group = value;
182 }
183 const QString &completionCondition(QString *arg) const {
184 *arg = m_CompletionConditionArg;
185 return m_CompletionCondition;
186 }
187 void setCompletionCondition(const QString &value, const QString &arg = "")
188 {
189 m_CompletionCondition = value;
190 m_CompletionConditionArg = arg;
191 }
192
193 const QString &sequenceFile() const {return m_SequenceFile;}
194 void setSequenceFile(const QString &value)
195 {
196 m_SequenceFile = value;
197 }
198 const QString &outputDirectory() const {return m_OutputDirectory;}
199 void setOutputDirectory(const QString &value)
200 {
201 m_OutputDirectory = value;
202 }
203 int focusEveryN() const {return m_FocusEveryN;}
204 void setFocusEveryN(int value)
205 {
206 m_FocusEveryN = value;
207 }
208 int alignEveryN() const {return m_AlignEveryN;}
209 void setAlignEveryN(int value)
210 {
211 m_AlignEveryN = value;
212 }
213 bool isTrackChecked() const {return m_TrackChecked;}
214 bool isFocusChecked() const {return m_FocusChecked;}
215 bool isAlignChecked() const {return m_AlignChecked;}
216 bool isGuideChecked() const {return m_GuideChecked;}
217 void setStepChecks(bool track, bool focus, bool align, bool guide)
218 {
219 m_TrackChecked = track;
220 m_FocusChecked = focus;
221 m_AlignChecked = align;
222 m_GuideChecked = guide;
223 }
224
225 // Titles
226 const QList<std::shared_ptr<OneTile>> &tiles() const
227 {
228 return m_Tiles;
229 }
230 std::shared_ptr<OneTile> oneTile(int row, int col);
231
232 private:
233
234 // Overall properties
235 double m_FocalLength {0};
236 double m_FocalReducer {1};
237 QSize m_CameraSize;
238 QSizeF m_PixelSize, m_CameraFOV, m_MosaicFOV;
239 QSize m_GridSize {1, 1};
240 double m_Overlap {10};
241 double m_PositionAngle {0};
242 bool m_SShaped {false};
243 int m_PainterAlpha {50};
244 bool m_PainterAlphaAuto {true};
245 QString m_TargetName;
246 QString m_Group;
247 QString m_CompletionCondition;
248 QString m_CompletionConditionArg;
249 QString m_SequenceFile;
250 QString m_OutputDirectory;
251 int m_FocusEveryN {1};
252 int m_AlignEveryN {1};
253 bool m_TrackChecked {true}, m_FocusChecked {true}, m_AlignChecked {true}, m_GuideChecked {true};
254
255 QBrush m_Brush;
256 QPen m_Pen;
257 QBrush m_TextBrush;
258 QPen m_TextPen;
259
261
262 /**
263 * @brief adjustCoordinate This uses the mosaic center as reference and the argument resolution of the sky map at that center.
264 * @param tileCoord point to adjust
265 * @return Returns scaled offsets for a pixel local coordinate.
266 */
267 QSizeF adjustCoordinate(QPointF tileCoord);
268 void updateTiles();
269
270 bool processJobInfo(XMLEle *root, int index);
271
272 QPointF rotatePoint(QPointF pointToRotate, QPointF centerPoint, double paDegrees);
273
274 QSizeF calculateTargetMosaicFOV() const;
275 QSize mosaicFOVToGrid() const;
276 QSizeF calculateCameraFOV() const;
277
278
279 private:
280};
281
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
QTextStream & center(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:04 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.