Changeset 8861 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2015-10-11T23:54:48+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r8860 r8861 140 140 public static final IntegerProperty ZOOM_OFFSET = new IntegerProperty(PREFERENCE_PREFIX + ".zoom_offset", 0); 141 141 142 /**143 * use fairly small memory cache, as cached objects are quite big, as they contain BufferedImages144 */145 public static final IntegerProperty MEMORY_CACHE_SIZE = new IntegerProperty(PREFERENCE_PREFIX + ".cache.max_objects_ram",146 (int) Math.max(200, 200 * Math.pow(4, ZOOM_OFFSET.get())));147 148 142 /* 149 143 * use MemoryTileCache instead of tileLoader JCS cache, as tileLoader caches only content (byte[] of image) … … 880 874 */ 881 875 private Tile getTile(int x, int y, int zoom) { 882 if (x < 0 || x > = tileSource.getTileXMax(zoom) || y < 0 || y >=tileSource.getTileYMax(zoom))876 if (x < 0 || x > tileSource.getTileXMax(zoom) || y < 0 || y > tileSource.getTileYMax(zoom)) 883 877 return null; 884 878 return tileCache.getTile(tileSource, x, y, zoom); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CommonSettingsPanel.java
r8751 r8861 39 39 private final JosmTextField tilecacheDir = new JosmTextField(); 40 40 private final JSpinner maxElementsOnDisk; 41 private final JSpinner maxElementsInRam;42 41 private final JSlider tilesZoom = new JSlider(-2, 2, 0); 43 42 … … 49 48 super(new GridBagLayout()); 50 49 51 this.maxElementsInRam = new JSpinner(new SpinnerNumberModel(52 AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get().intValue(), 0, Integer.MAX_VALUE, 1));53 50 this.maxElementsOnDisk = new JSpinner(new SpinnerNumberModel( 54 51 AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.get().intValue(), 0, Integer.MAX_VALUE, 1)); … … 98 95 add(this.maxElementsOnDisk, GBC.eol()); 99 96 100 add(new JLabel(tr("Maximum number of objects in memory cache: ")), GBC.std());101 add(GBC.glue(5, 0), GBC.std());102 add(this.maxElementsInRam, GBC.eol());103 104 97 this.tilesZoom.setPaintLabels(true); 105 98 this.tilesZoom.setMajorTickSpacing(2); … … 122 115 this.tilecacheDir.setText(CachedTileLoaderFactory.PROP_TILECACHE_DIR.get()); 123 116 this.maxElementsOnDisk.setValue(AbstractCachedTileSourceLayer.MAX_DISK_CACHE_SIZE.get()); 124 this.maxElementsInRam.setValue(AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get());125 117 this.tilesZoom.setValue(AbstractTileSourceLayer.ZOOM_OFFSET.get()); 126 118 } … … 147 139 } 148 140 149 if (!AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.get().equals(this.maxElementsInRam.getValue())) {150 AbstractCachedTileSourceLayer.MEMORY_CACHE_SIZE.put((Integer) this.maxElementsInRam.getValue());151 restartRequired = true;152 }153 154 141 if (!AbstractTileSourceLayer.ZOOM_OFFSET.get().equals(this.tilesZoom.getValue())) { 155 142 // TODO: make warning about too small MEMORY_CACHE_SIZE?
Note:
See TracChangeset
for help on using the changeset viewer.