0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BRepGProp / BRepGProp_EdgeTool.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
7fd59977 14
42cf5bc1 15
16#include <BRepAdaptor_Curve.hxx>
17#include <BRepGProp_EdgeTool.hxx>
7fd59977 18#include <Geom_BezierCurve.hxx>
19#include <Geom_BSplineCurve.hxx>
42cf5bc1 20#include <Geom_Curve.hxx>
21#include <GeomAdaptor_Curve.hxx>
22#include <gp_Pnt.hxx>
23#include <gp_Vec.hxx>
7fd59977 24
25Standard_Real BRepGProp_EdgeTool::FirstParameter(const BRepAdaptor_Curve& C)
26{
27 return C.FirstParameter();
28}
29
30Standard_Real BRepGProp_EdgeTool::LastParameter(const BRepAdaptor_Curve& C)
31{
32 return C.LastParameter();
33}
34
35Standard_Integer BRepGProp_EdgeTool::IntegrationOrder(const BRepAdaptor_Curve& BAC)
36{
37 switch (BAC.GetType()) {
38
39 case GeomAbs_Line :
40 return 2;
41
42 case GeomAbs_Parabola :
43 return 5;
44
45 case GeomAbs_BezierCurve :
46 {
47 const GeomAdaptor_Curve& GAC = BAC.Curve();
48 const Handle(Geom_Curve)& GC = GAC.Curve();
c5f3a425 49 Handle(Geom_BezierCurve) GBZC (Handle(Geom_BezierCurve)::DownCast (GC));
7fd59977 50 Standard_Integer n = 2*(GBZC->NbPoles()) - 1;
51 return n;
52 }
53 break;
54 case GeomAbs_BSplineCurve :
55 {
56 const GeomAdaptor_Curve& GAC = BAC.Curve();
57 const Handle(Geom_Curve)& GC = GAC.Curve();
c5f3a425 58 Handle(Geom_BSplineCurve) GBSC (Handle(Geom_BSplineCurve)::DownCast (GC));
7fd59977 59 Standard_Integer n = 2*(GBSC->NbPoles()) - 1;
60 return n;
61 }
62 break;
63
64 default :
65 return 10;
66 }
7fd59977 67}
68
69gp_Pnt BRepGProp_EdgeTool::Value(const BRepAdaptor_Curve& C, const Standard_Real U)
70{
71 return C.Value(U);
72}
73
74void BRepGProp_EdgeTool::D1(const BRepAdaptor_Curve& C,
75 const Standard_Real U, gp_Pnt& P, gp_Vec& V1)
76{
77 C.D1(U,P,V1);
78}
79
80// modified by NIZHNY-MKK Thu Jun 9 12:15:15 2005.BEGIN
81Standard_Integer BRepGProp_EdgeTool::NbIntervals(const BRepAdaptor_Curve& C,const GeomAbs_Shape S)
82{
83 BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually NbIntervals() does not modify the
84 // object "C". So it is safe to do such a cast.
85 return pC->NbIntervals(S);
86}
87
88void BRepGProp_EdgeTool::Intervals(const BRepAdaptor_Curve& C,TColStd_Array1OfReal& T,const GeomAbs_Shape S)
89{
90 BRepAdaptor_Curve* pC = (BRepAdaptor_Curve*) &C; // at the moment actually Intervals() does not modify the
91 // object "C". So it is safe to do such a cast.
92 pC->Intervals(T, S);
93}
94// modified by NIZHNY-MKK Thu Jun 9 12:15:18 2005.END