Skip to content

Commit

Permalink
Refs #6352. Add API call for special coordinate system for MDEW.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Jan 16, 2013
1 parent a1f7513 commit d87c51a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ namespace Mantid
virtual ~MDEWInMemoryLoadingPresenter();
virtual bool canReadFile() const;
virtual std::string getWorkspaceTypeName();
virtual int getSpecialCoordinates();
private:
/// Repository for accessing workspaces. At this level, does not specify how or where from.
boost::scoped_ptr<WorkspaceProvider> m_repository;
/// The name of the workspace.
const std::string m_wsName;
std::string m_wsTypeName;
int m_specialCoords;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define MANTID_VATES_MD_LOADING_PRESENTER

#include "MantidKernel/System.h"
#include "MantidAPI/IMDWorkspace.h"
#include <vtkDataSet.h>
#include <string>
#include <vector>
Expand Down Expand Up @@ -53,6 +54,10 @@ namespace Mantid
{
return "NotSet";
}
virtual int getSpecialCoordinates()
{
return API::None;
}
};

}
Expand Down
14 changes: 12 additions & 2 deletions Code/Mantid/Vates/VatesAPI/src/MDEWInMemoryLoadingPresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Mantid
@throw invalid_argument if the repository is null
@throw invalid_arument if view is null
*/
MDEWInMemoryLoadingPresenter::MDEWInMemoryLoadingPresenter(MDLoadingView* view, WorkspaceProvider* repository, std::string wsName) : MDEWLoadingPresenter(view), m_repository(repository), m_wsName(wsName), m_wsTypeName("")
MDEWInMemoryLoadingPresenter::MDEWInMemoryLoadingPresenter(MDLoadingView* view, WorkspaceProvider* repository, std::string wsName) : MDEWLoadingPresenter(view), m_repository(repository), m_wsName(wsName), m_wsTypeName(""), m_specialCoords(-1)
{
if(m_wsName.empty())
{
Expand Down Expand Up @@ -97,6 +97,7 @@ namespace Mantid
Workspace_sptr ws = m_repository->fetchWorkspace(m_wsName);
IMDEventWorkspace_sptr eventWs = boost::dynamic_pointer_cast<Mantid::API::IMDEventWorkspace>(ws);
m_wsTypeName = eventWs->id();
m_specialCoords = eventWs->getSpecialCoordinateSystem();
//Call base-class extraction method.
this->extractMetadata(eventWs);
}
Expand All @@ -115,5 +116,14 @@ namespace Mantid
{
return m_wsTypeName;
}

/**
* Getter for the special coordinates.
* @return the special coordinates value
*/
int MDEWInMemoryLoadingPresenter::getSpecialCoordinates()
{
return m_specialCoords;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class MDEWInMemoryLoadingPresenterTest: public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING(presenter.hasTDimensionAvailable());
TS_ASSERT_THROWS_NOTHING(presenter.getGeometryXML());
TS_ASSERT(!presenter.getWorkspaceTypeName().empty());
TSM_ASSERT("Special coordinate metadata failed.", -1<presenter.getSpecialCoordinates());
TS_ASSERT(Mock::VerifyAndClearExpectations(view));
TS_ASSERT(Mock::VerifyAndClearExpectations(&factory));

Expand Down Expand Up @@ -195,10 +196,14 @@ class MDEWInMemoryLoadingPresenterTest: public CxxTest::TestSuite
TSM_ASSERT_EQUALS("Characterisation Test Failed", "", presenter.getWorkspaceTypeName());
}


void testGetSpecialCoordinates()
{
MDEWInMemoryLoadingPresenter presenter(new MockMDLoadingView, new MockWorkspaceProvider, "_");
TSM_ASSERT_EQUALS("Characterisation Test Failed", -1, presenter.getSpecialCoordinates());
}



};

#endif
#endif

0 comments on commit d87c51a

Please sign in to comment.