From d03c08988c259682fbcb21a908bb25d5b6a3d5b4 Mon Sep 17 00:00:00 2001 From: akaftasev Date: Wed, 1 Sep 2021 12:48:54 +0300 Subject: [PATCH] 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 --- dox/upgrade/upgrade.md | 10 + src/BOPAlgo/BOPAlgo_Alerts.hxx | 3 + src/BOPAlgo/BOPAlgo_Algo.cxx | 66 +++++ src/BOPAlgo/BOPAlgo_Algo.hxx | 101 ++++++- src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx | 72 +++-- src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.hxx | 4 +- src/BOPAlgo/BOPAlgo_BOP.cxx | 125 +++++++-- src/BOPAlgo/BOPAlgo_BOP.hxx | 25 +- src/BOPAlgo/BOPAlgo_Builder.cxx | 171 +++++++++--- src/BOPAlgo/BOPAlgo_Builder.hxx | 136 +++++++--- src/BOPAlgo/BOPAlgo_BuilderArea.hxx | 8 +- src/BOPAlgo/BOPAlgo_BuilderFace.cxx | 104 +++++--- src/BOPAlgo/BOPAlgo_BuilderFace.hxx | 25 +- src/BOPAlgo/BOPAlgo_BuilderSolid.cxx | 98 +++++-- src/BOPAlgo/BOPAlgo_BuilderSolid.hxx | 10 +- src/BOPAlgo/BOPAlgo_Builder_1.cxx | 34 ++- src/BOPAlgo/BOPAlgo_Builder_2.cxx | 166 +++++++++--- src/BOPAlgo/BOPAlgo_Builder_3.cxx | 126 +++++++-- src/BOPAlgo/BOPAlgo_Builder_4.cxx | 10 +- src/BOPAlgo/BOPAlgo_CellsBuilder.cxx | 15 +- src/BOPAlgo/BOPAlgo_CellsBuilder.hxx | 2 +- src/BOPAlgo/BOPAlgo_CheckerSI.cxx | 53 ++-- src/BOPAlgo/BOPAlgo_CheckerSI.hxx | 16 +- src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx | 103 +++++-- src/BOPAlgo/BOPAlgo_MakerVolume.cxx | 68 +++-- src/BOPAlgo/BOPAlgo_MakerVolume.hxx | 28 +- src/BOPAlgo/BOPAlgo_Options.cxx | 31 +-- src/BOPAlgo/BOPAlgo_Options.hxx | 14 +- src/BOPAlgo/BOPAlgo_PaveFiller.cxx | 251 ++++++++++++------ src/BOPAlgo/BOPAlgo_PaveFiller.hxx | 51 ++-- src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx | 21 +- src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx | 47 +++- src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx | 111 ++++++-- src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx | 37 ++- src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx | 103 +++++-- src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx | 75 ++++-- src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx | 106 ++++++-- src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx | 10 +- src/BOPAlgo/BOPAlgo_RemoveFeatures.cxx | 2 +- src/BOPAlgo/BOPAlgo_RemoveFeatures.hxx | 2 +- src/BOPAlgo/BOPAlgo_Section.cxx | 63 ++++- src/BOPAlgo/BOPAlgo_Section.hxx | 25 +- src/BOPAlgo/BOPAlgo_ShellSplitter.cxx | 34 ++- src/BOPAlgo/BOPAlgo_ShellSplitter.hxx | 4 +- src/BOPAlgo/BOPAlgo_Splitter.cxx | 12 +- src/BOPAlgo/BOPAlgo_Splitter.hxx | 2 +- src/BOPAlgo/BOPAlgo_Tools.cxx | 39 ++- src/BOPAlgo/BOPAlgo_Tools.hxx | 4 +- src/BOPAlgo/BOPAlgo_WireSplitter.cxx | 35 ++- src/BOPAlgo/BOPAlgo_WireSplitter.hxx | 4 +- src/BOPTest/BOPTest_APICommands.cxx | 11 +- src/BOPTest/BOPTest_BOPCommands.cxx | 54 ++-- src/BOPTest/BOPTest_CellsCommands.cxx | 6 +- src/BOPTest/BOPTest_CheckCommands.cxx | 8 +- src/BOPTest/BOPTest_PartitionCommands.cxx | 18 +- src/BRepAlgo/BRepAlgo_Section.cxx | 2 +- src/BRepAlgo/BRepAlgo_Section.hxx | 2 +- src/BRepAlgoAPI/BRepAlgoAPI_Algo.hxx | 1 - .../BRepAlgoAPI_BooleanOperation.cxx | 31 ++- .../BRepAlgoAPI_BooleanOperation.hxx | 2 +- src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx | 26 +- src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.hxx | 6 +- src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx | 23 +- src/BRepAlgoAPI/BRepAlgoAPI_Check.hxx | 11 +- src/BRepAlgoAPI/BRepAlgoAPI_Common.cxx | 10 +- src/BRepAlgoAPI/BRepAlgoAPI_Common.hxx | 9 +- src/BRepAlgoAPI/BRepAlgoAPI_Cut.cxx | 10 +- src/BRepAlgoAPI/BRepAlgoAPI_Cut.hxx | 7 +- src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.cxx | 2 +- src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.hxx | 2 +- src/BRepAlgoAPI/BRepAlgoAPI_Fuse.cxx | 10 +- src/BRepAlgoAPI/BRepAlgoAPI_Fuse.hxx | 6 +- src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx | 4 +- src/BRepAlgoAPI/BRepAlgoAPI_Section.hxx | 2 +- src/BRepAlgoAPI/BRepAlgoAPI_Splitter.cxx | 7 +- src/BRepAlgoAPI/BRepAlgoAPI_Splitter.hxx | 2 +- .../BRepBuilderAPI_MakeShape.cxx | 2 +- .../BRepBuilderAPI_MakeShape.hxx | 3 +- src/BRepFeat/BRepFeat_Builder.cxx | 104 +++++--- src/BRepFeat/BRepFeat_Builder.hxx | 6 +- src/BRepFeat/BRepFeat_Gluer.cxx | 2 +- src/BRepFeat/BRepFeat_Gluer.hxx | 2 +- src/BRepFeat/BRepFeat_SplitShape.cxx | 2 +- src/BRepFeat/BRepFeat_SplitShape.hxx | 2 +- src/BRepFill/BRepFill_Draft.cxx | 6 +- .../BRepFilletAPI_MakeChamfer.cxx | 2 +- .../BRepFilletAPI_MakeChamfer.hxx | 2 +- .../BRepFilletAPI_MakeFillet.cxx | 2 +- .../BRepFilletAPI_MakeFillet.hxx | 2 +- .../BRepFilletAPI_MakeFillet2d.cxx | 2 +- .../BRepFilletAPI_MakeFillet2d.hxx | 2 +- .../BRepOffsetAPI_DraftAngle.cxx | 2 +- .../BRepOffsetAPI_DraftAngle.hxx | 2 +- .../BRepOffsetAPI_MakeEvolved.cxx | 2 +- .../BRepOffsetAPI_MakeEvolved.hxx | 2 +- .../BRepOffsetAPI_MakeFilling.cxx | 2 +- .../BRepOffsetAPI_MakeFilling.hxx | 2 +- .../BRepOffsetAPI_MakeOffset.cxx | 2 +- .../BRepOffsetAPI_MakeOffset.hxx | 2 +- .../BRepOffsetAPI_MakeOffsetShape.cxx | 2 +- .../BRepOffsetAPI_MakeOffsetShape.hxx | 2 +- src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.cxx | 2 +- src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.hxx | 2 +- .../BRepOffsetAPI_MakePipeShell.cxx | 2 +- .../BRepOffsetAPI_MakePipeShell.hxx | 2 +- .../BRepOffsetAPI_MakeThickSolid.cxx | 2 +- .../BRepOffsetAPI_MakeThickSolid.hxx | 2 +- .../BRepOffsetAPI_MiddlePath.cxx | 2 +- .../BRepOffsetAPI_MiddlePath.hxx | 2 +- .../BRepOffsetAPI_NormalProjection.cxx | 2 +- .../BRepOffsetAPI_NormalProjection.hxx | 2 +- .../BRepOffsetAPI_ThruSections.cxx | 2 +- .../BRepOffsetAPI_ThruSections.hxx | 2 +- src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx | 2 +- src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.hxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeBox.cxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeBox.hxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.hxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakePrism.cxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakePrism.hxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeRevol.hxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeWedge.cxx | 2 +- src/BRepPrimAPI/BRepPrimAPI_MakeWedge.hxx | 2 +- src/BRepTest/BRepTest_FilletCommands.cxx | 10 +- src/Draw/Draw_ProgressIndicator.cxx | 2 +- .../ShapeConstruct_MakeTriangulation.cxx | 2 +- .../ShapeConstruct_MakeTriangulation.hxx | 2 +- tests/bugs/modalg_7/bug21264 | 117 ++++++++ 130 files changed, 2407 insertions(+), 869 deletions(-) create mode 100644 tests/bugs/modalg_7/bug21264 diff --git a/dox/upgrade/upgrade.md b/dox/upgrade/upgrade.md index b5f57b5838..a19bc6335f 100644 --- a/dox/upgrade/upgrade.md +++ b/dox/upgrade/upgrade.md @@ -2253,3 +2253,13 @@ Access to an OCAF label via its entry is accelerated. In order to activate it, c The method *TDF_Tool::Label()*, which returns a label by an entry, becomes faster for about 10 .. 20 times. It has sense for applications, which use an entry as a unique key to access the data in OCAF tree. Also, the method *TDF_Tool::Entry()*, which returns an entry for a label, is accelerated as well. + +@subsection upgrade_occt760_bop_progress_indicator Progress indicator in Boolean operations + +Method SetProgressIndicator() has been removed due to Progress indicator mechanism refactoring. +To enable progress indicator and user break in Boolean operations user has to pass progress range as a parameter to Perform or Build method. +For example: +~~~~ +Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); +BRepAlgoApi_Cut(S1, S2, aProgress->Start()); // method Start() creates range for usage in cut algorithm +~~~~ diff --git a/src/BOPAlgo/BOPAlgo_Alerts.hxx b/src/BOPAlgo/BOPAlgo_Alerts.hxx index 3871c58fcd..d670a6e437 100644 --- a/src/BOPAlgo/BOPAlgo_Alerts.hxx +++ b/src/BOPAlgo/BOPAlgo_Alerts.hxx @@ -18,6 +18,9 @@ #include +//! Boolean operation was stopped by user +DEFINE_SIMPLE_ALERT(BOPAlgo_AlertUserBreak) + //! Boolean operation of given type is not allowed on the given inputs DEFINE_SIMPLE_ALERT(BOPAlgo_AlertBOPNotAllowed) diff --git a/src/BOPAlgo/BOPAlgo_Algo.cxx b/src/BOPAlgo/BOPAlgo_Algo.cxx index 1fd54eced9..794a32eb10 100644 --- a/src/BOPAlgo/BOPAlgo_Algo.cxx +++ b/src/BOPAlgo/BOPAlgo_Algo.cxx @@ -18,6 +18,8 @@ #include +#include + //======================================================================= // function: // purpose: @@ -60,3 +62,67 @@ void BOPAlgo_Algo::CheckResult() { GetReport()->Clear(Message_Fail); } + +//======================================================================= +// function: analyzeProgress +// purpose: +//======================================================================= +void BOPAlgo_Algo::analyzeProgress(const Standard_Real theWhole, + BOPAlgo_PISteps& theSteps) const +{ + Standard_Real aWhole = theWhole; + + // Fill progress steps for constant operations + fillPIConstants(theWhole, theSteps); + + TColStd_Array1OfReal& aSteps = theSteps.ChangeSteps(); + TColStd_MapOfInteger aMIConst; + for (Standard_Integer i = aSteps.Lower(); i <= aSteps.Upper(); ++i) + { + if (aSteps(i) > 0.) + { + aMIConst.Add(i); + aWhole -= aSteps(i); + } + } + + // Fill progress steps for other operations + fillPISteps(theSteps); + + Standard_Real aSum = 0.; + for (Standard_Integer i = aSteps.Lower(); i <= aSteps.Upper(); ++i) + { + if (!aMIConst.Contains(i)) + { + aSum += aSteps(i); + } + } + + // Normalize steps + if (aSum > 0.) + { + for (Standard_Integer i = aSteps.Lower(); i <= aSteps.Upper(); ++i) + { + if (!aMIConst.Contains(i)) + { + aSteps(i) = aWhole * aSteps(i) / aSum; + } + } + } +} + +//======================================================================= +// function: fillPIConstants +// purpose: +//======================================================================= +void BOPAlgo_Algo::fillPIConstants (const Standard_Real, BOPAlgo_PISteps&) const +{ +} + +//======================================================================= +// function: fillPISteps +// purpose: +//======================================================================= +void BOPAlgo_Algo::fillPISteps(BOPAlgo_PISteps&) const +{ +} diff --git a/src/BOPAlgo/BOPAlgo_Algo.hxx b/src/BOPAlgo/BOPAlgo_Algo.hxx index fb62632d28..d65caf1878 100644 --- a/src/BOPAlgo/BOPAlgo_Algo.hxx +++ b/src/BOPAlgo/BOPAlgo_Algo.hxx @@ -21,9 +21,13 @@ #include #include #include +#include +#include #include +class BOPAlgo_PISteps; + //! The class provides the root interface for the algorithms in Boolean Component.
class BOPAlgo_Algo : public BOPAlgo_Options { @@ -31,7 +35,9 @@ public: DEFINE_STANDARD_ALLOC - Standard_EXPORT virtual void Perform() = 0; + //! The main method to implement the operation + //! Providing the range allows to enable Progress indicator User break functionalities. + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0; protected: @@ -47,6 +53,99 @@ protected: //! Checks the obtained result Standard_EXPORT virtual void CheckResult(); +protected: //! @name Analyzing operations to fill progress indicator + + //! Analyze progress steps of the whole operation. + //! @param theWhole - sum of progress of all operations. + //! @oaram theSteps - steps of the operations supported by PI + //! + //! To use this method, one has to override the following methods: + //! * fillPIConstants - method filling values for constant operations. + //! * fillPISteps - method filling steps for the rest of operations. + Standard_EXPORT void analyzeProgress(const Standard_Real theWhole, + BOPAlgo_PISteps& theSteps) const; + + //! Fills the values for constant operations - the operations having constant relative running time. + //! @param theWhole - sum of all operations supported by PI, i.e. the value to normalize the steps to, if necessary. + //! @param theSteps - steps of the operations supported by PI + Standard_EXPORT virtual void fillPIConstants(const Standard_Real theWhole, + BOPAlgo_PISteps& theSteps) const; + + //! Fills the values for the operations dependent on the inputs. + //! Filled values may not be normalized to represent percentage of total running time. + //! The values should just correlate to each other. + //! E.g. if progress depends on the number of input shapes, the values may look like this: + //! step1 = number_of_input_vertices; + //! step2 = 2 * number_of_input_edges; + //! step3 = 10 * number_of_input_faces. + //! Normalization of these values will be done automatically in analyzeProgress() method. + Standard_EXPORT virtual void fillPISteps(BOPAlgo_PISteps& theSteps) const; +}; + +//! Additional root class to provide interface to be launched from parallel vector. +//! It already has the range as a field, and has to be used with caution to create +//! scope from the range only once. +class BOPAlgo_ParallelAlgo : public BOPAlgo_Algo +{ +public: + DEFINE_STANDARD_ALLOC + + //! The main method to implement the operation + Standard_EXPORT virtual void Perform() = 0; + +public: + //! Sets the range for a single run + void SetProgressRange(const Message_ProgressRange& theRange) + { + myProgressRange = theRange; + } + +private: + //! Disable the range enabled method + virtual void Perform(const Message_ProgressRange& /*theRange*/ = Message_ProgressRange()) {}; + +protected: + Message_ProgressRange myProgressRange; +}; + +//! Class for representing the relative contribution of each step of +//! the operation to the whole progress +class BOPAlgo_PISteps +{ +public: + //! Constructor + BOPAlgo_PISteps(const Standard_Integer theNbOp) + : mySteps(0, theNbOp - 1) + { + mySteps.Init(0); + } + + //! Returns the steps + const TColStd_Array1OfReal& Steps() const { return mySteps; } + //! Returns modifiable steps + TColStd_Array1OfReal& ChangeSteps() { return mySteps; } + + //! Assign the value theStep to theOperation + void SetStep(const Standard_Integer theOperation, const Standard_Real theStep) + { + if (theOperation >= mySteps.Lower() && theOperation <= mySteps.Upper()) + { + mySteps(theOperation) = theStep; + } + } + + //! Returns the step assigned to the operation + Standard_Real GetStep(const Standard_Integer theOperation) + { + if (theOperation < mySteps.Lower() || theOperation > mySteps.Upper()) + { + return 0.; + } + return mySteps(theOperation); + } + +protected: + TColStd_Array1OfReal mySteps; }; #endif // _BOPAlgo_Algo_HeaderFile diff --git a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx index e92da635d8..9a79159b94 100644 --- a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx +++ b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx @@ -151,81 +151,99 @@ void BOPAlgo_ArgumentAnalyzer::Prepare() // function: Perform // purpose: // ================================================================================ -void BOPAlgo_ArgumentAnalyzer::Perform() +void BOPAlgo_ArgumentAnalyzer::Perform(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, "Analyze shapes", 10); try { OCC_CATCH_SIGNALS myResult.Clear(); - // - UserBreak(); - // + if (UserBreak(aPS)) + { + return; + } // 1. Prepare Prepare(); // - UserBreak(); - // // 2. Test types if(myArgumentTypeMode) { TestTypes(); + if (UserBreak(aPS)) + { + return; + } } // - UserBreak(); - // // 3. Test self-interference if(mySelfInterMode) { - TestSelfInterferences(); + TestSelfInterferences(aPS.Next(8)); + if (UserBreak(aPS)) + { + return; + } } // - UserBreak(); - // // 4. Test small edges if(mySmallEdgeMode) { if(!(!myResult.IsEmpty() && myStopOnFirst)) TestSmallEdge(); + if (UserBreak(aPS)) + { + return; + } } // - UserBreak(); - // // 5. Test possibility to rebuild faces if(myRebuildFaceMode) { if(!(!myResult.IsEmpty() && myStopOnFirst)) TestRebuildFace(); + if (UserBreak(aPS)) + { + return; + } } // - UserBreak(); - // // 6. Test tangent if(myTangentMode) { - if(!(!myResult.IsEmpty() && myStopOnFirst)) + if (!(!myResult.IsEmpty() && myStopOnFirst)) + { TestTangent(); + if (UserBreak(aPS)) + { + return; + } + } } // - UserBreak(); - // // 7. Test merge vertices if(myMergeVertexMode) { if(!(!myResult.IsEmpty() && myStopOnFirst)) TestMergeVertex(); + if (UserBreak(aPS)) + { + return; + } } // - UserBreak(); - // // 8. Test merge edges if(myMergeEdgeMode) { if(!(!myResult.IsEmpty() && myStopOnFirst)) TestMergeEdge(); + if (UserBreak(aPS)) + { + return; + } } // - UserBreak(); - // // 9. Test shapes continuity if(myContinuityMode) { if(!(!myResult.IsEmpty() && myStopOnFirst)) TestContinuity(); + if (UserBreak(aPS)) + { + return; + } } // - UserBreak(); - // // 10. Test validity of the curves on the surfaces if(myCurveOnSurfaceMode) { if(!(!myResult.IsEmpty() && myStopOnFirst)) @@ -332,8 +350,9 @@ void BOPAlgo_ArgumentAnalyzer::TestTypes() //function : TestSelfInterferences //purpose : //======================================================================= -void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() +void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, NULL, (!myShape1.IsNull() && !myShape2.IsNull() ? 2 : 1)); Standard_Integer ii; // for(ii = 0; ii < 2; ii++) { @@ -357,9 +376,8 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() aChecker.SetNonDestructive(Standard_True); aChecker.SetRunParallel(myRunParallel); aChecker.SetFuzzyValue(myFuzzyValue); - aChecker.SetProgressIndicator(*myProgressScope); // - aChecker.Perform(); + aChecker.Perform(aPS.Next()); Standard_Boolean hasError = aChecker.HasErrors(); // const BOPDS_DS& aDS=*(aChecker.PDS()); diff --git a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.hxx b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.hxx index b26d3d2c3c..2c127cf55e 100644 --- a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.hxx +++ b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.hxx @@ -97,7 +97,7 @@ Standard_EXPORT virtual ~BOPAlgo_ArgumentAnalyzer(); Standard_Boolean& CurveOnSurfaceMode(); //! performs analysis - Standard_EXPORT void Perform(); + Standard_EXPORT void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()); //! result of test Standard_EXPORT Standard_Boolean HasFaulty() const; @@ -114,7 +114,7 @@ protected: Standard_EXPORT void TestTypes(); - Standard_EXPORT void TestSelfInterferences(); + Standard_EXPORT void TestSelfInterferences(const Message_ProgressRange& theRange); Standard_EXPORT void TestSmallEdge(); diff --git a/src/BOPAlgo/BOPAlgo_BOP.cxx b/src/BOPAlgo/BOPAlgo_BOP.cxx index b3367e2eb0..1c6c51ae7f 100644 --- a/src/BOPAlgo/BOPAlgo_BOP.cxx +++ b/src/BOPAlgo/BOPAlgo_BOP.cxx @@ -353,7 +353,7 @@ void BOPAlgo_BOP::BuildResult(const TopAbs_ShapeEnum theType) //function : Perform //purpose : //======================================================================= -void BOPAlgo_BOP::Perform() +void BOPAlgo_BOP::Perform(const Message_ProgressRange& theRange) { Handle(NCollection_BaseAllocator) aAllocator; BOPAlgo_PaveFiller* pPF; @@ -387,25 +387,35 @@ void BOPAlgo_BOP::Perform() pPF=new BOPAlgo_PaveFiller(aAllocator); pPF->SetArguments(aLS); pPF->SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - pPF->SetProgressIndicator(*myProgressScope); - } + Message_ProgressScope aPS(theRange, "Performing Boolean operation", 10); + pPF->SetFuzzyValue(myFuzzyValue); pPF->SetNonDestructive(myNonDestructive); pPF->SetGlue(myGlue); pPF->SetUseOBB(myUseOBB); // - pPF->Perform(); + pPF->Perform(aPS.Next(9)); // myEntryPoint=1; - PerformInternal(*pPF); + PerformInternal(*pPF, aPS.Next()); } + +//======================================================================= +// function: fillPIConstants +// purpose: +//======================================================================= +void BOPAlgo_BOP::fillPIConstants (const Standard_Real theWhole, BOPAlgo_PISteps& theSteps) const +{ + BOPAlgo_Builder::fillPIConstants(theWhole, theSteps); + theSteps.SetStep (PIOperation_BuildShape, (myOperation == BOPAlgo_FUSE ? 10. : 5.) * theWhole / 100.); +} + //======================================================================= //function : PerformInternal1 //purpose : //======================================================================= -void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) +void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, + const Message_ProgressRange& theRange) { myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller; myDS=myPaveFiller->PDS(); @@ -429,14 +439,18 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) { Standard_Boolean bDone = TreatEmptyShape(); if (bDone) { - PrepareHistory(); + PrepareHistory (theRange); return; } } + Message_ProgressScope aPS(theRange, "Building the result of Boolean operation", 100); // + 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; } @@ -446,7 +460,7 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) return; } // 3.2 Edges - FillImagesEdges(); + FillImagesEdges(aPS.Next(aSteps.GetStep(PIOperation_TreatEdges))); if (HasErrors()) { return; } @@ -457,7 +471,7 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // // 3.3 Wires - FillImagesContainers(TopAbs_WIRE); + FillImagesContainers(TopAbs_WIRE, aPS.Next(aSteps.GetStep(PIOperation_TreatWires))); if (HasErrors()) { return; } @@ -468,18 +482,18 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // // 3.4 Faces - FillImagesFaces(); + FillImagesFaces(aPS.Next(aSteps.GetStep(PIOperation_TreatFaces))); if (HasErrors()) { return; } - + BuildResult(TopAbs_FACE); if (HasErrors()) { return; } // // 3.5 Shells - FillImagesContainers(TopAbs_SHELL); + FillImagesContainers(TopAbs_SHELL, aPS.Next(aSteps.GetStep(PIOperation_TreatShells))); if (HasErrors()) { return; } @@ -490,7 +504,7 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // // 3.6 Solids - FillImagesSolids(); + FillImagesSolids(aPS.Next(aSteps.GetStep(PIOperation_TreatSolids))); if (HasErrors()) { return; } @@ -501,7 +515,7 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // // 3.7 CompSolids - FillImagesContainers(TopAbs_COMPSOLID); + FillImagesContainers(TopAbs_COMPSOLID, aPS.Next(aSteps.GetStep(PIOperation_TreatCompsolids))); if (HasErrors()) { return; } @@ -512,7 +526,7 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // // 3.8 Compounds - FillImagesCompounds(); + FillImagesCompounds(aPS.Next(aSteps.GetStep(PIOperation_TreatCompounds))); if (HasErrors()) { return; } @@ -523,23 +537,28 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // // 4.BuildShape; - BuildShape(); + BuildShape(aPS.Next(aSteps.GetStep(PIOperation_BuildShape))); 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 : BuildRC //purpose : //======================================================================= -void BOPAlgo_BOP::BuildRC() +void BOPAlgo_BOP::BuildRC(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, NULL, 1); + TopAbs_ShapeEnum aType; TopoDS_Compound aC; BRep_Builder aBB; @@ -561,6 +580,10 @@ void BOPAlgo_BOP::BuildRC() return; } // + if (UserBreak(aPS)) + { + return; + } // B. Common, Cut, Cut21 // Standard_Integer i, j, aNb, iDim; @@ -589,6 +612,11 @@ void BOPAlgo_BOP::BuildRC() } } // + if (UserBreak(aPS)) + { + return; + } + // bCheckEdges = Standard_False; // // get splits of building elements @@ -723,6 +751,10 @@ void BOPAlgo_BOP::BuildRC() return; } // + if (UserBreak(aPS)) + { + return; + } // The squats around degenerated edges Standard_Integer nVD; TopTools_IndexedMapOfShape aMVC; @@ -768,8 +800,10 @@ void BOPAlgo_BOP::BuildRC() //function : BuildShape //purpose : //======================================================================= -void BOPAlgo_BOP::BuildShape() +void BOPAlgo_BOP::BuildShape(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, NULL, 10.); + if (myDims[0] == 3 && myDims[1] == 3) { // For the Boolean operation on solids we need to check first @@ -784,7 +818,7 @@ void BOPAlgo_BOP::BuildShape() if (hasNotClosedSolids) { Handle(Message_Report) aReport = new Message_Report(); - BuildBOP(myArguments, myTools, myOperation, aReport); + BuildBOP(myArguments, myTools, myOperation, Message_ProgressRange(), aReport); if (aReport->GetAlerts(Message_Fail).IsEmpty()) { // Success. Merge the report into the main report. @@ -795,11 +829,16 @@ void BOPAlgo_BOP::BuildShape() } // Build the result using splits of arguments. - - BuildRC(); + BuildRC(aPS.Next(2.)); // if ((myOperation == BOPAlgo_FUSE) && (myDims[0] == 3)) { - BuildSolid(); + BuildSolid(aPS.Next(8.)); + return; + } + + // Check for user break + if (UserBreak(aPS)) + { return; } // @@ -825,6 +864,11 @@ void BOPAlgo_BOP::BuildShape() CollectContainers(aS, aLSC); } } + // Check for user break + if (UserBreak(aPS)) + { + return; + } // make containers TopTools_ListOfShape aLCRes; TopTools_MapOfShape aMInpFence; @@ -904,6 +948,12 @@ void BOPAlgo_BOP::BuildShape() } // RemoveDuplicates(aLCRes); + + // Check for user break + if (UserBreak(aPS)) + { + return; + } // // add containers to result TopoDS_Compound aResult; @@ -957,8 +1007,9 @@ void BOPAlgo_BOP::BuildShape() //function : BuildSolid //purpose : //======================================================================= -void BOPAlgo_BOP::BuildSolid() +void BOPAlgo_BOP::BuildSolid(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, NULL, 10.); // Containers TopTools_ListOfShape aLSC; // @@ -986,6 +1037,11 @@ void BOPAlgo_BOP::BuildSolid() CollectContainers(aSA, aLSC); } } + // Check for user break + if (UserBreak(aPS)) + { + return; + } // // Find solids in input arguments sharing faces with other solids TopTools_MapOfShape aMTSols; @@ -1045,6 +1101,11 @@ void BOPAlgo_BOP::BuildSolid() } } } + // Check for user break + if (UserBreak(aPS)) + { + return; + } // TopTools_IndexedDataMapOfShapeListOfShape aMEF; // Fill the list of faces to build the result solids @@ -1067,7 +1128,7 @@ void BOPAlgo_BOP::BuildSolid() aBS.SetContext(myContext); aBS.SetShapes(aSFS); aBS.SetAvoidInternalShapes (Standard_True); - aBS.Perform(); + aBS.Perform(aPS.Next(8.)); if (aBS.HasErrors()) { AddError (new BOPAlgo_AlertSolidBuilderFailed); // SolidBuilder failed return; @@ -1105,6 +1166,7 @@ void BOPAlgo_BOP::BuildSolid() TopoDS_Shape aResult; BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aResult); // + aIt.Initialize(aRC); if (!aIt.More()) { // no solids in the result @@ -1147,6 +1209,11 @@ void BOPAlgo_BOP::BuildSolid() } } // + // Check for user break + if (UserBreak(aPS)) + { + return; + } // build connexity blocks from new solids TopTools_ListOfShape aLCBS; BOPTools_AlgoTools::MakeConnexityBlocks(aRC, TopAbs_FACE, TopAbs_SOLID, aLCBS); diff --git a/src/BOPAlgo/BOPAlgo_BOP.hxx b/src/BOPAlgo/BOPAlgo_BOP.hxx index 4598262348..d91b86e851 100644 --- a/src/BOPAlgo/BOPAlgo_BOP.hxx +++ b/src/BOPAlgo/BOPAlgo_BOP.hxx @@ -84,7 +84,7 @@ public: Standard_EXPORT BOPAlgo_Operation Operation() const; - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; protected: @@ -92,15 +92,16 @@ protected: //! Performs calculations using prepared Filler //! object - Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE; - + Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF, + const Message_ProgressRange& theRange) Standard_OVERRIDE; + Standard_EXPORT virtual void BuildResult (const TopAbs_ShapeEnum theType) Standard_OVERRIDE; - Standard_EXPORT void BuildShape(); + Standard_EXPORT void BuildShape(const Message_ProgressRange& theRange); - Standard_EXPORT void BuildRC(); + Standard_EXPORT void BuildRC(const Message_ProgressRange& theRange); - Standard_EXPORT void BuildSolid(); + Standard_EXPORT void BuildSolid(const Message_ProgressRange& theRange); //! Treatment of the cases with empty shapes.
//! It returns TRUE if there is nothing to do, i.e. @@ -113,6 +114,18 @@ protected: //! for building the result shape. Standard_EXPORT virtual Standard_Boolean CheckArgsForOpenSolid(); +protected: + + //! Extend list of operations to be supported by the Progress Indicator + enum BOPAlgo_PIOperation + { + PIOperation_BuildShape = BOPAlgo_ToolsProvider::PIOperation_Last, + PIOperation_Last + }; + + //! Fill PI steps + Standard_EXPORT virtual void fillPIConstants(const Standard_Real theWhole, BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + protected: BOPAlgo_Operation myOperation; diff --git a/src/BOPAlgo/BOPAlgo_Builder.cxx b/src/BOPAlgo/BOPAlgo_Builder.cxx index 7ef864a1b6..d4c080e419 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder.cxx @@ -36,7 +36,6 @@ #include #include - //======================================================================= //function : //purpose : @@ -177,7 +176,7 @@ void BOPAlgo_Builder::Prepare() //function : Perform //purpose : //======================================================================= -void BOPAlgo_Builder::Perform() +void BOPAlgo_Builder::Perform(const Message_ProgressRange& theRange) { GetReport()->Clear(); // @@ -195,25 +194,22 @@ void BOPAlgo_Builder::Perform() // pPF->SetArguments(myArguments); pPF->SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - pPF->SetProgressIndicator(*myProgressScope); - } + Message_ProgressScope aPS(theRange, "Performing General Fuse operation", 10); pPF->SetFuzzyValue(myFuzzyValue); pPF->SetNonDestructive(myNonDestructive); pPF->SetGlue(myGlue); pPF->SetUseOBB(myUseOBB); // - pPF->Perform(); + pPF->Perform(aPS.Next(9)); // myEntryPoint=1; - PerformInternal(*pPF); + PerformInternal(*pPF, aPS.Next(1)); } //======================================================================= //function : PerformWithFiller //purpose : //======================================================================= -void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller) +void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { GetReport()->Clear(); myEntryPoint=0; @@ -221,30 +217,118 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller) myFuzzyValue = theFiller.FuzzyValue(); myGlue = theFiller.Glue(); myUseOBB = theFiller.UseOBB(); - PerformInternal(theFiller); + PerformInternal(theFiller, theRange); } //======================================================================= //function : PerformInternal //purpose : //======================================================================= -void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller) +void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { GetReport()->Clear(); // try { OCC_CATCH_SIGNALS - PerformInternal1(theFiller); + PerformInternal1(theFiller, theRange); } // catch (Standard_Failure const&) { AddError (new BOPAlgo_AlertBuilderFailed); } } + +//======================================================================= +//function : getNbShapes +//purpose : +//======================================================================= +BOPAlgo_Builder::NbShapes BOPAlgo_Builder::getNbShapes() const +{ + NbShapes aCounter; + aCounter.NbVertices() = myDS->ShapesSD().Size(); + for (Standard_Integer i = 0; i < myDS->NbSourceShapes(); ++i) + { + const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i); + switch (aSI.ShapeType()) + { + case TopAbs_EDGE: + { + if (myDS->HasPaveBlocks(i)) + { + aCounter.NbEdges()++; + } + break; + } + case TopAbs_WIRE: + aCounter.NbWires()++; + break; + case TopAbs_FACE: + { + if (myDS->HasFaceInfo(i)) + { + aCounter.NbFaces()++; + } + break; + } + case TopAbs_SHELL: + aCounter.NbShells()++; + break; + case TopAbs_SOLID: + aCounter.NbSolids()++; + break; + case TopAbs_COMPSOLID: + aCounter.NbCompsolids()++; + break; + case TopAbs_COMPOUND: + aCounter.NbCompounds()++; + break; + default: break; + } + } + return aCounter; +} + +//======================================================================= +// function: fillPIConstants +// purpose: +//======================================================================= +void BOPAlgo_Builder::fillPIConstants (const Standard_Real theWhole, + BOPAlgo_PISteps& theSteps) const +{ + // Fill in the constants: + if (myFillHistory) + { + // for FillHistroty, which takes about 5% of the whole operation + theSteps.SetStep(PIOperation_FillHistory, 0.05 * theWhole); + } + + // and for PostTreat, which takes about 3% of the whole operation + theSteps.SetStep(PIOperation_PostTreat, 0.03 * theWhole); +} + +//======================================================================= +// function: fillPISteps +// purpose: +//======================================================================= +void BOPAlgo_Builder::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_TreatWires, aNbShapes.NbWires()); + theSteps.SetStep(PIOperation_TreatFaces, 20 * aNbShapes.NbFaces()); + theSteps.SetStep(PIOperation_TreatShells, aNbShapes.NbShells()); + theSteps.SetStep(PIOperation_TreatSolids, 50 * aNbShapes.NbSolids()); + theSteps.SetStep(PIOperation_TreatCompsolids, aNbShapes.NbCompsolids()); + theSteps.SetStep(PIOperation_TreatCompounds, aNbShapes.NbCompounds()); +} + //======================================================================= //function : PerformInternal1 //purpose : //======================================================================= -void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) +void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller; myDS=myPaveFiller->PDS(); @@ -252,6 +336,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) myFuzzyValue = myPaveFiller->FuzzyValue(); myNonDestructive = myPaveFiller->NonDestructive(); // + Message_ProgressScope aPS(theRange, "Building the result of General Fuse operation", 100); // 1. CheckData CheckData(); if (HasErrors()) { @@ -264,9 +349,11 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) return; } // + BOPAlgo_PISteps aSteps(PIOperation_Last); + analyzeProgress(100., aSteps); // 3. Fill Images // 3.1 Vertice - FillImagesVertices(); + FillImagesVertices(aPS.Next(aSteps.GetStep(PIOperation_TreatVertices))); if (HasErrors()) { return; } @@ -276,7 +363,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) return; } // 3.2 Edges - FillImagesEdges(); + FillImagesEdges(aPS.Next(aSteps.GetStep(PIOperation_TreatEdges))); if (HasErrors()) { return; } @@ -287,7 +374,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // // 3.3 Wires - FillImagesContainers(TopAbs_WIRE); + FillImagesContainers(TopAbs_WIRE, aPS.Next(aSteps.GetStep(PIOperation_TreatWires))); if (HasErrors()) { return; } @@ -298,7 +385,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // 3.4 Faces - FillImagesFaces(); + FillImagesFaces(aPS.Next(aSteps.GetStep(PIOperation_TreatFaces))); if (HasErrors()) { return; } @@ -308,7 +395,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) return; } // 3.5 Shells - FillImagesContainers(TopAbs_SHELL); + FillImagesContainers(TopAbs_SHELL, aPS.Next(aSteps.GetStep(PIOperation_TreatShells))); if (HasErrors()) { return; } @@ -318,7 +405,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) return; } // 3.6 Solids - FillImagesSolids(); + FillImagesSolids(aPS.Next(aSteps.GetStep(PIOperation_TreatSolids))); if (HasErrors()) { return; } @@ -328,7 +415,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) return; } // 3.7 CompSolids - FillImagesContainers(TopAbs_COMPSOLID); + FillImagesContainers(TopAbs_COMPSOLID, aPS.Next(aSteps.GetStep(PIOperation_TreatCompsolids))); if (HasErrors()) { return; } @@ -339,7 +426,7 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) } // 3.8 Compounds - FillImagesCompounds(); + FillImagesCompounds(aPS.Next(aSteps.GetStep(PIOperation_TreatCompounds))); if (HasErrors()) { return; } @@ -349,19 +436,21 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) return; } // - // 4.History - PrepareHistory(); - // + // 4 History + PrepareHistory(aPS.Next(aSteps.GetStep(PIOperation_FillHistory))); + if (HasErrors()) { + return; + } // // 5 Post-treatment - PostTreat(); - + PostTreat(aPS.Next(aSteps.GetStep(PIOperation_PostTreat))); } + //======================================================================= //function : PostTreat //purpose : //======================================================================= -void BOPAlgo_Builder::PostTreat() +void BOPAlgo_Builder::PostTreat(const Message_ProgressRange& theRange) { Standard_Integer i, aNbS; TopAbs_ShapeEnum aType; @@ -381,7 +470,9 @@ void BOPAlgo_Builder::PostTreat() } } // + Message_ProgressScope aPS(theRange, "Post treatment of result shape", 2); BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel); + aPS.Next(); BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel); } @@ -389,11 +480,12 @@ void BOPAlgo_Builder::PostTreat() //function : BuildBOP //purpose : //======================================================================= -void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, - const TopAbs_State theObjState, - const TopTools_ListOfShape& theTools, - const TopAbs_State theToolsState, - Handle(Message_Report) theReport) +void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, + const TopAbs_State theObjState, + const TopTools_ListOfShape& theTools, + const TopAbs_State theToolsState, + const Message_ProgressRange& theRange, + Handle(Message_Report) theReport) { if (HasErrors()) return; @@ -406,7 +498,6 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, aReport->AddAlert(Message_Fail, new BOPAlgo_AlertBuilderFailed()); return; } - // Check the input data if ((theObjState != TopAbs_IN && theObjState != TopAbs_OUT) || (theToolsState != TopAbs_IN && theToolsState != TopAbs_OUT)) @@ -626,7 +717,7 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, if (!aMFToAvoid.Contains(aRF)) aResFaces.Append(aRF); } - + Message_ProgressScope aPS(theRange, NULL, 2); BRep_Builder aBB; // Try to build closed solids from the faces @@ -635,11 +726,7 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, aBS.SetRunParallel(myRunParallel); aBS.SetContext(myContext); aBS.SetFuzzyValue(myFuzzyValue); - if (myProgressScope != NULL) - { - aBS.SetProgressIndicator(*myProgressScope); - } - aBS.Perform(); + aBS.Perform(aPS.Next()); // Resulting solids TopTools_ListOfShape aResSolids; @@ -668,6 +755,10 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, } } } + else + { + return; + } // Collect unused faces TopoDS_Compound anUnUsedFaces; @@ -748,5 +839,5 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, aBB.Add(aResult, itLS.Value()); myShape = aResult; - PrepareHistory(); + PrepareHistory(aPS.Next()); } diff --git a/src/BOPAlgo/BOPAlgo_Builder.hxx b/src/BOPAlgo/BOPAlgo_Builder.hxx index 2d8d1e97c9..1d908c79bc 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.hxx +++ b/src/BOPAlgo/BOPAlgo_Builder.hxx @@ -169,11 +169,11 @@ public: //! @name Performing the operation //! Performs the operation. //! The intersection will be performed also. - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Performs the operation with the prepared filler. //! The intersection will not be performed in this case. - Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller); + Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange = Message_ProgressRange()); public: //! @name BOPs on open solids @@ -212,16 +212,17 @@ public: //! @name BOPs on open solids //! - BOPAlgo_AlertUnknownShape - the shape is unknown for the operation. //! //! Parameters: - //! @param theObjects - The group of Objects for BOP; - //! @param theObjState - State for objects faces to pass into result; - //! @param theTools - The group of Tools for BOP; - //! @param theObjState - State for tools faces to pass into result; - //! @param theReport - The alternative report to avoid pollution of the main one. - Standard_EXPORT virtual void BuildBOP(const TopTools_ListOfShape& theObjects, - const TopAbs_State theObjState, - const TopTools_ListOfShape& theTools, - const TopAbs_State theToolsState, - Handle(Message_Report) theReport = NULL); + //! @param theObjects - The group of Objects for BOP; + //! @param theObjState - State for objects faces to pass into result; + //! @param theTools - The group of Tools for BOP; + //! @param theToolsState - State for tools faces to pass into result; + //! @param theReport - The alternative report to avoid pollution of the main one. + Standard_EXPORT virtual void BuildBOP(const TopTools_ListOfShape& theObjects, + const TopAbs_State theObjState, + const TopTools_ListOfShape& theTools, + const TopAbs_State theToolsState, + const Message_ProgressRange& theRange, + Handle(Message_Report) theReport = NULL); //! Builds the result of Boolean operation of given type //! basing on the result of Builder operation (GF or any other). @@ -241,11 +242,13 @@ public: //! @name BOPs on open solids //! @param theObjects - The group of Objects for BOP; //! @param theTools - The group of Tools for BOP; //! @param theOperation - The BOP type; + //! @param theRange - The parameter to progressIndicator //! @param theReport - The alternative report to avoid pollution of the global one. - void BuildBOP(const TopTools_ListOfShape& theObjects, - const TopTools_ListOfShape& theTools, - const BOPAlgo_Operation theOperation, - Handle(Message_Report) theReport = NULL) + void BuildBOP(const TopTools_ListOfShape& theObjects, + const TopTools_ListOfShape& theTools, + const BOPAlgo_Operation theOperation, + const Message_ProgressRange& theRange, + Handle(Message_Report) theReport = NULL) { TopAbs_State anObjState, aToolsState; switch (theOperation) @@ -281,13 +284,13 @@ public: //! @name BOPs on open solids break; } } - BuildBOP(theObjects, anObjState, theTools, aToolsState, theReport); + BuildBOP(theObjects, anObjState, theTools, aToolsState, theRange, theReport); } protected: //! @name History methods //! Prepare information for history support. - Standard_EXPORT void PrepareHistory(); + Standard_EXPORT void PrepareHistory(const Message_ProgressRange& theRange); //! Prepare history information for the input shapes taking into account possible //! operation-specific modifications. @@ -334,17 +337,81 @@ public: //! @name Images/Origins return myShapesSD; } +protected://! @name Analyze progress of the operation + + //! List of operations to be supported by the Progress Indicator + enum BOPAlgo_PIOperation + { + PIOperation_TreatVertices = 0, + PIOperation_TreatEdges, + PIOperation_TreatWires, + PIOperation_TreatFaces, + PIOperation_TreatShells, + PIOperation_TreatSolids, + PIOperation_TreatCompsolids, + PIOperation_TreatCompounds, + PIOperation_FillHistory, + PIOperation_PostTreat, + PIOperation_Last + }; + + + //! Auxiliary structure to get information about number of shapes + //! of each type participated in operation. + class NbShapes + { + public: + NbShapes() + { + for (Standard_Integer i = 0; i < 8; ++i) + { + myNbShapesArr[i] = 0; + } + } + + Standard_Integer NbVertices() const { return myNbShapesArr[0]; } + Standard_Integer NbEdges() const { return myNbShapesArr[1]; } + Standard_Integer NbWires() const { return myNbShapesArr[2]; } + Standard_Integer NbFaces() const { return myNbShapesArr[3]; } + Standard_Integer NbShells() const { return myNbShapesArr[4]; } + Standard_Integer NbSolids() const { return myNbShapesArr[5]; } + Standard_Integer NbCompsolids() const { return myNbShapesArr[6]; } + Standard_Integer NbCompounds() const { return myNbShapesArr[7]; } + + Standard_Integer& NbVertices() { return myNbShapesArr[0]; } + Standard_Integer& NbEdges() { return myNbShapesArr[1]; } + Standard_Integer& NbWires() { return myNbShapesArr[2]; } + Standard_Integer& NbFaces() { return myNbShapesArr[3]; } + Standard_Integer& NbShells() { return myNbShapesArr[4]; } + Standard_Integer& NbSolids() { return myNbShapesArr[5]; } + Standard_Integer& NbCompsolids() { return myNbShapesArr[6]; } + Standard_Integer& NbCompounds() { return myNbShapesArr[7]; } + + private: + Standard_Integer myNbShapesArr[8]; + }; + +protected: + + //! Compute number of shapes of certain type participating in operation + Standard_EXPORT NbShapes getNbShapes() const; + + //! Filling steps for constant operations + Standard_EXPORT void fillPIConstants(const Standard_Real theWhole, BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + + //! Filling steps for all other operations + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; protected: //! @name Methods for building the result //! Performs the building of the result. //! The method calls the PerformInternal1() method surrounded by a try-catch block. - Standard_EXPORT virtual void PerformInternal (const BOPAlgo_PaveFiller& thePF); + Standard_EXPORT virtual void PerformInternal (const BOPAlgo_PaveFiller& thePF, const Message_ProgressRange& theRange); //! Performs the building of the result. //! To build the result of any other operation //! it will be necessary to override this method. - Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF); + Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF, const Message_ProgressRange& theRange); //! Builds the result of operation. //! The method is called for each of the arguments type and @@ -367,19 +434,19 @@ protected: //! @name Checking input arguments protected: //! @name Fill Images of VERTICES //! Fills the images of vertices. - Standard_EXPORT void FillImagesVertices(); + Standard_EXPORT void FillImagesVertices(const Message_ProgressRange& theRange); protected: //! @name Fill Images of EDGES //! Fills the images of edges. - Standard_EXPORT void FillImagesEdges(); + Standard_EXPORT void FillImagesEdges(const Message_ProgressRange& theRange); protected: //! @name Fill Images of CONTAINERS //! Fills the images of containers (WIRES/SHELLS/COMPSOLID). - Standard_EXPORT void FillImagesContainers (const TopAbs_ShapeEnum theType); + Standard_EXPORT void FillImagesContainers (const TopAbs_ShapeEnum theType, const Message_ProgressRange& theRange); //! Builds the image of the given container using the splits //! of its sub-shapes. @@ -393,19 +460,19 @@ protected: //! @name Fill Images of FACES //! 1. Build the splits of faces; //! 2. Find SD faces; //! 3. Add internal vertices (if any) to faces. - Standard_EXPORT void FillImagesFaces(); + Standard_EXPORT void FillImagesFaces(const Message_ProgressRange& theRange); //! 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); //! Looks for the same domain faces among the splits of the faces. //! Updates the map of images with SD faces. - Standard_EXPORT void FillSameDomainFaces(); + Standard_EXPORT void FillSameDomainFaces(const Message_ProgressRange& theRange); //! Classifies the alone vertices on faces relatively its splits //! and adds them as INTERNAL into the splits. - Standard_EXPORT void FillInternalVertices(); + Standard_EXPORT void FillInternalVertices(const Message_ProgressRange& theRange); protected: //! @name Fill Images of SOLIDS @@ -416,7 +483,7 @@ protected: //! @name Fill Images of SOLIDS //! 2. Find faces from other arguments located inside the solids; //! 3. Build splits of solid using the inside faces; //! 4. Fill internal shapes for the splits (Wires and vertices). - Standard_EXPORT void FillImagesSolids(); + Standard_EXPORT void FillImagesSolids(const Message_ProgressRange& theRange); //! Builds the draft solid by rebuilding the shells of the solid //! with the splits of faces. @@ -425,21 +492,23 @@ protected: //! @name Fill Images of SOLIDS TopTools_ListOfShape& theLIF); //! Finds faces located inside each solid. - Standard_EXPORT virtual void FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids); + Standard_EXPORT virtual void FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids, + const Message_ProgressRange& theRange); //! 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); //! Classifies the vertices and edges from the arguments relatively //! splits of solids and makes them INTERNAL for solids. - Standard_EXPORT void FillInternalShapes(); + Standard_EXPORT void FillInternalShapes(const Message_ProgressRange& theRange); protected: //! @name Fill Images of COMPOUNDS //! Fills the images of compounds. - Standard_EXPORT void FillImagesCompounds(); + Standard_EXPORT void FillImagesCompounds(const Message_ProgressRange& theRange); //! Builds the image of the given compound. Standard_EXPORT void FillImagesCompound (const TopoDS_Shape& theS, @@ -450,8 +519,7 @@ protected: //! @name Post treatment //! Post treatment of the result of the operation. //! The method checks validity of the sub-shapes of the result //! and updates the tolerances to make them valid. - Standard_EXPORT virtual void PostTreat(); - + Standard_EXPORT virtual void PostTreat(const Message_ProgressRange& theRange); protected: //! @name Fields diff --git a/src/BOPAlgo/BOPAlgo_BuilderArea.hxx b/src/BOPAlgo/BOPAlgo_BuilderArea.hxx index ae818a50a8..5f12f43cb6 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderArea.hxx +++ b/src/BOPAlgo/BOPAlgo_BuilderArea.hxx @@ -80,13 +80,13 @@ protected: Standard_EXPORT BOPAlgo_BuilderArea(const Handle(NCollection_BaseAllocator)& theAllocator); - virtual void PerformShapesToAvoid() = 0; + virtual void PerformShapesToAvoid(const Message_ProgressRange& theRange) = 0; - virtual void PerformLoops() = 0; + virtual void PerformLoops(const Message_ProgressRange& theRange) = 0; - virtual void PerformAreas() = 0; + virtual void PerformAreas(const Message_ProgressRange& theRange) = 0; - virtual void PerformInternalShapes() = 0; + virtual void PerformInternalShapes(const Message_ProgressRange& theRange) = 0; Handle(IntTools_Context) myContext; diff --git a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx index 8fe38f13ff..46addcede5 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx +++ b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx @@ -141,8 +141,10 @@ void BOPAlgo_BuilderFace::CheckData() //function : Perform //purpose : //======================================================================= -void BOPAlgo_BuilderFace::Perform() +void BOPAlgo_BuilderFace::Perform(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS (theRange, NULL, 100); + GetReport()->Clear(); // CheckData(); @@ -150,39 +152,28 @@ void BOPAlgo_BuilderFace::Perform() return; } // - UserBreak(); - // - PerformShapesToAvoid(); + PerformShapesToAvoid (aPS.Next(1)); if (HasErrors()) { return; } // - UserBreak(); - // - PerformLoops(); + PerformLoops (aPS.Next(10)); if (HasErrors()) { return; } // - UserBreak(); - // - PerformAreas(); + PerformAreas (aPS.Next(80)); if (HasErrors()) { return; } // - UserBreak(); - // - PerformInternalShapes(); - if (HasErrors()) { - return; - } + PerformInternalShapes(aPS.Next(9)); } //======================================================================= //function :PerformShapesToAvoid //purpose : //======================================================================= -void BOPAlgo_BuilderFace::PerformShapesToAvoid() +void BOPAlgo_BuilderFace::PerformShapesToAvoid(const Message_ProgressRange& theRange) { Standard_Boolean bFound; Standard_Integer i, iCnt, aNbV, aNbE; @@ -191,8 +182,15 @@ void BOPAlgo_BuilderFace::PerformShapesToAvoid() // myShapesToAvoid.Clear(); // + Message_ProgressScope aPS(theRange, NULL, 1); + // iCnt=0; for(;;) { + if (UserBreak(aPS)) + { + return; + } + ++iCnt; bFound=Standard_False; // @@ -247,15 +245,13 @@ void BOPAlgo_BuilderFace::PerformShapesToAvoid() if (!bFound) { break; } - // - }//while (1) - //printf(" EdgesToAvoid=%d, iCnt=%d\n", EdgesToAvoid.Extent(), iCnt); + } } //======================================================================= //function : PerformLoops //purpose : //======================================================================= -void BOPAlgo_BuilderFace::PerformLoops() +void BOPAlgo_BuilderFace::PerformLoops(const Message_ProgressRange& theRange) { Standard_Boolean bFlag; Standard_Integer i, aNbEA; @@ -267,6 +263,8 @@ void BOPAlgo_BuilderFace::PerformLoops() BOPAlgo_WireEdgeSet aWES(myAllocator); BOPAlgo_WireSplitter aWSp(myAllocator); // + Message_ProgressScope aMainScope(theRange, "Making wires", 10); + // // 1. myLoops.Clear(); aWES.SetFace(myFace); @@ -282,7 +280,7 @@ void BOPAlgo_BuilderFace::PerformLoops() aWSp.SetWES(aWES); aWSp.SetRunParallel(myRunParallel); aWSp.SetContext(myContext); - aWSp.Perform(); + aWSp.Perform(aMainScope.Next(9)); if (aWSp.HasErrors()) { return; } @@ -306,6 +304,9 @@ void BOPAlgo_BuilderFace::PerformLoops() aMEP.Add(aE); } } + if (UserBreak (aMainScope)) { + return; + } // // b. collect all edges that are to avoid aNbEA = myShapesToAvoid.Extent(); @@ -323,16 +324,19 @@ void BOPAlgo_BuilderFace::PerformLoops() } } // + if (UserBreak (aMainScope)) { + return; + } // 2. Internal Wires myLoopsInternal.Clear(); // aNbEA = myShapesToAvoid.Extent(); for (i = 1; i <= aNbEA; ++i) { const TopoDS_Shape& aEE = myShapesToAvoid(i); - TopExp::MapShapesAndAncestors(aEE, - TopAbs_VERTEX, - TopAbs_EDGE, - aVEMap); + TopExp::MapShapesAndAncestors(aEE, + TopAbs_VERTEX, + TopAbs_EDGE, + aVEMap); } // bFlag=Standard_True; @@ -342,6 +346,9 @@ void BOPAlgo_BuilderFace::PerformLoops() continue; } // + if (UserBreak (aMainScope)) { + return; + } // make new wire TopoDS_Wire aW; aBB.MakeWire(aW); @@ -375,7 +382,7 @@ void BOPAlgo_BuilderFace::PerformLoops() //function : PerformAreas //purpose : //======================================================================= -void BOPAlgo_BuilderFace::PerformAreas() +void BOPAlgo_BuilderFace::PerformAreas(const Message_ProgressRange& theRange) { myAreas.Clear(); BRep_Builder aBB; @@ -386,6 +393,8 @@ void BOPAlgo_BuilderFace::PerformAreas() // Get tolerance of myFace Standard_Real aTol = BRep_Tool::Tolerance(myFace); + Message_ProgressScope aMainScope (theRange, NULL, 10); + // Check if there are no loops at all if (myLoops.IsEmpty()) { @@ -410,9 +419,15 @@ void BOPAlgo_BuilderFace::PerformAreas() TopTools_IndexedMapOfShape aMHE; // Analyze the new wires - classify them to be the holes and growths + Message_ProgressScope aPSClass(aMainScope.Next(5), "Making faces", myLoops.Size()); TopTools_ListIteratorOfListOfShape aItLL(myLoops); - for (; aItLL.More(); aItLL.Next()) + for (; aItLL.More(); aItLL.Next(), aPSClass.Next()) { + if (UserBreak(aPSClass)) + { + return; + } + const TopoDS_Shape& aWire = aItLL.Value(); TopoDS_Face aFace; @@ -471,9 +486,14 @@ void BOPAlgo_BuilderFace::PerformAreas() BOPTools_Box2dTreeSelector aSelector; aSelector.SetBVHSet (&aBoxTree); + Message_ProgressScope aPSHoles(aMainScope.Next(4), "Adding holes", aNewFaces.Extent()); TopTools_ListIteratorOfListOfShape aItLS(aNewFaces); - for (; aItLS.More(); aItLS.Next()) + for (; aItLS.More(); aItLS.Next(), aPSHoles.Next()) { + if (UserBreak (aPSHoles)) + { + return; + } const TopoDS_Face& aFace = TopoDS::Face(aItLS.Value()); // Build box @@ -550,9 +570,15 @@ void BOPAlgo_BuilderFace::PerformAreas() } // Add Holes to Faces and add them to myAreas + Message_ProgressScope aPSU (aMainScope.Next(), NULL, aNewFaces.Size()); aItLS.Initialize(aNewFaces); - for ( ; aItLS.More(); aItLS.Next()) + for ( ; aItLS.More(); aItLS.Next(), aPSU.Next()) { + if (UserBreak (aPSU)) + { + return; + } + TopoDS_Face& aFace = *(TopoDS_Face*)&aItLS.Value(); const TopTools_ListOfShape* pLHoles = aFaceHolesMap.Seek(aFace); if (pLHoles) @@ -579,7 +605,7 @@ void BOPAlgo_BuilderFace::PerformAreas() //function : PerformInternalShapes //purpose : //======================================================================= -void BOPAlgo_BuilderFace::PerformInternalShapes() +void BOPAlgo_BuilderFace::PerformInternalShapes(const Message_ProgressRange& theRange) { if (myAvoidInternalShapes) // User-defined option to avoid internal edges @@ -596,10 +622,17 @@ void BOPAlgo_BuilderFace::PerformInternalShapes() // Map of edges to classify TopTools_IndexedMapOfShape anEdgesMap; + // Main progress scope + Message_ProgressScope aMainScope (theRange, "Adding internal shapes", 3); + // Fill the tree and the map TopTools_ListIteratorOfListOfShape itLE(myLoopsInternal); for (; itLE.More(); itLE.Next()) { + if (UserBreak (aMainScope)) + { + return; + } TopoDS_Iterator itE(itLE.Value()); for (; itE.More(); itE.Next()) { @@ -618,13 +651,20 @@ void BOPAlgo_BuilderFace::PerformInternalShapes() // Build BVH aBoxTree.Build(); + aMainScope.Next(); + // Fence map TColStd_MapOfInteger aMEDone; // Classify edges relatively faces + Message_ProgressScope aPSClass(aMainScope.Next(), NULL, myAreas.Size()); TopTools_ListIteratorOfListOfShape itLF(myAreas); - for (; itLF.More(); itLF.Next()) + for (; itLF.More(); itLF.Next(), aPSClass.Next()) { + if (UserBreak(aPSClass)) + { + return; + } TopoDS_Face& aF = *(TopoDS_Face*)&itLF.Value(); // Build box diff --git a/src/BOPAlgo/BOPAlgo_BuilderFace.hxx b/src/BOPAlgo/BOPAlgo_BuilderFace.hxx index 4ded4e6cc3..4823d587cf 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderFace.hxx +++ b/src/BOPAlgo/BOPAlgo_BuilderFace.hxx @@ -54,7 +54,7 @@ Standard_EXPORT virtual ~BOPAlgo_BuilderFace(); Standard_EXPORT const TopoDS_Face& Face() const; //! Performs the algorithm - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; Standard_EXPORT TopAbs_Orientation Orientation() const; @@ -63,40 +63,27 @@ protected: //! 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) 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) 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) Standard_OVERRIDE; //! Build finalized faces with internals - Standard_EXPORT virtual void PerformInternalShapes() Standard_OVERRIDE; + Standard_EXPORT virtual void PerformInternalShapes(const Message_ProgressRange& theRange) Standard_OVERRIDE; Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; +protected: TopoDS_Face myFace; TopAbs_Orientation myOrientation; - - -private: - - - - - }; - - - - - - #endif // _BOPAlgo_BuilderFace_HeaderFile diff --git a/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx b/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx index a024a4f2ca..4dfe15c897 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx +++ b/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx @@ -106,8 +106,10 @@ BOPAlgo_BuilderSolid::~BOPAlgo_BuilderSolid() //function : Perform //purpose : //======================================================================= -void BOPAlgo_BuilderSolid::Perform() +void BOPAlgo_BuilderSolid::Perform(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS (theRange, NULL, 100); + GetReport()->Clear(); // if (myShapes.IsEmpty()) @@ -130,39 +132,28 @@ void BOPAlgo_BuilderSolid::Perform() aBB.Add(aC, aF); } // - UserBreak(); - // - PerformShapesToAvoid(); + PerformShapesToAvoid (aPS.Next(1)); if (HasErrors()) { return; } // - UserBreak(); - // - PerformLoops(); + PerformLoops (aPS.Next(10)); if (HasErrors()) { return; } // - UserBreak(); - // - PerformAreas(); + PerformAreas (aPS.Next(80)); if (HasErrors()) { return; } // - UserBreak(); - // - PerformInternalShapes(); - if (HasErrors()) { - return; - } + PerformInternalShapes (aPS.Next(9)); } //======================================================================= //function :PerformShapesToAvoid //purpose : //======================================================================= -void BOPAlgo_BuilderSolid::PerformShapesToAvoid() +void BOPAlgo_BuilderSolid::PerformShapesToAvoid(const Message_ProgressRange& theRange) { Standard_Boolean bFound; Standard_Integer i, iCnt, aNbE, aNbF; @@ -172,8 +163,13 @@ void BOPAlgo_BuilderSolid::PerformShapesToAvoid() // myShapesToAvoid.Clear(); // + Message_ProgressScope aPS(theRange, NULL, 1); + // iCnt=0; for(;;) { + if (UserBreak(aPS)) { + return; + } ++iCnt; bFound=Standard_False; // @@ -242,7 +238,7 @@ void BOPAlgo_BuilderSolid::PerformShapesToAvoid() //function : PerformLoops //purpose : //======================================================================= -void BOPAlgo_BuilderSolid::PerformLoops() +void BOPAlgo_BuilderSolid::PerformLoops(const Message_ProgressRange& theRange) { Standard_Integer i, aNbSh; TopTools_ListIteratorOfListOfShape aIt; @@ -255,7 +251,9 @@ void BOPAlgo_BuilderSolid::PerformLoops() NCollection_BaseAllocator::CommonBaseAllocator(); BOPAlgo_ShellSplitter aSSp(aAlr); // - // 1. Shells Usual + Message_ProgressScope aMainScope (theRange, "Building shells", 10); + + // 1. Shells Usual aIt.Initialize (myShapes); for (; aIt.More(); aIt.Next()) { const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value()); @@ -275,9 +273,10 @@ void BOPAlgo_BuilderSolid::PerformLoops() } // aSSp.SetRunParallel(myRunParallel); - aSSp.Perform(); + aSSp.Perform(aMainScope.Next(9)); if (aSSp.HasErrors()) { // add warning status + if (aMainScope.More()) { TopoDS_Compound aFacesSp; BRep_Builder().MakeCompound(aFacesSp); @@ -314,6 +313,9 @@ void BOPAlgo_BuilderSolid::PerformLoops() aMP.Add(aF); } } + if (UserBreak (aMainScope)) { + return; + } // // b. collect all edges that are to avoid aNbSh = myShapesToAvoid.Extent(); @@ -333,6 +335,9 @@ void BOPAlgo_BuilderSolid::PerformLoops() } } //================================================= + if (UserBreak (aMainScope)) { + return; + } // // 3.Internal Shells myLoopsInternal.Clear(); @@ -349,6 +354,9 @@ void BOPAlgo_BuilderSolid::PerformLoops() } // for (i = 1; i <= aNbSh; ++i) { + if (UserBreak(aMainScope)) { + return; + } const TopoDS_Shape& aFF = myShapesToAvoid(i); if (!AddedFacesMap.Add(aFF)) { continue; @@ -385,7 +393,7 @@ void BOPAlgo_BuilderSolid::PerformLoops() //function : PerformAreas //purpose : //======================================================================= -void BOPAlgo_BuilderSolid::PerformAreas() +void BOPAlgo_BuilderSolid::PerformAreas(const Message_ProgressRange& theRange) { myAreas.Clear(); BRep_Builder aBB; @@ -397,10 +405,17 @@ void BOPAlgo_BuilderSolid::PerformAreas() // If the analyzed shell contains any of the hole faces, it is considered as growth. TopTools_IndexedMapOfShape aMHF; + Message_ProgressScope aMainScope(theRange, "Building solids", 10); + // Analyze the shells + Message_ProgressScope aPSClass(aMainScope.Next(5), "Classify solids", myLoops.Size()); TopTools_ListIteratorOfListOfShape aItLL(myLoops); - for (; aItLL.More(); aItLL.Next()) + for (; aItLL.More(); aItLL.Next(), aPSClass.Next()) { + if (UserBreak (aPSClass)) + { + return; + } const TopoDS_Shape& aShell = aItLL.Value(); Standard_Boolean bIsGrowth = IsGrowthShell(aShell, aMHF); @@ -464,9 +479,14 @@ void BOPAlgo_BuilderSolid::PerformAreas() // Find outer growth shell that is most close to each hole shell TopTools_IndexedDataMapOfShapeShape aHoleSolidMap; + Message_ProgressScope aPSH(aMainScope.Next(4), "Adding holes", aNewSolids.Size()); TopTools_ListIteratorOfListOfShape aItLS(aNewSolids); - for (; aItLS.More(); aItLS.Next()) + for (; aItLS.More(); aItLS.Next(), aPSH.Next()) { + if (UserBreak (aPSH)) + { + return; + } const TopoDS_Shape& aSolid = aItLS.Value(); // Build box @@ -522,9 +542,14 @@ void BOPAlgo_BuilderSolid::PerformAreas() } // Add Holes to Solids and add them to myAreas + Message_ProgressScope aPSU (aMainScope.Next(), NULL, aNewSolids.Size()); aItLS.Initialize(aNewSolids); - for ( ; aItLS.More(); aItLS.Next()) + for ( ; aItLS.More(); aItLS.Next(), aPSU.Next()) { + if (UserBreak (aPSU)) + { + return; + } TopoDS_Solid& aSolid = *(TopoDS_Solid*)&aItLS.Value(); const TopTools_ListOfShape* pLHoles = aSolidHolesMap.Seek(aSolid); if (pLHoles) @@ -569,7 +594,7 @@ void BOPAlgo_BuilderSolid::PerformAreas() //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 @@ -579,6 +604,8 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes() // no internal parts return; + Message_ProgressScope aMainScope (theRange, "Adding internal shapes", 2); + // Get all faces to classify TopTools_IndexedMapOfShape aMFs; TopTools_ListIteratorOfListOfShape aItLS(myLoopsInternal); @@ -610,6 +637,11 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes() return; } + if (UserBreak (aMainScope)) + { + return; + } + // Classify faces relatively solids // Prepare list of faces to classify @@ -622,15 +654,27 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes() TopTools_IndexedDataMapOfShapeListOfShape aMSLF; // Perform classification - BOPAlgo_Tools::ClassifyFaces(aLFaces, myAreas, myRunParallel, myContext, aMSLF, myBoxes); + BOPAlgo_Tools::ClassifyFaces(aLFaces, + myAreas, + myRunParallel, + myContext, + aMSLF, + myBoxes, + TopTools_DataMapOfShapeListOfShape(), + aMainScope.Next()); // Update Solids by internal Faces TopTools_MapOfShape aMFDone; Standard_Integer aNbS = aMSLF.Extent(); - for (i = 1; i <= aNbS; ++i) + Message_ProgressScope aPSLoop(aMainScope.Next(), NULL, aNbS); + for (i = 1; i <= aNbS; ++i, aPSLoop.Next()) { + if (UserBreak (aPSLoop)) + { + return; + } const TopoDS_Shape& aSolid = aMSLF.FindKey(i); TopoDS_Shape *pSolid = (TopoDS_Shape*)&aSolid; diff --git a/src/BOPAlgo/BOPAlgo_BuilderSolid.hxx b/src/BOPAlgo/BOPAlgo_BuilderSolid.hxx index 756d1861e8..1a8e3cea84 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderSolid.hxx +++ b/src/BOPAlgo/BOPAlgo_BuilderSolid.hxx @@ -96,7 +96,7 @@ public: //! @name Constructors public: //! @name Performing the operation //! Performs the construction of the solids from the given faces - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; public: //! @name Getting the bounding boxes of the created solids @@ -114,23 +114,23 @@ protected: //! @name Protected methods performing the operation //! - 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) 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) 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) 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) Standard_OVERRIDE; private: diff --git a/src/BOPAlgo/BOPAlgo_Builder_1.cxx b/src/BOPAlgo/BOPAlgo_Builder_1.cxx index 90767d6982..f343f9d274 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_1.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_1.cxx @@ -38,11 +38,16 @@ //function : FillImagesVertices //purpose : //======================================================================= -void BOPAlgo_Builder::FillImagesVertices() +void BOPAlgo_Builder::FillImagesVertices(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, "Filling splits of vertices", myDS->ShapesSD().Size()); TColStd_DataMapIteratorOfDataMapOfIntegerInteger aIt(myDS->ShapesSD()); - for (; aIt.More(); aIt.Next()) + for (; aIt.More(); aIt.Next(), aPS.Next()) { + if (UserBreak(aPS)) + { + return; + } Standard_Integer nV = aIt.Key(); Standard_Integer nVSD = aIt.Value(); @@ -63,10 +68,11 @@ void BOPAlgo_Builder::FillImagesVertices() //function : FillImagesEdges //purpose : //======================================================================= - void BOPAlgo_Builder::FillImagesEdges() + void BOPAlgo_Builder::FillImagesEdges(const Message_ProgressRange& theRange) { Standard_Integer i, aNbS = myDS->NbSourceShapes(); - for (i = 0; i < aNbS; ++i) { + Message_ProgressScope aPS(theRange, "Filling splits of edges", aNbS); + for (i = 0; i < aNbS; ++i, aPS.Next()) { const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i); if (aSI.ShapeType() != TopAbs_EDGE) { continue; @@ -106,6 +112,10 @@ void BOPAlgo_Builder::FillImagesVertices() myShapesSD.Bind(aSp, aSpR); } } + if (UserBreak(aPS)) + { + return; + } } } //======================================================================= @@ -149,36 +159,46 @@ void BOPAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType) // function: FillImagesContainers // purpose: //======================================================================= - void BOPAlgo_Builder::FillImagesContainers(const TopAbs_ShapeEnum theType) + void BOPAlgo_Builder::FillImagesContainers(const TopAbs_ShapeEnum theType, const Message_ProgressRange& theRange) { Standard_Integer i, aNbS; TopTools_MapOfShape aMFP(100, myAllocator); // aNbS=myDS->NbSourceShapes(); + Message_ProgressScope aPS(theRange, "Building splits of containers", 1); for (i=0; iShapeInfo(i); if (aSI.ShapeType()==theType) { const TopoDS_Shape& aC=aSI.Shape(); FillImagesContainer(aC, theType); } + if (UserBreak(aPS)) + { + return; + } }// for (; aItS.More(); aItS.Next()) { } //======================================================================= // function: FillImagesCompounds // purpose: //======================================================================= - void BOPAlgo_Builder::FillImagesCompounds() + void BOPAlgo_Builder::FillImagesCompounds(const Message_ProgressRange& theRange) { Standard_Integer i, aNbS; TopTools_MapOfShape aMFP(100, myAllocator); // aNbS=myDS->NbSourceShapes(); - for (i=0; iShapeInfo(i); if (aSI.ShapeType()==TopAbs_COMPOUND) { const TopoDS_Shape& aC=aSI.Shape(); FillImagesCompound(aC, aMFP); } + if (UserBreak(aPS)) + { + return; + } }// for (; aItS.More(); aItS.Next()) { } //======================================================================= diff --git a/src/BOPAlgo/BOPAlgo_Builder_2.cxx b/src/BOPAlgo/BOPAlgo_Builder_2.cxx index a0a2fc870c..186cd88399 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_2.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_2.cxx @@ -69,13 +69,13 @@ static //class : BOPAlgo_PairOfShapeBoolean //purpose : //======================================================================= -class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo { +class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_PairOfShapeBoolean() : - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myFlag(Standard_False) { } // @@ -103,8 +103,12 @@ class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo { } // virtual void Perform() { - BOPAlgo_Algo::UserBreak(); - // + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } + const TopoDS_Face& aFj=*((TopoDS_Face*)&myShape1); const TopoDS_Face& aFk=*((TopoDS_Face*)&myShape2); myFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, myContext, myFuzzyValue); @@ -120,21 +124,49 @@ class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo { typedef NCollection_Vector BOPAlgo_VectorOfPairOfShapeBoolean; //======================================================================= -// BuilderFace -// -typedef NCollection_Vector BOPAlgo_VectorOfBuilderFace; +//class : BOPAlgo_SplitFace +//purpose : Auxiliary class to extend BOPAlgo_BuilderFace with progress support +//======================================================================= +class BOPAlgo_SplitFace : public BOPAlgo_BuilderFace +{ +public: + //! Sets progress range + void SetProgressRange(const Message_ProgressRange& theRange) + { + myRange = theRange; + } + + // New perform method, using own progress range + void Perform() + { + Message_ProgressScope aPS(myRange, NULL, 1); + if (!aPS.More()) + { + return; + } + BOPAlgo_BuilderFace::Perform(aPS.Next()); + } + +private: + //! Disable the range enabled method + virtual void Perform(const Message_ProgressRange& /*theRange*/) {}; + +private: + Message_ProgressRange myRange; +}; +typedef NCollection_Vector BOPAlgo_VectorOfBuilderFace; //======================================================================= //class : BOPAlgo_VFI //purpose : //======================================================================= -class BOPAlgo_VFI : public BOPAlgo_Algo { +class BOPAlgo_VFI : public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_VFI() : - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myIsInternal(Standard_False) { } // @@ -170,9 +202,14 @@ class BOPAlgo_VFI : public BOPAlgo_Algo { } // virtual void Perform() { + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } + Standard_Real aT1, aT2, dummy; // - BOPAlgo_Algo::UserBreak(); Standard_Integer iFlag = myContext->ComputeVF(myV, myF, aT1, aT2, dummy, myFuzzyValue); myIsInternal = (iFlag == 0); @@ -191,17 +228,26 @@ typedef NCollection_Vector BOPAlgo_VectorOfVFI; //function : FillImagesFaces //purpose : //======================================================================= -void BOPAlgo_Builder::FillImagesFaces() +void BOPAlgo_Builder::FillImagesFaces(const Message_ProgressRange& theRange) { - BuildSplitFaces(); - FillSameDomainFaces(); - FillInternalVertices(); + Message_ProgressScope aPS(theRange, "Filing spligs of faces", 10); + BuildSplitFaces(aPS.Next(9)); + if (HasErrors()) + { + return; + } + FillSameDomainFaces(aPS.Next(0.5)); + if (HasErrors()) + { + return; + } + FillInternalVertices(aPS.Next(0.5)); } //======================================================================= //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; @@ -222,6 +268,7 @@ void BOPAlgo_Builder::BuildSplitFaces() TopTools_ListOfShape aLE(aAllocator); TopTools_MapOfShape aMDE(100, aAllocator); // + Message_ProgressScope aPSOuter(theRange, NULL, 10); // Build temporary map of faces images to avoid rebuilding // of the faces without any IN or section edges NCollection_IndexedDataMap aFacesIm; @@ -233,6 +280,10 @@ void BOPAlgo_Builder::BuildSplitFaces() if (aSI.ShapeType()!=TopAbs_FACE) { continue; } + if (UserBreak(aPSOuter)) + { + return; + } // const TopoDS_Face& aF=(*(TopoDS_Face*)(&aSI.Shape())); Standard_Boolean isUClosed = Standard_False, @@ -446,22 +497,31 @@ void BOPAlgo_Builder::BuildSplitFaces() BRepLib::BuildPCurveForEdgesOnPlane(aLE, aFF); } // 3 Build split faces - BOPAlgo_BuilderFace& aBF=aVBF.Appended(); + BOPAlgo_SplitFace& aBF=aVBF.Appended(); aBF.SetFace(aF); aBF.SetShapes(aLE); aBF.SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - aBF.SetProgressIndicator(*myProgressScope); - } // }// for (i=0; iShapeInfo(nF); const TopoDS_Shape& aF = aSI.Shape(); @@ -614,6 +684,10 @@ void BOPAlgo_Builder::FillSameDomainFaces() Standard_Integer aNbSets = anESetFaces.Extent(); for (Standard_Integer i = 1; i <= aNbSets; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } const TopTools_ListOfShape& aLF = anESetFaces(i); if (aLF.Extent() < 2) continue; @@ -640,18 +714,26 @@ void BOPAlgo_Builder::FillSameDomainFaces() aPSB.Shape1() = aF1; aPSB.Shape2() = aF2; aPSB.SetFuzzyValue(myFuzzyValue); - if (myProgressScope != NULL) - { - aPSB.SetProgressIndicator(*myProgressScope); - } } } } + aPSOuter.Next(); + + // Set progress range for each task to be run in parallel + Message_ProgressScope aPSParallel(aPSOuter.Next(6), "Checking SD faces", aVPSB.Size()); + for (Standard_Integer iPSB = 0; iPSB < aVPSB.Size(); ++iPSB) + { + aVPSB.ChangeValue(iPSB).SetProgressRange(aPSParallel.Next()); + } //================================================================ // Perform analysis BOPTools_Parallel::Perform (myRunParallel, aVPSB, myContext); //================================================================ + if (UserBreak(aPSOuter)) + { + return; + } NCollection_List aMBlocks(aAllocator); // Fill map with SD faces to make the blocks @@ -669,10 +751,15 @@ void BOPAlgo_Builder::FillSameDomainFaces() BOPAlgo_Tools::MakeBlocks (aDMSLS, aMBlocks, aAllocator); + Message_ProgressScope aPS(aPSOuter.Next(3), "Filling same domain faces map", aMBlocks.Size()); // Fill same domain faces map NCollection_List::Iterator aItB(aMBlocks); - for (; aItB.More(); aItB.Next()) + for (; aItB.More(); aItB.Next(), aPS.Next()) { + if (UserBreak(aPS)) + { + return; + } const TopTools_ListOfShape& aLSD = aItB.Value(); // If the group contains some original faces, the one with minimal // index in the DS will be chosen as the SD for the whole group. @@ -758,8 +845,10 @@ void BOPAlgo_Builder::FillSameDomainFaces() // function: FillImagesFaces1 // purpose: //======================================================================= -void BOPAlgo_Builder::FillInternalVertices() +void BOPAlgo_Builder::FillInternalVertices(const Message_ProgressRange& theRange) { + Message_ProgressScope aPSOuter(theRange, NULL, 1); + // Vector of pairs of Vertex/Face for classification of the vertices // relatively faces, and adding them as internal into the faces BOPAlgo_VectorOfVFI aVVFI; @@ -771,6 +860,11 @@ void BOPAlgo_Builder::FillInternalVertices() if (aSI.ShapeType() != TopAbs_FACE) continue; + if (UserBreak(aPSOuter)) + { + return; + } + const TopoDS_Shape& aF = aSI.Shape(); const TopTools_ListOfShape* pLFIm = myImages.Seek(aF); if (!pLFIm) @@ -796,18 +890,24 @@ void BOPAlgo_Builder::FillInternalVertices() aVFI.SetVertex(aV); aVFI.SetFace(aFIm); aVFI.SetFuzzyValue(myFuzzyValue); - if (myProgressScope != NULL) - { - aVFI.SetProgressIndicator(*myProgressScope); - } } } } + // Set progress range for each task to be run in parallel + Message_ProgressScope aPSParallel(aPSOuter.Next(), "Looking for internal shapes", aVVFI.Size()); + for (Standard_Integer iVFI = 0; iVFI< aVVFI.Size(); ++iVFI) + { + aVVFI.ChangeValue(iVFI).SetProgressRange(aPSParallel.Next()); + } // Perform classification //================================================================ BOPTools_Parallel::Perform (myRunParallel, aVVFI, myContext); //================================================================ + if (UserBreak(aPSOuter)) + { + return; + } Standard_Integer aNbVFI = aVVFI.Length(); for (Standard_Integer i = 0; i < aNbVFI; ++i) diff --git a/src/BOPAlgo/BOPAlgo_Builder_3.cxx b/src/BOPAlgo/BOPAlgo_Builder_3.cxx index f8d5b50999..1a6fd06f3a 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_3.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_3.cxx @@ -73,40 +73,47 @@ static //function : FillImagesSolids //purpose : //======================================================================= -void BOPAlgo_Builder::FillImagesSolids() +void BOPAlgo_Builder::FillImagesSolids(const Message_ProgressRange& theRange) { - Standard_Boolean bHasSolids; - Standard_Integer i, aNbS; - // - bHasSolids=Standard_False; - aNbS=myDS->NbSourceShapes(); - for (i=0; iShapeInfo(i); - if (aSI.ShapeType()==TopAbs_SOLID) { - bHasSolids=!bHasSolids; + Standard_Integer i = 0, aNbS = myDS->NbSourceShapes(); + for (i = 0; i < aNbS; ++i) { + const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i); + if (aSI.ShapeType() == TopAbs_SOLID) + { break; } } - // - if (!bHasSolids) { + if (i >= aNbS) { return; } + Message_ProgressScope aPS(theRange, "Building splits of solids", 10); // Draft solids TopTools_DataMapOfShapeShape aDraftSolids; // Find all IN faces for all IN faces - FillIn3DParts(aDraftSolids); + FillIn3DParts(aDraftSolids, aPS.Next(4)); + if (HasErrors()) + { + return; + } // Build split of the solids - BuildSplitSolids(aDraftSolids); + BuildSplitSolids(aDraftSolids, aPS.Next(5)); + if (HasErrors()) + { + return; + } // Fill solids with internal parts - FillInternalShapes(); + FillInternalShapes(aPS.Next()); } //======================================================================= //function : FillIn3DParts //purpose : //======================================================================= -void BOPAlgo_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids) +void BOPAlgo_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids, + const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, NULL, 2); + Handle(NCollection_BaseAllocator) anAlloc = new NCollection_IncAllocator; // Find all faces that are IN solids @@ -127,6 +134,11 @@ void BOPAlgo_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids if (aSI.ShapeType() != TopAbs_FACE) continue; + if (UserBreak(aPS)) + { + return; + } + const TopoDS_Shape& aS = aSI.Shape(); const TopTools_ListOfShape* pLSIm = myImages.Seek(aS); @@ -160,8 +172,13 @@ void BOPAlgo_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids { BOPDS_ShapeInfo& aSI = myDS->ChangeShapeInfo(i); if (aSI.ShapeType() != TopAbs_SOLID) + { continue; - + } + if (UserBreak(aPS)) + { + return; + } const TopoDS_Shape& aS = aSI.Shape(); const TopoDS_Solid& aSolid = (*(TopoDS_Solid*)(&aS)); // @@ -186,12 +203,17 @@ void BOPAlgo_Builder::FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids TopTools_IndexedDataMapOfShapeListOfShape anInParts; BOPAlgo_Tools::ClassifyFaces(aLFaces, aLSolids, myRunParallel, - myContext, anInParts, aShapeBoxMap, aSolidsIF); + myContext, anInParts, aShapeBoxMap, + aSolidsIF, aPS.Next()); // Analyze the results of classification Standard_Integer aNbSol = aDraftSolid.Extent(); for (i = 1; i <= aNbSol; ++i) { + if (UserBreak(aPS)) + { + return; + } const TopoDS_Solid& aSolid = TopoDS::Solid(aDraftSolid.FindKey(i)); const TopoDS_Solid& aSDraft = TopoDS::Solid(aDraftSolid(i)); const TopTools_ListOfShape& aLInFaces = anInParts.FindFromKey(aSDraft); @@ -335,8 +357,30 @@ public: //! Returns the solid const TopoDS_Solid& Solid() const { return mySolid; } + //! Sets progress range + void SetProgressRange(const Message_ProgressRange& theRange) + { + myRange = theRange; + } + + // New perform method, using own progress range + void Perform() + { + Message_ProgressScope aPS(myRange, NULL, 1); + if (!aPS.More()) + { + return; + } + BOPAlgo_BuilderSolid::Perform(aPS.Next()); + } + +private: + //! Disable the range enabled method + virtual void Perform(const Message_ProgressRange&/* theRange*/) {} + private: TopoDS_Solid mySolid; //!< Solid to split + Message_ProgressRange myRange; }; // Vector of Solid Builders @@ -346,7 +390,8 @@ typedef NCollection_Vector BOPAlgo_VectorOfBuilderSolid; //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; @@ -361,6 +406,7 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol BOPTools_MapOfSet aMST(100, aAlr0); BOPAlgo_VectorOfBuilderSolid aVBS; // + Message_ProgressScope aPSOuter (theRange, NULL, 10); // 0. Find same domain solids for non-interfered solids aNbS=myDS->NbSourceShapes(); for (i=0; iNbSourceShapes(); - for (Standard_Integer i = 0; i < aNbS; ++i) + Message_ProgressScope aPS(theRange, "Preparing history information", aNbS); + for (Standard_Integer i = 0; i < aNbS; ++i, aPS.Next()) { const TopoDS_Shape& aS = myDS->Shape(i); @@ -174,6 +175,11 @@ void BOPAlgo_Builder::PrepareHistory() if (!BRepTools_History::IsSupportedType(aS)) continue; + if (UserBreak(aPS)) + { + return; + } + Standard_Boolean isModified = Standard_False; // Check if the shape has any splits diff --git a/src/BOPAlgo/BOPAlgo_CellsBuilder.cxx b/src/BOPAlgo/BOPAlgo_CellsBuilder.cxx index 83e87b2414..e9645238e4 100644 --- a/src/BOPAlgo/BOPAlgo_CellsBuilder.cxx +++ b/src/BOPAlgo/BOPAlgo_CellsBuilder.cxx @@ -102,14 +102,15 @@ const TopoDS_Shape& BOPAlgo_CellsBuilder::GetAllParts() const //function : PerformInternal1 //purpose : //======================================================================= -void BOPAlgo_CellsBuilder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) +void BOPAlgo_CellsBuilder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { // Avoid filling history after GF operation as later // in this method the result shape will be nullified Standard_Boolean isHistory = HasHistory(); SetToFillHistory(Standard_False); // Perform splitting of the arguments - BOPAlgo_Builder::PerformInternal1(theFiller); + Message_ProgressScope aPS(theRange, "Performing MakeCells operation", 1); + BOPAlgo_Builder::PerformInternal1(theFiller, aPS.Next()); if (HasErrors()) { return; } @@ -296,7 +297,7 @@ void BOPAlgo_CellsBuilder::AddToResult(const TopTools_ListOfShape& theLSToTake, // if (!theUpdate) { if (bChanged) { - PrepareHistory(); + PrepareHistory(Message_ProgressRange()); } } else { @@ -329,7 +330,7 @@ void BOPAlgo_CellsBuilder::AddAllToResult(const Standard_Integer theMaterial, } // if (!theUpdate) { - PrepareHistory(); + PrepareHistory(Message_ProgressRange()); } else { RemoveInternalBoundaries(); @@ -419,7 +420,7 @@ void BOPAlgo_CellsBuilder::RemoveFromResult(const TopTools_ListOfShape& theLSToT if (bChanged) { myShape = aResult; // - PrepareHistory(); + PrepareHistory(Message_ProgressRange()); } } @@ -438,7 +439,7 @@ void BOPAlgo_CellsBuilder::RemoveAllFromResult() myShapeMaterial.Clear(); myMapModified.Clear(); // - PrepareHistory(); + PrepareHistory(Message_ProgressRange()); } //======================================================================= @@ -598,7 +599,7 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries() // myShape = aResult; // - PrepareHistory(); + PrepareHistory(Message_ProgressRange()); } } diff --git a/src/BOPAlgo/BOPAlgo_CellsBuilder.hxx b/src/BOPAlgo/BOPAlgo_CellsBuilder.hxx index 02d0022101..fd03822e54 100644 --- a/src/BOPAlgo/BOPAlgo_CellsBuilder.hxx +++ b/src/BOPAlgo/BOPAlgo_CellsBuilder.hxx @@ -242,7 +242,7 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder //! Redefined method PerformInternal1 - makes all split parts, //! nullifies the result , and index all parts. - Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE; + Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF, const Message_ProgressRange& theRange) Standard_OVERRIDE; //! Indexes the parts for quick access to the arguments. Standard_EXPORT void IndexParts(); diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx index 845659ab7c..6c93b78613 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -50,14 +50,14 @@ //======================================================================= class BOPAlgo_FaceSelfIntersect : public IntTools_FaceFace, - public BOPAlgo_Algo { + public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_FaceSelfIntersect() : IntTools_FaceFace(), - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myIF(-1), myTolF(1.e-7) { } // @@ -89,7 +89,11 @@ class BOPAlgo_FaceSelfIntersect : } // virtual void Perform() { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } IntTools_FaceFace::Perform (myF, myF, myRunParallel); } // @@ -140,7 +144,7 @@ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel) //function : Init //purpose : //======================================================================= -void BOPAlgo_CheckerSI::Init() +void BOPAlgo_CheckerSI::Init(const Message_ProgressRange& /*theRange*/) { Clear(); // @@ -164,7 +168,7 @@ void BOPAlgo_CheckerSI::Init() //function : Perform //purpose : //======================================================================= -void BOPAlgo_CheckerSI::Perform() +void BOPAlgo_CheckerSI::Perform(const Message_ProgressRange& theRange) { try { OCC_CATCH_SIGNALS @@ -174,24 +178,33 @@ void BOPAlgo_CheckerSI::Perform() return; } // + Message_ProgressScope aPS(theRange, "Checking shape on self-intersection", 10); // Perform intersection of sub shapes - BOPAlgo_PaveFiller::Perform(); + BOPAlgo_PaveFiller::Perform(aPS.Next(8)); + if (UserBreak(aPS)) + { + return; + } // - CheckFaceSelfIntersection(); + CheckFaceSelfIntersection(aPS.Next()); + Message_ProgressScope aPSZZ(aPS.Next(), NULL, 4); // Perform intersection with solids if (!HasErrors()) - PerformVZ(); + PerformVZ(aPSZZ.Next()); // if (!HasErrors()) - PerformEZ(); + PerformEZ(aPSZZ.Next()); // if (!HasErrors()) - PerformFZ(); + PerformFZ(aPSZZ.Next()); // if (!HasErrors()) - PerformZZ(); + PerformZZ(aPSZZ.Next()); // + if (HasErrors()) + return; + // Treat the intersection results PostTreat(); } @@ -384,7 +397,7 @@ void BOPAlgo_CheckerSI::PostTreat() //function : CheckFaceSelfIntersection //purpose : //======================================================================= -void BOPAlgo_CheckerSI::CheckFaceSelfIntersection() +void BOPAlgo_CheckerSI::CheckFaceSelfIntersection(const Message_ProgressRange& theRange) { if (myLevelOfCheck < 5) return; @@ -398,6 +411,8 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection() BOPAlgo_VectorOfFaceSelfIntersect aVFace; Standard_Integer aNbS=myDS->NbSourceShapes(); + + Message_ProgressScope aPSOuter(theRange, NULL, 1); // for (Standard_Integer i = 0; i < aNbS; i++) @@ -432,17 +447,21 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection() aFaceSelfIntersect.SetIndex(i); aFaceSelfIntersect.SetFace(aF); aFaceSelfIntersect.SetTolF(aTolF); - // - if (myProgressScope != NULL) - { - aFaceSelfIntersect.SetProgressIndicator(*myProgressScope); - } } Standard_Integer aNbFace = aVFace.Length(); + Message_ProgressScope aPSParallel(aPSOuter.Next(), "Checking surface on self-intersection", aNbFace); + for (Standard_Integer iF = 0; iF < aNbFace; ++iF) + { + aVFace.ChangeValue(iF).SetProgressRange(aPSParallel.Next()); + } //====================================================== BOPTools_Parallel::Perform (myRunParallel, aVFace); //====================================================== + if (UserBreak(aPSOuter)) + { + return; + } // for (Standard_Integer k = 0; k < aNbFace; k++) { diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.hxx b/src/BOPAlgo/BOPAlgo_CheckerSI.hxx index da10832f5a..31dd03118a 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.hxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.hxx @@ -46,7 +46,7 @@ public: Standard_EXPORT BOPAlgo_CheckerSI(); Standard_EXPORT virtual ~BOPAlgo_CheckerSI(); - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Sets the level of checking shape on self-interference.
//! It defines which interferences will be checked:
@@ -64,29 +64,29 @@ public: protected: - Standard_EXPORT virtual void Init() Standard_OVERRIDE; + Standard_EXPORT virtual void Init(const Message_ProgressRange& theRange) Standard_OVERRIDE; //! Treats the intersection results Standard_EXPORT void PostTreat(); - Standard_EXPORT void CheckFaceSelfIntersection(); + Standard_EXPORT void CheckFaceSelfIntersection(const Message_ProgressRange& theRange); //! Methods for intersection with solids //! Vertex/Solid intersection - Standard_EXPORT virtual void PerformVZ(); + Standard_EXPORT virtual void PerformVZ(const Message_ProgressRange& theRange); //! Edge/Solid intersection - Standard_EXPORT virtual void PerformEZ(); + Standard_EXPORT virtual void PerformEZ(const Message_ProgressRange& theRange); //! Face/Solid intersection - Standard_EXPORT virtual void PerformFZ(); + Standard_EXPORT virtual void PerformFZ(const Message_ProgressRange& theRange); //! Solid/Solid intersection - Standard_EXPORT virtual void PerformZZ(); + Standard_EXPORT virtual void PerformZZ(const Message_ProgressRange& theRange); //! Used for intersection of edges and faces with solids - Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS); + Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS, const Message_ProgressRange& theRange); Standard_Integer myLevelOfCheck; diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx index dc9b8c6f90..d607cba573 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx @@ -41,12 +41,12 @@ //class : BOPAlgo_VertexSolid //purpose : //======================================================================= -class BOPAlgo_VertexSolid { +class BOPAlgo_VertexSolid { public: DEFINE_STANDARD_ALLOC - BOPAlgo_VertexSolid() - : myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) { + BOPAlgo_VertexSolid() : + myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) { }; // virtual ~BOPAlgo_VertexSolid(){ @@ -92,7 +92,18 @@ class BOPAlgo_VertexSolid { return myState; }; // - void Perform() { + void SetProgressRange(const Message_ProgressRange& theRange) + { + myProgressRange = theRange; + } + // + virtual void Perform() { + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (!aPS.More()) + { + return; + } + Standard_Real aTol; gp_Pnt aPV; // @@ -113,6 +124,7 @@ class BOPAlgo_VertexSolid { TopoDS_Vertex myV; TopoDS_Solid myZ; Handle(IntTools_Context) myContext; + Message_ProgressRange myProgressRange; }; //======================================================================= typedef NCollection_Vector BOPAlgo_VectorOfVertexSolid; @@ -122,7 +134,7 @@ typedef NCollection_Vector BOPAlgo_VectorOfVertexSolid; //class : BOPAlgo_ShapeSolid //purpose : //======================================================================= -class BOPAlgo_ShapeSolid { +class BOPAlgo_ShapeSolid { public: DEFINE_STANDARD_ALLOC @@ -156,7 +168,18 @@ class BOPAlgo_ShapeSolid { return myHasInterf; }; // + void SetProgressRange(const Message_ProgressRange& theRange) + { + myProgressRange = theRange; + } + // virtual void Perform() { + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (!aPS.More()) + { + return; + } + Standard_Boolean bHasInterf; // myHasInterf=Standard_False; @@ -172,6 +195,7 @@ class BOPAlgo_ShapeSolid { Standard_Integer myIZ; Standard_Boolean myHasInterf; BOPDS_DS* myDS; + Message_ProgressRange myProgressRange; }; //======================================================================= typedef NCollection_Vector BOPAlgo_VectorOfShapeSolid; @@ -193,6 +217,12 @@ class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid { }; // virtual void Perform() { + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (!aPS.More()) + { + return; + } + Standard_Boolean bFlag; // bFlag=Standard_False; @@ -211,8 +241,10 @@ typedef NCollection_Vector BOPAlgo_VectorOfSolidSolid; //function : PerformVZ //purpose : //======================================================================= -void BOPAlgo_CheckerSI::PerformVZ() +void BOPAlgo_CheckerSI::PerformVZ(const Message_ProgressRange& theRange) { + Message_ProgressScope aPSOuter(theRange, NULL, 1); + Standard_Integer iSize, nV, nZ, k, aNbVVS; TopAbs_State aState; BOPDS_MapOfPair aMPK; @@ -229,6 +261,10 @@ void BOPAlgo_CheckerSI::PerformVZ() BOPAlgo_VectorOfVertexSolid aVVS; // for (; myIterator->More(); myIterator->Next()) { + if (UserBreak(aPSOuter)) + { + return; + } myIterator->Value(nV, nZ); // if (myDS->HasInterfShapeSubShapes(nV, nZ)) { @@ -254,9 +290,19 @@ void BOPAlgo_CheckerSI::PerformVZ() } // aNbVVS=aVVS.Length(); + + Message_ProgressScope aPSParallel(aPSOuter.Next(), "Performing Vertex-Solid intersection", aNbVVS); + for (Standard_Integer iVS = 0; iVS < aNbVVS; ++iVS) + { + aVVS.ChangeValue(iVS).SetProgressRange(aPSParallel.Next()); + } //============================================================= BOPTools_Parallel::Perform (myRunParallel, aVVS, myContext); //============================================================= + if (UserBreak(aPSOuter)) + { + return; + } for (k=0; k < aNbVVS; ++k) { const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k); aState=aVertexSolid.State(); @@ -274,24 +320,26 @@ void BOPAlgo_CheckerSI::PerformVZ() //function : PerformEZ //purpose : //======================================================================= -void BOPAlgo_CheckerSI::PerformEZ() +void BOPAlgo_CheckerSI::PerformEZ(const Message_ProgressRange& theRange) { - PerformSZ(TopAbs_EDGE); + PerformSZ(TopAbs_EDGE, theRange); } //======================================================================= //function : PerformFZ //purpose : //======================================================================= -void BOPAlgo_CheckerSI::PerformFZ() +void BOPAlgo_CheckerSI::PerformFZ(const Message_ProgressRange& theRange) { - PerformSZ(TopAbs_FACE); + PerformSZ(TopAbs_FACE, theRange); } //======================================================================= //function : PerformZZ //purpose : //======================================================================= -void BOPAlgo_CheckerSI::PerformZZ() +void BOPAlgo_CheckerSI::PerformZZ(const Message_ProgressRange& theRange) { + Message_ProgressScope aPSOuter(theRange, NULL, 1); + Standard_Boolean bHasInterf; Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid; // @@ -312,9 +360,19 @@ void BOPAlgo_CheckerSI::PerformZZ() } // aNbSolidSolid=aVSolidSolid.Length(); + + Message_ProgressScope aPSParallel(aPSOuter.Next(), "Performing Solid-Solid intersection", aNbSolidSolid); + for (Standard_Integer iSS = 0; iSS < aNbSolidSolid; ++iSS) + { + aVSolidSolid.ChangeValue(iSS).SetProgressRange(aPSParallel.Next()); + } //====================================================== BOPTools_Parallel::Perform (myRunParallel, aVSolidSolid); //====================================================== + if (UserBreak(aPSOuter)) + { + return; + } // BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ(); // @@ -337,12 +395,14 @@ void BOPAlgo_CheckerSI::PerformZZ() //function : PerformSZ //purpose : //======================================================================= -void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS) +void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum theTS, const Message_ProgressRange& theRange) { + Message_ProgressScope aPSOuter(theRange, NULL, 1); + Standard_Boolean bHasInterf; Standard_Integer iSize, nS, nZ, k, aNbShapeSolid; // - myIterator->Initialize(aTS, TopAbs_SOLID); + myIterator->Initialize(theTS, TopAbs_SOLID); iSize=myIterator->ExpectedLength(); if (!iSize) { return; @@ -359,14 +419,27 @@ void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS) } // aNbShapeSolid=aVShapeSolid.Length(); + + Message_ProgressScope aPSParallel(aPSOuter.Next(), + theTS == TopAbs_EDGE ? "Performing Edge-Solid intersection" : + "Performing Face-Solid intersection", + aNbShapeSolid); + for (Standard_Integer iSS = 0; iSS < aNbShapeSolid; ++iSS) + { + aVShapeSolid.ChangeValue(iSS).SetProgressRange(aPSParallel.Next()); + } //====================================================== BOPTools_Parallel::Perform (myRunParallel, aVShapeSolid); //====================================================== + if (UserBreak(aPSOuter)) + { + return; + } // BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ(); BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ(); // - if (aTS==TopAbs_EDGE) { + if (theTS==TopAbs_EDGE) { aEZs.SetIncrement(iSize); } else {//if (aTS==TopAbs_FACE) @@ -379,7 +452,7 @@ void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS) if (bHasInterf) { aShapeSolid.Indices(nS, nZ); // - if (aTS==TopAbs_EDGE) { + if (theTS==TopAbs_EDGE) { BOPDS_InterfEZ& aEZ=aEZs.Appended(); aEZ.SetIndices(nS, nZ); } diff --git a/src/BOPAlgo/BOPAlgo_MakerVolume.cxx b/src/BOPAlgo/BOPAlgo_MakerVolume.cxx index 2ea86e8783..2332cec777 100644 --- a/src/BOPAlgo/BOPAlgo_MakerVolume.cxx +++ b/src/BOPAlgo/BOPAlgo_MakerVolume.cxx @@ -48,8 +48,12 @@ void BOPAlgo_MakerVolume::CheckData() //function : Perform //purpose : //======================================================================= -void BOPAlgo_MakerVolume::Perform() +void BOPAlgo_MakerVolume::Perform(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, "Performing MakeVolume operation", 10); + Standard_Real anInterPart = myIntersect ? 9 : 0.5; + Standard_Real aBuildPart = 10. - anInterPart; + GetReport()->Clear(); // if (myEntryPoint == 1) { @@ -86,18 +90,14 @@ void BOPAlgo_MakerVolume::Perform() } // pPF->SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - pPF->SetProgressIndicator(*myProgressScope); - } pPF->SetFuzzyValue(myFuzzyValue); pPF->SetNonDestructive(myNonDestructive); pPF->SetGlue(myGlue); pPF->SetUseOBB(myUseOBB); - pPF->Perform(); + pPF->Perform(aPS.Next(anInterPart)); // myEntryPoint = 1; - PerformInternal(*pPF); + PerformInternal(*pPF, aPS.Next(aBuildPart)); } //======================================================================= @@ -105,8 +105,9 @@ void BOPAlgo_MakerVolume::Perform() //purpose : //======================================================================= void BOPAlgo_MakerVolume::PerformInternal1 - (const BOPAlgo_PaveFiller& theFiller) + (const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, "Building volumes", 100); myPaveFiller = (BOPAlgo_PaveFiller*)&theFiller; myDS = myPaveFiller->PDS(); myContext = myPaveFiller->Context(); @@ -123,25 +124,28 @@ void BOPAlgo_MakerVolume::PerformInternal1 return; } // + BOPAlgo_PISteps aSteps(PIOperation_Last); + analyzeProgress(100., aSteps); + // 3. Fill Images - // 3.1. Vertice if (myIntersect) { - FillImagesVertices(); + // 3.1. Vertices + FillImagesVertices(aPS.Next(aSteps.GetStep(PIOperation_TreatVertices))); if (HasErrors()) { return; } // 3.2. Edges - FillImagesEdges(); + FillImagesEdges(aPS.Next(aSteps.GetStep(PIOperation_TreatEdges))); if (HasErrors()) { return; } // 3.3. Wires - FillImagesContainers(TopAbs_WIRE); + FillImagesContainers(TopAbs_WIRE, aPS.Next(aSteps.GetStep(PIOperation_TreatWires))); if (HasErrors()) { return; } // 3.4. Faces - FillImagesFaces(); + FillImagesFaces(aPS.Next(aSteps.GetStep(PIOperation_TreatFaces))); if (HasErrors()) { return; } @@ -160,7 +164,7 @@ void BOPAlgo_MakerVolume::PerformInternal1 MakeBox(aBoxFaces); // // 6. Make volumes - BuildSolids(aLSR); + BuildSolids(aLSR, aPS.Next(aSteps.GetStep(PIOperation_BuildSolids))); if (HasErrors()) { return; } @@ -175,10 +179,30 @@ void BOPAlgo_MakerVolume::PerformInternal1 BuildShape(aLSR); // // 10. History - PrepareHistory(); + PrepareHistory(aPS.Next(aSteps.GetStep(PIOperation_FillHistory))); + if (HasErrors()) { + return; + } // // 11. Post-treatment - PostTreat(); + PostTreat(aPS.Next(aSteps.GetStep(PIOperation_PostTreat))); +} + +//======================================================================= +//function : fillPISteps +//purpose : +//======================================================================= +void BOPAlgo_MakerVolume::fillPISteps(BOPAlgo_PISteps& theSteps) const +{ + NbShapes aNbShapes = getNbShapes(); + if (myIntersect) + { + theSteps.SetStep(PIOperation_TreatVertices, aNbShapes.NbVertices()); + theSteps.SetStep(PIOperation_TreatEdges, aNbShapes.NbEdges()); + theSteps.SetStep(PIOperation_TreatWires, aNbShapes.NbWires()); + theSteps.SetStep(PIOperation_TreatFaces, 50 * aNbShapes.NbFaces()); + } + theSteps.SetStep(PIOperation_BuildSolids, 50 * aNbShapes.NbFaces()); } //======================================================================= @@ -187,7 +211,6 @@ void BOPAlgo_MakerVolume::PerformInternal1 //======================================================================= void BOPAlgo_MakerVolume::CollectFaces() { - UserBreak(); // Standard_Integer i, aNbShapes; TopTools_ListIteratorOfListOfShape aIt; @@ -226,7 +249,6 @@ void BOPAlgo_MakerVolume::CollectFaces() //======================================================================= void BOPAlgo_MakerVolume::MakeBox(TopTools_MapOfShape& theBoxFaces) { - UserBreak(); // Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, anExt; // @@ -251,16 +273,15 @@ void BOPAlgo_MakerVolume::MakeBox(TopTools_MapOfShape& theBoxFaces) //function : BuildSolids //purpose : //======================================================================= -void BOPAlgo_MakerVolume::BuildSolids(TopTools_ListOfShape& theLSR) +void BOPAlgo_MakerVolume::BuildSolids(TopTools_ListOfShape& theLSR, + const Message_ProgressRange& theRange) { - UserBreak(); - // BOPAlgo_BuilderSolid aBS; // aBS.SetShapes(myFaces); aBS.SetRunParallel(myRunParallel); aBS.SetAvoidInternalShapes(myAvoidInternalShapes); - aBS.Perform(); + aBS.Perform(theRange); if (aBS.HasErrors()) { AddError (new BOPAlgo_AlertSolidBuilderFailed); // SolidBuilder failed @@ -279,7 +300,6 @@ void BOPAlgo_MakerVolume::BuildSolids(TopTools_ListOfShape& theLSR) void BOPAlgo_MakerVolume::RemoveBox(TopTools_ListOfShape& theLSR, const TopTools_MapOfShape& theBoxFaces) { - UserBreak(); // TopTools_ListIteratorOfListOfShape aIt; TopExp_Explorer aExp; @@ -336,8 +356,6 @@ void BOPAlgo_MakerVolume::FillInternalShapes(const TopTools_ListOfShape& theLSR) return; } - UserBreak(); - // Get all non-compound shapes TopTools_ListOfShape aLSC; // Fence map diff --git a/src/BOPAlgo/BOPAlgo_MakerVolume.hxx b/src/BOPAlgo/BOPAlgo_MakerVolume.hxx index a17424363b..5d116869dd 100644 --- a/src/BOPAlgo/BOPAlgo_MakerVolume.hxx +++ b/src/BOPAlgo/BOPAlgo_MakerVolume.hxx @@ -113,8 +113,6 @@ public: DEFINE_STANDARD_ALLOC - - //! Empty constructor. BOPAlgo_MakerVolume(); virtual ~BOPAlgo_MakerVolume(); @@ -151,7 +149,7 @@ public: } //! Performs the operation. - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; protected: @@ -159,7 +157,7 @@ protected: Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; //! Performs the operation. - Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE; + Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF, const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Collects all faces. Standard_EXPORT void CollectFaces(); @@ -168,7 +166,8 @@ protected: Standard_EXPORT void MakeBox (TopTools_MapOfShape& theBoxFaces); //! Builds solids. - Standard_EXPORT void BuildSolids (TopTools_ListOfShape& theLSR); + Standard_EXPORT void BuildSolids (TopTools_ListOfShape& theLSR, + const Message_ProgressRange& theRange); //! Removes the covering box. Standard_EXPORT void RemoveBox (TopTools_ListOfShape& theLSR, const TopTools_MapOfShape& theBoxFaces); @@ -179,6 +178,25 @@ protected: //! Builds the result. Standard_EXPORT void BuildShape (const TopTools_ListOfShape& theLSR); +protected: + //! List of operations to be supported by the Progress Indicator. + //! Enumeration is going to contain some extra operations from base class, + //! which are not going to be used here. So, the array of steps will also + //! contain some extra zero values. This is the only extra resource that is + //! going to be used, but it allows us not to override the methods that use + //! the values of the enumeration of base class. + //! Starting the enumeration from the middle of enumeration of base class is + //! not a good idea as the values in enumeration may be swapped. + enum BOPAlgo_PIOperation + { + PIOperation_BuildSolids = BOPAlgo_Builder::PIOperation_Last, + PIOperation_Last + }; + + //! Analyze progress steps + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + +protected: Standard_Boolean myIntersect; Bnd_Box myBBox; diff --git a/src/BOPAlgo/BOPAlgo_Options.cxx b/src/BOPAlgo/BOPAlgo_Options.cxx index 34da6bcd3b..7ff5d35b07 100644 --- a/src/BOPAlgo/BOPAlgo_Options.cxx +++ b/src/BOPAlgo/BOPAlgo_Options.cxx @@ -21,6 +21,7 @@ #include #include #include +#include namespace { @@ -52,7 +53,6 @@ BOPAlgo_Options::BOPAlgo_Options() myReport(new Message_Report), myRunParallel(myGlobalRunParallel), myFuzzyValue(Precision::Confusion()), - myProgressScope(0L), myUseOBB(Standard_False) { BOPAlgo_LoadMessages(); @@ -69,7 +69,6 @@ BOPAlgo_Options::BOPAlgo_Options myReport(new Message_Report), myRunParallel(myGlobalRunParallel), myFuzzyValue(Precision::Confusion()), - myProgressScope(0L), myUseOBB(Standard_False) { BOPAlgo_LoadMessages(); @@ -129,27 +128,13 @@ void BOPAlgo_Options::SetFuzzyValue(const Standard_Real theFuzz) myFuzzyValue = Max(theFuzz, Precision::Confusion()); } - -//======================================================================= -//function : SetProgressIndicator -//purpose : -//======================================================================= -void BOPAlgo_Options::SetProgressIndicator - (const Message_ProgressScope& theScope) +Standard_Boolean BOPAlgo_Options::UserBreak(const Message_ProgressScope& thePS) { - myProgressScope = &theScope; + if (thePS.UserBreak()) + { + AddError(new BOPAlgo_AlertUserBreak); + return Standard_True; + } + return Standard_False; } -//======================================================================= -//function : UserBreak -//purpose : -//======================================================================= -void BOPAlgo_Options::UserBreak() const -{ - if (!myProgressScope) { - return; - } - if (myProgressScope->UserBreak()) { - throw Standard_NotImplemented("BOPAlgo_Options::UserBreak(), method is not implemented"); - } -} diff --git a/src/BOPAlgo/BOPAlgo_Options.hxx b/src/BOPAlgo/BOPAlgo_Options.hxx index 6043fec316..2805d4cbea 100644 --- a/src/BOPAlgo/BOPAlgo_Options.hxx +++ b/src/BOPAlgo/BOPAlgo_Options.hxx @@ -30,8 +30,6 @@ class Message_ProgressScope; //! - *Parallel processing mode* - provides the possibility to perform operation in parallel mode; //! - *Fuzzy tolerance* - additional tolerance for the operation to detect //! touching or coinciding cases; -//! - *Progress indicator* - provides interface to track the progress of -//! operation and stop the operation by user's break. //! - *Using the Oriented Bounding Boxes* - Allows using the Oriented Bounding Boxes of the shapes //! for filtering the intersections. //! @@ -152,12 +150,6 @@ public: return myFuzzyValue; } -public: - //!@name Progress indicator - - //! Set the Progress Indicator object. - Standard_EXPORT void SetProgressIndicator(const Message_ProgressScope& theProgress); - public: //!@name Usage of Oriented Bounding boxes @@ -175,9 +167,8 @@ public: protected: - //! Breaks the execution if the break signal - //! is indicated by myProgressIndicator. - Standard_EXPORT void UserBreak() const; + //! Adds error to the report if the break signal was caught. Returns true in this case, false otherwise. + Standard_EXPORT Standard_Boolean UserBreak(const Message_ProgressScope& thePS); protected: @@ -185,7 +176,6 @@ protected: Handle(Message_Report) myReport; Standard_Boolean myRunParallel; Standard_Real myFuzzyValue; - const Message_ProgressScope* myProgressScope; Standard_Boolean myUseOBB; }; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx index faf4ce3ee9..afe18b1e8d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx @@ -32,12 +32,38 @@ #include #include +namespace +{ + //======================================================================= + //function : BOPAlgo_PIOperation + //purpose : List of operations to be supported by the Progress Indicator + //======================================================================= + enum BOPAlgo_PIOperation + { + PIOperation_Prepare = 0, + PIOperation_PerformVV, + PIOperation_PerformVE, + PIOperation_PerformEE, + PIOperation_PerformVF, + PIOperation_PerformEF, + PIOperation_RepeatIntersection, + PIOperation_ForceInterfEE, + PIOperation_ForceInterfEF, + PIOperation_PerformFF, + PIOperation_MakeSplitEdges, + PIOperation_MakeBlocks, + PIOperation_MakePCurves, + PIOperation_ProcessDE, + PIOperation_Last + }; +} + //======================================================================= //function : //purpose : //======================================================================= BOPAlgo_PaveFiller::BOPAlgo_PaveFiller() -: + : BOPAlgo_Algo() { myDS = NULL; @@ -52,13 +78,13 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller() //purpose : //======================================================================= BOPAlgo_PaveFiller::BOPAlgo_PaveFiller - (const Handle(NCollection_BaseAllocator)& theAllocator) -: - BOPAlgo_Algo(theAllocator), - myFPBDone(1, theAllocator), - myIncreasedSS(1, theAllocator), - myVertsToAvoidExtension(1, theAllocator), - myDistances(1, theAllocator) +(const Handle (NCollection_BaseAllocator)& theAllocator) + : + BOPAlgo_Algo (theAllocator), + myFPBDone (1, theAllocator), + myIncreasedSS (1, theAllocator), + myVertsToAvoidExtension (1, theAllocator), + myDistances (1, theAllocator) { myDS = NULL; myIterator = NULL; @@ -79,15 +105,15 @@ BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller() //function : SetNonDestructive //purpose : //======================================================================= -void BOPAlgo_PaveFiller::SetNonDestructive(const Standard_Boolean bFlag) +void BOPAlgo_PaveFiller::SetNonDestructive (const Standard_Boolean bFlag) { - myNonDestructive=bFlag; + myNonDestructive = bFlag; } //======================================================================= //function : NonDestructive //purpose : //======================================================================= -Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const +Standard_Boolean BOPAlgo_PaveFiller::NonDestructive() const { return myNonDestructive; } @@ -95,15 +121,15 @@ Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const //function : SetGlue //purpose : //======================================================================= -void BOPAlgo_PaveFiller::SetGlue(const BOPAlgo_GlueEnum theGlue) +void BOPAlgo_PaveFiller::SetGlue (const BOPAlgo_GlueEnum theGlue) { - myGlue=theGlue; + myGlue = theGlue; } //======================================================================= //function : Glue //purpose : //======================================================================= -BOPAlgo_GlueEnum BOPAlgo_PaveFiller::Glue() const +BOPAlgo_GlueEnum BOPAlgo_PaveFiller::Glue() const { return myGlue; } @@ -111,15 +137,15 @@ BOPAlgo_GlueEnum BOPAlgo_PaveFiller::Glue() const //function : SetIsPrimary //purpose : //======================================================================= -void BOPAlgo_PaveFiller::SetIsPrimary(const Standard_Boolean bFlag) +void BOPAlgo_PaveFiller::SetIsPrimary (const Standard_Boolean bFlag) { - myIsPrimary=bFlag; + myIsPrimary = bFlag; } //======================================================================= //function : IsPrimary //purpose : //======================================================================= -Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const +Standard_Boolean BOPAlgo_PaveFiller::IsPrimary() const { return myIsPrimary; } @@ -132,11 +158,11 @@ void BOPAlgo_PaveFiller::Clear() BOPAlgo_Algo::Clear(); if (myIterator) { delete myIterator; - myIterator=NULL; + myIterator = NULL; } if (myDS) { delete myDS; - myDS=NULL; + myDS = NULL; } myIncreasedSS.Clear(); } @@ -160,7 +186,7 @@ BOPDS_PDS BOPAlgo_PaveFiller::PDS() //function : Context //purpose : //======================================================================= -const Handle(IntTools_Context)& BOPAlgo_PaveFiller::Context() +const Handle (IntTools_Context)& BOPAlgo_PaveFiller::Context() { return myContext; } @@ -169,7 +195,7 @@ const Handle(IntTools_Context)& BOPAlgo_PaveFiller::Context() //purpose : //======================================================================= void BOPAlgo_PaveFiller::SetSectionAttribute - (const BOPAlgo_SectionAttribute& theSecAttr) +(const BOPAlgo_SectionAttribute& theSecAttr) { mySectionAttribute = theSecAttr; } @@ -177,14 +203,15 @@ void BOPAlgo_PaveFiller::SetSectionAttribute // function: Init // purpose: //======================================================================= -void BOPAlgo_PaveFiller::Init() +void BOPAlgo_PaveFiller::Init (const Message_ProgressRange& theRange) { if (!myArguments.Extent()) { AddError (new BOPAlgo_AlertTooFewArguments); return; } // - TopTools_ListIteratorOfListOfShape aIt(myArguments); + Message_ProgressScope aPS (theRange, "Initialization of Intersection algorithm", 1); + TopTools_ListIteratorOfListOfShape aIt (myArguments); for (; aIt.More(); aIt.Next()) { if (aIt.Value().IsNull()) { AddError (new BOPAlgo_AlertNullInputShapes); @@ -196,117 +223,132 @@ void BOPAlgo_PaveFiller::Init() Clear(); // // 1.myDS - myDS=new BOPDS_DS(myAllocator); - myDS->SetArguments(myArguments); - myDS->Init(myFuzzyValue); + myDS = new BOPDS_DS (myAllocator); + myDS->SetArguments (myArguments); + myDS->Init (myFuzzyValue); // // 2 myContext - myContext=new IntTools_Context; + myContext = new IntTools_Context; // // 3.myIterator - myIterator=new BOPDS_Iterator(myAllocator); - myIterator->SetRunParallel(myRunParallel); - myIterator->SetDS(myDS); - myIterator->Prepare(myContext, myUseOBB, myFuzzyValue); + myIterator = new BOPDS_Iterator (myAllocator); + myIterator->SetRunParallel (myRunParallel); + myIterator->SetDS (myDS); + myIterator->Prepare (myContext, myUseOBB, myFuzzyValue); // // 4 NonDestructive flag SetNonDestructive(); } + //======================================================================= // function: Perform // purpose: //======================================================================= -void BOPAlgo_PaveFiller::Perform() +void BOPAlgo_PaveFiller::Perform (const Message_ProgressRange& theRange) { try { OCC_CATCH_SIGNALS - // - PerformInternal(); + // + PerformInternal (theRange); } // catch (Standard_Failure const&) { AddError (new BOPAlgo_AlertIntersectionFailed); - } + } } + //======================================================================= // function: PerformInternal // purpose: //======================================================================= -void BOPAlgo_PaveFiller::PerformInternal() +void BOPAlgo_PaveFiller::PerformInternal (const Message_ProgressRange& theRange) { - Init(); + Message_ProgressScope aPS (theRange, "Performing intersection of shapes", 100); + + Init (aPS.Next (5)); if (HasErrors()) { - return; + return; } + + // Compute steps of the PI + BOPAlgo_PISteps aSteps (PIOperation_Last); + analyzeProgress (95, aSteps); // - Prepare(); + Prepare (aPS.Next (aSteps.GetStep (PIOperation_Prepare))); if (HasErrors()) { - return; + return; } // 00 - PerformVV(); + PerformVV (aPS.Next (aSteps.GetStep (PIOperation_PerformVV))); if (HasErrors()) { - return; + return; } // 01 - PerformVE(); + PerformVE (aPS.Next (aSteps.GetStep (PIOperation_PerformVE))); if (HasErrors()) { - return; + return; } // UpdatePaveBlocksWithSDVertices(); // 11 - PerformEE(); + PerformEE (aPS.Next (aSteps.GetStep (PIOperation_PerformEE))); if (HasErrors()) { - return; + return; } UpdatePaveBlocksWithSDVertices(); // 02 - PerformVF(); + PerformVF (aPS.Next (aSteps.GetStep (PIOperation_PerformVF))); if (HasErrors()) { - return; + return; } UpdatePaveBlocksWithSDVertices(); // 12 - PerformEF(); + PerformEF (aPS.Next (aSteps.GetStep (PIOperation_PerformEF))); if (HasErrors()) { - return; + return; } UpdatePaveBlocksWithSDVertices(); UpdateInterfsWithSDVertices(); // Repeat Intersection with increased vertices - RepeatIntersection(); + RepeatIntersection (aPS.Next (aSteps.GetStep (PIOperation_RepeatIntersection))); if (HasErrors()) return; - // Force intersection of edges after increase // of the tolerance values of their vertices - ForceInterfEE(); + ForceInterfEE (aPS.Next (aSteps.GetStep (PIOperation_ForceInterfEE))); + if (HasErrors()) + { + return; + } // Force Edge/Face intersection after increase // of the tolerance values of their vertices - ForceInterfEF(); + ForceInterfEF (aPS.Next (aSteps.GetStep (PIOperation_ForceInterfEF))); + if (HasErrors()) + { + return; + } // // 22 - PerformFF(); + PerformFF (aPS.Next (aSteps.GetStep (PIOperation_PerformFF))); if (HasErrors()) { - return; + return; } // UpdateBlocksWithSharedVertices(); // myDS->RefineFaceInfoIn(); // - MakeSplitEdges(); + MakeSplitEdges (aPS.Next (aSteps.GetStep (PIOperation_MakeSplitEdges))); if (HasErrors()) { return; } // UpdatePaveBlocksWithSDVertices(); // - MakeBlocks(); + MakeBlocks (aPS.Next (aSteps.GetStep (PIOperation_MakeBlocks))); if (HasErrors()) { - return; + return; } // CheckSelfInterference(); @@ -317,14 +359,14 @@ void BOPAlgo_PaveFiller::PerformInternal() // RemoveMicroEdges(); // - MakePCurves(); + MakePCurves (aPS.Next (aSteps.GetStep (PIOperation_MakePCurves))); if (HasErrors()) { - return; + return; } // - ProcessDE(); + ProcessDE (aPS.Next (aSteps.GetStep (PIOperation_ProcessDE))); if (HasErrors()) { - return; + return; } } @@ -332,53 +374,114 @@ void BOPAlgo_PaveFiller::PerformInternal() // function: RepeatIntersection // purpose: //======================================================================= -void BOPAlgo_PaveFiller::RepeatIntersection() +void BOPAlgo_PaveFiller::RepeatIntersection (const Message_ProgressRange& theRange) { // Find all vertices with increased tolerance TColStd_MapOfInteger anExtraInterfMap; const Standard_Integer aNbS = myDS->NbSourceShapes(); + Message_ProgressScope aPS (theRange, "Repeat intersection", 3); for (Standard_Integer i = 0; i < aNbS; ++i) { - const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i); + const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo (i); if (aSI.ShapeType() != TopAbs_VERTEX) continue; // Check if the tolerance of the original vertex has been increased - if (myIncreasedSS.Contains(i)) + if (myIncreasedSS.Contains (i)) { - anExtraInterfMap.Add(i); + anExtraInterfMap.Add (i); continue; } // Check if the vertex created a new vertex with greater tolerance Standard_Integer nVSD; - if (!myDS->HasShapeSD(i, nVSD)) + if (!myDS->HasShapeSD (i, nVSD)) continue; - if (myIncreasedSS.Contains(nVSD)) - anExtraInterfMap.Add(i); + if (myIncreasedSS.Contains (nVSD)) + anExtraInterfMap.Add (i); } if (anExtraInterfMap.IsEmpty()) return; // Update iterator of pairs of shapes with interfering boxes - myIterator->IntersectExt(anExtraInterfMap); + myIterator->IntersectExt (anExtraInterfMap); // Perform intersections with vertices - PerformVV(); + + PerformVV (aPS.Next()); if (HasErrors()) return; UpdatePaveBlocksWithSDVertices(); - PerformVE(); + PerformVE (aPS.Next()); if (HasErrors()) return; UpdatePaveBlocksWithSDVertices(); - PerformVF(); + PerformVF (aPS.Next()); if (HasErrors()) return; UpdatePaveBlocksWithSDVertices(); UpdateInterfsWithSDVertices(); } + + +//======================================================================= +// function: fillPISteps +// purpose: +//======================================================================= +void BOPAlgo_PaveFiller::fillPIConstants (const Standard_Real theWhole, + BOPAlgo_PISteps& theSteps) const +{ + if (!myNonDestructive) + { + theSteps.SetStep (PIOperation_Prepare, 1 * theWhole / 100.); + } +} + +//======================================================================= +// function: fillPISteps +// purpose: +//======================================================================= +void BOPAlgo_PaveFiller::fillPISteps (BOPAlgo_PISteps& theSteps) const +{ + // Get number of all intersecting pairs + Standard_Integer aVVSize = 0, aVESize = 0, aEESize = 0, aVFSize = 0, aEFSize = 0, aFFSize = 0; + + myIterator->Initialize (TopAbs_VERTEX, TopAbs_VERTEX); + aVVSize = myIterator->ExpectedLength(); + + myIterator->Initialize (TopAbs_VERTEX, TopAbs_EDGE); + aVESize = myIterator->ExpectedLength(); + + myIterator->Initialize (TopAbs_EDGE, TopAbs_EDGE); + aEESize = myIterator->ExpectedLength(); + + myIterator->Initialize (TopAbs_VERTEX, TopAbs_FACE); + aVFSize = myIterator->ExpectedLength(); + + if (myGlue != BOPAlgo_GlueFull) + { + myIterator->Initialize (TopAbs_EDGE, TopAbs_FACE); + aEFSize = myIterator->ExpectedLength(); + } + + myIterator->Initialize (TopAbs_FACE, TopAbs_FACE); + aFFSize = myIterator->ExpectedLength(); + + theSteps.SetStep (PIOperation_PerformVV, aVVSize); + theSteps.SetStep (PIOperation_PerformVE, 2 * aVESize); + theSteps.SetStep (PIOperation_PerformEE, 5 * aEESize); + theSteps.SetStep (PIOperation_PerformVF, 5 * aVFSize); + theSteps.SetStep (PIOperation_PerformEF, 10 * aEFSize); + theSteps.SetStep (PIOperation_RepeatIntersection, 0.2 * (aVVSize + aVESize + aVFSize)); + theSteps.SetStep (PIOperation_ForceInterfEE, 2 * aEESize); + theSteps.SetStep (PIOperation_ForceInterfEF, 2 * aEFSize); + theSteps.SetStep (PIOperation_PerformFF, (myGlue == BOPAlgo_GlueFull ? 1 : 30) * aFFSize); + theSteps.SetStep (PIOperation_MakeSplitEdges, aEESize); + theSteps.SetStep (PIOperation_MakeBlocks, (myGlue == BOPAlgo_GlueFull ? 0 : 5) * aFFSize); + theSteps.SetStep (PIOperation_MakePCurves, myAvoidBuildPCurve ? 0 : 0.2 * (aEESize + aEFSize)); + theSteps.SetStep (PIOperation_ProcessDE, 0.1 * aEESize); +} diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx index 307f2e5031..5906e81825 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx @@ -158,7 +158,7 @@ public: //! a copy of a sub-shape is created in the result if it is needed to be updated. Standard_EXPORT Standard_Boolean NonDestructive() const; - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; @@ -204,20 +204,21 @@ protected: Standard_EXPORT Standard_Boolean IsPrimary() const; - Standard_EXPORT virtual void PerformInternal(); + Standard_EXPORT virtual void PerformInternal(const Message_ProgressRange& theRange); Standard_EXPORT virtual void Clear() Standard_OVERRIDE; - Standard_EXPORT virtual void Init(); + Standard_EXPORT virtual void Init(const Message_ProgressRange& theRange); - Standard_EXPORT void Prepare(); + Standard_EXPORT void Prepare(const Message_ProgressRange& theRange); - Standard_EXPORT virtual void PerformVV(); + Standard_EXPORT virtual void PerformVV(const Message_ProgressRange& theRange); - Standard_EXPORT virtual void PerformVE(); + Standard_EXPORT virtual void PerformVE(const Message_ProgressRange& theRange); //! Performs the intersection of the vertices with edges. Standard_EXPORT void IntersectVE(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theVEPairs, + const Message_ProgressRange& theRange, const Standard_Boolean bAddInterfs = Standard_True); //! Splits the Pave Blocks of the given edges with the extra paves.
@@ -230,30 +231,30 @@ protected: //! of the Pave Blocks will also form a Common Block. Standard_EXPORT void SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges, const Standard_Boolean theAddInterfs); + + Standard_EXPORT virtual void PerformVF(const Message_ProgressRange& theRange); - Standard_EXPORT virtual void PerformVF(); + Standard_EXPORT virtual void PerformEE(const Message_ProgressRange& theRange); - Standard_EXPORT virtual void PerformEE(); + Standard_EXPORT virtual void PerformEF(const Message_ProgressRange& theRange); - Standard_EXPORT virtual void PerformEF(); - - Standard_EXPORT virtual void PerformFF(); + Standard_EXPORT virtual void PerformFF(const Message_ProgressRange& theRange); Standard_EXPORT void TreatVerticesEE(); Standard_EXPORT void MakeSDVerticesFF(const TColStd_DataMapOfIntegerListOfInteger& aDMVLV, TColStd_DataMapOfIntegerInteger& theDMNewSD); - Standard_EXPORT void MakeSplitEdges(); + Standard_EXPORT void MakeSplitEdges(const Message_ProgressRange& theRange); - Standard_EXPORT void MakeBlocks(); + Standard_EXPORT void MakeBlocks(const Message_ProgressRange& theRange); - Standard_EXPORT void MakePCurves(); + Standard_EXPORT void MakePCurves(const Message_ProgressRange& theRange); Standard_EXPORT Standard_Integer MakeSDVertices(const TColStd_ListOfInteger& theVertIndices, const Standard_Boolean theAddInterfs = 1); - Standard_EXPORT void ProcessDE(); + Standard_EXPORT void ProcessDE(const Message_ProgressRange& theRange); Standard_EXPORT void FillShrunkData (Handle(BOPDS_PaveBlock)& thePB); @@ -269,6 +270,7 @@ protected: //! Performs intersection of new vertices, obtained in E/E and E/F intersections Standard_EXPORT void PerformNewVertices(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, const Handle(NCollection_BaseAllocator)& theAllocator, + const Message_ProgressRange& theRange, const Standard_Boolean theIsEEIntersection = Standard_True); Standard_EXPORT Standard_Boolean CheckFacePaves (const TopoDS_Vertex& theVnew, @@ -341,7 +343,8 @@ protected: TColStd_DataMapOfIntegerInteger& theDMNewSD, const BOPDS_IndexedMapOfPaveBlock& theMicroPB, const TopTools_IndexedMapOfShape& theVertsOnRejectedPB, - const Handle(NCollection_BaseAllocator)& theAllocator); + const Handle(NCollection_BaseAllocator)& theAllocator, + const Message_ProgressRange& theRange); Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, @@ -564,7 +567,7 @@ protected: //! If the intersection says that the section edge is lying on the face //! it will be added into FaceInfo structure of the face as IN edge //! and will be used for splitting. - Standard_EXPORT void PutSEInOtherFaces(); + Standard_EXPORT void PutSEInOtherFaces(const Message_ProgressRange& theRange); //! Analyzes the results of interferences of sub-shapes of the shapes //! looking for self-interfering entities by the following rules:
@@ -581,22 +584,23 @@ protected: const TopoDS_Shape& theS2); //! Repeat intersection of sub-shapes with increased vertices. - Standard_EXPORT void RepeatIntersection(); + Standard_EXPORT void RepeatIntersection(const Message_ProgressRange& theRange); //! Updates vertices of CommonBlocks with real tolerance of CB. Standard_EXPORT void UpdateVerticesOfCB(); //! The method looks for the additional common blocks among pairs of edges //! with the same bounding vertices. - Standard_EXPORT void ForceInterfEE(); + Standard_EXPORT void ForceInterfEE(const Message_ProgressRange& theRange); //! The method looks for the additional edge/face common blocks //! among pairs of edge/face having the same vertices. - Standard_EXPORT void ForceInterfEF(); + Standard_EXPORT void ForceInterfEF(const Message_ProgressRange& theRange); //! Performs intersection of given pave blocks //! with all faces from arguments. Standard_EXPORT void ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB, + const Message_ProgressRange& theRange, const Standard_Boolean theAddInterf); //! When all section edges are created and no increase of the tolerance @@ -631,6 +635,13 @@ protected: {} }; +protected: //! Analyzing Progress steps + + //! Filling steps for constant operations + Standard_EXPORT void fillPIConstants(const Standard_Real theWhole, BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + //! Filling steps for all other operations + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + protected: //! Fields TopTools_ListOfShape myArguments; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx index 6c27314ce3..aa1e754562 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx @@ -44,13 +44,14 @@ // function: PerformVV // purpose: //======================================================================= -void BOPAlgo_PaveFiller::PerformVV() +void BOPAlgo_PaveFiller::PerformVV(const Message_ProgressRange& theRange) { Standard_Integer n1, n2, iFlag, aSize; Handle(NCollection_BaseAllocator) aAllocator; // myIterator->Initialize(TopAbs_VERTEX, TopAbs_VERTEX); aSize=myIterator->ExpectedLength(); + Message_ProgressScope aPS(theRange, NULL, 2.); if (!aSize) { return; } @@ -65,7 +66,13 @@ void BOPAlgo_PaveFiller::PerformVV() NCollection_List aMBlocks(aAllocator); // // 1. Map V/LV - for (; myIterator->More(); myIterator->Next()) { + // Split progress range on intersection stage and making blocks. Display only intersection stage. + Message_ProgressScope aPSLoop(aPS.Next(1.), "Performing Vertex-Vertex intersection", aSize); + for (; myIterator->More(); myIterator->Next(), aPSLoop.Next()) { + if (UserBreak(aPS)) + { + return; + } myIterator->Value(n1, n2); // if (myDS->HasInterf(n1, n2)) @@ -96,6 +103,10 @@ void BOPAlgo_PaveFiller::PerformVV() // 3. Make vertices NCollection_List::Iterator aItB(aMBlocks); for (; aItB.More(); aItB.Next()) { + if (UserBreak(aPS)) + { + return; + } const TColStd_ListOfInteger& aLI = aItB.Value(); MakeSDVertices(aLI); } @@ -105,6 +116,10 @@ void BOPAlgo_PaveFiller::PerformVV() TColStd_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD(); aItDMII.Initialize(aDMII); for (; aItDMII.More(); aItDMII.Next()) { + if (UserBreak(aPS)) + { + return; + } n1=aItDMII.Key(); myDS->InitPaveBlocksForVertex(n1); } @@ -115,7 +130,7 @@ void BOPAlgo_PaveFiller::PerformVV() } //======================================================================= -// function: PerformVV +// function: MakeSDVertices // purpose: //======================================================================= Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx index ee6b573d59..c91453ec4f 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx @@ -41,13 +41,13 @@ //class : BOPAlgo_VertexEdge //purpose : //======================================================================= -class BOPAlgo_VertexEdge : public BOPAlgo_Algo { +class BOPAlgo_VertexEdge : public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_VertexEdge() : - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myIV(-1), myIE(-1), myFlag(-1), myT(-1.), myTolVNew(-1.) { }; // @@ -111,7 +111,11 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo { } // virtual void Perform() { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } try { OCC_CATCH_SIGNALS @@ -142,11 +146,13 @@ typedef NCollection_Vector BOPAlgo_VectorOfVertexEdge; // function: PerformVE // purpose: //======================================================================= -void BOPAlgo_PaveFiller::PerformVE() +void BOPAlgo_PaveFiller::PerformVE(const Message_ProgressRange& theRange) { FillShrunkData(TopAbs_VERTEX, TopAbs_EDGE); // myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE); + Message_ProgressScope aPS(theRange, NULL, 1); + Standard_Integer iSize = myIterator->ExpectedLength(); if (!iSize) { return; @@ -155,6 +161,10 @@ void BOPAlgo_PaveFiller::PerformVE() // Prepare pairs for intersection BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMVEPairs; for (; myIterator->More(); myIterator->Next()) { + if (UserBreak(aPS)) + { + return; + } Standard_Integer nV, nE; myIterator->Value(nV, nE); // @@ -192,7 +202,7 @@ void BOPAlgo_PaveFiller::PerformVE() pLV->Append(nV); } // - IntersectVE(aMVEPairs); + IntersectVE(aMVEPairs, aPS.Next()); } //======================================================================= @@ -201,6 +211,7 @@ void BOPAlgo_PaveFiller::PerformVE() //======================================================================= void BOPAlgo_PaveFiller::IntersectVE (const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theVEPairs, + const Message_ProgressRange& theRange, const Standard_Boolean theAddInterfs) { Standard_Integer i, aNbVE = theVEPairs.Extent(); @@ -221,7 +232,12 @@ void BOPAlgo_PaveFiller::IntersectVE // intersection of the same SD vertex with edge NCollection_DataMap aDMVSD; // + Message_ProgressScope aPSOuter(theRange, NULL, 10); for (i = 1; i <= aNbVE; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } const Handle(BOPDS_PaveBlock)& aPB = theVEPairs.FindKey(i); Standard_Integer nE = aPB->OriginalEdge(); // @@ -264,24 +280,35 @@ void BOPAlgo_PaveFiller::IntersectVE aVESolver.SetEdge(aE); aVESolver.SetPaveBlock(aPB); aVESolver.SetFuzzyValue(myFuzzyValue); - if (myProgressScope != NULL) - { - aVESolver.SetProgressIndicator(*myProgressScope); - } } } // + aNbVE = aVVE.Length(); + + Message_ProgressScope aPS(aPSOuter.Next(9), "Performing Vertex-Edge intersection", aNbVE); + for (i = 0; i < aNbVE; i++) + { + BOPAlgo_VertexEdge& aVESolver = aVVE.ChangeValue(i); + aVESolver.SetProgressRange(aPS.Next()); + } // Perform intersection //============================================================= BOPTools_Parallel::Perform (myRunParallel, aVVE, myContext); //============================================================= + if (UserBreak(aPSOuter)) + { + return; + } // // Keep the modified edges for further update TColStd_MapOfInteger aMEdges; // // Analyze intersections - aNbVE = aVVE.Length(); for (i = 0; i < aNbVE; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } const BOPAlgo_VertexEdge& aVESolver = aVVE(i); if (aVESolver.Flag() != 0) { if (aVESolver.HasErrors()) diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx index 0c0835ecbe..0d31a176bf 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx @@ -60,7 +60,7 @@ //======================================================================= class BOPAlgo_EdgeEdge : public IntTools_EdgeEdge, - public BOPAlgo_Algo { + public BOPAlgo_ParallelAlgo { public: @@ -68,7 +68,7 @@ class BOPAlgo_EdgeEdge : // BOPAlgo_EdgeEdge(): IntTools_EdgeEdge(), - BOPAlgo_Algo() { + BOPAlgo_ParallelAlgo() { }; // virtual ~BOPAlgo_EdgeEdge(){ @@ -102,7 +102,11 @@ class BOPAlgo_EdgeEdge : } // virtual void Perform() { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } TopoDS_Edge anE1 = myEdge1, anE2 = myEdge2; Standard_Boolean hasTrsf = false; try @@ -155,12 +159,13 @@ typedef NCollection_Vector BOPAlgo_VectorOfEdgeEdge; // function: PerformEE // purpose: //======================================================================= -void BOPAlgo_PaveFiller::PerformEE() +void BOPAlgo_PaveFiller::PerformEE(const Message_ProgressRange& theRange) { FillShrunkData(TopAbs_EDGE, TopAbs_EDGE); // myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE); Standard_Integer iSize = myIterator->ExpectedLength(); + Message_ProgressScope aPSOuter(theRange, NULL, 10); if (!iSize) { return; } @@ -187,6 +192,10 @@ void BOPAlgo_PaveFiller::PerformEE() aEEs.SetIncrement(iSize); // for (; myIterator->More(); myIterator->Next()) { + if (UserBreak(aPSOuter)) + { + return; + } myIterator->Value(nE1, nE2); // const BOPDS_ShapeInfo& aSIE1=myDS->ShapeInfo(nE1); @@ -213,6 +222,10 @@ void BOPAlgo_PaveFiller::PerformEE() // aIt1.Initialize(aLPB1); for (; aIt1.More(); aIt1.Next()) { + if (UserBreak(aPSOuter)) + { + return; + } Bnd_Box aBB1; // Handle(BOPDS_PaveBlock)& aPB1=aIt1.ChangeValue(); @@ -253,20 +266,31 @@ void BOPAlgo_PaveFiller::PerformEE() anEdgeEdge.SetEdge2(aE2, aT21, aT22); anEdgeEdge.SetBoxes (aBB1, aBB2); anEdgeEdge.SetFuzzyValue(myFuzzyValue); - if (myProgressScope != NULL) - { - anEdgeEdge.SetProgressIndicator(*myProgressScope); - } }//for (; aIt2.More(); aIt2.Next()) { }//for (; aIt1.More(); aIt1.Next()) { }//for (; myIterator->More(); myIterator->Next()) { // aNbEdgeEdge=aVEdgeEdge.Length(); + + Message_ProgressScope aPS(aPSOuter.Next(9), "Performing Edge-edge intersection", aNbEdgeEdge); + for (k = 0; k < aNbEdgeEdge; k++) + { + BOPAlgo_EdgeEdge& anEdgeEdge = aVEdgeEdge.ChangeValue(k); + anEdgeEdge.SetProgressRange(aPS.Next()); + } //====================================================== BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge); //====================================================== + if (UserBreak(aPSOuter)) + { + return; + } // for (k = 0; k < aNbEdgeEdge; ++k) { + if (UserBreak(aPSOuter)) + { + return; + } Bnd_Box aBB1, aBB2; // BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k); @@ -331,6 +355,10 @@ void BOPAlgo_PaveFiller::PerformEE() } // for (i=1; i<=aNbCPrts; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } const IntTools_CommonPrt& aCPart=aCPrts(i); // const TopoDS_Edge& aE1=aCPart.Edge1(); @@ -519,7 +547,11 @@ void BOPAlgo_PaveFiller::PerformEE() // Update vertices of common blocks with real CB tolerances UpdateVerticesOfCB(); - PerformNewVertices(aMVCPB, aAllocator); + PerformNewVertices(aMVCPB, aAllocator, aPSOuter.Next()); + if (HasErrors()) + { + return; + } // if (aMEdges.Extent()) { Standard_Integer aNbV = aMVCPB.Extent(); @@ -546,6 +578,7 @@ void BOPAlgo_PaveFiller::PerformEE() void BOPAlgo_PaveFiller::PerformNewVertices (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, const Handle(NCollection_BaseAllocator)& theAllocator, + const Message_ProgressRange& theRange, const Standard_Boolean bIsEEIntersection) { Standard_Integer aNbV = theMVCPB.Extent(); @@ -563,8 +596,15 @@ void BOPAlgo_PaveFiller::PerformNewVertices BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE(); BOPDS_VectorOfInterfEF& aEFs = myDS->InterfEF(); // + // 4. Compute Extra Paves and split Pave blocks by the Extra paves + Message_ProgressScope aPS(theRange, NULL, 2); Standard_Integer i, aNb = aImages.Extent(); - for (i = 1; i <= aNb; ++i) { + Message_ProgressScope aPS1(aPS.Next(), NULL, aNb + aNbV); + for (i = 1; i <= aNb; ++i, aPS1.Next()) { + if (UserBreak(aPS)) + { + return; + } const TopoDS_Vertex& aV = TopoDS::Vertex(aImages.FindKey(i)); const TopTools_ListOfShape& aLVSD = aImages.FindFromIndex(i); // @@ -592,7 +632,11 @@ void BOPAlgo_PaveFiller::PerformNewVertices // // 3. Map PaveBlock/ListOfVertices to add to this PaveBlock ->aMPBLI BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(100, theAllocator); - for (i = 1; i <= aNbV; ++i) { + for (i = 1; i <= aNbV; ++i, aPS1.Next()) { + if (UserBreak(aPS)) + { + return; + } const BOPDS_CoupleOfPaveBlocks& aCPB = theMVCPB.FindFromIndex(i); Standard_Integer iV = aCPB.Index(); // @@ -610,9 +654,8 @@ void BOPAlgo_PaveFiller::PerformNewVertices } } } - // // 4. Compute Extra Paves and split Pave blocks by the Extra paves - IntersectVE(aMPBLI, Standard_False); + IntersectVE(aMPBLI, aPS.Next(), Standard_False); } //======================================================================= //function : TreatNewVertices @@ -898,7 +941,7 @@ void BOPAlgo_PaveFiller::UpdateVerticesOfCB() //function : ForceInterfEE //purpose : //======================================================================= -void BOPAlgo_PaveFiller::ForceInterfEE() +void BOPAlgo_PaveFiller::ForceInterfEE(const Message_ProgressRange& theRange) { // Now that we have vertices increased and unified, try to find additional // common blocks among the pairs of edges. @@ -907,7 +950,7 @@ void BOPAlgo_PaveFiller::ForceInterfEE() // those pairs of pave blocks with the same bounding vertices. Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator; - + Message_ProgressScope aPSOuter(theRange, NULL, 10); // Initialize pave blocks for all vertices which participated in intersections const Standard_Integer aNbS = myDS->NbSourceShapes(); for (Standard_Integer i = 0; i < aNbS; ++i) @@ -918,8 +961,11 @@ void BOPAlgo_PaveFiller::ForceInterfEE() if (myDS->HasInterf(i)) myDS->InitPaveBlocksForVertex(i); } + if (UserBreak(aPSOuter)) + { + return; + } } - // Fill the connection map from bounding vertices to pave blocks // having those bounding vertices NCollection_IndexedDataMapPaveBlocks(i); BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB); for (; aItLPB.More(); aItLPB.Next()) @@ -976,6 +1025,10 @@ void BOPAlgo_PaveFiller::ForceInterfEE() for (Standard_Integer i = 1; i <= aNbPB; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } const BOPDS_ListOfPaveBlock& aLPB = aPBMap(i); if (aLPB.Extent() < 2) continue; @@ -1086,10 +1139,6 @@ void BOPAlgo_PaveFiller::ForceInterfEE() { anEdgeEdge.SetFuzzyValue(myFuzzyValue); } - if (myProgressScope != NULL) - { - anEdgeEdge.SetProgressIndicator(*myProgressScope); - } } } } @@ -1098,13 +1147,26 @@ void BOPAlgo_PaveFiller::ForceInterfEE() if (!aNbPairs) return; + // close preparation step + aPSOuter.Next(0.7); + aPBMap.Clear(); aMPBFence.Clear(); anAlloc->Reset(); + Message_ProgressScope aPS(aPSOuter.Next(9), "Checking for coinciding edges", aNbPairs); + for (Standard_Integer i = 0; i < aNbPairs; i++) + { + BOPAlgo_EdgeEdge& anEdgeEdge = aVEdgeEdge.ChangeValue(i); + anEdgeEdge.SetProgressRange(aPS.Next()); + } + // Perform intersection of the found pairs BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge); - + if (UserBreak(aPSOuter)) + { + return; + } BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE(); if (aEEs.IsEmpty()) aEEs.SetIncrement(10); @@ -1113,9 +1175,12 @@ void BOPAlgo_PaveFiller::ForceInterfEE() // intersection type only. BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(1, anAlloc); - for (Standard_Integer i = 0; i < aNbPairs; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } BOPAlgo_EdgeEdge& anEdgeEdge = aVEdgeEdge(i); if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors()) { diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx index 9a289ddf6d..6b5287a022 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx @@ -43,12 +43,12 @@ //class : BOPAlgo_VertexFace //purpose : //======================================================================= -class BOPAlgo_VertexFace : public BOPAlgo_Algo { +class BOPAlgo_VertexFace : public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_VertexFace() : - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myIV(-1), myIF(-1), myFlag(-1), myT1(-1.), myT2(-1.), myTolVNew(-1.) { } @@ -107,7 +107,11 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo { } // virtual void Perform() { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } try { OCC_CATCH_SIGNALS @@ -138,13 +142,14 @@ typedef NCollection_Vector BOPAlgo_VectorOfVertexFace; // function: PerformVF // purpose: //======================================================================= -void BOPAlgo_PaveFiller::PerformVF() +void BOPAlgo_PaveFiller::PerformVF(const Message_ProgressRange& theRange) { myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE); Standard_Integer iSize = myIterator->ExpectedLength(); // Standard_Integer nV, nF; // + Message_ProgressScope aPSOuter(theRange, NULL, 10); if (myGlue == BOPAlgo_GlueFull) { // there is no need to intersect vertices with faces in this mode // just initialize FaceInfo for all faces @@ -175,8 +180,11 @@ void BOPAlgo_PaveFiller::PerformVF() // Avoid repeated intersection of the same vertex with face in case // the group of vertices formed a single SD vertex NCollection_DataMap aMVFPairs; - for (; myIterator->More(); myIterator->Next()) { + if (UserBreak(aPSOuter)) + { + return; + } myIterator->Value(nV, nF); // if (myDS->IsSubShape(nV, nF)) { @@ -217,18 +225,29 @@ void BOPAlgo_PaveFiller::PerformVF() aVertexFace.SetVertex(aV); aVertexFace.SetFace(aF); aVertexFace.SetFuzzyValue(myFuzzyValue); - if (myProgressScope != NULL) - { - aVertexFace.SetProgressIndicator(*myProgressScope); - } + }//for (; myIterator->More(); myIterator->Next()) { // aNbVF=aVVF.Length(); + Message_ProgressScope aPS(aPSOuter.Next(9), "Performing Vertex-Face intersection", aNbVF); + for (k = 0; k < aNbVF; k++) + { + BOPAlgo_VertexFace& aVertexFace = aVVF.ChangeValue(k); + aVertexFace.SetProgressRange(aPS.Next()); + } //================================================================ BOPTools_Parallel::Perform (myRunParallel, aVVF, myContext); //================================================================ + if (UserBreak(aPSOuter)) + { + return; + } // for (k=0; k < aNbVF; ++k) { + if (UserBreak(aPSOuter)) + { + return; + } const BOPAlgo_VertexFace& aVertexFace=aVVF(k); // iFlag=aVertexFace.Flag(); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx index aebd4882d4..827135c9b4 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx @@ -59,14 +59,14 @@ //======================================================================= class BOPAlgo_EdgeFace : public IntTools_EdgeFace, - public BOPAlgo_Algo { + public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_EdgeFace() : IntTools_EdgeFace(), - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myIE(-1), myIF(-1) { }; // @@ -113,7 +113,11 @@ class BOPAlgo_EdgeFace : } // virtual void Perform() { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } TopoDS_Face aFace = myFace; TopoDS_Edge anEdge = myEdge; Standard_Boolean hasTrsf = false; @@ -167,11 +171,12 @@ typedef NCollection_Vector BOPAlgo_VectorOfEdgeFace; //function : PerformEF //purpose : //======================================================================= -void BOPAlgo_PaveFiller::PerformEF() +void BOPAlgo_PaveFiller::PerformEF(const Message_ProgressRange& theRange) { FillShrunkData(TopAbs_EDGE, TopAbs_FACE); // myIterator->Initialize(TopAbs_EDGE, TopAbs_FACE); + Message_ProgressScope aPSOuter(theRange, NULL, 10); Standard_Integer iSize = myIterator->ExpectedLength(); if (!iSize) { return; @@ -214,6 +219,10 @@ void BOPAlgo_PaveFiller::PerformEF() aEFs.SetIncrement(iSize); // for (; myIterator->More(); myIterator->Next()) { + if (UserBreak(aPSOuter)) + { + return; + } myIterator->Value(nE, nF); // const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE); @@ -237,6 +246,10 @@ void BOPAlgo_PaveFiller::PerformEF() BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE); aIt.Initialize(aLPB); for (; aIt.More(); aIt.Next()) { + if (UserBreak(aPSOuter)) + { + return; + } Handle(BOPDS_PaveBlock)& aPB=aIt.ChangeValue(); // const Handle(BOPDS_PaveBlock) aPBR=myDS->RealPaveBlock(aPB); @@ -268,20 +281,17 @@ void BOPAlgo_PaveFiller::PerformEF() aEdgeFace.SetBoxes (myDS->ShapeInfo(nE).Box(), myDS->ShapeInfo (nF).Box()); aEdgeFace.SetFuzzyValue(myFuzzyValue); aEdgeFace.UseQuickCoincidenceCheck(bExpressCompute); - // + IntTools_Range aSR(aTS1, aTS2); - IntTools_Range anewSR=aSR; + IntTools_Range anewSR = aSR; BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, anewSR); aEdgeFace.SetNewSR(anewSR); // IntTools_Range aPBRange(aT1, aT2); aSR = aPBRange; BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange); - aEdgeFace.SetRange (aPBRange); - if (myProgressScope != NULL) - { - aEdgeFace.SetProgressIndicator(*myProgressScope); - } + aEdgeFace.SetRange(aPBRange); + // // Save the pair to avoid their forced intersection BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF); if (!pMPB) @@ -291,11 +301,25 @@ void BOPAlgo_PaveFiller::PerformEF() }//for (; myIterator->More(); myIterator->Next()) { // aNbEdgeFace=aVEdgeFace.Length(); + Message_ProgressScope aPS(aPSOuter.Next(9), "Performing Edge-Face intersection", aNbEdgeFace); + for (Standard_Integer index = 0; index < aNbEdgeFace; index++) + { + BOPAlgo_EdgeFace& aEdgeFace = aVEdgeFace.ChangeValue(index); + aEdgeFace.SetProgressRange(aPS.Next()); + } //================================================================= BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext); //================================================================= + if (UserBreak(aPSOuter)) + { + return; + } // for (k=0; k < aNbEdgeFace; ++k) { + if (UserBreak(aPSOuter)) + { + return; + } BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace(k); if (!aEdgeFace.IsDone() || aEdgeFace.HasErrors()) { // Warn about failed intersection of sub-shapes @@ -358,6 +382,10 @@ void BOPAlgo_PaveFiller::PerformEF() } // for (i=1; i<=aNbCPrts; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } const IntTools_CommonPrt& aCPart=aCPrts(i); aType=aCPart.Type(); switch (aType) { @@ -524,7 +552,11 @@ void BOPAlgo_PaveFiller::PerformEF() //========================================= BOPAlgo_Tools::PerformCommonBlocks(aMPBLI, aAllocator, myDS, myContext); UpdateVerticesOfCB(); - PerformNewVertices(aMVCPB, aAllocator, Standard_False); + PerformNewVertices(aMVCPB, aAllocator, aPSOuter.Next(1), Standard_False); + if (HasErrors()) + { + return; + } // // Update FaceInfoIn for all faces having EF common parts myDS->UpdateFaceInfoIn (aMIEFC); @@ -733,8 +765,9 @@ void BOPAlgo_PaveFiller::ReduceIntersectionRange(const Standard_Integer theV1, //function : ForceInterfEF //purpose : //======================================================================= -void BOPAlgo_PaveFiller::ForceInterfEF() +void BOPAlgo_PaveFiller::ForceInterfEF(const Message_ProgressRange& theRange) { + Message_ProgressScope aPS(theRange, NULL, 1); if (!myIsPrimary) return; @@ -762,6 +795,10 @@ void BOPAlgo_PaveFiller::ForceInterfEF() // Degenerated edge continue; + if (UserBreak(aPS)) + { + return; + } const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE); BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB); for (; aItLPB.More(); aItLPB.Next()) @@ -773,7 +810,8 @@ void BOPAlgo_PaveFiller::ForceInterfEF() } // Perform intersection of collected pave blocks with faces - ForceInterfEF(aMPB, Standard_True); + + ForceInterfEF(aMPB, aPS.Next(), Standard_True); } //======================================================================= @@ -781,11 +819,13 @@ void BOPAlgo_PaveFiller::ForceInterfEF() //purpose : //======================================================================= void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB, + const Message_ProgressRange& theRange, const Standard_Boolean theAddInterf) { + // Split progress on preparation, intersection and post-treatment stages + Message_ProgressScope aPSOuter(theRange, NULL, 10); if (theMPB.IsEmpty()) return; - // Fill the tree with bounding boxes of the pave blocks BOPTools_BoxTree aBBTree; @@ -802,6 +842,10 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB if (!aPB->HasShrunkData()) continue; } + if (UserBreak(aPSOuter)) + { + return; + } Standard_Real f, l; Bnd_Box aPBBox; @@ -832,6 +876,11 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB // Face has no face info continue; + if (UserBreak(aPSOuter)) + { + return; + } + const Bnd_Box& aBoxF = aSI.Box(); BOPTools_BoxTreeSelector aSelector; aSelector.SetBox(Bnd_Tools::Bnd2BVH(aBoxF)); @@ -1013,23 +1062,34 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd); aEdgeFace.UseQuickCoincidenceCheck(Standard_True); aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter())); - if (myProgressScope != NULL) - { - aEdgeFace.SetProgressIndicator(*myProgressScope); - } } } } Standard_Integer aNbEFs = aVEdgeFace.Length(); if (!aNbEFs) + { return; + } + + // close preparation step + aPSOuter.Next(0.7); aPBMap.Clear(); anAlloc->Reset(); + Message_ProgressScope aPS(aPSOuter.Next(9), "Checking for edges coinciding with faces", aNbEFs); + for (Standard_Integer i = 0; i < aNbEFs; i++) + { + BOPAlgo_EdgeFace& aEdgeFace = aVEdgeFace.ChangeValue(i); + aEdgeFace.SetProgressRange(aPS.Next()); + } // Perform intersection of the found pairs BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext); + if (UserBreak(aPSOuter)) + { + return; + } BOPDS_VectorOfInterfEF& aEFs = myDS->InterfEF(); if (theAddInterf && aEFs.IsEmpty()) @@ -1040,9 +1100,12 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB // Collect all pairs for common block creation BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(1, anAlloc); - for (Standard_Integer i = 0; i < aNbEFs; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } BOPAlgo_EdgeFace& anEdgeFace = aVEdgeFace(i); if (!anEdgeFace.IsDone() || anEdgeFace.HasErrors()) { diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index bba02bfbaa..51558709ab 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -92,14 +92,14 @@ static Standard_Real ToleranceFF(const BRepAdaptor_Surface& aBAS1, //======================================================================= class BOPAlgo_FaceFace : public IntTools_FaceFace, - public BOPAlgo_Algo { + public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_FaceFace() : IntTools_FaceFace(), - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myIF1(-1), myIF2(-1), myTolFF(1.e-7) { } // @@ -153,7 +153,11 @@ class BOPAlgo_FaceFace : const gp_Trsf& Trsf() const { return myTrsf; } // virtual void Perform() { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } try { OCC_CATCH_SIGNALS @@ -231,10 +235,11 @@ typedef NCollection_Vector BOPAlgo_VectorOfFaceFace; //function : PerformFF //purpose : //======================================================================= -void BOPAlgo_PaveFiller::PerformFF() +void BOPAlgo_PaveFiller::PerformFF(const Message_ProgressRange& theRange) { myIterator->Initialize(TopAbs_FACE, TopAbs_FACE); Standard_Integer iSize = myIterator->ExpectedLength(); + Message_ProgressScope aPSOuter(theRange, NULL, 1); if (!iSize) { return; } @@ -269,6 +274,10 @@ void BOPAlgo_PaveFiller::PerformFF() // Initialize interferences myIterator->Initialize(TopAbs_FACE, TopAbs_FACE); for (; myIterator->More(); myIterator->Next()) { + if (UserBreak(aPSOuter)) + { + return; + } myIterator->Value(nF1, nF2); if (myGlue == BOPAlgo_GlueOff) @@ -309,10 +318,6 @@ void BOPAlgo_PaveFiller::PerformFF() // aFaceFace.SetParameters(bApprox, bCompC2D1, bCompC2D2, anApproxTol); aFaceFace.SetFuzzyValue(myFuzzyValue); - if (myProgressScope != NULL) - { - aFaceFace.SetProgressIndicator(*myProgressScope); - } } else { // for the Glue mode just add all interferences of that type @@ -323,13 +328,28 @@ void BOPAlgo_PaveFiller::PerformFF() } }//for (; myIterator->More(); myIterator->Next()) { // + Standard_Integer k, aNbFaceFace = aVFaceFace.Length();; + Message_ProgressScope aPS(aPSOuter.Next(), "Performing Face-Face intersection", aNbFaceFace); + for (k = 0; k < aNbFaceFace; k++) + { + BOPAlgo_FaceFace& aFaceFace = aVFaceFace.ChangeValue(k); + aFaceFace.SetProgressRange(aPS.Next()); + } //====================================================== // Perform intersection BOPTools_Parallel::Perform (myRunParallel, aVFaceFace); + if (UserBreak(aPSOuter)) + { + return; + } //====================================================== // Treatment of the results - Standard_Integer k, aNbFaceFace = aVFaceFace.Length(); + for (k = 0; k < aNbFaceFace; ++k) { + if (UserBreak(aPSOuter)) + { + return; + } BOPAlgo_FaceFace& aFaceFace = aVFaceFace(k); aFaceFace.Indices(nF1, nF2); if (!aFaceFace.IsDone() || aFaceFace.HasErrors()) { @@ -377,6 +397,10 @@ void BOPAlgo_PaveFiller::PerformFF() // BOPDS_VectorOfCurve& aVNC = aFF.ChangeCurves(); for (Standard_Integer i = 1; i <= aNbCurves; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } Bnd_Box aBox; const IntTools_Curve& aIC = aCvsX(i); Standard_Boolean bIsValid = IntTools_Tools::CheckCurve(aIC, aBox); @@ -427,14 +451,16 @@ static void UpdateSavedTolerance(const BOPDS_PDS& theDS, //function : MakeBlocks //purpose : //======================================================================= -void BOPAlgo_PaveFiller::MakeBlocks() +void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange) { + Message_ProgressScope aPSOuter(theRange, NULL, 4); if (myGlue != BOPAlgo_GlueOff) { return; } // BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); Standard_Integer aNbFF = aFFs.Length(); + Message_ProgressScope aPS(aPSOuter.Next(), "Building section edges", aNbFF); if (!aNbFF) { return; } @@ -472,9 +498,11 @@ void BOPAlgo_PaveFiller::MakeBlocks() // Map of PaveBlocks with the faces to which it has to be added BOPAlgo_DataMapOfPaveBlockListOfInteger aPBFacesMap; // - for (i=0; iInterfFF(); const Standard_Integer aNbFF = aFFs.Length(); + Message_ProgressScope aPS(theRange, NULL, 1); for (Standard_Integer i = 0; i < aNbFF; ++i) { const BOPDS_VectorOfCurve& aVNC = aFFs(i).Curves(); @@ -3686,7 +3715,7 @@ void BOPAlgo_PaveFiller::PutSEInOtherFaces() } } // Perform intersection of collected pave blocks - ForceInterfEF(aMPBScAll, Standard_False); + ForceInterfEF(aMPBScAll, aPS.Next(), Standard_False); } //======================================================================= diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx index 11a0cacc39..1ba29aae8a 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx @@ -74,13 +74,13 @@ static void UpdateVertices(const TopoDS_Edge& aE, //class : BOPAlgo_SplitEdge //purpose : //======================================================================= -class BOPAlgo_SplitEdge : public BOPAlgo_Algo { +class BOPAlgo_SplitEdge : public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_SplitEdge() : - BOPAlgo_Algo() { + BOPAlgo_ParallelAlgo() { myT1=0.; myT2=0.; myTol = 0.; @@ -139,7 +139,11 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo { } // virtual void Perform () { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } myTol = BOPAlgo_Tools::ComputeToleranceOfCB(myCB, myDS, myContext); BOPTools_AlgoTools::MakeSplitEdge(myE, myV1, myT1, @@ -175,13 +179,13 @@ typedef NCollection_Vector BOPAlgo_VectorOfSplitEdge; //class : BOPAlgo_MPC //purpose : //======================================================================= -class BOPAlgo_MPC : public BOPAlgo_Algo { +class BOPAlgo_MPC : public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC BOPAlgo_MPC() : - BOPAlgo_Algo(), + BOPAlgo_ParallelAlgo(), myFlag(Standard_False) { }; // @@ -233,6 +237,11 @@ class BOPAlgo_MPC : public BOPAlgo_Algo { } // virtual void Perform() { + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (UserBreak(aPS)) + { + return; + } try { OCC_CATCH_SIGNALS @@ -355,8 +364,17 @@ class BOPAlgo_BPC { Standard_Boolean IsToUpdate() const { return myToUpdate; } + void SetRange(const Message_ProgressRange& theRange) + { + myRange = theRange; + } // void Perform() { + Message_ProgressScope aPS(myRange, NULL, 1); + if (!aPS.More()) + { + return; + } BRepLib::BuildPCurveForEdgeOnPlane(myE, myF, myCurve, myToUpdate); }; // @@ -365,6 +383,8 @@ class BOPAlgo_BPC { TopoDS_Face myF; Handle(Geom2d_Curve) myCurve; Standard_Boolean myToUpdate; +private: + Message_ProgressRange myRange; }; //======================================================================= typedef NCollection_Vector BOPAlgo_VectorOfBPC; @@ -373,10 +393,11 @@ typedef NCollection_Vector BOPAlgo_VectorOfBPC; // function: MakeSplitEdges // purpose: //======================================================================= -void BOPAlgo_PaveFiller::MakeSplitEdges() +void BOPAlgo_PaveFiller::MakeSplitEdges(const Message_ProgressRange& theRange) { BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool(); Standard_Integer aNbPBP = aPBP.Length(); + Message_ProgressScope aPSOuter(theRange, NULL, 1); if(!aNbPBP) { return; } @@ -397,6 +418,10 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() // for (i = 0; i < aNbPBP; ++i) { + if (UserBreak(aPSOuter)) + { + return; + } BOPDS_ListOfPaveBlock& aLPB = aPBP(i); // aItPB.Initialize(aLPB); @@ -484,19 +509,29 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() aBSE.SetCommonBlock(aCB); } aBSE.SetDS(myDS); - if (myProgressScope != NULL) - { - aBSE.SetProgressIndicator(*myProgressScope); - } } // for (; aItPB.More(); aItPB.Next()) { } // for (i=0; iInitialize(aType[i], aType[2]); for (; myIterator->More(); myIterator->Next()) { @@ -853,14 +896,27 @@ void BOPAlgo_PaveFiller::Prepare() } } // + Message_ProgressScope aPS(aPSOuter.Next(), "Building 2d curves on planar faces", aVBPC.Length()); + for (i = 0; i < aVBPC.Length(); i++) + { + BOPAlgo_BPC& aBPC = aVBPC.ChangeValue(i); + aBPC.SetRange(aPS.Next()); + } //====================================================== BOPTools_Parallel::Perform (myRunParallel, aVBPC); //====================================================== - + if (UserBreak(aPS)) + { + return; + } // pcurves are built, and now update edges BRep_Builder aBB; TopoDS_Edge E; for (i = 0; i < aVBPC.Length(); i++) { + if (UserBreak(aPSOuter)) + { + return; + } const BOPAlgo_BPC& aBPC=aVBPC(i); if (aBPC.IsToUpdate()) { Standard_Real aTolE = BRep_Tool::Tolerance(aBPC.GetEdge()); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx index 69619a0043..d71031252d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx @@ -62,8 +62,10 @@ static //function : ProcessDE //purpose : //======================================================================= -void BOPAlgo_PaveFiller::ProcessDE() +void BOPAlgo_PaveFiller::ProcessDE(const Message_ProgressRange& theRange) { + Message_ProgressScope aPSOuter(theRange, NULL, 1); + Standard_Integer nF, aNb, nE, nV, nVSD, aNbPB; Handle(NCollection_BaseAllocator) aAllocator; Handle(BOPDS_PaveBlock) aPBD; @@ -89,7 +91,7 @@ void BOPAlgo_PaveFiller::ProcessDE() //nV,nE,nF // if (aSIF.ShapeType() == TopAbs_FACE) { - // 1. Find PaveBlocks that are go through nV for nF + // 1. Find PaveBlocks that go through nV for nF FindPaveBlocks(nV, nF, aLPBOut); aNbPB=aLPBOut.Extent(); if (aNbPB) { @@ -131,6 +133,10 @@ void BOPAlgo_PaveFiller::ProcessDE() aPBD->SetEdge(nEn); } } + if (UserBreak(aPSOuter)) + { + return; + } } } } diff --git a/src/BOPAlgo/BOPAlgo_RemoveFeatures.cxx b/src/BOPAlgo/BOPAlgo_RemoveFeatures.cxx index 3ae8e5b773..7616e1d841 100644 --- a/src/BOPAlgo/BOPAlgo_RemoveFeatures.cxx +++ b/src/BOPAlgo/BOPAlgo_RemoveFeatures.cxx @@ -124,7 +124,7 @@ static void FindSolid(const TopoDS_Shape& theSolIn, // function: Perform // purpose: Performs the removal of the requested faces from the input shape //======================================================================= -void BOPAlgo_RemoveFeatures::Perform() +void BOPAlgo_RemoveFeatures::Perform(const Message_ProgressRange& /*theRange*/) { try { diff --git a/src/BOPAlgo/BOPAlgo_RemoveFeatures.hxx b/src/BOPAlgo/BOPAlgo_RemoveFeatures.hxx index e855f24815..7db54ffa8c 100644 --- a/src/BOPAlgo/BOPAlgo_RemoveFeatures.hxx +++ b/src/BOPAlgo/BOPAlgo_RemoveFeatures.hxx @@ -201,7 +201,7 @@ public: //! @name Setting input data for the algorithm public: //! @name Performing the operation //! Performs the operation - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; public: //! @name Clearing the contents of the algorithm diff --git a/src/BOPAlgo/BOPAlgo_Section.cxx b/src/BOPAlgo/BOPAlgo_Section.cxx index 26ec591fc5..e889a5c514 100644 --- a/src/BOPAlgo/BOPAlgo_Section.cxx +++ b/src/BOPAlgo/BOPAlgo_Section.cxx @@ -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(); diff --git a/src/BOPAlgo/BOPAlgo_Section.hxx b/src/BOPAlgo/BOPAlgo_Section.hxx index 588b4b3062..fde4a020a1 100644 --- a/src/BOPAlgo/BOPAlgo_Section.hxx +++ b/src/BOPAlgo/BOPAlgo_Section.hxx @@ -53,12 +53,31 @@ protected: Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; //! Combine the result of section operation - Standard_EXPORT virtual void BuildSection(); + Standard_EXPORT virtual void BuildSection(const Message_ProgressRange& theRange); //! Performs calculations using prepared Filler object - Standard_EXPORT virtual void PerformInternal1(const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE; + Standard_EXPORT virtual void PerformInternal1(const BOPAlgo_PaveFiller& thePF, const Message_ProgressRange& theRange) Standard_OVERRIDE; -private: +protected: + + //! List of operations to be supported by the Progress Indicator. + //! Override the whole enumeration here since the constant operations are also + //! going to be overridden. + enum BOPAlgo_PIOperation + { + PIOperation_TreatVertices = 0, + PIOperation_TreatEdges, + PIOperation_BuildSection, + PIOperation_FillHistory, + PIOperation_PostTreat, + PIOperation_Last + }; + + //! Filling steps for constant operations + Standard_EXPORT void fillPIConstants(const Standard_Real theWhole, BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; + + //! Filling steps for all other operations + Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE; }; diff --git a/src/BOPAlgo/BOPAlgo_ShellSplitter.cxx b/src/BOPAlgo/BOPAlgo_ShellSplitter.cxx index 108d44f408..107a86a4b5 100644 --- a/src/BOPAlgo/BOPAlgo_ShellSplitter.cxx +++ b/src/BOPAlgo/BOPAlgo_ShellSplitter.cxx @@ -64,11 +64,22 @@ class BOPAlgo_CBK { return *myPCB; } // + void SetProgressRange(const Message_ProgressRange& theRange) + { + myProgressRange = theRange; + } + // void Perform() { + Message_ProgressScope aPS(myProgressRange, NULL, 1); + if (!aPS.More()) + { + return; + } BOPAlgo_ShellSplitter::SplitBlock(*myPCB); } protected: BOPTools_ConnexityBlock *myPCB; + Message_ProgressRange myProgressRange; }; //======================================================================= typedef NCollection_Vector BOPAlgo_VectorOfCBK; @@ -133,14 +144,19 @@ const TopTools_ListOfShape& BOPAlgo_ShellSplitter::Shells()const //function : Perform //purpose : //======================================================================= -void BOPAlgo_ShellSplitter::Perform() +void BOPAlgo_ShellSplitter::Perform(const Message_ProgressRange& theRange) { GetReport()->Clear(); + Message_ProgressScope aPS(theRange, "Building shells", 1); // BOPTools_AlgoTools::MakeConnexityBlocks (myStartShapes, TopAbs_EDGE, TopAbs_FACE, myLCB); - // - MakeShells(); + if (UserBreak (aPS)) + { + return; + } + + MakeShells(aPS.Next()); } //======================================================================= @@ -535,7 +551,7 @@ void RefineShell(TopoDS_Shell& theShell, //function : MakeShells //purpose : //======================================================================= -void BOPAlgo_ShellSplitter::MakeShells() +void BOPAlgo_ShellSplitter::MakeShells(const Message_ProgressRange& theRange) { Standard_Boolean bIsRegular; Standard_Integer aNbVCBK, k; @@ -543,10 +559,15 @@ void BOPAlgo_ShellSplitter::MakeShells() TopTools_ListIteratorOfListOfShape aIt; BOPAlgo_VectorOfCBK aVCBK; // + Message_ProgressScope aPSOuter(theRange, NULL, 1); myShells.Clear(); // aItCB.Initialize(myLCB); for (; aItCB.More(); aItCB.Next()) { + if (UserBreak (aPSOuter)) + { + return; + } BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue(); bIsRegular=aCB.IsRegular(); if (bIsRegular) { @@ -564,6 +585,11 @@ void BOPAlgo_ShellSplitter::MakeShells() } // aNbVCBK=aVCBK.Length(); + Message_ProgressScope aPSParallel(aPSOuter.Next(), NULL, aNbVCBK); + for (Standard_Integer iS = 0; iS < aNbVCBK; ++iS) + { + aVCBK.ChangeValue(iS).SetProgressRange(aPSParallel.Next()); + } //=================================================== BOPTools_Parallel::Perform (myRunParallel, aVCBK); //=================================================== diff --git a/src/BOPAlgo/BOPAlgo_ShellSplitter.hxx b/src/BOPAlgo/BOPAlgo_ShellSplitter.hxx index 95ef70540e..71a341f1d7 100644 --- a/src/BOPAlgo/BOPAlgo_ShellSplitter.hxx +++ b/src/BOPAlgo/BOPAlgo_ShellSplitter.hxx @@ -51,7 +51,7 @@ Standard_EXPORT virtual ~BOPAlgo_ShellSplitter(); Standard_EXPORT const TopTools_ListOfShape& StartElements() const; //! performs the algorithm - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! returns the loops Standard_EXPORT const TopTools_ListOfShape& Shells() const; @@ -61,7 +61,7 @@ Standard_EXPORT virtual ~BOPAlgo_ShellSplitter(); protected: - Standard_EXPORT void MakeShells(); + Standard_EXPORT void MakeShells(const Message_ProgressRange& theRange); TopTools_ListOfShape myStartShapes; diff --git a/src/BOPAlgo/BOPAlgo_Splitter.cxx b/src/BOPAlgo/BOPAlgo_Splitter.cxx index dc53bef848..a2c8180ead 100644 --- a/src/BOPAlgo/BOPAlgo_Splitter.cxx +++ b/src/BOPAlgo/BOPAlgo_Splitter.cxx @@ -62,7 +62,7 @@ void BOPAlgo_Splitter::CheckData() //function : Perform //purpose : //======================================================================= -void BOPAlgo_Splitter::Perform() +void BOPAlgo_Splitter::Perform(const Message_ProgressRange& theRange) { GetReport()->Clear(); // @@ -89,19 +89,17 @@ void BOPAlgo_Splitter::Perform() BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller(); pPF->SetArguments(aLS); pPF->SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - pPF->SetProgressIndicator(*myProgressScope); - } + pPF->SetFuzzyValue(myFuzzyValue); pPF->SetNonDestructive(myNonDestructive); pPF->SetGlue(myGlue); pPF->SetUseOBB(myUseOBB); // - pPF->Perform(); + Message_ProgressScope aPS(theRange, "Performing Split operation", 10); + pPF->Perform(aPS.Next(9)); // myEntryPoint = 1; - PerformInternal(*pPF); + PerformInternal(*pPF, aPS.Next(1)); } //======================================================================= diff --git a/src/BOPAlgo/BOPAlgo_Splitter.hxx b/src/BOPAlgo/BOPAlgo_Splitter.hxx index 67189f3160..bc3a08ee23 100644 --- a/src/BOPAlgo/BOPAlgo_Splitter.hxx +++ b/src/BOPAlgo/BOPAlgo_Splitter.hxx @@ -60,7 +60,7 @@ public: Standard_EXPORT BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator); //! Performs the operation - Standard_EXPORT virtual void Perform() Standard_OVERRIDE; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; protected: diff --git a/src/BOPAlgo/BOPAlgo_Tools.cxx b/src/BOPAlgo/BOPAlgo_Tools.cxx index e5f3c071a2..c102ed7c53 100644 --- a/src/BOPAlgo/BOPAlgo_Tools.cxx +++ b/src/BOPAlgo/BOPAlgo_Tools.cxx @@ -1143,7 +1143,7 @@ typedef NCollection_Vector BOPAlgo_VectorOfShapeBox; //class : BOPAlgo_FillIn3DParts //purpose : Auxiliary class for faces classification in parallel mode //======================================================================= -class BOPAlgo_FillIn3DParts : public BOPAlgo_Algo +class BOPAlgo_FillIn3DParts : public BOPAlgo_ParallelAlgo { public: DEFINE_STANDARD_ALLOC @@ -1262,7 +1262,11 @@ private: //======================================================================= void BOPAlgo_FillIn3DParts::Perform() { - BOPAlgo_Algo::UserBreak(); + Message_ProgressScope aPSOuter(myProgressRange, NULL, 2); + if (UserBreak(aPSOuter)) + { + return; + } myInFaces.Clear(); @@ -1334,6 +1338,8 @@ void BOPAlgo_FillIn3DParts::Perform() MapEdgesAndFaces(aVShapeBox(aIVec(k)).Shape(), aMEFP, anAlloc); } + aPSOuter.Next(); + // Map of Edge-Face connection, necessary for solid classification. // It will be filled when first classification is performed. TopTools_IndexedDataMapOfShapeListOfShape aMEFDS(1, anAlloc); @@ -1341,8 +1347,13 @@ void BOPAlgo_FillIn3DParts::Perform() // Fence map to avoid processing of the same faces twice TopTools_MapOfShape aMFDone(1, anAlloc); - for (k = 0; k < aNbFP; ++k) + Message_ProgressScope aPSLoop (aPSOuter.Next(), NULL, aNbFP); + for (k = 0; k < aNbFP; ++k, aPSLoop.Next()) { + if (UserBreak (aPSLoop)) + { + return; + } Standard_Integer nFP = aIVec(k); const TopoDS_Face& aFP = (*(TopoDS_Face*)&aVShapeBox(nFP).Shape()); if (!aMFDone.Add(aFP)) @@ -1491,16 +1502,24 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces, Handle(IntTools_Context)& theContext, TopTools_IndexedDataMapOfShapeListOfShape& theInParts, const TopTools_DataMapOfShapeBox& theShapeBoxMap, - const TopTools_DataMapOfShapeListOfShape& theSolidsIF) + const TopTools_DataMapOfShapeListOfShape& theSolidsIF, + const Message_ProgressRange& theRange) { Handle(NCollection_BaseAllocator) anAlloc = new NCollection_IncAllocator; + Message_ProgressScope aPSOuter(theRange, NULL, 10); + // Fill the vector of shape box with faces and its bounding boxes BOPAlgo_VectorOfShapeBox aVSB(256, anAlloc); TopTools_ListIteratorOfListOfShape aItLF(theFaces); for (; aItLF.More(); aItLF.Next()) { + if (!aPSOuter.More()) + { + return; + } + const TopoDS_Shape& aF = aItLF.Value(); // Append face to the vector of shape box BOPAlgo_ShapeBox& aSB = aVSB.Appended(); @@ -1568,14 +1587,20 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces, aFIP.SetShapeBoxVector(aVSB); } + // Close preparation task + aPSOuter.Next(); + // Set progress range for each task to be run in parallel + Standard_Integer aNbS = aVFIP.Length(); + Message_ProgressScope aPSParallel(aPSOuter.Next(9), "Classification of faces relatively solids", aNbS); + for (Standard_Integer iFS = 0; iFS < aNbS; ++iFS) + { + aVFIP.ChangeValue(iFS).SetProgressRange(aPSParallel.Next()); + } // Perform classification //================================================================ BOPTools_Parallel::Perform (theRunParallel, aVFIP, theContext); //================================================================ - // Analyze the results and fill the resulting map - - Standard_Integer aNbS = aVFIP.Length(); for (Standard_Integer i = 0; i < aNbS; ++i) { BOPAlgo_FillIn3DParts& aFIP = aVFIP(i); diff --git a/src/BOPAlgo/BOPAlgo_Tools.hxx b/src/BOPAlgo/BOPAlgo_Tools.hxx index b91d3420fb..f6aaee2c25 100644 --- a/src/BOPAlgo/BOPAlgo_Tools.hxx +++ b/src/BOPAlgo/BOPAlgo_Tools.hxx @@ -31,6 +31,7 @@ #include #include #include +#include class BOPDS_PaveBlock; class BOPDS_CommonBlock; @@ -184,7 +185,8 @@ public: Handle(IntTools_Context)& theContext, TopTools_IndexedDataMapOfShapeListOfShape& theInParts, const TopTools_DataMapOfShapeBox& theShapeBoxMap = TopTools_DataMapOfShapeBox(), - const TopTools_DataMapOfShapeListOfShape& theSolidsIF = TopTools_DataMapOfShapeListOfShape()); + const TopTools_DataMapOfShapeListOfShape& theSolidsIF = TopTools_DataMapOfShapeListOfShape(), + const Message_ProgressRange& theRange = Message_ProgressRange()); //! Classifies the given parts relatively the given solids and //! fills the solids with the parts classified as INTERNAL. diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter.cxx b/src/BOPAlgo/BOPAlgo_WireSplitter.cxx index 9302342c52..0653cf4b05 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter.cxx +++ b/src/BOPAlgo/BOPAlgo_WireSplitter.cxx @@ -109,9 +109,10 @@ void BOPAlgo_WireSplitter::CheckData() //function : Perform //purpose : //======================================================================= -void BOPAlgo_WireSplitter::Perform() +void BOPAlgo_WireSplitter::Perform(const Message_ProgressRange& theRange) { GetReport()->Clear(); + Message_ProgressScope aPS(theRange, "Building wires", 1); // CheckData(); if (HasErrors()) { @@ -125,8 +126,12 @@ void BOPAlgo_WireSplitter::Perform() // BOPTools_AlgoTools::MakeConnexityBlocks (myWES->StartElements(), TopAbs_VERTEX, TopAbs_EDGE, myLCB); + if (UserBreak (aPS)) + { + return; + } - MakeWires(); + MakeWires(aPS.Next()); } ///////////////////////////////////////////////////////////////////////// @@ -158,8 +163,17 @@ public: const Handle(IntTools_Context)& Context()const { return myContext; } + // + void SetProgressRange(const Message_ProgressRange& theRange) { + myRange = theRange; + } void Perform() { + Message_ProgressScope aPS (myRange, NULL, 1); + if (!aPS.More()) + { + return; + } BOPAlgo_WireSplitter::SplitBlock(myFace, myCB, myContext); } @@ -167,6 +181,7 @@ protected: TopoDS_Face myFace; BOPTools_ConnexityBlock myCB; Handle(IntTools_Context) myContext; + Message_ProgressRange myRange; }; typedef NCollection_Vector BOPAlgo_VectorOfConnexityBlock; @@ -175,7 +190,7 @@ typedef NCollection_Vector BOPAlgo_VectorOfConnexityB //function : MakeWires //purpose : //======================================================================= -void BOPAlgo_WireSplitter::MakeWires() +void BOPAlgo_WireSplitter::MakeWires(const Message_ProgressRange& theRange) { Standard_Boolean bIsRegular; Standard_Integer aNbVCB, k; @@ -184,10 +199,17 @@ void BOPAlgo_WireSplitter::MakeWires() TopTools_ListIteratorOfListOfShape aIt; BOPAlgo_VectorOfConnexityBlock aVCB; // + Message_ProgressScope aPSOuter(theRange, NULL, 1); + // const TopoDS_Face& aF=myWES->Face(); // aItCB.Initialize(myLCB); for (; aItCB.More(); aItCB.Next()) { + if (UserBreak (aPSOuter)) + { + return; + } + BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue(); bIsRegular=aCB.IsRegular(); if (bIsRegular) { @@ -201,10 +223,15 @@ void BOPAlgo_WireSplitter::MakeWires() aWSCB.SetConnexityBlock(aCB); } } + aNbVCB=aVCB.Length(); + Message_ProgressScope aPSParallel(aPSOuter.Next(), NULL, aNbVCB); + for (Standard_Integer iW = 0; iW < aNbVCB; ++iW) + { + aVCB.ChangeValue(iW).SetProgressRange(aPSParallel.Next()); + } //=================================================== BOPTools_Parallel::Perform (myRunParallel, aVCB, myContext); //=================================================== - aNbVCB=aVCB.Length(); for (k=0; k #include +#include + #include #include @@ -130,7 +132,8 @@ Standard_Integer bapibop(Draw_Interpretor& di, pBuilder->SetUseOBB(BOPTest_Objects::UseOBB()); pBuilder->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // - pBuilder->Build(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + pBuilder->Build(aProgress->Start()); pBuilder->SimplifyResult(BOPTest_Objects::UnifyEdges(), BOPTest_Objects::UnifyFaces(), BOPTest_Objects::Angular()); @@ -197,7 +200,8 @@ Standard_Integer bapibuild(Draw_Interpretor& di, aBuilder.SetUseOBB(BOPTest_Objects::UseOBB()); aBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // - aBuilder.Build(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aBuilder.Build(aProgress->Start()); aBuilder.SimplifyResult(BOPTest_Objects::UnifyEdges(), BOPTest_Objects::UnifyFaces(), BOPTest_Objects::Angular()); @@ -257,7 +261,8 @@ Standard_Integer bapisplit(Draw_Interpretor& di, aSplitter.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // // performing operation - aSplitter.Build(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aSplitter.Build(aProgress->Start()); aSplitter.SimplifyResult(BOPTest_Objects::UnifyEdges(), BOPTest_Objects::UnifyFaces(), BOPTest_Objects::Angular()); diff --git a/src/BOPTest/BOPTest_BOPCommands.cxx b/src/BOPTest/BOPTest_BOPCommands.cxx index 1d2e682ee1..a9ee0eed15 100644 --- a/src/BOPTest/BOPTest_BOPCommands.cxx +++ b/src/BOPTest/BOPTest_BOPCommands.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include // @@ -145,6 +146,7 @@ Standard_Integer bop(Draw_Interpretor& di, bRunParallel=BOPTest_Objects::RunParallel(); bNonDestructive = BOPTest_Objects::NonDestructive(); BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); // aLC.Append(aS1); aLC.Append(aS2); @@ -164,7 +166,7 @@ Standard_Integer bop(Draw_Interpretor& di, pPF->SetGlue(aGlue); pPF->SetUseOBB(BOPTest_Objects::UseOBB()); // - pPF->Perform(); + pPF->Perform(aProgress->Start()); BOPTest::ReportAlerts(pPF->GetReport()); // return 0; @@ -247,6 +249,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di, } // bRunParallel=BOPTest_Objects::RunParallel(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); // const TopoDS_Shape& aS1=aLC.First(); const TopoDS_Shape& aS2=aLC.Last(); @@ -258,7 +261,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di, aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted()); aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // - aBOP.PerformWithFiller(*pPF); + aBOP.PerformWithFiller(*pPF, aProgress->Start()); BOPTest::ReportAlerts(aBOP.GetReport()); // Store the history of Boolean operation into the session @@ -325,7 +328,8 @@ Standard_Integer bopsection(Draw_Interpretor& di, aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted()); aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // - aBOP.PerformWithFiller(*pPF); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aBOP.PerformWithFiller(*pPF, aProgress->Start()); BOPTest::ReportAlerts(aBOP.GetReport()); // Store the history of Section operation into the session @@ -436,6 +440,7 @@ Standard_Integer bsection(Draw_Interpretor& di, // BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False); // + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); aSec.Approximation(bApp); aSec.ComputePCurveOn1(bPC1); aSec.ComputePCurveOn2(bPC2); @@ -446,8 +451,7 @@ Standard_Integer bsection(Draw_Interpretor& di, aSec.SetGlue(aGlue); aSec.SetUseOBB(BOPTest_Objects::UseOBB()); // - aSec.Build(); - + aSec.Build(aProgress->Start()); // Store the history of Section operation into the session if (BRepTest_Objects::IsHistoryNeeded()) BRepTest_Objects::SetHistory(aSec.History()); @@ -483,10 +487,8 @@ Standard_Integer bsmt (Draw_Interpretor& di, const char** a, const BOPAlgo_Operation aOp) { - Standard_Boolean bRunParallel, bNonDestructive; TopoDS_Shape aS1, aS2; TopTools_ListOfShape aLC; - Standard_Real aTol; // if (n != 4) { di << " use bx r s1 s2\n"; @@ -502,47 +504,30 @@ Standard_Integer bsmt (Draw_Interpretor& di, } aLC.Append(aS1); aLC.Append(aS2); - // - aTol=BOPTest_Objects::FuzzyValue(); - bRunParallel = BOPTest_Objects::RunParallel(); - bNonDestructive = BOPTest_Objects::NonDestructive(); - BOPAlgo_GlueEnum aGlue = BOPTest_Objects::Glue(); // Handle(NCollection_BaseAllocator)aAL= NCollection_BaseAllocator::CommonBaseAllocator(); // - //--------------------------------------------------------------- - BOPAlgo_PaveFiller aPF(aAL); - // - aPF.SetArguments(aLC); - aPF.SetFuzzyValue(aTol); - aPF.SetRunParallel(bRunParallel); - aPF.SetNonDestructive(bNonDestructive); - aPF.SetGlue(aGlue); - aPF.SetUseOBB(BOPTest_Objects::UseOBB()); - // - aPF.Perform(); - BOPTest::ReportAlerts(aPF.GetReport()); - if (aPF.HasErrors()) { - return 0; - } - // - //--------------------------------------------------------------- BOPAlgo_BOP aBOP(aAL); - // aBOP.AddArgument(aS1); aBOP.AddTool(aS2); aBOP.SetOperation(aOp); - aBOP.SetRunParallel(bRunParallel); + // set options + aBOP.SetGlue(BOPTest_Objects::Glue()); + aBOP.SetFuzzyValue(BOPTest_Objects::FuzzyValue()); + aBOP.SetNonDestructive(BOPTest_Objects::NonDestructive()); + aBOP.SetRunParallel(BOPTest_Objects::RunParallel()); + aBOP.SetUseOBB(BOPTest_Objects::UseOBB()); aBOP.SetCheckInverted(BOPTest_Objects::CheckInverted()); aBOP.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // - aBOP.PerformWithFiller(aPF); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aBOP.Perform(aProgress->Start()); BOPTest::ReportAlerts(aBOP.GetReport()); // Store the history of Boolean operation into the session if (BRepTest_Objects::IsHistoryNeeded()) - BRepTest_Objects::SetHistory(aPF.Arguments(), aBOP); + BRepTest_Objects::SetHistory(aBOP.PDS()->Arguments(), aBOP); if (aBOP.HasErrors()) { return 0; @@ -852,7 +837,8 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** aMV.SetUseOBB(BOPTest_Objects::UseOBB()); aMV.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // - aMV.Perform(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aMV.Perform(aProgress->Start()); BOPTest::ReportAlerts(aMV.GetReport()); // Store the history of Volume Maker into the session diff --git a/src/BOPTest/BOPTest_CellsCommands.cxx b/src/BOPTest/BOPTest_CellsCommands.cxx index 6ff33c655f..2878fa32b0 100644 --- a/src/BOPTest/BOPTest_CellsCommands.cxx +++ b/src/BOPTest/BOPTest_CellsCommands.cxx @@ -25,6 +25,8 @@ #include +#include + static Standard_Integer bcbuild (Draw_Interpretor&, Standard_Integer, const char**); static Standard_Integer bcaddall (Draw_Interpretor&, Standard_Integer, const char**); static Standard_Integer bcremoveall (Draw_Interpretor&, Standard_Integer, const char**); @@ -116,9 +118,9 @@ Standard_Integer bcbuild(Draw_Interpretor& di, aCBuilder.SetUseOBB(BOPTest_Objects::UseOBB()); aCBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // - aCBuilder.PerformWithFiller(aPF); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aCBuilder.PerformWithFiller(aPF, aProgress->Start()); BOPTest::ReportAlerts(aCBuilder.GetReport()); - // Store the history of the Cells Builder into the session if (BRepTest_Objects::IsHistoryNeeded()) BRepTest_Objects::SetHistory(aCBuilder.Arguments(), aCBuilder); diff --git a/src/BOPTest/BOPTest_CheckCommands.cxx b/src/BOPTest/BOPTest_CheckCommands.cxx index 83ccd18a47..7a67b013d4 100644 --- a/src/BOPTest/BOPTest_CheckCommands.cxx +++ b/src/BOPTest/BOPTest_CheckCommands.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -243,7 +244,8 @@ Standard_Integer bopcheck (Draw_Interpretor& di, OSD_Timer aTimer; aTimer.Start(); // - aChecker.Perform(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aChecker.Perform(aProgress->Start()); // aTimer.Stop(); // @@ -549,9 +551,9 @@ Standard_Integer bopargcheck (Draw_Interpretor& di, } } + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); // run checker - aChecker.Perform(); - + aChecker.Perform(aProgress->Start()); // process result of checking if(!aChecker.HasFaulty()) { di << "Shape(s) seem(s) to be valid for BOP." << "\n"; diff --git a/src/BOPTest/BOPTest_PartitionCommands.cxx b/src/BOPTest/BOPTest_PartitionCommands.cxx index ebbb605d21..b85f70110e 100644 --- a/src/BOPTest/BOPTest_PartitionCommands.cxx +++ b/src/BOPTest/BOPTest_PartitionCommands.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -138,7 +139,8 @@ Standard_Integer bfillds(Draw_Interpretor& di, OSD_Timer aTimer; aTimer.Start(); // - aPF.Perform(); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + aPF.Perform(aProgress->Start()); BOPTest::ReportAlerts(aPF.GetReport()); if (aPF.HasErrors()) { return 0; @@ -210,11 +212,12 @@ Standard_Integer bbuild(Draw_Interpretor& di, aBuilder.SetCheckInverted(BOPTest_Objects::CheckInverted()); aBuilder.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); // OSD_Timer aTimer; aTimer.Start(); // - aBuilder.PerformWithFiller(aPF); + aBuilder.PerformWithFiller(aPF, aProgress->Start()); BOPTest::ReportAlerts(aBuilder.GetReport()); // Set history of GF operation into the session @@ -327,10 +330,12 @@ Standard_Integer bbop(Draw_Interpretor& di, pBuilder->SetCheckInverted(BOPTest_Objects::CheckInverted()); pBuilder->SetToFillHistory(BRepTest_Objects::IsHistoryNeeded()); // + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + // OSD_Timer aTimer; aTimer.Start(); // - pBuilder->PerformWithFiller(aPF); + pBuilder->PerformWithFiller(aPF, aProgress->Start()); BOPTest::ReportAlerts(pBuilder->GetReport()); // Set history of Boolean operation into the session @@ -404,7 +409,8 @@ Standard_Integer bsplit(Draw_Interpretor& di, aTimer.Start(); // // perform the operation - pSplitter->PerformWithFiller(aPF); + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + pSplitter->PerformWithFiller(aPF, aProgress->Start()); // aTimer.Stop(); BOPTest::ReportAlerts(pSplitter->GetReport()); @@ -567,9 +573,9 @@ Standard_Integer buildbop(Draw_Interpretor& di, // Create new report for the operation Handle(Message_Report) aReport = new Message_Report; - + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); // Build specific operation - pBuilder->BuildBOP(aLObjects, aLTools, anOp, aReport); + pBuilder->BuildBOP(aLObjects, aLTools, anOp, aProgress->Start(), aReport); // Report alerts of the operation BOPTest::ReportAlerts(aReport); diff --git a/src/BRepAlgo/BRepAlgo_Section.cxx b/src/BRepAlgo/BRepAlgo_Section.cxx index 1e9b3672c0..cc713e63fa 100644 --- a/src/BRepAlgo/BRepAlgo_Section.cxx +++ b/src/BRepAlgo/BRepAlgo_Section.cxx @@ -269,7 +269,7 @@ Standard_DISABLE_DEPRECATION_WARNINGS //function : Build //purpose : compute the section //======================================================================= - void BRepAlgo_Section::Build() + void BRepAlgo_Section::Build(const Message_ProgressRange& /*theRange*/) { if (myS1Changed || myS2Changed || diff --git a/src/BRepAlgo/BRepAlgo_Section.hxx b/src/BRepAlgo/BRepAlgo_Section.hxx index 20b80f1831..ba5f98247f 100644 --- a/src/BRepAlgo/BRepAlgo_Section.hxx +++ b/src/BRepAlgo/BRepAlgo_Section.hxx @@ -264,7 +264,7 @@ public: //! You may also have combined these computation //! options: look at the example given above to illustrate //! the use of the constructors. - Standard_EXPORT void Build() Standard_OVERRIDE; + Standard_EXPORT void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Identifies the ancestor faces of the new //! intersection edge E resulting from the last diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Algo.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Algo.hxx index 1511ee4645..5ff5a9e8aa 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Algo.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Algo.hxx @@ -53,7 +53,6 @@ public: using BOPAlgo_Options::DumpWarnings; using BOPAlgo_Options::ClearWarnings; using BOPAlgo_Options::GetReport; - using BOPAlgo_Options::SetProgressIndicator; using BOPAlgo_Options::SetUseOBB; protected: diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx index 969b9be10d..845b4f4e20 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx @@ -138,7 +138,7 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation //function : Build //purpose : //======================================================================= -void BRepAlgoAPI_BooleanOperation::Build() +void BRepAlgoAPI_BooleanOperation::Build(const Message_ProgressRange& theRange) { // Set Not Done status by default NotDone(); @@ -167,6 +167,27 @@ void BRepAlgoAPI_BooleanOperation::Build() } } + TCollection_AsciiString aPSName; + switch (myOperation) + { + case BOPAlgo_COMMON: + aPSName = "Performing COMMON operation"; + break; + case BOPAlgo_FUSE: + aPSName = "Performing FUSE operation"; + break; + case BOPAlgo_CUT: + case BOPAlgo_CUT21: + aPSName = "Performing CUT operation"; + break; + case BOPAlgo_SECTION: + aPSName = "Performing SECTION operation"; + break; + default: + return; + } + + Message_ProgressScope aPS(theRange, aPSName, myIsIntersectionNeeded ? 100 : 30); // If necessary perform intersection of the argument shapes if (myIsIntersectionNeeded) { @@ -176,7 +197,7 @@ void BRepAlgoAPI_BooleanOperation::Build() aLArgs.Append(it.Value()); // Perform intersection - IntersectShapes(aLArgs); + IntersectShapes(aLArgs, aPS.Next(70)); if (HasErrors()) { if (aDumpOper.IsDump()) @@ -203,7 +224,11 @@ void BRepAlgoAPI_BooleanOperation::Build() } // Build the result - BuildResult(); + BuildResult(aPS.Next(30)); + if (HasErrors()) + { + return; + } if (aDumpOper.IsDump()) { Standard_Boolean isDumpRes = myShape.IsNull() || diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.hxx index b298efa54a..7ab0800f56 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.hxx @@ -110,7 +110,7 @@ public: //! @name Setting/Getting the type of Boolean operation public: //! @name Performing the operation //! Performs the Boolean operation. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; protected: //! @name Constructors diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx index 4e310b2f6d..740a7fa66b 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx @@ -87,14 +87,15 @@ void BRepAlgoAPI_BuilderAlgo::Clear() //function : Build //purpose : //======================================================================= -void BRepAlgoAPI_BuilderAlgo::Build() +void BRepAlgoAPI_BuilderAlgo::Build(const Message_ProgressRange& theRange) { // Setting not done status NotDone(); // Destroy the tools if necessary Clear(); + Message_ProgressScope aPS(theRange, "Performing General Fuse operation", 100); // If necessary perform intersection of the argument shapes - IntersectShapes(myArguments); + IntersectShapes(myArguments, aPS.Next(70)); if (HasErrors()) return; @@ -102,16 +103,15 @@ void BRepAlgoAPI_BuilderAlgo::Build() myBuilder = new BOPAlgo_Builder(myAllocator); // Set arguments to builder myBuilder->SetArguments(myArguments); - // Build the result basing on intersection results - BuildResult(); + BuildResult(aPS.Next(30)); } //======================================================================= //function : IntersectShapes //purpose : Intersects the given shapes with the intersection tool //======================================================================= -void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArgs) +void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArgs, const Message_ProgressRange& theRange) { if (!myIsIntersectionNeeded) return; @@ -125,10 +125,7 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg myDSFiller->SetArguments(theArgs); // Set options for intersection myDSFiller->SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - myDSFiller->SetProgressIndicator(*myProgressScope); - } + myDSFiller->SetFuzzyValue(myFuzzyValue); myDSFiller->SetNonDestructive(myNonDestructive); myDSFiller->SetGlue(myGlue); @@ -136,7 +133,7 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg // Set Face/Face intersection options to the intersection algorithm SetAttributes(); // Perform intersection - myDSFiller->Perform(); + myDSFiller->Perform(theRange); // Check for the errors during intersection GetReport()->Merge(myDSFiller->GetReport()); } @@ -144,18 +141,15 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg //function : BuildResult //purpose : Builds the result shape //======================================================================= -void BRepAlgoAPI_BuilderAlgo::BuildResult() +void BRepAlgoAPI_BuilderAlgo::BuildResult(const Message_ProgressRange& theRange) { // Set options to the builder myBuilder->SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - myBuilder->SetProgressIndicator(*myProgressScope); - } + myBuilder->SetCheckInverted(myCheckInverted); myBuilder->SetToFillHistory(myFillHistory); // Perform building of the result with pre-calculated intersections - myBuilder->PerformWithFiller(*myDSFiller); + myBuilder->PerformWithFiller(*myDSFiller, theRange); // Merge the warnings of the Building part GetReport()->Merge(myBuilder->GetReport()); // Check for the errors diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.hxx index d8cc474de3..051e9ef930 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.hxx @@ -138,7 +138,7 @@ public: //! @name Setting options public: //! @name Performing the operation //! Performs the algorithm - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; public: //! @name Result simplification @@ -250,10 +250,10 @@ protected: //! @name Setting options to the Intersection tool protected: //! @name Protected methods for shapes intersection and building result //! Intersects the given shapes with the intersection tool - Standard_EXPORT void IntersectShapes(const TopTools_ListOfShape& theArgs); + Standard_EXPORT void IntersectShapes(const TopTools_ListOfShape& theArgs, const Message_ProgressRange& theRange); //! Builds the resulting shape - Standard_EXPORT void BuildResult(); + Standard_EXPORT void BuildResult(const Message_ProgressRange& theRange = Message_ProgressRange()); protected: //! @name Clearing the contents of the algorithm diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx index 3dc0098779..3c7d4da21a 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx @@ -38,7 +38,8 @@ BRepAlgoAPI_Check::BRepAlgoAPI_Check() //======================================================================= BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS, const Standard_Boolean bTestSE, - const Standard_Boolean bTestSI) + const Standard_Boolean bTestSI, + const Message_ProgressRange& theRange) : BOPAlgo_Options(), myS1(theS), @@ -46,7 +47,7 @@ BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS, myTestSI(bTestSI), myOperation(BOPAlgo_UNKNOWN) { - Perform(); + Perform(theRange); } //======================================================================= @@ -57,7 +58,8 @@ BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2, const BOPAlgo_Operation theOp, const Standard_Boolean bTestSE, - const Standard_Boolean bTestSI) + const Standard_Boolean bTestSI, + const Message_ProgressRange& theRange) : BOPAlgo_Options(), myS1(theS1), @@ -66,7 +68,7 @@ BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1, myTestSI(bTestSI), myOperation(theOp) { - Perform(); + Perform(theRange); } //======================================================================= @@ -81,7 +83,7 @@ BRepAlgoAPI_Check::~BRepAlgoAPI_Check() //function : Perform //purpose : //======================================================================= -void BRepAlgoAPI_Check::Perform() +void BRepAlgoAPI_Check::Perform(const Message_ProgressRange& theRange) { // Check the incompatibility of shapes types, small edges and self-interference BOPAlgo_ArgumentAnalyzer anAnalyzer; @@ -94,13 +96,14 @@ void BRepAlgoAPI_Check::Perform() anAnalyzer.SelfInterMode() = myTestSI; // Set options from BOPAlgo_Options anAnalyzer.SetRunParallel(myRunParallel); - if (myProgressScope != NULL) - { - anAnalyzer.SetProgressIndicator(*myProgressScope); - } anAnalyzer.SetFuzzyValue(myFuzzyValue); // Perform the check - anAnalyzer.Perform(); + Message_ProgressScope aPS(theRange, "Checking shapes", 1); + anAnalyzer.Perform(aPS.Next()); + if (UserBreak(aPS)) + { + return; + } // Get the results myFaultyShapes = anAnalyzer.GetCheckResult(); diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Check.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Check.hxx index e3ded7899c..bf9e252580 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Check.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Check.hxx @@ -26,6 +26,7 @@ #include #include #include +#include //! The class Check provides a diagnostic tool for checking the validity @@ -66,9 +67,11 @@ public: //! @name Constructors //! on small edges or not; by default it is set to TRUE; //! @param bTestSI [in] - flag which specifies whether to check the shape //! on self-interference or not; by default it is set to TRUE; + //! @param theRange [in] - parameter to use progress indicator Standard_EXPORT BRepAlgoAPI_Check(const TopoDS_Shape& theS, const Standard_Boolean bTestSE = Standard_True, - const Standard_Boolean bTestSI = Standard_True); + const Standard_Boolean bTestSI = Standard_True, + const Message_ProgressRange& theRange = Message_ProgressRange()); //! Constructor for checking the couple of shapes. //! Additionally to the validity checks of each given shape, @@ -83,11 +86,13 @@ public: //! @name Constructors //! on small edges or not; by default it is set to TRUE; //! @param bTestSI [in] - flag which specifies whether to check the shape //! on self-interference or not; by default it is set to TRUE; + //! @param theRange [in] - parameter to use progress indicator Standard_EXPORT BRepAlgoAPI_Check(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2, const BOPAlgo_Operation theOp = BOPAlgo_UNKNOWN, const Standard_Boolean bTestSE = Standard_True, - const Standard_Boolean bTestSI = Standard_True); + const Standard_Boolean bTestSI = Standard_True, + const Message_ProgressRange& theRange = Message_ProgressRange()); public: //! @name Initializing the algorithm @@ -141,7 +146,7 @@ public: //! @name Initializing the algorithm public: //! @name Performing the operation //! Performs the check. - Standard_EXPORT void Perform(); + Standard_EXPORT void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()); public: //! @name Getting the results. diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Common.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Common.cxx index 12f7f53b0a..5060b99596 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Common.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Common.cxx @@ -52,10 +52,11 @@ BRepAlgoAPI_Common::~BRepAlgoAPI_Common() //purpose : //======================================================================= BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1, - const TopoDS_Shape& S2) + const TopoDS_Shape& S2, + const Message_ProgressRange& theRange) : BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_COMMON) { - Build(); + Build(theRange); } //======================================================================= //function : BRepAlgoAPI_Common @@ -63,10 +64,11 @@ BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1, //======================================================================= BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1, const TopoDS_Shape& S2, - const BOPAlgo_PaveFiller& aDSF) + const BOPAlgo_PaveFiller& aDSF, + const Message_ProgressRange& theRange) : BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_COMMON) { - Build(); + Build(theRange); } diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Common.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Common.hxx index 401593cd1b..a3151a2df8 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Common.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Common.hxx @@ -49,7 +49,9 @@ Standard_EXPORT virtual ~BRepAlgoAPI_Common(); //! -tool //! - the type of the operation //! Obsolete - Standard_EXPORT BRepAlgoAPI_Common(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + Standard_EXPORT BRepAlgoAPI_Common(const TopoDS_Shape& S1, + const TopoDS_Shape& S2, + const Message_ProgressRange& theRange = Message_ProgressRange()); //! Constructor with two shapes //! -argument @@ -57,7 +59,10 @@ Standard_EXPORT virtual ~BRepAlgoAPI_Common(); //! - the type of the operation //! - PaveFiller object that is carried out //! Obsolete - Standard_EXPORT BRepAlgoAPI_Common(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& PF); + Standard_EXPORT BRepAlgoAPI_Common(const TopoDS_Shape& S1, + const TopoDS_Shape& S2, + const BOPAlgo_PaveFiller& PF, + const Message_ProgressRange& theRange = Message_ProgressRange()); diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Cut.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Cut.cxx index f2a3d4fdd1..89defaf635 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Cut.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Cut.cxx @@ -52,11 +52,12 @@ BRepAlgoAPI_Cut::~BRepAlgoAPI_Cut() //purpose : //======================================================================= BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1, - const TopoDS_Shape& S2) + const TopoDS_Shape& S2, + const Message_ProgressRange& theRange) : BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_CUT) { - Build(); + Build(theRange); } //======================================================================= //function : BRepAlgoAPI_Cut @@ -65,10 +66,11 @@ BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1, BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, - const Standard_Boolean bFWD) + const Standard_Boolean bFWD, + const Message_ProgressRange& theRange) : BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21) { - Build(); + Build(theRange); } diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Cut.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Cut.hxx index b5255bb089..41dba20286 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Cut.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Cut.hxx @@ -50,7 +50,8 @@ Standard_EXPORT virtual ~BRepAlgoAPI_Cut(); //! -tool //! - the type of the operation //! Obsolete - Standard_EXPORT BRepAlgoAPI_Cut(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + Standard_EXPORT BRepAlgoAPI_Cut(const TopoDS_Shape& S1, const TopoDS_Shape& S2, + const Message_ProgressRange& theRange = Message_ProgressRange()); //! Constructor with two shapes //! -argument @@ -58,7 +59,9 @@ Standard_EXPORT virtual ~BRepAlgoAPI_Cut(); //! - the type of the operation //! - PaveFiller object that is carried out //! Obsolete - Standard_EXPORT BRepAlgoAPI_Cut(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, const Standard_Boolean bFWD = Standard_True); + Standard_EXPORT BRepAlgoAPI_Cut(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, + const Standard_Boolean bFWD = Standard_True, + const Message_ProgressRange& theRange = Message_ProgressRange()); diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.cxx index 272a876a94..2f4def8b8d 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.cxx @@ -21,7 +21,7 @@ //function : Build //purpose : //======================================================================= -void BRepAlgoAPI_Defeaturing::Build() +void BRepAlgoAPI_Defeaturing::Build(const Message_ProgressRange& /*theRange*/) { // Set not done state for the operation NotDone(); diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.hxx index 43258f9548..a547766f76 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Defeaturing.hxx @@ -157,7 +157,7 @@ public: //! @name Setting input data for the algorithm public: //! @name Performing the operation //! Performs the operation - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; public: //! @name History Methods diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.cxx index 1e24153be7..cd3689b915 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.cxx @@ -52,11 +52,12 @@ BRepAlgoAPI_Fuse::~BRepAlgoAPI_Fuse() //purpose : //======================================================================= BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, - const TopoDS_Shape& S2) + const TopoDS_Shape& S2, + const Message_ProgressRange& theRange) : BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_FUSE) { - Build(); + Build(theRange); } //======================================================================= //function : BRepAlgoAPI_Fuse @@ -64,9 +65,10 @@ BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, //======================================================================= BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, const TopoDS_Shape& S2, - const BOPAlgo_PaveFiller& aDSF) + const BOPAlgo_PaveFiller& aDSF, + const Message_ProgressRange& theRange) : BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_FUSE) { - Build(); + Build(theRange); } diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.hxx index 52dd5dc89e..53fd176773 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Fuse.hxx @@ -49,7 +49,8 @@ Standard_EXPORT virtual ~BRepAlgoAPI_Fuse(); //! -tool //! - the type of the operation //! Obsolete - Standard_EXPORT BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + Standard_EXPORT BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, const TopoDS_Shape& S2, + const Message_ProgressRange& theRange = Message_ProgressRange()); //! Constructor with two shapes //! -argument @@ -57,7 +58,8 @@ Standard_EXPORT virtual ~BRepAlgoAPI_Fuse(); //! - the type of the operation //! - PaveFiller object that is carried out //! Obsolete - Standard_EXPORT BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF); + Standard_EXPORT BRepAlgoAPI_Fuse(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, + const Message_ProgressRange& theRange = Message_ProgressRange()); diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx index 2e59aaf5f4..1125e6d719 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx @@ -271,9 +271,9 @@ void BRepAlgoAPI_Section::SetAttributes() //function : Build //purpose : //======================================================================= -void BRepAlgoAPI_Section::Build() +void BRepAlgoAPI_Section::Build(const Message_ProgressRange& theRange) { - BRepAlgoAPI_BooleanOperation::Build(); + BRepAlgoAPI_BooleanOperation::Build(theRange); } //======================================================================= //function : HasAncestorFaceOn1 diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Section.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Section.hxx index 2582d5705a..78e525f8b7 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Section.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Section.hxx @@ -158,7 +158,7 @@ Standard_EXPORT virtual ~BRepAlgoAPI_Section(); //! Performs the algorithm //! Filling interference Data Structure (if it is necessary) //! Building the result of the operation. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! get the face of the first part giving section edge . diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.cxx index 4a0fd00d70..bd5a978792 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.cxx @@ -35,7 +35,7 @@ BRepAlgoAPI_Splitter::BRepAlgoAPI_Splitter(const BOPAlgo_PaveFiller& thePF) // function: Build // purpose: //======================================================================= -void BRepAlgoAPI_Splitter::Build() +void BRepAlgoAPI_Splitter::Build(const Message_ProgressRange& theRange) { // Set Not Done status by default NotDone(); @@ -50,6 +50,7 @@ void BRepAlgoAPI_Splitter::Build() } // If necessary perform intersection of the argument shapes + Message_ProgressScope aPS(theRange, "Performing Split operation", myIsIntersectionNeeded ? 100 : 30); if (myIsIntersectionNeeded) { // Combine Arguments and Tools for intersection into a single list @@ -58,7 +59,7 @@ void BRepAlgoAPI_Splitter::Build() aLArgs.Append(it.Value()); // Perform intersection - IntersectShapes(aLArgs); + IntersectShapes(aLArgs, aPS.Next(70)); if (HasErrors()) return; } @@ -69,5 +70,5 @@ void BRepAlgoAPI_Splitter::Build() ((BOPAlgo_Splitter*)myBuilder)->SetTools(myTools); // Build result shape basing on the intersection results - BuildResult(); + BuildResult(aPS.Next(30)); } diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.hxx b/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.hxx index 97288441d2..eed0680760 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.hxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Splitter.hxx @@ -82,7 +82,7 @@ public: //! @name Performing the operation //! Performs the Split operation. //! Performs the intersection of the argument shapes (both objects and tools) //! and splits objects by the tools. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; protected: //! @name Fields diff --git a/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx b/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx index ba27b58772..2ff0a1454c 100644 --- a/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx +++ b/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx @@ -36,7 +36,7 @@ BRepBuilderAPI_MakeShape::BRepBuilderAPI_MakeShape() //purpose : //======================================================================= -void BRepBuilderAPI_MakeShape::Build() +void BRepBuilderAPI_MakeShape::Build(const Message_ProgressRange& /*theRange*/) { } diff --git a/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.hxx b/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.hxx index 7536e26b13..d7d6b5ec91 100644 --- a/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.hxx +++ b/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.hxx @@ -25,6 +25,7 @@ #include #include #include +#include class StdFail_NotDone; class TopoDS_Shape; @@ -42,7 +43,7 @@ public: //! This is called by Shape(). It does nothing but //! may be redefined. - Standard_EXPORT virtual void Build(); + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()); //! Returns a shape built by the shape construction algorithm. //! Raises exception StdFail_NotDone if the shape was not built. diff --git a/src/BRepFeat/BRepFeat_Builder.cxx b/src/BRepFeat/BRepFeat_Builder.cxx index 4a6635ea55..24c641209b 100644 --- a/src/BRepFeat/BRepFeat_Builder.cxx +++ b/src/BRepFeat/BRepFeat_Builder.cxx @@ -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 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); diff --git a/src/BRepFeat/BRepFeat_Builder.hxx b/src/BRepFeat/BRepFeat_Builder.hxx index a9a96a03b5..b0f2616832 100644 --- a/src/BRepFeat/BRepFeat_Builder.hxx +++ b/src/BRepFeat/BRepFeat_Builder.hxx @@ -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. diff --git a/src/BRepFeat/BRepFeat_Gluer.cxx b/src/BRepFeat/BRepFeat_Gluer.cxx index a6f9c836f8..b119560b4a 100644 --- a/src/BRepFeat/BRepFeat_Gluer.cxx +++ b/src/BRepFeat/BRepFeat_Gluer.cxx @@ -26,7 +26,7 @@ //function : Build //purpose : //======================================================================= -void BRepFeat_Gluer::Build() +void BRepFeat_Gluer::Build(const Message_ProgressRange& /*theRange*/) { myGluer.Perform(); if (myGluer.IsDone()) { diff --git a/src/BRepFeat/BRepFeat_Gluer.hxx b/src/BRepFeat/BRepFeat_Gluer.hxx index cd29cd033c..aba0dfe40c 100644 --- a/src/BRepFeat/BRepFeat_Gluer.hxx +++ b/src/BRepFeat/BRepFeat_Gluer.hxx @@ -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. diff --git a/src/BRepFeat/BRepFeat_SplitShape.cxx b/src/BRepFeat/BRepFeat_SplitShape.cxx index 2a559c05fa..4b5ea9399c 100644 --- a/src/BRepFeat/BRepFeat_SplitShape.cxx +++ b/src/BRepFeat/BRepFeat_SplitShape.cxx @@ -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()) { diff --git a/src/BRepFeat/BRepFeat_SplitShape.hxx b/src/BRepFeat/BRepFeat_SplitShape.hxx index 1ebcce2a01..e38edf2d5e 100644 --- a/src/BRepFeat/BRepFeat_SplitShape.hxx +++ b/src/BRepFeat/BRepFeat_SplitShape.hxx @@ -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; diff --git a/src/BRepFill/BRepFill_Draft.cxx b/src/BRepFill/BRepFill_Draft.cxx index eb44aca877..65f605bf74 100644 --- a/src/BRepFill/BRepFill_Draft.cxx +++ b/src/BRepFill/BRepFill_Draft.cxx @@ -722,7 +722,7 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B, TopTools_ListOfShape aLO, aLT; aLO.Append(Sol1); aLT.Append(Sol2); - aBuilder.BuildBOP(aLO, aLT, BOPAlgo_CUT); + aBuilder.BuildBOP(aLO, aLT, BOPAlgo_CUT, Message_ProgressRange()); if (!aBuilder.HasErrors()) { TopoDS_Solid aCutMin; @@ -769,7 +769,7 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B, aLO.Clear(); aLO.Append(aCutMin); - aGluer.BuildBOP(aLO, State1, aLT, State2); + aGluer.BuildBOP(aLO, State1, aLT, State2, Message_ProgressRange()); if (!aGluer.HasErrors()) { @@ -791,7 +791,7 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B, aLO.Append(Sol1); aLT.Append(Sol2); - aBuilder.BuildBOP(aLO, State1, aLT, State2); + aBuilder.BuildBOP(aLO, State1, aLT, State2, Message_ProgressRange()); if (aBuilder.HasErrors()) return Standard_False; diff --git a/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.cxx b/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.cxx index 25dbeb6190..85bcc71d61 100644 --- a/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.cxx +++ b/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.cxx @@ -391,7 +391,7 @@ Handle(TopOpeBRepBuild_HBuilder) BRepFilletAPI_MakeChamfer::Builder()const //purpose : //======================================================================= -void BRepFilletAPI_MakeChamfer::Build() +void BRepFilletAPI_MakeChamfer::Build(const Message_ProgressRange& /*theRange*/) { myBuilder.Compute(); if (myBuilder.IsDone()){ diff --git a/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.hxx b/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.hxx index b395ef88fa..b13cc67e3c 100644 --- a/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.hxx +++ b/src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.hxx @@ -250,7 +250,7 @@ public: //! intersection of 4 or more edges of the shape, or //! - the intersection of the chamfer with a face which //! limits the contour is not fully contained in this face. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Reinitializes this algorithm, thus canceling the effects of the Build function. //! This function allows modifications to be made to the diff --git a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx index 8a942e992b..54c31dafd1 100644 --- a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx +++ b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.cxx @@ -528,7 +528,7 @@ Handle(TopOpeBRepBuild_HBuilder) BRepFilletAPI_MakeFillet::Builder()const //purpose : //======================================================================= -void BRepFilletAPI_MakeFillet::Build() +void BRepFilletAPI_MakeFillet::Build(const Message_ProgressRange& /*theRange*/) { myBuilder.Compute(); if(myBuilder.IsDone()) { diff --git a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.hxx b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.hxx index 8c22d8a09c..1d4dee1bab 100644 --- a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.hxx +++ b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet.hxx @@ -293,7 +293,7 @@ public: //! intersection of 4 or more edges of the shape, or //! - the intersection of the fillet with a face which limits //! the contour is not fully contained in this face. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Reinitializes this algorithm, thus canceling the effects of the Build function. //! This function allows modifications to be made to the diff --git a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.cxx b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.cxx index 08926078e6..3c544d8e63 100644 --- a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.cxx +++ b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.cxx @@ -155,7 +155,7 @@ const TopoDS_Edge& BRepFilletAPI_MakeFillet2d::BasisEdge(const TopoDS_Edge& E) c //purpose : //======================================================================= -void BRepFilletAPI_MakeFillet2d::Build() +void BRepFilletAPI_MakeFillet2d::Build(const Message_ProgressRange& /*theRange*/) { // test if the operation is done if (Status() == ChFi2d_IsDone) { diff --git a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.hxx b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.hxx index 645e4b14f2..a7a3a85a26 100644 --- a/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.hxx +++ b/src/BRepFilletAPI/BRepFilletAPI_MakeFillet2d.hxx @@ -282,7 +282,7 @@ public: ChFi2d_ConstructionError Status() const; //! Update the result and set the Done flag - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx index 50eadac75b..4e2f73ed37 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx @@ -305,7 +305,7 @@ TopoDS_Shape BRepOffsetAPI_DraftAngle::ModifiedShape //purpose : //======================================================================= -void BRepOffsetAPI_DraftAngle::Build() +void BRepOffsetAPI_DraftAngle::Build(const Message_ProgressRange& /*theRange*/) { Handle(Draft_Modification)::DownCast (myModification)->Perform(); if (!Handle(Draft_Modification)::DownCast (myModification)->IsDone()) { diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.hxx index 8fef1b0227..a74e31b3bb 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.hxx @@ -176,7 +176,7 @@ public: Standard_EXPORT const TopTools_ListOfShape& ModifiedFaces() const; //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; Standard_EXPORT void CorrectWires(); diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx index 1b7612b570..0fc1c6763c 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx @@ -114,7 +114,7 @@ const BRepFill_Evolved& BRepOffsetAPI_MakeEvolved::Evolved() const //function : Build //purpose : //======================================================================= -void BRepOffsetAPI_MakeEvolved::Build() +void BRepOffsetAPI_MakeEvolved::Build(const Message_ProgressRange& /*theRange*/) { if (myEvolved.IsDone()) { diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx index ea2e106211..f311f4c561 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx @@ -106,7 +106,7 @@ public: Standard_EXPORT const BRepFill_Evolved& Evolved() const; //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the shapes created from a subshape //! of the spine and a subshape diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.cxx index b8bfcbef66..5eb9909159 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.cxx @@ -144,7 +144,7 @@ Standard_Integer BRepOffsetAPI_MakeFilling::Add( const Standard_Real U, //function : Build //purpose : builds the resulting face //====================================================================== -void BRepOffsetAPI_MakeFilling::Build() +void BRepOffsetAPI_MakeFilling::Build(const Message_ProgressRange& /*theRange*/) { myFilling.Build(); myShape = myFilling.Face(); diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.hxx index 975eac073e..641633c407 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeFilling.hxx @@ -183,7 +183,7 @@ public: Standard_EXPORT Standard_Integer Add (const Standard_Real U, const Standard_Real V, const TopoDS_Face& Support, const GeomAbs_Shape Order); //! Builds the resulting faces - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Tests whether computation of the filling plate has been completed. Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx index 9c25655175..a6b1720535 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx @@ -373,7 +373,7 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset, //purpose : //======================================================================= -void BRepOffsetAPI_MakeOffset::Build() +void BRepOffsetAPI_MakeOffset::Build(const Message_ProgressRange& /*theRange*/) { Done(); } diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.hxx index f2ea8cb646..1ab16bb1fd 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.hxx @@ -79,7 +79,7 @@ public: Standard_EXPORT void Perform (const Standard_Real Offset, const Standard_Real Alt = 0.0); //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! returns a list of the created shapes //! from the shape . diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.cxx index 99e6eb4a74..d00d7d1610 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.cxx @@ -90,7 +90,7 @@ const BRepOffset_MakeOffset& BRepOffsetAPI_MakeOffsetShape::MakeOffset() const //function : Build //purpose : //======================================================================= -void BRepOffsetAPI_MakeOffsetShape::Build() +void BRepOffsetAPI_MakeOffsetShape::Build(const Message_ProgressRange& /*theRange*/) { } diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.hxx index c380e1b275..1a863c1091 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeOffsetShape.hxx @@ -120,7 +120,7 @@ public: Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const; //! Does nothing. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the list of shapes generated from the shape . Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.cxx index a4131ea8ca..3d3f80fe6e 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.cxx @@ -77,7 +77,7 @@ const BRepFill_Pipe& BRepOffsetAPI_MakePipe::Pipe() const //purpose : //======================================================================= -void BRepOffsetAPI_MakePipe::Build() +void BRepOffsetAPI_MakePipe::Build(const Message_ProgressRange& /*theRange*/) { myShape = myPipe.Shape(); //Check for emptiness of result diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.hxx index fc49ce31eb..7e2f30f8ec 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipe.hxx @@ -71,7 +71,7 @@ public: Standard_EXPORT const BRepFill_Pipe& Pipe() const; //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the TopoDS Shape of the bottom of the prism. Standard_EXPORT TopoDS_Shape FirstShape() Standard_OVERRIDE; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx index ef0343c4a0..b222a52b04 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx @@ -253,7 +253,7 @@ void BRepOffsetAPI_MakePipeShell::SetMaxSegments(const Standard_Integer NewMaxSe //function :Build() //purpose : //======================================================================= - void BRepOffsetAPI_MakePipeShell::Build() + void BRepOffsetAPI_MakePipeShell::Build(const Message_ProgressRange& /*theRange*/) { Standard_Boolean Ok; Ok = myPipe->Build(); diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.hxx index a10a9d4f31..401df7340d 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.hxx @@ -241,7 +241,7 @@ public: Standard_EXPORT void Simulate (const Standard_Integer NumberOfSection, TopTools_ListOfShape& Result); //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Transforms the sweeping Shell in Solid. //! If a propfile is not closed returns False diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.cxx index 4376c6cd0a..5024a3dfad 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.cxx @@ -89,7 +89,7 @@ void BRepOffsetAPI_MakeThickSolid::MakeThickSolidBySimple(const TopoDS_Shape& th //function : Build //purpose : //======================================================================= -void BRepOffsetAPI_MakeThickSolid::Build() +void BRepOffsetAPI_MakeThickSolid::Build(const Message_ProgressRange& /*theRange*/) { } diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.hxx index 4dc6589c3d..b15eb150f5 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeThickSolid.hxx @@ -113,7 +113,7 @@ public: const Standard_Boolean RemoveIntEdges = Standard_False); // Does nothing. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the list of shapes modified from the shape //! . diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx index 305c6ffdcf..67bce0849c 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.cxx @@ -332,7 +332,7 @@ BRepOffsetAPI_MiddlePath::BRepOffsetAPI_MiddlePath(const TopoDS_Shape& aShape, //purpose : //======================================================================= -void BRepOffsetAPI_MiddlePath::Build() +void BRepOffsetAPI_MiddlePath::Build(const Message_ProgressRange& /*theRange*/) { TopTools_ListIteratorOfListOfShape itl; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.hxx index a68cb68368..68e533ca43 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MiddlePath.hxx @@ -43,7 +43,7 @@ public: //! a wire or a face Standard_EXPORT BRepOffsetAPI_MiddlePath(const TopoDS_Shape& aShape, const TopoDS_Shape& StartShape, const TopoDS_Shape& EndShape); - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.cxx index 08361b7a84..6d0be92578 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.cxx @@ -61,7 +61,7 @@ BRepOffsetAPI_NormalProjection::BRepOffsetAPI_NormalProjection() myNormalProjector.Compute3d(With3d); } - void BRepOffsetAPI_NormalProjection::Build() + void BRepOffsetAPI_NormalProjection::Build(const Message_ProgressRange& /*theRange*/) { myNormalProjector.Build(); myShape = myNormalProjector.Projection(); diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.hxx index 2156812b9c..4b569019e0 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_NormalProjection.hxx @@ -91,7 +91,7 @@ public: //! Builds the result of the projection as a compound of //! wires. Tries to build oriented wires. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns true if the object was correctly built by the shape //! construction algorithm. diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx index dd7eeee2e9..745eba1f38 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx @@ -339,7 +339,7 @@ void BRepOffsetAPI_ThruSections::CheckCompatibility(const Standard_Boolean check //purpose : //======================================================================= -void BRepOffsetAPI_ThruSections::Build() +void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/) { //Check set of section for right configuration of punctual sections Standard_Integer i; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.hxx index 79c88394d4..705939443b 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.hxx @@ -130,7 +130,7 @@ public: //! the optimization. Standard_EXPORT void CriteriumWeight (Standard_Real& W1, Standard_Real& W2, Standard_Real& W3) const; - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the TopoDS Shape of the bottom of the loft if solid Standard_EXPORT const TopoDS_Shape& FirstShape() const; diff --git a/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx b/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx index 5a75797ed1..6cd21578fb 100644 --- a/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx +++ b/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.cxx @@ -27,7 +27,7 @@ //function : Build //purpose : //======================================================================= -void BRepPreviewAPI_MakeBox::Build() +void BRepPreviewAPI_MakeBox::Build(const Message_ProgressRange& /*theRange*/) { gp_Pnt anLocation = myWedge.Axes().Location(); diff --git a/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.hxx b/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.hxx index 3cee338dc1..17c478676c 100644 --- a/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.hxx +++ b/src/BRepPreviewAPI/BRepPreviewAPI_MakeBox.hxx @@ -34,7 +34,7 @@ public: BRepPreviewAPI_MakeBox() {} //! Creates a preview depending on point values. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; private: diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeBox.cxx b/src/BRepPrimAPI/BRepPrimAPI_MakeBox.cxx index 8cf9916704..52cda67cc8 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeBox.cxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeBox.cxx @@ -181,7 +181,7 @@ const TopoDS_Shell& BRepPrimAPI_MakeBox::Shell() //purpose : //======================================================================= -void BRepPrimAPI_MakeBox::Build() +void BRepPrimAPI_MakeBox::Build(const Message_ProgressRange& /*theRange*/) { Solid(); } diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeBox.hxx b/src/BRepPrimAPI/BRepPrimAPI_MakeBox.hxx index dd58918ab4..26c2680cd7 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeBox.hxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeBox.hxx @@ -98,7 +98,7 @@ public: Standard_EXPORT BRepPrim_Wedge& Wedge(); //! Stores the solid in myShape. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the constructed box as a shell. Standard_EXPORT const TopoDS_Shell& Shell(); diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx b/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx index 218a0b9e51..dc9d9fefe4 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.cxx @@ -51,7 +51,7 @@ const TopoDS_Shell& BRepPrimAPI_MakeOneAxis::Shell() //purpose : //======================================================================= -void BRepPrimAPI_MakeOneAxis::Build() +void BRepPrimAPI_MakeOneAxis::Build(const Message_ProgressRange& /*theRange*/) { BRep_Builder B; B.MakeSolid(TopoDS::Solid(myShape)); diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.hxx b/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.hxx index 0bf2bd6c27..647300dde4 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.hxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeOneAxis.hxx @@ -43,7 +43,7 @@ public: Standard_EXPORT virtual Standard_Address OneAxis() = 0; //! Stores the solid in myShape. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the lateral face of the rotational primitive. Standard_EXPORT const TopoDS_Face& Face(); diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakePrism.cxx b/src/BRepPrimAPI/BRepPrimAPI_MakePrism.cxx index 18d9803257..40809742c2 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakePrism.cxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakePrism.cxx @@ -78,7 +78,7 @@ const BRepSweep_Prism& BRepPrimAPI_MakePrism::Prism()const //purpose : //======================================================================= -void BRepPrimAPI_MakePrism::Build() +void BRepPrimAPI_MakePrism::Build(const Message_ProgressRange& /*theRange*/) { myShape = myPrism.Shape(); Done(); diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakePrism.hxx b/src/BRepPrimAPI/BRepPrimAPI_MakePrism.hxx index c33de96aac..d069851b3f 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakePrism.hxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakePrism.hxx @@ -72,7 +72,7 @@ public: Standard_EXPORT const BRepSweep_Prism& Prism() const; //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the TopoDS Shape of the bottom of the prism. Standard_EXPORT TopoDS_Shape FirstShape() Standard_OVERRIDE; diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx b/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx index ec5a69a96e..b8e61e9b06 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.cxx @@ -109,7 +109,7 @@ const BRepSweep_Revol& BRepPrimAPI_MakeRevol::Revol() const //purpose : //======================================================================= -void BRepPrimAPI_MakeRevol::Build() +void BRepPrimAPI_MakeRevol::Build(const Message_ProgressRange& /*theRange*/) { if (myIsBuild) { diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.hxx b/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.hxx index a24adbad2b..1132df39ca 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.hxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeRevol.hxx @@ -81,7 +81,7 @@ public: Standard_EXPORT const BRepSweep_Revol& Revol() const; //! Builds the resulting shape (redefined from MakeShape). - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the first shape of the revol (coinciding with //! the generating shape). diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.cxx b/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.cxx index 0491f4f9e1..d98e4d25d8 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.cxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.cxx @@ -119,7 +119,7 @@ const TopoDS_Shell& BRepPrimAPI_MakeWedge::Shell() //purpose : //======================================================================= -void BRepPrimAPI_MakeWedge::Build() +void BRepPrimAPI_MakeWedge::Build(const Message_ProgressRange& /*theRange*/) { BRep_Builder B; B.MakeSolid(TopoDS::Solid(myShape)); diff --git a/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.hxx b/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.hxx index c65b051c65..5ade9348bb 100644 --- a/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.hxx +++ b/src/BRepPrimAPI/BRepPrimAPI_MakeWedge.hxx @@ -60,7 +60,7 @@ public: Standard_EXPORT BRepPrim_Wedge& Wedge(); //! Stores the solid in myShape. - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; //! Returns the constructed box in the form of a shell. Standard_EXPORT const TopoDS_Shell& Shell(); diff --git a/src/BRepTest/BRepTest_FilletCommands.cxx b/src/BRepTest/BRepTest_FilletCommands.cxx index a9af23106d..18d39c1800 100644 --- a/src/BRepTest/BRepTest_FilletCommands.cxx +++ b/src/BRepTest/BRepTest_FilletCommands.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -357,23 +358,24 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const } BOPAlgo_PaveFiller theDSFiller; + Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); + Message_ProgressScope aPS(aProgress->Start(), NULL, 10); TopTools_ListOfShape aLS; aLS.Append(S1); aLS.Append(S2); theDSFiller.SetArguments(aLS); // - theDSFiller.Perform(); + theDSFiller.Perform(aPS.Next(8)); if (theDSFiller.HasErrors()) { Message::SendFail() << "Check types of the arguments, please"; return 1; } BRepAlgoAPI_BooleanOperation* pBuilder=NULL; - if (fuse) - pBuilder = new BRepAlgoAPI_Fuse( S1, S2, theDSFiller ); + pBuilder = new BRepAlgoAPI_Fuse( S1, S2, theDSFiller, aPS.Next(2) ); else - pBuilder = new BRepAlgoAPI_Cut ( S1, S2, theDSFiller ); + pBuilder = new BRepAlgoAPI_Cut ( S1, S2, theDSFiller, Standard_True, aPS.Next(2)); Standard_Boolean anIsDone = pBuilder->IsDone(); if (!anIsDone) diff --git a/src/Draw/Draw_ProgressIndicator.cxx b/src/Draw/Draw_ProgressIndicator.cxx index 6b2f4efaae..a31a1717a5 100644 --- a/src/Draw/Draw_ProgressIndicator.cxx +++ b/src/Draw/Draw_ProgressIndicator.cxx @@ -100,7 +100,7 @@ void Draw_ProgressIndicator::Show (const Message_ProgressScope& theScope, const // unless show is forced, show updated state only if at least 1% progress has been reached since the last update Standard_Real aPosition = GetPosition(); - if ( ! force && aPosition < 1. && Abs (aPosition - myLastPosition) < myUpdateThreshold) + if ( ! force && (1. - aPosition) > Precision::Confusion() && Abs (aPosition - myLastPosition) < myUpdateThreshold) return; // return if update interval has not elapsed myLastPosition = aPosition; diff --git a/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.cxx b/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.cxx index fc4bf61dbd..66fd7791a7 100644 --- a/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.cxx +++ b/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.cxx @@ -142,7 +142,7 @@ ShapeConstruct_MakeTriangulation::ShapeConstruct_MakeTriangulation (const TopoDS //purpose : //======================================================================= - void ShapeConstruct_MakeTriangulation::Build() + void ShapeConstruct_MakeTriangulation::Build(const Message_ProgressRange& /*theRange*/) { if (myShape.IsNull()) { // Triangulate polygonal wire diff --git a/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.hxx b/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.hxx index db04bbc859..10ed234cc7 100644 --- a/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.hxx +++ b/src/ShapeConstruct/ShapeConstruct_MakeTriangulation.hxx @@ -41,7 +41,7 @@ public: Standard_EXPORT ShapeConstruct_MakeTriangulation(const TopoDS_Wire& wire, const Standard_Real prec = 0.0); - Standard_EXPORT virtual void Build() Standard_OVERRIDE; + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE; diff --git a/tests/bugs/modalg_7/bug21264 b/tests/bugs/modalg_7/bug21264 new file mode 100644 index 0000000000..30f898b775 --- /dev/null +++ b/tests/bugs/modalg_7/bug21264 @@ -0,0 +1,117 @@ +puts "============================================" +puts "0021264: Modeling Algorithms - Progress indicator for Boolean operations" +puts "============================================" +puts "" + +proc isTracked { theOutput } { + if {![regexp "Progress" $theOutput]} { + puts "Error: progress is not tracked" + } +} + +XProgress +t + +box b1 10 10 10 +box b2 5 5 5 10 10 10 + +# check that progress is tracked for boolean operations + +# bop + operations + +set log [bop b1 b2] +isTracked $log + +set log [bopfuse r] +isTracked $log + +set log [bopcommon r] +isTracked $log + +set log [bopcut r] +isTracked $log + +set log [boptuc r] +isTracked $log + +set log [bopsection r] +isTracked $log + + +# b[operation] + +set log [bfuse r b1 b2] +isTracked $log + +set log [bcommon r b1 b2] +isTracked $log + +set log [bcut r b1 b2] +isTracked $log + +set log [btuc r b1 b2] +isTracked $log + +set log [bsection r b1 b2] +isTracked $log + + +# bfillds + bbop + +bclearobjects +bcleartools +baddobjects b1 +baddtools b2 + +set log [bfillds] +isTracked $log + +set log [bbop r 0] +isTracked $log + +set log [bbop r 1] +isTracked $log + +set log [bbop r 2] +isTracked $log + +set log [bbop r 3] +isTracked $log + +set log [bbop r 4] +isTracked $log + +set log [bbuild r] +isTracked $log + +set log [bsplit r] +isTracked $log + + +# API + +set log [bapibop r 0] +isTracked $log + +set log [bapibop r 1] +isTracked $log + +set log [bapibop r 2] +isTracked $log + +set log [bapibop r 3] +isTracked $log + +set log [bapibop r 4] +isTracked $log + +set log [bapibuild r] +isTracked $log + +set log [bapisplit r] +isTracked $log + + +# bopcheck + +set log [bopcheck r] +isTracked $log