1 /* 2 SPDX-FileCopyrightText: 2015 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 11 #include <QGraphicsScene> 12 #include <QGraphicsItem> 13 #include <QDialog> 14 #include <QBrush> 15 #include <QPen> 16 17 namespace Ui 18 { 19 class mosaicDialog; 20 } 21 22 namespace Ekos 23 { 24 class Scheduler; 25 class MosaicTile; 26 27 class Mosaic : public QDialog 28 { 29 Q_OBJECT 30 31 public: 32 Mosaic(QString targetName, SkyPoint center, QWidget *parent = nullptr); 33 ~Mosaic() override; 34 35 public: 36 Ui::mosaicDialog* ui { nullptr }; 37 38 void setCameraSize(uint16_t width, uint16_t height); 39 void setPixelSize(double pixelWSize, double pixelHSize); 40 void setFocalLength(double focalLength); 41 void setCenter(const SkyPoint &value); 42 QString getJobsDir() const; 43 44 public: 45 typedef struct _Job 46 { 47 SkyPoint center; 48 double rotation; 49 bool doAlign; 50 bool doFocus; 51 } Job; 52 53 QList <Job> getJobs() const; 54 55 protected: 56 virtual void showEvent(QShowEvent *) override; 57 virtual void resizeEvent(QResizeEvent *) override; 58 59 /// @brief Camera information validity checker. 60 bool isScopeInfoValid() const; 61 62 /// @brief Expected arcmin field width for the current number of tiles. 63 double getTargetWFOV() const; 64 65 /// @brief Expected arcmin field height for the current number of tiles. 66 double getTargetHFOV() const; 67 68 /// @brief Expected number of tiles for the current target field width. 69 double getTargetMosaicW() const; 70 71 /// @brief Expected number of tiles for the current target field height. 72 double getTargetMosaicH() const; 73 74 public slots: 75 void updateTargetFOVFromGrid(); 76 void updateGridFromTargetFOV(); 77 void constructMosaic(); 78 void calculateFOV(); 79 void updateTargetFOV(); 80 void saveJobsDirectory(); 81 void resetFOV(); 82 void fetchINDIInformation(); 83 void rewordStepEvery(int v); 84 85 public slots: 86 virtual int exec() override; 87 virtual void accept() override; 88 89 private: 90 SkyPoint center; 91 QImage *m_skyChart { nullptr }; 92 93 QPixmap targetPix; 94 QGraphicsPixmapItem *skyMapItem { nullptr }; 95 96 MosaicTile *mosaicTileItem { nullptr }; 97 98 double pixelsPerArcminRA { 0 }, pixelsPerArcminDE { 0 }; 99 double renderedWFOV { 0 }, renderedHFOV { 0 }; 100 double premosaicZoomFactor { 0 }; 101 102 QPointF screenPoint; 103 QGraphicsScene scene; 104 105 bool rememberAltAzOption; 106 107 QTimer *updateTimer { nullptr }; 108 }; 109 } 110