0024940: WOK: Cyclic dependency detected between: BOPInt IntTools
[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 //
167 Init();
168 if (myErrorStatus) {
169 return;
170 }
f1baf495 171 //
172 Prepare();
173 if (myErrorStatus) {
174 return;
175 }
6f31882a 176 // 00
177 PerformVV();
178 if (myErrorStatus) {
179 return;
180 }
181 // 01
182 PerformVE();
183 if (myErrorStatus) {
184 return;
185 }
186 //
187 myDS->UpdatePaveBlocks();
188 // 11
189 PerformEE();
190 if (myErrorStatus) {
191 return;
192 }
193 // 02
194 PerformVF();
195 if (myErrorStatus) {
196 return;
197 }
198 // 12
199 PerformEF();
200 if (myErrorStatus) {
201 return;
202 }
203 //
204 MakeSplitEdges();
205 if (myErrorStatus) {
206 return;
207 }
208 //
209 // 22
210 PerformFF();
211 if (myErrorStatus) {
212 return;
213 }
214 //
215 MakeBlocks();
216 if (myErrorStatus) {
217 return;
218 }
219 //
220 RefineFaceInfoOn();
221 //
222 MakePCurves();
223 if (myErrorStatus) {
224 return;
225 }
226 //
227 ProcessDE();
228 if (myErrorStatus) {
229 return;
230 }
231 } // try {
232 catch (Standard_Failure) {
233 myErrorStatus=11;
234 }
4e57c75e 235}