1 // Created by: Peter KURNEV
2 // Copyright (c) 2014 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_Builder.hxx>
17 #include <BOPAlgo_PaveFiller.hxx>
18 #include <BRepAlgoAPI_BuilderAlgo.hxx>
19 #include <TopoDS_Shape.hxx>
21 //=======================================================================
24 //=======================================================================
25 BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
32 myNonDestructive(Standard_False),
33 myGlue(BOPAlgo_GlueOff)
35 //=======================================================================
38 //=======================================================================
39 BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
40 (const BOPAlgo_PaveFiller& aPF)
46 myNonDestructive(Standard_False),
47 myGlue(BOPAlgo_GlueOff)
49 BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
52 //=======================================================================
55 //=======================================================================
56 BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo()
60 //=======================================================================
61 //function : SetFuzzyValue
63 //=======================================================================
64 void BRepAlgoAPI_BuilderAlgo::SetFuzzyValue(const Standard_Real theFuzz)
66 myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
68 //=======================================================================
69 //function : FuzzyValue
71 //=======================================================================
72 Standard_Real BRepAlgoAPI_BuilderAlgo::FuzzyValue() const
76 //=======================================================================
77 //function : SetNonDestructive
79 //=======================================================================
80 void BRepAlgoAPI_BuilderAlgo::SetNonDestructive(const Standard_Boolean theFlag)
82 myNonDestructive = theFlag;
84 //=======================================================================
85 //function : NonDestructive
87 //=======================================================================
88 Standard_Boolean BRepAlgoAPI_BuilderAlgo::NonDestructive() const
90 return myNonDestructive;
92 //=======================================================================
95 //=======================================================================
96 void BRepAlgoAPI_BuilderAlgo::SetGlue(const BOPAlgo_GlueEnum theGlue)
100 //=======================================================================
103 //=======================================================================
104 BOPAlgo_GlueEnum BRepAlgoAPI_BuilderAlgo::Glue() const
108 //=======================================================================
111 //=======================================================================
112 void BRepAlgoAPI_BuilderAlgo::Clear()
114 if (myDSFiller && myEntryType) {
123 //=======================================================================
124 //function : SetArguments
126 //=======================================================================
127 void BRepAlgoAPI_BuilderAlgo::SetArguments
128 (const TopTools_ListOfShape& theLS)
132 //=======================================================================
133 //function : Arguments
135 //=======================================================================
136 const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
140 //=======================================================================
143 //=======================================================================
144 void BRepAlgoAPI_BuilderAlgo::Build()
146 Standard_Integer iErr;
157 myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
159 myDSFiller->SetArguments(myArguments);
161 myDSFiller->SetRunParallel(myRunParallel);
162 myDSFiller->SetProgressIndicator(myProgressIndicator);
163 myDSFiller->SetFuzzyValue(myFuzzyValue);
164 myDSFiller->SetNonDestructive(myNonDestructive);
165 myDSFiller->SetGlue(myGlue);
167 myDSFiller->Perform();
168 iErr=myDSFiller->ErrorStatus();
170 myErrorStatus=100+iErr;
172 }// if (myEntryType) {
177 myBuilder=new BOPAlgo_Builder(myAllocator);
179 myBuilder->SetArguments(myArguments);
181 myBuilder->SetRunParallel(myRunParallel);
182 myBuilder->SetProgressIndicator(myProgressIndicator);
184 myBuilder->PerformWithFiller(*myDSFiller);
185 iErr=myBuilder->ErrorStatus();
187 myErrorStatus=200+iErr;
191 myShape=myBuilder->Shape();
193 //=======================================================================
194 //function : Generated
196 //=======================================================================
197 const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
198 (const TopoDS_Shape& aS)
200 if (myBuilder==NULL) {
204 myGenerated = myBuilder->Generated(aS);
207 //=======================================================================
208 //function : Modified
210 //=======================================================================
211 const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
212 (const TopoDS_Shape& aS)
214 if (myBuilder==NULL) {
218 myGenerated = myBuilder->Modified(aS);
221 //=======================================================================
222 //function : IsDeleted
224 //=======================================================================
225 Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
226 (const TopoDS_Shape& aS)
228 Standard_Boolean bDeleted = Standard_True;
229 if (myBuilder != NULL) {
230 bDeleted=myBuilder->IsDeleted(aS);
234 //=======================================================================
235 //function : HasModified
237 //=======================================================================
238 Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
240 if (myBuilder==NULL) {
241 return Standard_False;
243 return myBuilder->HasModified();
245 //=======================================================================
246 //function : HasGenerated
248 //=======================================================================
249 Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
251 if (myBuilder==NULL) {
252 return Standard_False;
254 return myBuilder->HasGenerated();
256 //=======================================================================
257 //function : HasDeleted
259 //=======================================================================
260 Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
262 if (myBuilder==NULL) {
263 return Standard_False;
265 return myBuilder->HasDeleted();