src/translate.js
function getFilterFn(layer, symbolizer) {
    const symbolizers = Object.keys(layer.shader)
        .filter(property => layer.shader[property].symbolizer === symbolizer);

    //No need to set a callback when at least one property is not filtered (i.e. it always activates the symbolizer)
    const alwaysActive = symbolizers
        .reduce((a, property) => a || !layer.shader[property].filtered, false);

    if (alwaysActive) {
        return undefined;
    }

    const fn = symbolizers
        .map((property) => layer.shader[property].js)
        .reduce((all, arr) => all.concat(arr), [])
        .join('');

    return wrapFn(`var _value = null; ${fn} return _value !== null;`);
}
function getFilterFn(layer, symbolizer) {
    const symbolizers = Object.keys(layer.shader)
        .filter(property => layer.shader[property].symbolizer === symbolizer);

    //No need to set a callback when at least one property is not filtered (i.e. it always activates the symbolizer)
    const alwaysActive = symbolizers
        .reduce((a, property) => a || !layer.shader[property].filtered, false);

    if (alwaysActive) {
        return undefined;
    }

    const fn = symbolizers
        .map((property) => layer.shader[property].js)
        .reduce((all, arr) => all.concat(arr), [])
        .join('');

    return wrapFn(`var _value = null; ${fn} return _value !== null;`);
}
function getFilterFn ( layer , symbolizer ) { const symbolizers = Object . keys ( layer . shader ) . filter ( property => layer . shader [ property ] . symbolizer === symbolizer ) ; //No need to set a callback when at least one property is not filtered (i.e. it always activates the symbolizer) const alwaysActive = symbolizers . reduce ( ( a , property ) => a || ! layer . shader [ property ] . filtered , false ) ; if ( alwaysActive ) { return undefined ; } const fn = symbolizers . map ( ( property ) => layer . shader [ property ] . js ) . reduce ( ( all , arr ) => all . concat ( arr ) , [ ] ) . join ( '' ) ; return wrapFn ( ` ${ fn } ` ) ; }
Returns a function string that dynamically filters symbolizer based on conditional properties
Returns a function string that dynamically filters symbolizer based on conditional properties