﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
23830	[PATCH] Slow selection when there is a lot of data	taylor.smock	team	"It turns out that `SelectionManager` iterates through ''all'' nodes and ''all'' ways when we are making a selection.

This is not ideal when working with large datasets.

{{{#!diff
Index: src/org/openstreetmap/josm/gui/SelectionManager.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/gui/SelectionManager.java b/src/org/openstreetmap/josm/gui/SelectionManager.java
--- a/src/org/openstreetmap/josm/gui/SelectionManager.java	(revision 19159)
+++ b/src/org/openstreetmap/josm/gui/SelectionManager.java	(date 1722522201978)
@@ -19,6 +19,7 @@
 
 import org.openstreetmap.josm.actions.SelectByInternalPointAction;
 import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.osm.BBox;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -382,15 +383,16 @@
                 selection.add(osm);
             }
         } else if (ds != null) {
+            final BBox bbox = nc.getLatLonBounds(bounding).toBBox();
             // nodes
-            for (Node n : ds.getNodes()) {
+            for (Node n : ds.searchNodes(bbox)) {
                 if (n.isSelectable() && selectionResult.contains(nc.getPoint2D(n))) {
                     selection.add(n);
                 }
             }
 
             // ways
-            for (Way w : ds.getWays()) {
+            for (Way w : ds.searchWays(bbox)) {
                 if (!w.isSelectable() || w.isEmpty()) {
                     continue;
                 }
}}}"	defect	closed	normal	24.08	Core		fixed		
