コード例 #1
0
void grid_renderer<T>::process(text_symbolizer const& sym,
                               mapnik::feature_impl & feature,
                               proj_transform const& prj_trans)
{
    text_symbolizer_helper<face_manager<freetype_engine>,
        label_collision_detector4> helper(
            sym, feature, prj_trans,
            width_, height_,
            scale_factor_ * (1.0/pixmap_.get_resolution()),
            t_, font_manager_, *detector_,
            query_extent_);
    bool placement_found = false;

    text_renderer<T> ren(pixmap_,
                         font_manager_,
                         sym.get_halo_rasterizer(),
                         sym.comp_op(),
                         scale_factor_);

    while (helper.next()) {
        placement_found = true;
        placements_type const& placements = helper.placements();
        for (unsigned int ii = 0; ii < placements.size(); ++ii)
        {
            ren.prepare_glyphs(placements[ii]);
            ren.render_id(feature.id(), placements[ii].center);
        }
    }
    if (placement_found) pixmap_.add_feature(feature);

}
コード例 #2
0
void agg_renderer<T>::process(text_symbolizer const& sym,
                              mapnik::feature_impl & feature,
                              proj_transform const& prj_trans)
{
    box2d<double> clip_box = clipping_extent();
    text_symbolizer_helper helper(
            sym, feature, prj_trans,
            width_, height_,
            scale_factor_,
            t_, font_manager_, *detector_,
            clip_box);

    agg_text_renderer<T> ren(*current_buffer_, sym.get_halo_rasterizer(), sym.comp_op(), scale_factor_, font_manager_.get_stroker());

    placements_list const& placements = helper.get();
    for (glyph_positions_ptr glyphs : placements)
    {
        ren.render(*glyphs);
    }
}