diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h index 77f369e9969f507cb33bc9dc5edf6c17ad9d8b21..04b1e2dace4fa41768b6cdc2f0534bd0ccd408ab 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/EnggDiffractionViewQtGUI.h @@ -16,6 +16,11 @@ #include <boost/scoped_ptr.hpp> #include <qwt_plot_curve.h> +/// shahroz +#include "MantidQtMantidWidgets/PeakPicker.h" +#include "MantidAPI/IPeakFunction.h" + + // Qt classes forward declarations class QMutex; @@ -177,6 +182,14 @@ public: int currentMultiRunMode() const override { return m_currentRunMode; } + Mantid::API::IPeakFunction_const_sptr peakPicker() const override; + + /// @shahroz + void setPeakPickerEnabled(bool enabled) override; + + // void setPeakPicker(const IPeakFunction_const_sptr &peak) override; + + private slots: /// for buttons, do calibrate, focus, event->histo rebin, and similar void loadCalibrationClicked(); @@ -234,6 +247,7 @@ private slots: void fittingListWidgetBank(int idx); void setListWidgetBank(int idx); + // show the standard Mantid help window with this interface's help void openHelpWin(); @@ -326,6 +340,10 @@ private: /// Loaded data curves std::vector<QwtPlotCurve *> m_fittedDataVector; + /// shahroz + /// Peak picker tool - only one on the plot at any given moment + MantidWidgets::PeakPicker *m_peakPicker; + /// presenter as in the model-view-presenter boost::scoped_ptr<IEnggDiffractionPresenter> m_presenter; }; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h index 89cc20400747efdccb09b3dcf88523a33c660741..3e8811f24baefddc34218293b344868ad3f8dd95 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/EnggDiffraction/IEnggDiffractionView.h @@ -9,6 +9,10 @@ #include "MantidAPI/MatrixWorkspace_fwd.h" #include "MantidQtCustomInterfaces/EnggDiffraction/EnggDiffCalibSettings.h" +/// @shahroz +#include "MantidQtMantidWidgets/PeakPicker.h" +#include "MantidAPI/IPeakFunction.h" + namespace MantidQt { namespace CustomInterfaces { @@ -425,6 +429,16 @@ public: virtual void plotReplacingWindow(const std::string &wsName, const std::string &spectrum, const std::string &type) = 0; + + /// @shahroz + + virtual Mantid::API::IPeakFunction_const_sptr peakPicker() const = 0; + + virtual void setPeakPickerEnabled(bool enabled) = 0; + + //virtual void setPeakPicker(const IPeakFunction_const_sptr &peak) = 0; + + }; } // namespace CustomInterfaces diff --git a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp index bf79c84fea04a887298155132512a14b665f2e6b..8ac7f11988a3519255fb40d65f46ea83b0da468f 100644 --- a/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp +++ b/MantidQt/CustomInterfaces/src/EnggDiffraction/EnggDiffractionViewQtGUI.cpp @@ -66,7 +66,7 @@ const std::string EnggDiffractionViewQtGUI::m_settingsGroup = EnggDiffractionViewQtGUI::EnggDiffractionViewQtGUI(QWidget *parent) : UserSubWindow(parent), IEnggDiffractionView(), m_currentInst("ENGINX"), m_currentCalibFilename(""), m_focusedDataVector(), m_fittedDataVector(), - m_presenter(NULL) {} + m_peakPicker(NULL), m_presenter(NULL) {} EnggDiffractionViewQtGUI::~EnggDiffractionViewQtGUI() { for (auto curves : m_focusedDataVector) { @@ -233,6 +233,9 @@ void EnggDiffractionViewQtGUI::doSetupTabFitting() { QFont font("MS Shell Dlg 2", 8); m_uiTabFitting.dataPlot->setAxisFont(QwtPlot::xBottom, font); m_uiTabFitting.dataPlot->setAxisFont(QwtPlot::yLeft, font); + + m_peakPicker = new MantidWidgets::PeakPicker(m_uiTabFitting.dataPlot, Qt::red); + } void EnggDiffractionViewQtGUI::doSetupTabSettings() { @@ -892,6 +895,26 @@ void EnggDiffractionViewQtGUI::loadCalibrationClicked() { m_presenter->notify(IEnggDiffractionPresenter::LoadExistingCalib); } + +Mantid::API::IPeakFunction_const_sptr EnggDiffractionViewQtGUI::peakPicker() const +{ + return m_peakPicker->peak(); +} + +void EnggDiffractionViewQtGUI::setPeakPickerEnabled(bool enabled) +{ + m_peakPicker->setEnabled(enabled); + m_peakPicker->setVisible(enabled); + m_uiTabFitting.dataPlot->replot(); // PeakPicker might get hidden/shown +} + +/* +void EnggDiffractionViewQtGUI::setPeakPicker(const IPeakFunction_const_sptr &peak) +{ + m_peakPicker->setPeak(peak); + m_uiTabFitting.dataPlot->replot(); +} +*/ void EnggDiffractionViewQtGUI::calibrateClicked() { m_presenter->notify(IEnggDiffractionPresenter::CalcCalib); }