use of com.vividsolutions.jts.index.sweepline.SweepLineInterval in project activityinfo by bedatadriven.
the class BatchGeocoder method geocode.
public List<List<AdminEntity>> geocode() {
entities = queryEntities();
// add the entities to the sweep line index
indexEntities();
index.computeOverlaps(new SweepLineOverlapAction() {
@Override
public void overlap(SweepLineInterval s0, SweepLineInterval s1) {
// is this an overlap between a point and and entity?
if (s0.getItem() instanceof Integer && s1.getItem() instanceof AdminEntity) {
checkContains((Integer) s0.getItem(), (AdminEntity) s1.getItem());
} else if (s1.getItem() instanceof Integer && s0.getItem() instanceof AdminEntity) {
checkContains((Integer) s1.getItem(), (AdminEntity) s0.getItem());
}
}
});
return results;
}
use of com.vividsolutions.jts.index.sweepline.SweepLineInterval in project activityinfo by bedatadriven.
the class BatchGeocoder method addPoint.
public void addPoint(double x, double y) {
int pointIndex = points.size();
// add the point to the list
points.add(gf.createPoint(new Coordinate(x, y)));
// index the point
index.add(new SweepLineInterval(x, x, pointIndex));
// add an empty result
results.add(new ArrayList<AdminEntity>());
}
Aggregations