Commit | Line | Data |
---|---|---|

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> |

17017555 | 22 | #include <SelectBasics_PickResult.hxx> |

bc73b006 | 23 | #include <Standard_Dump.hxx> |

f751596e | 24 | |

25 | class Bnd_Box; | |

26 | class gp_Pnt; | |

f751596e | 27 | |

28 | //! This class provides an interface for selecting volume manager, | |

29 | //! which is responsible for all overlap detection methods and | |

30 | //! calculation of minimum depth, distance to center of geometry | |

31 | //! and detected closest point on entity. | |

32 | class SelectBasics_SelectingVolumeManager | |

33 | { | |

34 | public: | |

35 | ||

36 | //! Available selection types | |

37 | enum SelectionType { Point, Box, Polyline, Unknown }; | |

38 | ||

39 | public: | |

40 | ||

b31fbc83 | 41 | SelectBasics_SelectingVolumeManager() {} |

f751596e | 42 | |

b31fbc83 | 43 | virtual ~SelectBasics_SelectingVolumeManager() {} |

f751596e | 44 | |

7ab15952 | 45 | virtual Standard_Integer GetActiveSelectionType() const = 0; |

f751596e | 46 | |

47 | //! Returns true if selecting volume is overlapped by box theBox | |

3bf9a45f | 48 | virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin, |

49 | const NCollection_Vec3<Standard_Real>& theBoxMax, | |

4a056d20 | 50 | SelectBasics_PickResult& thePickResult) const = 0; |

f751596e | 51 | |

52 | //! Returns true if selecting volume is overlapped by axis-aligned bounding box with minimum | |

53 | //! corner at point theMinPt and maximum at point theMaxPt | |

2157d6ac | 54 | virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin, |

55 | const NCollection_Vec3<Standard_Real>& theBoxMax, | |

4a056d20 | 56 | Standard_Boolean* theInside = NULL) const = 0; |

f751596e | 57 | |

3bf9a45f | 58 | //! Returns true if selecting volume is overlapped by point thePnt |

59 | virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt, | |

4a056d20 | 60 | SelectBasics_PickResult& thePickResult) const = 0; |

f751596e | 61 | |

3bf9a45f | 62 | //! Returns true if selecting volume is overlapped by point thePnt. |

63 | //! Does not perform depth calculation, so this method is defined as | |

64 | //! helper function for inclusion test. | |

4a056d20 | 65 | virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) const = 0; |

3bf9a45f | 66 | |

f751596e | 67 | //! Returns true if selecting volume is overlapped by planar convex polygon, which points |

68 | //! are stored in theArrayOfPts, taking into account sensitivity type theSensType | |

7ab15952 | 69 | virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts, |

70 | Standard_Integer theSensType, | |

4a056d20 | 71 | SelectBasics_PickResult& thePickResult) const = 0; |

f751596e | 72 | |

114b7bf1 | 73 | //! Returns true if selecting volume is overlapped by planar convex polygon, which points |

74 | //! are stored in theArrayOfPts, taking into account sensitivity type theSensType | |

75 | virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts, | |

76 | Standard_Integer theSensType, | |

4a056d20 | 77 | SelectBasics_PickResult& thePickResult) const = 0; |

114b7bf1 | 78 | |

f751596e | 79 | //! Returns true if selecting volume is overlapped by line segment with start point at thePt1 |

80 | //! and end point at thePt2 | |

7ab15952 | 81 | virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1, |

82 | const gp_Pnt& thePt2, | |

4a056d20 | 83 | SelectBasics_PickResult& thePickResult) const = 0; |

f751596e | 84 | |

85 | //! Returns true if selecting volume is overlapped by triangle with vertices thePt1, | |

86 | //! thePt2 and thePt3, taking into account sensitivity type theSensType | |

7ab15952 | 87 | virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1, |

88 | const gp_Pnt& thePt2, | |

89 | const gp_Pnt& thePt3, | |

90 | Standard_Integer theSensType, | |

4a056d20 | 91 | SelectBasics_PickResult& thePickResult) const = 0; |

f751596e | 92 | |

93 | //! Calculates distance from 3d projection of user-defined selection point | |

94 | //! to the given point theCOG | |

4a056d20 | 95 | virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const = 0; |

f751596e | 96 | |

3bf9a45f | 97 | virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0; |

f751596e | 98 | |

2157d6ac | 99 | virtual Standard_Boolean IsOverlapAllowed() const = 0; |

100 | ||

21a8e275 | 101 | //! Valid only for point and rectangular selection. |

102 | //! Returns projection of 2d mouse picked point or projection | |

103 | //! of center of 2d rectangle (for point and rectangular selection | |

104 | //! correspondingly) onto near view frustum plane | |

105 | virtual gp_Pnt GetNearPickedPnt() const = 0; | |

106 | ||

107 | //! Valid only for point and rectangular selection. | |

108 | //! Returns projection of 2d mouse picked point or projection | |

109 | //! of center of 2d rectangle (for point and rectangular selection | |

110 | //! correspondingly) onto far view frustum plane | |

111 | virtual gp_Pnt GetFarPickedPnt() const = 0; | |

112 | ||

b30b2c13 | 113 | //! Return mouse coordinates for Point selection mode. |

114 | virtual gp_Pnt2d GetMousePosition() const = 0; | |

115 | ||

871dcdc2 | 116 | //! Stores plane equation coefficients (in the following form: |

117 | //! Ax + By + Cz + D = 0) to the given vector | |

118 | virtual void GetPlanes (NCollection_Vector<NCollection_Vec4<Standard_Real> >& thePlaneEquations) const = 0; | |

119 | ||

bc73b006 | 120 | //! Dumps the content of me into the stream |

121 | virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const | |

122 | { (void)theDepth; OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myActiveSelectionType) } | |

123 | ||

f751596e | 124 | protected: |

125 | SelectionType myActiveSelectionType; //!< Active selection type: point, box or polyline | |

126 | }; | |

127 | ||

128 | #endif // _SelectBasics_SelectingVolumeManager_HeaderFile |