+add support for pickling a mapnik query - see #345
This commit is contained in:
parent
bd1407b7c5
commit
91876c9863
1 changed files with 12 additions and 3 deletions
|
@ -24,16 +24,25 @@
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
#include <mapnik/query.hpp>
|
#include <mapnik/query.hpp>
|
||||||
#include <mapnik/envelope.hpp>
|
#include <mapnik/envelope.hpp>
|
||||||
|
using mapnik::query;
|
||||||
|
using mapnik::Envelope;
|
||||||
|
|
||||||
|
struct query_pickle_suite : boost::python::pickle_suite
|
||||||
|
{
|
||||||
|
static boost::python::tuple
|
||||||
|
getinitargs(const query& q)
|
||||||
|
{
|
||||||
|
return boost::python::make_tuple(q.get_bbox(),q.resolution());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void export_query()
|
void export_query()
|
||||||
{
|
{
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
|
|
||||||
using mapnik::query;
|
|
||||||
using mapnik::Envelope;
|
|
||||||
|
|
||||||
class_<query>("Query", "a spatial query data object",
|
class_<query>("Query", "a spatial query data object",
|
||||||
init<Envelope<double>,double>() )
|
init<Envelope<double>,double>() )
|
||||||
|
.def_pickle(query_pickle_suite())
|
||||||
.add_property("resolution", &query::resolution)
|
.add_property("resolution", &query::resolution)
|
||||||
.add_property("bbox", make_function(&query::get_bbox,
|
.add_property("bbox", make_function(&query::get_bbox,
|
||||||
return_value_policy<copy_const_reference>()) )
|
return_value_policy<copy_const_reference>()) )
|
||||||
|
|
Loading…
Add table
Reference in a new issue