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


C++ OsmMapPtr::containsElement方法代码示例

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


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

示例1: apply

void PoiPolygonMerger::apply(const OsmMapPtr& map,
  vector< pair<ElementId, ElementId> >& replaced) const
{
  ////
  // See "Hootenanny - POI to Building" powerpoint for more details.
  ////

  // merge all POI tags first, but keep Unknown1 and Unknown2 separate. It is implicitly assumed
  // that since they're in a single group they all represent the same entity.
  Tags poiTags1 = _mergePoiTags(map, Status::Unknown1);
  Tags poiTags2 = _mergePoiTags(map, Status::Unknown2);

  // Get all the building parts for each status
  vector<ElementId> buildings1 = _getBuildingParts(map, Status::Unknown1);
  vector<ElementId> buildings2 = _getBuildingParts(map, Status::Unknown2);

  // Merge all the building parts together into a single building entity using the typical building
  // merge process.
  ElementId finalBuildingEid = _mergeBuildings(map, buildings1, buildings2, replaced);

  ElementPtr finalBuilding = map->getElement(finalBuildingEid);

  Tags finalBuildingTags = finalBuilding->getTags();
  if (poiTags1.size())
  {
    finalBuildingTags = TagMergerFactory::getInstance().mergeTags(poiTags1, finalBuildingTags,
      finalBuilding->getElementType());
  }
  if (poiTags2.size())
  {
    finalBuildingTags = TagMergerFactory::getInstance().mergeTags(finalBuildingTags,
      poiTags2, finalBuilding->getElementType());
  }
  finalBuilding->setTags(finalBuildingTags);

  // do some book keeping to remove the POIs and mark them as replaced.
  for (set< pair<ElementId, ElementId> >::const_iterator it = _pairs.begin(); it != _pairs.end();
       ++it)
  {
    const pair<ElementId, ElementId>& p = *it;
    if (p.first.getType() == ElementType::Node)
    {
      replaced.push_back(pair<ElementId, ElementId>(p.first, finalBuildingEid));
      // clear the tags just in case it is part of a way
      if (map->containsElement(p.first))
      {
        map->getElement(p.first)->getTags().clear();
        RecursiveElementRemover(p.first).apply(map);
      }
    }

    if (p.second.getType() == ElementType::Node)
    {
      replaced.push_back(pair<ElementId, ElementId>(p.second, finalBuildingEid));
      // clear the tags just in case it is part of a way
      if (map->containsElement(p.second))
      {
        map->getElement(p.second)->getTags().clear();
        RecursiveElementRemover(p.second).apply(map);
      }
    }
  }
}
开发者ID:mitulvpatel,项目名称:hootenanny,代码行数:63,代码来源:PoiPolygonMerger.cpp


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