Export the to_wkt functions to avoid python bindings access the internal structs.

This commit is contained in:
XinGang Li 2013-02-18 23:18:22 +08:00
parent df7db521bb
commit 7f1e416313
2 changed files with 21 additions and 23 deletions

View file

@ -24,34 +24,14 @@
#define MAPNIK_GEOMETRY_TO_WKT_HPP #define MAPNIK_GEOMETRY_TO_WKT_HPP
// mapnik // mapnik
#include <mapnik/global.hpp> #include <mapnik/config.hpp>
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/util/geometry_wkt_generator.hpp>
// boost
#include <boost/spirit/include/karma.hpp>
namespace mapnik { namespace util { namespace mapnik { namespace util {
namespace karma = boost::spirit::karma; MAPNIK_DECL bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom);
bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom) MAPNIK_DECL bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom);
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_generator<sink_type, mapnik::geometry_type> generator(true);
bool result = karma::generate(sink, generator, geom);
return result;
}
bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom)
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_multi_generator<sink_type, mapnik::geometry_container> generator;
bool result = karma::generate(sink, generator, geom);
return result;
}
}} }}

View file

@ -26,6 +26,7 @@
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>
#include <mapnik/util/geometry_wkt_generator.hpp> #include <mapnik/util/geometry_wkt_generator.hpp>
#include <mapnik/util/geometry_to_wkt.hpp>
#include <mapnik/util/path_iterator.hpp> #include <mapnik/util/path_iterator.hpp>
#include <mapnik/util/container_adapter.hpp> #include <mapnik/util/container_adapter.hpp>
@ -156,6 +157,23 @@ wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator()
template struct mapnik::util::wkt_generator<std::back_insert_iterator<std::string>, mapnik::geometry_type>; template struct mapnik::util::wkt_generator<std::back_insert_iterator<std::string>, mapnik::geometry_type>;
template struct mapnik::util::wkt_multi_generator<std::back_insert_iterator<std::string>, mapnik::geometry_container >; template struct mapnik::util::wkt_multi_generator<std::back_insert_iterator<std::string>, mapnik::geometry_container >;
bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom)
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_generator<sink_type, mapnik::geometry_type> generator(true);
bool result = karma::generate(sink, generator, geom);
return result;
}
bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom)
{
typedef std::back_insert_iterator<std::string> sink_type;
sink_type sink(wkt);
wkt_multi_generator<sink_type, mapnik::geometry_container> generator;
bool result = karma::generate(sink, generator, geom);
return result;
}
}} }}