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

0025748: Parallel version of progress indicator

Progress indication mechanism is refactored to support incrementing progress within multithreaded algorithms.

The class Message_ProgressIndicator is only an interface to the user application.
It accumulates the progress provided by progress scopes.
The counter is protected by mutex for thread-safety.

The new class Message_ProgressScope replacing Message_ProgressSentry should be used to advance the progress.
The scopes are nested to each other to reflect the nested nature of operations.
The new class Message_ProgressRange should be used to pass the progress to sub-scopes.

All OCCT algorithms involving progress indication have been updated to new API.

Improvements in Draw_ProgressIndicator:
- Separate console mode has been added in order to make possible to put the progress into std::cout instead
  or in addition to the draw interpreter, instead of trigger option "-tclOutput".
- Treatment of Ctrl-Break signal has been added.
  Now any operation can be aborted by Ctrl-C or Ctrl-Break keystroke.

Added new test case 'perf fclasses progr_par' for testing of parallel work of the progress.
This commit is contained in:
msv
2020-07-10 14:19:31 +03:00
committed by abv
parent 99289bed0a
commit 7e785937b3
271 changed files with 3701 additions and 3149 deletions

View File

@@ -17,7 +17,6 @@
#include <BinTools.hxx>
#include <BinTools_ShapeSet.hxx>
#include <FSD_FileHeader.hxx>
#include <Message_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx>
#include <Storage_StreamTypeMismatchError.hxx>
@@ -176,12 +175,12 @@ Standard_IStream& BinTools::GetBool(Standard_IStream& IS, Standard_Boolean& aVal
//=======================================================================
void BinTools::Write (const TopoDS_Shape& theShape, Standard_OStream& theStream,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
BinTools_ShapeSet aShapeSet(Standard_True);
aShapeSet.SetFormatNb (3);
aShapeSet.Add (theShape);
aShapeSet.Write (theStream, theProgress);
aShapeSet.Write (theStream, theRange);
aShapeSet.Write (theShape, theStream);
}
@@ -191,10 +190,10 @@ void BinTools::Write (const TopoDS_Shape& theShape, Standard_OStream& theStream,
//=======================================================================
void BinTools::Read (TopoDS_Shape& theShape, Standard_IStream& theStream,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
BinTools_ShapeSet aShapeSet(Standard_True);
aShapeSet.Read (theStream, theProgress);
aShapeSet.Read (theStream, theRange);
aShapeSet.Read (theShape, theStream, aShapeSet.NbShapes());
}
@@ -204,7 +203,7 @@ void BinTools::Read (TopoDS_Shape& theShape, Standard_IStream& theStream,
//=======================================================================
Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_CString theFile,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
std::ofstream aStream;
aStream.precision (15);
@@ -212,7 +211,7 @@ Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_C
if (!aStream.good())
return Standard_False;
Write (theShape, aStream, theProgress);
Write (theShape, aStream, theRange);
aStream.close();
return aStream.good();
}
@@ -223,7 +222,7 @@ Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_C
//=======================================================================
Standard_Boolean BinTools::Read (TopoDS_Shape& theShape, const Standard_CString theFile,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
std::filebuf aBuf;
OSD_OpenStream (aBuf, theFile, std::ios::in | std::ios::binary);
@@ -231,6 +230,6 @@ Standard_Boolean BinTools::Read (TopoDS_Shape& theShape, const Standard_CString
return Standard_False;
Standard_IStream aStream (&aBuf);
Read (theShape, aStream, theProgress);
Read (theShape, aStream, theRange);
return aStream.good();
}

View File

@@ -26,7 +26,7 @@
#include <Standard_ExtCharacter.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressRange.hxx>
class TopoDS_Shape;
class BinTools_ShapeSet;
@@ -65,21 +65,21 @@ public:
//! Writes <theShape> on <theStream> in binary format.
Standard_EXPORT static void Write (const TopoDS_Shape& theShape, Standard_OStream& theStream,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Reads a shape from <theStream> and returns it in <theShape>.
Standard_EXPORT static void Read (TopoDS_Shape& theShape, Standard_IStream& theStream,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Writes <theShape> in <theFile>.
Standard_EXPORT static Standard_Boolean Write
(const TopoDS_Shape& theShape, const Standard_CString theFile,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Reads a shape from <theFile> and returns it in <theShape>.
Standard_EXPORT static Standard_Boolean Read
(TopoDS_Shape& theShape, const Standard_CString theFile,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
protected:

View File

@@ -38,7 +38,7 @@
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Message_ProgressSentry.hxx>
#include <Message_ProgressScope.hxx>
#define LINE 1
#define CIRCLE 2
@@ -347,10 +347,10 @@ void BinTools_Curve2dSet::WriteCurve2d(const Handle(Geom2d_Curve)& C,
//=======================================================================
void BinTools_Curve2dSet::Write (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress)const
const Message_ProgressRange& theRange) const
{
Standard_Integer i, aNbCurves = myMap.Extent();
Message_ProgressSentry aPS(theProgress, "Writing 2D curves", 0, aNbCurves, 1);
Message_ProgressScope aPS(theRange, "Writing 2D curves",aNbCurves);
OS << "Curve2ds "<< aNbCurves << "\n";
for (i = 1; i <= aNbCurves && aPS.More(); i++, aPS.Next()) {
WriteCurve2d(Handle(Geom2d_Curve)::DownCast(myMap(i)),OS);
@@ -696,7 +696,7 @@ Standard_IStream& BinTools_Curve2dSet::ReadCurve2d(Standard_IStream& IS,
//=======================================================================
void BinTools_Curve2dSet::Read (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
char buffer[255];
@@ -714,7 +714,7 @@ void BinTools_Curve2dSet::Read (Standard_IStream& IS,
Handle(Geom2d_Curve) C;
Standard_Integer i, aNbCurves;
IS >> aNbCurves;
Message_ProgressSentry aPS(theProgress, "Reading curves 2d", 0, aNbCurves, 1);
Message_ProgressScope aPS(theRange, "Reading curves 2d", aNbCurves);
IS.get();//remove <lf>
for (i = 1; i <= aNbCurves && aPS.More(); i++, aPS.Next()) {
BinTools_Curve2dSet::ReadCurve2d(IS,C);

View File

@@ -25,7 +25,7 @@
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressRange.hxx>
class Standard_OutOfRange;
class Geom2d_Curve;
@@ -61,12 +61,12 @@ public:
//! Writes the content of me on the stream <OS> in a
//! format that can be read back by Read.
Standard_EXPORT void Write (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
Standard_EXPORT void Read (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Dumps the curve on the binary stream, that can be read back.
Standard_EXPORT static void WriteCurve2d(const Handle(Geom2d_Curve)& C, Standard_OStream& OS);

View File

@@ -37,7 +37,7 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Message_ProgressSentry.hxx>
#include <Message_ProgressScope.hxx>
#define LINE 1
#define CIRCLE 2
@@ -360,10 +360,10 @@ void BinTools_CurveSet::WriteCurve(const Handle(Geom_Curve)& C,
//=======================================================================
void BinTools_CurveSet::Write (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress)const
const Message_ProgressRange& theRange)const
{
Standard_Integer i, nbcurv = myMap.Extent();
Message_ProgressSentry aPS(theProgress, "Writing curves", 0, nbcurv, 1);
Message_ProgressScope aPS(theRange, "Writing curves", nbcurv);
OS << "Curves "<< nbcurv << "\n";
for (i = 1; i <= nbcurv &&aPS.More(); i++, aPS.Next()) {
WriteCurve(Handle(Geom_Curve)::DownCast(myMap(i)),OS);
@@ -715,7 +715,7 @@ Standard_IStream& BinTools_CurveSet::ReadCurve(Standard_IStream& IS,
//=======================================================================
void BinTools_CurveSet::Read (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
char buffer[255];
IS >> buffer;
@@ -733,7 +733,7 @@ void BinTools_CurveSet::Read (Standard_IStream& IS,
Standard_Integer i, nbcurve;
IS >> nbcurve;
Message_ProgressSentry aPS(theProgress, "Reading curves", 0, nbcurve, 1);
Message_ProgressScope aPS(theRange, "Reading curves", nbcurve);
IS.get();//remove <lf>
for (i = 1; i <= nbcurve && aPS.More(); i++, aPS.Next()) {

View File

@@ -25,7 +25,7 @@
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressRange.hxx>
class Standard_OutOfRange;
class Geom_Curve;
@@ -58,12 +58,12 @@ public:
//! Writes the content of me on the stream <OS> in a
//! format that can be read back by Read.
Standard_EXPORT void Write (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
Standard_EXPORT void Read (Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Dumps the curve on the stream in binary format
//! that can be read back.

View File

@@ -51,7 +51,7 @@
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <Message_ProgressSentry.hxx>
#include <Message_ProgressRange.hxx>
#include <string.h>
//#define MDTV_DEB 1
@@ -296,33 +296,25 @@ void BinTools_ShapeSet::AddGeometry(const TopoDS_Shape& S)
//=======================================================================
void BinTools_ShapeSet::WriteGeometry (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress)const
const Message_ProgressRange& theRange)const
{
Message_ProgressSentry aPS(theProgress, "Writing geometry", 0, 6, 1);
myCurves2d.Write(OS, theProgress);
Message_ProgressScope aPS(theRange, "Writing geometry", 6);
myCurves2d.Write(OS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
myCurves.Write(OS, theProgress);
myCurves.Write(OS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
WritePolygon3D(OS, theProgress);
WritePolygon3D(OS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
WritePolygonOnTriangulation(OS, theProgress);
WritePolygonOnTriangulation(OS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
mySurfaces.Write(OS, theProgress);
mySurfaces.Write(OS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
WriteTriangulation(OS, theProgress);
if (!aPS.More())
return;
aPS.Next();
WriteTriangulation(OS, aPS.Next());
}
//=======================================================================
@@ -331,7 +323,7 @@ void BinTools_ShapeSet::WriteGeometry (Standard_OStream& OS,
//=======================================================================
void BinTools_ShapeSet::Write (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress)const
const Message_ProgressRange& theRange)const
{
// write the copyright
@@ -352,23 +344,22 @@ void BinTools_ShapeSet::Write (Standard_OStream& OS,
// write the geometry
//-----------------------------------------
Message_ProgressSentry aPS(theProgress, "Writing geometry", 0, 2, 1);
Message_ProgressScope aPS(theRange, "Writing geometry", 2);
WriteGeometry(OS, theProgress);
WriteGeometry(OS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
//-----------------------------------------
// write the shapes
//-----------------------------------------
Standard_Integer i, nbShapes = myShapes.Extent();
Message_ProgressSentry aPSinner(theProgress, "Writing shapes", 0, nbShapes, 1);
Message_ProgressScope aPSinner(aPS.Next(), "Writing shapes", nbShapes);
OS << "\nTShapes " << nbShapes << "\n";
// subshapes are written first
for (i = 1; i <= nbShapes && aPS.More(); i++, aPS.Next()) {
for (i = 1; i <= nbShapes && aPSinner.More(); i++, aPSinner.Next()) {
const TopoDS_Shape& S = myShapes(i);
@@ -404,7 +395,7 @@ void BinTools_ShapeSet::Write (Standard_OStream& OS,
//=======================================================================
void BinTools_ShapeSet::Read (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
Clear();
@@ -440,11 +431,10 @@ void BinTools_ShapeSet::Read (Standard_IStream& IS,
//-----------------------------------------
// read the geometry
//-----------------------------------------
Message_ProgressSentry aPSouter(theProgress, "Reading", 0, 2, 1);
ReadGeometry(IS, theProgress);
Message_ProgressScope aPSouter(theRange, "Reading", 2);
ReadGeometry(IS, aPSouter.Next());
if (!aPSouter.More())
return;
aPSouter.Next();
//-----------------------------------------
// read the shapes
//-----------------------------------------
@@ -460,7 +450,7 @@ void BinTools_ShapeSet::Read (Standard_IStream& IS,
Standard_Integer nbShapes = 0;
IS >> nbShapes;
IS.get();//remove lf
Message_ProgressSentry aPSinner(theProgress, "Reading Shapes", 0, nbShapes, 1);
Message_ProgressScope aPSinner(aPSouter.Next(), "Reading Shapes", nbShapes);
for (int i = 1; i <= nbShapes && aPSinner.More(); i++, aPSinner.Next()) {
TopoDS_Shape S;
@@ -561,33 +551,25 @@ void BinTools_ShapeSet::Read (TopoDS_Shape& S, Standard_IStream& IS,
//=======================================================================
void BinTools_ShapeSet::ReadGeometry (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
Message_ProgressSentry aPS(theProgress, "Reading geomentry", 0, 6, 1);
myCurves2d.Read(IS, theProgress);
Message_ProgressScope aPS(theRange, "Reading geomentry", 6);
myCurves2d.Read(IS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
myCurves.Read(IS, theProgress);
myCurves.Read(IS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
ReadPolygon3D(IS, theProgress);
ReadPolygon3D(IS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
ReadPolygonOnTriangulation(IS, theProgress);
ReadPolygonOnTriangulation(IS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
mySurfaces.Read(IS, theProgress);
mySurfaces.Read(IS, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
ReadTriangulation(IS, theProgress);
if (!aPS.More())
return;
aPS.Next();
ReadTriangulation(IS, aPS.Next());
}
//=======================================================================
@@ -1229,14 +1211,14 @@ void BinTools_ShapeSet::AddShapes(TopoDS_Shape& S1,
//=======================================================================
void BinTools_ShapeSet::WritePolygonOnTriangulation
(Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress) const
const Message_ProgressRange& theRange) const
{
const Standard_Integer aNbPol = myNodes.Extent();
OS << "PolygonOnTriangulations " << aNbPol << "\n";
try
{
OCC_CATCH_SIGNALS
Message_ProgressSentry aPS(theProgress, "Writing polygons on triangulation", 0, aNbPol, 1);
Message_ProgressScope aPS(theRange, "Writing polygons on triangulation", aNbPol);
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
const Handle(Poly_PolygonOnTriangulation)& aPoly = myNodes.FindKey (aPolIter);
@@ -1279,7 +1261,7 @@ void BinTools_ShapeSet::WritePolygonOnTriangulation
//=======================================================================
void BinTools_ShapeSet::ReadPolygonOnTriangulation
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
char aHeader[255];
IS >> aHeader;
@@ -1294,7 +1276,7 @@ void BinTools_ShapeSet::ReadPolygonOnTriangulation
try
{
OCC_CATCH_SIGNALS
Message_ProgressSentry aPS(theProgress, "Reading Polygones on triangulation", 0, aNbPol, 1);
Message_ProgressScope aPS(theRange, "Reading Polygones on triangulation", aNbPol);
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
Standard_Integer aNbNodes = 0;
@@ -1336,15 +1318,15 @@ void BinTools_ShapeSet::ReadPolygonOnTriangulation
//function : WritePolygon3D
//purpose :
//=======================================================================
void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress)const
void BinTools_ShapeSet::WritePolygon3D (Standard_OStream& OS,
const Message_ProgressRange& theRange)const
{
const Standard_Integer aNbPol = myPolygons3D.Extent();
OS << "Polygon3D " << aNbPol << "\n";
try
{
OCC_CATCH_SIGNALS
Message_ProgressSentry aPS(theProgress, "Writing polygons 3D", 0, aNbPol, 1);
Message_ProgressScope aPS(theRange, "Writing polygons 3D", aNbPol);
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
const Handle(Poly_Polygon3D)& aPoly = myPolygons3D.FindKey (aPolIter);
@@ -1386,7 +1368,7 @@ void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS,
//purpose :
//=======================================================================
void BinTools_ShapeSet::ReadPolygon3D (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
char aHeader[255];
IS >> aHeader;
@@ -1405,7 +1387,7 @@ void BinTools_ShapeSet::ReadPolygon3D (Standard_IStream& IS,
try
{
OCC_CATCH_SIGNALS
Message_ProgressSentry aPS(theProgress, "Reading polygones 3D", 0, aNbPol, 1);
Message_ProgressScope aPS(theRange, "Reading polygones 3D", aNbPol);
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
Standard_Integer aNbNodes = 0;
@@ -1452,7 +1434,7 @@ void BinTools_ShapeSet::ReadPolygon3D (Standard_IStream& IS,
//purpose :
//=======================================================================
void BinTools_ShapeSet::WriteTriangulation (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress) const
const Message_ProgressRange& theRange) const
{
const Standard_Integer aNbTriangulations = myTriangulations.Extent();
OS << "Triangulations " << aNbTriangulations << "\n";
@@ -1460,7 +1442,7 @@ void BinTools_ShapeSet::WriteTriangulation (Standard_OStream& OS,
try
{
OCC_CATCH_SIGNALS
Message_ProgressSentry aPS(theProgress, "Writing triangulation", 0, aNbTriangulations, 1);
Message_ProgressScope aPS(theRange, "Writing triangulation", aNbTriangulations);
for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations && aPS.More(); ++aTriangulationIter, aPS.Next())
{
const Handle(Poly_Triangulation)& aTriangulation = myTriangulations.FindKey (aTriangulationIter);
@@ -1515,7 +1497,7 @@ void BinTools_ShapeSet::WriteTriangulation (Standard_OStream& OS,
//purpose :
//=======================================================================
void BinTools_ShapeSet::ReadTriangulation (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
char aHeader[255];
IS >> aHeader;
@@ -1531,7 +1513,7 @@ void BinTools_ShapeSet::ReadTriangulation (Standard_IStream& IS,
try
{
OCC_CATCH_SIGNALS
Message_ProgressSentry aPS(theProgress, "Reading triangulation", 0, aNbTriangulations, 1);
Message_ProgressScope aPS(theRange, "Reading triangulation", aNbTriangulations);
for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations && aPS.More(); ++aTriangulationIter, aPS.Next())
{
Standard_Integer aNbNodes = 0, aNbTriangles = 0;

View File

@@ -101,7 +101,7 @@ public:
//! Write the flags, the subshapes.
Standard_EXPORT virtual void Write
(Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
//! Reads the content of me from the binary stream <IS>. me
//! is first cleared.
@@ -117,7 +117,7 @@ public:
//! Reads the flag, the subshapes.
Standard_EXPORT virtual void Read
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Writes on <OS> the shape <S>. Writes the
//! orientation, the index of the TShape and the index
@@ -128,12 +128,12 @@ public:
//! binary format that can be read back by Read.
Standard_EXPORT virtual void WriteGeometry
(Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
//! Reads the geometry of me from the stream <IS>.
Standard_EXPORT virtual void ReadGeometry
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Reads from <IS> a shape and returns it in S.
//! <NbShapes> is the number of tshapes in the set.
@@ -159,40 +159,40 @@ public:
//! from the stream <IS>.
Standard_EXPORT void ReadPolygon3D
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Writes the 3d polygons
//! on the stream <OS> in a format that can
//! be read back by Read.
Standard_EXPORT void WritePolygon3D
(Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
//! Reads the triangulation of me
//! from the stream <IS>.
Standard_EXPORT void ReadTriangulation
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Writes the triangulation
//! on the stream <OS> in a format that can
//! be read back by Read.
Standard_EXPORT void WriteTriangulation
(Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
//! Reads the polygons on triangulation of me
//! from the stream <IS>.
Standard_EXPORT void ReadPolygonOnTriangulation
(Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress = NULL);
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Writes the polygons on triangulation
//! on the stream <OS> in a format that can
//! be read back by Read.
Standard_EXPORT void WritePolygonOnTriangulation
(Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
private:

View File

@@ -42,7 +42,7 @@
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <Message_ProgressSentry.hxx>
#include <Message_ProgressScope.hxx>
#define PLANE 1
#define CYLINDER 2
@@ -438,11 +438,11 @@ void BinTools_SurfaceSet::WriteSurface(const Handle(Geom_Surface)& S,
//=======================================================================
void BinTools_SurfaceSet::Write (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress)const
const Message_ProgressRange& theRange)const
{
Standard_Integer i, nbsurf = myMap.Extent();
Message_ProgressSentry aPS(theProgress, "Writing surfases", 0, nbsurf, 1);
Message_ProgressScope aPS(theRange, "Writing surfases", nbsurf);
OS << "Surfaces "<< nbsurf << "\n";
for (i = 1; i <= nbsurf && aPS.More(); i++, aPS.Next()) {
WriteSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS);
@@ -877,7 +877,7 @@ Standard_IStream& BinTools_SurfaceSet::ReadSurface(Standard_IStream& IS,
//=======================================================================
void BinTools_SurfaceSet::Read (Standard_IStream& IS,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theRange)
{
char buffer[255];
IS >> buffer;
@@ -894,7 +894,7 @@ void BinTools_SurfaceSet::Read (Standard_IStream& IS,
Handle(Geom_Surface) S;
Standard_Integer i, nbsurf;
IS >> nbsurf;
Message_ProgressSentry aPS(theProgress, "Reading surfaces", 0, nbsurf, 1);
Message_ProgressScope aPS(theRange, "Reading surfaces", nbsurf);
IS.get ();//remove <lf>
for (i = 1; i <= nbsurf && aPS.More(); i++, aPS.Next()) {
BinTools_SurfaceSet::ReadSurface(IS,S);

View File

@@ -25,7 +25,7 @@
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressRange.hxx>
class Standard_OutOfRange;
class Geom_Surface;
@@ -58,12 +58,12 @@ public:
//! Writes the content of me on the stream <OS> in
//! binary format that can be read back by Read.
Standard_EXPORT void Write (Standard_OStream& OS,
const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
const Message_ProgressRange& theRange = Message_ProgressRange()) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
Standard_EXPORT void Read (Standard_IStream& IS,
const Handle(Message_ProgressIndicator) &theProgress = NULL);
const Message_ProgressRange& therange = Message_ProgressRange());
//! Dumps the surface on the stream in binary
//! format that can be read back.