/***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) * * Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ //$Id: mapnik_python.cc 27 2005-03-30 21:45:40Z pavlenko $ #include #include #include #include "mapnik.hpp" using namespace mapnik; void export_color(); void export_layer(); void export_parameters(); void export_envelope(); void export_image(); void export_map(); void export_python(); void export_filter(); void export_rule(); void export_style(); void export_stroke(); void export_datasource_cache(); void export_point_symbolizer(); void export_line_symbolizer(); void export_line_pattern_symbolizer(); void export_polygon_symbolizer(); void export_polygon_pattern_symbolizer(); void export_raster_symbolizer(); void export_text_symbolizer(); void export_font_engine(); void render_to_file(const Map& map,const std::string& file,const std::string& format) { Image32 image(map.getWidth(),map.getHeight()); agg_renderer ren(map,image); ren.apply(); image.saveToFile(file,format); } void render(const Map& map,Image32& image) { agg_renderer ren(map,image); ren.apply(); } BOOST_PYTHON_MODULE(_mapnik) { using namespace boost::python; class_, boost::noncopyable>("Datasource",no_init) .def("envelope",&datasource::envelope, return_value_policy()) ; export_parameters(); export_color(); export_envelope(); export_image(); export_filter(); export_rule(); export_style(); export_layer(); export_stroke(); export_datasource_cache(); export_point_symbolizer(); export_line_symbolizer(); export_line_pattern_symbolizer(); export_polygon_symbolizer(); export_polygon_pattern_symbolizer(); export_raster_symbolizer(); export_text_symbolizer(); export_font_engine(); class_ >("Coord",init()) .def_readwrite("x", &coord::x) .def_readwrite("y", &coord::y) ; export_map(); def("render_to_file",&render_to_file); def("render",&render); register_ptr_to_python(); }