• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ point_symbolizer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中point_symbolizer的典型用法代码示例。如果您正苦于以下问题:C++ point_symbolizer类的具体用法?C++ point_symbolizer怎么用?C++ point_symbolizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了point_symbolizer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getstate

 static  boost::python::tuple
 getstate(const point_symbolizer& p)
 {
     return boost::python::make_tuple(p.get_allow_overlap(),
                                      p.get_opacity(),
                                      p.get_ignore_placement(),
                                      p.get_point_placement());
 }
开发者ID:ParveenArora,项目名称:mapnik,代码行数:8,代码来源:mapnik_point_symbolizer.cpp


示例2: operator

 void operator () (point_symbolizer const& sym)
 {
     path_expression_ptr const& filename_expr = sym.get_filename();
     if (filename_expr)
     {
         path_processor_type::collect_attributes(*filename_expr,names_);
     }
     collect_transform(sym.get_image_transform());
     collect_transform(sym.get_transform());
 }
开发者ID:Kotaimen,项目名称:mapnik,代码行数:10,代码来源:attribute_collector.hpp


示例3: getinitargs

 static boost::python::tuple
 getinitargs(const point_symbolizer& p)
 {
    boost::shared_ptr<mapnik::ImageData32> img = p.get_image();
    const std::string & filename = p.get_filename();
    
    if ( ! filename.empty() ) {
        return boost::python::make_tuple(filename,mapnik::guess_type(filename),img->width(),img->height());
    } else {
        return boost::python::make_tuple();
    }
    
 }
开发者ID:craton-,项目名称:php_mapnik,代码行数:13,代码来源:mapnik_point_symbolizer.cpp


示例4: setstate

 static void
 setstate (point_symbolizer& p, boost::python::tuple state)
 {
     using namespace boost::python;
     if (len(state) != 2)
     {
         PyErr_SetObject(PyExc_ValueError,
                         ("expected 2-item tuple in call to __setstate__; got %s"
                          % state).ptr()
             );
         throw_error_already_set();
     }
             
     p.set_allow_overlap(extract<bool>(state[0]));
     p.set_opacity(extract<float>(state[1]));
     
 }
开发者ID:achoch,项目名称:mapnik,代码行数:17,代码来源:mapnik_point_symbolizer.cpp


示例5: int

void agg_renderer<T>::process(point_symbolizer const& sym,
                              Feature const& feature,
                              proj_transform const& prj_trans)
{
    std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature);
    
    boost::optional<mapnik::marker_ptr> marker;
    if ( !filename.empty() )
    {
        marker = marker_cache::instance()->find(filename, true);
    }
    else
    {
        marker.reset(boost::make_shared<mapnik::marker>());
    }

    if (marker)
    {
        for (unsigned i=0; i<feature.num_geometries(); ++i)
        {
            geometry_type const& geom = feature.get_geometry(i);
            double x;
            double y;
            double z=0;
            if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT)
                geom.label_position(&x, &y);
            else
                geom.label_interior_position(&x, &y);

            prj_trans.backward(x,y,z);
            t_.forward(&x,&y);

            int w = (*marker)->width();
            int h = (*marker)->height();

            int px = int(floor(x - 0.5 * w));
            int py = int(floor(y - 0.5 * h));
            box2d<double> label_ext (px, py, px + w, py + h);
            if (sym.get_allow_overlap() ||
                detector_.has_placement(label_ext))
            {
                agg::trans_affine tr;
                boost::array<double,6> const& m = sym.get_transform();
                tr.load_from(&m[0]);

                render_marker(px,py,**marker,tr, sym.get_opacity());

                if (!sym.get_ignore_placement())
                    detector_.insert(label_ext);
                metawriter_with_properties writer = sym.get_metawriter();
                if (writer.first) writer.first->add_box(label_ext, feature, t_, writer.second);
            }
        }
    }

}
开发者ID:makinacorpus,项目名称:mapnik2,代码行数:56,代码来源:process_point_symbolizer.cpp


