Changeset 32211 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
- Timestamp:
- 2016-06-01T00:55:28+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
r32060 r32211 14 14 import java.net.MalformedURLException; 15 15 import java.net.URL; 16 import java.nio.charset.StandardCharsets; 16 17 import java.util.ArrayList; 17 18 import java.util.Collection; … … 43 44 private WMSLayer wmsLayer; 44 45 private CadastreInterface wmsInterface; 45 private String svg = null;46 private EastNorthBound viewBox = null;46 private String svg; 47 private EastNorthBound viewBox; 47 48 private static String errorMessage; 48 49 … … 88 89 @Override 89 90 protected void finish() { 91 // Do nothing 90 92 } 91 93 … … 168 170 private String grabBoundary(EastNorthBound bbox) throws IOException, OsmTransferException { 169 171 try { 170 URL url = null; 171 url = getURLsvg(bbox); 172 return grabSVG(url); 172 return grabSVG(getURLsvg(bbox)); 173 173 } catch (MalformedURLException e) { 174 174 throw (IOException) new IOException(tr("CadastreGrabber: Illegal url.")).initCause(e); … … 176 176 } 177 177 178 private URL getURLsvg(EastNorthBound bbox) throws MalformedURLException { 179 String str = new String(wmsInterface.baseURL+"/scpc/wms?version=1.1&request=GetMap");178 private static URL getURLsvg(EastNorthBound bbox) throws MalformedURLException { 179 String str = CadastreInterface.BASE_URL+"/scpc/wms?version=1.1&request=GetMap"; 180 180 str += "&layers="; 181 181 str += "CDIF:COMMUNE"; … … 198 198 wmsInterface.setCookie(); 199 199 File file = new File(CadastrePlugin.cacheDir + "boundary.svg"); 200 String svg = new String();200 String svg = ""; 201 201 try (InputStream is = new ProgressInputStream(wmsInterface.urlConn, NullProgressMonitor.INSTANCE)) { 202 202 if (file.exists()) … … 205 205 InputStreamReader isr =new InputStreamReader(is); 206 206 BufferedReader br = new BufferedReader(isr)) { 207 String line ="";207 String line; 208 208 while ( null!=(line=br.readLine())){ 209 209 line += "\n"; 210 bos.write(line.getBytes()); 210 bos.write(line.getBytes(StandardCharsets.UTF_8)); 211 211 svg += line; 212 212 } … … 219 219 220 220 public static void download(WMSLayer wmsLayer) { 221 if (CadastrePlugin.autoSourcing == false) {221 if (!CadastrePlugin.autoSourcing) { 222 222 JOptionPane.showMessageDialog(Main.parent, 223 223 tr("Please, enable auto-sourcing and check cadastre millesime.")); … … 228 228 JOptionPane.showMessageDialog(Main.parent, errorMessage); 229 229 } 230 231 230 }
Note:
See TracChangeset
for help on using the changeset viewer.