f751596e |
1 | // Created on: 1995-03-13 |
2 | // Created by: Robert COUBLANC |
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 _Select3D_SensitiveEntity_HeaderFile |
18 | #define _Select3D_SensitiveEntity_HeaderFile |
19 | |
f751596e |
20 | #include <SelectBasics_SensitiveEntity.hxx> |
f751596e |
21 | #include <SelectMgr_SelectingVolumeManager.hxx> |
f751596e |
22 | #include <TopLoc_Location.hxx> |
23 | |
f751596e |
24 | class SelectBasics_EntityOwner; |
25 | |
26 | //! Abstract framework to define 3D sensitive entities. |
27 | //! As the selection process uses the principle of a |
28 | //! projection of 3D shapes onto a 2D view where |
29 | //! nearness to a rectangle determines whether a shape |
30 | //! is picked or not, all 3D shapes need to be converted |
31 | //! into 2D ones in order to be selected. |
32 | class Select3D_SensitiveEntity : public SelectBasics_SensitiveEntity |
33 | { |
34 | public: |
35 | |
36 | //! Originally this method intended to return sensitive |
37 | //! entity with new location aLocation, but currently sensitive |
38 | //! entities do not hold a location, instead HasLocation() and |
39 | //! Location() methods call corresponding entity owner's methods. |
40 | //! Thus all entities returned by GetConnected() share the same |
41 | //! location propagated from corresponding selectable object. |
42 | //! You must redefine this function for any type of |
43 | //! sensitive entity which can accept another connected |
44 | //! sensitive entity.//can be connected to another sensitive entity. |
45 | Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected(); |
46 | |
47 | //! Checks whether sensitive overlaps current selecting volume. |
48 | //! Stores minimum depth, distance to center of geometry and |
49 | //! closest point detected into thePickResult |
50 | Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, |
51 | SelectBasics_PickResult& thePickResult) Standard_OVERRIDE; |
52 | |
53 | //! Returns the number of sub-entities or elements in |
54 | //! sensitive entity. Is used to determine if entity is |
55 | //! complex and needs to pre-build BVH at the creation of |
56 | //! sensitive entity step or is light-weighted so the tree |
57 | //! can be build on demand with unnoticeable delay |
79104795 |
58 | virtual Standard_Integer NbSubElements() Standard_OVERRIDE = 0; |
f751596e |
59 | |
60 | //! Returns bounding box of a sensitive with transformation applied |
79104795 |
61 | virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE = 0; |
f751596e |
62 | |
63 | //! Returns center of a sensitive with transformation applied |
64 | virtual gp_Pnt CenterOfGeometry() const = 0; |
65 | |
66 | //! Builds BVH tree for a sensitive if needed |
67 | Standard_EXPORT virtual void BVH() Standard_OVERRIDE; |
68 | |
69 | //! Clears up all resources and memory |
70 | Standard_EXPORT virtual void Clear() Standard_OVERRIDE; |
71 | |
3bf9a45f |
72 | //! Returns true if the shape corresponding to the entity has init location |
73 | Standard_EXPORT virtual Standard_Boolean HasInitLocation() const Standard_OVERRIDE; |
74 | |
75 | //! Returns inversed location transformation matrix if the shape corresponding |
76 | //! to this entity has init location set. Otherwise, returns identity matrix. |
91d96372 |
77 | Standard_EXPORT virtual gp_GTrsf InvInitLocation() const Standard_OVERRIDE; |
3bf9a45f |
78 | |
92efcf78 |
79 | DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveEntity,SelectBasics_SensitiveEntity) |
f751596e |
80 | |
81 | protected: |
82 | |
83 | Standard_EXPORT Select3D_SensitiveEntity (const Handle(SelectBasics_EntityOwner)& theOwnerId); |
84 | }; |
85 | |
86 | DEFINE_STANDARD_HANDLE(Select3D_SensitiveEntity, SelectBasics_SensitiveEntity) |
87 | |
88 | #endif // _Select3D_SensitiveEntity_HeaderFile |