Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Mantid::Geometry::ShapeFactory Class Reference

Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm. More...

#include <ShapeFactory.h>

Public Member Functions

std::string addGoniometerTag (const Kernel::Matrix< double > &rotateMatrix, std::string xml)
 
std::shared_ptr< CSGObjectcreateShape (Poco::XML::Element *pElem)
 Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain the shape information. More...
 
std::shared_ptr< CSGObjectcreateShape (std::string shapeXML, bool addTypeTag=true)
 Creates a geometric object directly from a XML shape string. More...
 

Static Public Member Functions

static std::shared_ptr< CSGObjectcreateHexahedralShape (double xlb, double xlf, double xrf, double xrb, double ylb, double ylf, double yrf, double yrb)
 Create a hexahedral shape object. More...
 
static std::shared_ptr< CSGObjectcreateSphere (const Kernel::V3D &centre, double radius)
 Create a Sphere. More...
 
static Kernel::Matrix< double > generateMatrix (double xRotation, double yRotation, double zRotation)
 Generates a rotate Matrix applying the x rotate then y rotate, then z rotate. More...
 
static Kernel::Matrix< double > generateXRotation (double xRotation)
 Generates the x component of the rotate matrix. More...
 
static Kernel::Matrix< double > generateYRotation (double yRotation)
 Generates the y component of the rotate matrix. More...
 
static Kernel::Matrix< double > generateZRotation (double zRotation)
 Generates the z component of the rotate matrix. More...
 

Private Member Functions

void createGeometryHandler (Poco::XML::Element *, const std::shared_ptr< CSGObject > &)
 create a special geometry handler for the known finite primitives More...
 
double getDoubleAttribute (Poco::XML::Element *pElem, const std::string &name)
 Return value of attribute to XML element. More...
 
Poco::XML::Element * getOptionalShapeElement (Poco::XML::Element *pElem, const std::string &name)
 Return a subelement of an XML element. More...
 
Poco::XML::Element * getShapeElement (Poco::XML::Element *pElem, const std::string &name)
 Return a subelement of an XML element, but also checks that there exist exactly one entry of this subelement. More...
 
