mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
0032976: Visualization - AIS_InteractiveContext::FitSelected() includes objects invisible in current View
This commit is contained in:
parent
dcbd679c8b
commit
b56df3a60a
@ -2214,10 +2214,11 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView)
|
|||||||
//function : BoundingBoxOfSelection
|
//function : BoundingBoxOfSelection
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
|
Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection (const Handle(V3d_View)& theView) const
|
||||||
{
|
{
|
||||||
Bnd_Box aBndSelected;
|
Bnd_Box aBndSelected;
|
||||||
AIS_MapOfObjectOwners anObjectOwnerMap;
|
AIS_MapOfObjectOwners anObjectOwnerMap;
|
||||||
|
const Standard_Integer aViewId = !theView.IsNull() ? theView->View()->Identification() : -1;
|
||||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
||||||
@ -2227,6 +2228,13 @@ Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->ObjectAffinity (anObj);
|
||||||
|
const Standard_Boolean isVisible = aViewId == -1 || anAffinity->IsVisible (aViewId);
|
||||||
|
if (!isVisible)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (anOwner == anObj->GlobalSelOwner())
|
if (anOwner == anObj->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
Bnd_Box aTmpBnd;
|
Bnd_Box aTmpBnd;
|
||||||
@ -2264,7 +2272,7 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
|||||||
const Standard_Real theMargin,
|
const Standard_Real theMargin,
|
||||||
const Standard_Boolean theToUpdate)
|
const Standard_Boolean theToUpdate)
|
||||||
{
|
{
|
||||||
Bnd_Box aBndSelected = BoundingBoxOfSelection();
|
Bnd_Box aBndSelected = BoundingBoxOfSelection (theView);
|
||||||
if (!aBndSelected.IsVoid())
|
if (!aBndSelected.IsVoid())
|
||||||
{
|
{
|
||||||
theView->FitAll (aBndSelected, theMargin, theToUpdate);
|
theView->FitAll (aBndSelected, theMargin, theToUpdate);
|
||||||
|
@ -502,7 +502,10 @@ public: //! @name Selection management
|
|||||||
Standard_EXPORT AIS_StatusOfPick SelectDetected (const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
|
Standard_EXPORT AIS_StatusOfPick SelectDetected (const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
|
||||||
|
|
||||||
//! Returns bounding box of selected objects.
|
//! Returns bounding box of selected objects.
|
||||||
Standard_EXPORT Bnd_Box BoundingBoxOfSelection() const;
|
Standard_EXPORT Bnd_Box BoundingBoxOfSelection (const Handle(V3d_View)& theView) const;
|
||||||
|
|
||||||
|
Standard_DEPRECATED ("BoundingBoxOfSelection() should be called with View argument")
|
||||||
|
Bnd_Box BoundingBoxOfSelection() const { return BoundingBoxOfSelection (Handle(V3d_View)()); }
|
||||||
|
|
||||||
//! Sets list of owner selected/deselected using specified selection scheme.
|
//! Sets list of owner selected/deselected using specified selection scheme.
|
||||||
//! @param theOwners owners to change selection state
|
//! @param theOwners owners to change selection state
|
||||||
|
@ -1969,7 +1969,7 @@ gp_Pnt AIS_ViewController::GravityPoint (const Handle(AIS_InteractiveContext)& t
|
|||||||
void AIS_ViewController::FitAllAuto (const Handle(AIS_InteractiveContext)& theCtx,
|
void AIS_ViewController::FitAllAuto (const Handle(AIS_InteractiveContext)& theCtx,
|
||||||
const Handle(V3d_View)& theView)
|
const Handle(V3d_View)& theView)
|
||||||
{
|
{
|
||||||
const Bnd_Box aBoxSel = theCtx->BoundingBoxOfSelection();
|
const Bnd_Box aBoxSel = theCtx->BoundingBoxOfSelection (theView);
|
||||||
const double aFitMargin = 0.01;
|
const double aFitMargin = 0.01;
|
||||||
if (aBoxSel.IsVoid())
|
if (aBoxSel.IsVoid())
|
||||||
{
|
{
|
||||||
|
@ -859,7 +859,7 @@ Standard_Boolean AIS_ViewCube::HasAnimation() const
|
|||||||
void AIS_ViewCube::viewFitAll (const Handle(V3d_View)& theView,
|
void AIS_ViewCube::viewFitAll (const Handle(V3d_View)& theView,
|
||||||
const Handle(Graphic3d_Camera)& theCamera)
|
const Handle(Graphic3d_Camera)& theCamera)
|
||||||
{
|
{
|
||||||
Bnd_Box aBndBox = myToFitSelected ? GetContext()->BoundingBoxOfSelection() : theView->View()->MinMaxValues();
|
Bnd_Box aBndBox = myToFitSelected ? GetContext()->BoundingBoxOfSelection (theView) : theView->View()->MinMaxValues();
|
||||||
if (aBndBox.IsVoid()
|
if (aBndBox.IsVoid()
|
||||||
&& myToFitSelected)
|
&& myToFitSelected)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user