0031353: TDocStd_Application does not have api to set progress indicator
authorakaftasev <akaftasev@opencascade.com>
Mon, 2 Mar 2020 12:29:34 +0000 (15:29 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 23 Jul 2020 13:08:23 +0000 (16:08 +0300)
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.

75 files changed:
src/BRepTools/BRepTools.cxx
src/BRepTools/BRepTools.hxx
src/BRepTools/BRepTools_ShapeSet.cxx
src/BRepTools/BRepTools_ShapeSet.hxx
src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx
src/BinDrivers/BinDrivers_DocumentRetrievalDriver.hxx
src/BinDrivers/BinDrivers_DocumentStorageDriver.cxx
src/BinDrivers/BinDrivers_DocumentStorageDriver.hxx
src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx
src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.hxx
src/BinLDrivers/BinLDrivers_DocumentSection.hxx
src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx
src/BinLDrivers/BinLDrivers_DocumentStorageDriver.hxx
src/BinMNaming/BinMNaming_NamedShapeDriver.cxx
src/BinMNaming/BinMNaming_NamedShapeDriver.hxx
src/BinTools/BinTools.cxx
src/BinTools/BinTools.hxx
src/BinTools/BinTools_Curve2dSet.cxx
src/BinTools/BinTools_Curve2dSet.hxx
src/BinTools/BinTools_CurveSet.cxx
src/BinTools/BinTools_CurveSet.hxx
src/BinTools/BinTools_ShapeSet.cxx
src/BinTools/BinTools_ShapeSet.hxx
src/BinTools/BinTools_SurfaceSet.cxx
src/BinTools/BinTools_SurfaceSet.hxx
src/CDF/CDF_Application.cxx
src/CDF/CDF_Application.hxx
src/CDF/CDF_Store.cxx
src/CDF/CDF_Store.hxx
src/CDF/CDF_StoreList.cxx
src/CDF/CDF_StoreList.hxx
src/CDM/CDM_Application.hxx
src/DBRep/DBRep.cxx
src/DDocStd/DDocStd_ApplicationCommands.cxx
src/GeomTools/GeomTools_Curve2dSet.cxx
src/GeomTools/GeomTools_Curve2dSet.hxx
src/GeomTools/GeomTools_CurveSet.cxx
src/GeomTools/GeomTools_CurveSet.hxx
src/GeomTools/GeomTools_SurfaceSet.cxx
src/GeomTools/GeomTools_SurfaceSet.hxx
src/PCDM/PCDM_Reader.hxx
src/PCDM/PCDM_ReaderStatus.hxx
src/PCDM/PCDM_StorageDriver.cxx
src/PCDM/PCDM_StorageDriver.hxx
src/PCDM/PCDM_StoreStatus.hxx
src/PCDM/PCDM_Writer.hxx
src/StdLDrivers/StdLDrivers_DocumentRetrievalDriver.cxx
src/StdLDrivers/StdLDrivers_DocumentRetrievalDriver.hxx
src/TDocStd/TDocStd_Application.cxx
src/TDocStd/TDocStd_Application.hxx
src/TopTools/TopTools_LocationSet.cxx
src/TopTools/TopTools_LocationSet.hxx
src/TopTools/TopTools_ShapeSet.cxx
src/TopTools/TopTools_ShapeSet.hxx
src/XDEDRAW/XDEDRAW.cxx
src/XmlDrivers/XmlDrivers_DocumentRetrievalDriver.cxx
src/XmlDrivers/XmlDrivers_DocumentRetrievalDriver.hxx
src/XmlDrivers/XmlDrivers_DocumentStorageDriver.cxx
src/XmlDrivers/XmlDrivers_DocumentStorageDriver.hxx
src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx
src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.hxx
src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx
src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.hxx
src/XmlMDF/XmlMDF.cxx
src/XmlMDF/XmlMDF.hxx
src/XmlMNaming/XmlMNaming_NamedShapeDriver.cxx
src/XmlMNaming/XmlMNaming_NamedShapeDriver.hxx
tests/caf/grids.list
tests/caf/progress/A1 [new file with mode: 0644]
tests/caf/progress/A2 [new file with mode: 0644]
tests/caf/progress/B1 [new file with mode: 0644]
tests/caf/progress/B2 [new file with mode: 0644]
tests/caf/progress/C1 [new file with mode: 0644]
tests/caf/progress/C2 [new file with mode: 0644]
tests/caf/progress/begin [new file with mode: 0644]

index 2af4d61..530602a 100644 (file)
@@ -36,7 +36,6 @@
 #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>
@@ -668,12 +667,11 @@ void  BRepTools::Dump(const TopoDS_Shape& Sh, Standard_OStream& S)
 //=======================================================================
 
 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);
 }
 
@@ -686,11 +684,10 @@ void  BRepTools::Write(const TopoDS_Shape& Sh, Standard_OStream& 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);
 }
 
@@ -701,7 +698,7 @@ void  BRepTools::Read(TopoDS_Shape& Sh,
 
 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);
@@ -713,11 +710,10 @@ Standard_Boolean  BRepTools::Write(const TopoDS_Shape& Sh,
     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);
@@ -739,7 +735,7 @@ Standard_Boolean  BRepTools::Write(const TopoDS_Shape& Sh,
 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);
@@ -747,8 +743,7 @@ Standard_Boolean BRepTools::Read(TopoDS_Shape& Sh,
   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;
index cbc23eb..6d62b95 100644 (file)
@@ -40,7 +40,6 @@ class TopoDS_Solid;
 class TopoDS_CompSolid;
 class TopoDS_Compound;
 class TopoDS_Shape;
-class Message_ProgressIndicator;
 class BRep_Builder;
 class BRepTools_WireExplorer;
 class BRepTools_Modification;
@@ -207,18 +206,24 @@ public:
   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
@@ -248,18 +253,8 @@ public:
   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;
@@ -273,10 +268,4 @@ friend class BRepTools_ReShape;
 
 };
 
-
-
-
-
-
-
 #endif // _BRepTools_HeaderFile
index 5c3c4c9..80e3cdd 100644 (file)
@@ -230,7 +230,7 @@ void BRepTools_ShapeSet::AddGeometry(const TopoDS_Shape& S)
 //purpose  : 
 //=======================================================================
 
-void  BRepTools_ShapeSet::DumpGeometry(Standard_OStream& OS)const 
+void  BRepTools_ShapeSet::DumpGeometry (Standard_OStream& OS)const 
 {
   myCurves2d.Dump(OS);
   myCurves.Dump(OS);
@@ -246,65 +246,32 @@ void  BRepTools_ShapeSet::DumpGeometry(Standard_OStream& OS)const
 //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);
 }
 
 
@@ -313,65 +280,35 @@ void  BRepTools_ShapeSet::WriteGeometry(Standard_OStream& OS)
 //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();
 }
 
 //=======================================================================
@@ -582,8 +519,7 @@ void  BRepTools_ShapeSet::DumpGeometry(const TopoDS_Shape& S,
 //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
   
@@ -814,9 +750,9 @@ static GeomAbs_Shape ReadRegularity(Standard_IStream& IS)
 //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
 
@@ -1232,13 +1168,13 @@ void BRepTools_ShapeSet::Check(const TopAbs_ShapeEnum T,
 //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 {
@@ -1297,7 +1233,8 @@ void BRepTools_ShapeSet::DumpPolygonOnTriangulation(Standard_OStream& OS)const
 //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;
@@ -1309,8 +1246,7 @@ void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
   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);
@@ -1351,13 +1287,13 @@ void BRepTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
 //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";
@@ -1429,7 +1365,8 @@ void BRepTools_ShapeSet::DumpPolygon3D(Standard_OStream& OS)const
 //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;
@@ -1441,8 +1378,7 @@ void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
   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;
@@ -1475,13 +1411,13 @@ void BRepTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
 //=======================================================================
 
 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";
@@ -1578,7 +1514,8 @@ void BRepTools_ShapeSet::DumpTriangulation(Standard_OStream& OS)const
 //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;
@@ -1594,8 +1531,7 @@ void BRepTools_ShapeSet::ReadTriangulation(Standard_IStream& IS)
 
   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;
index caf96de..dd370fa 100644 (file)
@@ -31,6 +31,7 @@
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
 #include <TopAbs_ShapeEnum.hxx>
+
 class BRep_Builder;
 class TopoDS_Shape;
 
@@ -48,11 +49,12 @@ public:
   
   //! 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;
@@ -65,21 +67,28 @@ public:
   
   //! 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
@@ -90,12 +99,17 @@ public:
   
   //! 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>.
@@ -103,12 +117,17 @@ public:
   
   //! 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>.
@@ -116,30 +135,24 @@ public:
   
   //! 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;
@@ -150,13 +163,6 @@ private:
   TColStd_IndexedMapOfTransient myNodes;
   Standard_Boolean myWithTriangles;
 
-
 };
 
-
-
-
-
-
-
 #endif // _BRepTools_ShapeSet_HeaderFile
index 95263f9..c17d3c9 100644 (file)
@@ -58,7 +58,8 @@ Handle(BinMDF_ADriverTable) BinDrivers_DocumentRetrievalDriver::AttributeDrivers
 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
@@ -69,7 +70,7 @@ void BinDrivers_DocumentRetrievalDriver::ReadShapeSection
       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
index 8d63cd8..47ce680 100644 (file)
@@ -42,11 +42,17 @@ public:
   //! 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;
@@ -54,22 +60,6 @@ public:
 
   DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentRetrievalDriver,BinLDrivers_DocumentRetrievalDriver)
 
-protected:
-
-
-
-
-private:
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _BinDrivers_DocumentRetrievalDriver_HeaderFile
index 3c1f9e5..799b1a8 100644 (file)
@@ -99,7 +99,8 @@ void BinDrivers_DocumentStorageDriver::SetWithTriangles (const Handle(Message_Me
 //=======================================================================
 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();
   
@@ -110,7 +111,7 @@ void BinDrivers_DocumentStorageDriver::WriteShapeSection
       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 :");
index 5cd7c3f..e976c3e 100644 (file)
@@ -39,10 +39,14 @@ public:
   //! 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;
@@ -53,22 +57,6 @@ public:
 
   DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentStorageDriver,BinLDrivers_DocumentStorageDriver)
 
-protected:
-
-
-
-
-private:
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _BinDrivers_DocumentStorageDriver_HeaderFile
index d87d836..14728b3 100644 (file)
@@ -42,6 +42,8 @@
 #include <TDF_Label.hxx>
 #include <TDocStd_Document.hxx>
 #include <TDocStd_Owner.hxx>
+#include <Message_ProgressSentry.hxx>
+
 
 IMPLEMENT_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver)
 
@@ -77,7 +79,8 @@ Handle(CDM_Document) BinLDrivers_DocumentRetrievalDriver::CreateDocument()
 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);
@@ -87,7 +90,12 @@ void BinLDrivers_DocumentRetrievalDriver::Read
     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
   {
@@ -108,7 +116,8 @@ void BinLDrivers_DocumentRetrievalDriver::Read
 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();
@@ -224,6 +233,8 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
   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;
@@ -246,10 +257,18 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
       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
@@ -287,7 +306,13 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
         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
@@ -300,8 +325,20 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
   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
@@ -331,17 +368,27 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
 
 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()) {
@@ -407,12 +454,19 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
 #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;
@@ -424,6 +478,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
     aTag = InverseInt (aTag);
 #endif
   }
+
   if (aTag != BinLDrivers_ENDLABEL) {
     // invalid end label marker
     myMsgDriver->Send (aMethStr + "error: invalid end label marker", Message_Fail);
@@ -465,8 +520,9 @@ void BinLDrivers_DocumentRetrievalDriver::ReadSection
 
 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()) {
index 0bbd004..5fb48ab 100644 (file)
@@ -59,12 +59,16 @@ public:
   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);
 
@@ -77,14 +81,24 @@ protected:
 
   
   //! 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);
index 0fa4888..c701634 100644 (file)
@@ -24,6 +24,8 @@
 #include <Standard_Boolean.hxx>
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
+#include <Message_ProgressIndicator.hxx>
+
 class TCollection_AsciiString;
 
 
index a01903d..0cf0878 100644 (file)
@@ -42,6 +42,7 @@
 #include <TDF_Label.hxx>
 #include <TDF_Tool.hxx>
 #include <TDocStd_Document.hxx>
+#include <Message_ProgressSentry.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(BinLDrivers_DocumentStorageDriver,PCDM_StorageDriver)
 
@@ -63,7 +64,8 @@ BinLDrivers_DocumentStorageDriver::BinLDrivers_DocumentStorageDriver ()
 
 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);
@@ -75,7 +77,7 @@ void BinLDrivers_DocumentStorageDriver::Write
 
   if (aFileStream.is_open() && aFileStream.good())
   {
-    Write (theDocument, aFileStream);
+    Write(theDocument, aFileStream, theProgress);
   }
   else
   {
@@ -89,7 +91,9 @@ void BinLDrivers_DocumentStorageDriver::Write
 //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();
@@ -136,12 +140,26 @@ void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDo
     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();
@@ -164,7 +182,13 @@ void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDo
       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
@@ -205,14 +229,15 @@ void BinLDrivers_DocumentStorageDriver::UnsupportedAttrMsg
 
 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
@@ -222,7 +247,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
 
   // 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
@@ -249,7 +274,12 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
     // 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
@@ -262,7 +292,14 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
   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
@@ -509,7 +546,8 @@ void BinLDrivers_DocumentStorageDriver::WriteSection
 //=======================================================================
 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);
index c95198f..1361d48 100644 (file)
@@ -52,10 +52,14 @@ public:
   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);
   
@@ -71,13 +75,19 @@ protected:
 
   
   //! 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;
@@ -85,7 +95,6 @@ protected:
 
 private:
 
-  
   Standard_EXPORT void FirstPass (const TDF_Label& theRoot);
   
   //! Returns true if <L> and its sub-labels do not contain
@@ -104,13 +113,6 @@ private:
   BinLDrivers_VectorOfDocumentSection mySections;
   TCollection_ExtendedString myFileName;
 
-
 };
 
-
-
-
-
-
-
 #endif // _BinLDrivers_DocumentStorageDriver_HeaderFile
index eeac367..09c19fe 100644 (file)
@@ -276,11 +276,12 @@ void BinMNaming_NamedShapeDriver::Paste (const Handle(TDF_Attribute)& theSource,
 //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();
 }
 
@@ -299,7 +300,8 @@ void BinMNaming_NamedShapeDriver::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
@@ -308,7 +310,7 @@ void BinMNaming_NamedShapeDriver::ReadShapeSection (Standard_IStream& theIS)
   theIS >> aSectionTitle;
   if(aSectionTitle.Length() > 0 && aSectionTitle == SHAPESET) {
     myShapeSet.Clear();
-    myShapeSet.Read (theIS);
+    myShapeSet.Read (theIS, theProgress);
     SetFormatNb(myShapeSet.FormatNb());
   }
   else
index 06368b0..0cd7285 100644 (file)
@@ -52,10 +52,12 @@ public:
   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();
index 9530abc..53aa4f6 100644 (file)
@@ -17,6 +17,7 @@
 #include <BinTools.hxx>
 #include <BinTools_ShapeSet.hxx>
 #include <FSD_FileHeader.hxx>
+#include <Message_ProgressIndicator.hxx>
 #include <OSD_OpenFile.hxx>
 #include <Storage_StreamTypeMismatchError.hxx>
 
@@ -174,12 +175,13 @@ Standard_IStream& BinTools::GetBool(Standard_IStream& IS, Standard_Boolean& aVal
 //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);
 }
 
@@ -188,10 +190,11 @@ void BinTools::Write (const TopoDS_Shape& theShape, Standard_OStream& 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());
 }
 
@@ -200,7 +203,8 @@ void BinTools::Read (TopoDS_Shape& theShape, Standard_IStream& theStream)
 //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);
@@ -208,7 +212,7 @@ Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_C
   if (!aStream.good())
     return Standard_False;
 
-  Write (theShape, aStream);
+  Write (theShape, aStream, theProgress);
   aStream.close();
   return aStream.good();
 }
@@ -218,7 +222,8 @@ Standard_Boolean BinTools::Write (const TopoDS_Shape& theShape, const Standard_C
 //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);
@@ -226,6 +231,6 @@ Standard_Boolean BinTools::Read (TopoDS_Shape& theShape, const Standard_CString
     return Standard_False;
 
   Standard_IStream aStream (&aBuf);
-  Read (theShape, aStream);
+  Read (theShape, aStream, theProgress);
   return aStream.good();
 }
index 78b5c0c..c1a1ca0 100644 (file)
@@ -26,6 +26,7 @@
 #include <Standard_ExtCharacter.hxx>
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
+#include <Message_ProgressIndicator.hxx>
 
 class TopoDS_Shape;
 class BinTools_ShapeSet;
@@ -63,16 +64,22 @@ public:
   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:
 
index 6454d82..faed5c5 100644 (file)
@@ -38,6 +38,7 @@
 #include <TColgp_Array1OfPnt2d.hxx>
 #include <TColStd_Array1OfInteger.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <Message_ProgressSentry.hxx>
 
 #define LINE      1
 #define CIRCLE    2
@@ -345,11 +346,13 @@ void BinTools_Curve2dSet::WriteCurve2d(const Handle(Geom2d_Curve)& C,
 //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);
   }
 }
@@ -692,7 +695,8 @@ Standard_IStream& BinTools_Curve2dSet::ReadCurve2d(Standard_IStream& IS,
 //purpose  : 
 //=======================================================================
 
-void  BinTools_Curve2dSet::Read(Standard_IStream& IS)
+void  BinTools_Curve2dSet::Read (Standard_IStream& IS,
+                                 const Handle(Message_ProgressIndicator)& theProgress)
 {
   char buffer[255];
 
@@ -710,12 +714,10 @@ void  BinTools_Curve2dSet::Read(Standard_IStream& IS)
   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);
   }
 }
-
-
-
index 815975a..b977d72 100644 (file)
@@ -24,6 +24,9 @@
 #include <Standard_Integer.hxx>
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
 class Standard_OutOfRange;
 class Geom2d_Curve;
 
@@ -57,42 +60,26 @@ 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 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
index d33b92c..a43774c 100644 (file)
@@ -37,6 +37,7 @@
 #include <TColgp_Array1OfPnt.hxx>
 #include <TColStd_Array1OfInteger.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <Message_ProgressSentry.hxx>
 
 #define LINE      1
 #define CIRCLE    2
@@ -358,11 +359,13 @@ void BinTools_CurveSet::WriteCurve(const Handle(Geom_Curve)& C,
 //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);
   }
 }
@@ -711,7 +714,8 @@ Standard_IStream& BinTools_CurveSet::ReadCurve(Standard_IStream& IS,
 //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;
@@ -729,11 +733,11 @@ void  BinTools_CurveSet::Read(Standard_IStream& IS)
   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);
   }
 }
-
-
index a2ccb07..0c02011 100644 (file)
@@ -24,6 +24,9 @@
 #include <Standard_Integer.hxx>
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
 class Standard_OutOfRange;
 class Geom_Curve;
 
@@ -54,11 +57,13 @@ 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 Read (Standard_IStream& IS,
+                             const Handle(Message_ProgressIndicator) &theProgress = NULL);
   
   //! Dumps the curve on the stream in binary format
   //! that can be read back.
@@ -69,28 +74,10 @@ public:
   //! method
   Standard_EXPORT static Standard_IStream& ReadCurve (Standard_IStream& IS, Handle(Geom_Curve)& C);
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-
-
   TColStd_IndexedMapOfTransient myMap;
 
