0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[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 IMPLEMENT_STANDARD_RTTIEXT(IGESGeom_OffsetCurve,IGESData_IGESEntity)
27
28 IGESGeom_OffsetCurve::IGESGeom_OffsetCurve ()     {  }
29
30
31     void IGESGeom_OffsetCurve::Init
32   (const Handle(IGESData_IGESEntity)& aBaseCurve,
33    const Standard_Integer anOffsetType,
34    const Handle(IGESData_IGESEntity)& aFunction,
35    const Standard_Integer aFunctionCoord,
36    const Standard_Integer aTaperedOffsetType,
37    const Standard_Real    offDistance1, 
38    const Standard_Real    anArcLength1, 
39    const Standard_Real    offDistance2, 
40    const Standard_Real    anArcLength2, 
41    const gp_XYZ&          aNormalVec,
42    const Standard_Real    anOffsetParam, 
43    const Standard_Real    anotherOffsetParam) 
44 {
45   theBaseCurve         = aBaseCurve;
46   theOffsetType        = anOffsetType;
47   theFunction          = aFunction;
48   theFunctionCoord     = aFunctionCoord;
49   theTaperedOffsetType = aTaperedOffsetType;
50   theOffsetDistance1   = offDistance1;
51   theArcLength1        = anArcLength1;
52   theOffsetDistance2   = offDistance2;
53   theArcLength2        = anArcLength2;
54   theNormalVector      = aNormalVec;
55   theOffsetParam1      = anOffsetParam;
56   theOffsetParam2      = anotherOffsetParam;
57   InitTypeAndForm(130,0);
58 }
59
60
61     Handle(IGESData_IGESEntity) IGESGeom_OffsetCurve::BaseCurve () const
62 {
63   return theBaseCurve;
64 }
65
66     Standard_Integer IGESGeom_OffsetCurve::OffsetType () const
67 {
68   return theOffsetType;
69 }
70
71     Handle(IGESData_IGESEntity) IGESGeom_OffsetCurve::Function () const
72 {
73   return theFunction;
74 }
75
76     Standard_Integer IGESGeom_OffsetCurve::FunctionParameter () const
77 {
78   return theFunctionCoord;
79 }
80
81     Standard_Integer IGESGeom_OffsetCurve::TaperedOffsetType () const
82 {
83   return theTaperedOffsetType;
84 }
85
86     Standard_Real IGESGeom_OffsetCurve::FirstOffsetDistance () const
87 {
88   return theOffsetDistance1;
89 }
90
91     Standard_Real IGESGeom_OffsetCurve::ArcLength1 () const
92 {
93   return theArcLength1;
94 }
95
96     Standard_Real IGESGeom_OffsetCurve::SecondOffsetDistance () const
97 {
98   return theOffsetDistance2;
99 }
100
101     Standard_Real IGESGeom_OffsetCurve::ArcLength2 () const
102 {
103   return theArcLength2;
104 }
105
106     gp_Vec IGESGeom_OffsetCurve::NormalVector () const
107 {
108   return ( gp_Vec(theNormalVector) );
109 }
110
111     gp_Vec IGESGeom_OffsetCurve::TransformedNormalVector () const
112 {
113   if (!HasTransf()) return gp_Vec(theNormalVector);
114   gp_XYZ tempXYZ(theNormalVector);
115   gp_GTrsf loc = Location();
116   loc.SetTranslationPart(gp_XYZ(0.,0.,0.));
117   loc.Transforms(tempXYZ);
118   return gp_Vec(tempXYZ);
119 }
120
121     Standard_Real IGESGeom_OffsetCurve::StartParameter () const
122 {  return theOffsetParam1;  }
123
124     Standard_Real IGESGeom_OffsetCurve::EndParameter () const
125 {  return theOffsetParam2;  }
126
127     void IGESGeom_OffsetCurve::Parameters
128   (Standard_Real& TT1, Standard_Real& TT2) const
129 {
130   TT1 = theOffsetParam1;
131   TT2 = theOffsetParam2;
132 }
133
134     Standard_Boolean IGESGeom_OffsetCurve::HasFunction () const
135 {
136   return (! theFunction.IsNull() );
137 }