Coding style correction : tabs to spaces
This commit is contained in:
parent
efff5f0ef0
commit
267975c388
4 changed files with 51 additions and 51 deletions
|
@ -105,27 +105,27 @@ void set_maximum_extent(mapnik::layer & l, boost::optional<mapnik::box2d<double>
|
|||
|
||||
void set_buffer_size(mapnik::layer & l, boost::optional<int> 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<int> buffer_size = l.buffer_size();
|
||||
if (buffer_size)
|
||||
{
|
||||
return PyInt_FromLong(*buffer_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
boost::optional<int> 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"
|
||||
|
|
|
@ -244,16 +244,16 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
|||
box2d<double> buffered_query_ext(query_ext); // buffered
|
||||
|
||||
boost::optional<int> 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<box2d<double> > const& maximum_extent = m_.maximum_extent();
|
||||
|
|
|
@ -207,7 +207,7 @@ boost::optional<int> const& layer::buffer_size() const
|
|||
|
||||
void layer::reset_buffer_size()
|
||||
{
|
||||
buffer_size_.reset();
|
||||
buffer_size_.reset();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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__":
|
||||
|
|
Loading…
Reference in a new issue