0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[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
ce7fe22d 17#include <GeomTools.hxx>
7fd59977 18
42cf5bc1 19#include <Geom2d_Curve.hxx>
42cf5bc1 20#include <Geom_Surface.hxx>
7fd59977 21#include <GeomTools_Curve2dSet.hxx>
42cf5bc1 22#include <GeomTools_CurveSet.hxx>
23#include <GeomTools_SurfaceSet.hxx>
7fd59977 24#include <GeomTools_UndefinedTypeHandler.hxx>
25
26static Handle(GeomTools_UndefinedTypeHandler) theActiveHandler = new GeomTools_UndefinedTypeHandler;
27
28void GeomTools::Dump(const Handle(Geom_Surface)& S, Standard_OStream& OS)
29{
30 GeomTools_SurfaceSet::PrintSurface(S,OS);
31}
32
33void GeomTools::Write(const Handle(Geom_Surface)& S, Standard_OStream& OS)
34{
35 GeomTools_SurfaceSet::PrintSurface(S,OS,Standard_True);
36}
37
38void GeomTools::Read(Handle(Geom_Surface)& S, Standard_IStream& IS)
39{
aa00364d 40 S = GeomTools_SurfaceSet::ReadSurface(IS);
7fd59977 41}
42
43void GeomTools::Dump(const Handle(Geom_Curve)& C, Standard_OStream& OS)
44{
45 GeomTools_CurveSet::PrintCurve(C,OS);
46}
47
48void GeomTools::Write(const Handle(Geom_Curve)& C, Standard_OStream& OS)
49{
50 GeomTools_CurveSet::PrintCurve(C,OS,Standard_True);
51}
52
53void GeomTools::Read(Handle(Geom_Curve)& C, Standard_IStream& IS)
54{
aa00364d 55 C = GeomTools_CurveSet::ReadCurve(IS);
7fd59977 56}
57
58void GeomTools::Dump(const Handle(Geom2d_Curve)& C, Standard_OStream& OS)
59{
60 GeomTools_Curve2dSet::PrintCurve2d(C,OS);
61}
62
63void GeomTools::Write(const Handle(Geom2d_Curve)& C, Standard_OStream& OS)
64{
65 GeomTools_Curve2dSet::PrintCurve2d(C,OS,Standard_True);
66}
67
68void GeomTools::Read(Handle(Geom2d_Curve)& C, Standard_IStream& IS)
69{
aa00364d 70 C = GeomTools_Curve2dSet::ReadCurve2d(IS);
7fd59977 71}
72
73//=======================================================================
74//function : SetUndefinedTypeHandler
75//purpose :
76//=======================================================================
77
78void GeomTools::SetUndefinedTypeHandler(const Handle(GeomTools_UndefinedTypeHandler)& aHandler)
79{
80 if(!aHandler.IsNull())
81 theActiveHandler = aHandler;
82}
83
84//=======================================================================
85//function : GetUndefinedTypeHandler
86//purpose :
87//=======================================================================
88
89Handle(GeomTools_UndefinedTypeHandler) GeomTools::GetUndefinedTypeHandler()
90{
91 return theActiveHandler;
92}
71598a83 93
94//=======================================================================
95//function : GetReal
96//purpose :
97//=======================================================================
98
99void GeomTools::GetReal(Standard_IStream& IS,Standard_Real& theValue)
100{
101 theValue = 0.;
102 if (IS.eof())
103 return;
104
105 char buffer[256];
106 buffer[0] = '\0';
107 std::streamsize anOldWide = IS.width(256);
108 IS >> buffer;
109 IS.width(anOldWide);
110 theValue = Strtod(buffer, NULL);
111}