0029312: Using OBB to speed up Boolean Operations
[occt.git] / src / BOPAlgo / BOPAlgo_Splitter.cxx
CommitLineData
c58055ad 1// Created by: Eugeny MALTCHIKOV
2// Copyright (c) 2017 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15
16#include <BOPAlgo_Splitter.hxx>
17#include <BOPAlgo_PaveFiller.hxx>
33ba8565 18#include <BOPAlgo_Alerts.hxx>
c58055ad 19
20//=======================================================================
21//function :
22//purpose :
23//=======================================================================
24BOPAlgo_Splitter::BOPAlgo_Splitter()
5fbe3d01 25: BOPAlgo_ToolsProvider()
c58055ad 26{
27}
28//=======================================================================
29//function :
30//purpose :
31//=======================================================================
5fbe3d01 32BOPAlgo_Splitter::BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator)
33: BOPAlgo_ToolsProvider(theAllocator)
c58055ad 34{
35}
36//=======================================================================
37//function : ~
38//purpose :
39//=======================================================================
40BOPAlgo_Splitter::~BOPAlgo_Splitter()
41{
42}
c58055ad 43//=======================================================================
44// function: CheckData
45// purpose:
46//=======================================================================
47void BOPAlgo_Splitter::CheckData()
48{
c58055ad 49 if (myArguments.IsEmpty() ||
50 (myArguments.Extent() + myTools.Extent()) < 2) {
51 // too few arguments to process
33ba8565 52 AddError (new BOPAlgo_AlertTooFewArguments);
c58055ad 53 return;
54 }
55 //
33ba8565 56 CheckFiller();
c58055ad 57}
58
59//=======================================================================
60//function : Perform
61//purpose :
62//=======================================================================
63void BOPAlgo_Splitter::Perform()
64{
33ba8565 65 GetReport()->Clear();
c58055ad 66 //
67 if (myEntryPoint == 1) {
68 if (myPaveFiller) {
69 delete myPaveFiller;
70 myPaveFiller = NULL;
71 }
72 }
73 //
74 // prepare shapes for intersection
1155d05a 75 TopTools_ListOfShape aLS;
c58055ad 76 //
1155d05a 77 TopTools_ListIteratorOfListOfShape aItLS(myArguments);
c58055ad 78 for (; aItLS.More(); aItLS.Next()) {
79 aLS.Append(aItLS.Value());
80 }
81 //
82 aItLS.Initialize(myTools);
83 for (; aItLS.More(); aItLS.Next()) {
84 aLS.Append(aItLS.Value());
85 }
86 //
87 BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
88 pPF->SetArguments(aLS);
89 pPF->SetRunParallel(myRunParallel);
90 pPF->SetProgressIndicator(myProgressIndicator);
91 pPF->SetFuzzyValue(myFuzzyValue);
92 pPF->SetNonDestructive(myNonDestructive);
93 pPF->SetGlue(myGlue);
944768d2 94 pPF->SetUseOBB(myUseOBB);
c58055ad 95 //
96 pPF->Perform();
97 //
98 myEntryPoint = 1;
99 PerformInternal(*pPF);
100}