// function: CheckData
// purpose:
//=======================================================================
-void BOPAlgo_Algo::CheckData()
+void BOPAlgo_Algo::CheckData(const Message_ProgressRange& /*theRange*/)
{
GetReport()->Clear(Message_Fail);
}
Standard_EXPORT BOPAlgo_Algo(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Checks input data
- Standard_EXPORT virtual void CheckData();
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange);
//! Checks the obtained result
Standard_EXPORT virtual void CheckResult();
//function : CheckData
//purpose :
//=======================================================================
-void BOPAlgo_BOP::CheckData()
+void BOPAlgo_BOP::CheckData(const Message_ProgressRange& theRange)
{
+ Message_ProgressScope aPS(theRange, "Cheching data", 1);
Standard_Integer i, j, aNbArgs, aNbTools;
Standard_Boolean bFuse;
TopTools_ListIteratorOfListOfShape aItLS;
myFuzzyValue = myPaveFiller->FuzzyValue();
myNonDestructive = myPaveFiller->NonDestructive();
//
+ Message_ProgressScope aPS(theRange, "PerformInternal", 100);
// 1. CheckData
- CheckData();
+ CheckData(aPS.Next(5));
if (HasErrors()) {
return;
}
}
}
//
- Message_ProgressScope aPS(theRange, "PerformInternal", 100);
NCollection_Array1<Standard_Real> aSteps = BOPAlgo_Builder::AnalyzeProgress();
// 3. Fill Images
// 3.1 Vertices
protected:
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
//! Performs calculations using prepared Filler
//! object <thePF>
// function: CheckData
// purpose:
//=======================================================================
-void BOPAlgo_Builder::CheckData()
+void BOPAlgo_Builder::CheckData(const Message_ProgressRange& theRange)
{
Standard_Integer aNb = myArguments.Extent();
+ Message_ProgressScope aPS(theRange, "Checking data", 1);
if (aNb<2) {
AddError (new BOPAlgo_AlertTooFewArguments); // too few arguments to process
return;
aSteps(i) = 0;
}
- Standard_Real aPart = 100.;
+ Standard_Real aPart = 95.;
Standard_Integer aNbV = myDS->ShapesSD().Size();
Standard_Integer aNbE = 0;
Standard_Integer aNbW = 0;
//
Message_ProgressScope aPS(theRange, "PerformInternal", 100);
// 1. CheckData
- CheckData();
+ CheckData(aPS.Next(5));
if (HasErrors()) {
return;
}
protected: //! @name Checking input arguments
//! Checks the input data.
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
//! Checks if the intersection algorithm has Errors/Warnings.
Standard_EXPORT void CheckFiller();
//function : CheckData
//purpose :
//=======================================================================
-void BOPAlgo_BuilderFace::CheckData()
+void BOPAlgo_BuilderFace::CheckData(const Message_ProgressRange& /*theRange*/)
{
if (myFace.IsNull()) {
AddError (new BOPAlgo_AlertNullInputShapes);
//function : Perform
//purpose :
//=======================================================================
-void BOPAlgo_BuilderFace::Perform(const Message_ProgressRange& /*theRange*/)
+void BOPAlgo_BuilderFace::Perform(const Message_ProgressRange& theRange)
{
GetReport()->Clear();
//
- CheckData();
+ Message_ProgressScope aPS(theRange, NULL, 1);
+ CheckData(aPS.Next());
if (HasErrors()) {
return;
}
//! Build finalized faces with internals
Standard_EXPORT virtual void PerformInternalShapes() Standard_OVERRIDE;
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
TopoDS_Face myFace;
//function : CheckData
//purpose :
//=======================================================================
-void BOPAlgo_MakerVolume::CheckData()
+void BOPAlgo_MakerVolume::CheckData(const Message_ProgressRange& theRange)
{
+ Message_ProgressScope aPS(theRange, "Checking data", 1);
if (myArguments.IsEmpty()) {
AddError (new BOPAlgo_AlertTooFewArguments); // no arguments to process
return;
myContext = myPaveFiller->Context();
//
// 1. CheckData
- CheckData();
+ Message_ProgressScope aPSOuter(theRange, NULL, myIntersect ? 100 : 5);
+ CheckData(aPSOuter.Next(5));
if (HasErrors()) {
return;
}
// 3. Fill Images
// 3.1. Vertice
if (myIntersect) {
- Message_ProgressScope aPS(theRange, "PerformInternal", 100);
+ Message_ProgressScope aPS(aPSOuter.Next(95), "PerformInternal", 100);
NCollection_Array1<Standard_Real> aSteps = AnalyzeProgress();
FillImagesVertices(aPS.Next(aSteps(0)));
protected:
//! Checks the data.
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
//! Analyze progress steps
Standard_EXPORT NCollection_Array1<Standard_Real> AnalyzeProgress() Standard_OVERRIDE;
// function: Perform
// purpose: Performs the removal of the requested faces from the input shape
//=======================================================================
-void BOPAlgo_RemoveFeatures::Perform(const Message_ProgressRange& /*theRange*/)
+void BOPAlgo_RemoveFeatures::Perform(const Message_ProgressRange& theRange)
{
try
{
if (HasHistory())
myHistory = new BRepTools_History();
-
+ Message_ProgressScope aPS(theRange, "Remove features", 100);
// Check the input data
- CheckData();
+ CheckData(aPS.Next(5));
if (HasErrors())
return;
// Prepare the faces to remove.
- PrepareFeatures();
+ PrepareFeatures(aPS.Next(10));
if (HasErrors())
return;
// Remove the features and fill the created gaps
- RemoveFeatures();
+ RemoveFeatures(aPS.Next(70));
+ if (HasErrors())
+ {
+ return;
+ }
// Update history with the removed features
- UpdateHistory();
+ UpdateHistory(aPS.Next(15));
+ if (HasErrors())
+ {
+ return;
+ }
// Simplify the result
SimplifyResult();
// function: CheckData
// purpose: Checks the input data on validity for the algorithm
//=======================================================================
-void BOPAlgo_RemoveFeatures::CheckData()
+void BOPAlgo_RemoveFeatures::CheckData(const Message_ProgressRange& theRange)
{
// Prepare the shape to work with
myShape = myInputShape;
// Check the type of input shape
const TopAbs_ShapeEnum aType = myInputShape.ShapeType();
+ Message_ProgressScope aPSOuter(theRange, "Checking data", 1);
+
if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID)
return; // OK
-
if (aType == TopAbs_COMPOUND)
{
TopTools_ListOfShape aShapes;
TopTools_ListOfShape aSolids;
TopTools_ListOfShape anOtherShapes;
TopTools_ListIteratorOfListOfShape aIt(aShapes);
- for (; aIt.More(); aIt.Next())
+ Message_ProgressScope aPS(aPSOuter.Next(), "Checking data", aShapes.Size());
+ for (; aIt.More(); aIt.Next(), aPS.Next())
{
+ if (UserBreak(aPS))
+ {
+ return;
+ }
const TopoDS_Shape& aS = aIt.Value();
if (aS.ShapeType() == TopAbs_SOLID || aS.ShapeType() == TopAbs_COMPSOLID)
aSolids.Append(aS);
// function: PrepareFeatures
// purpose: Prepares the features to remove
//=======================================================================
-void BOPAlgo_RemoveFeatures::PrepareFeatures()
+void BOPAlgo_RemoveFeatures::PrepareFeatures(const Message_ProgressRange& theRange)
{
// Map all sub-shapes of the input solids
TopExp::MapShapes(myInputShape, myInputsMap);
// Collect all faces of the input shape requested for removal
TopTools_ListOfShape aFacesToRemove;
TopTools_ListIteratorOfListOfShape aIt(myFacesToRemove);
- for (; aIt.More(); aIt.Next())
+ Message_ProgressScope aPS(theRange, "Preparing the faces to remove", myFacesToRemove.Size());
+ for (; aIt.More(); aIt.Next(), aPS.Next())
{
+ if (UserBreak(aPS))
+ {
+ return;
+ }
const TopoDS_Shape& aS = aIt.Value();
TopExp_Explorer anExpF(aS, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
return myHistory;
}
+ void SetRange(const Message_ProgressRange& theRange)
+ {
+ myRange = theRange;
+ }
+
public: //! @name Perform the operation
//! Performs the extension of the adjacent faces and
//! then trims the extended faces to fill the gaps
void Perform()
{
+ Message_ProgressScope aPS(myRange, NULL, 1);
+ if (!aPS.More())
+ {
+ return;
+ }
OCC_CATCH_SIGNALS
try
TopoDS_Shape myFeature; //!< Feature to remove
TopTools_IndexedDataMapOfShapeListOfShape* myEFMap; //!< EF Connection map to find adjacent faces
TopTools_IndexedDataMapOfShapeListOfShape* myFSMap; //!< FS Connection map to find solids participating in the feature removal
+ Message_ProgressRange myRange; //!< Indication of progress
// Results
TopTools_MapOfShape myFeatureFacesMap; //!< Faces of the feature
// purpose: Remove features by filling the gaps by extension of the
// adjacent faces
//=======================================================================
-void BOPAlgo_RemoveFeatures::RemoveFeatures()
+void BOPAlgo_RemoveFeatures::RemoveFeatures(const Message_ProgressRange& theRange)
{
// For each feature:
// - Find the faces adjacent to the feature;
VectorOfFillGap aVFG;
// Fill the vector
TopTools_ListIteratorOfListOfShape itF(myFeatures);
+ Message_ProgressScope aPSOuter(theRange, "Removing features", 100);
for (; itF.More(); itF.Next())
{
const TopoDS_Shape& aFeature = itF.Value();
aFG.SetEFConnectionMap(anEFMap);
aFG.SetFSConnectionMap(anFSMap);
aFG.SetRunParallel(myRunParallel);
+
+ }
+ const Standard_Integer aNbF = aVFG.Length();
+ Message_ProgressScope aPS(aPSOuter.Next(60), "Filling gaps", aNbF);
+ for (Standard_Integer i = 0; i < aNbF; ++i)
+ {
+ FillGap& aFG = aVFG.ChangeValue(i);
+ aFG.SetRange(aPS.Next());
}
// Perform the reconstruction of the adjacent faces
BOPTools_Parallel::Perform (myRunParallel, aVFG);
+ if (UserBreak(aPS))
+ {
+ return;
+ }
// Even if the history is not requested, it is necessary to track:
// - The solids modification after each feature removal to find
// Remove the features one by one.
// It will allow removing the features even if there were
// some problems with removal of the previous features.
- const Standard_Integer aNbF = aVFG.Length();
+ Message_ProgressScope aPS2(aPSOuter.Next(40), "Removing features one by one", aNbF);
for (Standard_Integer i = 0; i < aNbF; ++i)
{
+ if (UserBreak(aPS2))
+ {
+ return;
+ }
FillGap& aFG = aVFG(i);
// No need to fill the history for solids if the history is not
// Perform removal of the single feature
RemoveFeature(aFG.Feature(), aFG.Solids(), aFG.FeatureFacesMap(),
aFG.HasAdjacentFaces(), aFG.Faces(), aFG.History(),
- isSolidsHistoryNeeded);
+ isSolidsHistoryNeeded, aPS2.Next());
}
}
const Standard_Boolean theHasAdjacentFaces,
const TopTools_IndexedDataMapOfShapeListOfShape& theAdjFaces,
const Handle(BRepTools_History)& theAdjFacesHistory,
- const Standard_Boolean theSolidsHistoryNeeded)
+ const Standard_Boolean theSolidsHistoryNeeded,
+ const Message_ProgressRange& theRange)
{
Standard_Boolean bFuseShapes = Standard_True;
const Standard_Integer aNbAF = theAdjFaces.Extent();
+ Message_ProgressScope aPS(theRange, NULL, 1);
if (aNbAF == 0)
{
if (theHasAdjacentFaces)
// Add reconstructed adjacent faces
for (Standard_Integer i = 1; i <= aNbAF; ++i)
{
+ if (UserBreak(aPS))
+ {
+ return;
+ }
const TopTools_ListOfShape& aLFA = theAdjFaces(i);
if (aLFA.Extent() == 1)
{
}
// Build solids
- aMV.Perform();
+ aMV.Perform(aPS.Next());
if (aMV.HasErrors())
{
// Add warning for the feature
TopTools_MapOfShape anAdjFacesSplits;
for (Standard_Integer i = 1; i <= aNbAF; ++i)
{
+ if (UserBreak(aPS))
+ {
+ return;
+ }
const TopoDS_Shape& aF = theAdjFaces.FindKey(i);
const TopTools_ListOfShape& aLFIm = myHistory->Modified(aF);
if (aLFIm.IsEmpty())
aNbFK = aFacesToBeKept.Extent();
for (Standard_Integer i = 1; i <= aNbFK && bValid; ++i)
{
+ if (UserBreak(aPS))
+ {
+ return;
+ }
const TopoDS_Shape& aS = aFacesToBeKept(i);
if (anAdjFacesSplits.Contains(aS))
continue;
// function: UpdateHistory
// purpose: Update history with the removed features
//=======================================================================
-void BOPAlgo_RemoveFeatures::UpdateHistory()
+void BOPAlgo_RemoveFeatures::UpdateHistory(const Message_ProgressRange& theRange)
{
if (!HasHistory())
return;
BRepTools_History aHistory;
const Standard_Integer aNbS = myInputsMap.Extent();
- for (Standard_Integer i = 1; i <= aNbS; ++i)
+ Message_ProgressScope aPS(theRange, "Updating history", aNbS);
+ for (Standard_Integer i = 1; i <= aNbS; ++i, aPS.Next())
{
+ if (UserBreak(aPS))
+ {
+ return;
+ }
const TopoDS_Shape& aS = myInputsMap(i);
if (!BRepTools_History::IsSupportedType(aS))
continue;
//! If the input shape is not a solid, the method looks for the solids
//! in <myInputShape> and uses only them. All other shapes are simply removed.
//! If no solids were found, the Error of unsupported type is returned.
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
//! Prepares the faces to remove:
//! - Gets only faces contained in the input solids;
//! - Builds connected blocks of faces creating separate features to remove.
- Standard_EXPORT void PrepareFeatures();
+ Standard_EXPORT void PrepareFeatures(const Message_ProgressRange& theRange);
//! Removes the features and fills the created gaps by extension of the adjacent faces.
//! Processes each feature separately.
- Standard_EXPORT void RemoveFeatures();
+ Standard_EXPORT void RemoveFeatures(const Message_ProgressRange& theRange);
//! Remove the single feature from the shape.
//! @param theFeature [in] The feature to remove;
const Standard_Boolean theHasAdjacentFaces,
const TopTools_IndexedDataMapOfShapeListOfShape& theAdjFaces,
const Handle(BRepTools_History)& theAdjFacesHistory,
- const Standard_Boolean theSolidsHistoryNeeded);
+ const Standard_Boolean theSolidsHistoryNeeded,
+ const Message_ProgressRange& theRange);
//! Updates history with the removed features
- Standard_EXPORT void UpdateHistory();
+ Standard_EXPORT void UpdateHistory(const Message_ProgressRange& theRange);
//! Simplifies the result by removing extra edges and vertices created
//! during removal of the features.
//function : CheckData
//purpose :
//=======================================================================
-void BOPAlgo_Section::CheckData()
+void BOPAlgo_Section::CheckData(const Message_ProgressRange& theRange)
{
Standard_Integer aNbArgs;
//
+ Message_ProgressScope aPS(theRange, "Checking data", 1);
aNbArgs=myArguments.Extent();
if (!aNbArgs) {
AddError (new BOPAlgo_AlertTooFewArguments);
aSteps(i) = 0;
}
- Standard_Real aPart = 100.;
+ Standard_Real aPart = 95.;
Standard_Integer aNbV = myDS->ShapesSD().Size();
Standard_Integer aNbE = 0;
Standard_Integer aNbF = 0;
myDS=myPaveFiller->PDS();
myContext=myPaveFiller->Context();
//
+ Message_ProgressScope aPS(theRange, "Building result of SECTION operation", 100);
// 1. CheckData
- CheckData();
+ CheckData(aPS.Next(5));
if (HasErrors()) {
return;
}
return;
}
//
- Message_ProgressScope aPS(theRange, "Building result of SECTION operation", 100);
NCollection_Array1<Standard_Real> aSteps = AnalyzeProgress();
// 3. Fill Images
// 3.1 Vertices
protected:
//! Checks the data before performing the operation
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
//! Combine the result of section operation
Standard_EXPORT virtual void BuildSection(const Message_ProgressRange& theRange);
// function: CheckData
// purpose:
//=======================================================================
-void BOPAlgo_Splitter::CheckData()
+void BOPAlgo_Splitter::CheckData(const Message_ProgressRange& /*theRange*/)
{
if (myArguments.IsEmpty() ||
(myArguments.Extent() + myTools.Extent()) < 2) {
protected:
//! Checks the input data
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
//! Adds images of the argument shapes into result.
//! When called the for the last time (for compound) it rebuilds the result
// function: CheckData
// purpose:
//=======================================================================
-void BOPAlgo_WireSplitter::CheckData()
+void BOPAlgo_WireSplitter::CheckData(const Message_ProgressRange& /*theRange*/)
{
if (!myWES) {
AddError (new BOPAlgo_AlertNullInputShapes);
//function : Perform
//purpose :
//=======================================================================
-void BOPAlgo_WireSplitter::Perform(const Message_ProgressRange& /*theRange*/)
+void BOPAlgo_WireSplitter::Perform(const Message_ProgressRange& theRange)
{
GetReport()->Clear();
//
- CheckData();
+ Message_ProgressScope aPS(theRange, NULL, 1);
+ CheckData(aPS.Next());
if (HasErrors()) {
return;
}
protected:
- Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
+ Standard_EXPORT virtual void CheckData(const Message_ProgressRange& theRange) Standard_OVERRIDE;
Standard_EXPORT void MakeWires();
#include <DBRep.hxx>
#include <Draw.hxx>
+#include <Draw_ProgressIndicator.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
}
aRF.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
-
+ Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
// Perform the removal
- aRF.Build();
+ aRF.Build(aProgress->Start());
// Check for the errors/warnings
BOPTest::ReportAlerts(aRF.GetReport());
//function : Build
//purpose :
//=======================================================================
-void BRepAlgoAPI_Defeaturing::Build(const Message_ProgressRange& /*theRange*/)
+void BRepAlgoAPI_Defeaturing::Build(const Message_ProgressRange& theRange)
{
// Set not done state for the operation
NotDone();
myFeatureRemovalTool.SetRunParallel(myRunParallel);
// Perform the features removal
- myFeatureRemovalTool.Perform();
+ myFeatureRemovalTool.Perform(theRange);
// Merge the Errors/Warnings from the features removal tool
GetReport()->Merge(myFeatureRemovalTool.GetReport());