b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
7fd59977 |
19 | #include <gp_XYZ.hxx> |
42cf5bc1 |
20 | #include <IGESData_DirChecker.hxx> |
7fd59977 |
21 | #include <IGESData_Dump.hxx> |
42cf5bc1 |
22 | #include <IGESData_IGESDumper.hxx> |
23 | #include <IGESData_IGESReaderData.hxx> |
24 | #include <IGESData_IGESWriter.hxx> |
25 | #include <IGESData_ParamCursor.hxx> |
26 | #include <IGESData_ParamReader.hxx> |
27 | #include <IGESGeom_BSplineSurface.hxx> |
28 | #include <IGESGeom_ToolBSplineSurface.hxx> |
29 | #include <Interface_Check.hxx> |
30 | #include <Interface_CopyTool.hxx> |
31 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
32 | #include <Interface_Macros.hxx> |
42cf5bc1 |
33 | #include <Interface_ShareTool.hxx> |
34 | #include <Message_Messenger.hxx> |
7fd59977 |
35 | #include <Message_Msg.hxx> |
42cf5bc1 |
36 | #include <Standard_DomainError.hxx> |
37 | #include <TColgp_HArray2OfXYZ.hxx> |
38 | #include <TColStd_HArray1OfReal.hxx> |
39 | #include <TColStd_HArray2OfReal.hxx> |
7fd59977 |
40 | |
42cf5bc1 |
41 | // MGE 31/07/98 |
7fd59977 |
42 | //======================================================================= |
43 | //function : IGESGeom_ToolBSplineSurface |
44 | //purpose : |
45 | //======================================================================= |
7fd59977 |
46 | IGESGeom_ToolBSplineSurface::IGESGeom_ToolBSplineSurface () |
47 | { |
48 | } |
49 | |
50 | |
51 | //======================================================================= |
52 | //function : ReadOwnParams |
53 | //purpose : |
54 | //======================================================================= |
55 | |
56 | void IGESGeom_ToolBSplineSurface::ReadOwnParams |
57 | (const Handle(IGESGeom_BSplineSurface)& ent, |
58 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
59 | { |
60 | // MGE 31/07/98 |
61 | // Building of messages |
62 | //======================================== |
63 | Message_Msg Msg100("XSTEP_100"); |
64 | Message_Msg Msg101("XSTEP_101"); |
65 | Message_Msg Msg102("XSTEP_102"); |
66 | Message_Msg Msg103("XSTEP_103"); |
67 | Message_Msg Msg159("XSTEP_159"); |
68 | //======================================== |
69 | |
70 | Standard_Integer I, J; |
71 | Standard_Integer anIndexU, anIndexV, aDegU, aDegV; |
72 | Standard_Boolean aCloseU, aCloseV, aPolynom, aPeriodU, aPeriodV; |
1d47d8d0 |
73 | Standard_Real aUmin, aUmax, aVmin = 0., aVmax = 0.; |
7fd59977 |
74 | Standard_Real tempVal; |
75 | gp_XYZ tempXYZ; |
76 | Handle(TColStd_HArray1OfReal) allKnotsU; |
77 | Handle(TColStd_HArray1OfReal) allKnotsV; |
78 | Handle(TColStd_HArray2OfReal) allWeights; |
79 | Handle(TColgp_HArray2OfXYZ) allPoles; |
80 | |
81 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
82 | Standard_Boolean FlagindexU = PR.ReadInteger(PR.Current(), anIndexU); |
83 | |
84 | Standard_Boolean FlagindexV = PR.ReadInteger(PR.Current(), anIndexV); |
85 | |
86 | if (!FlagindexU || !FlagindexV){ |
87 | Message_Msg Msg97("XSTEP_97"); |
88 | PR.SendFail(Msg97); |
89 | } |
90 | |
91 | Standard_Boolean FlagdegU = PR.ReadInteger(PR.Current(), aDegU); |
92 | |
93 | Standard_Boolean FlagdegV = PR.ReadInteger(PR.Current(), aDegV); |
94 | |
95 | if (!FlagdegU || !FlagdegV){ |
96 | Message_Msg Msg98("XSTEP_98"); |
97 | PR.SendFail(Msg98); |
98 | } |
99 | //szv#4:S4163:12Mar99 `st=` not needed |
100 | PR.ReadBoolean(PR.Current(), Msg100,aCloseU); |
101 | PR.ReadBoolean(PR.Current(), Msg100,aCloseV); |
102 | PR.ReadBoolean(PR.Current(), Msg101, aPolynom); |
103 | PR.ReadBoolean(PR.Current(), Msg102, aPeriodU); |
104 | PR.ReadBoolean(PR.Current(), Msg102, aPeriodV); |
105 | |
106 | /* |
107 | Standard_Boolean FlagindexU = |
108 | PR.ReadInteger(PR.Current(), "Upper Index in U", anIndexU); |
109 | |
110 | Standard_Boolean FlagindexV = |
111 | PR.ReadInteger(PR.Current(), "Upper Index in V", anIndexV); |
112 | |
113 | Standard_Boolean FlagdegU = |
114 | PR.ReadInteger(PR.Current(), "Degree Of First Basis Functions", aDegU); |
115 | |
116 | Standard_Boolean FlagdegV = |
117 | PR.ReadInteger(PR.Current(), "Degree Of Second Basis Functions",aDegV); |
118 | |
119 | st = PR.ReadBoolean(PR.Current(), "Closed/Open flag in U Direction",aCloseU); |
120 | st = PR.ReadBoolean(PR.Current(), "Closed/Open flag in V Direction",aCloseV); |
121 | st = PR.ReadBoolean(PR.Current(), "Polynomial / Rational", aPolynom); |
122 | st = PR.ReadBoolean(PR.Current(), "Periodic flag in U direction", aPeriodU); |
123 | st = PR.ReadBoolean(PR.Current(), "Periodic flag in V direction", aPeriodV); |
124 | */ |
125 | if ( FlagdegU && FlagindexU ) |
126 | { |
127 | // allKnotsU = new TColStd_HArray1OfReal(-aDegU, anIndexU+1); done by : |
128 | Standard_Integer tempind = anIndexU+aDegU+2; |
129 | PR.ReadReals(PR.CurrentList(tempind), Msg103, allKnotsU, -aDegU); //szv#4:S4163:12Mar99 `st=` not needed |
130 | //st = PR.ReadReals(PR.CurrentList(tempind), "First knot sequence values", allKnotsU, -aDegU); |
131 | } |
132 | |
133 | if ( FlagdegV && FlagindexV ) |
134 | { |
135 | // allKnotsV = new TColStd_HArray1OfReal(-aDegV, anIndexV+1); done by : |
136 | Standard_Integer tempind = anIndexV+aDegV+2; |
137 | PR.ReadReals(PR.CurrentList(tempind), Msg103, allKnotsV, -aDegV); //szv#4:S4163:12Mar99 `st=` not needed |
138 | //st = PR.ReadReals(PR.CurrentList(tempind), "Second knot sequence values", allKnotsV, -aDegV); |
139 | } |
140 | |
141 | if ( FlagindexU && FlagindexV ) |
142 | { |
143 | allWeights = new TColStd_HArray2OfReal (0, anIndexU, 0, anIndexV); |
144 | allPoles = new TColgp_HArray2OfXYZ (0, anIndexU, 0, anIndexV); |
145 | |
146 | Standard_Boolean BadWeigth = Standard_False; |
147 | Message_Msg Msg105("XSTEP_105"); |
148 | |
149 | for (J = 0; J <= anIndexV; J ++) { |
150 | for (I = 0; I <= anIndexU; I ++) { |
151 | //st = PR.ReadReal(PR.Current(), Msg104, tempVal); //szv#4:S4163:12Mar99 moved down |
152 | //st = PR.ReadReal(PR.Current(), "Weights", tempVal); |
153 | if (PR.ReadReal(PR.Current(), tempVal)) { |
154 | if(tempVal<Precision::PConfusion()) { // skl for OCC2821 11.06.2003 |
155 | BadWeigth = Standard_True; |
156 | } |
157 | allWeights->SetValue(I, J, tempVal); |
158 | } |
159 | else{ |
160 | Message_Msg Msg104("XSTEP_104"); |
161 | PR.SendFail(Msg104); |
162 | } |
163 | } |
164 | } |
165 | if(BadWeigth) { // skl for OCC2821 11.06.2003 |
166 | for (J = 0; J <= anIndexV; J ++) { |
167 | for (I = 0; I <= anIndexU; I ++) { |
168 | allWeights->SetValue(I, J, 1.); |
169 | } |
170 | } |
171 | } |
172 | |
173 | for (J = 0; J <= anIndexV; J ++) |
174 | for (I = 0; I <= anIndexU; I ++) { |
175 | //st = PR.ReadXYZ (PR.CurrentList(1, 3), Msg105, tempXYZ); //szv#4:S4163:12Mar99 moved down |
176 | //st = PR.ReadXYZ (PR.CurrentList(1, 3), "Control Points", tempXYZ); |
177 | if (PR.ReadXYZ (PR.CurrentList(1, 3), Msg105, tempXYZ)) |
178 | allPoles->SetValue(I, J, tempXYZ); |
179 | } |
180 | } |
181 | |
182 | //szv#4:S4163:12Mar99 `st=` not needed |
183 | /* PR.ReadReal(PR.Current(), Msg106, aUmin); |
184 | PR.ReadReal(PR.Current(), Msg107, aUmax); |
185 | PR.ReadReal(PR.Current(), Msg106, aVmin); |
186 | PR.ReadReal(PR.Current(), Msg107, aVmax); |
187 | */ |
188 | if (!PR.ReadReal(PR.Current(), aUmin) || !PR.ReadReal(PR.Current(), aVmin)){ |
189 | Message_Msg Msg106("XSTEP_106"); |
190 | PR.SendFail(Msg106); |
191 | } |
192 | |
193 | if (!PR.ReadReal(PR.Current(), aUmax) || !PR.ReadReal(PR.Current(), aVmax)){ |
194 | Message_Msg Msg107("XSTEP_107"); |
195 | PR.SendFail(Msg107); |
196 | } |
197 | /* |
198 | st = PR.ReadReal(PR.Current(), "Starting Value For U Direction", aUmin); |
199 | st = PR.ReadReal(PR.Current(), "Ending Value For U Direction", aUmax); |
200 | st = PR.ReadReal(PR.Current(), "Starting Value For V Direction", aVmin); |
201 | st = PR.ReadReal(PR.Current(), "Ending Value For U Direction", aVmax); |
202 | */ |
203 | // PROTECTION contre ANSYS 5.3 qui ecrit 3 flottants en plus ... |
204 | Standard_Integer icur = PR.CurrentNumber(), imax = PR.NbParams(); |
205 | Standard_Real bid; Standard_Integer pbfin = 0; |
206 | //st = Standard_True; //szv#4:S4163:12Mar99 not needed |
207 | while (imax >= icur) { |
208 | Interface_ParamType pt = PR.ParamType(icur); |
209 | if (pt == Interface_ParamReal) { |
210 | if (!PR.ReadReal (PR.Current(),bid)){ |
211 | PR.SendFail(Msg159); |
212 | } //szv#4:S4163:12Mar99 `st=` not needed |
213 | if (pbfin == 0) pbfin = 1; |
214 | } |
215 | else if (pt == Interface_ParamInteger || pt == Interface_ParamVoid) break; |
216 | else pbfin = -1; |
217 | icur ++; |
218 | } |
219 | if (pbfin > 0) PR.SendWarning(Msg159); |
220 | if (pbfin < 0){ |
221 | Message_Msg Msg158("XSTEP_158"); |
222 | PR.SendFail(Msg158); |
223 | } |
224 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
225 | ent->Init |
226 | (anIndexU, anIndexV, aDegU, aDegV, aCloseU, aCloseV, |
227 | aPolynom, aPeriodU, aPeriodV, allKnotsU, allKnotsV, |
228 | allWeights, allPoles, aUmin, aUmax, aVmin, aVmax); |
229 | } |
230 | |
231 | |
232 | //======================================================================= |
233 | //function : WriteOwnParams |
234 | //purpose : |
235 | //======================================================================= |
236 | |
237 | void IGESGeom_ToolBSplineSurface::WriteOwnParams |
238 | (const Handle(IGESGeom_BSplineSurface)& ent, IGESData_IGESWriter& IW) const |
239 | { |
240 | Standard_Integer indU = ent->UpperIndexU(); |
241 | Standard_Integer indV = ent->UpperIndexV(); |
242 | Standard_Integer degU = ent->DegreeU(); |
243 | Standard_Integer degV = ent->DegreeV(); |
244 | Standard_Integer I, J; |
245 | IW.Send(indU); |
246 | IW.Send(indV); |
247 | IW.Send(degU); |
248 | IW.Send(degV); |
249 | IW.SendBoolean(ent->IsClosedU()); |
250 | IW.SendBoolean(ent->IsClosedV()); |
251 | IW.SendBoolean(ent->IsPolynomial()); |
252 | IW.SendBoolean(ent->IsPeriodicU()); |
253 | IW.SendBoolean(ent->IsPeriodicV()); |
254 | |
255 | for (I = -degU; I <= indU + 1; I ++) |
256 | IW.Send(ent->KnotU(I)); |
257 | |
258 | for (I = -degV; I <= indV + 1; I ++) |
259 | IW.Send(ent->KnotV(I)); |
260 | |
261 | for (J = 0; J <= indV; J ++) |
262 | for (I = 0; I <= indU; I ++) |
263 | IW.Send(ent->Weight(I, J)); |
264 | |
265 | for (J = 0; J <= indV; J ++) |
266 | for (I = 0; I <= indU; I ++) { |
267 | gp_XYZ tempXYZ = ent->Pole(I, J).XYZ(); |
268 | IW.Send(tempXYZ.X()); |
269 | IW.Send(tempXYZ.Y()); |
270 | IW.Send(tempXYZ.Z()); |
271 | } |
272 | IW.Send(ent->UMin()); |
273 | IW.Send(ent->UMax()); |
274 | IW.Send(ent->VMin()); |
275 | IW.Send(ent->VMax()); |
276 | } |
277 | |
278 | |
279 | //======================================================================= |
280 | //function : OwnShared |
281 | //purpose : |
282 | //======================================================================= |
283 | |
284 | void IGESGeom_ToolBSplineSurface::OwnShared(const Handle(IGESGeom_BSplineSurface)& /* ent */, |
285 | Interface_EntityIterator& /* iter */) const |
286 | { |
287 | } |
288 | |
289 | |
290 | //======================================================================= |
291 | //function : OwnCopy |
292 | //purpose : |
293 | //======================================================================= |
294 | |
295 | void IGESGeom_ToolBSplineSurface::OwnCopy(const Handle(IGESGeom_BSplineSurface)& another, |
296 | const Handle(IGESGeom_BSplineSurface)& ent, |
297 | Interface_CopyTool& /* TC */) const |
298 | { |
299 | Standard_Integer I, J; |
300 | Standard_Integer anIndexU, anIndexV, aDegU, aDegV; |
301 | Standard_Boolean aCloseU, aCloseV, aPolynom; |
302 | Standard_Boolean aPeriodU, aPeriodV; |
303 | Standard_Real aUmin, aUmax, aVmin, aVmax; |
304 | |
305 | anIndexU = another->UpperIndexU(); |
306 | anIndexV = another->UpperIndexV(); |
307 | aDegU = another->DegreeU(); |
308 | aDegV = another->DegreeV(); |
309 | aCloseU = another->IsClosedU(); |
310 | aCloseV = another->IsClosedV(); |
311 | aPolynom = another->IsPolynomial(); |
312 | aPeriodU = another->IsPeriodicU(); |
313 | aPeriodV = another->IsPeriodicV(); |
314 | |
315 | Handle(TColStd_HArray1OfReal) allKnotsU = |
316 | new TColStd_HArray1OfReal(-aDegU, anIndexU+1); |
317 | Handle(TColStd_HArray1OfReal) allKnotsV = |
318 | new TColStd_HArray1OfReal(-aDegV, anIndexV+1); |
319 | |
320 | for (I = -aDegU; I <= anIndexU + 1; I ++) |
321 | allKnotsU->SetValue(I, another->KnotU(I)); |
322 | |
323 | for (I = -aDegV; I <= anIndexV + 1; I ++) |
324 | allKnotsV->SetValue(I, another->KnotV(I)); |
325 | |
326 | Handle(TColStd_HArray2OfReal) allWeights = |
327 | new TColStd_HArray2OfReal (0, anIndexU, 0, anIndexV); |
328 | Handle(TColgp_HArray2OfXYZ) allPoles = |
329 | new TColgp_HArray2OfXYZ (0, anIndexU, 0, anIndexV); |
330 | |
331 | for (J = 0; J <= anIndexV; J ++) |
332 | for (I = 0; I <= anIndexU; I ++) |
333 | allWeights->SetValue(I, J, another->Weight(I,J)); |
334 | |
335 | for (J = 0; J <= anIndexV; J ++) |
336 | for (I = 0; I <= anIndexU; I ++) |
337 | allPoles->SetValue(I, J, another->Pole(I, J).XYZ()); |
338 | |
339 | aUmin = another->UMin(); |
340 | aUmax = another->UMax(); |
341 | aVmin = another->VMin(); |
342 | aVmax = another->VMax(); |
343 | |
344 | ent->Init (anIndexU, anIndexV, aDegU, aDegV, aCloseU, aCloseV, |
345 | aPolynom, aPeriodU, aPeriodV, allKnotsU, allKnotsV, |
346 | allWeights, allPoles, aUmin, aUmax, aVmin, aVmax); |
347 | ent->SetFormNumber(another->FormNumber()); |
348 | } |
349 | |
350 | |
351 | //======================================================================= |
352 | //function : DirChecker |
353 | //purpose : |
354 | //======================================================================= |
355 | |
356 | IGESData_DirChecker IGESGeom_ToolBSplineSurface::DirChecker |
357 | (const Handle(IGESGeom_BSplineSurface)& /* ent */ ) const |
358 | { |
359 | IGESData_DirChecker DC(128, 0, 9); |
360 | DC.Structure(IGESData_DefVoid); |
361 | DC.LineFont(IGESData_DefAny); |
362 | // DC.LineWeight(IGESData_DefValue); |
363 | DC.Color(IGESData_DefAny); |
364 | DC.HierarchyStatusIgnored(); |
365 | return DC; |
366 | } |
367 | |
368 | |
369 | //======================================================================= |
370 | //function : OwnCheck |
371 | //purpose : |
372 | //======================================================================= |
373 | |
374 | void IGESGeom_ToolBSplineSurface::OwnCheck(const Handle(IGESGeom_BSplineSurface)& ent, |
375 | const Interface_ShareTool&, |
376 | Handle(Interface_Check)& ach) const |
377 | { |
378 | // MGE 31/07/98 |
379 | // Building of messages |
380 | //======================================== |
381 | //Message_Msg Msg104("XSTEP_104"); |
382 | //Message_Msg Msg160("XSTEP_160"); |
383 | //Message_Msg Msg161("XSTEP_161"); |
384 | //======================================== |
385 | |
386 | |
387 | |
388 | //Standard_Real eps = 1.E-04; // Tolerance des tests ?? //szv#4:S4163:12Mar99 not needed |
389 | |
390 | //modified by rln 18/12/97 check of flag PROP2 according to IGES Standard |
391 | //The same as in IGESGeom_ToolBSplineCurve::OwnCheck() |
392 | //It is possible to compare U(0) and U(1) only if UStartingParameter = UFirstKnot |
393 | //and UEndingParameter = ULastKnot and the same for V(0),V(1) |
394 | //(else we must build real geometrical curve) |
395 | //The fail is replaced with warning because it is not a serious problem |
396 | /* |
397 | if (ent->UMin() == ent->KnotU(-ent->DegreeU() ) && |
398 | ent->UMax() == ent->KnotU( ent->UpperIndexU() + 1) ) { |
399 | Standard_Real udif = Max (ent->Pole(0, 0).SquareDistance (ent->Pole(ent->UpperIndexU(), 0)), |
400 | ent->Pole(0, ent->UpperIndexV()).SquareDistance (ent->Pole(ent->UpperIndexU(), ent->UpperIndexV()))); |
401 | // if ((ent->UMin() == ent->UMax()) && !ent->IsClosedU()) |
402 | // if (udif < eps * eps && !ent->IsClosedU()) |
403 | // ach.AddWarning("U(0) == U(1) & PROP1 != 1"); |
404 | // if ((ent->UMin() != ent->UMax()) && ent->IsClosedU()) |
405 | // if (udif >= eps * eps && ent->IsClosedU()) |
406 | // ach.AddWarning("U(0) != U(1) & PROP1 != 0"); |
407 | } |
408 | |
409 | if (ent->VMin() == ent->KnotV(-ent->DegreeV() ) && |
410 | ent->VMax() == ent->KnotV( ent->UpperIndexV() + 1) ) { |
411 | Standard_Real vdif = Max (ent->Pole(0, 0).SquareDistance (ent->Pole(0, ent->UpperIndexV())), |
412 | ent->Pole(ent->UpperIndexU(), 0).SquareDistance (ent->Pole(ent->UpperIndexU(), ent->UpperIndexV()))); |
413 | // if ((ent->VMin() == ent->VMax()) && !ent->IsClosedV()) |
414 | // if (vdif < eps * eps && !ent->IsClosedV()) |
415 | // ach.AddWarning("V(0) == V(1) & PROP2 != 1"); |
416 | // if ((ent->VMin() != ent->VMax()) && ent->IsClosedV()) |
417 | // if (vdif >= eps * eps && ent->IsClosedV()) |
418 | // ach.AddWarning("V(0) != V(1) & PROP2 != 0"); |
419 | } |
420 | */ |
421 | |
422 | Standard_Boolean Flag = Standard_True; |
423 | Standard_Integer indU = ent->UpperIndexU(); |
424 | Standard_Integer indV = ent->UpperIndexV(); |
425 | Standard_Integer I,J; |
426 | |
427 | if (ent->NbKnotsU() != (indU + ent->DegreeU() +2)) { |
428 | Message_Msg Msg160("XSTEP_160"); |
429 | Msg160.Arg(indU + ent->DegreeU() +2); |
430 | ach->SendFail(Msg160); |
431 | } |
432 | if (ent->NbKnotsV() != (indV + ent->DegreeV() +2)) { |
433 | Message_Msg Msg161("XSTEP_161"); |
434 | Msg161.Arg(indV + ent->DegreeV() +2); |
435 | ach->SendFail(Msg161); |
436 | } |
437 | |
438 | for ( J = 0; ((J < indV) && (Flag)); J ++) |
439 | for ( I = 0; ((I < indU) && (Flag)); I ++) |
440 | Flag &= (ent->Weight(I,J) > 0); |
441 | |
442 | if (!Flag) { |
443 | Message_Msg Msg104("XSTEP_104"); |
444 | ach->SendFail(Msg104); |
445 | } |
446 | |
447 | Flag = Standard_True; |
448 | Standard_Real tempVal = ent->Weight(0,0); |
449 | |
450 | for ( J = 0; ((J < indV) && (Flag)); J ++) |
451 | for ( I = 0; ((I < indU) && (Flag)); I ++) |
452 | Flag &= (ent->Weight(I,J) == tempVal); |
453 | |
454 | // Standard_Boolean Flap = ent->IsPolynomial(Standard_True); |
455 | // if (Flag && !Flap) |
456 | // ach.AddWarning("All weights equal & PROP3 != 1. (Surface not Polynomial)"); |
457 | // if (!Flag && Flap) |
458 | // ach.AddWarning("All weights not equal & PROP3 != 0 (Surface not Rational)"); |
459 | } |
460 | |
461 | |
462 | //======================================================================= |
463 | //function : OwnDump |
464 | //purpose : |
465 | //======================================================================= |
466 | |
467 | void IGESGeom_ToolBSplineSurface::OwnDump(const Handle(IGESGeom_BSplineSurface)& ent, |
468 | const IGESData_IGESDumper& /* dumper */, |
469 | const Handle(Message_Messenger)& S, |
470 | const Standard_Integer level) const |
471 | { |
472 | S << "BSplineSurface from IGESGeom" << endl << endl; |
473 | |
474 | Standard_Integer indU = ent->UpperIndexU(); |
475 | Standard_Integer indV = ent->UpperIndexV(); |
476 | Standard_Integer degU = ent->DegreeU(); |
477 | Standard_Integer degV = ent->DegreeV(); |
478 | |
479 | S << "In U : Upper Knot Index : " << indU; |
480 | S << " Degree : " << degU << " "; |
481 | S << (ent->IsClosedU() ? "Closed" : "Open") << " "; |
482 | S << (ent->IsPeriodicU() ? "Periodic" : "Non Periodic"); |
483 | S << endl; |
484 | S << "In V : Upper Knot Index : " << indV; |
485 | S << " Degree : " << degV << " "; |
486 | S << (ent->IsClosedV() ? "Closed" : "Open") << " "; |
487 | S << (ent->IsPeriodicV() ? "Periodic" : "Non Periodic") << " "; |
488 | S << (ent->IsPolynomial(Standard_True) ? "Polynomial" : "Rational") << endl; |
489 | |
490 | S << "Starting Parameter for U direction : " << ent->UMin() << endl; |
491 | S << "Ending Parameter for U direction : " << ent->UMax() << endl; |
492 | S << "Starting Parameter for V direction : " << ent->VMin() << endl; |
493 | S << "Ending Parameter for V direction : " << ent->VMax() << endl; |
494 | |
495 | S << " Knots in U : "; |
496 | IGESData_DumpVals(S ,level,-degU, indU+1,ent->KnotU); |
497 | S << endl; |
498 | S << " Knots in V : "; |
499 | IGESData_DumpVals(S ,level,-degV, indV+1,ent->KnotV); |
500 | S << endl; |
501 | S << "Weights : (Row -> IndexU, Col -> IndexV)"; |
502 | IGESData_DumpRectVals(S ,level,0, indU,0,indV,ent->Weight); |
503 | S << endl; |
504 | S << "Control Points (Poles) : "; |
505 | //IGESData_DumpRectXYZL(S,level,1, ent->NbPoles(),ent->Pole, ent->Location()); |
506 | if (level < 5) { S << " [ content : ask level > 4 ]" << endl; return; } |
507 | gp_GTrsf loca = ent->Location(); |
508 | for (Standard_Integer JP = 0; JP <= indV; JP ++) |
509 | for (Standard_Integer IP = 0; IP <= indU; IP ++) { |
510 | if (IP == 0) S << endl; |
511 | S <<" - ["<<IP<<","<<JP<<"]: "; |
512 | IGESData_DumpXYZL(S,level,ent->Pole(IP,JP),loca); |
513 | } |
514 | S << endl; |
515 | } |