1 // Created on: 1993-07-19
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Geom_BezierSurface.hxx>
19 #include <Geom_BSplineSurface.hxx>
20 #include <Geom_ConicalSurface.hxx>
21 #include <Geom_CylindricalSurface.hxx>
22 #include <Geom_OffsetSurface.hxx>
23 #include <Geom_Plane.hxx>
24 #include <Geom_RectangularTrimmedSurface.hxx>
25 #include <Geom_SphericalSurface.hxx>
26 #include <Geom_Surface.hxx>
27 #include <Geom_SurfaceOfLinearExtrusion.hxx>
28 #include <Geom_SurfaceOfRevolution.hxx>
29 #include <Geom_ToroidalSurface.hxx>
30 #include <GeomTools.hxx>
31 #include <GeomTools_CurveSet.hxx>
32 #include <GeomTools_SurfaceSet.hxx>
33 #include <GeomTools_UndefinedTypeHandler.hxx>
34 #include <gp_Cone.hxx>
35 #include <gp_Cylinder.hxx>
37 #include <gp_Sphere.hxx>
38 #include <gp_Torus.hxx>
39 #include <Message_ProgressIndicator.hxx>
40 #include <Message_ProgressSentry.hxx>
41 #include <Standard_ErrorHandler.hxx>
42 #include <Standard_Failure.hxx>
43 #include <Standard_OutOfRange.hxx>
44 #include <Standard_Stream.hxx>
45 #include <TColgp_Array1OfPnt.hxx>
46 #include <TColgp_Array2OfPnt.hxx>
47 #include <TColStd_Array1OfInteger.hxx>
48 #include <TColStd_Array1OfReal.hxx>
49 #include <TColStd_Array2OfReal.hxx>
56 #define LINEAREXTRUSION 6
60 #define RECTANGULAR 10
63 //=======================================================================
64 //function : GeomTools_SurfaceSet
66 //=======================================================================
68 GeomTools_SurfaceSet::GeomTools_SurfaceSet()
73 //=======================================================================
76 //=======================================================================
78 void GeomTools_SurfaceSet::Clear()
84 //=======================================================================
87 //=======================================================================
89 Standard_Integer GeomTools_SurfaceSet::Add(const Handle(Geom_Surface)& S)
95 //=======================================================================
98 //=======================================================================
100 Handle(Geom_Surface) GeomTools_SurfaceSet::Surface
101 (const Standard_Integer I)const
103 if (I <= 0 || I > myMap.Extent())
104 return Handle(Geom_Surface)();
105 return Handle(Geom_Surface)::DownCast(myMap(I));
109 //=======================================================================
112 //=======================================================================
114 Standard_Integer GeomTools_SurfaceSet::Index
115 (const Handle(Geom_Surface)& S)const
117 return myMap.FindIndex(S);
120 //=======================================================================
123 //=======================================================================
125 static void Print(const gp_Pnt P,
126 Standard_OStream& OS,
127 const Standard_Boolean compact)
130 if (!compact) OS << ",";
133 if (!compact) OS << ",";
139 //=======================================================================
142 //=======================================================================
144 static void Print(const gp_Dir D,
145 Standard_OStream& OS,
146 const Standard_Boolean compact)
149 if (!compact) OS << ",";
152 if (!compact) OS << ",";
158 //=======================================================================
161 //=======================================================================
163 static void Print(const Handle(Geom_Plane)& S,
164 Standard_OStream& OS,
165 const Standard_Boolean compact)
173 if (!compact) OS << "\n Origin :";
174 Print(P.Location(),OS,compact);
175 if (!compact) OS << "\n Axis :";
176 Print(P.Axis().Direction(),OS,compact);
177 if (!compact) OS << "\n XAxis :";
178 Print(P.XAxis().Direction(),OS,compact);
179 if (!compact) OS << "\n YAxis :";
180 Print(P.YAxis().Direction(),OS,compact);
182 if (!compact) OS << "\n";
186 //=======================================================================
189 //=======================================================================
191 static void Print(const Handle(Geom_CylindricalSurface)& S,
192 Standard_OStream& OS,
193 const Standard_Boolean compact)
196 OS << CYLINDER << " ";
198 OS << "CylindricalSurface";
200 gp_Cylinder P = S->Cylinder();
201 if (!compact) OS << "\n Origin :";
202 Print(P.Location(),OS,compact);
203 if (!compact) OS << "\n Axis :";
204 Print(P.Axis().Direction(),OS,compact);
205 if (!compact) OS << "\n XAxis :";
206 Print(P.XAxis().Direction(),OS,compact);
207 if (!compact) OS << "\n YAxis :";
208 Print(P.YAxis().Direction(),OS,compact);
209 if (!compact) OS << "\n Radius :";
212 if (!compact) OS << "\n";
216 //=======================================================================
219 //=======================================================================
221 static void Print(const Handle(Geom_ConicalSurface)& S,
222 Standard_OStream& OS,
223 const Standard_Boolean compact)
228 OS << "ConicalSurface";
230 gp_Cone P = S->Cone();
231 if (!compact) OS << "\n Origin :";
232 Print(P.Location(),OS,compact);
233 if (!compact) OS << "\n Axis :";
234 Print(P.Axis().Direction(),OS,compact);
235 if (!compact) OS << "\n XAxis :";
236 Print(P.XAxis().Direction(),OS,compact);
237 if (!compact) OS << "\n YAxis :";
238 Print(P.YAxis().Direction(),OS,compact);
239 if (!compact) OS << "\n Radius :";
242 if (!compact) OS << "\n Angle :";
245 if (!compact) OS << "\n";
249 //=======================================================================
252 //=======================================================================
254 static void Print(const Handle(Geom_SphericalSurface)& S,
255 Standard_OStream& OS,
256 const Standard_Boolean compact)
261 OS << "SphericalSurface";
263 gp_Sphere P = S->Sphere();
264 if (!compact) OS << "\n Center :";
265 Print(P.Location(),OS,compact);
266 if (!compact) OS << "\n Axis :";
267 Print(P.Position().Axis().Direction(),OS,compact);
268 if (!compact) OS << "\n XAxis :";
269 Print(P.XAxis().Direction(),OS,compact);
270 if (!compact) OS << "\n YAxis :";
271 Print(P.YAxis().Direction(),OS,compact);
272 if (!compact) OS << "\n Radius :";
275 if (!compact) OS << "\n";
279 //=======================================================================
282 //=======================================================================
284 static void Print(const Handle(Geom_ToroidalSurface)& S,
285 Standard_OStream& OS,
286 const Standard_Boolean compact)
291 OS << "ToroidalSurface";
293 gp_Torus P = S->Torus();
294 if (!compact) OS << "\n Origin :";
295 Print(P.Location(),OS,compact);
296 if (!compact) OS << "\n Axis :";
297 Print(P.Axis().Direction(),OS,compact);
298 if (!compact) OS << "\n XAxis :";
299 Print(P.XAxis().Direction(),OS,compact);
300 if (!compact) OS << "\n YAxis :";
301 Print(P.YAxis().Direction(),OS,compact);
302 if (!compact) OS << "\n Radii :";
303 OS << P.MajorRadius() << " " << P.MinorRadius();
305 if (!compact) OS << "\n";
309 //=======================================================================
312 //=======================================================================
314 static void Print(const Handle(Geom_SurfaceOfLinearExtrusion)& S,
315 Standard_OStream& OS,
316 const Standard_Boolean compact)
319 OS << LINEAREXTRUSION << " ";
321 OS << "SurfaceOfLinearExtrusion";
323 if (!compact) OS << "\n Direction :";
324 Print(S->Direction(),OS,compact);
325 if (!compact) OS << "\n Basis curve : ";
327 GeomTools_CurveSet::PrintCurve(S->BasisCurve(),OS,compact);
331 //=======================================================================
334 //=======================================================================
336 static void Print(const Handle(Geom_SurfaceOfRevolution)& S,
337 Standard_OStream& OS,
338 const Standard_Boolean compact)
341 OS << REVOLUTION <<" ";
343 OS << "SurfaceOfRevolution";
345 if (!compact) OS << "\n Origin :";
346 Print(S->Location(),OS,compact);
347 if (!compact) OS << "\n Direction :";
348 Print(S->Direction(),OS,compact);
349 if (!compact) OS << "\n Basis curve : ";
351 GeomTools_CurveSet::PrintCurve(S->BasisCurve(),OS,compact);
355 //=======================================================================
358 //=======================================================================
360 static void Print(const Handle(Geom_BezierSurface)& S,
361 Standard_OStream& OS,
362 const Standard_Boolean compact)
367 OS << "BezierSurface";
370 Standard_Boolean urational = S->IsURational();
371 Standard_Boolean vrational = S->IsVRational();
373 OS << (urational ? 1 : 0) << " ";
379 OS << (vrational ? 1 : 0) << " ";
386 Standard_Boolean uclosed = S->IsUClosed();
387 Standard_Boolean vclosed = S->IsVClosed();
395 Standard_Integer i,j,udegree,vdegree;
396 udegree = S->UDegree();
397 vdegree = S->VDegree();
398 if (!compact) OS << "\n Degrees :";
399 OS << udegree << " " << vdegree << " ";
401 for (i = 1; i <= udegree+1; i++) {
402 for (j = 1; j <= vdegree+1; j++) {
403 if (!compact) OS << "\n "<<std::setw(2)<<i<<", "<<std::setw(2)<<j<<" : ";
404 Print(S->Pole(i,j),OS,compact);
405 if (urational || vrational)
406 OS << " " << S->Weight(i,j);
413 if (!compact) OS << "\n";
417 //=======================================================================
420 //=======================================================================
422 static void Print(const Handle(Geom_BSplineSurface)& S,
423 Standard_OStream& OS,
424 const Standard_Boolean compact)
427 OS << BSPLINE << " ";
429 OS << "BSplineSurface";
431 Standard_Boolean urational = S->IsURational();
432 Standard_Boolean vrational = S->IsVRational();
434 OS << (urational ? 1 : 0) << " ";
440 OS << (vrational ? 1 : 0) << " ";
446 Standard_Boolean uperiodic = S->IsUPeriodic();
447 Standard_Boolean vperiodic = S->IsVPeriodic();
449 OS << (uperiodic ? 1 : 0) << " ";
455 OS << (vperiodic ? 1 : 0) << " ";
462 Standard_Boolean uclosed = S->IsUClosed();
463 Standard_Boolean vclosed = S->IsVClosed();
472 Standard_Integer i,j,udegree,vdegree,nbupoles,nbvpoles,nbuknots,nbvknots;
473 udegree = S->UDegree();
474 vdegree = S->VDegree();
475 nbupoles = S->NbUPoles();
476 nbvpoles = S->NbVPoles();
477 nbuknots = S->NbUKnots();
478 nbvknots = S->NbVKnots();
479 if (!compact) OS << "\n Degrees :";
480 OS << udegree << " " << vdegree << " ";
481 if (!compact) OS << "\n NbPoles :";
482 OS << nbupoles << " " << nbvpoles << " ";
483 if (!compact) OS << "\n NbKnots :";
484 OS << nbuknots << " " << nbvknots << " ";
486 if (!compact) OS << "\n Poles :\n";
487 for (i = 1; i <= nbupoles; i++) {
488 for (j = 1; j <= nbvpoles; j++) {
489 if (!compact) OS << "\n "<<std::setw(2)<<i<<", "<<std::setw(2)<<j<<" : ";
490 Print(S->Pole(i,j),OS,compact);
491 if (urational || vrational)
492 OS << " " << S->Weight(i,j);
499 if (!compact) OS << "\n UKnots :\n";
500 for (i = 1; i <= nbuknots; i++) {
501 if (!compact) OS << "\n "<<std::setw(2)<<i<<" : ";
502 OS << S->UKnot(i) << " " << S->UMultiplicity(i) <<"\n";
505 if (!compact) OS << "\n VKnots :\n";
506 for (i = 1; i <= nbvknots; i++) {
507 if (!compact) OS << "\n "<<std::setw(2)<<i<<" : ";
508 OS << S->VKnot(i) << " " << S->VMultiplicity(i) <<"\n";
511 if (!compact) OS << "\n";
515 //=======================================================================
518 //=======================================================================
520 static void Print(const Handle(Geom_RectangularTrimmedSurface)& S,
521 Standard_OStream& OS,
522 const Standard_Boolean compact)
525 OS << RECTANGULAR << " ";
527 OS << "RectangularTrimmedSurface";
529 Standard_Real U1,U2,V1,V2;
530 S->Bounds(U1,U2,V1,V2);
531 if (!compact) OS << "\nParameters : ";
532 OS << U1 << " " << U2 << " " << V1 << " " << V2 <<"\n";
533 if (!compact) OS << "BasisSurface :\n";
534 GeomTools_SurfaceSet::PrintSurface(S->BasisSurface(),OS,compact);
538 //=======================================================================
541 //=======================================================================
543 static void Print(const Handle(Geom_OffsetSurface)& S,
544 Standard_OStream& OS,
545 const Standard_Boolean compact)
550 OS << "OffsetSurface";
552 if (!compact) OS << "\nOffset : ";
553 OS << S->Offset() <<"\n";
554 if (!compact) OS << "BasisSurface :\n";
555 GeomTools_SurfaceSet::PrintSurface(S->BasisSurface(),OS,compact);
559 //=======================================================================
560 //function : PrintSurface
562 //=======================================================================
564 void GeomTools_SurfaceSet::PrintSurface(const Handle(Geom_Surface)& S,
565 Standard_OStream& OS,
566 const Standard_Boolean compact)
568 Handle(Standard_Type) TheType = S->DynamicType();
570 if ( TheType == STANDARD_TYPE(Geom_Plane)) {
571 Print(Handle(Geom_Plane)::DownCast(S),OS,compact);
573 else if ( TheType == STANDARD_TYPE(Geom_CylindricalSurface)) {
574 Print(Handle(Geom_CylindricalSurface)::DownCast(S),OS,compact);
576 else if ( TheType == STANDARD_TYPE(Geom_ConicalSurface)) {
577 Print(Handle(Geom_ConicalSurface)::DownCast(S),OS,compact);
579 else if ( TheType == STANDARD_TYPE(Geom_SphericalSurface)) {
580 Print(Handle(Geom_SphericalSurface)::DownCast(S),OS,compact);
582 else if ( TheType == STANDARD_TYPE(Geom_ToroidalSurface)) {
583 Print(Handle(Geom_ToroidalSurface)::DownCast(S),OS,compact);
585 else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
586 Print(Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(S),OS,compact);
588 else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution)) {
589 Print(Handle(Geom_SurfaceOfRevolution)::DownCast(S),OS,compact);
591 else if ( TheType == STANDARD_TYPE(Geom_BezierSurface)) {
592 Print(Handle(Geom_BezierSurface)::DownCast(S),OS,compact);
594 else if ( TheType == STANDARD_TYPE(Geom_BSplineSurface)) {
595 Print(Handle(Geom_BSplineSurface)::DownCast(S),OS,compact);
597 else if ( TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
598 Print(Handle(Geom_RectangularTrimmedSurface)::DownCast(S),OS,compact);
600 else if ( TheType == STANDARD_TYPE(Geom_OffsetSurface)) {
601 Print(Handle(Geom_OffsetSurface)::DownCast(S),OS,compact);
604 GeomTools::GetUndefinedTypeHandler()->PrintSurface(S,OS,compact);
606 // OS << "***** Unknown Surface ********\n";
608 // std::cout << "***** Unknown Surface ********"<<std::endl;
612 //=======================================================================
615 //=======================================================================
617 void GeomTools_SurfaceSet::Dump(Standard_OStream& OS)const
619 Standard_Integer i, nbsurf = myMap.Extent();
620 OS << "\n -------\n";
621 OS << "Dump of "<< nbsurf << " surfaces ";
622 OS << "\n -------\n\n";
624 for (i = 1; i <= nbsurf; i++) {
625 OS << std::setw(4) << i << " : ";
626 PrintSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS,Standard_False);
631 //=======================================================================
634 //=======================================================================
636 void GeomTools_SurfaceSet::Write(Standard_OStream& OS)const
638 std::streamsize prec = OS.precision(17);
640 Standard_Integer i, nbsurf = myMap.Extent();
641 OS << "Surfaces "<< nbsurf << "\n";
643 Handle(Message_ProgressIndicator) progress = GetProgress();
644 Message_ProgressSentry PS(progress, "Surfaces", 0, nbsurf, 1);
645 for (i = 1; i <= nbsurf && PS.More(); i++, PS.Next()) {
646 PrintSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS,Standard_True);
652 //=======================================================================
655 //=======================================================================
657 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P)
659 Standard_Real X=0.,Y=0.,Z=0.;
660 GeomTools::GetReal(IS, X);
661 GeomTools::GetReal(IS, Y);
662 GeomTools::GetReal(IS, Z);
667 //=======================================================================
670 //=======================================================================
672 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir& D)
674 Standard_Real X=0.,Y=0.,Z=0.;
675 GeomTools::GetReal(IS, X);
676 GeomTools::GetReal(IS, Y);
677 GeomTools::GetReal(IS, Z);
682 //=======================================================================
685 //=======================================================================
687 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Ax3& A3)
690 gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.);
691 IS >> P >> A >> AX >> AY;
693 if (AY.DotCross(A,AX) < 0)
700 //=======================================================================
701 //function : operator>>
703 //=======================================================================
705 static Standard_IStream& operator>>(Standard_IStream& IS,
706 Handle(Geom_Plane)& S)
710 S = new Geom_Plane(A);
714 //=======================================================================
715 //function : operator>>
717 //=======================================================================
719 static Standard_IStream& operator>>(Standard_IStream& IS,
720 Handle(Geom_CylindricalSurface)& S)
725 GeomTools::GetReal(IS, R);
726 S = new Geom_CylindricalSurface(A,R);
730 //=======================================================================
731 //function : operator>>
733 //=======================================================================
735 static Standard_IStream& operator>>(Standard_IStream& IS,
736 Handle(Geom_ConicalSurface)& S)
739 Standard_Real R=0.,Ang=0.;
741 GeomTools::GetReal(IS, R);
742 GeomTools::GetReal(IS, Ang);
743 S = new Geom_ConicalSurface(A,Ang,R);
747 //=======================================================================
748 //function : operator>>
750 //=======================================================================
752 static Standard_IStream& operator>>(Standard_IStream& IS,
753 Handle(Geom_SphericalSurface)& S)
758 GeomTools::GetReal(IS, R);
759 S = new Geom_SphericalSurface(A,R);
763 //=======================================================================
764 //function : operator>>
766 //=======================================================================
768 static Standard_IStream& operator>>(Standard_IStream& IS,
769 Handle(Geom_ToroidalSurface)& S)
772 Standard_Real R1=0.,R2=0.;
774 GeomTools::GetReal(IS, R1);
775 GeomTools::GetReal(IS, R2);
776 S = new Geom_ToroidalSurface(A,R1,R2);
780 //=======================================================================
781 //function : operator>>
783 //=======================================================================
785 static Standard_IStream& operator>>(Standard_IStream& IS,
786 Handle(Geom_SurfaceOfLinearExtrusion)& S)
790 Handle(Geom_Curve) C = GeomTools_CurveSet::ReadCurve(IS);
791 S = new Geom_SurfaceOfLinearExtrusion(C,D);
795 //=======================================================================
796 //function : operator>>
798 //=======================================================================
800 static Standard_IStream& operator>>(Standard_IStream& IS,
801 Handle(Geom_SurfaceOfRevolution)& S)
806 Handle(Geom_Curve) C = GeomTools_CurveSet::ReadCurve(IS);
807 S = new Geom_SurfaceOfRevolution(C,gp_Ax1(P,D));
811 //=======================================================================
812 //function : operator>>
814 //=======================================================================
816 static Standard_IStream& operator>>(Standard_IStream& IS,
817 Handle(Geom_BezierSurface)& S)
819 Standard_Boolean urational=Standard_False, vrational=Standard_False;
820 IS >> urational >> vrational;
821 Standard_Integer udegree=0, vdegree=0;
822 IS >> udegree >> vdegree;
823 TColgp_Array2OfPnt poles(1,udegree+1,1,vdegree+1);
824 TColStd_Array2OfReal weights(1,udegree+1,1,vdegree+1);
826 Standard_Integer i,j;
827 for (i = 1; i <= udegree+1; i++) {
828 for (j = 1; j <= vdegree+1; j++) {
830 if (urational || vrational)
831 GeomTools::GetReal(IS, weights(i,j));
835 if (urational || vrational)
836 S = new Geom_BezierSurface(poles,weights);
838 S = new Geom_BezierSurface(poles);
842 //=======================================================================
843 //function : operator>>
845 //=======================================================================
847 static Standard_IStream& operator>>(Standard_IStream& IS,
848 Handle(Geom_BSplineSurface)& S)
850 Standard_Boolean urational=Standard_False, vrational=Standard_False,
851 uperiodic=Standard_False, vperiodic=Standard_False;
852 IS >> urational >> vrational;
853 IS >> uperiodic >> vperiodic;
854 Standard_Integer udegree=0, vdegree=0,nbupoles=0,nbvpoles=0,nbuknots=0,nbvknots=0;
855 IS >> udegree >> vdegree;
856 IS >> nbupoles >> nbvpoles;
857 IS >> nbuknots >> nbvknots;
859 TColgp_Array2OfPnt poles(1,nbupoles,1,nbvpoles);
860 TColStd_Array2OfReal weights(1,nbupoles,1,nbvpoles);
862 Standard_Integer i,j;
863 for (i = 1; i <= nbupoles; i++) {
864 for (j = 1; j <= nbvpoles; j++) {
866 if (urational || vrational)
867 GeomTools::GetReal(IS, weights(i,j));
871 TColStd_Array1OfReal uknots(1,nbuknots);
872 TColStd_Array1OfInteger umults(1,nbuknots);
873 for (i = 1; i <= nbuknots; i++) {
874 GeomTools::GetReal(IS, uknots(i));
878 TColStd_Array1OfReal vknots(1,nbvknots);
879 TColStd_Array1OfInteger vmults(1,nbvknots);
880 for (i = 1; i <= nbvknots; i++) {
881 GeomTools::GetReal(IS, vknots(i));
885 if (urational || vrational)
886 S = new Geom_BSplineSurface(poles,weights,uknots,vknots,umults,vmults,
887 udegree,vdegree,uperiodic,vperiodic);
889 S = new Geom_BSplineSurface(poles,uknots,vknots,umults,vmults,
890 udegree,vdegree,uperiodic,vperiodic);
894 //=======================================================================
895 //function : operator>>
897 //=======================================================================
899 static Standard_IStream& operator>>(Standard_IStream& IS,
900 Handle(Geom_RectangularTrimmedSurface)& S)
902 Standard_Real U1=0.,U2=0.,V1=0.,V2=0.;
903 GeomTools::GetReal(IS, U1);
904 GeomTools::GetReal(IS, U2);
905 GeomTools::GetReal(IS, V1);
906 GeomTools::GetReal(IS, V2);
907 Handle(Geom_Surface) BS = GeomTools_SurfaceSet::ReadSurface(IS);
908 S = new Geom_RectangularTrimmedSurface(BS,U1,U2,V1,V2);
912 //=======================================================================
913 //function : operator>>
915 //=======================================================================
917 static Standard_IStream& operator>>(Standard_IStream& IS,
918 Handle(Geom_OffsetSurface)& S)
921 GeomTools::GetReal(IS, O);
922 Handle(Geom_Surface) BS = GeomTools_SurfaceSet::ReadSurface(IS);
923 S = new Geom_OffsetSurface(BS,O,Standard_True);
928 //=======================================================================
929 //function : ReadSurface
931 //=======================================================================
933 Handle(Geom_Surface) GeomTools_SurfaceSet::ReadSurface(Standard_IStream& IS)
935 Standard_Integer stype;
937 Handle(Geom_Surface) S;
945 Handle(Geom_Plane) SS;
953 Handle(Geom_CylindricalSurface) SS;
961 Handle(Geom_ConicalSurface) SS;
969 Handle(Geom_SphericalSurface) SS;
977 Handle(Geom_ToroidalSurface) SS;
983 case LINEAREXTRUSION :
985 Handle(Geom_SurfaceOfLinearExtrusion) SS;
993 Handle(Geom_SurfaceOfRevolution) SS;
1001 Handle(Geom_BezierSurface) SS;
1009 Handle(Geom_BSplineSurface) SS;
1017 Handle(Geom_RectangularTrimmedSurface) SS;
1025 Handle(Geom_OffsetSurface) SS;
1033 Handle(Geom_Surface) SS;
1034 GeomTools::GetUndefinedTypeHandler()->ReadSurface(stype,IS,SS);
1040 catch(Standard_Failure const& anException) {
1042 std::cout <<"EXCEPTION in GeomTools_SurfaceSet::ReadSurface(..)!!!" << std::endl;
1043 std::cout << anException << std::endl;
1050 //=======================================================================
1053 //=======================================================================
1055 void GeomTools_SurfaceSet::Read(Standard_IStream& IS)
1059 if (strcmp(buffer,"Surfaces")) {
1060 std::cout << "Not a surface table"<<std::endl;
1064 Standard_Integer i, nbsurf;
1067 Handle(Message_ProgressIndicator) progress = GetProgress();
1068 Message_ProgressSentry PS(progress, "Surfaces", 0, nbsurf, 1);
1069 for (i = 1; i <= nbsurf && PS.More(); i++, PS.Next()) {
1070 Handle(Geom_Surface) S = GeomTools_SurfaceSet::ReadSurface (IS);
1075 //=======================================================================
1076 //function : GetProgress
1078 //=======================================================================
1080 Handle(Message_ProgressIndicator) GeomTools_SurfaceSet::GetProgress() const
1085 //=======================================================================
1086 //function : SetProgress
1088 //=======================================================================
1090 void GeomTools_SurfaceSet::SetProgress(const Handle(Message_ProgressIndicator)& PR)