mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -83,13 +83,45 @@ void BOPAlgo_Section::CheckData()
|
||||
//
|
||||
CheckFiller();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: fillPIConstants
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_Section::fillPIConstants (const Standard_Real theWhole,
|
||||
BOPAlgo_PISteps& theSteps) const
|
||||
{
|
||||
// Fill in the constants:
|
||||
if (myFillHistory)
|
||||
{
|
||||
// for FillHistroty, which takes about 10% of the whole operation
|
||||
theSteps.SetStep(PIOperation_FillHistory, 10. * theWhole / 100.);
|
||||
}
|
||||
|
||||
// and for PostTreat, which takes about 5% of the whole operation
|
||||
theSteps.SetStep(PIOperation_PostTreat, 5. * theWhole / 100.);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: fillPISteps
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_Section::fillPISteps (BOPAlgo_PISteps& theSteps) const
|
||||
{
|
||||
// Compute the rest of the operations - all depend on the number of sub-shapes of certain type
|
||||
NbShapes aNbShapes = getNbShapes();
|
||||
theSteps.SetStep(PIOperation_TreatVertices, aNbShapes.NbVertices());
|
||||
theSteps.SetStep(PIOperation_TreatEdges, aNbShapes.NbEdges());
|
||||
theSteps.SetStep(PIOperation_BuildSection, aNbShapes.NbEdges() + aNbShapes.NbFaces());
|
||||
}
|
||||
//=======================================================================
|
||||
//function : PerformInternal1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Section::PerformInternal1
|
||||
(const BOPAlgo_PaveFiller& theFiller)
|
||||
(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange)
|
||||
{
|
||||
Message_ProgressScope aPS(theRange, "Building result of SECTION operation", 100);
|
||||
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
|
||||
myDS=myPaveFiller->PDS();
|
||||
myContext=myPaveFiller->Context();
|
||||
@@ -106,9 +138,11 @@ void BOPAlgo_Section::PerformInternal1
|
||||
return;
|
||||
}
|
||||
//
|
||||
BOPAlgo_PISteps aSteps (PIOperation_Last);
|
||||
analyzeProgress(100., aSteps);
|
||||
// 3. Fill Images
|
||||
// 3.1 Vertices
|
||||
FillImagesVertices();
|
||||
FillImagesVertices(aPS.Next(aSteps.GetStep(PIOperation_TreatVertices)));
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
@@ -118,7 +152,7 @@ void BOPAlgo_Section::PerformInternal1
|
||||
return;
|
||||
}
|
||||
// 3.2 Edges
|
||||
FillImagesEdges();
|
||||
FillImagesEdges(aPS.Next(aSteps.GetStep(PIOperation_TreatEdges)));
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
@@ -128,26 +162,25 @@ void BOPAlgo_Section::PerformInternal1
|
||||
return;
|
||||
}
|
||||
// 4. Section
|
||||
BuildSection();
|
||||
//
|
||||
BuildSection(aPS.Next(aSteps.GetStep(PIOperation_BuildSection)));
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
// 5.History
|
||||
PrepareHistory();
|
||||
//
|
||||
PrepareHistory(aPS.Next(aSteps.GetStep(PIOperation_FillHistory)));
|
||||
if (HasErrors()) {
|
||||
return;
|
||||
}
|
||||
// 6. Post-treatment
|
||||
PostTreat();
|
||||
PostTreat(aPS.Next(aSteps.GetStep(PIOperation_PostTreat)));
|
||||
}
|
||||
//=======================================================================
|
||||
//function : BuildSection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_Section::BuildSection()
|
||||
void BOPAlgo_Section::BuildSection(const Message_ProgressRange& theRange)
|
||||
{
|
||||
Message_ProgressScope aPS(theRange, "Building the result of Section operation", 1);
|
||||
Standard_Integer i, aNbMS, aNbLE;
|
||||
Standard_Integer j, nE, nV, aNb, aNbF, aNbPBSc;
|
||||
TopoDS_Shape aRC, aRC1;
|
||||
@@ -174,6 +207,10 @@ void BOPAlgo_Section::BuildSection()
|
||||
if (aSI.ShapeType()!=TopAbs_FACE) {
|
||||
continue;
|
||||
}
|
||||
if (UserBreak(aPS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//
|
||||
const BOPDS_FaceInfo& aFI=myDS->FaceInfo(i);
|
||||
//
|
||||
@@ -250,6 +287,10 @@ void BOPAlgo_Section::BuildSection()
|
||||
// 3.1 Set to treat => aLS
|
||||
aIt.Initialize(aLSA);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
if (UserBreak(aPS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
const TopoDS_Shape& aSA=aIt.Value();
|
||||
//
|
||||
aLS.Clear();
|
||||
@@ -331,6 +372,10 @@ void BOPAlgo_Section::BuildSection()
|
||||
//
|
||||
aNbMS=aMVE.Extent();
|
||||
for (i=1; i<=aNbMS; ++i) {
|
||||
if (UserBreak(aPS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
const TopoDS_Shape& aV=aMVE.FindKey(i);
|
||||
const TopTools_ListOfShape& aLE=aMVE.FindFromIndex(i);
|
||||
aNbLE=aLE.Extent();
|
||||
|
Reference in New Issue
Block a user