Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Mantid::Geometry::Component Class Reference

Component is a wrapper for a Component which can modify some of its parameters, e.g. More...

#include <Geometry/Component.h>

Inheritance diagram for Mantid::Geometry::Component:
Mantid::Geometry::IComponent Mantid::Geometry::CompAssembly Mantid::Geometry::ObjComponent Mantid::Geometry::GridDetector Mantid::Geometry::Instrument Mantid::Geometry::StructuredDetector Mantid::Geometry::Detector Mantid::Geometry::ObjCompAssembly Mantid::Geometry::RectangularDetector Mantid::Geometry::GridDetectorPixel

Public Member Functions

IComponentclone () const override
 Clone method Make a copy of the Component. More...
 
 Component ()
 Create Empty Component at Origin, with no orientation and null parent. More...
 
 Component (const IComponent *base, const ParameterMap *map)
 Constructor for parametrized component. More...
 
 Component (std::string name, const Kernel::V3D &position, const Kernel::Quat &rotation, IComponent *parent=nullptr)
 Create a named component with positioning vector, orientation and parent. More...
 
 Component (std::string name, const Kernel::V3D &position, IComponent *parent=nullptr)
 Create a named component with positioning vector, and parent component. More...
 
 Component (std::string name, IComponent *parent=nullptr)
 Create a named component with a parent component (optional) More...
 
std::vector< std::shared_ptr< const IComponent > > getAncestors () const override
 Return an array of all ancestors. More...
 
IComponent const * getBaseComponent () const override
 Returns const pointer to base component if this component is parametrized. More...
 
void getBoundingBox (BoundingBox &boundingBox) const override
 Get the bounding box for this component and store it in the given argument. More...
 
ComponentID getComponentID () const override
 Returns the ComponentID - a unique identifier of the component. More...
 
double getDistance (const IComponent &) const override
 Get the distance to another IComponent. More...
 
std::string getFullName () const override
 Get the full pathname. More...
 
std::string getName () const override
 Get the IComponent name. More...
 
std::shared_ptr< const IComponentgetParent () const override
 Return a pointer to the current parent. as shared pointer. More...
 
Kernel::V3D getPos () const override
 Get the position of the IComponent. Tree structure is traverse through the. More...
 
Kernel::V3D getRelativePos () const override
 Get the position relative to the parent IComponent (absolute if no parent) More...
 
Kernel::Quat getRelativeRot () const override
 Get the relative Orientation. More...
 
Kernel::Quat getRotation () const override
 Get the absolute orientation of the IComponent. More...
 
bool isParentNamed (const std::string &expectedName, int maxDepth=-1) const
 Return true if one of the parents of this component is named something. More...
 
void rotate (const Kernel::Quat &) override
 Rotate the IComponent. This is relative to parent. More...
 
void rotate (double, const Kernel::V3D &) override
 Rotate the IComponent by an angle in degrees with respect to an axis. More...
 
void setName (const std::string &) override
 Set the IComponent name. More...
 
void setParent (IComponent *) override
 Assign a parent IComponent. Previous parent link is lost. More...
 
void setPos (const Kernel::V3D &) override
 Set the position of the Component The position is with respect to the parent Component. More...
 
void setPos (double, double, double) override
 Set the IComponent position, x, y, z respective to parent (if present) More...
 
void setRot (const Kernel::Quat &) override
 Set the orientation Kernel::Quaternion relative to parent (if present) More...
 
void translate (const Kernel::V3D &) override
 Translate the IComponent (vector form). This is relative to parent if. More...
 
void translate (double, double, double) override
 Translate the IComponent (x,y,z form). This is relative to parent if. More...
 
virtual std::string typeName () const
 
- Public Member Functions inherited from Mantid::Geometry::IComponent
virtual IComponentclone () const =0
 Return a clone to the current object. More...
 
virtual std::vector< std::shared_ptr< const IComponent > > getAncestors () const =0
 Return an array of all ancestors, the nearest first. More...
 
virtual const IComponentgetBareParent () const =0
 Returns the bare pointer to the IComponent parent. More...
 
virtual IComponent const * getBaseComponent () const =0
 Returns const pointer to base component if this component is parametrized. More...
 
virtual void getBoundingBox (BoundingBox &boundingBox) const =0
 Get the bounding box for this component and store it in the given argument. More...
 
virtual ComponentID getComponentID () const =0
 Returns the ComponentID - a unique identifier of the component. More...
 
virtual double getDistance (const IComponent &) const =0
 Get the distance to another IComponent. More...
 
virtual std::string getFullName () const =0
 Get the IComponent full path name. More...
 
virtual std::string getName () const =0
 Get the IComponent name. More...
 
virtual std::shared_ptr< const IComponentgetParent () const =0
 Return a pointer to the current parent. More...
 
virtual Kernel::V3D getPos () const =0
 Get the position of the IComponent. Tree structure is traverse through the. More...
 
virtual Kernel::V3D getRelativePos () const =0
 Get the position relative to the parent IComponent (absolute if no parent) More...
 
virtual Kernel::Quat getRelativeRot () const =0
 Get the relative Orientation. More...
 
virtual Kernel::Quat getRotation () const =0
 Get the absolute orientation of the IComponent. More...
 
