4e57c75e |
1 | // Created by: Peter KURNEV |
2 | // Copyright (c) 2010-2012 OPEN CASCADE SAS |
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 | // |
7 | // The content of this file is subject to the Open CASCADE Technology Public |
8 | // License Version 6.5 (the "License"). You may not use the content of this file |
9 | // except in compliance with the License. Please obtain a copy of the License |
10 | // at http://www.opencascade.org and read it completely before using this file. |
11 | // |
12 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
13 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
14 | // |
15 | // The Original Code and all software distributed under the License is |
16 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
17 | // Initial Developer hereby disclaims all such warranties, including without |
18 | // limitation, any warranties of merchantability, fitness for a particular |
19 | // purpose or non-infringement. Please see the License for the specific terms |
20 | // and conditions governing the rights and limitations under the License. |
21 | |
22 | |
23 | #include <BOPAlgo_PaveFiller.ixx> |
24 | |
25 | #include <NCollection_BaseAllocator.hxx> |
26 | |
27 | #include <BOPInt_Context.hxx> |
28 | #include <BOPDS_DS.hxx> |
29 | #include <BOPDS_Iterator.hxx> |
30 | |
31 | //======================================================================= |
32 | //function : |
33 | //purpose : |
34 | //======================================================================= |
35 | BOPAlgo_PaveFiller::BOPAlgo_PaveFiller() |
36 | : |
37 | BOPAlgo_Algo() |
38 | { |
39 | myDS=NULL; |
40 | myIterator=NULL; |
41 | } |
42 | //======================================================================= |
43 | //function : |
44 | //purpose : |
45 | //======================================================================= |
46 | BOPAlgo_PaveFiller::BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator) |
47 | : |
48 | BOPAlgo_Algo(theAllocator) |
49 | { |
50 | myDS=NULL; |
51 | myIterator=NULL; |
52 | } |
53 | //======================================================================= |
54 | //function : ~ |
55 | //purpose : |
56 | //======================================================================= |
57 | BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller() |
58 | { |
59 | Clear(); |
60 | } |
61 | //======================================================================= |
62 | //function : Clear |
63 | //purpose : |
64 | //======================================================================= |
65 | void BOPAlgo_PaveFiller::Clear() |
66 | { |
67 | if (myIterator) { |
68 | delete myIterator; |
69 | myIterator=NULL; |
70 | } |
71 | if (myDS) { |
72 | delete myDS; |
73 | myDS=NULL; |
74 | } |
75 | myErrorStatus=2; |
76 | } |
77 | //======================================================================= |
78 | //function : DS |
79 | //purpose : |
80 | //======================================================================= |
81 | const BOPDS_DS& BOPAlgo_PaveFiller::DS() |
82 | { |
83 | return *myDS; |
84 | } |
85 | //======================================================================= |
86 | //function : PDS |
87 | //purpose : |
88 | //======================================================================= |
89 | BOPDS_PDS BOPAlgo_PaveFiller::PDS() |
90 | { |
91 | return myDS; |
92 | } |
93 | //======================================================================= |
94 | //function : Context |
95 | //purpose : |
96 | //======================================================================= |
97 | Handle(BOPInt_Context) BOPAlgo_PaveFiller::Context() |
98 | { |
99 | return myContext; |
100 | } |
101 | //======================================================================= |
102 | //function : SectionAttribute |
103 | //purpose : |
104 | //======================================================================= |
105 | void BOPAlgo_PaveFiller::SetSectionAttribute(const BOPAlgo_SectionAttribute& theSecAttr) |
106 | { |
107 | mySectionAttribute = theSecAttr; |
108 | } |
109 | //======================================================================= |
110 | //function : SetArguments |
111 | //purpose : |
112 | //======================================================================= |
113 | void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS) |
114 | { |
115 | myArguments=theLS; |
116 | } |
117 | //======================================================================= |
118 | //function : Arguments |
119 | //purpose : |
120 | //======================================================================= |
121 | const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const |
122 | { |
123 | return myArguments; |
124 | } |
125 | //======================================================================= |
126 | // function: Init |
127 | // purpose: |
128 | //======================================================================= |
129 | void BOPAlgo_PaveFiller::Init() |
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); |
148 | myIterator->SetDS(myDS); |
149 | myIterator->Prepare(); |
150 | // |
151 | // 3 myContext |
152 | myContext=new BOPInt_Context; |
153 | // |
154 | myErrorStatus=0; |
155 | } |
156 | //======================================================================= |
157 | // function: Perform |
158 | // purpose: |
159 | //======================================================================= |
160 | void BOPAlgo_PaveFiller::Perform() |
161 | { |
162 | myErrorStatus=0; |
163 | // |
164 | Init(); |
165 | if (myErrorStatus) { |
166 | return; |
167 | } |
168 | // 00 |
169 | PerformVV(); |
170 | if (myErrorStatus) { |
171 | return; |
172 | } |
173 | // 01 |
174 | PerformVE(); |
175 | if (myErrorStatus) { |
176 | return; |
177 | } |
178 | // |
179 | myDS->UpdatePaveBlocks(); |
180 | // 11 |
181 | PerformEE(); |
182 | if (myErrorStatus) { |
183 | return; |
184 | } |
185 | // 02 |
186 | PerformVF(); |
187 | if (myErrorStatus) { |
188 | return; |
189 | } |
190 | // 12 |
191 | PerformEF(); |
192 | if (myErrorStatus) { |
193 | return; |
194 | } |
195 | // |
196 | MakeSplitEdges(); |
197 | if (myErrorStatus) { |
198 | return; |
199 | } |
200 | // |
201 | // 22 |
202 | PerformFF(); |
203 | if (myErrorStatus) { |
204 | return; |
205 | } |
206 | // |
207 | MakeBlocks(); |
208 | if (myErrorStatus) { |
209 | return; |
210 | } |
211 | // |
212 | RefineFaceInfoOn(); |
213 | // |
214 | MakePCurves(); |
215 | if (myErrorStatus) { |
216 | return; |
217 | } |
218 | // |
219 | ProcessDE(); |
220 | if (myErrorStatus) { |
221 | return; |
222 | } |
223 | // |
224 | } |