本文整理汇总了C++中taglist_t::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ taglist_t::push_back方法的具体用法?C++ taglist_t::push_back怎么用?C++ taglist_t::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglist_t
的用法示例。
在下文中一共展示了taglist_t::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"));
//.........这里部分代码省略.........
示例2: lua_filter_rel_member_tags
unsigned tagtransform::lua_filter_rel_member_tags(const taglist_t &rel_tags,
const multitaglist_t &member_tags, const rolelist_t &member_roles,
int *member_superseeded, int *make_boundary, int *make_polygon, int *roads,
taglist_t &out_tags)
{
lua_getglobal(L, m_rel_mem_func.c_str());
lua_newtable(L); /* relations key value table */
for (taglist_t::const_iterator it = rel_tags.begin(); it != rel_tags.end(); ++it) {
lua_pushstring(L, it->key.c_str());
lua_pushstring(L, it->value.c_str());
lua_rawset(L, -3);
}
lua_newtable(L); /* member tags table */
int idx = 1;
for (multitaglist_t::const_iterator list = member_tags.begin();
list != member_tags.end(); ++list) {
lua_pushnumber(L, idx++);
lua_newtable(L); /* member key value table */
for (taglist_t::const_iterator it = list->begin(); it != list->end(); ++it) {
lua_pushstring(L, it->key.c_str());
lua_pushstring(L, it->value.c_str());
lua_rawset(L, -3);
}
lua_rawset(L, -3);
}
lua_newtable(L); /* member roles table */
for (size_t i = 0; i < member_roles.size(); i++) {
lua_pushnumber(L, i + 1);
lua_pushstring(L, member_roles[i]->c_str());
lua_rawset(L, -3);
}
lua_pushnumber(L, member_roles.size());
if (lua_pcall(L,4,6,0)) {
fprintf(stderr, "Failed to execute lua function for relation tag processing: %s\n", lua_tostring(L, -1));
/* lua function failed */
return 1;
}
*roads = lua_tointeger(L, -1);
lua_pop(L,1);
*make_polygon = lua_tointeger(L, -1);
lua_pop(L,1);
*make_boundary = lua_tointeger(L,-1);
lua_pop(L,1);
lua_pushnil(L);
for (size_t i = 0; i < member_tags.size(); i++) {
if (lua_next(L,-2)) {
member_superseeded[i] = lua_tointeger(L,-1);
lua_pop(L,1);
} else {
fprintf(stderr, "Failed to read member_superseeded from lua function\n");
}
}
lua_pop(L,2);
lua_pushnil(L);
while (lua_next(L,-2) != 0) {
const char *key = lua_tostring(L,-2);
const char *value = lua_tostring(L,-1);
out_tags.push_back(tag(key, value));
lua_pop(L,1);
}
lua_pop(L,1);
int filter = lua_tointeger(L, -1);
lua_pop(L,1);
return filter;
}
示例3: lua_filter_basic_tags
unsigned tagtransform::lua_filter_basic_tags(OsmType type, const taglist_t &tags,
int *polygon, int *roads, taglist_t &out_tags)
{
#ifdef HAVE_LUA
switch (type) {
case OSMTYPE_NODE: {
lua_getglobal(L, m_node_func.c_str());
break;
}
case OSMTYPE_WAY: {
lua_getglobal(L, m_way_func.c_str());
break;
}
case OSMTYPE_RELATION: {
lua_getglobal(L, m_rel_func.c_str());
break;
}
}
lua_newtable(L); /* key value table */
for (taglist_t::const_iterator it = tags.begin(); it != tags.end(); ++it) {
lua_pushstring(L, it->key.c_str());
lua_pushstring(L, it->value.c_str());
lua_rawset(L, -3);
}
lua_pushinteger(L, tags.size());
if (lua_pcall(L,2,type == OSMTYPE_WAY ? 4 : 2,0)) {
fprintf(stderr, "Failed to execute lua function for basic tag processing: %s\n", lua_tostring(L, -1));
/* lua function failed */
return 1;
}
if (type == OSMTYPE_WAY) {
assert(roads);
*roads = lua_tointeger(L, -1);
lua_pop(L,1);
assert(polygon);
*polygon = lua_tointeger(L, -1);
lua_pop(L,1);
}
lua_pushnil(L);
while (lua_next(L,-2) != 0) {
const char *key = lua_tostring(L,-2);
const char *value = lua_tostring(L,-1);
out_tags.push_back(tag(key, value));
lua_pop(L,1);
}
int filter = lua_tointeger(L, -2);
lua_pop(L,2);
return filter;
#else
return 1;
#endif
}
示例4: filter_rel_member_tags
unsigned lua_tagtransform_t::filter_rel_member_tags(
taglist_t const &rel_tags, multitaglist_t const &members_tags,
rolelist_t const &member_roles, int *member_superseded, int *make_boundary,
int *make_polygon, int *roads, export_list const &, taglist_t &out_tags,
bool)
{
lua_getglobal(L, m_rel_mem_func.c_str());
lua_newtable(L); /* relations key value table */
for (const auto &rel_tag : rel_tags) {
lua_pushstring(L, rel_tag.key.c_str());
lua_pushstring(L, rel_tag.value.c_str());
lua_rawset(L, -3);
}
lua_newtable(L); /* member tags table */
int idx = 1;
for (const auto &member_tags : members_tags) {
lua_pushnumber(L, idx++);
lua_newtable(L); /* member key value table */
for (const auto &member_tag : member_tags) {
lua_pushstring(L, member_tag.key.c_str());
lua_pushstring(L, member_tag.value.c_str());
lua_rawset(L, -3);
}
lua_rawset(L, -3);
}
lua_newtable(L); /* member roles table */
for (size_t i = 0; i < member_roles.size(); i++) {
lua_pushnumber(L, i + 1);
lua_pushstring(L, member_roles[i]);
lua_rawset(L, -3);
}
lua_pushnumber(L, member_roles.size());
if (lua_pcall(L, 4, 6, 0)) {
fprintf(
stderr,
"Failed to execute lua function for relation tag processing: %s\n",
lua_tostring(L, -1));
/* lua function failed */
return 1;
}
*roads = (int)lua_tointeger(L, -1);
lua_pop(L, 1);
*make_polygon = (int)lua_tointeger(L, -1);
lua_pop(L, 1);
*make_boundary = (int)lua_tointeger(L, -1);
lua_pop(L, 1);
lua_pushnil(L);
for (size_t i = 0; i < members_tags.size(); i++) {
if (lua_next(L, -2)) {
member_superseded[i] = (int)lua_tointeger(L, -1);
lua_pop(L, 1);
} else {
fprintf(stderr,
"Failed to read member_superseded from lua function\n");
}
}
lua_pop(L, 2);
lua_pushnil(L);
while (lua_next(L, -2) != 0) {
const char *key = lua_tostring(L, -2);
const char *value = lua_tostring(L, -1);
out_tags.push_back(tag_t(key, value));
lua_pop(L, 1);
}
lua_pop(L, 1);
unsigned filter = (unsigned)lua_tointeger(L, -1);
lua_pop(L, 1);
return filter;
}