virtual Kernel::V3D getScaleFactor () const
 Gets the scaling factor of the object for the Object Component. More...
 
virtual void rotate (const Kernel::Quat &)=0
 Rotate the IComponent. This is relative to parent. More...
 
virtual void rotate (double, const Kernel::V3D &)=0
 Rotate the IComponent by an angle in degrees with respect to an axis. More...
 
virtual void setName (const std::string &)=0
 Set the IComponent name. More...
 
virtual void setParent (IComponent *)=0
 Assign a parent IComponent. Previous parent link is lost. More...
 
virtual void setPos (const Kernel::V3D &)=0
 Set the position of the component The position is with respect to the parent component. More...
 
virtual void setPos (double, double, double)=0
 Set the IComponent position, x, y, z respective to parent (if present) More...
 
virtual void setRot (const Kernel::Quat &)=0
 Set the orientation Kernel::Quaternion relative to parent (if present) More...
 
virtual void translate (const Kernel::V3D &)=0
 Copy the Rotation from another IComponent. More...
 
virtual void translate (double, double, double)=0
 Translate the IComponent (x,y,z form). This is relative to parent if. More...
 
virtual std::string type () const
 Returns a string representation of the IComponent type. More...
 
virtual ~IComponent ()=default
 Destructor. More...
 

ParameterMap access

const IComponentm_parent
 Parent component in the tree. More...
 
const Componentm_base
 The base component - this is the unmodified component (without the parameters). More...
 
const ParameterMapm_map
 A pointer to const ParameterMap containing the parameters. More...
 
std::string m_name
 Name of the component. More...
 
Kernel::V3D m_pos
 Position w. More...
 
Kernel::Quat m_rot
 Orientation. More...
 
template<typename T >
class ComponentPool
 
std::set< std::string > getParameterNames (bool recursive=true) const override
 Return the parameter names. More...
 
std::map< std::string, ComponentIDgetParameterNamesByComponent () const override
 return the parameter names and the component they are from More...
 
bool hasParameter (const std::string &name, bool recursive=true) const override
 Returns a boolean indicating if the component has the named parameter. More...
 
std::vector< double > getNumberParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a double. More...
 
std::vector< int > getIntParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as an int. More...
 
std::string getParameterType (const std::string &pname, bool recursive=true) const override
 Get a parameter's type – this is HACK until Python can export property regardless of the property type. More...
 
std::string getDescription () const
 Get this component parameter's description – no recursive search within children. More...
 
std::string getParamDescription (const std::string &pname, bool recursive=true) const
 Get description of a parameter attached to this component
More...
 
std::string getParamShortDescription (const std::string &pname, bool recursive=true) const
 Get a component's parameter short description. More...
 
std::string getShortDescription () const
 Get a components's short description. More...
 
void setDescription (const std::string &descr)
 Set components description. More...
 
std::vector< bool > getBoolParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a bool. More...
 
std::vector< Kernel::V3DgetPositionParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::V3D. More...
 
std::vector< Kernel::QuatgetRotationParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::Quaternion. More...
 
std::vector< std::string > getStringParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a string. More...
 
std::string getParameterAsString (const std::string &pname, bool recursive=true) const override
 get a string representation of a parameter More...
 
bool getParameterVisible (const std::string &p_name, bool recursive) const override
 Get a visibility attribute of a parameter from the parameter map. More...
 
void printSelf (std::ostream &) const override
 Prints a text representation of itself. More...
 
const IComponentbase () const
 Returns the address of the base component. More...
 
Kernel::V3D getScaleFactor () const override
 Returns the ScaleFactor. More...
 
const IComponentgetBareParent () const override
 Returns the bare pointer to the IComponent parent. More...
 
virtual void readXMLAttributes (const Poco::XML::Attributes &attr)
 Reads the XML attributes from Poco XML parser. More...
 
virtual void writeXML (Poco::XML::XMLWriter &writer) const
 
virtual void appendXML (std::ostream &xmlStream) const
 Append to an open XML string. More...
 
bool isParametrized () const override
 Return true if the Component is, in fact, parametrized (that is - it has a valid parameter map) More...
 
virtual size_t registerContents (class ComponentVisitor &componentVisitor) const override
 
bool hasComponentInfo () const
 
size_t index () const
 Helper for legacy access mode. Returns the index of the component. More...
 
template<class TYPE >
std::vector< TYPEgetParameter (const std::string &p_name, bool recursive) const
 Get a parameter from the parameter map. More...
 
void swap (const Component *base, const ParameterMap *pmap)
 Swap the current references to the un-parameterized component and parameter map for new ones. More...
 

Detailed Description

Component is a wrapper for a Component which can modify some of its parameters, e.g.

position, orientation. Implements IComponent.

Author
Roman Tolchenov, Tessella Support Services plc
Date
4/12/2008

Definition at line 41 of file Component.h.

Constructor & Destructor Documentation

◆ Component() [1/5]

Mantid::Geometry::Component::Component ( const IComponent base,
const ParameterMap map 
)

Constructor for parametrized component.

Constructor for a parametrized Component.

Parameters
base:: a Component that is the base (un-parametrized) component
map:: a ParameterMap to parameterize the component

