added WFSCapabilities format. Original patch by tschaub, r=tschaub,me
(closes #1988) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9219 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -216,6 +216,10 @@
|
||||
"OpenLayers/Format/KML.js",
|
||||
"OpenLayers/Format/GeoRSS.js",
|
||||
"OpenLayers/Format/WFS.js",
|
||||
"OpenLayers/Format/WFSCapabilities.js",
|
||||
"OpenLayers/Format/WFSCapabilities/v1.js",
|
||||
"OpenLayers/Format/WFSCapabilities/v1_0_0.js",
|
||||
"OpenLayers/Format/WFSCapabilities/v1_1_0.js",
|
||||
"OpenLayers/Format/WFSDescribeFeatureType.js",
|
||||
"OpenLayers/Format/WMSDescribeLayer.js",
|
||||
"OpenLayers/Format/WMSDescribeLayer/v1_1.js",
|
||||
|
||||
117
lib/OpenLayers/Format/WFSCapabilities/v1.js
Normal file
117
lib/OpenLayers/Format/WFSCapabilities/v1.js
Normal file
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* @requires OpenLayers/Format/WFSCapabilities.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.WFSCapabilities.v1
|
||||
* Abstract class not to be instantiated directly.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format.XML>
|
||||
*/
|
||||
OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class(
|
||||
OpenLayers.Format.WFSCapabilities, {
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WFSCapabilities.v1_1
|
||||
* Create an instance of one of the subclasses.
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
|
||||
this.options = options;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: read
|
||||
* Read capabilities data from a string, and return a list of layers.
|
||||
*
|
||||
* Parameters:
|
||||
* data - {String} or {DOMElement} data to read/parse.
|
||||
*
|
||||
* Returns:
|
||||
* {Array} List of named layers.
|
||||
*/
|
||||
read: function(data) {
|
||||
if(typeof data == "string") {
|
||||
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
|
||||
}
|
||||
var capabilities = {};
|
||||
var root = data.documentElement;
|
||||
this.runChildNodes(capabilities, root);
|
||||
return capabilities;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: runChildNodes
|
||||
*/
|
||||
runChildNodes: function(obj, node) {
|
||||
var children = node.childNodes;
|
||||
var childNode, processor;
|
||||
for(var i=0; i<children.length; ++i) {
|
||||
childNode = children[i];
|
||||
if(childNode.nodeType == 1) {
|
||||
processor = this["read_cap_" + childNode.nodeName];
|
||||
if(processor) {
|
||||
processor.apply(this, [obj, childNode]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_FeatureTypeList
|
||||
*/
|
||||
read_cap_FeatureTypeList: function(request, node) {
|
||||
var featureTypeList = {
|
||||
featureTypes: []
|
||||
};
|
||||
this.runChildNodes(featureTypeList, node);
|
||||
request.featureTypeList = featureTypeList;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_FeatureType
|
||||
*/
|
||||
read_cap_FeatureType: function(featureTypeList, node, parentLayer) {
|
||||
var featureType = {};
|
||||
this.runChildNodes(featureType, node);
|
||||
featureTypeList.featureTypes.push(featureType);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_Name
|
||||
*/
|
||||
read_cap_Name: function(obj, node) {
|
||||
var name = this.getChildValue(node);
|
||||
if(name) {
|
||||
obj.name = name;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_Title
|
||||
*/
|
||||
read_cap_Title: function(obj, node) {
|
||||
var title = this.getChildValue(node);
|
||||
if(title) {
|
||||
obj.title = title;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_Abstract
|
||||
*/
|
||||
read_cap_Abstract: function(obj, node) {
|
||||
var abst = this.getChildValue(node);
|
||||
if(abst) {
|
||||
obj["abstract"] = abst;
|
||||
}
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1"
|
||||
|
||||
});
|
||||
31
lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
Normal file
31
lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @requires OpenLayers/Format/WFSCapabilities/v1.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.WFSCapabilities/v1_0_0
|
||||
* Read WMS Capabilities version 1.0.0.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format.WFSCapabilities>
|
||||
*/
|
||||
OpenLayers.Format.WFSCapabilities.v1_0_0 = OpenLayers.Class(
|
||||
OpenLayers.Format.WFSCapabilities.v1, {
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WFSCapabilities.v1_0_0
|
||||
* Create a new parser for WFS capabilities version 1.0.0.
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply(
|
||||
this, [options]
|
||||
);
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_0_0"
|
||||
|
||||
});
|
||||
31
lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
Normal file
31
lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @requires OpenLayers/Format/WFSCapabilities/v1.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.WFSCapabilities/v1_1_0
|
||||
* Read WFS Capabilities version 1.1.0.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format.WFSCapabilities>
|
||||
*/
|
||||
OpenLayers.Format.WFSCapabilities.v1_1_0 = OpenLayers.Class(
|
||||
OpenLayers.Format.WFSCapabilities.v1, {
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WFSCapabilities.v1_1_0
|
||||
* Create a new parser for WFS capabilities version 1.1.0.
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply(
|
||||
this, [options]
|
||||
);
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_1_0"
|
||||
|
||||
});
|
||||
128
tests/Format/WFSCapabilities/v1.html
Normal file
128
tests/Format/WFSCapabilities/v1.html
Normal file
File diff suppressed because one or more lines are too long
@@ -59,9 +59,10 @@
|
||||
<li>Format/Filter/v1.html</li>
|
||||
<li>Format/Filter/v1_0_0.html</li>
|
||||
<li>Format/Filter/v1_1_0.html</li>
|
||||
<li>Format/WFSDescribeFeatureType.html</li>
|
||||
<li>Format/WMSDescribeLayer.html</li>
|
||||
<li>Format/WFS.html</li>
|
||||
<li>Format/WFSCapabilities.html</li>
|
||||
<li>Format/WFSCapabilities/v1.html</li>
|
||||
<li>Format/WFSDescribeFeatureType.html</li>
|
||||
<li>Format/WFST.html</li>
|
||||
<li>Format/WFST/v1.html</li>
|
||||
<li>Format/WFST/v1_0_0.html</li>
|
||||
@@ -72,6 +73,7 @@
|
||||
<li>Format/WMC/v1.html</li>
|
||||
<li>Format/WMSCapabilities.html</li>
|
||||
<li>Format/WMSCapabilities/v1_1_1.html</li>
|
||||
<li>Format/WMSDescribeLayer.html</li>
|
||||
<li>Format/WMSGetFeatureInfo.html</li>
|
||||
<li>Format/XML.html</li>
|
||||
<li>Geometry.html</li>
|
||||
|
||||
Reference in New Issue
Block a user