From 9a2894dc3c3e284470a72cd28a775f09a1d54cb8 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 20 May 2009 00:08:18 +0000 Subject: [PATCH] +copy/pickle support for Coord objects - see #345 --- bindings/python/mapnik_coord.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bindings/python/mapnik_coord.cpp b/bindings/python/mapnik_coord.cpp index 42cd37ff7..2b98fbaf8 100644 --- a/bindings/python/mapnik_coord.cpp +++ b/bindings/python/mapnik_coord.cpp @@ -24,11 +24,23 @@ #include #include +using mapnik::coord; + +struct coord_pickle_suite : boost::python::pickle_suite +{ + static boost::python::tuple + getinitargs(const coord& c) + { + using namespace boost::python; + return boost::python::make_tuple(c.x,c.y); + } +}; + void export_coord() { using namespace boost::python; - using mapnik::coord; class_ >("Coord",init()) + .def_pickle(coord_pickle_suite()) .def_readwrite("x", &coord::x) .def_readwrite("y", &coord::y) .def(self == self) // __eq__