{
public:
- SelectMgr_RectangularFrustum() : myScale (1.0) {};
+ SelectMgr_RectangularFrustum() : myScale (1.0), myIsViewClipEnabled (Standard_True) {};
//! Builds volume according to the point and given pixel tolerance
Standard_EXPORT virtual void Build (const gp_Pnt2d& thePoint) Standard_OVERRIDE;
//! There are no default parameters, but in case if:
//! - transformation only is needed: @theScaleFactor must be initialized as any negative value;
//! - scale only is needed: @theTrsf must be set to gp_Identity.
- Standard_EXPORT virtual NCollection_Handle<SelectMgr_BaseFrustum> ScaleAndTransform (const Standard_Integer theScaleFactor,
- const gp_GTrsf& theTrsf) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(SelectMgr_BaseFrustum) ScaleAndTransform (const Standard_Integer theScaleFactor,
+ const gp_GTrsf& theTrsf) const Standard_OVERRIDE;
// SAT Tests for different objects
//! SAT intersection test between defined volume and given axis-aligned box
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
const SelectMgr_Vec3& theBoxMax,
- Standard_Real& theDepth) Standard_OVERRIDE;
+ SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
//! with minimum corner at point theMinPt and maximum at point theMaxPt
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
const SelectMgr_Vec3& theBoxMax,
- Standard_Boolean* theInside = NULL) Standard_OVERRIDE;
+ Standard_Boolean* theInside) const Standard_OVERRIDE;
//! Intersection test between defined volume and given point
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
- Standard_Real& theDepth) Standard_OVERRIDE;
+ SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
//! Intersection test between defined volume and given point
- Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) Standard_OVERRIDE;
+ Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) const Standard_OVERRIDE;
//! 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
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
Select3D_TypeOfSensitivity theSensType,
- Standard_Real& theDepth) Standard_OVERRIDE;
+ SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
//! Checks if line segment overlaps selecting frustum
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
const gp_Pnt& thePnt2,
- Standard_Real& theDepth) Standard_OVERRIDE;
+ SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
//! SAT intersection test between defined volume and given triangle. The test may
//! be considered of interior part or boundary line defined by triangle vertices
const gp_Pnt& thePnt2,
const gp_Pnt& thePnt3,
Select3D_TypeOfSensitivity theSensType,
- Standard_Real& theDepth) Standard_OVERRIDE;
+ SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
//! Measures distance between 3d projection of user-picked
//! screen point and given point theCOG
- Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE;
+ Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const Standard_OVERRIDE;
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;
//! Checks if the point of sensitive in which selection was detected belongs
//! to the region defined by clipping planes
Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
- const Standard_Real theDepth) Standard_OVERRIDE;
+ const Standard_Real theDepth) const 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;
+ Standard_EXPORT virtual void SetViewClipping (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) Standard_OVERRIDE;
+
+ //! Set if view clipping plane is enabled or not.
+ //! @return previous value of the flag
+ virtual Standard_Boolean SetViewClippingEnabled (const Standard_Boolean theToEnable) Standard_OVERRIDE
+ {
+ Standard_Boolean aPrevValue = myIsViewClipEnabled;
+ myIsViewClipEnabled = theToEnable;
+ return aPrevValue;
+ }
//! A set of helper functions that return rectangular selecting frustum data
inline const gp_Pnt* GetVertices() const { return myVertices; }
- inline gp_Pnt GetNearPnt() const { return myNearPickedPnt; }
+ //! Returns projection of 2d mouse picked point or projection
+ //! of center of 2d rectangle (for point and rectangular selection
+ //! correspondingly) onto near view frustum plane
+ inline const gp_Pnt& GetNearPnt() const { return myNearPickedPnt; }
+
+ //! Returns projection of 2d mouse picked point or projection
+ //! of center of 2d rectangle (for point and rectangular selection
+ //! correspondingly) onto far view frustum plane
+ inline const gp_Pnt& GetFarPnt() const { return myFarPickedPnt; }
+
+ //! Return mouse coordinates.
+ const gp_Pnt2d& GetMousePosition() const { return myMousePos; }
+
+ //! Stores plane equation coefficients (in the following form:
+ //! Ax + By + Cz + D = 0) to the given vector
+ Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
- inline gp_Pnt GetFarPnt() const { return myFarPickedPnt; }
protected:
Standard_EXPORT void segmentSegmentDistance (const gp_Pnt& theSegPnt1,
const gp_Pnt& theSegPnt2,
- Standard_Real& theDepth);
+ SelectBasics_PickResult& thePickResult) const;
- Standard_EXPORT void segmentPlaneIntersection (const gp_Vec& thePlane,
+ Standard_EXPORT bool segmentPlaneIntersection (const gp_Vec& thePlane,
const gp_Pnt& thePntOnPlane,
- Standard_Real& theDepth);
+ SelectBasics_PickResult& thePickResult) const;
//! Computes valid depth range for the given clipping planes
Standard_EXPORT void computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
- Standard_Real& theDepthMin,
- Standard_Real& theDepthMax);
+ SelectMgr_ViewClipRange& theRange) const;
//! Returns false if theDepth must be clipped by current view clip range
- Standard_EXPORT Standard_Boolean isViewClippingOk (const Standard_Real theDepth) const;
+ Standard_EXPORT Standard_Boolean isViewClippingOk (const SelectBasics_PickResult& thePickResult) const;
private:
- void cacheVertexProjections (SelectMgr_RectangularFrustum* theFrustum);
+ void cacheVertexProjections (SelectMgr_RectangularFrustum* theFrustum) const;
private:
enum { LeftTopNear, LeftTopFar,
gp_Pnt2d myMousePos; //!< Mouse coordinates
Standard_Real myScale; //!< Scale factor of applied transformation, if there was any
SelectMgr_ViewClipRange myViewClipRange;
+ Standard_Boolean myIsViewClipEnabled; //!< view clipping enabled state
+
};
#endif // _SelectMgr_RectangularFrustum_HeaderFile