20e04d9f29c44d6448129409aa90a23221d06e18
[occt.git] / src / GeomToStep / GeomToStep_MakePlane.cxx
1 // Created on: 1993-06-17
2 // Created by: Martine LANGLOIS
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 <Geom_Plane.hxx>
19 #include <GeomToStep_MakeAxis2Placement3d.hxx>
20 #include <GeomToStep_MakePlane.hxx>
21 #include <gp_Dir.hxx>
22 #include <gp_Pln.hxx>
23 #include <StdFail_NotDone.hxx>
24 #include <StepGeom_Axis2Placement3d.hxx>
25 #include <StepGeom_Plane.hxx>
26 #include <TCollection_HAsciiString.hxx>
27
28 //=============================================================================
29 // Creation d' un plane de prostep a partir d' un Pln de gp
30 //=============================================================================
31 GeomToStep_MakePlane::GeomToStep_MakePlane( const gp_Pln& P)
32 {
33   Handle(StepGeom_Plane) Plan = new StepGeom_Plane;
34   Handle(StepGeom_Axis2Placement3d) aPosition;
35
36   GeomToStep_MakeAxis2Placement3d MkAxis2(P.Position());
37   aPosition = MkAxis2.Value();
38   Plan->SetPosition(aPosition);
39   Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
40   Plan->SetName(name);
41   thePlane = Plan;
42   done = Standard_True;
43 }
44
45 //=============================================================================
46 // Creation d' un plane de prostep a partir d' un Plane de Geom
47 //=============================================================================
48
49 GeomToStep_MakePlane::GeomToStep_MakePlane( const Handle(Geom_Plane)& Gpln)
50 {
51   gp_Pln P;
52   Handle(StepGeom_Plane) Plan = new StepGeom_Plane;
53   Handle(StepGeom_Axis2Placement3d) aPosition;
54
55   P = Gpln->Pln();
56   
57   GeomToStep_MakeAxis2Placement3d MkAxis2(P.Position());
58   aPosition = MkAxis2.Value();
59   Plan->SetPosition(aPosition);
60   Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
61   Plan->SetName(name);
62   thePlane = Plan;
63   done = Standard_True;
64 }
65
66 //=============================================================================
67 // renvoi des valeurs
68 //=============================================================================
69
70 const Handle(StepGeom_Plane) &
71       GeomToStep_MakePlane::Value() const
72 {
73   StdFail_NotDone_Raise_if(!done, "");
74   return thePlane;
75 }
76