enumeration_wrapper to python converter (work-in-progress)

This commit is contained in:
artemp 2013-12-05 16:31:30 +00:00
parent 8a0c3692f6
commit 12dbc035cc
2 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,45 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2013 Artem Pavlenko
*
* 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
*
*****************************************************************************/
#ifndef MAPNIK_BINDINGS_PYTHON_ENUMERATION_WRAPPPER
#define MAPNIK_BINDINGS_PYTHON_ENUMERATION_WRAPPPER
// mapnik
#include <mapnik/symbolizer.hpp>
// boost
#include <boost/python.hpp>
namespace boost { namespace python {
struct mapnik_enumeration_wrapper_to_python
{
static PyObject* convert(mapnik::enumeration_wrapper const& v)
{
return ::PyLong_FromLongLong(v.value); // FIXME: this is a temp hack!!
}
};
}}
#endif // MAPNIK_BINDINGS_PYTHON_ENUMERATION_WRAPPPER

View file

@ -98,6 +98,7 @@ void export_wkt_reader();
#include "python_grid_utils.hpp"
#endif
#include "mapnik_value_converter.hpp"
#include "mapnik_enumeration_wrapper_converter.hpp"
#include "mapnik_threads.hpp"
#include "python_optional.hpp"
#include <mapnik/marker_cache.hpp>
@ -877,4 +878,5 @@ BOOST_PYTHON_MODULE(_mapnik)
register_ptr_to_python<mapnik::path_expression_ptr>();
to_python_converter<mapnik::value_holder,mapnik_param_to_python>();
to_python_converter<mapnik::value,mapnik_value_to_python>();
to_python_converter<mapnik::enumeration_wrapper,mapnik_enumeration_wrapper_to_python>();
}