Search in sources :

Example 1 with SweepLineOverlapAction

use of com.vividsolutions.jts.index.sweepline.SweepLineOverlapAction 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;
}
Also used : AdminEntity(org.activityinfo.server.database.hibernate.entity.AdminEntity) SweepLineOverlapAction(com.vividsolutions.jts.index.sweepline.SweepLineOverlapAction) SweepLineInterval(com.vividsolutions.jts.index.sweepline.SweepLineInterval)

Aggregations

SweepLineInterval (com.vividsolutions.jts.index.sweepline.SweepLineInterval)1 SweepLineOverlapAction (com.vividsolutions.jts.index.sweepline.SweepLineOverlapAction)1 AdminEntity (org.activityinfo.server.database.hibernate.entity.AdminEntity)1