Changeset 13600 in osm for applications/editors
- Timestamp:
- 2009-02-08T17:05:17+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin/src/wmsplugin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r13497 r13600 1 1 package wmsplugin; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.image.BufferedImage; … … 14 16 import java.text.NumberFormat; 15 17 import java.util.Locale; 18 import java.util.regex.Matcher; 19 import java.util.regex.Pattern; 16 20 17 21 import javax.imageio.ImageIO; 22 import javax.swing.JOptionPane; 18 23 19 24 import org.openstreetmap.josm.Main; … … 26 31 public class WMSGrabber extends Grabber { 27 32 protected String baseURL; 33 private static Boolean shownWarning = false; 28 34 29 35 WMSGrabber(String baseURL, Bounds b, Projection proj, … … 71 77 + latLonFormat.format(e) + "," 72 78 + latLonFormat.format(n) 79 + getProjection(baseURL, false) 73 80 + "&width=" + wi + "&height=" + ht; 74 81 return new URL(str.replace(" ", "%20")); 82 } 83 84 static public String getProjection(String baseURL, Boolean warn) 85 { 86 String projname = Main.proj.toCode(); 87 if(projname.equals("EPSG:3785")) // don't use mercator code 88 projname = "EPSG:4326"; 89 String res = ""; 90 try 91 { 92 Matcher m = Pattern.compile(".*srs=([a-z0-9:]+).*").matcher(baseURL.toLowerCase()); 93 if(m.matches()) 94 { 95 projname = projname.toLowerCase(); 96 if(!projname.equals(m.group(1)) && warn) 97 { 98 JOptionPane.showMessageDialog(Main.parent, 99 tr("The projection ''{0}'' in URL and current projection ''{1}'' mismatch.\n" 100 + "This may lead to wrong coordinates.\n", 101 m.group(1), projname)); 102 } 103 } 104 else 105 res ="&srs="+projname; 106 } 107 catch(Exception e) 108 { 109 } 110 return res; 75 111 } 76 112 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r13497 r13600 78 78 initializeImages(); 79 79 this.baseURL = baseURL; 80 WMSGrabber.getProjection(baseURL, true); 80 81 mv = Main.map.mapView; 81 82 getPPD();
Note:
See TracChangeset
for help on using the changeset viewer.