File indexing completed on 2024-03-24 03:46:17
0001 /* 0002 SPDX-FileCopyrightText: 2015 Jasem Mutlaq <mutlaqja@ikarustech.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "skypoint.h" 0010 #include "ekos/ekos.h" 0011 #include "indi/indimount.h" 0012 0013 #include <QGraphicsScene> 0014 #include <QGraphicsItem> 0015 #include <QDialog> 0016 #include <QBrush> 0017 #include <QPen> 0018 0019 namespace Ui 0020 { 0021 class FramingAssistant; 0022 } 0023 0024 namespace Ekos 0025 { 0026 class Scheduler; 0027 class MosaicTilesManager; 0028 class MosaicTilesScene; 0029 0030 class FramingAssistantUI : public QDialog 0031 { 0032 Q_OBJECT 0033 public: 0034 0035 FramingAssistantUI(); 0036 ~FramingAssistantUI() override; 0037 0038 public: 0039 enum 0040 { 0041 PAGE_EQUIPMENT, 0042 PAGE_SELECT_GRID, 0043 PAGE_ADJUST_GRID, 0044 PAGE_CREATE_JOBS 0045 }; 0046 0047 // Import Mosaic JSON Data 0048 bool importMosaic(const QJsonObject &payload); 0049 0050 protected: 0051 /// @brief Camera information validity checker. 0052 bool isEquipmentValid() const; 0053 0054 /// @brief Expected arcmin field width for the current number of tiles. 0055 double getTargetWFOV() const; 0056 0057 /// @brief Expected arcmin field height for the current number of tiles. 0058 double getTargetHFOV() const; 0059 0060 /// @brief Expected number of tiles for the current target field width. 0061 double getTargetMosaicW() const; 0062 0063 /// @brief Expected number of tiles for the current target field height. 0064 double getTargetMosaicH() const; 0065 0066 /** 0067 * @brief goAndSolve Go to current center, capture an image, and solve. 0068 */ 0069 void goAndSolve(); 0070 0071 void createJobs(); 0072 // Select sequence file 0073 void selectSequence(); 0074 // Select jobs directory 0075 void selectDirectory(); 0076 // Select mosaic import 0077 void selectImport(); 0078 // Import mosaic CSV 0079 bool parseMosaicCSV(const QString &filename); 0080 // Sanitize target name 0081 void sanitizeTarget(); 0082 0083 public slots: 0084 void updateTargetFOVFromGrid(); 0085 void updateGridFromTargetFOV(); 0086 void constructMosaic(); 0087 void calculateFOV(); 0088 void resetFOV(); 0089 void fetchINDIInformation(); 0090 void rewordStepEvery(int v); 0091 void setMountState(ISD::Mount::Status value); 0092 void setAlignState(AlignState value); 0093 0094 private: 0095 0096 SkyPoint m_CenterPoint; 0097 Ui::FramingAssistant *ui {nullptr}; 0098 0099 double renderedWFOV { 0 }, renderedHFOV { 0 }; 0100 QTimer *m_DebounceTimer { nullptr }; 0101 0102 // Go and solve 0103 bool m_GOTOSolvePending {false}; 0104 AlignState m_AlignState {ALIGN_IDLE}; 0105 ISD::Mount::Status m_MountState {ISD::Mount::MOUNT_IDLE}; 0106 0107 // Equipment 0108 double m_FocalLength {0}; 0109 double m_FocalReducer {1}; 0110 QSize m_CameraSize; 0111 QSizeF m_PixelSize, m_cameraFOV, m_MosaicFOV; 0112 QSize m_GridSize {1, 1}; 0113 double m_Overlap {10}, m_PA {0}; 0114 QString m_JobsDirectory; 0115 }; 0116 }