From ca96d3e137b49ce613dcbe61d6a3eafc9cf5d82a Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 17 Nov 2016 10:33:05 +0100 Subject: [PATCH] fix duplicate feature to geojson code --- include/mapnik/util/feature_to_geojson.hpp | 21 +++++++------------ .../json/mapnik_feature_to_geojson.cpp | 13 ++++-------- 2 files changed, 12 insertions(+), 22 deletions(-) rename include/mapnik/json/feature_generator.hpp => src/json/mapnik_feature_to_geojson.cpp (81%) diff --git a/include/mapnik/util/feature_to_geojson.hpp b/include/mapnik/util/feature_to_geojson.hpp index ad3c0a7d4..b6e5797c4 100644 --- a/include/mapnik/util/feature_to_geojson.hpp +++ b/include/mapnik/util/feature_to_geojson.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2016 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,23 +20,18 @@ * *****************************************************************************/ -#ifndef MAPNIK_FEATURE_TO_GEOJSON_HPP -#define MAPNIK_FEATURE_TO_GEOJSON_HPP +#ifndef MAPNIK_UTIL_FEATURE_TO_GEOJSON_HPP +#define MAPNIK_UTIL_FEATURE_TO_GEOJSON_HPP // mapnik - -#include +#include +// stl +#include namespace mapnik { namespace util { -inline bool to_geojson(std::string & json, mapnik::feature_impl const& feat) -{ - using sink_type = std::back_insert_iterator; - static const mapnik::json::feature_generator_grammar grammar; - sink_type sink(json); - return boost::spirit::karma::generate(sink, grammar, feat); -} +bool to_geojson(std::string & json, mapnik::feature_impl const& feat); }} -#endif // MAPNIK_FEATURE_TO_GEOJSON_HPP +#endif // MAPNIK_UTIL_FEATURE_TO_GEOJSON_HPP diff --git a/include/mapnik/json/feature_generator.hpp b/src/json/mapnik_feature_to_geojson.cpp similarity index 81% rename from include/mapnik/json/feature_generator.hpp rename to src/json/mapnik_feature_to_geojson.cpp index f24df4ed8..3532fea97 100644 --- a/include/mapnik/json/feature_generator.hpp +++ b/src/json/mapnik_feature_to_geojson.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2015 Artem Pavlenko + * Copyright (C) 2016 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,19 +20,16 @@ * *****************************************************************************/ -#ifndef MAPNIK_JSON_FEATURE_GENERATOR_HPP -#define MAPNIK_JSON_FEATURE_GENERATOR_HPP - // mapnik -#include +#include #include // boost #include -namespace mapnik { namespace json { +namespace mapnik { namespace util { -inline bool to_geojson(std::string & json, mapnik::feature_impl const& feature) +bool to_geojson(std::string & json, mapnik::feature_impl const& feature) { using sink_type = std::back_insert_iterator; static const mapnik::json::feature_generator_grammar grammar; @@ -41,5 +38,3 @@ inline bool to_geojson(std::string & json, mapnik::feature_impl const& feature) } }} - -#endif // MAPNIK_JSON_FEATURE_GENERATOR_HPP