Kstars

mosaictilesmodel.h
1 /*
2  SPDX-FileCopyrightText: 2022 Jasem Mutlaq <[email protected]>
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 positionAngle MEMBER m_PositionAngle READ positionAngle WRITE setPositionAngle NOTIFY positionAngleChanged)
25  Q_PROPERTY(QSize cameraSize MEMBER m_CameraSize READ cameraSize WRITE setCameraSize NOTIFY cameraSizeChanged)
26  Q_PROPERTY(QSizeF pixelSize MEMBER m_PixelSize READ pixelSize WRITE setPixelSize NOTIFY pixelSizeChanged)
27  Q_PROPERTY(QSizeF pixelScale MEMBER m_PixelScale READ pixelScale WRITE setPixelScale NOTIFY pixelScaleChanged)
28  Q_PROPERTY(QSize gridSize MEMBER m_GridSize READ gridSize WRITE setGridSize NOTIFY gridSizeChanged)
29  Q_PROPERTY(double overlap MEMBER m_Overlap READ overlap WRITE setOverlap NOTIFY overlapChanged)
30  Q_PROPERTY(SkyPoint skycenter MEMBER m_SkyCenter READ skyCenter WRITE setSkyCenter NOTIFY skycenterChanged)
31 
32  public:
33  MosaicTilesModel(QObject *parent = nullptr);
34  ~MosaicTilesModel() override;
35 
36  /***************************************************************************************************
37  * Import/Export Functions.
38  ***************************************************************************************************/
39  /**
40  * @brief toXML
41  * @param output
42  * @return
43  */
44  bool toXML(const QTextStream &output);
45 
46  /**
47  * @brief fromXML
48  * @param root
49  * @return
50  */
51  bool fromXML(XMLEle *root);
52 
53  /**
54  * @brief toJSON
55  * @param output
56  * @return
57  */
58  bool toJSON(QJsonObject &output);
59 
60  /**
61  * @brief fromJSON
62  * @param input
63  * @return
64  */
65  bool fromJSON(const QJsonObject &input);
66 
67  /***************************************************************************************************
68  * Tile Functions.
69  ***************************************************************************************************/
70  typedef struct
71  {
72  QPointF pos;
73  QPointF center;
74  SkyPoint skyCenter;
75  double rotation;
76  int index;
77  } OneTile;
78 
79  void appendTile(const OneTile &value);
80  void appendEmptyTile();
81  void clearTiles();
82 
83  // Getters
84 
85  // Return Camera Field of View in arcminutes
86  Q_INVOKABLE QSizeF cameraFOV() const
87  {
88  return m_cameraFOV;
89  }
90  // Return Mosaic Field of View in arcminutes
91  Q_INVOKABLE QSizeF mosaicFOV() const
92  {
93  return m_MosaicFOV;
94  }
95 
96  // Return Sky Point
97  double focalLength() const {return m_FocalLength;}
98  double positionAngle() const {return m_PositionAngle;}
99  QSize cameraSize() const {return m_CameraSize;}
100  QSizeF pixelSize() const {return m_PixelSize;}
101  QSizeF pixelScale() const {return m_PixelScale;}
102  QSize gridSize() const {return m_GridSize;}
103  double overlap() const {return m_Overlap;}
104  const SkyPoint &skyCenter() const {return m_SkyCenter;}
105 
106  // Setters
107  void setFocalLength(double value) {m_FocalLength = value;}
108  void setPositionAngle(double value);
109  void setCameraSize(const QSize &value) { m_CameraSize = value;}
110  void setPixelSize(const QSizeF &value) { m_PixelSize = value;}
111  void setPixelScale(const QSizeF &value) { m_PixelScale = value;}
112  void setGridSize(const QSize &value) {m_GridSize = value;}
113  void setSkyCenter(const SkyPoint &value) { m_SkyCenter = value;}
114  void setOverlap(double value);
115 
116  // Titles
117  const QList<std::shared_ptr<OneTile>> & tiles() const {return m_Tiles;}
118  std::shared_ptr<MosaicTilesModel::OneTile> oneTile(int row, int col);
119 
120  protected:
121 
122  signals:
123  void focalLengthChanged();
124  void cameraSizeChanged();
125  void pixelSizeChanged();
126  void pixelScaleChanged();
127  void gridSizeChanged();
128  void overlapChanged();
129  void positionAngleChanged();
130  void skycenterChanged();
131 
132  private:
133 
134  // Overall properties
135  double m_FocalLength {0};
136  QSize m_CameraSize;
137  QSizeF m_PixelSize, m_PixelScale, m_cameraFOV, m_MosaicFOV;
138  QSize m_GridSize {1,1};
139  double m_Overlap {10};
140  double m_PositionAngle {0};
141  SkyPoint m_SkyCenter;
142 
144 };
145 }
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:70
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-2022 The KDE developers.
Generated on Thu Aug 11 2022 04:00:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.