b311480e |
1 | // Created on: 1994-08-26 |
2 | // Created by: Frederic MAUPAS |
3 | // Copyright (c) 1994-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 | |
18 | #include <GeomToStep_MakeAxis2Placement2d.hxx> |
7fd59977 |
19 | #include <GeomToStep_MakeCartesianPoint.hxx> |
42cf5bc1 |
20 | #include <GeomToStep_MakeDirection.hxx> |
7fd59977 |
21 | #include <gp_Ax2.hxx> |
22 | #include <gp_Ax22d.hxx> |
42cf5bc1 |
23 | #include <StdFail_NotDone.hxx> |
7fd59977 |
24 | #include <StepGeom_Axis2Placement2d.hxx> |
42cf5bc1 |
25 | #include <StepGeom_CartesianPoint.hxx> |
26 | #include <StepGeom_Direction.hxx> |
7fd59977 |
27 | #include <TCollection_HAsciiString.hxx> |
28 | |
29 | //============================================================================= |
30 | // Creation d' un axis2_placement_2d de prostep a partir d' un Ax2 de gp |
31 | //============================================================================= |
7fd59977 |
32 | GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d |
33 | ( const gp_Ax2& A) |
34 | { |
35 | Handle(StepGeom_Axis2Placement2d) Axe; |
36 | Handle(StepGeom_CartesianPoint) P; |
37 | Handle(StepGeom_Direction) D; |
38 | |
39 | GeomToStep_MakeCartesianPoint MkPoint(A.Location()); |
40 | GeomToStep_MakeDirection MkDir(A.Direction()); |
41 | |
42 | P = MkPoint.Value(); |
43 | D = MkDir.Value(); |
44 | |
45 | Axe = new StepGeom_Axis2Placement2d; |
46 | Axe->SetLocation(P); |
47 | Axe->SetRefDirection(D); |
48 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); |
49 | Axe->SetName(name); |
50 | theAxis2Placement2d = Axe; |
51 | done = Standard_True; |
52 | } |
53 | |
54 | //============================================================================= |
55 | // Creation d' un axis2_placement_2d de prostep a partir d' un Ax22d de gp |
56 | //============================================================================= |
57 | |
58 | GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d |
59 | ( const gp_Ax22d& A) |
60 | { |
61 | Handle(StepGeom_Axis2Placement2d) Axe; |
62 | Handle(StepGeom_CartesianPoint) P; |
63 | Handle(StepGeom_Direction) D1; |
64 | |
65 | GeomToStep_MakeCartesianPoint MkPoint(A.Location()); |
66 | GeomToStep_MakeDirection MkDir(A.XDirection()); |
67 | |
68 | P = MkPoint.Value(); |
69 | D1 = MkDir.Value(); |
70 | |
71 | Axe = new StepGeom_Axis2Placement2d; |
72 | Axe->SetLocation(P); |
73 | Axe->SetRefDirection(D1); |
74 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); |
75 | Axe->SetName(name); |
76 | theAxis2Placement2d = Axe; |
77 | done = Standard_True; |
78 | } |
79 | |
80 | //============================================================================= |
81 | // Creation d' un axis2_placement_2d de prostep a partir d' un Axis2Placement |
82 | // de Geom |
83 | //============================================================================= |
84 | |
85 | //GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d |
86 | // ( const Handle(Geom_Axis2Placement)& Axis2) |
87 | //{ |
88 | // Handle(StepGeom_Axis2Placement2d) Axe; |
89 | // Handle(StepGeom_CartesianPoint) P; |
90 | // Handle(StepGeom_Direction) D1, D2; |
91 | // gp_Ax2 A; |
92 | |
93 | // A = Axis2->Ax2(); |
94 | // P = GeomToStep_MakeCartesianPoint(A.Location()); |
95 | // D1 = GeomToStep_MakeDirection(A.Direction()); |
96 | // D2 = GeomToStep_MakeDirection(A.XDirection()); |
97 | // Axe = new StepGeom_Axis2Placement2d; |
98 | // Axe->SetLocation(P); |
99 | // Axe->SetAxis(D1); |
100 | // Axe->SetRefDirection(D2); |
101 | // theAxis2Placement2d = Axe; |
102 | // done = Standard_True; |
103 | //} |
104 | |
105 | //============================================================================= |
106 | // renvoi des valeurs |
107 | //============================================================================= |
108 | |
109 | const Handle(StepGeom_Axis2Placement2d) & |
110 | GeomToStep_MakeAxis2Placement2d::Value() const |
111 | { |
2d2b3d53 |
112 | StdFail_NotDone_Raise_if (!done, "GeomToStep_MakeAxis2Placement2d::Value() - no result"); |
7fd59977 |
113 | return theAxis2Placement2d; |
114 | } |