f751596e |
1 | // Created on: 1997-05-14 |
2 | // Created by: Robert COUBLANC |
3 | // Copyright (c) 1997-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_SensitiveTriangle_HeaderFile |
18 | #define _Select3D_SensitiveTriangle_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
ec357c5c |
21 | #include <Standard_Type.hxx> |
f751596e |
22 | #include <Standard_Type.hxx> |
23 | |
24 | #include <Select3D_TypeOfSensitivity.hxx> |
25 | #include <Select3D_Pnt.hxx> |
26 | #include <Select3D_SensitivePoly.hxx> |
f751596e |
27 | #include <SelectMgr_SelectingVolumeManager.hxx> |
28 | #include <Standard_OStream.hxx> |
29 | |
30 | class Standard_ConstructionError; |
31 | class Standard_OutOfRange; |
32 | class SelectBasics_EntityOwner; |
33 | class gp_Pnt; |
f751596e |
34 | class Select3D_SensitiveEntity; |
35 | class TopLoc_Location; |
36 | |
37 | |
38 | //! A framework to define selection of triangles in a view. |
39 | //! This comes into play in the detection of meshing and triangulation in surfaces. |
40 | //! In some cases this class can raise Standard_ConstructionError and |
41 | //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly. |
2157d6ac |
42 | class Select3D_SensitiveTriangle : public Select3D_SensitiveEntity |
f751596e |
43 | { |
44 | public: |
45 | |
46 | //! Constructs a sensitive triangle object defined by the |
47 | //! owner theOwnerId, the points P1, P2, P3, and the type of sensitivity Sensitivity. |
48 | Standard_EXPORT Select3D_SensitiveTriangle (const Handle(SelectBasics_EntityOwner)& theOwnerId, |
49 | const gp_Pnt& thePnt0, |
50 | const gp_Pnt& thePnt1, |
51 | const gp_Pnt& thePnt2, |
52 | const Select3D_TypeOfSensitivity theType = Select3D_TOS_INTERIOR); |
53 | |
54 | //! Checks whether the triangle overlaps current selecting volume |
55 | Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, |
56 | SelectBasics_PickResult& thePickResult) Standard_OVERRIDE; |
57 | |
58 | //! Returns the 3D points P1, P2, P3 used at the time of construction. |
59 | Standard_EXPORT void Points3D (gp_Pnt& thePnt0, gp_Pnt& thePnt1, gp_Pnt& thePnt2) const; |
60 | |
61 | //! Returns the center point of the sensitive triangle created at construction time. |
62 | Standard_EXPORT gp_Pnt Center3D() const; |
63 | |
64 | //! Returns the copy of this |
65 | Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE; |
66 | |
67 | //! Returns bounding box of the triangle. If location transformation is set, it |
68 | //! will be applied |
69 | Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; |
70 | |
71 | //! Returns the amount of points |
2157d6ac |
72 | virtual Standard_Integer NbSubElements() Standard_OVERRIDE { return 3; } |
73 | |
74 | virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE { return myCentroid; } |
f751596e |
75 | |
92efcf78 |
76 | DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveTriangle,Select3D_SensitiveEntity) |
f751596e |
77 | |
78 | private: |
79 | |
80 | Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: boundary or interior |
81 | gp_Pnt myCentroid; //!< Center of triangle |
2157d6ac |
82 | gp_Pnt myPoints[3]; |
f751596e |
83 | }; |
84 | |
85 | DEFINE_STANDARD_HANDLE(Select3D_SensitiveTriangle, Select3D_SensitiveEntity) |
86 | |
87 | #endif |