std::string parseCone (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'cone' element. More...
 
CuboidCorners parseCuboid (Poco::XML::Element *pElem)
 Get the four corners of a cuboid from an XML element. More...
 
std::string parseCuboid (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'cuboid' element. More...
 
std::string parseCylinder (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'cylinder' element. More...
 
Hexahedron parseHexahedron (Poco::XML::Element *pElem)
 Get all corners of a hexahedron from an XML element. More...
 
std::string parseHexahedron (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'hexahedron' element. More...
 
std::string parseHollowCylinder (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'hollow-cylinder' element. More...
 
std::string parseInfiniteCone (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'infinite-cone' element. More...
 
std::string parseInfiniteCylinder (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'infinite-cylinder' element. More...
 
std::string parseInfinitePlane (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'infinite-plane' element. More...
 
Kernel::V3D parsePosition (Poco::XML::Element *pElem)
 Get position coordinates from XML element. More...
 
std::string parseSliceOfCylinderRing (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'slice-of-cylinder-ring' element. More...
 
std::string parseSphere (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'sphere' element. More...
 
std::string parseTaperedGuide (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'tapered-guide' element, which is a special case of the XML 'hexahedron' element. More...
 
std::string parseTorus (Poco::XML::Element *pElem, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 Parse XML 'torus' element. More...
 

Static Private Member Functions

static std::string parseHexahedronFromStruct (const Hexahedron &hex, std::map< int, std::shared_ptr< Surface > > &prim, int &l_id)
 The "tapered-guide" shape is actually a special case of hexahedron; once we have the 8 points that make up either shape, the process of parsing them can be exactly the same in both cases. More...
 
static std::string sphereAlgebra (const int surfaceID)
 Create the algebra string for a Sphere. More...
 

Private Attributes

Kernel::Matrix< double > m_gonioRotateMatrix = Kernel::Matrix<double>(3, 3, 1)
 
Kernel::Matrix< double > m_rotateAllMatrix = Kernel::Matrix<double>(3, 3, 1)
 

Detailed Description

Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm.

In that algorithm it is used for creating shared pointers to the geometric shapes described in the XML instrument definition file.

This class is now also use elsewhere, and in addition to create geometric shapes from an DOM-element-node pointing to a <type> element with shape information, shapes can also be created directly from a XML shape string.

Author
Anders Markvardsen, ISIS, RAL
Date
6/8/2008

Definition at line 89 of file ShapeFactory.h.

Member Function Documentation

◆ addGoniometerTag()

std::string Mantid::Geometry::ShapeFactory::addGoniometerTag ( const Kernel::Matrix< double > &  rotateMatrix,
std::string  xml 
)

◆ createGeometryHandler()

void Mantid::Geometry::ShapeFactory::createGeometryHandler ( Poco::XML::Element *  pElem,
const std::shared_ptr< CSGObject > &  Obj 
)
private

◆ createHexahedralShape()

std::shared_ptr< CSGObject > Mantid::Geometry::ShapeFactory::createHexahedralShape ( double  xlb,
double  xlf,
double  xrf,
double  xrb,
double  ylb,
double  ylf,
double  yrf,
double  yrb 
)
static

Create a hexahedral shape object.

Parameters
xlb:: Left-back x point or hexahedron
xlf:: Left-front x point of hexahedron
xrf:: Right-front x point of hexahedron
xrb:: Right-back x point of hexahedron
ylb:: Left-back y point or hexahedron
ylf:: Left-front y point of hexahedron
yrf:: Right-front y point of hexahedron
yrb:: Right-back y point of hexahedron
Returns
the newly created hexahedral shape object

Definition at line 1498 of file ShapeFactory.cpp.

References Mantid::Geometry::Hexahedron::lbb, Mantid::Geometry::Hexahedron::lbt, Mantid::Geometry::Hexahedron::lfb, Mantid::Geometry::Hexahedron::lft, parseHexahedronFromStruct(), Mantid::Geometry::Hexahedron::rbb, Mantid::Geometry::Hexahedron::rbt, Mantid::Geometry::Hexahedron::rfb, Mantid::Geometry::Hexahedron::rft, and Mantid::Geometry::detail::ShapeInfo::setHexahedron().

Referenced by Mantid::Geometry::StructuredDetector::addDetector().

◆ createShape() [1/2]

std::shared_ptr< CSGObject > Mantid::Geometry::ShapeFactory::createShape ( Poco::XML::Element *  pElem)

Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain the shape information.

If no shape information an empty Object is returned.

Parameters
pElemA pointer to an Element node whose children fully define the object. The name of this element is unimportant.
Returns
A shared pointer to a geometric shape

Definition at line 104 of file ShapeFactory.cpp.

References createGeometryHandler(), Mantid::Geometry::g_log, generateMatrix(), getDoubleAttribute(), getShapeElement(), Mantid::Kernel::Matrix< T >::identityMatrix(), m_gonioRotateMatrix, m_rotateAllMatrix, parseCone(), parseCuboid(), parseCylinder(), parseHexahedron(), parseHollowCylinder(), parseInfiniteCone(), parseInfiniteCylinder(), parseInfinitePlane(), parsePosition(), parseSliceOfCylinderRing(), parseSphere(), parseTaperedGuide(), parseTorus(), std::to_string(), and Mantid::Kernel::Logger::warning().

Referenced by Mantid::Geometry::InstrumentDefinitionParser::adjustTypesContainingCombineComponentsElement(), Mantid::Algorithms::AnyShapeAbsorption::constructGaugeVolume(), Mantid::Algorithms::PaalmanPingsAbsorptionCorrection::constructGaugeVolume(), Mantid::Algorithms::AbsorptionCorrection::constructSample(), Mantid::Algorithms::CopySample::copyParameters(), Mantid::Algorithms::CreateSampleWorkspace::createCappedCylinder(), ComponentCreationHelper::createCappedCylinder(), ComponentCreationHelper::createCuboid(), ComponentCreationHelper::createHollowCylinder(), ComponentCreationHelper::createHollowShell(), Mantid::Geometry::ObjCompAssembly::createOutline(), Mantid::Geometry::Container::createSampleShape(), createShape(), Mantid::Geometry::InstrumentDefinitionParser::createShapeIfTypeIsNotAnAssembly(), Mantid::Algorithms::CreateSampleWorkspace::createSphere(), ComponentCreationHelper::createSphere(), Mantid::Geometry::ComponentHelper::createSphere(), Mantid::DataHandling::DefineGaugeVolume::exec(), Mantid::DataHandling::FindDetectorsInShape::exec(), Mantid::DataHandling::LoadQKK::exec(), Mantid::API::Sample::loadNexus(), Mantid::Algorithms::SparseWorkspace::makeCubeShape(), WorkspaceCreationHelper::maskSpectra(), Mantid::DataHandling::SampleEnvironmentSpecParser::parseComponent(), Mantid::DataHandling::SetSample::setSampleEnvironmentFromXML(), Mantid::DataHandling::CreateSampleShape::setSampleShape(), Mantid::API::Sample::setShape(), Mantid::Geometry::GridDetector::shape(), Mantid::Geometry::StructuredDetector::shape(), and Mantid::DataHandling::SetSample::validateGeometry().

◆ createShape() [2/2]

std::shared_ptr< CSGObject > Mantid::Geometry::ShapeFactory::createShape ( std::string  shapeXML,
bool  addTypeTag = true 
)

Creates a geometric object directly from a XML shape string.

Parameters
shapeXML:: XML shape string
addTypeTag:: true to wrap a <type> tag around the XML supplied (default)
Returns
A shared pointer to a geometric shape (defaults to an 'empty' shape if XML tags contain no geo. info.)

Definition at line 74 of file ShapeFactory.cpp.

References createShape(), Mantid::Geometry::g_log, and Mantid::Kernel::Logger::warning().

◆ createSphere()

std::shared_ptr< CSGObject > Mantid::Geometry::ShapeFactory::createSphere ( const Kernel::V3D centre,
double  radius 
)
static

Create a Sphere.

Parameters
centreThe center of the sphere
radiusThe radius in metres
Returns
A new CSGObject defining a sphere

Definition at line 1468 of file ShapeFactory.cpp.

References radius, Mantid::Geometry::detail::ShapeInfo::setSphere(), and sphereAlgebra().

Referenced by Mantid::Crystal::SaveHKL::exec(), and Mantid::DataHandling::LoadNXSPE::exec().

◆ generateMatrix()

Kernel::Matrix< double > Mantid::Geometry::ShapeFactory::generateMatrix ( double  xrotate,
double  yrotate,
double  zrotate 
)
static

Generates a rotate Matrix applying the x rotate then y rotate, then z rotate.

Parameters
xrotateThe x rotate required in radians
yrotateThe y rotate required in radians
zrotateThe z rotate required in radians
Returns
a matrix of doubles to use as the rotate matrix

Definition at line 1595 of file ShapeFactory.cpp.

References generateXRotation(), generateYRotation(), and generateZRotation().

Referenced by createShape(), parseCuboid(), parseCylinder(), parseHexahedron(), parseHollowCylinder(), parseInfiniteCylinder(), parseInfinitePlane(), parseSliceOfCylinderRing(), parseTaperedGuide(), and Mantid::DataHandling::MeshFileIO::rotate().

◆ generateXRotation()

Kernel::Matrix< double > Mantid::Geometry::ShapeFactory::generateXRotation ( double  xrotate)
static

Generates the x component of the rotate matrix.

Parameters
xrotateThe x rotate required in radians
Returns
a matrix of doubles to use as the x axis rotate matrix

Definition at line 1608 of file ShapeFactory.cpp.

Referenced by generateMatrix().

◆ generateYRotation()

Kernel::Matrix< double > Mantid::Geometry::ShapeFactory::generateYRotation ( double  yrotate)
static

Generates the y component of the rotate matrix.

Parameters
yrotateThe y rotate required in radians
Returns
a matrix of doubles to use as the y axis rotate matrix

Definition at line 1620 of file ShapeFactory.cpp.

Referenced by generateMatrix().

◆ generateZRotation()

Kernel::Matrix< double > Mantid::Geometry::ShapeFactory::generateZRotation ( double  zrotate)
static

Generates the z component of the rotate matrix.

Parameters
zrotateThe z rotate required in radians
Returns
a matrix of doubles to use as the z axis rotate matrix

Definition at line 1632 of file ShapeFactory.cpp.

Referenced by generateMatrix().

◆ getDoubleAttribute()

double Mantid::Geometry::ShapeFactory::getDoubleAttribute ( Poco::XML::Element *  pElem,
const std::string &  name 
)
private

Return value of attribute to XML element.

It is an extension of poco's getAttribute method, which in addition check that this attribute exists and if not throws an error.

Parameters
pElem:: XML from instrument def. file
name:: Name of subelement
Returns
Value of attribute
Exceptions
std::invalid_argumentThrown if issues with XML string

Definition at line 1404 of file ShapeFactory.cpp.

Referenced by createShape(), parseCone(), parseCuboid(), parseCylinder(), parseHollowCylinder(), parseInfiniteCone(), parseInfiniteCylinder(), parseSliceOfCylinderRing(), parseSphere(), parseTaperedGuide(), and parseTorus().

◆ getOptionalShapeElement()

Poco::XML::Element * Mantid::Geometry::ShapeFactory::getOptionalShapeElement ( Poco::XML::Element *  pElem,
const std::string &  name 
)
private

Return a subelement of an XML element.

The subelement is optional so it may not exist, but we also check that there is never more than one.

Parameters
pElem:: XML from instrument definition file.
name:: Name of the subelement.
Returns
The subelement, or a null pointer if it does not exist.
Exceptions
std::invalid_argumentif XML string is invalid.

Definition at line 1381 of file ShapeFactory.cpp.

Referenced by createGeometryHandler(), parseCuboid(), parseCylinder(), parseHexahedron(), parseHollowCylinder(), parseInfiniteCylinder(), parseInfinitePlane(), parseSliceOfCylinderRing(), parseSphere(), and parseTaperedGuide().

◆ getShapeElement()

Poco::XML::Element * Mantid::Geometry::ShapeFactory::getShapeElement ( Poco::XML::Element *  pElem,
const std::string &  name 
)
private

Return a subelement of an XML element, but also checks that there exist exactly one entry of this subelement.

Parameters
pElem:: XML from instrument def. file
name:: Name of subelement
Returns
The subelement
Exceptions
std::invalid_argumentThrown if issues with XML string

Definition at line 1358 of file ShapeFactory.cpp.

Referenced by createGeometryHandler(), createShape(), parseCone(), parseCylinder(), parseHexahedron(), parseHollowCylinder(), parseInfiniteCone(), parseInfiniteCylinder(), parseInfinitePlane(), parseSliceOfCylinderRing(), parseSphere(), parseTaperedGuide(), and parseTorus().

◆ parseCone()

std::string Mantid::Geometry::ShapeFactory::parseCone ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'cone' element.

Parameters
pElem:: XML 'cone' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 891 of file ShapeFactory.cpp.

References getDoubleAttribute(), getShapeElement(), height, Mantid::Kernel::normalize(), and parsePosition().

Referenced by createShape().

◆ parseCuboid() [1/2]

CuboidCorners Mantid::Geometry::ShapeFactory::parseCuboid ( Poco::XML::Element *  pElem)
private

Get the four corners of a cuboid from an XML element.

The XML may consist of one of the two available syntaxes. We disallow a mixture of syntaxes.

Parameters
pElem:: XML 'cuboid' element from instrument definition file.
Returns
The four corners of the cuboid.
Exceptions
std::invalid_argumentif XML string is invalid.

Definition at line 649 of file ShapeFactory.cpp.

References generateMatrix(), getDoubleAttribute(), getOptionalShapeElement(), Mantid::Geometry::CuboidCorners::lbb, Mantid::Geometry::CuboidCorners::lfb, Mantid::Geometry::CuboidCorners::lft, m_gonioRotateMatrix, m_rotateAllMatrix, Mantid::Kernel::normalize(), parsePosition(), Mantid::Geometry::CuboidCorners::rfb, Mantid::Kernel::V3D::rotate(), Mantid::Kernel::Quat::rotate(), and Mantid::Geometry::CuboidCorners::rotatePoints().

Referenced by createGeometryHandler(), createShape(), and parseCuboid().

◆ parseCuboid() [2/2]

std::string Mantid::Geometry::ShapeFactory::parseCuboid ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'cuboid' element.

Parameters
pElem:: XML 'cuboid' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 756 of file ShapeFactory.cpp.

References Mantid::Kernel::normalize(), and parseCuboid().

◆ parseCylinder()

std::string Mantid::Geometry::ShapeFactory::parseCylinder ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'cylinder' element.

Parameters
pElem:: XML 'cylinder' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 474 of file ShapeFactory.cpp.

References generateMatrix(), getDoubleAttribute(), getOptionalShapeElement(), getShapeElement(), height, m_gonioRotateMatrix, m_rotateAllMatrix, Mantid::Kernel::normalize(), parsePosition(), radius, and Mantid::Kernel::V3D::rotate().

Referenced by createShape().

◆ parseHexahedron() [1/2]

Hexahedron Mantid::Geometry::ShapeFactory::parseHexahedron ( Poco::XML::Element *  pElem)
private

◆ parseHexahedron() [2/2]

std::string Mantid::Geometry::ShapeFactory::parseHexahedron ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'hexahedron' element.

Parameters
pElem:: XML 'hexahedron' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 1095 of file ShapeFactory.cpp.

References parseHexahedron(), and parseHexahedronFromStruct().

◆ parseHexahedronFromStruct()

std::string Mantid::Geometry::ShapeFactory::parseHexahedronFromStruct ( const Hexahedron hex,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
staticprivate

The "tapered-guide" shape is actually a special case of hexahedron; once we have the 8 points that make up either shape, the process of parsing them can be exactly the same in both cases.

Definition at line 940 of file ShapeFactory.cpp.

References Mantid::Geometry::Hexahedron::lbb, Mantid::Geometry::Hexahedron::lbt, Mantid::Geometry::Hexahedron::lfb, Mantid::Geometry::Hexahedron::lft, Mantid::Geometry::Hexahedron::rbb, Mantid::Geometry::Hexahedron::rfb, and Mantid::Geometry::Hexahedron::rft.

Referenced by createHexahedralShape(), parseHexahedron(), and parseTaperedGuide().

◆ parseHollowCylinder()

std::string Mantid::Geometry::ShapeFactory::parseHollowCylinder ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'hollow-cylinder' element.

Parameters
pElem:: XML 'hollow-cylinder' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 553 of file ShapeFactory.cpp.

References generateMatrix(), getDoubleAttribute(), getOptionalShapeElement(), getShapeElement(), height, innerRadius, m_gonioRotateMatrix, m_rotateAllMatrix, Mantid::Kernel::normalize(), parsePosition(), and Mantid::Kernel::V3D::rotate().

Referenced by createShape().

◆ parseInfiniteCone()

std::string Mantid::Geometry::ShapeFactory::parseInfiniteCone ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'infinite-cone' element.

Parameters
pElem:: XML 'infinite-cone' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 848 of file ShapeFactory.cpp.

References getDoubleAttribute(), getShapeElement(), Mantid::Kernel::normalize(), and parsePosition().

Referenced by createShape().

◆ parseInfiniteCylinder()

std::string Mantid::Geometry::ShapeFactory::parseInfiniteCylinder ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'infinite-cylinder' element.

Parameters
pElem:: XML 'infinite-cylinder' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 418 of file ShapeFactory.cpp.

References generateMatrix(), getDoubleAttribute(), getOptionalShapeElement(), getShapeElement(), m_gonioRotateMatrix, m_rotateAllMatrix, Mantid::Kernel::normalize(), parsePosition(), radius, and Mantid::Kernel::V3D::rotate().

Referenced by createShape().

◆ parseInfinitePlane()

std::string Mantid::Geometry::ShapeFactory::parseInfinitePlane ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'infinite-plane' element.

Parameters
pElem:: XML 'infinite-plane' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 368 of file ShapeFactory.cpp.

References generateMatrix(), getOptionalShapeElement(), getShapeElement(), m_gonioRotateMatrix, m_rotateAllMatrix, Mantid::Kernel::normalize(), parsePosition(), and Mantid::Kernel::V3D::rotate().

Referenced by createShape().

◆ parsePosition()

V3D Mantid::Geometry::ShapeFactory::parsePosition ( Poco::XML::Element *  pElem)
private

Get position coordinates from XML element.

Parameters
pElem:: XML element whose attributes contain position coordinates
Returns
Position coordinates in the form of a V3D object

Definition at line 1417 of file ShapeFactory.cpp.

References Mantid::Kernel::V3D::spherical(), Mantid::Geometry::x, Mantid::Geometry::y, and Mantid::Geometry::z.

Referenced by createGeometryHandler(), createShape(), parseCone(), parseCuboid(), parseCylinder(), parseHexahedron(), parseHollowCylinder(), parseInfiniteCone(), parseInfiniteCylinder(), parseInfinitePlane(), parseSliceOfCylinderRing(), parseSphere(), parseTaperedGuide(), and parseTorus().

◆ parseSliceOfCylinderRing()

std::string Mantid::Geometry::ShapeFactory::parseSliceOfCylinderRing ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'slice-of-cylinder-ring' element.

Parameters
pElem:: XML 'slice-of-cylinder-ring' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 1246 of file ShapeFactory.cpp.

References Mantid::Geometry::g_log, generateMatrix(), getDoubleAttribute(), getOptionalShapeElement(), getShapeElement(), innerRadius, m_gonioRotateMatrix, m_rotateAllMatrix, parsePosition(), Mantid::Kernel::V3D::rotate(), and Mantid::Kernel::Logger::warning().

Referenced by createShape().

◆ parseSphere()

std::string Mantid::Geometry::ShapeFactory::parseSphere ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'sphere' element.

Parameters
pElem:: XML 'sphere' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 326 of file ShapeFactory.cpp.

References getDoubleAttribute(), getOptionalShapeElement(), getShapeElement(), m_gonioRotateMatrix, m_rotateAllMatrix, parsePosition(), radius, Mantid::Kernel::V3D::rotate(), and sphereAlgebra().

Referenced by createShape().

◆ parseTaperedGuide()

std::string Mantid::Geometry::ShapeFactory::parseTaperedGuide ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'tapered-guide' element, which is a special case of the XML 'hexahedron' element.

Parameters
pElem:: XML 'hexahedron' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 1114 of file ShapeFactory.cpp.

References generateMatrix(), getDoubleAttribute(), getOptionalShapeElement(), getShapeElement(), Mantid::Geometry::Hexahedron::lbb, Mantid::Geometry::Hexahedron::lbt, Mantid::Geometry::Hexahedron::lfb, Mantid::Geometry::Hexahedron::lft, m_gonioRotateMatrix, m_rotateAllMatrix, Mantid::Kernel::normalize(), parseHexahedronFromStruct(), parsePosition(), Mantid::Geometry::Hexahedron::rbb, Mantid::Geometry::Hexahedron::rbt, Mantid::Geometry::Hexahedron::rfb, Mantid::Geometry::Hexahedron::rft, Mantid::Kernel::V3D::rotate(), Mantid::Kernel::Quat::rotate(), and Mantid::Geometry::Hexahedron::rotatePoints().

Referenced by createShape().

◆ parseTorus()

std::string Mantid::Geometry::ShapeFactory::parseTorus ( Poco::XML::Element *  pElem,
std::map< int, std::shared_ptr< Surface > > &  prim,
int &  l_id 
)
private

Parse XML 'torus' element.

Parameters
pElem:: XML 'torus' element from instrument def. file
prim:: To add shapes to
l_id:: When shapes added to the map prim l_id is the continuous incremented index
Returns
A Mantid algebra string for this shape
Exceptions
InstrumentDefinitionErrorThrown if issues with the content of XML instrument file

Definition at line 1206 of file ShapeFactory.cpp.

References getDoubleAttribute(), getShapeElement(), Mantid::Kernel::normalize(), and parsePosition().

Referenced by createShape().

◆ sphereAlgebra()

std::string Mantid::Geometry::ShapeFactory::sphereAlgebra ( const int  surfaceID)
staticprivate

Create the algebra string for a Sphere.

Parameters
surfaceIDID of surface in map lookup
Returns
A CSG surface algebra string

Definition at line 355 of file ShapeFactory.cpp.

References std::to_string().

Referenced by createSphere(), and parseSphere().

Member Data Documentation

◆ m_gonioRotateMatrix

Kernel::Matrix<double> Mantid::Geometry::ShapeFactory::m_gonioRotateMatrix = Kernel::Matrix<double>(3, 3, 1)
private

◆ m_rotateAllMatrix

Kernel::Matrix<double> Mantid::Geometry::ShapeFactory::m_rotateAllMatrix = Kernel::Matrix<double>(3, 3, 1)
private

The documentation for this class was generated from the following files: