0025748: Parallel version of progress indicator
[occt.git] / src / XSControl / XSControl_TransferReader.cxx
index 1347323..47b43f2 100644 (file)
@@ -29,6 +29,7 @@
 #include <Interface_SignLabel.hxx>
 #include <Interface_Static.hxx>
 #include <Message_Messenger.hxx>
+#include <Message_ProgressScope.hxx>
 #include <ShapeFix.hxx>
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
@@ -780,7 +781,9 @@ Standard_Boolean XSControl_TransferReader::Recognize
 //=======================================================================
 
 Standard_Integer XSControl_TransferReader::TransferOne
-  (const Handle(Standard_Transient)& ent, const Standard_Boolean rec)
+  (const Handle(Standard_Transient)& ent,
+   const Standard_Boolean rec,
+   const Message_ProgressRange& theProgress)
 {
   if (myActor.IsNull() || myModel.IsNull()) return 0;
 
@@ -813,7 +816,9 @@ Standard_Integer XSControl_TransferReader::TransferOne
   //  seule difference entre TransferRoots et TransferOne
   Standard_Integer res = 0;
   Handle(Standard_Transient) obj = ent;
-  TP.Transfer (obj);
+  TP.Transfer (obj, theProgress);
+  if (theProgress.UserBreak())
+    return res;
   myTP->SetRoot (obj);
 
   //  Resultat ...
@@ -834,7 +839,9 @@ Standard_Integer XSControl_TransferReader::TransferOne
 //=======================================================================
 
 Standard_Integer XSControl_TransferReader::TransferList
-  (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean rec)
+  (const Handle(TColStd_HSequenceOfTransient)& list,
+   const Standard_Boolean rec,
+   const Message_ProgressRange& theProgress)
 {
   if (myActor.IsNull() || myModel.IsNull()) return 0;
 
@@ -867,10 +874,10 @@ Standard_Integer XSControl_TransferReader::TransferList
   Standard_Integer res = 0;
   nb = list->Length();
   Handle(Standard_Transient) obj;
-
-  for (i = 1; i <= nb; i ++) {
+  Message_ProgressScope aPS(theProgress, NULL, nb);
+  for (i = 1; i <= nb && aPS.More(); i++) {
     obj = list->Value(i);
-    TP.Transfer (obj);
+    TP.Transfer (obj, aPS.Next());
     myTP->SetRoot (obj);
 
     //  Resultat ...
@@ -893,7 +900,8 @@ Standard_Integer XSControl_TransferReader::TransferList
 //purpose  : 
 //=======================================================================
 
-Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& G)
+Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& G,
+                                                         const Message_ProgressRange& theProgress)
 {
   if (myModel != G.Model()) return -1;
   if (!BeginTransfer()) return -1;
@@ -919,7 +927,9 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph&
     sout<<"\n*******************************************************************\n";
   }
 
-  TP.TransferRoots (G);
+  TP.TransferRoots (G, theProgress);
+  if (theProgress.UserBreak())
+    return -1;
 
   //  Les entites transferees sont notees "asmain"
   Standard_Integer i,n = myTP->NbMapped();