Declare methods V3d_View::Redraw() and V3d_View::RedrawImmediate() as virtual to allow customization.
//function : ZFitAll
//purpose :
//=============================================================================
-void Graphic3d_Camera::ZFitAll (const Standard_Real theScaleFactor, const Bnd_Box& theMinMax, const Bnd_Box& theGraphicBB)
+bool Graphic3d_Camera::ZFitAll (const Standard_Real theScaleFactor,
+ const Bnd_Box& theMinMax,
+ const Bnd_Box& theGraphicBB,
+ Standard_Real& theZNear,
+ Standard_Real& theZFar) const
{
Standard_ASSERT_RAISE (theScaleFactor > 0.0, "Zero or negative scale factor is not allowed.");
// scene with infinite or helper objects (third argument) for the sake of perspective projection.
if (theGraphicBB.IsVoid())
{
- SetZRange (DEFAULT_ZNEAR, DEFAULT_ZFAR);
- return;
+ theZNear = DEFAULT_ZNEAR;
+ theZFar = DEFAULT_ZFAR;
+ return false;
}
// Measure depth of boundary points from camera eye.
// Everything is behind the perspective camera.
if (aZFar < zEpsilon())
{
- SetZRange (DEFAULT_ZNEAR, DEFAULT_ZFAR);
- return;
+ theZNear = DEFAULT_ZNEAR;
+ theZFar = DEFAULT_ZFAR;
+ return false;
}
}
}
}
- SetZRange (aZNear, aZFar);
+ theZNear = aZNear;
+ theZFar = aZFar;
+ return true;
}
return myFOVy;
}
- //! Change Z-min and Z-max planes of projection volume to match the
+ //! Estimate Z-min and Z-max planes of projection volume to match the
//! displayed objects. The methods ensures that view volume will
//! be close by depth range to the displayed objects. Fitting assumes that
//! for orthogonal projection the view volume contains the displayed objects
//! Program error exception is thrown if negative or zero value is passed.
//! @param theMinMax [in] applicative min max boundaries.
//! @param theScaleFactor [in] real graphical boundaries (not accounting infinite flag).
-
- Standard_EXPORT void ZFitAll (const Standard_Real theScaleFactor, const Bnd_Box& theMinMax, const Bnd_Box& theGraphicBB);
+ Standard_EXPORT bool ZFitAll (const Standard_Real theScaleFactor,
+ const Bnd_Box& theMinMax,
+ const Bnd_Box& theGraphicBB,
+ Standard_Real& theZNear,
+ Standard_Real& theZFar) const;
+
+ //! Change Z-min and Z-max planes of projection volume to match the displayed objects.
+ void ZFitAll (const Standard_Real theScaleFactor, const Bnd_Box& theMinMax, const Bnd_Box& theGraphicBB)
+ {
+ Standard_Real aZNear = 0.0, aZFar = 1.0;
+ ZFitAll (theScaleFactor, theMinMax, theGraphicBB, aZNear, aZFar);
+ SetZRange (aZNear, aZFar);
+ }
//! Change the Near and Far Z-clipping plane positions.
//! For orthographic projection, theZNear, theZFar can be negative or positive.
//! been any modification.
//! Must be called if the view is shown.
//! (Ex: DeIconification ) .
- Standard_EXPORT void Redraw() const;
+ Standard_EXPORT virtual void Redraw() const;
//! Updates layer of immediate presentations.
- Standard_EXPORT void RedrawImmediate() const;
+ Standard_EXPORT virtual void RedrawImmediate() const;
//! Invalidates view content but does not redraw it.
Standard_EXPORT void Invalidate() const;