Skip to content

Commit

Permalink
Use the correct name of the result, not just hard-coded 'result'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Aug 13, 2012
1 parent 94f3ab3 commit 006d981
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
7 changes: 4 additions & 3 deletions lib/OpenLayers/WPSClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ OpenLayers.WPSClient = OpenLayers.Class({
* geometries or features.
* success - {Function} Callback to call when the process is complete.
* This function is called with an outputs object as argument, which
* will have a 'result' property. For processes that generate spatial
* output, this will either be a single <OpenLayers.Feature.Vector> or
* an array of features.
* will have a property with the name of the requested output (e.g.
* 'result'). For processes that generate spatial output, the value
* will either be a single <OpenLayers.Feature.Vector> or an array of
* features.
* scope - {Object} Optional scope for the success callback.
*/
execute: function(options) {
Expand Down
20 changes: 11 additions & 9 deletions lib/OpenLayers/WPSProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ OpenLayers.WPSProcess = OpenLayers.Class({
* provided, the first output will be parsed.
* success - {Function} Callback to call when the process is complete.
* This function is called with an outputs object as argument, which
* will have a 'result' property. For processes that generate spatial
* output, this will either be a single <OpenLayers.Feature.Vector> or
* an array of features.
* will have a property with the name of the requested output (e.g.
* 'result'). For processes that generate spatial output, the value
* will either be a single <OpenLayers.Feature.Vector> or an array of
* features.
* scope - {Object} Optional scope for the success callback.
*/
execute: function(options) {
Expand All @@ -223,10 +224,10 @@ OpenLayers.WPSProcess = OpenLayers.Class({
callback: function() {
var me = this;
//TODO For now we only deal with a single output
var output = this.getOutputIndex(
var outputIndex = this.getOutputIndex(
me.description.processOutputs, options.output
);
me.setResponseForm({outputIndex: output});
me.setResponseForm({outputIndex: outputIndex});
(function callback() {
OpenLayers.Util.removeItem(me.executeCallbacks, callback);
if (me.chained !== 0) {
Expand All @@ -241,15 +242,16 @@ OpenLayers.WPSProcess = OpenLayers.Class({
url: me.client.servers[me.server].url,
data: new OpenLayers.Format.WPSExecute().write(me.description),
success: function(response) {
var output = me.description.processOutputs[outputIndex];
var mimeType = me.findMimeType(
me.description.processOutputs[output].complexOutput.supported.formats
output.complexOutput.supported.formats
);
//TODO For now we assume a spatial output
var features = me.formats[mimeType].read(response.responseText);
if (options.success) {
options.success.call(options.scope, {
result: features
});
var outputs = {};
outputs[output.identifier] = features;
options.success.call(options.scope, outputs);
}
},
scope: me
Expand Down

0 comments on commit 006d981

Please sign in to comment.