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)
|
|
|
|
|
2012-08-01 04:19:45 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
porting notes -->
|
|
|
|
|
2012-08-15 02:18:44 +02:00
|
|
|
- rasterizer -> grid_rasterizer
|
|
|
|
- current_buffer_ -> pixmap_
|
|
|
|
- agg::rendering_buffer -> grid_renderering_buffer
|
2012-08-01 04:19:45 +02:00
|
|
|
- no gamma
|
|
|
|
- agg::scanline_bin sl
|
|
|
|
- grid_rendering_buffer
|
|
|
|
- agg::renderer_scanline_bin_solid
|
2012-08-15 02:18:44 +02:00
|
|
|
- TODO - clamp sizes to > 4 pixels of interactivity
|
2012-08-01 04:19:45 +02:00
|
|
|
- svg_renderer.render_id
|
|
|
|
- only encode feature if placements are found:
|
|
|
|
if (placed)
|
|
|
|
{
|
|
|
|
pixmap_.add_feature(feature);
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2011-04-26 23:44:52 +02:00
|
|
|
// mapnik
|
2013-01-04 03:06:07 +01:00
|
|
|
#include <mapnik/feature.hpp>
|
2011-04-26 23:44:52 +02:00
|
|
|
#include <mapnik/grid/grid_rasterizer.hpp>
|
|
|
|
#include <mapnik/grid/grid_renderer.hpp>
|
2012-12-20 04:19:30 +01:00
|
|
|
#include <mapnik/grid/grid_renderer_base.hpp>
|
2011-04-26 23:44:52 +02:00
|
|
|
#include <mapnik/grid/grid.hpp>
|
2012-08-15 02:18:44 +02:00
|
|
|
#include <mapnik/grid/grid_marker_helpers.hpp>
|
2012-08-01 04:19:45 +02:00
|
|
|
|
|
|
|
#include <mapnik/debug.hpp>
|
|
|
|
#include <mapnik/geom_util.hpp>
|
2012-03-08 17:37:58 +01:00
|
|
|
#include <mapnik/marker.hpp>
|
2012-07-11 07:32:19 +02:00
|
|
|
#include <mapnik/marker_cache.hpp>
|
|
|
|
#include <mapnik/marker_helpers.hpp>
|
2012-08-28 02:58:49 +02:00
|
|
|
#include <mapnik/svg/svg_renderer_agg.hpp>
|
2012-08-01 04:19:45 +02:00
|
|
|
#include <mapnik/svg/svg_storage.hpp>
|
2011-04-26 23:44:52 +02:00
|
|
|
#include <mapnik/svg/svg_path_adapter.hpp>
|
2012-08-01 04:19:45 +02:00
|
|
|
#include <mapnik/svg/svg_path_attributes.hpp>
|
2013-01-04 03:06:07 +01:00
|
|
|
#include <mapnik/parse_path.hpp>
|
2013-12-09 19:50:00 +01:00
|
|
|
#include <mapnik/renderer_common/process_markers_symbolizer.hpp>
|
2011-04-26 23:44:52 +02:00
|
|
|
|
|
|
|
// agg
|
2012-07-11 07:32:19 +02:00
|
|
|
#include "agg_basics.h"
|
|
|
|
#include "agg_rendering_buffer.h"
|
2011-04-26 23:44:52 +02:00
|
|
|
#include "agg_rasterizer_scanline_aa.h"
|
2012-07-11 07:32:19 +02:00
|
|
|
|
|
|
|
// boost
|
|
|
|
#include <boost/optional.hpp>
|
2011-04-26 23:44:52 +02:00
|
|
|
|
|
|
|
// stl
|
|
|
|
#include <algorithm>
|
2014-06-04 19:05:27 +02:00
|
|
|
#include <tuple>
|
2011-04-26 23:44:52 +02:00
|
|
|
|
|
|
|
namespace mapnik {
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void grid_renderer<T>::process(markers_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-07-07 19:23:15 +02:00
|
|
|
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 detector_type = label_collision_detector4;
|
2011-04-26 23:44:52 +02:00
|
|
|
|
2013-12-09 19:50:00 +01:00
|
|
|
using namespace mapnik::svg;
|
2014-07-07 19:23:15 +02:00
|
|
|
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>;
|
2013-12-09 19:50:00 +01:00
|
|
|
|
|
|
|
buf_type render_buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_);
|
|
|
|
ras_ptr->reset();
|
|
|
|
box2d<double> clip_box = common_.query_extent_;
|
|
|
|
|
2014-06-04 19:05:27 +02:00
|
|
|
auto renderer_context = std::tie(render_buf,*ras_ptr,pixmap_);
|
2014-07-07 19:23:15 +02:00
|
|
|
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>;
|
2014-06-04 19:05:27 +02:00
|
|
|
render_markers_symbolizer<vector_dispatch_type, raster_dispatch_type>(
|
|
|
|
sym, feature, prj_trans, common_, clip_box,renderer_context);
|
2011-04-26 23:44:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template void grid_renderer<grid>::process(markers_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
|