Add ol.source.Tile support for wrapping around the x-axis
This commit is contained in:
@@ -115,6 +115,56 @@ describe('ol.source.Tile', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('#getWrapXTileCoord()', function() {
|
||||
|
||||
it('returns the expected tile coordinate - {wrapX: undefined}', function() {
|
||||
var tileSource = new ol.source.Tile({
|
||||
projection: 'EPSG:3857'
|
||||
});
|
||||
|
||||
var tileCoord = tileSource.getWrapXTileCoord([6, -31, 22]);
|
||||
expect(tileCoord).to.eql([6, -31, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 33, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 97, 22]);
|
||||
expect(tileCoord).to.eql([6, 97, 22]);
|
||||
});
|
||||
|
||||
it('returns the expected tile coordinate - {wrapX: true}', function() {
|
||||
var tileSource = new ol.source.Tile({
|
||||
projection: 'EPSG:3857',
|
||||
wrapX: true
|
||||
});
|
||||
|
||||
var tileCoord = tileSource.getWrapXTileCoord([6, -31, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 33, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 97, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
});
|
||||
|
||||
it('returns the expected tile coordinate - {wrapX: false}', function() {
|
||||
var tileSource = new ol.source.Tile({
|
||||
projection: 'EPSG:3857',
|
||||
wrapX: false
|
||||
});
|
||||
|
||||
var tileCoord = tileSource.getWrapXTileCoord([6, -31, 22]);
|
||||
expect(tileCoord).to.eql(null);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 33, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 97, 22]);
|
||||
expect(tileCoord).to.eql(null);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -64,14 +64,17 @@ describe('ol.source.XYZ', function() {
|
||||
describe('wrap x', function() {
|
||||
|
||||
it('returns the expected URL', function() {
|
||||
var projection = xyzTileSource.getProjection();
|
||||
var tileUrl = xyzTileSource.tileUrlFunction(
|
||||
[6, -31, -23]);
|
||||
xyzTileSource.getWrapXTileCoord([6, -31, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = xyzTileSource.tileUrlFunction([6, 33, -23]);
|
||||
tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getWrapXTileCoord([6, 33, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = xyzTileSource.tileUrlFunction([6, 97, -23]);
|
||||
tileUrl = xyzTileSource.tileUrlFunction(
|
||||
xyzTileSource.getWrapXTileCoord([6, 97, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user