File indexing completed on 2024-04-14 14:10:37
0001 /* 0002 SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QPixmap> 0010 #include <KIO/Job> 0011 #include <QFile> 0012 0013 #include "dms.h" 0014 0015 class FITSImage; 0016 class SkyPoint; 0017 0018 typedef struct 0019 { 0020 FITSImage *image_data; 0021 dms ra, dec; 0022 int pix_width, pix_height; 0023 QPixmap pix; 0024 } FOverlay; 0025 0026 class FITSOverlay : public QObject 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 FITSOverlay(); 0032 ~FITSOverlay(); 0033 0034 void addFITSOverlay(const dms &ra, const dms &dec, const QUrl &imageURL); 0035 //void removeFITSOverlay(const SkyPoint *clickedPoint); 0036 0037 //const QPixmap *getPixmap() { return &pix;} 0038 //const SkyPoint *getCoord() { return coord; } 0039 0040 bool contains(const dms &ra, const dms &dec); 0041 0042 QList<FOverlay *> getOverlays() { return fList; } 0043 0044 private: 0045 void loadImageFromURL(); 0046 void openImage(); 0047 0048 QUrl m_ImageUrl; 0049 KIO::Job *downloadJob { nullptr }; // download job of image -> 0 == no job is running 0050 QString filename; 0051 QFile file; 0052 dms ra, dec; 0053 0054 QList<FOverlay *> fList; 0055 0056 private slots: 0057 /**Make sure download has finished, then make sure file exists, then save the image */ 0058 void downloadReady(KJob *); 0059 };