/***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) * * 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$ // boost #include #include #include #include // mapnik #include #include namespace { using mapnik::from_wkt; using mapnik::geometry_type; geometry_type * make_from_wkt(std::string const& wkt) { std::pair result = from_wkt(wkt); if (result.first) { return result.second; } throw std::runtime_error("Failed to parse WKT"); } } void export_geometry() { using namespace boost::python; enum_("GeometryType") .value("Point",mapnik::Point) .value("LineString",mapnik::LineString) .value("Polygon",mapnik::Polygon) .value("MultiPoint",mapnik::MultiPoint) .value("MultiLineString",mapnik::MultiLineString) .value("MultiPolygon",mapnik::MultiPolygon) ; using mapnik::geometry_type; class_,boost::noncopyable>("Geometry2d",no_init) // factory method .def("from_wkt",make_from_wkt,return_value_policy()) .staticmethod("from_wkt") .def("envelope",&geometry_type::envelope) // .def("__str__",&geometry_type::to_string) .def("type",&geometry_type::type) // TODO add other geometry_type methods ; }