当前位置: 首页>>代码示例>>C++>>正文


C++ Attr::push_back方法代码示例

本文整理汇总了C++中Attr::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Attr::push_back方法的具体用法?C++ Attr::push_back怎么用?C++ Attr::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attr的用法示例。


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

示例1: push_explicit_style

bool push_explicit_style(Attr const& src, Attr & dst, markers_symbolizer const& sym)
{
    boost::optional<stroke> const& strk = sym.get_stroke();
    boost::optional<color> const& fill = sym.get_fill();
    if (strk || fill)
    {
        for(unsigned i = 0; i < src.size(); ++i)
        {
            mapnik::svg::path_attributes attr = src[i];

            if (strk)
            {
                attr.stroke_flag = true;
                attr.stroke_width = strk->get_width();
                color const& s_color = strk->get_color();
                attr.stroke_color = agg::rgba(s_color.red()/255.0,s_color.green()/255.0,
                                              s_color.blue()/255.0,(s_color.alpha()*strk->get_opacity())/255.0);
            }
            if (fill)
            {

                attr.fill_flag = true;
                color const& f_color = *fill;
                attr.fill_color = agg::rgba(f_color.red()/255.0,f_color.green()/255.0,
                                            f_color.blue()/255.0,(f_color.alpha()*sym.get_opacity())/255.0);
            }
            dst.push_back(attr);
        }
        return true;
    }
    return false;
}
开发者ID:rjw57,项目名称:mapnik,代码行数:32,代码来源:marker_helpers.hpp

示例2: push_explicit_style

bool push_explicit_style(Attr const& src, Attr & dst, markers_symbolizer const& sym)
{
    boost::optional<stroke> const& strk = sym.get_stroke();
    boost::optional<color> const& fill = sym.get_fill();
    boost::optional<float> const& fill_opacity = sym.get_fill_opacity();
    if (strk || fill || fill_opacity)
    {
        bool success = false;
        for(unsigned i = 0; i < src.size(); ++i)
        {
            success = true;
            dst.push_back(src[i]);
            mapnik::svg::path_attributes & attr = dst.last();
            if (attr.stroke_flag)
            {
                // TODO - stroke attributes need to be boost::optional
                // for this to work properly
                if (strk)
                {
                    attr.stroke_width = strk->get_width();
                    color const& s_color = strk->get_color();
                    attr.stroke_color = agg::rgba(s_color.red()/255.0,
                                                  s_color.green()/255.0,
                                                  s_color.blue()/255.0,
                                                  s_color.alpha()/255.0);
                    attr.stroke_opacity = strk->get_opacity();
                }
            }
            if (attr.fill_flag)
            {
                if (fill)
                {
                    color const& f_color = *fill;
                    attr.fill_color = agg::rgba(f_color.red()/255.0,
                                                f_color.green()/255.0,
                                                f_color.blue()/255.0,
                                                f_color.alpha()/255.0);
                }
                if (fill_opacity)
                {
                    attr.fill_opacity = *fill_opacity;
                }
            }
        }
        return success;
    }
    return false;
}
开发者ID:LeadsPlus,项目名称:mapnik,代码行数:48,代码来源:marker_helpers.hpp

示例3: push_explicit_style

bool push_explicit_style(Attr const& src, Attr & dst,
                         markers_symbolizer const& sym,
                         feature_impl & feature,
                         attributes const& vars)
{
    auto fill_color = get_optional<color>(sym, keys::fill, feature, vars);
    auto fill_opacity = get_optional<double>(sym, keys::fill_opacity, feature, vars);
    auto stroke_color = get_optional<color>(sym, keys::stroke, feature, vars);
    auto stroke_width = get_optional<double>(sym, keys::stroke_width, feature, vars);
    auto stroke_opacity = get_optional<double>(sym, keys::stroke_opacity, feature, vars);
    if (fill_color ||
        fill_opacity ||
        stroke_color ||
        stroke_width ||
        stroke_opacity)
    {
        bool success = false;
        for(unsigned i = 0; i < src.size(); ++i)
        {
            success = true;
            dst.push_back(src[i]);
            mapnik::svg::path_attributes & attr = dst.last();
            if (attr.stroke_flag)
            {
                if (stroke_width)
                {
                    attr.stroke_width = *stroke_width;
                }
                if (stroke_color)
                {
                    color const& s_color = *stroke_color;
                    attr.stroke_color = agg::rgba(s_color.red()/255.0,
                                                  s_color.green()/255.0,
                                                  s_color.blue()/255.0,
                                                  s_color.alpha()/255.0);
                }
                if (stroke_opacity)
                {
                    attr.stroke_opacity = *stroke_opacity;
                }
            }
            if (attr.fill_flag)
            {
                if (fill_color)
                {
                    color const& f_color = *fill_color;
                    attr.fill_color = agg::rgba(f_color.red()/255.0,
                                                f_color.green()/255.0,
                                                f_color.blue()/255.0,
                                                f_color.alpha()/255.0);
                }
                if (fill_opacity)
                {
                    attr.fill_opacity = *fill_opacity;
                }
            }
        }
        return success;
    }
    return false;
}
开发者ID:eponymous1968,项目名称:mapnik,代码行数:61,代码来源:marker_helpers.hpp


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