Commit 0802e07a authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Added a BoundingBox class and implemented caching at the CompAssembly level....

Added a BoundingBox class and implemented caching at the CompAssembly level. Note that there are still several functions using the old getBoundingBox methods but this covers a lot of the needed code for the MC correction. Re #1212
parent 42aa385a
...@@ -158,6 +158,7 @@ ...@@ -158,6 +158,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\CreateSampleShape.cpp" /> <ClCompile Include="src\CreateSampleShape.cpp" />
<ClCompile Include="src\DefineGaugeVolume.cpp" />
<ClCompile Include="src\FindDetectorsInShape.cpp" /> <ClCompile Include="src\FindDetectorsInShape.cpp" />
<ClCompile Include="src\GetMaskedDetectors.cpp" /> <ClCompile Include="src\GetMaskedDetectors.cpp" />
<ClCompile Include="src\GroupDetectors.cpp" /> <ClCompile Include="src\GroupDetectors.cpp" />
...@@ -216,6 +217,7 @@ ...@@ -216,6 +217,7 @@
<ClCompile Include="src\UpdateInstrumentFromRaw.cpp" /> <ClCompile Include="src\UpdateInstrumentFromRaw.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="inc\MantidDataHandling\DefineGaugeVolume.h" />
<ClInclude Include="inc\mantiddatahandling\getmaskeddetectors.h" /> <ClInclude Include="inc\mantiddatahandling\getmaskeddetectors.h" />
<ClInclude Include="inc\mantiddatahandling\isisdataarchive.h" /> <ClInclude Include="inc\mantiddatahandling\isisdataarchive.h" />
<ClInclude Include="inc\mantiddatahandling\load.h" /> <ClInclude Include="inc\mantiddatahandling\load.h" />
......
...@@ -186,6 +186,9 @@ ...@@ -186,6 +186,9 @@
<ClCompile Include="src\LoadSpec.cpp"> <ClCompile Include="src\LoadSpec.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\DefineGaugeVolume.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="test\AlignDetectorsTest.h"> <ClInclude Include="test\AlignDetectorsTest.h">
...@@ -452,5 +455,8 @@ ...@@ -452,5 +455,8 @@
<ClInclude Include="inc\MantidDataHandling\LoadSpec.h"> <ClInclude Include="inc\MantidDataHandling\LoadSpec.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="inc\MantidDataHandling\DefineGaugeVolume.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
...@@ -72,6 +72,7 @@ namespace Mantid ...@@ -72,6 +72,7 @@ namespace Mantid
int spectra_nbr = 0; int spectra_nbr = 0;
while(getline(file,str)) while(getline(file,str))
{ {
if (str.empty() ) continue;
if (str[0] == '#' && str[1] == 'L') if (str[0] == '#' && str[1] == 'L')
{ {
spectra_nbr++; spectra_nbr++;
......
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
<ClCompile Include="src\Math\Acomp.cpp" /> <ClCompile Include="src\Math\Acomp.cpp" />
<ClCompile Include="src\Math\Algebra.cpp" /> <ClCompile Include="src\Math\Algebra.cpp" />
<ClCompile Include="src\Math\BnId.cpp" /> <ClCompile Include="src\Math\BnId.cpp" />
<ClCompile Include="src\Objects\BoundingBox.cpp" />
<ClCompile Include="src\Rendering\CacheGeometryGenerator.cpp" /> <ClCompile Include="src\Rendering\CacheGeometryGenerator.cpp" />
<ClCompile Include="src\Rendering\CacheGeometryHandler.cpp" /> <ClCompile Include="src\Rendering\CacheGeometryHandler.cpp" />
<ClCompile Include="src\Rendering\CacheGeometryRenderer.cpp" /> <ClCompile Include="src\Rendering\CacheGeometryRenderer.cpp" />
...@@ -245,6 +246,7 @@ ...@@ -245,6 +246,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="inc\MantidGeometry\Math\Acomp.h" /> <ClInclude Include="inc\MantidGeometry\Math\Acomp.h" />
<ClInclude Include="inc\MantidGeometry\Objects\BoundingBox.h" />
<ClInclude Include="inc\MantidGeometry\Rendering\OpenCascadeConfig.h" /> <ClInclude Include="inc\MantidGeometry\Rendering\OpenCascadeConfig.h" />
<ClInclude Include="test\AcompTest.h" /> <ClInclude Include="test\AcompTest.h" />
<ClInclude Include="inc\MantidGeometry\Math\Algebra.h" /> <ClInclude Include="inc\MantidGeometry\Math\Algebra.h" />
...@@ -257,6 +259,7 @@ ...@@ -257,6 +259,7 @@
<ClInclude Include="inc\MantidGeometry\Rendering\CacheGeometryHandler.h" /> <ClInclude Include="inc\MantidGeometry\Rendering\CacheGeometryHandler.h" />
<ClInclude Include="inc\MantidGeometry\Rendering\CacheGeometryRenderer.h" /> <ClInclude Include="inc\MantidGeometry\Rendering\CacheGeometryRenderer.h" />
<ClInclude Include="inc\MantidGeometry\Instrument\CompAssembly.h" /> <ClInclude Include="inc\MantidGeometry\Instrument\CompAssembly.h" />
<ClInclude Include="test\BoundingBoxTest.h" />
<ClInclude Include="test\CompAssemblyTest.h" /> <ClInclude Include="test\CompAssemblyTest.h" />
<ClInclude Include="inc\MantidGeometry\Instrument\Component.h" /> <ClInclude Include="inc\MantidGeometry\Instrument\Component.h" />
<ClInclude Include="test\ComponentTest.h" /> <ClInclude Include="test\ComponentTest.h" />
...@@ -369,6 +372,9 @@ ...@@ -369,6 +372,9 @@
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="test\ComponentCreationHelpers.hh" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
......
...@@ -192,6 +192,9 @@ ...@@ -192,6 +192,9 @@
<ClCompile Include="src\Rendering\vtkGeometryCacheWriter.cpp"> <ClCompile Include="src\Rendering\vtkGeometryCacheWriter.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Objects\BoundingBox.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="inc\MantidGeometry\Math\Acomp.h"> <ClInclude Include="inc\MantidGeometry\Math\Acomp.h">
...@@ -548,5 +551,16 @@ ...@@ -548,5 +551,16 @@
<ClInclude Include="inc\MantidGeometry\Rendering\OpenCascadeConfig.h"> <ClInclude Include="inc\MantidGeometry\Rendering\OpenCascadeConfig.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="inc\MantidGeometry\Objects\BoundingBox.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="test\BoundingBoxTest.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="test\ComponentCreationHelpers.hh">
<Filter>Header Files</Filter>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
...@@ -8,15 +8,24 @@ ...@@ -8,15 +8,24 @@
#include <set> #include <set>
#include "MantidGeometry/V3D.h" #include "MantidGeometry/V3D.h"
#include "MantidGeometry/Quat.h" #include "MantidGeometry/Quat.h"
#include "MantidGeometry/Objects/BoundingBox.h"
#include "MantidKernel/System.h" #include "MantidKernel/System.h"
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
namespace Mantid namespace Mantid
{ {
namespace Geometry namespace Geometry
{ {
/** @class IComponent //---------------------------------------------------------
// Forward declarations
//---------------------------------------------------------
class IComponent;
/// Define a type for a unique component identifier.
typedef IComponent* ComponentID;
/** @class IComponent
@brief base class for Geometric IComponent @brief base class for Geometric IComponent
@version A @version A
@author Laurent C Chapon, ISIS RAL @author Laurent C Chapon, ISIS RAL
...@@ -50,103 +59,104 @@ namespace Geometry ...@@ -50,103 +59,104 @@ namespace Geometry
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org> Code Documentation is available at: <http://doxygen.mantidproject.org>
*/ */
class IComponent;
/// Define a type for a unique component identifier.
typedef IComponent* ComponentID; class DLLExport IComponent
{
class DLLExport IComponent public:
{ /// Returns a string representation of the IComponent type
public: virtual std::string type() const {return "LogicalIComponent";}
/// Returns a string representation of the IComponent type //! Return a clone to the current object
virtual std::string type() const {return "LogicalIComponent";} virtual IComponent* clone() const=0;
//! Return a clone to the current object /// Destructor
virtual IComponent* clone() const=0; virtual ~IComponent(){}
/// Destructor //! Returns the ComponentID - a unique identifier of the component.
virtual ~IComponent(){} virtual ComponentID getComponentID()const = 0;
//! Returns the ComponentID - a unique identifier of the component. //! Assign a parent IComponent. Previous parent link is lost
virtual ComponentID getComponentID()const = 0; virtual void setParent(IComponent*)= 0;
//! Assign a parent IComponent. Previous parent link is lost //! Return a pointer to the current parent.
virtual void setParent(IComponent*)= 0; virtual boost::shared_ptr<const IComponent> getParent() const = 0;
//! Return a pointer to the current parent. //! Return an array of all ancestors, the nearest first
virtual boost::shared_ptr<const IComponent> getParent() const = 0; virtual std::vector<boost::shared_ptr<const IComponent> > getAncestors() const = 0;
//! Return an array of all ancestors, the nearest first //! Set the IComponent name
virtual std::vector<boost::shared_ptr<const IComponent> > getAncestors() const = 0; virtual void setName(const std::string&) = 0;
//! Set the IComponent name //! Get the IComponent name
virtual void setName(const std::string&) = 0; virtual std::string getName() const = 0;
//! Get the IComponent name //! Set the IComponent position, x, y, z respective to parent (if present) otherwise absolute
virtual std::string getName() const = 0; virtual void setPos(double, double, double) = 0;
//! Set the IComponent position, x, y, z respective to parent (if present) otherwise absolute /*! Set the position of the component
virtual void setPos(double, double, double) = 0; * The position is with respect to the parent component
/*! Set the position of the component */
* The position is with respect to the parent component virtual void setPos(const V3D&) = 0;
*/ //! Set the orientation quaternion relative to parent (if present) otherwise absolute
virtual void setPos(const V3D&) = 0; virtual void setRot(const Quat&) = 0;
//! Set the orientation quaternion relative to parent (if present) otherwise absolute //! Copy the Rotation from another IComponent
virtual void setRot(const Quat&) = 0; virtual void copyRot(const IComponent&) = 0;
//! Copy the Rotation from another IComponent //! Translate the IComponent (vector form). This is relative to parent if present.
virtual void copyRot(const IComponent&) = 0; virtual void translate(const V3D&) = 0;
//! Translate the IComponent (vector form). This is relative to parent if present. //! Translate the IComponent (x,y,z form). This is relative to parent if present.
virtual void translate(const V3D&) = 0; virtual void translate(double, double, double) = 0;
//! Translate the IComponent (x,y,z form). This is relative to parent if present. //! Rotate the IComponent. This is relative to parent.
virtual void translate(double, double, double) = 0; virtual void rotate(const Quat&) = 0;
//! Rotate the IComponent. This is relative to parent. //! Rotate the IComponent by an angle in degrees with respect to an axis.
virtual void rotate(const Quat&) = 0; virtual void rotate(double,const V3D&) = 0;
//! Rotate the IComponent by an angle in degrees with respect to an axis. //! Get the position relative to the parent IComponent (absolute if no parent)
virtual void rotate(double,const V3D&) = 0; virtual V3D getRelativePos() const = 0;
//! Get the position relative to the parent IComponent (absolute if no parent) //! Get the position of the IComponent. Tree structure is traverse through the parent chain
virtual V3D getRelativePos() const = 0; virtual V3D getPos() const = 0;
//! Get the position of the IComponent. Tree structure is traverse through the parent chain //! Get the relative Orientation
virtual V3D getPos() const = 0; virtual const Quat& getRelativeRot() const = 0;
//! Get the relative Orientation //! Get the absolute orientation of the IComponent
virtual const Quat& getRelativeRot() const = 0; virtual const Quat getRotation() const = 0;
//! Get the absolute orientation of the IComponent //! Get the distance to another IComponent
virtual const Quat getRotation() const = 0; virtual double getDistance(const IComponent&) const = 0;
//! Get the distance to another IComponent /// Get the bounding box for this component and store it in the given argument
virtual double getDistance(const IComponent&) const = 0; virtual void getBoundingBox(BoundingBox& boundingBox) const = 0;
/** @name ParameterMap access */
//@{ /** @name ParameterMap access */
/// Return the names of the parameters for this component //@{
virtual std::set<std::string> getParameterNames(bool recursive = true) const = 0; /// Return the names of the parameters for this component
/// Returns a boolean indicating if the component has the named parameter virtual std::set<std::string> getParameterNames(bool recursive = true) const = 0;
virtual bool hasParameter(const std::string & name, bool recursive = true) const = 0; /// Returns a boolean indicating if the component has the named parameter
// 06/05/2010 MG: Templated virtual functions cannot be defined so we have to resort to virtual bool hasParameter(const std::string & name, bool recursive = true) const = 0;
// one for each type, luckily there won't be too many // 06/05/2010 MG: Templated virtual functions cannot be defined so we have to resort to
/// Get a parameter defined as a double // one for each type, luckily there won't be too many
virtual std::vector<double> getNumberParameter(const std::string& pname, bool recursive = true) const = 0; /// Get a parameter defined as a double
/// Get a parameter defined as a V3D virtual std::vector<double> getNumberParameter(const std::string& pname, bool recursive = true) const = 0;
virtual std::vector<V3D> getPositionParameter(const std::string& pname, bool recursive = true) const = 0; /// Get a parameter defined as a V3D
/// Get a parameter defined as a Quaternion virtual std::vector<V3D> getPositionParameter(const std::string& pname, bool recursive = true) const = 0;
virtual std::vector<Quat> getRotationParameter(const std::string& pname, bool recursive = true) const = 0; /// Get a parameter defined as a Quaternion
/// Get a parameter defined as a string virtual std::vector<Quat> getRotationParameter(const std::string& pname, bool recursive = true) const = 0;
virtual std::vector<std::string> getStringParameter(const std::string& pname, bool recursive = true) const = 0; /// Get a parameter defined as a string
//@} virtual std::vector<std::string> getStringParameter(const std::string& pname, bool recursive = true) const = 0;
/** Prints a text representation of itself //@}
*/ /** Prints a text representation of itself
virtual void printSelf(std::ostream&) const = 0; */
private: virtual void printSelf(std::ostream&) const = 0;
/// Private, unimplemented copy assignment operator private:
IComponent& operator=(const IComponent&); /// Private, unimplemented copy assignment operator
}; IComponent& operator=(const IComponent&);
};
///Typedef of a shared pointer to a IComponent
typedef boost::shared_ptr<Mantid::Geometry::IComponent> IComponent_sptr; ///Typedef of a shared pointer to a IComponent
typedef boost::shared_ptr<Mantid::Geometry::IComponent> IComponent_sptr;
/** Prints a text representation
*/ /** Prints a text representation
DLLExport std::ostream& operator<<(std::ostream&, const IComponent&); */
DLLExport std::ostream& operator<<(std::ostream&, const IComponent&);
} //Namespace Geometry
} //Namespace Geometry
/// An object for constructing a shared_ptr that won't ever delete its pointee
class NoDeleting /// An object for constructing a shared_ptr that won't ever delete its pointee
{ class NoDeleting
public: {
/// Does nothing public:
void operator()(void*){} /// Does nothing
/// Does nothing void operator()(void*){}
void operator()(const void*){} /// Does nothing
}; void operator()(const void*){}
};
} //Namespace Mantid } //Namespace Mantid
......
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
* @param zmin :: Minimum value for the bounding box in z direction * @param zmin :: Minimum value for the bounding box in z direction
*/ */
virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const = 0; virtual void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const = 0;
///Try to find a point that lies within (or on) the object ///Try to find a point that lies within (or on) the object
virtual int getPointInObject(V3D& point) const = 0; virtual int getPointInObject(V3D& point) const = 0;
......
...@@ -75,6 +75,8 @@ public: ...@@ -75,6 +75,8 @@ public:
/// Set the pixel size of the detector (optional) /// Set the pixel size of the detector (optional)
virtual void setNumPixels(int num_xPixels, int num_yPixels); virtual void setNumPixels(int num_xPixels, int num_yPixels);
/// Get the bounding box for this component and store it in the given argument
virtual void getBoundingBox(BoundingBox& boundingBox) const;
//! Print information about all children //! Print information about all children
void printChildren(std::ostream&) const; void printChildren(std::ostream&) const;
void printTree(std::ostream&) const; void printTree(std::ostream&) const;
...@@ -83,13 +85,13 @@ private: ...@@ -83,13 +85,13 @@ private:
CompAssembly& operator=(const ICompAssembly&); CompAssembly& operator=(const ICompAssembly&);
///the group of child components ///the group of child components
std::vector< IComponent* > group; std::vector< IComponent* > m_children;
/// The number of pixels in the X (horizontal) direction; optional; for area detectors /// The number of pixels in the X (horizontal) direction; optional; for area detectors
int xPixels; int xPixels;
/// The number of pixels in the Y (vertical) direction; optional; for area detectors /// The number of pixels in the Y (vertical) direction; optional; for area detectors
int yPixels; int yPixels;
/// A cached bounding box
mutable BoundingBox *m_cachedBoundingBox;
}; };
DLLExport std::ostream& operator<<(std::ostream&, const CompAssembly&); DLLExport std::ostream& operator<<(std::ostream&, const CompAssembly&);
......
...@@ -110,6 +110,9 @@ namespace Mantid ...@@ -110,6 +110,9 @@ namespace Mantid
const Quat getRotation() const; const Quat getRotation() const;
//! Get the distance to another component //! Get the distance to another component
double getDistance(const IComponent&) const; double getDistance(const IComponent&) const;
/// Get the bounding box for this component and store it in the given argument
virtual void getBoundingBox(BoundingBox& boundingBox) const;
/** @name ParamaterMap access */ /** @name ParamaterMap access */
//@{ //@{
// 06/05/2010 MG: Templated virtual functions cannot be defined so we have to resort to // 06/05/2010 MG: Templated virtual functions cannot be defined so we have to resort to
......
...@@ -67,6 +67,8 @@ public: ...@@ -67,6 +67,8 @@ public:
virtual bool isOnSide(const V3D& point) const; virtual bool isOnSide(const V3D& point) const;
///Try to find a point that lies within (or on) the object ///Try to find a point that lies within (or on) the object
int getPointInObject(V3D& point) const; int getPointInObject(V3D& point) const;
/// Get the bounding box for this component and store it in the given argument
virtual void getBoundingBox(BoundingBox& boundingBox) const;
/// What detectors are contained in the group? /// What detectors are contained in the group?
std::vector<int> getDetectorIDs(); std::vector<int> getDetectorIDs();
......
...@@ -71,6 +71,7 @@ public: ...@@ -71,6 +71,7 @@ public:
int interceptSurface(Track& track) const; int interceptSurface(Track& track) const;
double solidAngle(const V3D& observer) const; double solidAngle(const V3D& observer) const;
void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const; void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const;
void getBoundingBox(BoundingBox& absoluteBB) const;
int getPointInObject(V3D& point) const; int getPointInObject(V3D& point) const;
//Rendering member functions //Rendering member functions
void draw() const; void draw() const;
......
...@@ -66,6 +66,9 @@ public: ...@@ -66,6 +66,9 @@ public:
/// Set the pixel size of the detector (optional) /// Set the pixel size of the detector (optional)
virtual void setNumPixels(int num_xPixels, int num_yPixels); virtual void setNumPixels(int num_xPixels, int num_yPixels);
/// Get the bounding box for this assembly and store it in the given argument
virtual void getBoundingBox(BoundingBox& boundingBox) const;
//! Print information about all children //! Print information about all children
void printChildren(std::ostream&) const; void printChildren(std::ostream&) const;
void printTree(std::ostream&) const; void printTree(std::ostream&) const;
......
...@@ -71,6 +71,8 @@ public: ...@@ -71,6 +71,8 @@ public:
int interceptSurface(Track& track) const; int interceptSurface(Track& track) const;
double solidAngle(const V3D& observer) const; double solidAngle(const V3D& observer) const;
void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const; void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const;
/// Get the bounding box for this component and store it in the given argument
virtual void getBoundingBox(BoundingBox& boundingBox) const;
int getPointInObject(V3D& point) const; int getPointInObject(V3D& point) const;
//Rendering member functions //Rendering member functions
void draw() const; void draw() const;
......
...@@ -277,19 +277,21 @@ public: ...@@ -277,19 +277,21 @@ public:
{ {
m_cacheLocMap.clear(); m_cacheLocMap.clear();
m_cacheRotMap.clear(); m_cacheRotMap.clear();
m_boundingBoxMap.clear();
} }
///Sets a cached location on the location cache ///Sets a cached location on the location cache
void setCachedLocation(const IComponent* comp, V3D& location) const; void setCachedLocation(const IComponent* comp, const V3D& location) const;
///Attempts to retreive a location from the location cache ///Attempts to retreive a location from the location cache
bool getCachedLocation(const IComponent* comp, V3D& location) const; bool getCachedLocation(const IComponent* comp, V3D& location) const;
///Sets a cached rotation on the rotation cache ///Sets a cached rotation on the rotation cache
void setCachedRotation(const IComponent* comp, Quat& rotation) const; void setCachedRotation(const IComponent* comp, const Quat& rotation) const;
///Attempts to retreive a rotation from the rotation cache ///Attempts to retreive a rotation from the rotation cache
bool getCachedRotation(const IComponent* comp, Quat& rotation) const; bool getCachedRotation(const IComponent* comp, Quat& rotation) const;
///Sets a cached bounding box
void setCachedBoundingBox(const IComponent *comp, const BoundingBox & box) const;
///Attempts to retrieve a bounding box from the cache
bool getCachedBoundingBox(const IComponent *comp, BoundingBox & box) const;
private: private:
///Assignment operator ///Assignment operator
...@@ -303,7 +305,8 @@ private: ...@@ -303,7 +305,8 @@ private:
mutable Kernel::Cache<const ComponentID,V3D > m_cacheLocMap; mutable Kernel::Cache<const ComponentID,V3D > m_cacheLocMap;
/// internal cache map instance for cached rotation values /// internal cache map instance for cached rotation values
mutable Kernel::Cache<const ComponentID,Quat > m_cacheRotMap; mutable Kernel::Cache<const ComponentID,Quat > m_cacheRotMap;
///internal cache map for cached bounding boxes
mutable Kernel::Cache<const ComponentID,BoundingBox> m_boundingBoxMap;
/// Static reference to the logger class /// Static reference to the logger class
static Kernel::Logger& g_log; static Kernel::Logger& g_log;
}; };
......
...@@ -116,6 +116,9 @@ namespace Mantid ...@@ -116,6 +116,9 @@ namespace Mantid
//! Get the distance to another IComponent //! Get the distance to another IComponent
double getDistance(const IComponent&) const; double getDistance(const IComponent&) const;
/// Get the bounding box for this component and store it in the given argument
virtual void getBoundingBox(BoundingBox& boundingBox) const;
/** @name ParamaterMap access */ /** @name ParamaterMap access */
//@{ //@{
// 06/05/2010 MG: Templated virtual functions cannot be defined so we have to resort to // 06/05/2010 MG: Templated virtual functions cannot be defined so we have to resort to
......