import com.infomatiq.jsi.*;
import com.infomatiq.jsi.rtree.*;
+/** wrapper around the <tt>com.infomatiq.jsi.rtree.RTree</tt> class */
public class RTree<V extends HasBoundingBox> implements Iterable<V> {
private com.infomatiq.jsi.rtree.RTree rtree =
public Iterator<V> iterator() { return vToId.keySet().iterator(); }
- private final MyIntProcedure myIntProcedure = new MyIntProcedure();
+ private final MyIntProcedure myIntProcedure = new MyIntProcedure();
private final com.infomatiq.jsi.Rectangle rect = new com.infomatiq.jsi.Rectangle(0,0,0,0,0,0);
- private final com.infomatiq.jsi.Point point = new com.infomatiq.jsi.Point(0,0,0);
- private V found = null;
+ private final com.infomatiq.jsi.Point point = new com.infomatiq.jsi.Point(0,0,0);
+ private V found = null;
private Visitor<V> visitor = null;
private static final Properties props = new Properties();
rtree.delete(rect, id);
}
- private class MyIntProcedure implements IntProcedure {
- public boolean execute(int id) {
- if (visitor != null) {
- V v = idToV.get(id);
- visitor.visit(v);
- return true;
- } else {
- found = idToV.get(id);
- return false;
- }
- }
- }
-
public V nearest(Point p) {
point.set(p.x, p.y, p.z);
rtree.nearest(point, myIntProcedure, Float.POSITIVE_INFINITY);
visitor = null;
}
+ private class MyIntProcedure implements IntProcedure {
+ public boolean execute(int id) {
+ if (visitor != null) {
+ V v = idToV.get(id);
+ visitor.visit(v);
+ return true;
+ } else {
+ found = idToV.get(id);
+ return false;
+ }
+ }
+ }
}