0025748: Parallel version of progress indicator
[occt.git] / src / TopoDSToStep / TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.cxx
index 29d859f..e47b2d6 100644 (file)
@@ -16,6 +16,7 @@
 
 
 #include <BRepClass3d.hxx>
+#include <Message_ProgressScope.hxx>
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
 #include <StepShape_ClosedShell.hxx>
@@ -42,7 +43,8 @@
 //=============================================================================
 TopoDSToStep_MakeFacetedBrepAndBrepWithVoids::
   TopoDSToStep_MakeFacetedBrepAndBrepWithVoids(const TopoDS_Solid& aSolid,
-                                   const Handle(Transfer_FinderProcess)& FP)
+                                               const Handle(Transfer_FinderProcess)& FP,
+                                               const Message_ProgressRange& theProgress)
 {
   done = Standard_False;
   TopoDS_Iterator              It;
@@ -61,14 +63,20 @@ TopoDSToStep_MakeFacetedBrepAndBrepWithVoids::
   TopoDSToStep_Tool    aTool;
 
   if (!aOutShell.IsNull()) {
-    It.Initialize(aSolid);
-    for ( ; It.More(); It.Next() ) {
+    Standard_Integer nbshapes = 0;
+    for (It.Initialize(aSolid); It.More(); It.Next())
+      if (It.Value().ShapeType() == TopAbs_SHELL)
+        nbshapes++;
+    Message_ProgressScope aPS(theProgress, NULL, nbshapes);
+    for (It.Initialize(aSolid); It.More() && aPS.More(); It.Next())
+    {
       if (It.Value().ShapeType() == TopAbs_SHELL) {
+        Message_ProgressRange aRange = aPS.Next();
        TopoDS_Shell CurrentShell = TopoDS::Shell(It.Value());
        if (It.Value().Closed()) {
 
          aTool.Init(aMap, Standard_False);
-         StepB.Init(CurrentShell, aTool, FP);
+         StepB.Init(CurrentShell, aTool, FP, aRange);
          TopoDSToStep::AddResult ( FP, aTool );
 
          if (StepB.IsDone()) {
@@ -92,6 +100,8 @@ TopoDSToStep_MakeFacetedBrepAndBrepWithVoids::
        }
       }
     }
+    if (!aPS.More())
+      return;
   }
   Standard_Integer N = S.Length();
   if ( N>=1 ) {