From 18c1a996042cf2282c151538a994556c693dd57b Mon Sep 17 00:00:00 2001 From: Jiri Drbalek Date: Mon, 17 Sep 2018 15:36:22 +0000 Subject: [PATCH] Polygon pattern on line geometries for AGG backend --- include/mapnik/agg/render_polygon_pattern.hpp | 156 ++++++++++++ .../renderer_common/pattern_alignment.hpp | 7 + include/mapnik/symbolizer.hpp | 4 +- include/mapnik/symbolizer_default_values.hpp | 7 + include/mapnik/symbolizer_enumerations.hpp | 8 + include/mapnik/symbolizer_keys.hpp | 1 + src/agg/process_line_pattern_symbolizer.cpp | 239 ++++++++++++------ .../process_polygon_pattern_symbolizer.cpp | 91 ++----- src/load_map.cpp | 7 + src/symbolizer_enumerations.cpp | 8 + src/symbolizer_keys.cpp | 3 + 11 files changed, 378 insertions(+), 153 deletions(-) create mode 100644 include/mapnik/agg/render_polygon_pattern.hpp diff --git a/include/mapnik/agg/render_polygon_pattern.hpp b/include/mapnik/agg/render_polygon_pattern.hpp new file mode 100644 index 000000000..38736d044 --- /dev/null +++ b/include/mapnik/agg/render_polygon_pattern.hpp @@ -0,0 +1,156 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2017 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_RENDER_POLYGON_PATTERN_HPP +#define MAPNIK_RENDER_POLYGON_PATTERN_HPP + +#include +#include +#include +#include +#include +#include + +#pragma GCC diagnostic push +#include +#include "agg_basics.h" +#include "agg_rendering_buffer.h" +#include "agg_pixfmt_rgba.h" +#include "agg_color_rgba.h" +#include "agg_rasterizer_scanline_aa.h" +#include "agg_scanline_u.h" +#include "agg_renderer_scanline.h" +#include "agg_span_allocator.h" +#include "agg_span_pattern_rgba.h" +#include "agg_image_accessors.h" +#include "agg_conv_clip_polygon.h" +#pragma GCC diagnostic pop + +namespace mapnik { + +struct agg_pattern_base +{ + image_rgba8 const& pattern_img_; + renderer_common const& common_; + symbolizer_base const& sym_; + mapnik::feature_impl const& feature_; + proj_transform const& prj_trans_; + + agg::trans_affine geom_transform() const + { + agg::trans_affine tr; + auto transform = get_optional(sym_, keys::geometry_transform); + if (transform) + { + evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_); + } + return tr; + } +}; + +template +struct agg_polygon_pattern : agg_pattern_base +{ + using color_type = agg::rgba8; + using order_type = agg::order_rgba; + using blender_type = agg::comp_op_adaptor_rgba_pre; + using pixfmt_type = agg::pixfmt_custom_blend_rgba; + using wrap_x_type = agg::wrap_mode_repeat; + using wrap_y_type = agg::wrap_mode_repeat; + using img_source_type = agg::image_accessor_wrap; + using span_gen_type = agg::span_pattern_rgba; + using renderer_base = agg::renderer_base; + using renderer_type = agg::renderer_scanline_aa_alpha, + span_gen_type>; + + agg_polygon_pattern(image_rgba8 const& pattern_img, + renderer_common const& common, + symbolizer_base const& sym, + mapnik::feature_impl const& feature, + proj_transform const& prj_trans) + : agg_pattern_base{pattern_img, common, sym, feature, prj_trans}, + clip_(get(sym_, feature_, common_.vars_)), + clip_box_(clipping_extent(common)), + tr_(geom_transform()), + converter_(clip_box_, sym, common.t_, prj_trans, tr_, + feature, common.vars_, common.scale_factor_) + { + value_double simplify_tolerance = get(sym_, feature_, common_.vars_); + value_double smooth = get(sym_, feature_, common_.vars_); + + if (simplify_tolerance > 0.0) converter_.template set(); + converter_.template set(); + if (smooth > 0.0) converter_.template set(); + } + + void render(renderer_base & ren_base, rasterizer & ras) + { + pattern_alignment_enum alignment = get( + sym_, feature_, common_.vars_); + unsigned offset_x=0; + unsigned offset_y=0; + + if (alignment == LOCAL_ALIGNMENT) + { + double x0 = 0; + double y0 = 0; + using apply_local_alignment = detail::apply_local_alignment; + apply_local_alignment apply(common_.t_, prj_trans_, clip_box_, x0, y0); + util::apply_visitor(geometry::vertex_processor(apply), feature_.get_geometry()); + + offset_x = unsigned(ren_base.width() - x0); + offset_y = unsigned(ren_base.height() - y0); + } + + agg::rendering_buffer pattern_rbuf((agg::int8u*)pattern_img_.bytes(), + pattern_img_.width(), pattern_img_.height(), + pattern_img_.width() * 4); + agg::pixfmt_rgba32_pre pixf_pattern(pattern_rbuf); + img_source_type img_src(pixf_pattern); + span_gen_type sg(img_src, offset_x, offset_y); + + agg::span_allocator sa; + value_double opacity = get(sym_, feature_, common_.vars_); + renderer_type rp(ren_base, sa, sg, unsigned(opacity * 255)); + + using apply_vertex_converter_type = detail::apply_vertex_converter< + VertexConverter, rasterizer>; + using vertex_processor_type = geometry::vertex_processor; + apply_vertex_converter_type apply(converter_, ras); + mapnik::util::apply_visitor(vertex_processor_type(apply), feature_.get_geometry()); + agg::scanline_u8 sl; + agg::render_scanlines(ras, sl, rp); + } + + const bool clip_; + const box2d clip_box_; + const agg::trans_affine tr_; + VertexConverter converter_; +}; + +} // namespace mapnik + + +#endif // MAPNIK_RENDER_POLYGON_PATTERN_HPP diff --git a/include/mapnik/renderer_common/pattern_alignment.hpp b/include/mapnik/renderer_common/pattern_alignment.hpp index 299f60d8b..db606ec55 100644 --- a/include/mapnik/renderer_common/pattern_alignment.hpp +++ b/include/mapnik/renderer_common/pattern_alignment.hpp @@ -25,6 +25,13 @@ #define MAPNIK_PATTERN_ALIGNMENT_HPP #include +#include +#include + +#pragma GCC diagnostic push +#include +#include "agg_conv_clip_polygon.h" +#pragma GCC diagnostic pop namespace mapnik { namespace detail { diff --git a/include/mapnik/symbolizer.hpp b/include/mapnik/symbolizer.hpp index a45608b78..1c9f7a23a 100644 --- a/include/mapnik/symbolizer.hpp +++ b/include/mapnik/symbolizer.hpp @@ -94,7 +94,8 @@ enum class property_types : std::uint8_t target_vertical_alignment, target_upright, target_direction, - target_font_feature_settings + target_font_feature_settings, + target_line_pattern, }; template @@ -189,6 +190,7 @@ ENUM_FROM_STRING( text_transform_enum ) ENUM_FROM_STRING( text_upright_enum ) ENUM_FROM_STRING( direction_enum ) ENUM_FROM_STRING( gamma_method_enum ) +ENUM_FROM_STRING( line_pattern_enum ) // enum template diff --git a/include/mapnik/symbolizer_default_values.hpp b/include/mapnik/symbolizer_default_values.hpp index 4341c1d4d..e19b2b67a 100644 --- a/include/mapnik/symbolizer_default_values.hpp +++ b/include/mapnik/symbolizer_default_values.hpp @@ -369,6 +369,13 @@ struct symbolizer_default // font-feature-settings +// line-pattern +template <> +struct symbolizer_default +{ + static line_pattern_enum value() { return LINE_PATTERN_WARP; } +}; + // extend template <> struct symbolizer_default diff --git a/include/mapnik/symbolizer_enumerations.hpp b/include/mapnik/symbolizer_enumerations.hpp index 9ed48cd03..53911ff9d 100644 --- a/include/mapnik/symbolizer_enumerations.hpp +++ b/include/mapnik/symbolizer_enumerations.hpp @@ -222,6 +222,14 @@ enum gamma_method_enum : std::uint8_t DEFINE_ENUM (gamma_method_e, gamma_method_enum ); +enum line_pattern_enum : std::uint8_t +{ + LINE_PATTERN_WARP, + LINE_PATTERN_REPEAT, + line_pattern_enum_MAX +}; + +DEFINE_ENUM (line_pattern_e, line_pattern_enum ); } diff --git a/include/mapnik/symbolizer_keys.hpp b/include/mapnik/symbolizer_keys.hpp index 83e18bc49..1822be827 100644 --- a/include/mapnik/symbolizer_keys.hpp +++ b/include/mapnik/symbolizer_keys.hpp @@ -93,6 +93,7 @@ enum class keys : std::uint8_t avoid_edges, ff_settings, extend, + line_pattern, MAX_SYMBOLIZER_KEY }; diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index 6a84c9ba1..005c95744 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -27,15 +27,15 @@ #include #include #include +#include #include #include #include -#include #include -#include #include #include #include +#include #include @@ -53,22 +53,139 @@ #include "agg_span_allocator.h" #include "agg_span_pattern_rgba.h" #include "agg_renderer_outline_image.h" +#include "agg_image_accessors.h" #pragma GCC diagnostic pop namespace mapnik { +namespace { + +template +using vertex_converter_type = vertex_converter; + +struct warp_pattern : agg_pattern_base +{ + using vc_type = vertex_converter_type<>; + using color_type = agg::rgba8; + using order_type = agg::order_rgba; + using blender_type = agg::comp_op_adaptor_rgba_pre; + using pattern_filter_type = agg::pattern_filter_bilinear_rgba8; + using pattern_type = agg::line_image_pattern; + using pixfmt_type = agg::pixfmt_custom_blend_rgba; + using renderer_base = agg::renderer_base; + using renderer_type = agg::renderer_outline_image; + using rasterizer_type = agg::rasterizer_outline_aa; + + warp_pattern(image_rgba8 const& pattern_img, + renderer_common const& common, + symbolizer_base const& sym, + mapnik::feature_impl const& feature, + proj_transform const& prj_trans) + : agg_pattern_base{pattern_img, common, sym, feature, prj_trans}, + clip_(get(sym, feature, common.vars_)), + offset_(get(sym, feature, common.vars_)), + clip_box_(clip_box()), + tr_(geom_transform()), + converter_(clip_box_, sym, common.t_, prj_trans, tr_, + feature, common.vars_, common.scale_factor_) + { + value_double simplify_tolerance = get(sym_, feature_, common_.vars_); + value_double smooth = get(sym_, feature_, common_.vars_); + + if (std::fabs(offset_) > 0.0) converter_.template set(); + if (simplify_tolerance > 0.0) converter_.template set(); + converter_.template set(); + if (smooth > 0.0) converter_.template set(); + } + + box2d clip_box() const + { + box2d clip_box = clipping_extent(common_); + if (clip_) + { + double pad_per_pixel = static_cast(common_.query_extent_.width() / common_.width_); + double pixels = std::ceil(std::max(pattern_img_.width() / 2.0 + std::fabs(offset_), + (std::fabs(offset_) * offset_converter_default_threshold))); + double padding = pad_per_pixel * pixels * common_.scale_factor_; + clip_box.pad(padding); + } + return clip_box; + } + + void render(renderer_base & ren_base, rasterizer &) + { + value_double opacity = get(sym_, feature_, common_.vars_); + agg::pattern_filter_bilinear_rgba8 filter; + pattern_source source(pattern_img_, opacity); + pattern_type pattern (filter, source); + renderer_type ren(ren_base, pattern); + double half_stroke = std::max(pattern_img_.width() / 2.0, pattern_img_.height() / 2.0); + int rast_clip_padding = static_cast(std::round(half_stroke)); + ren.clip_box(-rast_clip_padding, -rast_clip_padding, + common_.width_ + rast_clip_padding, + common_.height_ + rast_clip_padding); + rasterizer_type ras(ren); + + using apply_vertex_converter_type = detail::apply_vertex_converter< + vc_type, rasterizer_type>; + using vertex_processor_type = geometry::vertex_processor; + apply_vertex_converter_type apply(converter_, ras); + + util::apply_visitor(vertex_processor_type(apply), feature_.get_geometry()); + } + + const bool clip_; + const double offset_; + const box2d clip_box_; + const agg::trans_affine tr_; + vc_type converter_; +}; + +using repeat_pattern_base = agg_polygon_pattern>; +struct repeat_pattern : repeat_pattern_base +{ + using repeat_pattern_base::agg_polygon_pattern; + + void render(renderer_base & ren_base, rasterizer & ras) + { + if (has_key(sym_, keys::stroke_dasharray)) + { + converter_.set(); + } + + if (clip_) converter_.template set(); + + value_double offset = get(sym_, feature_, common_.vars_); + if (std::fabs(offset) > 0.0) converter_.template set(); + + // To allow lines cross themselves. + ras.filling_rule(agg::fill_non_zero); + + repeat_pattern_base::render(ren_base, ras); + } +}; + +} + template struct agg_renderer_process_visitor_l { - agg_renderer_process_visitor_l(renderer_common & common, + agg_renderer_process_visitor_l(renderer_common const& common, buffer_type & current_buffer, - std::unique_ptr const& ras_ptr, + rasterizer & ras, line_pattern_symbolizer const& sym, - mapnik::feature_impl & feature, + mapnik::feature_impl const& feature, proj_transform const& prj_trans) : common_(common), current_buffer_(current_buffer), - ras_ptr_(ras_ptr), + ras_(ras), sym_(sym), feature_(feature), prj_trans_(prj_trans) {} @@ -82,88 +199,57 @@ struct agg_renderer_process_visitor_l if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_); mapnik::box2d const& bbox_image = marker.get_data()->bounding_box() * image_tr; image_rgba8 image(bbox_image.width(), bbox_image.height()); - render_pattern(*ras_ptr_, marker, image_tr, 1.0, image); - render(image, marker.width(), marker.height()); + render_pattern(ras_, marker, image_tr, 1.0, image); + render_by_pattern_type(image); } void operator() (marker_rgba8 const& marker) const { - render(marker.get_data(), marker.width(), marker.height()); + render_by_pattern_type(marker.get_data()); } private: - void render(mapnik::image_rgba8 const& marker, double width, double height) const + void render_by_pattern_type(image_rgba8 const& pattern_image) const { - using col = agg::rgba8; - using order = agg::order_rgba; - using blender_type = agg::comp_op_adaptor_rgba_pre; - using pattern_filter_type = agg::pattern_filter_bilinear_rgba8; - using pattern_type = agg::line_image_pattern; - using pixfmt_type = agg::pixfmt_custom_blend_rgba; - using renderer_base = agg::renderer_base; - using renderer_type = agg::renderer_outline_image; - using rasterizer_type = agg::rasterizer_outline_aa; - - value_double opacity = get(sym_, feature_, common_.vars_); - value_bool clip = get(sym_, feature_, common_.vars_); - value_double offset = get(sym_, feature_, common_.vars_); - value_double simplify_tolerance = get(sym_, feature_, common_.vars_); - value_double smooth = get(sym_, feature_, common_.vars_); - - agg::rendering_buffer buf(current_buffer_.bytes(), current_buffer_.width(), - current_buffer_.height(), current_buffer_.row_size()); - pixfmt_type pixf(buf); - pixf.comp_op(static_cast(get(sym_, feature_, common_.vars_))); - renderer_base ren_base(pixf); - agg::pattern_filter_bilinear_rgba8 filter; - - pattern_source source(marker, opacity); - pattern_type pattern (filter,source); - renderer_type ren(ren_base, pattern); - double half_stroke = std::max(width / 2.0, height / 2.0); - int rast_clip_padding = static_cast(std::round(half_stroke)); - ren.clip_box(-rast_clip_padding,-rast_clip_padding,common_.width_+rast_clip_padding,common_.height_+rast_clip_padding); - rasterizer_type ras(ren); - - agg::trans_affine tr; - auto transform = get_optional(sym_, keys::geometry_transform); - if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_); - - box2d clip_box = clipping_extent(common_); - if (clip) + line_pattern_enum pattern = get(sym_, feature_, common_.vars_); + switch (pattern) { - double pad_per_pixel = static_cast(common_.query_extent_.width()/common_.width_); - double pixels = std::ceil(std::max(width / 2.0 + std::fabs(offset), - (std::fabs(offset) * offset_converter_default_threshold))); - double padding = pad_per_pixel * pixels * common_.scale_factor_; - - clip_box.pad(padding); + case LINE_PATTERN_WARP: + { + warp_pattern pattern(pattern_image, common_, sym_, feature_, prj_trans_); + render(pattern); + break; + } + case LINE_PATTERN_REPEAT: + { + repeat_pattern pattern(pattern_image, common_, sym_, feature_, prj_trans_); + render(pattern); + break; + } + case line_pattern_enum_MAX: + default: + MAPNIK_LOG_ERROR(process_line_pattern_symbolizer) << "Incorrect line-pattern value."; } - using vertex_converter_type = vertex_converter; - - vertex_converter_type converter(clip_box,sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); - - if (clip) converter.set(); - converter.set(); //always transform - if (simplify_tolerance > 0.0) converter.set(); // optional simplify converter - if (std::fabs(offset) > 0.0) converter.set(); // parallel offset - converter.set(); // optional affine transform - if (smooth > 0.0) converter.set(); // optional smooth converter - - using apply_vertex_converter_type = detail::apply_vertex_converter; - using vertex_processor_type = geometry::vertex_processor; - apply_vertex_converter_type apply(converter, ras); - mapnik::util::apply_visitor(vertex_processor_type(apply), feature_.get_geometry()); } - renderer_common & common_; + template + void render(Pattern & pattern) const + { + agg::rendering_buffer buf(current_buffer_.bytes(), current_buffer_.width(), + current_buffer_.height(), current_buffer_.row_size()); + typename Pattern::pixfmt_type pixf(buf); + pixf.comp_op(static_cast(get(sym_, feature_, common_.vars_))); + typename Pattern::renderer_base ren_base(pixf); + + if (pattern.clip_) pattern.converter_.template set(); + pattern.render(ren_base, ras_); + } + + renderer_common const& common_; buffer_type & current_buffer_; - std::unique_ptr const& ras_ptr_; + rasterizer & ras_; line_pattern_symbolizer const& sym_; - mapnik::feature_impl & feature_; + mapnik::feature_impl const& feature_; proj_transform const& prj_trans_; }; @@ -172,8 +258,6 @@ void agg_renderer::process(line_pattern_symbolizer const& sym, mapnik::feature_impl & feature, proj_transform const& prj_trans) { - - std::string filename = get(sym, feature, common_.vars_); if (filename.empty()) return; ras_ptr->reset(); @@ -183,10 +267,11 @@ void agg_renderer::process(line_pattern_symbolizer const& sym, gamma_method_ = GAMMA_POWER; gamma_ = 1.0; } + std::shared_ptr marker = marker_cache::instance().find(filename, true); agg_renderer_process_visitor_l visitor(common_, buffers_.top().get(), - ras_ptr, + *ras_ptr, sym, feature, prj_trans); diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index 118de1765..67e868c94 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -35,10 +36,7 @@ #include #include #include -#include #include -#include -#include #pragma GCC diagnostic push #include @@ -111,86 +109,30 @@ private: gamma_ = gamma; } - value_bool clip = get(sym_, feature_, common_.vars_); - value_double opacity = get(sym_, feature_, common_.vars_); - value_double simplify_tolerance = get(sym_, feature_, common_.vars_); - value_double smooth = get(sym_, feature_, common_.vars_); - - box2d clip_box = clipping_extent(common_); - - using col = agg::rgba8; - using order = agg::order_rgba; - using blender_type = agg::comp_op_adaptor_rgba_pre; - using pixfmt_type = agg::pixfmt_custom_blend_rgba; - - using wrap_x_type = agg::wrap_mode_repeat; - using wrap_y_type = agg::wrap_mode_repeat; - using img_source_type = agg::image_accessor_wrap; - - using span_gen_type = agg::span_pattern_rgba; - using ren_base = agg::renderer_base; - - using renderer_type = agg::renderer_scanline_aa_alpha, - span_gen_type>; - - pixfmt_type pixf(buf); - pixf.comp_op(static_cast(get(sym_, feature_, common_.vars_))); - ren_base renb(pixf); - - unsigned w = image.width(); - unsigned h = image.height(); - agg::rendering_buffer pattern_rbuf((agg::int8u*)image.bytes(),w,h,w*4); - agg::pixfmt_rgba32_pre pixf_pattern(pattern_rbuf); - img_source_type img_src(pixf_pattern); - - pattern_alignment_enum alignment = get(sym_, feature_, common_.vars_); - unsigned offset_x=0; - unsigned offset_y=0; - - if (alignment == LOCAL_ALIGNMENT) - { - double x0 = 0; - double y0 = 0; - using apply_local_alignment = detail::apply_local_alignment; - apply_local_alignment apply(common_.t_,prj_trans_, clip_box, x0, y0); - util::apply_visitor(geometry::vertex_processor(apply), feature_.get_geometry()); - - offset_x = unsigned(current_buffer_.width() - x0); - offset_y = unsigned(current_buffer_.height() - y0); - } - - span_gen_type sg(img_src, offset_x, offset_y); - - agg::span_allocator sa; - renderer_type rp(renb,sa, sg, unsigned(opacity * 255)); - - agg::trans_affine tr; - auto transform = get_optional(sym_, keys::geometry_transform); - if (transform) evaluate_transform(tr, feature_, common_.vars_, *transform, common_.scale_factor_); using vertex_converter_type = vertex_converter; + using pattern_type = agg_polygon_pattern; - vertex_converter_type converter(clip_box, sym_,common_.t_,prj_trans_,tr,feature_,common_.vars_,common_.scale_factor_); + pattern_type pattern(image, common_, sym_, feature_, prj_trans_); - if (prj_trans_.equal() && clip) converter.set(); - converter.set(); //always transform - converter.set(); // optional affine transform - if (simplify_tolerance > 0.0) converter.set(); // optional simplify converter - if (smooth > 0.0) converter.set(); // optional smooth converter + pattern_type::pixfmt_type pixf(buf); + pixf.comp_op(static_cast(get(sym_, feature_, common_.vars_))); + pattern_type::renderer_base renb(pixf); + + unsigned w = image.width(); + unsigned h = image.height(); + agg::rendering_buffer pattern_rbuf((agg::int8u*)image.bytes(),w,h,w*4); + agg::pixfmt_rgba32_pre pixf_pattern(pattern_rbuf); + pattern_type::img_source_type img_src(pixf_pattern); + + if (prj_trans_.equal() && pattern.clip_) pattern.converter_.set(); - using apply_vertex_converter_type = detail::apply_vertex_converter; - using vertex_processor_type = geometry::vertex_processor; - apply_vertex_converter_type apply(converter, *ras_ptr_); - mapnik::util::apply_visitor(vertex_processor_type(apply),feature_.get_geometry()); - agg::scanline_u8 sl; ras_ptr_->filling_rule(agg::fill_even_odd); - agg::render_scanlines(*ras_ptr_, sl, rp); + + pattern.render(renb, *ras_ptr_); } renderer_common & common_; @@ -220,7 +162,6 @@ void agg_renderer::process(polygon_pattern_symbolizer const& sym, feature, prj_trans); util::apply_visitor(visitor, *marker); - } diff --git a/src/load_map.cpp b/src/load_map.cpp index 9e5178560..1b94bb2da 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -1174,6 +1174,13 @@ void map_parser::parse_line_pattern_symbolizer(rule & rule, xml_node const & nod set_symbolizer_property(sym, keys::opacity, node); set_symbolizer_property(sym, keys::offset, node); set_symbolizer_property(sym, keys::image_transform, node); + set_symbolizer_property(sym, keys::stroke_miterlimit, node); + set_symbolizer_property(sym, keys::stroke_width, node); + set_symbolizer_property(sym, keys::stroke_linejoin, node); + set_symbolizer_property(sym, keys::stroke_linecap, node); + set_symbolizer_property(sym, keys::stroke_dasharray, node); + set_symbolizer_property(sym, keys::line_pattern, node); + set_symbolizer_property(sym, keys::alignment, node); rule.append(std::move(sym)); } catch (config_error const& ex) diff --git a/src/symbolizer_enumerations.cpp b/src/symbolizer_enumerations.cpp index c8f479375..1eee34b9c 100644 --- a/src/symbolizer_enumerations.cpp +++ b/src/symbolizer_enumerations.cpp @@ -207,4 +207,12 @@ static const char * gamma_method_strings[] = { IMPLEMENT_ENUM( gamma_method_e, gamma_method_strings ) +static const char * line_pattern_strings[] = { + "warp", + "repeat", + "" +}; + +IMPLEMENT_ENUM( line_pattern_e, line_pattern_strings ) + } // namespace mapnik diff --git a/src/symbolizer_keys.cpp b/src/symbolizer_keys.cpp index 64eeb64ca..748b70392 100644 --- a/src/symbolizer_keys.cpp +++ b/src/symbolizer_keys.cpp @@ -159,6 +159,9 @@ static const property_meta_type key_meta[const_max_key] = property_meta_type{ "avoid-edges",nullptr, property_types::target_bool }, property_meta_type{ "font-feature-settings", nullptr, property_types::target_font_feature_settings }, property_meta_type{ "extend", nullptr, property_types::target_double}, + property_meta_type{ "line-pattern", [](enumeration_wrapper e) + {return enumeration(line_pattern_enum(e.value)).as_string();}, + property_types::target_line_pattern}, };