Changeset 18762 in osm for applications/editors/josm/plugins/wmsplugin/src
- Timestamp:
- 2009-11-23T17:07:50+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r18761 r18762 87 87 WMSGrabber.getProjection(baseURL, true); 88 88 mv = Main.map.mapView; 89 90 // quick hack to predefine the PixelDensity to reuse the cache 91 int codeIndex = getName().indexOf("#PPD="); 92 if (codeIndex != -1) { 93 pixelPerDegree = Double.valueOf(getName().substring(codeIndex+5)); 94 } else { 95 pixelPerDegree = getPPD(); 96 } 89 97 resolution = mv.getDist100PixelText(); 90 98 pixelPerDegree = getPPD(); … … 117 125 try { 118 126 executor.shutdownNow(); 119 // Might not be init alized, so catch NullPointer as well127 // Might not be initialized, so catch NullPointer as well 120 128 } catch(Exception x) { 121 129 x.printStackTrace(); … … 269 277 new JMenuItem(new LoadWmsAction()), 270 278 new JMenuItem(new SaveWmsAction()), 279 new JMenuItem(new BookmarkWmsAction()), 271 280 new JSeparator(), 272 281 startstop, … … 318 327 // Delete small files, because they're probably blank tiles. 319 328 // See https://josm.openstreetmap.de/ticket/2307 320 WMSPlugin.cache.customCleanUp(CacheFiles.CLEAN_SMALL_FILES, 2048);329 WMSPlugin.cache.customCleanUp(CacheFiles.CLEAN_SMALL_FILES, 4096); 321 330 322 331 for (int x = 0; x < dax; ++x) { … … 428 437 } 429 438 } 439 /** 440 * This action will add a WMS layer menu entry with the current WMS layer URL and name extended by the current resolution. 441 * When using the menu entry again, the WMS cache will be used properly. 442 */ 443 public class BookmarkWmsAction extends AbstractAction { 444 public BookmarkWmsAction() { 445 super(tr("Set WMS Bookmark")); 446 } 447 public void actionPerformed(ActionEvent ev) { 448 int i = 0; 449 while (Main.pref.hasKey("wmsplugin.url."+i+".url")) { 450 i++; 451 } 452 String baseName; 453 // cut old parameter 454 int parameterIndex = getName().indexOf("#PPD="); 455 if (parameterIndex != -1) { 456 baseName = getName().substring(0,parameterIndex); 457 } 458 else { 459 baseName = getName(); 460 } 461 Main.pref.put("wmsplugin.url."+ i +".url",baseURL ); 462 Main.pref.put("wmsplugin.url."+String.valueOf(i)+".name", baseName + "#" + getPPD() ); 463 WMSPlugin.refreshMenu(); 464 } 465 } 430 466 }
Note:
See TracChangeset
for help on using the changeset viewer.