0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / IGESGeom / IGESGeom_OffsetCurve.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <gp_GTrsf.hxx>
20 #include <gp_Vec.hxx>
21 #include <gp_XYZ.hxx>
22 #include <IGESData_IGESEntity.hxx>
23 #include <IGESGeom_OffsetCurve.hxx>
24 #include <Standard_Type.hxx>
25
26 IGESGeom_OffsetCurve::IGESGeom_OffsetCurve ()     {  }
27
28
29     void IGESGeom_OffsetCurve::Init
30   (const Handle(IGESData_IGESEntity)& aBaseCurve,
31    const Standard_Integer anOffsetType,
32    const Handle(IGESData_IGESEntity)& aFunction,
33    const Standard_Integer aFunctionCoord,
34    const Standard_Integer aTaperedOffsetType,
35    const Standard_Real    offDistance1, 
36    const Standard_Real    anArcLength1, 
37    const Standard_Real    offDistance2, 
38    const Standard_Real    anArcLength2, 
39    const gp_XYZ&          aNormalVec,
40    const Standard_Real    anOffsetParam, 
41    const Standard_Real    anotherOffsetParam) 
42 {
43   theBaseCurve         = aBaseCurve;
44   theOffsetType        = anOffsetType;
45   theFunction          = aFunction;
46   theFunctionCoord     = aFunctionCoord;
47   theTaperedOffsetType = aTaperedOffsetType;
48   theOffsetDistance1   = offDistance1;
49   theArcLength1        = anArcLength1;
50   theOffsetDistance2   = offDistance2;
51   theArcLength2        = anArcLength2;
52   theNormalVector      = aNormalVec;
53   theOffsetParam1      = anOffsetParam;
54   theOffsetParam2      = anotherOffsetParam;
55   InitTypeAndForm(130,0);
56 }
57
58
59     Handle(IGESData_IGESEntity) IGESGeom_OffsetCurve::BaseCurve () const
60 {
61   return theBaseCurve;
62 }
63
64     Standard_Integer IGESGeom_OffsetCurve::OffsetType () const
65 {
66   return theOffsetType;
67 }
68
69     Handle(IGESData_IGESEntity) IGESGeom_OffsetCurve::Function () const
70 {
71   return theFunction;
72 }
73
74     Standard_Integer IGESGeom_OffsetCurve::FunctionParameter () const
75 {
76   return theFunctionCoord;
77 }
78
79     Standard_Integer IGESGeom_OffsetCurve::TaperedOffsetType () const
80 {
81   return theTaperedOffsetType;
82 }
83
84     Standard_Real IGESGeom_OffsetCurve::FirstOffsetDistance () const
85 {
86   return theOffsetDistance1;
87 }
88
89     Standard_Real IGESGeom_OffsetCurve::ArcLength1 () const
90 {
91   return theArcLength1;
92 }
93
94     Standard_Real IGESGeom_OffsetCurve::SecondOffsetDistance () const
95 {
96   return theOffsetDistance2;
97 }
98
99     Standard_Real IGESGeom_OffsetCurve::ArcLength2 () const
100 {
101   return theArcLength2;
102 }
103
104     gp_Vec IGESGeom_OffsetCurve::NormalVector () const
105 {
106   return ( gp_Vec(theNormalVector) );
107 }
108
109     gp_Vec IGESGeom_OffsetCurve::TransformedNormalVector () const
110 {
111   if (!HasTransf()) return gp_Vec(theNormalVector);
112   gp_XYZ tempXYZ(theNormalVector);
113   gp_GTrsf loc = Location();
114   loc.SetTranslationPart(gp_XYZ(0.,0.,0.));
115   loc.Transforms(tempXYZ);
116   return gp_Vec(tempXYZ);
117 }
118
119     Standard_Real IGESGeom_OffsetCurve::StartParameter () const
120 {  return theOffsetParam1;  }
121
122     Standard_Real IGESGeom_OffsetCurve::EndParameter () const
123 {  return theOffsetParam2;  }
124
125     void IGESGeom_OffsetCurve::Parameters
126   (Standard_Real& TT1, Standard_Real& TT2) const
127 {
128   TT1 = theOffsetParam1;
129   TT2 = theOffsetParam2;
130 }
131
132     Standard_Boolean IGESGeom_OffsetCurve::HasFunction () const
133 {
134   return (! theFunction.IsNull() );
135 }