Skip to content

Commit

Permalink
Refs #10537 Added Technique-dependent initial view
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonPiccardoSelg committed Dec 5, 2014
1 parent 18caa30 commit d7fae3d
Show file tree
Hide file tree
Showing 20 changed files with 1,029 additions and 61 deletions.
4 changes: 4 additions & 0 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h
Expand Up @@ -235,6 +235,10 @@ namespace Mantid

/// Get the ParaViewPath
const std::string getParaViewPath() const;

/// Get the initial view for vates
const std::string getVsiInitialView() const;

private:
friend struct Mantid::Kernel::CreateUsingNew<ConfigServiceImpl>;
/// Handles distribution of Poco signals.
Expand Down
9 changes: 9 additions & 0 deletions Code/Mantid/Framework/Kernel/src/ConfigService.cpp
Expand Up @@ -2199,6 +2199,15 @@ const std::string ConfigServiceImpl::getParaViewPath() const
return getString("paraview.path");
}

/**
* Get the user-specified initial view
* @returns A string with the initial view or an empty string
*/
const std::string ConfigServiceImpl::getVsiInitialView() const
{
return getString("vsi.initialview");
}

/// \cond TEMPLATE
template DLLExport int ConfigServiceImpl::getValue(const std::string&, double&);
template DLLExport int ConfigServiceImpl::getValue(const std::string&, std::string&);
Expand Down
260 changes: 260 additions & 0 deletions Code/Mantid/Installers/colormaps/All_vsi_default_cmaps.xml

Large diffs are not rendered by default.

33 changes: 30 additions & 3 deletions Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp
Expand Up @@ -685,22 +685,48 @@ void MantidUI::showVatesSimpleInterface()
{
return;
}
// Set the type of workspace, the GUI needs it

// Set the type of workspace, the GUI needs it and
// extract the instrument which was used to measure the workspace data
int wsType = MantidQt::API::VatesViewerInterface::MDEW;

std::string instrumentName;

// check for peak workspace
if (pws)
{
wsType = MantidQt::API::VatesViewerInterface::PEAKS;

instrumentName = pws->getInstrument()->getFullName();
}

// Check for histo workspace
if (mdhist)
{
wsType = MantidQt::API::VatesViewerInterface::MDHW;

// Get the instrument name
if (mdhist->getNumExperimentInfo() > 0 )
{
instrumentName = mdhist->getExperimentInfo(0)->getInstrument()->getFullName();
}
}

// Check for event workspace
if (mdews)
{
// Get the instrument name
if (mdews->getNumExperimentInfo() > 0 )
{
instrumentName = mdews->getExperimentInfo(0)->getInstrument()->getFullName();
}
}

if (m_vatesSubWindow)
{
QWidget *vwidget = m_vatesSubWindow->widget();
vwidget->show();
qobject_cast<MantidQt::API::VatesViewerInterface *>(vwidget)->renderWorkspace(wsName, wsType);
qobject_cast<MantidQt::API::VatesViewerInterface *>(vwidget)->renderWorkspace(wsName, wsType, instrumentName);
return;
}
else
Expand All @@ -720,11 +746,12 @@ void MantidUI::showVatesSimpleInterface()
connect(vsui, SIGNAL(requestClose()), m_vatesSubWindow, SLOT(close()));
vsui->setParent(m_vatesSubWindow);
m_vatesSubWindow->setWindowTitle("Vates Simple Interface");

