1 // Created on: 2014-08-15
2 // Created by: Varvara POSKONINA
3 // Copyright (c) 2005-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Select3D_InteriorSensitivePointSet_HeaderFile
17 #define _Select3D_InteriorSensitivePointSet_HeaderFile
19 #include <NCollection_Vector.hxx>
21 #include <TColgp_HArray1OfPnt.hxx>
22 #include <TColStd_HArray1OfInteger.hxx>
24 #include <Select3D_SensitivePoly.hxx>
25 #include <Select3D_SensitiveSet.hxx>
28 class SelectBasics_EntityOwner;
30 typedef NCollection_Vector<Handle(Select3D_SensitivePoly)> Select3D_VectorOfHPoly;
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.
35 class Select3D_InteriorSensitivePointSet : public Select3D_SensitiveSet
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);
43 //! Initializes the given array theHArrayOfPnt by 3d coordinates of vertices of the
45 Standard_EXPORT virtual void GetPoints (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt);
47 //! Returns the length of vector of planar convex polygons
48 Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
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;
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;
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;
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;
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;
70 //! Returns the amount of points in set
71 Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
73 DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet,Select3D_SensitiveSet)
77 //! Checks whether the planar convex polygon with index theIdx
78 //! in myPlanarPolygons overlaps the current selecting volume
79 Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
80 SelectBasics_SelectingVolumeManager& theMgr,
81 Standard_Integer theElemIdx,
82 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
84 //! Checks whether the entity with index theIdx is inside the current selecting volume
85 Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
86 Standard_Integer theElemIdx,
87 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
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;
95 Select3D_VectorOfHPoly myPlanarPolygons; //!< Vector of planar polygons
96 Handle(TColStd_HArray1OfInteger) myPolygonsIdxs; //!< Indexes array for BVH calculation
97 gp_Pnt myCOG; //!< Center of the point set
98 Select3D_BndBox3d myBndBox; //!< Bounding box of the point set
101 DEFINE_STANDARD_HANDLE(Select3D_InteriorSensitivePointSet, Select3D_SensitiveSet)
103 #endif // _Select3D_InteriorSensitivePointSet_HeaderFile