File: QFitsWidget1D.h

package info (click to toggle)
dpuser 4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,084 kB
  • sloc: cpp: 124,807; ansic: 6,866; lex: 1,113; makefile: 777; yacc: 742; sh: 78
file content (189 lines) | stat: -rw-r--r-- 5,229 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#ifndef QFITSWIDGET1D_H
#define QFITSWIDGET1D_H

#include <QWidget>
#include <QDialog>
#include <QTableWidget>
#include <QLabel>
#include <QPushButton>

#include "QFitsBaseWidget.h"
#include "QFitsView1D.h"
#include "QFitsGlobal.h"
#include "fits.h"

class QFitsMainView;
class QFitsSimplestButton;
class QFitsMarkers;

class QFitsTransparentLabel;    // declared below
class QLabelWithoutMouse;       // declared below
class QWidgetWithoutMouse;      // declared below
class QFitsTransparentCaption;  // declared below
class QFitsSpectrumRangeControl;

class QFitsWidget1D : public QFitsBaseWidget {
    Q_OBJECT
//----- Functions -----
public:
    QFitsWidget1D(QFitsBaseBuffer*);
    ~QFitsWidget1D();

    void updateTable(const Fits &values);
    void updateHeight(int);
    void updatePos(int);
    void updateFWHM(int);
    void updateBase(int);

    //
    // overloaded abstract base functions
    //
    void updateScaling();
    void setXRange(const double &, const double &);
    void setYRange(const double &, const double &);
    void setData();
    virtual QFitsBaseView* getView()                        { return plotter; }

    void plotterKeyPressEvent(QKeyEvent*);
    void plotterMouseMoveEvent(QMouseEvent*);
    bool handleMousePressEvent(QMouseEvent*);

protected:
    void resizeEvent(QResizeEvent*);
    void paintEvent(QPaintEvent*);
    void keyReleaseEvent(QKeyEvent*);
    void enterEvent(QEvent*);

//----- Slots -----
public slots:
    void hide();
    void dofit();
    void handleescape();
    void subtractfit();
    void addfit();
    void copyfit();
    void updateRange();
    void rangeChanged(const double &, const double &);
//----- Signals -----
//----- Members -----
public:
    double                  fitx[2], fity[2];
    int                     bstart, bend,
                            ngauss,
                            heightupdate, posupdate, fwhmupdate, baseupdate,
                            currentStatusBarText;
    bool                    dagain, gagain, bagain;
    Fits                    fitgx, fitgy, types,
                            params, fitparams;
    QFitsView1D             *plotter;
    QFitsSpectrumRangeControl   *rangeControl;
    QTableWidget            *fitresults;
    QFitsTransparentLabel   *fitestimates;
    QVector<QString>        dpQtPlotStatusBarText;
};

class QFitsTransparentLabel : public QDialog {
    Q_OBJECT
//----- Functions -----
public:
    QFitsTransparentLabel(QFitsWidget1D*, QFitsView1D*);
    ~QFitsTransparentLabel() {}

    void setFitEstimates(int nparams, double *fitx, double *fity, Fits &types, Fits &fitgx, Fits &fitgy);
    void setFitResults(double *fitx, double *fity, const Fits &values);
    void showValues();
    void deleteFitResults();
    void removeMarker2();
    bool getShowEstimates() { return showEstimates; }
    int getNlines() { return nlines; }
    double getEstimateFitX(int i);
    double getEstimateFitY(int i);
    double getEstimateFitGX(int i) { return estimatefitgx[i];}
    double getEstimateFitGY(int i) { return estimatefitgy[i];}
    const Fits* const getEstimateFitGX() { return &estimatefitgx;}
    const Fits* const getEstimateFitGY() { return &estimatefitgy;}
    const Fits* const getFitResult() { return &fitResult;}

protected:
    void mouseMoveEvent(QMouseEvent *);
    void mouseDoubleClickEvent(QMouseEvent *);
    void leaveEvent(QEvent *);

//----- Slots -----
public slots:
    void fitestimatesClicked();
    void fitresultsClicked();

//----- Signals -----
//signals:
//    void mouseMoved(const QPoint &);

//----- Members -----
private:
    QFitsWidget1D* myParent;
    QFitsView1D* myView;
    QFitsTransparentCaption *theCaption;
    QWidgetWithoutMouse *viewArea;
    QLabelWithoutMouse *l1, *l2, *l3, *l4, *l5;
    QLabel *marker, *marker2;
    QFitsSimplestButton *fitestimatesTab, *fitresultsTab, *closeButton;
    QPushButton *fitButton, *addButton, *subButton, *clipboardButton;
    int nlines;
    bool showEstimates;
    bool hasFitResult;
    // values of the fit estimate
    double estimatefitx[2], estimatefity[2];
    int estimatenparams;
    Fits estimatetypes, estimatefitgx, estimatefitgy;
    // values of the fit result
    double resultfitx[2], resultfity[2];
    Fits fitResult;
};

class QFitsTransparentCaption : public QLabel {
    Q_OBJECT
//----- Functions -----
public:
    QFitsTransparentCaption(QFitsTransparentLabel *parent);
    ~QFitsTransparentCaption() {}

protected:
    void mousePressEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);

//----- Slots -----
//----- Signals -----
//----- Members -----
private:
    QFitsTransparentLabel *myParent;
    QPoint p;
};

class QWidgetWithoutMouse : public QWidget {
    Q_OBJECT
//----- Functions -----
public:
    QWidgetWithoutMouse(QWidget *parent);
    ~QWidgetWithoutMouse() {}
protected:
    void mouseMoveEvent(QMouseEvent *);

//----- Slots -----
//----- Signals -----
//----- Members -----
};

class QLabelWithoutMouse : public QLabel {
    Q_OBJECT
//----- Functions -----
public:
    QLabelWithoutMouse(QWidget *parent);
protected:
    void mouseMoveEvent(QMouseEvent *);

//----- Slots -----
//----- Signals -----
//----- Members -----
};

#endif /* QFITSWIDGET1D_H */