mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
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
132 lines
3.9 KiB
C++
132 lines
3.9 KiB
C++
// Created by: Eugeny MALTCHIKOV
|
|
// Copyright (c) 2017 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
// by the Free Software Foundation, with special exception defined in the file
|
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
// distribution for complete text of the license and disclaimer of any warranty.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
|
|
#include <BOPAlgo_Splitter.hxx>
|
|
#include <BOPAlgo_PaveFiller.hxx>
|
|
#include <BOPAlgo_Alerts.hxx>
|
|
|
|
#include <TopoDS_Iterator.hxx>
|
|
|
|
//=======================================================================
|
|
//function :
|
|
//purpose :
|
|
//=======================================================================
|
|
BOPAlgo_Splitter::BOPAlgo_Splitter()
|
|
: BOPAlgo_ToolsProvider()
|
|
{
|
|
}
|
|
//=======================================================================
|
|
//function :
|
|
//purpose :
|
|
//=======================================================================
|
|
BOPAlgo_Splitter::BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator)
|
|
: BOPAlgo_ToolsProvider(theAllocator)
|
|
{
|
|
}
|
|
//=======================================================================
|
|
//function : ~
|
|
//purpose :
|
|
//=======================================================================
|
|
BOPAlgo_Splitter::~BOPAlgo_Splitter()
|
|
{
|
|
}
|
|
//=======================================================================
|
|
// function: CheckData
|
|
// purpose:
|
|
//=======================================================================
|
|
void BOPAlgo_Splitter::CheckData()
|
|
{
|
|
if (myArguments.IsEmpty() ||
|
|
(myArguments.Extent() + myTools.Extent()) < 2) {
|
|
// too few arguments to process
|
|
AddError (new BOPAlgo_AlertTooFewArguments);
|
|
return;
|
|
}
|
|
//
|
|
CheckFiller();
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : Perform
|
|
//purpose :
|
|
//=======================================================================
|
|
void BOPAlgo_Splitter::Perform(const Message_ProgressRange& theRange)
|
|
{
|
|
GetReport()->Clear();
|
|
//
|
|
if (myEntryPoint == 1) {
|
|
if (myPaveFiller) {
|
|
delete myPaveFiller;
|
|
myPaveFiller = NULL;
|
|
}
|
|
}
|
|
//
|
|
// prepare shapes for intersection
|
|
TopTools_ListOfShape aLS;
|
|
//
|
|
TopTools_ListIteratorOfListOfShape aItLS(myArguments);
|
|
for (; aItLS.More(); aItLS.Next()) {
|
|
aLS.Append(aItLS.Value());
|
|
}
|
|
//
|
|
aItLS.Initialize(myTools);
|
|
for (; aItLS.More(); aItLS.Next()) {
|
|
aLS.Append(aItLS.Value());
|
|
}
|
|
//
|
|
BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
|
|
pPF->SetArguments(aLS);
|
|
pPF->SetRunParallel(myRunParallel);
|
|
|
|
pPF->SetFuzzyValue(myFuzzyValue);
|
|
pPF->SetNonDestructive(myNonDestructive);
|
|
pPF->SetGlue(myGlue);
|
|
pPF->SetUseOBB(myUseOBB);
|
|
//
|
|
Message_ProgressScope aPS(theRange, "Performing Split operation", 10);
|
|
pPF->Perform(aPS.Next(9));
|
|
//
|
|
myEntryPoint = 1;
|
|
PerformInternal(*pPF, aPS.Next(1));
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : BuildResult
|
|
//purpose :
|
|
//=======================================================================
|
|
void BOPAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType)
|
|
{
|
|
BOPAlgo_Builder::BuildResult(theType);
|
|
|
|
if (theType == TopAbs_COMPOUND)
|
|
{
|
|
// The method is called for the last time for this operation.
|
|
// If there is only one argument shape and it has been modified into
|
|
// a single shape, or has not been modified at all, the result shape
|
|
// has to be overwritten to avoid the unnecessary enclosure into compound.
|
|
if (myArguments.Extent() == 1)
|
|
{
|
|
TopoDS_Iterator it(myShape);
|
|
if (it.More())
|
|
{
|
|
const TopoDS_Shape& aSFirst = it.Value();
|
|
it.Next();
|
|
if (!it.More())
|
|
myShape = aSFirst;
|
|
}
|
|
}
|
|
}
|
|
}
|