Changeset 19167 in josm for trunk/src


Ignore:
Timestamp:
2024-08-05T21:18:00+02:00 (3 months ago)
Author:
taylor.smock
Message:

Fix #23830: Slow selection when there is a lot of data

We were previously iterating through all nodes and ways when making a selection.
We don't have to do that since we have a way to efficiently find objects in a
bbox.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/SelectionManager.java

    r19050 r19167  
    2020import org.openstreetmap.josm.actions.SelectByInternalPointAction;
    2121import org.openstreetmap.josm.data.Bounds;
     22import org.openstreetmap.josm.data.osm.BBox;
    2223import org.openstreetmap.josm.data.osm.DataSet;
    2324import org.openstreetmap.josm.data.osm.Node;
     
    383384            }
    384385        } else if (ds != null) {
     386            final BBox bbox = nc.getLatLonBounds(bounding).toBBox();
    385387            // nodes
    386             for (Node n : ds.getNodes()) {
     388            for (Node n : ds.searchNodes(bbox)) {
    387389                if (n.isSelectable() && selectionResult.contains(nc.getPoint2D(n))) {
    388390                    selection.add(n);
     
    391393
    392394            // ways
    393             for (Way w : ds.getWays()) {
     395            for (Way w : ds.searchWays(bbox)) {
    394396                if (!w.isSelectable() || w.isEmpty()) {
    395397                    continue;
Note: See TracChangeset for help on using the changeset viewer.