0026973: Visualization - selection of entities hidden by clipping planes is broken
[occt.git] / src / SelectMgr / SelectMgr_RectangularFrustum.hxx
index ba229c0..c1d4ca7 100644 (file)
@@ -17,6 +17,7 @@
 #define _SelectMgr_RectangularFrustum_HeaderFile
 
 #include <SelectMgr_Frustum.hxx>
+#include <SelectMgr_ViewClipRange.hxx>
 
 //! This class contains representation of rectangular selecting frustum, created in case
 //! of point and box selection, and algorithms for overlap detection between selecting
@@ -106,6 +107,10 @@ public:
   Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
                                                       const Standard_Real theDepth) Standard_OVERRIDE;
 
+  //! Valid for point selection only!
+  //! Computes depth range for global (defined for the whole view) clipping planes.
+  Standard_EXPORT virtual void SetViewClipping (const Graphic3d_SequenceOfHClipPlane& thePlanes) Standard_OVERRIDE;
+
   //! A set of helper functions that return rectangular selecting frustum data
   inline const gp_Pnt* GetVertices() const { return myVertices; }
 
@@ -122,6 +127,14 @@ protected:
                                                  const gp_Pnt& thePntOnPlane,
                                                  Standard_Real& theDepth);
 
+  //! Computes valid depth range for the given clipping planes
+  Standard_EXPORT void computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
+                                             Standard_Real& theDepthMin,
+                                             Standard_Real& theDepthMax);
+
+  //! Returns false if theDepth must be clipped by current view clip range
+  Standard_EXPORT Standard_Boolean isViewClippingOk (const Standard_Real theDepth) const;
+
 private:
 
   void cacheVertexProjections (SelectMgr_RectangularFrustum* theFrustum);
@@ -134,11 +147,12 @@ private:
 
 private:
 
-  gp_Pnt   myNearPickedPnt;             //!< 3d projection of user-picked selection point onto near view plane
-  gp_Pnt   myFarPickedPnt;              //!< 3d projection of user-picked selection point onto far view plane
-  gp_Vec   myViewRayDir;
-  gp_Pnt2d myMousePos;                  //!< Mouse coordinates
-  Standard_Real myScale;                //!< Scale factor of applied transformation, if there was any
+  gp_Pnt                  myNearPickedPnt;             //!< 3d projection of user-picked selection point onto near view plane
+  gp_Pnt                  myFarPickedPnt;              //!< 3d projection of user-picked selection point onto far view plane
+  gp_Vec                  myViewRayDir;
+  gp_Pnt2d                myMousePos;                  //!< Mouse coordinates
+  Standard_Real           myScale;                     //!< Scale factor of applied transformation, if there was any
+  SelectMgr_ViewClipRange myViewClipRange;
 };
 
 #endif // _SelectMgr_RectangularFrustum_HeaderFile