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

@@ -76,12 +76,13 @@ goog.inherits(ol.source.ImageSource, ol.source.Source);
* @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {ol.Size} size Size.
* @param {ol.Projection} projection Projection.
* @return {ol.Image} Single image.
*/
ol.source.ImageSource.prototype.createImage =
function(extent, resolution, size) {
function(extent, resolution, size, projection) {
var image = null;
var imageUrl = this.imageUrlFunction(extent, size);
var imageUrl = this.imageUrlFunction(extent, size, projection);
if (goog.isDef(imageUrl)) {
image = new ol.Image(
extent, resolution, imageUrl, this.crossOrigin_,
@@ -109,6 +110,7 @@ ol.source.ImageSource.prototype.findNearestResolution =
/**
* @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {ol.Projection} projection Projection.
* @return {ol.Image} Single image.
*/
ol.source.ImageSource.prototype.getImage = goog.abstractMethod;