From ec2d0cc21069e13609f14b0d6ee5bda122be416e Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 26 Jul 2012 15:20:56 +0100 Subject: [PATCH] + wkb reader : close polygons --- src/wkb.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wkb.cpp b/src/wkb.cpp index 1d800fd44..2e57b8600 100644 --- a/src/wkb.cpp +++ b/src/wkb.cpp @@ -353,10 +353,11 @@ private: CoordinateArray ar(num_points); read_coords(ar); poly->move_to(ar[0].x, ar[0].y); - for (int j = 1; j < num_points; ++j) + for (int j = 1; j < num_points - 1; ++j) { poly->line_to(ar[j].x, ar[j].y); } + poly->close(ar[num_points-1].x, ar[num_points-1].y); } } if (poly->size() > 2) // ignore if polygon has less than 3 vertices @@ -388,10 +389,11 @@ private: CoordinateArray ar(num_points); read_coords_xyz(ar); poly->move_to(ar[0].x, ar[0].y); - for (int j = 1; j < num_points; ++j) + for (int j = 1; j < num_points - 1; ++j) { poly->line_to(ar[j].x, ar[j].y); } + poly->close(ar[num_points-1].x, ar[num_points-1].y); } } if (poly->size() > 2) // ignore if polygon has less than 3 vertices