本文整理汇总了C++中taglist_t::get方法的典型用法代码示例。如果您正苦于以下问题:C++ taglist_t::get方法的具体用法?C++ taglist_t::get怎么用?C++ taglist_t::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglist_t
的用法示例。
在下文中一共展示了taglist_t::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: relation_add
int output_pgsql_t::relation_add(osmid_t id, const memberlist_t &members, const taglist_t &tags)
{
const std::string *type = tags.get("type");
/* Must have a type field or we ignore it */
if (!type)
return 0;
/* Only a limited subset of type= is supported, ignore other */
if ( (*type != "route") && (*type != "multipolygon") && (*type != "boundary"))
return 0;
return pgsql_process_relation(id, members, tags, 0);
}
示例2: process_tags
void place_tag_processor::process_tags(const taglist_t &tags)
{
bool placeadmin = false;
bool placehouse = false;
bool placebuilding = false;
const tag_t *place = 0;
const tag_t *junction = 0;
const tag_t *landuse = 0;
bool isnamed = false;
bool isinterpolation = false;
const std::string *house_nr = 0;
const std::string *conscr_nr = 0;
const std::string *street_nr = 0;
clear();
src = &tags;
for (const auto& item: tags) {
if (boost::ends_with(item.key, "source")) {
// ignore
} else if (item.key == "name:prefix" ||
item.key == "name:botanical" ||
boost::ends_with(item.key, "wikidata")) {
extratags.push_back(&item);
} else if (item.key == "ref" ||
item.key == "int_ref" ||
item.key == "nat_ref" ||
item.key == "reg_ref" ||
item.key == "loc_ref" ||
item.key == "old_ref" ||
item.key == "iata" ||
item.key == "icao" ||
item.key == "operator" ||
item.key == "pcode" ||
boost::starts_with(item.key, "pcode:")) {
names.push_back(&item);
} else if (item.key == "name" ||
boost::starts_with(item.key, "name:") ||
item.key == "int_name" ||
boost::starts_with(item.key, "int_name:") ||
item.key == "nat_name" ||
boost::starts_with(item.key, "nat_name:") ||
item.key == "reg_name" ||
boost::starts_with(item.key, "reg_name:") ||
item.key == "loc_name" ||
boost::starts_with(item.key, "loc_name:") ||
item.key == "old_name" ||
boost::starts_with(item.key, "old_name:") ||
item.key == "alt_name" ||
boost::starts_with(item.key, "alt_name:") ||
boost::starts_with(item.key, "alt_name_") ||
item.key == "official_name" ||
boost::starts_with(item.key, "official_name:") ||
item.key == "place_name" ||
boost::starts_with(item.key, "place_name:") ||
item.key == "short_name" ||
boost::starts_with(item.key, "short_name:") ||
item.key == "brand") {
names.push_back(&item);
isnamed = true;
} else if (item.key == "addr:housename") {
names.push_back(&item);
placehouse = true;
} else if (item.key == "emergency") {
if (item.value != "fire_hydrant" &&
item.value != "yes" &&
item.value != "no")
places.push_back(item);
} else if (item.key == "tourism" ||
item.key == "historic" ||
item.key == "military") {
if (item.value != "no" && item.value != "yes")
places.push_back(item);
} else if (item.key == "natural") {
if (item.value != "no" &&
item.value != "yes" &&
item.value != "coastline")
places.push_back(item);
} else if (item.key == "landuse") {
if (item.value == "cemetry")
places.push_back(item);
else
landuse = &item;
} else if (item.key == "highway") {
if (item.value == "footway") {
auto *footway = tags.get("footway");
if (footway == nullptr || *footway != "sidewalk")
places.push_back(item);
} else if (item.value != "no" &&
item.value != "turning_circle" &&
item.value != "mini_roundabout" &&
item.value != "noexit" &&
item.value != "crossing")
places.push_back(item);
} else if (item.key == "railway") {
if (item.value != "level_crossing" &&
item.value != "no")
places.push_back(item);
} else if (item.key == "man_made") {
if (item.value != "survey_point" &&
//.........这里部分代码省略.........
示例3: process_relation
int output_gazetteer_t::process_relation(osmid_t id, const memberlist_t &members,
const taglist_t &tags)
{
const std::string *type = tags.get("type");
if (!type) {
delete_unused_full('R', id);
return 0;
}
int cmp_waterway = type->compare("waterway");
if (*type == "associatedStreet"
|| !(*type == "boundary" || *type == "multipolygon" || !cmp_waterway)) {
delete_unused_full('R', id);
return 0;
}
places.process_tags(tags);
if (m_options.append)
delete_unused_classes('R', id);
/* Are we interested in this item? */
if (!places.has_data())
return 0;
/* get the boundary path (ways) */
idlist_t xid2;
for (const auto& member: members) {
/* only interested in ways */
if (member.type == OSMTYPE_WAY)
xid2.push_back(member.id);
}
if (xid2.empty()) {
if (m_options.append)
delete_unused_full('R', id);
return 0;
}
multitaglist_t xtags;
multinodelist_t xnodes;
idlist_t xid;
m_mid->ways_get_list(xid2, xid, xtags, xnodes);
if (cmp_waterway) {
auto geoms = builder.build_both(xnodes, 1, 1, 1000000, id);
for (const auto& geom: geoms) {
if (geom.is_polygon()) {
places.copy_out('R', id, geom.geom, buffer);
flush_place_buffer();
} else {
/* add_polygon_error('R', id, "boundary", "adminitrative", &names, countrycode, wkt); */
}
}
} else {
/* waterways result in multilinestrings */
auto geom = builder.build_multilines(xnodes, id);
if (geom.valid()) {
places.copy_out('R', id, geom.geom, buffer);
flush_place_buffer();
}
}
return 0;
}
示例4: process_relation
int output_gazetteer_t::process_relation(osmid_t id, const memberlist_t &members,
const taglist_t &tags)
{
const std::string *type = tags.get("type");
if (!type) {
delete_unused_full('R', id);
return 0;
}
int cmp_waterway = type->compare("waterway");
if (*type == "associatedStreet"
|| !(*type == "boundary" || *type == "multipolygon" || !cmp_waterway)) {
delete_unused_full('R', id);
return 0;
}
places.process_tags(tags);
if (m_options.append)
delete_unused_classes('R', id);
/* Are we interested in this item? */
if (!places.has_data())
return 0;
/* get the boundary path (ways) */
idlist_t xid2;
for (memberlist_t::const_iterator it = members.begin(); it != members.end(); ++it) {
/* only interested in ways */
if (it->type == OSMTYPE_WAY)
xid2.push_back(it->id);
}
if (xid2.empty()) {
if (m_options.append)
delete_unused_full('R', id);
return 0;
}
multitaglist_t xtags;
multinodelist_t xnodes;
idlist_t xid;
m_mid->ways_get_list(xid2, xid, xtags, xnodes);
if (cmp_waterway) {
geometry_builder::maybe_wkts_t wkts = builder.build_both(xnodes, 1, 1, 1000000, id);
for (const auto& wkt: *wkts) {
if (boost::starts_with(wkt.geom, "POLYGON")
|| boost::starts_with(wkt.geom, "MULTIPOLYGON")) {
places.copy_out('R', id, wkt.geom, buffer);
flush_place_buffer();
} else {
/* add_polygon_error('R', id, "boundary", "adminitrative", &names, countrycode, wkt); */
}
}
} else {
/* waterways result in multilinestrings */
geometry_builder::maybe_wkt_t wkt = builder.build_multilines(xnodes, id);
if ((wkt->geom).length() > 0) {
places.copy_out('R', id, wkt->geom, buffer);
flush_place_buffer();
}
}
return 0;
}