Changeset 6953 in osm for applications
- Timestamp:
- 2008-02-23T07:47:39+01:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
r6923 r6953 12 12 import java.awt.geom.*; 13 13 import java.util.*; 14 import java.text.*; 14 15 15 16 public class LakewalkerWMS { … … 39 40 40 41 public BufferedImage getTile(int x, int y) throws LakewalkerException { 42 String status = getStatus(); 43 setStatus("Downloading image tile..."); 44 41 45 String layer = "global_mosaic_base"; 42 46 … … 51 55 double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution); 52 56 double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution); 53 57 54 58 String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+ 55 59 "_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png"; 56 60 57 String urlloc = String.format("http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+ 61 // The WMS server only understands decimal points using periods, so we need 62 // to convert to a locale that uses that to build the proper URL 63 NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH); 64 DecimalFormat df = (DecimalFormat)nf; 65 df.applyLocalizedPattern("0.000000"); 66 67 String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+ 58 68 "&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+ 59 "&bbox= %.6f,%.6f,%.6f,%.6f&width=%d&height=%d",60 bottomleft_geo[1],bottomleft_geo[0],topright_geo[1],topright_geo[0],61 this.tilesize,this.tilesize);62 69 "&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+ 70 ","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+ 71 "&width="+this.tilesize+"&height="+this.tilesize; 72 63 73 File file = new File(this.working_dir,filename); 64 74 … … 135 145 } 136 146 147 setStatus(status); 148 137 149 return this.image; 138 150 } … … 151 163 152 164 public int getPixel(int x, int y) throws LakewalkerException{ 165 166 // Get the previously shown text 167 153 168 154 169 BufferedImage image = null; … … 216 231 } 217 232 } 218 /* 219 private double[] xy_to_geo(int x, int y){ 220 double[] geo = new double[2]; 221 geo[0] = (double)y / (double)this.resolution; 222 geo[1] = (double)x / (double)this.resolution; 223 return geo; 224 } 225 226 private int[] geo_to_xy(double lat, double lon){ 227 int[] xy = new int[2]; 228 229 xy[0] = (int)(Math.floor(lon * this.resolution) + 0.5); 230 xy[1] = (int)(Math.floor(lat * this.resolution) + 0.5); 231 232 return xy; 233 } 234 */ 233 protected void setStatus(String s) { 234 Main.pleaseWaitDlg.currentAction.setText(s); 235 Main.pleaseWaitDlg.repaint(); 236 } 237 protected String getStatus(){ 238 return Main.pleaseWaitDlg.currentAction.getText(); 239 } 235 240 }
Note:
See TracChangeset
for help on using the changeset viewer.