Changeset 422 in josm for trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
- Timestamp:
- 2007-10-25T22:54:01+02:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r407 r422 291 291 292 292 /** 293 * @return A list of all nodes that are nearest to 294 * the mouse. Does a simple sequential scan on all the data. 295 * 296 * @return A collection of all nodes or <code>null</code> 297 * if no node under or near the point. The returned 298 * list is never empty. 299 */ 300 public Collection<Node> getNearestNodes(Point p) { 301 Collection<Node> nearest = new HashSet<Node>(); 302 for (Node n : Main.ds.nodes) { 303 if (!n.deleted && !n.incomplete 304 && getPoint(n.eastNorth).distanceSq(p) < 100) { 305 nearest.add(n); 306 } 307 } 308 return nearest.isEmpty() ? null : nearest; 309 } 310 311 /** 312 * @return the nearest nodes to the screen point given that is not 313 * in ignore. 314 * 315 * @param p the point for which to search the nearest segment. 316 * @param ignore a collection of nodes which are not to be returned. 317 * May be null. 318 */ 319 public final Collection<Node> getNearestNodes(Point p, Collection<Node> ignore) { 320 Collection<Node> nearest = getNearestNodes(p); 321 if (nearest == null) return null; 322 if (ignore != null) nearest.removeAll(ignore); 323 return nearest.isEmpty() ? null : nearest; 324 } 325 326 /** 293 327 * @return The projection to be used in calculating stuff. 294 328 */
Note:
See TracChangeset
for help on using the changeset viewer.
