0024750: Replace instantiations of TCollection generic classes by NCollection templat...
[occt.git] / src / Select3D / Select3D_SensitiveFace.hxx
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
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 //Modif on jun-24-97 : introduction de CSLib_Class2d de LBR
18 //                     pour teste si on est dedans ou dehors...
19 //Modif on jul-21-97 : changement en harray1 pour eventuelles connexions ...
20
21 #ifndef _Select3D_SensitiveFace_HeaderFile
22 #define _Select3D_SensitiveFace_HeaderFile
23
24 #include <Standard_Type.hxx>
25
26 #include <Select3D_TypeOfSensitivity.hxx>
27 #include <Select3D_SensitiveSet.hxx>
28 #include <Handle_SelectBasics_EntityOwner.hxx>
29 #include <TColgp_HArray1OfPnt.hxx>
30 #include <Standard_Boolean.hxx>
31 #include <SelectBasics_SelectingVolumeManager.hxx>
32 #include <Standard_Real.hxx>
33 #include <Standard_OStream.hxx>
34
35 class Standard_ConstructionError;
36 class Standard_OutOfRange;
37 class SelectBasics_EntityOwner;
38 class TopLoc_Location;
39
40
41 //! Sensitive Entity to make a face selectable.
42 //! In some cases this class can raise Standard_ConstructionError and
43 //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
44 class Select3D_SensitiveFace : public Select3D_SensitiveEntity
45 {
46 public:
47
48   //! Constructs a sensitive face object defined by the
49   //! owner theOwnerId, the array of points thePoints, and
50   //! the sensitivity type theType.
51   //! The array of points is the outer polygon of the geometric face.
52   Standard_EXPORT Select3D_SensitiveFace (const Handle(SelectBasics_EntityOwner)& theOwnerId,
53                                           const TColgp_Array1OfPnt& thePoints,
54                                           const Select3D_TypeOfSensitivity theType);
55
56   //! Constructs a sensitive face object defined by the
57   //! owner theOwnerId, the array of points thePoints, and
58   //! the sensitivity type theType.
59   //! The array of points is the outer polygon of the geometric face.
60   Standard_EXPORT Select3D_SensitiveFace (const Handle(SelectBasics_EntityOwner)& theOwnerId,
61                                           const Handle(TColgp_HArray1OfPnt)& thePoints,
62                                           const Select3D_TypeOfSensitivity theType);
63
64   //! Initializes the given array theHArrayOfPnt by 3d
65   //! coordinates of vertices of the face
66   Standard_EXPORT void GetPoints (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt);
67
68   //! Checks whether the face overlaps current selecting volume
69   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
70                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
71
72   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
73
74   //! Returns bounding box of the face. If location transformation
75   //! is set, it will be applied
76   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
77
78   //! Returns center of the face. If location transformation
79   //! is set, it will be applied
80   Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
81
82   //! Builds BVH tree for the face
83   Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
84
85   //! Returns the amount of sub-entities (points or planar convex polygons)
86   Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
87
88   DEFINE_STANDARD_RTTI(Select3D_SensitiveFace, Select3D_SensitiveEntity)
89
90 private:
91
92   Select3D_TypeOfSensitivity    mySensType;       //!< Type of sensitivity: interior or boundary
93   Handle(Select3D_SensitiveSet) myFacePoints;     //!< Wrapper for overlap detection created depending on sensitivity type
94 };
95
96 DEFINE_STANDARD_HANDLE(Select3D_SensitiveFace, Select3D_SensitiveEntity)
97
98 #endif // _Select3D_SensitiveFace_HeaderFile