Kstars

mosaictilesmodel.cpp
1 /*
2  SPDX-FileCopyrightText: 2022 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include <QQuickView>
8 #include <klocalizedcontext.h>
9 #include <klocalizedstring.h>
10 #include <QQmlContext>
11 
12 #include "mosaictilesmodel.h"
13 #include "Options.h"
14 #include "ekos_scheduler_debug.h"
15 
16 namespace Ekos
17 {
18 
19 MosaicTilesModel::MosaicTilesModel(QObject *parent) : QObject(parent)
20 {
21  m_FocalLength = Options::telescopeFocalLength();
22  m_CameraSize.setWidth(Options::cameraWidth());
23  m_CameraSize.setHeight(Options::cameraHeight());
24  m_PixelSize.setWidth(Options::cameraPixelWidth());
25  m_PixelSize.setHeight(Options::cameraPixelHeight());
26  m_PositionAngle = Options::cameraRotation();
27 }
28 
29 void MosaicTilesModel::setPositionAngle(double value)
30 {
31  m_PositionAngle = std::fmod(value * -1 + 360.0, 360.0);
32 }
33 
34 void MosaicTilesModel::setOverlap(double value)
35 {
36  m_Overlap = (value < 0) ? 0 : (1 < value) ? 1 : value;
37 }
38 
39 MosaicTilesModel::~MosaicTilesModel()
40 {
41 }
42 
43 std::shared_ptr<MosaicTilesModel::OneTile> MosaicTilesModel::oneTile(int row, int col)
44 {
45  int offset = row * m_GridSize.width() + col;
46 
47  if (offset < 0 || offset >= m_Tiles.size())
48  return nullptr;
49 
50  return m_Tiles[offset];
51 }
52 
53 bool MosaicTilesModel::toXML(const QTextStream &output)
54 {
55  Q_UNUSED(output)
56  return false;
57 }
58 
59 bool MosaicTilesModel::fromXML(XMLEle *root)
60 {
61  Q_UNUSED(root)
62  return false;
63 }
64 
65 bool MosaicTilesModel::toJSON(QJsonObject &output)
66 {
67  Q_UNUSED(output)
68  return false;
69 }
70 
71 bool MosaicTilesModel::fromJSON(const QJsonObject &input)
72 {
73  Q_UNUSED(input)
74  return false;
75 }
76 
77 void MosaicTilesModel::appendTile(const OneTile &value)
78 {
79  m_Tiles.append(std::make_shared<OneTile>(value));
80 }
81 
82 void MosaicTilesModel::appendEmptyTile()
83 {
84  m_Tiles.append(std::make_shared<OneTile>());
85 }
86 
87 void MosaicTilesModel::clearTiles()
88 {
89  m_Tiles.clear();
90 }
91 
92 }
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:66
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 03:57:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.