+ directly ctor default mapnik::color to avoid css color parsing

This commit is contained in:
Artem Pavlenko 2010-03-24 18:02:10 +00:00
parent 1787c2b6ef
commit 5890f17df3

View file

@ -106,9 +106,11 @@ unsigned glyph_symbolizer::eval_size(Feature const& feature) const
color glyph_symbolizer::eval_color(Feature const& feature) const
{
raster_colorizer_ptr colorizer = get_colorizer();
if (colorizer) {
if (colorizer)
{
expression_ptr value_expr = get_value();
if (!value_expr) {
if (!value_expr)
{
throw config_error(
"Must define a 'value' expression to use a colorizer"
);
@ -121,9 +123,12 @@ color glyph_symbolizer::eval_color(Feature const& feature) const
std::clog << "value_result=" << value_result.to_string() << "\n";
#endif
return colorizer->get_color((float)value_result.to_double());
} else {
}
else
{
expression_ptr color_expr = get_color();
if (color_expr) {
if (color_expr)
{
value_type color_result = boost::apply_visitor(
evaluate<Feature,value_type>(feature),
*color_expr
@ -132,8 +137,10 @@ color glyph_symbolizer::eval_color(Feature const& feature) const
std::clog << "color_result=" << color_result.to_string() << "\n";
#endif
return color(color_result.to_string());
} else {
return color("black");
}
else
{
return color(0,0,0); // black
}
}
}