1 // Created on: 2014-08-15
2 // Created by: Varvara POSKONINA
3 // Copyright (c) 2005-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _SelectMgr_SelectableObjectSet_HeaderFile
17 #define _SelectMgr_SelectableObjectSet_HeaderFile
19 #include <BVH_PrimitiveSet.hxx>
21 #include <Select3D_BndBox3d.hxx>
22 #include <Handle_SelectMgr_SelectionManager.hxx>
23 #include <SelectMgr_SelectableObject.hxx>
24 #include <SelectMgr_VectorTypes.hxx>
26 //! The purpose of this class is to organize all selectable objects into
27 //! data structure, allowing to build BVH tree. For selectable objects
28 //! binned BVH builder is used with 32 bins and 1 element per leaf.
29 class SelectMgr_SelectableObjectSet : public BVH_PrimitiveSet<Standard_Real, 3>
33 //! Creates new empty objects set and initializes BVH tree
34 //! builder to Binned builder with 1 element per list
35 SelectMgr_SelectableObjectSet();
37 virtual ~SelectMgr_SelectableObjectSet() {};
39 //! Adds new object to the set and marks BVH tree for rebuild
40 void Append (const Handle(SelectMgr_SelectableObject)& theObject);
42 //! Removes object theObject from set and marks BVH tree for rebuild
43 void Remove (const Handle(SelectMgr_SelectableObject)& theObject);
45 //! Returns bounding box of object with index theIndex
46 virtual Select3D_BndBox3d Box (const Standard_Integer theIndex) const Standard_OVERRIDE;
48 //! Returns center of object with index theIndex in the set
49 //! along the given axis theAxis
50 virtual Standard_Real Center (const Standard_Integer theIndex,
51 const Standard_Integer theAxis) const Standard_OVERRIDE;
53 //! Swaps items with indexes theIndex1 and theIndex2 in the set
54 virtual void Swap (const Standard_Integer theIndex1,
55 const Standard_Integer theIndex2) Standard_OVERRIDE;
57 //! Returns size of objects set
58 virtual Standard_Integer Size() const Standard_OVERRIDE;
60 //! Returns object from set by theIndex given
61 const Handle(SelectMgr_SelectableObject)& GetObjectById (const Standard_Integer theIndex) const;
63 //! Returns true if this objects set contains theObject given
64 const Standard_Boolean Contains (const Handle(SelectMgr_SelectableObject)& theObject) const;
68 NCollection_Sequence<Handle(SelectMgr_SelectableObject)> myObjects;
69 NCollection_Sequence<Standard_Integer> myObjectIdxs;
72 #endif // _SelectMgr_SelectableObjectSet_HeaderFile