Add new cacheSize option to ol.source

Option added to:
 - olx.source.BingMapsOptions
 - olx.source.MapQuestOptions
 - olx.source.OSMOptions
 - olx.source.StamenOptions
 - olx.source.TileArcGISRestOptions
 - olx.source.TileImageOptions
 - olx.source.TileJSONOptions
 - olx.source.TileWMSOptions
 - olx.source.VectorTileOptions
 - olx.source.XYZOptions
 - olx.source.WMTSOptions
 - olx.source.ZoomifyOptions
This commit is contained in:
Frederic Junod
2016-02-08 15:10:31 +01:00
parent d5fb6dda49
commit 58d8b290af
13 changed files with 126 additions and 4 deletions

View File

@@ -3904,7 +3904,8 @@ olx.source;
/** /**
* @typedef {{culture: (string|undefined), * @typedef {{cacheSize: (number|undefined),
* culture: (string|undefined),
* key: string, * key: string,
* imagerySet: string, * imagerySet: string,
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
@@ -3916,6 +3917,14 @@ olx.source;
olx.source.BingMapsOptions; olx.source.BingMapsOptions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.BingMapsOptions.prototype.cacheSize;
/** /**
* Culture code. Default is `en-us`. * Culture code. Default is `en-us`.
* @type {string|undefined} * @type {string|undefined}
@@ -4107,6 +4116,7 @@ olx.source.TileUTFGridOptions.prototype.url;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
@@ -4136,6 +4146,14 @@ olx.source.TileImageOptions;
olx.source.TileImageOptions.prototype.attributions; olx.source.TileImageOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.TileImageOptions.prototype.cacheSize;
/** /**
* The `crossOrigin` attribute for loaded images. Note that you must provide a * The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to * `crossOrigin` value if you are using the WebGL renderer or if you want to
@@ -4270,6 +4288,7 @@ olx.source.TileImageOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* format: (ol.format.Feature|undefined), * format: (ol.format.Feature|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
@@ -4298,6 +4317,15 @@ olx.source.VectorTileOptions;
olx.source.VectorTileOptions.prototype.attributions; olx.source.VectorTileOptions.prototype.attributions;
/**
* Cache size. Default is `128`.
* @type {number|undefined}
* @api
*/
olx.source.VectorTileOptions.prototype.cacheSize;
/** /**
* Feature format for tiles. Used and required by the default * Feature format for tiles. Used and required by the default
* `tileLoadFunction`. * `tileLoadFunction`.
@@ -4518,7 +4546,8 @@ olx.source.ImageMapGuideOptions.prototype.params;
/** /**
* @typedef {{layer: string, * @typedef {{cacheSize: (number|undefined),
* layer: string,
* reprojectionErrorThreshold: (number|undefined), * reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined)}} * url: (string|undefined)}}
@@ -4527,6 +4556,14 @@ olx.source.ImageMapGuideOptions.prototype.params;
olx.source.MapQuestOptions; olx.source.MapQuestOptions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.MapQuestOptions.prototype.cacheSize;
/** /**
* Layer. Possible values are `osm`, `sat`, and `hyb`. * Layer. Possible values are `osm`, `sat`, and `hyb`.
* @type {string} * @type {string}
@@ -4600,6 +4637,7 @@ olx.source.TileDebugOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
@@ -4620,6 +4658,14 @@ olx.source.OSMOptions;
olx.source.OSMOptions.prototype.attributions; olx.source.OSMOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.OSMOptions.prototype.cacheSize;
/** /**
* The `crossOrigin` attribute for loaded images. Note that you must provide a * The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to * `crossOrigin` value if you are using the WebGL renderer or if you want to
@@ -5016,7 +5062,8 @@ olx.source.ImageWMSOptions.prototype.url;
/** /**
* @typedef {{layer: string, * @typedef {{cacheSize: (number|undefined),
* layer: string,
* minZoom: (number|undefined), * minZoom: (number|undefined),
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
@@ -5028,6 +5075,13 @@ olx.source.ImageWMSOptions.prototype.url;
olx.source.StamenOptions; olx.source.StamenOptions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.StamenOptions.prototype.cacheSize;
/** /**
* Layer. * Layer.
* @type {string} * @type {string}
@@ -5176,6 +5230,7 @@ olx.source.ImageStaticOptions.prototype.url;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* params: (Object.<string, *>|undefined), * params: (Object.<string, *>|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
@@ -5199,6 +5254,14 @@ olx.source.TileArcGISRestOptions;
olx.source.TileArcGISRestOptions.prototype.attributions; olx.source.TileArcGISRestOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.TileArcGISRestOptions.prototype.cacheSize;
/** /**
* The `crossOrigin` attribute for loaded images. Note that you must provide a * The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to * `crossOrigin` value if you are using the WebGL renderer or if you want to
@@ -5303,6 +5366,7 @@ olx.source.TileArcGISRestOptions.prototype.urls;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* jsonp: (boolean|undefined), * jsonp: (boolean|undefined),
* reprojectionErrorThreshold: (number|undefined), * reprojectionErrorThreshold: (number|undefined),
@@ -5324,6 +5388,14 @@ olx.source.TileJSONOptions;
olx.source.TileJSONOptions.prototype.attributions; olx.source.TileJSONOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.TileJSONOptions.prototype.cacheSize;
/** /**
* The `crossOrigin` attribute for loaded images. Note that you must provide a * The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to * `crossOrigin` value if you are using the WebGL renderer or if you want to
@@ -5385,6 +5457,7 @@ olx.source.TileJSONOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* params: Object.<string,*>, * params: Object.<string,*>,
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* gutter: (number|undefined), * gutter: (number|undefined),
@@ -5412,6 +5485,14 @@ olx.source.TileWMSOptions;
olx.source.TileWMSOptions.prototype.attributions; olx.source.TileWMSOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.TileWMSOptions.prototype.cacheSize;
/** /**
* WMS request parameters. At least a `LAYERS` param is required. `STYLES` is * WMS request parameters. At least a `LAYERS` param is required. `STYLES` is
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX` * `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
@@ -5675,6 +5756,7 @@ olx.source.VectorOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (string|null|undefined), * crossOrigin: (string|null|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* tileGrid: ol.tilegrid.WMTS, * tileGrid: ol.tilegrid.WMTS,
@@ -5709,6 +5791,14 @@ olx.source.WMTSOptions;
olx.source.WMTSOptions.prototype.attributions; olx.source.WMTSOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.WMTSOptions.prototype.cacheSize;
/** /**
* The `crossOrigin` attribute for loaded images. Note that you must provide a * The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to * `crossOrigin` value if you are using the WebGL renderer or if you want to
@@ -5882,6 +5972,7 @@ olx.source.WMTSOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
@@ -5910,6 +6001,14 @@ olx.source.XYZOptions;
olx.source.XYZOptions.prototype.attributions; olx.source.XYZOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.XYZOptions.prototype.cacheSize;
/** /**
* The `crossOrigin` attribute for loaded images. Note that you must provide a * The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to * `crossOrigin` value if you are using the WebGL renderer or if you want to
@@ -6048,6 +6147,7 @@ olx.source.XYZOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* reprojectionErrorThreshold: (number|undefined), * reprojectionErrorThreshold: (number|undefined),
@@ -6067,6 +6167,14 @@ olx.source.ZoomifyOptions;
olx.source.ZoomifyOptions.prototype.attributions; olx.source.ZoomifyOptions.prototype.attributions;
/**
* Cache size. Default is `2048`.
* @type {number|undefined}
* @api
*/
olx.source.ZoomifyOptions.prototype.cacheSize;
/** /**
* The `crossOrigin` attribute for loaded images. Note that you must provide a * The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to * `crossOrigin` value if you are using the WebGL renderer or if you want to

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -26,9 +26,12 @@ goog.require('ol.source.UrlTile');
*/ */
ol.source.VectorTile = function(options) { ol.source.VectorTile = function(options) {
var cacheSize = options.cacheSize !== undefined ?
options.cacheSize : ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK / 16;
goog.base(this, { goog.base(this, {
attributions: options.attributions, attributions: options.attributions,
cacheSize: ol.DEFAULT_TILE_CACHE_HIGH_WATER_MARK / 16, cacheSize: cacheSize,
extent: options.extent, extent: options.extent,
logo: options.logo, logo: options.logo,
opaque: options.opaque, opaque: options.opaque,

View File

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

View File

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

View File

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