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 | // |
973c2be1 |
9 | // This library is free software; you can redistribute it and / or modify it |
10 | // under the terms of the GNU Lesser General Public version 2.1 as published |
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 | |
20 | #include <NCollection_BaseAllocator.hxx> |
21 | |
22 | #include <BOPInt_Context.hxx> |
23 | #include <BOPDS_DS.hxx> |
24 | #include <BOPDS_Iterator.hxx> |
25 | |
26 | //======================================================================= |
27 | //function : |
28 | //purpose : |
29 | //======================================================================= |
30 | BOPAlgo_PaveFiller::BOPAlgo_PaveFiller() |
31 | : |
32 | BOPAlgo_Algo() |
33 | { |
34 | myDS=NULL; |
35 | myIterator=NULL; |
36 | } |
37 | //======================================================================= |
38 | //function : |
39 | //purpose : |
40 | //======================================================================= |
41 | BOPAlgo_PaveFiller::BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator) |
42 | : |
43 | BOPAlgo_Algo(theAllocator) |
44 | { |
45 | myDS=NULL; |
46 | myIterator=NULL; |
47 | } |
48 | //======================================================================= |
49 | //function : ~ |
50 | //purpose : |
51 | //======================================================================= |
52 | BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller() |
53 | { |
54 | Clear(); |
55 | } |
56 | //======================================================================= |
57 | //function : Clear |
58 | //purpose : |
59 | //======================================================================= |
60 | void BOPAlgo_PaveFiller::Clear() |
61 | { |
62 | if (myIterator) { |
63 | delete myIterator; |
64 | myIterator=NULL; |
65 | } |
66 | if (myDS) { |
67 | delete myDS; |
68 | myDS=NULL; |
69 | } |
70 | myErrorStatus=2; |
71 | } |
72 | //======================================================================= |
73 | //function : DS |
74 | //purpose : |
75 | //======================================================================= |
76 | const BOPDS_DS& BOPAlgo_PaveFiller::DS() |
77 | { |
78 | return *myDS; |
79 | } |
80 | //======================================================================= |
81 | //function : PDS |
82 | //purpose : |
83 | //======================================================================= |
84 | BOPDS_PDS BOPAlgo_PaveFiller::PDS() |
85 | { |
86 | return myDS; |
87 | } |
88 | //======================================================================= |
89 | //function : Context |
90 | //purpose : |
91 | //======================================================================= |
92 | Handle(BOPInt_Context) BOPAlgo_PaveFiller::Context() |
93 | { |
94 | return myContext; |
95 | } |
96 | //======================================================================= |
97 | //function : SectionAttribute |
98 | //purpose : |
99 | //======================================================================= |
100 | void BOPAlgo_PaveFiller::SetSectionAttribute(const BOPAlgo_SectionAttribute& theSecAttr) |
101 | { |
102 | mySectionAttribute = theSecAttr; |
103 | } |
104 | //======================================================================= |
105 | //function : SetArguments |
106 | //purpose : |
107 | //======================================================================= |
108 | void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS) |
109 | { |
110 | myArguments=theLS; |
111 | } |
112 | //======================================================================= |
113 | //function : Arguments |
114 | //purpose : |
115 | //======================================================================= |
116 | const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const |
117 | { |
118 | return myArguments; |
119 | } |
120 | //======================================================================= |
121 | // function: Init |
122 | // purpose: |
123 | //======================================================================= |
124 | void BOPAlgo_PaveFiller::Init() |
125 | { |
126 | myErrorStatus=0; |
127 | // |
128 | if (!myArguments.Extent()) { |
129 | myErrorStatus=10; |
130 | return; |
131 | } |
132 | // |
133 | // 0 Clear |
134 | Clear(); |
135 | // |
136 | // 1.myDS |
137 | myDS=new BOPDS_DS(myAllocator); |
138 | myDS->SetArguments(myArguments); |
139 | myDS->Init(); |
140 | // |
141 | // 2.myIterator |
142 | myIterator=new BOPDS_Iterator(myAllocator); |
143 | myIterator->SetDS(myDS); |
144 | myIterator->Prepare(); |
145 | // |
146 | // 3 myContext |
147 | myContext=new BOPInt_Context; |
148 | // |
149 | myErrorStatus=0; |
150 | } |
151 | //======================================================================= |
152 | // function: Perform |
153 | // purpose: |
154 | //======================================================================= |
155 | void BOPAlgo_PaveFiller::Perform() |
156 | { |
157 | myErrorStatus=0; |
158 | // |
159 | Init(); |
160 | if (myErrorStatus) { |
161 | return; |
162 | } |
163 | // 00 |
164 | PerformVV(); |
165 | if (myErrorStatus) { |
166 | return; |
167 | } |
168 | // 01 |
169 | PerformVE(); |
170 | if (myErrorStatus) { |
171 | return; |
172 | } |
173 | // |
174 | myDS->UpdatePaveBlocks(); |
175 | // 11 |
176 | PerformEE(); |
177 | if (myErrorStatus) { |
178 | return; |
179 | } |
180 | // 02 |
181 | PerformVF(); |
182 | if (myErrorStatus) { |
183 | return; |
184 | } |
185 | // 12 |
186 | PerformEF(); |
187 | if (myErrorStatus) { |
188 | return; |
189 | } |
190 | // |
191 | MakeSplitEdges(); |
192 | if (myErrorStatus) { |
193 | return; |
194 | } |
195 | // |
196 | // 22 |
197 | PerformFF(); |
198 | if (myErrorStatus) { |
199 | return; |
200 | } |
201 | // |
202 | MakeBlocks(); |
203 | if (myErrorStatus) { |
204 | return; |
205 | } |
206 | // |
207 | RefineFaceInfoOn(); |
208 | // |
209 | MakePCurves(); |
210 | if (myErrorStatus) { |
211 | return; |
212 | } |
213 | // |
214 | ProcessDE(); |
215 | if (myErrorStatus) { |
216 | return; |
217 | } |
218 | // |
219 | } |