Add serviceVersion property to Layer.TMS. (see #1023)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4521 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -13,6 +13,12 @@
|
|||||||
*/
|
*/
|
||||||
OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: serviceVersion
|
||||||
|
* {String}
|
||||||
|
*/
|
||||||
|
serviceVersion: "1.0.0",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: isBaseLayer
|
* APIProperty: isBaseLayer
|
||||||
* {Boolean}
|
* {Boolean}
|
||||||
@@ -91,7 +97,7 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
||||||
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
|
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
|
||||||
var z = this.map.getZoom();
|
var z = this.map.getZoom();
|
||||||
var path = "1.0.0" + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
|
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
|
||||||
var url = this.url;
|
var url = this.url;
|
||||||
if (url instanceof Array) {
|
if (url instanceof Array) {
|
||||||
url = this.selectUrl(path, url);
|
url = this.selectUrl(path, url);
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
*/
|
*/
|
||||||
function test_10_Layer_TMS_getURL(t) {
|
function test_10_Layer_TMS_getURL(t) {
|
||||||
|
|
||||||
t.plan(2);
|
t.plan(3);
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map', options);
|
var map = new OpenLayers.Map('map', options);
|
||||||
var options = {'layername':'basic', 'type':'png'};
|
var options = {'layername':'basic', 'type':'png'};
|
||||||
@@ -129,6 +129,12 @@
|
|||||||
var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
|
var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
|
||||||
t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/261/192.png", "Tile URL is correct");
|
t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/261/192.png", "Tile URL is correct");
|
||||||
|
|
||||||
|
var layer2 = layer.clone();
|
||||||
|
layer2.serviceVersion = "1.2.3";
|
||||||
|
map.addLayer(layer2);
|
||||||
|
tileurl = layer2.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
|
||||||
|
t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.2.3/basic/9/261/192.png", "TMS serviceVersion is correct");
|
||||||
|
|
||||||
layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"];
|
layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"];
|
||||||
tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
|
tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
|
||||||
t.eq(tileurl, "http://tilecache1/1.0.0/basic/9/261/192.png", "Tile URL is deterministic");
|
t.eq(tileurl, "http://tilecache1/1.0.0/basic/9/261/192.png", "Tile URL is deterministic");
|
||||||
|
|||||||
Reference in New Issue
Block a user