1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

FitAll for objects represented via LODs is fixed

This commit is contained in:
vpa
2016-03-31 19:22:21 +03:00
parent 05286d6875
commit 3d7e35768f
4 changed files with 43 additions and 24 deletions

View File

@@ -79,23 +79,39 @@ void Graphic3d_LODManager::SetRange (const Standard_Integer theLodIdx,
// function : GetCurrentGroups
// purpose :
//=======================================================================
const Graphic3d_SequenceOfGroup& Graphic3d_LODManager::GetCurrentGroups() const
{
return myLODs.Value (myCurrentLODIdx)->GetDrawGroups();
}
const Graphic3d_SequenceOfGroup& Graphic3d_LODManager::GetCurrentGroups() const
{
return myLODs.Value (myCurrentLODIdx)->GetDrawGroups();
}
//=======================================================================
//=======================================================================
// function : GetCombinedBndBox
// purpose :
//=======================================================================
void Graphic3d_LODManager::GetCombinedBndBox (Graphic3d_BndBox4f& theBndBox) const
{
for (Standard_Integer aLodIdx = 0; aLodIdx < myLODs.Size(); ++aLodIdx)
{
const Graphic3d_SequenceOfGroup& aGroups = myLODs.Value (aLodIdx)->GetDrawGroups();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
{
theBndBox.Combine (aGroupIter.Value()->BoundingBox());
}
}
}
void Graphic3d_LODManager::GetCombinedBndBox (Graphic3d_BndBox4f& theBndBox) const
{
for (Standard_Integer aLodIdx = 0; aLodIdx < myLODs.Size(); ++aLodIdx)
{
const Graphic3d_SequenceOfGroup& aGroups = myLODs.Value (aLodIdx)->GetDrawGroups();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
{
theBndBox.Combine (aGroupIter.Value()->BoundingBox());
}
}
}
//=======================================================================
// function : IsEmpty
// purpose :
//=======================================================================
Standard_Boolean Graphic3d_LODManager::IsEmpty() const
{
for (Standard_Integer aLodIdx = 0; aLodIdx < myLODs.Size(); ++aLodIdx)
{
const Graphic3d_SequenceOfGroup& aGroups = myLODs.Value (aLodIdx)->GetDrawGroups();
if (!aGroups.IsEmpty())
return Standard_False;
}
return Standard_True;
}

View File

@@ -55,6 +55,9 @@ public:
Standard_EXPORT void GetCombinedBndBox (Graphic3d_BndBox4f& theBndBox) const;
//! Returns false if at least one of LODs has non-empty sequence of Graphic3d_Groups
Standard_EXPORT Standard_Boolean IsEmpty() const;
DEFINE_STANDARD_RTTIEXT (Graphic3d_LODManager, Standard_Transient)
protected:

View File

@@ -486,9 +486,16 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const
}
// structure is empty:
// - in case if it is represented by LODs, all LODs have no graphic groups
// - if all these groups are empty
// - or if all groups are empty and all their descendants are empty
// - or if all its descendants are empty
// - or, in case if it is represented by LODs, all LODs have no graphic groups
if (!myCStructure->GetLodManager().IsNull())
{
return myCStructure->GetLodManager()->IsEmpty();
}
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myCStructure->Groups()); aGroupIter.More(); aGroupIter.Next())
{
if (!aGroupIter.Value()->IsEmpty())
@@ -505,6 +512,7 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const
return Standard_False;
}
}
return Standard_True;
}

View File

@@ -417,8 +417,6 @@ void MeshVS_LODBuilder::drawArrays (const Handle(Prs3d_Presentation)& theBasePrs
if (isPolygons && theFillAsp->FrontMaterial().Transparency() < 0.01)
{
Handle (Graphic3d_Group) aGroup = aNewLod->NewGroup (theBasePrs);
//Prs3d_Root::NewGroup ( theBasePrs );
//Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup ( theBasePrs );
theFillAsp->SetEdgeOff();
@@ -449,8 +447,6 @@ void MeshVS_LODBuilder::drawArrays (const Handle(Prs3d_Presentation)& theBasePrs
if (isPolylines && !theIsPolygonsEdgesOff)
{
Handle (Graphic3d_Group) aLGroup = aNewLod->NewGroup (theBasePrs);
//Prs3d_Root::NewGroup ( theBasePrs );
//Handle (Graphic3d_Group) aLGroup = Prs3d_Root::CurrentGroup ( theBasePrs );
theFillAsp->SetEdgeOff();
if (theIsSelected)
@@ -467,8 +463,6 @@ void MeshVS_LODBuilder::drawArrays (const Handle(Prs3d_Presentation)& theBasePrs
if (isLinkPolylines)
{
Handle (Graphic3d_Group) aBeamGroup = aNewLod->NewGroup (theBasePrs);
//Prs3d_Root::NewGroup ( theBasePrs );
//Handle (Graphic3d_Group) aBeamGroup = Prs3d_Root::CurrentGroup ( theBasePrs );
theFillAsp->SetEdgeOff();
if (!theIsSelected)
@@ -481,8 +475,6 @@ void MeshVS_LODBuilder::drawArrays (const Handle(Prs3d_Presentation)& theBasePrs
if (isPolygons && theFillAsp->FrontMaterial().Transparency() >= 0.01)
{
Handle (Graphic3d_Group) aGroup = aNewLod->NewGroup (theBasePrs);
//Prs3d_Root::NewGroup ( theBasePrs );
//Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup ( theBasePrs );
theFillAsp->SetEdgeOff();