From: mzn Date: Thu, 30 Jan 2014 11:17:42 +0000 (+0000) Subject: Bug #168: do not close wire for closed polyline section consist of less than 2 points. X-Git-Tag: BR_hydro_v_1_0~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7c0f65b952b63fc55d20636ce62eb09de587abe2;p=modules%2Fhydro.git Bug #168: do not close wire for closed polyline section consist of less than 2 points. --- diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index d40212e2..e6643808 100755 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -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() )