Skip to content

Commit

Permalink
Refs #11814 Correct the display of the rec. depth in plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonPiccardoSelg committed May 21, 2015
1 parent ec6b4b1 commit ff8aabd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Expand Up @@ -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.
Expand Down
32 changes: 30 additions & 2 deletions 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<Mantid::API::IMDEventWorkspace> workspaceProvider;
auto workspace = boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(workspaceProvider.fetchWorkspace(wsName.toStdString()));
if (workspace) {
auto boxController = workspace->getBoxController();
boost::optional<std::vector<size_t>> topLevelSplits = boxController->getSplitTopInto();
if (topLevelSplits) {
vtkSMPropertyHelper(source->getProxy(),
"Recursion Depth").Set(1);
}
}
}

} // namespace SimpleGui
} // namespace Vates
Expand Down

0 comments on commit ff8aabd

Please sign in to comment.