0024023: Revamp the OCCT Handle -- general
[occt.git] / src / SelectMgr / SelectMgr_BaseFrustum.hxx
index 32fb41a..e2e466e 100644 (file)
@@ -25,7 +25,6 @@
 #include <Graphic3d_ClipPlane.hxx>
 #include <Graphic3d_SequenceOfHClipPlane.hxx>
 
-#include <NCollection_Handle.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 
@@ -39,7 +38,7 @@
 //! selection. It contains signatures of functions for detection of
 //! overlap by sensitive entity and initializes some data for building
 //! the selecting frustum
-class SelectMgr_BaseFrustum
+class SelectMgr_BaseFrustum : public Standard_Transient
 {
 public:
 
@@ -47,7 +46,7 @@ public:
   //! orthographic camera and empty frustum builder
   SelectMgr_BaseFrustum();
 
-  virtual ~SelectMgr_BaseFrustum() {};
+  virtual ~SelectMgr_BaseFrustum() {}
 
   //! Passes camera projection and orientation matrices to builder
   void SetCamera (const Handle(Graphic3d_Camera)& theCamera);
@@ -68,76 +67,83 @@ public:
                     const Standard_Real theHeight);
 
   //! Nullifies the builder created in the constructor and copies the pointer given
-  void SetBuilder (const NCollection_Handle<SelectMgr_FrustumBuilder>& theBuilder);
+  void SetBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder);
 
 
   //! Builds volume according to the point and given pixel tolerance
-  virtual void Build (const gp_Pnt2d& /*thePoint*/) {};
+  virtual void Build (const gp_Pnt2d& /*thePoint*/) {}
 
   //! Builds volume according to the selected rectangle
   virtual void Build (const gp_Pnt2d& /*theMinPt*/,
-                      const gp_Pnt2d& /*theMaxPt*/) {};
+                      const gp_Pnt2d& /*theMaxPt*/) {}
 
   //! Builds volume according to the triangle given
   virtual void Build (const gp_Pnt2d& /*theP1*/,
                       const gp_Pnt2d& /*theP2*/,
-                      const gp_Pnt2d& /*theP3*/) {};
+                      const gp_Pnt2d& /*theP3*/) {}
 
   //! Builds selecting volumes set according to polyline points
-  virtual void Build (const TColgp_Array1OfPnt2d& /*thePoints*/) {};
+  virtual void Build (const TColgp_Array1OfPnt2d& /*thePoints*/) {}
 
   virtual NCollection_Handle<SelectMgr_BaseFrustum> Transform (const gp_Trsf& /*theTrsf*/) { return NULL; }
 
+  //! IMPORTANT: Makes sense only for frustum built on a single point!
+  //! Returns a copy of the frustum resized according to the scale factor given
+  virtual NCollection_Handle<SelectMgr_BaseFrustum> Scale (const Standard_Real /*theScaleFactor*/) { return NULL; }
+
   //! SAT intersection test between defined volume and given axis-aligned box
-  virtual const Standard_Boolean Overlaps (const BVH_Box<Standard_Real, 3>& theBndBox,
-                                           Standard_Real& theDepth);
+  virtual Standard_Boolean Overlaps (const BVH_Box<Standard_Real, 3>& theBndBox,
+                                     Standard_Real& theDepth);
 
   //! Returns true if selecting volume is overlapped by axis-aligned bounding box
   //! with minimum corner at point theMinPt and maximum at point theMaxPt
-  virtual const Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPt,
-                                           const SelectMgr_Vec3& theMaxPt);
+  virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
+                                     const SelectMgr_Vec3& theBoxMax,
+                                     Standard_Boolean*     theInside = NULL);
 
   //! Intersection test between defined volume and given point
-  virtual const Standard_Boolean Overlaps (const gp_Pnt& thePt,
-                                           Standard_Real& theDepth);
+  virtual Standard_Boolean Overlaps (const gp_Pnt& thePt,
+                                     Standard_Real& theDepth);
 
   //! SAT intersection test between defined volume and given ordered set of points,
   //! representing line segments. The test may be considered of interior part or
   //! boundary line defined by segments depending on given sensitivity type
-  virtual const Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
-                                           Select3D_TypeOfSensitivity theSensType,
-                                           Standard_Real& theDepth);
+  virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
+                                     Select3D_TypeOfSensitivity theSensType,
+                                     Standard_Real& theDepth);
 
   //! Checks if line segment overlaps selecting frustum
-  virtual const Standard_Boolean Overlaps (const gp_Pnt& thePt1,
-                                           const gp_Pnt& thePt2,
-                                           Standard_Real& theDepth);
+  virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
+                                     const gp_Pnt& thePt2,
+                                     Standard_Real& theDepth);
 
   //! SAT intersection test between defined volume and given triangle. The test may
   //! be considered of interior part or boundary line defined by triangle vertices
   //! depending on given sensitivity type
-  virtual const Standard_Boolean Overlaps (const gp_Pnt& thePt1,
-                                           const gp_Pnt& thePt2,
-                                           const gp_Pnt& thePt3,
-                                           Select3D_TypeOfSensitivity theSensType,
-                                           Standard_Real& theDepth);
+  virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
+                                     const gp_Pnt& thePt2,
+                                     const gp_Pnt& thePt3,
+                                     Select3D_TypeOfSensitivity theSensType,
+                                     Standard_Real& theDepth);
 
   //! Measures distance between 3d projection of user-picked
   //! screen point and given point theCOG
-  virtual const Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG);
+  virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG);
 
   virtual SelectMgr_Vec3 DetectedPoint (const Standard_Real theDepth) const;
 
   //! Checks if the point of sensitive in which selection was detected belongs
   //! to the region defined by clipping planes
-  virtual const Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
-                                            const Standard_Real theDepth);
+  virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
+                                      const Standard_Real theDepth);
+
+  DEFINE_STANDARD_RTTI(SelectMgr_BaseFrustum, Standard_Transient)
 
 protected:
   Standard_Real    myPixelTolerance;      //!< Pixel tolerance
   Standard_Boolean myIsOrthographic;      //!< Defines if current camera is orthographic
 
-  NCollection_Handle<SelectMgr_FrustumBuilder> myBuilder;      //!< A tool implementing methods for volume build
+  Handle(SelectMgr_FrustumBuilder) myBuilder; //!< A tool implementing methods for volume build
 };
 
 #endif // _SelectMgr_BaseFrustum_HeaderFile