-
Notifications
You must be signed in to change notification settings - Fork 121
/
DataComparison.h
98 lines (82 loc) · 2.43 KB
/
DataComparison.h
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
#ifndef MANTIDQTCUSTOMINTERFACES_DATACOMPARISON_H_
#define MANTIDQTCUSTOMINTERFACES_DATACOMPARISON_H_
//----------------------
// Includes
//----------------------
#include "ui_DataComparison.h"
#include "MantidQtAPI/UserSubWindow.h"
#include "MantidAPI/MatrixWorkspace.h"
#include <QPointer>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_zoomer.h>
namespace MantidQt
{
namespace CustomInterfaces
{
class DataComparison : public MantidQt::API::UserSubWindow
{
Q_OBJECT
public:
/// The name of the interface as registered into the factory
static std::string name() { return "Data Comparison"; }
// This interface's categories.
static QString categoryInfo() { return "General"; }
public:
/// Default Constructor
DataComparison(QWidget *parent = 0);
private slots:
/// Add selected data to plot
void addData();
/// Remove selected data from plot
void removeSelectedData();
/// Remove all data from plot
void removeAllData();
/// Create a diff of the two selected workspaces
void diffSelected();
/// Remove the diff from the plot
void clearDiff();
/// Handles replotting workspace spectra
void plotWorkspaces();
/// Handles updating the plot
void updatePlot();
/// Handles creating and plotting a diff worksapce
void plotDiffWorkspace();
/// Toggle the pan plot tool
void togglePan(bool enabled);
/// Toggle the zoom plot tool
void toggleZoom(bool enabled);
private:
/// Enumeration for column index
enum Column
{
COLOUR,
WORKSPACE_NAME,
SPEC_OFFSET,
CURRENT_SPEC
};
/// Initialize the layout
virtual void initLayout();
/// Normalises spectra offsets in table
void normaliseSpectraOffsets();
/// Gets an initial curve colour for a new workspace
int getInitialColourIndex();
private:
// The form generated by Qt Designer
Ui::DataComparison m_uiForm;
// The plot object
QwtPlot *m_plot;
// Plot zoom tool
QwtPlotZoomer *m_zoomTool;
// Plot pan tool
QwtPlotPanner *m_panTool;
// Curves shown on plot, indexed by workspace name
QMap<QString, boost::shared_ptr<QwtPlotCurve>> m_curves;
boost::shared_ptr<QwtPlotCurve> m_diffCurve;
// The two workspaces that are currently being diffed
QPair<QString, QString> m_diffWorkspaceNames;
};
}
}
#endif //MANTIDQTCUSTOMINTERFACES_DATACOMPARISON_H_