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


C++ ConstOsmMapPtr::getNode方法代码示例

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


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

示例1: _calculateStartWayLocation

WayLocation MaximalSubline::_calculateStartWayLocation(const ConstOsmMapPtr& map,
        const ConstWayPtr& a, const ConstWayPtr& b, int indexA, int indexB)
{
    Coordinate ca1 = map->getNode(a->getNodeId(indexA))->toCoordinate();
    Coordinate ca2 = map->getNode(a->getNodeId(indexA + 1))->toCoordinate();
    Coordinate cb1 = map->getNode(b->getNodeId(indexB))->toCoordinate();

    LineSegment lsA(ca1, ca2);
    Coordinate start;
    lsA.closestPoint(cb1, start);

    return LocationOfPoint(map, a).locate(start);
}
开发者ID:giserh,项目名称:hootenanny,代码行数:13,代码来源:MaximalSubline.cpp

示例2: write

void OsmPgCsvWriter::write(ConstOsmMapPtr map)
{
  QList<long> ids;
  //  Start with the nodes
  const NodeMap& nodes = map->getNodes();
  for (NodeMap::const_iterator it = nodes.begin(); it != nodes.end(); ++it)
    ids.append(it->first);
  //  Sort the values to give consistent results.
  qSort(ids.begin(), ids.end(), qLess<long>());
  for (int i = 0; i < ids.size(); i++)
    writePartial(map->getNode(ids[i]));
  //  Next are the ways
  ids.clear();
  const WayMap& ways = map->getWays();
  for (WayMap::const_iterator it = ways.begin(); it != ways.end(); ++it)
    ids.append(it->first);
  //  Sort the values to give consistent results.
  qSort(ids.begin(), ids.end(), qLess<long>());
  for (int i = 0; i < ids.size(); i++)
    writePartial(map->getWay(ids[i]));
  //  Finally the relations
  ids.clear();
  const RelationMap& relations = map->getRelations();
  for (RelationMap::const_iterator it = relations.begin(); it != relations.end(); ++it)
    ids.append(it->first);
  //  Sort the values to give consistent results.
  qSort(ids.begin(), ids.end(), qLess<long>());
  for (int i = 0; i < ids.size(); i++)
    writePartial(map->getRelation(ids[i]));
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例3: cleanWay

void WayCleaner::cleanWay(WayPtr way, const ConstOsmMapPtr& map)
{
  const vector<long> nodeIds = way->getNodeIds();

  if (isZeroLengthWay(way, map))
  {
    throw HootException("Cannot clean zero length way.");
  }

  QList<long> modifiedNodeIds = QVector<long>::fromStdVector(nodeIds).toList();
  QList<long> nodeIdsTemp;
  QList<Coordinate> coords;
  for (size_t i = 0; i < nodeIds.size(); i++)
  {
    bool found = false;
    if (nodeIdsTemp.contains(nodeIds[i]))
    {
      //the only duplicated nodes allowed are the first and last for a closed way
      if (i == (nodeIds.size() - 1) && nodeIds[0] == nodeIds[i])
      {
      }
      else
      {
        found = true;
      }
    }
    else
    {
      nodeIdsTemp.append(nodeIds[i]);
    }

    const Coordinate coord = map->getNode(nodeIds[i])->toCoordinate();
    if (coords.contains(coord))
    {
      //the only duplicated coords allowed are the first and last for a closed way, if the node ID's
      //match
      if (i == (nodeIds.size() - 1) && nodeIds[0] == nodeIds[i])
      {
      }
      else
      {
        found = true;
      }
    }
    else
    {
      coords.append(coord);
    }

    if (found)
    {
      modifiedNodeIds.removeAt(i);
    }
  }

  way->setNodes(modifiedNodeIds.toVector().toStdVector());
}
开发者ID:Nanonid,项目名称:hootenanny,代码行数:57,代码来源:WayCleaner.cpp


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