From e243e16fd975c2a4a8e2ba7fcbd1e69377956933 Mon Sep 17 00:00:00 2001 From: Jiri Drbalek Date: Sun, 8 Oct 2017 14:32:14 +0000 Subject: [PATCH] find text interior placement after reprojection --- src/text/symbolizer_helpers.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/text/symbolizer_helpers.cpp b/src/text/symbolizer_helpers.cpp index 367411b67..65aaeafa6 100644 --- a/src/text/symbolizer_helpers.cpp +++ b/src/text/symbolizer_helpers.cpp @@ -40,6 +40,10 @@ #include #include #include +#include +#include +#include +#include namespace mapnik { namespace geometry { @@ -286,11 +290,24 @@ void base_symbolizer_helper::initialize_points() const success = true; } } - else if (how_placed == INTERIOR_PLACEMENT && type == geometry::geometry_types::Polygon) + else if (type == geometry::geometry_types::Polygon) { - auto const& poly = mapnik::util::get >(geom); - geometry::polygon_vertex_adapter va(poly); - success = label::interior_position(va, label_x, label_y); + auto const& poly = util::get>(geom); + proj_transform backwart_transform(prj_trans_.dest(), prj_trans_.source()); + view_strategy vs(t_); + proj_strategy ps(backwart_transform); + using transform_group_type = geometry::strategy_group; + transform_group_type transform_group(ps, vs); + geometry::polygon tranformed_poly(geometry::transform(poly, transform_group)); + if (how_placed == INTERIOR_PLACEMENT) + { + geometry::polygon_vertex_adapter va(tranformed_poly); + if (label::interior_position(va, label_x, label_y)) + { + points_.emplace_back(label_x, label_y); + } + } + continue; } else {