// 3.1. Vertice
if (myIntersect) {
Message_ProgressScope aPS(theRange, "PerformInternal", 100);
- FillImagesVertices(aPS.Next(15)); // 15
+ NCollection_Array1<Standard_Real> aSteps = AnalyzeProgress();
+
+ FillImagesVertices(aPS.Next(aSteps(0)));
if (HasErrors()) {
return;
}
// 3.2. Edges
- FillImagesEdges(aPS.Next(15)); // 30
+ FillImagesEdges(aPS.Next(aSteps(1)));
if (HasErrors()) {
return;
}
// 3.3. Wires
- FillImagesContainers(TopAbs_WIRE, aPS.Next(20)); // 50
+ FillImagesContainers(TopAbs_WIRE, aPS.Next(aSteps(2)));
if (HasErrors()) {
return;
}
// 3.4. Faces
- FillImagesFaces(aPS.Next(50)); // 100
+ FillImagesFaces(aPS.Next(aSteps(3)));
if (HasErrors()) {
return;
}
}
- else
- {
- Message_ProgressScope aPS(theRange, NULL, 1);
- }
//
// 4. Collect faces
CollectFaces();
PostTreat();
}
+//=======================================================================
+//function : AnalyzeProgress
+//purpose :
+//=======================================================================
+NCollection_Array1<Standard_Real> BOPAlgo_MakerVolume::AnalyzeProgress()
+{
+ Standard_Integer aSize = 4;
+ NCollection_Array1<Standard_Real> aSteps(0, aSize - 1);
+ for (Standard_Integer i = 0; i < aSize; i++)
+ {
+ aSteps(i) = 0;
+ }
+
+ Standard_Real aPart = 100.;
+ Standard_Integer aNbV = myDS->ShapesSD().Size();
+ Standard_Integer aNbE = 0;
+ Standard_Integer aNbW = 0;
+ Standard_Integer aNbF = 0;
+
+ for (Standard_Integer i = 0; i < myDS->NbSourceShapes(); i++)
+ {
+ const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
+ switch (aSI.ShapeType())
+ {
+ case TopAbs_EDGE:
+ aNbE++;
+ break;
+ case TopAbs_WIRE:
+ aNbW++;
+ break;
+ case TopAbs_FACE:
+ aNbF++;
+ break;
+ default:
+ break;
+ }
+ }
+
+ aNbE = 5 * aNbE;
+ aNbW = 10 * aNbW;
+ aNbF = 20 * aNbF;
+ Standard_Real aSum = aNbV + aNbE + aNbW + aNbF;
+ if (aSum == 0)
+ {
+ return aSteps;
+ }
+
+ aSteps(0) = aPart * aNbV / aSum;
+ aSteps(1) = aPart * aNbE / aSum;
+ aSteps(2) = aPart * aNbW / aSum;
+ aSteps(3) = aPart * aNbF / aSum;
+
+ return aSteps;
+}
+
//=======================================================================
//function : CollectFaces
//purpose :