Merge branch 'master' into compositing
This commit is contained in:
commit
a789ffd2a8
1 changed files with 35 additions and 13 deletions
|
@ -71,7 +71,8 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
|||
agg::trans_affine tr;
|
||||
boost::array<double,6> const& m = sym.get_image_transform();
|
||||
tr.load_from(&m[0]);
|
||||
tr = agg::trans_affine_scaling(scale_factor_*(1.0/pixmap_.get_resolution())) * tr;
|
||||
unsigned int res = pixmap_.get_resolution();
|
||||
tr = agg::trans_affine_scaling(scale_factor_*(1.0/res)) * tr;
|
||||
std::string filename = path_processor_type::evaluate(*sym.get_filename(), *feature);
|
||||
marker_placement_e placement_method = sym.get_marker_placement();
|
||||
marker_type_e marker_type = sym.get_marker_type();
|
||||
|
@ -87,6 +88,11 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
|||
double y1 = bbox.miny();
|
||||
double x2 = bbox.maxx();
|
||||
double y2 = bbox.maxy();
|
||||
double w = (*mark)->width();
|
||||
double h = (*mark)->height();
|
||||
// clamp sizes
|
||||
w = std::max(w,4.0);
|
||||
h = std::max(w,4.0);
|
||||
|
||||
agg::trans_affine recenter = agg::trans_affine_translation(-0.5*(x1+x2),-0.5*(y1+y2));
|
||||
tr.transform(&x1,&y1);
|
||||
|
@ -104,11 +110,27 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
|||
for (unsigned i=0; i<feature->num_geometries(); ++i)
|
||||
{
|
||||
geometry_type & geom = feature->get_geometry(i);
|
||||
if (geom.num_points() <= 1)
|
||||
if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1)
|
||||
{
|
||||
MAPNIK_LOG_WARN(grid_renderer) << "grid_renderer: markers_symbolizer points do not yet support SVG markers";
|
||||
double x;
|
||||
double y;
|
||||
double z=0;
|
||||
geom.label_interior_position(&x, &y);
|
||||
prj_trans.backward(x,y,z);
|
||||
t_.forward(&x,&y);
|
||||
extent.re_center(x,y);
|
||||
|
||||
continue;
|
||||
if (sym.get_allow_overlap() ||
|
||||
detector_.has_placement(extent))
|
||||
{
|
||||
|
||||
render_marker(feature,
|
||||
pixmap_.get_resolution(),
|
||||
pixel_position(x - 0.5 * w, y - 0.5 * h),
|
||||
**mark,
|
||||
tr,
|
||||
sym.get_opacity());
|
||||
}
|
||||
}
|
||||
|
||||
path_type path(t_,geom,prj_trans);
|
||||
|
@ -131,20 +153,17 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
|||
}
|
||||
else
|
||||
{
|
||||
stroke const& stroke_ = sym.get_stroke();
|
||||
double strk_width = stroke_.get_width();
|
||||
|
||||
double w;
|
||||
double h;
|
||||
unsigned int res = pixmap_.get_resolution();
|
||||
if (res != 1) {
|
||||
// clamp to at least 4 px otherwise interactive pixels can be too small
|
||||
double min = static_cast<double>(4/pixmap_.get_resolution());
|
||||
// clamp to at least 4 px otherwise interactive pixels can be too small
|
||||
if (res == 1) {
|
||||
w = std::max(sym.get_width(),4.0);
|
||||
h = std::max(sym.get_height(),4.0);
|
||||
} else {
|
||||
double min = static_cast<double>(4.0/res);
|
||||
w = std::max(sym.get_width()/res,min);
|
||||
h = std::max(sym.get_height()/res,min);
|
||||
} else {
|
||||
w = sym.get_width()/res;
|
||||
h = sym.get_height()/res;
|
||||
}
|
||||
|
||||
double rx = w/2.0;
|
||||
|
@ -153,6 +172,9 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
|||
arrow arrow_;
|
||||
box2d<double> extent;
|
||||
|
||||
stroke const& stroke_ = sym.get_stroke();
|
||||
double strk_width = stroke_.get_width();
|
||||
|
||||
double dx = w + (2*strk_width);
|
||||
double dy = h + (2*strk_width);
|
||||
|
||||
|
|
Loading…
Reference in a new issue