From 0a6ab1fd08f02e99f122481e737123e15af59acd Mon Sep 17 00:00:00 2001 From: akaftasev Date: Fri, 13 Aug 2021 19:48:57 +0300 Subject: [PATCH] Remarks from msv --- src/BOPAlgo/BOPAlgo_Alerts.hxx | 2 +- src/BOPAlgo/BOPAlgo_Algo.hxx | 13 ++++----- src/BOPAlgo/BOPAlgo_BOP.cxx | 5 ++-- src/BOPAlgo/BOPAlgo_Builder.cxx | 28 +++++++++++-------- src/BOPAlgo/BOPAlgo_Builder.hxx | 23 ++++++++------- src/BOPAlgo/BOPAlgo_BuilderFace.cxx | 2 +- src/BOPAlgo/BOPAlgo_Builder_1.cxx | 24 ++++++++-------- src/BOPAlgo/BOPAlgo_Builder_2.cxx | 5 ++-- src/BOPAlgo/BOPAlgo_Builder_3.cxx | 2 +- src/BOPAlgo/BOPAlgo_Builder_4.cxx | 9 +++--- src/BOPAlgo/BOPAlgo_CheckerSI.cxx | 2 +- src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx | 30 ++++++++++++-------- src/BOPAlgo/BOPAlgo_MakerVolume.cxx | 3 +- src/BOPAlgo/BOPAlgo_PaveFiller.cxx | 4 --- src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx | 2 +- src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx | 12 ++------ src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx | 31 ++++++++------------- src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx | 2 +- src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx | 31 +++++++++++---------- src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx | 8 ++---- src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx | 8 +++--- src/BOPAlgo/BOPAlgo_Section.cxx | 16 +++-------- src/BOPAlgo/BOPAlgo_Splitter.cxx | 3 +- src/BOPAlgo/BOPAlgo_Tools.cxx | 4 +-- src/BOPTest/BOPTest_PartitionCommands.cxx | 4 +-- src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx | 3 +- src/BRepFill/BRepFill_Draft.cxx | 6 ++-- 27 files changed, 131 insertions(+), 151 deletions(-) diff --git a/src/BOPAlgo/BOPAlgo_Alerts.hxx b/src/BOPAlgo/BOPAlgo_Alerts.hxx index 7a77adee1f..d670a6e437 100644 --- a/src/BOPAlgo/BOPAlgo_Alerts.hxx +++ b/src/BOPAlgo/BOPAlgo_Alerts.hxx @@ -18,7 +18,7 @@ #include -//! Boolean operation was stoped by user +//! Boolean operation was stopped by user DEFINE_SIMPLE_ALERT(BOPAlgo_AlertUserBreak) //! Boolean operation of given type is not allowed on the given inputs diff --git a/src/BOPAlgo/BOPAlgo_Algo.hxx b/src/BOPAlgo/BOPAlgo_Algo.hxx index ba5c0fd60f..8043b06bd1 100644 --- a/src/BOPAlgo/BOPAlgo_Algo.hxx +++ b/src/BOPAlgo/BOPAlgo_Algo.hxx @@ -37,7 +37,7 @@ public: //! 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; + Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0; protected: @@ -78,12 +78,12 @@ protected: //! @name Analyzing operations to fill progress indicator //! step1 = number_of_input_vertices; //! step2 = 2 * number_of_input_edges; //! step3 = 10 * number_of_input_faces. - //! Normalization of this values will be done automatically in analyzeProgress() method. + //! 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 cautious to create +//! 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 { @@ -117,10 +117,7 @@ public: BOPAlgo_PISteps(const Standard_Integer theNbOp) : mySteps(0, theNbOp - 1) { - for (Standard_Integer i = 0; i < theNbOp; ++i) - { - mySteps(i) = 0.; - } + mySteps.Init(0); } //! Returns the steps @@ -128,7 +125,7 @@ public: //! Returns modifiable steps TColStd_Array1OfReal& ChangeSteps() { return mySteps; } - //! Returns the step assigned to the operation + //! Assign the value theSteps to theOperation void SetStep(const Standard_Integer theOperation, const Standard_Real theStep) { if (theOperation >= mySteps.Lower() && theOperation <= mySteps.Upper()) diff --git a/src/BOPAlgo/BOPAlgo_BOP.cxx b/src/BOPAlgo/BOPAlgo_BOP.cxx index 1d78f1e411..de8e7ebf23 100644 --- a/src/BOPAlgo/BOPAlgo_BOP.cxx +++ b/src/BOPAlgo/BOPAlgo_BOP.cxx @@ -420,8 +420,6 @@ void BOPAlgo_BOP::fillPIConstants (const Standard_Real theWhole, BOPAlgo_PISteps void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, const Message_ProgressRange& theRange) { - Message_ProgressScope aPS (theRange, "Building the result of Boolean operation", 100); - myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller; myDS=myPaveFiller->PDS(); myContext=myPaveFiller->Context(); @@ -448,6 +446,7 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller, return; } } + Message_ProgressScope aPS(theRange, "Building the result of Boolean operation", 100); // BOPAlgo_PISteps aSteps (PIOperation_Last); analyzeProgress (100, aSteps); @@ -822,7 +821,7 @@ void BOPAlgo_BOP::BuildShape(const Message_ProgressRange& theRange) 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. diff --git a/src/BOPAlgo/BOPAlgo_Builder.cxx b/src/BOPAlgo/BOPAlgo_Builder.cxx index 8196cfd2f1..73c95d3140 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder.cxx @@ -302,11 +302,11 @@ void BOPAlgo_Builder::fillPIConstants (const Standard_Real theWhole, if (myFillHistory) { // for FillHistroty, which takes about 5% of the whole operation - theSteps.SetStep(PIOperation_FillHistory, 5. * theWhole / 100.); + theSteps.SetStep(PIOperation_FillHistory, 0.05 * theWhole); } // and for PostTreat, which takes about 3% of the whole operation - theSteps.SetStep(PIOperation_PostTreat, 3. * theWhole / 100.); + theSteps.SetStep(PIOperation_PostTreat, 0.03 * theWhole); } //======================================================================= @@ -476,7 +476,7 @@ void BOPAlgo_Builder::PostTreat(const Message_ProgressRange& theRange) // Message_ProgressScope aPS(theRange, "Post treatment of result shape", 2); BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05, myRunParallel); - aPS.Next().Close(); + aPS.Next(); BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA, myRunParallel); } @@ -484,11 +484,12 @@ void BOPAlgo_Builder::PostTreat(const Message_ProgressRange& theRange) //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; @@ -501,7 +502,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)) @@ -721,7 +721,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 @@ -730,7 +730,7 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, aBS.SetRunParallel(myRunParallel); aBS.SetContext(myContext); aBS.SetFuzzyValue(myFuzzyValue); - aBS.Perform(); + aBS.Perform(aPS.Next()); // Resulting solids TopTools_ListOfShape aResSolids; @@ -759,6 +759,10 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, } } } + else + { + return; + } // Collect unused faces TopoDS_Compound anUnUsedFaces; @@ -839,5 +843,5 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects, aBB.Add(aResult, itLS.Value()); myShape = aResult; - PrepareHistory(Message_ProgressRange()); + PrepareHistory(aPS.Next()); } diff --git a/src/BOPAlgo/BOPAlgo_Builder.hxx b/src/BOPAlgo/BOPAlgo_Builder.hxx index fc7fc59346..8d23567638 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.hxx +++ b/src/BOPAlgo/BOPAlgo_Builder.hxx @@ -217,11 +217,12 @@ public: //! @name BOPs on open solids //! @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); + 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,7 +284,7 @@ public: //! @name BOPs on open solids break; } } - BuildBOP(theObjects, anObjState, theTools, aToolsState, theReport); + BuildBOP(theObjects, anObjState, theTools, aToolsState, theRange, theReport); } protected: //! @name History methods diff --git a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx index c895387ff3..46addcede5 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx +++ b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx @@ -651,7 +651,7 @@ void BOPAlgo_BuilderFace::PerformInternalShapes(const Message_ProgressRange& the // Build BVH aBoxTree.Build(); - aMainScope.Next().Close(); + aMainScope.Next(); // Fence map TColStd_MapOfInteger aMEDone; diff --git a/src/BOPAlgo/BOPAlgo_Builder_1.cxx b/src/BOPAlgo/BOPAlgo_Builder_1.cxx index 47df33a248..125f91c5ab 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_1.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_1.cxx @@ -73,10 +73,6 @@ void BOPAlgo_Builder::FillImagesVertices(const Message_ProgressRange& theRange) Standard_Integer i, aNbS = myDS->NbSourceShapes(); Message_ProgressScope aPS(theRange, "Filling splits of edges", aNbS); for (i = 0; i < aNbS; ++i, aPS.Next()) { - if (UserBreak(aPS)) - { - return; - } const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i); if (aSI.ShapeType() != TopAbs_EDGE) { continue; @@ -115,6 +111,10 @@ void BOPAlgo_Builder::FillImagesVertices(const Message_ProgressRange& theRange) const TopoDS_Shape& aSp = myDS->Shape(nSp); myShapesSD.Bind(aSp, aSpR); } + if (UserBreak(aPS)) + { + return; + } } } } @@ -167,15 +167,15 @@ void BOPAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType) 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()) { } //======================================================================= @@ -190,15 +190,15 @@ void BOPAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType) aNbS=myDS->NbSourceShapes(); Message_ProgressScope aPS(theRange, "Building splits of compounds", aNbS); 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 d51d462ecf..5611cc04f7 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_2.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_2.cxx @@ -152,7 +152,6 @@ private: virtual void Perform(const Message_ProgressRange& /*theRange*/) {}; private: - TopoDS_Solid mySolid; //!< Solid to split Message_ProgressRange myRange; }; typedef NCollection_Vector BOPAlgo_VectorOfBuilderFace; @@ -506,7 +505,7 @@ void BOPAlgo_Builder::BuildSplitFaces(const Message_ProgressRange& theRange) }// for (i=0; iShape(i); // Check if History information is available for this kind of shape. 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_CheckerSI.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx index a1d0a4920f..6c93b78613 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -451,7 +451,7 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection(const Message_ProgressRange& t Standard_Integer aNbFace = aVFace.Length(); Message_ProgressScope aPSParallel(aPSOuter.Next(), "Checking surface on self-intersection", aNbFace); - for (Standard_Integer iF = 0; iF < aVFace.Size(); ++iF) + for (Standard_Integer iF = 0; iF < aNbFace; ++iF) { aVFace.ChangeValue(iF).SetProgressRange(aPSParallel.Next()); } diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx index 05db010e0e..f8ab363c34 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx @@ -41,12 +41,11 @@ //class : BOPAlgo_VertexSolid //purpose : //======================================================================= -class BOPAlgo_VertexSolid : public BOPAlgo_ParallelAlgo { +class BOPAlgo_VertexSolid { public: DEFINE_STANDARD_ALLOC BOPAlgo_VertexSolid() : - BOPAlgo_ParallelAlgo(), myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) { }; // @@ -93,9 +92,14 @@ class BOPAlgo_VertexSolid : public BOPAlgo_ParallelAlgo { return myState; }; // + void SetProgressRange(const Message_ProgressRange& theRange) + { + myProgressRange = theRange; + } + // virtual void Perform() { Message_ProgressScope aPS(myProgressRange, NULL, 1); - if (UserBreak(aPS)) + if (!aPS.More()) { return; } @@ -120,6 +124,7 @@ class BOPAlgo_VertexSolid : public BOPAlgo_ParallelAlgo { TopoDS_Vertex myV; TopoDS_Solid myZ; Handle(IntTools_Context) myContext; + Message_ProgressRange myProgressRange; }; //======================================================================= typedef NCollection_Vector BOPAlgo_VectorOfVertexSolid; @@ -129,12 +134,11 @@ typedef NCollection_Vector BOPAlgo_VectorOfVertexSolid; //class : BOPAlgo_ShapeSolid //purpose : //======================================================================= -class BOPAlgo_ShapeSolid: public BOPAlgo_ParallelAlgo { +class BOPAlgo_ShapeSolid { public: DEFINE_STANDARD_ALLOC BOPAlgo_ShapeSolid() : - BOPAlgo_ParallelAlgo(), myIE(-1), myIZ(-1), myHasInterf(Standard_False), @@ -164,9 +168,14 @@ class BOPAlgo_ShapeSolid: public BOPAlgo_ParallelAlgo { return myHasInterf; }; // + void SetProgressRange(const Message_ProgressRange& theRange) + { + myProgressRange = theRange; + } + // virtual void Perform() { Message_ProgressScope aPS(myProgressRange, NULL, 1); - if (UserBreak(aPS)) + if (!aPS.More()) { return; } @@ -186,6 +195,7 @@ class BOPAlgo_ShapeSolid: public BOPAlgo_ParallelAlgo { Standard_Integer myIZ; Standard_Boolean myHasInterf; BOPDS_DS* myDS; + Message_ProgressRange myProgressRange; }; //======================================================================= typedef NCollection_Vector BOPAlgo_VectorOfShapeSolid; @@ -208,7 +218,7 @@ class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid { // virtual void Perform() { Message_ProgressScope aPS(myProgressRange, NULL, 1); - if (UserBreak(aPS)) + if (!aPS.More()) { return; } @@ -223,6 +233,8 @@ class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid { myHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ, bFlag); } }; +protected: + Message_ProgressRange myProgressRange; }; //======================================================================= typedef NCollection_Vector BOPAlgo_VectorOfSolidSolid; @@ -401,10 +413,6 @@ void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum theTS, const Message_Pr BOPAlgo_VectorOfShapeSolid aVShapeSolid; // for (; myIterator->More(); myIterator->Next()) { - if (UserBreak(aPSOuter)) - { - return; - } myIterator->Value(nS, nZ); // BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Appended(); diff --git a/src/BOPAlgo/BOPAlgo_MakerVolume.cxx b/src/BOPAlgo/BOPAlgo_MakerVolume.cxx index dec0aae836..bd1cd3a420 100644 --- a/src/BOPAlgo/BOPAlgo_MakerVolume.cxx +++ b/src/BOPAlgo/BOPAlgo_MakerVolume.cxx @@ -95,8 +95,9 @@ void BOPAlgo_MakerVolume::Perform(const Message_ProgressRange& theRange) pPF->SetGlue(myGlue); pPF->SetUseOBB(myUseOBB); pPF->Perform(aPS.Next(anInterPart)); - if (HasErrors()) + if (pPF->HasErrors()) { + AddError(new BOPAlgo_AlertUserBreak); return; } // diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx index f371c6a797..afe18b1e8d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx @@ -382,10 +382,6 @@ void BOPAlgo_PaveFiller::RepeatIntersection (const Message_ProgressRange& theRan Message_ProgressScope aPS (theRange, "Repeat intersection", 3); for (Standard_Integer i = 0; i < aNbS; ++i) { - if (UserBreak (aPS)) - { - return; - } const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo (i); if (aSI.ShapeType() != TopAbs_VERTEX) continue; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx index 65f15f879b..aa1e754562 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx @@ -130,7 +130,7 @@ void BOPAlgo_PaveFiller::PerformVV(const Message_ProgressRange& theRange) } //======================================================================= -// 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 b82966efdb..c91453ec4f 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx @@ -286,7 +286,7 @@ void BOPAlgo_PaveFiller::IntersectVE aNbVE = aVVE.Length(); Message_ProgressScope aPS(aPSOuter.Next(9), "Performing Vertex-Edge intersection", aNbVE); - for (i = 0; i < aVVE.Length(); i++) + for (i = 0; i < aNbVE; i++) { BOPAlgo_VertexEdge& aVESolver = aVVE.ChangeValue(i); aVESolver.SetProgressRange(aPS.Next()); @@ -295,7 +295,7 @@ void BOPAlgo_PaveFiller::IntersectVE //============================================================= BOPTools_Parallel::Perform (myRunParallel, aVVE, myContext); //============================================================= - if (HasErrors()) + if (UserBreak(aPSOuter)) { return; } @@ -334,10 +334,6 @@ void BOPAlgo_PaveFiller::IntersectVE BOPDS_ListOfPaveBlock::Iterator itPB (aLPB); for (; itPB.More(); itPB.Next()) { - if (UserBreak(aPSOuter)) - { - return; - } aPB = itPB.Value(); Standard_Real aT1, aT2; aPB->Range (aT1, aT2); @@ -359,10 +355,6 @@ void BOPAlgo_PaveFiller::IntersectVE const TColStd_ListOfInteger& aLI = aDMVSD.Find(aPair); TColStd_ListIteratorOfListOfInteger aItLI(aLI); for (; aItLI.More(); aItLI.Next()) { - if (UserBreak(aPSOuter)) - { - return; - } const Standard_Integer nVOld = aItLI.Value(); // 3. Create interference V/E BOPDS_InterfVE& aVE = aVEs.Appended(); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx index 9eb030eeb6..0d31a176bf 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx @@ -238,10 +238,6 @@ void BOPAlgo_PaveFiller::PerformEE(const Message_ProgressRange& theRange) // aIt2.Initialize(aLPB2); for (; aIt2.More(); aIt2.Next()) { - if (UserBreak(aPSOuter)) - { - return; - } Bnd_Box aBB2; // Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue(); @@ -285,7 +281,7 @@ void BOPAlgo_PaveFiller::PerformEE(const Message_ProgressRange& theRange) //====================================================== BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge); //====================================================== - if (HasErrors()) + if (UserBreak(aPSOuter)) { return; } @@ -624,10 +620,6 @@ void BOPAlgo_PaveFiller::PerformNewVertices // TopTools_ListIteratorOfListOfShape aItLS(aLVSD); for (; aItLS.More(); aItLS.Next()) { - if (UserBreak(aPS)) - { - return; - } const TopoDS_Shape& aVx = aItLS.Value(); BOPDS_CoupleOfPaveBlocks &aCPB = theMVCPB.ChangeFromKey(aVx); aCPB.SetIndex(iV); @@ -963,16 +955,16 @@ void BOPAlgo_PaveFiller::ForceInterfEE(const Message_ProgressRange& theRange) const Standard_Integer aNbS = myDS->NbSourceShapes(); for (Standard_Integer i = 0; i < aNbS; ++i) { - if (UserBreak(aPSOuter)) - { - return; - } const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i); if (aSI.ShapeType() == TopAbs_VERTEX) { 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 @@ -984,10 +976,6 @@ void BOPAlgo_PaveFiller::ForceInterfEE(const Message_ProgressRange& theRange) for (Standard_Integer i = 0; i < aNbS; ++i) { - if (UserBreak(aPSOuter)) - { - return; - } const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i); if (aSI.ShapeType() != TopAbs_EDGE) // Not an edge @@ -1000,7 +988,10 @@ void BOPAlgo_PaveFiller::ForceInterfEE(const Message_ProgressRange& theRange) if (aSI.HasFlag()) // Degenerated edge continue; - + if (UserBreak(aPSOuter)) + { + return; + } const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(i); BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB); for (; aItLPB.More(); aItLPB.Next()) @@ -1157,7 +1148,7 @@ void BOPAlgo_PaveFiller::ForceInterfEE(const Message_ProgressRange& theRange) return; // close preparation step - aPSOuter.Next(0.7).Close(); + aPSOuter.Next(0.7); aPBMap.Clear(); aMPBFence.Clear(); @@ -1172,7 +1163,7 @@ void BOPAlgo_PaveFiller::ForceInterfEE(const Message_ProgressRange& theRange) // Perform intersection of the found pairs BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge); - if (HasErrors()) + if (UserBreak(aPSOuter)) { return; } diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx index 0eca3667a7..6b5287a022 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx @@ -238,7 +238,7 @@ void BOPAlgo_PaveFiller::PerformVF(const Message_ProgressRange& theRange) //================================================================ BOPTools_Parallel::Perform (myRunParallel, aVVF, myContext); //================================================================ - if (HasErrors()) + if (UserBreak(aPSOuter)) { return; } diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx index 77b8c718df..827135c9b4 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx @@ -310,7 +310,7 @@ void BOPAlgo_PaveFiller::PerformEF(const Message_ProgressRange& theRange) //================================================================= BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext); //================================================================= - if (HasErrors()) + if (UserBreak(aPSOuter)) { return; } @@ -782,10 +782,6 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const Message_ProgressRange& theRange) const Standard_Integer aNbS = myDS->NbSourceShapes(); for (Standard_Integer nE = 0; nE < aNbS; ++nE) { - if (UserBreak(aPS)) - { - return; - } const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nE); if (aSI.ShapeType() != TopAbs_EDGE) // Not an edge @@ -799,6 +795,10 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const Message_ProgressRange& theRange) // Degenerated edge continue; + if (UserBreak(aPS)) + { + return; + } const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(nE); BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB); for (; aItLPB.More(); aItLPB.Next()) @@ -835,10 +835,6 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB Standard_Integer aNbPB = theMPB.Extent(); for (Standard_Integer iPB = 1; iPB <= aNbPB; ++iPB) { - if (UserBreak(aPSOuter)) - { - return; - } Handle(BOPDS_PaveBlock) aPB = theMPB(iPB); if (!aPB->HasShrunkData() || !myDS->IsValidShrunkData(aPB)) { @@ -846,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; @@ -867,10 +867,6 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB const Standard_Integer aNbS = myDS->NbSourceShapes(); for (Standard_Integer nF = 0; nF < aNbS; ++nF) { - if (UserBreak(aPSOuter)) - { - return; - } const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(nF); if (aSI.ShapeType() != TopAbs_FACE) // Not a face @@ -880,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)); @@ -1072,7 +1073,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB } // close preparation step - aPSOuter.Next(0.7).Close(); + aPSOuter.Next(0.7); aPBMap.Clear(); anAlloc->Reset(); @@ -1085,7 +1086,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB } // Perform intersection of the found pairs BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext); - if (HasErrors()) + if (UserBreak(aPSOuter)) { return; } diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 46e4fa1d42..51558709ab 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -330,7 +330,7 @@ void BOPAlgo_PaveFiller::PerformFF(const Message_ProgressRange& theRange) // Standard_Integer k, aNbFaceFace = aVFaceFace.Length();; Message_ProgressScope aPS(aPSOuter.Next(), "Performing Face-Face intersection", aNbFaceFace); - for (k = 0; k < aVFaceFace.Size(); k++) + for (k = 0; k < aNbFaceFace; k++) { BOPAlgo_FaceFace& aFaceFace = aVFaceFace.ChangeValue(k); aFaceFace.SetProgressRange(aPS.Next()); @@ -338,7 +338,7 @@ void BOPAlgo_PaveFiller::PerformFF(const Message_ProgressRange& theRange) //====================================================== // Perform intersection BOPTools_Parallel::Perform (myRunParallel, aVFaceFace); - if (HasErrors()) + if (UserBreak(aPSOuter)) { return; } @@ -3704,10 +3704,6 @@ void BOPAlgo_PaveFiller::PutSEInOtherFaces(const Message_ProgressRange& theRange Message_ProgressScope aPS(theRange, NULL, 1); for (Standard_Integer i = 0; i < aNbFF; ++i) { - if (UserBreak(aPS)) - { - return; - } const BOPDS_VectorOfCurve& aVNC = aFFs(i).Curves(); const Standard_Integer aNbC = aVNC.Length(); for (Standard_Integer j = 0; j < aNbC; ++j) diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx index 1a2ab61bbb..d71031252d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_8.cxx @@ -80,10 +80,6 @@ void BOPAlgo_PaveFiller::ProcessDE(const Message_ProgressRange& theRange) // aNb=myDS->NbSourceShapes(); for (nE=0; nEShapeInfo(nE); if (aSIE.ShapeType()==TopAbs_EDGE) { if (aSIE.HasFlag(nF)) { @@ -137,6 +133,10 @@ void BOPAlgo_PaveFiller::ProcessDE(const Message_ProgressRange& theRange) aPBD->SetEdge(nEn); } } + if (UserBreak(aPSOuter)) + { + return; + } } } } diff --git a/src/BOPAlgo/BOPAlgo_Section.cxx b/src/BOPAlgo/BOPAlgo_Section.cxx index f792974d4c..e889a5c514 100644 --- a/src/BOPAlgo/BOPAlgo_Section.cxx +++ b/src/BOPAlgo/BOPAlgo_Section.cxx @@ -203,14 +203,14 @@ void BOPAlgo_Section::BuildSection(const Message_ProgressRange& theRange) // 1. aRC1 aNb=myDS->NbSourceShapes(); for (i=0; iShapeInfo(i); if (aSI.ShapeType()!=TopAbs_FACE) { continue; } + if (UserBreak(aPS)) + { + return; + } // const BOPDS_FaceInfo& aFI=myDS->FaceInfo(i); // @@ -254,10 +254,6 @@ void BOPAlgo_Section::BuildSection(const Message_ProgressRange& theRange) // aNb=aPBP.Size(); for (i=0; i1) { diff --git a/src/BOPAlgo/BOPAlgo_Splitter.cxx b/src/BOPAlgo/BOPAlgo_Splitter.cxx index 735b83eda1..e350c63c82 100644 --- a/src/BOPAlgo/BOPAlgo_Splitter.cxx +++ b/src/BOPAlgo/BOPAlgo_Splitter.cxx @@ -97,8 +97,9 @@ void BOPAlgo_Splitter::Perform(const Message_ProgressRange& theRange) // Message_ProgressScope aPS(theRange, "Performing Split operation", 10); pPF->Perform(aPS.Next(9)); - if (HasErrors()) + if (pPF->HasErrors()) { + AddError(new BOPAlgo_AlertUserBreak); return; } // diff --git a/src/BOPAlgo/BOPAlgo_Tools.cxx b/src/BOPAlgo/BOPAlgo_Tools.cxx index 8bc5b551d9..c102ed7c53 100644 --- a/src/BOPAlgo/BOPAlgo_Tools.cxx +++ b/src/BOPAlgo/BOPAlgo_Tools.cxx @@ -1338,7 +1338,7 @@ void BOPAlgo_FillIn3DParts::Perform() MapEdgesAndFaces(aVShapeBox(aIVec(k)).Shape(), aMEFP, anAlloc); } - aPSOuter.Next().Close(); + aPSOuter.Next(); // Map of Edge-Face connection, necessary for solid classification. // It will be filled when first classification is performed. @@ -1588,7 +1588,7 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces, } // Close preparation task - aPSOuter.Next().Close(); + 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); diff --git a/src/BOPTest/BOPTest_PartitionCommands.cxx b/src/BOPTest/BOPTest_PartitionCommands.cxx index 13ad4f919b..b85f70110e 100644 --- a/src/BOPTest/BOPTest_PartitionCommands.cxx +++ b/src/BOPTest/BOPTest_PartitionCommands.cxx @@ -573,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/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx index d89a009064..740a7fa66b 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx @@ -113,7 +113,6 @@ void BRepAlgoAPI_BuilderAlgo::Build(const Message_ProgressRange& theRange) //======================================================================= void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArgs, const Message_ProgressRange& theRange) { - Message_ProgressScope aPS(theRange, NULL, 1); if (!myIsIntersectionNeeded) return; @@ -134,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(aPS.Next()); + myDSFiller->Perform(theRange); // Check for the errors during intersection GetReport()->Merge(myDSFiller->GetReport()); } 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; -- 2.39.5