}
}
}
+#include <GeomProjLib.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <Geom_Plane.hxx>
+#include <BRepTools.hxx>
+static void ProjEdgeOnPlane(const TopoDS_Edge& inpEdge, const Handle_Geom_Plane& RefPlane, TopoDS_Edge& outSh, TopoDS_Vertex V1, TopoDS_Vertex V2)
+{
+ double f, l;
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve(inpEdge, f, l);
+ Handle(Geom_Curve) ProjectedCurve = GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d, f, l), RefPlane, RefPlane->Position().Direction(), Standard_True);
+ if (V1.IsNull() || V2.IsNull())
+ outSh = BRepLib_MakeEdge(ProjectedCurve); //create new vertices
+ else
+ outSh = BRepLib_MakeEdge(ProjectedCurve, V1, V2);
+}
+
bool HYDROData_Stream::CreatePresentations( const TopoDS_Edge& theLeftBank,
const TopoDS_Edge& theRightBank,
- const TopTools_ListOfShape& theProfiles3d,
+ const std::vector<TopoDS_Edge>& theProfiles3d,
PrsDefinition& thePrs )
{
+ thePrs.myLeftBank = theLeftBank;
+ thePrs.myRightBank = theRightBank;
+
+ BRep_Builder aBB;
+ TopoDS_Compound aCmp;
+ aBB.MakeCompound(aCmp);
+ for (size_t i = 0; i < theProfiles3d.size(); i++ )
+ aBB.Add(aCmp, theProfiles3d[i]);
+
+ aBB.Add(aCmp, theLeftBank);
+ aBB.Add(aCmp, theRightBank);
+
+ thePrs.myPrs3D = aCmp; //3d pres
+
+
+ Handle_Geom_Plane RefPlane = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
+ std::vector<TopoDS_Edge> internProf;
+ internProf.reserve(theProfiles3d.size() - 2);
+
+ //project internal edges/profiles
+ for (size_t i = 1; i < theProfiles3d.size() - 1; i++ )
+ {
+ TopoDS_Edge ProjEdge;
+ ProjEdgeOnPlane(theProfiles3d[i], RefPlane, ProjEdge, TopoDS_Vertex(), TopoDS_Vertex());
+ internProf.push_back (TopoDS::Edge(ProjEdge.Oriented(TopAbs_INTERNAL)));
+ }
+
+ TopoDS_Edge ProjEdgeIn, ProjEdgeOut;
+ TopoDS_Vertex V1In, V2In, V1Out, V2Out;
+
+ ProjEdgeOnPlane(theProfiles3d.front(), RefPlane, ProjEdgeIn, TopoDS_Vertex(), TopoDS_Vertex());
+ TopExp::Vertices(ProjEdgeIn, V1In, V2In);
+
+ ProjEdgeOnPlane(theProfiles3d.back(), RefPlane, ProjEdgeOut, TopoDS_Vertex(), TopoDS_Vertex());
+ TopExp::Vertices(ProjEdgeOut, V1Out, V2Out);
+
+ TopoDS_Edge ProjEdgeLeftB, ProjEdgeRightB;
+ ProjEdgeOnPlane(theLeftBank, RefPlane, ProjEdgeLeftB, V1In, V1Out);
+ ProjEdgeOnPlane(theRightBank, RefPlane, ProjEdgeRightB, V2In, V2Out);
+
+ BRepLib_MakeWire WM(ProjEdgeIn, ProjEdgeOut, ProjEdgeLeftB, ProjEdgeRightB);
+ for (size_t i = 0; i < internProf.size(); i++ )
+ WM.Add(internProf[i]);
+
+ TopoDS_Face outF = BRepLib_MakeFace(RefPlane, WM.Wire()).Face();
+ thePrs.myPrs2D = outF;
+
return true;
/*if ( theArrayOfFPnt.IsNull() || theArrayOfLPnt.IsNull() || theArrOfProfiles.IsNull() ) {
return false;