_lonStep = b.getMaxLon() - b.getMinLon();
}
public void add(double lat, double lon, T element) {
STRtree tree = null;
for (Map.Entry<CoordinateBounds, STRtree> entry : _treesByBounds.entrySet()) {
CoordinateBounds bounds = entry.getKey();
if (bounds.contains(lat, lon)) {
tree = entry.getValue();
break;
}
}
if (tree == null) {
double gLat = Math.floor(lat / _latStep) * _latStep;
double gLon = Math.floor(lon / _lonStep) * _lonStep;
CoordinateBounds b = new CoordinateBounds(gLat, gLon, gLat + _latStep,
gLon + _lonStep);
tree = new STRtree();
_treesByBounds.put(b, tree);
}
Envelope env = new Envelope(lon, lon, lat, lat);
tree.insert(env, element);
}