From 267975c3886b3d94e490cff4218a330784193d4a Mon Sep 17 00:00:00 2001 From: Alexandre Bonnasseau Date: Fri, 9 Nov 2012 11:57:10 +0100 Subject: [PATCH] Coding style correction : tabs to spaces --- bindings/python/mapnik_layer.cpp | 36 +++++++-------- .../mapnik/feature_style_processor_impl.hpp | 20 ++++----- src/layer.cpp | 2 +- tests/python_tests/layer_buffer_size_test.py | 44 +++++++++---------- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/bindings/python/mapnik_layer.cpp b/bindings/python/mapnik_layer.cpp index f0d28cc28..5e212f22b 100644 --- a/bindings/python/mapnik_layer.cpp +++ b/bindings/python/mapnik_layer.cpp @@ -105,27 +105,27 @@ void set_maximum_extent(mapnik::layer & l, boost::optional void set_buffer_size(mapnik::layer & l, boost::optional const& buffer_size) { - if (buffer_size) - { - l.set_buffer_size(*buffer_size); - } - else - { - l.reset_buffer_size(); - } + if (buffer_size) + { + l.set_buffer_size(*buffer_size); + } + else + { + l.reset_buffer_size(); + } } PyObject * get_buffer_size(mapnik::layer & l) { - boost::optional buffer_size = l.buffer_size(); - if (buffer_size) - { - return PyInt_FromLong(*buffer_size); - } - else - { - Py_RETURN_NONE; - } + boost::optional buffer_size = l.buffer_size(); + if (buffer_size) + { + return PyInt_FromLong(*buffer_size); + } + else + { + Py_RETURN_NONE; + } } void export_layer() @@ -249,7 +249,7 @@ void export_layer() ) .add_property("buffer_size", - &get_buffer_size, + &get_buffer_size, &set_buffer_size, "Get/Set the size of buffer around layer in pixels.\n" "\n" diff --git a/include/mapnik/feature_style_processor_impl.hpp b/include/mapnik/feature_style_processor_impl.hpp index 345016426..d0fd17c15 100644 --- a/include/mapnik/feature_style_processor_impl.hpp +++ b/include/mapnik/feature_style_processor_impl.hpp @@ -244,16 +244,16 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces box2d buffered_query_ext(query_ext); // buffered boost::optional layer_buffer_size = lay.buffer_size(); - if (layer_buffer_size) // if layer overrides buffer size, use this value to compute buffered extent - { - double extra = 2.0 * m_.scale() * *layer_buffer_size; - buffered_query_ext.width(query_ext.width() + extra); - buffered_query_ext.height(query_ext.height() + extra); - } - else - { - buffered_query_ext = m_.get_buffered_extent(); - } + if (layer_buffer_size) // if layer overrides buffer size, use this value to compute buffered extent + { + double extra = 2.0 * m_.scale() * *layer_buffer_size; + buffered_query_ext.width(query_ext.width() + extra); + buffered_query_ext.height(query_ext.height() + extra); + } + else + { + buffered_query_ext = m_.get_buffered_extent(); + } // clip buffered extent by maximum extent, if supplied boost::optional > const& maximum_extent = m_.maximum_extent(); diff --git a/src/layer.cpp b/src/layer.cpp index 61739c7a7..14744402b 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -207,7 +207,7 @@ boost::optional const& layer::buffer_size() const void layer::reset_buffer_size() { - buffer_size_.reset(); + buffer_size_.reset(); } diff --git a/tests/python_tests/layer_buffer_size_test.py b/tests/python_tests/layer_buffer_size_test.py index 4b6fb1ff4..f50a0d62b 100644 --- a/tests/python_tests/layer_buffer_size_test.py +++ b/tests/python_tests/layer_buffer_size_test.py @@ -11,30 +11,30 @@ def setup(): os.chdir(execution_path('.')) def test_layer_buffer_size_1(): - m = mapnik.Map(512,512) - mapnik.load_map(m,'../data/good_maps/layer_buffer_size_reduction.xml') - m.zoom_all() - im = mapnik.Image(m.width,m.height) - mapnik.render(m,im) - actual = '/tmp/mapnik-layer-buffer-size.png' - expected = 'images/support/mapnik-layer-buffer-size.png' - im.save(actual) - expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + m = mapnik.Map(512,512) + mapnik.load_map(m,'../data/good_maps/layer_buffer_size_reduction.xml') + m.zoom_all() + im = mapnik.Image(m.width,m.height) + mapnik.render(m,im) + actual = '/tmp/mapnik-layer-buffer-size.png' + expected = 'images/support/mapnik-layer-buffer-size.png' + im.save(actual) + expected_im = mapnik.Image.open(expected) + eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) def test_layer_buffer_size_2(): - actual = '/tmp/mapnik-layer-buffer-size-cairo.png' - expected = 'images/support/mapnik-layer-buffer-size-cairo.png' - m = mapnik.Map(512,512) - mapnik.load_map(m,'../data/good_maps/layer_buffer_size_reduction.xml') - m.zoom_all() - surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, m.width, m.height) - mapnik.render(m, surface) - surface.write_to_png(actual) - surface.finish() - expected_im = mapnik.Image.open(expected) - actual_im = mapnik.Image.open(actual) - eq_(actual_im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + actual = '/tmp/mapnik-layer-buffer-size-cairo.png' + expected = 'images/support/mapnik-layer-buffer-size-cairo.png' + m = mapnik.Map(512,512) + mapnik.load_map(m,'../data/good_maps/layer_buffer_size_reduction.xml') + m.zoom_all() + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, m.width, m.height) + mapnik.render(m, surface) + surface.write_to_png(actual) + surface.finish() + expected_im = mapnik.Image.open(expected) + actual_im = mapnik.Image.open(actual) + eq_(actual_im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) if __name__ == "__main__":