diff --git a/include/mapnik/geometry/is_empty.hpp b/include/mapnik/geometry/is_empty.hpp index fccf7eae0..e39a5b9f7 100644 --- a/include/mapnik/geometry/is_empty.hpp +++ b/include/mapnik/geometry/is_empty.hpp @@ -39,18 +39,36 @@ struct geometry_is_empty bool operator()(mapnik::geometry::point const&) const { return false; } - bool operator()(mapnik::geometry::line_string const& geom) const { return geom.empty(); } + bool operator()(mapnik::geometry::line_string const& line) const { return line.empty(); } - bool operator()(mapnik::geometry::polygon const& geom) const + bool operator()(mapnik::geometry::polygon const& poly) const { - return geom.empty() || geom.front().empty(); + for (auto const& ring : poly) + { + if (!ring.empty()) return false; + } + return true; } bool operator()(mapnik::geometry::multi_point const& geom) const { return geom.empty(); } - bool operator()(mapnik::geometry::multi_line_string const& geom) const { return geom.empty(); } + bool operator()(mapnik::geometry::multi_line_string const& mline) const + { + for (auto const& line : mline) + { + if (!line.empty()) return false; + } + return true; + } - bool operator()(mapnik::geometry::multi_polygon const& geom) const { return geom.empty(); } + bool operator()(mapnik::geometry::multi_polygon const& mpoly) const + { + for (auto const& poly : mpoly) + { + if (!operator()(poly)) return false; + } + return true; + } bool operator()(mapnik::geometry::geometry_collection const& geom) const { return geom.empty(); }