From 91876c98639682debda603c9871f3944a9e7399c Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 24 May 2009 05:49:03 +0000 Subject: [PATCH] +add support for pickling a mapnik query - see #345 --- bindings/python/mapnik_query.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bindings/python/mapnik_query.cpp b/bindings/python/mapnik_query.cpp index d8325c396..d28d0acf2 100644 --- a/bindings/python/mapnik_query.cpp +++ b/bindings/python/mapnik_query.cpp @@ -24,16 +24,25 @@ #include #include #include +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() { using namespace boost::python; - using mapnik::query; - using mapnik::Envelope; - class_("Query", "a spatial query data object", init,double>() ) + .def_pickle(query_pickle_suite()) .add_property("resolution", &query::resolution) .add_property("bbox", make_function(&query::get_bbox, return_value_policy()) )