File indexing completed on 2024-04-14 14:10:36

0001 /*
0002     SPDX-FileCopyrightText: 2021 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QUndoCommand>
0010 #include "fitsdata.h"
0011 
0012 class FITSData;
0013 class FITSHistogramEditor;
0014 
0015 class FITSHistogramCommand : public QUndoCommand
0016 {
0017     public:
0018         FITSHistogramCommand(const QSharedPointer<FITSData> &data, FITSHistogramEditor * inHisto, FITSScale newType,
0019                              const QVector<double> &lmin,
0020                              const QVector<double> &lmax);
0021         virtual ~FITSHistogramCommand();
0022 
0023         virtual void redo() override;
0024         virtual void undo() override;
0025         virtual QString text() const;
0026 
0027     private:
0028         bool calculateDelta(const uint8_t * buffer);
0029         bool reverseDelta();
0030 
0031         FITSImage::Statistic stats;
0032 
0033         QSharedPointer<FITSData> m_ImageData;
0034         FITSHistogramEditor * histogram { nullptr };
0035         FITSScale type;
0036         QVector<double> min, max;
0037 
0038         unsigned char * delta { nullptr };
0039         unsigned long compressedBytes { 0 };
0040 
0041 };