567d055037632e215c385d387c24c8d1bc38b84c
[occt.git] / src / SelectBasics / SelectBasics_SensitiveEntity.hxx
1 // Created on: 1995-01-23
2 // Created by: Mister rmi
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _SelectBasics_SensitiveEntity_HeaderFile
18 #define _SelectBasics_SensitiveEntity_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Real.hxx>
24 #include <MMgt_TShared.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <SelectBasics_SelectingVolumeManager.hxx>
27 #include <SelectBasics_PickResult.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Select3D_BndBox3d.hxx>
30 class SelectBasics_EntityOwner;
31
32
33 class SelectBasics_SensitiveEntity;
34 DEFINE_STANDARD_HANDLE(SelectBasics_SensitiveEntity, MMgt_TShared)
35
36 //! root class; the inheriting classes will be able to give
37 //! sensitive Areas for the dynamic selection algorithms
38 class SelectBasics_SensitiveEntity : public MMgt_TShared
39 {
40
41 public:
42
43   
44   //! Sets owner of the entity
45   Standard_EXPORT virtual void Set (const Handle(SelectBasics_EntityOwner)& theOwnerId);
46   
47   //! Returns pointer to owner of the entity
48   Standard_EXPORT const Handle(SelectBasics_EntityOwner)& OwnerId() const;
49   
50   //! Checks whether the sensitive entity is overlapped by
51   //! current selecting volume
52   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult) = 0;
53   
54   //! allows a better sensitivity for
55   //! a specific entity in selection algorithms
56   //! useful for small sized entities.
57   Standard_EXPORT Standard_Real SensitivityFactor() const;
58   
59   //! Returns the number of sub-entities or elements in
60   //! sensitive entity. Is used to determine if entity is
61   //! complex and needs to pre-build BVH at the creation of
62   //! sensitive entity step or is light-weighted so the tree
63   //! can be build on demand with unnoticeable delay
64   Standard_EXPORT virtual Standard_Integer NbSubElements() = 0;
65   
66   //! Returns bounding box of sensitive entity
67   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() = 0;
68   
69   //! Builds BVH tree for sensitive if it is needed
70   Standard_EXPORT virtual void BVH() = 0;
71   
72   //! Clears up all the resources and memory allocated
73   Standard_EXPORT virtual void Clear() = 0;
74
75
76
77
78   DEFINE_STANDARD_RTTI(SelectBasics_SensitiveEntity,MMgt_TShared)
79
80 protected:
81
82   
83   Standard_EXPORT SelectBasics_SensitiveEntity(const Handle(SelectBasics_EntityOwner)& theOwnerId, const Standard_Real theSensFactor = 2.0);
84   
85   //! Allows to manage the sensitivity of the entity
86     void SetSensitivityFactor (const Standard_Real theSensFactor);
87
88   Handle(SelectBasics_EntityOwner) myOwnerId;
89
90
91 private:
92
93
94   Standard_Real mySFactor;
95
96
97 };
98
99
100 #include <SelectBasics_SensitiveEntity.lxx>
101
102
103
104
105
106 #endif // _SelectBasics_SensitiveEntity_HeaderFile