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


C++ xml_node::has_attribute方法代码示例

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


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

示例1: text_properties_from_xml

void text_symbolizer_properties::text_properties_from_xml(xml_node const& node)
{
    // The options 'margin' and 'repeat-distance' replace 'minimum-distance'.
    // Only allow one or the other to be defined here.
    if (node.has_attribute("margin") || node.has_attribute("repeat-distance"))
    {
        if (node.has_attribute("minimum-distance"))
        {
            throw config_error(std::string("Cannot use deprecated option minimum-distance with "
                                           "new options margin and repeat-distance."));
        }
        set_property_from_xml<value_double>(expressions.margin, "margin", node);
        set_property_from_xml<value_double>(expressions.repeat_distance, "repeat-distance", node);
    }
    else
    {
        set_property_from_xml<value_double>(expressions.minimum_distance, "minimum-distance", node);
    }
    set_property_from_xml<label_placement_e>(expressions.label_placement, "placement", node);
    set_property_from_xml<value_double>(expressions.label_spacing, "spacing", node);
    set_property_from_xml<value_double>(expressions.label_position_tolerance, "label-position-tolerance", node);
    set_property_from_xml<value_double>(expressions.minimum_padding, "minimum-padding", node);
    set_property_from_xml<value_double>(expressions.minimum_path_length, "minimum-path-length", node);
    set_property_from_xml<boolean_type>(expressions.avoid_edges, "avoid-edges", node);
    set_property_from_xml<boolean_type>(expressions.allow_overlap, "allow-overlap", node);
    set_property_from_xml<boolean_type>(expressions.largest_bbox_only, "largest-bbox-only", node);
    set_property_from_xml<value_double>(expressions.max_char_angle_delta, "max-char-angle-delta", node);
    set_property_from_xml<text_upright_e>(expressions.upright, "upright", node);
}
开发者ID:jakhaf,项目名称:mapnik,代码行数:29,代码来源:text_properties.cpp

示例2: set_symbolizer_property

void set_symbolizer_property(Symbolizer & sym, keys key, xml_node const& node)
{
    std::string const& name = std::get<0>(get_meta(key));
    if (node.has_attribute(name)) {
        detail::set_symbolizer_property_impl<Symbolizer,T, std::is_enum<T>::value>::apply(sym,key,name,node);
    }
}
开发者ID:CartoDB,项目名称:mapnik,代码行数:7,代码来源:symbolizer_utils.hpp

示例3: from_xml

node_ptr layout_node::from_xml(xml_node const& xml, fontset_map const& fontsets)
{
    auto n = std::make_shared<layout_node>();
    node_ptr child = node::from_xml(xml, fontsets);
    n->set_child(child);

    if (xml.has_attribute("dx")) set_property_from_xml<double>(n->dx, "dx", xml);
    if (xml.has_attribute("dy")) set_property_from_xml<double>(n->dy, "dy", xml);
    if (xml.has_attribute("text-ratio")) set_property_from_xml<double>(n->text_ratio, "text-ratio", xml);
    if (xml.has_attribute("wrap-width")) set_property_from_xml<double>(n->wrap_width, "wrap-width", xml);
    if (xml.has_attribute("wrap-character")) set_property_from_xml<std::string>(n->wrap_char, "wrap-character", xml);
    if (xml.has_attribute("wrap-before")) set_property_from_xml<mapnik::value_bool>(n->wrap_before, "wrap-before", xml);
    if (xml.has_attribute("repeat-wrap-character")) set_property_from_xml<mapnik::value_bool>(n->repeat_wrap_char, "repeat-wrap-character", xml);
    if (xml.has_attribute("rotate-displacement")) set_property_from_xml<mapnik::value_bool>(n->rotate_displacement, "rotate-displacement", xml);
    if (xml.has_attribute("orientation")) set_property_from_xml<double>(n->orientation, "orientation", xml);
    if (xml.has_attribute("horizontal-alignment")) set_property_from_xml<horizontal_alignment_e>(n->halign, "horizontal-alignment", xml);
    if (xml.has_attribute("vertical-alignment")) set_property_from_xml<vertical_alignment_e>(n->valign, "vertical-alignment", xml);
    if (xml.has_attribute("justify-alignment")) set_property_from_xml<justify_alignment_e>(n->jalign, "justify-alignment", xml);
    return n;
}
开发者ID:mapycz,项目名称:mapnik,代码行数:20,代码来源:layout.cpp


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