-
 };
 
-
-
-
-
-
-
 #endif // _BinTools_CurveSet_HeaderFile
index 35bc4ea..84f8847 100644 (file)
@@ -51,6 +51,7 @@
 #include <TopoDS_Iterator.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <Message_ProgressSentry.hxx>
 
 #include <string.h>
 //#define MDTV_DEB 1
@@ -294,14 +295,34 @@ void BinTools_ShapeSet::AddGeometry(const TopoDS_Shape& S)
 //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();
 }
 
 //=======================================================================
@@ -309,7 +330,8 @@ void  BinTools_ShapeSet::WriteGeometry(Standard_OStream& OS)const
 //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
@@ -330,18 +352,23 @@ void  BinTools_ShapeSet::Write(Standard_OStream& OS)const
   // 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);
     
@@ -369,7 +396,6 @@ void  BinTools_ShapeSet::Write(Standard_OStream& OS)const
     }
     Write(TopoDS_Shape(),OS); // Null shape to end the list
   }
-  
 }
 
 //=======================================================================
@@ -377,7 +403,8 @@ void  BinTools_ShapeSet::Write(Standard_OStream& OS)const
 //purpose  : 
 //=======================================================================
 
-void  BinTools_ShapeSet::Read(Standard_IStream& IS)
+void  BinTools_ShapeSet::Read (Standard_IStream& IS,
+                               const Handle(Message_ProgressIndicator)& theProgress)
 {
 
   Clear();
@@ -413,9 +440,11 @@ void  BinTools_ShapeSet::Read(Standard_IStream& IS)
   //-----------------------------------------
   // 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
   //-----------------------------------------
@@ -428,12 +457,11 @@ void  BinTools_ShapeSet::Read(Standard_IStream& IS)
     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;
     
@@ -487,7 +515,8 @@ void  BinTools_ShapeSet::Read(Standard_IStream& IS)
 //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()) 
 
@@ -505,8 +534,8 @@ void  BinTools_ShapeSet::Write(const TopoDS_Shape& S, Standard_OStream& OS)const
 //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;
@@ -531,14 +560,34 @@ void  BinTools_ShapeSet::Read(TopoDS_Shape& S, Standard_IStream& IS,
 //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();
 }
 
 //=======================================================================
@@ -546,7 +595,7 @@ void  BinTools_ShapeSet::ReadGeometry(Standard_IStream& IS)
 //purpose  : 
 //=======================================================================
 
-void  BinTools_ShapeSet::WriteGeometry(const TopoDS_Shape& S, 
+void  BinTools_ShapeSet::WriteGeometry (const TopoDS_Shape& S, 
                                         Standard_OStream&   OS)const 
 {
 // Write the geometry
@@ -1178,14 +1227,17 @@ void  BinTools_ShapeSet::AddShapes(TopoDS_Shape&       S1,
 //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();
@@ -1225,7 +1277,9 @@ void BinTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS) const
 //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;
@@ -1240,7 +1294,8 @@ void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
   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);
@@ -1281,14 +1336,16 @@ void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
 //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());
@@ -1328,7 +1385,8 @@ void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS)const
 //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;
@@ -1347,7 +1405,8 @@ void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
   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;
@@ -1392,7 +1451,8 @@ void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
 //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";
@@ -1400,7 +1460,8 @@ void BinTools_ShapeSet::WriteTriangulation(Standard_OStream& OS) const
   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();
@@ -1453,7 +1514,8 @@ void BinTools_ShapeSet::WriteTriangulation(Standard_OStream& OS) const
 //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;
@@ -1469,7 +1531,8 @@ void BinTools_ShapeSet::ReadTriangulation (Standard_IStream& IS)
   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;
index 6ad63f1..7b84da4 100644 (file)
@@ -32,6 +32,7 @@
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
 #include <TopAbs_ShapeEnum.hxx>
+
 class TopoDS_Shape;
 class BinTools_LocationSet;
 
@@ -98,7 +99,9 @@ public:
   //! 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.
@@ -112,7 +115,9 @@ public:
   //! 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
@@ -121,14 +126,20 @@ public:
   
   //! 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.
@@ -146,30 +157,42 @@ public:
   
   //! 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:
 
index c615a4b..3edec2c 100644 (file)
@@ -42,6 +42,7 @@
 #include <TColStd_Array1OfInteger.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColStd_Array2OfReal.hxx>
+#include <Message_ProgressSentry.hxx>
 
 #define PLANE           1
 #define CYLINDER        2
@@ -436,12 +437,14 @@ void BinTools_SurfaceSet::WriteSurface(const Handle(Geom_Surface)& S,
 //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);
   }
 
@@ -873,7 +876,8 @@ Standard_IStream& BinTools_SurfaceSet::ReadSurface(Standard_IStream& IS,
 //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;
@@ -890,10 +894,10 @@ void  BinTools_SurfaceSet::Read(Standard_IStream& IS)
   Handle(Geom_Surface) S;
   Standard_Integer i, nbsurf;
   IS >> nbsurf;
+  Message_ProgressSentry aPS(theProgress, "Reading surfaces", 0, nbsurf, 1);
   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);
   }
 }
-
index c7bf825..0fe32d9 100644 (file)
@@ -24,6 +24,9 @@
 #include <Standard_Integer.hxx>
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
 class Standard_OutOfRange;
 class Geom_Surface;
 
@@ -54,11 +57,13 @@ public:
   
   //! Writes the content of  me  on the stream <OS> in
   //! binary format that can be read back by Read.
-  Standard_EXPORT void Write (Standard_OStream& OS) const;
+  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.
@@ -69,28 +74,10 @@ public:
   //! method.
   Standard_EXPORT static Standard_IStream& ReadSurface (Standard_IStream& IS, Handle(Geom_Surface)& S);
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
-
-
   TColStd_IndexedMapOfTransient myMap;
 
-
 };
 
-
-
-
-
-
-
 #endif // _BinTools_SurfaceSet_HeaderFile
index 6f48e01..ec967fe 100644 (file)
@@ -33,6 +33,7 @@
 #include <Standard_NoSuchObject.hxx>
 #include <Standard_ProgramError.hxx>
 #include <UTL.hxx>
+#include <Message_ProgressSentry.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(CDF_Application,CDM_Application)
 
@@ -84,21 +85,24 @@ void CDF_Application::Close(const Handle(CDM_Document)& aDocument) {
 //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; 
   
@@ -108,7 +112,8 @@ Handle(CDM_Document)  CDF_Application::Retrieve(const TCollection_ExtendedString
     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);
@@ -204,15 +209,20 @@ Standard_Boolean CDF_Application::SetDefaultFolder(const Standard_ExtString aFol
 //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;
@@ -265,7 +275,7 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
 
     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();
@@ -320,7 +330,8 @@ CDF_TypeOfActivation CDF_Application::TypeOfActivation(const Handle(CDM_MetaData
 //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;
@@ -358,8 +369,7 @@ Handle(CDM_Document) CDF_Application::Read (Standard_IStream& theIStream)
   try
   {
     OCC_CATCH_SIGNALS
-  
-    aReader->Read (theIStream, dData, aDoc, this);
+    aReader->Read (theIStream, dData, aDoc, this, theProgress);
   }
   catch (Standard_Failure const& anException)
   {
index 60ed7e7..2b599c5 100644 (file)
@@ -87,7 +87,11 @@ public:
   //!
   //! 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
@@ -103,18 +107,28 @@ public:
   //! 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.
   //!
@@ -147,7 +161,8 @@ public:
   //! 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();
   
@@ -158,15 +173,6 @@ friend class CDF_Session;
 
   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:
 
   
@@ -183,11 +189,19 @@ 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;
   
@@ -195,6 +209,14 @@ private:
   
   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;
 };
index e47631a..fe91752 100644 (file)
@@ -145,11 +145,12 @@ CDF_StoreSetNameStatus CDF_Store::SetName(const Standard_ExtString aName)
   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 {
index 537fe67..66e03a3 100644 (file)
@@ -28,6 +28,9 @@
 #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;
@@ -85,7 +88,7 @@ public:
   
   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;
index 91149ae..24d3997 100644 (file)
@@ -74,8 +74,10 @@ void CDF_StoreList::Next() {
 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;
@@ -112,7 +114,7 @@ PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollect
           }
           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);
index 47fb2a9..fd8d004 100644 (file)
@@ -26,6 +26,8 @@
 #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;
@@ -48,7 +50,9 @@ public:
   
   //! 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();
   
index f23f0cb..d936faf 100644 (file)
@@ -26,6 +26,7 @@
 #include <Standard_ExtString.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
+#include <Message_ProgressIndicator.hxx>
 
 class CDM_Reference;
 class CDM_MetaData;
@@ -88,7 +89,10 @@ protected:
 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;
index 214ba8b..230bdbe 100644 (file)
@@ -1584,10 +1584,8 @@ static void ssave(const Handle(Draw_Drawable3D)&d, std::ostream& OS)
     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);
@@ -1597,9 +1595,7 @@ static Handle(Draw_Drawable3D) srestore (std::istream& IS)
 {
   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;
index 955338a..ba16f2c 100644 (file)
@@ -17,6 +17,7 @@
 #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>
@@ -126,8 +127,8 @@ static Standard_Integer DDocStd_NewDocument (Draw_Interpretor& di,
 //=======================================================================
 
 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]); 
@@ -151,53 +152,61 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
       }
     }
 
+    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;
 }
@@ -208,8 +217,8 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
 //=======================================================================
 
 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;    
@@ -219,7 +228,9 @@ static Standard_Integer DDocStd_Save (Draw_Interpretor& di,
       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";
@@ -255,15 +266,17 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
         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 ) {
@@ -292,6 +305,10 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
         di << "Error saving document: Write info section failure\n" ;
         break;
                                        }
+      case PCDM_SS_UserBreak: {
+        di << "Error saving document: User break \n" ;
+        break;
+      }
       default:
         break;
       }
index 8115514..9486d67 100644 (file)
@@ -496,15 +496,15 @@ void  GeomTools_Curve2dSet::Dump(Standard_OStream& OS)const
 //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);
   }
@@ -840,7 +840,8 @@ Handle(Geom2d_Curve) GeomTools_Curve2dSet::ReadCurve2d(Standard_IStream& IS)
 //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;
@@ -852,32 +853,9 @@ void  GeomTools_Curve2dSet::Read(Standard_IStream& IS)
   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;
-}
-
-
index 8111f6d..730317c 100644 (file)
@@ -60,48 +60,29 @@ 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 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
index 9588e8c..90cbbd7 100644 (file)
@@ -513,15 +513,15 @@ void  GeomTools_CurveSet::Dump(Standard_OStream& OS)const
 //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);
   }
@@ -861,7 +861,8 @@ Handle(Geom_Curve) GeomTools_CurveSet::ReadCurve (Standard_IStream& IS)
 //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;
@@ -873,32 +874,9 @@ void  GeomTools_CurveSet::Read(Standard_IStream& IS)
   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;
-}
-
-
index fbe59da..7474294 100644 (file)
@@ -60,48 +60,29 @@ 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 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
index 1aaad47..bb7d2ae 100644 (file)
@@ -633,15 +633,15 @@ void  GeomTools_SurfaceSet::Dump(Standard_OStream& OS)const
 //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);
   }
@@ -930,7 +930,7 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
 //purpose  : 
 //=======================================================================
 
-Handle(Geom_Surface) GeomTools_SurfaceSet::ReadSurface(Standard_IStream& IS)
+Handle(Geom_Surface) GeomTools_SurfaceSet::ReadSurface (Standard_IStream& IS)
 {
   Standard_Integer stype;
 
@@ -1052,7 +1052,8 @@ Handle(Geom_Surface) GeomTools_SurfaceSet::ReadSurface(Standard_IStream& IS)
 //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;
@@ -1064,33 +1065,9 @@ void  GeomTools_SurfaceSet::Read(Standard_IStream& IS)
   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;
-}
-
-
-
index 83639fa..4877427 100644 (file)
@@ -60,48 +60,29 @@ 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 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
index 85b39e5..d52178d 100644 (file)
@@ -24,6 +24,7 @@
 #include <Standard_Transient.hxx>
 #include <Standard_IStream.hxx>
 #include <Storage_Data.hxx>
+#include <Message_ProgressIndicator.hxx>
 
 class PCDM_DriverError;
 class CDM_Document;
@@ -45,12 +46,16 @@ public:
   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;
 
index d9ee495..5e04801 100644 (file)
@@ -41,7 +41,8 @@ PCDM_RS_AlreadyRetrieved,
 PCDM_RS_UnknownDocument,
 PCDM_RS_WrongResource,
 PCDM_RS_ReaderException,
-PCDM_RS_NoModel
+PCDM_RS_NoModel,
+PCDM_RS_UserBreak
 };
 
 #endif // _PCDM_ReaderStatus_HeaderFile
index c44e0c0..8aeb79d 100644 (file)
@@ -42,7 +42,9 @@ IMPLEMENT_STANDARD_RTTIEXT(PCDM_StorageDriver,PCDM_Writer)
 
 
 
-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;
 
