Skip to content

Commit

Permalink
Refs #6927. MDHW sources and files can now do non-ortho.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Apr 25, 2013
1 parent 913a0c0 commit 764d1c7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,15 @@ int vtkMDHWNexusReader::RequestData(vtkInformation * vtkNotUsed(request), vtkInf
vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
output->ShallowCopy(clipperOutput);

try
{
m_presenter->makeNonOrthogonal(output);
}
catch (std::invalid_argument &e)
{
qWarning() << "Workspace does not have correct information to "
<< "plot non-orthogonal axes. " << e.what();
}
m_presenter->setAxisLabels(output);

clipper->Delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "MantidVatesAPI/FilteringUpdateProgressAction.h"
#include "MantidVatesAPI/IgnoreZerosThresholdRange.h"

#include <QtDebug>

using namespace Mantid::VATES;

vtkStandardNewMacro(vtkMDHWSource);
Expand Down Expand Up @@ -130,7 +132,15 @@ int vtkMDHWSource::RequestData(vtkInformation *, vtkInformationVector **, vtkInf
vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));
output->ShallowCopy(clipperOutput);

try
{
m_presenter->makeNonOrthogonal(output);
}
catch (std::invalid_argument &e)
{
qWarning() << "Workspace does not have correct information to "
<< "plot non-orthogonal axes. " << e.what();
}
m_presenter->setAxisLabels(output);

clipper->Delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace Mantid
virtual std::vector<double> getTimeStepValues() const;
virtual std::string getTimeStepLabel() const;
virtual void setAxisLabels(vtkDataSet* visualDataSet);
virtual void makeNonOrthogonal(vtkDataSet* visualDataSet);
virtual ~MDHWLoadingPresenter();
protected:
/*---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ namespace Mantid
virtual std::vector<double> getTimeStepValues() const = 0;
virtual std::string getTimeStepLabel() const = 0;
virtual void setAxisLabels(vtkDataSet* visualDataSet) = 0;
virtual void makeNonOrthogonal(vtkDataSet* visualDataSet)
{
// This is a no-op function for most loaders.
UNUSED_ARG(visualDataSet);
}
virtual bool canReadFile() const = 0;
virtual const std::string& getGeometryXML() const = 0;
virtual ~MDLoadingPresenter(){}
Expand Down
13 changes: 13 additions & 0 deletions Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "MantidVatesAPI/RebinningKnowledgeSerializer.h"
#include "MantidVatesAPI/MetadataToFieldData.h"
#include "MantidVatesAPI/RebinningCutterXMLDefinitions.h"
#include "MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h"
#include "MantidVatesAPI/vtkDataSetToWsName.h"
#include "MantidVatesAPI/Common.h"

#include <vtkFieldData.h>
Expand Down Expand Up @@ -153,6 +155,17 @@ namespace Mantid
outputFD->Delete();
}

/**
* Change the data based on non-orthogonal axis information
* @param visualDataSet : The VTK dataset to modify
*/
void MDHWLoadingPresenter::makeNonOrthogonal(vtkDataSet *visualDataSet)
{
std::string wsName = vtkDataSetToWsName::exec(visualDataSet);
vtkDataSetToNonOrthogonalDataSet converter(visualDataSet, wsName);
converter.execute();
}

/**
* Set the axis labels from the current dimensions
* @param visualDataSet: The VTK dataset to update
Expand Down

0 comments on commit 764d1c7

Please sign in to comment.