Skip to content

Commit

Permalink
Refs #6352. Add API call for special coordinate system for MDHW.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Jan 16, 2013
1 parent b4f9f41 commit 8ad7313
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ namespace Mantid
virtual ~MDHWInMemoryLoadingPresenter();
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
12 changes: 11 additions & 1 deletion Code/Mantid/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.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
*/
MDHWInMemoryLoadingPresenter::MDHWInMemoryLoadingPresenter(MDLoadingView* view, WorkspaceProvider* repository, std::string wsName) : MDHWLoadingPresenter(view), m_repository(repository), m_wsName(wsName), m_wsTypeName("")
MDHWInMemoryLoadingPresenter::MDHWInMemoryLoadingPresenter(MDLoadingView* view, WorkspaceProvider* repository, std::string wsName) : MDHWLoadingPresenter(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);
IMDHistoWorkspace_sptr histoWs = boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>(ws);
m_wsTypeName = histoWs->id();
m_specialCoords = histoWs->getSpecialCoordinateSystem();
//Call base-class extraction method.
this->extractMetadata(histoWs);
}
Expand All @@ -115,5 +116,14 @@ namespace Mantid
{
return m_wsTypeName;
}

/**
* Getter for the special coordinates.
* @return the special coordinates value
*/
int MDHWInMemoryLoadingPresenter::getSpecialCoordinates()
{
return m_specialCoords;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +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());
TSM_ASSERT("Special coordinate metadata failed.", -1 < presenter.getSpecialCoordinates());
TS_ASSERT(Mock::VerifyAndClearExpectations(view));
TS_ASSERT(Mock::VerifyAndClearExpectations(&factory));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class MDHWInMemoryLoadingPresenterTest: 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 @@ -188,6 +189,12 @@ class MDHWInMemoryLoadingPresenterTest: public CxxTest::TestSuite
TSM_ASSERT_EQUALS("Characterisation Test Failed", "", presenter.getWorkspaceTypeName());
}

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

};

#endif

0 comments on commit 8ad7313

Please sign in to comment.