Exemplo n.º 1
0
  void queryIndex(Graph g, LocationIndex idx, double lat, double lon, double expectedDist) {
    QueryResult res = idx.findClosest(lat, lon, EdgeFilter.ALL_EDGES);
    if (!res.isValid()) {
      errors.add("node not found for " + lat + "," + lon);
      return;
    }

    GHPoint found = res.getSnappedPoint();
    double dist = distCalc.calcDist(lat, lon, found.lat, found.lon);
    if (Math.abs(dist - expectedDist) > .1) {
      errors.add(
          "queried lat,lon="
              + (float) lat
              + ","
              + (float) lon
              + " (found: "
              + (float) found.lat
              + ","
              + (float) found.lon
              + ")"
              + "\n   expected distance:"
              + expectedDist
              + ", but was:"
              + dist);
    }
  }