本文整理汇总了C++中RelationPtr::consolidate方法的典型用法代码示例。如果您正苦于以下问题:C++ RelationPtr::consolidate方法的具体用法?C++ RelationPtr::consolidate怎么用?C++ RelationPtr::consolidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelationPtr
的用法示例。
在下文中一共展示了RelationPtr::consolidate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: consolidateRelations
void Network::consolidateRelations(bool discard_if_missing_reference) {
std::map<unsigned long long int, RelationPtr>::iterator relIt = relations.begin();
//loop through the relations
while (relIt != relations.end()) {
RelationPtr relation = relIt->second;
try {
relation->consolidate(this);
relIt++;
} catch (RefNotFoundException e) {
//the relation references a node, way or relation that doesn't exist
if (discard_if_missing_reference) {
//discard relations referencing this relation
std::map<unsigned long long int, RelationPtr>::iterator relIt2 = relations.begin();
while (relIt2 != relations.end() && relIt2 != relIt) {
if (relIt2->second->contains(relation)) {
relations.erase(relIt2++);
} else {
relIt2++;
}
}
//discard the relation itself
std::map<unsigned long long int, RelationPtr>::iterator rel_to_delete = relIt++;
relations.erase(rel_to_delete);
} else {
relIt++;
}
}
}
}