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