Changeset 15961 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java
- Timestamp:
- 2009-06-17T09:46:26+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java
r13784 r15961 14 14 import org.openstreetmap.josm.Main; 15 15 import org.openstreetmap.josm.data.coor.EastNorth; 16 import org.openstreetmap.josm.io.OsmTransferException; 16 17 import org.openstreetmap.josm.io.ProgressInputStream; 17 18 18 19 public class CadastreGrabber { 19 20 20 21 22 21 public static final double epsilon = 1e-11; 22 23 private CadastreInterface wmsInterface = new CadastreInterface(this); 23 24 private String lastWMSLayerName = null; 24 25 26 getWmsInterface().downloadCancelled = false; 27 28 29 public GeorefImage grab(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws IOException { 25 26 CadastreGrabber() { 27 getWmsInterface().downloadCancelled = false; 28 } 29 30 public GeorefImage grab(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws IOException, OsmTransferException { 30 31 31 32 try { … … 58 59 private URL getURLVector(EastNorth lambertMin, EastNorth lambertMax) throws MalformedURLException { 59 60 String str = new String(wmsInterface.baseURL+"/scpc/wms?version=1.1&request=GetMap"); 60 61 62 63 64 65 66 67 68 69 70 71 61 str += "&layers=CDIF:LS3,CDIF:LS2,CDIF:LS1,CDIF:PARCELLE,CDIF:NUMERO"; 62 str += ",CDIF:PT3,CDIF:PT2,CDIF:PT1,CDIF:LIEUDIT"; 63 str += ",CDIF:SUBSECTION"; 64 str += ",CDIF:SECTION"; 65 str += ",CDIF:COMMUNE"; 66 str += "&format=image/png"; 67 //str += "&format=image/jpeg"; 68 str += "&bbox="+lambertMin.east()+","; 69 str += lambertMin.north() + ","; 70 str += lambertMax.east() + ","; 71 str += lambertMax.north(); 72 //str += "&width=800&height=600"; // maximum allowed by wms server 72 73 str += "&width=1000&height=800"; // maximum allowed by wms server 73 74 75 76 77 74 str += "&styles=LS3_90,LS2_90,LS1_90,PARCELLE_90,NUMERO_90,PT3_90,PT2_90,PT1_90,LIEUDIT_90"; 75 str += ",SUBSECTION_90"; 76 str += ",SECTION_90"; 77 str += ",COMMUNE_90"; 78 System.out.println("URL="+str); 78 79 return new URL(str.replace(" ", "%20")); 79 80 } 80 81 81 82 83 84 85 86 82 private BufferedImage grab(URL url) throws IOException, OsmTransferException { 83 wmsInterface.urlConn = (HttpURLConnection)url.openConnection(); 84 wmsInterface.urlConn.setRequestMethod("GET"); 85 wmsInterface.setCookie(); 86 InputStream is = new ProgressInputStream(wmsInterface.urlConn, Main.pleaseWaitDlg); 87 BufferedImage img = ImageIO.read(is); 87 88 is.close(); 88 89 return img; 89 90 } 90 91 91 92 public CadastreInterface getWmsInterface() {
Note:
See TracChangeset
for help on using the changeset viewer.