Add reprojectionErrorThreshold option to the tiled image sources
This commit is contained in:
@@ -28,10 +28,12 @@ goog.require('ol.reproj.Triangulation');
|
||||
* @param {number} y
|
||||
* @param {number} pixelRatio
|
||||
* @param {function(number, number, number, number) : ol.Tile} getTileFunction
|
||||
* @param {number=} opt_errorThreshold
|
||||
* @param {boolean=} opt_renderEdges
|
||||
*/
|
||||
ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
||||
targetProj, targetTileGrid, z, x, y, pixelRatio, getTileFunction,
|
||||
opt_errorThreshold,
|
||||
opt_renderEdges) {
|
||||
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 errorThresholdInPixels = ol.DEFAULT_RASTER_REPROJ_ERROR_THRESHOLD;
|
||||
var errorThresholdInPixels = goog.isDef(opt_errorThreshold) ?
|
||||
opt_errorThreshold : ol.DEFAULT_RASTER_REPROJ_ERROR_THRESHOLD;
|
||||
|
||||
// in source units
|
||||
var errorThreshold = targetResolution * errorThresholdInPixels *
|
||||
|
||||
@@ -29,6 +29,7 @@ ol.source.BingMaps = function(options) {
|
||||
crossOrigin: 'anonymous',
|
||||
opaque: true,
|
||||
projection: ol.proj.get('EPSG:3857'),
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
state: ol.source.State.LOADING,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
wrapX: options.wrapX !== undefined ? options.wrapX : true
|
||||
|
||||
@@ -40,6 +40,7 @@ ol.source.MapQuest = function(opt_options) {
|
||||
crossOrigin: 'anonymous',
|
||||
logo: 'https://developer.mapquest.com/content/osm/mq_logo.png',
|
||||
maxZoom: layerConfig.maxZoom,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
opaque: true,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
url: url
|
||||
|
||||
@@ -36,6 +36,7 @@ ol.source.OSM = function(opt_options) {
|
||||
crossOrigin: crossOrigin,
|
||||
opaque: true,
|
||||
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
url: url,
|
||||
wrapX: options.wrapX
|
||||
|
||||
@@ -109,6 +109,7 @@ ol.source.Stamen = function(options) {
|
||||
// FIXME uncomment the following when tilegrid supports minZoom
|
||||
//minZoom: providerConfig.minZoom,
|
||||
opaque: layerConfig.opaque,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
url: url
|
||||
});
|
||||
|
||||
@@ -41,6 +41,7 @@ ol.source.TileArcGISRest = function(opt_options) {
|
||||
crossOrigin: options.crossOrigin,
|
||||
logo: options.logo,
|
||||
projection: options.projection,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileGrid: options.tileGrid,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
tileUrlFunction: goog.bind(this.tileUrlFunction_, this),
|
||||
|
||||
@@ -85,6 +85,12 @@ ol.source.TileImage = function(options) {
|
||||
*/
|
||||
this.tileGridForProjection = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
@@ -204,7 +210,8 @@ ol.source.TileImage.prototype.getTile =
|
||||
projection, targetTileGrid,
|
||||
z, x, y, pixelRatio, goog.bind(function(z, x, y, pixelRatio) {
|
||||
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
|
||||
}, this), this.renderReprojectionEdges_);
|
||||
}, this), this.reprojectionErrorThreshold_,
|
||||
this.renderReprojectionEdges_);
|
||||
|
||||
cache.set(tileCoordKey, tile);
|
||||
return tile;
|
||||
|
||||
@@ -34,6 +34,7 @@ ol.source.TileJSON = function(options) {
|
||||
attributions: options.attributions,
|
||||
crossOrigin: options.crossOrigin,
|
||||
projection: ol.proj.get('EPSG:3857'),
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
state: ol.source.State.LOADING,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
wrapX: options.wrapX !== undefined ? options.wrapX : true
|
||||
|
||||
@@ -45,6 +45,7 @@ ol.source.TileWMS = function(opt_options) {
|
||||
logo: options.logo,
|
||||
opaque: !transparent,
|
||||
projection: options.projection,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileGrid: options.tileGrid,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
tileUrlFunction: goog.bind(this.tileUrlFunction_, this),
|
||||
|
||||
@@ -185,6 +185,7 @@ ol.source.WMTS = function(options) {
|
||||
crossOrigin: options.crossOrigin,
|
||||
logo: options.logo,
|
||||
projection: options.projection,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileClass: options.tileClass,
|
||||
tileGrid: tileGrid,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
|
||||
@@ -49,6 +49,7 @@ ol.source.XYZ = function(options) {
|
||||
crossOrigin: options.crossOrigin,
|
||||
logo: options.logo,
|
||||
projection: projection,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileGrid: tileGrid,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
tilePixelRatio: options.tilePixelRatio,
|
||||
|
||||
@@ -124,6 +124,7 @@ ol.source.Zoomify = function(opt_options) {
|
||||
attributions: options.attributions,
|
||||
crossOrigin: options.crossOrigin,
|
||||
logo: options.logo,
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileClass: ol.source.ZoomifyTile_,
|
||||
tileGrid: tileGrid,
|
||||
tileUrlFunction: tileUrlFunction
|
||||
|
||||
Reference in New Issue
Block a user