Revive Symbolizer to json functionality

This commit is contained in:
Artem Pavlenko 2024-05-15 10:24:27 +01:00
parent 454837070d
commit 1283ca5b77

View file

@ -30,6 +30,7 @@
#include <mapnik/parse_path.hpp> #include <mapnik/parse_path.hpp>
#include <mapnik/color.hpp> #include <mapnik/color.hpp>
#include <mapnik/expression.hpp> #include <mapnik/expression.hpp>
#include <mapnik/expression_string.hpp>
#include <mapnik/color_factory.hpp> #include <mapnik/color_factory.hpp>
#include <mapnik/symbolizer.hpp> #include <mapnik/symbolizer.hpp>
#include <mapnik/xml_tree.hpp> #include <mapnik/xml_tree.hpp>
@ -146,9 +147,6 @@ inline std::string symbolizer_name(symbolizer const& sym)
return type; return type;
} }
// https://github.com/mapnik/mapnik/issues/2324
/*
template <typename Meta> template <typename Meta>
class symbolizer_property_value_string class symbolizer_property_value_string
{ {
@ -162,7 +160,7 @@ public:
auto const& convert_fun_ptr(std::get<1>(meta_)); auto const& convert_fun_ptr(std::get<1>(meta_));
if ( convert_fun_ptr ) if ( convert_fun_ptr )
{ {
ss << convert_fun_ptr(e); ss << '\"' << convert_fun_ptr(e) << '\"';
} }
return ss.str(); return ss.str();
} }
@ -202,7 +200,7 @@ public:
std::ostringstream ss; std::ostringstream ss;
if (expr) if (expr)
{ {
ss << '\"' << "FIXME" << '\"'; ss << '\"' << mapnik::to_expression_string(*expr) << '\"';
} }
return ss.str(); return ss.str();
} }
@ -219,7 +217,7 @@ public:
std::ostringstream ss; std::ostringstream ss;
for (std::size_t i = 0; i < dash.size(); ++i) for (std::size_t i = 0; i < dash.size(); ++i)
{ {
ss << dash[i].first << ", " << dash[i].second; ss << dash[i].first << "," << dash[i].second;
if ( i + 1 < dash.size() ) ss << ','; if ( i + 1 < dash.size() ) ss << ',';
} }
return ss.str(); return ss.str();
@ -229,7 +227,7 @@ public:
std::string operator () ( T const& val ) const std::string operator () ( T const& val ) const
{ {
std::ostringstream ss; std::ostringstream ss;
ss << val; ss << '\"' << val << '\"';
return ss.str(); return ss.str();
} }
@ -261,8 +259,6 @@ struct symbolizer_to_json
} }
}; };
*/
namespace { namespace {
template<typename Symbolizer, typename T> template<typename Symbolizer, typename T>