Changeset 1156

Show
Ignore:
Timestamp:
05/24/09 01:49:03 (14 months ago)
Author:
dane
Message:

+add support for pickling a mapnik query - see #345

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/bindings/python/mapnik_query.cpp

    r790 r1156  
    2525#include <mapnik/query.hpp> 
    2626#include <mapnik/envelope.hpp> 
     27using mapnik::query; 
     28using mapnik::Envelope; 
     29 
     30struct query_pickle_suite : boost::python::pickle_suite 
     31{ 
     32   static boost::python::tuple 
     33   getinitargs(const query& q) 
     34   { 
     35      return boost::python::make_tuple(q.get_bbox(),q.resolution());   
     36   } 
     37}; 
    2738 
    2839void export_query() 
     
    3041    using namespace boost::python; 
    3142 
    32     using mapnik::query; 
    33     using mapnik::Envelope; 
    34  
    3543    class_<query>("Query", "a spatial query data object",  
    3644                  init<Envelope<double>,double>() ) 
     45        .def_pickle(query_pickle_suite()) 
    3746        .add_property("resolution", &query::resolution) 
    3847        .add_property("bbox", make_function(&query::get_bbox,