From 516202703495392ec4f5cbc8f490cbca8c25a1c0 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 7 May 2015 16:12:38 -0700 Subject: [PATCH] avoid closing empty path --- include/mapnik/geometry_to_path.hpp | 34 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/include/mapnik/geometry_to_path.hpp b/include/mapnik/geometry_to_path.hpp index f74fabc5f..dcd62ecc4 100644 --- a/include/mapnik/geometry_to_path.hpp +++ b/include/mapnik/geometry_to_path.hpp @@ -75,24 +75,38 @@ struct geometry_to_path bool first = true; for (auto const& pt : poly.exterior_ring) { - //point pt_new; - //Transformer::apply(pt, pt_new); - if (first) { p_.move_to(pt.x, pt.y); first=false;} - else p_.line_to(pt.x, pt.y); + if (first) { + p_.move_to(pt.x, pt.y); + first=false; + } + else + { + p_.line_to(pt.x, pt.y); + } + } + if (!first) + { + p_.close_path(); } - p_.close_path(); // interior for (auto const& ring : poly.interior_rings) { first = true; for (auto const& pt : ring) { - //point pt_new; - //Transformer::apply(pt, pt_new); - if (first) { p_.move_to(pt.x, pt.y); first=false;} - else p_.line_to(pt.x, pt.y); + if (first) { + p_.move_to(pt.x, pt.y); + first=false; + } + else + { + p_.line_to(pt.x, pt.y); + } + } + if (!first) + { + p_.close_path(); } - p_.close_path(); } }