Merge remote branch 'upstream/master'
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>Basic Bing Tiles with a Subset of Resolutions Example</title>
|
<title>Basic Bing Tiles with a Subset of Resolutions Example</title>
|
||||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>OpenLayers Canvas Hit Detection Example</title>
|
<title>OpenLayers Canvas Hit Detection Example</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
||||||
<link rel="stylesheet" href="style.css" type="text/css">
|
<link rel="stylesheet" href="style.css" type="text/css">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>OpenLayers Undo/Redo Drawing Methods</title>
|
<title>OpenLayers Undo/Redo Drawing Methods</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
||||||
<link rel="stylesheet" href="style.css" type="text/css">
|
<link rel="stylesheet" href="style.css" type="text/css">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>OpenLayers Editing Methods</title>
|
<title>OpenLayers Editing Methods</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
||||||
<link rel="stylesheet" href="style.css" type="text/css">
|
<link rel="stylesheet" href="style.css" type="text/css">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>OpenLayers Point Grid Example</title>
|
<title>OpenLayers Point Grid Example</title>
|
||||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>OpenLayers Snap Grid Example</title>
|
<title>OpenLayers Snap Grid Example</title>
|
||||||
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
|
||||||
|
|||||||
@@ -114,10 +114,13 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
|
|||||||
|
|
||||||
layer = new OpenLayers.Layer.WMTS(
|
layer = new OpenLayers.Layer.WMTS(
|
||||||
OpenLayers.Util.applyDefaults(config, {
|
OpenLayers.Util.applyDefaults(config, {
|
||||||
url: capabilities.operationsMetadata.GetTile.dcp.http.get,
|
url: config.requestEncoding === "REST" && layerDef.resourceUrl ?
|
||||||
|
layerDef.resourceUrl.tile.template :
|
||||||
|
capabilities.operationsMetadata.GetTile.dcp.http.get,
|
||||||
name: layerDef.title,
|
name: layerDef.title,
|
||||||
style: style.identifier,
|
style: style.identifier,
|
||||||
matrixIds: matrixSet.matrixIds
|
matrixIds: matrixSet.matrixIds,
|
||||||
|
tileFullExtent: matrixSet.bounds
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: url
|
* APIProperty: url
|
||||||
* {String} The base URL for the WMTS service. Must be provided.
|
* {String|Array(String)} The base URL or request URL template for the WMTS
|
||||||
|
* service. Must be provided. Array is only supported for base URLs, not
|
||||||
|
* for request URL templates. URL templates are only supported for
|
||||||
|
* REST <requestEncoding>.
|
||||||
*/
|
*/
|
||||||
url: null,
|
url: null,
|
||||||
|
|
||||||
@@ -416,17 +419,37 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
var center = bounds.getCenterLonLat();
|
var center = bounds.getCenterLonLat();
|
||||||
var info = this.getTileInfo(center);
|
var info = this.getTileInfo(center);
|
||||||
var matrixId = this.matrix.identifier;
|
var matrixId = this.matrix.identifier;
|
||||||
|
var dimensions = this.dimensions, params;
|
||||||
|
|
||||||
if (this.requestEncoding.toUpperCase() === "REST") {
|
if (this.requestEncoding.toUpperCase() === "REST") {
|
||||||
|
params = this.params;
|
||||||
|
if (typeof this.url === "string" && this.url.indexOf("{") !== -1) {
|
||||||
|
var template = this.url.replace(/\{/g, "${");
|
||||||
|
var context = {
|
||||||
|
// spec does not make clear if capital S or not
|
||||||
|
style: this.style, Style: this.style,
|
||||||
|
TileMatrixSet: this.matrixSet,
|
||||||
|
TileMatrix: this.matrix.identifier,
|
||||||
|
TileRow: info.row,
|
||||||
|
TileCol: info.col
|
||||||
|
};
|
||||||
|
if (dimensions) {
|
||||||
|
var dimension, i;
|
||||||
|
for (i=dimensions.length-1; i>=0; --i) {
|
||||||
|
dimension = dimensions[i];
|
||||||
|
context[dimension] = params[dimension.toUpperCase()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = OpenLayers.String.format(template, context);
|
||||||
|
} else {
|
||||||
// include 'version', 'layer' and 'style' in tile resource url
|
// include 'version', 'layer' and 'style' in tile resource url
|
||||||
var path = this.version + "/" + this.layer + "/" + this.style + "/";
|
var path = this.version + "/" + this.layer + "/" + this.style + "/";
|
||||||
|
|
||||||
// append optional dimension path elements
|
// append optional dimension path elements
|
||||||
if (this.dimensions) {
|
if (dimensions) {
|
||||||
for (var i=0; i<this.dimensions.length; i++) {
|
for (var i=0; i<dimensions.length; i++) {
|
||||||
if (this.params[this.dimensions[i]]) {
|
if (params[dimensions[i]]) {
|
||||||
path = path + this.params[this.dimensions[i]] + "/";
|
path = path + params[dimensions[i]] + "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,11 +467,11 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
url = url + "/";
|
url = url + "/";
|
||||||
}
|
}
|
||||||
url = url + path;
|
url = url + path;
|
||||||
|
}
|
||||||
} else if (this.requestEncoding.toUpperCase() === "KVP") {
|
} else if (this.requestEncoding.toUpperCase() === "KVP") {
|
||||||
|
|
||||||
// assemble all required parameters
|
// assemble all required parameters
|
||||||
var params = {
|
params = {
|
||||||
SERVICE: "WMTS",
|
SERVICE: "WMTS",
|
||||||
REQUEST: "GetTile",
|
REQUEST: "GetTile",
|
||||||
VERSION: this.version,
|
VERSION: this.version,
|
||||||
|
|||||||
@@ -221,6 +221,39 @@
|
|||||||
map.destroy();
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_getURL_resourceUrl(t) {
|
||||||
|
t.plan(2);
|
||||||
|
|
||||||
|
var xml = document.getElementById("capabilities").firstChild.nodeValue;
|
||||||
|
var doc = new OpenLayers.Format.XML().read(xml);
|
||||||
|
var obj = new OpenLayers.Format.WMTSCapabilities().read(doc);
|
||||||
|
|
||||||
|
var template = "http://www.example.com/{style}/{Time}/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png";
|
||||||
|
var layer = new OpenLayers.Layer.WMTS({
|
||||||
|
requestEncoding: "REST",
|
||||||
|
url: template,
|
||||||
|
layer: "GeoWebCache_USA_WMTS",
|
||||||
|
style: "foo",
|
||||||
|
matrixSet: "arcgis-online",
|
||||||
|
params: {Time: "2011"},
|
||||||
|
dimensions: ["Time"]
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new OpenLayers.Map("map", {
|
||||||
|
layers: [layer],
|
||||||
|
projection: "EPSG:4326",
|
||||||
|
maxResolution: 0.3515625,
|
||||||
|
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90)
|
||||||
|
});
|
||||||
|
map.setCenter(new OpenLayers.LonLat(-97.0, 38.0), 1);
|
||||||
|
t.eq(layer.getURL(new OpenLayers.Bounds(-135.0, 0.0, -90.0, 45.0)),
|
||||||
|
"http://www.example.com/foo/2011/foo/arcgis-online/1/1/1.png", "getURL returns correct url");
|
||||||
|
map.zoomIn();
|
||||||
|
t.eq(layer.getURL(new OpenLayers.Bounds(-180.0, 0.0, -90.0, 90.0)),
|
||||||
|
"http://www.example.com/foo/2011/foo/arcgis-online/2/2/2.png", "getURL returns correct url");
|
||||||
|
map.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
function test_destroy (t) {
|
function test_destroy (t) {
|
||||||
t.plan(3);
|
t.plan(3);
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
|
|||||||
Reference in New Issue
Block a user