Support tile sources without configured projection

This change adds a lot of flexibility to working with tile
layers: Sources where the server projection or tile grid do not
matter can now be constructed without specifying a projection or
tile grid.

The tileUrlFunction/imageUrlFunction now also creates updated
URLs when the params of the layer change, so things like
mergeNewParams in ol2 will be possible.

A nice side effect of this whole change is that there is no more
duplicated code between tiled and single image WMS layers.

While I was at it, I also fixed a WMS 1.1.1 axis order issue
and incorrect STYLES params (STYLES=& instead of STYLES&).
This commit is contained in:
ahocevar
2013-03-05 00:46:58 +01:00
parent cad215e0cc
commit 586f393492
24 changed files with 320 additions and 206 deletions

View File

@@ -169,16 +169,16 @@ describe('ol.tilegrid.TileGrid', function() {
expect(grid).toBeA(ol.tilegrid.TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).toBe(19);
expect(resolutions.length).toBe(ol.DEFAULT_MAX_ZOOM + 1);
});
it('accepts a number of zoom levels', function() {
var projection = ol.projection.getFromCode('EPSG:3857');
var grid = ol.tilegrid.createForProjection(projection, 22);
var grid = ol.tilegrid.createForProjection(projection, 18);
expect(grid).toBeA(ol.tilegrid.TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).toBe(23);
expect(resolutions.length).toBe(19);
});
it('accepts a big number of zoom levels', function() {
@@ -192,6 +192,28 @@ describe('ol.tilegrid.TileGrid', function() {
});
describe('getForProjection', function() {
it('gets the default tile grid for a projection', function() {
var projection = ol.projection.getFromCode('EPSG:3857');
var grid = ol.tilegrid.getForProjection(projection);
expect(grid).toBeA(ol.tilegrid.TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).toBe(ol.DEFAULT_MAX_ZOOM + 1);
expect(grid.getTileSize().toString()).toBe('(256 x 256)');
});
it('stores the default tile grid on a projection', function() {
var projection = ol.projection.getFromCode('EPSG:3857');
var grid = ol.tilegrid.getForProjection(projection);
var gridAgain = ol.tilegrid.getForProjection(projection);
expect(grid).toBe(gridAgain);
});
});
describe('getTileCoordFromCoordAndZ', function() {
describe('Y North, X East', function() {