+ supprt polygon smoothing in cairo backend
This commit is contained in:
parent
3e4733c51a
commit
f0bc1064c6
1 changed files with 25 additions and 10 deletions
|
@ -53,6 +53,7 @@
|
|||
// agg
|
||||
#include "agg_conv_clip_polyline.h"
|
||||
#include "agg_conv_clip_polygon.h"
|
||||
#include "agg_conv_smooth_poly1.h"
|
||||
|
||||
// stl
|
||||
#ifdef MAPNIK_DEBUG
|
||||
|
@ -725,18 +726,31 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
proj_transform const& prj_trans)
|
||||
{
|
||||
|
||||
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
cairo_context context(context_);
|
||||
|
||||
context.set_color(sym.get_fill(), sym.get_opacity());
|
||||
|
||||
box2d<double> inflated_extent = query_extent_ * 1.1;
|
||||
for (unsigned i = 0; i < feature->num_geometries(); ++i)
|
||||
{
|
||||
geometry_type & geom = feature->get_geometry(i);
|
||||
if (geom.num_points() > 2)
|
||||
{
|
||||
if (sym.smooth() > 0.0)
|
||||
{
|
||||
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef agg::conv_smooth_poly1_curve<path_type> smooth_type;
|
||||
clipped_geometry_type clipped(geom);
|
||||
clipped.clip_box(inflated_extent.minx(),inflated_extent.miny(),inflated_extent.maxx(),inflated_extent.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
smooth_type smooth(path);
|
||||
smooth.smooth_value(sym.smooth());
|
||||
context.add_agg_path(smooth);
|
||||
context.fill();
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
clipped_geometry_type clipped(geom);
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
|
@ -745,6 +759,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cairo_renderer_base::process(building_symbolizer const& sym,
|
||||
mapnik::feature_ptr const& feature,
|
||||
|
|
Loading…
Reference in a new issue