0022627: Change OCCT memory management defaults
[occt.git] / src / GeomToIGES / GeomToIGES_GeomVector.cxx
... / ...
CommitLineData
1// File: GeomToIGES_GeomVector.cxx
2
3// modif du 14/09/95 mjm
4// prise en compte de l'unite choisi par l'utilisateur
5// pour l'ecriture du fichier IGES.
6
7#include <GeomToIGES_GeomVector.ixx>
8
9#include <Geom_Vector.hxx>
10#include <Geom_VectorWithMagnitude.hxx>
11#include <Geom_Direction.hxx>
12
13#include <gp_Dir.hxx>
14#include <gp_GTrsf.hxx>
15#include <gp_Pnt.hxx>
16#include <gp_Trsf.hxx>
17#include <gp_XYZ.hxx>
18
19#include <IGESData_IGESEntity.hxx>
20#include <IGESData_ToolLocation.hxx>
21
22#include <IGESGeom_CopiousData.hxx>
23#include <IGESGeom_Line.hxx>
24#include <IGESGeom_Point.hxx>
25
26#include <Interface_Macros.hxx>
27
28
29
30//=============================================================================
31// GeomToIGES_GeomVector
32//=============================================================================
33
34GeomToIGES_GeomVector::GeomToIGES_GeomVector()
35:GeomToIGES_GeomEntity()
36{
37}
38
39
40//=============================================================================
41// GeomToIGES_GeomVector
42//=============================================================================
43
44GeomToIGES_GeomVector::GeomToIGES_GeomVector
45(const GeomToIGES_GeomEntity& GE)
46:GeomToIGES_GeomEntity(GE)
47{
48}
49
50
51//=============================================================================
52// Transfer des Entites Vector de Geom vers IGES
53// TransferVector
54//=============================================================================
55
56Handle(IGESGeom_Direction) GeomToIGES_GeomVector::TransferVector
57(const Handle(Geom_Vector)& start)
58{
59 Handle(IGESGeom_Direction) res;
60 if (start.IsNull()) {
61 return res;
62 }
63
64 if (start->IsKind(STANDARD_TYPE(Geom_VectorWithMagnitude))) {
65 DeclareAndCast(Geom_VectorWithMagnitude, VMagn, start);
66 res = TransferVector(VMagn);
67 }
68 else if (start->IsKind(STANDARD_TYPE(Geom_Direction))) {
69 DeclareAndCast(Geom_Direction, Direction, start);
70 res = TransferVector(Direction);
71 }
72
73 return res;
74}
75
76
77//=============================================================================
78// Transfer des Entites VectorWithMagnitude de Geom vers IGES
79// TransferVector
80//=============================================================================
81
82Handle(IGESGeom_Direction) GeomToIGES_GeomVector::TransferVector
83(const Handle(Geom_VectorWithMagnitude)& start)
84{
85 Handle(IGESGeom_Direction) Dir = new IGESGeom_Direction;
86 if (start.IsNull()) {
87 return Dir;
88 }
89
90 Standard_Real X,Y,Z;
91 start->Coord(X,Y,Z);
92 Standard_Real M = start->Magnitude();
93 Dir->Init(gp_XYZ(X/(M*GetUnit()),Y/(M*GetUnit()),Z/(M*GetUnit())));
94 return Dir;
95}
96
97
98//=============================================================================
99// Transfer des Entites Direction de Geom vers IGES
100// TransferVector
101//=============================================================================
102
103Handle(IGESGeom_Direction) GeomToIGES_GeomVector::TransferVector
104(const Handle(Geom_Direction)& start)
105{
106 Handle(IGESGeom_Direction) Dir = new IGESGeom_Direction;
107 if (start.IsNull()) {
108 return Dir;
109 }
110
111 Standard_Real X,Y,Z;
112 start->Coord(X,Y,Z);
113 Dir->Init(gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit()));
114 return Dir;
115}