Last change
on this file since 15735 was 15452, checked in by Don-vip, 5 years ago |
see #10564 - use the same i18n string than other actions
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.io.IOException;
|
---|
7 | import java.util.Objects;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
10 | import org.openstreetmap.josm.gui.io.importexport.GeoJSONImporter;
|
---|
11 | import org.openstreetmap.josm.gui.progress.ProgressMonitor;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * GeoJson server reader.
|
---|
15 | * @author Omar Vega Ramos <ovruni@riseup.net>
|
---|
16 | * @since 15424
|
---|
17 | */
|
---|
18 | public class GeoJSONServerReader extends OsmServerReader {
|
---|
19 |
|
---|
20 | private final String url;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Constructs a new {@code GeoJSONServerReader}.
|
---|
24 | * @param url geojson URL
|
---|
25 | */
|
---|
26 | public GeoJSONServerReader(String url) {
|
---|
27 | this.url = Objects.requireNonNull(url);
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException {
|
---|
32 | try {
|
---|
33 | progressMonitor.beginTask(tr("Contacting Server..."), 10);
|
---|
34 | return new GeoJSONImporter().parseDataSet(url);
|
---|
35 | } catch (IOException | IllegalDataException e) {
|
---|
36 | throw new OsmTransferException(e);
|
---|
37 | } finally {
|
---|
38 | progressMonitor.finishTask();
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.