f751596e |
1 | // Created on: 1996-02-06 |
2 | // Created by: Robert COUBLANC |
3 | // Copyright (c) 1996-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 | |
f751596e |
17 | #ifndef _Select3D_SensitiveCircle_HeaderFile |
18 | #define _Select3D_SensitiveCircle_HeaderFile |
19 | |
7f24b768 |
20 | #include <gp_Circ.hxx> |
f751596e |
21 | #include <Select3D_SensitivePoly.hxx> |
f751596e |
22 | #include <Select3D_TypeOfSensitivity.hxx> |
7f24b768 |
23 | #include <SelectMgr_SelectingVolumeManager.hxx> |
24 | #include <TColgp_HArray1OfPnt.hxx> |
f751596e |
25 | |
26 | //! A framework to define sensitive 3D arcs and circles. |
27 | //! In some cases this class can raise Standard_ConstructionError and |
28 | //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly. |
29 | class Select3D_SensitiveCircle : public Select3D_SensitivePoly |
30 | { |
0609d8ee |
31 | DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCircle, Select3D_SensitivePoly) |
f751596e |
32 | public: |
33 | |
34 | //! Constructs the sensitive circle object defined by the |
35 | //! owner theOwnerId, the circle theCircle, the boolean |
36 | //! theIsFilled and the number of points theNbPnts. |
0ef04197 |
37 | Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId, |
7f24b768 |
38 | const gp_Circ& theCircle, |
f751596e |
39 | const Standard_Boolean theIsFilled = Standard_False, |
40 | const Standard_Integer theNbPnts = 12); |
41 | |
42 | //! Constructs the sensitive arc object defined by the |
43 | //! owner theOwnerId, the circle theCircle, the parameters theU1 |
44 | //! and theU2, the boolean theIsFilled and the number of points theNbPnts. |
45 | //! theU1 and theU2 define the first and last points of the arc on theCircle. |
0ef04197 |
46 | Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId, |
7f24b768 |
47 | const gp_Circ& theCircle, |
f751596e |
48 | const Standard_Real theU1, |
49 | const Standard_Real theU2, |
50 | const Standard_Boolean theIsFilled = Standard_False, |
51 | const Standard_Integer theNbPnts = 12); |
52 | |
53 | //! Constructs the sensitive circle object defined by the |
54 | //! owner theOwnerId, the array of triangles thePnts3d, and the boolean theIsFilled. |
55 | //! thePnts3d is an array of consecutive triangles on the |
56 | //! circle. The triangle i+1 lies on the intersection of the |
57 | //! tangents to the circle of i and i+2. Note, that the first point of thePnts3d |
58 | //! must be equal to the last point of thePnts3d. |
0ef04197 |
59 | Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId, |
f751596e |
60 | const Handle(TColgp_HArray1OfPnt)& thePnts3d, |
61 | const Standard_Boolean theIsFilled = Standard_False); |
62 | |
63 | //! Constructs the sensitive circle object defined by the |
64 | //! owner theOwnerId, the array of points thePnts3d, and the boolean theIsFilled. |
65 | //! If the length of thePnts3d is more then 1, the first point of thePnts3d |
66 | //! must be equal to the last point of thePnts3d. |
0ef04197 |
67 | Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId, |
f751596e |
68 | const TColgp_Array1OfPnt& thePnts3d, |
69 | const Standard_Boolean theIsFilled = Standard_False); |
70 | |
71 | //! Checks whether the circle overlaps current selecting volume |
72 | Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, |
73 | SelectBasics_PickResult& thePickResult) Standard_OVERRIDE; |
74 | |
f751596e |
75 | Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE; |
76 | |
77 | //! Returns center of the circle. If location |
78 | //! transformation is set, it will be applied |
79 | Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE; |
80 | |
81 | //! Builds BVH tree for a circle's edge segments if needed |
82 | Standard_EXPORT virtual void BVH() Standard_OVERRIDE; |
83 | |
7d46a9ed |
84 | protected: |
85 | |
86 | //! Calculates distance from the 3d projection of used-picked screen point |
87 | //! to center of the geometry |
25333d45 |
88 | Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE; |
7d46a9ed |
89 | |
f751596e |
90 | private: |
91 | |
92 | //! Computes myCenter3D as the barycenter of points from mypolyg3d |
93 | void computeCenter3D(); |
94 | |
95 | private: |
96 | |
0609d8ee |
97 | Select3D_TypeOfSensitivity mySensType; //!< True if type of selection is interior, false otherwise |
98 | gp_Pnt myCenter3D; //!< Center of a circle |
7f24b768 |
99 | gp_Circ myCircle; //!< Points of the circle |
0609d8ee |
100 | Standard_Real myStart; //!< Sensitive arc parameter |
101 | Standard_Real myEnd; //!< Sensitive arc parameter |
f751596e |
102 | }; |
103 | |
104 | DEFINE_STANDARD_HANDLE(Select3D_SensitiveCircle, Select3D_SensitivePoly) |
105 | |
106 | #endif // _Select3D_SensitiveCircle_HeaderFile |