0025242: Wrong result of cut operation.
[occt.git] / src / BOPAlgo / BOPAlgo_PaveFiller.cxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 2010-2014 OPEN CASCADE SAS
4e57c75e 3// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6//
973c2be1 7// This file is part of Open CASCADE Technology software library.
4e57c75e 8//
d5f74e42 9// This library is free software; you can redistribute it and/or modify it under
10// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 11// by the Free Software Foundation, with special exception defined in the file
12// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13// distribution for complete text of the license and disclaimer of any warranty.
4e57c75e 14//
973c2be1 15// Alternatively, this file may be used under the terms of Open CASCADE
16// commercial license or contractual agreement.
4e57c75e 17
18#include <BOPAlgo_PaveFiller.ixx>
19
6f31882a 20#include <Standard_ErrorHandler.hxx>
21#include <Standard_Failure.hxx>
22
4e57c75e 23#include <NCollection_BaseAllocator.hxx>
24
1e143abb 25#include <IntTools_Context.hxx>
4e57c75e 26#include <BOPDS_DS.hxx>
27#include <BOPDS_Iterator.hxx>
28
6f31882a 29
4e57c75e 30//=======================================================================
31//function :
32//purpose :
33//=======================================================================
6f31882a 34BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
4e57c75e 35:
36 BOPAlgo_Algo()
37{
38 myDS=NULL;
39 myIterator=NULL;
40}
41//=======================================================================
42//function :
43//purpose :
44//=======================================================================
6f31882a 45BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
46 (const Handle(NCollection_BaseAllocator)& theAllocator)
4e57c75e 47:
48 BOPAlgo_Algo(theAllocator)
49{
50 myDS=NULL;
51 myIterator=NULL;
52}
53//=======================================================================
54//function : ~
55//purpose :
56//=======================================================================
6f31882a 57BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
4e57c75e 58{
59 Clear();
60}
61//=======================================================================
62//function : Clear
63//purpose :
64//=======================================================================
6f31882a 65void BOPAlgo_PaveFiller::Clear()
4e57c75e 66{
67 if (myIterator) {
68 delete myIterator;
69 myIterator=NULL;
70 }
71 if (myDS) {
72 delete myDS;
73 myDS=NULL;
74 }
4e57c75e 75}
76//=======================================================================
77//function : DS
78//purpose :
79//=======================================================================
6f31882a 80const BOPDS_DS& BOPAlgo_PaveFiller::DS()
4e57c75e 81{
82 return *myDS;
83}
84//=======================================================================
85//function : PDS
86//purpose :
87//=======================================================================
6f31882a 88BOPDS_PDS BOPAlgo_PaveFiller::PDS()
4e57c75e 89{
90 return myDS;
91}
92//=======================================================================
93//function : Context
94//purpose :
95//=======================================================================
1e143abb 96Handle(IntTools_Context) BOPAlgo_PaveFiller::Context()
4e57c75e 97{
98 return myContext;
99}
100//=======================================================================
101//function : SectionAttribute
102//purpose :
103//=======================================================================
6f31882a 104void BOPAlgo_PaveFiller::SetSectionAttribute
105 (const BOPAlgo_SectionAttribute& theSecAttr)
4e57c75e 106{
107 mySectionAttribute = theSecAttr;
108}
109//=======================================================================
110//function : SetArguments
111//purpose :
112//=======================================================================
6f31882a 113void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
4e57c75e 114{
115 myArguments=theLS;
116}
117//=======================================================================
118//function : Arguments
119//purpose :
120//=======================================================================
6f31882a 121const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
4e57c75e 122{
123 return myArguments;
124}
125//=======================================================================
126// function: Init
127// purpose:
128//=======================================================================
6f31882a 129void BOPAlgo_PaveFiller::Init()
4e57c75e 130{
131 myErrorStatus=0;
132 //
133 if (!myArguments.Extent()) {
134 myErrorStatus=10;
135 return;
136 }
137 //
138 // 0 Clear
139 Clear();
140 //
141 // 1.myDS
142 myDS=new BOPDS_DS(myAllocator);
143 myDS->SetArguments(myArguments);
144 myDS->Init();
145 //
146 // 2.myIterator
147 myIterator=new BOPDS_Iterator(myAllocator);
a2098360 148 myIterator->SetRunParallel(myRunParallel);
4e57c75e 149 myIterator->SetDS(myDS);
150 myIterator->Prepare();
151 //
152 // 3 myContext
1e143abb 153 myContext=new IntTools_Context;
4e57c75e 154 //
155 myErrorStatus=0;
156}
157//=======================================================================
158// function: Perform
159// purpose:
160//=======================================================================
6f31882a 161void BOPAlgo_PaveFiller::Perform()
4e57c75e 162{
163 myErrorStatus=0;
6f31882a 164 try {
165 OCC_CATCH_SIGNALS
166 //
36f4947b 167 PerformInternal();
168 }
169 //
6f31882a 170 catch (Standard_Failure) {
171 myErrorStatus=11;
36f4947b 172 }
4e57c75e 173}
36f4947b 174//=======================================================================
175// function: PerformInternal
176// purpose:
177//=======================================================================
178void BOPAlgo_PaveFiller::PerformInternal()
179{
180 myErrorStatus=0;
181 //
182 Init();
183 if (myErrorStatus) {
184 return;
185 }
186 //
187 Prepare();
188 if (myErrorStatus) {
189 return;
190 }
191 // 00
192 PerformVV();
193 if (myErrorStatus) {
194 return;
195 }
196 // 01
197 PerformVE();
198 if (myErrorStatus) {
199 return;
200 }
201 //
202 myDS->UpdatePaveBlocks();
203 // 11
204 PerformEE();
205 if (myErrorStatus) {
206 return;
207 }
208 // 02
209 PerformVF();
210 if (myErrorStatus) {
211 return;
212 }
213 // 12
214 PerformEF();
215 if (myErrorStatus) {
216 return;
217 }
218 //
219 MakeSplitEdges();
220 if (myErrorStatus) {
221 return;
222 }
223 //
224 // 22
225 PerformFF();
226 if (myErrorStatus) {
227 return;
228 }
229 //
230 MakeBlocks();
231 if (myErrorStatus) {
232 return;
233 }
234 //
235 RefineFaceInfoOn();
236 //
237 MakePCurves();
238 if (myErrorStatus) {
239 return;
240 }
241 //
242 ProcessDE();
243 if (myErrorStatus) {
244 return;
245 }
955b3e71 246 //
247 //modified by NIZNHY-PKV Fri Sep 12 07:06:50 2014f
248 // 03
249 PerformVZ();
250 if (myErrorStatus) {
251 return;
252 }
253 // 13
254 PerformEZ();
255 if (myErrorStatus) {
256 return;
257 }
258 // 23
259 PerformFZ();
260 if (myErrorStatus) {
261 return;
262 }
263 // 33
264 PerformZZ();
265 if (myErrorStatus) {
266 return;
267 }
268 //modified by NIZNHY-PKV Fri Sep 12 07:06:52 2014t
36f4947b 269}