fix marker width/height to mean pixels - which it should have all along - closes #1134
This commit is contained in:
parent
18774354a6
commit
3f26c439c9
7 changed files with 27 additions and 8 deletions
|
@ -9,6 +9,8 @@ For a complete change history, see the SVN log.
|
||||||
|
|
||||||
## Mapnik 2.1.0
|
## Mapnik 2.1.0
|
||||||
|
|
||||||
|
- Fix Markers rendering so that ellipse height/width units are pixels (previously were unintentially radii)
|
||||||
|
|
||||||
- Removed mutex locking during reprojection if using >= proj 4.7 (#1072)
|
- Removed mutex locking during reprojection if using >= proj 4.7 (#1072)
|
||||||
|
|
||||||
- Removed PointDatasource - use more robust MemoryDatasource instead (#1032)
|
- Removed PointDatasource - use more robust MemoryDatasource instead (#1032)
|
||||||
|
|
|
@ -116,5 +116,13 @@ void export_markers_symbolizer()
|
||||||
.add_property("transform",
|
.add_property("transform",
|
||||||
&mapnik::get_svg_transform<markers_symbolizer>,
|
&mapnik::get_svg_transform<markers_symbolizer>,
|
||||||
&mapnik::set_svg_transform<markers_symbolizer>)
|
&mapnik::set_svg_transform<markers_symbolizer>)
|
||||||
|
.add_property("width",
|
||||||
|
&markers_symbolizer::get_width,
|
||||||
|
&markers_symbolizer::set_width,
|
||||||
|
"Set/get the marker width")
|
||||||
|
.add_property("height",
|
||||||
|
&markers_symbolizer::get_height,
|
||||||
|
&markers_symbolizer::set_height,
|
||||||
|
"Set/get the marker height")
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,8 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
||||||
unsigned s_a=col.alpha();
|
unsigned s_a=col.alpha();
|
||||||
double w = sym.get_width();
|
double w = sym.get_width();
|
||||||
double h = sym.get_height();
|
double h = sym.get_height();
|
||||||
|
double rx = w/2.0;
|
||||||
|
double ry = h/2.0;
|
||||||
|
|
||||||
arrow arrow_;
|
arrow arrow_;
|
||||||
box2d<double> extent;
|
box2d<double> extent;
|
||||||
|
@ -225,7 +227,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
||||||
if (sym.get_allow_overlap() ||
|
if (sym.get_allow_overlap() ||
|
||||||
detector_->has_placement(label_ext))
|
detector_->has_placement(label_ext))
|
||||||
{
|
{
|
||||||
agg::ellipse c(x, y, w, h);
|
agg::ellipse c(x, y, rx, ry);
|
||||||
marker.concat_path(c);
|
marker.concat_path(c);
|
||||||
ras_ptr->add_path(marker);
|
ras_ptr->add_path(marker);
|
||||||
ren.color(agg::rgba8(r, g, b, int(a*sym.get_opacity())));
|
ren.color(agg::rgba8(r, g, b, int(a*sym.get_opacity())));
|
||||||
|
@ -271,7 +273,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
||||||
if (marker_type == ELLIPSE)
|
if (marker_type == ELLIPSE)
|
||||||
{
|
{
|
||||||
// todo proper bbox - this is buggy
|
// todo proper bbox - this is buggy
|
||||||
agg::ellipse c(x_t, y_t, w, h);
|
agg::ellipse c(x_t, y_t, rx, ry);
|
||||||
marker.concat_path(c);
|
marker.concat_path(c);
|
||||||
agg::trans_affine matrix;
|
agg::trans_affine matrix;
|
||||||
matrix *= agg::trans_affine_translation(-x_t,-y_t);
|
matrix *= agg::trans_affine_translation(-x_t,-y_t);
|
||||||
|
|
|
@ -148,6 +148,9 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
||||||
h = sym.get_height()/res;
|
h = sym.get_height()/res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double rx = w/2.0;
|
||||||
|
double ry = h/2.0;
|
||||||
|
|
||||||
arrow arrow_;
|
arrow arrow_;
|
||||||
box2d<double> extent;
|
box2d<double> extent;
|
||||||
|
|
||||||
|
@ -195,7 +198,7 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
||||||
if (sym.get_allow_overlap() ||
|
if (sym.get_allow_overlap() ||
|
||||||
detector_.has_placement(label_ext))
|
detector_.has_placement(label_ext))
|
||||||
{
|
{
|
||||||
agg::ellipse c(x, y, w, h);
|
agg::ellipse c(x, y, rx, ry);
|
||||||
agg::path_storage marker;
|
agg::path_storage marker;
|
||||||
marker.concat_path(c);
|
marker.concat_path(c);
|
||||||
ras_ptr->add_path(marker);
|
ras_ptr->add_path(marker);
|
||||||
|
@ -232,7 +235,7 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
||||||
if (marker_type == ELLIPSE)
|
if (marker_type == ELLIPSE)
|
||||||
{
|
{
|
||||||
// todo proper bbox - this is buggy
|
// todo proper bbox - this is buggy
|
||||||
agg::ellipse c(x_t, y_t, w, h);
|
agg::ellipse c(x_t, y_t, rx, ry);
|
||||||
marker.concat_path(c);
|
marker.concat_path(c);
|
||||||
agg::trans_affine matrix;
|
agg::trans_affine matrix;
|
||||||
matrix *= agg::trans_affine_translation(-x_t,-y_t);
|
matrix *= agg::trans_affine_translation(-x_t,-y_t);
|
||||||
|
|
|
@ -51,8 +51,8 @@ markers_symbolizer::markers_symbolizer()
|
||||||
fill_(color(0,0,255)),
|
fill_(color(0,0,255)),
|
||||||
spacing_(100.0),
|
spacing_(100.0),
|
||||||
max_error_(0.2),
|
max_error_(0.2),
|
||||||
width_(5.0),
|
width_(10.0),
|
||||||
height_(5.0),
|
height_(10.0),
|
||||||
stroke_(),
|
stroke_(),
|
||||||
marker_p_(MARKER_LINE_PLACEMENT),
|
marker_p_(MARKER_LINE_PLACEMENT),
|
||||||
marker_type_(ARROW) {}
|
marker_type_(ARROW) {}
|
||||||
|
@ -65,8 +65,8 @@ markers_symbolizer::markers_symbolizer(path_expression_ptr filename)
|
||||||
fill_(color(0,0,255)),
|
fill_(color(0,0,255)),
|
||||||
spacing_(100.0),
|
spacing_(100.0),
|
||||||
max_error_(0.2),
|
max_error_(0.2),
|
||||||
width_(5.0),
|
width_(10.0),
|
||||||
height_(5.0),
|
height_(10.0),
|
||||||
stroke_(),
|
stroke_(),
|
||||||
marker_p_(MARKER_LINE_PLACEMENT),
|
marker_p_(MARKER_LINE_PLACEMENT),
|
||||||
marker_type_(ARROW) {}
|
marker_type_(ARROW) {}
|
||||||
|
|
|
@ -57,6 +57,8 @@ def create_grid_map(width,height):
|
||||||
s = mapnik.Style()
|
s = mapnik.Style()
|
||||||
r = mapnik.Rule()
|
r = mapnik.Rule()
|
||||||
symb = mapnik.MarkersSymbolizer()
|
symb = mapnik.MarkersSymbolizer()
|
||||||
|
symb.width = 10
|
||||||
|
symb.height = 10
|
||||||
symb.allow_overlap = True
|
symb.allow_overlap = True
|
||||||
r.symbols.append(symb)
|
r.symbols.append(symb)
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,8 @@ def test_render_grid():
|
||||||
s = mapnik.Style()
|
s = mapnik.Style()
|
||||||
r = mapnik.Rule()
|
r = mapnik.Rule()
|
||||||
symb = mapnik.MarkersSymbolizer()
|
symb = mapnik.MarkersSymbolizer()
|
||||||
|
symb.width = 10
|
||||||
|
symb.height = 10
|
||||||
symb.allow_overlap = True
|
symb.allow_overlap = True
|
||||||
r.symbols.append(symb)
|
r.symbols.append(symb)
|
||||||
s.rules.append(r)
|
s.rules.append(r)
|
||||||
|
|
Loading…
Reference in a new issue