1 // Created on: 2014-08-21
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 _SelectBasics_SelectingVolumeManager_HeaderFile
17 #define _SelectBasics_SelectingVolumeManager_HeaderFile
19 #include <BVH_Box.hxx>
20 #include <TColgp_HArray1OfPnt.hxx>
21 #include <NCollection_Vec3.hxx>
25 class TColgp_Array1OfPnt;
27 //! This class provides an interface for selecting volume manager,
28 //! which is responsible for all overlap detection methods and
29 //! calculation of minimum depth, distance to center of geometry
30 //! and detected closest point on entity.
31 class SelectBasics_SelectingVolumeManager
35 //! Available selection types
36 enum SelectionType { Point, Box, Polyline, Unknown };
40 SelectBasics_SelectingVolumeManager() {};
42 virtual ~SelectBasics_SelectingVolumeManager() {};
44 virtual Standard_Integer GetActiveSelectionType() const = 0;
46 //! Returns true if selecting volume is overlapped by box theBox
47 virtual Standard_Boolean Overlaps (const BVH_Box<Standard_Real, 3>& theBox,
48 Standard_Real& theDepth) = 0;
50 //! Returns true if selecting volume is overlapped by axis-aligned bounding box with minimum
51 //! corner at point theMinPt and maximum at point theMaxPt
52 virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
53 const NCollection_Vec3<Standard_Real>& theBoxMax,
54 Standard_Boolean* theInside = NULL) = 0;
56 //! Returns true if selecting volume is overlapped by point thePt
57 virtual Standard_Boolean Overlaps (const gp_Pnt& thePt,
58 Standard_Real& theDepth) = 0;
60 //! Returns true if selecting volume is overlapped by planar convex polygon, which points
61 //! are stored in theArrayOfPts, taking into account sensitivity type theSensType
62 virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
63 Standard_Integer theSensType,
64 Standard_Real& theDepth) = 0;
66 //! Returns true if selecting volume is overlapped by line segment with start point at thePt1
67 //! and end point at thePt2
68 virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
70 Standard_Real& theDepth) = 0;
72 //! Returns true if selecting volume is overlapped by triangle with vertices thePt1,
73 //! thePt2 and thePt3, taking into account sensitivity type theSensType
74 virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
77 Standard_Integer theSensType,
78 Standard_Real& theDepth) = 0;
80 //! Calculates distance from 3d projection of user-defined selection point
81 //! to the given point theCOG
82 virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) = 0;
84 virtual NCollection_Vec3<Standard_Real> DetectedPoint (const Standard_Real theDepth) const = 0;
86 virtual Standard_Boolean IsOverlapAllowed() const = 0;
89 SelectionType myActiveSelectionType; //!< Active selection type: point, box or polyline
92 #endif // _SelectBasics_SelectingVolumeManager_HeaderFile