Definition at line 31 of file Component.cpp.

References m_base.

◆ Component() [2/5]

Mantid::Geometry::Component::Component ( )

Create Empty Component at Origin, with no orientation and null parent.

Empty constructor Create a component with null parent.

Definition at line 42 of file Component.cpp.

Referenced by clone().

◆ Component() [3/5]

Mantid::Geometry::Component::Component ( std::string  name,
IComponent parent = nullptr 
)
explicit

Create a named component with a parent component (optional)

Constructor by value.

Parameters
name:: Component name
parent:: parent Component (optional)

Definition at line 48 of file Component.cpp.

◆ Component() [4/5]

Mantid::Geometry::Component::Component ( std::string  name,
const Kernel::V3D position,
IComponent parent = nullptr 
)

Create a named component with positioning vector, and parent component.

Constructor by value.

Parameters
name:: Component name
position:: position absolute or relative if the parent is defined
parent:: parent Component

Definition at line 57 of file Component.cpp.

◆ Component() [5/5]

Mantid::Geometry::Component::Component ( std::string  name,
const Kernel::V3D position,
const Kernel::Quat rotation,
IComponent parent = nullptr 
)

Create a named component with positioning vector, orientation and parent.

Constructor.

Parameters
name:: Component name
position:: position (relative to parent, if present)
rotation:: orientation quaternion (relative to parent, if present)
parent:: parent Component (optional)

Definition at line 66 of file Component.cpp.

Member Function Documentation

◆ appendXML()

void Mantid::Geometry::Component::appendXML ( std::ostream &  xmlStream) const
virtual

Append to an open XML string.

Parameters
xmlStream:: string to append to.

Definition at line 553 of file Component.cpp.

References m_pos, m_rot, and Mantid::Kernel::V3D::write().

◆ base()

const IComponent * Mantid::Geometry::Component::base ( ) const
inline

Returns the address of the base component.

Definition at line 280 of file Component.h.

Referenced by Mantid::Geometry::Instrument::getComponentByID(), Mantid::Geometry::ObjComponent::shape(), and swap().

◆ clone()

IComponent * Mantid::Geometry::Component::clone ( ) const
overridevirtual

◆ getAncestors()

std::vector< std::shared_ptr< const IComponent > > Mantid::Geometry::Component::getAncestors ( ) const
overridevirtual

Return an array of all ancestors.

Returns an array of all ancestors of this component, starting with the direct parent and moving up.

Returns
An array of pointers to ancestor components

Implements Mantid::Geometry::IComponent.

Definition at line 147 of file Component.cpp.

References getParent().

Referenced by getFullName().

◆ getBareParent()

const IComponent * Mantid::Geometry::Component::getBareParent ( ) const
inlineoverridevirtual

Returns the bare pointer to the IComponent parent.

Implements Mantid::Geometry::IComponent.

Definition at line 286 of file Component.h.

◆ getBaseComponent()

const IComponent * Mantid::Geometry::Component::getBaseComponent ( ) const
overridevirtual

Returns const pointer to base component if this component is parametrized.

Implements Mantid::Geometry::IComponent.

Definition at line 96 of file Component.cpp.

References m_base, and m_map.

◆ getBoolParameter()

std::vector< bool > Mantid::Geometry::Component::getBoolParameter ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

Get a parameter defined as a bool.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
A list of values

Implements Mantid::Geometry::IComponent.

Definition at line 205 of file Component.h.

Referenced by export_Component().

◆ getBoundingBox()

void Mantid::Geometry::Component::getBoundingBox ( BoundingBox boundingBox) const
overridevirtual

Get the bounding box for this component and store it in the given argument.

Get the bounding box for this component.

It is no shape so gives an empty box.

Parameters
boundingBox:: [Out] The resulting bounding box is stored here.

Implements Mantid::Geometry::IComponent.

Reimplemented in Mantid::Geometry::ObjComponent, Mantid::Geometry::GridDetector, Mantid::Geometry::GridDetector, Mantid::Geometry::RectangularDetector, Mantid::Geometry::StructuredDetector, and Mantid::Geometry::StructuredDetector.

Definition at line 428 of file Component.cpp.

◆ getComponentID()

ComponentID Mantid::Geometry::Component::getComponentID ( ) const
overridevirtual

Returns the ComponentID - a unique identifier of the component.

Get the component's ID (pointer address)

Returns
ID

Implements Mantid::Geometry::IComponent.

Definition at line 89 of file Component.cpp.

References m_base, and m_map.

Referenced by getParameterNamesByComponent(), and index().

◆ getDescription()

std::string Mantid::Geometry::Component::getDescription ( ) const

Get this component parameter's description – no recursive search within children.

Get this parameter's description – no recursive search within children.

Definition at line 601 of file Component.cpp.

References getName(), and getParamDescription().

Referenced by export_Component().

◆ getDistance()

double Mantid::Geometry::Component::getDistance ( const IComponent comp) const
overridevirtual

Get the distance to another IComponent.

Gets the distance between two Components.

Parameters
comp:: The Component to measure against
Returns
The distance

Implements Mantid::Geometry::IComponent.

