apply patch from @lightmare fixing image_filter getter - closes #1534
This commit is contained in:
parent
38d9163f78
commit
72124a9f8a
2 changed files with 18 additions and 1 deletions
|
@ -49,14 +49,16 @@ void set_image_filters(feature_type_style & style, std::string const& filters)
|
||||||
std::string::const_iterator end = filters.end();
|
std::string::const_iterator end = filters.end();
|
||||||
mapnik::image_filter_grammar<std::string::const_iterator,
|
mapnik::image_filter_grammar<std::string::const_iterator,
|
||||||
std::vector<mapnik::filter::filter_type> > filter_grammar;
|
std::vector<mapnik::filter::filter_type> > filter_grammar;
|
||||||
|
std::vector<mapnik::filter::filter_type> new_filters;
|
||||||
bool result = boost::spirit::qi::phrase_parse(itr,end,
|
bool result = boost::spirit::qi::phrase_parse(itr,end,
|
||||||
filter_grammar,
|
filter_grammar,
|
||||||
boost::spirit::qi::ascii::space,
|
boost::spirit::qi::ascii::space,
|
||||||
style.image_filters());
|
new_filters);
|
||||||
if (!result || itr!=end)
|
if (!result || itr!=end)
|
||||||
{
|
{
|
||||||
throw mapnik::value_error("failed to parse image-filters: '" + std::string(itr,end) + "'");
|
throw mapnik::value_error("failed to parse image-filters: '" + std::string(itr,end) + "'");
|
||||||
}
|
}
|
||||||
|
style.image_filters().swap(new_filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
void export_style()
|
void export_style()
|
||||||
|
|
15
tests/python_tests/image_filters_test.py
Normal file
15
tests/python_tests/image_filters_test.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from nose.tools import *
|
||||||
|
import os, mapnik
|
||||||
|
|
||||||
|
def test_append():
|
||||||
|
s = mapnik.Style()
|
||||||
|
eq_(s.image_filters,'')
|
||||||
|
s.image_filters = 'gray'
|
||||||
|
eq_(s.image_filters,'gray')
|
||||||
|
s.image_filters = 'sharpen'
|
||||||
|
eq_(s.image_filters,'sharpen')
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
[eval(run)() for run in dir() if 'test_' in run]
|
Loading…
Reference in a new issue