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