Add reprojectionErrorThreshold option to the tiled image sources

This commit is contained in:
Petr Sloup
2015-07-23 15:04:58 +02:00
parent ebc1bc0096
commit 168b675191
13 changed files with 121 additions and 2 deletions

View File

@@ -3602,6 +3602,7 @@ olx.source;
* key: string, * key: string,
* imagerySet: string, * imagerySet: string,
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* wrapX: (boolean|undefined)}} * wrapX: (boolean|undefined)}}
* @api * @api
@@ -3642,6 +3643,14 @@ olx.source.BingMapsOptions.prototype.imagerySet;
olx.source.BingMapsOptions.prototype.maxZoom; olx.source.BingMapsOptions.prototype.maxZoom;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.BingMapsOptions.prototype.reprojectionErrorThreshold;
/** /**
* Optional function to load a tile given a URL. * Optional function to load a tile given a URL.
* @type {ol.TileLoadFunctionType|undefined} * @type {ol.TileLoadFunctionType|undefined}
@@ -3761,6 +3770,7 @@ olx.source.TileUTFGridOptions.prototype.url;
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
* projection: ol.proj.ProjectionLike, * projection: ol.proj.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
* state: (ol.source.State|string|undefined), * state: (ol.source.State|string|undefined),
* tileClass: (function(new: ol.ImageTile, ol.TileCoord, * tileClass: (function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string, * ol.TileState, string, ?string,
@@ -3819,6 +3829,14 @@ olx.source.TileImageOptions.prototype.opaque;
olx.source.TileImageOptions.prototype.projection; olx.source.TileImageOptions.prototype.projection;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.TileImageOptions.prototype.reprojectionErrorThreshold;
/** /**
* Source state. * Source state.
* @type {ol.source.State|string|undefined} * @type {ol.source.State|string|undefined}
@@ -4076,6 +4094,7 @@ olx.source.ImageMapGuideOptions.prototype.params;
/** /**
* @typedef {{layer: string, * @typedef {{layer: string,
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined)}} * url: (string|undefined)}}
* @api * @api
@@ -4091,6 +4110,14 @@ olx.source.MapQuestOptions;
olx.source.MapQuestOptions.prototype.layer; olx.source.MapQuestOptions.prototype.layer;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.MapQuestOptions.prototype.reprojectionErrorThreshold;
/** /**
* Optional function to load a tile given a URL. * Optional function to load a tile given a URL.
* @type {ol.TileLoadFunctionType|undefined} * @type {ol.TileLoadFunctionType|undefined}
@@ -4144,6 +4171,7 @@ olx.source.TileDebugOptions.prototype.wrapX;
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined), * url: (string|undefined),
* wrapX: (boolean|undefined)}} * wrapX: (boolean|undefined)}}
@@ -4182,6 +4210,14 @@ olx.source.OSMOptions.prototype.crossOrigin;
olx.source.OSMOptions.prototype.maxZoom; olx.source.OSMOptions.prototype.maxZoom;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.OSMOptions.prototype.reprojectionErrorThreshold;
/** /**
* Optional function to load a tile given a URL. * Optional function to load a tile given a URL.
* @type {ol.TileLoadFunctionType|undefined} * @type {ol.TileLoadFunctionType|undefined}
@@ -4538,6 +4574,7 @@ olx.source.ImageWMSOptions.prototype.url;
* minZoom: (number|undefined), * minZoom: (number|undefined),
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined)}} * url: (string|undefined)}}
* @api * @api
@@ -4577,6 +4614,14 @@ olx.source.StamenOptions.prototype.maxZoom;
olx.source.StamenOptions.prototype.opaque; olx.source.StamenOptions.prototype.opaque;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.StamenOptions.prototype.reprojectionErrorThreshold;
/** /**
* Optional function to load a tile given a URL. * Optional function to load a tile given a URL.
* @type {ol.TileLoadFunctionType|undefined} * @type {ol.TileLoadFunctionType|undefined}
@@ -4683,6 +4728,7 @@ olx.source.ImageStaticOptions.prototype.url;
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* tileGrid: (ol.tilegrid.TileGrid|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined),
* projection: ol.proj.ProjectionLike, * projection: ol.proj.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined), * url: (string|undefined),
* urls: (Array.<string>|undefined), * urls: (Array.<string>|undefined),
@@ -4754,6 +4800,14 @@ olx.source.TileArcGISRestOptions.prototype.tileGrid;
olx.source.TileArcGISRestOptions.prototype.projection; olx.source.TileArcGISRestOptions.prototype.projection;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.TileArcGISRestOptions.prototype.reprojectionErrorThreshold;
/** /**
* Optional function to load a tile given a URL. * Optional function to load a tile given a URL.
* @type {ol.TileLoadFunctionType|undefined} * @type {ol.TileLoadFunctionType|undefined}
@@ -4791,6 +4845,7 @@ olx.source.TileArcGISRestOptions.prototype.urls;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: string, * url: string,
* wrapX: (boolean|undefined)}} * wrapX: (boolean|undefined)}}
@@ -4821,6 +4876,14 @@ olx.source.TileJSONOptions.prototype.attributions;
olx.source.TileJSONOptions.prototype.crossOrigin; olx.source.TileJSONOptions.prototype.crossOrigin;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.TileJSONOptions.prototype.reprojectionErrorThreshold;
/** /**
* Optional function to load a tile given a URL. * Optional function to load a tile given a URL.
* @type {ol.TileLoadFunctionType|undefined} * @type {ol.TileLoadFunctionType|undefined}
@@ -4855,6 +4918,7 @@ olx.source.TileJSONOptions.prototype.wrapX;
* tileGrid: (ol.tilegrid.TileGrid|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined),
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* projection: ol.proj.ProjectionLike, * projection: ol.proj.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
* serverType: (ol.source.wms.ServerType|string|undefined), * serverType: (ol.source.wms.ServerType|string|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined), * url: (string|undefined),
@@ -4955,6 +5019,14 @@ olx.source.TileWMSOptions.prototype.maxZoom;
olx.source.TileWMSOptions.prototype.projection; olx.source.TileWMSOptions.prototype.projection;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.TileWMSOptions.prototype.reprojectionErrorThreshold;
/** /**
* The type of the remote WMS server. Currently only used when `hidpi` is * The type of the remote WMS server. Currently only used when `hidpi` is
* `true`. Default is `undefined`. * `true`. Default is `undefined`.
@@ -5120,6 +5192,7 @@ olx.source.VectorOptions.prototype.wrapX;
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* tileGrid: ol.tilegrid.WMTS, * tileGrid: ol.tilegrid.WMTS,
* projection: ol.proj.ProjectionLike, * projection: ol.proj.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
* requestEncoding: (ol.source.WMTSRequestEncoding|string|undefined), * requestEncoding: (ol.source.WMTSRequestEncoding|string|undefined),
* layer: string, * layer: string,
* style: string, * style: string,
@@ -5185,6 +5258,14 @@ olx.source.WMTSOptions.prototype.tileGrid;
olx.source.WMTSOptions.prototype.projection; olx.source.WMTSOptions.prototype.projection;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.WMTSOptions.prototype.reprojectionErrorThreshold;
/** /**
* Request encoding. Default is `KVP`. * Request encoding. Default is `KVP`.
* @type {ol.source.WMTSRequestEncoding|string|undefined} * @type {ol.source.WMTSRequestEncoding|string|undefined}
@@ -5311,6 +5392,7 @@ olx.source.WMTSOptions.prototype.wrapX;
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* projection: ol.proj.ProjectionLike, * projection: ol.proj.ProjectionLike,
* reprojectionErrorThreshold: (number|undefined),
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* minZoom: (number|undefined), * minZoom: (number|undefined),
* tileGrid: (ol.tilegrid.TileGrid|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined),
@@ -5362,6 +5444,14 @@ olx.source.XYZOptions.prototype.logo;
olx.source.XYZOptions.prototype.projection; olx.source.XYZOptions.prototype.projection;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.XYZOptions.prototype.reprojectionErrorThreshold;
/** /**
* Optional max zoom level. Default is `18`. * Optional max zoom level. Default is `18`.
* @type {number|undefined} * @type {number|undefined}
@@ -5452,6 +5542,7 @@ olx.source.XYZOptions.prototype.wrapX;
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
* reprojectionErrorThreshold: (number|undefined),
* url: !string, * url: !string,
* tierSizeCalculation: (string|undefined), * tierSizeCalculation: (string|undefined),
* size: ol.Size}} * size: ol.Size}}
@@ -5488,6 +5579,14 @@ olx.source.ZoomifyOptions.prototype.crossOrigin;
olx.source.ZoomifyOptions.prototype.logo; olx.source.ZoomifyOptions.prototype.logo;
/**
* Maximum allowed reprojection error.
* @type {number|undefined}
* @api
*/
olx.source.ZoomifyOptions.prototype.reprojectionErrorThreshold;
/** /**
* Prefix of URL template. * Prefix of URL template.
* @type {!string} * @type {!string}

View File

@@ -28,10 +28,12 @@ goog.require('ol.reproj.Triangulation');
* @param {number} y * @param {number} y
* @param {number} pixelRatio * @param {number} pixelRatio
* @param {function(number, number, number, number) : ol.Tile} getTileFunction * @param {function(number, number, number, number) : ol.Tile} getTileFunction
* @param {number=} opt_errorThreshold
* @param {boolean=} opt_renderEdges * @param {boolean=} opt_renderEdges
*/ */
ol.reproj.Tile = function(sourceProj, sourceTileGrid, ol.reproj.Tile = function(sourceProj, sourceTileGrid,
targetProj, targetTileGrid, z, x, y, pixelRatio, getTileFunction, targetProj, targetTileGrid, z, x, y, pixelRatio, getTileFunction,
opt_errorThreshold,
opt_renderEdges) { opt_renderEdges) {
goog.base(this, [z, x, y], ol.TileState.IDLE); goog.base(this, [z, x, y], ol.TileState.IDLE);
@@ -111,7 +113,8 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
var targetResolution = targetTileGrid.getResolution(z); var targetResolution = targetTileGrid.getResolution(z);
var errorThresholdInPixels = ol.DEFAULT_RASTER_REPROJ_ERROR_THRESHOLD; var errorThresholdInPixels = goog.isDef(opt_errorThreshold) ?
opt_errorThreshold : ol.DEFAULT_RASTER_REPROJ_ERROR_THRESHOLD;
// in source units // in source units
var errorThreshold = targetResolution * errorThresholdInPixels * var errorThreshold = targetResolution * errorThresholdInPixels *

View File

@@ -29,6 +29,7 @@ ol.source.BingMaps = function(options) {
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
opaque: true, opaque: true,
projection: ol.proj.get('EPSG:3857'), projection: ol.proj.get('EPSG:3857'),
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
state: ol.source.State.LOADING, state: ol.source.State.LOADING,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
wrapX: options.wrapX !== undefined ? options.wrapX : true wrapX: options.wrapX !== undefined ? options.wrapX : true

View File

@@ -40,6 +40,7 @@ ol.source.MapQuest = function(opt_options) {
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,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
opaque: true, opaque: true,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
url: url url: url

View File

@@ -36,6 +36,7 @@ ol.source.OSM = function(opt_options) {
crossOrigin: crossOrigin, crossOrigin: crossOrigin,
opaque: true, opaque: true,
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19, maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
url: url, url: url,
wrapX: options.wrapX wrapX: options.wrapX

View File

@@ -109,6 +109,7 @@ ol.source.Stamen = function(options) {
// FIXME uncomment the following when tilegrid supports minZoom // FIXME uncomment the following when tilegrid supports minZoom
//minZoom: providerConfig.minZoom, //minZoom: providerConfig.minZoom,
opaque: layerConfig.opaque, opaque: layerConfig.opaque,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
url: url url: url
}); });

View File

@@ -41,6 +41,7 @@ ol.source.TileArcGISRest = function(opt_options) {
crossOrigin: options.crossOrigin, crossOrigin: options.crossOrigin,
logo: options.logo, logo: options.logo,
projection: options.projection, projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileGrid: options.tileGrid, tileGrid: options.tileGrid,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
tileUrlFunction: goog.bind(this.tileUrlFunction_, this), tileUrlFunction: goog.bind(this.tileUrlFunction_, this),

View File

@@ -85,6 +85,12 @@ ol.source.TileImage = function(options) {
*/ */
this.tileGridForProjection = {}; this.tileGridForProjection = {};
/**
* @private
* @type {number|undefined}
*/
this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
@@ -204,7 +210,8 @@ ol.source.TileImage.prototype.getTile =
projection, targetTileGrid, projection, targetTileGrid,
z, x, y, pixelRatio, goog.bind(function(z, x, y, pixelRatio) { z, x, y, pixelRatio, goog.bind(function(z, x, y, pixelRatio) {
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection); return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
}, this), this.renderReprojectionEdges_); }, this), this.reprojectionErrorThreshold_,
this.renderReprojectionEdges_);
cache.set(tileCoordKey, tile); cache.set(tileCoordKey, tile);
return tile; return tile;

View File

@@ -34,6 +34,7 @@ ol.source.TileJSON = function(options) {
attributions: options.attributions, attributions: options.attributions,
crossOrigin: options.crossOrigin, crossOrigin: options.crossOrigin,
projection: ol.proj.get('EPSG:3857'), projection: ol.proj.get('EPSG:3857'),
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
state: ol.source.State.LOADING, state: ol.source.State.LOADING,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
wrapX: options.wrapX !== undefined ? options.wrapX : true wrapX: options.wrapX !== undefined ? options.wrapX : true

View File

@@ -45,6 +45,7 @@ ol.source.TileWMS = function(opt_options) {
logo: options.logo, logo: options.logo,
opaque: !transparent, opaque: !transparent,
projection: options.projection, projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileGrid: options.tileGrid, tileGrid: options.tileGrid,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
tileUrlFunction: goog.bind(this.tileUrlFunction_, this), tileUrlFunction: goog.bind(this.tileUrlFunction_, this),

View File

@@ -185,6 +185,7 @@ ol.source.WMTS = function(options) {
crossOrigin: options.crossOrigin, crossOrigin: options.crossOrigin,
logo: options.logo, logo: options.logo,
projection: options.projection, projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileClass: options.tileClass, tileClass: options.tileClass,
tileGrid: tileGrid, tileGrid: tileGrid,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,

View File

@@ -49,6 +49,7 @@ ol.source.XYZ = function(options) {
crossOrigin: options.crossOrigin, crossOrigin: options.crossOrigin,
logo: options.logo, logo: options.logo,
projection: projection, projection: projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileGrid: tileGrid, tileGrid: tileGrid,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
tilePixelRatio: options.tilePixelRatio, tilePixelRatio: options.tilePixelRatio,

View File

@@ -124,6 +124,7 @@ ol.source.Zoomify = function(opt_options) {
attributions: options.attributions, attributions: options.attributions,
crossOrigin: options.crossOrigin, crossOrigin: options.crossOrigin,
logo: options.logo, logo: options.logo,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileClass: ol.source.ZoomifyTile_, tileClass: ol.source.ZoomifyTile_,
tileGrid: tileGrid, tileGrid: tileGrid,
tileUrlFunction: tileUrlFunction tileUrlFunction: tileUrlFunction