1 // Created on: 1995-02-01
2 // Created by: Marie Jose MARTZ
3 // Copyright (c) 1995-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_Direction.hxx>
19 #include <Geom2d_Vector.hxx>
20 #include <Geom2d_VectorWithMagnitude.hxx>
21 #include <Geom2dToIGES_Geom2dEntity.hxx>
22 #include <Geom2dToIGES_Geom2dVector.hxx>
24 #include <IGESGeom_Direction.hxx>
25 #include <Interface_Macros.hxx>
27 //=============================================================================
28 // Geom2dToIGES_Geom2dVector
29 //=============================================================================
30 Geom2dToIGES_Geom2dVector::Geom2dToIGES_Geom2dVector()
31 :Geom2dToIGES_Geom2dEntity()
36 //=============================================================================
37 // Geom2dToIGES_Geom2dVector
38 //=============================================================================
40 Geom2dToIGES_Geom2dVector::Geom2dToIGES_Geom2dVector
41 (const Geom2dToIGES_Geom2dEntity& G2dE)
42 :Geom2dToIGES_Geom2dEntity(G2dE)
47 //=============================================================================
48 // Transfer des Entites Vector de Geom2d vers IGES
50 //=============================================================================
52 Handle(IGESGeom_Direction) Geom2dToIGES_Geom2dVector::Transfer2dVector
53 (const Handle(Geom2d_Vector)& start)
55 Handle(IGESGeom_Direction) res;
60 if (start->IsKind(STANDARD_TYPE(Geom2d_VectorWithMagnitude))) {
61 DeclareAndCast(Geom2d_VectorWithMagnitude, VMagn, start);
62 res = Transfer2dVector(VMagn);
64 else if (start->IsKind(STANDARD_TYPE(Geom2d_Direction))) {
65 DeclareAndCast(Geom2d_Direction, Direction, start);
66 res = Transfer2dVector(Direction);
73 //=============================================================================
74 // Transfer des Entites VectorWithMagnitude de Geom2d vers IGES
76 //=============================================================================
78 Handle(IGESGeom_Direction) Geom2dToIGES_Geom2dVector::Transfer2dVector
79 (const Handle(Geom2d_VectorWithMagnitude)& start)
81 Handle(IGESGeom_Direction) Dir = new IGESGeom_Direction;
88 Standard_Real M = start->Magnitude();
89 Dir->Init(gp_XYZ(X/M, Y/M, 0.));
94 //=============================================================================
95 // Transfer des Entites Direction de Geom2d vers IGES
97 //=============================================================================
99 Handle(IGESGeom_Direction) Geom2dToIGES_Geom2dVector::Transfer2dVector
100 (const Handle(Geom2d_Direction)& start)
102 Handle(IGESGeom_Direction) Dir = new IGESGeom_Direction;
103 if (start.IsNull()) {
109 Dir->Init(gp_XYZ(X, Y, 0.));