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)
34 //=======================================================================
37 //=======================================================================
38 BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
39 (const BOPAlgo_PaveFiller& aPF)
45 myNonDestructive(Standard_False)
47 BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
50 //=======================================================================
53 //=======================================================================
54 BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo()
58 //=======================================================================
59 //function : SetFuzzyValue
61 //=======================================================================
62 void BRepAlgoAPI_BuilderAlgo::SetFuzzyValue(const Standard_Real theFuzz)
64 myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
66 //=======================================================================
67 //function : FuzzyValue
69 //=======================================================================
70 Standard_Real BRepAlgoAPI_BuilderAlgo::FuzzyValue() const
74 //=======================================================================
75 //function : SetNonDestructive
77 //=======================================================================
78 void BRepAlgoAPI_BuilderAlgo::SetNonDestructive(const Standard_Boolean theFlag)
80 myNonDestructive = theFlag;
82 //=======================================================================
83 //function : NonDestructive
85 //=======================================================================
86 Standard_Boolean BRepAlgoAPI_BuilderAlgo::NonDestructive() const
88 return myNonDestructive;
90 //=======================================================================
93 //=======================================================================
94 void BRepAlgoAPI_BuilderAlgo::Clear()
96 if (myDSFiller && myEntryType) {
105 //=======================================================================
106 //function : SetArguments
108 //=======================================================================
109 void BRepAlgoAPI_BuilderAlgo::SetArguments
110 (const TopTools_ListOfShape& theLS)
114 //=======================================================================
115 //function : Arguments
117 //=======================================================================
118 const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
122 //=======================================================================
125 //=======================================================================
126 void BRepAlgoAPI_BuilderAlgo::Build()
128 Standard_Integer iErr;
139 myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
141 myDSFiller->SetArguments(myArguments);
143 myDSFiller->SetRunParallel(myRunParallel);
144 myDSFiller->SetProgressIndicator(myProgressIndicator);
145 myDSFiller->SetFuzzyValue(myFuzzyValue);
146 myDSFiller->SetNonDestructive(myNonDestructive);
148 myDSFiller->Perform();
149 iErr=myDSFiller->ErrorStatus();
151 myErrorStatus=100+iErr;
153 }// if (myEntryType) {
158 myBuilder=new BOPAlgo_Builder(myAllocator);
160 myBuilder->SetArguments(myArguments);
162 myBuilder->SetRunParallel(myRunParallel);
163 myBuilder->SetProgressIndicator(myProgressIndicator);
165 myBuilder->PerformWithFiller(*myDSFiller);
166 iErr=myBuilder->ErrorStatus();
168 myErrorStatus=200+iErr;
172 myShape=myBuilder->Shape();
174 //=======================================================================
175 //function : Generated
177 //=======================================================================
178 const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
179 (const TopoDS_Shape& aS)
181 if (myBuilder==NULL) {
185 myGenerated = myBuilder->Generated(aS);
188 //=======================================================================
189 //function : Modified
191 //=======================================================================
192 const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
193 (const TopoDS_Shape& aS)
195 if (myBuilder==NULL) {
199 myGenerated = myBuilder->Modified(aS);
202 //=======================================================================
203 //function : IsDeleted
205 //=======================================================================
206 Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
207 (const TopoDS_Shape& aS)
209 Standard_Boolean bDeleted = Standard_True;
210 if (myBuilder != NULL) {
211 bDeleted=myBuilder->IsDeleted(aS);
215 //=======================================================================
216 //function : HasModified
218 //=======================================================================
219 Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
221 if (myBuilder==NULL) {
222 return Standard_False;
224 return myBuilder->HasModified();
226 //=======================================================================
227 //function : HasGenerated
229 //=======================================================================
230 Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
232 if (myBuilder==NULL) {
233 return Standard_False;
235 return myBuilder->HasGenerated();
237 //=======================================================================
238 //function : HasDeleted
240 //=======================================================================
241 Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
243 if (myBuilder==NULL) {
244 return Standard_False;
246 return myBuilder->HasDeleted();