#include <HYDROData_PolylineXY.h>
#include <HYDROData_Polyline3D.h>
#include <HYDROData_Bathymetry.h>
-
+#include <Geom_Line.hxx>
+#include <Geom2d_BSplineCurve.hxx>
+#include <Standard_Type.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom_BSplineCurve.hxx>
+
+#include <GeomAPI.hxx>
+#include <gp.hxx>
+#include <Geom_Plane.hxx>
#include <QFileInfo>
#define BLOCK_SIZE 10000
}
+
+
+Handle(Geom2d_Curve) HYDROData_Tool::BRepAdaptorTo2DCurve( const BRepAdaptor_Curve& ad )
+{
+ if( ad.GetType() == GeomAbs_Line)
+ {
+ double f = ad.FirstParameter();
+ double l = ad.LastParameter();
+ return new Geom2d_TrimmedCurve( GeomAPI::To2d(ad.Curve().Curve(), Geom_Plane(gp::XOY()).Pln()), f, l );
+ }
+
+ if( ad.GetType() == GeomAbs_BSplineCurve )
+ {
+ Handle(Geom_BSplineCurve) aSpline = ad.Curve().BSpline();
+ if (aSpline.IsNull())
+ return Handle(Geom2d_Curve)();
+
+ 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)();
+}
+
std::ostream& operator<<( std::ostream& theStream, const QString& theText )
{
theStream << theText.toStdString();