Changeset 34661 in osm for applications
- Timestamp:
- 2018-09-15T14:58:07+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataTask.java
r34608 r34661 61 61 @Override 62 62 public String[] getPatterns() { 63 String pattern = "";63 StringBuilder pattern = new StringBuilder(); 64 64 for (String ext : NetworkReader.FILE_AND_ARCHIVE_READERS.keySet()) { 65 if ( !pattern.isEmpty()) {66 pattern += "|";65 if (pattern.length() > 0) { 66 pattern.append('|'); 67 67 } 68 pattern += "."+ext;68 pattern.append('.').append(ext); 69 69 } 70 70 return new String[]{".*(" + pattern + ")"}; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/SimpleDataSetHandler.java
r34646 r34661 160 160 } 161 161 162 protected String getOverpassApiQueries(String bbox, String 162 protected String getOverpassApiQueries(String bbox, String... conditions) { 163 163 String[] mpconditions = new String[conditions.length+1]; 164 164 mpconditions[0] = OverpassApi.hasKey("type", "multipolygon"); … … 177 177 @Override 178 178 protected String getOverpassApiRequest(String bbox) { 179 String result = "";179 StringBuilder result = new StringBuilder(); 180 180 if (this.relevantUnion) { 181 181 for (Tag tag : this.relevantTags) { 182 result += getOverpassApiQueries(bbox, OverpassApi.hasKey(tag.getKey(), tag.getValue()));182 result.append(getOverpassApiQueries(bbox, OverpassApi.hasKey(tag.getKey(), tag.getValue()))); 183 183 } 184 184 result = OverpassApi.union(result); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/OverpassApi.java
r33245 r34661 43 43 } 44 44 45 public static final String union(String... queries) {46 String result = "<union>\n";47 for ( Stringquery : queries) {45 public static final StringBuilder union(CharSequence... queries) { 46 StringBuilder result = new StringBuilder("<union>\n"); 47 for (CharSequence query : queries) { 48 48 if (query != null) { 49 result += query + "\n";49 result.append(query).append('\n'); 50 50 } 51 51 } 52 result += "</union>";52 result.append("</union>"); 53 53 return result; 54 54 } 55 55 56 public static final String query(String bbox, OaQueryType type, String... conditions) {57 String result = "<query type=\""+type+"\" >\n";56 public static final StringBuilder query(String bbox, OaQueryType type, CharSequence... conditions) { 57 StringBuilder result = new StringBuilder("<query type=\"").append(type).append("\" >\n"); 58 58 if (bbox != null) { 59 result += "<bbox-query "+bbox+"/>\n";59 result.append("<bbox-query ").append(bbox).append("/>\n"); 60 60 } 61 for ( Stringcondition : conditions) {61 for (CharSequence condition : conditions) { 62 62 if (condition != null) { 63 result += condition + "\n";63 result.append(condition).append('\n'); 64 64 } 65 65 } 66 result += "</query>";66 result.append("</query>"); 67 67 return result; 68 68 }
Note:
See TracChangeset
for help on using the changeset viewer.