From 7c0f65b952b63fc55d20636ce62eb09de587abe2 Mon Sep 17 00:00:00 2001 From: mzn Date: Thu, 30 Jan 2014 11:17:42 +0000 Subject: [PATCH] Bug #168: do not close wire for closed polyline section consist of less than 2 points. --- src/HYDROData/HYDROData_PolylineXY.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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() ) -- 2.39.2