]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Bug #168: do not close wire for closed polyline section consist of less than 2 points.
authormzn <mzn@opencascade.com>
Thu, 30 Jan 2014 11:17:42 +0000 (11:17 +0000)
committermzn <mzn@opencascade.com>
Thu, 30 Jan 2014 11:17:42 +0000 (11:17 +0000)
src/HYDROData/HYDROData_PolylineXY.cxx

index d40212e22a6018b713445af69ae6d516bb7512c7..e66438086ea59139e31e280ec67d9806f7331639 100755 (executable)
@@ -389,14 +389,15 @@ TopoDS_Wire HYDROData_PolylineXY::BuildWire( const SectionType&
   TopoDS_Wire aWire;
   if( theType == SECTION_POLYLINE )
   {
+    int aNbPoints = thePoints.Length();
     BRepBuilderAPI_MakePolygon aMakeWire;
-    for ( int i = 1, n = thePoints.Length(); i <= n ; ++i )
+    for ( int i = 1, n = aNbPoints; i <= n ; ++i )
     {
       gp_XYZ aPoint = thePoints.Value( i );
       gp_Pnt aPnt( aPoint.X(), aPoint.Y(), aPoint.Z() );
       aMakeWire.Add( aPnt );
     }
-    if( theIsClosed )
+    if( theIsClosed && ( aNbPoints > 2 ) )
       aMakeWire.Close();
 
     if ( aMakeWire.IsDone() )