diff --git a/include/mapnik/marker_helpers.hpp b/include/mapnik/marker_helpers.hpp index 88c6377e6..41431a177 100644 --- a/include/mapnik/marker_helpers.hpp +++ b/include/mapnik/marker_helpers.hpp @@ -114,17 +114,18 @@ struct vector_markers_rasterizer_dispatch } agg::trans_affine matrix = marker_trans_; matrix.translate(x,y); + if (snap_to_pixels_) + { + // https://github.com/mapnik/mapnik/issues/1316 + matrix.tx = std::floor(matrix.tx+.5); + matrix.ty = std::floor(matrix.ty+.5); + } + // TODO https://github.com/mapnik/mapnik/issues/1754 box2d transformed_bbox = bbox_ * matrix; if (sym_.get_allow_overlap() || detector_.has_placement(transformed_bbox)) { - if (snap_to_pixels_) - { - // https://github.com/mapnik/mapnik/issues/1316 - matrix.tx = std::floor(matrix.tx+.5); - matrix.ty = std::floor(matrix.ty+.5); - } svg_renderer_.render(ras_, sl_, renb_, matrix, sym_.get_opacity(), bbox_); if (!sym_.get_ignore_placement()) { diff --git a/src/load_map.cpp b/src/load_map.cpp index 36fca224d..9e188d8de 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -111,7 +111,7 @@ private: void find_unused_nodes_recursive(xml_node const& node, std::string & error_text); - std::string ensure_relative_to_xml(boost::optional opt_path); + std::string ensure_relative_to_xml(boost::optional const& opt_path); void ensure_exists(std::string const& file_path); boost::optional get_opt_color_attr(boost::property_tree::ptree const& node, std::string const& name); @@ -1635,7 +1635,7 @@ void map_parser::ensure_font_face(std::string const& face_name) } } -std::string map_parser::ensure_relative_to_xml(boost::optional opt_path) +std::string map_parser::ensure_relative_to_xml(boost::optional const& opt_path) { if (marker_cache::instance().is_uri(*opt_path)) return *opt_path; diff --git a/tests/python_tests/palette_test.py b/tests/python_tests/palette_test.py index edc64d55a..caa50d604 100644 --- a/tests/python_tests/palette_test.py +++ b/tests/python_tests/palette_test.py @@ -40,9 +40,9 @@ def test_render_with_palette(): # test saving to a string open('/tmp/mapnik-palette-test2.png','wb').write(im.tostring('png',palette)); # compare the two methods - eq_(mapnik.Image.open('/tmp/mapnik-palette-test.png').tostring(),mapnik.Image.open('/tmp/mapnik-palette-test2.png').tostring()) + eq_(mapnik.Image.open('/tmp/mapnik-palette-test.png').tostring(),mapnik.Image.open('/tmp/mapnik-palette-test2.png').tostring(),'%s not eq to %s' % ('/tmp/mapnik-palette-test.png','/tmp/mapnik-palette-test2.png')) # compare to expected - eq_(mapnik.Image.open('/tmp/mapnik-palette-test.png').tostring(),mapnik.Image.open('./images/support/mapnik-palette-test.png').tostring()) + eq_(mapnik.Image.open('/tmp/mapnik-palette-test.png').tostring(),mapnik.Image.open('./images/support/mapnik-palette-test.png').tostring(),'%s not eq to %s' % ('/tmp/mapnik-palette-test.png','./images/support/mapnik-palette-test.png')) if __name__ == "__main__": setup()