AddError (new BOPAlgo_AlertBuilderFailed);
}
}
+
+//=======================================================================
+//function : AnalyzeProgress
+//purpose :
+//=======================================================================
+NCollection_Array1<Standard_Real> BOPAlgo_Builder::AnalyzeProgress()
+{
+ Standard_Integer aSize = 8;
+ 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;
+ Standard_Integer aNbSh = 0;
+ Standard_Integer aNbS = 0;
+ Standard_Integer aNbCS = 0;
+ Standard_Integer aNbC = 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;
+ case TopAbs_SHELL:
+ aNbSh++;
+ break;
+ case TopAbs_SOLID:
+ aNbS++;
+ break;
+ case TopAbs_COMPSOLID:
+ aNbCS++;
+ break;
+ case TopAbs_COMPOUND:
+ aNbC++;
+ break;
+ default:
+ break;
+ }
+ }
+
+ aNbE = 5 * aNbE;
+ aNbW = 10 * aNbW;
+ aNbF = 20 * aNbF;
+ aNbSh = 10 * aNbSh;
+ aNbS = 10 * aNbS;
+ aNbCS = 5 * aNbCS;
+ aNbC = 5 * aNbC;
+ Standard_Real aSum = aNbV + aNbE + aNbW + aNbF + aNbSh + aNbS + aNbCS + aNbC;
+ 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;
+ aSteps(4) = aPart * aNbSh / aSum;
+ aSteps(5) = aPart * aNbS / aSum;
+ aSteps(6) = aPart * aNbCS / aSum;
+ aSteps(7) = aPart * aNbC / aSum;
+ Standard_Real a = 0;
+ for (Standard_Integer i = 0; i < aSize; i++)
+ {
+ a += aSteps(i);
+ }
+ return aSteps;
+}
+
//=======================================================================
//function : PerformInternal1
//purpose :
return;
}
//
+ NCollection_Array1<Standard_Real> aSteps = AnalyzeProgress();
// 3. Fill Images
// 3.1 Vertice
- FillImagesVertices(aPS.Next(10)); // 10
+ FillImagesVertices(aPS.Next(aSteps(0)));
if (HasErrors()) {
return;
}
return;
}
// 3.2 Edges
- FillImagesEdges(aPS.Next(10)); // 20
+ FillImagesEdges(aPS.Next(aSteps(1)));
if (HasErrors()) {
return;
}
}
//
// 3.3 Wires
- FillImagesContainers(TopAbs_WIRE, aPS.Next(10)); // 30
+ FillImagesContainers(TopAbs_WIRE, aPS.Next(aSteps(2)));
if (HasErrors()) {
return;
}
}
// 3.4 Faces
- FillImagesFaces(aPS.Next(30)); // 60
+ FillImagesFaces(aPS.Next(aSteps(3)));
if (HasErrors()) {
return;
}
return;
}
// 3.5 Shells
- FillImagesContainers(TopAbs_SHELL, aPS.Next(10)); // 70
+ FillImagesContainers(TopAbs_SHELL, aPS.Next(aSteps(4)));
if (HasErrors()) {
return;
}
return;
}
// 3.6 Solids
- FillImagesSolids(aPS.Next(10)); // 80
+ FillImagesSolids(aPS.Next(aSteps(5)));
if (HasErrors()) {
return;
}
return;
}
// 3.7 CompSolids
- FillImagesContainers(TopAbs_COMPSOLID, aPS.Next(10)); // 90
+ FillImagesContainers(TopAbs_COMPSOLID, aPS.Next(aSteps(6)));
if (HasErrors()) {
return;
}
}
// 3.8 Compounds
- FillImagesCompounds(aPS.Next(10)); // 100
+ FillImagesCompounds(aPS.Next(aSteps(7)));
if (HasErrors()) {
return;
}
//! obtaining Generated elements differently.
Standard_EXPORT virtual const TopTools_ListOfShape& LocGenerated(const TopoDS_Shape& theS);
+ //! AnalyzeProgress
+ Standard_EXPORT NCollection_Array1<Standard_Real> AnalyzeProgress() Standard_OVERRIDE;
+
public: //! @name Images/Origins
//! Returns the map of images.
//=======================================================================
void BOPAlgo_Builder::FillImagesVertices(const Message_ProgressRange& theRange)
{
- Message_ProgressScope aPS(theRange, "FillImagesVertices", myDS->ShapesSD().Size());
+ Message_ProgressScope aPS(theRange, "Filling splits of vertices", 1);
TColStd_DataMapIteratorOfDataMapOfIntegerInteger aIt(myDS->ShapesSD());
- for (; aIt.More(); aIt.Next(), aPS.Next())
+ for (; aIt.More(); aIt.Next())
{
if (UserBreak(aPS))
{
void BOPAlgo_Builder::FillImagesEdges(const Message_ProgressRange& theRange)
{
Standard_Integer i, aNbS = myDS->NbSourceShapes();
- Message_ProgressScope aPS(theRange, "FillImagesEdges", aNbS);
- for (i = 0; i < aNbS; ++i, aPS.Next()) {
+ Message_ProgressScope aPS(theRange, "Filling splits of edges", 1);
+ for (i = 0; i < aNbS; ++i) {
if (UserBreak(aPS))
{
return;
//
BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
for (; aItPB.More(); aItPB.Next()) {
- if (UserBreak(aPS))
- {
- return;
- }
const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
Handle(BOPDS_PaveBlock) aPBR = myDS->RealPaveBlock(aPB);
//
TopTools_MapOfShape aMFP(100, myAllocator);
//
aNbS=myDS->NbSourceShapes();
- Message_ProgressScope aPS(theRange, "FillImagesContainers", aNbS);
- for (i=0; i<aNbS; ++i, aPS.Next()) {
+ Message_ProgressScope aPS(theRange, "Filling images containers", 1);
+ for (i=0; i<aNbS; ++i) {
if (UserBreak(aPS))
{
return;
TopTools_MapOfShape aMFP(100, myAllocator);
//
aNbS=myDS->NbSourceShapes();
- Message_ProgressScope aPS(theRange, "FillImagesCompounds", aNbS);
+ Message_ProgressScope aPS(theRange, "Filling images compounds", aNbS);
for (i=0; i<aNbS; ++i, aPS.Next()) {
if (UserBreak(aPS))
{
//=======================================================================
void BOPAlgo_Builder::FillImagesFaces(const Message_ProgressRange& theRange)
{
- Message_ProgressScope aPS(theRange, "FillImagesFaces", 1);
+ Message_ProgressScope aPS(theRange, "Building splits of faces", 1);
BuildSplitFaces();
- if (UserBreak(aPS))
- {
- return;
- }
FillSameDomainFaces();
- if (UserBreak(aPS))
- {
- return;
- }
FillInternalVertices();
}
//=======================================================================
//=======================================================================
void BOPAlgo_Builder::FillImagesSolids(const Message_ProgressRange& theRange)
{
- Message_ProgressScope aPS(theRange, "FillImagesSolid", 1);
+ Message_ProgressScope aPS(theRange, "Filling images solids", 1);
Standard_Boolean bHasSolids;
Standard_Integer i, aNbS;
//
TopTools_DataMapOfShapeShape aDraftSolids;
// Find all IN faces for all IN faces
FillIn3DParts(aDraftSolids);
- if (UserBreak(aPS))
- {
- return;
- }
// Build split of the solids
BuildSplitSolids(aDraftSolids);
- if (UserBreak(aPS))
- {
- return;
- }
// Fill solids with internal parts
FillInternalShapes();
}
aSteps(i) = 0;
}
- Standard_Integer aPart = 85;
+ Standard_Real aPart = 85.;
myIterator->Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
Standard_Real aPerformVVSize = myIterator->ExpectedLength();