1 // Created on: 1993-06-15
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Geom2d_CartesianPoint.hxx>
19 #include <Geom_CartesianPoint.hxx>
20 #include <GeomToStep_MakeCartesianPoint.hxx>
22 #include <gp_Pnt2d.hxx>
23 #include <StdFail_NotDone.hxx>
24 #include <StepData_GlobalFactors.hxx>
25 #include <StepGeom_CartesianPoint.hxx>
26 #include <TCollection_HAsciiString.hxx>
27 #include <TColStd_HArray1OfReal.hxx>
29 //=============================================================================
30 // Creation d' un cartesian_point de prostep a partir d' un point3d de gp
31 //=============================================================================
32 GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt& P)
34 Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint;
35 // Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,3);
36 Standard_Real X, Y, Z;
39 // Acoord->SetValue(1,X);
40 // Acoord->SetValue(2,Y);
41 // Acoord->SetValue(3,Z);
42 // Pstep->SetCoordinates(Acoord);
43 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
44 // Pstep->SetName(name);
45 Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
46 Pstep->Init3D (name,X/fact,Y/fact,Z/fact);
47 theCartesianPoint = Pstep;
50 //=============================================================================
51 // Creation d' un cartesian_point de prostep a partir d' un point 2d de gp
52 //=============================================================================
54 GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt2d& P)
56 Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint;
57 // Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,2);
61 // Acoord->SetValue(1,X);
62 // Acoord->SetValue(2,Y);
63 // Pstep->SetCoordinates(Acoord);
64 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
65 // Pstep->SetName(name);
66 Pstep->Init2D (name,X,Y);
67 theCartesianPoint = Pstep;
71 //=============================================================================
72 // Creation d' un cartesian_point de prostep a partir d' un point 3d de Geom
73 //=============================================================================
75 GeomToStep_MakeCartesianPoint::
76 GeomToStep_MakeCartesianPoint( const Handle(Geom_CartesianPoint)& P)
79 Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint;
80 // Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,3);
81 Standard_Real X, Y, Z;
84 // Acoord->SetValue(1,X);
85 // Acoord->SetValue(2,Y);
86 // Acoord->SetValue(3,Z);
87 // Pstep->SetCoordinates(Acoord);
88 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
89 // Pstep->SetName(name);
90 Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
91 Pstep->Init3D (name,X/fact,Y/fact,Z/fact);
92 theCartesianPoint = Pstep;
96 //=============================================================================
97 // Creation d' un cartesian_point de prostep a partir d' un point 2d de Geom2d
98 //=============================================================================
100 GeomToStep_MakeCartesianPoint::
101 GeomToStep_MakeCartesianPoint( const Handle(Geom2d_CartesianPoint)& P)
104 Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint;
105 // Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,2);
109 // Acoord->SetValue(1,X);
110 // Acoord->SetValue(2,Y);
111 // Pstep->SetCoordinates(Acoord);
112 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
113 // Pstep->SetName(name);
114 Pstep->Init2D (name,X,Y);
115 theCartesianPoint = Pstep;
116 done = Standard_True;
119 //=============================================================================
120 // renvoi des valeurs
121 //=============================================================================
123 const Handle(StepGeom_CartesianPoint) &
124 GeomToStep_MakeCartesianPoint::Value() const
126 StdFail_NotDone_Raise_if (!done, "GeomToStep_MakeCartesianPoint::Value() - no result");
127 return theCartesianPoint;