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