1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0032976: Visualization - AIS_InteractiveContext::FitSelected() includes objects invisible in current View

This commit is contained in:
kgv
2022-05-16 23:02:31 +03:00
committed by smoskvin
parent dcbd679c8b
commit b56df3a60a
4 changed files with 16 additions and 5 deletions

View File

@@ -2214,10 +2214,11 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView)
//function : BoundingBoxOfSelection
//purpose :
//=======================================================================
Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection (const Handle(V3d_View)& theView) const
{
Bnd_Box aBndSelected;
AIS_MapOfObjectOwners anObjectOwnerMap;
const Standard_Integer aViewId = !theView.IsNull() ? theView->View()->Identification() : -1;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
@@ -2227,6 +2228,13 @@ Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
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())
{
Bnd_Box aTmpBnd;
@@ -2264,7 +2272,7 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
const Standard_Real theMargin,
const Standard_Boolean theToUpdate)
{
Bnd_Box aBndSelected = BoundingBoxOfSelection();
Bnd_Box aBndSelected = BoundingBoxOfSelection (theView);
if (!aBndSelected.IsVoid())
{
theView->FitAll (aBndSelected, theMargin, theToUpdate);