Salome HOME
Refs #289 - Spline profile is represented in OCC view as polyline profile
[modules/hydro.git] / src / HYDROData / HYDROData_Profile.cxx
index f970509e255594371801463ab7ba79218b6f0673..a3cbe730753853d77fcec0d3f75da78e268e1283 100755 (executable)
@@ -4,6 +4,7 @@
 #include "HYDROData_Document.h"
 #include "HYDROData_Iterator.h"
 #include "HYDROData_Tool.h"
+#include "HYDROData_PolylineXY.h"
 
 #include <BRepBuilderAPI_MakeEdge.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
@@ -86,41 +87,15 @@ void HYDROData_Profile::Update()
 {
   HYDROData_Object::Update();
 
-  BRepBuilderAPI_MakePolygon aMakeWire;
-
-  ProfilePoints aProfilePoints = GetProfilePoints();
-  for ( int i = 1, n = aProfilePoints.Length(); i <= n ; ++i )
-  {
-    ProfilePoint aPoint = aProfilePoints.Value( i );
-    gp_Pnt aPnt( aPoint.X(), aPoint.Y(), aPoint.Z() );
-    aMakeWire.Add( aPnt );
-  }
-
   TopoDS_Wire aWire;
-  if ( aMakeWire.IsDone() )
-    aWire = aMakeWire.Wire();
-
-  /*BRepBuilderAPI_MakeWire aMakeWire;
-
-  ProfilePoints aProfilePoints = GetProfilePoints();
-  for ( int i = 1, n = aProfilePoints.Length(); i < n ; ++i )
+  Handle(HYDROData_ProfileUZ) aProfile = GetProfileUZ( false );
+  if ( !aProfile.IsNull() )
   {
-    ProfilePoint aFirstPoint = aProfilePoints.Value( i );
-    ProfilePoint aSecPoint = aProfilePoints.Value( i + 1 );
+    ProfilePoints aProfilePoints = GetProfilePoints();
+    HYDROData_IPolyline::SectionType aSectionType = aProfile->GetSectionType( 0 );
 
-    gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), aFirstPoint.Z() );
-    gp_Pnt aPnt2( aSecPoint.X(),   aSecPoint.Y(),   aSecPoint.Z()   );
-
-    BRepBuilderAPI_MakeEdge aMakeEdge( aPnt1, aPnt2 );
-    TopoDS_Edge anEdge = aMakeEdge;
-
-    aMakeWire.Add( anEdge );
+    aWire = HYDROData_PolylineXY::BuildWire( aSectionType, false, aProfilePoints );
   }
-
-  TopoDS_Wire aWire;
-  if ( aMakeWire.IsDone() )
-    aWire = aMakeWire;*/
-
   SetShape3D( aWire );
 }