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 "fitscommon.h"
10 #include "fitsdata.h"
11 #include "fitshistogramcommand.h"
12 
13 #include "qcustomplot.h"
14 
15 class QMouseEvent;
16 
17 class FITSHistogramView : public QCustomPlot
18 {
19         Q_OBJECT
20 
21         Q_PROPERTY(bool axesLabelEnabled MEMBER m_AxesLabelEnabled)
22         Q_PROPERTY(bool linear MEMBER m_Linear)
23         friend class histDrawArea;
24 
25     public:
26         explicit FITSHistogramView(QWidget *parent = nullptr);
27 
28         void reset();
29         void setImageData(const QSharedPointer<FITSData> &data);
30         void syncGUI();
31 
32     protected:
33         void showEvent(QShowEvent * event) override;
34         void driftMouseOverLine(QMouseEvent * event);
35 
36     signals:
37         void constructed();
38 
39     public slots:
40         //void applyScale();
41         void resizePlot();
42 
43     private:
44         void createNonLinearHistogram();
45         QVector<QCPGraph *> graphs;
46         QVector<int> numDecimals;
47         bool isGUISynced { false};
48         bool m_AxesLabelEnabled {true};
49         bool m_Linear { true };
50         QSharedPointer<FITSData> m_ImageData;
51         QVector<QVector<double>> m_HistogramIntensity;
52         QVector<QVector<double>> m_HistogramFrequency;
53 };
54