Reimplemented in Mantid::Geometry::Detector.

Definition at line 421 of file Component.cpp.

References Mantid::Kernel::V3D::distance(), Mantid::Geometry::IComponent::getPos(), and getPos().

◆ getFullName()

std::string Mantid::Geometry::Component::getFullName ( ) const
overridevirtual

Get the full pathname.

Get the full path name of the Component.

Returns
full path name

Implements Mantid::Geometry::IComponent.

Definition at line 183 of file Component.cpp.

References getAncestors(), and getName().

◆ getIntParameter()

std::vector< int > Mantid::Geometry::Component::getIntParameter ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

Get a parameter defined as an int.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
A list of values

Implements Mantid::Geometry::IComponent.

Definition at line 160 of file Component.h.

Referenced by export_Component().

◆ getName()

std::string Mantid::Geometry::Component::getName ( ) const
overridevirtual

◆ getNumberParameter()

std::vector< double > Mantid::Geometry::Component::getNumberParameter ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

Get a parameter defined as a double.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
A list of values

Implements Mantid::Geometry::IComponent.

Definition at line 149 of file Component.h.

Referenced by export_Component().

◆ getParamDescription()

std::string Mantid::Geometry::Component::getParamDescription ( const std::string &  pname,
bool  recursive = true 
) const

Get description of a parameter attached to this component

Get a parameter's description.

Only parameterized component can have description

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
std::string describing parameter if such description is defined or empty string if not.

Definition at line 585 of file Component.cpp.

References Mantid::Geometry::ParameterMap::get(), Mantid::Geometry::ParameterMap::getRecursive(), and m_map.

Referenced by export_Component(), and getDescription().

◆ getParameter()

template<class TYPE >
std::vector< TYPE > Mantid::Geometry::Component::getParameter ( const std::string &  p_name,
bool  recursive 
) const
inlineprotected

Get a parameter from the parameter map.

Parameters
p_name:: The name of the parameter
recursive:: If true then the lookup will walk up the tree if this component does not have parameter
Returns
A list of size 0 or 1 containing the parameter value or nothing if it does not exist

Definition at line 324 of file Component.h.

References Mantid::Geometry::ParameterMap::get(), and Mantid::Geometry::ParameterMap::getRecursive().

◆ getParameterAsString()

std::string Mantid::Geometry::Component::getParameterAsString ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

get a string representation of a parameter

Implements Mantid::Geometry::IComponent.

Definition at line 243 of file Component.h.

◆ getParameterNames()

std::set< std::string > Mantid::Geometry::Component::getParameterNames ( bool  recursive = true) const
overridevirtual

Return the parameter names.

Get the names of the parameters for this component.

Parameters
recursive:: If true, the parameters for all of the parent components are also included
Returns
A set of strings giving the parameter names for this component

Implements Mantid::Geometry::IComponent.

Definition at line 436 of file Component.cpp.

References getParent(), m_map, and Mantid::Geometry::ParameterMap::names().

Referenced by export_Component().

◆ getParameterNamesByComponent()

std::map< std::string, ComponentID > Mantid::Geometry::Component::getParameterNamesByComponent ( ) const
overridevirtual

return the parameter names and the component they are from

Get the names of the parameters for this component and it's parents.

Returns
A map of strings giving the parameter names and the component they are from, warning this contains shared pointers keeping transient objects alive, do not keep longer than needed

Implements Mantid::Geometry::IComponent.

Definition at line 459 of file Component.cpp.

References getComponentID(), getParent(), m_map, and Mantid::Geometry::ParameterMap::names().

◆ getParameterType()

std::string Mantid::Geometry::Component::getParameterType ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

Get a parameter's type – this is HACK until Python can export property regardless of the property type.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
std::string describing parameter type or empty string if the type is not found

Implements Mantid::Geometry::IComponent.

Definition at line 173 of file Component.h.

Referenced by export_Component().

◆ getParameterVisible()

bool Mantid::Geometry::Component::getParameterVisible ( const std::string &  p_name,
bool  recursive 
) const
inlineoverridevirtual

Get a visibility attribute of a parameter from the parameter map.

Parameters
p_name:: The name of the parameter
recursive:: If true then the lookup will walk up the tree if this component does not have parameter
Returns
A boolean containing the visibility attribute of the parameter, false if does not exist

Implements Mantid::Geometry::IComponent.

Definition at line 258 of file Component.h.

◆ getParamShortDescription()

std::string Mantid::Geometry::Component::getParamShortDescription ( const std::string &  pname,
bool  recursive = true 
) const

Get a component's parameter short description.

Get a parameter's short description Only parameterized component can have description.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
std::string describing parameter if such description is defined or empty string if not.

Definition at line 616 of file Component.cpp.

References Mantid::Geometry::ParameterMap::get(), Mantid::Geometry::ParameterMap::getRecursive(), and m_map.

Referenced by export_Component(), and getShortDescription().

◆ getParent()

std::shared_ptr< const IComponent > Mantid::Geometry::Component::getParent ( ) const
overridevirtual

Return a pointer to the current parent. as shared pointer.

Get a pointer to the parent.

Returns
this.parent

Implements Mantid::Geometry::IComponent.

