+#include <BRepLib_MakeEdge.hxx>
+#include <BRepLib_MakeWire.hxx>
+//#include <BRepLib_MakeFace.hxx>
+#include <BRep_Builder.hxx>
+#include <GeomProjLib.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <Geom_Plane.hxx>
+#include <BRepTools_WireExplorer.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+void HYDROData_DTM::PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W )
+{
+ BRepLib_MakeWire WM;
+ for (int i =0; i < pnts.size() - 1; i++)
+ {
+ gp_Pnt p1(pnts[i].X, pnts[i].Y, pnts[i].Z);
+ gp_Pnt p2(pnts[i+1].X, pnts[i+1].Y, pnts[i+1].Z);
+ WM.Add(BRepLib_MakeEdge(p1, p2).Edge());
+ }
+ W = WM.Wire();
+}
+
+static void ProjWireOnPlane(const TopoDS_Wire& inpWire, const Handle_Geom_Plane& RefPlane, TopoDS_Wire& outWire)
+{
+ BRepTools_WireExplorer ex(TopoDS::Wire(inpWire.Oriented(TopAbs_FORWARD)));
+ BRepLib_MakeWire WM;
+ for (;ex.More();ex.Next())
+ {
+ const TopoDS_Edge& CE = ex.Current();
+ double f, l;
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve(CE, f, l);
+ Handle(Geom_Curve) ProjectedCurve = GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d, f, l), RefPlane, RefPlane->Position().Direction(), Standard_True);
+ TopoDS_Edge ProjEdge = BRepLib_MakeEdge(ProjectedCurve);
+ WM.Add(ProjEdge); //auto sharing between edges if vertex is coincident
+ }
+ outWire = WM.Wire();
+ outWire.Orientation(inpWire.Orientation()); //take from the original wire
+}
+