InputManager

InputManager

Random Value Input

Random Value Input

Random Value Input

Fip Cerrado project

Fip Cerrado project

Mitigation option project

Mitigation option project

A tool that allows saving objects and states in a object to be used in multiple interactions. The stored value can store object to use multiple times, functions with his context, timers, or even variables or tables.

Usage: “\{\{inputmanager|id=ANY_UNIQUE_ID\}\}”

Mappia API

 
 

getValue: ({String}) => {Object}

Get the stored value by his property name, if it does not exists returns null.

@param key {String} Stored property name.
@returns {*} Desired stored property when it exists or null otherwise.
Usage: (inputs.id['id'].getValue('name'))

Defaults to undefined
 

forceRecalc: ()

Force a legend map recalculation.
Usage: (inputs.id['id'].forceRecalc())

Defaults to undefined
 

setValues: ({{obj}}, {{cancelUpdate}}, {{local}})

Stores object properties for later usage.

PS: If has name property collision the older is replaced.
@param obj {Object} Object with the properties to be stored.
@param cancelUpdate {Boolean} False if this change must cause layer recalculation, True otherwise.
@param local {Boolean} True to store the property locally, False otherwise. The local properties aren't sent to 'expression' calbacks. (i.e. If a element is recursive or have DOM elements, it must local avoid stringify errors on 'expression' callbacks)
Usage: (inputs.id['id'].setValues({toStore:5}, ))('name'))

Defaults to undefined
 

beforeCalc: {Function}({{inputs}})

Function called before each expression calculation.
Ps: Maps even without 'expression' function will call the 'beforeCalc' function on an input update.
Ps2: This function is called synchronously and the context is the map layer.
Usage: beforeCalc: function(inputs){}

Defaults to null
 

expression: {Function}({{layersVals}}, {{inputs}})

Function to process each layer pixels to the resulting map.

@param layersValue {Array} Array with the layers values, each layer in one position of the array.
@param inputs {Object} Inputs defined to interact with the map.
@return {*} Value of each processed pixel.
Usage: { expression: function(layersVals, inputs) {return layersVals[0];} }

Defaults to null
 

runOnceLayerVisible: ({{layer}}, {{callback}})

A function that assure that a function will be called only when the layers is/became visible.
layer: {Openlayers.Layer} A reference to the map layer.
callback: {Function} A function that will be called instantly if the layer is already visible, or when the layer became visible.
Usage: ExtjsUtils.QUERY.runOnceLayerVisible(this, function(){alert('Layer Visible.')});

Defaults to undefined