Allow specifying non default DPI on ol.source.TileArcGISRest
This commit is contained in:
@@ -102,7 +102,9 @@ ol.source.TileArcGISRest.prototype.getRequestUrl_ =
|
|||||||
params['BBOX'] = tileExtent.join(',');
|
params['BBOX'] = tileExtent.join(',');
|
||||||
params['BBOXSR'] = srid;
|
params['BBOXSR'] = srid;
|
||||||
params['IMAGESR'] = srid;
|
params['IMAGESR'] = srid;
|
||||||
params['DPI'] = Math.round(90 * pixelRatio);
|
params['DPI'] = Math.round(
|
||||||
|
params['DPI'] ? params['DPI'] * pixelRatio : 90 * pixelRatio
|
||||||
|
);
|
||||||
|
|
||||||
var url;
|
var url;
|
||||||
if (urls.length == 1) {
|
if (urls.length == 1) {
|
||||||
|
|||||||
@@ -43,6 +43,16 @@ describe('ol.source.TileArcGISRest', function() {
|
|||||||
expect(queryData.get('DPI')).to.be('101');
|
expect(queryData.get('DPI')).to.be('101');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('takes DPI from params if specified', function() {
|
||||||
|
options.params.DPI = 96;
|
||||||
|
var source = new ol.source.TileArcGISRest(options);
|
||||||
|
var tile = source.getTile(3, 2, -7, 1.12, ol.proj.get('EPSG:3857'));
|
||||||
|
var uri = new goog.Uri(tile.src_);
|
||||||
|
var queryData = uri.getQueryData();
|
||||||
|
expect(queryData.get('DPI')).to.be('108');
|
||||||
|
delete options.params.DPI;
|
||||||
|
});
|
||||||
|
|
||||||
it('returns a tile with the expected URL with url list', function() {
|
it('returns a tile with the expected URL with url list', function() {
|
||||||
|
|
||||||
options.urls = ['http://test1.com/MapServer',
|
options.urls = ['http://test1.com/MapServer',
|
||||||
|
|||||||
Reference in New Issue
Block a user