Last change
on this file since 12894 was 12816, checked in by Don-vip, 7 years ago |
see #15229 - see #15182 - remove GUI references from I/O subsystem
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Rev | Line | |
---|
[9241] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | package org.openstreetmap.josm.io;
|
---|
| 3 |
|
---|
[10300] | 4 | import java.util.Set;
|
---|
[10689] | 5 | import java.util.function.Function;
|
---|
[10300] | 6 |
|
---|
[9241] | 7 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
---|
| 8 | import org.openstreetmap.josm.tools.Utils;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * Retrieves a set of {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s from an Overpass API server.
|
---|
| 12 | *
|
---|
| 13 | * @since 9241
|
---|
| 14 | */
|
---|
| 15 | class MultiFetchOverpassObjectReader extends MultiFetchServerObjectReader {
|
---|
| 16 |
|
---|
| 17 | @Override
|
---|
| 18 | protected String buildRequestString(final OsmPrimitiveType type, Set<Long> idPackage) {
|
---|
[10689] | 19 | final Function<Long, Object> toOverpassExpression = x -> type.getAPIName() + '(' + x + ");>;";
|
---|
[10300] | 20 | final String query = '(' + Utils.join("", Utils.transform(idPackage, toOverpassExpression)) + ");out meta;";
|
---|
[9241] | 21 | return "interpreter?data=" + Utils.encodeUrl(query);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | @Override
|
---|
| 25 | protected String getBaseUrl() {
|
---|
[12816] | 26 | return OverpassDownloadReader.OVERPASS_SERVER.get();
|
---|
[9241] | 27 | }
|
---|
[9325] | 28 |
|
---|
| 29 | @Override
|
---|
| 30 | protected boolean recursesDown() {
|
---|
| 31 | // see https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Recurse_down_.28.3E.29 for documentation
|
---|
| 32 | // accomplished using >; in the query string above
|
---|
| 33 | return true;
|
---|
| 34 | }
|
---|
[9241] | 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.