Definition at line 113 of file Component.cpp.

References Mantid::Geometry::ParComponentFactory::create(), getParent(), m_base, m_map, and m_parent.

Referenced by getAncestors(), getParameterNames(), getParameterNamesByComponent(), getParent(), getPos(), getRotation(), hasParameter(), and printSelf().

◆ getPos()

Kernel::V3D Mantid::Geometry::Component::getPos ( ) const
overridevirtual

◆ getPositionParameter()

std::vector< Kernel::V3D > Mantid::Geometry::Component::getPositionParameter ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

Get a parameter defined as a Kernel::V3D.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
A list of values

Implements Mantid::Geometry::IComponent.

Definition at line 216 of file Component.h.

Referenced by export_Component().

◆ getRelativePos()

Kernel::V3D Mantid::Geometry::Component::getRelativePos ( ) const
overridevirtual

Get the position relative to the parent IComponent (absolute if no parent)

Return the relative position to the parent Component.

Implements Mantid::Geometry::IComponent.

Reimplemented in Mantid::Geometry::GridDetectorPixel.

Definition at line 308 of file Component.cpp.

References Mantid::Geometry::ParameterMap::componentInfo(), Mantid::Geometry::ParameterMap::contains(), Mantid::Geometry::ParameterMap::get(), hasComponentInfo(), index(), m_base, m_map, m_pos, and Mantid::Geometry::ComponentInfo::relativePosition().

Referenced by export_Component(), and getPos().

◆ getRelativeRot()

Kernel::Quat Mantid::Geometry::Component::getRelativeRot ( ) const
overridevirtual

Get the relative Orientation.

Return the relative rotation of the Compoonent to the parent.

Implements Mantid::Geometry::IComponent.

Definition at line 371 of file Component.cpp.

References Mantid::Geometry::ParameterMap::componentInfo(), Mantid::Geometry::ParameterMap::contains(), Mantid::Geometry::ParameterMap::get(), hasComponentInfo(), index(), m_base, m_map, m_rot, and Mantid::Geometry::ComponentInfo::relativeRotation().

Referenced by getRotation(), and printSelf().

◆ getRotation()

Kernel::Quat Mantid::Geometry::Component::getRotation ( ) const
overridevirtual

◆ getRotationParameter()

std::vector< Kernel::Quat > Mantid::Geometry::Component::getRotationParameter ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

Get a parameter defined as a Kernel::Quaternion.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
A list of values

Implements Mantid::Geometry::IComponent.

Definition at line 227 of file Component.h.

Referenced by export_Component().

◆ getScaleFactor()

V3D Mantid::Geometry::Component::getScaleFactor ( ) const
overridevirtual

◆ getShortDescription()

std::string Mantid::Geometry::Component::getShortDescription ( ) const

Get a components's short description.

Get a parameter's tooltip (short description) – no recursive search within children.

Definition at line 634 of file Component.cpp.

References getName(), and getParamShortDescription().

Referenced by export_Component().

◆ getStringParameter()

std::vector< std::string > Mantid::Geometry::Component::getStringParameter ( const std::string &  pname,
bool  recursive = true 
) const
inlineoverridevirtual

Get a parameter defined as a string.

Parameters
pname:: The name of the parameter
recursive:: If true the search will walk up through the parent components
Returns
A list of values

Implements Mantid::Geometry::IComponent.

Definition at line 238 of file Component.h.

Referenced by Mantid::Algorithms::DirectILLTubeBackground::components(), and export_Component().

◆ hasComponentInfo()

bool Mantid::Geometry::Component::hasComponentInfo ( ) const

◆ hasParameter()

bool Mantid::Geometry::Component::hasParameter ( const std::string &  name,
bool  recursive = true 
) const
overridevirtual

Returns a boolean indicating if the component has the named parameter.

Parameters
name:: The name of the parameter
recursive:: If true the parent components will also be searched (Default: true)
Returns
A boolean indicating if the search was successful or not.

Implements Mantid::Geometry::IComponent.

Definition at line 486 of file Component.cpp.

References Mantid::Geometry::ParameterMap::contains(), getParent(), and m_map.

Referenced by Mantid::Algorithms::DirectILLTubeBackground::components(), and export_Component().

◆ index()

size_t Mantid::Geometry::Component::index ( ) const

◆ isParametrized()

bool Mantid::Geometry::Component::isParametrized ( ) const
overridevirtual

Return true if the Component is, in fact, parametrized (that is - it has a valid parameter map)

Implements Mantid::Geometry::IComponent.

Definition at line 73 of file Component.cpp.

References m_map.

Referenced by Mantid::Geometry::Instrument::parseTreeAndCacheBeamline(), Mantid::Geometry::Instrument::saveNexus(), and Mantid::Geometry::ParameterMap::setInstrument().

◆ isParentNamed()

bool Mantid::Geometry::Component::isParentNamed ( const std::string &  expectedName,
int  maxDepth = -1 
) const

Return true if one of the parents of this component is named something.

Parameters
expectedName:: case-sensitive name to look for.
maxDepth:: levels of recursion to look into, -1 for no limit (default)
Returns
true if a parent matches, false otherwise

Definition at line 129 of file Component.cpp.

