text-properties : make fill and halo-fill expressions
This commit is contained in:
parent
f8ccbf3ded
commit
1927a00ee0
3 changed files with 15 additions and 31 deletions
|
@ -76,13 +76,12 @@ struct MAPNIK_DECL format_properties
|
||||||
symbolizer_base::value_type halo_opacity;
|
symbolizer_base::value_type halo_opacity;
|
||||||
symbolizer_base::value_type wrap_char;
|
symbolizer_base::value_type wrap_char;
|
||||||
symbolizer_base::value_type halo_radius;
|
symbolizer_base::value_type halo_radius;
|
||||||
|
symbolizer_base::value_type fill;
|
||||||
|
symbolizer_base::value_type halo_fill;
|
||||||
//
|
//
|
||||||
std::string face_name;
|
std::string face_name;
|
||||||
boost::optional<font_set> fontset;
|
boost::optional<font_set> fontset;
|
||||||
text_transform_e text_transform; //Per expression
|
text_transform_e text_transform; //Per expression
|
||||||
color fill;
|
|
||||||
color halo_fill;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ struct MAPNIK_DECL text_layout_properties
|
||||||
// This function is used to collect attributes.
|
// This function is used to collect attributes.
|
||||||
void add_expressions(expression_set & output) const;
|
void add_expressions(expression_set & output) const;
|
||||||
|
|
||||||
//Per layout options
|
// per layout expressions
|
||||||
symbolizer_base::value_type dx;
|
symbolizer_base::value_type dx;
|
||||||
symbolizer_base::value_type dy;
|
symbolizer_base::value_type dy;
|
||||||
symbolizer_base::value_type orientation;
|
symbolizer_base::value_type orientation;
|
||||||
|
|
|
@ -1226,8 +1226,7 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& node)
|
||||||
placements->defaults.from_xml(node, fontsets_);
|
placements->defaults.from_xml(node, fontsets_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strict_ &&
|
if (strict_ && !placements->defaults.format_defaults.fontset)
|
||||||
!placements->defaults.format_defaults.fontset)
|
|
||||||
{
|
{
|
||||||
ensure_font_face(placements->defaults.format_defaults.face_name);
|
ensure_font_face(placements->defaults.format_defaults.face_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,16 +72,15 @@ void text_symbolizer_properties::process(text_layout & output, feature_impl cons
|
||||||
format->halo_radius = boost::apply_visitor(extract_value<value_double>(feature,attrs), format_defaults.halo_radius);
|
format->halo_radius = boost::apply_visitor(extract_value<value_double>(feature,attrs), format_defaults.halo_radius);
|
||||||
|
|
||||||
std::string const& wrap_char = boost::apply_visitor(extract_value<std::string>(feature,attrs), format_defaults.wrap_char);
|
std::string const& wrap_char = boost::apply_visitor(extract_value<std::string>(feature,attrs), format_defaults.wrap_char);
|
||||||
if (!wrap_char.empty())
|
if (!wrap_char.empty()) format->wrap_char = wrap_char[0];
|
||||||
{
|
|
||||||
format->wrap_char = wrap_char[0];
|
format->fill = boost::apply_visitor(extract_value<color>(feature,attrs), format_defaults.fill);
|
||||||
}
|
format->halo_fill = boost::apply_visitor(extract_value<color>(feature,attrs), format_defaults.halo_fill);
|
||||||
|
|
||||||
format->face_name = format_defaults.face_name;
|
format->face_name = format_defaults.face_name;
|
||||||
format->fontset = format_defaults.fontset;
|
format->fontset = format_defaults.fontset;
|
||||||
format->text_transform = format_defaults.text_transform;
|
format->text_transform = format_defaults.text_transform;
|
||||||
format->fill = format_defaults.fill;
|
|
||||||
format->halo_fill = format_defaults.halo_fill;
|
|
||||||
|
|
||||||
tree_->apply(format, feature, attrs, output);
|
tree_->apply(format, feature, attrs, output);
|
||||||
}
|
}
|
||||||
|
@ -293,20 +292,15 @@ void format_properties::from_xml(xml_node const& node, fontset_map const& fontse
|
||||||
set_property_from_xml<double>(text_opacity, "opacity", node);
|
set_property_from_xml<double>(text_opacity, "opacity", node);
|
||||||
set_property_from_xml<double>(halo_opacity, "halo-opacity", node);
|
set_property_from_xml<double>(halo_opacity, "halo-opacity", node);
|
||||||
set_property_from_xml<std::string>(wrap_char, "wrap-character", node);
|
set_property_from_xml<std::string>(wrap_char, "wrap-character", node);
|
||||||
|
set_property_from_xml<color>(fill, "fill", node);
|
||||||
optional<color> fill_ = node.get_opt_attr<color>("fill");
|
set_property_from_xml<color>(halo_fill, "halo-fill", node);
|
||||||
if (fill_) fill = *fill_;
|
|
||||||
optional<color> halo_fill_ = node.get_opt_attr<color>("halo-fill");
|
|
||||||
if (halo_fill_) halo_fill = *halo_fill_;
|
|
||||||
|
|
||||||
optional<text_transform_e> tconvert_ = node.get_opt_attr<text_transform_e>("text-transform");
|
optional<text_transform_e> tconvert_ = node.get_opt_attr<text_transform_e>("text-transform");
|
||||||
if (tconvert_) text_transform = *tconvert_;
|
if (tconvert_) text_transform = *tconvert_;
|
||||||
|
|
||||||
optional<std::string> face_name_ = node.get_opt_attr<std::string>("face-name");
|
optional<std::string> face_name_ = node.get_opt_attr<std::string>("face-name");
|
||||||
if (face_name_)
|
if (face_name_) face_name = *face_name_;
|
||||||
{
|
|
||||||
face_name = *face_name_;
|
|
||||||
}
|
|
||||||
optional<std::string> fontset_name_ = node.get_opt_attr<std::string>("fontset-name");
|
optional<std::string> fontset_name_ = node.get_opt_attr<std::string>("fontset-name");
|
||||||
if (fontset_name_)
|
if (fontset_name_)
|
||||||
{
|
{
|
||||||
|
@ -352,16 +346,8 @@ void format_properties::to_xml(boost::property_tree::ptree & node, bool explicit
|
||||||
if (!(text_opacity == dfl.text_opacity) || explicit_defaults) serialize_property("opacity", text_opacity, node);
|
if (!(text_opacity == dfl.text_opacity) || explicit_defaults) serialize_property("opacity", text_opacity, node);
|
||||||
if (!(halo_opacity == dfl.halo_opacity) || explicit_defaults) serialize_property("halo-opacity", halo_opacity, node);
|
if (!(halo_opacity == dfl.halo_opacity) || explicit_defaults) serialize_property("halo-opacity", halo_opacity, node);
|
||||||
//
|
//
|
||||||
|
if (!(fill == dfl.fill) || explicit_defaults) serialize_property("fill", fill, node);
|
||||||
if (fill != dfl.fill || explicit_defaults)
|
if (!(halo_fill == dfl.halo_fill) || explicit_defaults) serialize_property("halo-fill", halo_fill, node);
|
||||||
{
|
|
||||||
set_attr(node, "fill", fill);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (halo_fill != dfl.halo_fill || explicit_defaults)
|
|
||||||
{
|
|
||||||
set_attr(node, "halo-fill", halo_fill);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (text_transform != dfl.text_transform || explicit_defaults)
|
if (text_transform != dfl.text_transform || explicit_defaults)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue