+copy/pickle support for Coord objects - see #345
This commit is contained in:
parent
7d9ac2a094
commit
9a2894dc3c
1 changed files with 13 additions and 1 deletions
|
@ -24,11 +24,23 @@
|
|||
#include <boost/python.hpp>
|
||||
#include <mapnik/coord.hpp>
|
||||
|
||||
using mapnik::coord;
|
||||
|
||||
struct coord_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static boost::python::tuple
|
||||
getinitargs(const coord<double,2>& 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<double,2> >("Coord",init<double,double>())
|
||||
.def_pickle(coord_pickle_suite())
|
||||
.def_readwrite("x", &coord<double,2>::x)
|
||||
.def_readwrite("y", &coord<double,2>::y)
|
||||
.def(self == self) // __eq__
|
||||
|
|
Loading…
Reference in a new issue