1 // Created on: 2004-05-20
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2004-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #include <BinTools_SurfaceSet.ixx>
23 #include <BinTools.hxx>
25 #include <BinTools_CurveSet.hxx>
26 #include <Geom_Plane.hxx>
27 #include <Geom_CylindricalSurface.hxx>
28 #include <Geom_ConicalSurface.hxx>
29 #include <Geom_SphericalSurface.hxx>
30 #include <Geom_ToroidalSurface.hxx>
31 #include <Geom_SurfaceOfLinearExtrusion.hxx>
32 #include <Geom_SurfaceOfRevolution.hxx>
33 #include <Geom_BezierSurface.hxx>
34 #include <Geom_BSplineSurface.hxx>
35 #include <Geom_RectangularTrimmedSurface.hxx>
36 #include <Geom_OffsetSurface.hxx>
39 #include <gp_Cylinder.hxx>
40 #include <gp_Cone.hxx>
41 #include <gp_Sphere.hxx>
42 #include <gp_Torus.hxx>
44 #include <TColStd_Array1OfReal.hxx>
45 #include <TColStd_Array1OfInteger.hxx>
46 #include <TColgp_Array1OfPnt.hxx>
47 #include <TColStd_Array2OfReal.hxx>
48 #include <TColgp_Array2OfPnt.hxx>
49 #include <Standard_Failure.hxx>
50 #include <Standard_ErrorHandler.hxx>
57 #define LINEAREXTRUSION 6
61 #define RECTANGULAR 10
64 //=======================================================================
65 //function : BinTools_SurfaceSet
67 //=======================================================================
69 BinTools_SurfaceSet::BinTools_SurfaceSet()
74 //=======================================================================
77 //=======================================================================
79 void BinTools_SurfaceSet::Clear()
85 //=======================================================================
88 //=======================================================================
90 Standard_Integer BinTools_SurfaceSet::Add(const Handle(Geom_Surface)& S)
96 //=======================================================================
99 //=======================================================================
101 Handle(Geom_Surface) BinTools_SurfaceSet::Surface
102 (const Standard_Integer I)const
104 return Handle(Geom_Surface)::DownCast(myMap(I));
108 //=======================================================================
111 //=======================================================================
113 Standard_Integer BinTools_SurfaceSet::Index
114 (const Handle(Geom_Surface)& S)const
116 return myMap.FindIndex(S);
119 //=======================================================================
120 //function : operator << (gp_Pnt)
122 //=======================================================================
124 static Standard_OStream& operator <<(Standard_OStream& OS, const gp_Pnt P)
126 BinTools::PutReal(OS, P.X());
127 BinTools::PutReal(OS, P.Y());
128 BinTools::PutReal(OS, P.Z());
132 //=======================================================================
133 //function : operator << (gp_Dir)
135 //=======================================================================
137 static Standard_OStream& operator <<(Standard_OStream& OS, const gp_Dir D)
139 BinTools::PutReal(OS, D.X());
140 BinTools::PutReal(OS, D.Y());
141 BinTools::PutReal(OS, D.Z());
146 //=======================================================================
147 //function : operator <<(Geom_Plane)
149 //=======================================================================
151 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_Plane)& S)
153 OS << (Standard_Byte)PLANE;
155 OS << P.Location();//Pnt
156 OS << P.Axis().Direction();
157 OS << P.XAxis().Direction();
158 OS << P.YAxis().Direction();
163 //=======================================================================
164 //function : operator <<(Geom_CylindricalSurface)
166 //=======================================================================
168 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_CylindricalSurface)& S)
170 OS << (Standard_Byte)CYLINDER;
171 gp_Cylinder P = S->Cylinder();
172 OS << P.Location();//Pnt
173 OS << P.Axis().Direction();
174 OS << P.XAxis().Direction();
175 OS << P.YAxis().Direction();
176 BinTools::PutReal(OS, P.Radius());
181 //=======================================================================
182 //function : operator <<(Geom_ConicalSurface)
184 //=======================================================================
186 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_ConicalSurface)& S)
188 OS << (Standard_Byte)CONE;
189 gp_Cone P = S->Cone();
190 OS << P.Location();//Pnt
191 OS << P.Axis().Direction();
192 OS << P.XAxis().Direction();
193 OS << P.YAxis().Direction();
194 BinTools::PutReal(OS, P.RefRadius());
195 BinTools::PutReal(OS, P.SemiAngle());
200 //=======================================================================
201 //function : operator <<(Geom_SphericalSurface)
203 //=======================================================================
205 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_SphericalSurface)& S)
207 OS << (Standard_Byte)SPHERE;
208 gp_Sphere P = S->Sphere();
209 OS << P.Location();//Pnt
210 OS << P.Position().Axis().Direction();
211 OS << P.XAxis().Direction();
212 OS << P.YAxis().Direction();
213 BinTools::PutReal(OS, P.Radius());
218 //=======================================================================
219 //function : operator <<(Geom_ToroidalSurface)
221 //=======================================================================
223 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_ToroidalSurface)& S)
225 OS << (Standard_Byte)TORUS;
226 gp_Torus P = S->Torus();
227 OS << P.Location();//Pnt
228 OS << P.Axis().Direction();
229 OS << P.XAxis().Direction();
230 OS << P.YAxis().Direction();
231 BinTools::PutReal(OS, P.MajorRadius());
232 BinTools::PutReal(OS, P.MinorRadius());
237 //=======================================================================
238 //function : operator <<(Geom_SurfaceOfLinearExtrusion)
240 //=======================================================================
242 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_SurfaceOfLinearExtrusion)& S)
244 OS << (Standard_Byte)LINEAREXTRUSION;
245 OS << S->Direction();
246 BinTools_CurveSet::WriteCurve(S->BasisCurve(),OS);
251 //=======================================================================
252 //function : operator <<(Geom_SurfaceOfRevolution)
254 //=======================================================================
256 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_SurfaceOfRevolution)& S)
258 OS << (Standard_Byte)REVOLUTION;
260 OS << S->Direction();
261 BinTools_CurveSet::WriteCurve(S->BasisCurve(),OS);
266 //=======================================================================
267 //function : operator <<(Geom_BezierSurface)
269 //=======================================================================
271 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_BezierSurface)& S)
273 OS << (Standard_Byte)BEZIER;
274 Standard_Boolean urational = S->IsURational() ? 1:0;
275 Standard_Boolean vrational = S->IsVRational() ? 1:0;
276 BinTools::PutBool(OS, urational); //rational
277 BinTools::PutBool(OS, vrational);
278 // cout << "Bezier Surface:"<< endl;
279 // cout << "\turational = "<<urational<<" vrational = " <<vrational<<endl;
282 Standard_Integer i,j,udegree,vdegree;
283 udegree = S->UDegree();
284 vdegree = S->VDegree();
286 // cout << "\tudegree = " << udegree << ", vdegree = "<< vdegree<<endl;
288 BinTools::PutExtChar(OS, (Standard_ExtCharacter)udegree);
289 BinTools::PutExtChar(OS, (Standard_ExtCharacter)vdegree);
290 for (i = 1; i <= udegree+1; i++) {
291 for (j = 1; j <= vdegree+1; j++) {
292 OS << S->Pole(i,j); //Pnt
294 // cout << "Bezier Surface: Pole Pnt: X = " << S->Pole(i,j).X()<< " Y = " << S->Pole(i,j).Y()<<" Z = " << S->Pole(i,j).Z()<<endl;
296 if (urational || vrational) {
297 BinTools::PutReal(OS, S->Weight(i,j));//Real
299 // cout << "Bezier Surface: Put Real" << endl;
305 // const Standard_Integer aPos = OS.tellp();
306 // cout << "\tEnd of Bezier surface pos = " << aPos << endl;
312 //=======================================================================
313 //function : operator <<(Geom_BSplineSurface)
315 //=======================================================================
317 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_BSplineSurface)& S)
319 OS << (Standard_Byte)BSPLINE;
320 Standard_Boolean urational = S->IsURational() ? 1:0;
321 Standard_Boolean vrational = S->IsVRational() ? 1:0;
322 Standard_Boolean uperiodic = S->IsUPeriodic() ? 1:0;
323 Standard_Boolean vperiodic = S->IsVPeriodic() ? 1:0;
324 BinTools::PutBool(OS, urational);
325 BinTools::PutBool(OS, vrational);
326 BinTools::PutBool(OS, uperiodic);
327 BinTools::PutBool(OS, vperiodic);
330 Standard_Integer i,j,udegree,vdegree,nbupoles,nbvpoles,nbuknots,nbvknots;
331 udegree = S->UDegree();
332 vdegree = S->VDegree();
333 nbupoles = S->NbUPoles();
334 nbvpoles = S->NbVPoles();
335 nbuknots = S->NbUKnots();
336 nbvknots = S->NbVKnots();
337 BinTools::PutExtChar(OS, (Standard_ExtCharacter) udegree);
338 BinTools::PutExtChar(OS, (Standard_ExtCharacter) vdegree);
339 BinTools::PutInteger(OS, nbupoles);
340 BinTools::PutInteger(OS, nbvpoles);
341 BinTools::PutInteger(OS, nbuknots);
342 BinTools::PutInteger(OS, nbvknots);
343 for (i = 1; i <= nbupoles; i++) {
344 for (j = 1; j <= nbvpoles; j++) {
345 OS << S->Pole(i,j); //Pnt
346 if (urational || vrational)
347 BinTools::PutReal(OS, S->Weight(i,j));//Real
351 for (i = 1; i <= nbuknots; i++) {
352 BinTools::PutReal(OS,S->UKnot(i));
353 BinTools::PutInteger(OS, S->UMultiplicity(i));
356 for (i = 1; i <= nbvknots; i++) {
357 BinTools::PutReal(OS,S->VKnot(i));
358 BinTools::PutInteger(OS, S->VMultiplicity(i));
364 //=======================================================================
365 //function : operator <<(Geom_RectangularTrimmedSurface)
367 //=======================================================================
369 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_RectangularTrimmedSurface)& S)
371 OS << (Standard_Byte)RECTANGULAR;
372 Standard_Real U1,U2,V1,V2;
373 S->Bounds(U1,U2,V1,V2);
374 BinTools::PutReal(OS, U1);
375 BinTools::PutReal(OS, U2);
376 BinTools::PutReal(OS, V1);
377 BinTools::PutReal(OS, V2);
378 BinTools_SurfaceSet::WriteSurface(S->BasisSurface(),OS);
383 //=======================================================================
384 //function : operator <<(Geom_OffsetSurface)
386 //=======================================================================
388 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_OffsetSurface)& S)
390 OS << (Standard_Byte)OFFSET;
391 BinTools::PutReal(OS, S->Offset());
392 BinTools_SurfaceSet::WriteSurface(S->BasisSurface(),OS);
397 //=======================================================================
398 //function : WriteSurface
400 //=======================================================================
402 void BinTools_SurfaceSet::WriteSurface(const Handle(Geom_Surface)& S,
403 Standard_OStream& OS)
405 Standard_SStream aMsg;
406 Handle(Standard_Type) TheType = S->DynamicType();
409 if ( TheType == STANDARD_TYPE(Geom_Plane)) {
410 OS << Handle(Geom_Plane)::DownCast(S);
412 else if ( TheType == STANDARD_TYPE(Geom_CylindricalSurface)) {
413 OS << Handle(Geom_CylindricalSurface)::DownCast(S);
415 else if ( TheType == STANDARD_TYPE(Geom_ConicalSurface)) {
416 OS << Handle(Geom_ConicalSurface)::DownCast(S);
418 else if ( TheType == STANDARD_TYPE(Geom_SphericalSurface)) {
419 OS << Handle(Geom_SphericalSurface)::DownCast(S);
421 else if ( TheType == STANDARD_TYPE(Geom_ToroidalSurface)) {
422 OS << Handle(Geom_ToroidalSurface)::DownCast(S);
424 else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
425 OS << Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(S);
427 else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution)) {
428 OS << Handle(Geom_SurfaceOfRevolution)::DownCast(S);
430 else if ( TheType == STANDARD_TYPE(Geom_BezierSurface)) {
431 OS << Handle(Geom_BezierSurface)::DownCast(S);
433 else if ( TheType == STANDARD_TYPE(Geom_BSplineSurface)) {
434 OS << Handle(Geom_BSplineSurface)::DownCast(S);
436 else if ( TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
437 OS << Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
439 else if ( TheType == STANDARD_TYPE(Geom_OffsetSurface)) {
440 OS << Handle(Geom_OffsetSurface)::DownCast(S);
443 aMsg <<"UNKNOWN SURFACE TYPE" <<endl;
444 Standard_Failure::Raise(aMsg);
447 catch(Standard_Failure) {
448 aMsg << "EXCEPTION in BinTools_SurfaceSet::WriteSurface(..)" << endl;
449 Handle(Standard_Failure) anExc = Standard_Failure::Caught();
450 aMsg << anExc << endl;
451 Standard_Failure::Raise(aMsg);
455 //=======================================================================
458 //=======================================================================
460 void BinTools_SurfaceSet::Write(Standard_OStream& OS)const
463 Standard_Integer i, nbsurf = myMap.Extent();
464 OS << "Surfaces "<< nbsurf << "\n";
465 for (i = 1; i <= nbsurf; i++) {
466 WriteSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS);
472 //=======================================================================
475 //=======================================================================
477 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P)
479 Standard_Real X=0.,Y=0.,Z=0.;
480 BinTools::GetReal(IS, X);
481 BinTools::GetReal(IS, Y);
482 BinTools::GetReal(IS, Z);
487 //=======================================================================
490 //=======================================================================
492 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir& D)
494 Standard_Real X=0.,Y=0.,Z=0.;
495 BinTools::GetReal(IS, X);
496 BinTools::GetReal(IS, Y);
497 BinTools::GetReal(IS, Z);
502 //=======================================================================
505 //=======================================================================
507 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Ax3& A3)
510 gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.);
511 IS >> P >> A >> AX >> AY;
513 if (AY.DotCross(A,AX) < 0)
520 //=======================================================================
521 //function : operator>>
523 //=======================================================================
525 static Standard_IStream& operator>>(Standard_IStream& IS,
526 Handle(Geom_Plane)& S)
530 S = new Geom_Plane(A);
534 //=======================================================================
535 //function : operator>>
537 //=======================================================================
539 static Standard_IStream& operator>>(Standard_IStream& IS,
540 Handle(Geom_CylindricalSurface)& S)
545 BinTools::GetReal(IS, R);
546 S = new Geom_CylindricalSurface(A,R);
550 //=======================================================================
551 //function : operator>>
553 //=======================================================================
555 static Standard_IStream& operator>>(Standard_IStream& IS,
556 Handle(Geom_ConicalSurface)& S)
559 Standard_Real R=0.,Ang=0.;
561 BinTools::GetReal(IS, R);
562 BinTools::GetReal(IS, Ang);
563 S = new Geom_ConicalSurface(A,Ang,R);
567 //=======================================================================
568 //function : operator>>
570 //=======================================================================
572 static Standard_IStream& operator>>(Standard_IStream& IS,
573 Handle(Geom_SphericalSurface)& S)
578 BinTools::GetReal(IS, R);
579 S = new Geom_SphericalSurface(A,R);
583 //=======================================================================
584 //function : operator>>
586 //=======================================================================
588 static Standard_IStream& operator>>(Standard_IStream& IS,
589 Handle(Geom_ToroidalSurface)& S)
592 Standard_Real R1=0.,R2=0.;
594 BinTools::GetReal(IS, R1);
595 BinTools::GetReal(IS, R2);
596 S = new Geom_ToroidalSurface(A,R1,R2);
600 //=======================================================================
601 //function : operator>>
603 //=======================================================================
605 static Standard_IStream& operator>>(Standard_IStream& IS,
606 Handle(Geom_SurfaceOfLinearExtrusion)& S)
609 Handle(Geom_Curve) C;
611 BinTools_CurveSet::ReadCurve(IS,C);
612 S = new Geom_SurfaceOfLinearExtrusion(C,D);
616 //=======================================================================
617 //function : operator>>
619 //=======================================================================
621 static Standard_IStream& operator>>(Standard_IStream& IS,
622 Handle(Geom_SurfaceOfRevolution)& S)
626 Handle(Geom_Curve) C;
628 BinTools_CurveSet::ReadCurve(IS, C);
629 S = new Geom_SurfaceOfRevolution(C,gp_Ax1(P,D));
633 //=======================================================================
634 //function : operator>>
636 //=======================================================================
638 static Standard_IStream& operator>>(Standard_IStream& IS,
639 Handle(Geom_BezierSurface)& S)
641 // cout << "BezierSurface:" <<endl;
642 Standard_Boolean urational=Standard_False, vrational=Standard_False;
643 BinTools::GetBool(IS, urational);
644 BinTools::GetBool(IS, vrational);
646 // cout << "\turational = " << urational << " vrational = " << vrational<<endl;
647 Standard_Integer udegree=0, vdegree=0;
648 Standard_ExtCharacter aVal='\0';
649 BinTools::GetExtChar(IS, aVal);
651 udegree = (Standard_Integer)aVal;
652 BinTools::GetExtChar(IS, aVal);
653 vdegree = (Standard_Integer)aVal;
654 // cout << "\ttudegree = " << udegree << ", vdegree = " << vdegree << endl;
656 TColgp_Array2OfPnt poles(1,udegree+1,1,vdegree+1);
657 TColStd_Array2OfReal weights(1,udegree+1,1,vdegree+1);
659 Standard_Integer i,j;
660 for (i = 1; i <= udegree+1; i++) {
661 for (j = 1; j <= vdegree+1; j++) {
662 IS >> poles(i,j);//Pnt
663 // cout <<"Pole X = " <<poles(i,j).X()<< " Y = " <<poles(i,j).Y()<< " Z = " << poles(i,j).Z()<<endl;
664 if (urational || vrational)
665 BinTools::GetReal(IS, weights(i,j));
669 if (urational || vrational)
670 S = new Geom_BezierSurface(poles,weights);
672 S = new Geom_BezierSurface(poles);
676 //=======================================================================
677 //function : operator>>
679 //=======================================================================
681 static Standard_IStream& operator>>(Standard_IStream& IS,
682 Handle(Geom_BSplineSurface)& S)
684 Standard_Boolean urational=Standard_False, vrational=Standard_False,
685 uperiodic=Standard_False, vperiodic=Standard_False;
686 BinTools::GetBool(IS, urational);
687 BinTools::GetBool(IS, vrational);
688 BinTools::GetBool(IS, uperiodic);
689 BinTools::GetBool(IS, vperiodic);
691 Standard_Integer udegree=0, vdegree=0,nbupoles=0,nbvpoles=0,nbuknots=0,nbvknots=0;
692 Standard_ExtCharacter aVal='\0';
693 BinTools::GetExtChar(IS, aVal);
694 udegree = (Standard_Integer)aVal;
695 BinTools::GetExtChar(IS, aVal);
696 vdegree = (Standard_Integer)aVal;
697 BinTools::GetInteger(IS, nbupoles);
698 BinTools::GetInteger(IS, nbvpoles);
699 BinTools::GetInteger(IS, nbuknots);
700 BinTools::GetInteger(IS, nbvknots);
702 TColgp_Array2OfPnt poles(1,nbupoles,1,nbvpoles);
703 TColStd_Array2OfReal weights(1,nbupoles,1,nbvpoles);
705 Standard_Integer i,j;
706 for (i = 1; i <= nbupoles; i++) {
707 for (j = 1; j <= nbvpoles; j++) {
708 IS >> poles(i,j);//Pnt
709 if (urational || vrational)
710 BinTools::GetReal(IS, weights(i,j));
714 TColStd_Array1OfReal uknots(1,nbuknots);
715 TColStd_Array1OfInteger umults(1,nbuknots);
716 for (i = 1; i <= nbuknots; i++) {
717 BinTools::GetReal(IS, uknots(i));
718 BinTools::GetInteger(IS, umults(i));
721 TColStd_Array1OfReal vknots(1,nbvknots);
722 TColStd_Array1OfInteger vmults(1,nbvknots);
723 for (i = 1; i <= nbvknots; i++) {
724 BinTools::GetReal(IS, vknots(i));
725 BinTools::GetInteger(IS, vmults(i));
728 if (urational || vrational)
729 S = new Geom_BSplineSurface(poles,weights,uknots,vknots,umults,vmults,
730 udegree,vdegree,uperiodic,vperiodic);
732 S = new Geom_BSplineSurface(poles,uknots,vknots,umults,vmults,
733 udegree,vdegree,uperiodic,vperiodic);
737 //=======================================================================
738 //function : operator>>
740 //=======================================================================
742 static Standard_IStream& operator>>(Standard_IStream& IS,
743 Handle(Geom_RectangularTrimmedSurface)& S)
745 Standard_Real U1=0.,U2=0.,V1=0.,V2=0.;
746 BinTools::GetReal(IS, U1);
747 BinTools::GetReal(IS, U2);
748 BinTools::GetReal(IS, V1);
749 BinTools::GetReal(IS, V2);
750 Handle(Geom_Surface) BS;
751 BinTools_SurfaceSet::ReadSurface(IS, BS);
752 S = new Geom_RectangularTrimmedSurface(BS,U1,U2,V1,V2);
756 //=======================================================================
757 //function : operator>>
759 //=======================================================================
761 static Standard_IStream& operator>>(Standard_IStream& IS,
762 Handle(Geom_OffsetSurface)& S)
765 BinTools::GetReal(IS, O);
766 Handle(Geom_Surface) BS;
767 BinTools_SurfaceSet::ReadSurface(IS, BS);
768 S = new Geom_OffsetSurface(BS,O);
773 //=======================================================================
774 //function : ReadSurface
776 //=======================================================================
778 Standard_IStream& BinTools_SurfaceSet::ReadSurface(Standard_IStream& IS,
779 Handle(Geom_Surface)& S)
781 Standard_SStream aMsg;
784 const Standard_Byte stype = (Standard_Byte) IS.get();
786 // cout << "ReadSurface: Surface type = " << (Standard_Integer)stype <<endl;
792 Handle(Geom_Plane) SS;
800 Handle(Geom_CylindricalSurface) SS;
808 Handle(Geom_ConicalSurface) SS;
816 Handle(Geom_SphericalSurface) SS;
824 Handle(Geom_ToroidalSurface) SS;
830 case LINEAREXTRUSION :
832 Handle(Geom_SurfaceOfLinearExtrusion) SS;
840 Handle(Geom_SurfaceOfRevolution) SS;
848 Handle(Geom_BezierSurface) SS;
856 Handle(Geom_BSplineSurface) SS;
864 Handle(Geom_RectangularTrimmedSurface) SS;
872 Handle(Geom_OffsetSurface) SS;
881 aMsg << "UNKNOWN SURFACE TYPE" << endl;
882 Standard_Failure::Raise(aMsg);
887 catch(Standard_Failure) {
889 aMsg << "EXCEPTION in BinTools_SurfaceSet::ReadSurface(..)" << endl;
890 Handle(Standard_Failure) anExc = Standard_Failure::Caught();
891 aMsg << anExc << endl;
892 Standard_Failure::Raise(aMsg);
897 //=======================================================================
900 //=======================================================================
902 void BinTools_SurfaceSet::Read(Standard_IStream& IS)
906 if (IS.fail() || strcmp(buffer,"Surfaces")) {
907 Standard_SStream aMsg;
908 aMsg << "BinTools_SurfaceSet::Read: Not a surface table"<<endl;
910 cout <<"SurfaceSet buffer: " << buffer << endl;
912 Standard_Failure::Raise(aMsg);
916 Handle(Geom_Surface) S;
917 Standard_Integer i, nbsurf;
919 IS.get ();//remove <lf>
920 for (i = 1; i <= nbsurf; i++) {
921 BinTools_SurfaceSet::ReadSurface(IS,S);