0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / BVH / BVH_Object.hxx
1 // Created on: 2013-12-20
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _BVH_Object_Header
17 #define _BVH_Object_Header
18
19 #include <BVH_Box.hxx>
20 #include <BVH_Properties.hxx>
21
22 //! A non-template class for using as base for BVH_Object
23 //! (just to have a named base class).
24 class BVH_ObjectTransient : public Standard_Transient
25 {
26   DEFINE_STANDARD_RTTIEXT(BVH_ObjectTransient, Standard_Transient)
27 public:
28
29   //! Returns properties of the geometric object.
30   virtual const Handle(BVH_Properties)& Properties() const { return myProperties; }
31
32   //! Sets properties of the geometric object.
33   virtual void SetProperties (const Handle(BVH_Properties)& theProperties) { myProperties = theProperties; }
34
35   //! Returns TRUE if object state should be updated.
36   virtual Standard_Boolean IsDirty() const { return myIsDirty; }
37
38   //! Marks object state as outdated (needs BVH rebuilding).
39   virtual void MarkDirty() { myIsDirty = Standard_True; }
40
41 protected:
42
43   //! Creates new abstract geometric object.
44   BVH_ObjectTransient() : myIsDirty (Standard_False) {}
45
46 protected:
47
48   Standard_Boolean       myIsDirty;    //!< Marks internal object state as outdated
49   Handle(BVH_Properties) myProperties; //!< Generic properties assigned to the object
50
51 };
52
53 //! Abstract geometric object bounded by BVH box.
54 //! \tparam T Numeric data type
55 //! \tparam N Vector dimension
56 template<class T, int N>
57 class BVH_Object : public BVH_ObjectTransient
58 {
59 public:
60
61   //! Creates new abstract geometric object.
62   BVH_Object() {}
63
64   //! Releases resources of geometric object.
65   virtual ~BVH_Object() = 0;
66
67 public:
68
69   //! Returns AABB of the geometric object.
70   virtual BVH_Box<T, N> Box() const = 0;
71
72 };
73
74 // =======================================================================
75 // function : ~BVH_Object
76 // purpose  :
77 // =======================================================================
78 template<class T, int N>
79 BVH_Object<T, N>::~BVH_Object()
80 {
81   //
82 }
83
84 #endif // _BVH_Object_Header