Changeset 4375 in josm for trunk/src/org
- Timestamp:
- 2011-08-28T14:24:35+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/search
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r4373 r4375 230 230 descriptionText.appendItem(tr("<b>parent <i>expr</i></b> - all parents of objects matching the expression")); 231 231 descriptionText.appendItem(tr("<b>(all)inDownloadedArea</b> - objects (and all its way nodes / relation members) in downloaded area")); 232 descriptionText.appendItem(tr("<b>(all)inView</b> - objects (and all its way nodes / relation members) in current view")); 232 233 descriptionText.appendItem(tr("Use <b>|</b> or <b>OR</b> to combine with logical or")); 233 234 descriptionText.appendItem(tr("Use <b>\"</b> to quote operators (e.g. if key contains <b>:</b>)") -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r4372 r4375 16 16 import org.openstreetmap.josm.actions.search.PushbackTokenizer.Range; 17 17 import org.openstreetmap.josm.actions.search.PushbackTokenizer.Token; 18 import org.openstreetmap.josm.data.Bounds; 18 19 import org.openstreetmap.josm.data.osm.Node; 19 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 724 725 725 726 /** 726 * Matches data in source area ("downloaded area").727 * Matches data within bounds. 727 728 */ 728 private static class InDataSourceArea extends Match { 729 730 private final java.awt.geom.Area dataSourceArea = Main.main.getCurrentDataSet().getDataSourceArea(); 731 private final boolean all; 729 private abstract static class InArea extends Match { 730 731 protected abstract Bounds getBounds(); 732 protected final boolean all; 733 protected final Bounds bounds; 732 734 733 735 /** 734 736 * @param all if true, all way nodes or relation members have to be within source area;if false, one suffices. 735 737 */ 736 public In DataSourceArea(boolean all) {738 public InArea(boolean all) { 737 739 this.all = all; 740 this.bounds = getBounds(); 738 741 } 739 742 … … 743 746 return false; 744 747 } else if (osm instanceof Node) { 745 return dataSourceArea.contains(((Node) osm).getCoor());748 return bounds.contains(((Node) osm).getCoor()); 746 749 } else if (osm instanceof Way) { 747 750 Collection<Node> nodes = ((Way) osm).getNodes(); … … 753 756 return false; 754 757 } 758 } 759 } 760 761 /** 762 * Matches data in source area ("downloaded area"). 763 */ 764 private static class InDataSourceArea extends InArea { 765 766 public InDataSourceArea(boolean all) { 767 super(all); 768 } 769 770 @Override 771 protected Bounds getBounds() { 772 return new Bounds(Main.main.getCurrentDataSet().getDataSourceArea().getBounds2D()); 773 } 774 } 775 776 /** 777 * Matches data in current map view. 778 */ 779 private static class InView extends InArea { 780 781 public InView(boolean all) { 782 super(all); 783 } 784 785 @Override 786 protected Bounds getBounds() { 787 return Main.map.mapView.getRealBounds(); 755 788 } 756 789 } … … 857 890 else if ("allinDownloadedArea".equals(key)) 858 891 return new InDataSourceArea(true); 892 else if ("inView".equals(key)) 893 return new InView(false); 894 else if ("allinView".equals(key)) 895 return new InView(true); 859 896 else 860 897 return new Any(key, regexSearch, caseSensitive);
Note:
See TracChangeset
for help on using the changeset viewer.