find text interior placement after reprojection
This commit is contained in:
parent
43d7278352
commit
e243e16fd9
1 changed files with 21 additions and 4 deletions
|
@ -40,6 +40,10 @@
|
||||||
#include <mapnik/text/placement_finder_impl.hpp>
|
#include <mapnik/text/placement_finder_impl.hpp>
|
||||||
#include <mapnik/text/placements/base.hpp>
|
#include <mapnik/text/placements/base.hpp>
|
||||||
#include <mapnik/text/placements/dummy.hpp>
|
#include <mapnik/text/placements/dummy.hpp>
|
||||||
|
#include <mapnik/geometry/transform.hpp>
|
||||||
|
#include <mapnik/geometry/strategy.hpp>
|
||||||
|
#include <mapnik/proj_strategy.hpp>
|
||||||
|
#include <mapnik/view_strategy.hpp>
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
namespace geometry {
|
namespace geometry {
|
||||||
|
@ -286,11 +290,24 @@ void base_symbolizer_helper::initialize_points() const
|
||||||
success = true;
|
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<geometry::polygon<double> >(geom);
|
auto const& poly = util::get<geometry::polygon<double>>(geom);
|
||||||
geometry::polygon_vertex_adapter<double> va(poly);
|
proj_transform backwart_transform(prj_trans_.dest(), prj_trans_.source());
|
||||||
success = label::interior_position(va, label_x, label_y);
|
view_strategy vs(t_);
|
||||||
|
proj_strategy ps(backwart_transform);
|
||||||
|
using transform_group_type = geometry::strategy_group<proj_strategy, view_strategy>;
|
||||||
|
transform_group_type transform_group(ps, vs);
|
||||||
|
geometry::polygon<double> tranformed_poly(geometry::transform<double>(poly, transform_group));
|
||||||
|
if (how_placed == INTERIOR_PLACEMENT)
|
||||||
|
{
|
||||||
|
geometry::polygon_vertex_adapter<double> va(tranformed_poly);
|
||||||
|
if (label::interior_position(va, label_x, label_y))
|
||||||
|
{
|
||||||
|
points_.emplace_back(label_x, label_y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue