- Timestamp:
- 2009-08-09T22:43:59+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r1908 r1941 292 292 double minDistanceSq = snapDistance; 293 293 Node minPrimitive = null; 294 for (Node n : getCurrentDataSet().nodes) { 294 DataSet ds = getCurrentDataSet(); 295 if(ds == null) 296 return null; 297 for (Node n : ds.nodes) { 295 298 if (n.deleted || n.incomplete) { 296 299 continue; … … 320 323 public final List<WaySegment> getNearestWaySegments(Point p) { 321 324 TreeMap<Double, List<WaySegment>> nearest = new TreeMap<Double, List<WaySegment>>(); 322 for (Way w : getCurrentDataSet().ways) { 325 DataSet ds = getCurrentDataSet(); 326 if(ds == null) 327 return null; 328 for (Way w : ds.ways) { 323 329 if (w.deleted || w.incomplete) { 324 330 continue; … … 376 382 public final WaySegment getNearestWaySegment(Point p, Collection<WaySegment> ignore) { 377 383 List<WaySegment> nearest = getNearestWaySegments(p); 384 if(nearest == null) 385 return null; 378 386 if (ignore != null) { 379 387 nearest.removeAll(ignore); … … 439 447 public Collection<OsmPrimitive> getAllNearest(Point p) { 440 448 Collection<OsmPrimitive> nearest = new HashSet<OsmPrimitive>(); 441 for (Way w : getCurrentDataSet().ways) { 449 DataSet ds = getCurrentDataSet(); 450 if(ds == null) 451 return null; 452 for (Way w : ds.ways) { 442 453 if (w.deleted || w.incomplete) { 443 454 continue; … … 465 476 } 466 477 } 467 for (Node n : getCurrentDataSet().nodes) {478 for (Node n : ds.nodes) { 468 479 if (!n.deleted && !n.incomplete 469 480 && getPoint(n).distanceSq(p) < snapDistance) { … … 484 495 public Collection<Node> getNearestNodes(Point p) { 485 496 Collection<Node> nearest = new HashSet<Node>(); 486 for (Node n : getCurrentDataSet().nodes) { 497 DataSet ds = getCurrentDataSet(); 498 if(ds == null) 499 return null; 500 for (Node n : ds.nodes) { 487 501 if (!n.deleted && !n.incomplete 488 502 && getPoint(n).distanceSq(p) < snapDistance) {
Note:
See TracChangeset
for help on using the changeset viewer.