@@ -105,7 +107,9 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
 //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*/)
 {
   
 }
index 6e21f78..5c7e9da 100644 (file)
@@ -70,10 +70,14 @@ public:
   //!
   //! 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);
   
index 08ef129..cd0e563 100644 (file)
@@ -26,7 +26,8 @@ PCDM_SS_WriteFailure,
 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
index 8de0caa..e224303 100644 (file)
@@ -21,6 +21,9 @@
 #include <Standard_Type.hxx>
 
 #include <Standard_Transient.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
 class PCDM_DriverError;
 class CDM_Document;
 class TCollection_ExtendedString;
@@ -32,35 +35,19 @@ DEFINE_STANDARD_HANDLE(PCDM_Writer, Standard_Transient)
 
 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
index 3b2fabe..33231a1 100644 (file)
@@ -52,7 +52,8 @@ Handle(CDM_Document) StdLDrivers_DocumentRetrievalDriver::CreateDocument()
 //=======================================================================
 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;
@@ -227,7 +228,8 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
 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");
 }
index b5f86e7..ea53890 100644 (file)
@@ -30,13 +30,15 @@ public:
   //! 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)
 
index ee2f1ff..142c98e 100644 (file)
@@ -35,6 +35,8 @@
 #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
@@ -281,35 +283,46 @@ Standard_Integer TDocStd_Application::IsInSession (const TCollection_ExtendedStr
 //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;
 }
@@ -318,19 +331,22 @@ PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& pa
 //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())
@@ -339,7 +355,6 @@ PCDM_ReaderStatus TDocStd_Application::Open (Standard_IStream& theIStream, Handl
       MessageDriver()->Send (aFailureMessage.ToExtString(), Message_Fail);
     }
   }
-
   return GetRetrieveStatus();
 }
 
