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


C++ taglist_t::get_bool方法代码示例

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


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

示例1: c_filter_basic_tags

/* Go through the given tags and determine the union of flags. Also remove
 * any tags from the list that we don't know about */
unsigned int tagtransform::c_filter_basic_tags(OsmType type, const taglist_t &tags, int *polygon,
                                               int *roads, const export_list &exlist,
                                               taglist_t &out_tags, bool strict)
{
    //assume we dont like this set of tags
    int filter = 1;

    int flags = 0;
    int add_area_tag = 0;

    OsmType export_type;
    if (type == OSMTYPE_RELATION) {
        export_type = OSMTYPE_WAY;
    } else {
        export_type = type;
    }
    const std::vector<taginfo> &infos = exlist.get(export_type);

    /* We used to only go far enough to determine if it's a polygon or not,
       but now we go through and filter stuff we don't need
       pop each tag off and keep it in the temp list if we like it */
    for (taglist_t::const_iterator item = tags.begin(); item != tags.end(); ++item) {
        //if we want to do more than the export list says
        if(!strict) {
            if (type == OSMTYPE_RELATION && "type" == item->key) {
                out_tags.push_back(*item);
                filter = 0;
                continue;
            }
            /* Allow named islands to appear as polygons */
            if ("natural" == item->key && "coastline" == item->value) {
                add_area_tag = 1;

                /* Discard natural=coastline tags (we render these from a shapefile instead) */
                if (!options->keep_coastlines) {
                    continue;
                }
            }
        }

        //go through the actual tags found on the item and keep the ones in the export list
        size_t i = 0;
        for (; i < infos.size(); i++) {
            const taginfo &info = infos[i];
            if (wildMatch(info.name.c_str(), item->key.c_str())) {
                if (info.flags & FLAG_DELETE) {
                    break;
                }

                filter = 0;
                flags |= info.flags;

                out_tags.push_back(*item);
                break;
            }
        }

        // if we didn't find any tags that we wanted to export
        // and we aren't strictly adhering to the list
        if (i == infos.size() && !strict) {
            if (options->hstore_mode != HSTORE_NONE) {
                /* with hstore, copy all tags... */
                out_tags.push_back(*item);
                /* ... but if hstore_match_only is set then don't take this
                 as a reason for keeping the object */
                if (!options->hstore_match_only && "osm_uid" != item->key
                        && "osm_user" != item->key
                        && "osm_timestamp" != item->key
                        && "osm_version" != item->key
                        && "osm_changeset" != item->key)
                    filter = 0;
            } else if (options->hstore_columns.size() > 0) {
                /* does this column match any of the hstore column prefixes? */
                size_t j = 0;
                for(; j < options->hstore_columns.size(); ++j) {
                    size_t pos = item->key.find(options->hstore_columns[j]);
                    if (pos == 0) {
                        out_tags.push_back(*item);
                        /* ... but if hstore_match_only is set then don't take this
                         as a reason for keeping the object */
                        if (!options->hstore_match_only
                                && "osm_uid" != item->key
                                && "osm_user" != item->key
                                && "osm_timestamp" != item->key
                                && "osm_version" != item->key
                                && "osm_changeset" != item->key)
                            filter = 0;
                        break;
                    }
                }
            } 
        }
    }

    if (polygon) {
        if (add_area_tag) {
            /* If we need to force this as a polygon, append an area tag */
            out_tags.push_dedupe(tag("area", "yes"));
//.........这里部分代码省略.........
开发者ID:beemogmbh,项目名称:osm2pgsql,代码行数:101,代码来源:tagtransform.cpp


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