1 // Created on: 1995-03-27
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_SensitiveFace_HeaderFile
18 #define _Select3D_SensitiveFace_HeaderFile
20 #include <Select3D_TypeOfSensitivity.hxx>
21 #include <Select3D_SensitiveSet.hxx>
22 #include <TColgp_HArray1OfPnt.hxx>
23 #include <SelectBasics_SelectingVolumeManager.hxx>
26 //! Sensitive Entity to make a face selectable.
27 //! In some cases this class can raise Standard_ConstructionError and
28 //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
29 class Select3D_SensitiveFace : public Select3D_SensitiveEntity
31 DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveFace, Select3D_SensitiveEntity)
34 //! Constructs a sensitive face object defined by the
35 //! owner theOwnerId, the array of points thePoints, and
36 //! the sensitivity type theType.
37 //! The array of points is the outer polygon of the geometric face.
38 Standard_EXPORT Select3D_SensitiveFace (const Handle(SelectMgr_EntityOwner)& theOwnerId,
39 const TColgp_Array1OfPnt& thePoints,
40 const Select3D_TypeOfSensitivity theType);
42 //! Constructs a sensitive face object defined by the
43 //! owner theOwnerId, the array of points thePoints, and
44 //! the sensitivity type theType.
45 //! The array of points is the outer polygon of the geometric face.
46 Standard_EXPORT Select3D_SensitiveFace (const Handle(SelectMgr_EntityOwner)& theOwnerId,
47 const Handle(TColgp_HArray1OfPnt)& thePoints,
48 const Select3D_TypeOfSensitivity theType);
50 //! Initializes the given array theHArrayOfPnt by 3d
51 //! coordinates of vertices of the face
52 Standard_EXPORT void GetPoints (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt);
54 //! Checks whether the face overlaps current selecting volume
55 Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
56 SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
58 Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
60 //! Returns bounding box of the face. If location transformation
61 //! is set, it will be applied
62 Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
64 //! Returns center of the face. If location transformation
65 //! is set, it will be applied
66 Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
68 //! Builds BVH tree for the face
69 Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
71 //! Returns TRUE if BVH tree is in invalidated state
72 virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return myFacePoints->ToBuildBVH(); }
74 //! Returns the amount of sub-entities (points or planar convex polygons)
75 Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
77 //! Dumps the content of me into the stream
78 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
82 Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: interior or boundary
83 Handle(Select3D_SensitiveSet) myFacePoints; //!< Wrapper for overlap detection created depending on sensitivity type
86 DEFINE_STANDARD_HANDLE(Select3D_SensitiveFace, Select3D_SensitiveEntity)
88 #endif // _Select3D_SensitiveFace_HeaderFile