@@ -348,7 +363,10 @@ PCDM_ReaderStatus TDocStd_Application::Open (Standard_IStream& theIStream, Handl
 //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();
@@ -368,7 +386,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,c
   storer.SetName (file);
   try {
     OCC_CATCH_SIGNALS
-    storer.Realize();
+    storer.Realize (theProgress);
   }
   catch (Standard_Failure const& anException) {
     if (!MessageDriver().IsNull()) {
@@ -388,7 +406,9 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,c
 //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
   {
@@ -400,7 +420,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs (const Handle(TDocStd_Document)& th
     }
 
     aDocStorageDriver->SetFormat(theDoc->StorageFormat());
-    aDocStorageDriver->Write(theDoc, theOStream);
+    aDocStorageDriver->Write(theDoc, theOStream, theProgress);
 
     if (aDocStorageDriver->GetStoreStatus() == PCDM_SS_OK)
     {
@@ -425,13 +445,15 @@ PCDM_StoreStatus TDocStd_Application::SaveAs (const Handle(TDocStd_Document)& th
 //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()) {
@@ -462,7 +484,8 @@ PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
 
 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;
@@ -476,7 +499,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
     storer.SetName (file);
     try {
       OCC_CATCH_SIGNALS
-      storer.Realize();
+      storer.Realize (theProgress);
     }
     catch (Standard_Failure const& anException) {
       if (!MessageDriver().IsNull()) {
@@ -504,7 +527,8 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
 
 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
   {
@@ -516,7 +540,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs (const Handle(TDocStd_Document)& th
     }
 
     aDocStorageDriver->SetFormat(theDoc->StorageFormat());
-    aDocStorageDriver->Write(theDoc, theOStream);
+    aDocStorageDriver->Write(theDoc, theOStream, theProgress);
         
     if (aDocStorageDriver->GetStoreStatus() == PCDM_SS_OK)
     {
@@ -542,14 +566,15 @@ PCDM_StoreStatus TDocStd_Application::SaveAs (const Handle(TDocStd_Document)& th
 //=======================================================================
 
 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()) {
index 11ce9e5..d4f3081 100644 (file)
@@ -225,38 +225,54 @@ public:
   //! 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);
index 8c1c8fa..c1fd3b6 100644 (file)
@@ -18,7 +18,6 @@
 #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>
@@ -172,7 +171,8 @@ void  TopTools_LocationSet::Dump(Standard_OStream& OS) const
 //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);
@@ -181,7 +181,7 @@ void  TopTools_LocationSet::Write(Standard_OStream& OS) const
   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);
 
@@ -246,7 +246,7 @@ static void ReadTrsf(gp_Trsf& T,
 //purpose  : 
 //=======================================================================
 
-void  TopTools_LocationSet::Read(Standard_IStream& IS)
+void  TopTools_LocationSet::Read (Standard_IStream& IS, const Handle(Message_ProgressIndicator) &theProgress)
 {
   myMap.Clear();
 
@@ -266,7 +266,7 @@ void  TopTools_LocationSet::Read(Standard_IStream& IS)
   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;
@@ -290,25 +290,3 @@ void  TopTools_LocationSet::Read(Standard_IStream& IS)
     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;
-}
-
-
index a059e5e..56e8c4c 100644 (file)
@@ -25,7 +25,8 @@
 #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;
 
@@ -37,7 +38,7 @@ 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:
@@ -66,39 +67,17 @@ 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
index c680985..ace0355 100644 (file)
@@ -443,7 +443,8 @@ void  TopTools_ShapeSet::Dump(Standard_OStream& OS)const
 //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());
@@ -460,33 +461,20 @@ void  TopTools_ShapeSet::Write(Standard_OStream& OS)
   //-----------------------------------------
   // 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
@@ -498,10 +486,8 @@ void  TopTools_ShapeSet::Write(Standard_OStream& OS)
 
   // 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
@@ -542,14 +528,6 @@ void  TopTools_ShapeSet::Write(Standard_OStream& OS)
   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";
-  }
 }
 
 //=======================================================================
@@ -597,7 +575,7 @@ static TopAbs_ShapeEnum ReadShapeEnum(Standard_IStream& IS)
 //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());
@@ -634,38 +612,18 @@ void  TopTools_ShapeSet::Read(Standard_IStream& IS)
   //-----------------------------------------
 
   //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
@@ -684,9 +642,8 @@ void  TopTools_ShapeSet::Read(Standard_IStream& IS)
   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;
     
@@ -726,11 +683,6 @@ void  TopTools_ShapeSet::Read(Standard_IStream& IS)
 
     myShapes.Add(S);
   }
-  if (!myProgress.IsNull()) {
-    myProgress->EndScope();
-    myProgress->Show();
-  }
-
   // on remet le LC_NUMERIC a la precedente valeur
   IS.imbue (anOldLocale);
 }
@@ -758,8 +710,7 @@ void  TopTools_ShapeSet::Dump(const TopoDS_Shape& S,
 //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 {
@@ -774,8 +725,7 @@ void  TopTools_ShapeSet::Write(const TopoDS_Shape& S,
 //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());
 }
@@ -849,7 +799,8 @@ void  TopTools_ShapeSet::DumpGeometry(Standard_OStream&) const
 //purpose  : 
 //=======================================================================
 
-void  TopTools_ShapeSet::WriteGeometry(Standard_OStream&) 
+void  TopTools_ShapeSet::WriteGeometry (Standard_OStream&,
+                                        const Handle(Message_ProgressIndicator) &)
 {
 }
 
@@ -859,7 +810,8 @@ void  TopTools_ShapeSet::WriteGeometry(Standard_OStream&)
 //purpose  : 
 //=======================================================================
 
-void  TopTools_ShapeSet::ReadGeometry(Standard_IStream&)
+void  TopTools_ShapeSet::ReadGeometry (Standard_IStream&,
+                                       const Handle(Message_ProgressIndicator) &)
 {
 }
 
@@ -880,8 +832,7 @@ void  TopTools_ShapeSet::DumpGeometry(const TopoDS_Shape&,
 //purpose  : 
 //=======================================================================
 
-void  TopTools_ShapeSet::WriteGeometry(const TopoDS_Shape&, 
-                                       Standard_OStream&)const 
+void  TopTools_ShapeSet::WriteGeometry (const TopoDS_Shape&, Standard_OStream&)const
 {
 }
 
@@ -891,9 +842,7 @@ void  TopTools_ShapeSet::WriteGeometry(const TopoDS_Shape&,
 //purpose  : 
 //=======================================================================
 
-void  TopTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum,
-                                      Standard_IStream& ,
-                                      TopoDS_Shape&)
+void  TopTools_ShapeSet::ReadGeometry (const TopAbs_ShapeEnum, Standard_IStream&, TopoDS_Shape&)
 {
 }
 
@@ -931,25 +880,3 @@ Standard_Integer  TopTools_ShapeSet::NbShapes() const
 {
   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;
-}
-
-
index fde517d..2a65d81 100644 (file)
 #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.
@@ -44,7 +44,6 @@ public:
 
   DEFINE_STANDARD_ALLOC
 
-  
   //! Builds an empty ShapeSet.
   Standard_EXPORT TopTools_ShapeSet();
   
@@ -109,7 +108,9 @@ public:
   //! 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.
@@ -123,7 +124,9 @@ public:
   //! 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
@@ -146,10 +149,14 @@ public:
   
   //! 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;
@@ -176,40 +183,16 @@ public:
   
   //! 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
index 07b3afa..6cc7904 100644 (file)
@@ -185,6 +185,9 @@ static Standard_Integer saveDoc (Draw_Interpretor& di, Standard_Integer argc, co
     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;
index 2b0a1b8..112d517 100644 (file)
@@ -50,7 +50,8 @@ Handle(XmlMDF_ADriverTable) XmlDrivers_DocumentRetrievalDriver::AttributeDrivers
 //=======================================================================
 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;
@@ -58,7 +59,7 @@ Handle(XmlMDF_ADriver) XmlDrivers_DocumentRetrievalDriver::ReadShapeSection(
   {
     Handle(XmlMNaming_NamedShapeDriver) aNamedShapeDriver = 
       Handle(XmlMNaming_NamedShapeDriver)::DownCast (aDriver);
-    aNamedShapeDriver -> ReadShapeSection (theElement);
+    aNamedShapeDriver->ReadShapeSection (theElement, theProgress);
   }
   return aDriver;
 }
index f73d511..2eb1c0f 100644 (file)
@@ -33,38 +33,23 @@ DEFINE_STANDARD_HANDLE(XmlDrivers_DocumentRetrievalDriver, XmlLDrivers_DocumentR
 
 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
index 5cbcd1c..c1d8df3 100644 (file)
@@ -51,7 +51,8 @@ Handle(XmlMDF_ADriverTable) XmlDrivers_DocumentStorageDriver::AttributeDrivers
 //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;
@@ -59,7 +60,7 @@ Standard_Boolean XmlDrivers_DocumentStorageDriver::WriteShapeSection
   {
     Handle(XmlMNaming_NamedShapeDriver) aNamedShapeDriver = 
       Handle(XmlMNaming_NamedShapeDriver)::DownCast (aDriver);
-    aNamedShapeDriver -> WriteShapeSection (theElement); 
+    aNamedShapeDriver->WriteShapeSection (theElement, theProgress);
     isShape = Standard_True;
   }
   return isShape;
index a100f8f..a09c9ed 100644 (file)
@@ -33,37 +33,20 @@ DEFINE_STANDARD_HANDLE(XmlDrivers_DocumentStorageDriver, XmlLDrivers_DocumentSto
 
 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
index c3e8f14..c3f647c 100644 (file)
@@ -17,6 +17,7 @@
 #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>
@@ -174,9 +175,10 @@ Handle(CDM_Document) XmlLDrivers_DocumentRetrievalDriver::CreateDocument()
 //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;
@@ -186,7 +188,7 @@ void XmlLDrivers_DocumentRetrievalDriver::Read
 
   if (aFileStream.is_open() && aFileStream.good())
   {
-    Read (aFileStream, NULL, theNewDocument, theApplication);
+    Read (aFileStream, NULL, theNewDocument, theApplication, theProgress);
   }
   else
   {
@@ -207,7 +209,8 @@ void XmlLDrivers_DocumentRetrievalDriver::Read
 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);
@@ -229,7 +232,7 @@ void XmlLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&              t
   const XmlObjMgt_Element anElement= aParser.getDocument().getDocumentElement();
   ::take_time (0, " +++++ Fin parsing XML :       ", aMessageDriver);
 
-  ReadFromDomDocument (anElement, theNewDocument, theApplication);
+  ReadFromDomDocument (anElement, theNewDocument, theApplication, theProgress);
 }
 
 //=======================================================================
@@ -242,7 +245,8 @@ void XmlLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&              t
 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();
@@ -427,13 +431,20 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
       }
     }
   }
-
+  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);
@@ -448,7 +459,7 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
     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;
@@ -458,6 +469,12 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
     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);
@@ -475,14 +492,15 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
 //=======================================================================
 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);
@@ -540,7 +558,8 @@ static void take_time (const Standard_Integer isReset, const char * aHeader,
 //=======================================================================
 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
index 9262dda..dd2b8cc 100644 (file)
@@ -49,12 +49,16 @@ public:
   
   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);
 
@@ -66,11 +70,19 @@ public:
 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);
 
index 06e11c8..d7add44 100644 (file)
@@ -18,6 +18,7 @@
 #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>
@@ -92,7 +93,8 @@ void XmlLDrivers_DocumentStorageDriver::AddNamespace
 //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;
 
@@ -101,7 +103,7 @@ void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)&
 
   if (aFileStream.is_open() && aFileStream.good())
   {
-    Write (theDocument, aFileStream);
+    Write (theDocument, aFileStream, theProgress);
   }
   else
   {
@@ -120,8 +122,9 @@ void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)&
 //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);
@@ -132,7 +135,7 @@ Standard_EXPORT void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_
   // 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);
@@ -164,8 +167,10 @@ Standard_EXPORT void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_
 //           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 =
@@ -320,14 +325,21 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Ha
     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)
     {
@@ -353,8 +365,15 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Ha
   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();
 }
 
@@ -364,7 +383,8 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Ha
 //=======================================================================
 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);  
@@ -385,7 +405,7 @@ Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument
     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);
