Skip to content

Commit

Permalink
refs #7281. Add in spherical multi peak factory.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Jun 12, 2013
1 parent 496d055 commit df207c0
Show file tree
Hide file tree
Showing 9 changed files with 422 additions and 8 deletions.
9 changes: 7 additions & 2 deletions Code/Mantid/MantidQt/SliceViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ set ( SRC_FILES
src/PeakBoundingBox.cpp
src/PeaksViewerOptionsDialog.cpp
src/PeakOverlayMultiCross.cpp
src/PeakOverlayMultiCrossFactory.cpp
src/PeakOverlayMultiCrossFactory.cpp
src/PeakOverlayMultiSphere.cpp
src/PeakOverlayMultiSphereFactory.cpp
src/PeakOverlaySphere.cpp
src/PeakOverlayCross.cpp
src/PeakOverlaySphereFactory.cpp
Expand Down Expand Up @@ -52,7 +54,9 @@ set ( INC_FILES
inc/MantidQtSliceViewer/NullPeaksPresenter.h
inc/MantidQtSliceViewer/PeakBoundingBox.h
inc/MantidQtSliceViewer/PeakOverlayMultiCross.h
inc/MantidQtSliceViewer/PeakOverlayMultiCrossFactory.h
inc/MantidQtSliceViewer/PeakOverlayMultiCrossFactory.h
inc/MantidQtSliceViewer/PeakOverlayMultiSphere.h
inc/MantidQtSliceViewer/PeakOverlayMultiSphereFactory.h
inc/MantidQtSliceViewer/PeakOverlaySphere.h
inc/MantidQtSliceViewer/PeakOverlayCross.h
inc/MantidQtSliceViewer/PeakOverlayView.h
Expand Down Expand Up @@ -92,6 +96,7 @@ set ( MOC_FILES
inc/MantidQtSliceViewer/LineViewer.h
inc/MantidQtSliceViewer/LinePlotOptions.h
inc/MantidQtSliceViewer/PeakOverlayMultiCross.h
inc/MantidQtSliceViewer/PeakOverlayMultiSphere.h
inc/MantidQtSliceViewer/PeakOverlayCross.h
inc/MantidQtSliceViewer/PeakOverlaySphere.h
inc/MantidQtSliceViewer/SliceViewer.h
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#ifndef MANTID_SLICEVIEWER_PEAKOVERLAYMULTISPHERE_H_
#define MANTID_SLICEVIEWER_PEAKOVERLAYMULTISPHERE_H_

#include "DllOption.h"
#include "MantidKernel/System.h"
#include "MantidKernel/V3D.h"
#include <q3iconview.h>
#include <QtCore/QtCore>
#include <QtGui/qwidget.h>
#include <qwt_plot.h>
#include <qpainter.h>
#include <qcolor.h>
#include "MantidQtSliceViewer/PeakOverlayView.h"
#include "MantidQtSliceViewer/PhysicalSphericalPeak.h"


namespace MantidQt
{
namespace SliceViewer
{

/** Widget representing a peak sphere on the plot. Used for representing spherically integrated peaks.
@date 2012-08-22
Copyright &copy; 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class EXPORT_OPT_MANTIDQT_SLICEVIEWER PeakOverlayMultiSphere : public QWidget, public PeakOverlayView
{
Q_OBJECT

public:
/// Constructor
PeakOverlayMultiSphere(QwtPlot * plot, QWidget * parent, const VecPhysicalSphericalPeak& vecPhysicalPeaks, const QColor& peakColour, const QColor& backColour);
/// Destructor
virtual ~PeakOverlayMultiSphere();
/// Set the slice point at position.
virtual void setSlicePoint(const double& point);
/// Hide the view.
virtual void hideView();
/// Show the view.
virtual void showView();
/// Update the view.
virtual void updateView();
/// Move the position of the peak, by using a different configuration of the existing origin indexes.
void movePosition(PeakTransform_sptr peakTransform);
/// Change foreground colour
virtual void changeForegroundColour(const QColor);
/// Change background colour
virtual void changeBackgroundColour(const QColor);
/// Show the background radius
virtual void showBackgroundRadius(const bool show);
/// Get a bounding box for this peak.
virtual PeakBoundingBox getBoundingBox() const;
/// Changes the size of the overlay to be the requested fraction of the current view width.
virtual void changeOccupancyInView(const double fraction);
/// Changes the size of the overlay to be the requested fraction of the view depth.
virtual void changeOccupancyIntoView(const double fraction);
/// Get the peak size (width/2 as a fraction of total width) on projection
virtual double getOccupancyInView() const;
/// Get the peaks size into the projection (effective radius as a fraction of z range)
virtual double getOccupancyIntoView() const;
/// Getter indicating that the view is position only
virtual bool positionOnly() const;
private:

//QRect drawHandle(QPainter & painter, QPointF coords, QColor brush);
void paintEvent(QPaintEvent *event);

QSize sizeHint() const;
QSize size() const;
int height() const;
int width() const;

/// QwtPlot containing this
QwtPlot * m_plot;
/// Physical peak object
VecPhysicalSphericalPeak m_physicalPeaks;
/// Peak colour
QColor m_peakColour;
/// Back colour
QColor m_backColour;
};


} // namespace SliceViewer
} // namespace Mantid

#endif /* MANTID_SLICEVIEWER_PEAKOVERLAY_H_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#ifndef MANTID_SLICEVIEWER_PEAKOVERLAYMULTISPHERE_FACTORY_H_
#define MANTID_SLICEVIEWER_PEAKOVERLAYMULTISPHERE_FACTORY_H_

#include "MantidQtSliceViewer/PeakOverlayViewFactoryBase.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include <boost/shared_ptr.hpp>

namespace MantidQt
{
namespace SliceViewer
{
/** Concrete view factory. For creating instances of PeakOverlayMultiSphere widget.
@date 2013-06-12
Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport PeakOverlayMultiSphereFactory : public PeakOverlayViewFactoryBase
{
private:
double m_peakRadius;
double m_backgroundInnerRadius;
double m_backgroundOuterRadius;
Mantid::API::IPeaksWorkspace_sptr m_peaksWS;
int m_FOM;
public:
PeakOverlayMultiSphereFactory(Mantid::API::IPeaksWorkspace_sptr peaksWS, QwtPlot * plot, QWidget * parent, const size_t colourNumber=0);
virtual ~PeakOverlayMultiSphereFactory();
virtual boost::shared_ptr<PeakOverlayView> createView(const int peakIndex, PeakTransform_const_sptr transform) const;
virtual int FOM() const;
};
}
}

#endif /*MANTID_SLICEVIEWER_PEAKOVERLAYMULTISPHERE_FACTORY_H_*/
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ namespace MantidQt
DISABLE_COPY_AND_ASSIGN(PhysicalSphericalPeak)
};

typedef boost::shared_ptr<PhysicalSphericalPeak> PhysicalSphericalPeak_sptr;
typedef std::vector<PhysicalSphericalPeak_sptr> VecPhysicalSphericalPeak;

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace MantidQt
namespace SliceViewer
{


//----------------------------------------------------------------------------------------------
/** Constructor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace MantidQt
{
}

boost::shared_ptr<PeakOverlayView> PeakOverlayMultiCrossFactory::createView(const int peakIndex, PeakTransform_const_sptr transform) const
boost::shared_ptr<PeakOverlayView> PeakOverlayMultiCrossFactory::createView(const int, PeakTransform_const_sptr transform) const
{
// Construct all physical peaks
VecPhysicalCrossPeak physicalPeaks(m_peaksWS->rowCount());
Expand All @@ -56,7 +56,7 @@ namespace MantidQt

int PeakOverlayMultiCrossFactory::FOM() const
{
return 2; // HACK. Large value means that this is always chosen.
return 1;
}
}
}

0 comments on commit df207c0

Please sign in to comment.