Commit 2aee77bb authored by Anthony Lim's avatar Anthony Lim
Browse files

refs #26878 ALF view has interfaces for most parts

parent 9e7fbd16
......@@ -16,25 +16,45 @@
namespace MantidQt {
namespace CustomInterfaces {
class DLLExport IALFCustomInstrumentModel
: public virtual MantidWidgets::IBaseCustomInstrumentModel {
public:
// virtual so we can patch them later
virtual void loadAlg(const std::string &name)=0;
virtual void transformData()=0;
virtual std::map<std::string, bool> isDataValid()=0;
virtual void storeSingleTube(const std::string &name)=0;
virtual void averageTube()=0;
virtual bool hasTubeBeenExtracted(const std::string &name)=0;
virtual bool extractTubeConditon(std::map<std::string, bool> tabBools) = 0;
virtual bool averageTubeConditon(std::map<std::string, bool> tabBools) = 0;
virtual void extractSingleTube() = 0;
virtual std::string WSName() = 0;
virtual Mantid::API::CompositeFunction_sptr getDefaultFunction() = 0;
};
class DLLExport ALFCustomInstrumentModel
: public MantidWidgets::BaseCustomInstrumentModel {
: public virtual IALFCustomInstrumentModel, public
MantidWidgets::BaseCustomInstrumentModel {
public:
ALFCustomInstrumentModel();
virtual ~ALFCustomInstrumentModel(){};
// virtual so we can patch them later
virtual void loadAlg(const std::string &name);
virtual void transformData();
std::pair<int, std::string> loadData(const std::string &name) override;
std::map<std::string, bool> isDataValid();
void storeSingleTube(const std::string &name);
void averageTube();
bool hasTubeBeenExtracted(const std::string &name);
bool extractTubeConditon(std::map<std::string, bool> tabBools);
bool averageTubeConditon(std::map<std::string, bool> tabBools);
void extractSingleTube();
std::string WSName();
Mantid::API::CompositeFunction_sptr getDefaultFunction();
void loadAlg(const std::string &name) override;
void transformData() override;
std::pair<int, std::string> loadData(const std::string &name) override final;
std::map<std::string, bool> isDataValid() override;
void storeSingleTube(const std::string &name) override;
void averageTube() override;
bool hasTubeBeenExtracted(const std::string &name) override;
bool extractTubeConditon(std::map<std::string, bool> tabBools) override;
bool averageTubeConditon(std::map<std::string, bool> tabBools) override;
void extractSingleTube() override;
std::string WSName() override;
Mantid::API::CompositeFunction_sptr getDefaultFunction() override;
private:
int m_numberOfTubesInAverage;
......
......@@ -18,7 +18,7 @@ namespace CustomInterfaces {
ALFCustomInstrumentPresenter::ALFCustomInstrumentPresenter(
IALFCustomInstrumentView *view, ALFCustomInstrumentModel *model,
MantidWidgets::PlotFitAnalysisPanePresenter *analysisPane)
MantidWidgets::IPlotFitAnalysisPanePresenter *analysisPane)
: BaseCustomInstrumentPresenter(view, model, analysisPane),
m_view(view), m_model(model), m_analysisPane(analysisPane),
m_extractSingleTubeObserver(nullptr), m_averageTubeObserver(nullptr) {
......
......@@ -26,12 +26,12 @@ class MANTIDQT_DIRECT_DLL ALFCustomInstrumentPresenter
public:
ALFCustomInstrumentPresenter(
IALFCustomInstrumentView *view, ALFCustomInstrumentModel *model,
MantidWidgets::PlotFitAnalysisPanePresenter *analysisPane);
MantidWidgets::IPlotFitAnalysisPanePresenter *analysisPane);
~ALFCustomInstrumentPresenter() {
delete m_extractSingleTubeObserver;
delete m_averageTubeObserver;
delete m_analysisPane;
delete m_model;
m_analysisPane->destructor();
};
void addInstrument() override;
......@@ -49,7 +49,7 @@ public:
private:
IALFCustomInstrumentView *m_view;
ALFCustomInstrumentModel *m_model;
MantidWidgets::PlotFitAnalysisPanePresenter *m_analysisPane;
MantidWidgets::IPlotFitAnalysisPanePresenter *m_analysisPane;
VoidObserver *m_extractSingleTubeObserver;
VoidObserver *m_averageTubeObserver;
};
......
......@@ -14,21 +14,38 @@
namespace MantidQt {
namespace MantidWidgets {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseCustomInstrumentModel {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW IBaseCustomInstrumentModel {
public:
virtual void loadEmptyInstrument()=0;
virtual std::pair<int, std::string> loadData(const std::string &name)=0;
virtual void setCurrentRun(int &run)=0;
virtual int getCurrentRun()=0;
virtual void rename()=0;
virtual void remove()=0;
virtual std::string dataFileName()=0;
virtual int currentRun()=0;
virtual bool isErrorCode(const int run)=0;
virtual const std::string getInstrument()=0;
};
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseCustomInstrumentModel
: public virtual IBaseCustomInstrumentModel{
public:
BaseCustomInstrumentModel();
~BaseCustomInstrumentModel(){};
virtual void loadEmptyInstrument();
virtual std::pair<int, std::string> loadData(const std::string &name);
void setCurrentRun(int &run) { m_currentRun = run; };
int getCurrentRun() { return m_currentRun; };
void rename();
void remove();
std::string dataFileName();
int currentRun();
bool isErrorCode(const int run);
const std::string getInstrument() { return m_instrumentName; };
void loadEmptyInstrument() override;
std::pair<int, std::string> loadData(const std::string &name) override;
void setCurrentRun(int &run) override{ m_currentRun = run; };
int getCurrentRun() override{ return m_currentRun; };
void rename() override;
void remove() override;
std::string dataFileName() override;
int currentRun() override;
bool isErrorCode(const int run) override;
const std::string getInstrument() override { return m_instrumentName; };
protected:
int m_currentRun;
......
......@@ -22,8 +22,8 @@ class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseCustomInstrumentPresenter
public:
BaseCustomInstrumentPresenter(IBaseCustomInstrumentView *view,
BaseCustomInstrumentModel *model,
PlotFitAnalysisPanePresenter *analysisView);
IBaseCustomInstrumentModel *model,
IPlotFitAnalysisPanePresenter *analysisView);
~BaseCustomInstrumentPresenter() { delete m_loadRunObserver; };
typedef std::pair<
......@@ -51,11 +51,11 @@ private:
std::pair<instrumentSetUp, instrumentObserverOptions> setupInstrument();
IBaseCustomInstrumentView *m_view;
BaseCustomInstrumentModel *m_model;
IBaseCustomInstrumentModel *m_model;
int m_currentRun;
std::string m_currentFile;
VoidObserver *m_loadRunObserver;
PlotFitAnalysisPanePresenter *m_analysisPanePresenter;
IPlotFitAnalysisPanePresenter *m_analysisPanePresenter;
};
} // namespace MantidWidgets
} // namespace MantidQt
......@@ -14,10 +14,10 @@ using namespace Mantid::API;
namespace MantidQt {
namespace MantidWidgets {
class PlotFitAnalysisPaneModel {
class PlotFitAnalysisPaneModel{
public:
IFunction_sptr doFit(const std::string &wsName,
IFunction_sptr doFit(const std::string &wsName,
const std::pair<double, double> &range,
const IFunction_sptr func);
};
......
......@@ -15,23 +15,38 @@
namespace MantidQt {
namespace MantidWidgets {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW IPlotFitAnalysisPanePresenter {
public:
IPlotFitAnalysisPanePresenter(){};
~IPlotFitAnalysisPanePresenter(){};
virtual void destructor() = 0;
virtual IPlotFitAnalysisPaneView *getView()=0;
virtual std::string getCurrentWS()=0;
virtual void clearCurrentWS()=0;
virtual void doFit()=0;
virtual void addSpectrum(const std::string &wsName)=0;
virtual void addFunction(Mantid::API::IFunction_sptr func)=0;
};
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW PlotFitAnalysisPanePresenter
: public QObject {
: public QObject, public IPlotFitAnalysisPanePresenter {
Q_OBJECT
public:
PlotFitAnalysisPanePresenter(IPlotFitAnalysisPaneView *m_view,
explicit PlotFitAnalysisPanePresenter(IPlotFitAnalysisPaneView *m_view,
PlotFitAnalysisPaneModel *m_model);
~PlotFitAnalysisPanePresenter() {
delete m_model;
delete m_fitObserver;
};
IPlotFitAnalysisPaneView *getView() { return m_view; };
std::string getCurrentWS() { return m_currentName; };
void clearCurrentWS() { m_currentName = ""; };
void doFit();
void addSpectrum(const std::string &wsName);
void addFunction(Mantid::API::IFunction_sptr func);
void destructor() override { this->~PlotFitAnalysisPanePresenter(); };
IPlotFitAnalysisPaneView *getView() override { return m_view; };
std::string getCurrentWS() override { return m_currentName; };
void clearCurrentWS() override { m_currentName = ""; };
void doFit() override;
void addSpectrum(const std::string &wsName) override;
void addFunction(Mantid::API::IFunction_sptr func) override;
private:
VoidObserver *m_fitObserver;
......
......@@ -18,8 +18,8 @@ namespace MantidQt {
namespace MantidWidgets {
BaseCustomInstrumentPresenter::BaseCustomInstrumentPresenter(
IBaseCustomInstrumentView *view, BaseCustomInstrumentModel *model,
PlotFitAnalysisPanePresenter *analysisPanePresenter)
IBaseCustomInstrumentView *view, IBaseCustomInstrumentModel *model,
IPlotFitAnalysisPanePresenter *analysisPanePresenter)
: m_view(view), m_model(model), m_currentRun(0), m_currentFile(""),
m_loadRunObserver(nullptr), m_analysisPanePresenter(analysisPanePresenter) {
m_loadRunObserver = new VoidObserver();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment