Search in sources :

Example 1 with AbstractNode

use of org.locationtech.jts.index.strtree.AbstractNode in project jts by locationtech.

the class SpatialIndexFunctions method addBounds.

private static void addBounds(Boundable bnd, List bounds, GeometryFactory factory) {
    // don't include bounds of leaf nodes
    if (!(bnd instanceof AbstractNode))
        return;
    Envelope env = (Envelope) bnd.getBounds();
    bounds.add(factory.toGeometry(env));
    if (bnd instanceof AbstractNode) {
        AbstractNode node = (AbstractNode) bnd;
        List children = node.getChildBoundables();
        for (Iterator i = children.iterator(); i.hasNext(); ) {
            Boundable child = (Boundable) i.next();
            addBounds(child, bounds, factory);
        }
    }
}
Also used : AbstractNode(org.locationtech.jts.index.strtree.AbstractNode) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) Boundable(org.locationtech.jts.index.strtree.Boundable) Envelope(org.locationtech.jts.geom.Envelope)

Example 2 with AbstractNode

use of org.locationtech.jts.index.strtree.AbstractNode in project hortonmachine by TheHortonMachine.

the class BoundablePair method expand.

private void expand(Boundable bndComposite, Boundable bndOther, PriorityQueue priQ, double minDistance) {
    List children = ((AbstractNode) bndComposite).getChildBoundables();
    for (Iterator i = children.iterator(); i.hasNext(); ) {
        Boundable child = (Boundable) i.next();
        BoundablePair bp = new BoundablePair(child, bndOther, itemDistance);
        // bndOther)!
        if (bp.getDistance() < minDistance) {
            priQ.add(bp);
        }
    }
}
Also used : AbstractNode(org.locationtech.jts.index.strtree.AbstractNode) Iterator(java.util.Iterator) List(java.util.List) ItemBoundable(org.locationtech.jts.index.strtree.ItemBoundable) Boundable(org.locationtech.jts.index.strtree.Boundable)

Aggregations

Iterator (java.util.Iterator)2 List (java.util.List)2 AbstractNode (org.locationtech.jts.index.strtree.AbstractNode)2 Boundable (org.locationtech.jts.index.strtree.Boundable)2 ArrayList (java.util.ArrayList)1 Envelope (org.locationtech.jts.geom.Envelope)1 ItemBoundable (org.locationtech.jts.index.strtree.ItemBoundable)1