0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / SelectMgr / SelectMgr_SensitiveEntitySet.hxx
CommitLineData
f751596e 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
f5b72419 19#include <BVH_PrimitiveSet3d.hxx>
ec81011f 20#include <NCollection_IndexedMap.hxx>
f751596e 21#include <Select3D_BndBox3d.hxx>
f5b72419 22#include <Select3D_BVHBuilder3d.hxx>
f751596e 23#include <SelectMgr_SensitiveEntity.hxx>
24#include <SelectMgr_Selection.hxx>
25
ec81011f 26typedef NCollection_IndexedMap<Handle(SelectMgr_SensitiveEntity)> SelectMgr_IndexedMapOfHSensitive;
27
f751596e 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
f5b72419 31class SelectMgr_SensitiveEntitySet : public BVH_PrimitiveSet3d
f751596e 32{
f5b72419 33 DEFINE_STANDARD_RTTIEXT(SelectMgr_SensitiveEntitySet, BVH_PrimitiveSet3d)
f751596e 34public:
35
f5b72419 36 //! Empty constructor.
37 Standard_EXPORT SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder);
f751596e 38
b31fbc83 39 virtual ~SelectMgr_SensitiveEntitySet() {}
f751596e 40
41 //! Adds new entity to the set and marks BVH tree for rebuild
1f3913c6 42 Standard_EXPORT void Append (const Handle(SelectMgr_SensitiveEntity)& theEntity);
f751596e 43
44 //! Adds every entity of selection theSelection to the set and marks
45 //! BVH tree for rebuild
1f3913c6 46 Standard_EXPORT void Append (const Handle(SelectMgr_Selection)& theSelection);
f751596e 47
f751596e 48 //! Removes every entity of selection theSelection from the set
49 //! and marks BVH tree for rebuild
1f3913c6 50 Standard_EXPORT void Remove (const Handle(SelectMgr_Selection)& theSelection);
f751596e 51
52 //! Returns bounding box of entity with index theIdx
1f3913c6 53 Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIndex) const Standard_OVERRIDE;
f751596e 54
201c2208 55 //! Make inherited method Box() visible to avoid CLang warning
f5b72419 56 using BVH_PrimitiveSet3d::Box;
201c2208 57
f751596e 58 //! Returns geometry center of sensitive entity index theIdx
59 //! along the given axis theAxis
1f3913c6 60 Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIndex,
61 const Standard_Integer theAxis) const Standard_OVERRIDE;
f751596e 62
63 //! Swaps items with indexes theIdx1 and theIdx2
1f3913c6 64 Standard_EXPORT virtual void Swap (const Standard_Integer theIndex1,
65 const Standard_Integer theIndex2) Standard_OVERRIDE;
f751596e 66
67 //! Returns the amount of entities
1f3913c6 68 Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
f751596e 69
70 //! Returns the entity with index theIndex in the set
1f3913c6 71 Standard_EXPORT const Handle(SelectMgr_SensitiveEntity)& GetSensitiveById (const Standard_Integer theIndex) const;
f751596e 72
be7fc29e 73 //! Returns map of entities.
74 const SelectMgr_IndexedMapOfHSensitive& Sensitives() const { return mySensitives; }
75
f751596e 76private:
77
ec81011f 78 SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH
f751596e 79};
80
81#endif // _SelectMgr_SensitiveEntitySet_HeaderFile