[OpenLayers-Commits] r12006 - in sandbox/bartvde/wps/openlayers:
lib/OpenLayers/Format lib/OpenLayers/Format/OWSCommon tests/Format
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed May 25 11:00:16 EDT 2011
Author: bartvde
Date: 2011-05-25 08:00:15 -0700 (Wed, 25 May 2011)
New Revision: 12006
Modified:
sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/OWSCommon/v1.js
sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
Log:
more work on WPSExecute
Modified: sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/OWSCommon/v1.js
===================================================================
--- sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/OWSCommon/v1.js 2011-05-25 11:17:04 UTC (rev 12005)
+++ sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/OWSCommon/v1.js 2011-05-25 15:00:15 UTC (rev 12006)
@@ -251,6 +251,11 @@
value: title });
return node;
},
+ "Abstract": function(abstractValue) {
+ var node = this.createElementNSPlus("ows:Abstract", {
+ value: abstractValue });
+ return node;
+ },
"OutputFormat": function(format) {
var node = this.createElementNSPlus("ows:OutputFormat", {
value: format });
Modified: sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
===================================================================
--- sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-25 11:17:04 UTC (rev 12005)
+++ sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-25 15:00:15 UTC (rev 12006)
@@ -105,9 +105,36 @@
},
"ResponseForm": function(responseForm) {
var node = this.createElementNSPlus("wps:ResponseForm", {});
- this.writeNode("wps:RawDataOutput", responseForm.rawDataOutput, node);
+ if (responseForm.rawDataOutput) {
+ this.writeNode("wps:RawDataOutput", responseForm.rawDataOutput, node);
+ }
+ if (responseForm.responseDocument) {
+ this.writeNode("wps:ResponseDocument", responseForm.responseDocument, node);
+ }
return node;
},
+ "ResponseDocument": function(responseDocument) {
+ var node = this.createElementNSPlus("wps:ResponseDocument", {
+ attributes: {
+ storeExecuteResponse: responseDocument.storeExecuteResponse
+ }
+ });
+ if (responseDocument.output) {
+ this.writeNode("wps:Output", responseDocument.output, node);
+ }
+ return node;
+ },
+ "Output": function(output) {
+ var node = this.createElementNSPlus("wps:Output", {
+ attributes: {
+ asReference: output.asReference
+ }
+ });
+ this.writeNode("ows:Identifier", output.identifier, node);
+ this.writeNode("ows:Title", output.title, node);
+ this.writeNode("ows:Abstract", output["abstract"], node);
+ return node;
+ },
"RawDataOutput": function(rawDataOutput) {
var node = this.createElementNSPlus("wps:RawDataOutput", {
attributes: {
Modified: sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
===================================================================
--- sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-25 11:17:04 UTC (rev 12005)
+++ sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-25 15:00:15 UTC (rev 12006)
@@ -158,6 +158,74 @@
t.xml_eq(result, expected, "WPS Execute written out correctly");
}
+ function test_write_request_responseDoc_defaultFormat(t) {
+ t.plan(1);
+ // taken from http://geoprocessing.info/schemas/wps/1.0/examples/51_wpsExecute_request_ResponseDocument.xml
+ var expected = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
+'<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" ' +
+'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0' +
+' http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">' +
+' <ows:Identifier>Buffer</ows:Identifier>' +
+' <wps:DataInputs>' +
+' <wps:Input>' +
+' <ows:Identifier>InputPolygon</ows:Identifier>' +
+' <ows:Title>Playground area</ows:Title>' +
+' <wps:Reference xlink:href="http://foo.bar/some_WFS_request.xml"/>' +
+' </wps:Input>' +
+' <wps:Input>' +
+' <ows:Identifier>BufferDistance</ows:Identifier>' +
+' <ows:Title>Distance which people will walk to get to a playground.</ows:Title>' +
+' <wps:Data>' +
+' <wps:LiteralData>400</wps:LiteralData>' +
+' </wps:Data>' +
+' </wps:Input>' +
+' </wps:DataInputs>' +
+' <wps:ResponseForm>' +
+' <wps:ResponseDocument storeExecuteResponse="true">' +
+' <wps:Output asReference="true">' +
+' <ows:Identifier>BufferedPolygon</ows:Identifier>' +
+' <ows:Title>Area serviced by playground.</ows:Title>' +
+' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
+' </wps:Output>' +
+' </wps:ResponseDocument>' +
+' </wps:ResponseForm>' +
+'</wps:Execute>';
+
+ var format = new OpenLayers.Format.WPSExecute();
+ var result = format.write({
+ identifier: "Buffer",
+ dataInputs: {
+ inputs: [
+ {
+ identifier: 'InputPolygon',
+ title: 'Playground area',
+ reference: {
+ href: 'http://foo.bar/some_WFS_request.xml'
+ }
+ }, {
+ identifier: 'BufferDistance',
+ title: 'Distance which people will walk to get to a playground.',
+ data: {
+ literalData: 400
+ }
+ }
+ ]
+ },
+ responseForm: {
+ responseDocument: {
+ storeExecuteResponse: true,
+ output: {
+ asReference: true,
+ identifier: 'BufferedPolygon',
+ title: 'Area serviced by playground.',
+ abstract: 'Area within which most users of this playground will live.'
+ }
+ }
+ }
+ });
+ t.xml_eq(result, expected, "WPS Execute written out correctly");
+ }
+
</script>
</head>
<body>
More information about the Commits
mailing list