本文整理汇总了C++中ren函数的典型用法代码示例。如果您正苦于以下问题:C++ ren函数的具体用法?C++ ren怎么用?C++ ren使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ren函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
bool operator()() const
{
mapnik::Map m(256,256,"+init=epsg:3857");
mapnik::parameters params;
params["type"]="memory";
auto ds = std::make_shared<mapnik::memory_datasource>(params);
// add whitespace to trigger phony "reprojection"
mapnik::layer lay("layer",m.srs() + " ");
lay.set_datasource(ds);
lay.add_style("style");
m.add_layer(lay);
// dummy style to ensure that layer is processed
m.insert_style("style",mapnik::feature_type_style());
// dummy bbox, but "valid" because minx and miny are less
// with an invalid bbox then layer.visible() returns false
// and the initial rendering setup is not run
m.zoom_to_box(mapnik::box2d<double>(-1,-1,0,0));
for (unsigned i=0;i<iterations_;++i)
{
mapnik::image_rgba8 im(256,256);
mapnik::agg_renderer<mapnik::image_rgba8> ren(m,im);
ren.apply();
}
return true;
}
示例2: render
void render(mapnik::geometry_type & geom,
mapnik::box2d<double> const& extent,
std::string const& name)
{
using path_type = mapnik::coord_transform<mapnik::CoordTransform,mapnik::geometry_type>;
using ren_base = agg::renderer_base<agg::pixfmt_rgba32_plain>;
using renderer = agg::renderer_scanline_aa_solid<ren_base>;
mapnik::image_32 im(256,256);
im.set_background(mapnik::color("white"));
mapnik::box2d<double> padded_extent = extent;
padded_extent.pad(10);
mapnik::CoordTransform tr(im.width(),im.height(),padded_extent,0,0);
agg::rendering_buffer buf(im.raw_data(),im.width(),im.height(), im.width() * 4);
agg::pixfmt_rgba32_plain pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
ren.color(agg::rgba8(127,127,127,255));
agg::rasterizer_scanline_aa<> ras;
mapnik::proj_transform prj_trans(mapnik::projection("+init=epsg:4326"),mapnik::projection("+init=epsg:4326"));
geom.rewind(0);
path_type path(tr,geom,prj_trans);
ras.add_path(path);
agg::scanline_u8 sl;
agg::render_scanlines(ras, sl, ren);
mapnik::save_to_file(im,name);
geom.rewind(0);
}
示例3: helper
void grid_renderer<T>::process(text_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
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_);
text_symbolizer_helper helper(
sym, feature, common_.vars_, prj_trans,
common_.width_, common_.height_,
common_.scale_factor_ * (1.0/pixmap_.get_resolution()),
common_.t_, common_.font_manager_, *common_.detector_,
common_.query_extent_, tr);
bool placement_found = false;
composite_mode_e comp_op = get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over);
grid_text_renderer<T> ren(pixmap_,
comp_op,
common_.scale_factor_);
placements_list const& placements = helper.get();
value_integer feature_id = feature.id();
for (glyph_positions_ptr glyphs : placements)
{
ren.render(*glyphs, feature_id);
placement_found = true;
}
if (placement_found)
{
pixmap_.add_feature(feature);
}
}
示例4: main
int main( int argc, char **argv )
{
QApplication app( argc, argv );
#ifndef QSA_NO_IDE
QObject::connect( &app, SIGNAL( lastWindowClosed() ),
&app, SLOT( quit() ) );
QSProject proj( 0, "FilterModules" );
proj.load( "filter.qsa" );
Renderer ren( proj.interpreter() );
proj.addObject( &ren );
ModuleFactory factory;
proj.interpreter()->addObjectFactory( &factory );
QSWorkbench workbench( &proj );
workbench.open();
app.exec();
proj.commitEditorContents();
proj.save( "filter.qsa" );
#else
QMessageBox::information( 0, "Disabled feature",
"QSA Workbench has been disabled. Reconfigure to enable",
QMessageBox::Ok );
#endif
return 0;
}
示例5: MAPNIK_LOG_DEBUG
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);
}
示例6: fill
void fill(Rasterizer *ras, Bitmap<Pixel> *bitmap, BlendOp *blendOp, Filler *filler, float opacity)
{
agg::scanline_pf sl;
ImageBaseRenderer<Filler> baseRen(*bitmap, blendOp, opacity, filler);
Renderer<ImageBaseRenderer<Filler> > ren(baseRen);
renderScanlines(*ras, sl, ren);
}
示例7: render
image_type render(mapnik::Map const & map, double scale_factor) const
{
std::stringstream ss;
std::ostream_iterator<char> output_stream_iterator(ss);
mapnik::svg_renderer<std::ostream_iterator<char>> ren(map, output_stream_iterator, scale_factor);
ren.apply();
return ss.str();
}
示例8: buf
void grid_renderer<T>::render_marker(Feature const& feature, unsigned int step, const int x, const int y, marker &marker, const agg::trans_affine & tr, double opacity)
{
if (marker.is_vector())
{
typedef coord_transform2<CoordTransform,geometry_type> path_type;
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray16 pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
ras_ptr->reset();
box2d<double> const& bbox = (*marker.get_vector_data())->bounding_box();
coord<double,2> c = bbox.center();
// center the svg marker on '0,0'
agg::trans_affine mtx = agg::trans_affine_translation(-c.x,-c.y);
// apply symbol transformation to get to map space
mtx *= tr;
mtx *= agg::trans_affine_scaling(scale_factor_*(1.0/step));
// render the marker at the center of the marker box
mtx.translate(x+0.5 * marker.width(), y+0.5 * marker.height());
vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
svg_path_adapter svg_path(stl_storage);
svg_renderer<svg_path_adapter,
agg::pod_bvector<path_attributes>,
renderer,
mapnik::pixfmt_gray16> svg_renderer(svg_path,
(*marker.get_vector_data())->attributes());
svg_renderer.render_id(*ras_ptr, sl, renb, feature.id(), mtx, opacity, bbox);
}
else
{
image_data_32 const& data = **marker.get_bitmap_data();
if (step == 1 && scale_factor_ == 1.0)
{
pixmap_.set_rectangle(feature.id(), data, x, y);
}
else
{
double ratio = (1.0/step);
image_data_32 target(ratio * data.width(), ratio * data.height());
mapnik::scale_image_agg<image_data_32>(target,data, SCALING_NEAR,
scale_factor_, 0.0, 0.0, 1.0, ratio);
pixmap_.set_rectangle(feature.id(), target, x, y);
}
}
pixmap_.add_feature(feature);
}
示例9: ren
void agg_renderer<T0,T1>::process(group_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
thunk_renderer<buffer_type> ren(*this, ras_ptr, current_buffer_, common_);
render_group_symbolizer(
sym, feature, common_.vars_, prj_trans, clipping_extent(common_), common_,
ren);
}
示例10: ren
void grid_renderer<T>::process(group_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
thunk_renderer<T> ren(*this, *ras_ptr, pixmap_, common_, feature);
render_group_symbolizer(
sym, feature, common_.vars_, prj_trans, common_.query_extent_, common_,
ren);
}
示例11: ren
void cairo_renderer<T>::process(group_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
thunk_renderer<T> ren(*this, context_, face_manager_, common_);
render_group_symbolizer(
sym, feature, common_.vars_, prj_trans, common_.query_extent_, common_,
ren);
}
示例12: do_ren
int do_ren(u8 * _old , u8 * _new){
s8 ret;
if (!check_for_args(REN,2)) return 1;
ret =ren(_old, _new);
if(ret == -1){
vd_puts("CANNOT RENAME THIS FILE\n");
errormessage(geterror());
}
fl_clean();
return 0;
}
示例13: validate
bool validate() const
{
mapnik::Map m(256,256);
mapnik::load_map(m,xml_);
m.zoom_to_box(extent_);
mapnik::image_32 im(m.width(),m.height());
mapnik::agg_renderer<mapnik::image_32> ren(m,im);
ren.apply();
//mapnik::save_to_file(im,"test.png");
return true;
}
示例14: has_key
void agg_renderer<T0,T1>::process(dot_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
double width = 0.0;
double height = 0.0;
bool has_width = has_key(sym,keys::width);
bool has_height = has_key(sym,keys::height);
if (has_width && has_height)
{
width = get<double>(sym, keys::width, feature, common_.vars_, 0.0);
height = get<double>(sym, keys::height, feature, common_.vars_, 0.0);
}
else if (has_width)
{
width = height = get<double>(sym, keys::width, feature, common_.vars_, 0.0);
}
else if (has_height)
{
width = height = get<double>(sym, keys::height, feature, common_.vars_, 0.0);
}
double rx = width/2.0;
double ry = height/2.0;
double opacity = get<double>(sym, keys::opacity, feature, common_.vars_, 1.0);
color const& fill = get<mapnik::color>(sym, keys::fill, feature, common_.vars_, mapnik::color(128,128,128));
ras_ptr->reset();
agg::rendering_buffer buf(current_buffer_->raw_data(),current_buffer_->width(),current_buffer_->height(),current_buffer_->width() * 4);
using blender_type = agg::comp_op_adaptor_rgba_pre<agg::rgba8, agg::order_rgba>;
using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
using renderer_base = agg::renderer_base<pixfmt_comp_type>;
using renderer_type = agg::renderer_scanline_aa_solid<renderer_base>;
pixfmt_comp_type pixf(buf);
pixf.comp_op(static_cast<agg::comp_op_e>(get<composite_mode_e>(sym, keys::comp_op, feature, common_.vars_, src_over)));
renderer_base renb(pixf);
renderer_type ren(renb);
agg::scanline_u8 sl;
ren.color(agg::rgba8_pre(fill.red(), fill.green(), fill.blue(), int(fill.alpha() * opacity)));
agg::ellipse el(0,0,rx,ry);
unsigned num_steps = el.num_steps();
for (geometry_type const& geom : feature.paths()) {
double x,y,z = 0;
unsigned cmd = 1;
geom.rewind(0);
while ((cmd = geom.vertex(&x, &y)) != mapnik::SEG_END) {
if (cmd == SEG_CLOSE) continue;
prj_trans.backward(x,y,z);
common_.t_.forward(&x,&y);
el.init(x,y,rx,ry,num_steps);
ras_ptr->add_path(el);
agg::render_scanlines(*ras_ptr, sl, ren);
}
}
}
示例15: render_layer_for_grid
void render_layer_for_grid(mapnik::Map const& map,
mapnik::grid & grid,
unsigned layer_idx,
boost::python::list const& fields,
double scale_factor,
unsigned offset_x,
unsigned offset_y)
{
std::vector<mapnik::layer> const& layers = map.layers();
std::size_t layer_num = layers.size();
if (layer_idx >= layer_num) {
std::ostringstream s;
s << "Zero-based layer index '" << layer_idx << "' not valid, only '"
<< layer_num << "' layers are in map\n";
throw std::runtime_error(s.str());
}
// convert python list to std::set
boost::python::ssize_t num_fields = boost::python::len(fields);
for(boost::python::ssize_t i=0; i<num_fields; i++) {
boost::python::extract<std::string> name(fields[i]);
if (name.check())
{
grid.add_field(name());
}
else
{
std::stringstream s;
s << "list of field names must be strings";
throw mapnik::value_error(s.str());
}
}
// copy field names
std::set<std::string> attributes = grid.get_fields();
// todo - make this a static constant
std::string known_id_key = "__id__";
if (attributes.find(known_id_key) != attributes.end())
{
attributes.erase(known_id_key);
}
std::string join_field = grid.get_key();
if (known_id_key != join_field &&
attributes.find(join_field) == attributes.end())
{
attributes.insert(join_field);
}
mapnik::grid_renderer<mapnik::grid> ren(map,grid,scale_factor,offset_x,offset_y);
mapnik::layer const& layer = layers[layer_idx];
ren.apply(layer,attributes);
}