mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0021264: Modeling Algorithms - Progress indicator for Boolean operations
Update BOP commands to use progress indicator Deleted wrong usage of progress indicator from bop operations Added UserBreak() method to break execution boolean operation if progress indicator is used Added method AnalyzeProgress() to calculate steps of progress indicator Introduce BOPAlgo_ParallelAlgo which has myRange as a field to be used in parallel vector. Provide suitable way of keeping the progress steps of operations. Give meaningful names to progress scopes. Propagate progress indicator into deeper methods of BOA. Add progress indicator to BOPAlgo_BuilderFace and BOPAlgo_WireSplitter, BOPAlgo_BuilderSolid and BOPAlgo_ShellSplitter
This commit is contained in:
@@ -213,45 +213,76 @@
|
||||
//function : PerformResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepFeat_Builder::PerformResult()
|
||||
void BRepFeat_Builder::PerformResult(const Message_ProgressRange& theRange)
|
||||
{
|
||||
myOperation = myFuse ? BOPAlgo_FUSE : BOPAlgo_CUT;
|
||||
//
|
||||
if (!myShapes.IsEmpty()) {
|
||||
//
|
||||
Prepare();
|
||||
//
|
||||
RebuildFaces();
|
||||
//
|
||||
FillImagesContainers(TopAbs_SHELL);
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
FillImagesSolids();
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
CheckSolidImages();
|
||||
//
|
||||
BuildResult(TopAbs_SOLID);
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
FillImagesCompounds();
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildResult(TopAbs_COMPOUND);
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
if (myShapes.IsEmpty())
|
||||
{
|
||||
BuildShape(theRange);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aWhole = 100.;
|
||||
Message_ProgressScope aPS(theRange, "BRepFeat_Builder", aWhole);
|
||||
Standard_Real aBSPart = 15;
|
||||
aWhole -= aBSPart;
|
||||
|
||||
// Compute PI steps
|
||||
const Standard_Integer aSize = 4;
|
||||
NCollection_Array1<Standard_Real> aSteps(0, aSize - 1);
|
||||
{
|
||||
for (Standard_Integer i = 0; i < aSize; ++i)
|
||||
aSteps(i) = 0.;
|
||||
|
||||
NbShapes aNbShapes = getNbShapes();
|
||||
Standard_Real aTreatFaces = 5 * aNbShapes.NbFaces();
|
||||
Standard_Real aTreatShells = aNbShapes.NbShells();
|
||||
Standard_Real aTreatSolids = 20 * aNbShapes.NbSolids();
|
||||
Standard_Real aTreatCompounds = aNbShapes.NbCompounds();
|
||||
|
||||
Standard_Real aSum = aTreatFaces + aTreatShells + aTreatSolids + aTreatCompounds;
|
||||
if (aSum > 0)
|
||||
{
|
||||
aSteps(0) = aTreatFaces * aWhole / aSum;
|
||||
aSteps(1) = aTreatShells * aWhole / aSum;
|
||||
aSteps(2) = aTreatSolids * aWhole / aSum;
|
||||
aSteps(3) = aTreatCompounds * aWhole / aSum;
|
||||
}
|
||||
}
|
||||
//
|
||||
BuildShape();
|
||||
Prepare();
|
||||
//
|
||||
RebuildFaces();
|
||||
aPS.Next(aSteps(0));
|
||||
//
|
||||
FillImagesContainers(TopAbs_SHELL, aPS.Next(aSteps(1)));
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
FillImagesSolids(aPS.Next(aSteps(2)));
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
CheckSolidImages();
|
||||
//
|
||||
BuildResult(TopAbs_SOLID);
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
FillImagesCompounds(aPS.Next(aSteps(3)));
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildResult(TopAbs_COMPOUND);
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BuildShape(aPS.Next(aBSPart));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -732,11 +763,12 @@
|
||||
//function : FillIn3DParts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepFeat_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids)
|
||||
void BRepFeat_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
GetReport()->Clear();
|
||||
|
||||
BOPAlgo_Builder::FillIn3DParts(theDraftSolids);
|
||||
BOPAlgo_Builder::FillIn3DParts(theDraftSolids, theRange);
|
||||
|
||||
// Clear the IN parts of the solids from the removed faces
|
||||
TopTools_DataMapOfShapeListOfShape::Iterator itM(myInParts);
|
||||
|
@@ -89,7 +89,7 @@ Standard_EXPORT virtual ~BRepFeat_Builder();
|
||||
|
||||
//! Main function to build the result of the
|
||||
//! local operation required.
|
||||
Standard_EXPORT void PerformResult();
|
||||
Standard_EXPORT void PerformResult(const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
//! Rebuilds faces in accordance with the kept parts of the tool.
|
||||
Standard_EXPORT void RebuildFaces();
|
||||
@@ -112,12 +112,12 @@ Standard_EXPORT virtual ~BRepFeat_Builder();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Prepares builder of local operation.
|
||||
Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
|
||||
|
||||
//! Function is redefined to avoid the usage of removed faces.
|
||||
Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeShape& theDraftSolids) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeShape& theDraftSolids,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE;
|
||||
|
||||
//! Avoid the check for open solids and always use the splits
|
||||
//! of solids for building the result shape.
|
||||
|
@@ -26,7 +26,7 @@
|
||||
//function : Build
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepFeat_Gluer::Build()
|
||||
void BRepFeat_Gluer::Build(const Message_ProgressRange& /*theRange*/)
|
||||
{
|
||||
myGluer.Perform();
|
||||
if (myGluer.IsDone()) {
|
||||
|
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
//! This is called by Shape(). It does nothing but
|
||||
//! may be redefined.
|
||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! returns the status of the Face after
|
||||
//! the shape creation.
|
||||
|
@@ -33,7 +33,7 @@
|
||||
//function : Build
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepFeat_SplitShape::Build ()
|
||||
void BRepFeat_SplitShape::Build (const Message_ProgressRange& /*theRange*/)
|
||||
{
|
||||
mySShape.Perform(myWOnShape);
|
||||
if (mySShape.IsDone()) {
|
||||
|
@@ -109,7 +109,7 @@ public:
|
||||
Standard_EXPORT const TopTools_ListOfShape& Right() const;
|
||||
|
||||
//! Builds the cut and the resulting faces and edges as well.
|
||||
Standard_EXPORT void Build() Standard_OVERRIDE;
|
||||
Standard_EXPORT void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the shape has been deleted.
|
||||
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& S) Standard_OVERRIDE;
|
||||
|
Reference in New Issue
Block a user