File indexing completed on 2024-04-28 03:43:43
0001 /* 0002 SPDX-FileCopyrightText: 2022 Jasem Mutlaq <mutlaqja@ikarustech.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include <QQuickView> 0008 #include <klocalizedcontext.h> 0009 #include <klocalizedstring.h> 0010 #include <QQmlContext> 0011 0012 #include "mosaictilesmodel.h" 0013 #include "Options.h" 0014 #include "ekos_scheduler_debug.h" 0015 0016 namespace Ekos 0017 { 0018 0019 MosaicTilesModel::MosaicTilesModel(QObject *parent) : QObject(parent) 0020 { 0021 m_FocalLength = Options::telescopeFocalLength(); 0022 m_CameraSize.setWidth(Options::cameraWidth()); 0023 m_CameraSize.setHeight(Options::cameraHeight()); 0024 m_PixelSize.setWidth(Options::cameraPixelWidth()); 0025 m_PixelSize.setHeight(Options::cameraPixelHeight()); 0026 m_PositionAngle = Options::cameraRotation(); 0027 } 0028 0029 void MosaicTilesModel::setPositionAngle(double value) 0030 { 0031 m_PositionAngle = std::fmod(value * -1 + 360.0, 360.0); 0032 } 0033 0034 void MosaicTilesModel::setOverlap(double value) 0035 { 0036 m_Overlap = (value < 0) ? 0 : (1 < value) ? 1 : value; 0037 } 0038 0039 MosaicTilesModel::~MosaicTilesModel() 0040 { 0041 } 0042 0043 std::shared_ptr<MosaicTilesModel::OneTile> MosaicTilesModel::oneTile(int row, int col) 0044 { 0045 int offset = row * m_GridSize.width() + col; 0046 0047 if (offset < 0 || offset >= m_Tiles.size()) 0048 return nullptr; 0049 0050 return m_Tiles[offset]; 0051 } 0052 0053 bool MosaicTilesModel::toXML(const QTextStream &output) 0054 { 0055 Q_UNUSED(output) 0056 return false; 0057 } 0058 0059 bool MosaicTilesModel::fromXML(XMLEle *root) 0060 { 0061 Q_UNUSED(root) 0062 return false; 0063 } 0064 0065 bool MosaicTilesModel::toJSON(QJsonObject &output) 0066 { 0067 Q_UNUSED(output) 0068 return false; 0069 } 0070 0071 bool MosaicTilesModel::fromJSON(const QJsonObject &input) 0072 { 0073 Q_UNUSED(input) 0074 return false; 0075 } 0076 0077 void MosaicTilesModel::appendTile(const OneTile &value) 0078 { 0079 m_Tiles.append(std::make_shared<OneTile>(value)); 0080 } 0081 0082 void MosaicTilesModel::appendEmptyTile() 0083 { 0084 m_Tiles.append(std::make_shared<OneTile>()); 0085 } 0086 0087 void MosaicTilesModel::clearTiles() 0088 { 0089 m_Tiles.clear(); 0090 } 0091 0092 }