fix markers transforms calc
This commit is contained in:
parent
81c4b9dd59
commit
de90d0ee2a
3 changed files with 16 additions and 25 deletions
|
@ -240,6 +240,9 @@ struct vector_markers_rasterizer_dispatch_grid : mapnik::noncopyable
|
|||
double opacity = get<double>(sym_,keys::opacity, feature_, vars_, 1.0);
|
||||
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
|
||||
|
||||
coord2d center = bbox_.center();
|
||||
agg::trans_affine_translation recenter(-center.x, -center.y);
|
||||
|
||||
if (placement_method != MARKER_LINE_PLACEMENT ||
|
||||
path.type() == geometry_type::types::Point)
|
||||
{
|
||||
|
@ -247,27 +250,18 @@ struct vector_markers_rasterizer_dispatch_grid : mapnik::noncopyable
|
|||
double y = 0;
|
||||
if (path.type() == geometry_type::types::LineString)
|
||||
{
|
||||
if (!label::middle_point(path, x, y))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!label::middle_point(path, x, y)) return;
|
||||
}
|
||||
else if (placement_method == MARKER_INTERIOR_PLACEMENT)
|
||||
{
|
||||
if (!label::interior_position(path, x, y))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!label::interior_position(path, x, y)) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!label::centroid(path, x, y))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!label::centroid(path, x, y)) return;
|
||||
}
|
||||
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
agg::trans_affine matrix = recenter * marker_trans_;
|
||||
matrix.translate(x,y);
|
||||
box2d<double> transformed_bbox = bbox_ * matrix;
|
||||
if (allow_overlap ||
|
||||
|
@ -296,7 +290,7 @@ struct vector_markers_rasterizer_dispatch_grid : mapnik::noncopyable
|
|||
double x, y, angle;
|
||||
while (placement.get_point(x, y, angle, ignore_placement))
|
||||
{
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
agg::trans_affine matrix = recenter * marker_trans_;
|
||||
matrix.rotate(angle);
|
||||
matrix.translate(x, y);
|
||||
svg_renderer_.render_id(ras_, sl_, renb_, feature_.id(), matrix, opacity, bbox_);
|
||||
|
|
|
@ -106,6 +106,9 @@ struct vector_markers_rasterizer_dispatch : mapnik::noncopyable
|
|||
bool allow_overlap = get<bool>(sym_, keys::allow_overlap, feature_, vars_, false);
|
||||
double opacity = get<double>(sym_,keys::opacity, feature_, vars_, 1.0);
|
||||
|
||||
coord2d center = bbox_.center();
|
||||
agg::trans_affine_translation recenter(-center.x, -center.y);
|
||||
|
||||
if (placement_method != MARKER_LINE_PLACEMENT ||
|
||||
path.type() == mapnik::geometry_type::types::Point)
|
||||
{
|
||||
|
@ -123,7 +126,7 @@ struct vector_markers_rasterizer_dispatch : mapnik::noncopyable
|
|||
{
|
||||
if (!label::centroid(path, x, y)) return;
|
||||
}
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
agg::trans_affine matrix = recenter * marker_trans_;
|
||||
matrix.translate(x,y);
|
||||
if (snap_to_pixels_)
|
||||
{
|
||||
|
@ -157,7 +160,8 @@ struct vector_markers_rasterizer_dispatch : mapnik::noncopyable
|
|||
double angle = 0;
|
||||
while (placement.get_point(x, y, angle, ignore_placement))
|
||||
{
|
||||
agg::trans_affine matrix = marker_trans_;
|
||||
|
||||
agg::trans_affine matrix = recenter * marker_trans_;
|
||||
matrix.rotate(angle);
|
||||
matrix.translate(x, y);
|
||||
svg_renderer_.render(ras_, sl_, renb_, matrix, opacity, bbox_);
|
||||
|
|
|
@ -79,13 +79,10 @@ void render_markers_symbolizer(markers_symbolizer const& sym,
|
|||
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
|
||||
if (image_transform) evaluate_transform(tr, feature, common.vars_, *image_transform);
|
||||
box2d<double> bbox = marker_ellipse.bounding_box();
|
||||
coord2d center = bbox.center();
|
||||
agg::trans_affine_translation recenter(-center.x, -center.y);
|
||||
agg::trans_affine marker_trans = recenter * tr;
|
||||
vector_dispatch_type rasterizer_dispatch(svg_path,
|
||||
result ? attributes : (*stock_vector_marker)->attributes(),
|
||||
bbox,
|
||||
marker_trans,
|
||||
tr,
|
||||
sym,
|
||||
*common.detector_,
|
||||
common.scale_factor_,
|
||||
|
@ -121,14 +118,10 @@ void render_markers_symbolizer(markers_symbolizer const& sym,
|
|||
svg_path_adapter svg_path(stl_storage);
|
||||
svg_attribute_type attributes;
|
||||
bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym, feature, common.vars_);
|
||||
// TODO - clamping to >= 4 pixels
|
||||
coord2d center = bbox.center();
|
||||
agg::trans_affine_translation recenter(-center.x, -center.y);
|
||||
agg::trans_affine marker_trans = recenter * tr;
|
||||
vector_dispatch_type rasterizer_dispatch(svg_path,
|
||||
result ? attributes : (*stock_vector_marker)->attributes(),
|
||||
bbox,
|
||||
marker_trans,
|
||||
tr,
|
||||
sym,
|
||||
*common.detector_,
|
||||
common.scale_factor_,
|
||||
|
|
Loading…
Reference in a new issue