summaryrefslogtreecommitdiff
path: root/src/GeomToStep/GeomToStep_MakeAxis2Placement2d.cxx
blob: 77c670426619cd4959a9920f4581354cc659061f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// File:	GeomToStep_MakeAxis2Placement2d.cxx
// Created:	Fri Aug 26 09:46:42 1994
// Author:	Frederic MAUPAS
//		<fma@minox>


#include <GeomToStep_MakeAxis2Placement2d.ixx>
#include <StepGeom_Direction.hxx>
#include <GeomToStep_MakeDirection.hxx>
#include <StepGeom_CartesianPoint.hxx>
#include <GeomToStep_MakeCartesianPoint.hxx>
#include <StdFail_NotDone.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax22d.hxx>

#include <StepGeom_Axis2Placement2d.hxx>
#include <TCollection_HAsciiString.hxx>

//=============================================================================
// Creation d' un axis2_placement_2d de prostep a partir d' un Ax2 de gp
//=============================================================================

GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d
( const gp_Ax2& A)
{
  Handle(StepGeom_Axis2Placement2d) Axe;
  Handle(StepGeom_CartesianPoint) P;
  Handle(StepGeom_Direction) D;

  GeomToStep_MakeCartesianPoint MkPoint(A.Location());
  GeomToStep_MakeDirection      MkDir(A.Direction());

  P = MkPoint.Value();
  D = MkDir.Value();

  Axe = new StepGeom_Axis2Placement2d;
  Axe->SetLocation(P);
  Axe->SetRefDirection(D);
  Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
  Axe->SetName(name);
  theAxis2Placement2d = Axe;
  done = Standard_True;
}

//=============================================================================
// Creation d' un axis2_placement_2d de prostep a partir d' un Ax22d de gp
//=============================================================================

GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d
( const gp_Ax22d& A)
{
  Handle(StepGeom_Axis2Placement2d) Axe;
  Handle(StepGeom_CartesianPoint) P;
  Handle(StepGeom_Direction) D1;

  GeomToStep_MakeCartesianPoint MkPoint(A.Location());
  GeomToStep_MakeDirection      MkDir(A.XDirection());

  P  = MkPoint.Value();
  D1 = MkDir.Value();

  Axe = new StepGeom_Axis2Placement2d;
  Axe->SetLocation(P);
  Axe->SetRefDirection(D1);
  Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
  Axe->SetName(name);
  theAxis2Placement2d = Axe;
  done = Standard_True;
}

//=============================================================================
// Creation d' un axis2_placement_2d de prostep a partir d' un Axis2Placement
// de Geom
//=============================================================================

//GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d
//  ( const Handle(Geom_Axis2Placement)& Axis2)
//{
//  Handle(StepGeom_Axis2Placement2d) Axe;
//  Handle(StepGeom_CartesianPoint) P;
//  Handle(StepGeom_Direction) D1, D2;
//  gp_Ax2 A;
  
//  A = Axis2->Ax2();
//  P = GeomToStep_MakeCartesianPoint(A.Location());
//  D1 = GeomToStep_MakeDirection(A.Direction());
//  D2 = GeomToStep_MakeDirection(A.XDirection());
//  Axe = new StepGeom_Axis2Placement2d;
//  Axe->SetLocation(P);
//  Axe->SetAxis(D1);  
//  Axe->SetRefDirection(D2);
//  theAxis2Placement2d = Axe;
//  done = Standard_True;
//}

//=============================================================================
// renvoi des valeurs
//=============================================================================

const Handle(StepGeom_Axis2Placement2d) &
      GeomToStep_MakeAxis2Placement2d::Value() const
{
  StdFail_NotDone_Raise_if(!done == Standard_True,"");
  return theAxis2Placement2d;
}