References Mantid::Geometry::IComponent::getBareParent(), Mantid::Geometry::IComponent::getName(), and m_parent.

◆ printSelf()

void Mantid::Geometry::Component::printSelf ( std::ostream &  os) const
overridevirtual

Prints a text representation of itself.

Parameters
os:: The output stream to write to

Implements Mantid::Geometry::IComponent.

Definition at line 509 of file Component.cpp.

References getName(), getParent(), getPos(), getRelativeRot(), and Mantid::Geometry::IComponent::type().

Referenced by Mantid::Geometry::operator<<().

◆ readXMLAttributes()

void Mantid::Geometry::Component::readXMLAttributes ( const Poco::XML::Attributes &  attr)
virtual

Reads the XML attributes from Poco XML parser.

Parameters
attr:: XML attributes

Definition at line 535 of file Component.cpp.

References UNUSED_ARG.

Referenced by Mantid::Geometry::ComponentParser::startElement().

◆ registerContents()

size_t Mantid::Geometry::Component::registerContents ( class ComponentVisitor componentVisitor) const
overridevirtual

◆ rotate() [1/2]

void Mantid::Geometry::Component::rotate ( const Kernel::Quat r)
overridevirtual

Rotate the IComponent. This is relative to parent.

Rotate the Component relative to the parent Component.

Parameters
r:: translation vector

Implements Mantid::Geometry::IComponent.

Definition at line 260 of file Component.cpp.

References m_map, and m_rot.

◆ rotate() [2/2]

void Mantid::Geometry::Component::rotate ( double  angle,
const Kernel::V3D axis 
)
overridevirtual

Rotate the IComponent by an angle in degrees with respect to an axis.

Rotate the Component by an angle in degrees with respect to an axis.

Parameters
angle:: the number of degrees to rotate
axis:: The Vector to rotate around

Implements Mantid::Geometry::IComponent.

Definition at line 271 of file Component.cpp.

◆ setDescription()

void Mantid::Geometry::Component::setDescription ( const std::string &  descr)

Set components description.

Works for parameterized components only

Works for parameterized components only

Parameters
descr:: String which describes the component.

Definition at line 641 of file Component.cpp.

References getName(), Mantid::Geometry::ParameterMap::getRecursive(), and m_map.

Referenced by export_Component().

◆ setName()

void Mantid::Geometry::Component::setName ( const std::string &  s)
overridevirtual

Set the IComponent name.

Set the name of the Component (currently does nothing)

Parameters
s:: name string

Implements Mantid::Geometry::IComponent.

Definition at line 162 of file Component.cpp.

References m_map, and m_name.

◆ setParent()

void Mantid::Geometry::Component::setParent ( IComponent comp)
overridevirtual

Assign a parent IComponent. Previous parent link is lost.

Set the parent.

Previous parenting is lost.

Parameters
comp:: the parent Component

Implements Mantid::Geometry::IComponent.

Definition at line 107 of file Component.cpp.

References m_parent.

Referenced by Mantid::Geometry::InstrumentDefinitionParser::setLocation().

◆ setPos() [1/2]

void Mantid::Geometry::Component::setPos ( const Kernel::V3D v)
overridevirtual

Set the position of the Component The position is with respect to the parent Component.

Parameters
v:: vector position

Implements Mantid::Geometry::IComponent.

Definition at line 215 of file Component.cpp.

References m_map, and m_pos.

◆ setPos() [2/2]

void Mantid::Geometry::Component::setPos ( double  x,
double  y,
double  z 
)
overridevirtual

Set the IComponent position, x, y, z respective to parent (if present)

Set the position of the Component The position is with respect to the parent Component.

Parameters
x:: x position
y:: y position
z:: z position

Implements Mantid::Geometry::IComponent.

Definition at line 204 of file Component.cpp.

References m_map, m_pos, Mantid::Geometry::x, Mantid::Geometry::y, and Mantid::Geometry::z.

Referenced by InstrumentCreationHelper::addDetector(), InstrumentCreationHelper::addFullInstrumentToWorkspace(), ComponentCreationHelper::addSourceToInstrument(), ComponentCreationHelper::createCylInstrumentWithDetInGivenPositions(), ComponentCreationHelper::createCylInstrumentWithVerticalOffsetsSpecified(), ComponentCreationHelper::createEmptyInstrument(), Mantid::DataHandling::LoadGSS::createInstrumentGeometry(), ComponentCreationHelper::createInstrumentWithPSDTubes(), ComponentCreationHelper::createInstrumentWithSourceRotation(), Mantid::Geometry::ComponentHelper::createMinimalInstrument(), ComponentCreationHelper::createMinimalInstrument(), ComponentCreationHelper::createSimpleInstrumentWithRotation(), ComponentCreationHelper::createTestAssemblyOfFourCylinders(), ComponentCreationHelper::createTestInstrumentCylindrical(), Mantid::Algorithms::CreateSampleWorkspace::createTestInstrumentRectangular(), Mantid::Geometry::ComponentHelper::createVirtualInstrument(), Mantid::Geometry::ComponentParser::endElement(), Mantid::Algorithms::EditInstrumentGeometry::exec(), Mantid::Crystal::LoadHKL::exec(), Mantid::DataHandling::LoadInstrumentFromNexus::exec(), Mantid::DataHandling::LoadInstrumentFromRaw::exec(), Mantid::DataHandling::LoadNXSPE::exec(), Mantid::DataHandling::LoadQKK::exec(), Mantid::Geometry::InstrumentDefinitionParser::getAbsolutPositionInCompCoorSys(), ComponentCreationHelper::makeBank(), WorkspaceCreationHelper::maskSpectra(), ComponentCreationHelper::sansInstrument(), and Mantid::Geometry::InstrumentDefinitionParser::setLocation().

