Merge branch 'master' into release/image_data_any

This commit is contained in:
Blake Thompson 2015-01-16 13:09:25 -06:00
commit 35be6117c8
38 changed files with 1146 additions and 396 deletions

View file

@ -0,0 +1,148 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2014 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
*
*****************************************************************************/
#include <mapnik/color.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_converter.hpp>
#include <mapnik/vertex_converters.hpp>
#include <mapnik/box2d.hpp>
// agg
#include "agg_color_rgba.h"
#include "agg_renderer_base.h"
#include "agg_renderer_scanline.h"
#include "agg_rendering_buffer.h"
#include "agg_scanline_u.h"
#include "agg_image_filters.h"
#include "agg_trans_affine.h"
#include "agg_span_allocator.h"
#include "agg_image_accessors.h"
#include "agg_pixfmt_rgba.h"
#include "agg_span_image_filter_rgba.h"
#include "agg_span_interpolator_linear.h"
namespace mapnik {
template <typename SvgRenderer, typename RasterizerType, typename RendererBaseType>
void render_vector_marker(SvgRenderer & svg_renderer, RasterizerType & ras, RendererBaseType & renb,
box2d<double> const& bbox, agg::trans_affine const& tr,
double opacity, bool snap_to_pixels)
{
agg::scanline_u8 sl;
if (snap_to_pixels)
{
// https://github.com/mapnik/mapnik/issues/1316
agg::trans_affine snap_tr = tr;
snap_tr.tx = std::floor(snap_tr.tx + .5);
snap_tr.ty = std::floor(snap_tr.ty + .5);
svg_renderer.render(ras, sl, renb, snap_tr, opacity, bbox);
}
else
{
svg_renderer.render(ras, sl, renb, tr, opacity, bbox);
}
}
template <typename RendererType, typename RasterizerType>
void render_raster_marker(RendererType renb, RasterizerType & ras, image_data_rgba8 const& src,
agg::trans_affine const& tr, double opacity,
float scale_factor, bool snap_to_pixels)
{
using color_type = agg::rgba8;
using pixfmt_pre = agg::pixfmt_rgba32_pre;
agg::scanline_u8 sl;
double width = src.width();
double height = src.height();
if (std::fabs(1.0 - scale_factor) < 0.001
&& (std::fabs(1.0 - tr.sx) < agg::affine_epsilon)
&& (std::fabs(0.0 - tr.shy) < agg::affine_epsilon)
&& (std::fabs(0.0 - tr.shx) < agg::affine_epsilon)
&& (std::fabs(1.0 - tr.sy) < agg::affine_epsilon))
{
agg::rendering_buffer src_buffer((unsigned char *)src.getBytes(),src.width(),src.height(),src.width() * 4);
pixfmt_pre pixf_mask(src_buffer);
if (snap_to_pixels)
{
renb.blend_from(pixf_mask,
0,
std::floor(tr.tx + .5),
std::floor(tr.ty + .5),
unsigned(255*opacity));
}
else
{
renb.blend_from(pixf_mask,
0,
tr.tx,
tr.ty,
unsigned(255*opacity));
}
}
else
{
using img_accessor_type = agg::image_accessor_clone<pixfmt_pre>;
using interpolator_type = agg::span_interpolator_linear<>;
//using span_gen_type = agg::span_image_filter_rgba_2x2<img_accessor_type,interpolator_type>;
using span_gen_type = agg::span_image_resample_rgba_affine<img_accessor_type>;
using renderer_type = agg::renderer_scanline_aa_alpha<RendererType,
agg::span_allocator<color_type>,
span_gen_type>;
double p[8];
p[0] = 0; p[1] = 0;
p[2] = width; p[3] = 0;
p[4] = width; p[5] = height;
p[6] = 0; p[7] = height;
tr.transform(&p[0], &p[1]);
tr.transform(&p[2], &p[3]);
tr.transform(&p[4], &p[5]);
tr.transform(&p[6], &p[7]);
agg::span_allocator<color_type> sa;
agg::image_filter_lut filter;
filter.calculate(agg::image_filter_bilinear(), true);
agg::rendering_buffer marker_buf((unsigned char *)src.getBytes(),
src.width(),
src.height(),
src.width()*4);
pixfmt_pre pixf(marker_buf);
img_accessor_type ia(pixf);
agg::trans_affine final_tr(p, 0, 0, width, height);
if (snap_to_pixels)
{
final_tr.tx = std::floor(final_tr.tx+.5);
final_tr.ty = std::floor(final_tr.ty+.5);
}
interpolator_type interpolator(final_tr);
span_gen_type sg(ia, interpolator, filter);
renderer_type rp(renb, sa, sg, unsigned(opacity*255));
ras.move_to_d(p[0],p[1]);
ras.line_to_d(p[2],p[3]);
ras.line_to_d(p[4],p[5]);
ras.line_to_d(p[6],p[7]);
agg::render_scanlines(ras, sl, rp);
}
}
}

View file

@ -37,10 +37,10 @@ struct pixel_position;
template <typename T> class box2d;
namespace svg { struct path_attributes; }
void render_vector_marker(cairo_context & context, pixel_position const& pos,
svg::svg_path_adapter & svg_path, box2d<double> const& bbox,
void render_vector_marker(cairo_context & context, svg::svg_path_adapter & svg_path,
agg::pod_bvector<svg::path_attributes> const & attributes,
agg::trans_affine const& tr, double opacity, bool recenter);
box2d<double> const& bbox, agg::trans_affine const& tr,
double opacity);
}

View file

@ -0,0 +1,72 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2012 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_GRID_MARKER_HELPERS_HPP
#define MAPNIK_GRID_MARKER_HELPERS_HPP
// mapnik
#include <mapnik/feature.hpp>
// agg
#include "agg_renderer_scanline.h"
#include "agg_scanline_bin.h"
#include "agg_image_filters.h"
#include "agg_trans_bilinear.h"
#include "agg_span_allocator.h"
#include "agg_image_accessors.h"
#include "agg_span_image_filter_gray.h"
namespace mapnik {
template <typename RendererType, typename RasterizerType>
void render_raster_marker(RendererType ren,
RasterizerType & ras,
image_data_rgba8 & src,
mapnik::feature_impl const& feature,
agg::trans_affine const& marker_tr,
double opacity)
{
using color_type = typename RendererType::color_type;
agg::scanline_bin sl;
double width = src.width();
double height = src.height();
double p[8];
p[0] = 0; p[1] = 0;
p[2] = width; p[3] = 0;
p[4] = width; p[5] = height;
p[6] = 0; p[7] = height;
marker_tr.transform(&p[0], &p[1]);
marker_tr.transform(&p[2], &p[3]);
marker_tr.transform(&p[4], &p[5]);
marker_tr.transform(&p[6], &p[7]);
ras.move_to_d(p[0],p[1]);
ras.line_to_d(p[2],p[3]);
ras.line_to_d(p[4],p[5]);
ras.line_to_d(p[6],p[7]);
ren.color(color_type(feature.id()));
agg::render_scanlines(ras, sl, ren);
}
}
#endif

View file

