function mapDispatch() {
return {
onDownload: (src, mapSource, downloadFormat) => {
// find the layer and check to see if it has features,
// if features is undefined, then just return an empty collection.
let features = mapSource.features;
// check to see if there is a filter on the specified layer
let filter = null;
for (let i = 0, ii = mapSource.layers.length; filter === null && i < ii; i++) {
const layer = mapSource.layers[i];
if (layer.name === src.layerName && layer.filter !== undefined) {
filter = layer.filter;
}
}
// if a filter is found on the layer,
// then ensure only those features are matched.
if (filter !== null) {
features = matchFeatures(features, filter);
}
doDownload(features, downloadFormat);
},
};
}
Does not use dispatch or props so can likely be moved to a separate function with no react or redux dependencies.
In: gm3/src/gm3/components/catalog/tools/download.js
Does not use dispatch or props so can likely be moved to a separate function with no react or redux dependencies.