Skip to content
Snippets Groups Projects
CreateSampleShape.cpp 1.25 KiB
Newer Older
//--------------------------------
// Includes
//--------------------------------
#include "MantidDataHandling/CreateSampleShape.h"
Nick Draper's avatar
Nick Draper committed
#include "MantidGeometry/Objects/ShapeFactory.h"

namespace Mantid
{
namespace DataHandling
{
  // Register the algorithm into the AlgorithmFactory

/**
 * Initialize the algorithm
 */
void CreateSampleShape::init()
{
  using namespace Mantid::Kernel;
  declareProperty(
    new WorkspaceProperty<MatrixWorkspace>("InputWorkspace","",Direction::Input),
    "The workspace with which to associate the sample ");
  declareProperty("ShapeXML","",new MandatoryValidator<std::string>(),
    "The XML that describes the shape" );
{  
  // Get the input workspace
  const MatrixWorkspace_sptr workspace = getProperty("InputWorkspace");
  // Get the XML definition
  std::string shapeXML = getProperty("ShapeXML");
  Geometry::ShapeFactory sFactory;
  boost::shared_ptr<Geometry::Object> shape_sptr = sFactory.createShape(shapeXML);

  workspace->mutableSample().setShapeObject(*shape_sptr);