9#include "MantidGeometry/DllConfig.h"
44 virtual std::string
typeName()
const {
return "Component"; }
67 IComponent const *getBaseComponent()
const override;
73 std::shared_ptr<const IComponent> getParent()
const override;
75 std::vector<std::shared_ptr<const IComponent>> getAncestors()
const override;
77 bool isParentNamed(
const std::string &expectedName,
int maxDepth = -1)
const;
80 void setName(
const std::string &)
override;
83 std::string
getName()
const override;
86 std::string getFullName()
const override;
90 void setPos(
double,
double,
double)
override;
103 void translate(
double,
double,
double)
override;
125 double getDistance(
const IComponent &)
const override;
128 void getBoundingBox(
BoundingBox &boundingBox)
const override;
136 std::set<std::string> getParameterNames(
bool recursive =
true)
const override;
138 std::map<std::string, ComponentID> getParameterNamesByComponent()
const override;
140 bool hasParameter(
const std::string &name,
bool recursive =
true)
const override;
149 std::vector<double>
getNumberParameter(
const std::string &pname,
bool recursive =
true)
const override {
150 return getParameter<double>(pname, recursive);
160 std::vector<int>
getIntParameter(
const std::string &pname,
bool recursive =
true)
const override {
161 return getParameter<int>(pname, recursive);
173 std::string
getParameterType(
const std::string &pname,
bool recursive =
true)
const override {
176 param = m_map->getRecursive(
this, pname);
178 param = m_map->get(
this, pname);
181 return std::string(param->type());
183 return std::string(
"");
187 std::string getDescription()
const;
190 std::string getParamDescription(
const std::string &pname,
bool recursive =
true)
const;
193 std::string getParamShortDescription(
const std::string &pname,
bool recursive =
true)
const;
195 std::string getShortDescription()
const;
197 void setDescription(
const std::string &descr);
205 std::vector<bool>
getBoolParameter(
const std::string &pname,
bool recursive =
true)
const override {
206 return getParameter<bool>(pname, recursive);
216 std::vector<Kernel::V3D>
getPositionParameter(
const std::string &pname,
bool recursive =
true)
const override {
217 return getParameter<Kernel::V3D>(pname, recursive);
227 std::vector<Kernel::Quat>
getRotationParameter(
const std::string &pname,
bool recursive =
true)
const override {
228 return getParameter<Kernel::Quat>(pname, recursive);
238 std::vector<std::string>
getStringParameter(
const std::string &pname,
bool recursive =
true)
const override {
239 return getParameter<std::string>(pname, recursive);
246 retVal = m_map->getString(
this, pname, recursive);
262 param = m_map->getRecursive(
this, p_name);
264 param = m_map->get(
this, p_name);
267 return param->visible();
277 void printSelf(std::ostream &)
const override;
288 virtual void readXMLAttributes(
const Poco::XML::Attributes &attr);
289 virtual void writeXML(Poco::XML::XMLWriter &writer)
const;
290 virtual void appendXML(std::ostream &xmlStream)
const;
292 bool isParametrized()
const override;
294 virtual size_t registerContents(
class ComponentVisitor &componentVisitor)
const override;
295 bool hasComponentInfo()
const;
296 size_t index()
const;
324 template <
class TYPE> std::vector<TYPE>
getParameter(
const std::string &p_name,
bool recursive)
const {
330 param = m_map->
get(
this, p_name);
333 return std::vector<TYPE>(1, param->value<
TYPE>());
335 return std::vector<TYPE>(0);
339 return std::vector<TYPE>(0);
std::map< DeltaEMode::Type, std::string > index
Mantid::Kernel::Quat(ComponentInfo::* rotation)(const size_t) const
std::string getName(const IMDDimension &self)
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
ComponentVisitor : Visitor for IComponents.
Component is a wrapper for a Component which can modify some of its parameters, e....
const ParameterMap * m_map
A pointer to const ParameterMap containing the parameters.
bool getParameterVisible(const std::string &p_name, bool recursive) const override
Get a visibility attribute of a parameter from the parameter map.
virtual std::string typeName() const
const IComponent * getBareParent() const override
Returns the bare pointer to the IComponent parent.
std::vector< double > getNumberParameter(const std::string &pname, bool recursive=true) const override
Get a parameter defined as a double.
std::vector< Kernel::Quat > getRotationParameter(const std::string &pname, bool recursive=true) const override
Get a parameter defined as a Kernel::Quaternion.
std::string m_name
Name of the component.
Kernel::V3D m_pos
Position w.
std::string getParameterAsString(const std::string &pname, bool recursive=true) const override
get a string representation of a parameter
std::vector< int > getIntParameter(const std::string &pname, bool recursive=true) const override
Get a parameter defined as an int.
std::vector< Kernel::V3D > getPositionParameter(const std::string &pname, bool recursive=true) const override
Get a parameter defined as a Kernel::V3D.
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 typ...
const IComponent * base() const
Returns the address of the base component.
const IComponent * m_parent
Parent component in the tree.
Kernel::Quat m_rot
Orientation.
const Component * m_base
The base component - this is the unmodified component (without the parameters).
std::vector< std::string > getStringParameter(const std::string &pname, bool recursive=true) const override
Get a parameter defined as a string.
std::vector< bool > getBoolParameter(const std::string &pname, bool recursive=true) const override
Get a parameter defined as a bool.
std::vector< TYPE > getParameter(const std::string &p_name, bool recursive) const
Get a parameter from the parameter map.
base class for Geometric IComponent
std::shared_ptr< Parameter > getRecursive(const IComponent *comp, const std::string &name, const std::string &type="") const
Use get() recursively to see if can find param in all parents of comp and given type (std::string ver...
std::shared_ptr< Parameter > get(const IComponent *comp, const std::string &name, const std::string &type="") const
Get a parameter with a given name and type (std::string version)
void swap(MDLeanEvent< nd > &first, MDLeanEvent< nd > &second)
std::shared_ptr< Parameter > Parameter_sptr
Typedef for the shared pointer.
Helper class which provides the Collimation Length for SANS instruments.
Generate a tableworkspace to store the calibration results.