From 361cffdd936bdc3a2827dea7c94f1aa6b6564b6f Mon Sep 17 00:00:00 2001 From: Mohcine Chraibi <m.chraibi@fz-juelich.de> Date: Tue, 9 Oct 2018 16:23:06 +0200 Subject: [PATCH] Fixes #87 .Bug in polygon2string conversion some polygons are made of interior and exterior rings. --- methods/Method_D.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/methods/Method_D.cpp b/methods/Method_D.cpp index 3017911b..58ebd367 100644 --- a/methods/Method_D.cpp +++ b/methods/Method_D.cpp @@ -491,6 +491,19 @@ std::string polygon_to_string(const polygon_2d & polygon) polygon_str.append(std::to_string(y)); polygon_str.append("), "); } + for(auto ring: boost::geometry::interior_rings(polygon) ) + { + for(auto point: ring ) + { + double x = boost::geometry::get<0>(point); + double y = boost::geometry::get<1>(point); + polygon_str.append("("); + polygon_str.append(std::to_string(x)); + polygon_str.append(", "); + polygon_str.append(std::to_string(y)); + polygon_str.append("), "); + } + } polygon_str.pop_back(); polygon_str.pop_back(); //remove last komma polygon_str.append("))"); return polygon_str; -- GitLab