feature_generator - adapt to new geometry generator

This commit is contained in:
artemp 2015-03-04 09:23:57 +01:00
parent 920a9549c4
commit ec7f2f3f0c
3 changed files with 14 additions and 13 deletions

View file

@ -65,12 +65,12 @@ struct end_container<mapnik::feature_impl const>
template <>
struct transform_attribute<const boost::fusion::cons<mapnik::feature_impl const&, boost::fusion::nil>,
mapnik::geometry_container const& ,karma::domain>
mapnik::new_geometry::geometry const& , karma::domain>
{
using type = mapnik::geometry_container const&;
using type = mapnik::new_geometry::geometry const&;
static type pre(const boost::fusion::cons<mapnik::feature_impl const&, boost::fusion::nil>& f)
{
return boost::fusion::at<mpl::int_<0> >(f).paths();
return boost::fusion::at<mpl::int_<0> >(f).get_geometry();
}
};
@ -98,7 +98,7 @@ struct feature_generator_grammar :
{
feature_generator_grammar();
karma::rule<OutputIterator, FeatureType const&()> feature;
multi_geometry_generator_grammar<OutputIterator, mapnik::geometry_container> geometry;
geometry_generator_grammar<OutputIterator, mapnik::new_geometry::geometry> geometry;
properties_generator_grammar<OutputIterator, FeatureType> properties;
boost::phoenix::function<get_id<FeatureType> > id_;
};

View file

@ -29,14 +29,15 @@
namespace mapnik { namespace util {
inline bool to_geojson(std::string & json, mapnik::geometry_type const& geom)
inline bool to_geojson(std::string & json, mapnik::new_geometry::geometry const& geom)
{
using sink_type = std::back_insert_iterator<std::string>;
static const mapnik::json::geometry_generator_grammar<sink_type, mapnik::geometry_type> grammar;
static const mapnik::json::geometry_generator_grammar<sink_type, mapnik::new_geometry::geometry> grammar;
sink_type sink(json);
return boost::spirit::karma::generate(sink, grammar, geom);
return boost::spirit::karma::generate(sink, grammar, boost::phoenix::cref(geom));
}
/*
inline bool to_geojson(std::string & json, mapnik::geometry_container const& geom)
{
using sink_type = std::back_insert_iterator<std::string>;
@ -44,7 +45,7 @@ inline bool to_geojson(std::string & json, mapnik::geometry_container const& geo
sink_type sink(json);
return boost::spirit::karma::generate(sink, grammar, geom);
}
*/
}}
#endif // MAPNIK_GEOMETRY_TO_GEOJSON_HPP

View file

@ -22,14 +22,14 @@
#include <mapnik/geometry_impl.hpp>
//#include <mapnik/json/feature_generator_grammar_impl.hpp>
#include <mapnik/json/geometry_generator_grammar_impl.hpp>
//#include <mapnik/json/properties_generator_grammar_impl.hpp>
#include <mapnik/json/properties_generator_grammar_impl.hpp>
#include <mapnik/json/feature_generator_grammar_impl.hpp>
#include <string>
using sink_type = std::back_insert_iterator<std::string>;
//template struct mapnik::json::properties_generator_grammar<sink_type, mapnik::feature_impl>;
//template struct mapnik::json::feature_generator_grammar<sink_type, mapnik::feature_impl>;
template struct mapnik::json::properties_generator_grammar<sink_type, mapnik::feature_impl>;
template struct mapnik::json::feature_generator_grammar<sink_type, mapnik::feature_impl>;
template struct mapnik::json::geometry_generator_grammar<sink_type, mapnik::new_geometry::geometry>;
//template struct mapnik::json::multi_geometry_generator_grammar<sink_type, mapnik::geometry_container>;