Skip to content

Commit

Permalink
refs #5167. Separate classes into headers
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Aug 30, 2012
1 parent 0f915e6 commit 2766c0f
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 35 deletions.
2 changes: 2 additions & 0 deletions Code/Mantid/MantidQt/SliceViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ set ( SRC_FILES
# Include files aren't required, but this makes them appear in Visual Studio
set ( INC_FILES
inc/MantidQtSliceViewer/ColorBarWidget.h
inc/MantidQtSliceViewer/ConcretePeaksPresenter.h
inc/MantidQtSliceViewer/CustomTools.h
inc/MantidQtSliceViewer/DimensionSliceWidget.h
inc/MantidQtSliceViewer/LineOverlay.h
inc/MantidQtSliceViewer/LinePlotOptions.h
inc/MantidQtSliceViewer/LineViewer.h
inc/MantidQtSliceViewer/NullPeaksPresenter.h
inc/MantidQtSliceViewer/PeakOverlay.h
inc/MantidQtSliceViewer/PeakOverlayView.h
inc/MantidQtSliceViewer/PeakOverlayViewFactory.h
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef MANTID_SLICEVIEWER_CONCRETEPEAKSPRESENTER_H_
#define MANTID_SLICEVIEWER_CONCRETEPEAKSPRESENTER_H_

#include "MantidQtSliceViewer/PeaksPresenter.h"
#include <vector>

namespace MantidQt
{
namespace SliceViewer
{
/*---------------------------------------------------------
ConcretePeaksPresenter
Concrete implmentation of the Peaks presenter.
----------------------------------------------------------*/
class DLLExport ConcretePeaksPresenter : public PeaksPresenter
{
public:
ConcretePeaksPresenter(PeakOverlayViewFactory* factory, boost::shared_ptr<Mantid::API::IPeaksWorkspace> peaksWS);
virtual ~ConcretePeaksPresenter();
virtual void update();
virtual void updateWithSlicePoint(const double& slicePoint);
private:
typedef std::vector< boost::shared_ptr<PeakOverlayView> > VecPeakOverlayView;
/// Peak overlay views.
VecPeakOverlayView m_viewPeaks;
};

}
}

#endif /* MANTID_SLICEVIEWER_CONCRETEPEAKSPRESENTER_H_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef MANTID_SLICEVIEWER_NULLPEAKSPRESENTER_H_
#define MANTID_SLICEVIEWER_NULLPEAKSPRESENTER_H_

#include "MantidQtSliceViewer/PeaksPresenter.h"

namespace MantidQt
{
namespace SliceViewer
{
/*---------------------------------------------------------
NullPeaksPresenter
This implementation prevents the client code having to run Null checks on the PeaksPresenter pointer before using it.
----------------------------------------------------------*/
class DLLExport NullPeaksPresenter : public PeaksPresenter
{
public:
virtual void update(){};
virtual void updateWithSlicePoint(const double&)
{
}
};

}
}

#endif /* MANTID_SLICEVIEWER_NULLPEAKSPRESENTER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define MANTID_SLICEVIEWER_PEAKSPRESENTER_H_

#include "MantidKernel/System.h"
#include <vector>
#include <boost/shared_ptr.hpp>
#include "MantidKernel/System.h"

Expand Down Expand Up @@ -33,37 +32,6 @@ namespace SliceViewer
virtual void updateWithSlicePoint(const double&) = 0;
};

/*---------------------------------------------------------
NullPeaksPresenter
This implementation prevents the client code having to run Null checks on the PeaksPresenter pointer before using it.
----------------------------------------------------------*/
class DLLExport NullPeaksPresenter : public PeaksPresenter
{
public:
virtual void update(){};
virtual void updateWithSlicePoint(const double&)
{
}
};

/*---------------------------------------------------------
ConcretePeaksPresenter
Concrete implmentation of the Peaks presenter.
----------------------------------------------------------*/
class DLLExport ConcretePeaksPresenter : public PeaksPresenter
{
public:
ConcretePeaksPresenter(PeakOverlayViewFactory* factory, boost::shared_ptr<Mantid::API::IPeaksWorkspace> peaksWS);
virtual ~ConcretePeaksPresenter();
virtual void update();
virtual void updateWithSlicePoint(const double& slicePoint);
private:
typedef std::vector< boost::shared_ptr<PeakOverlayView> > VecPeakOverlayView;
/// Peak overlay views.
VecPeakOverlayView m_viewPeaks;
};

typedef boost::shared_ptr<PeaksPresenter> PeaksPresenter_sptr;
typedef boost::shared_ptr<const PeaksPresenter> PeaksPresenter_const_sptr;
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidQt/SliceViewer/src/PeaksPresenter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MantidQtSliceViewer/PeaksPresenter.h"
#include "MantidQtSliceViewer/ConcretePeaksPresenter.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IPeak.h"
#include "MantidQtSliceViewer/PeakOverlayViewFactory.h"
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#include "MantidQtSliceViewer/SliceViewer.h"
#include "MantidQtSliceViewer/SnapToGridDialog.h"
#include "MantidQtSliceViewer/XYLimitsDialog.h"
#include "MantidQtSliceViewer/PeaksPresenter.h"
#include "MantidQtSliceViewer/ConcretePeaksPresenter.h"
#include "MantidQtSliceViewer/NullPeaksPresenter.h"
#include "MantidQtSliceViewer/PeakOverlayFactory.h"
#include "MantidQtMantidWidgets/SelectWorkspacesDialog.h"
#include "qmainwindow.h"
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidQt/SliceViewer/test/PeaksPresenterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <gmock/gmock.h>
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/IPeak.h"
#include "MantidQtSliceViewer/PeaksPresenter.h"
#include "MantidQtSliceViewer/ConcretePeaksPresenter.h"
#include "MantidQtSliceViewer/PeakOverlayViewFactory.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
Expand Down

0 comments on commit 2766c0f

Please sign in to comment.