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