Fix tile size and pixel ratio
This commit is contained in:
committed by
Bart van den Eijnden
parent
02c0a6a533
commit
d52b3715d9
@@ -23,6 +23,12 @@ goog.require('ol.tilegrid');
|
|||||||
*/
|
*/
|
||||||
ol.source.BingMaps = function(options) {
|
ol.source.BingMaps = function(options) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.hidpi_ = options.hidpi !== undefined ? options.hidpi : false;
|
||||||
|
|
||||||
ol.source.TileImage.call(this, {
|
ol.source.TileImage.call(this, {
|
||||||
cacheSize: options.cacheSize,
|
cacheSize: options.cacheSize,
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
@@ -31,15 +37,10 @@ ol.source.BingMaps = function(options) {
|
|||||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||||
state: ol.source.State.LOADING,
|
state: ol.source.State.LOADING,
|
||||||
tileLoadFunction: options.tileLoadFunction,
|
tileLoadFunction: options.tileLoadFunction,
|
||||||
|
tilePixelRatio: this.hidpi_ ? 2 : 1,
|
||||||
wrapX: options.wrapX !== undefined ? options.wrapX : true
|
wrapX: options.wrapX !== undefined ? options.wrapX : true
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.hidpi_ = options.hidpi !== undefined ? options.hidpi : false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -143,7 +144,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = function(response)
|
|||||||
extent: extent,
|
extent: extent,
|
||||||
minZoom: resource.zoomMin,
|
minZoom: resource.zoomMin,
|
||||||
maxZoom: maxZoom,
|
maxZoom: maxZoom,
|
||||||
tileSize: tileSize
|
tileSize: tileSize / this.getTilePixelRatio()
|
||||||
});
|
});
|
||||||
this.tileGrid = tileGrid;
|
this.tileGrid = tileGrid;
|
||||||
|
|
||||||
@@ -172,7 +173,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = function(response)
|
|||||||
ol.tilecoord.createOrUpdate(tileCoord[0], tileCoord[1],
|
ol.tilecoord.createOrUpdate(tileCoord[0], tileCoord[1],
|
||||||
-tileCoord[2] - 1, quadKeyTileCoord);
|
-tileCoord[2] - 1, quadKeyTileCoord);
|
||||||
var url = imageUrl;
|
var url = imageUrl;
|
||||||
if (hidpi && pixelRatio >= 2) {
|
if (hidpi) {
|
||||||
url += '&dpi=d1&device=mobile';
|
url += '&dpi=d1&device=mobile';
|
||||||
}
|
}
|
||||||
return url.replace('{quadkey}', ol.tilecoord.quadKey(
|
return url.replace('{quadkey}', ol.tilecoord.quadKey(
|
||||||
|
|||||||
Reference in New Issue
Block a user