1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028895: Visualization, V3d_View::SetComputedMode() - HLR calculation is performed multiple times when 'hlr on' has been called

V3d_View::SetComputedMode() - removed implicit View update.

Graphic3d_CView::SetComputedMode(), ::ReCompute() - fixed
uninitialized bounding box of Computed structure.

PrsMgr_Presentation::Compute() - fixed computation of Computed structure
with transformation within Connected presentation.

StdPrs_HLRPolyShape::Add() now creates Graphic3d_ArrayOfSegments instead of
inefficient Graphic3d_ArrayOfPolylines with boundaries at every segment.

Fixed error in test case bugs/vis/bug24388_1.
This commit is contained in:
kgv
2017-07-10 15:43:25 +03:00
committed by bugmaster
parent 851dacdbb9
commit 1eeef710bb
15 changed files with 316 additions and 187 deletions

View File

@@ -14,9 +14,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <StdPrs_HLRPolyShape.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Group.hxx>
#include <HLRAlgo_EdgeIterator.hxx>
#include <HLRAlgo_EdgeStatus.hxx>
@@ -27,7 +28,6 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
#include <StdPrs_HLRPolyShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TopAbs.hxx>
@@ -64,9 +64,6 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
}
}
TColgp_SequenceOfPnt HiddenPnts;
TColgp_SequenceOfPnt SeenPnts;
if (aDrawer->IsAutoTriangulation())
{
const Standard_Boolean aRel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
@@ -121,48 +118,64 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
S,reg1,regn,outl,intl));
}
}
// storage in the group:
HLRBRep_ListIteratorOfListOfBPoint ItB;
if (aDrawer->DrawHiddenLine()) {
for (ItB.Initialize(BiPntHid); ItB.More(); ItB.Next()) {
const HLRBRep_BiPoint& BP = ItB.Value();
if (!BP.RgNLine() || BP.OutLine()) {
HiddenPnts.Append(BP.P1());
HiddenPnts.Append(BP.P2());
// storage in the group
if (aDrawer->DrawHiddenLine())
{
Standard_Integer aNbHiddenSegments = 0;
for (HLRBRep_ListIteratorOfListOfBPoint aBPntHidIter (BiPntHid); aBPntHidIter.More(); aBPntHidIter.Next())
{
const HLRBRep_BiPoint& aBPnt = aBPntHidIter.Value();
if (!aBPnt.RgNLine()
|| aBPnt.OutLine())
{
++aNbHiddenSegments;
}
}
}
if (aNbHiddenSegments > 0)
{
Handle(Graphic3d_ArrayOfSegments) aHiddenArray = new Graphic3d_ArrayOfSegments (aNbHiddenSegments * 2);
for (HLRBRep_ListIteratorOfListOfBPoint aBPntHidIter (BiPntHid); aBPntHidIter.More(); aBPntHidIter.Next())
{
const HLRBRep_BiPoint& aBPnt = aBPntHidIter.Value();
if (!aBPnt.RgNLine()
|| aBPnt.OutLine())
{
aHiddenArray->AddVertex (aBPnt.P1());
aHiddenArray->AddVertex (aBPnt.P2());
}
}
for (ItB.Initialize(BiPntVis); ItB.More(); ItB.Next()) {
const HLRBRep_BiPoint& BP = ItB.Value();
if (!BP.RgNLine() || BP.OutLine()) {
SeenPnts.Append(BP.P1());
SeenPnts.Append(BP.P2());
aGroup->SetPrimitivesAspect (aDrawer->HiddenLineAspect()->Aspect());
aGroup->AddPrimitiveArray (aHiddenArray);
}
}
Standard_Integer nbVertices = HiddenPnts.Length();
if(nbVertices > 0) {
Handle(Graphic3d_ArrayOfPolylines) HiddenArray = new Graphic3d_ArrayOfPolylines(nbVertices, (Standard_Integer)nbVertices/2);
for(int i=1; i<=nbVertices; i+=2) {
HiddenArray->AddBound(2);
HiddenArray->AddVertex(HiddenPnts.Value(i));
HiddenArray->AddVertex(HiddenPnts.Value(i+1));
{
Standard_Integer aNbSeenSegments = 0;
for (HLRBRep_ListIteratorOfListOfBPoint aBPntVisIter (BiPntVis); aBPntVisIter.More(); aBPntVisIter.Next())
{
const HLRBRep_BiPoint& aBPnt = aBPntVisIter.Value();
if (!aBPnt.RgNLine()
|| aBPnt.OutLine())
{
++aNbSeenSegments;
}
}
aGroup->SetPrimitivesAspect(aDrawer->HiddenLineAspect()->Aspect());
aGroup->AddPrimitiveArray(HiddenArray);
}
nbVertices = SeenPnts.Length();
if(nbVertices > 0) {
Handle(Graphic3d_ArrayOfPolylines) SeenArray = new Graphic3d_ArrayOfPolylines(nbVertices, (Standard_Integer)nbVertices/2);
for(int i=1; i<=nbVertices; i+=2) {
SeenArray->AddBound(2);
SeenArray->AddVertex(SeenPnts.Value(i));
SeenArray->AddVertex(SeenPnts.Value(i+1));
if (aNbSeenSegments > 0)
{
Handle(Graphic3d_ArrayOfSegments) aSeenArray = new Graphic3d_ArrayOfSegments (aNbSeenSegments * 2);
for (HLRBRep_ListIteratorOfListOfBPoint aBPntVisIter (BiPntVis); aBPntVisIter.More(); aBPntVisIter.Next())
{
const HLRBRep_BiPoint& aBPnt = aBPntVisIter.Value();
if (!aBPnt.RgNLine()
|| aBPnt.OutLine())
{
aSeenArray->AddVertex (aBPnt.P1());
aSeenArray->AddVertex (aBPnt.P2());
}
}
aGroup->SetPrimitivesAspect (aDrawer->SeenLineAspect()->Aspect());
aGroup->AddPrimitiveArray (aSeenArray);
}
aGroup->SetPrimitivesAspect(aDrawer->SeenLineAspect()->Aspect());
aGroup->AddPrimitiveArray(SeenArray);
}
}