Changeset 8220 in josm
- Timestamp:
- 2015-04-18T15:58:51+02:00 (10 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
r8208 r8220 349 349 .addKeyword("<i>key</i>=", null, tr("matches if ''key'' exists")) 350 350 .addKeyword("<i>key</i>><i>value</i>", null, tr("matches if ''key'' is greater than ''value'' (analogously, less than)")) 351 .addKeyword("\"key\"=\"value\"", "\"\"=\"\"", tr("to quote operators.<br>Within quoted strings the <b>\"</b> and <b>\\</b> characters need to be escaped by a preceding <b>\\</b> (e.g. <b>\\\"</b> and <b>\\\\</b>)."), "\"addr:street\"") 351 352 , GBC.eol()); 352 353 right.add(new SearchKeywordRow(hcbSearchString) … … 357 358 .addKeyword("-<i>expr</i>", null, tr("logical not")) 358 359 .addKeyword("(<i>expr</i>)", "()", tr("use parenthesis to group expressions")) 359 .addKeyword("\"key\"=\"value\"", "\"\"=\"\"", tr("to quote operators.<br>Within quoted strings the <b>\"</b> and <b>\\</b> characters need to be escaped by a preceding <b>\\</b> (e.g. <b>\\\"</b> and <b>\\\\</b>)."), "\"addr:street\"")360 360 , GBC.eol()); 361 361 … … 379 379 right.add(new SearchKeywordRow(hcbSearchString) 380 380 .addTitle(tr("properties")) 381 .addKeyword("nodes:<i>20-</i>", "nodes:", tr("objects with at least 20 nodes")) 381 .addKeyword("nodes:<i>20-</i>", "nodes:", tr("ways with at least 20 nodes, or relations containing at least 20 nodes")) 382 .addKeyword("ways:<i>3-</i>", "ways:", tr("nodes with at least 3 referring ways, or relations containing at least 3 ways")) 382 383 .addKeyword("tags:<i>5-10</i>", "tags:", tr("objects having 5 to 10 tags")) 383 384 .addKeyword("role:", "role:", tr("objects with given role in a relation")) -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r8198 r8220 29 29 import org.openstreetmap.josm.tools.Geometry; 30 30 import org.openstreetmap.josm.tools.Predicate; 31 import org.openstreetmap.josm.tools.Utils; 31 32 import org.openstreetmap.josm.tools.date.DateUtils; 32 33 … … 99 100 public class CoreSimpleMatchFactory implements SimpleMatchFactory { 100 101 private Collection<String> keywords = Arrays.asList("id", "version", 101 "changeset", "nodes", "tags", "areasize", "waylength", "modified", "selected", 102 "changeset", "nodes", "ways", "tags", "areasize", "waylength", "modified", "selected", 102 103 "incomplete", "untagged", "closed", "new", "indownloadedarea", 103 104 "allindownloadedarea", "inview", "allinview", "timestamp", "nth", "nth%"); … … 137 138 case "nodes": 138 139 return new NodeCountRange(tokenizer); 140 case "ways": 141 return new WayCountRange(tokenizer); 139 142 case "tags": 140 143 return new TagCountRange(tokenizer); … … 922 925 @Override 923 926 protected Long getNumber(OsmPrimitive osm) { 924 if (!(osm instanceof Way)) 927 if (osm instanceof Way) { 928 return (long) ((Way) osm).getRealNodesCount(); 929 } else if (osm instanceof Relation) { 930 return (long) ((Relation) osm).getMemberPrimitives(Node.class).size(); 931 } else { 925 932 return null; 926 else 927 return (long) ((Way) osm).getRealNodesCount(); 933 } 928 934 } 929 935 … … 931 937 protected String getString() { 932 938 return "nodes"; 939 } 940 } 941 942 /** 943 * Matches objects with the number of referring/contained ways in the given range 944 */ 945 private static class WayCountRange extends RangeMatch { 946 public WayCountRange(Range range) { 947 super(range); 948 } 949 950 public WayCountRange(PushbackTokenizer tokenizer) throws ParseError { 951 this(tokenizer.readRange(tr("Range of numbers expected"))); 952 } 953 954 @Override 955 protected Long getNumber(OsmPrimitive osm) { 956 if (osm instanceof Way) { 957 return (long) Utils.filteredCollection(osm.getReferrers(), Way.class).size(); 958 } else if (osm instanceof Relation) { 959 return (long) ((Relation) osm).getMemberPrimitives(Way.class).size(); 960 } else { 961 return null; 962 } 963 } 964 965 @Override 966 protected String getString() { 967 return "ways"; 933 968 } 934 969 }
Note:
See TracChangeset
for help on using the changeset viewer.