Allow extents to restrict tile ranges requested from the server
The addition of full extent tile ranges also allows us to simplify wrapX handling for tile layers. By limiting wrapX to true and false as possible values, we can remove a lot of guessing logic.
This commit is contained in:
@@ -115,22 +115,7 @@ 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]);
|
||||
});
|
||||
describe('#getTileCoordForTileUrlFunction()', function() {
|
||||
|
||||
it('returns the expected tile coordinate - {wrapX: true}', function() {
|
||||
var tileSource = new ol.source.Tile({
|
||||
@@ -138,13 +123,13 @@ describe('ol.source.Tile', function() {
|
||||
wrapX: true
|
||||
});
|
||||
|
||||
var tileCoord = tileSource.getWrapXTileCoord([6, -31, 22]);
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction([6, -31, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 33, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 33, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 97, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 97, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
});
|
||||
|
||||
@@ -154,13 +139,13 @@ describe('ol.source.Tile', function() {
|
||||
wrapX: false
|
||||
});
|
||||
|
||||
var tileCoord = tileSource.getWrapXTileCoord([6, -31, 22]);
|
||||
var tileCoord = tileSource.getTileCoordForTileUrlFunction([6, -31, 22]);
|
||||
expect(tileCoord).to.eql(null);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 33, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 33, 22]);
|
||||
expect(tileCoord).to.eql([6, 33, 22]);
|
||||
|
||||
tileCoord = tileSource.getWrapXTileCoord([6, 97, 22]);
|
||||
tileCoord = tileSource.getTileCoordForTileUrlFunction([6, 97, 22]);
|
||||
expect(tileCoord).to.eql(null);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user