Files
tenmon/imageinfo.h
T
2022-06-13 23:28:39 +02:00

72 lines
1.4 KiB
C++

#ifndef IMAGEINFO_H
#define IMAGEINFO_H
#include <QTreeWidget>
#include <wcslib/wcs.h>
#include <cmath>
struct FITSRecord
{
QByteArray key;
QVariant value;
QByteArray comment;
bool editable() const;
};
class SkyPoint
{
double ra = NAN;
double dec = NAN;
public:
SkyPoint();
SkyPoint(double ra, double dec);
void set(double ra, double dec);
double RA() const { return ra; }
double DEC() const { return dec; }
QString toString() const;
};
class WCSData
{
int nwcs = 0;
struct wcsprm *wcs = nullptr;
void freeWCS();
public:
WCSData();
WCSData(char *header, int nrec);
~WCSData();
bool pixelToWorld(const QPointF &pixel, SkyPoint &point) const;
bool worldToPixel(const SkyPoint &point, QPointF &pixel) const;
void calculateBounds(int w, int h, double &minRa, double &maxRa, double &minDec, double &maxDec);
bool valid() const { return wcs; };
};
struct ImageInfoData
{
QVector<FITSRecord> fitsHeader;
QVector<QPair<QString, QString>> info;
std::shared_ptr<WCSData> wcs;
};
Q_DECLARE_METATYPE(ImageInfoData);
typedef enum
{
None,
Statistics,
Peaks,
Stars,
}AnalyzeLevel;
class ImageInfo : public QTreeWidget
{
Q_OBJECT
public:
explicit ImageInfo(QWidget *parent);
~ImageInfo() override;
public slots:
void setInfo(const ImageInfoData &info);
};
#endif // IMAGEINFO_H