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

ParameterMap access

const IComponentm_parent
 Parent component in the tree.
 
const Componentm_base
 The base component - this is the unmodified component (without the parameters).
 
const ParameterMapm_map
 A pointer to const ParameterMap containing the parameters.
 
std::string m_name
 Name of the component.
 
Kernel::V3D m_pos
 Position w.
 
Kernel::Quat m_rot
 Orientation.
 
std::optional< Kernel::V2Dm_sidebysideviewpos
 Position of component in instrument viewer side by side view.
 
template<typename T >
class ComponentPool
 
std::set< std::string > getParameterNames (bool recursive=true) const override
 Return the parameter names.
 
std::map< std::string, ComponentIDgetParameterNamesByComponent () const override
 return the parameter names and the component they are from
 
bool hasParameter (const std::string &name, bool recursive=true) const override
 Returns a boolean indicating if the component has the named parameter.
 
std::vector< double > getNumberParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a double.
 
std::vector< int > getIntParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as an int.
 
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.
 
std::string getDescription () const
 Get this component parameter's description – no recursive search within children.
 
std::string getParamDescription (const std::string &pname, bool recursive=true) const
 Get description of a parameter attached to this component

 
std::string getParamShortDescription (const std::string &pname, bool recursive=true) const
 Get a component's parameter short description.
 
std::string getShortDescription () const
 Get a components's short description.
 
void setDescription (const std::string &descr)
 Set components description.
 
std::vector< bool > getBoolParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a bool.
 
std::vector< Kernel::V3DgetPositionParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::V3D.
 
std::vector< Kernel::QuatgetRotationParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::Quaternion.
 
std::vector< std::string > getStringParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a string.
 
std::string getParameterAsString (const std::string &pname, bool recursive=true) const override
 get a string representation of a parameter
 
bool getParameterVisible (const std::string &p_name, bool recursive) const override
 Get a visibility attribute of a parameter from the parameter map.
 
double getFittingParameter (const std::string &pname, double xvalue) const
 Get fitting parameter.
 
void printSelf (std::ostream &) const override
 Prints a text representation of itself.
 
const IComponentbase () const
 Returns the address of the base component.
 
Kernel::V3D getScaleFactor () const override
 Returns the ScaleFactor.
 
const IComponentgetBareParent () const override
 Returns the bare pointer to the IComponent parent.
 
virtual void readXMLAttributes (const Poco::XML::Attributes &attr)
 Reads the XML attributes from Poco XML parser.
 
virtual void writeXML (Poco::XML::XMLWriter &writer) const
 
virtual void appendXML (std::ostream &xmlStream) const
 Append to an open XML string.
 
bool isParametrized () const override
 Return true if the Component is, in fact, parametrized (that is - it has a valid parameter map)
 
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.
 
template<class TYPE >
std::vector< TYPEgetParameter (const std::string &p_name, bool recursive) const
 Get a parameter from the parameter map.
 
void swap (const Component *base, const ParameterMap *pmap)
 Swap the current references to the un-parameterized component and parameter map for new ones.
 

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 42 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 33 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 44 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 50 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 59 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 68 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 574 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 289 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 149 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 295 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 98 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 211 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::Instrument, Mantid::Geometry::GridDetector, Mantid::Geometry::GridDetector, Mantid::Geometry::RectangularDetector, Mantid::Geometry::StructuredDetector, and Mantid::Geometry::StructuredDetector.

Definition at line 449 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 91 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 622 of file Component.cpp.

References getName(), getParamDescription(), and name.

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 442 of file Component.cpp.

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

◆ getFittingParameter()

double Mantid::Geometry::Component::getFittingParameter ( const std::string &  pname,
double  xvalue 
) const

Get fitting parameter.

Get fitting parameter from a look up table or a formula.

Parameters
pname:: The name of the parameter
xvalue:: xvalue to interpolate lookup table of parameter map components
Returns
A list of values

Definition at line 690 of file Component.cpp.

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

Referenced by export_Component().

◆ 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 185 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 166 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 155 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 606 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 335 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 249 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 457 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 480 of file Component.cpp.

References getComponentID(), getParent(), m_map, name, 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 179 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 264 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 637 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 115 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 222 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 312 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 392 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 233 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 655 of file Component.cpp.

References getName(), getParamShortDescription(), and name.

Referenced by export_Component().

◆ getSideBySideViewPos()

std::optional< Kernel::V2D > Mantid::Geometry::Component::getSideBySideViewPos ( ) const
overridevirtual

Return the position of the component required on the instrument side by side view.

Implements Mantid::Geometry::IComponent.

Definition at line 375 of file Component.cpp.

References Mantid::Geometry::IComponent::getSideBySideViewPos(), getSideBySideViewPos(), m_base, m_map, m_parent, and m_sidebysideviewpos.

Referenced by getSideBySideViewPos().

◆ 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 244 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 507 of file Component.cpp.

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

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 75 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 131 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 530 of file Component.cpp.

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

Referenced by Mantid::Geometry::operator<<(), and 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 556 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 264 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 275 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 662 of file Component.cpp.

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

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 164 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 109 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 217 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 206 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::AddAbsorptionWeightedPathLengths::exec(), Mantid::Algorithms::EditInstrumentGeometry::exec(), Mantid::Crystal::LoadHKL::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 230 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().

◆ setSideBySideViewPos()

void Mantid::Geometry::Component::setSideBySideViewPos ( const Kernel::V2D pos)
overridevirtual

Set the IComponent position in the side by side instrument view.

Implements Mantid::Geometry::IComponent.

Definition at line 224 of file Component.cpp.

References m_sidebysideviewpos.

◆ 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 591 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 254 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 242 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 45 of file Component.h.

◆ writeXML()

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

Definition at line 564 of file Component.cpp.

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

Friends And Related Symbol Documentation

◆ ComponentPool

template<typename T >
friend class ComponentPool
friend

Definition at line 358 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 316 of file Component.h.

Referenced by Mantid::Geometry::CompAssembly::add(), Mantid::Geometry::ObjCompAssembly::add(), Mantid::Geometry::CompAssembly::addCopy(), Mantid::Geometry::ObjCompAssembly::addCopy(), 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(), getFittingParameter(), 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(), getSideBySideViewPos(), 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(), setPos(), setRot(), Mantid::Geometry::ObjComponent::setShape(), Mantid::Geometry::Instrument::setXmlText(), Mantid::Geometry::ObjComponent::shape(), Mantid::Geometry::ObjComponent::solidAngle(), swap(), translate(), 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 319 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 309 of file Component.h.

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

◆ m_pos

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

Position w.

Definition at line 321 of file Component.h.

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

◆ m_rot

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

Orientation.

Definition at line 323 of file Component.h.

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

◆ m_sidebysideviewpos

std::optional<Kernel::V2D> Mantid::Geometry::Component::m_sidebysideviewpos
protected

Position of component in instrument viewer side by side view.

Definition at line 325 of file Component.h.

Referenced by getSideBySideViewPos(), and setSideBySideViewPos().


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