Changeset 17089 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java
- Timestamp:
- 2009-08-16T23:36:16+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java
r16581 r17089 19 19 public class CadastreGrabber { 20 20 21 public static finaldouble epsilon = 1e-11;21 public final static double epsilon = 1e-11; 22 22 23 private CadastreInterface wmsInterface = new CadastreInterface(this); 24 private String lastWMSLayerName = null; 25 26 CadastreGrabber() { 27 getWmsInterface().downloadCancelled = false; 28 } 23 private CadastreInterface wmsInterface = new CadastreInterface(); 29 24 30 25 public GeorefImage grab(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws IOException, OsmTransferException { … … 36 31 else 37 32 url = getURLVector(lambertMin, lambertMax); 38 System.out.println("grab:"+url);39 33 BufferedImage img = grab(url); 40 ImageModifier imageModified = new ImageModifier(img); 34 ImageModifier imageModified; 35 if (wmsLayer.isRaster()) 36 imageModified = new RasterImageModifier(img); 37 else 38 imageModified = new VectorImageModifier(img); 41 39 return new GeorefImage(imageModified.bufferedImage, lambertMin, lambertMax); 42 40 } catch (MalformedURLException e) { … … 46 44 47 45 private URL getURLRaster(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws MalformedURLException { 46 // GET /scpc/wms?version=1.1&request=GetMap&layers=CDIF:PMC@QH4480001701&format=image/png&bbox=-1186,0,13555,8830&width=576&height=345&exception=application/vnd.ogc.se_inimage&styles= HTTP/1.1 47 final int cRasterX = 1000; // keep width constant and adjust width to original image proportions 48 48 String str = new String(wmsInterface.baseURL+"/scpc/wms?version=1.1&request=GetMap"); 49 49 str += "&layers=CDIF:PMC@"; … … 52 52 str += "&bbox="; 53 53 str += wmsLayer.eastNorth2raster(lambertMin, lambertMax); 54 str += "&width=600&height=600"; // maximum allowed by wms server 54 //str += "&width=800&height=800"; // maximum allowed by wms server 55 str += "&width="+cRasterX+"&height="; // maximum allowed by wms server (576/345, 800/378, 1000/634) 56 str += (int)(cRasterX*(wmsLayer.communeBBox.max.getY() - wmsLayer.communeBBox.min.getY())/(wmsLayer.communeBBox.max.getX() - wmsLayer.communeBBox.min.getX())); 55 57 str += "&exception=application/vnd.ogc.se_inimage&styles="; 56 58 return new URL(str.replace(" ", "%20")); … … 94 96 } 95 97 96 public String getLastWMSLayerName() {97 return lastWMSLayerName;98 }99 100 public void setLastWMSLayerName(String lastWMSLayerName) {101 this.lastWMSLayerName = lastWMSLayerName;102 }103 104 98 }
Note:
See TracChangeset
for help on using the changeset viewer.