vsui->setupPluginMode();
//m_appWindow->setGeometry(m_vatesSubWindow, vsui);
m_vatesSubWindow->setWidget(vsui);
m_vatesSubWindow->widget()->show();
vsui->renderWorkspace(wsName, wsType);
vsui->renderWorkspace(wsName, wsType, instrumentName);
}
else
{
Expand Down
Expand Up @@ -5,6 +5,8 @@

#include <QWidget>

#include <string>

class QString;

namespace MantidQt
Expand Down Expand Up @@ -58,8 +60,11 @@ class EXPORT_OPT_MANTIDQT_API VatesViewerInterface : public QWidget
* @param wsname the name of the workspace to visualize
* @param wstype the type of workspace being visualized
*/
virtual void renderWorkspace(QString wsname, int wstype);
/// Special function of correct widget invocation for plugin mode.
virtual void renderWorkspace(QString workspaceName, int workspaceType, std::string instrumentName);

/**
* Special function of correct widget invocation for plugin mode.
*/
virtual void setupPluginMode();

/// Enum to track the workspace type
Expand Down
7 changes: 4 additions & 3 deletions Code/Mantid/MantidQt/API/src/VatesViewerInterface.cpp
Expand Up @@ -18,10 +18,11 @@ void VatesViewerInterface::setupPluginMode()
{
}

void VatesViewerInterface::renderWorkspace(QString wsname, int wstype)
void VatesViewerInterface::renderWorkspace(QString workSpaceName, int workspaceType, std::string instrumentName)
{
UNUSED_ARG(wsname);
UNUSED_ARG(wstype);
UNUSED_ARG(workSpaceName);
UNUSED_ARG(workspaceType);
UNUSED_ARG(instrumentName);
}

void VatesViewerInterface::shutdown()
Expand Down
Expand Up @@ -2,11 +2,13 @@
#define MANTID_VATES_vtkSplatterPlotFactory_H_

#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidAPI/IMDHistoWorkspace.h"
#include "MantidAPI/IMDNode.h"
#include "MantidMDEvents/MDEventFactory.h"
#include "MantidMDEvents/MDEventWorkspace.h"
#include "MantidVatesAPI/ThresholdRange.h"
#include "MantidVatesAPI/vtkDataSetFactory.h"
#include <vtkPoints.h>
#include <boost/shared_ptr.hpp>

using Mantid::MDEvents::MDEventWorkspace;
Expand Down Expand Up @@ -42,6 +44,7 @@ namespace VATES
* File change history is stored at: <https://github.com/mantidproject/mantid>
* Code Documentation is available at: <http://doxygen.mantidproject.org>
*/

class DLLExport vtkSplatterPlotFactory : public vtkDataSetFactory
{
public:
Expand Down Expand Up @@ -81,6 +84,23 @@ class DLLExport vtkSplatterPlotFactory : public vtkDataSetFactory
template<typename MDE, size_t nd>
void doCreate(typename MDEventWorkspace<MDE, nd>::sptr ws) const;

///Check if the MDHisto workspace is 3D or 4D in nature
bool doMDHisto4D(Mantid::API::IMDHistoWorkspace_sptr workspace) const;

/// Generate the vtkDataSet from the objects input MDHistoWorkspace
void doCreateMDHisto(Mantid::API::IMDHistoWorkspace_sptr workspace) const;

/// Set the signals and the valid points which are to be displayed
double extractScalarSignal(Mantid::API::IMDHistoWorkspace_sptr workspace,
bool do4D, const int x, const int y, const int z) const;

/// Set the points and point ids for a hexahedron structure.
void setPointsAndPointIdsForHex(vtkPoints* points,
std::vector<vtkIdType> &pointIDs,
Mantid::coord_t out[3],
double signalScalar,
Mantid::coord_t steps[3]) const;

/// Template Method pattern to validate the factory before use.
virtual void validate() const;

Expand All @@ -91,7 +111,7 @@ class DLLExport vtkSplatterPlotFactory : public vtkDataSetFactory
const std::string m_scalarName;

/// Member workspace to generate vtkdataset from.
Mantid::API::IMDEventWorkspace_sptr m_workspace;
Mantid::API::IMDWorkspace_sptr m_workspace;

/// Approximate number of points to plot
size_t m_numPoints;
Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp
Expand Up @@ -281,7 +281,6 @@ namespace VATES
delete [] voxelShown;
delete [] pointNeeded;
return visualDataSet;

}


Expand Down

0 comments on commit d7fae3d

Please sign in to comment.