◆ setRot()

void Mantid::Geometry::Component::setRot ( const Kernel::Quat q)
overridevirtual

Set the orientation Kernel::Quaternion relative to parent (if present)

Set the orientation of the Component The position is with respect to the parent Component.

Parameters
q:: rotation quaternion

Implements Mantid::Geometry::IComponent.

Definition at line 226 of file Component.cpp.

References m_map, and m_rot.

Referenced by ComponentCreationHelper::createInstrumentWithSourceRotation(), ComponentCreationHelper::createSimpleInstrumentWithRotation(), Mantid::Geometry::ComponentParser::endElement(), and Mantid::Geometry::InstrumentDefinitionParser::setLocation().

◆ swap()

void Mantid::Geometry::Component::swap ( const Component base,
const ParameterMap pmap 
)
protected

Swap the current references to the un-parameterized component and parameter map for new ones.

Parameters
baseA pointer to the new un-parameterized component
pmapA pointer to the new parameter map

Definition at line 570 of file Component.cpp.

References base(), m_base, and m_map.

◆ translate() [1/2]

void Mantid::Geometry::Component::translate ( const Kernel::V3D v)
overridevirtual

Translate the IComponent (vector form). This is relative to parent if.

Translate the Component relative to the parent Component.

Parameters
v:: translation vector

Implements Mantid::Geometry::IComponent.

Definition at line 250 of file Component.cpp.

References m_map, and m_pos.

◆ translate() [2/2]

void Mantid::Geometry::Component::translate ( double  x,
double  y,
double  z 
)
overridevirtual

Translate the IComponent (x,y,z form). This is relative to parent if.

Translate the Component relative to the parent Component.

Parameters
x:: translation on the x-axis
y:: translation on the y-axis
z:: translation on the z-axis

Implements Mantid::Geometry::IComponent.

Definition at line 238 of file Component.cpp.

References m_map, m_pos, Mantid::Geometry::x, Mantid::Geometry::y, and Mantid::Geometry::z.

◆ typeName()

virtual std::string Mantid::Geometry::Component::typeName ( ) const
inlinevirtual
Returns
the name of this type

Definition at line 44 of file Component.h.

◆ writeXML()

void Mantid::Geometry::Component::writeXML ( Poco::XML::XMLWriter &  writer) const
virtual

Definition at line 543 of file Component.cpp.

References m_pos, and Mantid::Kernel::V3D::toString().

Friends And Related Function Documentation

◆ ComponentPool

template<typename T >
friend class ComponentPool
friend

Definition at line 347 of file Component.h.

Member Data Documentation

◆ m_base

const Component* Mantid::Geometry::Component::m_base
protected

◆ m_map

const ParameterMap* Mantid::Geometry::Component::m_map
protected

A pointer to const ParameterMap containing the parameters.

Definition at line 307 of file Component.h.

