本文整理汇总了C++中proj_transform::equal方法的典型用法代码示例。如果您正苦于以下问题:C++ proj_transform::equal方法的具体用法?C++ proj_transform::equal怎么用?C++ proj_transform::equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类proj_transform
的用法示例。
在下文中一共展示了proj_transform::equal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buf
void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
boost::optional<marker_ptr> mark = marker_cache::instance().find(filename,true);
if (!mark) return;
if (!(*mark)->is_bitmap())
{
MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: Only images (not '" << filename << "') are supported in the line_pattern_symbolizer";
return;
}
boost::optional<image_ptr> pat = (*mark)->get_bitmap_data();
if (!pat) return;
ras_ptr->reset();
agg::trans_affine tr;
evaluate_transform(tr, feature, sym.get_transform());
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag> conv_types;
vertex_converter<box2d<double>, grid_rasterizer, polygon_pattern_symbolizer,
CoordTransform, proj_transform, agg::trans_affine, conv_types>
converter(query_extent_,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_);
if (prj_trans.equal() && sym.clip()) converter.set<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
converter.set<affine_transform_tag>();
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{
converter.apply(geom);
}
}
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
pixfmt_type pixf(buf);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
// render id
ren.color(color_type(feature.id()));
agg::scanline_bin sl;
ras_ptr->filling_rule(agg::fill_even_odd);
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
pixmap_.add_feature(feature);
}
示例2: target_data
void agg_renderer<T>::process(raster_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
raster_ptr const& source = feature.get_raster();
if (source)
{
// If there's a colorizer defined, use it to color the raster in-place
raster_colorizer_ptr colorizer = sym.get_colorizer();
if (colorizer)
colorizer->colorize(source,feature);
box2d<double> target_ext = box2d<double>(source->ext_);
prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS);
box2d<double> ext = t_.forward(target_ext);
int start_x = static_cast<int>(ext.minx());
int start_y = static_cast<int>(ext.miny());
int end_x = static_cast<int>(ceil(ext.maxx()));
int end_y = static_cast<int>(ceil(ext.maxy()));
int raster_width = end_x - start_x;
int raster_height = end_y - start_y;
if (raster_width > 0 && raster_height > 0)
{
image_data_32 target_data(raster_width,raster_height);
raster target(target_ext, target_data);
scaling_method_e scaling_method = sym.get_scaling_method();
double filter_radius = sym.calculate_filter_factor();
double offset_x = ext.minx() - start_x;
double offset_y = ext.miny() - start_y;
if (!prj_trans.equal())
{
reproject_and_scale_raster(target, *source, prj_trans,
offset_x, offset_y,
sym.get_mesh_size(),
filter_radius,
scaling_method);
}
else
{
if (scaling_method == SCALING_BILINEAR8){
scale_image_bilinear8<image_data_32>(target.data_,source->data_, offset_x, offset_y);
} else {
double scaling_ratio = ext.width() / source->data_.width();
scale_image_agg<image_data_32>(target.data_,
source->data_,
scaling_method,
scaling_ratio,
offset_x,
offset_y,
filter_radius);
}
}
composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, true);
}
}
}
示例3: buf
void grid_renderer<T>::process(polygon_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
ras_ptr->reset();
agg::trans_affine tr;
evaluate_transform(tr, feature, sym.get_transform(), scale_factor_);
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
vertex_converter<box2d<double>, grid_rasterizer, polygon_symbolizer,
CoordTransform, proj_transform, agg::trans_affine, conv_types>
converter(query_extent_,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_);
if (prj_trans.equal() && sym.clip()) converter.set<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
converter.set<affine_transform_tag>();
if (sym.simplify_tolerance() > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{
converter.apply(geom);
}
}
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
pixfmt_type pixf(buf);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
// render id
ren.color(color_type(feature.id()));
agg::scanline_bin sl;
ras_ptr->filling_rule(agg::fill_even_odd);
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
pixmap_.add_feature(feature);
}
示例4: guard
void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double simplify_tolerance = get<value_double, keys::simplify_tolerance>(sym, feature, common_.vars_);
value_double smooth = get<value_double, keys::smooth>(sym, feature, common_.vars_);
value_double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform);
cairo_save_restore guard(context_);
context_.set_operator(comp_op);
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance().find(filename,true);
if (!marker || !(*marker)) return;
unsigned offset_x=0;
unsigned offset_y=0;
box2d<double> const& clip_box = clipping_extent(common_);
pattern_alignment_enum alignment = get<pattern_alignment_enum, keys::alignment>(sym, feature, common_.vars_);
if (alignment == LOCAL_ALIGNMENT)
{
double x0 = 0.0;
double y0 = 0.0;
if (feature.num_geometries() > 0)
{
using clipped_geometry_type = agg::conv_clip_polygon<geometry_type>;
using path_type = transform_path_adapter<view_transform,clipped_geometry_type>;
clipped_geometry_type clipped(feature.get_geometry(0));
clipped.clip_box(clip_box.minx(), clip_box.miny(),
clip_box.maxx(), clip_box.maxy());
path_type path(common_.t_, clipped, prj_trans);
path.vertex(&x0, &y0);
}
offset_x = std::abs(clip_box.width() - x0);
offset_y = std::abs(clip_box.height() - y0);
}
if ((*marker)->is_bitmap())
{
cairo_pattern pattern(**((*marker)->get_bitmap_data()), opacity);
pattern.set_extend(CAIRO_EXTEND_REPEAT);
pattern.set_origin(offset_x, offset_y);
context_.set_pattern(pattern);
}
else
{
mapnik::rasterizer ras;
image_ptr image = render_pattern(ras, **marker, image_tr, 1.0); //
cairo_pattern pattern(*image, opacity);
pattern.set_extend(CAIRO_EXTEND_REPEAT);
pattern.set_origin(offset_x, offset_y);
context_.set_pattern(pattern);
}
agg::trans_affine tr;
auto geom_transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (geom_transform) {
evaluate_transform(tr, feature, common_.vars_, *geom_transform, common_.scale_factor_);
}
vertex_converter<cairo_context,clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag>
converter(clip_box, context_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
converter.set<affine_transform_tag>();
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{
converter.apply(geom);
}
}
// fill polygon
context_.set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD);
context_.fill();
}
示例5: guard
void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
composite_mode_e comp_op = get<composite_mode_e, keys::comp_op>(sym, feature, common_.vars_);
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double simplify_tolerance = get<value_double, keys::simplify_tolerance>(sym, feature, common_.vars_);
value_double smooth = get<value_double, keys::smooth>(sym, feature, common_.vars_);
value_double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform);
cairo_save_restore guard(context_);
context_.set_operator(comp_op);
std::shared_ptr<mapnik::marker const> marker = mapnik::marker_cache::instance().find(filename,true);
if (marker->is<mapnik::marker_null>()) return;
unsigned offset_x=0;
unsigned offset_y=0;
box2d<double> const& clip_box = clipping_extent(common_);
pattern_alignment_enum alignment = get<pattern_alignment_enum, keys::alignment>(sym, feature, common_.vars_);
if (alignment == LOCAL_ALIGNMENT)
{
double x0 = 0.0;
double y0 = 0.0;
using apply_local_alignment = detail::apply_local_alignment;
apply_local_alignment apply(common_.t_, prj_trans, clip_box, x0, y0);
util::apply_visitor(geometry::vertex_processor<apply_local_alignment>(apply), feature.get_geometry());
offset_x = std::abs(clip_box.width() - x0);
offset_y = std::abs(clip_box.height() - y0);
}
util::apply_visitor(cairo_renderer_process_visitor_p(context_, image_tr, offset_x, offset_y, opacity), *marker);
agg::trans_affine tr;
auto geom_transform = get_optional<transform_type>(sym, keys::geometry_transform);
if (geom_transform) { evaluate_transform(tr, feature, common_.vars_, *geom_transform, common_.scale_factor_); }
using vertex_converter_type = vertex_converter<
clip_poly_tag,
transform_tag,
affine_transform_tag,
simplify_tag,
smooth_tag>;
vertex_converter_type converter(clip_box,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
converter.set<affine_transform_tag>();
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, cairo_context>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter, context_);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
// fill polygon
context_.set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD);
context_.fill();
}
示例6: buf
void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = get<std::string>(sym, keys::file, feature, common_.vars_);
if (filename.empty()) return;
boost::optional<mapnik::marker_ptr> mark = marker_cache::instance().find(filename, true);
if (!mark) return;
if (!(*mark)->is_bitmap())
{
MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: Only images (not '" << filename << "') are supported in the line_pattern_symbolizer";
return;
}
boost::optional<image_ptr> pat = (*mark)->get_bitmap_data();
if (!pat) return;
ras_ptr->reset();
bool clip = get<value_bool>(sym, keys::clip, feature, common_.vars_, true);
double simplify_tolerance = get<value_double>(sym, keys::simplify_tolerance, feature, common_.vars_, 0.0);
double smooth = get<value_double>(sym, keys::smooth, feature, common_.vars_, false);
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_);
}
using conv_types = boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag>;
vertex_converter<box2d<double>, grid_rasterizer, polygon_pattern_symbolizer,
CoordTransform, proj_transform, agg::trans_affine, conv_types, feature_impl>
converter(common_.query_extent_,*ras_ptr,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
converter.set<affine_transform_tag>();
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
for ( geometry_type & geom : feature.paths())
{
if (geom.size() > 2)
{
converter.apply(geom);
}
}
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using color_type = typename grid_renderer_base_type::pixfmt_type::color_type;
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
grid_rendering_buffer buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_);
pixfmt_type pixf(buf);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
// render id
ren.color(color_type(feature.id()));
agg::scanline_bin sl;
ras_ptr->filling_rule(agg::fill_even_odd);
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
pixmap_.add_feature(feature);
}
示例7: converter
void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
if (filename.empty()) return;
mapnik::marker const& mark = marker_cache::instance().find(filename, true);
if (mark.is<mapnik::marker_null>()) return;
if (!mark.is<mapnik::marker_rgba8>())
{
MAPNIK_LOG_DEBUG(agg_renderer) << "agg_renderer: Only images (not '" << filename << "') are supported in the line_pattern_symbolizer";
return;
}
ras_ptr->reset();
value_bool clip = get<value_bool, keys::clip>(sym, feature, common_.vars_);
value_double simplify_tolerance = get<value_double, keys::simplify_tolerance>(sym, feature, common_.vars_);
value_double smooth = get<value_double, keys::smooth>(sym, feature, common_.vars_);
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_);
}
using vertex_converter_type = vertex_converter<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag>;
vertex_converter_type converter(common_.query_extent_,sym,common_.t_,prj_trans,tr,feature,common_.vars_,common_.scale_factor_);
if (prj_trans.equal() && clip) converter.set<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform
converter.set<affine_transform_tag>();
if (simplify_tolerance > 0.0) converter.set<simplify_tag>(); // optional simplify converter
if (smooth > 0.0) converter.set<smooth_tag>(); // optional smooth converter
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type, grid_rasterizer>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
apply_vertex_converter_type apply(converter, *ras_ptr);
mapnik::util::apply_visitor(vertex_processor_type(apply),feature.get_geometry());
using pixfmt_type = typename grid_renderer_base_type::pixfmt_type;
using color_type = typename grid_renderer_base_type::pixfmt_type::color_type;
using renderer_type = agg::renderer_scanline_bin_solid<grid_renderer_base_type>;
grid_rendering_buffer buf(pixmap_.raw_data(), common_.width_, common_.height_, common_.width_);
pixfmt_type pixf(buf);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
// render id
ren.color(color_type(feature.id()));
agg::scanline_bin sl;
ras_ptr->filling_rule(agg::fill_even_odd);
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
pixmap_.add_feature(feature);
}
示例8: target
void agg_renderer<T>::process(raster_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
raster_ptr const& source = feature.get_raster();
if (source)
{
// If there's a colorizer defined, use it to color the raster in-place
raster_colorizer_ptr colorizer = sym.get_colorizer();
if (colorizer)
colorizer->colorize(source,feature);
box2d<double> target_ext = box2d<double>(source->ext_);
prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS);
box2d<double> ext = t_.forward(target_ext);
int start_x = static_cast<int>(std::floor(ext.minx()+.5));
int start_y = static_cast<int>(std::floor(ext.miny()+.5));
int end_x = static_cast<int>(std::floor(ext.maxx()+.5));
int end_y = static_cast<int>(std::floor(ext.maxy()+.5));
int raster_width = end_x - start_x;
int raster_height = end_y - start_y;
if (raster_width > 0 && raster_height > 0)
{
raster target(target_ext, raster_width,raster_height);
scaling_method_e scaling_method = sym.get_scaling_method();
double filter_radius = sym.calculate_filter_factor();
bool premultiply_source = !source->premultiplied_alpha_;
boost::optional<bool> is_premultiplied = sym.premultiplied();
if (is_premultiplied)
{
if (*is_premultiplied) premultiply_source = false;
else premultiply_source = true;
}
if (premultiply_source)
{
agg::rendering_buffer buffer(source->data_.getBytes(),
source->data_.width(),
source->data_.height(),
source->data_.width() * 4);
agg::pixfmt_rgba32 pixf(buffer);
pixf.premultiply();
}
if (!prj_trans.equal())
{
double offset_x = ext.minx() - start_x;
double offset_y = ext.miny() - start_y;
reproject_and_scale_raster(target, *source, prj_trans,
offset_x, offset_y,
sym.get_mesh_size(),
filter_radius,
scaling_method);
}
else
{
if (scaling_method == SCALING_BILINEAR8)
{
scale_image_bilinear8<image_data_32>(target.data_,
source->data_,
0.0,
0.0);
}
else
{
double image_ratio_x = ext.width() / source->data_.width();
double image_ratio_y = ext.height() / source->data_.height();
scale_image_agg<image_data_32>(target.data_,
source->data_,
scaling_method,
image_ratio_x,
image_ratio_y,
0.0,
0.0,
filter_radius);
}
}
composite(current_buffer_->data(), target.data_,
sym.comp_op(), sym.get_opacity(),
start_x, start_y, false);
}
}
}