0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / GeomToStep / GeomToStep_MakeSurface.cxx
CommitLineData
b311480e 1// Created on: 1993-06-22
2// Created by: Martine LANGLOIS
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
42cf5bc1 17
7fd59977 18#include <Geom_BoundedSurface.hxx>
7fd59977 19#include <Geom_ElementarySurface.hxx>
42cf5bc1 20#include <Geom_OffsetSurface.hxx>
21#include <Geom_Surface.hxx>
7fd59977 22#include <Geom_SweptSurface.hxx>
42cf5bc1 23#include <GeomToStep_MakeBoundedSurface.hxx>
24#include <GeomToStep_MakeElementarySurface.hxx>
25#include <GeomToStep_MakeSurface.hxx>
7fd59977 26#include <GeomToStep_MakeSweptSurface.hxx>
42cf5bc1 27#include <StdFail_NotDone.hxx>
7fd59977 28#include <StepData_Logical.hxx>
42cf5bc1 29#include <StepGeom_BoundedSurface.hxx>
30#include <StepGeom_ElementarySurface.hxx>
31#include <StepGeom_OffsetSurface.hxx>
32#include <StepGeom_Surface.hxx>
33#include <StepGeom_SweptSurface.hxx>
34#include <TCollection_HAsciiString.hxx>
7fd59977 35#include <UnitsMethods.hxx>
36
37//=============================================================================
38// Creation d' une Surface de prostep a partir d' une Surface de Geom
39//=============================================================================
7fd59977 40GeomToStep_MakeSurface::GeomToStep_MakeSurface ( const Handle(Geom_Surface)& S)
41{
42 done = Standard_True;
43 if (S->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
44 Handle(Geom_BoundedSurface) S1 =
45 Handle(Geom_BoundedSurface)::DownCast(S);
46 GeomToStep_MakeBoundedSurface MkBoundedS(S1);
47 theSurface = MkBoundedS.Value();
48 }
49 else if (S->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
50 Handle(Geom_ElementarySurface) S1 =
51 Handle(Geom_ElementarySurface)::DownCast(S);
52 GeomToStep_MakeElementarySurface MkElementaryS(S1);
53 theSurface = MkElementaryS.Value();
54 }
55 else if (S->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
56 Handle(Geom_SweptSurface) S1 =
57 Handle(Geom_SweptSurface)::DownCast(S);
58 GeomToStep_MakeSweptSurface MkSwept(S1);
59 theSurface = MkSwept.Value();
60 }
61 else if (S->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
62 Handle(Geom_OffsetSurface) S1 =
63 Handle(Geom_OffsetSurface)::DownCast(S);
64 GeomToStep_MakeSurface MkBasis(S1->BasisSurface());
65 done = MkBasis.IsDone();
66 if (!done) return;
67 Handle(StepGeom_OffsetSurface) Surf = new StepGeom_OffsetSurface;
68 Surf->Init (new TCollection_HAsciiString(""),
69 MkBasis.Value(),S1->Offset()/UnitsMethods::LengthFactor(),StepData_LFalse);
70 theSurface = Surf;
71 }
72 else {
73 done = Standard_False;
0797d9d3 74#ifdef OCCT_DEBUG
7fd59977 75 cout << " unknown type " << S->DynamicType()->Name() << endl;
76#endif
77 }
78}
79
80
81//=============================================================================
82// renvoi des valeurs
83//=============================================================================
84
85const Handle(StepGeom_Surface) &
86 GeomToStep_MakeSurface::Value() const
87{
11bf7051 88 StdFail_NotDone_Raise_if(!done, "");
7fd59977 89 return theSurface;
90}