diff --git a/include/mapnik/json/symbolizer_grammar.hpp b/include/mapnik/json/symbolizer_grammar.hpp index 040d6e1c3..89a0cf25f 100644 --- a/include/mapnik/json/symbolizer_grammar.hpp +++ b/include/mapnik/json/symbolizer_grammar.hpp @@ -30,6 +30,7 @@ // mapnik #include +#include #include namespace mapnik { namespace json { @@ -63,8 +64,7 @@ struct json_value_visitor : boost::static_visitor<> void operator() (std::string const& val) const { - std::cerr << std::get<0>(get_meta(key_)) << ":" << val << std::endl; - put(sym_, key_, val); + set_property(sym_, key_, val); } template diff --git a/include/mapnik/symbolizer_utils.hpp b/include/mapnik/symbolizer_utils.hpp index 4ec6c69e6..5d57431cd 100644 --- a/include/mapnik/symbolizer_utils.hpp +++ b/include/mapnik/symbolizer_utils.hpp @@ -24,9 +24,10 @@ #define MAPNIK_SYMBOLIZER_UTILS_HPP // mapnik -#include -#include #include +#include +#include +#include // boost #include @@ -180,7 +181,7 @@ public: std::ostringstream ss; if (expr) { - ss << '\"' << mapnik::to_expression_string(*expr) << '\"'; + ss << '\"' << "FIXME" /*mapnik::to_expression_string(*expr)*/ << '\"'; } return ss.str(); } @@ -239,6 +240,67 @@ struct symbolizer_to_json : public boost::static_visitor } }; +namespace { + +template +struct set_property_impl +{ + static void apply(Symbolizer & sym, mapnik::keys key, std::string const& val) + { + std::cerr << "do nothing" << std::endl; + } +}; + +template +struct set_property_impl > +{ + static void apply(Symbolizer & sym, mapnik::keys key, std::string const& val) + { + put(sym, key, mapnik::parse_color(val)); + } +}; + +template +struct set_property_impl > +{ + static void apply(Symbolizer & sym, mapnik::keys key, std::string const& val) + { + std::cerr << " expects double" << std::endl; + } +}; + +template +struct set_property_impl > +{ + static void apply(Symbolizer & sym, mapnik::keys key, std::string const& val) + { + std::cerr << " expects bool" << std::endl; + } +}; + +} + +template +inline void set_property(Symbolizer & sym, mapnik::keys key, T const& val) +{ + switch (std::get<3>(get_meta(key))) + { + case property_types::target_bool: + set_property_impl >::apply(sym,key,val); + break; + case property_types::target_integer: + set_property_impl >::apply(sym,key,val); + break; + case property_types::target_double: + set_property_impl >::apply(sym,key,val); + break; + case property_types::target_color: + set_property_impl >::apply(sym,key,val); + break; + default: + break; + } +} }