1 |
3032
|
perry
|
/*
|
2 |
|
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
3 |
4307
|
leinfelder
|
$Id: WpsCapabilities.js 3657 2007-11-29 09:04:26Z gjvoosten $
|
4 |
3032
|
perry
|
*/
|
5 |
|
|
|
6 |
4307
|
leinfelder
|
// Ensure this object's dependancies are loaded.
|
7 |
|
|
mapbuilder.loadScript(baseDir+"/model/ModelBase.js");
|
8 |
|
|
|
9 |
3032
|
perry
|
/**
|
10 |
|
|
* Stores a Web Processing service (WPS) Capabilities document as defined by the
|
11 |
4307
|
leinfelder
|
* Open Geospatial Consortium (http://www.opengeospatial.org/).
|
12 |
3032
|
perry
|
*
|
13 |
|
|
* @constructor
|
14 |
4307
|
leinfelder
|
* @base ModelBase
|
15 |
3032
|
perry
|
* @author Mike Adair
|
16 |
|
|
* @param modelNode The model's XML object node from the configuration document.
|
17 |
|
|
* @param parent The model object that this widget belongs to.
|
18 |
|
|
*/
|
19 |
|
|
function WpsCapabilities(modelNode, parent) {
|
20 |
|
|
// Inherit the ModelBase functions and parameters
|
21 |
|
|
ModelBase.apply(this, new Array(modelNode, parent));
|
22 |
|
|
|
23 |
|
|
this.namespace = "xmlns:wps='http://www.opengis.net/wps' xmlns:ows='http://www.opengis.net/ows' xmlns:xlink='http://www.w3.org/1999/xlink'";
|
24 |
|
|
|
25 |
|
|
/**
|
26 |
|
|
* Returns the serverUrl for the WFS request passed in with the specified
|
27 |
|
|
* HTTP method from the capabilities doc.
|
28 |
|
|
* @param requestName the WFS request to get the URL for
|
29 |
|
|
* @param method http method for the request
|
30 |
|
|
* @param feature ignored for WFS docs
|
31 |
|
|
* @return URL for the specified request with the specified method
|
32 |
|
|
*/
|
33 |
|
|
this.getServerUrl = function(requestName, method, feature) {
|
34 |
|
|
var requestParts = requestName.split(':');
|
35 |
|
|
var xpath = "/wps:Capabilities/ows:OperationsMetadata/ows:Operation[@name='"+requestParts[1]+"']";
|
36 |
|
|
if (method.toLowerCase() == "post") {
|
37 |
|
|
xpath += "/ows:DCP/ows:HTTP/ows:Post";
|
38 |
|
|
} else {
|
39 |
|
|
xpath += "/ows:DCP/ows:HTTP/ows:Get";
|
40 |
|
|
}
|
41 |
|
|
var urlNode = this.doc.selectSingleNode(xpath);
|
42 |
|
|
if (urlNode) {
|
43 |
|
|
return urlNode.getAttribute("xlink:href");
|
44 |
|
|
} else {
|
45 |
|
|
return null;
|
46 |
|
|
}
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
/**
|
50 |
|
|
* Returns the version for the wps
|
51 |
|
|
* @return the wps version
|
52 |
|
|
*/
|
53 |
|
|
this.getVersion = function() {
|
54 |
|
|
var xpath = "/wps:Capabilities";
|
55 |
|
|
return this.doc.selectSingleNode(xpath).getAttribute("version");
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
/**
|
59 |
|
|
* Get HTTP method used to retreive this model
|
60 |
|
|
* @return the HTTP method
|
61 |
|
|
*/
|
62 |
|
|
this.getMethod = function() {
|
63 |
|
|
return this.method;
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
/**
|
67 |
|
|
* Returns the featureType node with the specified name from the list of nodes
|
68 |
|
|
* selected by the nodeSelectXpath from the capabilities doc.
|
69 |
|
|
* @param featureName name of the featureType to look up
|
70 |
|
|
* @return the featureType node with the specified name.
|
71 |
|
|
*/
|
72 |
|
|
this.getFeatureNode = function(featureName) {
|
73 |
|
|
return this.doc.selectSingleNode(this.nodeSelectXpath+"[wps:Name='"+featureName+"']");
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
}
|