Ignore:
Timestamp:
2015-07-12T23:55:18+02:00 (9 years ago)
Author:
wiktorn
Message:

TileSource:

  • added method - getTileId that returns unique identifier for the tile, that should not collide with other tile sources
  • added JavaDocs

JCSCacheManager:

  • moved from object count limit to object size limit
  • fixed bug with unnecessary re-creation of auxilary cache, that could result in cache corruption/loss of current cache data

CachedTileLoaderFactory, WMSCachedTileLoader, TMSCachedTileLoader

  • un-abstract CachedTileLoaderFactory, use reflection to create TileLoaders
  • adjust constructors

TMSCachedTileLoader, AbstractCachedTileSourceLayer:

  • move cache related settings to AbstractCachedTileSourceLayer
  • move cache instation to AbstractCachedTileSourceLayer
  • make "flush tile cache" command clear only one tile source

TMSCachedTileLoaderJob:

  • make "flush tile cache" command clear only one tile source
  • reorder methods

TemplatedWMSTileSource:

  • java docs
  • inline of private methods: getTileXMax, getTileYMax
  • fix sonar issues
  • make WMS layer zoom levels closer to TMS (addresses: #11459)

WMTSTileSource:

  • fix Sonar issues
  • use topLeftCorner in X/Y tile max calculations instead of world bounds (fixes issues with WMTS-es, for which topLeftCorner lies outside projection world bounds)

AbstractTileSourceLayer:

  • draw warning, when min-zoom-level is set, and tiles are not loaded due to too many tiles on screen

TMSLayer, WMSLayer, WMTSLayer:

  • expose access to cache object for ImageryPreferences

CacheContentsPanel:

  • add panel for managing cache regions and tile sources within the regions

CommonSettingsPanel, TMSSettingsPanel:

  • move settings common to all imagery layers from TMSSettingsPanel to CommonSettingsPanel
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CommonSettingsPanel.java

    r7937 r8598  
    1515import javax.swing.JPanel;
    1616import javax.swing.JSlider;
     17import javax.swing.JSpinner;
     18import javax.swing.SpinnerNumberModel;
    1719
     20import org.openstreetmap.josm.data.imagery.CachedTileLoaderFactory;
     21import org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer;
    1822import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1923import org.openstreetmap.josm.gui.widgets.JosmComboBox;
     24import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2025import org.openstreetmap.josm.tools.ColorHelper;
    2126import org.openstreetmap.josm.tools.GBC;
     
    3136    private final JSlider fadeAmount = new JSlider(0, 100);
    3237    private final JosmComboBox<String> sharpen;
     38    private final JosmTextField tilecacheDir = new JosmTextField();
     39    private final JSpinner maxElementsOnDisk;
     40    private final JSpinner maxElementsInRam;
     41
    3342
    3443    /**
     
    3746    public CommonSettingsPanel() {
    3847        super(new GridBagLayout());
    39        
     48
     49        this.maxElementsInRam = new JSpinner(new SpinnerNumberModel(
     50                AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get().intValue(), 0, Integer.MAX_VALUE, 1));
     51        this.maxElementsOnDisk = new JSpinner(new SpinnerNumberModel(
     52                AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.get().intValue(), 0, Integer.MAX_VALUE, 1));
     53
     54
    4055        this.btnFadeColor = new JButton();
    4156
     
    7287        add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));
    7388        add(this.sharpen, GBC.eol().fill(GBC.HORIZONTAL));
     89
     90        add(new JLabel(tr("Tile cache directory: ")), GBC.std());
     91        add(GBC.glue(5, 0), GBC.std());
     92        add(tilecacheDir, GBC.eol().fill(GBC.HORIZONTAL));
     93
     94        add(new JLabel(tr("Maximum size of disk cache (per imagery) in MB: ")), GBC.std());
     95        add(GBC.glue(5, 0), GBC.std());
     96        add(this.maxElementsOnDisk, GBC.eol());
     97
     98        add(new JLabel(tr("Maximum number of objects in memory cache: ")), GBC.std());
     99        add(GBC.glue(5, 0), GBC.std());
     100        add(this.maxElementsInRam, GBC.eol());
    74101    }
    75    
     102
    76103    /**
    77104     * Loads the common settings.
     
    83110        this.fadeAmount.setValue(ImageryLayer.PROP_FADE_AMOUNT.get());
    84111        this.sharpen.setSelectedIndex(Math.max(0, Math.min(2, ImageryLayer.PROP_SHARPEN_LEVEL.get())));
     112        this.tilecacheDir.setText(CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
     113        this.maxElementsOnDisk.setValue(AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.get());
     114        this.maxElementsInRam.setValue(AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get());
     115
    85116    }
    86    
     117
    87118    /**
    88119     * Saves the common settings.
     
    93124        ImageryLayer.PROP_FADE_COLOR.put(this.btnFadeColor.getBackground());
    94125        ImageryLayer.PROP_SHARPEN_LEVEL.put(sharpen.getSelectedIndex());
    95         return false;
     126        boolean restartRequired = false;
     127        if (!AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.get().equals(this.maxElementsOnDisk.getValue())) {
     128            AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.put((Integer) this.maxElementsOnDisk.getValue());
     129            restartRequired = true;
     130        }
     131
     132
     133        if (!CachedTileLoaderFactory.PROP_TILECACHE_DIR.get().equals(this.tilecacheDir.getText())) {
     134            restartRequired = true;
     135            CachedTileLoaderFactory.PROP_TILECACHE_DIR.put(this.tilecacheDir.getText());
     136        }
     137
     138        if (!AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get().equals(this.maxElementsInRam.getValue())) {
     139            AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.put((Integer) this.maxElementsInRam.getValue());
     140        }
     141
     142
     143        return restartRequired;
    96144    }
    97145}
Note: See TracChangeset for help on using the changeset viewer.