File indexing completed on 2024-04-21 03:43:51

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 "fitscommon.h"
0010 #include "fitsdata.h"
0011 #include "fitshistogramcommand.h"
0012 
0013 #include "qcustomplot.h"
0014 
0015 class QMouseEvent;
0016 
0017 class FITSHistogramView : public QCustomPlot
0018 {
0019         Q_OBJECT
0020 
0021         Q_PROPERTY(bool axesLabelEnabled MEMBER m_AxesLabelEnabled)
0022         Q_PROPERTY(bool linear MEMBER m_Linear)
0023         friend class histDrawArea;
0024 
0025     public:
0026         explicit FITSHistogramView(QWidget *parent = nullptr);
0027 
0028         void reset();
0029         void setImageData(const QSharedPointer<FITSData> &data);
0030         void syncGUI();
0031 
0032     protected:
0033         void showEvent(QShowEvent * event) override;
0034         void driftMouseOverLine(QMouseEvent * event);
0035 
0036     signals:
0037         void constructed();
0038 
0039     private slots:
0040         void onXRangeChanged(const QCPRange &range);
0041         void onYRangeChanged(const QCPRange &range);
0042 
0043     public slots:
0044         //void applyScale();
0045         void resizePlot();
0046 
0047     private:
0048         void createNonLinearHistogram();
0049         QVector<QCPGraph *> graphs;
0050         QVector<int> numDecimals;
0051         bool isGUISynced { false};
0052         bool m_AxesLabelEnabled {true};
0053         bool m_Linear { true };
0054         QSharedPointer<FITSData> m_ImageData;
0055         QVector<QVector<double>> m_HistogramIntensity;
0056         QVector<QVector<double>> m_HistogramFrequency;
0057 };