1 // Created by: Eugeny MALTCHIKOV
2 // Copyright (c) 2017 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <BOPAlgo_Splitter.hxx>
17 #include <BOPAlgo_PaveFiller.hxx>
18 #include <BOPAlgo_Alerts.hxx>
20 //=======================================================================
23 //=======================================================================
24 BOPAlgo_Splitter::BOPAlgo_Splitter()
28 myMapTools(100, myAllocator)
31 //=======================================================================
34 //=======================================================================
35 BOPAlgo_Splitter::BOPAlgo_Splitter
36 (const Handle(NCollection_BaseAllocator)& theAllocator)
38 BOPAlgo_Builder(theAllocator),
40 myMapTools(100, myAllocator)
43 //=======================================================================
46 //=======================================================================
47 BOPAlgo_Splitter::~BOPAlgo_Splitter()
50 //=======================================================================
53 //=======================================================================
54 void BOPAlgo_Splitter::Clear()
56 BOPAlgo_Builder::Clear();
60 //=======================================================================
63 //=======================================================================
64 void BOPAlgo_Splitter::AddTool(const TopoDS_Shape& theShape)
66 if (myMapTools.Add(theShape)) {
67 myTools.Append(theShape);
70 //=======================================================================
73 //=======================================================================
74 void BOPAlgo_Splitter::SetTools(const BOPCol_ListOfShape& theShapes)
77 BOPCol_ListIteratorOfListOfShape aIt(theShapes);
78 for (; aIt.More(); aIt.Next()) {
83 //=======================================================================
84 // function: CheckData
86 //=======================================================================
87 void BOPAlgo_Splitter::CheckData()
89 if (myArguments.IsEmpty() ||
90 (myArguments.Extent() + myTools.Extent()) < 2) {
91 // too few arguments to process
92 AddError (new BOPAlgo_AlertTooFewArguments);
99 //=======================================================================
102 //=======================================================================
103 void BOPAlgo_Splitter::Perform()
105 GetReport()->Clear();
107 if (myEntryPoint == 1) {
114 // prepare shapes for intersection
115 BOPCol_ListOfShape aLS;
117 BOPCol_ListIteratorOfListOfShape aItLS(myArguments);
118 for (; aItLS.More(); aItLS.Next()) {
119 aLS.Append(aItLS.Value());
122 aItLS.Initialize(myTools);
123 for (; aItLS.More(); aItLS.Next()) {
124 aLS.Append(aItLS.Value());
127 BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
128 pPF->SetArguments(aLS);
129 pPF->SetRunParallel(myRunParallel);
130 pPF->SetProgressIndicator(myProgressIndicator);
131 pPF->SetFuzzyValue(myFuzzyValue);
132 pPF->SetNonDestructive(myNonDestructive);
133 pPF->SetGlue(myGlue);
138 PerformInternal(*pPF);