0026641: Visualization, TKOpenGl - handle correctly transformation persistence within...
[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
19#include <BVH_PrimitiveSet.hxx>
20
ec81011f 21#include <NCollection_IndexedMap.hxx>
f751596e 22#include <NCollection_Handle.hxx>
23
24#include <Select3D_BndBox3d.hxx>
25
26#include <SelectMgr_SensitiveEntity.hxx>
27#include <SelectMgr_Selection.hxx>
28
ec81011f 29typedef NCollection_IndexedMap<Handle(SelectMgr_SensitiveEntity)> SelectMgr_IndexedMapOfHSensitive;
30
f751596e 31//! This class is used to store all calculated sensitive entites of one selectable
32//! object. It provides an interface for building BVH tree which is used to speed-up
33//! the performance of searching for overlap among sensitives of one selectable object
34class SelectMgr_SensitiveEntitySet : public BVH_PrimitiveSet<Standard_Real, 3>
35{
36public:
37
1f3913c6 38 Standard_EXPORT SelectMgr_SensitiveEntitySet();
f751596e 39
40 virtual ~SelectMgr_SensitiveEntitySet() {};
41
42 //! Adds new entity to the set and marks BVH tree for rebuild
1f3913c6 43 Standard_EXPORT void Append (const Handle(SelectMgr_SensitiveEntity)& theEntity);
f751596e 44
45 //! Adds every entity of selection theSelection to the set and marks
46 //! BVH tree for rebuild
1f3913c6 47 Standard_EXPORT void Append (const Handle(SelectMgr_Selection)& theSelection);
f751596e 48
f751596e 49 //! Removes every entity of selection theSelection from the set
50 //! and marks BVH tree for rebuild
1f3913c6 51 Standard_EXPORT void Remove (const Handle(SelectMgr_Selection)& theSelection);
f751596e 52
53 //! Returns bounding box of entity with index theIdx
1f3913c6 54 Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIndex) const Standard_OVERRIDE;
f751596e 55
201c2208 56 //! Make inherited method Box() visible to avoid CLang warning
57 using BVH_PrimitiveSet<Standard_Real, 3>::Box;
58
f751596e 59 //! Returns geometry center of sensitive entity index theIdx
60 //! along the given axis theAxis
1f3913c6 61 Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIndex,
62 const Standard_Integer theAxis) const Standard_OVERRIDE;
f751596e 63
64 //! Swaps items with indexes theIdx1 and theIdx2
1f3913c6 65 Standard_EXPORT virtual void Swap (const Standard_Integer theIndex1,
66 const Standard_Integer theIndex2) Standard_OVERRIDE;
f751596e 67
68 //! Returns the amount of entities
1f3913c6 69 Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
f751596e 70
71 //! Returns the entity with index theIndex in the set
1f3913c6 72 Standard_EXPORT const Handle(SelectMgr_SensitiveEntity)& GetSensitiveById (const Standard_Integer theIndex) const;
f751596e 73
74private:
75
ec81011f 76 SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH
f751596e 77};
78
79#endif // _SelectMgr_SensitiveEntitySet_HeaderFile