From 1bf3e89de08162ab01cb27064af8023377b5d286 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 11 Mar 2013 15:58:19 -0700 Subject: [PATCH 1/3] tests: if palette comparison fails print file names --- tests/python_tests/palette_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() From 86ad6c0dabdc7fd24bf520fa9d59265a9c9989bd Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 12 Mar 2013 12:14:01 -0700 Subject: [PATCH 2/3] snap to pixels for markers because calculating placement --- include/mapnik/marker_helpers.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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()) { From 71a04cd09da21680b6ad498fe4985eb157f34f35 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 12 Mar 2013 16:56:31 -0700 Subject: [PATCH 3/3] pass optional by const ref --- src/load_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/load_map.cpp b/src/load_map.cpp index 7595200d4..dcd8786de 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); @@ -1634,7 +1634,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;