+ 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
|
// agg
|
||||||
#include "agg_conv_clip_polyline.h"
|
#include "agg_conv_clip_polyline.h"
|
||||||
#include "agg_conv_clip_polygon.h"
|
#include "agg_conv_clip_polygon.h"
|
||||||
|
#include "agg_conv_smooth_poly1.h"
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
|
@ -725,23 +726,37 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
||||||
proj_transform const& prj_trans)
|
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_);
|
cairo_context context(context_);
|
||||||
|
|
||||||
context.set_color(sym.get_fill(), sym.get_opacity());
|
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)
|
for (unsigned i = 0; i < feature->num_geometries(); ++i)
|
||||||
{
|
{
|
||||||
geometry_type & geom = feature->get_geometry(i);
|
geometry_type & geom = feature->get_geometry(i);
|
||||||
if (geom.num_points() > 2)
|
if (geom.num_points() > 2)
|
||||||
{
|
{
|
||||||
clipped_geometry_type clipped(geom);
|
if (sym.smooth() > 0.0)
|
||||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
{
|
||||||
path_type path(t_,clipped,prj_trans);
|
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
|
||||||
context.add_path(path);
|
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||||
context.fill();
|
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);
|
||||||
|
context.add_path(path);
|
||||||
|
context.fill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue