Changeset 9021 in josm
- Timestamp:
- 2015-11-18T01:39:10+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r8979 r9021 10 10 import java.util.Arrays; 11 11 import java.util.Collection; 12 import java.util.Collections; 12 13 import java.util.HashMap; 13 14 import java.util.List; … … 22 23 import org.openstreetmap.josm.actions.search.PushbackTokenizer.Token; 23 24 import org.openstreetmap.josm.data.Bounds; 25 import org.openstreetmap.josm.data.coor.LatLon; 24 26 import org.openstreetmap.josm.data.osm.Node; 25 27 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 1422 1424 } 1423 1425 1424 protected abstract BoundsgetBounds();1426 protected abstract Collection<Bounds> getBounds(); 1425 1427 1426 1428 @Override … … 1429 1431 return false; 1430 1432 else if (osm instanceof Node) { 1431 Bounds bounds = getBounds(); 1432 return bounds != null && bounds.contains(((Node) osm).getCoor()); 1433 Collection<Bounds> allBounds = getBounds(); 1434 if (allBounds != null) { 1435 LatLon coor = ((Node) osm).getCoor(); 1436 for (Bounds bounds: allBounds) { 1437 if (bounds.contains(coor)) { 1438 return true; 1439 } 1440 } 1441 } 1442 return false; 1433 1443 } else if (osm instanceof Way) { 1434 1444 Collection<Node> nodes = ((Way) osm).getNodes(); … … 1447 1457 public static class InDataSourceArea extends InArea { 1448 1458 1459 /** 1460 * Constructs a new {@code InDataSourceArea}. 1461 * @param all if true, all way nodes or relation members have to be within source area; if false, one suffices. 1462 */ 1449 1463 public InDataSourceArea(boolean all) { 1450 1464 super(all); … … 1452 1466 1453 1467 @Override 1454 protected BoundsgetBounds() {1468 protected Collection<Bounds> getBounds() { 1455 1469 return Main.main.getCurrentDataSet() == null || Main.main.getCurrentDataSet().getDataSourceArea() == null 1456 ? null : new Bounds(Main.main.getCurrentDataSet().getDataSourceArea().getBounds2D());1470 ? null : Main.main.getCurrentDataSet().getDataSourceBounds(); 1457 1471 } 1458 1472 … … 1473 1487 1474 1488 @Override 1475 protected BoundsgetBounds() {1489 protected Collection<Bounds> getBounds() { 1476 1490 if (!Main.isDisplayingMapView()) { 1477 1491 return null; 1478 1492 } 1479 return Main.map.mapView.getRealBounds();1493 return Collections.singleton(Main.map.mapView.getRealBounds()); 1480 1494 } 1481 1495
Note:
See TracChangeset
for help on using the changeset viewer.