make OWSCommon v1 support constraints in Get and Post nodes
This commit is contained in:
@@ -173,10 +173,22 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
"Get": function(node, http) {
|
||||
http.get = this.getAttributeNS(node,
|
||||
this.namespaces.xlink, "href");
|
||||
if (!http.constraints) {
|
||||
http.constraints = {};
|
||||
}
|
||||
var obj = {};
|
||||
this.readChildNodes(node, obj);
|
||||
http.constraints.get = obj.constraints;
|
||||
},
|
||||
"Post": function(node, http) {
|
||||
http.post = this.getAttributeNS(node,
|
||||
this.namespaces.xlink, "href");
|
||||
if (!http.constraints) {
|
||||
http.constraints = {};
|
||||
}
|
||||
var obj = {};
|
||||
this.readChildNodes(node, obj);
|
||||
http.constraints.post = obj.constraints;
|
||||
},
|
||||
"Parameter": function(node, operation) {
|
||||
if (!operation.parameters) {
|
||||
@@ -186,6 +198,14 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
operation.parameters[name] = {};
|
||||
this.readChildNodes(node, operation.parameters[name]);
|
||||
},
|
||||
"Constraint": function(node, obj) {
|
||||
if (!obj.constraints) {
|
||||
obj.constraints = {};
|
||||
}
|
||||
var name = node.getAttribute("name");
|
||||
obj.constraints[name] = {};
|
||||
this.readChildNodes(node, obj.constraints[name]);
|
||||
},
|
||||
"Value": function(node, allowedValues) {
|
||||
allowedValues[this.getChildValue(node)] = true;
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_ows(t) {
|
||||
t.plan(17);
|
||||
t.plan(20);
|
||||
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
|
||||
var doc = new OpenLayers.Format.XML().read(xml);
|
||||
var obj = new OpenLayers.Format.WMTSCapabilities().read(doc);
|
||||
@@ -31,8 +31,17 @@
|
||||
// ows:OperationsMetadata
|
||||
var operationsMetadata = obj.operationsMetadata;
|
||||
t.eq(operationsMetadata.GetCapabilities.dcp.http.get, "http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?", "ows:OperationsMetadata GetCapabilities url is correct");
|
||||
t.eq(operationsMetadata.GetCapabilities.dcp.http.constraints.get.GetEncoding.allowedValues,
|
||||
{'KVP': true},
|
||||
"ows:OperationsMetadata GetCapabilities Constraints Get is correct");
|
||||
t.eq(operationsMetadata.GetFeatureInfo.dcp.http.get, "http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?", "ows:OperationsMetadata GetFeatureInfo url is correct");
|
||||
t.eq(operationsMetadata.GetFeatureInfo.dcp.http.constraints.get,
|
||||
undefined,
|
||||
"ows:OperationsMetadata GetFeatureInfo Constraints Get is correct");
|
||||
t.eq(operationsMetadata.GetTile.dcp.http.get, "http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?", "ows:OperationsMetadata GetTile url is correct");
|
||||
t.eq(operationsMetadata.GetTile.dcp.http.constraints.get,
|
||||
undefined,
|
||||
"ows:OperationsMetadata GetTile Constraints Get is correct");
|
||||
}
|
||||
|
||||
function test_layers(t) {
|
||||
|
||||
Reference in New Issue
Block a user