0031124: Configuration - linker errors when building with CLang on Windows
[occt.git] / src / SelectMgr / SelectMgr_SensitiveEntitySet.hxx
1 // Created on: 2014-08-15
2 // Created by: Varvara POSKONINA
3 // Copyright (c) 2005-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 _SelectMgr_SensitiveEntitySet_HeaderFile
17 #define _SelectMgr_SensitiveEntitySet_HeaderFile
18
19 #include <BVH_PrimitiveSet3d.hxx>
20 #include <NCollection_IndexedMap.hxx>
21 #include <Select3D_BndBox3d.hxx>
22 #include <Select3D_BVHBuilder3d.hxx>
23 #include <SelectMgr_SensitiveEntity.hxx>
24 #include <SelectMgr_Selection.hxx>
25
26 typedef NCollection_IndexedMap<Handle(SelectMgr_SensitiveEntity)> SelectMgr_IndexedMapOfHSensitive;
27
28 //! This class is used to store all calculated sensitive entites of one selectable
29 //! object. It provides an interface for building BVH tree which is used to speed-up
30 //! the performance of searching for overlap among sensitives of one selectable object
31 class SelectMgr_SensitiveEntitySet : public BVH_PrimitiveSet3d
32 {
33   DEFINE_STANDARD_RTTIEXT(SelectMgr_SensitiveEntitySet, BVH_PrimitiveSet3d)
34 public:
35
36   //! Empty constructor.
37   Standard_EXPORT SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder);
38
39   virtual ~SelectMgr_SensitiveEntitySet() {}
40
41   //! Adds new entity to the set and marks BVH tree for rebuild
42   Standard_EXPORT void Append (const Handle(SelectMgr_SensitiveEntity)& theEntity);
43
44   //! Adds every entity of selection theSelection to the set and marks
45   //! BVH tree for rebuild
46   Standard_EXPORT void Append (const Handle(SelectMgr_Selection)& theSelection);
47
48   //! Removes every entity of selection theSelection from the set
49   //! and marks BVH tree for rebuild
50   Standard_EXPORT void Remove (const Handle(SelectMgr_Selection)& theSelection);
51
52   //! Returns bounding box of entity with index theIdx
53   Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIndex) const Standard_OVERRIDE;
54
55   //! Make inherited method Box() visible to avoid CLang warning
56   using BVH_PrimitiveSet3d::Box;
57
58   //! Returns geometry center of sensitive entity index theIdx
59   //! along the given axis theAxis
60   Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIndex,
61                                                 const Standard_Integer theAxis) const Standard_OVERRIDE;
62
63   //! Swaps items with indexes theIdx1 and theIdx2
64   Standard_EXPORT virtual void Swap (const Standard_Integer theIndex1,
65                                      const Standard_Integer theIndex2) Standard_OVERRIDE;
66
67   //! Returns the amount of entities
68   Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
69
70   //! Returns the entity with index theIndex in the set
71   Standard_EXPORT const Handle(SelectMgr_SensitiveEntity)& GetSensitiveById (const Standard_Integer theIndex) const;
72
73   //! Returns map of entities.
74   const SelectMgr_IndexedMapOfHSensitive& Sensitives() const { return mySensitives; }
75
76 private:
77
78   SelectMgr_IndexedMapOfHSensitive mySensitives;     //!< Map of entities and its corresponding index in BVH
79 };
80
81 #endif // _SelectMgr_SensitiveEntitySet_HeaderFile