@@ -446,7 +466,8 @@ static void take_time (const Standard_Integer isReset, const char * aHeader,
 //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;
index b5dd604..aa5d7b0 100644 (file)
@@ -45,9 +45,13 @@ public:
   
   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);
 
@@ -59,13 +63,22 @@ public:
 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;
index da434e5..01c5bb8 100644 (file)
@@ -15,6 +15,7 @@
 
 
 #include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
 #include <Storage_Schema.hxx>
 #include <TColStd_MapOfTransient.hxx>
 #include <TDF_Attribute.hxx>
@@ -60,11 +61,12 @@ static TColStd_MapOfTransient& UnsuppTypesMap ()
 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();
 }
 
@@ -76,7 +78,8 @@ Standard_Integer XmlMDF::WriteSubTree
                       (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();
 
@@ -128,10 +131,16 @@ Standard_Integer XmlMDF::WriteSubTree
 
   // 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())
@@ -141,7 +150,6 @@ Standard_Integer XmlMDF::WriteSubTree
     // set attribute "tag"
     aLabElem.setAttribute (::TagString(), theLabel.Tag());
   }
-
   return count;
 }
 
@@ -152,7 +160,8 @@ Standard_Integer XmlMDF::WriteSubTree
 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;
@@ -167,7 +176,7 @@ Standard_Boolean XmlMDF::FromTo (const XmlObjMgt_Element&         theElement,
     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;
@@ -188,7 +197,8 @@ Standard_Boolean XmlMDF::FromTo (const XmlObjMgt_Element&         theElement,
 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;
@@ -196,6 +206,7 @@ Standard_Integer XmlMDF::ReadSubTree (const XmlObjMgt_Element&    theElement,
   //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 )
@@ -217,7 +228,7 @@ Standard_Integer XmlMDF::ReadSubTree (const XmlObjMgt_Element&    theElement,
 
         // 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;
@@ -305,6 +316,10 @@ Standard_Integer XmlMDF::ReadSubTree (const XmlObjMgt_Element&    theElement,
     //anElem = (const XmlObjMgt_Element &) anElem.getNextSibling();
     LDOM_Node theNode1 = anElem.getNextSibling();
     anElem = (const XmlObjMgt_Element &) theNode1;
+
+    if (!aPS.More())
+      return -1;
+    aPS.Next();
   }
 
   // AfterRetrieval
index 2b0eb77..1c4ae55 100644 (file)
@@ -26,6 +26,9 @@
 #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;
@@ -58,38 +61,45 @@ public:
 
   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;
@@ -98,10 +108,4 @@ friend class XmlMDF_ADriverTable;
 
 };
 
-
-
-
-
-
-
 #endif // _XmlMDF_HeaderFile
index a710679..b49a503 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <BRepTools.hxx>
 #include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
 #include <LDOM_OSStream.hxx>
 #include <LDOM_Text.hxx>
 #include <Standard_SStream.hxx>
@@ -333,8 +334,8 @@ static int doTranslate  (const XmlMNaming_Shape1&       thePShape,
 //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());
@@ -347,7 +348,7 @@ void XmlMNaming_NamedShapeDriver::ReadShapeSection
         LDOMString aData = aNode.getNodeValue();
         std::stringstream aStream (std::string(aData.GetString()));
         myShapeSet.Clear();
-        myShapeSet.Read (aStream);
+        myShapeSet.Read (aStream, theProgress);
         break;
       }
     }
@@ -359,8 +360,8 @@ void XmlMNaming_NamedShapeDriver::ReadShapeSection
 //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();
@@ -373,7 +374,11 @@ void XmlMNaming_NamedShapeDriver::WriteShapeSection
     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);
@@ -384,6 +389,9 @@ void XmlMNaming_NamedShapeDriver::WriteShapeSection
   // 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();
   }
 }
 
index c72b999..8efb659 100644 (file)
@@ -37,23 +37,29 @@ DEFINE_STANDARD_HANDLE(XmlMNaming_NamedShapeDriver, XmlMDF_ADriver)
 
 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();
@@ -61,29 +67,15 @@ public:
   //! 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
index 2b0016d..29f0908 100644 (file)
@@ -6,4 +6,5 @@
 006 bugs
 007 driver
 008 nam
+009 progress
 
diff --git a/tests/caf/progress/A1 b/tests/caf/progress/A1
new file mode 100644 (file)
index 0000000..7c57233
--- /dev/null
@@ -0,0 +1,37 @@
+#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
diff --git a/tests/caf/progress/A2 b/tests/caf/progress/A2
new file mode 100644 (file)
index 0000000..29ad501
--- /dev/null
@@ -0,0 +1,37 @@
+#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
diff --git a/tests/caf/progress/B1 b/tests/caf/progress/B1
new file mode 100644 (file)
index 0000000..a5772c9
--- /dev/null
@@ -0,0 +1,36 @@
+#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
diff --git a/tests/caf/progress/B2 b/tests/caf/progress/B2
new file mode 100644 (file)
index 0000000..6dfba67
--- /dev/null
@@ -0,0 +1,36 @@
+#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
diff --git a/tests/caf/progress/C1 b/tests/caf/progress/C1
new file mode 100644 (file)
index 0000000..acd5d36
--- /dev/null
@@ -0,0 +1,43 @@
+#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
diff --git a/tests/caf/progress/C2 b/tests/caf/progress/C2
new file mode 100644 (file)
index 0000000..9b47b86
--- /dev/null
@@ -0,0 +1,42 @@
+#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
+    }
+}
diff --git a/tests/caf/progress/begin b/tests/caf/progress/begin
new file mode 100644 (file)
index 0000000..61b8906
--- /dev/null
@@ -0,0 +1,41 @@
+# 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
+}