Added Bing layer with direct tile access. p=me,tschaub r=tschaub,me (closes #2975)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10975 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2010-12-17 23:46:22 +00:00
parent 62d91da358
commit 1b9996d62c
8 changed files with 470 additions and 11 deletions

View File

@@ -107,7 +107,7 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
},
/**
* Method: getUrl
* Method: getURL
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
@@ -118,6 +118,27 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
* parameters
*/
getURL: function (bounds) {
var xyz = this.getXYZ(bounds);
var url = this.url;
if (url instanceof Array) {
var s = '' + xyz.x + xyz.y + xyz.z;
url = this.selectUrl(s, url);
}
return OpenLayers.String.format(url, xyz);
},
/**
* Method: getXYZ
* Calculates x, y and z for the given bounds.
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
*
* Returns:
* {Object} - an object with x, y and z properties.
*/
getXYZ: function(bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left)
/ (res * this.tileSize.w));
@@ -127,16 +148,7 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
OpenLayers.Util.indexOf(this.serverResolutions, res) :
this.map.getZoom() + this.zoomOffset;
var url = this.url;
var s = '' + x + y + z;
if (url instanceof Array)
{
url = this.selectUrl(s, url);
}
var path = OpenLayers.String.format(url, {'x': x, 'y': y, 'z': z});
return path;
return {'x': x, 'y': y, 'z': z};
},
/**