7fd59977 |
1 | // File: GeomToStep_MakeAxis2Placement3d.cxx |
2 | // Created: Wed Jun 16 11:05:22 1993 |
3 | // Author: Martine LANGLOIS |
4 | // <mla@mastox> |
5 | |
6 | #include <GeomToStep_MakeAxis2Placement3d.ixx> |
7 | #include <StepGeom_Direction.hxx> |
8 | #include <GeomToStep_MakeDirection.hxx> |
9 | #include <StepGeom_CartesianPoint.hxx> |
10 | #include <GeomToStep_MakeCartesianPoint.hxx> |
11 | #include <StdFail_NotDone.hxx> |
12 | #include <gp_Ax2.hxx> |
13 | #include <gp_Ax3.hxx> |
14 | #include <Geom_Axis2Placement.hxx> |
15 | #include <StepGeom_Axis2Placement3d.hxx> |
16 | #include <TCollection_HAsciiString.hxx> |
17 | |
18 | static Handle(StepGeom_Axis2Placement3d) MakeAxis2Placement3d |
19 | (const gp_Pnt& O, const gp_Dir& D, const gp_Dir& X, const Standard_CString nom) |
20 | { |
21 | Handle(StepGeom_Axis2Placement3d) Axe; |
22 | Handle(StepGeom_CartesianPoint) P; |
23 | Handle(StepGeom_Direction) D1, D2; |
24 | |
25 | GeomToStep_MakeCartesianPoint MkPoint(O); |
26 | GeomToStep_MakeDirection MkDir1(D); |
27 | GeomToStep_MakeDirection MkDir2(X); |
28 | |
29 | P = MkPoint.Value(); |
30 | D1 = MkDir1.Value(); |
31 | D2 = MkDir2.Value(); |
32 | |
33 | Axe = new StepGeom_Axis2Placement3d; |
34 | Axe->SetLocation(P); |
35 | Axe->SetAxis(D1); |
36 | Axe->SetRefDirection(D2); |
37 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(nom); |
38 | Axe->SetName(name); |
39 | return Axe; |
40 | } |
41 | |
42 | //============================================================================= |
43 | // Creation d' un axis2_placement_3d a l origine |
44 | //============================================================================= |
45 | |
46 | GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d ( ) |
47 | { |
48 | gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.)); |
49 | // le reste inchange |
50 | |
51 | Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d |
52 | (A.Location(), A.Direction(), A.XDirection(), ""); |
53 | theAxis2Placement3d = Axe; |
54 | done = Standard_True; |
55 | } |
56 | |
57 | //============================================================================= |
58 | // Creation d' un axis2_placement_3d de prostep a partir d' un Ax2 de gp |
59 | //============================================================================= |
60 | |
61 | GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d( const gp_Ax2& |
62 | A) |
63 | { |
64 | Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d |
65 | (A.Location(), A.Direction(), A.XDirection(), ""); |
66 | theAxis2Placement3d = Axe; |
67 | done = Standard_True; |
68 | } |
69 | |
70 | //============================================================================= |
71 | // Creation d' un axis2_placement_3d de prostep a partir d' un Ax3 de gp |
72 | //============================================================================= |
73 | |
74 | GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d |
75 | ( const gp_Ax3& A) |
76 | { |
77 | Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d |
78 | (A.Location(), A.Direction(), A.XDirection(), ""); |
79 | theAxis2Placement3d = Axe; |
80 | done = Standard_True; |
81 | } |
82 | |
83 | //============================================================================= |
84 | // Creation d' un axis2_placement_3d de prostep a partir d' un Trsf de gp |
85 | //============================================================================= |
86 | |
87 | GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d |
88 | ( const gp_Trsf& T) |
89 | { |
90 | gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.)); |
91 | A.Transform (T); |
92 | // le reste inchange |
93 | |
94 | Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d |
95 | (A.Location(), A.Direction(), A.XDirection(), ""); |
96 | theAxis2Placement3d = Axe; |
97 | done = Standard_True; |
98 | } |
99 | |
100 | //============================================================================= |
101 | // Creation d' un axis2_placement_3d de prostep a partir d' un Axis2Placement |
102 | // de Geom |
103 | //============================================================================= |
104 | |
105 | GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d |
106 | ( const Handle(Geom_Axis2Placement)& Axis2) |
107 | { |
108 | gp_Ax2 A; |
109 | A = Axis2->Ax2(); |
110 | |
111 | Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d |
112 | (A.Location(), A.Direction(), A.XDirection(), ""); |
113 | theAxis2Placement3d = Axe; |
114 | done = Standard_True; |
115 | } |
116 | |
117 | //============================================================================= |
118 | // renvoi des valeurs |
119 | //============================================================================= |
120 | |
121 | const Handle(StepGeom_Axis2Placement3d) & |
122 | GeomToStep_MakeAxis2Placement3d::Value() const |
123 | { |
124 | StdFail_NotDone_Raise_if(!done == Standard_True,""); |
125 | return theAxis2Placement3d; |
126 | } |