Changeset 14110 in osm for applications/editors/josm
- Timestamp:
- 2009-03-17T19:33:32+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r14063 r14110 14 14 import java.text.DecimalFormat; 15 15 import java.text.DecimalFormatSymbols; 16 import java.text.MessageFormat; 16 17 import java.text.NumberFormat; 17 18 import java.util.Locale; … … 34 35 protected Cache cache = new wmsplugin.Cache(); 35 36 private static Boolean shownWarning = false; 37 private boolean urlWithPatterns; 36 38 37 39 WMSGrabber(String baseURL, Bounds b, Projection proj, … … 39 41 super(b, proj, pixelPerDegree, image, mv, layer); 40 42 this.baseURL = baseURL; 43 /* URL containing placeholders? */ 44 urlWithPatterns = baseURL != null && baseURL.contains("{1}"); 41 45 } 42 46 … … 74 78 int wi, int ht) throws MalformedURLException { 75 79 String str = baseURL; 76 if(!str.endsWith("?")) 77 str += "&"; 78 str += "bbox=" 79 + latLonFormat.format(w) + "," 80 + latLonFormat.format(s) + "," 81 + latLonFormat.format(e) + "," 82 + latLonFormat.format(n) 83 + getProjection(baseURL, false) 84 + "&width=" + wi + "&height=" + ht; 80 String bbox = latLonFormat.format(w) + "," + 81 latLonFormat.format(s) + "," + 82 latLonFormat.format(e) + "," + 83 latLonFormat.format(n); 84 85 if (urlWithPatterns) { 86 String proj = Main.proj.toCode(); 87 if(proj.equals("EPSG:3785")) // don't use mercator code 88 proj = "EPSG:4326"; 89 90 str = MessageFormat.format(str, proj, bbox, wi, ht); 91 } else { 92 if(!str.endsWith("?")) 93 str += "&"; 94 str += "bbox=" 95 + bbox 96 + getProjection(baseURL, false) 97 + "&width=" + wi + "&height=" + ht; 98 } 85 99 return new URL(str.replace(" ", "%20")); 86 100 }
Note:
See TracChangeset
for help on using the changeset viewer.