From ff8aabdf20689a5dbc3d61ce0ff7955b5792df5d Mon Sep 17 00:00:00 2001 From: Anton Piccardo-Selg Date: Thu, 21 May 2015 09:02:17 +0100 Subject: [PATCH] Refs #11814 Correct the display of the rec. depth in plugin --- .../ViewBase.h | 2 ++ .../ViewWidgets/src/ViewBase.cpp | 32 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h index 50217be212b2..fc36d43337af 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/ViewBase.h @@ -243,6 +243,8 @@ public slots: pqPipelineRepresentation *getRep(); /// Collect time information for animation controls. void handleTimeInfo(vtkSMDoubleVectorProperty *dvp); + /// Set the recursion depth + void setRecursionDepthForTopLevelSplitting(pqPipelineSource* source, QString wsName); ColorUpdater colorUpdater; ///< Handle to the color updating delegator BackgroundRgbProvider backgroundRgbProvider; /// < Holds the manager for background color related tasks. diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp index 5ffe25bf69ea..6fe2e4a030a7 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp @@ -1,7 +1,8 @@ #include "MantidVatesSimpleGuiViewWidgets/ViewBase.h" #include "MantidVatesSimpleGuiViewWidgets/BackgroundRgbProvider.h" #include "MantidVatesSimpleGuiViewWidgets/RebinnedSourcesManager.h" - +#include "MantidVatesAPI/ADSWorkspaceProvider.h" +#include "MantidAPI/IMDEventWorkspace.h" #if defined(__INTEL_COMPILER) #pragma warning disable 1170 #endif @@ -292,6 +293,13 @@ pqPipelineSource* ViewBase::setPluginSource(QString pluginName, QString wsName) vtkSMPropertyHelper(src->getProxy(), "Mantid Workspace Name").Set(wsName.toStdString().c_str()); + // WORKAROUND BEGIN + // We are setting the recursion depth to 1 when we are dealing with MDEvent workspaces + // with top level splitting, but this is not updated in the plugin line edit field. + // We do this here. + setRecursionDepthForTopLevelSplitting(src, wsName); + // WORKAROUND END + // Update the source so that it retrieves the data from the Mantid workspace src->getProxy()->UpdateVTKObjects(); // Updates all the proxies src->updatePipeline(); // Updates the pipeline @@ -898,7 +906,27 @@ void ViewBase::removeVisibilityListener() { } } - +/** + * Set the recursion depth to 1 when we are dealing with a workspace with top level splitting. + * This is a workaround. The recusion depth is set in the plugin which loads the source. + * But this does not udpate the line edit field in the VSI. We therefore need to change this here. + * Note that this is only a cosmetic change and will not cause the source to reload, as the + * recursion depth in the plugin is already set to 1. + * @param source :: the newly created source + * @param wsName :: the name of the workspace corresponding to the source + */ +void ViewBase::setRecursionDepthForTopLevelSplitting(pqPipelineSource* source, QString wsName){ + Mantid::VATES::ADSWorkspaceProvider workspaceProvider; + auto workspace = boost::dynamic_pointer_cast(workspaceProvider.fetchWorkspace(wsName.toStdString())); + if (workspace) { + auto boxController = workspace->getBoxController(); + boost::optional> topLevelSplits = boxController->getSplitTopInto(); + if (topLevelSplits) { + vtkSMPropertyHelper(source->getProxy(), + "Recursion Depth").Set(1); + } + } +} } // namespace SimpleGui } // namespace Vates