2011-04-26 23:44:52 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
2014-11-20 15:25:50 +01:00
|
|
|
* Copyright (C) 2014 Artem Pavlenko
|
2011-04-26 23:44:52 +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
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2014-04-24 21:54:18 +02:00
|
|
|
#if defined(GRID_RENDERER)
|
|
|
|
|
2011-04-26 23:44:52 +02:00
|
|
|
// mapnik
|
2013-11-28 07:50:15 +01:00
|
|
|
#include <mapnik/feature.hpp>
|
|
|
|
#include <mapnik/grid/grid_rasterizer.hpp>
|
2011-04-26 23:44:52 +02:00
|
|
|
#include <mapnik/grid/grid_renderer.hpp>
|
2013-11-28 07:50:15 +01:00
|
|
|
#include <mapnik/grid/grid_renderer_base.hpp>
|
|
|
|
#include <mapnik/grid/grid.hpp>
|
2013-12-02 14:46:52 +01:00
|
|
|
#include <mapnik/text/symbolizer_helpers.hpp>
|
2013-11-28 07:50:15 +01:00
|
|
|
#include <mapnik/pixel_position.hpp>
|
2013-12-02 14:46:52 +01:00
|
|
|
#include <mapnik/text/renderer.hpp>
|
2011-04-26 23:44:52 +02:00
|
|
|
|
|
|
|
// agg
|
2011-05-17 08:24:49 +02:00
|
|
|
#include "agg_trans_affine.h"
|
2011-04-26 23:44:52 +02:00
|
|
|
|
|
|
|
namespace mapnik {
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void grid_renderer<T>::process(shield_symbolizer const& sym,
|
2012-06-16 04:17:26 +02:00
|
|
|
mapnik::feature_impl & feature,
|
2012-02-02 02:53:35 +01:00
|
|
|
proj_transform const& prj_trans)
|
2011-04-26 23:44:52 +02:00
|
|
|
{
|
2014-08-06 15:54:38 +02:00
|
|
|
agg::trans_affine tr;
|
|
|
|
auto transform = get_optional<transform_type>(sym, keys::geometry_transform);
|
|
|
|
if (transform) evaluate_transform(tr, feature, common_.vars_, *transform, common_.scale_factor_);
|
|
|
|
|
2013-12-02 14:46:52 +01:00
|
|
|
text_symbolizer_helper helper(
|
2014-05-14 03:24:17 +02:00
|
|
|
sym, feature, common_.vars_, prj_trans,
|
2013-12-05 20:34:32 +01:00
|
|
|
common_.width_, common_.height_,
|
|
|
|
common_.scale_factor_,
|
|
|
|
common_.t_, common_.font_manager_, *common_.detector_,
|
2014-08-06 15:54:38 +02:00
|
|
|
common_.query_extent_, tr);
|
2013-11-28 07:50:15 +01:00
|
|
|
bool placement_found = false;
|
2011-04-26 23:44:52 +02:00
|
|
|
|
2014-05-14 03:24:17 +02:00
|
|
|
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
|
|
|
|
double opacity = get<double>(sym, keys::opacity, feature, common_.vars_, 1.0);
|
2011-04-26 23:44:52 +02:00
|
|
|
|
2013-12-02 14:46:52 +01:00
|
|
|
grid_text_renderer<T> ren(pixmap_,
|
|
|
|
comp_op,
|
2013-12-05 20:34:32 +01:00
|
|
|
common_.scale_factor_);
|
2013-12-02 14:46:52 +01:00
|
|
|
|
|
|
|
placements_list const& placements = helper.get();
|
|
|
|
value_integer feature_id = feature.id();
|
2014-08-06 15:54:38 +02:00
|
|
|
|
2013-12-02 14:46:52 +01:00
|
|
|
for (glyph_positions_ptr glyphs : placements)
|
2012-07-11 11:13:38 +02:00
|
|
|
{
|
2013-12-02 14:46:52 +01:00
|
|
|
if (glyphs->marker())
|
2013-11-28 07:50:15 +01:00
|
|
|
{
|
2014-08-06 15:54:38 +02:00
|
|
|
render_marker(feature,
|
2013-12-02 14:46:52 +01:00
|
|
|
glyphs->marker_pos(),
|
|
|
|
*(glyphs->marker()->marker),
|
|
|
|
glyphs->marker()->transform,
|
|
|
|
opacity, comp_op);
|
2013-11-28 07:50:15 +01:00
|
|
|
}
|
2013-12-02 14:46:52 +01:00
|
|
|
ren.render(*glyphs, feature_id);
|
|
|
|
placement_found = true;
|
2011-04-26 23:44:52 +02:00
|
|
|
}
|
2013-11-28 07:50:15 +01:00
|
|
|
if (placement_found)
|
2013-12-02 14:46:52 +01:00
|
|
|
{
|
2013-11-28 07:50:15 +01:00
|
|
|
pixmap_.add_feature(feature);
|
2013-12-02 14:46:52 +01:00
|
|
|
}
|
2011-04-26 23:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template void grid_renderer<grid>::process(shield_symbolizer const&,
|
2012-06-16 04:17:26 +02:00
|
|
|
mapnik::feature_impl &,
|
2012-02-02 02:53:35 +01:00
|
|
|
proj_transform const&);
|
2011-04-26 23:44:52 +02:00
|
|
|
|
|
|
|
}
|
2014-04-24 21:54:18 +02:00
|
|
|
|
|
|
|
#endif
|