0027180: Visualization - improve selection logic of MeshVS_Mesh
[occt.git] / src / SelectBasics / SelectBasics_SelectingVolumeManager.hxx
CommitLineData
f751596e 1// Created on: 2014-08-21
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 _SelectBasics_SelectingVolumeManager_HeaderFile
17#define _SelectBasics_SelectingVolumeManager_HeaderFile
18
19#include <BVH_Box.hxx>
3bf9a45f 20#include <gp_Pnt.hxx>
f751596e 21#include <TColgp_HArray1OfPnt.hxx>
f751596e 22
23class Bnd_Box;
24class gp_Pnt;
f751596e 25
26//! This class provides an interface for selecting volume manager,
27//! which is responsible for all overlap detection methods and
28//! calculation of minimum depth, distance to center of geometry
29//! and detected closest point on entity.
30class SelectBasics_SelectingVolumeManager
31{
32public:
33
34 //! Available selection types
35 enum SelectionType { Point, Box, Polyline, Unknown };
36
37public:
38
39 SelectBasics_SelectingVolumeManager() {};
40
41 virtual ~SelectBasics_SelectingVolumeManager() {};
42
7ab15952 43 virtual Standard_Integer GetActiveSelectionType() const = 0;
f751596e 44
45 //! Returns true if selecting volume is overlapped by box theBox
3bf9a45f 46 virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
47 const NCollection_Vec3<Standard_Real>& theBoxMax,
7ab15952 48 Standard_Real& theDepth) = 0;
f751596e 49
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
2157d6ac 52 virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
53 const NCollection_Vec3<Standard_Real>& theBoxMax,
54 Standard_Boolean* theInside = NULL) = 0;
f751596e 55
3bf9a45f 56 //! Returns true if selecting volume is overlapped by point thePnt
57 virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
7ab15952 58 Standard_Real& theDepth) = 0;
f751596e 59
3bf9a45f 60 //! Returns true if selecting volume is overlapped by point thePnt.
61 //! Does not perform depth calculation, so this method is defined as
62 //! helper function for inclusion test.
63 virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) = 0;
64
f751596e 65 //! Returns true if selecting volume is overlapped by planar convex polygon, which points
66 //! are stored in theArrayOfPts, taking into account sensitivity type theSensType
7ab15952 67 virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
68 Standard_Integer theSensType,
69 Standard_Real& theDepth) = 0;
f751596e 70
114b7bf1 71 //! Returns true if selecting volume is overlapped by planar convex polygon, which points
72 //! are stored in theArrayOfPts, taking into account sensitivity type theSensType
73 virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
74 Standard_Integer theSensType,
75 Standard_Real& theDepth) = 0;
76
f751596e 77 //! Returns true if selecting volume is overlapped by line segment with start point at thePt1
78 //! and end point at thePt2
7ab15952 79 virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
80 const gp_Pnt& thePt2,
81 Standard_Real& theDepth) = 0;
f751596e 82
83 //! Returns true if selecting volume is overlapped by triangle with vertices thePt1,
84 //! thePt2 and thePt3, taking into account sensitivity type theSensType
7ab15952 85 virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
86 const gp_Pnt& thePt2,
87 const gp_Pnt& thePt3,
88 Standard_Integer theSensType,
89 Standard_Real& theDepth) = 0;
f751596e 90
91 //! Calculates distance from 3d projection of user-defined selection point
92 //! to the given point theCOG
7ab15952 93 virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) = 0;
f751596e 94
3bf9a45f 95 virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0;
f751596e 96
2157d6ac 97 virtual Standard_Boolean IsOverlapAllowed() const = 0;
98
f751596e 99protected:
100 SelectionType myActiveSelectionType; //!< Active selection type: point, box or polyline
101};
102
103#endif // _SelectBasics_SelectingVolumeManager_HeaderFile