From: isn Date: Tue, 26 Mar 2019 17:08:13 +0000 (+0300) Subject: lot 11 : use occt conversion for bsplines (3d->2d) X-Git-Tag: SH_V2_2_0~99^2~26^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2fc0787360e16a134eae6251d99df429c2478e6f;p=modules%2Fhydro.git lot 11 : use occt conversion for bsplines (3d->2d) --- diff --git a/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx b/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx index f7c9d1a8..11ef389f 100644 --- a/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx +++ b/src/HYDROData/HYDROData_StreamLinearInterpolation.cxx @@ -386,7 +386,7 @@ void HYDROData_StreamLinearInterpolation::Perform(const HYDROData_SequenceOfObje Handle(Geom2d_Curve) Hax2d; PolyToCurve2d(hax, Hax2d); - if (Hax2d->IsClosed()) //can't be closed + if (hax->IsClosed() || Hax2d->IsClosed()) //can't be closed { if (warnings) warnings->push_back(hax->GetName().toStdString() + " is closed; abort"); diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 4cd66c6a..241131ac 100755 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -921,21 +921,23 @@ Handle(Geom2d_Curve) HYDROData_Tool::BRepAdaptorTo2DCurve( const BRepAdaptor_Cur if( ad.GetType() == GeomAbs_BSplineCurve ) { - //just ignore Z coord, without projecting Handle(Geom_BSplineCurve) aSpline = ad.Curve().BSpline(); if (aSpline.IsNull()) return Handle(Geom2d_Curve)(); - TColgp_Array1OfPnt poles3d = aSpline->Poles(); - TColgp_HArray1OfPnt2d poles2d(poles3d.Lower(), poles3d.Upper()); - for (int i=poles3d.Lower(); i<=poles3d.Upper();i++) - { - gp_XY p2d(poles3d(i).X(), poles3d(i).Y()); - poles2d(i).SetXY(p2d); - } - const TColStd_Array1OfReal& knots = aSpline->Knots(); - const TColStd_Array1OfInteger& multiplicities = aSpline->Multiplicities(); - int aDegree = aSpline->Degree(); - return new Geom2d_BSplineCurve( poles2d, knots, multiplicities, aDegree ); + + return GeomAPI::To2d(aSpline, gp_Pln(gp::XOY())); + + //TColgp_Array1OfPnt poles3d = aSpline->Poles(); + //TColgp_HArray1OfPnt2d poles2d(poles3d.Lower(), poles3d.Upper()); + //for (int i=poles3d.Lower(); i<=poles3d.Upper();i++) + //{ + // gp_XY p2d(poles3d(i).X(), poles3d(i).Y()); + // poles2d(i).SetXY(p2d); + //} + //const TColStd_Array1OfReal& knots = aSpline->Knots(); + //const TColStd_Array1OfInteger& multiplicities = aSpline->Multiplicities(); + //int aDegree = aSpline->Degree(); + //return new Geom2d_BSplineCurve( poles2d, knots, multiplicities, aDegree ); } return Handle(Geom2d_Curve)(); }