Changeset 24544 in osm for applications/editors
- Timestamp:
- 2010-12-03T04:37:35+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryInfo.java
r24501 r24544 31 31 ImageryType imageryType = ImageryType.WMS; 32 32 double pixelPerDegree = 0.0; 33 int maxZoom = 0; 33 34 34 35 public ImageryInfo(String name) { … … 66 67 if(url != null && !url.isEmpty()) e2 = getFullURL(); 67 68 if(cookies != null && !cookies.isEmpty()) e3 = cookies; 68 if(pixelPerDegree != 0.0) e4 = String.valueOf(pixelPerDegree); 69 if(imageryType == ImageryType.WMS) { 70 if(pixelPerDegree != 0.0) e4 = String.valueOf(pixelPerDegree); 71 } else { 72 if(maxZoom != 0) e4 = String.valueOf(maxZoom); 73 } 69 74 if(e4 != null && e3 == null) e3 = ""; 70 75 if(e3 != null && e2 == null) e2 = ""; … … 83 88 if(array.size() >= 2) setURL(array.get(1)); 84 89 if(array.size() >= 3) this.cookies=array.get(2); 85 if(array.size() >= 4) this.pixelPerDegree=Double.valueOf(array.get(3)); 90 if(imageryType == ImageryType.WMS && array.size() >= 4) this.pixelPerDegree=Double.valueOf(array.get(3)); 91 if(imageryType == ImageryType.TMS && array.size() >= 4) this.maxZoom=Integer.valueOf(array.get(3)); 86 92 } 87 93 … … 148 154 } 149 155 156 public int getMaxZoom() { 157 return this.maxZoom; 158 } 159 150 160 public String getFullURL() { 151 161 return imageryType.getUrlString() + ":" + url; … … 165 175 if(pixelPerDegree != 0.0) 166 176 res += " ("+pixelPerDegree+")"; 177 else if(maxZoom != 0) 178 res += " (z"+maxZoom+")"; 167 179 return res; 168 180 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPreferenceEditor.java
r24521 r24544 40 40 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 41 41 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 42 import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType; 42 43 import org.openstreetmap.josm.plugins.imagery.tms.TMSPreferences; 43 44 import org.openstreetmap.josm.plugins.imagery.wms.AddWMSLayerPanel; … … 73 74 public String getToolTipText(MouseEvent e) { 74 75 java.awt.Point p = e.getPoint(); 75 return (String) model.getValueAt(rowAtPoint(p), columnAtPoint(p));76 return model.getValueAt(rowAtPoint(p), columnAtPoint(p)).toString(); 76 77 } 77 78 }; … … 397 398 return info.getFullURL(); 398 399 case 2: 399 return info.pixelPerDegree == 0.0 ? "" : info.pixelPerDegree; 400 return (info.imageryType == ImageryType.WMS) ? (info.pixelPerDegree == 0.0 ? "" : info.pixelPerDegree) 401 : (info.maxZoom == 0 ? "" : info.maxZoom); 400 402 } 401 403 return null; … … 410 412 case 1: 411 413 info.setURL((String)o); 414 case 2: 415 if(info.imageryType == ImageryType.WMS) 416 info.pixelPerDegree = Double.parseDouble((String) o); 417 else 418 info.maxZoom = Integer.parseInt((String) o); 412 419 } 413 420 } … … 415 422 @Override 416 423 public boolean isCellEditable(int row, int column) { 417 return (column != 2);424 return true; 418 425 } 419 426 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java
r24541 r24544 183 183 184 184 if (info.getImageryType() == ImageryType.TMS) { 185 initTileSource(new TMSTileSource(info.getName(),info.getURL())); 185 if(isUrlWithPatterns(info.getURL())) { 186 initTileSource(new TemplatedTMSTileSource(info.getName(), info.getURL(), info.getMaxZoom())); 187 } else { 188 initTileSource(new TMSTileSource(info.getName(),info.getURL(), info.getMaxZoom())); 189 } 186 190 } else if (info.getImageryType() == ImageryType.BING) { 187 191 initTileSource(new BingAerialTileSource()); … … 358 362 } 359 363 }); 364 } 365 366 public static boolean isUrlWithPatterns(String url) { 367 return url != null && url.contains("{") && url.contains("}"); 360 368 } 361 369 -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSPreferences.java
r24536 r24544 59 59 maxZoomLvl = PROP_MIN_ZOOM_LVL.get(); 60 60 } 61 if (ts != null && ts.getMaxZoom() < maxZoomLvl) { 62 System.err.println("decreasing maxZoomLvl to match tile source"); 61 if (ts != null && ts.getMaxZoom() != 0) { 63 62 maxZoomLvl = ts.getMaxZoom(); 64 63 } -
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSTileSource.java
r24536 r24544 4 4 5 5 public class TMSTileSource extends OsmTileSource.AbstractOsmTileSource { 6 public TMSTileSource(String name, String url) { 6 private int maxZoom; 7 8 public TMSTileSource(String name, String url, int maxZoom) { 7 9 super(name, url); 10 this.maxZoom = maxZoom; 8 11 } 12 13 @Override 14 public int getMaxZoom() { 15 return (maxZoom == 0) ? super.getMaxZoom() : maxZoom; 16 } 17 9 18 @Override 10 19 public TileUpdate getTileUpdate() {
Note:
See TracChangeset
for help on using the changeset viewer.