示例6: getinitargs

 static boost::python::tuple
 getinitargs(const point_symbolizer& p)
 {
     std::string filename = path_processor_type::to_string(*p.get_filename());
     return boost::python::make_tuple(filename,mapnik::guess_type(filename));
 }
开发者ID:achoch,项目名称:mapnik,代码行数:6,代码来源:mapnik_point_symbolizer.cpp


示例7: recenter

void agg_renderer<T>::process(point_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<mapnik::marker_ptr> marker;
    if ( !filename.empty() )
    {
        marker = marker_cache::instance()->find(filename, true);
    }
    else
    {
        marker.reset(boost::make_shared<mapnik::marker>());
    }

    if (marker)
    {
        box2d<double> const& bbox = (*marker)->bounding_box();
        coord2d center = bbox.center();

        agg::trans_affine tr;
        evaluate_transform(tr, feature, sym.get_image_transform());
        agg::trans_affine_translation recenter(-center.x, -center.y);
        agg::trans_affine recenter_tr = recenter * tr;
        box2d<double> label_ext = bbox * recenter_tr;

        for (unsigned i=0; i<feature.num_geometries(); ++i)
        {
            geometry_type const& geom = feature.get_geometry(i);
            double x;
            double y;
            double z=0;
            if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT)
            {
                if (!label::centroid(geom, x, y))
                    return;
            }
            else
            {
                if (!label::interior_position(geom ,x, y))
                    return;
            }

            prj_trans.backward(x,y,z);
            t_.forward(&x,&y);
            label_ext.re_center(x,y);
            if (sym.get_allow_overlap() ||
                detector_->has_placement(label_ext))
            {

                render_marker(pixel_position(x, y),
                              **marker,
                              tr,
                              sym.get_opacity(),
                              sym.comp_op());

                if (!sym.get_ignore_placement())
                    detector_->insert(label_ext);
            }
        }
    }

}
开发者ID:bert,项目名称:mapnik,代码行数:64,代码来源:process_point_symbolizer.cpp


示例8:

void agg_renderer<T>::process(point_symbolizer const& sym,
                              mapnik::feature_ptr const& feature,
                              proj_transform const& prj_trans)
{
    std::string filename = path_processor_type::evaluate(*sym.get_filename(), *feature);

    boost::optional<mapnik::marker_ptr> marker;
    if ( !filename.empty() )
    {
        marker = marker_cache::instance()->find(filename, true);
    }
    else
    {
        marker.reset(boost::make_shared<mapnik::marker>());
    }

    if (marker)
    {
        double w = (*marker)->width();
        double h = (*marker)->height();
        agg::trans_affine tr;
        boost::array<double,6> const& m = sym.get_transform();
        tr.load_from(&m[0]);
        double px0 = - 0.5 * w;
        double py0 = - 0.5 * h;
        double px1 = 0.5 * w;
        double py1 = 0.5 * h;
        double px2 = px1;
        double py2 = py0;
        double px3 = px0;
        double py3 = py1;
        tr.transform(&px0,&py0);
        tr.transform(&px1,&py1);
        tr.transform(&px2,&py2);
        tr.transform(&px3,&py3);
        box2d<double> label_ext (px0, py0, px1, py1);
        label_ext.expand_to_include(px2, py2);
        label_ext.expand_to_include(px3, py3);

        for (unsigned i=0; i<feature->num_geometries(); ++i)
        {
            geometry_type const& geom = feature->get_geometry(i);
            double x;
            double y;
            double z=0;
            if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT)
                geom.label_position(&x, &y);
            else
                geom.label_interior_position(&x, &y);

            prj_trans.backward(x,y,z);
            t_.forward(&x,&y);
            label_ext.re_center(x,y);

            if (sym.get_allow_overlap() ||
                detector_->has_placement(label_ext))
            {

                render_marker(pixel_position(x - 0.5 * w, y - 0.5 * h) ,**marker,tr, sym.get_opacity());

                if (!sym.get_ignore_placement())
                    detector_->insert(label_ext);
                metawriter_with_properties writer = sym.get_metawriter();
                if (writer.first) writer.first->add_box(label_ext, *feature, t_, writer.second);
            }
        }
    }

}
开发者ID:ClaudioFloreani,项目名称:mapnik,代码行数:69,代码来源:process_point_symbolizer.cpp


