Merge pull request #4805 from fredj/cacheSize

Add new cacheSize option to ol.source
This commit is contained in:
Frédéric Junod
2016-03-01 10:46:00 +01:00
16 changed files with 138 additions and 13 deletions

View File

@@ -35,12 +35,6 @@ ol.DEFAULT_MIN_ZOOM = 0;
ol.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD = 0.5;
/**
* @define {number} Default high water mark.
*/
ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK = 2048;
/**
* @define {number} Default tile size.
*/

View File

@@ -24,6 +24,7 @@ goog.require('ol.tilecoord');
ol.source.BingMaps = function(options) {
goog.base(this, {
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
opaque: true,
projection: ol.proj.get('EPSG:3857'),

View File

@@ -36,6 +36,7 @@ ol.source.MapQuest = function(opt_options) {
goog.base(this, {
attributions: layerConfig.attributions,
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
logo: 'https://developer.mapquest.com/content/osm/mq_logo.png',
maxZoom: layerConfig.maxZoom,

View File

@@ -32,6 +32,7 @@ ol.source.OSM = function(opt_options) {
goog.base(this, {
attributions: attributions,
cacheSize: options.cacheSize,
crossOrigin: crossOrigin,
opaque: options.opaque !== undefined ? options.opaque : true,
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,

View File

@@ -103,6 +103,7 @@ ol.source.Stamen = function(options) {
goog.base(this, {
attributions: ol.source.Stamen.ATTRIBUTIONS,
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
maxZoom: providerConfig.maxZoom,
// FIXME uncomment the following when tilegrid supports minZoom

View File

@@ -33,6 +33,7 @@ ol.source.TileArcGISRest = function(opt_options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
projection: options.projection,

View File

@@ -25,6 +25,7 @@ ol.source.TileImage = function(options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
extent: options.extent,
logo: options.logo,
opaque: options.opaque,

View File

@@ -31,6 +31,7 @@ ol.source.TileJSON = function(options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
projection: ol.proj.get('EPSG:3857'),
reprojectionErrorThreshold: options.reprojectionErrorThreshold,

View File

@@ -39,6 +39,7 @@ ol.source.TileWMS = function(opt_options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
opaque: !transparent,

View File

@@ -28,7 +28,7 @@ ol.source.VectorTile = function(options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK / 16,
cacheSize: options.cacheSize !== undefined ? options.cacheSize : 128,
extent: options.extent,
logo: options.logo,
opaque: options.opaque,

View File

@@ -174,6 +174,7 @@ ol.source.WMTS = function(options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
projection: options.projection,

View File

@@ -38,6 +38,7 @@ ol.source.XYZ = function(options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
opaque: options.opaque,

View File

@@ -121,6 +121,7 @@ ol.source.Zoomify = function(opt_options) {
goog.base(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
logo: options.logo,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,

View File

@@ -1,6 +1,5 @@
goog.provide('ol.TileCache');
goog.require('ol');
goog.require('ol.TileRange');
goog.require('ol.structs.LRUCache');
goog.require('ol.tilecoord');
@@ -20,8 +19,7 @@ ol.TileCache = function(opt_highWaterMark) {
* @private
* @type {number}
*/
this.highWaterMark_ = opt_highWaterMark !== undefined ?
opt_highWaterMark : ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK;
this.highWaterMark_ = opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;
};
goog.inherits(ol.TileCache, ol.structs.LRUCache);