Referenced by Mantid::Geometry::CompAssembly::add(), Mantid::Geometry::ObjCompAssembly::add(), Mantid::Geometry::CompAssembly::addCopy(), Mantid::Geometry::ObjCompAssembly::addCopy(), Mantid::Geometry::Instrument::baseInstrument(), Mantid::Geometry::Instrument::detectorIndex(), Mantid::Geometry::StructuredDetector::getB(), getBaseComponent(), Mantid::Geometry::ObjComponent::getBoundingBox(), Mantid::Geometry::Instrument::getBoundingBox(), Mantid::Geometry::CompAssembly::getBoundingBox(), Mantid::Geometry::GridDetector::getBoundingBox(), Mantid::Geometry::StructuredDetector::getBoundingBox(), Mantid::Geometry::CompAssembly::getChild(), Mantid::Geometry::Instrument::getComponentByID(), getComponentID(), Mantid::Geometry::Instrument::getDetector(), Mantid::Geometry::StructuredDetector::getDetectorIDAtXY(), Mantid::Geometry::GridDetector::getDetectorIDAtXYZ(), Mantid::Geometry::Instrument::getDetectorIDs(), Mantid::Geometry::Instrument::getDetectors(), Mantid::Geometry::Instrument::getFilename(), Mantid::Geometry::StructuredDetector::getG(), Mantid::Geometry::Detector::getID(), Mantid::Geometry::Instrument::getMinMaxDetectorIDs(), Mantid::Geometry::Instrument::getMonitors(), getName(), Mantid::Geometry::Instrument::getNumberDetectors(), getParamDescription(), Mantid::Geometry::Instrument::getParameterMap(), getParameterNames(), getParameterNamesByComponent(), getParamShortDescription(), getParent(), Mantid::Geometry::Instrument::getPhysicalInstrument(), Mantid::Geometry::Instrument::getPlottable(), Mantid::Geometry::CompAssembly::getPos(), getPos(), Mantid::Geometry::ObjCompAssembly::getPos(), Mantid::Geometry::StructuredDetector::getR(), Mantid::Geometry::Instrument::getReferenceFrame(), getRelativePos(), Mantid::Geometry::GridDetectorPixel::getRelativePos(), Mantid::Geometry::GridDetector::getRelativePosAtXYZ(), getRelativeRot(), Mantid::Geometry::CompAssembly::getRotation(), getRotation(), Mantid::Geometry::ObjCompAssembly::getRotation(), Mantid::Geometry::Instrument::getSample(), getScaleFactor(), Mantid::Geometry::Instrument::getSource(), Mantid::Geometry::Instrument::getXmlText(), Mantid::Geometry::StructuredDetector::getXValues(), Mantid::Geometry::StructuredDetector::getXYForDetectorID(), Mantid::Geometry::GridDetector::getXYZForDetectorID(), Mantid::Geometry::StructuredDetector::getYValues(), hasComponentInfo(), Mantid::Geometry::Detector::hasDetectorInfo(), hasParameter(), Mantid::Geometry::GridDetector::idfillbyfirst_y(), Mantid::Geometry::StructuredDetector::idFillByFirstY(), Mantid::Geometry::GridDetector::idFillOrder(), Mantid::Geometry::GridDetector::idstart(), Mantid::Geometry::StructuredDetector::idStart(), Mantid::Geometry::GridDetector::idstep(), Mantid::Geometry::StructuredDetector::idStep(), Mantid::Geometry::GridDetector::idstepbyrow(), Mantid::Geometry::StructuredDetector::idStepByRow(), index(), Mantid::Geometry::Detector::index(), Mantid::Geometry::StructuredDetector::initialize(), Mantid::Geometry::GridDetector::initialize(), Mantid::Geometry::Instrument::isMonitor(), Mantid::Geometry::Instrument::isMonitorViaIndex(), isParametrized(), Mantid::Geometry::Instrument::makeLegacyParameterMap(), Mantid::Geometry::Instrument::markAsDetector(), Mantid::Geometry::Instrument::markAsDetectorIncomplete(), Mantid::Geometry::Instrument::markAsMonitor(), Mantid::Geometry::Instrument::markAsSamplePos(), Mantid::Geometry::Instrument::markAsSource(), Mantid::Geometry::GridDetector::maxDetectorID(), Mantid::Geometry::StructuredDetector::maxDetectorID(), Mantid::Geometry::GridDetector::minDetectorID(), Mantid::Geometry::StructuredDetector::minDetectorID(), Mantid::Geometry::CompAssembly::nelements(), Mantid::Geometry::ObjCompAssembly::nelements(), Mantid::Geometry::ObjCompAssembly::operator[](), Mantid::Geometry::Detector::parameterMap(), Mantid::Geometry::CompAssembly::remove(), Mantid::Geometry::Instrument::removeDetector(), rotate(), Mantid::Geometry::StructuredDetector::setColors(), setDescription(), Mantid::Geometry::Instrument::setFilename(), setName(), Mantid::Geometry::Instrument::setPhysicalInstrument(), setPos(), setRot(), Mantid::Geometry::ObjComponent::setShape(), Mantid::Geometry::Instrument::setXmlText(), Mantid::Geometry::ObjComponent::shape(), Mantid::Geometry::ObjComponent::solidAngle(), swap(), translate(), Mantid::Geometry::GridDetector::xpixels(), Mantid::Geometry::StructuredDetector::xPixels(), Mantid::Geometry::GridDetector::xsize(), Mantid::Geometry::GridDetector::xstart(), Mantid::Geometry::GridDetector::xstep(), Mantid::Geometry::GridDetector::ypixels(), Mantid::Geometry::StructuredDetector::yPixels(), Mantid::Geometry::GridDetector::ysize(), Mantid::Geometry::GridDetector::ystart(), Mantid::Geometry::GridDetector::ystep(), Mantid::Geometry::GridDetector::zpixels(), Mantid::Geometry::GridDetector::zsize(), Mantid::Geometry::GridDetector::zstart(), and Mantid::Geometry::GridDetector::zstep().

◆ m_name

std::string Mantid::Geometry::Component::m_name
protected

Name of the component.

Definition at line 310 of file Component.h.

Referenced by getName(), and setName().

◆ m_parent

const IComponent* Mantid::Geometry::Component::m_parent
protected

Parent component in the tree.

Definition at line 300 of file Component.h.

Referenced by getParent(), getPos(), getRotation(), isParentNamed(), and setParent().

◆ m_pos

Kernel::V3D Mantid::Geometry::Component::m_pos
protected

Position w.

Definition at line 312 of file Component.h.

Referenced by appendXML(), getPos(), getRelativePos(), setPos(), translate(), and writeXML().

◆ m_rot

Kernel::Quat Mantid::Geometry::Component::m_rot
protected

Orientation.

Definition at line 314 of file Component.h.

Referenced by appendXML(), getRelativeRot(), getRotation(), rotate(), and setRot().


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