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

0031504: Data Exchange - Wrong output of progress indicator when writing to stl

Added new condition for first indicated element at Draw_ProgressIndicator::Show(),
because it’s more logical that at start progress starts at 0
Changed usage of Next() to Next(step) for increment progress to IND_THRESHOLD in RWStl::writeASCII() and RWStl::writeBinary()
Changed condition for continuation of writing and add interrupt to this function
Added possibility to use Progress indicator in writestl
Changed paremeter in constructor Message_ProgressSentry aPS() IND_THRESHOLD to 1
Changed test
This commit is contained in:
akaftasev
2020-05-22 13:04:49 +03:00
committed by bugmaster
parent 59ec2ccec9
commit 1fc1a207b0
8 changed files with 59 additions and 16 deletions

View File

@@ -281,12 +281,12 @@ Standard_Boolean RWStl::writeASCII (const Handle(Poly_Triangulation)& theMesh,
char aBuffer[512];
memset (aBuffer, 0, sizeof(aBuffer));
const Standard_Integer NBTriangles = theMesh->NbTriangles();
Message_ProgressSentry aPS (theProgInd, "Triangles", 0,
theMesh->NbTriangles(), IND_THRESHOLD);
NBTriangles, 1);
const TColgp_Array1OfPnt& aNodes = theMesh->Nodes();
const Poly_Array1OfTriangle& aTriangles = theMesh->Triangles();
const Standard_Integer NBTriangles = theMesh->NbTriangles();
Standard_Integer anElem[3] = {0, 0, 0};
for (Standard_Integer aTriIter = 1; aTriIter <= NBTriangles; ++aTriIter)
{
@@ -330,7 +330,9 @@ Standard_Boolean RWStl::writeASCII (const Handle(Poly_Triangulation)& theMesh,
// update progress only per 1k triangles
if ((aTriIter % IND_THRESHOLD) == 0)
{
aPS.Next();
if (!aPS.More())
return Standard_False;
aPS.Next(IND_THRESHOLD);
}
}
@@ -355,9 +357,10 @@ Standard_Boolean RWStl::writeBinary (const Handle(Poly_Triangulation)& theMesh,
{
return Standard_False;
}
const Standard_Integer aNBTriangles = theMesh->NbTriangles();
Message_ProgressSentry aPS (theProgInd, "Triangles", 0,
theMesh->NbTriangles(), IND_THRESHOLD);
aNBTriangles, 1);
const Standard_Size aNbChunkTriangles = 4096;
const Standard_Size aChunkSize = aNbChunkTriangles * THE_STL_SIZEOF_FACET;
@@ -366,7 +369,6 @@ Standard_Boolean RWStl::writeBinary (const Handle(Poly_Triangulation)& theMesh,
const TColgp_Array1OfPnt& aNodes = theMesh->Nodes();
const Poly_Array1OfTriangle& aTriangles = theMesh->Triangles();
const Standard_Integer aNBTriangles = theMesh->NbTriangles();
Standard_Character aConv[4];
convertInteger (aNBTriangles, aConv);
@@ -431,7 +433,9 @@ Standard_Boolean RWStl::writeBinary (const Handle(Poly_Triangulation)& theMesh,
// update progress only per 1k triangles
if ((aTriIter % IND_THRESHOLD) == 0)
{
aPS.Next();
if (!aPS.More())
return Standard_False;
aPS.Next(IND_THRESHOLD);
}
}