/* 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$ #include #include #include #include "mapnik.hh" #include "polygon_symbolizer.hh" #include "line_symbolizer.hh" #include "image_symbolizer.hh" void export_color(); void export_layer(); void export_parameters(); void export_envelope(); void export_map(); using namespace mapnik; namespace boost { namespace python { template class DeallocPolicy> T* get_pointer(ref_ptr< T , DeallocPolicy> const& ptr) { return ( T* )ptr.get(); } template struct pointee > { typedef T type; }; template <> struct pointee > { typedef datasource type; }; } } void render_to_file(const Map& map,const std::string& file,const std::string& format) { Image32 image(map.getWidth(),map.getHeight()); Renderer::render(map,image); image.saveToFile(file,format); } //BEGIN quick hack ref_ptr create_point_symbolizer(const std::string& file,unsigned w,unsigned h) { return ref_ptr(new ImageSymbolizer(file,"png",w,h)); } ref_ptr create_line_symbolizer(const Color& stroke,double minScale,double maxScale) { return ref_ptr(new LineSymbolizer(stroke,minScale,maxScale)); } ref_ptr create_polygon_symbolizer(const Color& stroke,const Color& fill,double minScale,double maxScale) { return ref_ptr(new PolygonSymbolizer(fill,minScale,maxScale)); } //END 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(); class_