Add support of Message_ProgressIndicator in BinTools classes.
Add support of Message_ProgressIndicator with possibility of user break in methods of opening and saving TDocStd_Application.
Add tests of ProgressIndicator in TDocStd_Applacation.
#include <Geom_Surface.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Vec2d.hxx>
-#include <Message_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Triangulation.hxx>
//=======================================================================
void BRepTools::Write(const TopoDS_Shape& Sh, Standard_OStream& S,
- const Handle(Message_ProgressIndicator)& PR)
+ const Handle(Message_ProgressIndicator)& theProgress)
{
BRepTools_ShapeSet SS;
- SS.SetProgress(PR);
SS.Add(Sh);
- SS.Write(S);
+ SS.Write(S, theProgress);
SS.Write(Sh,S);
}
void BRepTools::Read(TopoDS_Shape& Sh,
std::istream& S,
const BRep_Builder& B,
- const Handle(Message_ProgressIndicator)& PR)
+ const Handle(Message_ProgressIndicator)& theProgress)
{
BRepTools_ShapeSet SS(B);
- SS.SetProgress(PR);
- SS.Read(S);
+ SS.Read(S, theProgress);
SS.Read(Sh,S);
}
Standard_Boolean BRepTools::Write(const TopoDS_Shape& Sh,
const Standard_CString File,
- const Handle(Message_ProgressIndicator)& PR)
+ const Handle(Message_ProgressIndicator)& theProgress)
{
std::ofstream os;
OSD_OpenStream(os, File, std::ios::out);
return isGood;
BRepTools_ShapeSet SS;
- SS.SetProgress(PR);
SS.Add(Sh);
os << "DBRep_DrawableShape\n"; // for easy Draw read
- SS.Write(os);
+ SS.Write(os, theProgress);
isGood = os.good();
if(isGood )
SS.Write(Sh,os);
Standard_Boolean BRepTools::Read(TopoDS_Shape& Sh,
const Standard_CString File,
const BRep_Builder& B,
- const Handle(Message_ProgressIndicator)& PR)
+ const Handle(Message_ProgressIndicator)& theProgress)
{
std::filebuf fic;
std::istream in(&fic);
if(!fic.is_open()) return Standard_False;
BRepTools_ShapeSet SS(B);
- SS.SetProgress(PR);
- SS.Read(in);
+ SS.Read(in, theProgress);
if(!SS.NbShapes()) return Standard_False;
SS.Read(Sh,in);
return Standard_True;
class TopoDS_CompSolid;
class TopoDS_Compound;
class TopoDS_Shape;
-class Message_ProgressIndicator;
class BRep_Builder;
class BRepTools_WireExplorer;
class BRepTools_Modification;
Standard_EXPORT static void Dump (const TopoDS_Shape& Sh, Standard_OStream& S);
//! Writes <Sh> on <S> in an ASCII format.
- Standard_EXPORT static void Write (const TopoDS_Shape& Sh, Standard_OStream& S, const Handle(Message_ProgressIndicator)& PR = NULL);
+ Standard_EXPORT static void Write (const TopoDS_Shape& Sh, Standard_OStream& S,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Reads a Shape from <S> in returns it in <Sh>.
//! <B> is used to build the shape.
- Standard_EXPORT static void Read (TopoDS_Shape& Sh, Standard_IStream& S, const BRep_Builder& B, const Handle(Message_ProgressIndicator)& PR = NULL);
+ Standard_EXPORT static void Read (TopoDS_Shape& Sh, Standard_IStream& S, const BRep_Builder& B,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Writes <Sh> in <File>.
- Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape& Sh, const Standard_CString File, const Handle(Message_ProgressIndicator)& PR = NULL);
+ Standard_EXPORT static Standard_Boolean Write
+ (const TopoDS_Shape& Sh, const Standard_CString File,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Reads a Shape from <File>, returns it in <Sh>.
//! <B> is used to build the shape.
- Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& Sh, const Standard_CString File, const BRep_Builder& B, const Handle(Message_ProgressIndicator)& PR = NULL);
+ Standard_EXPORT static Standard_Boolean Read
+ (TopoDS_Shape& Sh, const Standard_CString File, const BRep_Builder& B,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Evals real tolerance of edge <theE>.
//! <theC3d>, <theC2d>, <theS>, <theF>, <theL> are
Standard_EXPORT static void RemoveInternals (TopoDS_Shape& theS,
const Standard_Boolean theForce = Standard_False);
-
-protected:
-
-
-
-
-
private:
-
-
-
friend class BRepTools_WireExplorer;
friend class BRepTools_Modification;
friend class BRepTools_Modifier;
};
-
-
-
-
-
-
#endif // _BRepTools_HeaderFile
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::DumpGeometry(Standard_OStream& OS)const
+void BRepTools_ShapeSet::DumpGeometry (Standard_OStream& OS)const
{
myCurves2d.Dump(OS);
myCurves.Dump(OS);
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::WriteGeometry(Standard_OStream& OS)
+void BRepTools_ShapeSet::WriteGeometry (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
//OCC19559
- myCurves2d.SetProgress(GetProgress());
- myCurves.SetProgress(GetProgress());
- mySurfaces.SetProgress(GetProgress());
-
- if ( !GetProgress().IsNull()) {
- if(GetProgress()->UserBreak() ) return;
- GetProgress()->NewScope ( 15, "2D Curves" );
- }
- myCurves2d.Write(OS);
-
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 15, "3D Curves" );
- }
- myCurves.Write(OS);
-
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 10, "3D Polygons" );
- }
- WritePolygon3D(OS);
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 10, "Polygons On Triangulation" );
- }
- WritePolygonOnTriangulation(OS);
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 10, "Surfaces" );
- }
- mySurfaces.Write(OS);
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 15, "Triangulations" );
- }
- WriteTriangulation(OS);
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
- }
+ Message_ProgressSentry aPS(theProgress, "Writing geometry", 0, 6, 1);
+ myCurves2d.Write (OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ myCurves.Write (OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ WritePolygon3D (OS, true, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ WritePolygonOnTriangulation (OS, true, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ mySurfaces.Write (OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ WriteTriangulation (OS, true, theProgress);
}
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::ReadGeometry(Standard_IStream& IS)
+void BRepTools_ShapeSet::ReadGeometry (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress)
{
//OCC19559
- myCurves2d.SetProgress(GetProgress());
- myCurves.SetProgress(GetProgress());
- mySurfaces.SetProgress(GetProgress());
-
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->NewScope ( 15, "2D Curves" );
- }
- myCurves2d.Read(IS);
-
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 15, "3D Curves" );
- }
- myCurves.Read(IS);
-
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 10, "3D Polygons" );
- }
- ReadPolygon3D(IS);
- if ( !GetProgress().IsNull() ) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 10, "Polygons On Triangulation" );
- }
- ReadPolygonOnTriangulation(IS);
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 10, "Surfaces" );
- }
- mySurfaces.Read(IS);
- if ( !GetProgress().IsNull() ) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
-
- GetProgress()->NewScope ( 15, "Triangulations" );
- }
- ReadTriangulation(IS);
- if ( !GetProgress().IsNull()) {
- if( GetProgress()->UserBreak() ) return;
- GetProgress()->EndScope();
- GetProgress()->Show();
- }
+ Message_ProgressSentry aPS(theProgress, "Reading geometry", 0, 6, 1);
+ myCurves2d.Read(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ myCurves.Read(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ ReadPolygon3D(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ ReadPolygonOnTriangulation(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ mySurfaces.Read(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ ReadTriangulation(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
}
//=======================================================================
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::WriteGeometry(const TopoDS_Shape& S,
- Standard_OStream& OS)const
+void BRepTools_ShapeSet::WriteGeometry (const TopoDS_Shape& S, Standard_OStream& OS)const
{
// Write the geometry
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
- Standard_IStream& IS,
- TopoDS_Shape& S)
+void BRepTools_ShapeSet::ReadGeometry (const TopAbs_ShapeEnum T,
+ Standard_IStream& IS,
+ TopoDS_Shape& S)
{
// Read the geometry
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS,
- const Standard_Boolean Compact)const
+void BRepTools_ShapeSet::WritePolygonOnTriangulation (Standard_OStream& OS,
+ const Standard_Boolean Compact,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
Standard_Integer i, j, nbpOntri = myNodes.Extent();
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "Polygons On Triangulation", 0, nbpOntri, 1);
+ Message_ProgressSentry PS(theProgress, "Polygons On Triangulation", 0, nbpOntri, 1);
if (Compact)
OS << "PolygonOnTriangulations " << nbpOntri << "\n";
else {
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
+void BRepTools_ShapeSet::ReadPolygonOnTriangulation (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress)
{
char buffer[255];
IS >> buffer;
Handle(Poly_PolygonOnTriangulation) Poly;
IS >> nbpol;
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "Polygons On Triangulation", 0, nbpol, 1);
+ Message_ProgressSentry PS(theProgress, "Polygons On Triangulation", 0, nbpol, 1);
for (i=1; i<=nbpol&& PS.More(); i++, PS.Next()) {
IS >> nbnodes;
TColStd_Array1OfInteger Nodes(1, nbnodes);
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::WritePolygon3D(Standard_OStream& OS,
- const Standard_Boolean Compact)const
+void BRepTools_ShapeSet::WritePolygon3D (Standard_OStream& OS,
+ const Standard_Boolean Compact,
+ const Handle(Message_ProgressIndicator) &theProgress)const
{
Standard_Integer i, j, nbpol = myPolygons3D.Extent();
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "3D Poligons", 0, nbpol, 1);
+ Message_ProgressSentry PS(theProgress, "3D Polygons", 0, nbpol, 1);
if (Compact)
OS << "Polygon3D " << nbpol << "\n";
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
+void BRepTools_ShapeSet::ReadPolygon3D (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char buffer[255];
// Standard_Integer i, j, p, val, nbpol, nbnodes, hasparameters;
Handle(Poly_Polygon3D) P;
IS >> nbpol;
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "3D Polygons", 0, nbpol, 1);
+ Message_ProgressSentry PS(theProgress, "3D Polygons", 0, nbpol, 1);
for (i=1; i<=nbpol && PS.More(); i++, PS.Next()) {
IS >> nbnodes;
IS >> hasparameters;
//=======================================================================
void BRepTools_ShapeSet::WriteTriangulation(Standard_OStream& OS,
- const Standard_Boolean Compact)const
+ const Standard_Boolean Compact,
+ const Handle(Message_ProgressIndicator) &theProgress)const
{
Standard_Integer i, j, nbNodes, nbtri = myTriangulations.Extent();
Standard_Integer nbTriangles = 0, n1, n2, n3;
-
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "Triangulations", 0, nbtri, 1);
+
+ Message_ProgressSentry PS(theProgress, "Triangulations", 0, nbtri, 1);
if (Compact)
OS << "Triangulations " << nbtri << "\n";
//purpose :
//=======================================================================
-void BRepTools_ShapeSet::ReadTriangulation(Standard_IStream& IS)
+void BRepTools_ShapeSet::ReadTriangulation (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress)
{
char buffer[255];
// Standard_Integer i, j, val, nbtri;
IS >> nbtri;
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "Triangulations", 0, nbtri, 1);
+ Message_ProgressSentry PS(theProgress, "Triangulations", 0, nbtri, 1);
for (i=1; i<=nbtri && PS.More();i++, PS.Next()) {
IS >> nbNodes >> nbTriangles >> hasUV;
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <TopAbs_ShapeEnum.hxx>
+
class BRep_Builder;
class TopoDS_Shape;
//! Builds an empty ShapeSet.
//! Parameter <isWithTriangles> is added for XML Persistence
- Standard_EXPORT BRepTools_ShapeSet(const Standard_Boolean isWithTriangles = Standard_True);
+ Standard_EXPORT BRepTools_ShapeSet (const Standard_Boolean isWithTriangles = Standard_True);
//! Builds an empty ShapeSet.
//! Parameter <isWithTriangles> is added for XML Persistence
- Standard_EXPORT BRepTools_ShapeSet(const BRep_Builder& B, const Standard_Boolean isWithTriangles = Standard_True);
+ Standard_EXPORT BRepTools_ShapeSet (const BRep_Builder& B,
+ const Standard_Boolean isWithTriangles = Standard_True);
//! Clears the content of the set.
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Writes the geometry of me on the stream <OS> in a
//! format that can be read back by Read.
- Standard_EXPORT virtual void WriteGeometry (Standard_OStream& OS) Standard_OVERRIDE;
+ Standard_EXPORT virtual void WriteGeometry
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL) Standard_OVERRIDE;
//! Reads the geometry of me from the stream <IS>.
- Standard_EXPORT virtual void ReadGeometry (Standard_IStream& IS) Standard_OVERRIDE;
+ Standard_EXPORT virtual void ReadGeometry
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL) Standard_OVERRIDE;
//! Dumps the geometry of <S> on the stream <OS>.
- Standard_EXPORT virtual void DumpGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
+ Standard_EXPORT virtual void DumpGeometry
+ (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
//! Writes the geometry of <S> on the stream <OS> in a
//! format that can be read back by Read.
- Standard_EXPORT virtual void WriteGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
+ Standard_EXPORT virtual void WriteGeometry
+ (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
//! Reads the geometry of a shape of type <T> from the
//! stream <IS> and returns it in <S>.
- Standard_EXPORT virtual void ReadGeometry (const TopAbs_ShapeEnum T, Standard_IStream& IS, TopoDS_Shape& S) Standard_OVERRIDE;
+ Standard_EXPORT virtual void ReadGeometry
+ (const TopAbs_ShapeEnum T, Standard_IStream& IS, TopoDS_Shape& S) Standard_OVERRIDE;
//! Inserts the shape <S2> in the shape <S1>. This
//! method must be redefined to use the correct
//! Reads the 3d polygons of me
//! from the stream <IS>.
- Standard_EXPORT void ReadPolygon3D (Standard_IStream& IS);
+ Standard_EXPORT void ReadPolygon3D
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! 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 Standard_Boolean Compact = Standard_True) const;
+ Standard_EXPORT void WritePolygon3D
+ (Standard_OStream& OS,
+ const Standard_Boolean Compact = Standard_True,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
//! Dumps the 3d polygons
//! on the stream <OS>.
//! Reads the triangulation of me
//! from the stream <IS>.
- Standard_EXPORT void ReadTriangulation (Standard_IStream& IS);
+ Standard_EXPORT void ReadTriangulation
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! 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 Standard_Boolean Compact = Standard_True) const;
+ Standard_EXPORT void WriteTriangulation
+ (Standard_OStream& OS,
+ const Standard_Boolean Compact = Standard_True,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
//! Dumps the triangulation
//! on the stream <OS>.
//! Reads the polygons on triangulation of me
//! from the stream <IS>.
- Standard_EXPORT void ReadPolygonOnTriangulation (Standard_IStream& IS);
+ Standard_EXPORT void ReadPolygonOnTriangulation
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! 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 Standard_Boolean Compact = Standard_True) const;
+ Standard_EXPORT void WritePolygonOnTriangulation
+ (Standard_OStream& OS,
+ const Standard_Boolean Compact = Standard_True,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
//! Dumps the polygons on triangulation
//! on the stream <OS>.
Standard_EXPORT void DumpPolygonOnTriangulation (Standard_OStream& OS) const;
-
-
-
-protected:
-
-
-
-
-
private:
-
-
BRep_Builder myBuilder;
GeomTools_SurfaceSet mySurfaces;
GeomTools_CurveSet myCurves;
TColStd_IndexedMapOfTransient myNodes;
Standard_Boolean myWithTriangles;
-
};
-
-
-
-
-
-
#endif // _BRepTools_ShapeSet_HeaderFile
void BinDrivers_DocumentRetrievalDriver::ReadShapeSection
(BinLDrivers_DocumentSection& /*theSection*/,
Standard_IStream& theIS,
- const Standard_Boolean /*isMess*/)
+ const Standard_Boolean /*isMess*/,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
// Read Shapes
OCC_CATCH_SIGNALS
Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
- aNamedShapeDriver->ReadShapeSection (theIS);
+ aNamedShapeDriver->ReadShapeSection (theIS, theProgress);
}
catch(Standard_Failure const& anException) {
const TCollection_ExtendedString aMethStr
//! Constructor
Standard_EXPORT BinDrivers_DocumentRetrievalDriver();
- Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers
+ (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
- Standard_EXPORT virtual void ReadShapeSection (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS, const Standard_Boolean isMess = Standard_False) Standard_OVERRIDE;
+ Standard_EXPORT virtual void ReadShapeSection
+ (BinLDrivers_DocumentSection& theSection,
+ Standard_IStream& theIS,
+ const Standard_Boolean isMess = Standard_False,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
- Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS) Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckShapeSection
+ (const Storage_Position& thePos, Standard_IStream& theIS) Standard_OVERRIDE;
//! Clears the NamedShape driver
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentRetrievalDriver,BinLDrivers_DocumentRetrievalDriver)
-protected:
-
-
-
-
-private:
-
-
-
-
};
-
-
-
-
-
-
#endif // _BinDrivers_DocumentRetrievalDriver_HeaderFile
//=======================================================================
void BinDrivers_DocumentStorageDriver::WriteShapeSection
(BinLDrivers_DocumentSection& theSection,
- Standard_OStream& theOS)
+ Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();
OCC_CATCH_SIGNALS
Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
- aNamedShapeDriver->WriteShapeSection (theOS);
+ aNamedShapeDriver->WriteShapeSection (theOS, theProgress);
}
catch(Standard_Failure const& anException) {
TCollection_ExtendedString anErrorStr ("BinDrivers_DocumentStorageDriver, Shape Section :");
//! Constructor
Standard_EXPORT BinDrivers_DocumentStorageDriver();
- Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers
+ (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
//! implements the procedure of writing a shape section to file
- Standard_EXPORT virtual void WriteShapeSection (BinLDrivers_DocumentSection& theDocSection, Standard_OStream& theOS) Standard_OVERRIDE;
+ Standard_EXPORT virtual void WriteShapeSection
+ (BinLDrivers_DocumentSection& theDocSection,
+ Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
//! Return true if shape should be stored with triangles.
Standard_EXPORT Standard_Boolean IsWithTriangles() const;
DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentStorageDriver,BinLDrivers_DocumentStorageDriver)
-protected:
-
-
-
-
-private:
-
-
-
-
};
-
-
-
-
-
-
#endif // _BinDrivers_DocumentStorageDriver_HeaderFile
#include <TDF_Label.hxx>
#include <TDocStd_Document.hxx>
#include <TDocStd_Owner.hxx>
+#include <Message_ProgressSentry.hxx>
+
IMPLEMENT_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver)
void BinLDrivers_DocumentRetrievalDriver::Read
(const TCollection_ExtendedString& theFileName,
const Handle(CDM_Document)& theNewDocument,
- const Handle(CDM_Application)& theApplication)
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
std::ifstream aFileStream;
OSD_OpenStream (aFileStream, theFileName, std::ios::in | std::ios::binary);
Handle(Storage_Data) dData;
TCollection_ExtendedString aFormat = PCDM_ReadWriter::FileFormat (aFileStream, dData);
- Read (aFileStream, dData, theNewDocument, theApplication);
+ Read(aFileStream, dData, theNewDocument, theApplication, theProgress);
+ if (theProgress->UserBreak())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return;
+ }
}
else
{
void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream& theIStream,
const Handle(Storage_Data)& theStorageData,
const Handle(CDM_Document)& theDoc,
- const Handle(CDM_Application)& theApplication)
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
myReaderStatus = PCDM_RS_DriverFailure;
myMsgDriver = theApplication -> MessageDriver();
Handle(TDF_Data) aData = new TDF_Data();
std::streampos aDocumentPos = -1;
+ Message_ProgressSentry aPS(theProgress, "Reading data", 0, 3, 1);
+
// 2b. Read the TOC of Sections
if (aFileVer >= 3) {
BinLDrivers_DocumentSection aSection;
BinLDrivers_DocumentSection& aCurSection = anIterS.ChangeValue();
if (aCurSection.IsPostRead() == Standard_False) {
theIStream.seekg ((std::streampos) aCurSection.Offset());
- if (aCurSection.Name().IsEqual ((Standard_CString)SHAPESECTION_POS))
- ReadShapeSection (aCurSection, theIStream);
+ if (aCurSection.Name().IsEqual ((Standard_CString)SHAPESECTION_POS))
+ {
+ ReadShapeSection (aCurSection, theIStream, false, theProgress);
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return;
+ }
+ aPS.Next();
+ }
else
- ReadSection (aCurSection, theDoc, theIStream);
+ ReadSection (aCurSection, theDoc, theIStream);
}
}
} else { //aFileVer < 3
CheckShapeSection(aShapeSectionPos, theIStream);
// Read Shapes
BinLDrivers_DocumentSection aCurSection;
- ReadShapeSection (aCurSection, theIStream, Standard_False);
+ ReadShapeSection (aCurSection, theIStream, Standard_False, theProgress);
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return;
+ }
+ aPS.Next();
}
}
} // end of reading Sections or shape section
theIStream.read ((char*)&aTag, sizeof(Standard_Integer));
// read sub-tree of the root label
- Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root());
+ Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root(), theProgress);
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return;
+ }
+ aPS.Next();
Clear();
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return;
+ }
+ aPS.Next();
if (nbRead > 0) {
// attach data to the document
Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
(Standard_IStream& theIS,
- const TDF_Label& theLabel)
+ const TDF_Label& theLabel,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Standard_Integer nbRead = 0;
TCollection_ExtendedString aMethStr
("BinLDrivers_DocumentRetrievalDriver: ");
+ Message_ProgressSentry aPS(theProgress, "Reading sub tree", 0, 2, 1, true);
+
// Read attributes:
theIS >> myPAtt;
while (theIS && myPAtt.TypeId() > 0 && // not an end marker ?
myPAtt.Id() > 0 && // not a garbage ?
- !theIS.eof()) {
+ !theIS.eof())
+ {
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return -1;
+ }
+
// get a driver according to TypeId
Handle(BinMDF_ADriver) aDriver = myDrivers->GetDriver (myPAtt.TypeId());
if (!aDriver.IsNull()) {
#if DO_INVERSE
aTag = InverseInt (aTag);
#endif
+
while (theIS && aTag >= 0 && !theIS.eof()) { // not an end marker ?
// create sub-label
TDF_Label aLab = theLabel.FindChild (aTag, Standard_True);
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return -1;
+ }
+ aPS.Next();
// read sub-tree
- Standard_Integer nbSubRead = ReadSubTree(theIS, aLab);
+ Standard_Integer nbSubRead = ReadSubTree (theIS, aLab, theProgress);
// check for error
if (nbSubRead == -1)
return -1;
aTag = InverseInt (aTag);
#endif
}
+
if (aTag != BinLDrivers_ENDLABEL) {
// invalid end label marker
myMsgDriver->Send (aMethStr + "error: invalid end label marker", Message_Fail);
void BinLDrivers_DocumentRetrievalDriver::ReadShapeSection
(BinLDrivers_DocumentSection& theSection,
- Standard_IStream& /*theIS*/,
- const Standard_Boolean isMess)
+ Standard_IStream& /*theIS*/,
+ const Standard_Boolean isMess,
+ const Handle(Message_ProgressIndicator) &/*theProgress*/)
{
if(isMess && theSection.Length()) {
Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE;
//! retrieves the content of the file into a new Document.
- Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName, const Handle(CDM_Document)& theNewDocument, const Handle(CDM_Application)& theApplication) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
+ const Handle(CDM_Document)& theNewDocument,
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual void Read (Standard_IStream& theIStream,
const Handle(Storage_Data)& theStorageData,
const Handle(CDM_Document)& theDoc,
- const Handle(CDM_Application)& theApplication) Standard_OVERRIDE;
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
//! Read the tree from the stream <theIS> to <theLabel>
- Standard_EXPORT virtual Standard_Integer ReadSubTree (Standard_IStream& theIS, const TDF_Label& theData);
+ Standard_EXPORT virtual Standard_Integer ReadSubTree
+ (Standard_IStream& theIS,
+ const TDF_Label& theData,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! define the procedure of reading a section to file.
- Standard_EXPORT virtual void ReadSection (BinLDrivers_DocumentSection& theSection, const Handle(CDM_Document)& theDoc, Standard_IStream& theIS);
+ Standard_EXPORT virtual void ReadSection
+ (BinLDrivers_DocumentSection& theSection,
+ const Handle(CDM_Document)& theDoc,
+ Standard_IStream& theIS);
//! define the procedure of reading a shapes section to file.
- Standard_EXPORT virtual void ReadShapeSection (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS, const Standard_Boolean isMess = Standard_False);
+ Standard_EXPORT virtual void ReadShapeSection
+ (BinLDrivers_DocumentSection& theSection,
+ Standard_IStream& theIS,
+ const Standard_Boolean isMess = Standard_False,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! checks the shapes section can be correctly retreived.
Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS);
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
+#include <Message_ProgressIndicator.hxx>
+
class TCollection_AsciiString;
#include <TDF_Label.hxx>
#include <TDF_Tool.hxx>
#include <TDocStd_Document.hxx>
+#include <Message_ProgressSentry.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinLDrivers_DocumentStorageDriver,PCDM_StorageDriver)
void BinLDrivers_DocumentStorageDriver::Write
(const Handle(CDM_Document)& theDocument,
- const TCollection_ExtendedString& theFileName)
+ const TCollection_ExtendedString& theFileName,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
SetIsError(Standard_False);
SetStoreStatus(PCDM_SS_OK);
if (aFileStream.is_open() && aFileStream.good())
{
- Write (theDocument, aFileStream);
+ Write(theDocument, aFileStream, theProgress);
}
else
{
//purpose :
//=======================================================================
-void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDoc, Standard_OStream& theOStream)
+void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDoc,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
myMsgDriver = theDoc->Application()->MessageDriver();
myMapUnsupported.Clear();
myRelocTable.Clear();
myPAtt.Init();
-// Write Doc structure
- WriteSubTree (aData->Root(), theOStream); // Doc is written
+ Message_ProgressSentry aPS(theProgress, "Writing document", 0, 3, 1);
+// Write Doc structure
+ WriteSubTree (aData->Root(), theOStream, theProgress); // Doc is written
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return;
+ }
+ aPS.Next();
// 4. Write Shapes section
- WriteShapeSection (aShapesSection, theOStream);
-
+ WriteShapeSection (aShapesSection, theOStream, theProgress);
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return;
+ }
+ aPS.Next();
// Write application-defined sections
for (anIterS.Init (mySections); anIterS.More(); anIterS.Next()) {
BinLDrivers_DocumentSection& aSection = anIterS.ChangeValue();
SetStoreStatus(PCDM_SS_No_Obj);
}
myRelocTable.Clear();
-
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return;
+ }
+ aPS.Next();
if (!theOStream) {
// A problem with the stream
#ifdef OCCT_DEBUG
void BinLDrivers_DocumentStorageDriver::WriteSubTree
(const TDF_Label& theLabel,
- Standard_OStream& theOS)
+ Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
// Skip empty labels
if (!myEmptyLabels.IsEmpty() && myEmptyLabels.First() == theLabel) {
myEmptyLabels.RemoveFirst();
return;
}
-
+ Message_ProgressSentry aPS(theProgress, "Writing sub tree", 0, 2, 1, 1);
// Write label header: tag
Standard_Integer aTag = theLabel.Tag();
#if DO_INVERSE
// Write attributes
TDF_AttributeIterator itAtt (theLabel);
- for ( ; itAtt.More() && theOS; itAtt.Next()) {
+ for ( ; itAtt.More() && theOS && aPS.More(); itAtt.Next()) {
const Handle(TDF_Attribute) tAtt = itAtt.Value();
const Handle(Standard_Type)& aType = tAtt->DynamicType();
// Get type ID and driver
// Problem with the stream
return;
}
-
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return;
+ }
// Write the end attributes list marker
BinLDrivers_Marker anEndAttr = BinLDrivers_ENDATTRLIST;
#if DO_INVERSE
for ( ; itChld.More(); itChld.Next())
{
const TDF_Label& aChildLab = itChld.Value();
- WriteSubTree (aChildLab, theOS);
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return;
+ }
+ aPS.Next();
+ WriteSubTree (aChildLab, theOS, theProgress);
}
// Write the end label marker
//=======================================================================
void BinLDrivers_DocumentStorageDriver::WriteShapeSection
(BinLDrivers_DocumentSection& theSection,
- Standard_OStream& theOS)
+ Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();
theSection.Write (theOS, aShapesSectionOffset);
Standard_EXPORT BinLDrivers_DocumentStorageDriver();
//! Write <theDocument> to the binary file <theFileName>
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, const TCollection_ExtendedString& theFileName) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
+ const TCollection_ExtendedString& theFileName,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
//! Write <theDocument> to theOStream
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, Standard_OStream& theOStream) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
//! Write the tree under <theLabel> to the stream <theOS>
- Standard_EXPORT void WriteSubTree (const TDF_Label& theData, Standard_OStream& theOS);
+ Standard_EXPORT void WriteSubTree (const TDF_Label& theData,
+ Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! define the procedure of writing a section to file.
- Standard_EXPORT virtual void WriteSection (const TCollection_AsciiString& theName, const Handle(CDM_Document)& theDoc, Standard_OStream& theOS);
+ Standard_EXPORT virtual void WriteSection (const TCollection_AsciiString& theName,
+ const Handle(CDM_Document)& theDoc,
+ Standard_OStream& theOS);
//! defines the procedure of writing a shape section to file
- Standard_EXPORT virtual void WriteShapeSection (BinLDrivers_DocumentSection& theDocSection, Standard_OStream& theOS);
+ Standard_EXPORT virtual void WriteShapeSection (BinLDrivers_DocumentSection& theDocSection,
+ Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
Handle(BinMDF_ADriverTable) myDrivers;
BinObjMgt_SRelocationTable myRelocTable;
private:
-
Standard_EXPORT void FirstPass (const TDF_Label& theRoot);
//! Returns true if <L> and its sub-labels do not contain
BinLDrivers_VectorOfDocumentSection mySections;
TCollection_ExtendedString myFileName;
-
};
-
-
-
-
-
-
#endif // _BinLDrivers_DocumentStorageDriver_HeaderFile
//purpose :
//=======================================================================
-void BinMNaming_NamedShapeDriver::WriteShapeSection (Standard_OStream& theOS)
+void BinMNaming_NamedShapeDriver::WriteShapeSection (Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
theOS << SHAPESET;
myShapeSet.SetFormatNb(myFormatNb);
- myShapeSet.Write (theOS);
+ myShapeSet.Write (theOS, theProgress);
myShapeSet.Clear();
}
//purpose :
//=======================================================================
-void BinMNaming_NamedShapeDriver::ReadShapeSection (Standard_IStream& theIS)
+void BinMNaming_NamedShapeDriver::ReadShapeSection (Standard_IStream& theIS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
// check section title string; note that some versions of OCCT (up to 6.3.1)
// might avoid writing shape section if it is empty
theIS >> aSectionTitle;
if(aSectionTitle.Length() > 0 && aSectionTitle == SHAPESET) {
myShapeSet.Clear();
- myShapeSet.Read (theIS);
+ myShapeSet.Read (theIS, theProgress);
SetFormatNb(myShapeSet.FormatNb());
}
else
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
//! Input the shapes from Bin Document file
- Standard_EXPORT void ReadShapeSection (Standard_IStream& theIS);
+ Standard_EXPORT void ReadShapeSection (Standard_IStream& theIS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Output the shapes into Bin Document file
- Standard_EXPORT void WriteShapeSection (Standard_OStream& theOS);
+ Standard_EXPORT void WriteShapeSection (Standard_OStream& theOS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Clear myShapeSet
Standard_EXPORT void Clear();
#include <BinTools.hxx>
#include <BinTools_ShapeSet.hxx>
#include <FSD_FileHeader.hxx>
+#include <Message_ProgressIndicator.hxx>
#include <OSD_OpenFile.hxx>
#include <Storage_StreamTypeMismatchError.hxx>
//purpose :
//=======================================================================
-void BinTools::Write (const TopoDS_Shape& theShape, Standard_OStream& theStream)
+void BinTools::Write (const TopoDS_Shape& theShape, Standard_OStream& theStream,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
BinTools_ShapeSet aShapeSet(Standard_True);
aShapeSet.SetFormatNb (3);
aShapeSet.Add (theShape);
- aShapeSet.Write (theStream);
+ aShapeSet.Write (theStream, theProgress);
aShapeSet.Write (theShape, theStream);
}
//purpose :
//=======================================================================
-void BinTools::Read (TopoDS_Shape& theShape, Standard_IStream& theStream)
+void BinTools::Read (TopoDS_Shape& theShape, Standard_IStream& theStream,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
BinTools_ShapeSet aShapeSet(Standard_True);
- aShapeSet.Read (theStream);
+ aShapeSet.Read (theStream, theProgress);
aShapeSet.Read (theShape, theStream, aShapeSet.NbShapes());
}
//purpose :
//=======================================================================
-Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_CString theFile)
+Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_CString theFile,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
std::ofstream aStream;
aStream.precision (15);
if (!aStream.good())
return Standard_False;
- Write (theShape, aStream);
+ Write (theShape, aStream, theProgress);
aStream.close();
return aStream.good();
}
//purpose :
//=======================================================================
-Standard_Boolean BinTools::Read (TopoDS_Shape& theShape, const Standard_CString theFile)
+Standard_Boolean BinTools::Read (TopoDS_Shape& theShape, const Standard_CString theFile,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
std::filebuf aBuf;
OSD_OpenStream (aBuf, theFile, std::ios::in | std::ios::binary);
return Standard_False;
Standard_IStream aStream (&aBuf);
- Read (theShape, aStream);
+ Read (theShape, aStream, theProgress);
return aStream.good();
}
#include <Standard_ExtCharacter.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
+#include <Message_ProgressIndicator.hxx>
class TopoDS_Shape;
class BinTools_ShapeSet;
Standard_EXPORT static Standard_IStream& GetExtChar (Standard_IStream& IS, Standard_ExtCharacter& theValue);
//! Writes <theShape> on <theStream> in binary format.
- Standard_EXPORT static void Write (const TopoDS_Shape& theShape, Standard_OStream& theStream);
+ Standard_EXPORT static void Write (const TopoDS_Shape& theShape, Standard_OStream& theStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Reads a shape from <theStream> and returns it in <theShape>.
- Standard_EXPORT static void Read (TopoDS_Shape& theShape, Standard_IStream& theStream);
+ Standard_EXPORT static void Read (TopoDS_Shape& theShape, Standard_IStream& theStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Writes <theShape> in <theFile>.
- Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape& theShape, const Standard_CString theFile);
+ Standard_EXPORT static Standard_Boolean Write
+ (const TopoDS_Shape& theShape, const Standard_CString theFile,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Reads a shape from <theFile> and returns it in <theShape>.
- Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& theShape, const Standard_CString theFile);
+ Standard_EXPORT static Standard_Boolean Read
+ (TopoDS_Shape& theShape, const Standard_CString theFile,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
protected:
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
+#include <Message_ProgressSentry.hxx>
#define LINE 1
#define CIRCLE 2
//purpose :
//=======================================================================
-void BinTools_Curve2dSet::Write(Standard_OStream& OS)const
+void BinTools_Curve2dSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
Standard_Integer i, aNbCurves = myMap.Extent();
+ Message_ProgressSentry aPS(theProgress, "Writing 2D curves", 0, aNbCurves, 1);
OS << "Curve2ds "<< aNbCurves << "\n";
- for (i = 1; i <= aNbCurves; i++) {
+ for (i = 1; i <= aNbCurves && aPS.More(); i++, aPS.Next()) {
WriteCurve2d(Handle(Geom2d_Curve)::DownCast(myMap(i)),OS);
}
}
//purpose :
//=======================================================================
-void BinTools_Curve2dSet::Read(Standard_IStream& IS)
+void BinTools_Curve2dSet::Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char buffer[255];
Handle(Geom2d_Curve) C;
Standard_Integer i, aNbCurves;
IS >> aNbCurves;
- IS.get();//remove <lf>
- for (i = 1; i <= aNbCurves; i++) {
+ Message_ProgressSentry aPS(theProgress, "Reading curves 2d", 0, aNbCurves, 1);
+ IS.get();//remove <lf>
+ for (i = 1; i <= aNbCurves && aPS.More(); i++, aPS.Next()) {
BinTools_Curve2dSet::ReadCurve2d(IS,C);
myMap.Add(C);
}
}
-
-
-
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
class Standard_OutOfRange;
class Geom2d_Curve;
//! 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;
+ Standard_EXPORT void Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
- Standard_EXPORT void Read (Standard_IStream& IS);
+ Standard_EXPORT void Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! 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);
+ Standard_EXPORT static void WriteCurve2d(const Handle(Geom2d_Curve)& C, Standard_OStream& OS);
//! Reads the curve from the stream. The curve is
//! assumed to have been written with the Write
//! method.
Standard_EXPORT static Standard_IStream& ReadCurve2d (Standard_IStream& IS, Handle(Geom2d_Curve)& C);
-
-
-
-protected:
-
-
-
-
-
private:
-
-
TColStd_IndexedMapOfTransient myMap;
-
};
-
-
-
-
-
-
#endif // _BinTools_Curve2dSet_HeaderFile
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
+#include <Message_ProgressSentry.hxx>
#define LINE 1
#define CIRCLE 2
//purpose :
//=======================================================================
-void BinTools_CurveSet::Write(Standard_OStream& OS)const
+void BinTools_CurveSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
- Standard_Integer i, nbsurf = myMap.Extent();
- OS << "Curves "<< nbsurf << "\n";
- for (i = 1; i <= nbsurf; i++) {
+ Standard_Integer i, nbcurv = myMap.Extent();
+ Message_ProgressSentry aPS(theProgress, "Writing curves", 0, nbcurv, 1);
+ OS << "Curves "<< nbcurv << "\n";
+ for (i = 1; i <= nbcurv &&aPS.More(); i++, aPS.Next()) {
WriteCurve(Handle(Geom_Curve)::DownCast(myMap(i)),OS);
}
}
//purpose :
//=======================================================================
-void BinTools_CurveSet::Read(Standard_IStream& IS)
+void BinTools_CurveSet::Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char buffer[255];
IS >> buffer;
Standard_Integer i, nbcurve;
IS >> nbcurve;
+ Message_ProgressSentry aPS(theProgress, "Reading curves", 0, nbcurve, 1);
+
IS.get();//remove <lf>
- for (i = 1; i <= nbcurve; i++) {
+ for (i = 1; i <= nbcurve && aPS.More(); i++, aPS.Next()) {
BinTools_CurveSet::ReadCurve(IS,C);
myMap.Add(C);
}
}
-
-
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
class Standard_OutOfRange;
class Geom_Curve;
//! 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;
+ Standard_EXPORT void Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
- Standard_EXPORT void Read (Standard_IStream& IS);
+ Standard_EXPORT void Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Dumps the curve on the stream in binary format
//! that can be read back.
//! method
Standard_EXPORT static Standard_IStream& ReadCurve (Standard_IStream& IS, Handle(Geom_Curve)& C);
-
-
-
-protected:
-
-
-
-
-
private:
-
-
TColStd_IndexedMapOfTransient myMap;
-
};
-
-
-
-
-
-
#endif // _BinTools_CurveSet_HeaderFile
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
+#include <Message_ProgressSentry.hxx>
#include <string.h>
//#define MDTV_DEB 1
//purpose :
//=======================================================================
-void BinTools_ShapeSet::WriteGeometry(Standard_OStream& OS)const
+void BinTools_ShapeSet::WriteGeometry (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
- myCurves2d.Write(OS);
- myCurves.Write(OS);
- WritePolygon3D(OS);
- WritePolygonOnTriangulation(OS);
- mySurfaces.Write(OS);
- WriteTriangulation(OS);
+ Message_ProgressSentry aPS(theProgress, "Writing geometry", 0, 6, 1);
+ myCurves2d.Write(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ myCurves.Write(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ WritePolygon3D(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ WritePolygonOnTriangulation(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ mySurfaces.Write(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ WriteTriangulation(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
}
//=======================================================================
//purpose :
//=======================================================================
-void BinTools_ShapeSet::Write(Standard_OStream& OS)const
+void BinTools_ShapeSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
// write the copyright
// write the geometry
//-----------------------------------------
- WriteGeometry(OS);
+ Message_ProgressSentry aPS(theProgress, "Writing geometry", 0, 2, 1);
+ WriteGeometry(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+
//-----------------------------------------
// write the shapes
//-----------------------------------------
Standard_Integer i, nbShapes = myShapes.Extent();
-
+ Message_ProgressSentry aPSinner(theProgress, "Writing shapes", 0, nbShapes, 1);
OS << "\nTShapes " << nbShapes << "\n";
// subshapes are written first
- for (i = 1; i <= nbShapes; i++) {
+ for (i = 1; i <= nbShapes && aPS.More(); i++, aPS.Next()) {
const TopoDS_Shape& S = myShapes(i);
}
Write(TopoDS_Shape(),OS); // Null shape to end the list
}
-
}
//=======================================================================
//purpose :
//=======================================================================
-void BinTools_ShapeSet::Read(Standard_IStream& IS)
+void BinTools_ShapeSet::Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Clear();
//-----------------------------------------
// read the geometry
//-----------------------------------------
-
- ReadGeometry(IS);
-
+ Message_ProgressSentry aPSouter(theProgress, "Reading", 0, 2, 1);
+ ReadGeometry(IS, theProgress);
+ if (!aPSouter.More())
+ return;
+ aPSouter.Next();
//-----------------------------------------
// read the shapes
//-----------------------------------------
throw Standard_Failure(aMsg.str().c_str());
return;
}
-
Standard_Integer nbShapes = 0;
IS >> nbShapes;
IS.get();//remove lf
-
- for (int i = 1; i <= nbShapes; i++) {
+ Message_ProgressSentry aPSinner(theProgress, "Reading Shapes", 0, nbShapes, 1);
+ for (int i = 1; i <= nbShapes && aPSinner.More(); i++, aPSinner.Next()) {
TopoDS_Shape S;
//purpose :
//=======================================================================
-void BinTools_ShapeSet::Write(const TopoDS_Shape& S, Standard_OStream& OS)const
+void BinTools_ShapeSet::Write (const TopoDS_Shape& S,
+ Standard_OStream& OS)const
{
if (S.IsNull())
//purpose :
//=======================================================================
-void BinTools_ShapeSet::Read(TopoDS_Shape& S, Standard_IStream& IS,
- const Standard_Integer nbshapes)const
+void BinTools_ShapeSet::Read (TopoDS_Shape& S, Standard_IStream& IS,
+ const Standard_Integer nbshapes)const
{
Standard_Character aChar = '\0';
IS >> aChar;
//purpose :
//=======================================================================
-void BinTools_ShapeSet::ReadGeometry(Standard_IStream& IS)
+void BinTools_ShapeSet::ReadGeometry (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
- myCurves2d.Read(IS);
- myCurves.Read(IS);
- ReadPolygon3D(IS);
- ReadPolygonOnTriangulation(IS);
- mySurfaces.Read(IS);
- ReadTriangulation(IS);
+ Message_ProgressSentry aPS(theProgress, "Reading geomentry", 0, 6, 1);
+ myCurves2d.Read(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ myCurves.Read(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ ReadPolygon3D(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ ReadPolygonOnTriangulation(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ mySurfaces.Read(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
+ ReadTriangulation(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
}
//=======================================================================
//purpose :
//=======================================================================
-void BinTools_ShapeSet::WriteGeometry(const TopoDS_Shape& S,
+void BinTools_ShapeSet::WriteGeometry (const TopoDS_Shape& S,
Standard_OStream& OS)const
{
// Write the geometry
//function : WritePolygonOnTriangulation
//purpose :
//=======================================================================
-void BinTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS) const
+void BinTools_ShapeSet::WritePolygonOnTriangulation
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress) const
{
const Standard_Integer aNbPol = myNodes.Extent();
OS << "PolygonOnTriangulations " << aNbPol << "\n";
try
{
OCC_CATCH_SIGNALS
- for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+ Message_ProgressSentry aPS(theProgress, "Writing polygons on triangulation", 0, aNbPol, 1);
+ for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
const Handle(Poly_PolygonOnTriangulation)& aPoly = myNodes.FindKey (aPolIter);
const TColStd_Array1OfInteger& aNodes = aPoly->Nodes();
//function : ReadPolygonOnTriangulation
//purpose :
//=======================================================================
-void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
+void BinTools_ShapeSet::ReadPolygonOnTriangulation
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char aHeader[255];
IS >> aHeader;
try
{
OCC_CATCH_SIGNALS
- for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+ Message_ProgressSentry aPS(theProgress, "Reading Polygones on triangulation", 0, aNbPol, 1);
+ for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
Standard_Integer aNbNodes = 0;
BinTools::GetInteger(IS, aNbNodes);
//function : WritePolygon3D
//purpose :
//=======================================================================
-void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS)const
+void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
const Standard_Integer aNbPol = myPolygons3D.Extent();
OS << "Polygon3D " << aNbPol << "\n";
try
{
OCC_CATCH_SIGNALS
- for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+ Message_ProgressSentry aPS(theProgress, "Writing polygons 3D", 0, aNbPol, 1);
+ for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
const Handle(Poly_Polygon3D)& aPoly = myPolygons3D.FindKey (aPolIter);
BinTools::PutInteger(OS, aPoly->NbNodes());
//function : ReadPolygon3D
//purpose :
//=======================================================================
-void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
+void BinTools_ShapeSet::ReadPolygon3D (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char aHeader[255];
IS >> aHeader;
try
{
OCC_CATCH_SIGNALS
- for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+ Message_ProgressSentry aPS(theProgress, "Reading polygones 3D", 0, aNbPol, 1);
+ for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol && aPS.More(); ++aPolIter, aPS.Next())
{
Standard_Integer aNbNodes = 0;
Standard_Boolean hasParameters = Standard_False;
//function : WriteTriangulation
//purpose :
//=======================================================================
-void BinTools_ShapeSet::WriteTriangulation(Standard_OStream& OS) const
+void BinTools_ShapeSet::WriteTriangulation (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress) const
{
const Standard_Integer aNbTriangulations = myTriangulations.Extent();
OS << "Triangulations " << aNbTriangulations << "\n";
try
{
OCC_CATCH_SIGNALS
- for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations; ++aTriangulationIter)
+ Message_ProgressSentry aPS(theProgress, "Writing triangulation", 0, aNbTriangulations, 1);
+ for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations && aPS.More(); ++aTriangulationIter, aPS.Next())
{
const Handle(Poly_Triangulation)& aTriangulation = myTriangulations.FindKey (aTriangulationIter);
const Standard_Integer aNbNodes = aTriangulation->NbNodes();
//function : ReadTriangulation
//purpose :
//=======================================================================
-void BinTools_ShapeSet::ReadTriangulation (Standard_IStream& IS)
+void BinTools_ShapeSet::ReadTriangulation (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char aHeader[255];
IS >> aHeader;
try
{
OCC_CATCH_SIGNALS
- for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations; ++aTriangulationIter)
+ Message_ProgressSentry aPS(theProgress, "Reading triangulation", 0, aNbTriangulations, 1);
+ for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations && aPS.More(); ++aTriangulationIter, aPS.Next())
{
Standard_Integer aNbNodes = 0, aNbTriangles = 0;
Standard_Boolean hasUV = Standard_False;
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <TopAbs_ShapeEnum.hxx>
+
class TopoDS_Shape;
class BinTools_LocationSet;
//! Write the type.
//! calls WriteGeometry(S).
//! Write the flags, the subshapes.
- Standard_EXPORT virtual void Write (Standard_OStream& OS) const;
+ Standard_EXPORT virtual void Write
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the content of me from the binary stream <IS>. me
//! is first cleared.
//! Reads the type.
//! calls ReadGeometry(T,S).
//! Reads the flag, the subshapes.
- Standard_EXPORT virtual void Read (Standard_IStream& IS);
+ Standard_EXPORT virtual void Read
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Writes on <OS> the shape <S>. Writes the
//! orientation, the index of the TShape and the index
//! Writes the geometry of me on the stream <OS> in a
//! binary format that can be read back by Read.
- Standard_EXPORT virtual void WriteGeometry (Standard_OStream& OS) const;
+ Standard_EXPORT virtual void WriteGeometry
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the geometry of me from the stream <IS>.
- Standard_EXPORT virtual void ReadGeometry (Standard_IStream& IS);
+ Standard_EXPORT virtual void ReadGeometry
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Reads from <IS> a shape and returns it in S.
//! <NbShapes> is the number of tshapes in the set.
- Standard_EXPORT virtual void Read (TopoDS_Shape& S, Standard_IStream& IS, const Standard_Integer NbShapes) const;
+ Standard_EXPORT virtual void Read
+ (TopoDS_Shape& S,
+ Standard_IStream& IS, const Standard_Integer NbShapes) const;
//! Writes the geometry of <S> on the stream <OS> in a
//! binary format that can be read back by Read.
//! Reads the 3d polygons of me
//! from the stream <IS>.
- Standard_EXPORT void ReadPolygon3D (Standard_IStream& IS);
+ Standard_EXPORT void ReadPolygon3D
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! 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;
+ Standard_EXPORT void WritePolygon3D
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the triangulation of me
//! from the stream <IS>.
- Standard_EXPORT void ReadTriangulation (Standard_IStream& IS);
+ Standard_EXPORT void ReadTriangulation
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! 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;
+ Standard_EXPORT void WriteTriangulation
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the polygons on triangulation of me
//! from the stream <IS>.
- Standard_EXPORT void ReadPolygonOnTriangulation (Standard_IStream& IS);
+ Standard_EXPORT void ReadPolygonOnTriangulation
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! 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;
+ Standard_EXPORT void WritePolygonOnTriangulation
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
private:
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array2OfReal.hxx>
+#include <Message_ProgressSentry.hxx>
#define PLANE 1
#define CYLINDER 2
//purpose :
//=======================================================================
-void BinTools_SurfaceSet::Write(Standard_OStream& OS)const
+void BinTools_SurfaceSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
Standard_Integer i, nbsurf = myMap.Extent();
+ Message_ProgressSentry aPS(theProgress, "Writing surfases", 0, nbsurf, 1);
OS << "Surfaces "<< nbsurf << "\n";
- for (i = 1; i <= nbsurf; i++) {
+ for (i = 1; i <= nbsurf && aPS.More(); i++, aPS.Next()) {
WriteSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS);
}
//purpose :
//=======================================================================
-void BinTools_SurfaceSet::Read(Standard_IStream& IS)
+void BinTools_SurfaceSet::Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char buffer[255];
IS >> buffer;
Handle(Geom_Surface) S;
Standard_Integer i, nbsurf;
IS >> nbsurf;
+ Message_ProgressSentry aPS(theProgress, "Reading surfaces", 0, nbsurf, 1);
IS.get ();//remove <lf>
- for (i = 1; i <= nbsurf; i++) {
+ for (i = 1; i <= nbsurf && aPS.More(); i++, aPS.Next()) {
BinTools_SurfaceSet::ReadSurface(IS,S);
myMap.Add(S);
}
}
-
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
class Standard_OutOfRange;
class Geom_Surface;
//! 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;
+ Standard_EXPORT void Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
- Standard_EXPORT void Read (Standard_IStream& IS);
+ Standard_EXPORT void Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Dumps the surface on the stream in binary
//! format that can be read back.
//! method.
Standard_EXPORT static Standard_IStream& ReadSurface (Standard_IStream& IS, Handle(Geom_Surface)& S);
-
-
-
-protected:
-
-
-
-
-
private:
-
-
TColStd_IndexedMapOfTransient myMap;
-
};
-
-
-
-
-
-
#endif // _BinTools_SurfaceSet_HeaderFile
#include <Standard_NoSuchObject.hxx>
#include <Standard_ProgramError.hxx>
#include <UTL.hxx>
+#include <Message_ProgressSentry.hxx>
IMPLEMENT_STANDARD_RTTIEXT(CDF_Application,CDM_Application)
//function : Retrieve
//purpose :
//=======================================================================
-Handle(CDM_Document) CDF_Application::Retrieve(const TCollection_ExtendedString& aFolder,
- const TCollection_ExtendedString& aName,
- const Standard_Boolean UseStorageConfiguration) {
+Handle(CDM_Document) CDF_Application::Retrieve (const TCollection_ExtendedString& aFolder,
+ const TCollection_ExtendedString& aName,
+ const Standard_Boolean UseStorageConfiguration,
+ const Handle(Message_ProgressIndicator)& theProgress)
+{
TCollection_ExtendedString nullVersion;
- return Retrieve(aFolder,aName,nullVersion,UseStorageConfiguration);
+ return Retrieve(aFolder, aName, nullVersion, UseStorageConfiguration, theProgress);
}
//=======================================================================
//function : Retrieve
//purpose :
//=======================================================================
-Handle(CDM_Document) CDF_Application::Retrieve(const TCollection_ExtendedString& aFolder,
- const TCollection_ExtendedString& aName,
- const TCollection_ExtendedString& aVersion,
- const Standard_Boolean UseStorageConfiguration)
+Handle(CDM_Document) CDF_Application::Retrieve (const TCollection_ExtendedString& aFolder,
+ const TCollection_ExtendedString& aName,
+ const TCollection_ExtendedString& aVersion,
+ const Standard_Boolean UseStorageConfiguration,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Handle(CDM_MetaData) theMetaData;
theMetaData=theMetaDataDriver->MetaData(aFolder,aName,aVersion);
CDF_TypeOfActivation theTypeOfActivation=TypeOfActivation(theMetaData);
- Handle(CDM_Document) theDocument=Retrieve(theMetaData,UseStorageConfiguration,Standard_False);
+ Handle(CDM_Document) theDocument = Retrieve(theMetaData, UseStorageConfiguration,
+ Standard_False, theProgress);
CDF_Session::CurrentSession()->Directory()->Add(theDocument);
Activate(theDocument,theTypeOfActivation);
//function : Retrieve
//purpose :
//=======================================================================
-Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration) {
- return Retrieve(aMetaData,UseStorageConfiguration,Standard_True);
+Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMetaData,
+ const Standard_Boolean UseStorageConfiguration,
+ const Handle(Message_ProgressIndicator)& theProgress) {
+ return Retrieve(aMetaData, UseStorageConfiguration, Standard_True, theProgress);
}
//=======================================================================
//function : Retrieve
//purpose :
//=======================================================================
-Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration, const Standard_Boolean IsComponent) {
+Handle(CDM_Document) CDF_Application::Retrieve (const Handle(CDM_MetaData)& aMetaData,
+ const Standard_Boolean UseStorageConfiguration,
+ const Standard_Boolean IsComponent,
+ const Handle(Message_ProgressIndicator)& theProgress) {
Handle(CDM_Document) theDocumentToReturn;
myRetrievableStatus = PCDM_RS_DriverFailure;
try {
OCC_CATCH_SIGNALS
- theReader->Read(aMetaData->FileName(),theDocument,this);
+ theReader->Read (aMetaData->FileName(), theDocument, this, theProgress);
}
catch (Standard_Failure const& anException) {
myRetrievableStatus = theReader->GetStatus();
//function : Read
//purpose :
//=======================================================================
-Handle(CDM_Document) CDF_Application::Read (Standard_IStream& theIStream)
+Handle(CDM_Document) CDF_Application::Read (Standard_IStream& theIStream,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Handle(CDM_Document) aDoc;
Handle(Storage_Data) dData;
try
{
OCC_CATCH_SIGNALS
-
- aReader->Read (theIStream, dData, aDoc, this);
+ aReader->Read (theIStream, dData, aDoc, this, theProgress);
}
catch (Standard_Failure const& anException)
{
//!
//! Since the version is not specified in this syntax, the latest wil be used.
//! A link is kept with the database through an instance of CDM_MetaData
- Standard_EXPORT Handle(CDM_Document) Retrieve (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const Standard_Boolean UseStorageConfiguration = Standard_True);
+ Standard_EXPORT Handle(CDM_Document) Retrieve
+ (const TCollection_ExtendedString& aFolder,
+ const TCollection_ExtendedString& aName,
+ const Standard_Boolean UseStorageConfiguration = Standard_True,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! This method retrieves a document from the database.
//! If the Document references other documents which have
//! Handle(CDM_Document) theDocument=myApplication->Retrieve("|user|cascade","box","2");
//! A link is kept with the database through an instance
//! of CDM_MetaData
- Standard_EXPORT Handle(CDM_Document) Retrieve (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion, const Standard_Boolean UseStorageConfiguration = Standard_True);
+ Standard_EXPORT Handle(CDM_Document) Retrieve
+ (const TCollection_ExtendedString& aFolder,
+ const TCollection_ExtendedString& aName,
+ const TCollection_ExtendedString& aVersion,
+ const Standard_Boolean UseStorageConfiguration = Standard_True,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
- Standard_EXPORT PCDM_ReaderStatus CanRetrieve (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName);
+ Standard_EXPORT PCDM_ReaderStatus CanRetrieve (const TCollection_ExtendedString& aFolder,
+ const TCollection_ExtendedString& aName);
- Standard_EXPORT PCDM_ReaderStatus CanRetrieve (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion);
+ Standard_EXPORT PCDM_ReaderStatus CanRetrieve (const TCollection_ExtendedString& aFolder,
+ const TCollection_ExtendedString& aName,
+ const TCollection_ExtendedString& aVersion);
//! Checks status after Retrieve
PCDM_ReaderStatus GetRetrieveStatus() const { return myRetrievableStatus; }
//! Reads aDoc from standard SEEKABLE stream theIStream,
//! the stream should support SEEK fuctionality
- Standard_EXPORT Handle(CDM_Document) Read (Standard_IStream& theIStream);
+ Standard_EXPORT Handle(CDM_Document) Read
+ (Standard_IStream& theIStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Returns instance of read driver for specified format.
//!
//! try to retrieve a Format directly in the file or in
//! application resource by using extension. returns
//! True if found;
- Standard_EXPORT Standard_Boolean Format (const TCollection_ExtendedString& aFileName, TCollection_ExtendedString& theFormat);
+ Standard_EXPORT Standard_Boolean Format (const TCollection_ExtendedString& aFileName,
+ TCollection_ExtendedString& theFormat);
Standard_EXPORT Standard_ExtString DefaultFolder();
DEFINE_STANDARD_RTTIEXT(CDF_Application,CDM_Application)
-protected:
-
-
- Standard_EXPORT CDF_Application();
-
- PCDM_ReaderStatus myRetrievableStatus;
- NCollection_IndexedDataMap<TCollection_ExtendedString, Handle(PCDM_RetrievalDriver)> myReaders;
- NCollection_IndexedDataMap<TCollection_ExtendedString, Handle(PCDM_StorageDriver)> myWriters;
-
private:
//! retrieved and modified since the previous retrieval.
//! You do not need to call <Activate>, but you should redefine
//! this method to implement application specific behavior.
- Standard_EXPORT virtual void Activate (const Handle(CDM_Document)& aDocument, const CDF_TypeOfActivation aTypeOfActivation);
+ Standard_EXPORT virtual void Activate (const Handle(CDM_Document)& aDocument,
+ const CDF_TypeOfActivation aTypeOfActivation);
- Standard_EXPORT Handle(CDM_Document) Retrieve (const Handle(CDM_MetaData)& aMetaData, const Standard_Boolean UseStorageConfiguration) Standard_OVERRIDE;
+ Standard_EXPORT Handle(CDM_Document) Retrieve
+ (const Handle(CDM_MetaData)& aMetaData,
+ const Standard_Boolean UseStorageConfiguration,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
- Standard_EXPORT Handle(CDM_Document) Retrieve (const Handle(CDM_MetaData)& aMetaData, const Standard_Boolean UseStorageConfiguration, const Standard_Boolean IsComponent);
+ Standard_EXPORT Handle(CDM_Document) Retrieve
+ (const Handle(CDM_MetaData)& aMetaData,
+ const Standard_Boolean UseStorageConfiguration,
+ const Standard_Boolean IsComponent,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
Standard_EXPORT Standard_Integer DocumentVersion (const Handle(CDM_MetaData)& theMetaData) Standard_OVERRIDE;
Standard_EXPORT PCDM_ReaderStatus CanRetrieve (const Handle(CDM_MetaData)& aMetaData);
+protected:
+
+ Standard_EXPORT CDF_Application();
+
+ PCDM_ReaderStatus myRetrievableStatus;
+ NCollection_IndexedDataMap<TCollection_ExtendedString, Handle(PCDM_RetrievalDriver)> myReaders;
+ NCollection_IndexedDataMap<TCollection_ExtendedString, Handle(PCDM_StorageDriver)> myWriters;
+
private:
TCollection_ExtendedString myDefaultFolder;
};
return SetName(theName);
}
-void CDF_Store::Realize() {
+void CDF_Store::Realize (const Handle(Message_ProgressIndicator)& theProgress)
+{
Standard_ProgramError_Raise_if(!myList->IsConsistent(),"information are missing");
Handle(CDM_MetaData) m;
myText = "";
- myStatus = myList->Store(m,myText);
+ myStatus = myList->Store(m, myText, theProgress);
if(myStatus==PCDM_SS_OK) myPath = m->Path();
}
Standard_ExtString CDF_Store::Path() const {
#include <Standard_ExtString.hxx>
#include <CDF_StoreSetNameStatus.hxx>
#include <CDF_SubComponentStatus.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
class CDF_StoreList;
class CDM_Document;
class TCollection_ExtendedString;
Standard_EXPORT Standard_Boolean SetPreviousVersion (const Standard_ExtString aPreviousVersion);
- Standard_EXPORT void Realize();
+ Standard_EXPORT void Realize (const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! returns the complete path of the created meta-data.
Standard_EXPORT Standard_ExtString Path() const;
Handle(CDM_Document) CDF_StoreList::Value() const {
return myIterator.Key();
}
-PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText) {
-
+PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData,
+ TCollection_ExtendedString& aStatusAssociatedText,
+ const Handle(Message_ProgressIndicator)& theProgress)
+{
Handle(CDF_MetaDataDriver) theMetaDataDriver = CDF_Session::CurrentSession()->MetaDataDriver();
PCDM_StoreStatus status = PCDM_SS_OK;
}
TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
- aDocumentStorageDriver->Write(theDocument,theName);
+ aDocumentStorageDriver->Write(theDocument, theName, theProgress);
status = aDocumentStorageDriver->GetStoreStatus();
aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
theDocument->SetMetaData(aMetaData);
#include <Standard_Transient.hxx>
#include <Standard_Boolean.hxx>
#include <PCDM_StoreStatus.hxx>
+#include <Message_ProgressIndicator.hxx>
+
class CDM_Document;
class Standard_NoSuchObject;
class CDM_MetaData;
//! stores each object of the storelist in the reverse
//! order of which they had been added.
- Standard_EXPORT PCDM_StoreStatus Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText);
+ Standard_EXPORT PCDM_StoreStatus Store (Handle(CDM_MetaData)& aMetaData,
+ TCollection_ExtendedString& aStatusAssociatedText,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
Standard_EXPORT void Init();
#include <Standard_ExtString.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
+#include <Message_ProgressIndicator.hxx>
class CDM_Reference;
class CDM_MetaData;
private:
- Standard_EXPORT virtual Handle(CDM_Document) Retrieve (const Handle(CDM_MetaData)& aMetaData, const Standard_Boolean UseStorageConfiguration) = 0;
+ Standard_EXPORT virtual Handle(CDM_Document) Retrieve
+ (const Handle(CDM_MetaData)& aMetaData,
+ const Standard_Boolean UseStorageConfiguration,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) = 0;
//! returns -1 if the metadata has no modification counter.
Standard_EXPORT virtual Standard_Integer DocumentVersion (const Handle(CDM_MetaData)& aMetaData) = 0;
N = Handle(DBRep_DrawableShape)::DownCast(d);
BRep_Builder B;
BRepTools_ShapeSet S(B);
- if(!Draw::GetProgressBar().IsNull())
- S.SetProgress(Draw::GetProgressBar());
- S.Add(N->Shape());
- S.Write(OS);
+ S.Add (N->Shape());
+ S.Write (OS, Draw::GetProgressBar());
if(!Draw::GetProgressBar().IsNull() && Draw::GetProgressBar()->UserBreak())
return;
S.Write(N->Shape(),OS);
{
BRep_Builder B;
BRepTools_ShapeSet S(B);
- if(!Draw::GetProgressBar().IsNull())
- S.SetProgress(Draw::GetProgressBar());
- S.Read(IS);
+ S.Read (IS, Draw::GetProgressBar());
Handle(DBRep_DrawableShape) N;
if(!Draw::GetProgressBar().IsNull() && Draw::GetProgressBar()->UserBreak())
return N;
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw_Viewer.hxx>
+#include <Draw_ProgressIndicator.hxx>
#include <DDocStd_DrawDocument.hxx>
#include <TDocStd_Application.hxx>
#include <TDocStd_Document.hxx>
//=======================================================================
static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
- Standard_Integer nb,
- const char** a)
+ Standard_Integer nb,
+ const char** a)
{
if (nb >= 3) {
TCollection_ExtendedString path (a[1]);
}
}
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
if (anUseStream)
{
std::ifstream aFileStream;
OSD_OpenStream (aFileStream, path, std::ios::in | std::ios::binary);
- theStatus = A->Open (aFileStream, D);
+ theStatus = A->Open (aFileStream, D, aProgress);
}
else
{
- theStatus = A->Open(path,D);
+ theStatus = A->Open (path, D, aProgress);
}
- if (theStatus == PCDM_RS_OK && !D.IsNull()) {
+ if (theStatus == PCDM_RS_OK && !D.IsNull())
+ {
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(D);
TDataStd_Name::Set(D->GetData()->Root(),a[2]);
Draw::Set(a[2],DD);
return 0;
- } else {
+ }
+ else
+ {
switch ( theStatus ) {
+ case PCDM_RS_UserBreak: {
+ di << " could not retrieve , user break \n";
+ break;
+ }
case PCDM_RS_AlreadyRetrieved:
case PCDM_RS_AlreadyRetrievedAndModified: {
- di << " already retrieved \n" ;
- break;
+ di << " already retrieved \n" ;
+ break;
}
case PCDM_RS_NoDriver: {
- di << " could not retrieve , no Driver to make it \n" ;
- break ;
+ di << " could not retrieve , no Driver to make it \n" ;
+ break ;
}
case PCDM_RS_UnknownDocument:
case PCDM_RS_NoModel: {
- di << " could not retrieve , Unknown Document or No Model \n";
- break ;
+ di << " could not retrieve , Unknown Document or No Model \n";
+ break ;
}
case PCDM_RS_TypeNotFoundInSchema:
case PCDM_RS_UnrecognizedFileFormat: {
- di << " could not retrieve , Type not found or Unrecognized File Format\n";
- break ;
+ di << " could not retrieve , Type not found or Unrecognized File Format\n";
+ break ;
}
case PCDM_RS_PermissionDenied: {
- di << " could not retrieve , permission denied \n" ;
- break;
+ di << " could not retrieve , permission denied \n" ;
+ break;
}
default:
- di << " could not retrieve \n" ;
- break;
+ di << " could not retrieve \n" ;
+ break;
}
di << "DDocStd_Open : Error\n";
- }
+ }
}
return 1;
}
//=======================================================================
static Standard_Integer DDocStd_Save (Draw_Interpretor& di,
- Standard_Integer nb,
- const char** a)
+ Standard_Integer nb,
+ const char** a)
{
if (nb == 2) {
Handle(TDocStd_Document) D;
di << "this document has never been saved\n";
return 0;
}
- A->Save(D);
+
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
+ A->Save (D, aProgress);
return 0;
}
di << "DDocStd_Save : Error\n";
D->SetEmptyLabelsSavingMode(isSaveEmptyLabels);
}
}
+
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
if (anUseStream)
{
std::ofstream aFileStream;
OSD_OpenStream (aFileStream, path, std::ios::out | std::ios::binary);
- theStatus = A->SaveAs (D, aFileStream);
+ theStatus = A->SaveAs (D, aFileStream, aProgress);
}
else
{
- theStatus = A->SaveAs(D,path);
+ theStatus = A->SaveAs(D,path, aProgress);
}
if (theStatus != PCDM_SS_OK ) {
di << "Error saving document: Write info section failure\n" ;
break;
}
+ case PCDM_SS_UserBreak: {
+ di << "Error saving document: User break \n" ;
+ break;
+ }
default:
break;
}
//purpose :
//=======================================================================
-void GeomTools_Curve2dSet::Write(Standard_OStream& OS)const
+void GeomTools_Curve2dSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator) &theProgress)const
{
std::streamsize prec = OS.precision(17);
Standard_Integer i, nbsurf = myMap.Extent();
OS << "Curve2ds "<< nbsurf << "\n";
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "2D Curves", 0, nbsurf, 1);
+ Message_ProgressSentry PS(theProgress, "2D Curves", 0, nbsurf, 1);
for (i = 1; i <= nbsurf && PS.More(); i++, PS.Next()) {
PrintCurve2d(Handle(Geom2d_Curve)::DownCast(myMap(i)),OS,Standard_True);
}
//purpose :
//=======================================================================
-void GeomTools_Curve2dSet::Read(Standard_IStream& IS)
+void GeomTools_Curve2dSet::Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress)
{
char buffer[255];
IS >> buffer;
Standard_Integer i, nbcurve;
IS >> nbcurve;
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "2D Curves", 0, nbcurve, 1);
+ Message_ProgressSentry PS(theProgress, "2D Curves", 0, nbcurve, 1);
for (i = 1; i <= nbcurve && PS.More(); i++, PS.Next()) {
Handle(Geom2d_Curve) C = GeomTools_Curve2dSet::ReadCurve2d (IS);
myMap.Add(C);
}
}
-
-//=======================================================================
-//function : GetProgress
-//purpose :
-//=======================================================================
-
-Handle(Message_ProgressIndicator) GeomTools_Curve2dSet::GetProgress() const
-{
- return myProgress;
-}
-
-//=======================================================================
-//function : SetProgress
-//purpose :
-//=======================================================================
-
-void GeomTools_Curve2dSet::SetProgress(const Handle(Message_ProgressIndicator)& PR)
-{
- myProgress = PR;
-}
-
-
//! 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;
+ Standard_EXPORT void Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
- Standard_EXPORT void Read (Standard_IStream& IS);
+ Standard_EXPORT void Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Dumps the curve on the stream, if compact is True
//! use the compact format that can be read back.
- Standard_EXPORT static void PrintCurve2d (const Handle(Geom2d_Curve)& C, Standard_OStream& OS, const Standard_Boolean compact = Standard_False);
+ Standard_EXPORT static void PrintCurve2d (const Handle(Geom2d_Curve)& C,
+ Standard_OStream& OS,
+ const Standard_Boolean compact = Standard_False);
//! Reads the curve from the stream. The curve is
//! assumed to have been written with the Print
//! method (compact = True).
Standard_EXPORT static Handle(Geom2d_Curve) ReadCurve2d (Standard_IStream& IS);
-
- Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& PR);
-
- Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const;
-
-
-
-
-protected:
-
-
-
-
private:
-
-
TColStd_IndexedMapOfTransient myMap;
- Handle(Message_ProgressIndicator) myProgress;
-
};
-
-
-
-
-
-
#endif // _GeomTools_Curve2dSet_HeaderFile
//purpose :
//=======================================================================
-void GeomTools_CurveSet::Write(Standard_OStream& OS)const
+void GeomTools_CurveSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
std::streamsize prec = OS.precision(17);
Standard_Integer i, nbcurve = myMap.Extent();
OS << "Curves "<< nbcurve << "\n";
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "3D Curves", 0, nbcurve, 1);
+ Message_ProgressSentry PS(theProgress, "3D Curves", 0, nbcurve, 1);
for (i = 1; i <= nbcurve && PS.More(); i++, PS.Next()) {
PrintCurve(Handle(Geom_Curve)::DownCast(myMap(i)),OS,Standard_True);
}
//purpose :
//=======================================================================
-void GeomTools_CurveSet::Read(Standard_IStream& IS)
+void GeomTools_CurveSet::Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char buffer[255];
IS >> buffer;
Standard_Integer i, nbcurve;
IS >> nbcurve;
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "3D Curves", 0, nbcurve, 1);
+ Message_ProgressSentry PS(theProgress, "3D Curves", 0, nbcurve, 1);
for (i = 1; i <= nbcurve && PS.More(); i++, PS.Next()) {
Handle(Geom_Curve) C = GeomTools_CurveSet::ReadCurve (IS);
myMap.Add(C);
}
}
-
-//=======================================================================
-//function : GetProgress
-//purpose :
-//=======================================================================
-
-Handle(Message_ProgressIndicator) GeomTools_CurveSet::GetProgress() const
-{
- return myProgress;
-}
-
-//=======================================================================
-//function : SetProgress
-//purpose :
-//=======================================================================
-
-void GeomTools_CurveSet::SetProgress(const Handle(Message_ProgressIndicator)& PR)
-{
- myProgress = PR;
-}
-
-
//! 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;
+ Standard_EXPORT void Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
- Standard_EXPORT void Read (Standard_IStream& IS);
+ Standard_EXPORT void Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Dumps the curve on the stream, if compact is True
//! use the compact format that can be read back.
- Standard_EXPORT static void PrintCurve (const Handle(Geom_Curve)& C, Standard_OStream& OS, const Standard_Boolean compact = Standard_False);
+ Standard_EXPORT static void PrintCurve (const Handle(Geom_Curve)& C,
+ Standard_OStream& OS,
+ const Standard_Boolean compact = Standard_False);
//! Reads the curve from the stream. The curve is
//! assumed to have been written with the Print
//! method (compact = True).
Standard_EXPORT static Handle(Geom_Curve) ReadCurve (Standard_IStream& IS);
-
- Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& PR);
-
- Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const;
-
-
-
-
-protected:
-
-
-
-
private:
-
-
TColStd_IndexedMapOfTransient myMap;
- Handle(Message_ProgressIndicator) myProgress;
-
};
-
-
-
-
-
-
#endif // _GeomTools_CurveSet_HeaderFile
//purpose :
//=======================================================================
-void GeomTools_SurfaceSet::Write(Standard_OStream& OS)const
+void GeomTools_SurfaceSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress)const
{
std::streamsize prec = OS.precision(17);
Standard_Integer i, nbsurf = myMap.Extent();
OS << "Surfaces "<< nbsurf << "\n";
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "Surfaces", 0, nbsurf, 1);
+ Message_ProgressSentry PS(theProgress, "Surfaces", 0, nbsurf, 1);
for (i = 1; i <= nbsurf && PS.More(); i++, PS.Next()) {
PrintSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS,Standard_True);
}
//purpose :
//=======================================================================
-Handle(Geom_Surface) GeomTools_SurfaceSet::ReadSurface(Standard_IStream& IS)
+Handle(Geom_Surface) GeomTools_SurfaceSet::ReadSurface (Standard_IStream& IS)
{
Standard_Integer stype;
//purpose :
//=======================================================================
-void GeomTools_SurfaceSet::Read(Standard_IStream& IS)
+void GeomTools_SurfaceSet::Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
char buffer[255];
IS >> buffer;
Standard_Integer i, nbsurf;
IS >> nbsurf;
//OCC19559
- Handle(Message_ProgressIndicator) progress = GetProgress();
- Message_ProgressSentry PS(progress, "Surfaces", 0, nbsurf, 1);
+ Message_ProgressSentry PS(theProgress, "Surfaces", 0, nbsurf, 1);
for (i = 1; i <= nbsurf && PS.More(); i++, PS.Next()) {
Handle(Geom_Surface) S = GeomTools_SurfaceSet::ReadSurface (IS);
myMap.Add(S);
}
}
-
-//=======================================================================
-//function : GetProgress
-//purpose :
-//=======================================================================
-
-Handle(Message_ProgressIndicator) GeomTools_SurfaceSet::GetProgress() const
-{
- return myProgress;
-}
-
-//=======================================================================
-//function : SetProgress
-//purpose :
-//=======================================================================
-
-void GeomTools_SurfaceSet::SetProgress(const Handle(Message_ProgressIndicator)& PR)
-{
- myProgress = PR;
-}
-
-
-
//! 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;
+ Standard_EXPORT void Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
- Standard_EXPORT void Read (Standard_IStream& IS);
+ Standard_EXPORT void Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Dumps the surface on the stream, if compact is True
//! use the compact format that can be read back.
- Standard_EXPORT static void PrintSurface (const Handle(Geom_Surface)& S, Standard_OStream& OS, const Standard_Boolean compact = Standard_False);
+ Standard_EXPORT static void PrintSurface (const Handle(Geom_Surface)& S,
+ Standard_OStream& OS,
+ const Standard_Boolean compact = Standard_False);
//! Reads the surface from the stream. The surface is
//! assumed to have been written with the Print
//! method (compact = True).
Standard_EXPORT static Handle(Geom_Surface) ReadSurface (Standard_IStream& IS);
-
- Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& PR);
-
- Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const;
-
-
-
-
-protected:
-
-
-
-
private:
-
-
TColStd_IndexedMapOfTransient myMap;
- Handle(Message_ProgressIndicator) myProgress;
-
};
-
-
-
-
-
-
#endif // _GeomTools_SurfaceSet_HeaderFile
#include <Standard_Transient.hxx>
#include <Standard_IStream.hxx>
#include <Storage_Data.hxx>
+#include <Message_ProgressIndicator.hxx>
class PCDM_DriverError;
class CDM_Document;
Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() = 0;
//! retrieves the content of the file into a new Document.
- Standard_EXPORT virtual void Read (const TCollection_ExtendedString& aFileName, const Handle(CDM_Document)& aNewDocument, const Handle(CDM_Application)& anApplication) = 0;
+ Standard_EXPORT virtual void Read (const TCollection_ExtendedString& aFileName,
+ const Handle(CDM_Document)& aNewDocument,
+ const Handle(CDM_Application)& anApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) = 0;
Standard_EXPORT virtual void Read (Standard_IStream& theIStream,
- const Handle(Storage_Data)& theStorageData,
- const Handle(CDM_Document)& theDoc,
- const Handle(CDM_Application)& theApplication) = 0;
+ const Handle(Storage_Data)& theStorageData,
+ const Handle(CDM_Document)& theDoc,
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) = 0;
PCDM_ReaderStatus GetStatus() const;
PCDM_RS_UnknownDocument,
PCDM_RS_WrongResource,
PCDM_RS_ReaderException,
-PCDM_RS_NoModel
+PCDM_RS_NoModel,
+PCDM_RS_UserBreak
};
#endif // _PCDM_ReaderStatus_HeaderFile
-void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aFileName)
+void PCDM_StorageDriver::Write (const Handle(CDM_Document)& aDocument,
+ const TCollection_ExtendedString& aFileName,
+ const Handle(Message_ProgressIndicator) &/*theProgress*/)
{
Handle(Storage_Schema) theSchema = new Storage_Schema;
//function : Write
//purpose :
//=======================================================================
-void PCDM_StorageDriver::Write (const Handle(CDM_Document)& /*aDocument*/, Standard_OStream& /*theOStream*/)
+void PCDM_StorageDriver::Write (const Handle(CDM_Document)& /*aDocument*/,
+ Standard_OStream& /*theOStream*/,
+ const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
}
//!
//! by default Write will use Make method to build a persistent
//! document and the Schema method to write the persistent document.
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aFileName) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& aDocument,
+ const TCollection_ExtendedString& aFileName,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
//! Write <theDocument> to theOStream
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, Standard_OStream& theOStream) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT void SetFormat (const TCollection_ExtendedString& aformat);
PCDM_SS_Failure,
PCDM_SS_Doc_IsNull,
PCDM_SS_No_Obj,
-PCDM_SS_Info_Section_Error
+PCDM_SS_Info_Section_Error,
+PCDM_SS_UserBreak
};
#endif // _PCDM_StoreStatus_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
class PCDM_DriverError;
class CDM_Document;
class TCollection_ExtendedString;
class PCDM_Writer : public Standard_Transient
{
-
public:
-
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aFileName) = 0;
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& aDocument,
+ const TCollection_ExtendedString& aFileName,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) = 0;
//! Write <theDocument> to theOStream
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, Standard_OStream& theOStream) = 0;
-
-
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) = 0;
DEFINE_STANDARD_RTTIEXT(PCDM_Writer,Standard_Transient)
-protected:
-
-
-
-
-private:
-
-
-
-
};
-
-
-
-
-
-
#endif // _PCDM_Writer_HeaderFile
//=======================================================================
void StdLDrivers_DocumentRetrievalDriver::Read (const TCollection_ExtendedString& theFileName,
const Handle(CDM_Document)& theNewDocument,
- const Handle(CDM_Application)&)
+ const Handle(CDM_Application)& ,
+ const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
// Read header data and persistent document
Storage_HeaderData aHeaderData;
void StdLDrivers_DocumentRetrievalDriver::Read (Standard_IStream& /*theIStream*/,
const Handle(Storage_Data)& /*theStorageData*/,
const Handle(CDM_Document)& /*theDoc*/,
- const Handle(CDM_Application)& /*theApplication*/)
+ const Handle(CDM_Application)& /*theApplication*/,
+ const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
throw Standard_NotImplemented("Reading from stream is not supported by StdLDrivers_DocumentRetrievalDriver");
}
//! Retrieve the content of a file into a new document.
Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
const Handle(CDM_Document)& theNewDocument,
- const Handle(CDM_Application)& theApplication) Standard_OVERRIDE;
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
//! Override pure virtual method (raises exception Standard_NotImplemented)
Standard_EXPORT virtual void Read (Standard_IStream& theIStream,
const Handle(Storage_Data)& theStorageData,
const Handle(CDM_Document)& theDoc,
- const Handle(CDM_Application)& theApplication) Standard_OVERRIDE;
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT (StdLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
#include <TDocStd_Owner.hxx>
#include <TDocStd_PathParser.hxx>
+#include<Message_ProgressSentry.hxx>
+
IMPLEMENT_STANDARD_RTTIEXT(TDocStd_Application,CDF_Application)
// TDocStd_Owner attribute have pointer of closed TDocStd_Document
//purpose :
//=======================================================================
-PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
+PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,
+ Handle(TDocStd_Document)& aDoc,
+ const Handle(Message_ProgressIndicator)& theProgress)
+{
PCDM_ReaderStatus status = PCDM_RS_DriverFailure;
TDocStd_PathParser tool (path);
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
- file+=".";
- file+=tool.Extension();
- status = CanRetrieve(directory,file);
- if (status != PCDM_RS_OK) return status;
- try {
+ file += ".";
+ file += tool.Extension();
+ status = CanRetrieve(directory, file);
+
+ if (status != PCDM_RS_OK)
+ {
+ return status;
+ }
+
+ try
+ {
OCC_CATCH_SIGNALS
Handle(TDocStd_Document) D =
- Handle(TDocStd_Document)::DownCast(Retrieve(directory,file));
+ Handle(TDocStd_Document)::DownCast(Retrieve(directory, file, Standard_True, theProgress));
CDF_Application::Open(D);
aDoc = D;
}
- catch (Standard_Failure const& anException) {
-// status = GetRetrieveStatus();
- if (!MessageDriver().IsNull()) {
-// Standard_SStream aMsg;
-// aMsg << Standard_Failure::Caught() << std::endl;
-// std::cout << "TDocStd_Application::Open(): " << aMsg.rdbuf()->str() << std::endl;
+ catch (Standard_Failure const& anException)
+ {
+ // status = GetRetrieveStatus();
+ if (!MessageDriver().IsNull())
+ {
+ // Standard_SStream aMsg;
+ // aMsg << Standard_Failure::Caught() << std::endl;
+ // std::cout << "TDocStd_Application::Open(): " << aMsg.rdbuf()->str() << std::endl;
TCollection_ExtendedString aString (anException.GetMessageString());
MessageDriver()->Send(aString.ToExtString(), Message_Fail);
}
}
status = GetRetrieveStatus();
#ifdef OCCT_DEBUG
- std::cout<<"TDocStd_Application::Open(): The status = "<<status<<std::endl;
+ std::cout << "TDocStd_Application::Open(): The status = " << status << std::endl;
#endif
return status;
}
//function : Open
//purpose :
//=======================================================================
-PCDM_ReaderStatus TDocStd_Application::Open (Standard_IStream& theIStream, Handle(TDocStd_Document)& theDoc)
+PCDM_ReaderStatus TDocStd_Application::Open(Standard_IStream& theIStream,
+ Handle(TDocStd_Document)& theDoc,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
try
{
OCC_CATCH_SIGNALS
+ Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(Read(theIStream, theProgress));
- Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast (Read (theIStream));
if (!D.IsNull())
{
CDF_Application::Open(D);
theDoc = D;
}
}
+
catch (Standard_Failure const& anException)
{
if (!MessageDriver().IsNull())
MessageDriver()->Send (aFailureMessage.ToExtString(), Message_Fail);
}
}
-
return GetRetrieveStatus();
}
//purpose :
//=======================================================================
-PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,const TCollection_ExtendedString& path) {
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
+ const TCollection_ExtendedString& path,
+ const Handle(Message_ProgressIndicator)& theProgress)
+{
TDocStd_PathParser tool (path);
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
storer.SetName (file);
try {
OCC_CATCH_SIGNALS
- storer.Realize();
+ storer.Realize (theProgress);
}
catch (Standard_Failure const& anException) {
if (!MessageDriver().IsNull()) {
//function : SaveAs
//purpose :
//=======================================================================
-PCDM_StoreStatus TDocStd_Application::SaveAs (const Handle(TDocStd_Document)& theDoc, Standard_OStream& theOStream)
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& theDoc,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
try
{
}
aDocStorageDriver->SetFormat(theDoc->StorageFormat());
- aDocStorageDriver->Write(theDoc, theOStream);
+ aDocStorageDriver->Write(theDoc, theOStream, theProgress);
if (aDocStorageDriver->GetStoreStatus() == PCDM_SS_OK)
{
//purpose :
//=======================================================================
-PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
+PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
+ const Handle(Message_ProgressIndicator)& theProgress)
+{
PCDM_StoreStatus status = PCDM_SS_OK;
if (D->IsSaved()) {
CDF_Store storer (D);
try{
OCC_CATCH_SIGNALS
- storer.Realize();
+ storer.Realize (theProgress);
}
catch (Standard_Failure const& anException) {
if (!MessageDriver().IsNull()) {
PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
const TCollection_ExtendedString& path,
- TCollection_ExtendedString& theStatusMessage)
+ TCollection_ExtendedString& theStatusMessage,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
TDocStd_PathParser tool (path);
PCDM_StoreStatus aStatus = PCDM_SS_Failure;
storer.SetName (file);
try {
OCC_CATCH_SIGNALS
- storer.Realize();
+ storer.Realize (theProgress);
}
catch (Standard_Failure const& anException) {
if (!MessageDriver().IsNull()) {
PCDM_StoreStatus TDocStd_Application::SaveAs (const Handle(TDocStd_Document)& theDoc,
Standard_OStream& theOStream,
- TCollection_ExtendedString& theStatusMessage)
+ TCollection_ExtendedString& theStatusMessage,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
try
{
}
aDocStorageDriver->SetFormat(theDoc->StorageFormat());
- aDocStorageDriver->Write(theDoc, theOStream);
+ aDocStorageDriver->Write(theDoc, theOStream, theProgress);
if (aDocStorageDriver->GetStoreStatus() == PCDM_SS_OK)
{
//=======================================================================
PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
- TCollection_ExtendedString& theStatusMessage)
+ TCollection_ExtendedString& theStatusMessage,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
PCDM_StoreStatus status = PCDM_SS_OK;
if (D->IsSaved()) {
CDF_Store storer (D);
try {
OCC_CATCH_SIGNALS
- storer.Realize();
+ storer.Realize (theProgress);
}
catch (Standard_Failure const& anException) {
if (!MessageDriver().IsNull()) {
//! In order not to override a version of aDoc which
//! is already in memory, this method can be made
//! to depend on the value returned by IsInSession.
- Standard_EXPORT PCDM_ReaderStatus Open (const TCollection_ExtendedString& path, Handle(TDocStd_Document)& aDoc);
+ Standard_EXPORT PCDM_ReaderStatus Open (const TCollection_ExtendedString& path,
+ Handle(TDocStd_Document)& aDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Retrieves aDoc from standard SEEKABLE stream theIStream.
//! the stream should support SEEK fuctionality
- Standard_EXPORT PCDM_ReaderStatus Open (Standard_IStream& theIStream, Handle(TDocStd_Document)& theDoc);
+ Standard_EXPORT PCDM_ReaderStatus Open (Standard_IStream& theIStream, Handle(TDocStd_Document)& theDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Save the active document in the file <name> in the
//! path <path> ; o verwrites the file if it already exists.
- Standard_EXPORT PCDM_StoreStatus SaveAs (const Handle(TDocStd_Document)& aDoc, const TCollection_ExtendedString& path);
+ Standard_EXPORT PCDM_StoreStatus SaveAs (const Handle(TDocStd_Document)& aDoc,
+ const TCollection_ExtendedString& path,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Save theDoc to standard SEEKABLE stream theOStream.
//! the stream should support SEEK fuctionality
- Standard_EXPORT PCDM_StoreStatus SaveAs(const Handle(TDocStd_Document)& theDoc, Standard_OStream& theOStream);
+ Standard_EXPORT PCDM_StoreStatus SaveAs (const Handle(TDocStd_Document)& theDoc,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Save aDoc active document.
//! Exceptions:
//! Standard_NotImplemented if the document
//! was not retrieved in the applicative session by using Open.
- Standard_EXPORT PCDM_StoreStatus Save (const Handle(TDocStd_Document)& aDoc);
+ Standard_EXPORT PCDM_StoreStatus Save (const Handle(TDocStd_Document)& aDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Save the active document in the file <name> in the
//! path <path> . overwrite the file if it
//! already exist.
- Standard_EXPORT PCDM_StoreStatus SaveAs (const Handle(TDocStd_Document)& aDoc, const TCollection_ExtendedString& path, TCollection_ExtendedString& theStatusMessage);
+ Standard_EXPORT PCDM_StoreStatus SaveAs (const Handle(TDocStd_Document)& aDoc,
+ const TCollection_ExtendedString& path,
+ TCollection_ExtendedString& theStatusMessage,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Save theDoc TO standard SEEKABLE stream theOStream.
//! the stream should support SEEK fuctionality
- Standard_EXPORT PCDM_StoreStatus SaveAs(const Handle(TDocStd_Document)& theDoc, Standard_OStream& theOStream, TCollection_ExtendedString& theStatusMessage);
+ Standard_EXPORT PCDM_StoreStatus SaveAs (const Handle(TDocStd_Document)& theDoc,
+ Standard_OStream& theOStream,
+ TCollection_ExtendedString& theStatusMessage,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Save the document overwriting the previous file
- Standard_EXPORT PCDM_StoreStatus Save (const Handle(TDocStd_Document)& aDoc, TCollection_ExtendedString& theStatusMessage);
+ Standard_EXPORT PCDM_StoreStatus Save (const Handle(TDocStd_Document)& aDoc,
+ TCollection_ExtendedString& theStatusMessage,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Notification that is fired at each OpenTransaction event.
Standard_EXPORT virtual void OnOpenTransaction (const Handle(TDocStd_Document)& theDoc);
#include <GeomTools.hxx>
#include <gp_Ax3.hxx>
#include <gp_Vec.hxx>
-#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <Precision.hxx>
#include <Standard_OutOfRange.hxx>
//purpose :
//=======================================================================
-void TopTools_LocationSet::Write(Standard_OStream& OS) const
+void TopTools_LocationSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator) &theProgress) const
{
std::streamsize prec = OS.precision(15);
OS << "Locations " << nbLoc << "\n";
//OCC19559
- Message_ProgressSentry PS(GetProgress(), "Locations", 0, nbLoc, 1);
+ Message_ProgressSentry PS(theProgress, "Locations", 0, nbLoc, 1);
for (i = 1; i <= nbLoc && PS.More(); i++, PS.Next()) {
TopLoc_Location L = myMap(i);
//purpose :
//=======================================================================
-void TopTools_LocationSet::Read(Standard_IStream& IS)
+void TopTools_LocationSet::Read (Standard_IStream& IS, const Handle(Message_ProgressIndicator) &theProgress)
{
myMap.Clear();
gp_Trsf T;
//OCC19559
- Message_ProgressSentry PS(GetProgress(), "Locations", 0, nbLoc, 1);
+ Message_ProgressSentry PS(theProgress, "Locations", 0, nbLoc, 1);
for (i = 1; i <= nbLoc&& PS.More(); i++, PS.Next()) {
Standard_Integer typLoc;
IS >> typLoc;
if (!L.IsIdentity()) myMap.Add(L);
}
}
-
-//=======================================================================
-//function : GetProgress
-//purpose :
-//=======================================================================
-
-Handle(Message_ProgressIndicator) TopTools_LocationSet::GetProgress() const
-{
- return myProgress;
-}
-
-//=======================================================================
-//function : SetProgress
-//purpose :
-//=======================================================================
-
-void TopTools_LocationSet::SetProgress(const Handle(Message_ProgressIndicator)& PR)
-{
- myProgress = PR;
-}
-
-
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
-class Message_ProgressIndicator;
+#include <Message_ProgressIndicator.hxx>
+
class Standard_OutOfRange;
class TopLoc_Location;
//!
//! It can create Locations.
//!
-//! It can be write and read from a stream.
+//! It can be written and read from a stream.
class TopTools_LocationSet
{
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;
+ Standard_EXPORT void Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) const;
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
- Standard_EXPORT void Read (Standard_IStream& IS);
-
- Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& PR);
-
- Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const;
-
-
-
-
-protected:
-
-
-
-
+ Standard_EXPORT void Read (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
private:
-
-
TopLoc_IndexedMapOfLocation myMap;
- Handle(Message_ProgressIndicator) myProgress;
-
-
};
-
-
-
-
-
-
#endif // _TopTools_LocationSet_HeaderFile
//purpose :
//=======================================================================
-void TopTools_ShapeSet::Write(Standard_OStream& OS)
+void TopTools_ShapeSet::Write (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator) &theProgress)
{
// always use C locale for writing shapes
std::locale anOldLocale = OS.imbue (std::locale::classic());
//-----------------------------------------
// write the locations
//-----------------------------------------
-
- if ( !myProgress.IsNull() )
- myProgress->NewScope ( 10, "Locations" );
- myLocations.SetProgress(myProgress);
- myLocations.Write(OS);
- if ( !myProgress.IsNull() ) {
- myProgress->EndScope();
- myProgress->Show();
- }
-
- if (!myProgress.IsNull() && myProgress->UserBreak()) {
- OS << "Interrupted by the user\n";
- OS.imbue (anOldLocale);
+ Message_ProgressSentry aPS(theProgress, "Writing Shapes", 0, 3, 1);
+ myLocations.Write(OS, theProgress);
+ if (!aPS.More())
return;
- }
+ aPS.Next();
//-----------------------------------------
// write the geometry
//-----------------------------------------
- if ( !myProgress.IsNull() )
- myProgress->NewScope ( 75, "Geometry" );
- WriteGeometry(OS);
- if ( !myProgress.IsNull() ) {
- myProgress->EndScope();
- myProgress->Show();
- }
+ WriteGeometry(OS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
//-----------------------------------------
// write the shapes
// subshapes are written first
//OCC19559
- if ( !myProgress.IsNull() )
- myProgress->NewScope ( 15, "Shapes" );
- Message_ProgressSentry PS(myProgress, "Shapes", 0, nbShapes, 1);
- for (i = 1; i <= nbShapes && PS.More(); i++, PS.Next()) {
+ Message_ProgressSentry aPSinner(theProgress, "Shapes", 0, nbShapes, 1);
+ for (i = 1; i <= nbShapes && aPSinner.More(); i++, aPSinner.Next()) {
const TopoDS_Shape& S = myShapes(i);
// Type
OS << "\n";
OS.precision(prec);
OS.imbue (anOldLocale);
-
- PS.Relieve();
- if (!myProgress.IsNull()) {
- myProgress->EndScope();
- myProgress->Show();
- if (myProgress->UserBreak())
- OS << "Interrupted by the user\n";
- }
}
//=======================================================================
//purpose :
//=======================================================================
-void TopTools_ShapeSet::Read(Standard_IStream& IS)
+void TopTools_ShapeSet::Read (Standard_IStream& IS, const Handle(Message_ProgressIndicator) &theProgress)
{
// always use C locale for reading shapes
std::locale anOldLocale = IS.imbue (std::locale::classic());
//-----------------------------------------
//OCC19559
- if (!myProgress.IsNull() && myProgress->UserBreak()) {
- std::cout << "Interrupted by the user"<<std::endl;
- // on remet le LC_NUMERIC a la precedente valeur
- IS.imbue (anOldLocale);
- return;
- }
- if ( !myProgress.IsNull() )
- myProgress->NewScope ( 10, "Locations" );
- myLocations.SetProgress(myProgress);
- myLocations.Read(IS);
- if ( !myProgress.IsNull() ) {
- myProgress->EndScope();
- myProgress->Show();
- }
- //OCC19559
- if (!myProgress.IsNull() && myProgress->UserBreak()) {
- std::cout << "Interrupted by the user"<<std::endl;
- // on remet le LC_NUMERIC a la precedente valeur
- IS.imbue (anOldLocale);
+ Message_ProgressSentry aPS(theProgress, "Reading", 0, 10, 3);
+ myLocations.Read(IS, theProgress);
+ if (!aPS.More())
return;
- }
-
+ aPS.Next();
//-----------------------------------------
// read the geometry
//-----------------------------------------
- if ( !myProgress.IsNull() )
- myProgress->NewScope ( 75, "Geometry" );
- ReadGeometry(IS);
- if ( !myProgress.IsNull() ) {
- myProgress->EndScope();
- myProgress->Show();
- }
+ ReadGeometry(IS, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
//-----------------------------------------
// read the shapes
IS >> nbShapes;
//OCC19559
- if ( !myProgress.IsNull() )
- myProgress->NewScope ( 15, "Shapes" );
- Message_ProgressSentry PS(myProgress, "Shapes", 0, nbShapes, 1);
+
+ Message_ProgressSentry PS(theProgress, "Shapes", 0, nbShapes, 1);
for (i = 1; i <= nbShapes && PS.More(); i++, PS.Next() ) {
TopoDS_Shape S;
myShapes.Add(S);
}
- if (!myProgress.IsNull()) {
- myProgress->EndScope();
- myProgress->Show();
- }
-
// on remet le LC_NUMERIC a la precedente valeur
IS.imbue (anOldLocale);
}
//purpose :
//=======================================================================
-void TopTools_ShapeSet::Write(const TopoDS_Shape& S,
- Standard_OStream& OS)const
+void TopTools_ShapeSet::Write (const TopoDS_Shape& S, Standard_OStream& OS)const
{
if (S.IsNull()) OS << "*";
else {
//purpose :
//=======================================================================
-void TopTools_ShapeSet::Read(TopoDS_Shape& S,
- Standard_IStream& IS)const
+void TopTools_ShapeSet::Read (TopoDS_Shape& S, Standard_IStream& IS)const
{
Read(S,IS,myShapes.Extent());
}
//purpose :
//=======================================================================
-void TopTools_ShapeSet::WriteGeometry(Standard_OStream&)
+void TopTools_ShapeSet::WriteGeometry (Standard_OStream&,
+ const Handle(Message_ProgressIndicator) &)
{
}
//purpose :
//=======================================================================
-void TopTools_ShapeSet::ReadGeometry(Standard_IStream&)
+void TopTools_ShapeSet::ReadGeometry (Standard_IStream&,
+ const Handle(Message_ProgressIndicator) &)
{
}
//purpose :
//=======================================================================
-void TopTools_ShapeSet::WriteGeometry(const TopoDS_Shape&,
- Standard_OStream&)const
+void TopTools_ShapeSet::WriteGeometry (const TopoDS_Shape&, Standard_OStream&)const
{
}
//purpose :
//=======================================================================
-void TopTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum,
- Standard_IStream& ,
- TopoDS_Shape&)
+void TopTools_ShapeSet::ReadGeometry (const TopAbs_ShapeEnum, Standard_IStream&, TopoDS_Shape&)
{
}
{
return myShapes.Extent();
}
-
-//=======================================================================
-//function : GetProgress
-//purpose :
-//=======================================================================
-
-Handle(Message_ProgressIndicator) TopTools_ShapeSet::GetProgress() const
-{
- return myProgress;
-}
-
-//=======================================================================
-//function : SetProgress
-//purpose :
-//=======================================================================
-
-void TopTools_ShapeSet::SetProgress(const Handle(Message_ProgressIndicator)& PR)
-{
- myProgress = PR;
-}
-
-
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <TopAbs_ShapeEnum.hxx>
-class Message_ProgressIndicator;
+
class TopoDS_Shape;
class TopTools_LocationSet;
class TCollection_AsciiString;
//! A ShapeSets contains a Shape and all its
-//! sub-shapes and locations. It can be dump, write
+//! sub-shapes and locations. It can be dumped, written
//! and read.
//!
//! Methods to handle the geometry can be redefined.
DEFINE_STANDARD_ALLOC
-
//! Builds an empty ShapeSet.
Standard_EXPORT TopTools_ShapeSet();
//! Write the type.
//! calls WriteGeometry(S).
//! Write the flags, the subshapes.
- Standard_EXPORT virtual void Write (Standard_OStream& OS);
+ Standard_EXPORT virtual void Write
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Reads the content of me from the stream <IS>. me
//! is first cleared.
//! Reads the type.
//! calls ReadGeometry(T,S).
//! Reads the flag, the subshapes.
- Standard_EXPORT virtual void Read (Standard_IStream& IS);
+ Standard_EXPORT virtual void Read
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Dumps on <OS> the shape <S>. Dumps the
//! orientation, the index of the TShape and the index
//! Writes the geometry of me on the stream <OS> in a
//! format that can be read back by Read.
- Standard_EXPORT virtual void WriteGeometry (Standard_OStream& OS);
+ Standard_EXPORT virtual void WriteGeometry
+ (Standard_OStream& OS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Reads the geometry of me from the stream <IS>.
- Standard_EXPORT virtual void ReadGeometry (Standard_IStream& IS);
+ Standard_EXPORT virtual void ReadGeometry
+ (Standard_IStream& IS,
+ const Handle(Message_ProgressIndicator) &theProgress = NULL);
//! Dumps the geometry of <S> on the stream <OS>.
Standard_EXPORT virtual void DumpGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const;
//! Returns number of shapes read from file.
Standard_EXPORT Standard_Integer NbShapes() const;
-
- Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& PR);
-
- Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const;
-
-
-
-
-protected:
-
-
-
-
private:
-
//! Reads from <IS> a shape and returns it in S.
//! <NbShapes> is the number of tshapes in the set.
Standard_EXPORT void Read (TopoDS_Shape& S, Standard_IStream& IS, const Standard_Integer NbShapes) const;
-
TopTools_IndexedMapOfShape myShapes;
TopTools_LocationSet myLocations;
Standard_Integer myFormatNb;
- Handle(Message_ProgressIndicator) myProgress;
-
-
};
-
-
-
-
-
-
#endif // _TopTools_ShapeSet_HeaderFile
case PCDM_SS_Info_Section_Error:
di << "Storage error: section error\n";
break;
+ case PCDM_SS_UserBreak:
+ di << "Storage error: user break\n";
+ break;
}
return 0;
//=======================================================================
Handle(XmlMDF_ADriver) XmlDrivers_DocumentRetrievalDriver::ReadShapeSection(
const XmlObjMgt_Element& theElement,
- const Handle(Message_Messenger)& theMsgDriver)
+ const Handle(Message_Messenger)& theMsgDriver,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
if (myDrivers.IsNull()) myDrivers = AttributeDrivers (theMsgDriver);
Handle(XmlMDF_ADriver) aDriver;
{
Handle(XmlMNaming_NamedShapeDriver) aNamedShapeDriver =
Handle(XmlMNaming_NamedShapeDriver)::DownCast (aDriver);
- aNamedShapeDriver -> ReadShapeSection (theElement);
+ aNamedShapeDriver->ReadShapeSection (theElement, theProgress);
}
return aDriver;
}
class XmlDrivers_DocumentRetrievalDriver : public XmlLDrivers_DocumentRetrievalDriver
{
-
public:
-
Standard_EXPORT XmlDrivers_DocumentRetrievalDriver();
- Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers
+ (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
- Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection (const XmlObjMgt_Element& thePDoc, const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection
+ (const XmlObjMgt_Element& thePDoc,
+ const Handle(Message_Messenger)& theMsgDriver,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
- Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver) Standard_OVERRIDE;
-
-
+ Standard_EXPORT virtual void ShapeSetCleaning
+ (const Handle(XmlMDF_ADriver)& theDriver) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlDrivers_DocumentRetrievalDriver,XmlLDrivers_DocumentRetrievalDriver)
-protected:
-
-
-
-
-private:
-
-
-
-
};
-
-
-
-
-
-
#endif // _XmlDrivers_DocumentRetrievalDriver_HeaderFile
//purpose : Implements WriteShapeSection
//=======================================================================
Standard_Boolean XmlDrivers_DocumentStorageDriver::WriteShapeSection
- (XmlObjMgt_Element& theElement)
+ (XmlObjMgt_Element& theElement,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Standard_Boolean isShape(Standard_False);
Handle(XmlMDF_ADriver) aDriver;
{
Handle(XmlMNaming_NamedShapeDriver) aNamedShapeDriver =
Handle(XmlMNaming_NamedShapeDriver)::DownCast (aDriver);
- aNamedShapeDriver -> WriteShapeSection (theElement);
+ aNamedShapeDriver->WriteShapeSection (theElement, theProgress);
isShape = Standard_True;
}
return isShape;
class XmlDrivers_DocumentStorageDriver : public XmlLDrivers_DocumentStorageDriver
{
-
public:
+ Standard_EXPORT XmlDrivers_DocumentStorageDriver
+ (const TCollection_ExtendedString& theCopyright);
- Standard_EXPORT XmlDrivers_DocumentStorageDriver(const TCollection_ExtendedString& theCopyright);
-
- Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
+ Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers
+ (const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
- Standard_EXPORT virtual Standard_Boolean WriteShapeSection (XmlObjMgt_Element& thePDoc) Standard_OVERRIDE;
-
-
-
+ Standard_EXPORT virtual Standard_Boolean WriteShapeSection
+ (XmlObjMgt_Element& thePDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(XmlDrivers_DocumentStorageDriver,XmlLDrivers_DocumentStorageDriver)
-protected:
-
-
-
-
-private:
-
-
-
-
};
-
-
-
-
-
-
#endif // _XmlDrivers_DocumentStorageDriver_HeaderFile
#include <CDM_Application.hxx>
#include <CDM_Document.hxx>
#include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
#include <CDM_MetaData.hxx>
#include <LDOM_DocumentType.hxx>
#include <LDOM_LDOMImplementation.hxx>
//purpose :
//=======================================================================
void XmlLDrivers_DocumentRetrievalDriver::Read
- (const TCollection_ExtendedString& theFileName,
- const Handle(CDM_Document)& theNewDocument,
- const Handle(CDM_Application)& theApplication)
+ (const TCollection_ExtendedString& theFileName,
+ const Handle(CDM_Document)& theNewDocument,
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
myReaderStatus = PCDM_RS_DriverFailure;
myFileName = theFileName;
if (aFileStream.is_open() && aFileStream.good())
{
- Read (aFileStream, NULL, theNewDocument, theApplication);
+ Read (aFileStream, NULL, theNewDocument, theApplication, theProgress);
}
else
{
void XmlLDrivers_DocumentRetrievalDriver::Read (Standard_IStream& theIStream,
const Handle(Storage_Data)& /*theStorageData*/,
const Handle(CDM_Document)& theNewDocument,
- const Handle(CDM_Application)& theApplication)
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Handle(Message_Messenger) aMessageDriver = theApplication -> MessageDriver();
::take_time (~0, " +++++ Start RETRIEVE procedures ++++++", aMessageDriver);
const XmlObjMgt_Element anElement= aParser.getDocument().getDocumentElement();
::take_time (0, " +++++ Fin parsing XML : ", aMessageDriver);
- ReadFromDomDocument (anElement, theNewDocument, theApplication);
+ ReadFromDomDocument (anElement, theNewDocument, theApplication, theProgress);
}
//=======================================================================
void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
(const XmlObjMgt_Element& theElement,
const Handle(CDM_Document)& theNewDocument,
- const Handle(CDM_Application)& theApplication)
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
const Handle(Message_Messenger) aMsgDriver =
theApplication -> MessageDriver();
}
}
}
-
+ Message_ProgressSentry aPS(theProgress, "Reading document", 0, 2, 1);
// 2. Read Shapes section
if (myDrivers.IsNull()) myDrivers = AttributeDrivers (aMsgDriver);
- const Handle(XmlMDF_ADriver) aNSDriver = ReadShapeSection(theElement, aMsgDriver);
+ const Handle(XmlMDF_ADriver) aNSDriver = ReadShapeSection(theElement, aMsgDriver, theProgress);
if(!aNSDriver.IsNull())
::take_time (0, " +++++ Fin reading Shapes : ", aMsgDriver);
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return;
+ }
+ aPS.Next();
+
// 2.1. Keep document format version in RT
Handle(Storage_HeaderData) aHeaderData = new Storage_HeaderData();
aHeaderData->SetStorageVersion(aCurDocVersion);
TCollection_ExtendedString aMessage ("PasteDocument");
aMsgDriver ->Send (aMessage.ToExtString(), Message_Trace);
#endif
- if (!MakeDocument(theElement, theNewDocument))
+ if (!MakeDocument(theElement, theNewDocument, theProgress))
myReaderStatus = PCDM_RS_MakeFailure;
else
myReaderStatus = PCDM_RS_OK;
TCollection_ExtendedString anErrorString (anException.GetMessageString());
aMsgDriver ->Send (anErrorString.ToExtString(), Message_Fail);
}
+ if (!aPS.More())
+ {
+ myReaderStatus = PCDM_RS_UserBreak;
+ return;
+ }
+ aPS.Next();
// Wipe off the shapes written to the <shapes> section
ShapeSetCleaning(aNSDriver);
//=======================================================================
Standard_Boolean XmlLDrivers_DocumentRetrievalDriver::MakeDocument
(const XmlObjMgt_Element& theElement,
- const Handle(CDM_Document)& theTDoc)
+ const Handle(CDM_Document)& theTDoc,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Standard_Boolean aResult = Standard_False;
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
if (!TDOC.IsNull())
{
Handle(TDF_Data) aTDF = new TDF_Data();
- aResult = XmlMDF::FromTo (theElement, aTDF, myRelocTable, myDrivers);
+ aResult = XmlMDF::FromTo (theElement, aTDF, myRelocTable, myDrivers, theProgress);
if (aResult) {
TDOC->SetData (aTDF);
TDocStd_Owner::SetDocument (aTDF, TDOC);
//=======================================================================
Handle(XmlMDF_ADriver) XmlLDrivers_DocumentRetrievalDriver::ReadShapeSection(
const XmlObjMgt_Element& /*theElement*/,
- const Handle(Message_Messenger)& /*aMsgDriver*/)
+ const Handle(Message_Messenger)& /*aMsgDriver*/,
+ const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
Handle(XmlMDF_ADriver) aDriver;
//empty; to be redefined
Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE;
- Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName, const Handle(CDM_Document)& theNewDocument, const Handle(CDM_Application)& theApplication) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
+ const Handle(CDM_Document)& theNewDocument,
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual void Read (Standard_IStream& theIStream,
const Handle(Storage_Data)& theStorageData,
const Handle(CDM_Document)& theDoc,
- const Handle(CDM_Application)& theApplication) Standard_OVERRIDE;
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
protected:
- Standard_EXPORT virtual void ReadFromDomDocument (const XmlObjMgt_Element& theDomElement, const Handle(CDM_Document)& theNewDocument, const Handle(CDM_Application)& theApplication);
+ Standard_EXPORT virtual void ReadFromDomDocument (const XmlObjMgt_Element& theDomElement,
+ const Handle(CDM_Document)& theNewDocument,
+ const Handle(CDM_Application)& theApplication,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
- Standard_EXPORT virtual Standard_Boolean MakeDocument (const XmlObjMgt_Element& thePDoc, const Handle(CDM_Document)& theTDoc);
+ Standard_EXPORT virtual Standard_Boolean MakeDocument (const XmlObjMgt_Element& thePDoc,
+ const Handle(CDM_Document)& theTDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
- Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection (const XmlObjMgt_Element& thePDoc, const Handle(Message_Messenger)& theMsgDriver);
+ Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection
+ (const XmlObjMgt_Element& thePDoc,
+ const Handle(Message_Messenger)& theMsgDriver,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver);
#include <CDM_Document.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
#include <LDOM_DocumentType.hxx>
#include <LDOM_LDOMImplementation.hxx>
#include <LDOM_XmlWriter.hxx>
//purpose :
//=======================================================================
void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
- const TCollection_ExtendedString& theFileName)
+ const TCollection_ExtendedString& theFileName,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
myFileName = theFileName;
if (aFileStream.is_open() && aFileStream.good())
{
- Write (theDocument, aFileStream);
+ Write (theDocument, aFileStream, theProgress);
}
else
{
//function : Write
//purpose :
//=======================================================================
-Standard_EXPORT void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
- Standard_OStream& theOStream)
+void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Handle(Message_Messenger) aMessageDriver = theDocument->Application()->MessageDriver();
::take_time (~0, " +++++ Start STORAGE procedures ++++++", aMessageDriver);
// Fill the document with data
XmlObjMgt_Element anElement = aDOMDoc.getDocumentElement();
- if (WriteToDomDocument (theDocument, anElement) == Standard_False) {
+ if (WriteToDomDocument (theDocument, anElement, theProgress) == Standard_False) {
LDOM_XmlWriter aWriter;
aWriter.SetIndentation(1);
// data to XML, this method should be reimplemented avoiding step 3
//=======================================================================
-Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Handle(CDM_Document)& theDocument,
- XmlObjMgt_Element& theElement)
+Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
+ (const Handle(CDM_Document)& theDocument,
+ XmlObjMgt_Element& theElement,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
SetIsError(Standard_False);
Handle(Message_Messenger) aMessageDriver =
aCommentsElem.appendChild (aCItem);
XmlObjMgt::SetExtendedString (aCItem, aComments(i));
}
-
+ Message_ProgressSentry aPS(theProgress, "Writing", 0, 2, 1);
// 2a. Write document contents
Standard_Integer anObjNb = 0;
{
try
{
OCC_CATCH_SIGNALS
- anObjNb = MakeDocument(theDocument, theElement);
+ anObjNb = MakeDocument(theDocument, theElement, theProgress);
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return IsError();
+ }
+ aPS.Next();
}
catch (Standard_Failure const& anException)
{
myRelocTable.Clear();
// 4. Write Shapes section
- if(WriteShapeSection(theElement))
+ if (WriteShapeSection(theElement, theProgress))
::take_time (0, " +++ Fin DOM data for Shapes : ", aMessageDriver);
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return IsError();
+ }
+ aPS.Next();
return IsError();
}
//=======================================================================
Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument
(const Handle(CDM_Document)& theTDoc,
- XmlObjMgt_Element& theElement)
+ XmlObjMgt_Element& theElement,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
TCollection_ExtendedString aMessage;
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
if (myDrivers.IsNull()) myDrivers = AttributeDrivers (aMessageDriver);
// Retrieve from DOM_Document
- XmlMDF::FromTo (aTDF, theElement, myRelocTable, myDrivers);
+ XmlMDF::FromTo (aTDF, theElement, myRelocTable, myDrivers, theProgress);
#ifdef OCCT_DEBUGXML
aMessage = "First step successfull";
aMessageDriver -> Send (aMessage.ToExtString(), Message_Warning);
//purpose : defines WriteShapeSection
//=======================================================================
Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteShapeSection
- (XmlObjMgt_Element& /*theElement*/)
+ (XmlObjMgt_Element& /*theElement*/,
+ const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
// empty; should be redefined in subclasses
return Standard_False;
Standard_EXPORT XmlLDrivers_DocumentStorageDriver(const TCollection_ExtendedString& theCopyright);
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, const TCollection_ExtendedString& theFileName) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
+ const TCollection_ExtendedString& theFileName,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
- Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument, Standard_OStream& theOStream) Standard_OVERRIDE;
+ Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
protected:
- Standard_EXPORT virtual Standard_Boolean WriteToDomDocument (const Handle(CDM_Document)& theDocument, XmlObjMgt_Element& thePDoc);
+ Standard_EXPORT virtual Standard_Boolean WriteToDomDocument
+ (const Handle(CDM_Document)& theDocument,
+ XmlObjMgt_Element& thePDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
- Standard_EXPORT virtual Standard_Integer MakeDocument (const Handle(CDM_Document)& theDocument, XmlObjMgt_Element& thePDoc);
+ Standard_EXPORT virtual Standard_Integer MakeDocument
+ (const Handle(CDM_Document)& theDocument,
+ XmlObjMgt_Element& thePDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
- Standard_EXPORT void AddNamespace (const TCollection_AsciiString& thePrefix, const TCollection_AsciiString& theURI);
+ Standard_EXPORT void AddNamespace (const TCollection_AsciiString& thePrefix,
+ const TCollection_AsciiString& theURI);
- Standard_EXPORT virtual Standard_Boolean WriteShapeSection (XmlObjMgt_Element& thePDoc);
+ Standard_EXPORT virtual Standard_Boolean WriteShapeSection
+ (XmlObjMgt_Element& thePDoc,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
Handle(XmlMDF_ADriverTable) myDrivers;
XmlObjMgt_SRelocationTable myRelocTable;
#include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
#include <Storage_Schema.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TDF_Attribute.hxx>
void XmlMDF::FromTo (const Handle(TDF_Data)& theData,
XmlObjMgt_Element& theElement,
XmlObjMgt_SRelocationTable& theRelocTable,
- const Handle(XmlMDF_ADriverTable)& theDrivers)
+ const Handle(XmlMDF_ADriverTable)& theDrivers,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
UnsuppTypesMap().Clear();
// Standard_Integer count =
- WriteSubTree(theData->Root(), theElement, theRelocTable, theDrivers);
+ WriteSubTree(theData->Root(), theElement, theRelocTable, theDrivers, theProgress);
UnsuppTypesMap().Clear();
}
(const TDF_Label& theLabel,
XmlObjMgt_Element& theElement,
XmlObjMgt_SRelocationTable& theRelocTable,
- const Handle(XmlMDF_ADriverTable)& theDrivers)
+ const Handle(XmlMDF_ADriverTable)& theDrivers,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
XmlObjMgt_Document aDoc = theElement.getOwnerDocument();
// write sub-labels
TDF_ChildIterator itr2 (theLabel);
- for ( ; itr2.More(); itr2.Next())
+ Standard_Real child_count = 0;
+ for (; itr2.More(); ++child_count, itr2.Next())
+ {
+ }
+ itr2.Initialize(theLabel);
+ Message_ProgressSentry aPS(theProgress, "Writing sub-tree", 0, child_count, 1);
+ for ( ; itr2.More() && aPS.More(); itr2.Next(), aPS.Next())
{
const TDF_Label& aChildLab = itr2.Value();
- count += WriteSubTree(aChildLab, aLabElem, theRelocTable, theDrivers);
+ count += WriteSubTree(aChildLab, aLabElem, theRelocTable, theDrivers, theProgress);
}
if (count > 0 || TDocStd_Owner::GetDocument(theLabel.Data())->EmptyLabelsSavingMode())
// set attribute "tag"
aLabElem.setAttribute (::TagString(), theLabel.Tag());
}
-
return count;
}
Standard_Boolean XmlMDF::FromTo (const XmlObjMgt_Element& theElement,
Handle(TDF_Data)& theData,
XmlObjMgt_RRelocationTable& theRelocTable,
- const Handle(XmlMDF_ADriverTable)& theDrivers)
+ const Handle(XmlMDF_ADriverTable)& theDrivers,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
TDF_Label aRootLab = theData->Root();
XmlMDF_MapOfDriver aDriverMap;
if ( anElem.getNodeName().equals (::LabelString()) )
{
Standard_Integer subcount =
- ReadSubTree(anElem, aRootLab, theRelocTable, aDriverMap);
+ ReadSubTree(anElem, aRootLab, theRelocTable, aDriverMap, theProgress);
// check for error
if (subcount < 0)
return Standard_False;
Standard_Integer XmlMDF::ReadSubTree (const XmlObjMgt_Element& theElement,
const TDF_Label& theLabel,
XmlObjMgt_RRelocationTable& theRelocTable,
- const XmlMDF_MapOfDriver& theDriverMap)
+ const XmlMDF_MapOfDriver& theDriverMap,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
// Extraction of the driver subset.
Standard_Integer count = 0;
//XmlObjMgt_Element anElem = (const XmlObjMgt_Element &) theElement.getFirstChild();
LDOM_Node theNode = theElement.getFirstChild();
XmlObjMgt_Element anElem = (const XmlObjMgt_Element &) theNode;
+ Message_ProgressSentry aPS(theProgress, "Reading sub-tree", 0, 2, 1, true);
while ( !anElem.isNull() )
{
if ( anElem.getNodeType() == LDOM_Node::ELEMENT_NODE )
// read sub-tree
Standard_Integer subcount =
- ReadSubTree(anElem, aLab, theRelocTable, theDriverMap);
+ ReadSubTree(anElem, aLab, theRelocTable, theDriverMap, theProgress);
// check for error
if (subcount == -1)
return -1;
//anElem = (const XmlObjMgt_Element &) anElem.getNextSibling();
LDOM_Node theNode1 = anElem.getNextSibling();
anElem = (const XmlObjMgt_Element &) theNode1;
+
+ if (!aPS.More())
+ return -1;
+ aPS.Next();
}
// AfterRetrieval
#include <Standard_Boolean.hxx>
#include <XmlObjMgt_RRelocationTable.hxx>
#include <XmlMDF_MapOfDriver.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
class TDF_Data;
class XmlMDF_ADriverTable;
class TDF_Label;
DEFINE_STANDARD_ALLOC
-
//! Translates a transient <aSource> into a persistent
//! <aTarget>.
- Standard_EXPORT static void FromTo (const Handle(TDF_Data)& aSource, XmlObjMgt_Element& aTarget, XmlObjMgt_SRelocationTable& aReloc, const Handle(XmlMDF_ADriverTable)& aDrivers);
+ Standard_EXPORT static void FromTo (const Handle(TDF_Data)& aSource,
+ XmlObjMgt_Element& aTarget,
+ XmlObjMgt_SRelocationTable& aReloc,
+ const Handle(XmlMDF_ADriverTable)& aDrivers,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Translates a persistent <aSource> into a transient
//! <aTarget>.
//! Returns True if completed successfully (False on error)
- Standard_EXPORT static Standard_Boolean FromTo (const XmlObjMgt_Element& aSource, Handle(TDF_Data)& aTarget, XmlObjMgt_RRelocationTable& aReloc, const Handle(XmlMDF_ADriverTable)& aDrivers);
+ Standard_EXPORT static Standard_Boolean FromTo
+ (const XmlObjMgt_Element& aSource,
+ Handle(TDF_Data)& aTarget, XmlObjMgt_RRelocationTable& aReloc,
+ const Handle(XmlMDF_ADriverTable)& aDrivers,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Adds the attribute storage drivers to <aDriverSeq>.
- Standard_EXPORT static void AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, const Handle(Message_Messenger)& theMessageDriver);
-
-
-
-
-protected:
-
-
-
-
+ Standard_EXPORT static void AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
+ const Handle(Message_Messenger)& theMessageDriver);
private:
+ Standard_EXPORT static Standard_Integer WriteSubTree
+ (const TDF_Label& theLabel,
+ XmlObjMgt_Element& theElement,
+ XmlObjMgt_SRelocationTable& aReloc,
+ const Handle(XmlMDF_ADriverTable)& aDrivers,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
- Standard_EXPORT static Standard_Integer WriteSubTree (const TDF_Label& theLabel, XmlObjMgt_Element& theElement, XmlObjMgt_SRelocationTable& aReloc, const Handle(XmlMDF_ADriverTable)& aDrivers);
-
- Standard_EXPORT static Standard_Integer ReadSubTree (const XmlObjMgt_Element& theElement, const TDF_Label& theLabel, XmlObjMgt_RRelocationTable& aReloc, const XmlMDF_MapOfDriver& aDrivers);
+ Standard_EXPORT static Standard_Integer ReadSubTree
+ (const XmlObjMgt_Element& theElement,
+ const TDF_Label& theLabel,
+ XmlObjMgt_RRelocationTable& aReloc,
+ const XmlMDF_MapOfDriver& aDrivers,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
- Standard_EXPORT static void CreateDrvMap (const Handle(XmlMDF_ADriverTable)& aDriverTable, XmlMDF_MapOfDriver& anAsciiDriverMap);
-
-
+ Standard_EXPORT static void CreateDrvMap (const Handle(XmlMDF_ADriverTable)& aDriverTable,
+ XmlMDF_MapOfDriver& anAsciiDriverMap);
friend class XmlMDF_ADriver;
friend class XmlMDF_TagSourceDriver;
};
-
-
-
-
-
-
#endif // _XmlMDF_HeaderFile
#include <BRepTools.hxx>
#include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
#include <LDOM_OSStream.hxx>
#include <LDOM_Text.hxx>
#include <Standard_SStream.hxx>
//purpose :
//=======================================================================
-void XmlMNaming_NamedShapeDriver::ReadShapeSection
- (const XmlObjMgt_Element& theElement)
+void XmlMNaming_NamedShapeDriver::ReadShapeSection (const XmlObjMgt_Element& theElement,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
XmlObjMgt_Element anElement =
XmlObjMgt::FindChildByName (theElement, ::ShapesString());
LDOMString aData = aNode.getNodeValue();
std::stringstream aStream (std::string(aData.GetString()));
myShapeSet.Clear();
- myShapeSet.Read (aStream);
+ myShapeSet.Read (aStream, theProgress);
break;
}
}
//purpose :
//=======================================================================
-void XmlMNaming_NamedShapeDriver::WriteShapeSection
- (XmlObjMgt_Element& theElement)
+void XmlMNaming_NamedShapeDriver::WriteShapeSection (XmlObjMgt_Element& theElement,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
// Create "shapes" element and append it as child
XmlObjMgt_Document aDoc = theElement.getOwnerDocument();
LDOM_OSStream aStream (16 * 1024);
// ostrstream aStream;
// aStream.rdbuf() -> setbuf (0, 16380);
- myShapeSet.Write (aStream);
+ Message_ProgressSentry aPS(theProgress, "Writing shape section", 0, 2, 1);
+ myShapeSet.Write (aStream, theProgress);
+ if (!aPS.More())
+ return;
+ aPS.Next();
aStream << std::ends;
char * aStr = (char *)aStream.str();
LDOM_Text aText = aDoc.createTextNode (aStr);
// Clear the shape set to avoid appending to it on the next write
BRepTools_ShapeSet& aShapeSet = (BRepTools_ShapeSet&) myShapeSet;
aShapeSet.Clear();
+ if (!aPS.More())
+ return;
+ aPS.Next();
}
}
class XmlMNaming_NamedShapeDriver : public XmlMDF_ADriver
{
-
public:
-
Standard_EXPORT XmlMNaming_NamedShapeDriver(const Handle(Message_Messenger)& aMessageDriver);
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
- Standard_EXPORT virtual Standard_Boolean Paste (const XmlObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
+ Standard_EXPORT virtual Standard_Boolean Paste
+ (const XmlObjMgt_Persistent& theSource,
+ const Handle(TDF_Attribute)& theTarget,
+ XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
- Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, XmlObjMgt_Persistent& theTarget, XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
+ Standard_EXPORT virtual void Paste
+ (const Handle(TDF_Attribute)& theSource,
+ XmlObjMgt_Persistent& theTarget,
+ XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
//! Input the shapes from DOM element
- Standard_EXPORT void ReadShapeSection (const XmlObjMgt_Element& anElement);
+ Standard_EXPORT void ReadShapeSection (const XmlObjMgt_Element& anElement,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Output the shapes into DOM element
- Standard_EXPORT void WriteShapeSection (XmlObjMgt_Element& anElement);
+ Standard_EXPORT void WriteShapeSection (XmlObjMgt_Element& anElement,
+ const Handle(Message_ProgressIndicator)& theProgress = NULL);
//! Clear myShapeSet
Standard_EXPORT void Clear();
//! get the format of topology
TopTools_LocationSet& GetShapesLocations();
-
-
-
DEFINE_STANDARD_RTTIEXT(XmlMNaming_NamedShapeDriver,XmlMDF_ADriver)
-protected:
-
-
-
-
private:
-
BRepTools_ShapeSet myShapeSet;
-
};
#include <XmlMNaming_NamedShapeDriver.lxx>
-
-
-
-
#endif // _XmlMNaming_NamedShapeDriver_HeaderFile
006 bugs
007 driver
008 nam
+009 progress
--- /dev/null
+#INTERFACE CAF
+# Message_ProgressIndicator
+#
+# Testing attribute: TDocStd_Application
+#
+# Testing command: SaveAs
+#
+
+puts "caf009-A1"
+
+# Configurate XProgress
+XProgress -g +t -tcloutput
+
+# Create binary document
+NewDocument Doc BinOcaf
+
+# Fill the document by box
+box b 1 1 1
+SetShape Doc 0:1 b
+
+# SaveAs
+set output [SaveAs Doc ${imagedir}/testA1.cbf]
+
+# Close the document
+Close Doc
+
+# Test data
+set ctr { "0%" "Writing document" "Writing sub tree"
+ "Writing geometry" "Writing 2D curves" "Writing curves"
+ "Writing surfases" "Writing shapes" "100%" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: SaveAs command for binary files: Mismatch data on '$data'"
+ break;
+ }
+}
\ No newline at end of file
--- /dev/null
+#INTERFACE CAF
+# Message_ProgressIndicator
+#
+# Testing attribute: TDocStd_Application
+#
+# Testing command: SaveAs
+#
+
+puts "caf009-A2"
+
+# Configurate XProgress
+XProgress -g +t -tcloutput
+
+# Create binary document
+NewDocument Doc XmlOcaf
+
+# Fill the document by box
+box b 1 1 1
+
+SetShape Doc 0:1 b
+
+# SaveAs
+set output [SaveAs Doc ${imagedir}/testA2.xml]
+
+# Close the document
+Close Doc
+
+# Test data
+set ctr { "0%" "Writing sub-tree" "Writing shape section"
+ "Writing Shapes" "Writing geometry" "2D Curves" "3D Curves" "Surfaces" "100%" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: SaveAs command for xml files: Mismatch data on '$data'"
+ break
+ }
+}
\ No newline at end of file
--- /dev/null
+#INTERFACE CAF
+# Message_ProgressIndicator
+#
+# Testing attribute: TDocStd_Application
+#
+# Testing command: Open
+#
+
+puts "caf009-B1"
+
+set bDoc [CreateBinDoc]
+
+# Configurate XProgress
+XProgress -g +t -tcloutput
+
+# Open binary document
+if {${bDoc} == "" } {
+ puts "Error: Open command for binary files: Error, wrong path"
+ return
+}
+
+set output [Open ${bDoc} Doc]
+
+# Close the document
+Close Doc
+
+# Test data
+set ctr {"0%" "Reading data" "Reading geomentry" "Reading curves 2d"
+ "Reading surfaces" "Reading Shapes" "Reading sub tree" "100%" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: Open command for binary files: Mismatch data on '$data'"
+ break
+ }
+}
\ No newline at end of file
--- /dev/null
+#INTERFACE CAF
+# Message_ProgressIndicator
+#
+# Testing attribute: TDocStd_Application
+#
+# Testing command: Open
+#
+
+puts "caf009-B2"
+
+set xDoc [CreateXmlDoc]
+
+# Configurate XProgress
+XProgress -g +t -tcloutput
+
+# Open xml document
+if {${xDoc} == "" } {
+ puts "Error: Open command for xml files: wrong path"
+ return
+}
+
+set output [Open ${xDoc} Doc]
+
+# Close the document
+Close Doc
+
+# Test data
+set ctr {"0%" "Reading document" "Reading geometry" "3D Curves"
+ "Surfaces" "Shapes" "Reading sub-tree" "100%" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: Open command for xml files: Mismatch data on '$data'"
+ break
+ }
+}
\ No newline at end of file
--- /dev/null
+#INTERFACE CAF
+# Message_ProgressIndicator
+#
+# Testing attribute: TDocStd_Application
+#
+# Testing command: Save
+#
+
+puts "caf009-C1"
+
+set bDoc [CreateBinDoc]
+
+# Open document
+if {${bDoc} == "" } {
+ puts "Save command for binary files: Error, cannot open file"
+ return
+}
+Open ${bDoc} Doc
+
+# Fill the document by another box
+box b 1 1 1
+SetShape Doc 0:2 b
+
+# Configurate XProgress
+XProgress -g +t -tcloutput
+
+# Save
+set output [Save Doc]
+
+# Close the document
+Close Doc
+
+# Test data
+set ctr { "0%" "Writing document" "Writing sub tree"
+ "Writing geometry" "Writing 2D curves" "Writing curves"
+ "Writing surfases" "Writing shapes" "100%" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: Save command for binary files: Mismatch data on '$data'"
+ break
+ }
+}
\ No newline at end of file
--- /dev/null
+#INTERFACE CAF
+# Message_ProgressIndicator
+#
+# Testing attribute: TDocStd_Application
+#
+# Testing command: Save
+#
+
+puts "caf009-C2"
+
+set xDoc [CreateXmlDoc]
+
+# Open document
+if {${xDoc} == "" } {
+ puts "Save command for binary files: Error, cannot open file"
+ return
+}
+Open ${xDoc} Doc
+
+# Fill the document by another box
+box b 1 1 1
+SetShape Doc 0:2 b
+
+# Configurate XProgress
+XProgress -g +t -tcloutput
+
+# Save
+set output [Save Doc]
+
+# Close the document
+Close Doc
+
+# Test data
+set ctr { "0%" "Writing sub-tree" "Writing shape section"
+ "Writing Shapes" "Writing geometry" "2D Curves" "3D Curves" "Surfaces" "100%" }
+
+foreach data ${ctr} {
+ if ![regexp $data $output] {
+ puts "Error: Save command for xml files: Mismatch data on '$data'"
+ break
+ }
+}
--- /dev/null
+# begin
+
+if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
+ pload TOPTEST
+}
+
+proc CreateBinDoc {} {
+ global imagedir casename
+ # Create binary document
+ NewDocument DocBin BinOcaf
+
+ # Fill document by box
+ box b 1 1 1
+ SetShape DocBin 0:1 b
+
+ # Save document
+ set bDoc "${imagedir}/$casename.cbf"
+ SaveAs DocBin $bDoc
+
+ # Close document
+ Close DocBin
+ return $bDoc
+}
+
+proc CreateXmlDoc {} {
+ global imagedir casename
+ # Create xml document
+ NewDocument DocXml XmlOcaf
+
+ # Fill document by box
+ box b 1 1 1
+ SetShape DocXml 0:1 b
+
+ # Save document
+ set xDoc "${imagedir}/$casename.xml"
+ SaveAs DocXml $xDoc
+
+ # Close document
+ Close DocXml
+ return $xDoc
+}