back compatibility for raster-mode values using _ and shield-no-text

This commit is contained in:
Dane Springmeyer 2012-08-16 19:20:29 -07:00
parent 62e039d2c9
commit ad2250a4b5
3 changed files with 22 additions and 67 deletions

View file

@ -275,71 +275,6 @@ void write_features(T const& grid_type,
feature_data[feat_itr->first] = feat;
}
}
/* std::string const& key = grid_type.get_key();
std::set<std::string> const& attributes = grid_type.property_names();
typename T::feature_type::const_iterator feat_itr = g_features.begin();
typename T::feature_type::const_iterator feat_end = g_features.end();
bool include_key = (attributes.find(key) != attributes.end());
for (; feat_itr != feat_end; ++feat_itr)
{
mapnik::feature_ptr feature = feat_itr->second;
boost::optional<std::string> join_value;
if (key == grid_type.key_name())
{
join_value = feat_itr->first;
}
else if (feature->has_key(key))
{
join_value = feature->get(key).to_string();
}
if (join_value)
{
// only serialize features visible in the grid
if(std::find(key_order.begin(), key_order.end(), *join_value) != key_order.end()) {
boost::python::dict feat;
bool found = false;
if (key == grid_type.key_name())
{
// drop key unless requested
if (include_key) {
found = true;
//TODO - add __id__ as data key?
//feat[key] = *join_value;
}
}
feature_kv_iterator itr = feature->begin();
feature_kv_iterator end = feature->end();
for ( ;itr!=end; ++itr)
{
std::string const& key_name = boost::get<0>(*itr);
if (key_name == key) {
// drop key unless requested
if (include_key) {
found = true;
feat[key_name] = boost::get<1>(*itr);
}
}
else if ( (attributes.find(key_name) != attributes.end()) )
{
found = true;
feat[key_name] = boost::get<1>(*itr);
}
}
if (found)
{
feature_data[feat_itr->first] = feat;
}
}
}
else
{
MAPNIK_LOG_DEBUG(bindings) << "write_features: Should not get here: key " << key << " not found in grid feature properties";
}
}
*/
}
template <typename T>

View file

@ -1242,6 +1242,17 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym)
}
}
// no_text - removed property in 2.1.x that used to have a purpose
// before you could provide an expression with an empty string
optional<boolean> no_text =
sym.get_opt_attr<boolean>("no-text");
if (no_text)
{
MAPNIK_LOG_ERROR(raster_symbolizer) << "'no-text' is deprecated and will be removed in Mapnik 3.x, to create a ShieldSymbolizer without text just provide an element like: \"<ShieldSymbolizer ... />' '</>\"";
if (*no_text)
shield_symbol.set_name(parse_expression("' '"));
}
file = ensure_relative_to_xml(file);
path_expression_ptr expr(boost::make_shared<path_expression>());
if (!parse_path_from_string(expr, file, sym.get_tree().path_expr_grammar))
@ -1431,7 +1442,16 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & sym)
// mode
optional<std::string> mode = sym.get_opt_attr<std::string>("mode");
if (mode) raster_sym.set_mode(*mode);
if (mode)
{
std::string mode_string = *mode;
if (boost::algorithm::find_first(mode_string,"_"))
{
MAPNIK_LOG_ERROR(raster_symbolizer) << "'mode' values using \"_\" are deprecated and will be removed in Mapnik 3.x, use \"-\"instead";
boost::algorithm::replace_all(mode_string,"_","-");
}
raster_sym.set_mode(mode_string);
}
// scaling
optional<std::string> scaling = sym.get_opt_attr<std::string>("scaling");

View file

@ -4,7 +4,7 @@
<Style name="white">
<Rule>
<RasterSymbolizer opacity="1" scaling="bilinear" />
<RasterSymbolizer opacity="1" scaling="bilinear" mode="grain_merge"/>
</Rule>
</Style>
<Layer name="white"