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.
17 #include <Standard_Stream.hxx>
18 #include <GeomTools_SurfaceSet.ixx>
19 #include <GeomTools.hxx>
20 #include <GeomTools_UndefinedTypeHandler.hxx>
22 #include <GeomTools_CurveSet.hxx>
23 #include <Geom_Plane.hxx>
24 #include <Geom_CylindricalSurface.hxx>
25 #include <Geom_ConicalSurface.hxx>
26 #include <Geom_SphericalSurface.hxx>
27 #include <Geom_ToroidalSurface.hxx>
28 #include <Geom_SurfaceOfLinearExtrusion.hxx>
29 #include <Geom_SurfaceOfRevolution.hxx>
30 #include <Geom_BezierSurface.hxx>
31 #include <Geom_BSplineSurface.hxx>
32 #include <Geom_RectangularTrimmedSurface.hxx>
33 #include <Geom_OffsetSurface.hxx>
36 #include <gp_Cylinder.hxx>
37 #include <gp_Cone.hxx>
38 #include <gp_Sphere.hxx>
39 #include <gp_Torus.hxx>
41 #include <TColStd_Array1OfReal.hxx>
42 #include <TColStd_Array1OfInteger.hxx>
43 #include <TColgp_Array1OfPnt.hxx>
44 #include <TColStd_Array2OfReal.hxx>
45 #include <TColgp_Array2OfPnt.hxx>
46 #include <Standard_Failure.hxx>
47 #include <Standard_ErrorHandler.hxx>
48 #include <Message_ProgressSentry.hxx>
55 #define LINEAREXTRUSION 6
59 #define RECTANGULAR 10
62 //=======================================================================
63 //function : GeomTools_SurfaceSet
65 //=======================================================================
67 GeomTools_SurfaceSet::GeomTools_SurfaceSet()
72 //=======================================================================
75 //=======================================================================
77 void GeomTools_SurfaceSet::Clear()
83 //=======================================================================
86 //=======================================================================
88 Standard_Integer GeomTools_SurfaceSet::Add(const Handle(Geom_Surface)& S)
94 //=======================================================================
97 //=======================================================================
99 Handle(Geom_Surface) GeomTools_SurfaceSet::Surface
100 (const Standard_Integer I)const
102 if (I <= 0 || I > myMap.Extent())
103 return Handle(Geom_Surface)();
104 return Handle(Geom_Surface)::DownCast(myMap(I));
108 //=======================================================================
111 //=======================================================================
113 Standard_Integer GeomTools_SurfaceSet::Index
114 (const Handle(Geom_Surface)& S)const
116 return myMap.FindIndex(S);
119 //=======================================================================
122 //=======================================================================
124 static void Print(const gp_Pnt P,
125 Standard_OStream& OS,
126 const Standard_Boolean compact)
129 if (!compact) OS << ",";
132 if (!compact) OS << ",";
138 //=======================================================================
141 //=======================================================================
143 static void Print(const gp_Dir D,
144 Standard_OStream& OS,
145 const Standard_Boolean compact)
148 if (!compact) OS << ",";
151 if (!compact) OS << ",";
157 //=======================================================================
160 //=======================================================================
162 static void Print(const Handle(Geom_Plane)& S,
163 Standard_OStream& OS,
164 const Standard_Boolean compact)
172 if (!compact) OS << "\n Origin :";
173 Print(P.Location(),OS,compact);
174 if (!compact) OS << "\n Axis :";
175 Print(P.Axis().Direction(),OS,compact);
176 if (!compact) OS << "\n XAxis :";
177 Print(P.XAxis().Direction(),OS,compact);
178 if (!compact) OS << "\n YAxis :";
179 Print(P.YAxis().Direction(),OS,compact);
181 if (!compact) OS << "\n";
185 //=======================================================================
188 //=======================================================================
190 static void Print(const Handle(Geom_CylindricalSurface)& S,
191 Standard_OStream& OS,
192 const Standard_Boolean compact)
195 OS << CYLINDER << " ";
197 OS << "CylindricalSurface";
199 gp_Cylinder P = S->Cylinder();
200 if (!compact) OS << "\n Origin :";
201 Print(P.Location(),OS,compact);
202 if (!compact) OS << "\n Axis :";
203 Print(P.Axis().Direction(),OS,compact);
204 if (!compact) OS << "\n XAxis :";
205 Print(P.XAxis().Direction(),OS,compact);
206 if (!compact) OS << "\n YAxis :";
207 Print(P.YAxis().Direction(),OS,compact);
208 if (!compact) OS << "\n Radius :";
211 if (!compact) OS << "\n";
215 //=======================================================================
218 //=======================================================================
220 static void Print(const Handle(Geom_ConicalSurface)& S,
221 Standard_OStream& OS,
222 const Standard_Boolean compact)
227 OS << "ConicalSurface";
229 gp_Cone P = S->Cone();
230 if (!compact) OS << "\n Origin :";
231 Print(P.Location(),OS,compact);
232 if (!compact) OS << "\n Axis :";
233 Print(P.Axis().Direction(),OS,compact);
234 if (!compact) OS << "\n XAxis :";
235 Print(P.XAxis().Direction(),OS,compact);
236 if (!compact) OS << "\n YAxis :";
237 Print(P.YAxis().Direction(),OS,compact);
238 if (!compact) OS << "\n Radius :";
241 if (!compact) OS << "\n Angle :";
244 if (!compact) OS << "\n";
248 //=======================================================================
251 //=======================================================================
253 static void Print(const Handle(Geom_SphericalSurface)& S,
254 Standard_OStream& OS,
255 const Standard_Boolean compact)
260 OS << "SphericalSurface";
262 gp_Sphere P = S->Sphere();
263 if (!compact) OS << "\n Center :";
264 Print(P.Location(),OS,compact);
265 if (!compact) OS << "\n Axis :";
266 Print(P.Position().Axis().Direction(),OS,compact);
267 if (!compact) OS << "\n XAxis :";
268 Print(P.XAxis().Direction(),OS,compact);
269 if (!compact) OS << "\n YAxis :";
270 Print(P.YAxis().Direction(),OS,compact);
271 if (!compact) OS << "\n Radius :";
274 if (!compact) OS << "\n";
278 //=======================================================================
281 //=======================================================================
283 static void Print(const Handle(Geom_ToroidalSurface)& S,
284 Standard_OStream& OS,
285 const Standard_Boolean compact)
290 OS << "ToroidalSurface";
292 gp_Torus P = S->Torus();
293 if (!compact) OS << "\n Origin :";
294 Print(P.Location(),OS,compact);
295 if (!compact) OS << "\n Axis :";
296 Print(P.Axis().Direction(),OS,compact);
297 if (!compact) OS << "\n XAxis :";
298 Print(P.XAxis().Direction(),OS,compact);
299 if (!compact) OS << "\n YAxis :";
300 Print(P.YAxis().Direction(),OS,compact);
301 if (!compact) OS << "\n Radii :";
302 OS << P.MajorRadius() << " " << P.MinorRadius();
304 if (!compact) OS << "\n";
308 //=======================================================================
311 //=======================================================================
313 static void Print(const Handle(Geom_SurfaceOfLinearExtrusion)& S,
314 Standard_OStream& OS,
315 const Standard_Boolean compact)
318 OS << LINEAREXTRUSION << " ";
320 OS << "SurfaceOfLinearExtrusion";
322 if (!compact) OS << "\n Direction :";
323 Print(S->Direction(),OS,compact);
324 if (!compact) OS << "\n Basis curve : ";
326 GeomTools_CurveSet::PrintCurve(S->BasisCurve(),OS,compact);
330 //=======================================================================
333 //=======================================================================
335 static void Print(const Handle(Geom_SurfaceOfRevolution)& S,
336 Standard_OStream& OS,
337 const Standard_Boolean compact)
340 OS << REVOLUTION <<" ";
342 OS << "SurfaceOfRevolution";
344 if (!compact) OS << "\n Origin :";
345 Print(S->Location(),OS,compact);
346 if (!compact) OS << "\n Direction :";
347 Print(S->Direction(),OS,compact);
348 if (!compact) OS << "\n Basis curve : ";
350 GeomTools_CurveSet::PrintCurve(S->BasisCurve(),OS,compact);
354 //=======================================================================
357 //=======================================================================
359 static void Print(const Handle(Geom_BezierSurface)& S,
360 Standard_OStream& OS,
361 const Standard_Boolean compact)
366 OS << "BezierSurface";
369 Standard_Boolean urational = S->IsURational();
370 Standard_Boolean vrational = S->IsVRational();
372 OS << (urational ? 1 : 0) << " ";
378 OS << (vrational ? 1 : 0) << " ";
385 Standard_Boolean uclosed = S->IsUClosed();
386 Standard_Boolean vclosed = S->IsVClosed();
394 Standard_Integer i,j,udegree,vdegree;
395 udegree = S->UDegree();
396 vdegree = S->VDegree();
397 if (!compact) OS << "\n Degrees :";
398 OS << udegree << " " << vdegree << " ";
400 for (i = 1; i <= udegree+1; i++) {
401 for (j = 1; j <= vdegree+1; j++) {
402 if (!compact) OS << "\n "<<setw(2)<<i<<", "<<setw(2)<<j<<" : ";
403 Print(S->Pole(i,j),OS,compact);
404 if (urational || vrational)
405 OS << " " << S->Weight(i,j);
412 if (!compact) OS << "\n";
416 //=======================================================================
419 //=======================================================================
421 static void Print(const Handle(Geom_BSplineSurface)& S,
422 Standard_OStream& OS,
423 const Standard_Boolean compact)
426 OS << BSPLINE << " ";
428 OS << "BSplineSurface";
430 Standard_Boolean urational = S->IsURational();
431 Standard_Boolean vrational = S->IsVRational();
433 OS << (urational ? 1 : 0) << " ";
439 OS << (vrational ? 1 : 0) << " ";
445 Standard_Boolean uperiodic = S->IsUPeriodic();
446 Standard_Boolean vperiodic = S->IsVPeriodic();
448 OS << (uperiodic ? 1 : 0) << " ";
454 OS << (vperiodic ? 1 : 0) << " ";
461 Standard_Boolean uclosed = S->IsUClosed();
462 Standard_Boolean vclosed = S->IsVClosed();
471 Standard_Integer i,j,udegree,vdegree,nbupoles,nbvpoles,nbuknots,nbvknots;
472 udegree = S->UDegree();
473 vdegree = S->VDegree();
474 nbupoles = S->NbUPoles();
475 nbvpoles = S->NbVPoles();
476 nbuknots = S->NbUKnots();
477 nbvknots = S->NbVKnots();
478 if (!compact) OS << "\n Degrees :";
479 OS << udegree << " " << vdegree << " ";
480 if (!compact) OS << "\n NbPoles :";
481 OS << nbupoles << " " << nbvpoles << " ";
482 if (!compact) OS << "\n NbKnots :";
483 OS << nbuknots << " " << nbvknots << " ";
485 if (!compact) OS << "\n Poles :\n";
486 for (i = 1; i <= nbupoles; i++) {
487 for (j = 1; j <= nbvpoles; j++) {
488 if (!compact) OS << "\n "<<setw(2)<<i<<", "<<setw(2)<<j<<" : ";
489 Print(S->Pole(i,j),OS,compact);
490 if (urational || vrational)
491 OS << " " << S->Weight(i,j);
498 if (!compact) OS << "\n UKnots :\n";
499 for (i = 1; i <= nbuknots; i++) {
500 if (!compact) OS << "\n "<<setw(2)<<i<<" : ";
501 OS << S->UKnot(i) << " " << S->UMultiplicity(i) <<"\n";
504 if (!compact) OS << "\n VKnots :\n";
505 for (i = 1; i <= nbvknots; i++) {
506 if (!compact) OS << "\n "<<setw(2)<<i<<" : ";
507 OS << S->VKnot(i) << " " << S->VMultiplicity(i) <<"\n";
510 if (!compact) OS << "\n";
514 //=======================================================================
517 //=======================================================================
519 static void Print(const Handle(Geom_RectangularTrimmedSurface)& S,
520 Standard_OStream& OS,
521 const Standard_Boolean compact)
524 OS << RECTANGULAR << " ";
526 OS << "RectangularTrimmedSurface";
528 Standard_Real U1,U2,V1,V2;
529 S->Bounds(U1,U2,V1,V2);
530 if (!compact) OS << "\nParameters : ";
531 OS << U1 << " " << U2 << " " << V1 << " " << V2 <<"\n";
532 if (!compact) OS << "BasisSurface :\n";
533 GeomTools_SurfaceSet::PrintSurface(S->BasisSurface(),OS,compact);
537 //=======================================================================
540 //=======================================================================
542 static void Print(const Handle(Geom_OffsetSurface)& S,
543 Standard_OStream& OS,
544 const Standard_Boolean compact)
549 OS << "OffsetSurface";
551 if (!compact) OS << "\nOffset : ";
552 OS << S->Offset() <<"\n";
553 if (!compact) OS << "BasisSurface :\n";
554 GeomTools_SurfaceSet::PrintSurface(S->BasisSurface(),OS,compact);
558 //=======================================================================
559 //function : PrintSurface
561 //=======================================================================
563 void GeomTools_SurfaceSet::PrintSurface(const Handle(Geom_Surface)& S,
564 Standard_OStream& OS,
565 const Standard_Boolean compact)
567 Handle(Standard_Type) TheType = S->DynamicType();
569 if ( TheType == STANDARD_TYPE(Geom_Plane)) {
570 Print(Handle(Geom_Plane)::DownCast(S),OS,compact);
572 else if ( TheType == STANDARD_TYPE(Geom_CylindricalSurface)) {
573 Print(Handle(Geom_CylindricalSurface)::DownCast(S),OS,compact);
575 else if ( TheType == STANDARD_TYPE(Geom_ConicalSurface)) {
576 Print(Handle(Geom_ConicalSurface)::DownCast(S),OS,compact);
578 else if ( TheType == STANDARD_TYPE(Geom_SphericalSurface)) {
579 Print(Handle(Geom_SphericalSurface)::DownCast(S),OS,compact);
581 else if ( TheType == STANDARD_TYPE(Geom_ToroidalSurface)) {
582 Print(Handle(Geom_ToroidalSurface)::DownCast(S),OS,compact);
584 else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
585 Print(Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(S),OS,compact);
587 else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution)) {
588 Print(Handle(Geom_SurfaceOfRevolution)::DownCast(S),OS,compact);
590 else if ( TheType == STANDARD_TYPE(Geom_BezierSurface)) {
591 Print(Handle(Geom_BezierSurface)::DownCast(S),OS,compact);
593 else if ( TheType == STANDARD_TYPE(Geom_BSplineSurface)) {
594 Print(Handle(Geom_BSplineSurface)::DownCast(S),OS,compact);
596 else if ( TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
597 Print(Handle(Geom_RectangularTrimmedSurface)::DownCast(S),OS,compact);
599 else if ( TheType == STANDARD_TYPE(Geom_OffsetSurface)) {
600 Print(Handle(Geom_OffsetSurface)::DownCast(S),OS,compact);
603 GeomTools::GetUndefinedTypeHandler()->PrintSurface(S,OS,compact);
605 // OS << "***** Unknown Surface ********\n";
607 // cout << "***** Unknown Surface ********"<<endl;
611 //=======================================================================
614 //=======================================================================
616 void GeomTools_SurfaceSet::Dump(Standard_OStream& OS)const
618 Standard_Integer i, nbsurf = myMap.Extent();
619 OS << "\n -------\n";
620 OS << "Dump of "<< nbsurf << " surfaces ";
621 OS << "\n -------\n\n";
623 for (i = 1; i <= nbsurf; i++) {
624 OS << setw(4) << i << " : ";
625 PrintSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS,Standard_False);
630 //=======================================================================
633 //=======================================================================
635 void GeomTools_SurfaceSet::Write(Standard_OStream& OS)const
637 std::streamsize prec = OS.precision(17);
639 Standard_Integer i, nbsurf = myMap.Extent();
640 OS << "Surfaces "<< nbsurf << "\n";
642 Handle(Message_ProgressIndicator) progress = GetProgress();
643 Message_ProgressSentry PS(progress, "Surfaces", 0, nbsurf, 1);
644 for (i = 1; i <= nbsurf && PS.More(); i++, PS.Next()) {
645 PrintSurface(Handle(Geom_Surface)::DownCast(myMap(i)),OS,Standard_True);
651 //=======================================================================
654 //=======================================================================
656 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Pnt& P)
658 Standard_Real X=0.,Y=0.,Z=0.;
659 GeomTools::GetReal(IS, X);
660 GeomTools::GetReal(IS, Y);
661 GeomTools::GetReal(IS, Z);
666 //=======================================================================
669 //=======================================================================
671 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Dir& D)
673 Standard_Real X=0.,Y=0.,Z=0.;
674 GeomTools::GetReal(IS, X);
675 GeomTools::GetReal(IS, Y);
676 GeomTools::GetReal(IS, Z);
681 //=======================================================================
684 //=======================================================================
686 static Standard_IStream& operator>>(Standard_IStream& IS, gp_Ax3& A3)
689 gp_Dir A(1.,0.,0.),AX(1.,0.,0.),AY(1.,0.,0.);
690 IS >> P >> A >> AX >> AY;
692 if (AY.DotCross(A,AX) < 0)
699 //=======================================================================
700 //function : operator>>
702 //=======================================================================
704 static Standard_IStream& operator>>(Standard_IStream& IS,
705 Handle(Geom_Plane)& S)
709 S = new Geom_Plane(A);
713 //=======================================================================
714 //function : operator>>
716 //=======================================================================
718 static Standard_IStream& operator>>(Standard_IStream& IS,
719 Handle(Geom_CylindricalSurface)& S)
724 GeomTools::GetReal(IS, R);
725 S = new Geom_CylindricalSurface(A,R);
729 //=======================================================================
730 //function : operator>>
732 //=======================================================================
734 static Standard_IStream& operator>>(Standard_IStream& IS,
735 Handle(Geom_ConicalSurface)& S)
738 Standard_Real R=0.,Ang=0.;
740 GeomTools::GetReal(IS, R);
741 GeomTools::GetReal(IS, Ang);
742 S = new Geom_ConicalSurface(A,Ang,R);
746 //=======================================================================
747 //function : operator>>
749 //=======================================================================
751 static Standard_IStream& operator>>(Standard_IStream& IS,
752 Handle(Geom_SphericalSurface)& S)
757 GeomTools::GetReal(IS, R);
758 S = new Geom_SphericalSurface(A,R);
762 //=======================================================================
763 //function : operator>>
765 //=======================================================================
767 static Standard_IStream& operator>>(Standard_IStream& IS,
768 Handle(Geom_ToroidalSurface)& S)
771 Standard_Real R1=0.,R2=0.;
773 GeomTools::GetReal(IS, R1);
774 GeomTools::GetReal(IS, R2);
775 S = new Geom_ToroidalSurface(A,R1,R2);
779 //=======================================================================
780 //function : operator>>
782 //=======================================================================
784 static Standard_IStream& operator>>(Standard_IStream& IS,
785 Handle(Geom_SurfaceOfLinearExtrusion)& S)
788 Handle(Geom_Curve) C;
790 GeomTools_CurveSet::ReadCurve(IS,C);
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)
805 Handle(Geom_Curve) C;
807 GeomTools_CurveSet::ReadCurve(IS,C);
808 S = new Geom_SurfaceOfRevolution(C,gp_Ax1(P,D));
812 //=======================================================================
813 //function : operator>>
815 //=======================================================================
817 static Standard_IStream& operator>>(Standard_IStream& IS,
818 Handle(Geom_BezierSurface)& S)
820 Standard_Boolean urational=Standard_False, vrational=Standard_False;
821 IS >> urational >> vrational;
822 Standard_Integer udegree=0, vdegree=0;
823 IS >> udegree >> vdegree;
824 TColgp_Array2OfPnt poles(1,udegree+1,1,vdegree+1);
825 TColStd_Array2OfReal weights(1,udegree+1,1,vdegree+1);
827 Standard_Integer i,j;
828 for (i = 1; i <= udegree+1; i++) {
829 for (j = 1; j <= vdegree+1; j++) {
831 if (urational || vrational)
832 GeomTools::GetReal(IS, weights(i,j));
836 if (urational || vrational)
837 S = new Geom_BezierSurface(poles,weights);
839 S = new Geom_BezierSurface(poles);
843 //=======================================================================
844 //function : operator>>
846 //=======================================================================
848 static Standard_IStream& operator>>(Standard_IStream& IS,
849 Handle(Geom_BSplineSurface)& S)
851 Standard_Boolean urational=Standard_False, vrational=Standard_False,
852 uperiodic=Standard_False, vperiodic=Standard_False;
853 IS >> urational >> vrational;
854 IS >> uperiodic >> vperiodic;
855 Standard_Integer udegree=0, vdegree=0,nbupoles=0,nbvpoles=0,nbuknots=0,nbvknots=0;
856 IS >> udegree >> vdegree;
857 IS >> nbupoles >> nbvpoles;
858 IS >> nbuknots >> nbvknots;
860 TColgp_Array2OfPnt poles(1,nbupoles,1,nbvpoles);
861 TColStd_Array2OfReal weights(1,nbupoles,1,nbvpoles);
863 Standard_Integer i,j;
864 for (i = 1; i <= nbupoles; i++) {
865 for (j = 1; j <= nbvpoles; j++) {
867 if (urational || vrational)
868 GeomTools::GetReal(IS, weights(i,j));
872 TColStd_Array1OfReal uknots(1,nbuknots);
873 TColStd_Array1OfInteger umults(1,nbuknots);
874 for (i = 1; i <= nbuknots; i++) {
875 GeomTools::GetReal(IS, uknots(i));
879 TColStd_Array1OfReal vknots(1,nbvknots);
880 TColStd_Array1OfInteger vmults(1,nbvknots);
881 for (i = 1; i <= nbvknots; i++) {
882 GeomTools::GetReal(IS, vknots(i));
886 if (urational || vrational)
887 S = new Geom_BSplineSurface(poles,weights,uknots,vknots,umults,vmults,
888 udegree,vdegree,uperiodic,vperiodic);
890 S = new Geom_BSplineSurface(poles,uknots,vknots,umults,vmults,
891 udegree,vdegree,uperiodic,vperiodic);
895 //=======================================================================
896 //function : operator>>
898 //=======================================================================
900 static Standard_IStream& operator>>(Standard_IStream& IS,
901 Handle(Geom_RectangularTrimmedSurface)& S)
903 Standard_Real U1=0.,U2=0.,V1=0.,V2=0.;
904 GeomTools::GetReal(IS, U1);
905 GeomTools::GetReal(IS, U2);
906 GeomTools::GetReal(IS, V1);
907 GeomTools::GetReal(IS, V2);
908 Handle(Geom_Surface) BS;
909 GeomTools_SurfaceSet::ReadSurface(IS,BS);
910 S = new Geom_RectangularTrimmedSurface(BS,U1,U2,V1,V2);
914 //=======================================================================
915 //function : operator>>
917 //=======================================================================
919 static Standard_IStream& operator>>(Standard_IStream& IS,
920 Handle(Geom_OffsetSurface)& S)
923 GeomTools::GetReal(IS, O);
924 Handle(Geom_Surface) BS;
925 GeomTools_SurfaceSet::ReadSurface(IS,BS);
926 S = new Geom_OffsetSurface(BS,O);
931 //=======================================================================
932 //function : ReadSurface
934 //=======================================================================
936 Standard_IStream& GeomTools_SurfaceSet::ReadSurface(Standard_IStream& IS,
937 Handle(Geom_Surface)& S)
939 Standard_Integer stype;
948 Handle(Geom_Plane) SS;
956 Handle(Geom_CylindricalSurface) SS;
964 Handle(Geom_ConicalSurface) SS;
972 Handle(Geom_SphericalSurface) SS;
980 Handle(Geom_ToroidalSurface) SS;
986 case LINEAREXTRUSION :
988 Handle(Geom_SurfaceOfLinearExtrusion) SS;
996 Handle(Geom_SurfaceOfRevolution) SS;
1004 Handle(Geom_BezierSurface) SS;
1012 Handle(Geom_BSplineSurface) SS;
1020 Handle(Geom_RectangularTrimmedSurface) SS;
1028 Handle(Geom_OffsetSurface) SS;
1036 Handle(Geom_Surface) SS;
1037 GeomTools::GetUndefinedTypeHandler()->ReadSurface(stype,IS,SS);
1043 catch(Standard_Failure) {
1045 Handle(Standard_Failure) anExc = Standard_Failure::Caught();
1046 cout <<"EXCEPTION in GeomTools_SurfaceSet::ReadSurface(..)!!!" << endl;
1047 cout << anExc << endl;
1054 //=======================================================================
1057 //=======================================================================
1059 void GeomTools_SurfaceSet::Read(Standard_IStream& IS)
1063 if (strcmp(buffer,"Surfaces")) {
1064 cout << "Not a surface table"<<endl;
1068 Handle(Geom_Surface) S;
1069 Standard_Integer i, nbsurf;
1072 Handle(Message_ProgressIndicator) progress = GetProgress();
1073 Message_ProgressSentry PS(progress, "Surfaces", 0, nbsurf, 1);
1074 for (i = 1; i <= nbsurf && PS.More(); i++, PS.Next()) {
1075 GeomTools_SurfaceSet::ReadSurface(IS,S);
1080 //=======================================================================
1081 //function : GetProgress
1083 //=======================================================================
1085 Handle(Message_ProgressIndicator) GeomTools_SurfaceSet::GetProgress() const
1090 //=======================================================================
1091 //function : SetProgress
1093 //=======================================================================
1095 void GeomTools_SurfaceSet::SetProgress(const Handle(Message_ProgressIndicator)& PR)