diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/SplatterPlotView.h b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/SplatterPlotView.h index cd78425c35c588b76e4d9eabf2d830bb5901e1e4..4a1755863344d367ffbf844412b217e139eacff0 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/SplatterPlotView.h +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/SplatterPlotView.h @@ -98,6 +98,7 @@ private: /// Destroy all peak sources. void destroyPeakSources(); + bool noOverlay; ///< Flag to respond to overlay situation correctly QList<QPointer<pqPipelineSource> > peaksSource; ///< A list of peaks sources QPointer<pqPipelineRepresentation> splatRepr; ///< The splatter plot representation QPointer<pqPipelineSource> splatSource; ///< The splatter plot source diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp index 066ed4858697897be34243770ec68d23d75c93df..a0c511c02623ea8abd0b59264eede0de0ef89af4 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/SplatterPlotView.cpp @@ -11,6 +11,8 @@ #include "vtkProperty.h" #include "vtkSMPropertyHelper.h" +#include <QMessageBox> + namespace Mantid { namespace Vates @@ -20,6 +22,7 @@ namespace SimpleGui SplatterPlotView::SplatterPlotView(QWidget *parent) : ViewBase(parent) { + this->noOverlay = false; this->ui.setupUi(this); // Set the threshold button to create a threshold filter on data @@ -62,9 +65,25 @@ void SplatterPlotView::render() pqPipelineSource *src = NULL; src = pqActiveObjects::instance().activeSource(); - int renderType = VTK_SURFACE; pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder(); + // Do not allow overplotting of MDWorkspaces + if (!this->isPeaksWorkspace(src) && NULL != this->splatSource) + { + QMessageBox::warning(this, QApplication::tr("Overplotting Warning"), + QApplication::tr("SplatterPlot mode does not allow "\ + "more that one MDEventWorkspace to "\ + "be plotted.")); + // Need to destroy source since we tried to load it and set the active + // back to something. In this case we'll choose the splatter plot filter. + builder->destroy(src); + pqActiveObjects::instance().setActiveSource(this->splatSource); + this->noOverlay = true; + return; + } + + int renderType = VTK_SURFACE; + if (!this->isPeaksWorkspace(src)) { this->origSrc = src; @@ -120,10 +139,11 @@ void SplatterPlotView::onThresholdButtonClicked() void SplatterPlotView::checkView() { - if (this->peaksSource.isEmpty()) + if (!this->noOverlay && this->peaksSource.isEmpty()) { ViewBase::checkView(); } + this->noOverlay = false; } void SplatterPlotView::resetCamera() diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp index 76721dd953fdbb431009ce7ef0bdeb0b5b7b4723..ac4ff0bfd2ea6e65822ce7c474f077bdaa3949b1 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp @@ -298,6 +298,11 @@ unsigned int ViewBase::getNumSources() */ void ViewBase::handleTimeInfo(vtkSMDoubleVectorProperty *dvp, bool doUpdate) { + if (NULL == dvp) + { + // This is a normal filter and therefore has no timesteps. + return; + } const int numTimesteps = static_cast<int>(dvp->GetNumberOfElements()); if (0 != numTimesteps) {