]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
lot 11 : use occt conversion for bsplines (3d->2d)
authorisn <isn@opencascade.com>
Tue, 26 Mar 2019 17:08:13 +0000 (20:08 +0300)
committerisn <isn@opencascade.com>
Tue, 26 Mar 2019 17:13:19 +0000 (20:13 +0300)
src/HYDROData/HYDROData_StreamLinearInterpolation.cxx
src/HYDROData/HYDROData_Tool.cxx

index f7c9d1a8497ac7f74d3d73fb7b6e9561f2e380a3..11ef389f30664affab369e058c4f8598f94cdbe5 100644 (file)
@@ -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");
index 4cd66c6a1e8e6ca6638f200824ebfc710b9d3d38..241131acdce73439577b7eae378d3b81d985d5b5 100755 (executable)
@@ -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)();
 }