Changeset 10382 in osm
- Timestamp:
- 2008-09-02T11:23:39+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/README
r7270 r10382 15 15 some code from Jonathan Stott <jonathan@jstott.me.uk>, Gabriel Ebner 16 16 <ge@gabrielebner.at> and Ulf Lamping <ulf.lamping@web.de>. 17 The automatic tiles downloading and Yahoo downloader made by Petr Dlouhý <petr.dlouhy@email.cz> 17 18 18 19 This plugin is licensed under the GNU GPL v2 or later. -
applications/editors/josm/plugins/wmsplugin/build.xml
r8666 r10382 33 33 34 34 <target name="dist" depends="compile"> 35 <copy todir="${plugin.build.dir}/resources"> 36 <fileset dir="resources"/> 37 </copy> 35 38 <copy todir="build/images" > 36 39 <fileset dir="images" /> -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java
r6984 r10382 15 15 16 16 public class GeorefImage implements Serializable { 17 public BufferedImage image ;17 public BufferedImage image = null; 18 18 public EastNorth min, max; 19 public boolean downloadingStarted; 19 20 20 public GeorefImage(BufferedImage img, EastNorth min, EastNorth max) { 21 image = img; 22 this.min = min; 23 this.max = max; 21 public GeorefImage(boolean downloadingStarted) { 22 this.downloadingStarted = downloadingStarted; 24 23 } 25 24 … … 34 33 } 35 34 36 public void paint(Graphics g, NavigatableComponent nc) { 37 if (image == null || min == null || max == null) return; 35 public boolean isVisible(NavigatableComponent nc) { 36 Point minPt = nc.getPoint(min), maxPt = nc.getPoint(max); 37 Graphics g = nc.getGraphics(); 38 39 return (g.hitClip(minPt.x, maxPt.y, 40 maxPt.x - minPt.x, minPt.y - maxPt.y)); 41 } 42 43 public boolean paint(Graphics g, NavigatableComponent nc) { 44 if (image == null || min == null || max == null) return false; 38 45 39 46 Point minPt = nc.getPoint(min), maxPt = nc.getPoint(max); 40 47 41 if (!g.hitClip(minPt.x, maxPt.y, 42 maxPt.x - minPt.x, minPt.y - maxPt.y)) 43 return; 48 if(!isVisible(nc)) 49 return false; 44 50 45 51 g.drawImage(image, … … 47 53 0, 0, image.getWidth(), image.getHeight(), // src 48 54 null); 55 56 return true; 49 57 } 50 58 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java
r6777 r10382 3 3 import org.openstreetmap.josm.data.Bounds; 4 4 import org.openstreetmap.josm.data.projection.Projection; 5 import java.util.ArrayList; 6 import org.openstreetmap.josm.gui.MapView; 5 7 6 8 public interface Grabber { 7 public GeorefImage grab(Bounds bounds, 8 Projection proj, double pixelPerDegree) 9 throws IOException; 9 public void start(); 10 10 } -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/OSGBGrabber.java
r6777 r10382 1 /* 1 2 package wmsplugin; 2 3 … … 61 62 } 62 63 } 64 */ -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSDownloadAction.java
r8721 r10382 9 9 import org.openstreetmap.josm.gui.MapView; 10 10 import org.openstreetmap.josm.gui.layer.Layer; 11 import org.openstreetmap.josm.data.Bounds; 11 12 12 13 public class WMSDownloadAction extends JosmAction { … … 22 23 System.out.println(info.url); 23 24 24 DownloadWMSTask.download(getLayer(info)); 25 WMSLayer wmsLayer = getLayer(info); 26 MapView mv = Main.map.mapView; 27 28 Bounds b = new Bounds( 29 mv.getLatLon(0, mv.getHeight()), 30 mv.getLatLon(mv.getWidth(), 0)); 31 double pixelPerDegree = mv.getWidth() / (b.max.lon() - b.min.lon()); 32 33 wmsLayer.grab(b, pixelPerDegree); 25 34 } 26 35 … … 34 43 35 44 // FIXME: move this to WMSPlugin/WMSInfo/preferences. 36 WMSLayer wmsLayer = new WMSLayer(info.name, info. grabber);45 WMSLayer wmsLayer = new WMSLayer(info.name, info.url); 37 46 Main.main.addLayer(wmsLayer); 38 47 return wmsLayer; -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r8721 r10382 12 12 import java.text.NumberFormat; 13 13 import java.util.Locale; 14 import java.util.ArrayList; 14 15 15 16 import javax.imageio.ImageIO; 17 import javax.swing.JOptionPane; 16 18 17 19 import org.openstreetmap.josm.Main; … … 19 21 import org.openstreetmap.josm.data.projection.Projection; 20 22 import org.openstreetmap.josm.io.ProgressInputStream; 23 import org.openstreetmap.josm.gui.MapView; 21 24 22 public class WMSGrabber implements Grabber {23 public String baseURL;24 25 25 public WMSGrabber(String baseURL) { 26 this.baseURL = baseURL; 26 public class WMSGrabber extends Thread implements Grabber{ 27 protected String baseURL; 28 29 protected Bounds b; 30 protected Projection proj; 31 protected double pixelPerDegree; 32 protected GeorefImage image; 33 protected MapView mv; 34 protected WMSLayer layer; 35 36 WMSGrabber(String _baseURL, Bounds _b, Projection _proj, 37 double _pixelPerDegree, GeorefImage _image, MapView _mv, WMSLayer _layer) { 38 this.baseURL = _baseURL; 39 b = _b; 40 proj = _proj; 41 pixelPerDegree = _pixelPerDegree; 42 image = _image; 43 mv = _mv; 44 layer = _layer; 45 this.setDaemon(true); 46 this.setPriority(Thread.MIN_PRIORITY); 27 47 } 28 48 29 public GeorefImage grab(Bounds b, Projection proj,30 double pixelPerDegree) throws IOException {31 int w = (int) ((b.max.lon() - b.min.lon()) * pixelPerDegree);32 int h = (int) ((b.max.lat() - b.min.lat()) * pixelPerDegree);49 public void run() { 50 51 int w = (int) ((b.max.lon() - b.min.lon()) * pixelPerDegree); 52 int h = (int) ((b.max.lat() - b.min.lat()) * pixelPerDegree); 33 53 34 try {35 URL url = getURL(36 b.min.lon(), b.min.lat(),37 b.max.lon(), b.max.lat(),38 w, h);54 try { 55 URL url = getURL( 56 b.min.lon(), b.min.lat(), 57 b.max.lon(), b.max.lat(), 58 w, h); 39 59 40 BufferedImage img = grab(url); 60 image.min = proj.latlon2eastNorth(b.min); 61 image.max = proj.latlon2eastNorth(b.max); 41 62 42 return new GeorefImage(img, 43 proj.latlon2eastNorth(b.min), 44 proj.latlon2eastNorth(b.max)); 45 } catch (MalformedURLException e) { 46 throw (IOException) new IOException( 47 tr("WMSGrabber: Illegal url.")).initCause(e); 48 } 63 image.image = grab(url); 64 image.downloadingStarted = false; 65 66 mv.repaint(); 67 } 68 catch (MalformedURLException e) { 69 if(layer.messageNum-- > 0) 70 JOptionPane.showMessageDialog(Main.parent,tr("WMSPlugin: Illegal url.\n{0}",e.getMessage())); 71 } 72 catch (IOException e) { 73 if(layer.messageNum-- > 0) 74 JOptionPane.showMessageDialog(Main.parent,tr("WMSPlugin: IO exception.\n{0}",e.getMessage())); 75 } 49 76 } 50 77 … … 65 92 66 93 protected BufferedImage grab(URL url) throws IOException { 67 InputStream is = new ProgressInputStream( 68 url.openConnection(), Main.pleaseWaitDlg); 69 BufferedImage img = ImageIO.read(is); 70 is.close(); 71 return img; 94 InputStream is = new ProgressInputStream( 95 url.openConnection(), null); 96 BufferedImage img; 97 synchronized (layer){ //download only one tile in one moment 98 if(!image.isVisible(mv)){ 99 return null; 100 } 101 img = ImageIO.read(is); 102 } 103 is.close(); 104 return img; 72 105 } 73 106 } -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java
r6780 r10382 12 12 String name; 13 13 String url; 14 Grabber grabber;15 14 int prefid; 16 15 17 public WMSInfo(String name, String url, Grabber grabber,int prefid) {16 public WMSInfo(String name, String url, int prefid) { 18 17 this.name=name; this.url=url; this.prefid=prefid; 19 this.grabber = grabber;20 18 } 21 19 22 public WMSInfo(String name, String url, int prefid) {23 this(name, url, WMSPlugin.getGrabber(url), prefid);24 }25 20 26 21 public void save() { -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r8721 r10382 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.lang.Math; 5 6 import java.awt.Component; 6 7 import java.awt.Graphics; 8 import java.awt.Point; 7 9 import java.awt.Toolkit; 8 10 import java.awt.event.ActionEvent; … … 30 32 import org.openstreetmap.josm.data.projection.Projection; 31 33 import org.openstreetmap.josm.data.Bounds; 34 import org.openstreetmap.josm.data.coor.LatLon; 32 35 import org.openstreetmap.josm.gui.MapView; 36 import java.util.ArrayList; 33 37 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 34 38 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; … … 46 50 new ImageIcon(Toolkit.getDefaultToolkit().createImage(WMSPlugin.class.getResource("/images/wms_small.png"))); 47 51 48 protected ArrayList<GeorefImage> images = new ArrayList<GeorefImage>(); 49 protected Grabber grabber; 50 protected final int serializeFormatVersion = 2; 52 public int messageNum = 5; //limit for messages per layer 53 protected boolean started = true; 54 protected boolean stopAfterPaint = false; 55 protected int ImageSize = 500; 56 protected int dax = 10; 57 protected int day = 10; 58 protected int minZoom = 3; 59 protected double pixelPerDegree; 60 protected GeorefImage[][] images = new GeorefImage[dax][day]; 61 62 protected String baseURL; 63 protected final int serializeFormatVersion = 3; 51 64 52 65 public WMSLayer() { 53 66 this(tr("Blank Layer"), null); 54 } 55 56 public WMSLayer(String name, Grabber grabber) { 67 initializeImages(); 68 } 69 70 public WMSLayer(String name, String baseURL) { 57 71 super(name); 58 this.grabber = grabber; 59 } 60 61 public void grab(Bounds b, double pixelPerDegree) throws IOException { 62 if (grabber == null) return; 63 images.add(grabber.grab(b, Main.main.proj, pixelPerDegree)); 64 Main.map.mapView.repaint(); 72 initializeImages(); 73 this.baseURL = baseURL; 74 } 75 76 public void initializeImages() { 77 images = new GeorefImage[dax][day]; 78 for(int x = 0; x<dax; ++x) 79 for(int y = 0; y<day; ++y) 80 images[x][y]= new GeorefImage(false); 81 } 82 83 public void grab(Bounds b, double _pixelPerDegree) { 84 if (baseURL == null) return; 85 //set resolution 86 if(started || Math.round(pixelPerDegree/10000) != Math.round(_pixelPerDegree/10000)) 87 initializeImages(); 88 pixelPerDegree = _pixelPerDegree; 89 if(!started)stopAfterPaint = true; 90 started = true; 65 91 } 66 92 … … 70 96 71 97 @Override public String getToolTipText() { 72 return tr("WMS layer ({0}), {1} tile(s) loaded", name, images.size()); 98 if(started) 99 return tr("WMS layer ({0}), automaticaly downloading in zoom {1}", name, Math.round(pixelPerDegree/10000)); 100 else 101 return tr("WMS layer ({0}), downloading in zoom {1}", name, Math.round(pixelPerDegree/10000)); 73 102 } 74 103 … … 80 109 } 81 110 111 private Bounds XYtoBounds (int x, int y) { 112 return new Bounds( 113 new LatLon( x * ImageSize / pixelPerDegree, 114 y * ImageSize / pixelPerDegree), 115 new LatLon((x + 1) * ImageSize / pixelPerDegree, 116 (y + 1) * ImageSize / pixelPerDegree)); 117 } 118 119 private int modulo (int a, int b) { 120 if(a%b>=0)return a%b; 121 else return a%b+b; 122 } 123 82 124 @Override public void paint(Graphics g, final MapView mv) { 83 for (GeorefImage img : images) img.paint(g, mv); 125 Bounds b = new Bounds( 126 mv.getLatLon(0, mv.getHeight()), 127 mv.getLatLon(mv.getWidth(), 0)); 128 int bminx= (int)Math.floor ((b.min.lat() * pixelPerDegree ) / ImageSize ); 129 int bminy= (int)Math.floor ((b.min.lon() * pixelPerDegree ) / ImageSize ); 130 int bmaxx= (int)Math.ceil ((b.max.lat() * pixelPerDegree ) / ImageSize ); 131 int bmaxy= (int)Math.ceil ((b.max.lon() * pixelPerDegree ) / ImageSize ); 132 133 134 if( !started || (pixelPerDegree / (mv.getWidth() / (b.max.lon() - b.min.lon())) > minZoom) ){ //don't download when it's too outzoomed 135 for(int x = 0; x<dax; ++x) 136 for(int y = 0; y<day; ++y){ 137 images[modulo(x,dax)][modulo(y,day)].paint(g, mv); 138 } 139 } else { 140 for(int x = bminx; x<bmaxx; ++x) 141 for(int y = bminy; y<bmaxy; ++y){ 142 GeorefImage img = images[modulo(x,dax)][modulo(y,day)]; 143 if(!img.paint(g, mv) && !img.downloadingStarted){ 144 //System.out.println(tr("------{0}|{1}|{2}|{3}", modulo(x,dax), modulo(y,day), img.downloadingStarted, img.isVisible(mv))); 145 img.downloadingStarted = true; 146 img.image = null; 147 Grabber gr = WMSPlugin.getGrabber(baseURL, XYtoBounds(x,y), Main.main.proj, pixelPerDegree, img, mv, this); 148 gr.start(); 149 } 150 } 151 } 152 if(stopAfterPaint){ 153 started = false; 154 stopAfterPaint = false; 155 } 84 156 } 85 157 86 158 @Override public void visitBoundingBox(BoundingXYVisitor v) { 87 for (GeorefImage img : images) { 88 v.visit(img.min); 89 v.visit(img.max); 90 } 159 for(int x = 0; x<dax; ++x) 160 for(int y = 0; y<day; ++y) 161 if(images[x][y]!=null){ 162 v.visit(images[x][y].min); 163 v.visit(images[x][y].max); 164 } 91 165 } 92 166 … … 99 173 new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)), 100 174 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 175 new JSeparator(), 101 176 new JMenuItem(new LoadWmsAction()), 102 177 new JMenuItem(new SaveWmsAction()), 103 178 new JSeparator(), 179 new JMenuItem(new StartWmsAction()), 180 new JMenuItem(new StopWmsAction()), 181 new JSeparator(), 104 182 new JMenuItem(new LayerListPopup.InfoAction(this))}; 183 105 184 } 106 185 107 186 public GeorefImage findImage(EastNorth eastNorth) { 108 // Iterate in reverse, so we return the image which is painted last.109 // (i.e. the topmost one)110 for (int i = images.size() - 1; i >= 0; i--){111 if (images.get(i).contains(eastNorth)) {112 return images.get(i);113 }114 }187 for(int x = 0; x<dax; ++x) 188 for(int y = 0; y<day; ++y) 189 if(images[x][y]!=null && images[x][y].image!=null && images[x][y].min!=null && images[x][y].max!=null){ 190 if (images[x][y].contains(eastNorth)) { 191 return images[x][y]; 192 } 193 } 115 194 return null; 116 195 } 196 117 197 118 198 public class SaveWmsAction extends AbstractAction { … … 122 202 public void actionPerformed(ActionEvent ev) { 123 203 File f = openFileDialog(false); 124 try { 204 try 205 { 125 206 FileOutputStream fos = new FileOutputStream(f); 126 207 ObjectOutputStream oos = new ObjectOutputStream(fos); 127 208 oos.writeInt(serializeFormatVersion); 128 oos.writeInt(images.size()); 129 for (GeorefImage img : images) { 130 oos.writeObject(img); 131 } 209 oos.writeInt(dax); 210 oos.writeInt(day); 211 oos.writeInt(ImageSize); 212 oos.writeDouble(pixelPerDegree); 213 oos.writeObject(baseURL); 214 oos.writeObject(images); 132 215 oos.close(); 133 216 fos.close(); 134 } catch (Exception ex) { 217 } 218 catch (Exception ex) { 135 219 ex.printStackTrace(System.out); 136 220 } 137 221 } 138 222 } 139 223 140 224 public class LoadWmsAction extends AbstractAction { 141 225 public LoadWmsAction() { … … 145 229 File f = openFileDialog(true); 146 230 if (f == null) return; 147 try { 231 try 232 { 148 233 FileInputStream fis = new FileInputStream(f); 149 234 ObjectInputStream ois = new ObjectInputStream(fis); 150 235 int sfv = ois.readInt(); 151 236 if (sfv != serializeFormatVersion) { 152 JOptionPane.showMessageDialog(Main.parent, 237 JOptionPane.showMessageDialog(Main.parent, 153 238 tr("Unsupported WMS file version; found {0}, expected {1}", sfv, serializeFormatVersion), 154 tr("File Format Error"), 239 tr("File Format Error"), 155 240 JOptionPane.ERROR_MESSAGE); 156 241 return; 157 242 } 158 int numImg = ois.readInt(); 159 for (int i=0; i< numImg; i++) { 160 GeorefImage img = (GeorefImage) ois.readObject(); 161 images.add(img); 162 } 243 dax = ois.readInt(); 244 day = ois.readInt(); 245 ImageSize = ois.readInt(); 246 pixelPerDegree = ois.readDouble(); 247 baseURL = (String) ois.readObject(); 248 images = (GeorefImage[][])ois.readObject(); 249 163 250 ois.close(); 164 251 fis.close(); 165 } catch (Exception ex) { 252 started = false; 253 } 254 catch (Exception ex) { 166 255 // FIXME be more specific 167 256 ex.printStackTrace(System.out); 168 JOptionPane.showMessageDialog(Main.parent, 169 tr("Error loading file"), 170 tr("Error"), 171 JOptionPane.ERROR_MESSAGE); 172 return; 173 } 174 } 175 } 176 257 JOptionPane.showMessageDialog(Main.parent, 258 tr("Error loading file"), 259 tr("Error"), 260 JOptionPane.ERROR_MESSAGE); 261 return; 262 } 263 } 264 } 265 266 public class StartWmsAction extends AbstractAction { 267 public StartWmsAction() { 268 super(tr("Start automatic downloading"), null); 269 } 270 public void actionPerformed(ActionEvent ev) { 271 started = true; 272 } 273 } 274 275 public class StopWmsAction extends AbstractAction { 276 public StopWmsAction() { 277 super(tr("Stop automatic downloading"), null); 278 } 279 public void actionPerformed(ActionEvent ev) { 280 started = false; 281 } 282 } 283 177 284 protected static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple) { 178 285 String curDir = Main.pref.get("lastDirectory"); … … 184 291 fc.addChoosableFileFilter(ExtensionFileFilter.filters[i]); 185 292 fc.setAcceptAllFileFilterUsed(true); 186 293 187 294 int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent); 188 295 if (answer != JFileChooser.APPROVE_OPTION) 189 296 return null; 190 297 191 298 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) 192 299 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath()); … … 194 301 if (!open) { 195 302 File file = fc.getSelectedFile(); 196 if (file == null || (file.exists() && JOptionPane.YES_OPTION != 197 303 if (file == null || (file.exists() && JOptionPane.YES_OPTION != 304 JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION))) 198 305 return null; 199 306 } 200 307 201 308 return fc; 202 309 } 203 310 204 311 public static File openFileDialog(boolean open) { 205 312 JFileChooser fc = createAndOpenFileChooser(open, false); -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
r8721 r10382 9 9 import java.util.Map; 10 10 import java.util.TreeSet; 11 import java.io.*; 11 12 12 13 import javax.swing.AbstractAction; … … 21 22 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 22 23 import org.openstreetmap.josm.actions.JosmAction; 24 import org.openstreetmap.josm.data.Bounds; 25 import org.openstreetmap.josm.data.projection.Projection; 26 import org.openstreetmap.josm.gui.MapView; 23 27 24 28 … … 26 30 // data. 27 31 32 33 28 34 public class WMSPlugin extends Plugin { 29 35 … … 37 43 38 44 public WMSPlugin() { 45 try 46 { 47 copy("/resources/ymap.html", "ymap.html"); 48 } 49 catch(IOException e) { 50 e.printStackTrace(); 51 } 39 52 refreshMenu(); 40 53 } … … 44 57 // wmsplugin.1.name=Landsat 45 58 // wmsplugin.1.url=http://and.so.on/ 59 60 public void copy(String from, String to) throws FileNotFoundException, IOException 61 { 62 File pluginDir = new File(Main.pref.getPreferencesDir() + "plugins/wmsplugin/"); 63 if (!pluginDir.exists()) 64 pluginDir.mkdirs(); 65 FileOutputStream out = new FileOutputStream(Main.pref.getPreferencesDir() + "plugins/wmsplugin/" + to); 66 InputStream in = WMSPlugin.class.getResourceAsStream(from); 67 byte[] buffer = new byte[8192]; 68 for(int len = in.read(buffer); len > 0; len = in.read(buffer)) 69 out.write(buffer, 0, len); 70 in.close(); 71 out.close(); 72 } 73 46 74 47 75 public static void refreshMenu() { … … 54 82 String url = null; 55 83 int lastid = -1; 84 boolean isYahoo = false; 56 85 for (String key : keys) { 57 86 String[] elements = key.split("\\."); … … 65 94 if ((name != null) && (url != null)) { 66 95 wmsList.add(new WMSInfo(name, url, prefid)); 96 if(name.equals("YAHOO"))isYahoo = true; 67 97 } 68 98 name = null; url = null; lastid = prefid; … … 76 106 if ((name != null) && (url != null)) { 77 107 wmsList.add(new WMSInfo(name, url, prefid)); 78 } 79 108 if(name.equals("YAHOO"))isYahoo = true; 109 } 110 80 111 // if no (valid) prefs are set, initialize to a sensible default. 81 112 if (wmsList.isEmpty()) { … … 92 123 wmsList.add(npeInfo); 93 124 } 125 if(!isYahoo){ //add Yahoo to the list, if there isn't 126 int maxKey = 0; 127 for(WMSInfo in : wmsList) 128 if(maxKey < in.prefid)maxKey = in.prefid; 129 WMSInfo yahooInfo = new WMSInfo(tr("YAHOO"), 130 "yahoo://gnome-web-photo --mode=photo --format=png {0} /dev/stdout", maxKey+1); 131 yahooInfo.save(); 132 wmsList.add(yahooInfo); 133 } 94 134 95 135 JMenuBar menu = Main.main.menu; … … 122 162 } 123 163 124 public static Grabber getGrabber(String wmsurl) { 125 if (wmsurl.matches("(?i).*layers=npeoocmap.*") || wmsurl.matches("(?i).*layers=npe.*") ){ 126 return new OSGBGrabber(wmsurl); 127 } else { 128 return new WMSGrabber(wmsurl); 129 } 164 public static Grabber getGrabber(String _baseURL, Bounds _b, Projection _proj, 165 double _pixelPerDegree, GeorefImage _image, MapView _mv, WMSLayer _layer){ 166 if(_baseURL.startsWith("yahoo://")) 167 return new YAHOOGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer); 168 else 169 return new WMSGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer); 170 // OSBGrabber should be rewrite for thread support first 171 //if (wmsurl.matches("(?i).*layers=npeoocmap.*") || wmsurl.matches("(?i).*layers=npe.*") ){ 172 // return new OSGBGrabber(_b, _proj, _pixelPerDegree, _images, _mv, _layer); 173 //} else { 174 // return new WMSGrabber(_b, _proj, _pixelPerDegree, _images, _mv, _layer); 175 //} 130 176 } 131 177
Note:
See TracChangeset
for help on using the changeset viewer.