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.
15 #include <BRepAlgoAPI_Splitter.hxx>
17 #include <BOPAlgo_Alerts.hxx>
18 #include <BOPAlgo_Splitter.hxx>
20 //=======================================================================
21 // function: Empty constructor
23 //=======================================================================
24 BRepAlgoAPI_Splitter::BRepAlgoAPI_Splitter()
25 : BRepAlgoAPI_BuilderAlgo() {}
27 //=======================================================================
28 // function: Constructor with already prepared PaveFiller
30 //=======================================================================
31 BRepAlgoAPI_Splitter::BRepAlgoAPI_Splitter(const BOPAlgo_PaveFiller& thePF)
32 : BRepAlgoAPI_BuilderAlgo(thePF) {}
34 //=======================================================================
37 //=======================================================================
38 void BRepAlgoAPI_Splitter::Build()
40 // Set Not Done status by default
44 // Check for availability of arguments and tools
45 if (myArguments.IsEmpty() ||
46 (myArguments.Extent() + myTools.Extent()) < 2)
48 AddError (new BOPAlgo_AlertTooFewArguments);
52 // If necessary perform intersection of the argument shapes
53 if (myIsIntersectionNeeded)
55 // Combine Arguments and Tools for intersection into a single list
56 TopTools_ListOfShape aLArgs = myArguments;
57 for (TopTools_ListOfShape::Iterator it(myTools); it.More(); it.Next())
58 aLArgs.Append(it.Value());
60 // Perform intersection
61 IntersectShapes(aLArgs);
66 // Initialization of the building tool
67 myBuilder = new BOPAlgo_Splitter(myAllocator);
68 myBuilder->SetArguments(myArguments);
69 ((BOPAlgo_Splitter*)myBuilder)->SetTools(myTools);
71 // Build result shape basing on the intersection results