//! Builds the splits of faces using the information from the
//! intersection stage stored in Data Structure.
- Standard_EXPORT virtual void BuildSplitFaces();
+ Standard_EXPORT virtual void BuildSplitFaces(const Message_ProgressRange& theRange = Message_ProgressRange());
//! Looks for the same domain faces among the splits of the faces.
//! Updates the map of images with SD faces.
//! Builds the splits of the solids using their draft versions
//! and faces located inside.
- Standard_EXPORT void BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSolids);
+ Standard_EXPORT void BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSolids, const Message_ProgressRange& theRange = Message_ProgressRange());
//! Classifies the vertices and edges from the arguments relatively
//! splits of solids and makes them INTERNAL for solids.
protected: //! @name Fill Images of COMPOUNDS
//! Fills the images of compounds.
- Standard_EXPORT void FillImagesCompounds(const Message_ProgressRange& theRange);
+ Standard_EXPORT void FillImagesCompounds(const Message_ProgressRange& theRange = Message_ProgressRange());
//! Builds the image of the given compound.
Standard_EXPORT void FillImagesCompound (const TopoDS_Shape& theS,
Standard_EXPORT BOPAlgo_BuilderArea(const Handle(NCollection_BaseAllocator)& theAllocator);
- virtual void PerformShapesToAvoid() = 0;
+ virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
- virtual void PerformLoops() = 0;
+ virtual void PerformLoops(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
- virtual void PerformAreas() = 0;
+ virtual void PerformAreas(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
- virtual void PerformInternalShapes() = 0;
+ virtual void PerformInternalShapes(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
Handle(IntTools_Context) myContext;
//=======================================================================
void BOPAlgo_BuilderFace::Perform(const Message_ProgressRange& theRange)
{
+
+ Message_ProgressScope aPS(theRange, "Perform", 100);
+
GetReport()->Clear();
//
CheckData();
- if (HasErrors()) {
- return;
- }
- //
- if (!theRange.More())
- {
- return;
- }
- //
- PerformShapesToAvoid();
- if (HasErrors()) {
- return;
- }
- //
- if (!theRange.More())
- {
+ if (HasErrors() || !theRange.More()) {
return;
}
//
- PerformLoops();
- if (HasErrors()) {
+ PerformShapesToAvoid(aPS.Next(1)); //1%
+ if (HasErrors() || !theRange.More()) {
return;
}
//
- if (!theRange.More())
- {
- return;
- }
//
- PerformAreas();
- if (HasErrors()) {
+ PerformLoops(aPS.Next(9)); //9%
+ if (HasErrors() || !theRange.More()) {
return;
}
//
- if (!theRange.More())
- {
+ PerformAreas(aPS.Next(80)); //80%
+ if (HasErrors() || !theRange.More()) {
return;
}
//
- PerformInternalShapes();
- if (HasErrors()) {
+ PerformInternalShapes(aPS.Next(9)); //9%
+ if (HasErrors() || !theRange.More()) {
return;
}
}
//function :PerformShapesToAvoid
//purpose :
//=======================================================================
-void BOPAlgo_BuilderFace::PerformShapesToAvoid()
+void BOPAlgo_BuilderFace::PerformShapesToAvoid(const Message_ProgressRange& theRange)
{
Standard_Boolean bFound;
Standard_Integer i, iCnt, aNbV, aNbE;
//
myShapesToAvoid.Clear();
//
+ Message_ProgressScope theScope(theRange, "Perform Shapes to Avoid", 1);
+ //
iCnt=0;
for(;;) {
++iCnt;
//function : PerformLoops
//purpose :
//=======================================================================
-void BOPAlgo_BuilderFace::PerformLoops()
+void BOPAlgo_BuilderFace::PerformLoops(const Message_ProgressRange& theRange)
{
Standard_Boolean bFlag;
Standard_Integer i, aNbEA;
BOPAlgo_WireEdgeSet aWES(myAllocator);
BOPAlgo_WireSplitter aWSp(myAllocator);
//
+ Message_ProgressScope MainScope(theRange, "PerformLoops", 100);
+ //
// 1.
myLoops.Clear();
aWES.SetFace(myFace);
//
aIt.Initialize(myShapes);
- for (; aIt.More(); aIt.Next()) {
+ Message_ProgressScope aPS(MainScope.Next(4), "Shells Usual", myShapes.Size());
+ for (; aIt.More(); aIt.Next(), aPS.Next()) {
+ if (!aPS.More())
+ return;
const TopoDS_Shape& aE=aIt.Value();
if (!myShapesToAvoid.Contains(aE)) {
aWES.AddStartElement(aE);
aWSp.SetWES(aWES);
aWSp.SetRunParallel(myRunParallel);
aWSp.SetContext(myContext);
- aWSp.Perform();
+ aWSp.Perform(MainScope.Next(90));
if (aWSp.HasErrors()) {
return;
}
//
// a. collect all edges that are in loops
aIt.Initialize (myLoops);
- for (; aIt.More(); aIt.Next()) {
+ Message_ProgressScope aPT_PS(MainScope.Next(), "Post Treatment: collect all edges", myLoops.Size());
+ for (; aIt.More(); aIt.Next(), aPT_PS.Next()) {
+ if (!aPT_PS.More())
+ return;
const TopoDS_Shape& aW=aIt.Value();
aItW.Initialize(aW);
for (; aItW.More(); aItW.Next()) {
//
// c. add all edges that are not processed to myShapesToAvoid
aIt.Initialize (myShapes);
- for (; aIt.More(); aIt.Next()) {
+ Message_ProgressScope aPT_PS1(MainScope.Next(), "Post Treatment: adding edges", myShapes.Size());
+ for (; aIt.More(); aIt.Next(), aPT_PS1.Next()) {
const TopoDS_Shape& aE=aIt.Value();
if (!aMEP.Contains(aE)) {
myShapesToAvoid.Add(aE);
//function : PerformAreas
//purpose :
//=======================================================================
-void BOPAlgo_BuilderFace::PerformAreas()
+void BOPAlgo_BuilderFace::PerformAreas(const Message_ProgressRange& theRange)
{
myAreas.Clear();
BRep_Builder aBB;
// Get tolerance of myFace
Standard_Real aTol = BRep_Tool::Tolerance(myFace);
+ Message_ProgressScope theMainPS(theRange, "PerformAreas", 10);
+
// Check if there are no loops at all
if (myLoops.IsEmpty())
{
// Analyze the new wires - classify them to be the holes and growths
TopTools_ListIteratorOfListOfShape aItLL(myLoops);
- for (; aItLL.More(); aItLL.Next())
+ Message_ProgressScope aPS(theMainPS.Next(4), "Analyze the shells", myLoops.Size());
+ for (; aItLL.More(); aItLL.Next(), aPS.Next())
{
const TopoDS_Shape& aWire = aItLL.Value();
BOPTools_Box2dTree aBoxTree;
Standard_Integer i, aNbH = aHoleFaces.Extent();
aBoxTree.SetSize (aNbH);
- for (i = 1; i <= aNbH; ++i)
+ Message_ProgressScope aTPPS(theMainPS.Next(), "Prepare tree with the boxes of the hole faces", aNbH);
+ for (i = 1; i <= aNbH; ++i, aTPPS.Next())
{
const TopoDS_Face& aHFace = TopoDS::Face(aHoleFaces(i));
//
aSelector.SetBVHSet (&aBoxTree);
TopTools_ListIteratorOfListOfShape aItLS(aNewFaces);
- for (; aItLS.More(); aItLS.Next())
+ Message_ProgressScope aPS1(theMainPS.Next(), "Selector", aNewFaces.Size());
+ for (; aItLS.More(); aItLS.Next(), aPS1.Next())
{
const TopoDS_Face& aFace = TopoDS::Face(aItLS.Value());
TopTools_IndexedDataMapOfShapeListOfShape aFaceHolesMap;
aNbH = aHoleFaceMap.Extent();
- for (i = 1; i <= aNbH; ++i)
+ Message_ProgressScope aPS2(theMainPS.Next(), "Make the back map from faces to holes", aNbH);
+ for (i = 1; i <= aNbH; ++i, aPS2.Next())
{
const TopoDS_Shape& aHole = aHoleFaceMap.FindKey(i);
const TopoDS_Shape& aFace = aHoleFaceMap(i);
// Add Holes to Faces and add them to myAreas
aItLS.Initialize(aNewFaces);
+ Message_ProgressScope aPS4(theMainPS.Next(), "Adding Holes to Faces", aNewFaces.Size());
for ( ; aItLS.More(); aItLS.Next())
{
TopoDS_Face& aFace = *(TopoDS_Face*)&aItLS.Value();
//function : PerformInternalShapes
//purpose :
//=======================================================================
-void BOPAlgo_BuilderFace::PerformInternalShapes()
+void BOPAlgo_BuilderFace::PerformInternalShapes(const Message_ProgressRange& theRange)
{
if (myAvoidInternalShapes)
// User-defined option to avoid internal edges
// Map of edges to classify
TopTools_IndexedMapOfShape anEdgesMap;
+
+ //Make main progress scope
+ Message_ProgressScope aPS(theRange, "PerformInternalShapes", 3);
// Fill the tree and the map
TopTools_ListIteratorOfListOfShape itLE(myLoopsInternal);
- for (; itLE.More(); itLE.Next())
+ Message_ProgressScope aFTPS(aPS.Next(), "Filling the tree and the map", myLoopsInternal.Size());
+ for (; itLE.More(); itLE.Next(), aFTPS.Next())
{
TopoDS_Iterator itE(itLE.Value());
for (; itE.More(); itE.Next())
// Classify edges relatively faces
TopTools_ListIteratorOfListOfShape itLF(myAreas);
- for (; itLF.More(); itLF.Next())
+ Message_ProgressScope aCEPS(aPS.Next(), "Classify edges", myAreas.Size());
+ for (; itLF.More(); itLF.Next(), aCEPS.Next())
{
TopoDS_Face& aF = *(TopoDS_Face*)&itLF.Value();
// Make internal wires
TopTools_ListOfShape aLSI;
- MakeInternalWires(anEdgesUnUsed, aLSI);
+ MakeInternalWires(anEdgesUnUsed, aLSI/*, aPS.Next()*/);
// Make compound
TopoDS_Compound aWShape;
BRep_Builder().Add(aWShape, aCE);
}
+ aPS.Next();
+
// Add warning
AddWarning(new BOPAlgo_AlertFaceBuilderUnusedEdges(aWShape));
}
//! Collect the edges that
//! a) are internal
//! b) are the same and have different orientation
- Standard_EXPORT virtual void PerformShapesToAvoid() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Build draft wires
//! a)myLoops - draft wires that consist of
//! boundary edges
//! b)myLoopsInternal - draft wires that contains
//! inner edges
- Standard_EXPORT virtual void PerformLoops() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformLoops(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Build draft faces that contains boundary edges
- Standard_EXPORT virtual void PerformAreas() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformAreas(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Build finalized faces with internals
- Standard_EXPORT virtual void PerformInternalShapes() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformInternalShapes(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
#include <NCollection_DataMap.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Vector.hxx>
-
-#include <Message_ProgressIndicator.hxx>
-#include <Message_ProgressScope.hxx>
-
#include <TColStd_MapIntegerHasher.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <TopTools_MapOfShape.hxx>
-//-----------------------------------------------------------
-#include <OSD_Timer.hxx>
-//-----------------------------------------------------------
//
static
//=======================================================================
void BOPAlgo_BuilderSolid::Perform(const Message_ProgressRange& theRange)
{
- //Message_ProgressRange aRootRange=theRange->Start();
- Message_ProgressScope aPS(theRange, "Perform Builder Solid", 100);
- //Timer construction
- //---------------------------------------------------------------------
- OSD_Timer DurationTimer;
- //---------------------------------------------------------------------
-
- DurationTimer.Start();
+ Message_ProgressScope theScope(theRange, "Perform", 100);
GetReport()->Clear();
//
if (myShapes.IsEmpty())
return;
-
if (myContext.IsNull()) {
myContext=new IntTools_Context;
}
-
myBoxes.Clear();
-
- DurationTimer.Stop();
- std::cout << "Prelim. duration: " << DurationTimer.ElapsedTime() << std::endl;
- aPS.Next(1);
-
-
+ //
TopoDS_Compound aC;
BRep_Builder aBB;
TopTools_ListIteratorOfListOfShape aIt;
//
- DurationTimer.Restart();
- aBB.MakeCompound(aC);
- DurationTimer.Stop();
- std::cout << "MakeCompound duration: " << DurationTimer.ElapsedTime() << std::endl;
- aPS.Next(1);
- DurationTimer.Restart();
+ aBB.MakeCompound(aC);
aIt.Initialize(myShapes);
- DurationTimer.Stop();
- std::cout << "Initialize duration: " << DurationTimer.ElapsedTime() << std::endl;
- aPS.Next(1);
- DurationTimer.Restart();
+
for(; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
aBB.Add(aC, aF);
}
- DurationTimer.Stop();
- std::cout << "ItLoop duration: " << DurationTimer.ElapsedTime() << std::endl;
- //
if (!theRange.More())
{
return;
}
//
- DurationTimer.Restart();
- PerformShapesToAvoid();
- DurationTimer.Stop();
- std::cout << "PerformShapesToAvoid duration: " << DurationTimer.ElapsedTime() << std::endl;
- if (HasErrors()) {
- return;
- }
- //
- if (!theRange.More())
- {
+ PerformShapesToAvoid(theScope.Next(1)); //1%
+ if (HasErrors() || !theRange.More()) {
return;
}
- //
- DurationTimer.Restart();
- PerformLoops();
- DurationTimer.Stop();
- std::cout << "PerformLoops duration: " << DurationTimer.ElapsedTime() << std::endl;
- aPS.Next(97);
- if (HasErrors()) {
- return;
- }
- //
- if (!theRange.More())
- {
- return;
- }
- //
- DurationTimer.Restart();
- PerformAreas();
- DurationTimer.Stop();
- std::cout << "PerformAreas duration: " << DurationTimer.ElapsedTime() << std::endl;
- if (HasErrors()) {
+ //
+ PerformLoops(theScope.Next(9)); //9%
+
+ if (HasErrors() || !theRange.More()) {
return;
}
- //
- if (!theRange.More())
- {
+ //
+ PerformAreas(theScope.Next(80)); //80%
+ if (HasErrors() || !theRange.More()) {
return;
}
//
- DurationTimer.Restart();
- PerformInternalShapes();
- DurationTimer.Stop();
- std::cout << "PerformInternalShapes duration: " << DurationTimer.ElapsedTime() << std::endl;
- if (HasErrors()) {
+ PerformInternalShapes(theScope.Next(9)); //10%
+ if (HasErrors() || !theRange.More()) {
return;
}
}
//function :PerformShapesToAvoid
//purpose :
//=======================================================================
-void BOPAlgo_BuilderSolid::PerformShapesToAvoid()
+void BOPAlgo_BuilderSolid::PerformShapesToAvoid(const Message_ProgressRange& theRange)
{
Standard_Boolean bFound;
Standard_Integer i, iCnt, aNbE, aNbF;
//
myShapesToAvoid.Clear();
//
+ Message_ProgressScope theScope(theRange, "Perform Shapes to Avoid", 1);
+ //
iCnt=0;
for(;;) {
++iCnt;
//function : PerformLoops
//purpose :
//=======================================================================
-void BOPAlgo_BuilderSolid::PerformLoops()
+void BOPAlgo_BuilderSolid::PerformLoops(const Message_ProgressRange& theRange)
{
Standard_Integer i, aNbSh;
TopTools_ListIteratorOfListOfShape aIt;
Handle(NCollection_BaseAllocator) aAlr;
//
myLoops.Clear();
+ //
//
aAlr=
NCollection_BaseAllocator::CommonBaseAllocator();
BOPAlgo_ShellSplitter aSSp(aAlr);
//
- // 1. Shells Usual
+ //
+ Message_ProgressScope MainScope(theRange, "PerformLoops", 100);
+
+ // 1. Shells Usual
aIt.Initialize (myShapes);
- for (; aIt.More(); aIt.Next()) {
+ Message_ProgressScope aPS(MainScope.Next(4), "Shells Usual", myShapes.Size());
+ for (; aIt.More(); aIt.Next(), aPS.Next()) {
+ if (!aPS.More())
+ return;
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
if (myContext->IsInfiniteFace(aF)) {
- TopoDS_Shell aSh;
+ TopoDS_Shell aSh;
BRep_Builder aBB;
//
aBB.MakeShell(aSh);
aSSp.AddStartElement(aF);
}
}
- //
+
aSSp.SetRunParallel(myRunParallel);
- aSSp.Perform();
+ aSSp.Perform(MainScope.Next(90));
+ if (!MainScope.More())
+ return;
+
if (aSSp.HasErrors()) {
- // add warning status
+ // add warning status
{
TopoDS_Compound aFacesSp;
BRep_Builder().MakeCompound(aFacesSp);
}
return;
}
- //
+
const TopTools_ListOfShape& aLSh=aSSp.Shells();
aIt.Initialize (aLSh);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSh=aIt.Value();
myLoops.Append(aSh);
}
- //=================================================
//
// 2. Post Treatment
BRep_Builder aBB;
TopTools_MapOfOrientedShape AddedFacesMap;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap;
TopTools_MapOfOrientedShape aMP;
- //
+
// a. collect all edges that are in loops
aIt.Initialize (myLoops);
- for (; aIt.More(); aIt.Next()) {
+ Message_ProgressScope aPT_PS(MainScope.Next(), "Post Treatment: collect all edges", myLoops.Size());
+ for (; aIt.More(); aIt.Next(), aPT_PS.Next()) {
+ if (!aPT_PS.More())
+ return;
const TopoDS_Shape& aS=aIt.Value();
aItS.Initialize(aS);
for (; aItS.More(); aItS.Next()) {
aMP.Add(aF);
}
//
- // c. add all edges that are not processed to myShapesToAvoid
+ // c. add all edges that are not processed to myShapesToAvoid
aIt.Initialize (myShapes);
- for (; aIt.More(); aIt.Next()) {
+ Message_ProgressScope aPT_PS1(MainScope.Next(), "Post Treatment: adding edges", myShapes.Size());
+ for (; aIt.More(); aIt.Next(), aPT_PS1.Next()) {
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
if (!myContext->IsInfiniteFace(aF)) {
if (!aMP.Contains(aF)) {
myShapesToAvoid.Add(aF);
}
}
- }
- //=================================================
+ }
//
// 3.Internal Shells
myLoopsInternal.Clear();
AddedFacesMap.Clear();
//
aNbSh = myShapesToAvoid.Extent();
+
for (i = 1; i <= aNbSh; ++i) {
const TopoDS_Shape& aFF = myShapesToAvoid(i);
TopExp::MapShapesAndAncestors(aFF,
TopAbs_EDGE, TopAbs_FACE,
aEFMap);
}
- //
+ //
for (i = 1; i <= aNbSh; ++i) {
const TopoDS_Shape& aFF = myShapesToAvoid(i);
if (!AddedFacesMap.Add(aFF)) {
//function : PerformAreas
//purpose :
//=======================================================================
-void BOPAlgo_BuilderSolid::PerformAreas()
+void BOPAlgo_BuilderSolid:: PerformAreas(const Message_ProgressRange& theRange)
{
+
myAreas.Clear();
BRep_Builder aBB;
// The new solids
// If the analyzed shell contains any of the hole faces, it is considered as growth.
TopTools_IndexedMapOfShape aMHF;
+ Message_ProgressScope theMainPS(theRange, "PerformAreas", 10);
+
// Analyze the shells
TopTools_ListIteratorOfListOfShape aItLL(myLoops);
- for (; aItLL.More(); aItLL.Next())
+ Message_ProgressScope aPS(theMainPS.Next(4), "Analyze the shells", myLoops.Size());
+ for (; aItLL.More(); aItLL.Next(), aPS.Next())
{
- const TopoDS_Shape& aShell = aItLL.Value();
+ if (!aPS.More())
+ return;
+ const TopoDS_Shape& aShell = aItLL.Value();
Standard_Boolean bIsGrowth = IsGrowthShell(aShell, aMHF);
if (!bIsGrowth)
{
TopExp::MapShapes(aShell, TopAbs_FACE, aMHF);
}
}
-
+
if (aHoleShells.IsEmpty())
{
// No holes, stop the analysis
TopTools_ListIteratorOfListOfShape aItLS(aNewSolids);
- for (; aItLS.More(); aItLS.Next())
+ Message_ProgressScope aSHPS(theMainPS.Next(), "SearchHoles", aNewSolids.Size());
+ for (; aItLS.More(); aItLS.Next(), aSHPS.Next())
{
const TopoDS_Shape& aSol = aItLS.Value();
myAreas.Append(aSol);
}
return;
}
-
// Classify holes relatively solids
-
// Prepare tree with the boxes of the hole shells
BOPTools_BoxTree aBBTree;
Standard_Integer i, aNbH = aHoleShells.Extent();
+ Message_ProgressScope aPS1(theMainPS.Next(), "Prepare tree with the boxes of the hole shells", aNbH);
aBBTree.SetSize (aNbH);
- for (i = 1; i <= aNbH; ++i)
+ for (i = 1; i <= aNbH; ++i, aPS.Next())
{
const TopoDS_Shape& aHShell = aHoleShells(i);
//
// Find outer growth shell that is most close to each hole shell
TopTools_IndexedDataMapOfShapeShape aHoleSolidMap;
-
TopTools_ListIteratorOfListOfShape aItLS(aNewSolids);
+ Message_ProgressScope aPS2(theMainPS.Next(), "Find outer growth shell that is most close to each hole shell", aNewSolids.Size());
+ //50%
for (; aItLS.More(); aItLS.Next())
{
const TopoDS_Shape& aSolid = aItLS.Value();
const TColStd_ListOfInteger& aLI = aSelector.Indices();
TColStd_ListIteratorOfListOfInteger aItLI(aLI);
- for (; aItLI.More(); aItLI.Next())
+ Message_ProgressScope aPS21(aPS2.Next(), "Iteration", aLI.Size());
+ for (; aItLI.More(); aItLI.Next(), aPS21.Next())
{
Standard_Integer k = aItLI.Value();
const TopoDS_Shape& aHole = aHoleShells(k);
}
}
}
-
+
// Make the back map from solids to holes
TopTools_IndexedDataMapOfShapeListOfShape aSolidHolesMap;
-
aNbH = aHoleSolidMap.Extent();
- for (i = 1; i <= aNbH; ++i)
+ Message_ProgressScope aPS3(theMainPS.Next(), "Make the back map from solids to holes", aNbH);
+ for (i = 1; i <= aNbH; ++i, aPS3.Next())
{
const TopoDS_Shape& aHole = aHoleSolidMap.FindKey(i);
const TopoDS_Shape& aSolid = aHoleSolidMap(i);
// Add Holes to Solids and add them to myAreas
aItLS.Initialize(aNewSolids);
- for ( ; aItLS.More(); aItLS.Next())
+ Message_ProgressScope aPS4(theMainPS.Next(), "Adding Holes to Solids", aNewSolids.Size());
+ for ( ; aItLS.More(); aItLS.Next(), aPS4.Next())
{
TopoDS_Solid& aSolid = *(TopoDS_Solid*)&aItLS.Value();
const TopTools_ListOfShape* pLHoles = aSolidHolesMap.Seek(aSolid);
// Add holes that outside the solids to myAreas
aNbH = aHoleShells.Extent();
- for (i = 1; i <= aNbH; ++i)
+ Message_ProgressScope aPS5(theMainPS.Next(), "Add holes that outside the solids to myAreas", aNbH);
+ for (i = 1; i <= aNbH; ++i, aPS5.Next())
{
const TopoDS_Shape& aHole = aHoleShells(i);
if (!aHoleSolidMap.Contains(aHole))
//function : PerformInternalShapes
//purpose :
//=======================================================================
-void BOPAlgo_BuilderSolid::PerformInternalShapes()
-{
+void BOPAlgo_BuilderSolid::PerformInternalShapes(const Message_ProgressRange& theRange)
+{
if (myAvoidInternalShapes)
- // user-defined option to avoid internal parts is in force
- return;
+ // user-defined option to avoid internal parts is in force
+ return;
if (myLoopsInternal.IsEmpty())
- // no internal parts
- return;
+ // no internal parts
+ return;
// Get all faces to classify
TopTools_IndexedMapOfShape aMFs;
TopTools_ListIteratorOfListOfShape aItLS(myLoopsInternal);
- for (; aItLS.More(); aItLS.Next())
+ Message_ProgressScope aMainPS(theRange, "PerformInternalShapes", 3);
+ Message_ProgressScope aSPrSc(aMainPS.Next(), "PerformInternalShapes", myLoopsInternal.Size());
+ for (; aItLS.More(); aItLS.Next(), aSPrSc.Next())
{
const TopoDS_Shape& aShell = aItLS.Value();
TopoDS_Iterator aIt(aShell);
TopTools_MapOfShape aMFDone;
Standard_Integer aNbS = aMSLF.Extent();
- for (i = 1; i <= aNbS; ++i)
+ Message_ProgressScope aSPrSc1(aMainPS.Next(), "Update Solids by internal Faces", aNbS);
+ for (i = 1; i <= aNbS; ++i, aSPrSc1.Next())
{
const TopoDS_Shape& aSolid = aMSLF.FindKey(i);
TopoDS_Shape *pSolid = (TopoDS_Shape*)&aSolid;
//! - that are alone but given twice with different orientation.
//! These faces will be put into the map *myShapesToAvoid* and will be
//! avoided in shells construction, but will be classified later on.
- Standard_EXPORT virtual void PerformShapesToAvoid() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Build all possible closed shells from the given faces.
//! The method fills the following maps:
//! - myLoops - Created closed shells;
//! - myLoopsInternal - The shells created from unused faces.
- Standard_EXPORT virtual void PerformLoops() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformLoops(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Classifies the created shells on the Holes and Growths.
//! Creates the solids from the Growths shells.
//! Puts the Hole shells into the closest Growths solids.
- Standard_EXPORT virtual void PerformAreas() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformAreas(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Classifies the unused faces relatively the created solids.
//! Puts the classified faces into the closest solids as internal shells.
//! Warns the user about unclassified faces if any.
- Standard_EXPORT virtual void PerformInternalShapes() Standard_OVERRIDE;
+ Standard_EXPORT virtual void PerformInternalShapes(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
private:
TopTools_DataMapOfShapeBox myBoxes; // Boxes of the produced solids
-
+
};
#endif // _BOPAlgo_BuilderSolid_HeaderFile
void BOPAlgo_Builder::FillImagesFaces(const Message_ProgressRange& theRange)
{
Message_ProgressScope aPS(theRange, "FillImagesFaces", 1);
- BuildSplitFaces();
- if (!aPS.More())
- {
- return;
- }
+ BuildSplitFaces(aPS.Next());
FillSameDomainFaces();
- if (!aPS.More())
- {
- return;
- }
FillInternalVertices();
}
//=======================================================================
//function : BuildSplitFaces
//purpose :
//=======================================================================
-void BOPAlgo_Builder::BuildSplitFaces()
+void BOPAlgo_Builder::BuildSplitFaces(const Message_ProgressRange& theRange)
{
Standard_Boolean bHasFaceInfo, bIsClosed, bIsDegenerated, bToReverse;
Standard_Integer i, j, k, aNbS, aNbPBIn, aNbPBOn, aNbPBSc, aNbAV, nSp;
//===================================================
//
Standard_Integer aNbBF = aVBF.Length();
+ Message_ProgressScope aPS(theRange, "Builder Face", aNbBF);
for (k = 0; k < aNbBF; ++k)
{
- BOPAlgo_BuilderFace& aBF = aVBF(k);
+ BOPAlgo_BuilderFace& aBF = aVBF(k);
aFacesIm.Add(myDS->Index(aBF.Face()), aBF.Areas());
myReport->Merge(aBF.GetReport());
+ aBF.Perform(aPS.Next());
}
aNbBF = aFacesIm.Extent();
{
return;
}
+ //std::cout << "FillImagesSolids:theRange = " << theRange.IsActive() << std::endl;
// Build split of the solids
- BuildSplitSolids(aDraftSolids);
+ BuildSplitSolids(aDraftSolids, aPS.Next());
if (!aPS.More())
{
return;
//! Returns the solid
const TopoDS_Solid& Solid() const { return mySolid; }
+ void SetProgress(const Message_ProgressRange& theRange)
+ {
+ myRange = theRange;
+ }
+
+ virtual void Perform(const Message_ProgressRange& /*theRange*/ = Message_ProgressRange())
+ {
+ BOPAlgo_BuilderSolid::Perform(myRange);
+ }
+
private:
TopoDS_Solid mySolid; //!< Solid to split
+ Message_ProgressRange myRange;
};
// Vector of Solid Builders
//function : BuildSplitSolids
//purpose :
//=======================================================================
-void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSolids)
+void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSolids, const Message_ProgressRange& theRange)
{
Standard_Boolean bFlagSD;
Standard_Integer i, aNbS;
//
// 0. Find same domain solids for non-interfered solids
aNbS=myDS->NbSourceShapes();
+
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
//
//
aNbBS=aVBS.Length();
//
+
+ Message_ProgressScope aPS(theRange, "Builder solid", aNbBS);
+ for (Standard_Integer index = 0; index < aNbBS; index++) {
+ BOPAlgo_SplitSolid& aSplitSolid = aVBS.ChangeValue(index);
+ aSplitSolid.SetProgress(aPS.Next());
+ }
//===================================================
BOPTools_Parallel::Perform (myRunParallel, aVBS);
//===================================================
//
- for (k = 0; k < aNbBS; ++k)
+ for (k = 0; k < aNbBS; ++k)
{
BOPAlgo_SplitSolid& aBS = aVBS(k);
aSolidsIm.Add(aBS.Solid(), aBS.Areas());
Standard_Boolean isHistory = HasHistory();
SetToFillHistory(Standard_False);
// Perform splitting of the arguments
- Message_ProgressScope aPS(theRange, "BOPAlgo_CellsBuilder", 1);
+ Message_ProgressScope aPS(theRange, "BOPAlgo_CellsBuilder", 2);
BOPAlgo_Builder::PerformInternal1(theFiller, aPS.Next());
if (HasErrors() || !aPS.More()) {
return;
return *myPCB;
}
//
+ void SetProgress(const Message_ProgressRange& theRange)
+ {
+ myRange = theRange;
+ }
+ //
void Perform() {
BOPAlgo_ShellSplitter::SplitBlock(*myPCB);
}
protected:
BOPTools_ConnexityBlock *myPCB;
+
+ private:
+ Message_ProgressRange myRange;
};
//=======================================================================
typedef NCollection_Vector<BOPAlgo_CBK> BOPAlgo_VectorOfCBK;
//function : Perform
//purpose :
//=======================================================================
-void BOPAlgo_ShellSplitter::Perform(const Message_ProgressRange& /*theRange*/)
+void BOPAlgo_ShellSplitter::Perform(const Message_ProgressRange& theRange)
{
GetReport()->Clear();
+ Message_ProgressScope aPS(theRange, "Perform", 1);
//
BOPTools_AlgoTools::MakeConnexityBlocks
(myStartShapes, TopAbs_EDGE, TopAbs_FACE, myLCB);
//
- MakeShells();
+ MakeShells(aPS.Next());
}
//=======================================================================
//function : MakeShells
//purpose :
//=======================================================================
-void BOPAlgo_ShellSplitter::MakeShells()
+void BOPAlgo_ShellSplitter::MakeShells(const Message_ProgressRange& theRange)
{
Standard_Boolean bIsRegular;
Standard_Integer aNbVCBK, k;
myShells.Clear();
//
aItCB.Initialize(myLCB);
- for (; aItCB.More(); aItCB.Next()) {
+ Message_ProgressScope aPSOuter(theRange, "Make shells", 10);
+ Message_ProgressScope aPS(aPSOuter.Next(1), "Iteration", myLCB.Size());
+ for (; aItCB.More(); aItCB.Next(), aPS.Next()) {
BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue();
bIsRegular=aCB.IsRegular();
if (bIsRegular) {
}
//
aNbVCBK=aVCBK.Length();
+
+ //Message_ProgressScope aPS(aPSOuter.Next(8), "MS", aNbVCBK);
+ //for (Standard_Integer index = 0; index < aNbVCBK; index++) {
+ //BOPAlgo_CBK& aUselessCBK = aVCBK.ChangeValue(index);
+ //aUselessCBK.SetProgress(aPS.Next());
+ //}
+
//===================================================
BOPTools_Parallel::Perform (myRunParallel, aVCBK);
//===================================================
- for (k=0; k<aNbVCBK; ++k) {
+ if (!aPSOuter.More())
+ return;
+ //
+ Message_ProgressScope aPS2(aPSOuter.Next(8), "Post treatment", aNbVCBK);
+ for (k=0; k<aNbVCBK; ++k, aPS2.Next()) {
BOPAlgo_CBK& aCBK=aVCBK(k);
const BOPTools_ConnexityBlock& aCB=aCBK.ConnexityBlock();
const TopTools_ListOfShape& aLS=aCB.Loops();
protected:
- Standard_EXPORT void MakeShells();
+ Standard_EXPORT void MakeShells(const Message_ProgressRange& theRange = Message_ProgressRange());
TopTools_ListOfShape myStartShapes;
//function : Perform
//purpose :
//=======================================================================
-void BOPAlgo_WireSplitter::Perform(const Message_ProgressRange& /*theRange*/)
+void BOPAlgo_WireSplitter::Perform(const Message_ProgressRange& theRange)
{
GetReport()->Clear();
+ Message_ProgressScope aPS(theRange, "Perform", 1);
//
CheckData();
if (HasErrors()) {
BOPTools_AlgoTools::MakeConnexityBlocks
(myWES->StartElements(), TopAbs_VERTEX, TopAbs_EDGE, myLCB);
- MakeWires();
+ MakeWires(aPS.Next());
}
/////////////////////////////////////////////////////////////////////////
//function : MakeWires
//purpose :
//=======================================================================
-void BOPAlgo_WireSplitter::MakeWires()
+void BOPAlgo_WireSplitter::MakeWires(const Message_ProgressRange& theRange)
{
Standard_Boolean bIsRegular;
Standard_Integer aNbVCB, k;
BOPAlgo_VectorOfConnexityBlock aVCB;
//
const TopoDS_Face& aF=myWES->Face();
+ Message_ProgressScope aPSOuter(theRange, "Make shells", 10);
//
- aItCB.Initialize(myLCB);
- for (; aItCB.More(); aItCB.Next()) {
+ aItCB.Initialize(myLCB);
+ Message_ProgressScope aPS(aPSOuter.Next(1), "Iteration", myLCB.Size());
+ for (; aItCB.More(); aItCB.Next(), aPS.Next()) {
BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue();
bIsRegular=aCB.IsRegular();
if (bIsRegular) {
//===================================================
BOPTools_Parallel::Perform (myRunParallel, aVCB, myContext);
//===================================================
+ if (!aPSOuter.More())
+ return;
aNbVCB=aVCB.Length();
- for (k=0; k<aNbVCB; ++k) {
+ Message_ProgressScope aPS2(aPSOuter.Next(8), "Post treatment", aNbVCB);
+ for (k=0; k<aNbVCB; ++k, aPS2.Next()) {
const BOPAlgo_WS_ConnexityBlock& aCB=aVCB(k);
const TopTools_ListOfShape& aLW=aCB.ConnexityBlock().Loops();
aIt.Initialize(aLW);
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
- Standard_EXPORT void MakeWires();
+ Standard_EXPORT void MakeWires(const Message_ProgressRange& theRange = Message_ProgressRange());
BOPAlgo_PWireEdgeSet myWES;
BOPTools_ListOfConnexityBlock myLCB;
pBuilder->SetCheckInverted(BOPTest_Objects::CheckInverted());
pBuilder->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
//
+
OSD_Timer aTimer;
aTimer.Start();
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
//
- pBuilder->PerformWithFiller(aPF);
+ pBuilder->PerformWithFiller(aPF, aProgress->Start());
+ if (aProgress->UserBreak())
+ {
+ di << "Error: User break";
+ return 0;
+ }
BOPTest::ReportAlerts(pBuilder->GetReport());
// Set history of Boolean operation into the session