Use the correct name of the result, not just hard-coded 'result'.

This commit is contained in:
ahocevar
2012-08-13 13:29:34 +02:00
parent 94f3ab393f
commit 006d98151f
2 changed files with 15 additions and 12 deletions
+4 -3
View File
@@ -94,9 +94,10 @@ OpenLayers.WPSClient = OpenLayers.Class({
* geometries or features. * geometries or features.
* success - {Function} Callback to call when the process is complete. * success - {Function} Callback to call when the process is complete.
* This function is called with an outputs object as argument, which * This function is called with an outputs object as argument, which
* will have a 'result' property. For processes that generate spatial * will have a property with the name of the requested output (e.g.
* output, this will either be a single <OpenLayers.Feature.Vector> or * 'result'). For processes that generate spatial output, the value
* an array of features. * will either be a single <OpenLayers.Feature.Vector> or an array of
* features.
* scope - {Object} Optional scope for the success callback. * scope - {Object} Optional scope for the success callback.
*/ */
execute: function(options) { execute: function(options) {
+11 -9
View File
@@ -212,9 +212,10 @@ OpenLayers.WPSProcess = OpenLayers.Class({
* provided, the first output will be parsed. * provided, the first output will be parsed.
* success - {Function} Callback to call when the process is complete. * success - {Function} Callback to call when the process is complete.
* This function is called with an outputs object as argument, which * This function is called with an outputs object as argument, which
* will have a 'result' property. For processes that generate spatial * will have a property with the name of the requested output (e.g.
* output, this will either be a single <OpenLayers.Feature.Vector> or * 'result'). For processes that generate spatial output, the value
* an array of features. * will either be a single <OpenLayers.Feature.Vector> or an array of
* features.
* scope - {Object} Optional scope for the success callback. * scope - {Object} Optional scope for the success callback.
*/ */
execute: function(options) { execute: function(options) {
@@ -223,10 +224,10 @@ OpenLayers.WPSProcess = OpenLayers.Class({
callback: function() { callback: function() {
var me = this; var me = this;
//TODO For now we only deal with a single output //TODO For now we only deal with a single output
var output = this.getOutputIndex( var outputIndex = this.getOutputIndex(
me.description.processOutputs, options.output me.description.processOutputs, options.output
); );
me.setResponseForm({outputIndex: output}); me.setResponseForm({outputIndex: outputIndex});
(function callback() { (function callback() {
OpenLayers.Util.removeItem(me.executeCallbacks, callback); OpenLayers.Util.removeItem(me.executeCallbacks, callback);
if (me.chained !== 0) { if (me.chained !== 0) {
@@ -241,15 +242,16 @@ OpenLayers.WPSProcess = OpenLayers.Class({
url: me.client.servers[me.server].url, url: me.client.servers[me.server].url,
data: new OpenLayers.Format.WPSExecute().write(me.description), data: new OpenLayers.Format.WPSExecute().write(me.description),
success: function(response) { success: function(response) {
var output = me.description.processOutputs[outputIndex];
var mimeType = me.findMimeType( var mimeType = me.findMimeType(
me.description.processOutputs[output].complexOutput.supported.formats output.complexOutput.supported.formats
); );
//TODO For now we assume a spatial output //TODO For now we assume a spatial output
var features = me.formats[mimeType].read(response.responseText); var features = me.formats[mimeType].read(response.responseText);
if (options.success) { if (options.success) {
options.success.call(options.scope, { var outputs = {};
result: features outputs[output.identifier] = features;
}); options.success.call(options.scope, outputs);
} }
}, },
scope: me scope: me