Exemplo n.º 1
0
  public void plotNode(Graphics2D g2, int loc, Color c) {
    double lat = g.getLatitude(loc);
    double lon = g.getLongitude(loc);
    if (lat < bounds.minLat || lat > bounds.maxLat || lon < bounds.minLon || lon > bounds.maxLon)
      return;

    Color old = g2.getColor();
    g2.setColor(c);
    plot(g2, lat, lon, 4);
    g2.setColor(old);
  }
 void testIndex() {
   // query outside
   double qLat = 49.4000;
   double qLon = 9.9690;
   int id = idx.findID(qLat, qLon);
   double foundLat = unterfrankenGraph.getLatitude(id);
   double foundLon = unterfrankenGraph.getLongitude(id);
   double dist = new DistanceCalc().calcDistKm(qLat, qLon, foundLat, foundLon);
   double expectedDist = 5.5892;
   if (Math.abs(dist - expectedDist) > 1e-4)
     System.out.println(
         "ERROR in test index. queried lat,lon="
             + (float) qLat
             + ","
             + (float) qLon
             + ", but was "
             + (float) foundLat
             + ","
             + (float) foundLon
             + "\n   expected distance:"
             + expectedDist
             + ", but was:"
             + dist);
 }