1
|
/*
|
2
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
3
|
$Id$
|
4
|
*/
|
5
|
|
6
|
/**
|
7
|
* Stores a Web Feature (WFS) Capabilities document as defined by the
|
8
|
* Open Geospatial Consortium (http://opengis.org).
|
9
|
*
|
10
|
* @constructor
|
11
|
* @author Mike Adair
|
12
|
* @param modelNode The model's XML object node from the configuration document.
|
13
|
* @param parent The model object that this widget belongs to.
|
14
|
*/
|
15
|
function WfsCapabilities(modelNode, parent) {
|
16
|
// Inherit the ModelBase functions and parameters
|
17
|
ModelBase.apply(this, new Array(modelNode, parent));
|
18
|
|
19
|
this.namespace = "xmlns:wfs='http://www.opengis.net/wfs'";
|
20
|
|
21
|
/**
|
22
|
* Returns the serverUrl for the WFS request passed in with the specified
|
23
|
* HTTP method from the capabilities doc.
|
24
|
* @param requestName the WFS request to get the URL for
|
25
|
* @param method http method for the request
|
26
|
* @param feature ignored for WFS docs
|
27
|
* @return URL for the specified request with the specified method
|
28
|
*/
|
29
|
this.getServerUrl = function(requestName, method, feature) {
|
30
|
var xpath = "/wfs:WFS_Capabilities/wfs:Capability/wfs:Request/"+requestName;
|
31
|
if (method.toLowerCase() == "post") {
|
32
|
xpath += "/wfs:DCPType/wfs:HTTP/wfs:Post";
|
33
|
} else {
|
34
|
xpath += "/wfs:DCPType/wfs:HTTP/wfs:Get";
|
35
|
}
|
36
|
return this.doc.selectSingleNode(xpath).getAttribute("onlineResource");
|
37
|
}
|
38
|
|
39
|
/**
|
40
|
* Returns the version for the WFS
|
41
|
* @return the WFS version
|
42
|
*/
|
43
|
this.getVersion = function() {
|
44
|
var xpath = "/wfs:WFS_Capabilities";
|
45
|
return this.doc.selectSingleNode(xpath).getAttribute("version");
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* Get HTTP method used to retreive this model
|
50
|
* @return the HTTP method
|
51
|
*/
|
52
|
this.getMethod = function() {
|
53
|
return this.method;
|
54
|
}
|
55
|
|
56
|
/**
|
57
|
* Returns the featureType node with the specified name from the list of nodes
|
58
|
* selected by the nodeSelectXpath from the capabilities doc.
|
59
|
* @param featureName name of the featureType to look up
|
60
|
* @return the featureType node with the specified name.
|
61
|
*/
|
62
|
this.getFeatureNode = function(featureName) {
|
63
|
return this.doc.selectSingleNode(this.nodeSelectXpath+"[wfs:Name='"+featureName+"']");
|
64
|
}
|
65
|
|
66
|
}
|
67
|
|