Ticket #20514: 20514.quadbuckets.patch

File 20514.quadbuckets.patch, 1.3 KB (added by GerdP, 4 years ago)
  • src/org/openstreetmap/josm/data/osm/QuadBucketPrimitiveStore.java

     
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.osm;
    33
    4 import java.util.ArrayList;
    5 import java.util.Collection;
    64import java.util.List;
    75import java.util.function.Consumer;
    8 import java.util.stream.Collectors;
    96
    107import org.openstreetmap.josm.tools.JosmRuntimeException;
    118
     
    3633    /**
    3734     * All relations/relationships
    3835     */
    39     private final Collection<R> relations = new ArrayList<>();
     36    private final QuadBuckets<R> relations = new QuadBuckets<>();
    4037
    4138    /**
    4239     * Searches for nodes in the given bounding box.
     
    8077     * @return List of relations in the given bbox. Can be empty but not null
    8178     */
    8279    public List<R> searchRelations(BBox bbox) {
    83         // QuadBuckets might be useful here (don't forget to do reindexing after some of rm is changed)
    84         return relations.stream()
    85                 .filter(r -> r.getBBox().intersects(bbox))
    86                 .collect(Collectors.toList());
     80        return relations.search(bbox);
    8781    }
    8882
    8983    /**