コード例 #1
0
ファイル: WayCleaner.cpp プロジェクト: Nanonid/hootenanny
bool WayCleaner::hasDuplicateCoords(ConstWayPtr way, const OsmMap& map, const bool logDetails)
{
  const vector<long> nodeIds = way->getNodeIds();

  if (nodeIds.size() == 2 &&
      map.getNode(nodeIds.at(0))->toCoordinate() == map.getNode(nodeIds.at(1))->toCoordinate())
  {
    if (logDetails)
    {
      LOG_WARN(
        "Duplicate coordinate " << map.getNode(nodeIds.at(0))->toCoordinate() <<
        " for node with ID:'s " << nodeIds[0] << " and " << nodeIds[1] <<
        " found at indexes 0 and 1; For way with ID: " << way->getElementId().getId());
      LOG_VARW(nodeIds);
    }
    return true;
  }

  bool found = false;
  QList<Coordinate> coords;
  for (size_t i = 0; i < nodeIds.size(); 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])
      {
        found = false;
      }
      else
      {
        found = true;
      }
      if (found)
      {
        if (logDetails)
        {
          LOG_WARN(
            "Duplicate coord " << map.getNode(nodeIds[i])->toCoordinate() << " for node with ID: " <<
            nodeIds[i] << " found at index: " << i << " For way with ID: " << way->getElementId().getId());
          LOG_VARW(nodeIds);
        }
        return found;
      }
    }
    else
    {
      coords.append(coord);
    }
  }
  return found;
}
コード例 #2
0
ファイル: Node.cpp プロジェクト: drew-bower/hootenanny
void Node::visitRo(const OsmMap& map, ElementVisitor& filter) const
{
  filter.visit(map.getNode(getId()));
}
コード例 #3
0
ファイル: Node.cpp プロジェクト: drew-bower/hootenanny
void Node::visitRw(OsmMap& map, ElementVisitor& filter)
{
  filter.visit(map.getNode(getId()));
}