Changeset 16308 in osm for applications
- Timestamp:
- 2009-07-04T20:28:12+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin
- Files:
-
- 1 deleted
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/build.xml
r16290 r16308 16 16 </target> 17 17 <target name="dist" depends="compile,revision"> 18 <copy todir="${plugin.build.dir}/resources">19 <fileset dir="resources"/>20 </copy>21 18 <copy todir="${plugin.build.dir}/images"> 22 19 <fileset dir="images"/> -
applications/editors/josm/plugins/wmsplugin/sources.cfg
r15725 r16308 3 3 # NOTE: default items should be common and worldwide 4 4 # 5 true;Landsat;http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&styles=&format=image/jpeg 6 true;Open Aerial Map;http://openaerialmap.org/wms/?VERSION=1.0&request=GetMap&layers=world&styles=&format=image/jpeg 5 true;Landsat;http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&styles=&format=image/jpeg& 6 true;Open Aerial Map;http://openaerialmap.org/wms/?VERSION=1.0&request=GetMap&layers=world&styles=&format=image/jpeg& 7 7 # fails with division by zero error 8 false;NPE Maps;http://nick.dev.openstreetmap.org/openpaths/freemap.php?layers=npe 8 false;NPE Maps;http://nick.dev.openstreetmap.org/openpaths/freemap.php?layers=npe& 9 9 false;NPE Maps (Tim);http://dev.openstreetmap.org/~timsc/wms2/map.php? 10 # different forms for Yahoo 11 # must be yahoo://<commandline> 12 # The {0} in the commandline is for the URL 13 # output must be on stdout 14 false;YAHOO (GNOME);yahoo://gnome-web-photo --mode=photo --format=png {0} /dev/stdout 15 false;YAHOO (GNOME Fix);yahoo://gnome-web-photo-fixed {0} 16 true;YAHOO (WebKit);yahoo://webkit-image {0} 17 false;YAHOO (WebKit GTK);yahoo://webkit-image-gtk {0} 10 # 11 # different forms for web access 12 # must be html:<url> 13 true;Yahoo Sat;html:http://josm.openstreetmap.org/wmsplugin/Yahoo.html? 14 false;OpenStreetMap;html:http://josm.openstreetmap.org/wmsplugin/OpenStreetMap.html? 15 false;OpenCycleMap;html:http://josm.openstreetmap.org/wmsplugin/OpenCycleMap.html? 16 false;TilesAtHome;html:http://josm.openstreetmap.org/wmsplugin/TilesAtHome.html? 17 # 18 # 18 19 # only for Germany 19 false;Oberpfalz Geofabrik.de;http://oberpfalz.geofabrik.de/wms4josm? 20 false;Streets NRW Geofabrik.de;http://tools.geofabrik.de/osmi/view/strassennrw/josmwms 21 # Terraserver USCG- High resolution maps 22 false;Terraserver Topo;http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=drg&styles=&format=image/jpeg 23 true;Terraserver Urban;http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=urbanarea&styles=&format=image/jpeg 20 false;Streets NRW Geofabrik.de;http://tools.geofabrik.de/osmi/view/strassennrw/josmwms? 21 # Terraserver USCG - High resolution maps 22 false;Terraserver Topo;http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=drg&styles=&format=image/jpeg& 23 false;Terraserver Urban;http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=urbanarea&styles=&format=image/jpeg& 24 # 25 # 26 # URLS must be designed to append arguments directly behind. So the URLS should either end with '?' or '&' 27 # Following arguments are added: width, height, bbox, srs (projection method) 28 # srs is only added when no srs is given already (In this case the projection is checked 29 # and an error is issued when they mismatch). 30 # 31 # If more specific URL design is needed, then patterns are supported as well. If 32 # patterns are found no other arguments are added: 33 # {srs} is replaced by projection 34 # {bbox} is replaced by bounding box using projected coordinates 35 # {width} is requested display width 36 # {height} is requested display height -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/HTMLGrabber.java
r16302 r16308 10 10 import javax.imageio.ImageIO; 11 11 12 import org.openstreetmap.josm.Main; 12 13 import org.openstreetmap.josm.data.ProjectionBounds; 13 14 import org.openstreetmap.josm.gui.MapView; 14 15 import org.openstreetmap.josm.io.CacheFiles; 15 16 16 17 public class YAHOOGrabber extends WMSGrabber { 18 protected String browserCmd; 19 20 YAHOOGrabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 17 public class HTMLGrabber extends WMSGrabber { 18 HTMLGrabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 21 19 super(b, image, mv, layer, cache); 22 this.baseURL = "file:///" + WMSPlugin.getPrefsPath() + "ymap.html?"; 23 this.browserCmd = layer.baseURL.replaceFirst("yahoo://", ""); 20 this.baseURL = layer.baseURL.replaceFirst("html:", ""); 24 21 } 25 22 … … 27 24 protected BufferedImage grab(URL url) throws IOException { 28 25 String urlstring = url.toExternalForm(); 29 // work around a problem in URL removing 2 slashes30 if(!urlstring.startsWith("file:///"))31 urlstring = urlstring.replaceFirst("file:", "file://");32 26 33 27 BufferedImage cached = cache.getImg(urlstring); … … 35 29 36 30 ArrayList<String> cmdParams = new ArrayList<String>(); 37 StringTokenizer st = new StringTokenizer(MessageFormat.format(browserCmd, urlstring)); 31 StringTokenizer st = new StringTokenizer(MessageFormat.format( 32 Main.pref.get("wmsplugin.browser", "webkit-image {0}"), urlstring)); 38 33 while( st.hasMoreTokens() ) 39 34 cmdParams.add(st.nextToken()); 40 35 41 System.out.println("WMS::Browsing YAHOO: " + cmdParams);42 36 ProcessBuilder builder = new ProcessBuilder( cmdParams); 43 37 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSDownloadAction.java
r15858 r16308 19 19 20 20 public void actionPerformed(ActionEvent e) { 21 System.out.println(info.url);21 //System.out.println(info.url); 22 22 23 23 WMSLayer wmsLayer = new WMSLayer(info.name, info.url, info.cookies); -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r16290 r16308 43 43 this.baseURL = layer.baseURL; 44 44 /* URL containing placeholders? */ 45 urlWithPatterns = baseURL != null && baseURL.contains("{ 1}");45 urlWithPatterns = baseURL != null && baseURL.contains("{") && baseURL.contains("}"); 46 46 } 47 47 … … 62 62 image.max = b.max; 63 63 64 System.out.println(url + " " + b + " " + image.min + " " + image.max);65 64 if(image.isVisible(mv)) { //don't download, if the image isn't visible already 66 65 image.image = grab(url); … … 81 80 if(Main.proj instanceof Mercator) // don't use mercator code directly 82 81 { 83 LatLon sw = Main.proj.eastNorth2latlon(new EastNorth( s, w));84 LatLon ne = Main.proj.eastNorth2latlon(new EastNorth( n, e));82 LatLon sw = Main.proj.eastNorth2latlon(new EastNorth(w, s)); 83 LatLon ne = Main.proj.eastNorth2latlon(new EastNorth(e, n)); 85 84 proj = "EPSG:4326"; 86 85 s = sw.lat(); … … 89 88 e = ne.lon(); 90 89 } 91 /* else if(!(Main.proj instanceof Epsg4326)) 92 { 93 EastNorth sw = Main.proj.latlon2eastNorth(new LatLon(s, w)); 94 EastNorth ne = Main.proj.latlon2eastNorth(new LatLon(n, e)); 95 s = sw.north(); 96 w = sw.east(); 97 n = ne.north(); 98 e = ne.east(); 99 } 100 */ 90 101 91 String str = baseURL; 102 92 String bbox = latLonFormat.format(w) + "," … … 106 96 107 97 if (urlWithPatterns) { 108 str = MessageFormat.format(str, proj, bbox, wi, ht); 98 str = str.replaceAll("{proj}", proj) 99 .replaceAll("{bbox}", bbox) 100 .replaceAll("{width}", String.valueOf(wi)) 101 .replaceAll("{height}", String.valueOf(ht)); 109 102 } else { 110 if(!str.endsWith("?")) 103 if(!str.contains("?")) 104 str += "?"; 105 else if(!str.endsWith("?")) 111 106 str += "&"; 112 107 str += "bbox=" -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
r16290 r16308 48 48 49 49 public WMSPlugin() { 50 try51 {52 copy("/resources/ymap.html", "ymap.html");53 }54 catch(IOException e) {55 e.printStackTrace();56 }57 50 refreshMenu(); 58 51 cache.setExpire(cache.EXPIRE_MONTHLY, false); … … 190 183 191 184 public static Grabber getGrabber(ProjectionBounds bounds, GeorefImage img, MapView mv, WMSLayer layer){ 192 if(layer.baseURL.startsWith(" yahoo://"))193 return new YAHOOGrabber(bounds, img, mv, layer, cache);185 if(layer.baseURL.startsWith("html:")) 186 return new HTMLGrabber(bounds, img, mv, layer, cache); 194 187 else 195 188 return new WMSGrabber(bounds, img, mv, layer, cache); -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
r16290 r16308 17 17 import javax.swing.Box; 18 18 import javax.swing.JButton; 19 import javax.swing.JComboBox; 19 20 import javax.swing.JLabel; 20 21 import javax.swing.JOptionPane; … … 32 33 private Map<String,String> orig; 33 34 private DefaultTableModel model; 35 private JComboBox browser; 34 36 private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>(); 35 37 … … 69 71 JPanel p = new JPanel(new GridBagLayout()); 70 72 p.add(new JLabel(tr("Menu Name")), GBC.std().insets(0,0,5,0)); 71 JTextField key = new JTextField( 10);72 JTextField value = new JTextField( 10);73 JTextField key = new JTextField(40); 74 JTextField value = new JTextField(40); 73 75 p.add(key, GBC.eop().insets(5,0,0,0).fill(GBC.HORIZONTAL)); 74 76 p.add(new JLabel(tr("WMS URL")), GBC.std().insets(0,0,5,0)); … … 113 115 p.add(buttonPanel); 114 116 p.add(Box.createHorizontalGlue(), GBC.eol().fill(GBC.HORIZONTAL)); 117 browser = new JComboBox(new String[]{ 118 "webkit-image {0}", 119 "gnome-web-photo --mode=photo --format=png {0} /dev/stdout", 120 "gnome-web-photo-fixed {0}", 121 "webkit-image-gtk {0}"}); 122 browser.setEditable(true); 123 browser.setSelectedItem(Main.pref.get("wmsplugin.browser", "webkit-image {0}")); 124 p.add(new JLabel(tr("Downloader:")), GBC.eol().fill(GBC.HORIZONTAL)); 125 p.add(browser, GBC.eol().fill(GBC.HORIZONTAL)); 115 126 } 116 127 … … 152 163 if (change) WMSPlugin.refreshMenu(); 153 164 165 Main.pref.put("wmsplugin.browser", browser.getEditor().getItem().toString()); 154 166 return false; 155 167 }
Note:
See TracChangeset
for help on using the changeset viewer.