42cf5bc1 |
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 | |
91d96372 |
20 | #include <gp_GTrsf.hxx> |
3bf9a45f |
21 | #include <gp_Trsf.hxx> |
22 | |
42cf5bc1 |
23 | #include <Standard.hxx> |
24 | #include <Standard_Type.hxx> |
25 | |
26 | #include <Standard_Real.hxx> |
27 | #include <MMgt_TShared.hxx> |
28 | #include <Standard_Boolean.hxx> |
29 | #include <SelectBasics_SelectingVolumeManager.hxx> |
30 | #include <SelectBasics_PickResult.hxx> |
31 | #include <Standard_Integer.hxx> |
32 | #include <Select3D_BndBox3d.hxx> |
3bf9a45f |
33 | |
42cf5bc1 |
34 | class SelectBasics_EntityOwner; |
35 | |
36 | |
37 | class SelectBasics_SensitiveEntity; |
38 | DEFINE_STANDARD_HANDLE(SelectBasics_SensitiveEntity, MMgt_TShared) |
39 | |
40 | //! root class; the inheriting classes will be able to give |
41 | //! sensitive Areas for the dynamic selection algorithms |
42 | class SelectBasics_SensitiveEntity : public MMgt_TShared |
43 | { |
44 | |
45 | public: |
46 | |
47 | |
48 | //! Sets owner of the entity |
49 | Standard_EXPORT virtual void Set (const Handle(SelectBasics_EntityOwner)& theOwnerId); |
50 | |
51 | //! Returns pointer to owner of the entity |
52 | Standard_EXPORT const Handle(SelectBasics_EntityOwner)& OwnerId() const; |
53 | |
54 | //! Checks whether the sensitive entity is overlapped by |
55 | //! current selecting volume |
3bf9a45f |
56 | virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult) = 0; |
42cf5bc1 |
57 | |
58 | //! allows a better sensitivity for |
59 | //! a specific entity in selection algorithms |
60 | //! useful for small sized entities. |
be5c3602 |
61 | Standard_Integer SensitivityFactor() const; |
8a1170ad |
62 | |
63 | //! Allows to manage sensitivity of a particular sensitive entity |
64 | Standard_EXPORT void SetSensitivityFactor (const Standard_Integer theNewSens); |
42cf5bc1 |
65 | |
66 | //! Returns the number of sub-entities or elements in |
67 | //! sensitive entity. Is used to determine if entity is |
68 | //! complex and needs to pre-build BVH at the creation of |
69 | //! sensitive entity step or is light-weighted so the tree |
70 | //! can be build on demand with unnoticeable delay |
3bf9a45f |
71 | virtual Standard_Integer NbSubElements() = 0; |
42cf5bc1 |
72 | |
73 | //! Returns bounding box of sensitive entity |
3bf9a45f |
74 | virtual Select3D_BndBox3d BoundingBox() = 0; |
42cf5bc1 |
75 | |
76 | //! Builds BVH tree for sensitive if it is needed |
3bf9a45f |
77 | virtual void BVH() = 0; |
42cf5bc1 |
78 | |
79 | //! Clears up all the resources and memory allocated |
3bf9a45f |
80 | virtual void Clear() = 0; |
42cf5bc1 |
81 | |
3bf9a45f |
82 | //! Returns true if the shape corresponding to the entity has init location |
83 | virtual Standard_Boolean HasInitLocation() const = 0; |
42cf5bc1 |
84 | |
3bf9a45f |
85 | //! Returns inversed location transformation matrix if the shape corresponding |
86 | //! to this entity has init location set. Otherwise, returns identity matrix. |
91d96372 |
87 | virtual gp_GTrsf InvInitLocation() const = 0; |
42cf5bc1 |
88 | |
92efcf78 |
89 | DEFINE_STANDARD_RTTIEXT(SelectBasics_SensitiveEntity,MMgt_TShared) |
42cf5bc1 |
90 | |
91 | protected: |
92 | |
3bf9a45f |
93 | Standard_EXPORT SelectBasics_SensitiveEntity (const Handle(SelectBasics_EntityOwner)& theOwnerId); |
94 | |
42cf5bc1 |
95 | Handle(SelectBasics_EntityOwner) myOwnerId; |
96 | |
97 | |
98 | private: |
99 | |
3bf9a45f |
100 | Standard_Integer mySFactor; |
42cf5bc1 |
101 | }; |
102 | |
103 | |
104 | #include <SelectBasics_SensitiveEntity.lxx> |
105 | |
106 | |
107 | |
108 | |
109 | |
110 | #endif // _SelectBasics_SensitiveEntity_HeaderFile |