f751596e |
1 | // Created on: 2014-08-15 |
2 | // Created by: Varvara POSKONINA |
3 | // Copyright (c) 2005-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _Select3D_InteriorSensitivePointSet_HeaderFile |
17 | #define _Select3D_InteriorSensitivePointSet_HeaderFile |
18 | |
19 | #include <NCollection_Vector.hxx> |
20 | |
b7c077b9 |
21 | #include <TColgp_HArray1OfPnt.hxx> |
22 | #include <TColStd_HArray1OfInteger.hxx> |
f751596e |
23 | |
f751596e |
24 | #include <Select3D_SensitivePoly.hxx> |
25 | #include <Select3D_SensitiveSet.hxx> |
26 | |
27 | class gp_Pnt; |
28 | class SelectBasics_EntityOwner; |
f751596e |
29 | |
30 | typedef NCollection_Vector<Handle(Select3D_SensitivePoly)> Select3D_VectorOfHPoly; |
31 | |
32 | //! This class handles the selection of arbitrary point set with internal type of sensitivity. |
33 | //! The main principle is to split the point set given onto planar convex polygons and search |
34 | //! for the overlap with one or more of them through traverse of BVH tree. |
bf3977c9 |
35 | class Select3D_InteriorSensitivePointSet : public Select3D_SensitiveSet |
f751596e |
36 | { |
37 | public: |
38 | |
39 | //! Splits the given point set thePoints onto planar convex polygons |
40 | Standard_EXPORT Select3D_InteriorSensitivePointSet (const Handle(SelectBasics_EntityOwner)& theOwnerId, |
41 | const TColgp_Array1OfPnt& thePoints); |
42 | |
f751596e |
43 | //! Initializes the given array theHArrayOfPnt by 3d coordinates of vertices of the |
44 | //! whole point set |
bf3977c9 |
45 | Standard_EXPORT virtual void GetPoints (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt); |
f751596e |
46 | |
47 | //! Returns the length of vector of planar convex polygons |
48 | Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE; |
49 | |
50 | //! Returns bounding box of planar convex polygon with index theIdx |
51 | Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE; |
52 | |
53 | //! Returns geometry center of planar convex polygon with index |
54 | //! theIdx in the vector along the given axis theAxis |
55 | Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx, |
56 | const Standard_Integer theAxis) const Standard_OVERRIDE; |
57 | |
58 | //! Swaps items with indexes theIdx1 and theIdx2 in the vector |
59 | Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1, |
60 | const Standard_Integer theIdx2) Standard_OVERRIDE; |
61 | |
62 | //! Returns bounding box of the point set. If location |
63 | //! transformation is set, it will be applied |
64 | Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; |
65 | |
66 | //! Returns center of the point set. If location |
67 | //! transformation is set, it will be applied |
68 | Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE; |
69 | |
f751596e |
70 | //! Returns the amount of points in set |
71 | Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; |
72 | |
92efcf78 |
73 | DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet,Select3D_SensitiveSet) |
bf3977c9 |
74 | |
f751596e |
75 | protected: |
76 | |
77 | //! Checks whether the planar convex polygon with index theIdx |
78 | //! in myPlanarPolygons overlaps the current selecting volume |
4a056d20 |
79 | Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult, |
80 | SelectBasics_SelectingVolumeManager& theMgr, |
f751596e |
81 | Standard_Integer theElemIdx, |
4a056d20 |
82 | Standard_Boolean theIsFullInside) Standard_OVERRIDE; |
f751596e |
83 | |
2157d6ac |
84 | //! Checks whether the entity with index theIdx is inside the current selecting volume |
85 | Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr, |
4a056d20 |
86 | Standard_Integer theElemIdx, |
87 | Standard_Boolean theIsFullInside) Standard_OVERRIDE; |
2157d6ac |
88 | |
f751596e |
89 | //! Calculates distance from the 3d projection of used-picked |
90 | //! screen point to center of the geometry |
91 | Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE; |
92 | |
93 | protected: |
94 | |
95 | Select3D_VectorOfHPoly myPlanarPolygons; //!< Vector of planar polygons |
35c0599a |
96 | Handle(TColStd_HArray1OfInteger) myPolygonsIdxs; //!< Indexes array for BVH calculation |
f751596e |
97 | gp_Pnt myCOG; //!< Center of the point set |
98 | Select3D_BndBox3d myBndBox; //!< Bounding box of the point set |
99 | }; |
100 | |
bf3977c9 |
101 | DEFINE_STANDARD_HANDLE(Select3D_InteriorSensitivePointSet, Select3D_SensitiveSet) |
102 | |
f751596e |
103 | #endif // _Select3D_InteriorSensitivePointSet_HeaderFile |