Warnings on vc14 were eliminated
[occt.git] / src / GeomTools / GeomTools.cxx
1 // Created on: 1993-01-21
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <Geom2d_Curve.hxx>
19 #include <Geom_Curve.hxx>
20 #include <Geom_Surface.hxx>
21 #include <GeomTools.hxx>
22 #include <GeomTools_Curve2dSet.hxx>
23 #include <GeomTools_CurveSet.hxx>
24 #include <GeomTools_SurfaceSet.hxx>
25 #include <GeomTools_UndefinedTypeHandler.hxx>
26
27 static Handle(GeomTools_UndefinedTypeHandler) theActiveHandler = new GeomTools_UndefinedTypeHandler;
28
29 void  GeomTools::Dump(const Handle(Geom_Surface)& S, Standard_OStream& OS)
30 {
31   GeomTools_SurfaceSet::PrintSurface(S,OS);
32 }
33
34 void  GeomTools::Write(const Handle(Geom_Surface)& S, Standard_OStream& OS)
35 {
36   GeomTools_SurfaceSet::PrintSurface(S,OS,Standard_True);
37 }
38
39 void GeomTools::Read(Handle(Geom_Surface)& S, Standard_IStream& IS)
40 {
41   S = GeomTools_SurfaceSet::ReadSurface(IS);
42 }
43
44 void  GeomTools::Dump(const Handle(Geom_Curve)& C, Standard_OStream& OS)
45 {
46   GeomTools_CurveSet::PrintCurve(C,OS);
47 }
48
49 void  GeomTools::Write(const Handle(Geom_Curve)& C, Standard_OStream& OS)
50 {
51   GeomTools_CurveSet::PrintCurve(C,OS,Standard_True);
52 }
53
54 void GeomTools::Read(Handle(Geom_Curve)& C, Standard_IStream& IS)
55 {
56   C = GeomTools_CurveSet::ReadCurve(IS);
57 }
58
59 void  GeomTools::Dump(const Handle(Geom2d_Curve)& C, Standard_OStream& OS)
60 {
61   GeomTools_Curve2dSet::PrintCurve2d(C,OS);
62 }
63
64 void  GeomTools::Write(const Handle(Geom2d_Curve)& C, Standard_OStream& OS)
65 {
66   GeomTools_Curve2dSet::PrintCurve2d(C,OS,Standard_True);
67 }
68
69 void  GeomTools::Read(Handle(Geom2d_Curve)& C, Standard_IStream& IS)
70 {
71   C = GeomTools_Curve2dSet::ReadCurve2d(IS);
72 }
73
74 //=======================================================================
75 //function : SetUndefinedTypeHandler
76 //purpose  : 
77 //=======================================================================
78
79 void GeomTools::SetUndefinedTypeHandler(const Handle(GeomTools_UndefinedTypeHandler)& aHandler)
80 {
81   if(!aHandler.IsNull())
82     theActiveHandler = aHandler;
83 }
84
85 //=======================================================================
86 //function : GetUndefinedTypeHandler
87 //purpose  : 
88 //=======================================================================
89
90 Handle(GeomTools_UndefinedTypeHandler) GeomTools::GetUndefinedTypeHandler()
91 {
92   return theActiveHandler;
93 }
94
95 //=======================================================================
96 //function : GetReal
97 //purpose  : 
98 //=======================================================================
99
100 void GeomTools::GetReal(Standard_IStream& IS,Standard_Real& theValue)
101 {
102   theValue = 0.;
103   if (IS.eof()) 
104     return;
105
106   char buffer[256];
107   buffer[0] = '\0';
108   std::streamsize anOldWide = IS.width(256);
109   IS >> buffer;
110   IS.width(anOldWide);
111   theValue = Strtod(buffer, NULL);
112 }