Kstars

mosaictilesmodel.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 "skypoint.h"
10 #include <lilxml.h>
11 #include <memory>
12 
13 namespace Ekos
14 {
15 
16 /**
17  * @brief The MosaicTilesModel class holds the data representation of the mosaic tiles. These represent metadata describing the
18  * overall mosaic, and tile-per-tile specific metadata.
19  */
20 class MosaicTilesModel : public QObject
21 {
22  Q_OBJECT
23  Q_PROPERTY(double focalLength MEMBER m_FocalLength READ focalLength WRITE setFocalLength NOTIFY focalLengthChanged)
24  Q_PROPERTY(double focalReducer MEMBER m_FocalReducer READ focalReducer WRITE setFocalReducer NOTIFY focalReducerChanged)
25  Q_PROPERTY(double positionAngle MEMBER m_PositionAngle READ positionAngle WRITE setPositionAngle NOTIFY positionAngleChanged)
26  Q_PROPERTY(QSize cameraSize MEMBER m_CameraSize READ cameraSize WRITE setCameraSize NOTIFY cameraSizeChanged)
27  Q_PROPERTY(QSizeF pixelSize MEMBER m_PixelSize READ pixelSize WRITE setPixelSize NOTIFY pixelSizeChanged)
28  Q_PROPERTY(QSizeF pixelScale MEMBER m_PixelScale READ pixelScale WRITE setPixelScale NOTIFY pixelScaleChanged)
29  Q_PROPERTY(QSize gridSize MEMBER m_GridSize READ gridSize WRITE setGridSize NOTIFY gridSizeChanged)
30  Q_PROPERTY(double overlap MEMBER m_Overlap READ overlap WRITE setOverlap NOTIFY overlapChanged)
31  Q_PROPERTY(SkyPoint skycenter MEMBER m_SkyCenter READ skyCenter WRITE setSkyCenter NOTIFY skycenterChanged)
32 
33  public:
34  MosaicTilesModel(QObject *parent = nullptr);
35  ~MosaicTilesModel() override;
36 
37  /***************************************************************************************************
38  * Import/Export Functions.
39  ***************************************************************************************************/
40  /**
41  * @brief toXML
42  * @param output
43  * @return
44  */
45  bool toXML(const QTextStream &output);
46 
47  /**
48  * @brief fromXML
49  * @param root
50  * @return
51  */
52  bool fromXML(XMLEle *root);
53 
54  /**
55  * @brief toJSON
56  * @param output
57  * @return
58  */
59  bool toJSON(QJsonObject &output);
60 
61  /**
62  * @brief fromJSON
63  * @param input
64  * @return
65  */
66  bool fromJSON(const QJsonObject &input);
67 
68  /***************************************************************************************************
69  * Tile Functions.
70  ***************************************************************************************************/
71  typedef struct
72  {
73  QPointF pos;
74  QPointF center;
75  SkyPoint skyCenter;
76  double rotation;
77  int index;
78  } OneTile;
79 
80  void appendTile(const OneTile &value);
81  void appendEmptyTile();
82  void clearTiles();
83 
84  // Getters
85 
86  // Return Camera Field of View in arcminutes
87  Q_INVOKABLE QSizeF cameraFOV() const
88  {
89  return m_cameraFOV;
90  }
91  // Return Mosaic Field of View in arcminutes
92  Q_INVOKABLE QSizeF mosaicFOV() const
93  {
94  return m_MosaicFOV;
95  }
96 
97  // Return Sky Point
98  double focalLength() const {return m_FocalLength;}
99  double focalReducer() const {return m_FocalReducer;}
100  double positionAngle() const {return m_PositionAngle;}
101  QSize cameraSize() const {return m_CameraSize;}
102  QSizeF pixelSize() const {return m_PixelSize;}
103  QSizeF pixelScale() const {return m_PixelScale;}
104  QSize gridSize() const {return m_GridSize;}
105  double overlap() const {return m_Overlap;}
106  const SkyPoint &skyCenter() const {return m_SkyCenter;}
107 
108  // Setters
109  void setFocalLength(double value) {m_FocalLength = value;}
110  void setFocalReducer(double value) {m_FocalReducer = value;}
111  void setPositionAngle(double value);
112  void setCameraSize(const QSize &value) { m_CameraSize = value;}
113  void setPixelSize(const QSizeF &value) { m_PixelSize = value;}
114  void setPixelScale(const QSizeF &value) { m_PixelScale = value;}
115  void setGridSize(const QSize &value) {m_GridSize = value;}
116  void setSkyCenter(const SkyPoint &value) { m_SkyCenter = value;}
117  void setOverlap(double value);
118 
119  // Titles
120  const QList<std::shared_ptr<OneTile>> & tiles() const {return m_Tiles;}
121  std::shared_ptr<MosaicTilesModel::OneTile> oneTile(int row, int col);
122 
123  protected:
124 
125  signals:
126  void focalLengthChanged();
127  void focalReducerChanged();
128  void cameraSizeChanged();
129  void pixelSizeChanged();
130  void pixelScaleChanged();
131  void gridSizeChanged();
132  void overlapChanged();
133  void positionAngleChanged();
134  void skycenterChanged();
135 
136  private:
137 
138  // Overall properties
139  double m_FocalLength {0};
140  double m_FocalReducer {1};
141  QSize m_CameraSize;
142  QSizeF m_PixelSize, m_PixelScale, m_cameraFOV, m_MosaicFOV;
143  QSize m_GridSize {1,1};
144  double m_Overlap {10};
145  double m_PositionAngle {0};
146  SkyPoint m_SkyCenter;
147 
149 };
150 }
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
The MosaicTilesModel class holds the data representation of the mosaic tiles.
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:77
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
bool toXML(const QTextStream &output)
toXML
bool fromJSON(const QJsonObject &input)
fromJSON
Q_INVOKABLEQ_INVOKABLE
bool fromXML(XMLEle *root)
fromXML
QObject * parent() const const
bool toJSON(QJsonObject &output)
toJSON
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 04:02:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.