@ -40,19 +40,7 @@
#include <mapnik/label_collision_detector.hpp>
// agg
#include "agg_ellipse.h"
#include "agg_color_rgba.h"
#include "agg_renderer_base.h"
#include "agg_renderer_scanline.h"
#include "agg_rendering_buffer.h"
#include "agg_scanline_u.h"
#include "agg_image_filters.h"
#include "agg_trans_affine.h"
#include "agg_span_allocator.h"
#include "agg_image_accessors.h"
#include "agg_pixfmt_rgba.h"
#include "agg_span_image_filter_rgba.h"
#include "agg_span_interpolator_linear.h"
// boost
#include <boost/optional.hpp>
@ -68,49 +56,30 @@ struct clip_poly_tag;
using svg_attribute_type = agg::pod_bvector<svg::path_attributes>;
template <typename SvgRenderer, typename Detector, typename RendererContext>
struct vector_markers_rasterizer_dispatch : util::noncopyable
template <typename Detector>
struct vector_markers_dispatch : util::noncopyable
{
using renderer_base = typename SvgRenderer::renderer_base ;
using vertex_source_type = typename SvgRenderer::vertex_source_type ;
using attribute_source_type = typename SvgRenderer::attribute_source_type;
using pixfmt_type = typename renderer_base::pixfmt_type ;
using BufferType = typename std::tuple_element<0,RendererContext>::type;
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
vector_markers_rasterizer_dispatch(vertex_source_type & path,
attribute_source_type const& attrs,
box2d<double> const& bbox,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars,
bool snap_to_pixels,
RendererContext const& renderer_context)
: buf_(std::get<0>(renderer_context)),
pixf_(buf_),
renb_(pixf_),
svg_renderer_(path, attrs),
ras_(std::get<1>(renderer_context)),
bbox_(bbox),
vector_markers_dispatch(svg_path_ptr const& src,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars)
: src_(src),
marker_trans_(marker_trans),
sym_(sym),
detector_(detector),
feature_(feature),
vars_(vars),
scale_factor_(scale_factor),
snap_to_pixels_(snap_to_pixels)
{
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym,feature_, vars_)));
}
scale_factor_(scale_factor)
{}
virtual ~vector_markers_dispatch() {}
template <typename T>
void add_path(T & path)
{
agg::scanline_u8 sl_;
marker_placement_enum placement_method = get<marker_placement_enum, keys::markers_placement_type>(sym_, feature_, vars_);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
@ -118,10 +87,10 @@ struct vector_markers_rasterizer_dispatch : util::noncopyable
value_double opacity = get<value_double,keys::opacity>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
coord2d center = bbox_.center();
coord2d center = src_->bounding_box().center();
agg::trans_affine_translation recenter(-center.x, -center.y);
agg::trans_affine tr = recenter * marker_trans_;
markers_placement_params params { bbox_, tr, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
markers_placement_params params { src_->bounding_box(), tr, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
markers_placement_finder<T, Detector> placement_finder(
placement_method, path, detector_, params);
double x, y, angle = .0;
@ -130,69 +99,42 @@ struct vector_markers_rasterizer_dispatch : util::noncopyable
agg::trans_affine matrix = tr;
matrix.rotate(angle);
matrix.translate(x, y);
if (snap_to_pixels_)
{
// https://github.com/mapnik/mapnik/issues/1316
matrix.tx = std::floor(matrix.tx + .5);
matrix.ty = std::floor(matrix.ty + .5);
}
svg_renderer_.render(ras_, sl_, renb_, matrix, opacity, bbox_);
render_marker(matrix, opacity);
}
}
private:
BufferType & buf_;
pixfmt_type pixf_;
renderer_base renb_;
SvgRenderer svg_renderer_;
RasterizerType & ras_;
box2d<double> const& bbox_;
virtual void render_marker(agg::trans_affine const& marker_tr, double opacity) = 0;
protected:
svg_path_ptr const& src_;
agg::trans_affine const& marker_trans_;
symbolizer_base const& sym_;
Detector & detector_;
feature_impl & feature_;
attributes const& vars_;
double scale_factor_;
bool snap_to_pixels_;
};
template <typename Detector,typename RendererContext>
struct raster_markers_rasterizer_dispatch : util::noncopyable
template <typename Detector>
struct raster_markers_dispatch : util::noncopyable
{
using BufferType = typename std::remove_reference<typename std::tuple_element<0,RendererContext>::type>::type;
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
using color_type = agg::rgba8;
using order_type = agg::order_rgba;
using pixel_type = agg::pixel32_type;
using blender_type = agg::comp_op_adaptor_rgba_pre<color_type, order_type>; // comp blender
using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, BufferType>;
using renderer_base = agg::renderer_base<pixfmt_comp_type>;
raster_markers_rasterizer_dispatch(image_data_rgba8 const& src,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars,
RendererContext const& renderer_context,
bool snap_to_pixels = false)
: buf_(std::get<0>(renderer_context)),
pixf_(buf_),
renb_(pixf_),
ras_(std::get<1>(renderer_context)),
src_(src),
raster_markers_dispatch(image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars)
: src_(src),
marker_trans_(marker_trans),
sym_(sym),
detector_(detector),
feature_(feature),
vars_(vars),
scale_factor_(scale_factor),
snap_to_pixels_(snap_to_pixels)
{
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym, feature_, vars_)));
}
scale_factor_(scale_factor)
{}
virtual ~raster_markers_dispatch() {}
template <typename T>
void add_path(T & path)
@ -200,12 +142,12 @@ struct raster_markers_rasterizer_dispatch : util::noncopyable
marker_placement_enum placement_method = get<marker_placement_enum, keys::markers_placement_type>(sym_, feature_, vars_);
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
box2d<double> bbox_(0,0, src_.width(),src_.height());
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, vars_);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
markers_placement_params params { bbox_, marker_trans_, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
box2d<double> bbox(0,0, src_.width(),src_.height());
markers_placement_params params { bbox, marker_trans_, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
markers_placement_finder<T, label_collision_detector4> placement_finder(
placement_method, path, detector_, params);
double x, y, angle = .0;
@ -214,103 +156,22 @@ struct raster_markers_rasterizer_dispatch : util::noncopyable
agg::trans_affine matrix = marker_trans_;
matrix.rotate(angle);
matrix.translate(x, y);
render_raster_marker(matrix, opacity);
render_marker(matrix, opacity);
}
}
void render_raster_marker(agg::trans_affine const& marker_tr,
double opacity)
{
using pixfmt_pre = agg::pixfmt_rgba32_pre;
agg::scanline_u8 sl_;
double width = src_.width();
double height = src_.height();
if (std::fabs(1.0 - scale_factor_) < 0.001
&& (std::fabs(1.0 - marker_tr.sx) < agg::affine_epsilon)
&& (std::fabs(0.0 - marker_tr.shy) < agg::affine_epsilon)
&& (std::fabs(0.0 - marker_tr.shx) < agg::affine_epsilon)
&& (std::fabs(1.0 - marker_tr.sy) < agg::affine_epsilon))
{
agg::rendering_buffer src_buffer((unsigned char *)src_.getBytes(),src_.width(),src_.height(),src_.width() * 4);
pixfmt_pre pixf_mask(src_buffer);
if (snap_to_pixels_)
{
renb_.blend_from(pixf_mask,
0,
std::floor(marker_tr.tx + .5),
std::floor(marker_tr.ty + .5),
unsigned(255*opacity));
}
else
{
renb_.blend_from(pixf_mask,
0,
marker_tr.tx,
marker_tr.ty,
unsigned(255*opacity));
}
}
else
{
using img_accessor_type = agg::image_accessor_clone<pixfmt_pre>;
using interpolator_type = agg::span_interpolator_linear<>;
//using span_gen_type = agg::span_image_filter_rgba_2x2<img_accessor_type,interpolator_type>;
using span_gen_type = agg::span_image_resample_rgba_affine<img_accessor_type>;
using renderer_type = agg::renderer_scanline_aa_alpha<renderer_base,
agg::span_allocator<color_type>,
span_gen_type>;
virtual void render_marker(agg::trans_affine const& marker_tr, double opacity) = 0;
double p[8];
p[0] = 0; p[1] = 0;
p[2] = width; p[3] = 0;
p[4] = width; p[5] = height;
p[6] = 0; p[7] = height;
marker_tr.transform(&p[0], &p[1]);
marker_tr.transform(&p[2], &p[3]);
marker_tr.transform(&p[4], &p[5]);
marker_tr.transform(&p[6], &p[7]);
agg::span_allocator<color_type> sa;
agg::image_filter_lut filter;
filter.calculate(agg::image_filter_bilinear(), true);
agg::rendering_buffer marker_buf((unsigned char *)src_.getBytes(),
src_.width(),
src_.height(),
src_.width()*4);
pixfmt_pre pixf(marker_buf);
img_accessor_type ia(pixf);
agg::trans_affine final_tr(p, 0, 0, width, height);
if (snap_to_pixels_)
{
final_tr.tx = std::floor(final_tr.tx+.5);
final_tr.ty = std::floor(final_tr.ty+.5);
}
interpolator_type interpolator(final_tr);
span_gen_type sg(ia, interpolator, filter);
renderer_type rp(renb_,sa, sg, unsigned(opacity*255));
ras_.move_to_d(p[0],p[1]);
ras_.line_to_d(p[2],p[3]);
ras_.line_to_d(p[4],p[5]);
ras_.line_to_d(p[6],p[7]);
agg::render_scanlines(ras_, sl_, rp);
}
}
private:
BufferType & buf_;
pixfmt_comp_type pixf_;
renderer_base renb_;
RasterizerType & ras_;
image_data_rgba8 const& src_;
protected:
image_data_rgba8 & src_;
agg::trans_affine const& marker_trans_;
symbolizer_base const& sym_;
Detector & detector_;
feature_impl & feature_;
attributes const& vars_;
double scale_factor_;
bool snap_to_pixels_;
};
void build_ellipse(symbolizer_base const& sym, mapnik::feature_impl & feature, attributes const& vars, svg_storage_type & marker_ellipse, svg::svg_path_adapter & svg_path);
bool push_explicit_style(svg_attribute_type const& src,

View file

@ -26,6 +26,7 @@
// mapnik
#include <mapnik/pixel_position.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/marker_helpers.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
#include <mapnik/renderer_common.hpp>
@ -39,6 +40,9 @@
#include <mapnik/util/variant.hpp>
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/util/noncopyable.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/graphics.hpp>
// agg
#include <agg_trans_affine.h>
@ -49,9 +53,11 @@ class proj_transform;
struct glyph_info;
class text_symbolizer_helper;
using svg::svg_path_adapter;
using svg_attribute_type = agg::pod_bvector<svg::path_attributes>;
struct virtual_renderer_common : private util::noncopyable
{
virtual_renderer_common(renderer_common & common) :
width_(common.width_),
height_(common.height_),
@ -97,23 +103,51 @@ struct virtual_renderer_common : private util::noncopyable
// stores all the arguments necessary to re-render this point
// symbolizer at a later time.
struct point_render_thunk : util::noncopyable
struct vector_marker_render_thunk : util::noncopyable
{
pixel_position pos_;
marker_ptr marker_;
svg_path_ptr src_;
svg_attribute_type attrs_;
agg::trans_affine tr_;
double opacity_;
composite_mode_e comp_op_;
bool snap_to_pixels_;
point_render_thunk(pixel_position const& pos, marker const& m,
agg::trans_affine const& tr, double opacity,
composite_mode_e comp_op);
point_render_thunk(point_render_thunk && rhs)
: pos_(std::move(rhs.pos_)),
marker_(std::move(rhs.marker_)),
vector_marker_render_thunk(svg_path_ptr const& src,
svg_attribute_type const& attrs,
agg::trans_affine const& marker_trans,
double opacity,
composite_mode_e comp_op,
bool snap_to_pixels);
vector_marker_render_thunk(vector_marker_render_thunk && rhs)
: src_(std::move(rhs.src_)),
attrs_(std::move(rhs.attrs_)),
tr_(std::move(rhs.tr_)),
opacity_(std::move(rhs.opacity_)),
comp_op_(std::move(rhs.comp_op_)) {}
comp_op_(std::move(rhs.comp_op_)),
snap_to_pixels_(std::move(rhs.snap_to_pixels_)) {}
};
struct raster_marker_render_thunk : util::noncopyable
{
image_data_rgba8 & src_;
agg::trans_affine tr_;
double opacity_;
composite_mode_e comp_op_;
bool snap_to_pixels_;
raster_marker_render_thunk(image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
double opacity,
composite_mode_e comp_op,
bool snap_to_pixels);
raster_marker_render_thunk(raster_marker_render_thunk && rhs)
: src_(rhs.src_),
tr_(std::move(rhs.tr_)),
opacity_(std::move(rhs.opacity_)),
comp_op_(std::move(rhs.comp_op_)),
snap_to_pixels_(std::move(rhs.snap_to_pixels_)) {}
};
using helper_ptr = std::unique_ptr<text_symbolizer_helper>;
@ -131,6 +165,7 @@ struct text_render_thunk : util::noncopyable
text_render_thunk(helper_ptr && helper,
double opacity, composite_mode_e comp_op,
halo_rasterizer_enum halo_rasterizer);
text_render_thunk(text_render_thunk && rhs)
: helper_(std::move(rhs.helper_)),
placements_(std::move(rhs.placements_)),
@ -143,7 +178,8 @@ struct text_render_thunk : util::noncopyable
// Variant type for render thunks to allow us to re-render them
// via a static visitor later.
using render_thunk = util::variant<point_render_thunk,
using render_thunk = util::variant<vector_marker_render_thunk,
raster_marker_render_thunk,
text_render_thunk>;
using render_thunk_ptr = std::unique_ptr<render_thunk>;
using render_thunk_list = std::list<render_thunk_ptr>;
@ -164,7 +200,7 @@ struct render_thunk_extractor
virtual_renderer_common & common,
box2d<double> const& clipping_extent);
void operator()(point_symbolizer const& sym) const;
void operator()(markers_symbolizer const& sym) const;
void operator()(text_symbolizer const& sym) const;

View file

@ -32,17 +32,17 @@
namespace mapnik {
template <typename T0, typename T1, typename T2>
template <typename VD, typename RD, typename RendererType, typename ContextType>
void render_markers_symbolizer(markers_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans,
renderer_common const& common,
RendererType const& common,
box2d<double> const& clip_box,
T2 const& renderer_context)
ContextType const& renderer_context)
{
using namespace mapnik::svg;
using vector_dispatch_type = T0;
using raster_dispatch_type = T1;
using vector_dispatch_type = VD;
using raster_dispatch_type = RD;
std::string filename = get<std::string>(sym, keys::file, feature, common.vars_, "shape://ellipse");
bool clip = get<value_bool, keys::clip>(sym, feature, common.vars_);
@ -71,18 +71,17 @@ void render_markers_symbolizer(markers_symbolizer const& sym,
if (filename == "shape://ellipse"
&& (has_key(sym,keys::width) || has_key(sym,keys::height)))
{
svg_storage_type marker_ellipse;
vertex_stl_adapter<svg_path_storage> stl_storage(marker_ellipse.source());
svg_path_ptr marker_ellipse = std::make_shared<svg_storage_type>();
vertex_stl_adapter<svg_path_storage> stl_storage(marker_ellipse->source());
svg_path_adapter svg_path(stl_storage);
build_ellipse(sym, feature, common.vars_, marker_ellipse, svg_path);
build_ellipse(sym, feature, common.vars_, *marker_ellipse, svg_path);
svg_attribute_type attributes;
bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym, feature, common.vars_);
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature, common.vars_, *image_transform);
box2d<double> bbox = marker_ellipse.bounding_box();
vector_dispatch_type rasterizer_dispatch(svg_path,
vector_dispatch_type rasterizer_dispatch(marker_ellipse,
svg_path,
result ? attributes : (*stock_vector_marker)->attributes(),
bbox,
image_tr,
sym,
*common.detector_,
@ -124,9 +123,9 @@ void render_markers_symbolizer(markers_symbolizer const& sym,
svg_path_adapter svg_path(stl_storage);
svg_attribute_type attributes;
bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym, feature, common.vars_);
vector_dispatch_type rasterizer_dispatch(svg_path,
vector_dispatch_type rasterizer_dispatch(*stock_vector_marker,
svg_path,
result ? attributes : (*stock_vector_marker)->attributes(),
bbox,
image_tr,
sym,
*common.detector_,

View file

@ -24,6 +24,7 @@
#include <mapnik/feature.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/agg_rasterizer.hpp>
#include <mapnik/agg_render_marker.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/util/variant.hpp>
#include <mapnik/text/renderer.hpp>
@ -32,6 +33,10 @@
#include <mapnik/pixel_position.hpp>
#include <mapnik/renderer_common/process_group_symbolizer.hpp>
#include <mapnik/renderer_common/clipping_extent.hpp>
#include <mapnik/svg/svg_renderer_agg.hpp>
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/svg/svg_converter.hpp>
// agg
#include "agg_trans_affine.h"
@ -50,17 +55,55 @@ struct thunk_renderer
using text_renderer_type = agg_text_renderer<buffer_type>;
thunk_renderer(renderer_type &ren,
std::unique_ptr<rasterizer> const& ras_ptr,
buffer_type *buf,
renderer_common &common,
pixel_position const &offset)
: ren_(ren), buf_(buf), common_(common), offset_(offset)
: ren_(ren), ras_ptr_(ras_ptr), buf_(buf), common_(common), offset_(offset)
{}
void operator()(point_render_thunk const &thunk) const
void operator()(vector_marker_render_thunk const &thunk) const
{
pixel_position new_pos(thunk.pos_.x + offset_.x, thunk.pos_.y + offset_.y);
ren_.render_marker(new_pos, *thunk.marker_, thunk.tr_, thunk.opacity_,
thunk.comp_op_);
using blender_type = agg::comp_op_adaptor_rgba_pre<agg::rgba8, agg::order_rgba>; // comp blender
using buf_type = agg::rendering_buffer;
using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, buf_type>;
using renderer_base = agg::renderer_base<pixfmt_comp_type>;
using renderer_type = agg::renderer_scanline_aa_solid<renderer_base>;
using svg_attribute_type = agg::pod_bvector<svg::path_attributes>;
using svg_renderer_type = svg::svg_renderer_agg<svg_path_adapter,
svg_attribute_type,
renderer_type,
pixfmt_comp_type>;
ras_ptr_->reset();
buf_type render_buffer(buf_->raw_data(), buf_->width(), buf_->height(), buf_->width() * 4);
pixfmt_comp_type pixf(render_buffer);
pixf.comp_op(static_cast<agg::comp_op_e>(thunk.comp_op_));
renderer_base renb(pixf);
svg::vertex_stl_adapter<svg::svg_path_storage> stl_storage(thunk.src_->source());
svg_path_adapter svg_path(stl_storage);
svg_renderer_type svg_renderer(svg_path, thunk.attrs_);
agg::trans_affine offset_tr = thunk.tr_;
offset_tr.translate(offset_.x, offset_.y);
render_vector_marker(svg_renderer, *ras_ptr_, renb, thunk.src_->bounding_box(), offset_tr, thunk.opacity_, thunk.snap_to_pixels_);
}
void operator()(raster_marker_render_thunk const &thunk) const
{
using blender_type = agg::comp_op_adaptor_rgba_pre<agg::rgba8, agg::order_rgba>; // comp blender
using buf_type = agg::rendering_buffer;
using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, buf_type>;
using renderer_base = agg::renderer_base<pixfmt_comp_type>;
ras_ptr_->reset();
buf_type render_buffer(buf_->raw_data(), buf_->width(), buf_->height(), buf_->width() * 4);
pixfmt_comp_type pixf(render_buffer);
pixf.comp_op(static_cast<agg::comp_op_e>(thunk.comp_op_));
renderer_base renb(pixf);
agg::trans_affine offset_tr = thunk.tr_;
offset_tr.translate(offset_.x, offset_.y);
render_raster_marker(renb, *ras_ptr_, thunk.src_, offset_tr, thunk.opacity_, common_.scale_factor_, thunk.snap_to_pixels_);
}
void operator()(text_render_thunk const &thunk) const
@ -92,6 +135,7 @@ struct thunk_renderer
private:
renderer_type &ren_;
std::unique_ptr<rasterizer> const& ras_ptr_;
buffer_type *buf_;
renderer_common &common_;
pixel_position offset_;
@ -106,7 +150,7 @@ void agg_renderer<T0,T1>::process(group_symbolizer const& sym,
sym, feature, common_.vars_, prj_trans, clipping_extent(common_), common_,
[&](render_thunk_list const& thunks, pixel_position const& render_offset)
{
thunk_renderer ren(*this, current_buffer_, common_, render_offset);
thunk_renderer ren(*this, ras_ptr, current_buffer_, common_, render_offset);
for (render_thunk_ptr const& thunk : thunks)
{
util::apply_visitor(ren, *thunk);

View file

@ -32,6 +32,7 @@
#include <mapnik/marker_helpers.hpp>
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/agg_render_marker.hpp>
#include <mapnik/svg/svg_renderer_agg.hpp>
#include <mapnik/svg/svg_storage.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
@ -59,6 +60,107 @@
namespace mapnik {
namespace detail {
template <typename SvgRenderer, typename Detector, typename RendererContext>
struct vector_markers_rasterizer_dispatch : public vector_markers_dispatch<Detector>
{
using renderer_base = typename SvgRenderer::renderer_base;
using vertex_source_type = typename SvgRenderer::vertex_source_type;
using attribute_source_type = typename SvgRenderer::attribute_source_type;
using pixfmt_type = typename renderer_base::pixfmt_type;
using BufferType = typename std::tuple_element<0,RendererContext>::type;
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
vector_markers_rasterizer_dispatch(svg_path_ptr const& src,
vertex_source_type & path,
svg_attribute_type const& attrs,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars,
bool snap_to_pixels,
RendererContext const& renderer_context)
: vector_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
buf_(std::get<0>(renderer_context)),
pixf_(buf_),
renb_(pixf_),
svg_renderer_(path, attrs),
ras_(std::get<1>(renderer_context)),
snap_to_pixels_(snap_to_pixels)
{
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym, feature, vars)));
}
~vector_markers_rasterizer_dispatch() {}
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
render_vector_marker(svg_renderer_, ras_, renb_, this->src_->bounding_box(),
marker_tr, opacity, snap_to_pixels_);
}
private:
BufferType & buf_;
pixfmt_type pixf_;
renderer_base renb_;
SvgRenderer svg_renderer_;
RasterizerType & ras_;
bool snap_to_pixels_;
};
template <typename Detector, typename RendererContext>
struct raster_markers_rasterizer_dispatch : public raster_markers_dispatch<Detector>
{
using BufferType = typename std::remove_reference<typename std::tuple_element<0,RendererContext>::type>::type;
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
using color_type = agg::rgba8;
using order_type = agg::order_rgba;
using pixel_type = agg::pixel32_type;
using blender_type = agg::comp_op_adaptor_rgba_pre<color_type, order_type>; // comp blender
using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, BufferType>;
using renderer_base = agg::renderer_base<pixfmt_comp_type>;
raster_markers_rasterizer_dispatch(image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars,
RendererContext const& renderer_context,
bool snap_to_pixels = false)
: raster_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
buf_(std::get<0>(renderer_context)),
pixf_(buf_),
renb_(pixf_),
ras_(std::get<1>(renderer_context)),
snap_to_pixels_(snap_to_pixels)
{
pixf_.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e, keys::comp_op>(sym, feature, vars)));
}
~raster_markers_rasterizer_dispatch() {}
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
render_raster_marker(renb_, ras_, this->src_, marker_tr, opacity, this->scale_factor_, snap_to_pixels_);
}
private:
BufferType & buf_;
pixfmt_comp_type pixf_;
renderer_base renb_;
RasterizerType & ras_;
bool snap_to_pixels_;
};
}
template <typename T0, typename T1>
void agg_renderer<T0,T1>::process(markers_symbolizer const& sym,
feature_impl & feature,
@ -94,8 +196,8 @@ void agg_renderer<T0,T1>::process(markers_symbolizer const& sym,
auto renderer_context = std::tie(render_buffer,*ras_ptr,pixmap_);
using context_type = decltype(renderer_context);
using vector_dispatch_type = vector_markers_rasterizer_dispatch<svg_renderer_type, detector_type, context_type>;
using raster_dispatch_type = raster_markers_rasterizer_dispatch<detector_type, context_type>;
using vector_dispatch_type = detail::vector_markers_rasterizer_dispatch<svg_renderer_type, detector_type, context_type>;
using raster_dispatch_type = detail::raster_markers_rasterizer_dispatch<detector_type, context_type>;
render_markers_symbolizer<vector_dispatch_type, raster_dispatch_type>(
sym, feature, prj_trans, common_, clip_box, renderer_context);

View file

@ -32,21 +32,12 @@
namespace mapnik
{
void render_vector_marker(cairo_context & context, pixel_position const& pos,
svg::svg_path_adapter & svg_path, box2d<double> const& bbox,
void render_vector_marker(cairo_context & context, svg::svg_path_adapter & svg_path,
agg::pod_bvector<svg::path_attributes> const & attributes,
agg::trans_affine const& tr, double opacity, bool recenter)
box2d<double> const& bbox, agg::trans_affine const& tr,
double opacity)
{
using namespace mapnik::svg;
agg::trans_affine mtx = tr;
if (recenter)
{
coord<double,2> c = bbox.center();
mtx = agg::trans_affine_translation(-c.x,-c.y);
mtx *= tr;
mtx.translate(pos.x, pos.y);
}
agg::trans_affine transform;
for(unsigned i = 0; i < attributes.size(); ++i)
@ -56,7 +47,7 @@ void render_vector_marker(cairo_context & context, pixel_position const& pos,
continue;
cairo_save_restore guard(context);
transform = attr.transform;
transform *= mtx;
transform *= tr;
// TODO - this 'is_valid' check is not used in the AGG renderer and also
// appears to lead to bogus results with

View file

@ -201,13 +201,20 @@ void cairo_renderer<T>::render_marker(pixel_position const& pos,
mapnik::svg_path_ptr vmarker = *marker.get_vector_data();
if (vmarker)
{
agg::trans_affine marker_tr = tr;
marker_tr *=agg::trans_affine_scaling(common_.scale_factor_);
box2d<double> bbox = vmarker->bounding_box();
agg::trans_affine marker_tr = tr;
if (recenter)
{
coord<double,2> c = bbox.center();
marker_tr = agg::trans_affine_translation(-c.x,-c.y);
marker_tr *= tr;
}
marker_tr *= agg::trans_affine_scaling(common_.scale_factor_);
agg::pod_bvector<svg::path_attributes> const & attributes = vmarker->attributes();
svg::vertex_stl_adapter<svg::svg_path_storage> stl_storage(vmarker->source());
svg::svg_path_adapter svg_path(stl_storage);
render_vector_marker(context_, pos, svg_path, bbox, attributes, marker_tr, opacity, recenter);
marker_tr.translate(pos.x, pos.y);
render_vector_marker(context_, svg_path, attributes, bbox, marker_tr, opacity);
}
}
else if (marker.is_bitmap())

View file

@ -23,8 +23,11 @@
#if defined(HAVE_CAIRO)
// mapnik
#include <mapnik/marker.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/make_unique.hpp>
#include <mapnik/cairo/cairo_renderer.hpp>
#include <mapnik/cairo/cairo_render_vector.hpp>
// mapnik symbolizer generics
#include <mapnik/renderer_common/process_group_symbolizer.hpp>
@ -56,11 +59,32 @@ struct thunk_renderer
common_(common), offset_(offset)
{}
void operator()(point_render_thunk const &thunk) const
void operator()(vector_marker_render_thunk const &thunk) const
{
pixel_position new_pos(thunk.pos_.x + offset_.x, thunk.pos_.y + offset_.y);
ren_.render_marker(new_pos, *thunk.marker_, thunk.tr_, thunk.opacity_,
thunk.comp_op_);
cairo_save_restore guard(context_);
context_.set_operator(thunk.comp_op_);
svg::vertex_stl_adapter<svg::svg_path_storage> stl_storage(thunk.src_->source());
svg::svg_path_adapter svg_path(stl_storage);
agg::trans_affine offset_tr = thunk.tr_;
offset_tr.translate(offset_.x, offset_.y);
mapnik::render_vector_marker(context_,
svg_path,
thunk.attrs_,
thunk.src_->bounding_box(),
offset_tr,
thunk.opacity_);
}
void operator()(raster_marker_render_thunk const &thunk) const
{
cairo_save_restore guard(context_);
context_.set_operator(thunk.comp_op_);
agg::trans_affine offset_tr = thunk.tr_;
offset_tr.translate(offset_.x, offset_.y);
context_.add_image(offset_tr, thunk.src_, thunk.opacity_);
}
void operator()(text_render_thunk const &thunk) const

View file

@ -32,6 +32,7 @@
#include <mapnik/attribute.hpp>
#include <mapnik/marker.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/marker_helpers.hpp>
#include <mapnik/renderer_common/process_markers_symbolizer.hpp>
// agg
@ -43,135 +44,67 @@ namespace mapnik
class feature_impl;
class proj_transform;
namespace svg { struct path_attributes; }
namespace detail {
template <typename RendererContext, typename SvgPath, typename Attributes, typename Detector>
struct markers_dispatch : util::noncopyable
template <typename RendererContext, typename Detector>
struct vector_markers_dispatch_cairo : public vector_markers_dispatch<Detector>
{
markers_dispatch(SvgPath & marker,
Attributes const& attributes,
box2d<double> const& bbox,
agg::trans_affine const& marker_trans,
markers_symbolizer const& sym,
Detector & detector,
double scale_factor,
feature_impl const& feature,
mapnik::attributes const& vars,
bool snap_to_pixels,
RendererContext const& renderer_context)
:marker_(marker),
attributes_(attributes),
bbox_(bbox),
marker_trans_(marker_trans),
sym_(sym),
detector_(detector),
scale_factor_(scale_factor),
feature_(feature),
vars_(vars),
vector_markers_dispatch_cairo(svg_path_ptr const& src,
svg::svg_path_adapter & path,
svg_attribute_type const& attrs,
agg::trans_affine const& marker_trans,
markers_symbolizer const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
mapnik::attributes const& vars,
bool snap_to_pixels,
RendererContext const& renderer_context)
: vector_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
path_(path),
attr_(attrs),
ctx_(std::get<0>(renderer_context))
{}
template <typename T>
void add_path(T & path)
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
marker_placement_enum placement_method = get<marker_placement_enum>(
sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double, keys::max_error>(sym_, feature_, vars_);
coord2d center = bbox_.center();
agg::trans_affine_translation recenter(-center.x, -center.y);
agg::trans_affine tr = recenter * marker_trans_;
markers_placement_params params { bbox_, tr, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
markers_placement_finder<T, label_collision_detector4> placement_finder(
placement_method, path, detector_, params);
double x, y, angle = .0;
while (placement_finder.get_point(x, y, angle, ignore_placement))
{
agg::trans_affine matrix = tr;
matrix.rotate(angle);
matrix.translate(x, y);
render_vector_marker(
ctx_,
pixel_position(x, y),
marker_,
bbox_,
attributes_,
matrix,
opacity,
false);
}
render_vector_marker(ctx_,
path_,
attr_,
this->src_->bounding_box(),
marker_tr,
opacity);
}
SvgPath & marker_;
Attributes const& attributes_;
box2d<double> const& bbox_;
agg::trans_affine const& marker_trans_;
markers_symbolizer const& sym_;
Detector & detector_;
double scale_factor_;
feature_impl const& feature_;
attributes const& vars_;
private:
svg::svg_path_adapter & path_;
svg_attribute_type const& attr_;
cairo_context & ctx_;
};
template <typename RendererContext, typename Detector>
struct raster_markers_dispatch : util::noncopyable
struct raster_markers_dispatch_cairo : public raster_markers_dispatch<Detector>
{
raster_markers_dispatch(mapnik::image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
markers_symbolizer const& sym,
Detector & detector,
double scale_factor,
feature_impl const& feature,
mapnik::attributes const& vars,
RendererContext const& renderer_context)
: src_(src),
detector_(detector),
sym_(sym),
marker_trans_(marker_trans),
scale_factor_(scale_factor),
feature_(feature),
vars_(vars),
raster_markers_dispatch_cairo(mapnik::image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
markers_symbolizer const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
mapnik::attributes const& vars,
RendererContext const& renderer_context)
: raster_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
ctx_(std::get<0>(renderer_context)) {}
template <typename T>
void add_path(T & path)
~raster_markers_dispatch_cairo() {}
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
marker_placement_enum placement_method = get<marker_placement_enum>(sym_, keys::markers_placement_type, feature_, vars_, MARKER_POINT_PLACEMENT);
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, vars_);
value_double spacing = get<value_double, keys::spacing>(sym_, feature_, vars_);
value_double max_error = get<value_double>(sym_, keys::max_error, feature_, vars_, 0.2); // overwrite default
value_bool allow_overlap = get<value_bool, keys::allow_overlap>(sym_, feature_, vars_);
value_bool avoid_edges = get<value_bool, keys::avoid_edges>(sym_, feature_, vars_);
value_bool ignore_placement = get<value_bool, keys::ignore_placement>(sym_, feature_, vars_);
box2d<double> bbox_(0,0, src_.width(),src_.height());
markers_placement_params params { bbox_, marker_trans_, spacing * scale_factor_, max_error, allow_overlap, avoid_edges };
markers_placement_finder<T, label_collision_detector4> placement_finder(
placement_method, path, detector_, params);
double x, y, angle = .0;
while (placement_finder.get_point(x, y, angle, ignore_placement))
{
agg::trans_affine matrix = marker_trans_;
matrix.rotate(angle);
matrix.translate(x, y);
ctx_.add_image(matrix, src_, opacity);
}
ctx_.add_image(marker_tr, this->src_, opacity);
}
image_data_rgba8 & src_;
Detector & detector_;
markers_symbolizer const& sym_;
agg::trans_affine const& marker_trans_;
double scale_factor_;
feature_impl const& feature_;
attributes const& vars_;
private:
cairo_context & ctx_;
};
@ -182,8 +115,6 @@ void cairo_renderer<T>::process(markers_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
using svg_attribute_type = agg::pod_bvector<svg::path_attributes>;
cairo_save_restore guard(context_);
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
context_.set_operator(comp_op);
@ -192,12 +123,11 @@ void cairo_renderer<T>::process(markers_symbolizer const& sym,
auto renderer_context = std::tie(context_);
using RendererContextType = decltype(renderer_context);
using vector_dispatch_type = detail::markers_dispatch<RendererContextType,
svg::path_adapter<svg::vertex_stl_adapter<svg::svg_path_storage> >,
svg_attribute_type,label_collision_detector4>;
using vector_dispatch_type = detail::vector_markers_dispatch_cairo<RendererContextType,
label_collision_detector4>;
using raster_dispatch_type = detail::raster_markers_dispatch<RendererContextType,
label_collision_detector4>;
using raster_dispatch_type = detail::raster_markers_dispatch_cairo<RendererContextType,
label_collision_detector4>;
render_markers_symbolizer<vector_dispatch_type, raster_dispatch_type>(

View file

@ -26,10 +26,15 @@
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/grid/grid_render_marker.hpp>
#include <mapnik/attribute_collector.hpp>
#include <mapnik/text/placement_finder.hpp>
#include <mapnik/text/symbolizer_helpers.hpp>
#include <mapnik/text/renderer.hpp>
#include <mapnik/svg/svg_renderer_agg.hpp>
#include <mapnik/svg/svg_storage.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/group/group_layout_manager.hpp>
#include <mapnik/group/group_symbolizer_helper.hpp>
#include <mapnik/util/variant.hpp>
@ -60,18 +65,58 @@ struct thunk_renderer
using text_renderer_type = grid_text_renderer<buffer_type>;
thunk_renderer(renderer_type &ren,
grid_rasterizer &ras,
buffer_type &pixmap,
renderer_common &common,
feature_impl &feature,
pixel_position const &offset)
: ren_(ren), pixmap_(pixmap), common_(common),
feature_(feature), offset_(offset)
: ren_(ren), ras_(ras), pixmap_(pixmap),
common_(common), feature_(feature), offset_(offset)
{}
void operator()(point_render_thunk const &thunk) const
void operator()(vector_marker_render_thunk const &thunk) const
{
ren_.render_marker(feature_, offset_ + thunk.pos_,
*thunk.marker_, thunk.tr_, thunk.opacity_, thunk.comp_op_);
using buf_type = grid_rendering_buffer;
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
using namespace mapnik::svg;
using svg_attribute_type = agg::pod_bvector<path_attributes>;
using svg_renderer_type = svg_renderer_agg<svg_path_adapter,
svg_attribute_type,
renderer_type,
pixfmt_type>;
buf_type render_buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_);
ras_.reset();
pixfmt_type pixf(render_buf);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
vertex_stl_adapter<svg_path_storage> stl_storage(thunk.src_->source());
svg_path_adapter svg_path(stl_storage);
svg_renderer_type svg_renderer(svg_path, thunk.attrs_);
agg::trans_affine offset_tr = thunk.tr_;
offset_tr.translate(offset_.x, offset_.y);
//render_vector_marker(svg_renderer, *ras_ptr_, renb, thunk.src_->bounding_box(), offset_tr, thunk.opacity_, thunk.snap_to_pixels_);
agg::scanline_bin sl;
svg_renderer.render_id(ras_, sl, renb, feature_.id(), offset_tr, thunk.opacity_, thunk.src_->bounding_box());
pixmap_.add_feature(feature_);
}
void operator()(raster_marker_render_thunk const &thunk) const
{
using buf_type = grid_rendering_buffer;
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
buf_type render_buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_);
ras_.reset();
pixfmt_type pixf(render_buf);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
agg::trans_affine offset_tr = thunk.tr_;
offset_tr.translate(offset_.x, offset_.y);
render_raster_marker(ren, ras_, thunk.src_, feature_, offset_tr, thunk.opacity_);
pixmap_.add_feature(feature_);
}
void operator()(text_render_thunk const &thunk) const
@ -94,6 +139,7 @@ struct thunk_renderer
}
ren.render(*glyphs, feature_id);
});
pixmap_.add_feature(feature_);
}
template <typename T1>
@ -104,6 +150,7 @@ struct thunk_renderer
private:
renderer_type &ren_;
grid_rasterizer & ras_;
buffer_type &pixmap_;
renderer_common &common_;
feature_impl &feature_;
@ -119,7 +166,7 @@ void grid_renderer<T>::process(group_symbolizer const& sym,
sym, feature, common_.vars_, prj_trans, common_.query_extent_, common_,
[&](render_thunk_list const& thunks, pixel_position const& render_offset)
{
thunk_renderer<T> ren(*this, pixmap_, common_, feature, render_offset);
thunk_renderer<T> ren(*this, *ras_ptr, pixmap_, common_, feature, render_offset);
for (render_thunk_ptr const& thunk : thunks)
{
util::apply_visitor(ren, *thunk);

View file

@ -45,11 +45,14 @@ porting notes -->
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/marker_helpers.hpp>
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid_render_marker.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/grid/grid_marker_helpers.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/geom_util.hpp>
@ -77,6 +80,110 @@ porting notes -->
namespace mapnik {
namespace detail {
template <typename SvgRenderer, typename Detector, typename RendererContext>
struct vector_markers_rasterizer_dispatch : public vector_markers_dispatch<Detector>
{
using renderer_base = typename SvgRenderer::renderer_base;
using vertex_source_type = typename SvgRenderer::vertex_source_type;
using attribute_source_type = typename SvgRenderer::attribute_source_type;
using pixfmt_type = typename renderer_base::pixfmt_type;
using BufferType = typename std::tuple_element<0,RendererContext>::type;
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
using PixMapType = typename std::tuple_element<2,RendererContext>::type;
vector_markers_rasterizer_dispatch(svg_path_ptr const& src,
vertex_source_type & path,
svg_attribute_type const& attrs,
agg::trans_affine const& marker_trans,
markers_symbolizer const& sym,
Detector & detector,
double scale_factor,
mapnik::feature_impl & feature,
attributes const& vars,
bool snap_to_pixels,
RendererContext const& renderer_context)
: vector_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
buf_(std::get<0>(renderer_context)),
pixf_(buf_),
renb_(pixf_),
svg_renderer_(path, attrs),
ras_(std::get<1>(renderer_context)),
pixmap_(std::get<2>(renderer_context)),
placed_(false)
{}
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
agg::scanline_bin sl_;
svg_renderer_.render_id(ras_, sl_, renb_, this->feature_.id(), marker_tr, opacity, this->src_->bounding_box());
if (!placed_)
{
pixmap_.add_feature(this->feature_);
placed_ = true;
}
}
private:
BufferType & buf_;
pixfmt_type pixf_;
renderer_base renb_;
SvgRenderer svg_renderer_;
RasterizerType & ras_;
PixMapType & pixmap_;
bool placed_;
};
template <typename RendererBase, typename RendererType, typename Detector, typename RendererContext>
struct raster_markers_rasterizer_dispatch : public raster_markers_dispatch<Detector>
{
using pixfmt_type = typename RendererBase::pixfmt_type;
using color_type = typename RendererBase::pixfmt_type::color_type;
using BufferType = typename std::tuple_element<0,RendererContext>::type;
using RasterizerType = typename std::tuple_element<1,RendererContext>::type;
using PixMapType = typename std::tuple_element<2,RendererContext>::type;
raster_markers_rasterizer_dispatch(image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
markers_symbolizer const& sym,
Detector & detector,
double scale_factor,
mapnik::feature_impl & feature,
attributes const& vars,
RendererContext const& renderer_context)
: raster_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
buf_(std::get<0>(renderer_context)),
pixf_(buf_),
renb_(pixf_),
ras_(std::get<1>(renderer_context)),
pixmap_(std::get<2>(renderer_context)),
placed_(false)
{}
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
render_raster_marker(RendererType(renb_), ras_, this->src_, this->feature_, marker_tr, opacity);
if (!placed_)
{
pixmap_.add_feature(this->feature_);
placed_ = true;
}
}
private:
BufferType & buf_;
pixfmt_type pixf_;
RendererBase renb_;
RasterizerType & ras_;
PixMapType & pixmap_;
bool placed_;
};
}
template <typename T>
void grid_renderer<T>::process(markers_symbolizer const& sym,
mapnik::feature_impl & feature,
@ -100,13 +207,13 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
auto renderer_context = std::tie(render_buf,*ras_ptr,pixmap_);
using context_type = decltype(renderer_context);
using vector_dispatch_type = vector_markers_rasterizer_dispatch_grid<svg_renderer_type,
detector_type,
context_type>;
using raster_dispatch_type = raster_markers_rasterizer_dispatch_grid<grid_renderer_base_type,
renderer_type,
detector_type,
context_type>;
using vector_dispatch_type = detail::vector_markers_rasterizer_dispatch<svg_renderer_type,
detector_type,
context_type>;
using raster_dispatch_type = detail::raster_markers_rasterizer_dispatch<grid_renderer_base_type,
renderer_type,
detector_type,
context_type>;
render_markers_symbolizer<vector_dispatch_type, raster_dispatch_type>(
sym, feature, prj_trans, common_, clip_box,renderer_context);
}

View file

@ -23,6 +23,9 @@
// mapnik
#include <mapnik/marker_helpers.hpp>
#include "agg_ellipse.h"
#include "agg_color_rgba.h"
namespace mapnik {
void build_ellipse(symbolizer_base const& sym, mapnik::feature_impl & feature, attributes const& vars, svg_storage_type & marker_ellipse, svg::svg_path_adapter & svg_path)

View file

@ -23,18 +23,30 @@
// mapnik
#include <mapnik/renderer_common/process_group_symbolizer.hpp>
#include <mapnik/renderer_common/process_point_symbolizer.hpp>
#include <mapnik/renderer_common/process_markers_symbolizer.hpp>
#include <mapnik/text/glyph_info.hpp>
#include <mapnik/make_unique.hpp>
namespace mapnik {
point_render_thunk::point_render_thunk(pixel_position const& pos, marker const& m,
agg::trans_affine const& tr, double opacity,
composite_mode_e comp_op)
: pos_(pos), marker_(std::make_shared<marker>(m)),
tr_(tr), opacity_(opacity), comp_op_(comp_op)
vector_marker_render_thunk::vector_marker_render_thunk(svg_path_ptr const& src,
svg_attribute_type const& attrs,
agg::trans_affine const& marker_trans,
double opacity,
composite_mode_e comp_op,
bool snap_to_pixels)
: src_(src), attrs_(attrs), tr_(marker_trans), opacity_(opacity),
comp_op_(comp_op), snap_to_pixels_(snap_to_pixels)
{}
raster_marker_render_thunk::raster_marker_render_thunk(image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
double opacity,
composite_mode_e comp_op,
bool snap_to_pixels)
: src_(src), tr_(marker_trans), opacity_(opacity), comp_op_(comp_op),
snap_to_pixels_(snap_to_pixels)
{}
text_render_thunk::text_render_thunk(helper_ptr && helper,
double opacity, composite_mode_e comp_op,
@ -43,7 +55,77 @@ text_render_thunk::text_render_thunk(helper_ptr && helper,
placements_(helper_->get()),
opacity_(opacity),
comp_op_(comp_op),
halo_rasterizer_(halo_rasterizer) {}
halo_rasterizer_(halo_rasterizer)
{}
namespace detail {
template <typename Detector, typename RendererContext>
struct vector_marker_thunk_dispatch : public vector_markers_dispatch<Detector>
{
vector_marker_thunk_dispatch(svg_path_ptr const& src,
svg_path_adapter & path,
svg_attribute_type const& attrs,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars,
bool snap_to_pixels,
RendererContext const& renderer_context)
: vector_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
attrs_(attrs), comp_op_(get<composite_mode_e, keys::comp_op>(sym, feature, vars)),
snap_to_pixels_(snap_to_pixels), thunks_(std::get<0>(renderer_context))
{}
~vector_marker_thunk_dispatch() {}
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
vector_marker_render_thunk thunk(this->src_, this->attrs_, marker_tr, opacity, comp_op_, snap_to_pixels_);
thunks_.push_back(std::make_unique<render_thunk>(std::move(thunk)));
}
private:
svg_attribute_type const& attrs_;
composite_mode_e comp_op_;
bool snap_to_pixels_;
render_thunk_list & thunks_;
};
template <typename Detector, typename RendererContext>
struct raster_marker_thunk_dispatch : public raster_markers_dispatch<Detector>
{
raster_marker_thunk_dispatch(image_data_rgba8 & src,
agg::trans_affine const& marker_trans,
symbolizer_base const& sym,
Detector & detector,
double scale_factor,
feature_impl & feature,
attributes const& vars,
RendererContext const& renderer_context,
bool snap_to_pixels = false)
: raster_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
comp_op_(get<composite_mode_e, keys::comp_op>(sym, feature, vars)),
snap_to_pixels_(snap_to_pixels), thunks_(std::get<0>(renderer_context))
{}
~raster_marker_thunk_dispatch() {}
void render_marker(agg::trans_affine const& marker_tr, double opacity)
{
raster_marker_render_thunk thunk(this->src_, marker_tr, opacity, comp_op_, snap_to_pixels_);
thunks_.push_back(std::make_unique<render_thunk>(std::move(thunk)));
}
private:
composite_mode_e comp_op_;
bool snap_to_pixels_;
render_thunk_list & thunks_;
};
}
render_thunk_extractor::render_thunk_extractor(box2d<double> & box,
render_thunk_list & thunks,
@ -56,17 +138,15 @@ render_thunk_extractor::render_thunk_extractor(box2d<double> & box,
common_(common), clipping_extent_(clipping_extent)
{}
void render_thunk_extractor::operator()(point_symbolizer const& sym) const
void render_thunk_extractor::operator()(markers_symbolizer const& sym) const
{
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature_, common_.vars_, src_over);
auto renderer_context = std::tie(thunks_);
using context_type = decltype(renderer_context);
using vector_dispatch_type = detail::vector_marker_thunk_dispatch<label_collision_detector4, context_type>;
using raster_dispatch_type = detail::raster_marker_thunk_dispatch<label_collision_detector4, context_type>;
render_point_symbolizer(
sym, feature_, prj_trans_, common_,
[&](pixel_position const& pos, marker const& marker,
agg::trans_affine const& tr, double opacity) {
point_render_thunk thunk(pos, marker, tr, opacity, comp_op);
thunks_.push_back(std::make_unique<render_thunk>(std::move(thunk)));
});
render_markers_symbolizer<vector_dispatch_type, raster_dispatch_type>(
sym, feature_, prj_trans_, common_, clipping_extent_, renderer_context);
update_box();
}
@ -128,7 +208,6 @@ void render_thunk_extractor::update_box() const
detector.clear();
}
geometry_type *origin_point(proj_transform const& prj_trans,
renderer_common const& common)
{

View file

@ -67,10 +67,10 @@
" !! !! ",
" ! ! ",
" !! !! ",
" !!!!!! !!!!! ",
" !!!!!! !!!!! ",
" !!!!!! !!!!! ",
" !!!!!! !!!!! ",
" !! !! ",
" !!!!! !!!!! ",
" !!!!! !!!!! ",
" !!!! !!!!! ",
" ",
" ! ! !! !! ",
" ! !! !!! ! !! ! ",

View file

@ -65,14 +65,14 @@
" ! ! ",
" ! ! ",
" ",
" !! !! ",
" !!!!!!!! !!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!!! !!!!!!!!!! ",
" !!!!!!!!! !!!!!!!!! ",
" !!!!!! !!!!!! ",
" ",
" !! !!!!!! ",
" ! ! ! ",

View file

@ -0,0 +1,34 @@
{
"keys": [
"",
"1"
],
"data": {},
"grid": [
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!! ",
" ! !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!! !!! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! ",
" !!! !!!!! ! !!!! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!! ",
" !!! !!!!! !!! !!!! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!! ",
" !!! !!!!! !! !!!! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!! ",
" !!! !!!!! !!!! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!! ",
" !!! !! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! ",
" ! !!!!!!!!!!!!!!!!!!!!!!!!! ",
" ! !!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "
]
}

View file

@ -0,0 +1,73 @@
{
"keys": [
"",
"1"
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !! ! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! ",
" !! !!!! !!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!! ",
" !!!!!!!!! !!! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!! ",
" !!!!!!!!!!!!! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!! ",
" !!!! !!!! !! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!! ",
" !! !!! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! ",
" !! ! !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" ! !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" ! !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

@ -22,7 +22,7 @@ lat,long,name1,ref1,name2,ref2
<GroupSymbolizer start-column="1" num-columns="2" placement="point" avoid-edges="false" minimum-distance="10" spacing="20" repeat-key="[name%]+'-'+[ref%]">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<MarkersSymbolizer file="shape://ellipse" width="20" height="15"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="10">[name%]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="-10">[ref%]</TextSymbolizer>
</GroupRule>

View file

@ -41,7 +41,7 @@ lat,long,name1,ref1,name2,ref2
<GroupSymbolizer start-column="1" num-columns="2" placement="point" avoid-edges="false">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<ShieldSymbolizer file="../../data/svg/rect.svg" face-name="DejaVu Sans Book"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="10">[name%]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="-10">[ref%]</TextSymbolizer>
</GroupRule>
@ -63,11 +63,11 @@ lat,long,name1,ref1,name2,ref2
<Style name="non-grouped">
<Rule>
<ShieldSymbolizer face-name="DejaVu Sans Book" dx="-16.25" file="../../data/svg/rect.svg"/>
<ShieldSymbolizer dx="-16.25" file="../../data/svg/rect.svg" face-name="DejaVu Sans Book"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="-0.25" dy="10">[name1]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="-11.25" dy="-10">[ref1]</TextSymbolizer>
<ShieldSymbolizer face-name="DejaVu Sans Book" dx="15" file="../../data/svg/rect.svg"/>
<ShieldSymbolizer dx="15" file="../../data/svg/rect.svg" face-name="DejaVu Sans Book"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="0.25" dy="10">[name2]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dx="10" dy="-10">[ref2]</TextSymbolizer>
</Rule>

View file

@ -41,7 +41,7 @@ lat,long,name1,ref1,name2,ref2,margin
<GroupSymbolizer start-column="1" num-columns="2" placement="point" avoid-edges="false" margin="[margin]">
<PairLayout item-margin="1"/>
<GroupRule>
<PointSymbolizer file="../../data/svg/rect.svg"/>
<MarkersSymbolizer file="../../data/svg/rect.svg"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="10">[name%]</TextSymbolizer>
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="-10">[ref%]</TextSymbolizer>
</GroupRule>

View file

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Without unlock-image -->
<!DOCTYPE Map>
<Map background-color="green" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" minimum-version="2.0.0">
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>points</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,ref1,ref2,ref3,ref4,ref5,ref6,ref7,ref8,ref9,ref10
0,0,1,2,3,4,5,6,7,8,9,10
</Parameter>
</Datasource>
</Layer>
<Style name="points">
<Rule>
<GroupSymbolizer start-column="1" num-columns="10" placement="point" avoid-edges="false" minimum-distance="10" spacing="20" repeat-key="[ref%]">
<SimpleLayout item-margin="5"/>
<GroupRule>
<Filter>[ref%] = 1</Filter>
<MarkersSymbolizer file="shape://ellipse" width="12" height="25" />
<TextSymbolizer face-name="DejaVu Sans Book" size="14" placement="point">[ref%]</TextSymbolizer>
</GroupRule>
<GroupRule>
<Filter>[ref%] = 2</Filter>
<MarkersSymbolizer file="shape://ellipse" width="18" height="18" fill="red" stroke="white" stroke-width="2" />
<TextSymbolizer face-name="DejaVu Sans Bold" size="14" fill="white" placement="point">[ref%]</TextSymbolizer>
</GroupRule>
<GroupRule>
<Filter>[ref%] = 3</Filter>
<MarkersSymbolizer file="shape://ellipse" comp-op="invert" />
<TextSymbolizer face-name="DejaVu Sans Book" size="14" dy="10" placement="point">[ref%]</TextSymbolizer>
</GroupRule>
<GroupRule>
<Filter>[ref%] = 4</Filter>
<MarkersSymbolizer file="../../data/images/crosshair16x16.png"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="12" placement="point" dy="-5" dx="-5" horizontal-alignment="left" vertical-alignment="top">[ref%]</TextSymbolizer>
</GroupRule>
<GroupRule>
<Filter>[ref%] = 5</Filter>
<MarkersSymbolizer file="../../data/images/marker.png" comp-op="xor"/>
<TextSymbolizer face-name="DejaVu Sans Bold" size="16" placement="point">[ref%]</TextSymbolizer>
</GroupRule>
<GroupRule>
<Filter>[ref%] = 6</Filter>
<MarkersSymbolizer file="../../data/svg/rect.svg" />
<TextSymbolizer face-name="DejaVu Sans Book" size="14" placement="point">[ref%]</TextSymbolizer>
</GroupRule>
<GroupRule>
<Filter>[ref%] = 7</Filter>
<MarkersSymbolizer file="../../data/svg/rect.svg" width="20" height="20" fill="red" stroke="white" stroke-width="3" />
<TextSymbolizer face-name="DejaVu Sans Bold" size="14" fill="white" placement="point">[ref%]</TextSymbolizer>
</GroupRule>
<GroupRule>
<Filter>[ref%] = 8</Filter>
<MarkersSymbolizer file="../../data/svg/rect.svg" comp-op="grain-extract"/>
<TextSymbolizer face-name="DejaVu Sans Book" size="14" placement="point">[ref%]</TextSymbolizer>
</GroupRule>
</GroupSymbolizer>
</Rule>
</Style>
<Layer name="layer2" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>frame</StyleName>
<Datasource>
<Parameter name="type">csv</Parameter>
<Parameter name="inline">
lat,long,nr
-1,-2,0
-1,2,1
1,-2,2
1,2,3
</Parameter>
</Datasource>
</Layer>
<Style name="frame">
<Rule>
<PointSymbolizer/>
<DebugSymbolizer/>
</Rule>
</Style>
</Map>