Mantid
Loading...
Searching...
No Matches
IObjComponent.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
13namespace Mantid {
14
15namespace Kernel {
16class Material;
17}
18
19namespace Geometry {
20class Track;
21class IObject;
22class GeometryHandler;
23
37class MANTID_GEOMETRY_DLL IObjComponent : public virtual IComponent {
38public:
40 std::string type() const override { return "IObjComponent"; }
41
43
44 IObjComponent(GeometryHandler *the_handler);
45
47
48 IObjComponent &operator=(const IObjComponent &rhs);
49
50 // Looking to get rid of the first of these constructors in due course (and
51 // probably add others)
52 ~IObjComponent() override;
53
57 IComponent *clone() const override = 0;
58
60 virtual bool isValid(const Kernel::V3D &point) const = 0;
61
63 virtual bool isOnSide(const Kernel::V3D &point) const = 0;
64
66 virtual int interceptSurface(Track &track) const = 0;
67
70 virtual double solidAngle(const Kernel::V3D &observer) const = 0;
71
73 virtual int getPointInObject(Kernel::V3D &point) const = 0;
74
75 // Rendering member functions
77 virtual void draw() const = 0;
78
80 virtual void drawObject() const = 0;
81
84 virtual void initDraw() const = 0;
85
87 virtual const std::shared_ptr<const IObject> shape() const = 0;
89 virtual const Kernel::Material material() const = 0;
90
92 GeometryHandler *Handle() const { return handle.get(); }
93
94protected:
96 void setGeometryHandler(GeometryHandler *h);
97
98private:
100 std::unique_ptr<GeometryHandler> handle;
101
102 friend class GeometryHandler;
103};
104
106using IObjComponent_sptr = std::shared_ptr<IObjComponent>;
108using IObjComponent_const_sptr = std::shared_ptr<const IObjComponent>;
109
110} // namespace Geometry
111} // namespace Mantid
const std::vector< double > & rhs
Handles rendering of all object Geometry.
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
GeometryHandler * Handle() const
Gets the GeometryHandler.
Definition: IObjComponent.h:92
virtual const std::shared_ptr< const IObject > shape() const =0
Returns the shape of the Object.
virtual const Kernel::Material material() const =0
Returns the material of the Object.
IComponent * clone() const override=0
Virtual Copy Constructor.
virtual bool isOnSide(const Kernel::V3D &point) const =0
Does the point given lie on the surface of this object component?
virtual int getPointInObject(Kernel::V3D &point) const =0
Try to find a point that lies within (or on) the object.
std::unique_ptr< GeometryHandler > handle
Geometry Handle for rendering.
virtual void initDraw() const =0
Initializes the ObjComponent for rendering, this function should be called before rendering.
virtual bool isValid(const Kernel::V3D &point) const =0
Does the point given lie within this object component?
virtual void draw() const =0
Draws the objcomponent.
virtual double solidAngle(const Kernel::V3D &observer) const =0
Finds the approximate solid angle covered by the component when viewed from the point given.
virtual int interceptSurface(Track &track) const =0
Checks whether the track given will pass through this Component.
virtual void drawObject() const =0
Draws the Object.
std::string type() const override
type string
Definition: IObjComponent.h:40
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
std::shared_ptr< IObjComponent > IObjComponent_sptr
Shared pointer to IObjComponent.
std::shared_ptr< const IObjComponent > IObjComponent_const_sptr
Shared pointer to IObjComponent (const version)
Helper class which provides the Collimation Length for SANS instruments.