public void testGet(){
  final double minX=200000.0;
  final double maxX=400000.0;
  final double minY=500000.0;
  final double maxY=700000.0;
  final long nOfEntries=25000;
  final long nOfQueries=25000;
  Random r=new Random(4711);
  double deltaX=maxX - minX;
  double deltaY=maxY - minY;
  log.info("build quadtree, adding " + nOfEntries + " entries...");
  QuadTree<Long> qt=new QuadTree<Long>(minX,minY,maxX,maxY);
  for (long i=0; i < nOfEntries; i++) {
    double x=r.nextDouble() * deltaX + minX;
    double y=r.nextDouble() * deltaY + minY;
    qt.put(x,y,Long.valueOf(i));
  }
  log.info("start get-Queries");
  Gbl.startMeasurement();
  for (long i=0; i < nOfQueries; i++) {
    double x=r.nextDouble() * deltaX + minX;
    double y=r.nextDouble() * deltaY + minY;
    qt.getClosest(x,y);
  }
  Gbl.printElapsedTime();
  log.info("get-Queries ended.");
}

public void testGet ( ) { final double minX = 200000.0 ; final double maxX = 400000.0 ; final double minY = 500000.0 ; final double maxY = 700000.0 ; final long nOfEntries = 25000 ; final long nOfQueries = 25000 ; Random r = new Random ( 4711 ) ; double deltaX = maxX - minX ; double deltaY = maxY - minY ; log . info ( "build quadtree, adding " + nOfEntries + " entries..." ) ; QuadTree < Long > qt = new QuadTree < Long > ( minX , minY , maxX , maxY ) ; for ( long i = 0 ; i < nOfEntries ; i ++ ) { double x = r . nextDouble ( ) * deltaX + minX ; double y = r . nextDouble ( ) * deltaY + minY ; qt . put ( x , y , Long . valueOf ( i ) ) ; } log . info ( "start get-Queries" ) ; Gbl . startMeasurement ( ) ; for ( long i = 0 ; i < nOfQueries ; i ++ ) { double x = r . nextDouble ( ) * deltaX + minX ; double y = r . nextDouble ( ) * deltaY + minY ; qt . getClosest ( x , y ) ; } Gbl . printElapsedTime ( ) ; log . info ( "get-Queries ended." ) ; }
test the performance of getting the nearest objects to a given coordinate in a quadtree with a large number of entries .
