symbolizer properties : image_transform, cleanups
This commit is contained in:
parent
6034837c95
commit
ab3aad38ad
3 changed files with 33 additions and 47 deletions
|
@ -316,6 +316,7 @@ ENUM_FROM_STRING( marker_placement_enum )
|
|||
ENUM_FROM_STRING( gamma_method_enum )
|
||||
ENUM_FROM_STRING( line_rasterizer_enum )
|
||||
ENUM_FROM_STRING( marker_multi_policy_enum )
|
||||
ENUM_FROM_STRING( halo_rasterizer_enum )
|
||||
// enum
|
||||
template <typename T, bool is_enum = true>
|
||||
struct expression_result
|
||||
|
|
|
@ -976,11 +976,7 @@ void map_parser::parse_point_symbolizer(rule & rule, xml_node const & node)
|
|||
std::string filename = *file;
|
||||
ensure_exists(filename);
|
||||
put(sym, keys::file, parse_path(filename));
|
||||
|
||||
if (image_transform_wkt)
|
||||
{
|
||||
put(sym, keys::image_transform, mapnik::parse_transform(*image_transform_wkt));
|
||||
}
|
||||
set_symbolizer_property<symbolizer_base, transform_type>(sym, keys::image_transform, node);
|
||||
}
|
||||
parse_symbolizer_base(sym, node);
|
||||
rule.append(std::move(sym));
|
||||
|
@ -1046,13 +1042,8 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& node)
|
|||
set_symbolizer_property<markers_symbolizer,double>(sym, keys::opacity, node);
|
||||
// fill opacity
|
||||
set_symbolizer_property<markers_symbolizer,double>(sym, keys::fill_opacity, node);
|
||||
|
||||
optional<std::string> image_transform_wkt = node.get_opt_attr<std::string>("transform");
|
||||
if (image_transform_wkt)
|
||||
{
|
||||
put(sym, keys::image_transform, mapnik::parse_transform(*image_transform_wkt));
|
||||
}
|
||||
|
||||
// transform
|
||||
set_symbolizer_property<symbolizer_base, transform_type>(sym, keys::image_transform, node);
|
||||
// fill
|
||||
set_symbolizer_property<markers_symbolizer,color>(sym, keys::fill, node);
|
||||
// spacing
|
||||
|
@ -1205,22 +1196,17 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& node)
|
|||
{
|
||||
ensure_font_face(placement_finder->defaults.format->face_name);
|
||||
}
|
||||
text_symbolizer text_symbol;
|
||||
parse_symbolizer_base(text_symbol, node);
|
||||
text_symbolizer sym;
|
||||
parse_symbolizer_base(sym, node);
|
||||
// placement finder
|
||||
put<text_placements_ptr>(sym, keys::text_placements_, placement_finder);
|
||||
// halo-comp-op
|
||||
set_symbolizer_property<symbolizer_base,composite_mode_e>(text_symbol, keys::halo_comp_op, node);
|
||||
|
||||
put<text_placements_ptr>(text_symbol, keys::text_placements_, placement_finder);
|
||||
optional<halo_rasterizer_e> halo_rasterizer_ = node.get_opt_attr<halo_rasterizer_e>("halo-rasterizer");
|
||||
if (halo_rasterizer_) put(text_symbol, keys::halo_rasterizer, halo_rasterizer_enum(*halo_rasterizer_));
|
||||
|
||||
optional<std::string> halo_transform_wkt = node.get_opt_attr<std::string>("halo-transform");
|
||||
if (halo_transform_wkt)
|
||||
{
|
||||
put(text_symbol, keys::halo_transform, mapnik::parse_transform(*halo_transform_wkt));
|
||||
}
|
||||
|
||||
rule.append(std::move(text_symbol));
|
||||
set_symbolizer_property<text_symbolizer,composite_mode_e>(sym, keys::halo_comp_op, node);
|
||||
// halo-rasterizer
|
||||
set_symbolizer_property<text_symbolizer, halo_rasterizer_enum>(sym, keys::halo_rasterizer, node);
|
||||
// halo-transform
|
||||
set_symbolizer_property<text_symbolizer, transform_type>(sym, keys::halo_transform, node);
|
||||
rule.append(std::move(sym));
|
||||
}
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
|
@ -1248,30 +1234,29 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& node)
|
|||
ensure_font_face(placement_finder->defaults.format->face_name);
|
||||
}
|
||||
|
||||
shield_symbolizer shield_symbol;
|
||||
put<text_placements_ptr>(shield_symbol, keys::text_placements_, placement_finder);
|
||||
optional<std::string> image_transform_wkt = node.get_opt_attr<std::string>("transform");
|
||||
if (image_transform_wkt)
|
||||
{
|
||||
put(shield_symbol, keys::image_transform, mapnik::parse_transform(*image_transform_wkt));
|
||||
}
|
||||
shield_symbolizer sym;
|
||||
put<text_placements_ptr>(sym, keys::text_placements_, placement_finder);
|
||||
// transform
|
||||
set_symbolizer_property<symbolizer_base, transform_type>(sym, keys::image_transform, node);
|
||||
// shield displacements: shield-dx shield-dy
|
||||
set_symbolizer_property<symbolizer_base, double>(sym, keys::shield_dx, node);
|
||||
set_symbolizer_property<symbolizer_base, double>(sym, keys::shield_dy, node);
|
||||
|
||||
// shield displacement
|
||||
optional<double> shield_dx = node.get_opt_attr<double>("shield-dx");
|
||||
if (shield_dx) put(shield_symbol, keys::shield_dx, *shield_dx);
|
||||
//optional<double> shield_dx = node.get_opt_attr<double>("shield-dx");
|
||||
//if (shield_dx) put(shield_symbol, keys::shield_dx, *shield_dx);
|
||||
|
||||
optional<double> shield_dy = node.get_opt_attr<double>("shield-dy");
|
||||
if (shield_dy) put(shield_symbol, keys::shield_dy, *shield_dy);
|
||||
//optional<double> shield_dy = node.get_opt_attr<double>("shield-dy");
|
||||
//if (shield_dy) put(shield_symbol, keys::shield_dy, *shield_dy);
|
||||
|
||||
// opacity
|
||||
set_symbolizer_property<shield_symbolizer,double>(shield_symbol, keys::opacity, node);
|
||||
set_symbolizer_property<shield_symbolizer,double>(sym, keys::opacity, node);
|
||||
|
||||
// text-opacity
|
||||
set_symbolizer_property<shield_symbolizer,double>(shield_symbol, keys::text_opacity, node);
|
||||
set_symbolizer_property<shield_symbolizer,double>(sym, keys::text_opacity, node);
|
||||
|
||||
// unlock_image
|
||||
optional<boolean> unlock_image = node.get_opt_attr<boolean>("unlock-image");
|
||||
if (unlock_image) put(shield_symbol, keys::unlock_image, *unlock_image);
|
||||
if (unlock_image) put(sym, keys::unlock_image, *unlock_image);
|
||||
|
||||
std::string file = node.get_attr<std::string>("file");
|
||||
if (file.empty())
|
||||
|
@ -1302,11 +1287,11 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& node)
|
|||
|
||||
file = ensure_relative_to_xml(file);
|
||||
ensure_exists(file);
|
||||
put(shield_symbol, keys::file , parse_path(file));
|
||||
parse_symbolizer_base(shield_symbol, node);
|
||||
put(sym, keys::file , parse_path(file));
|
||||
parse_symbolizer_base(sym, node);
|
||||
optional<halo_rasterizer_e> halo_rasterizer_ = node.get_opt_attr<halo_rasterizer_e>("halo-rasterizer");
|
||||
if (halo_rasterizer_) put(shield_symbol, keys::halo_rasterizer, halo_rasterizer_enum(*halo_rasterizer_));
|
||||
rule.append(std::move(shield_symbol));
|
||||
if (halo_rasterizer_) put(sym, keys::halo_rasterizer, halo_rasterizer_enum(*halo_rasterizer_));
|
||||
rule.append(std::move(sym));
|
||||
}
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ static const property_meta_type key_meta[to_integral(keys::MAX_SYMBOLIZER_KEY)]
|
|||
[](enumeration_wrapper e) { return *simplify_algorithm_to_string(simplify_algorithm_e(e.value));}, property_types::target_simplify_algorithm },
|
||||
property_meta_type{ "simplify-tolerance", 0.0, nullptr, property_types::target_double },
|
||||
property_meta_type{ "halo-rasterizer", enumeration_wrapper(HALO_RASTERIZER_FULL),
|
||||
[](enumeration_wrapper e) { return enumeration<halo_rasterizer_enum,halo_rasterizer_enum_MAX>(halo_rasterizer_enum(e.value)).as_string();}, property_types::target_double },
|
||||
[](enumeration_wrapper e) { return enumeration<halo_rasterizer_enum,halo_rasterizer_enum_MAX>(halo_rasterizer_enum(e.value)).as_string();}, property_types::target_halo_rasterizer },
|
||||
property_meta_type{ "text-placements", false, nullptr, property_types::target_double },
|
||||
property_meta_type{ "placement", enumeration_wrapper(MARKER_POINT_PLACEMENT),
|
||||
[](enumeration_wrapper e) { return enumeration<marker_placement_enum,marker_placement_enum_MAX>(marker_placement_enum(e.value)).as_string();}, property_types::target_markers_placement }, // FIXME - rename to "markers-placement-type"
|
||||
|
|
Loading…
Reference in a new issue