Skip to content

Commit

Permalink
refs #6279. Rename PeakOverlay to be more specific.
Browse files Browse the repository at this point in the history
This will allow me to slot in a new type of PeakOverlayView for representing non-integrated peaks.
  • Loading branch information
OwenArnold committed Dec 11, 2012
1 parent aa786a3 commit 884c03b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
6 changes: 3 additions & 3 deletions Code/Mantid/MantidQt/SliceViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set ( SRC_FILES
src/DimensionSliceWidget.cpp
src/LineOverlay.cpp
src/LineViewer.cpp
src/PeakOverlay.cpp
src/PeakOverlaySphere.cpp
src/PeakOverlayFactory.cpp
src/PeakTransform.cpp
src/PeakTransformHKL.cpp
Expand Down Expand Up @@ -35,7 +35,7 @@ set ( INC_FILES
inc/MantidQtSliceViewer/LinePlotOptions.h
inc/MantidQtSliceViewer/LineViewer.h
inc/MantidQtSliceViewer/NullPeaksPresenter.h
inc/MantidQtSliceViewer/PeakOverlay.h
inc/MantidQtSliceViewer/PeakOverlaySphere.h
inc/MantidQtSliceViewer/PeakOverlayView.h
inc/MantidQtSliceViewer/PeakOverlayViewFactory.h
inc/MantidQtSliceViewer/PeakOverlayFactory.h
Expand All @@ -60,7 +60,7 @@ set ( MOC_FILES
inc/MantidQtSliceViewer/LineOverlay.h
inc/MantidQtSliceViewer/LineViewer.h
inc/MantidQtSliceViewer/LinePlotOptions.h
inc/MantidQtSliceViewer/PeakOverlay.h
inc/MantidQtSliceViewer/PeakOverlaySphere.h
inc/MantidQtSliceViewer/SliceViewer.h
inc/MantidQtSliceViewer/SliceViewerWindow.h
inc/MantidQtSliceViewer/ColorBarWidget.h
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MANTID_SLICEVIEWER_PEAKOVERLAY_H_
#define MANTID_SLICEVIEWER_PEAKOVERLAY_H_
#ifndef MANTID_SLICEVIEWER_PEAKOVERLAYSPHERE_H_
#define MANTID_SLICEVIEWER_PEAKOVERLAYSPHERE_H_

#include "DllOption.h"
#include "MantidKernel/System.h"
Expand All @@ -18,7 +18,7 @@ namespace MantidQt
namespace SliceViewer
{

/** Widget representing a peak ellipse on the plot.
/** Widget representing a peak sphere on the plot. Used for representing spherically integrated peaks.
@date 2012-08-22
Expand All @@ -42,15 +42,15 @@ namespace SliceViewer
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 PeakOverlay : public QWidget, public PeakOverlayView
class EXPORT_OPT_MANTIDQT_SLICEVIEWER PeakOverlaySphere : public QWidget, public PeakOverlayView
{
Q_OBJECT

public:
/// Constructor
PeakOverlay(QwtPlot * plot, QWidget * parent, const Mantid::Kernel::V3D& origin, const double& radius, const QColor& peakColour);
PeakOverlaySphere(QwtPlot * plot, QWidget * parent, const Mantid::Kernel::V3D& origin, const double& radius, const QColor& peakColour);
/// Destructor
virtual ~PeakOverlay();
virtual ~PeakOverlaySphere();
/// Set the slice point at position.
virtual void setSlicePoint(const double& point);
/// Hide the view.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "MantidQtMantidWidgets/SafeQwtPlot.h"
#include "MantidQtAPI/SyncedCheckboxes.h"
#include "MantidQtSliceViewer/LineOverlay.h"
#include "MantidQtSliceViewer/PeakOverlay.h"
#include "MantidQtSliceViewer/PeakTransformSelector.h"
#include "QwtRasterDataMD.h"
#include "ui_SliceViewer.h"
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/MantidQt/SliceViewer/src/PeakOverlayFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "MantidQtSliceViewer/PeakOverlayFactory.h"
#include "MantidQtSliceViewer/PeakOverlay.h"
#include "MantidQtSliceViewer/PeakOverlaySphere.h"
#include "MantidKernel/V3D.h"
#include "MantidAPI/IPeak.h"
#include "MantidAPI/IMDWorkspace.h"
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace MantidQt

boost::shared_ptr<PeakOverlayView> PeakOverlayFactory::createView(const Mantid::Kernel::V3D& position) const
{
return boost::make_shared<PeakOverlay>(m_plot, m_parent, position, this->m_peakRadius, this->m_peakColour);
return boost::make_shared<PeakOverlaySphere>(m_plot, m_parent, position, this->m_peakRadius, this->m_peakColour);
}

std::string PeakOverlayFactory::getPlotXLabel() const
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MantidQtSliceViewer/PeakOverlay.h"
#include "MantidQtSliceViewer/PeakOverlaySphere.h"
#include <qwt_plot.h>
#include <qwt_plot_canvas.h>
#include <qwt_scale_div.h>
Expand All @@ -22,7 +22,7 @@ namespace SliceViewer
//----------------------------------------------------------------------------------------------
/** Constructor
*/
PeakOverlay::PeakOverlay(QwtPlot * plot, QWidget * parent, const Mantid::Kernel::V3D& origin, const double& radius, const QColor& peakColour)
PeakOverlaySphere::PeakOverlaySphere(QwtPlot * plot, QWidget * parent, const Mantid::Kernel::V3D& origin, const double& radius, const QColor& peakColour)
: QWidget( parent ),
m_plot(plot),
m_originalOrigin(origin),
Expand All @@ -40,7 +40,7 @@ namespace SliceViewer
//----------------------------------------------------------------------------------------------
/** Destructor
*/
PeakOverlay::~PeakOverlay()
PeakOverlaySphere::~PeakOverlaySphere()
{
}

Expand All @@ -63,7 +63,7 @@ namespace SliceViewer
\ /
\---------/
*/
void PeakOverlay::setSlicePoint(const double& z)
void PeakOverlaySphere::setSlicePoint(const double& z)
{
const double distanceSQ = (z - m_origin.Z()) * (z - m_origin.Z());
const double distance = std::sqrt(distanceSQ);
Expand All @@ -85,34 +85,34 @@ namespace SliceViewer
this->update(); //repaint
}

const Mantid::Kernel::V3D & PeakOverlay::getOrigin() const
const Mantid::Kernel::V3D & PeakOverlaySphere::getOrigin() const
{ return m_origin; }

double PeakOverlay::getRadius() const
double PeakOverlaySphere::getRadius() const
{
return m_radius;
}

//----------------------------------------------------------------------------------------------
/// Return the recommended size of the widget
QSize PeakOverlay::sizeHint() const
QSize PeakOverlaySphere::sizeHint() const
{
//TODO: Is there a smarter way to find the right size?
return QSize(20000, 20000);
// Always as big as the canvas
//return m_plot->canvas()->size();
}

QSize PeakOverlay::size() const
QSize PeakOverlaySphere::size() const
{ return m_plot->canvas()->size(); }
int PeakOverlay::height() const
int PeakOverlaySphere::height() const
{ return m_plot->canvas()->height(); }
int PeakOverlay::width() const
int PeakOverlaySphere::width() const
{ return m_plot->canvas()->width(); }

//----------------------------------------------------------------------------------------------
/// Paint the overlay
void PeakOverlay::paintEvent(QPaintEvent * /*event*/)
void PeakOverlaySphere::paintEvent(QPaintEvent * /*event*/)
{
// Linear Transform from MD coordinates into Windows/Qt coordinates for ellipse rendering. TODO: This can be done outside of paintEvent.
const int xOrigin = m_plot->transform( QwtPlot::xBottom, m_origin.X() );
Expand Down Expand Up @@ -153,22 +153,22 @@ namespace SliceViewer

}

void PeakOverlay::updateView()
void PeakOverlaySphere::updateView()
{
this->update();
}

void PeakOverlay::hideView()
void PeakOverlaySphere::hideView()
{
this->hide();
}

void PeakOverlay::showView()
void PeakOverlaySphere::showView()
{
this->show();
}

void PeakOverlay::movePosition(PeakTransform_sptr transform)
void PeakOverlaySphere::movePosition(PeakTransform_sptr transform)
{
// Will have the plots x, y, and z aligned to the correct h, k, l value.
m_origin = transform->transform(this->m_originalOrigin);
Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "MantidQtSliceViewer/CustomTools.h"
#include "MantidQtSliceViewer/DimensionSliceWidget.h"
#include "MantidQtSliceViewer/LineOverlay.h"
#include "MantidQtSliceViewer/PeakOverlay.h"
#include "MantidQtSliceViewer/QwtRasterDataMD.h"
#include "MantidQtSliceViewer/SliceViewer.h"
#include "MantidQtSliceViewer/SnapToGridDialog.h"
Expand Down

0 comments on commit 884c03b

Please sign in to comment.