2010-06-01 15:31:08 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
2011-10-23 15:04:25 +02:00
|
|
|
* Copyright (C) 2011 Artem Pavlenko
|
2010-06-01 15:31:08 +02:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2012-04-08 02:45:01 +02:00
|
|
|
// mapnik
|
2010-06-01 15:31:08 +02:00
|
|
|
#include <mapnik/agg_renderer.hpp>
|
2010-06-13 14:03:42 +02:00
|
|
|
#include <mapnik/agg_rasterizer.hpp>
|
2010-06-01 15:31:08 +02:00
|
|
|
#include <mapnik/image_util.hpp>
|
2010-06-08 12:16:22 +02:00
|
|
|
#include <mapnik/svg/svg_converter.hpp>
|
|
|
|
#include <mapnik/svg/svg_renderer.hpp>
|
2010-06-14 18:38:02 +02:00
|
|
|
#include <mapnik/svg/svg_path_adapter.hpp>
|
2012-01-29 04:49:02 +01:00
|
|
|
#include <mapnik/symbolizer_helpers.hpp>
|
2012-02-17 00:59:20 +01:00
|
|
|
|
2011-05-10 23:09:54 +02:00
|
|
|
// boost
|
|
|
|
#include <boost/make_shared.hpp>
|
|
|
|
|
2010-06-01 15:31:08 +02:00
|
|
|
namespace mapnik {
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void agg_renderer<T>::process(shield_symbolizer const& sym,
|
2012-06-16 04:17:26 +02:00
|
|
|
mapnik::feature_impl & feature,
|
2010-06-02 13:03:30 +02:00
|
|
|
proj_transform const& prj_trans)
|
2010-06-01 15:31:08 +02:00
|
|
|
{
|
2012-01-29 04:49:02 +01:00
|
|
|
shield_symbolizer_helper<face_manager<freetype_engine>,
|
2012-02-02 02:53:35 +01:00
|
|
|
label_collision_detector4> helper(
|
2012-06-16 04:17:26 +02:00
|
|
|
sym, feature, prj_trans,
|
2012-02-02 02:53:35 +01:00
|
|
|
width_, height_,
|
|
|
|
scale_factor_,
|
2012-03-07 13:48:51 +01:00
|
|
|
t_, font_manager_, *detector_, query_extent_);
|
2012-01-29 04:49:02 +01:00
|
|
|
|
|
|
|
text_renderer<T> ren(pixmap_, font_manager_, *(font_manager_.get_stroker()));
|
|
|
|
|
2012-03-03 20:15:24 +01:00
|
|
|
while (helper.next()) {
|
|
|
|
placements_type &placements = helper.placements();
|
|
|
|
for (unsigned int ii = 0; ii < placements.size(); ++ii)
|
2012-01-29 04:49:02 +01:00
|
|
|
{
|
2012-05-27 23:50:09 +02:00
|
|
|
// get_marker_position returns (minx,miny) corner position,
|
|
|
|
// while (currently only) agg_renderer::render_marker newly
|
|
|
|
// expects center position;
|
|
|
|
// until all renderers and shield_symbolizer_helper are
|
|
|
|
// modified accordingly, we must adjust the position here
|
|
|
|
pixel_position pos = helper.get_marker_position(placements[ii]);
|
|
|
|
pos.x += 0.5 * helper.get_marker_width();
|
|
|
|
pos.y += 0.5 * helper.get_marker_height();
|
|
|
|
render_marker(pos,
|
2012-03-03 20:15:24 +01:00
|
|
|
helper.get_marker(),
|
2012-05-01 17:47:33 +02:00
|
|
|
helper.get_image_transform(),
|
2012-05-15 17:13:08 +02:00
|
|
|
sym.get_opacity(),
|
|
|
|
sym.comp_op());
|
2012-01-29 04:49:02 +01:00
|
|
|
|
2012-03-03 20:15:24 +01:00
|
|
|
ren.prepare_glyphs(&(placements[ii]));
|
|
|
|
ren.render(placements[ii].center);
|
2010-06-02 13:03:30 +02:00
|
|
|
}
|
2010-06-01 15:31:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template void agg_renderer<image_32>::process(shield_symbolizer const&,
|
2012-06-16 04:17:26 +02:00
|
|
|
mapnik::feature_impl &,
|
2010-06-02 13:03:30 +02:00
|
|
|
proj_transform const&);
|
2010-06-01 15:31:08 +02:00
|
|
|
|
|
|
|
}
|