Kstars

simplefovexporter.h
1/*
2 SPDX-FileCopyrightText: 2011 Rafał Kułaga <rl.kulaga@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#ifndef SIMPLEFOVEXPORTER_H
8#define SIMPLEFOVEXPORTER_H
9
10#include "QList"
11
12class SkyPoint;
13class FOV;
14class KStarsData;
15class SkyMap;
16class QPaintDevice;
17
18/**
19 * \class SimpleFovExporter
20 * \brief SimpleFovExporter class is used for FOV representation exporting.
21 * Central point is defined by passed pointer to SkyPoint instance and field-of-view parameters
22 * are defined by FOV class instance. Fragment of sky is painted on passed QPaintDevice subclass.
23 * SimpleFovExporter class can be used for export of FOV representations in user-interactive mode as well as
24 * for export of multiple FOVs at once, without user interaction.
25 * \note Please note that SimpleFovExporter class instances may pause simulation clock if they're configured
26 * to do so (via setClockStopping() method).
27 * \note FOV representation's shape can be overridden (i.e. FOV image will be always rectangular) using
28 * setFovShapeOverriden() method.
29 */
31{
32 public:
33 /**
34 * \brief Constructor
35 */
37
38 /**
39 * \brief Paint FOV representation on passed QPaintDevice subclass.
40 * \param point central point of the exported FOV.
41 * \param fov represented field-of-view.
42 * \param pd paint device on which the representation of the FOV will be painted.
43 */
44 void exportFov(SkyPoint *point, FOV *fov, QPaintDevice *pd);
45
46 /**
47 * \brief Paint FOV representation on passed QPaintDevice subclass.
48 * \param fov represented field-of-view.
49 * \param pd paint device on which the representation of the FOV will be painted.
50 */
51 void exportFov(FOV *fov, QPaintDevice *pd);
52
53 /**
54 * \brief Paint FOV representation on passed QPaintDevice subclass.
55 * \param pd paint device on which the representation of the FOV will be painted.
56 */
57 void exportFov(QPaintDevice *pd);
58
59 /**
60 * \brief Export multiple FOV representations.
61 * \param points list of central points.
62 * \param fovs list of fields-of-view.
63 * \param pds list of paint devices on which the representation of the FOV will be painted.
64 */
65 void exportFov(const QList<SkyPoint *> &points, const QList<FOV *> &fovs, const QList<QPaintDevice *> &pds);
66
67 /**
68 * \brief Export multiple FOV representations.
69 * \param points list of central points.
70 * \param fov list of fields-of-view.
71 * \param pds list of paint devices on which the representation of the FOV will be painted.
72 */
73 void exportFov(const QList<SkyPoint *> &points, FOV *fov, const QList<QPaintDevice *> &pds);
74
75 /**
76 * \brief Check if FOV export will cause simulation clock to be stopped.
77 * \return true if clock will be stopped for FOV export.
78 * \note If changed, previous clock state will be restored after FOV export is done.
79 */
80 inline bool isClockStopping() const { return m_StopClock; }
81
82 /**
83 * \brief Check if FOV representation will be always rectangular.
84 * \return true if FOV shape is overridden.
85 */
86 inline bool isFovShapeOverriden() const { return m_OverrideFovShape; }
87
88 /**
89 * \brief Check if FOV symbol will be drawn.
90 * \return true if FOV symbol will be drawn.
91 */
92 inline bool isFovSymbolDrawn() const { return m_DrawFovSymbol; }
93
94 /**
95 * \brief Enable or disable stopping simulation for FOV export.
96 * \param stopping should be true if stopping is to be enabled.
97 */
98 inline void setClockStopping(bool stopping) { m_StopClock = stopping; }
99
100 /**
101 * \brief Enable or disable FOV shape overriding.
102 * \param overrideFovShape should be true if FOV representation is to be always rectangular.
103 */
104 inline void setFovShapeOverriden(bool overrideFovShape) { m_OverrideFovShape = overrideFovShape; }
105
106 /**
107 * \brief Enable or disable FOV symbol drawing.
108 * \param draw should be true if FOV symbol is to be drawn.
109 */
110 inline void setFovSymbolDrawn(bool draw) { m_DrawFovSymbol = draw; }
111
112 /**
113 * \brief Calculate zoom level at which given angular length will occupy given length in pixels.
114 * \param pixelSize size in pixels.
115 * \param degrees angular length.
116 * \return zoom level.
117 */
118 static inline double calculateZoomLevel(int pixelSize, float degrees) { return (pixelSize * 57.3 * 60) / degrees; }
119
120 /**
121 * \brief Calculate pixel size of given angular length at given zoom level.
122 * \param degrees angular length.
123 * \param zoomLevel zoom level.
124 * \return size in pixels.
125 */
126 static inline double calculatePixelSize(float degrees, double zoomLevel)
127 {
128 return degrees * zoomLevel / (57.3 * 60.0);
129 }
130
131 private:
132 /**
133 * \brief Save SkyMap state.
134 * \param savePos should be true if current position is to be saved.
135 */
136 void saveState(bool savePos);
137
138 /**
139 * \brief Restore saved SkyMap state.
140 * \param restorePos should be true if saved position is to be restored.
141 */
142 void restoreState(bool restorePos);
143
144 /**
145 * \brief Private FOV export method.
146 * \param point central point of the exported FOV.
147 * \param fov represented field-of-view.
148 * \param pd paint device on which the representation of the FOV will be painted.
149 * \note Call to this method will not change SkyMap's state.
150 */
151 void pExportFov(SkyPoint *point, FOV *fov, QPaintDevice *pd);
152
153 KStarsData *m_KSData;
154 SkyMap *m_Map;
155
156 bool m_StopClock;
157 bool m_OverrideFovShape;
158 bool m_DrawFovSymbol;
159
160 bool m_PrevClockState;
161 bool m_PrevSlewing;
162 SkyPoint *m_PrevPoint;
163 double m_PrevZoom;
164};
165
166#endif // SIMPLEFOVEXPORTER_H
A simple class encapsulating a Field-of-View symbol.
Definition fov.h:28
KStarsData is the backbone of KStars.
Definition kstarsdata.h:74
SimpleFovExporter class is used for FOV representation exporting.
bool isClockStopping() const
Check if FOV export will cause simulation clock to be stopped.
void setFovSymbolDrawn(bool draw)
Enable or disable FOV symbol drawing.
static double calculatePixelSize(float degrees, double zoomLevel)
Calculate pixel size of given angular length at given zoom level.
SimpleFovExporter()
Constructor.
static double calculateZoomLevel(int pixelSize, float degrees)
Calculate zoom level at which given angular length will occupy given length in pixels.
void exportFov(SkyPoint *point, FOV *fov, QPaintDevice *pd)
Paint FOV representation on passed QPaintDevice subclass.
bool isFovSymbolDrawn() const
Check if FOV symbol will be drawn.
void setFovShapeOverriden(bool overrideFovShape)
Enable or disable FOV shape overriding.
void setClockStopping(bool stopping)
Enable or disable stopping simulation for FOV export.
bool isFovShapeOverriden() const
Check if FOV representation will be always rectangular.
This is the canvas on which the sky is painted.
Definition skymap.h:54
The sky coordinates of a point in the sky.
Definition skypoint.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.