Mantid
Loading...
Searching...
No Matches
ObjComponent.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidGeometry/DllConfig.h"
12
13#ifdef _WIN32
14#pragma warning(disable : 4250)
15#endif
16
17namespace Mantid {
18namespace Geometry {
19class Objects;
20//----------------------------------------------------------------------
21// Forward Declaration
22//----------------------------------------------------------------------
23
33class MANTID_GEOMETRY_DLL ObjComponent : public virtual IObjComponent, public Component {
34public:
36 std::string type() const override { return "PhysicalComponent"; }
37
39 ObjComponent(const IComponent *base, const ParameterMap *map);
40 // Looking to get rid of the first of these constructors in due course (and
41 // probably add others)
42 explicit ObjComponent(const std::string &name, IComponent *parent = nullptr);
43 explicit ObjComponent(const std::string &name, std::shared_ptr<const IObject> shape, IComponent *parent = nullptr);
44
48 IComponent *clone() const override { return new ObjComponent(*this); }
49
50 bool isValid(const Kernel::V3D &point) const override;
51 bool isOnSide(const Kernel::V3D &point) const override;
52 int interceptSurface(Track &track) const override;
53 double solidAngle(const Kernel::V3D &observer) const override;
55 void boundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const;
57 void getBoundingBox(BoundingBox &absoluteBB) const override;
59 virtual double getHeight() const;
61 virtual double getWidth() const;
63 virtual double getDepth() const;
64
65 int getPointInObject(Kernel::V3D &point) const override;
66 // Rendering member functions
67 void draw() const override;
68 void drawObject() const override;
69 void initDraw() const override;
70
72 const std::shared_ptr<const IObject> shape() const override;
75 void setShape(std::shared_ptr<const IObject> newShape);
77 const Kernel::Material material() const override;
78
79 virtual size_t registerContents(class ComponentVisitor &componentVisitor) const override;
80
81protected:
83 // Made a pointer to a const object. Since this is a shared object we
84 // shouldn't be
85 // exposing non-const methods of Object through this class.
86 std::shared_ptr<const IObject> m_shape;
87
88 const Kernel::V3D factorOutComponentPosition(const Kernel::V3D &point) const;
89 const Kernel::V3D takeOutRotation(Kernel::V3D point) const;
90
91private:
93 void getRelativeBoundingBox(BoundingBox &RelativeBB) const;
94};
95
96} // namespace Geometry
97} // namespace Mantid
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition: BoundingBox.h:34
ComponentVisitor : Visitor for IComponents.
Component is a wrapper for a Component which can modify some of its parameters, e....
Definition: Component.h:41
base class for Geometric IComponent
Definition: IComponent.h:51
Object Component class, this class brings together the physical attributes of the component to the po...
Definition: IObjComponent.h:37
Object Component class, this class brings together the physical attributes of the component to the po...
Definition: ObjComponent.h:33
std::shared_ptr< const IObject > m_shape
The physical geometry representation.
Definition: ObjComponent.h:86
void getRelativeBoundingBox(BoundingBox &RelativeBB) const
common part of the two Bounding box functions above;
void boundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const
std::string type() const override
type string
Definition: ObjComponent.h:36
IComponent * clone() const override
Virtual Copy Constructor.
Definition: ObjComponent.h:48
Defines a track as a start point and a direction.
Definition: Track.h:165
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
Definition: Material.h:50
Class for 3D vectors.
Definition: V3D.h:34
Helper class which provides the Collimation Length for SANS instruments.