/* This file is part of python_mapnik (c++/python mapping toolkit) * Copyright (C) 2005 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //$Id: mapnik_map.cc 17 2005-03-08 23:58:43Z pavlenko $ #include #include #include #include using mapnik::Color; using mapnik::coord; using mapnik::Envelope; using mapnik::Layer; using mapnik::Map; struct map_pickle_suite : boost::python::pickle_suite { static boost::python::tuple getinitargs(const Map& m) { return boost::python::make_tuple(m.getWidth(),m.getHeight(),m.srid()); } static boost::python::tuple getstate(const Map& m) { boost::python::list l; for (unsigned i=0;i ext = extract >(state[0]); Color bg = extract(state[1]); m.zoomToBox(ext); m.setBackground(bg); boost::python::list l=extract(state[2]); for (int i=0;i(l[i])); } } }; void export_map() { using namespace boost::python; class_ >("layers") .def(vector_indexing_suite >()) ; class_("map",init >()) .add_property("width",&Map::getWidth) .add_property("height",&Map::getHeight) .add_property("srid",&Map::srid) .add_property("background",make_function (&Map::getBackground,return_value_policy()), &Map::setBackground) .def("scale", &Map::scale) .def("zoom_to_box",&Map::zoomToBox) .def("pan",&Map::pan) .def("zoom",&Map::zoom) .def("pan_and_zoom",&Map::pan_and_zoom) .add_property("layers",make_function (&Map::layers,return_value_policy())) .def_pickle(map_pickle_suite()) ; }