+bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)& theGuideLine,
+ const Handle(HYDROData_Profile)& theProfile,
+ PrsDefinition& thePrs )
+{
+ if ( theGuideLine.IsNull() || theProfile.IsNull() )
+ return false;
+
+ // build 3d shape
+ TopoDS_Wire aPathWire = TopoDS::Wire( theGuideLine->GetShape3D() );
+ TopoDS_Wire aProfileWire = TopoDS::Wire( theProfile->GetShape3D() );
+ if ( aPathWire.IsNull() || aProfileWire.IsNull() )
+ return false;
+
+#ifdef DEB_CHANNEL
+ BRepTools::Write( aPathWire, "guideline.brep" );
+ BRepTools::Write( aProfileWire, "profile.brep" );
+#endif
+
+ HYDROData_Canal3dAnd2d aChannelConstructor( aProfileWire, aPathWire );
+ if( aChannelConstructor.GetStatus() != 0 )
+ return false;
+
+ aChannelConstructor.Create3dPresentation();
+ aChannelConstructor.Create2dPresentation();
+ thePrs.myPrs3D = aChannelConstructor.Get3dPresentation();
+ thePrs.myPrs2D = aChannelConstructor.Get2dPresentation();
+
+ thePrs.myLeftBank = aChannelConstructor.GetLeftBank();
+ thePrs.myRightBank = aChannelConstructor.GetRightBank();
+ thePrs.myInlet = aChannelConstructor.GetInlet();
+ thePrs.myOutlet = aChannelConstructor.GetOutlet();
+
+#ifdef DEB_CHANNEL
+ BRepTools::Write( thePrs.myPrs2D, "channel2d.brep" );
+ BRepTools::Write( thePrs.myPrs3D, "channel3d.brep" );
+ HYDROData_ShapesTool::DumpShapeSubShapes( std::cout, "Top shape edges:", thePrs.myPrs2D, TopAbs_EDGE );
+ HYDROData_ShapesTool::DumpShapeSubShapes( std::cout, "Left bank edges:", thePrs.myLeftBank, TopAbs_EDGE );
+ HYDROData_ShapesTool::DumpShapeSubShapes( std::cout, "Right bank edges:", thePrs.myRightBank, TopAbs_EDGE );
+ HYDROData_ShapesTool::DumpShapeSubShapes( std::cout, "Inlet edges:", thePrs.myInlet, TopAbs_EDGE );
+ HYDROData_ShapesTool::DumpShapeSubShapes( std::cout, "Outlet edges:", thePrs.myOutlet, TopAbs_EDGE );
+#endif
+
+ return true;
+}
+