示例9: buf

void agg_renderer<T>::process(point_symbolizer const& sym,
                              Feature const& feature,
                              proj_transform const& prj_trans)
{
    typedef agg::pixfmt_rgba32 pixfmt;
    typedef agg::renderer_base<pixfmt> renderer_base;
    typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
    
    double x;
    double y;
    double z=0;
    
    std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature);
    boost::optional<mapnik::image_ptr> data;
    
    if (is_svg(filename))
    {
        // SVG  
        using namespace mapnik::svg;
        boost::optional<path_ptr> marker;
        ras_ptr->reset();
        ras_ptr->gamma(agg::gamma_linear());
        agg::scanline_u8 sl;
        agg::rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_ * 4);
        pixfmt pixf(buf);
        renderer_base renb(pixf);
        renderer_solid ren(renb);
        box2d<double> extent;
        
        marker = marker_cache::instance()->find(filename, true);

        if (marker && *marker)
        {
            
            box2d<double> const& bbox = (*marker)->bounding_box();
            double x1 = bbox.minx();
            double y1 = bbox.miny();
            double x2 = bbox.maxx();
            double y2 = bbox.maxy();

            vertex_stl_adapter<svg_path_storage> stl_storage((*marker)->source());
            svg_path_adapter svg_path(stl_storage);
            svg_renderer<svg_path_adapter, 
                         agg::pod_bvector<path_attributes> > svg_renderer(svg_path,
                                                                          (*marker)->attributes());
            
            for (unsigned i=0; i<feature.num_geometries(); ++i)
            {
                geometry2d const& geom = feature.get_geometry(i);  
                geom.label_position(&x,&y);
                prj_trans.backward(x,y,z);
                t_.forward(&x,&y);
                
                agg::trans_affine tr;
                boost::array<double,6> const& m = sym.get_transform();
                tr.load_from(&m[0]);
                tr *= agg::trans_affine_scaling(scale_factor_);
                tr *= agg::trans_affine_translation(x, y);
                
                tr.transform(&x1,&y1);
                tr.transform(&x2,&y2);
                
                extent.init(x1,y1,x2,y2);
                if (sym.get_allow_overlap() ||
                    detector_.has_placement(extent))
                {
                    svg_renderer.render(*ras_ptr, sl, ren, tr, renb.clip_box(), sym.get_opacity());
                    detector_.insert(extent);
                    metawriter_with_properties writer = sym.get_metawriter();
                    if (writer.first)
                    {
                        writer.first->add_box(extent, feature, t_, writer.second);
                    }
                }
            }   
        }
    }
    else
    {
        if ( filename.empty() )
        {
            // default OGC 4x4 black square
            data = boost::optional<mapnik::image_ptr>(new image_data_32(4,4));
            (*data)->set(0xff000000);
        }
        else
        {
            data = mapnik::image_cache::instance()->find(filename,true);    
        }

        if ( data )
        {
            for (unsigned i=0; i<feature.num_geometries(); ++i)
            {
                geometry2d const& geom = feature.get_geometry(i);
                
                geom.label_position(&x,&y);
                prj_trans.backward(x,y,z);
                t_.forward(&x,&y);
                int w = (*data)->width();
//.........这里部分代码省略.........
开发者ID:achoch,项目名称:mapnik,代码行数:101,代码来源:process_point_symbolizer.cpp



注:本文中的point_symbolizer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ point_t类代码示例发布时间:2022-05-31
下一篇:
C++ pointVec_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap