Remove lint
This commit is contained in:
@@ -451,7 +451,8 @@ export function optionsFromCapabilities(wmtsCap, config) {
|
|||||||
const wrapX = false;
|
const wrapX = false;
|
||||||
|
|
||||||
const matrix0 = matrixSetObj.TileMatrix[0];
|
const matrix0 = matrixSetObj.TileMatrix[0];
|
||||||
const resolution = (matrix0.ScaleDenominator * 0.00028) / projection.getMetersPerUnit(); // WMTS 1.0.0: standardized rendering pixel size
|
const resolution =
|
||||||
|
(matrix0.ScaleDenominator * 0.00028) / projection.getMetersPerUnit(); // WMTS 1.0.0: standardized rendering pixel size
|
||||||
const origin =
|
const origin =
|
||||||
projection === getProjection('EPSG:4326')
|
projection === getProjection('EPSG:4326')
|
||||||
? [matrix0.TopLeftCorner[1], matrix0.TopLeftCorner[0]]
|
? [matrix0.TopLeftCorner[1], matrix0.TopLeftCorner[0]]
|
||||||
|
|||||||
@@ -349,14 +349,15 @@ describe('ol.source.WMTS', function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when creating options from wgs84 capabilities', function () {
|
describe('when creating options from wgs84 capabilities', function () {
|
||||||
const parser = new WMTSCapabilities();
|
const parser = new WMTSCapabilities();
|
||||||
let capabilities, content;
|
let capabilities;
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
afterLoadText('spec/ol/format/wmts/capabilities_wgs84.xml', function (xml) {
|
afterLoadText('spec/ol/format/wmts/capabilities_wgs84.xml', function (
|
||||||
|
xml
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
content = xml;
|
|
||||||
capabilities = parser.read(xml);
|
capabilities = parser.read(xml);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
done(e);
|
done(e);
|
||||||
@@ -364,45 +365,45 @@ describe('ol.source.WMTS', function () {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('returns correct bounding box', function () {
|
it('returns correct bounding box', function () {
|
||||||
const options = optionsFromCapabilities(capabilities, {
|
const options = optionsFromCapabilities(capabilities, {
|
||||||
layer: 'baselayer',
|
layer: 'baselayer',
|
||||||
matrixSet: 'inspire_quad',
|
matrixSet: 'inspire_quad',
|
||||||
requestEncoding: 'REST',
|
requestEncoding: 'REST',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(options.urls).to.be.an('array');
|
expect(options.urls).to.be.an('array');
|
||||||
expect(options.urls).to.have.length(1);
|
expect(options.urls).to.have.length(1);
|
||||||
expect(options.urls[0]).to.be.eql(
|
expect(options.urls[0]).to.be.eql(
|
||||||
'https://example.com/wmts/baselayer/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png'
|
'https://example.com/wmts/baselayer/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(options.layer).to.be.eql('baselayer');
|
expect(options.layer).to.be.eql('baselayer');
|
||||||
|
|
||||||
expect(options.matrixSet).to.be.eql('inspire_quad');
|
expect(options.matrixSet).to.be.eql('inspire_quad');
|
||||||
|
|
||||||
expect(options.format).to.be.eql('image/png');
|
expect(options.format).to.be.eql('image/png');
|
||||||
|
|
||||||
expect(options.projection).to.be.a(Projection);
|
expect(options.projection).to.be.a(Projection);
|
||||||
expect(options.projection).to.be.eql(getProjection('EPSG:4326'));
|
expect(options.projection).to.be.eql(getProjection('EPSG:4326'));
|
||||||
|
|
||||||
expect(options.requestEncoding).to.be.eql('REST');
|
expect(options.requestEncoding).to.be.eql('REST');
|
||||||
|
|
||||||
expect(options.tileGrid).to.be.a(WMTSTileGrid);
|
expect(options.tileGrid).to.be.a(WMTSTileGrid);
|
||||||
expect(options.style).to.be.eql('default');
|
expect(options.style).to.be.eql('default');
|
||||||
|
|
||||||
const extent = options.tileGrid.getExtent();
|
const extent = options.tileGrid.getExtent();
|
||||||
|
|
||||||
// compare with delta, due to rounding not the exact bounding box is returned...
|
// compare with delta, due to rounding not the exact bounding box is returned...
|
||||||
const expectDelta = (value, expected) => expect(Math.abs(value - expected)).to.below(1e-10);
|
const expectDelta = (value, expected) =>
|
||||||
|
expect(Math.abs(value - expected)).to.below(1e-10);
|
||||||
expectDelta(extent[0], -180);
|
|
||||||
expectDelta(extent[1], -90);
|
expectDelta(extent[0], -180);
|
||||||
expectDelta(extent[2], 180);
|
expectDelta(extent[1], -90);
|
||||||
expectDelta(extent[3], 90);
|
expectDelta(extent[2], 180);
|
||||||
});
|
expectDelta(extent[3], 90);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#setUrls()', function () {
|
describe('#setUrls()', function () {
|
||||||
@@ -533,6 +534,5 @@ describe('ol.source.WMTS', function () {
|
|||||||
const requestEncoding = source.getRequestEncoding();
|
const requestEncoding = source.getRequestEncoding();
|
||||||
expect(requestEncoding).to.be.eql('REST');
|
expect(requestEncoding).to.be.eql('REST');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user