General Information
Configuring Layers
Helper Functions
External Libraries
Tools
General Information
Some General information that may help in sharing and using maps
description: Object
Raw Maps operations: 'normal' (NORMAL): A normal map is a map with each cell representing a legend/color and aren't a RAW Maps type. 'raw' (RAW): Each cell in resulting map has the value of ther most centered cell in aggregated region. 'rgba' (RGBA): Each cell in resulting map has a integer value representing the RGBA composition. PS: Tanto o resultado como o input são inteiros representando valores RGBA. 'sum' (SUM): Each resulting cell is the weighted sum of cells in the covering region. PS: The weight used is the proportion of the covered area against the total area of the cell i.e. VALUE * COVERED_PERCENTAGE. 'average' (AVERAGE): Each cell is the resulting of the weighted mean of cell in the covered region. i.e. Sum(A) / Sum(B) : A is CELL_VALUE * COVERED_PROPORTION, B is COVERED_PROPORTION. Example: A full covered cell the COVERED_PROPORTION is 1, and the half covered cell the proportion is 0.5 . 'max' (MAX): Each resulting cell is the greater cell that is at least partially covered in the given region. 'min' (MIN): Each resulting cell is the smaller cell that is at least partially covered in the given region. 'integral' (INTEGRAL): A technique that allows to calculate the sum in a region just inspecting the cells on the boundaries of a retangular area i.e. calculate sum in a region using only 4 points. 'areaintegral' (AREAINTEGRAL): ? 'area' (AREA): Each cell carry the original map area in the aggregated region. ?PS: Esse simplificador agrupa as áreas do mapa original e permite avialiar a área do mapa minimizando erros de calculos de área causados pela reprojeção uma vez q a própria célula armazena esse valor. 'cells' (CELLS): Weighted sum of the cell quantity in a given region.
Configuring Layers
Properties that allow to, define, custumize, provide functionalities to layers
getLayerLegend: function(composedLayer, index) : Array
Get the associated layer legend content by its index. PS: The legend format is the same as expected by the composedLayer.setCalculateLegend function. Usage:this.setCalculateLegend(ExtjsUtils.Layer.getLayerLegend(composedLayer, 0)); @param composedLayer {OpenLayers.Layer.Composed} Layer composed. @param index {Numeric} Index of the inside layer.
source: String
Define the source of the layer. EX: xyz, calculate, local, file, ... PS: If two layers colide returns the first that best fits. For example it is possible to use source name to match. Ex: XYZ:Layer vai buscar primeiro nos layers dentro dos stores e só depois vai forçar o 'xyz' store. XYZ as layer in calculate map
functions: Array|null
Allows to create custom functions on the context of each layer. These functions can be used in any tool callbacks, in the tool callback must use the same name in this 'functions' property. PS1: Functions are only visible inside this layer. PS2: Functions may be accessed by tools callbacks using its property name as (this.functions.['onClick']) to refer the following onClick function: functions: { onClick: function() { ExtjsUtils.ALERTIFY.log("Clicked Button"); } }
source: String
#TODO VICTOR: testar se está documentado, link para parte correta Verificar nome da função de criar source Defines layer source. 'local' - Maps available at Mappia server. 'calculate' - Combination of maps, allow map algebra. 'xyz' - Maps that use maps WMTS-like for map source. 'file' - Maps using data from data as csv or json. PS: It is possible to define other source using function ExtjsUtils.função
extents: Array
Override the map extents with a custom one. Extents must be in EPSG:4326 (coordinates in lat,long) array: [minX, minY, maxX, maxY] PS: All tiles within area will be requested.
name: String
Defines which maps are rendered in a layer. This string consists of map names separated by commas. Uses the full name of maps.
beforeCalc: Funtion
Function to be called always before the expression calculation. Ps: Even if maps don't have 'expression' function 'beforeCalc' function will be called. Ps2: This function is called synchronously and the context is the map layer. Ps3: This function can do useful things that depends on layer load end.
legendColor: function
Function to treat the color associated to each value/category. PS: This function callback is called in layer context. @param color {Array} Three numbers (0 to 255) to define the RGB color. @param inputs {Array} Array of widgets. @param lastValue {String} Last maximum title. @param currentValue {String} Current maximum title. @param ruleIndex {Numeric} Rule input index.
afterCalc: function
Callback called immediately after 'expression' function finishes. Ps: This function will only be called if 'expression' is defined.
expression: function
Callback processing 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.
onInputsReady: function
Callback function called after all inputs ready and loaded. PS: Its called even when the map is listed but not showing. @param inputs {Object} Inputs defined to interact with the map.
exclusiveGroupDetails: String
Only one layer with the same exclusiveGroupDetails may have its details shown
onVisibilityChange: function
Callback on layer visibility change. @param visibility {Boolean} True on showing map False otherwise. @param inputs {Object} Object with the input manager object.
isCalculationPaused: function() : Boolean
Returns calculation status. True if calculations are paused, false otherwise.
attribution: String
#TODO VICTOR: Não consegui fazer funcionar Recognizes someone as the platform author. "Powered by: ..."
maxExtent: OpenLayers.Bounds
#TODO VICTOR: NÃO TESTADO checar se é assim que funciona Defines a geographical limit for map rendering.
minscale: Numeric
Limits the real min scale of a given layer. (When map scale is lower than this, the image is reused and is compressed CHECAR!!!!)
maxscale: Numeric
Limits the real max scale of a given layer. (When map scale exceed this, the image is reused and is stretched)
maxZoom: Numeric
Limits the real max zoom of a given layer. (When map zoom exceed this, the image is reused and is stretched)
type: String
Use as data source in any of supported types: 'load', 'csv', 'json' or 'default'. 'load': Function to use as callback on 'loadData' property. The user is responsible for load data directly on layer. 'csv': Url address to load csv file from. 'json': Json data directly itself. 'jsonurl': Url address to load json from
title: String
Defines layer title, which is the name that is displayed in the menus to interact with a specific layer. Defaults to the map name
group: String
Defines which group is the layer associated with. Layers from the same group can't be active simultaneously.
visibility: Boolean
Defines the default layer visibility. If true the first time the platform is opened this layer will already be active
metadataUrl: string|null
Change the url as layer metadata information. The default value is obtained from layer metadata from PS: The linked domain must have CORS headers enabled.
hideLegendButton: boolean
Defines the visibility of the subtitles container. True to hide the subtitles container, false otherwise. PS: Only works if the source is not local
toggleHandler: function()
Handler is the callback when the ToggleButton is clicked. Overwrite to call a custom function. PS: Using custom function ignore the associatedButtonID "It doesnt have to even exists".
handler: function()
Handler is the callback when the button is clicked. Overwrite to call a custom function. PS: Using custom function ignore the associatedButtonID "It doesnt have to even exists".
useLayerTooltip: Boolean
if true, it allows to use the tooltip of a map if its source attribute is calculate.
onClickViewGroup: function
Layer configuration to use layer group click callback. PS: Function executed in the node context. PS2: this.expanded True when its opened False otherwise.
onToggleViewGroup: function
Layer property to use the group toggle callback. PS: Function executed in the node context. PS2: this.expanded True when its openned False otherwise.
hideButton: Boolean
#TODO VICTOR: Só FUNCIONA COM QUERY!!! Hide a button from the layer menu if used with "type:'query'".
hideBottomButton: Boolean
Hide the buttons that appear when the layer is expanded. Which are the "Show query" and "Show Legend" buttons.
type: String
Define the button type. Types: associated: {associatedButtonID: 'ANOTHER_BUTTON_ID', type: 'associated'} Treat the layer button and the associated as the same button, so no matter which one is clicked both will receive the click event. query: {type: 'query'} This configuration allows the user to change the default query button behavior overriting his definition. download: {type: 'download', layerIndex: 0} Set what layer should be downloaded when more than one layer is shown by its internal layer index. metadata: {type: 'metadata', layerIndex: 0} Set the metadata button to show one of the inside composite layer by his index. PS: The layerIndex is from 0 to the quantity of layers in a composed map. PS2: The properties are aditional, so the common must always be present, and for each type his corresponding property must be added.
iconCls: String
#TODO VICTOR: MUDAR DE LUGAR The class to add on the button. Ex: "icon-timeline-slider"
onHover: function
Add a hover callback. @param evt {Object} Features. @param state {Boolean} True when hover start, False when it ends. @param controller {Object} The controller itself. @param inputs {Object} Layer inputs.
onClick: function
Adds a callback function to the click event. @param event {Object} The click event Object. @param source {VectorFileSource} Auxiliary functions to deal with Vector Layer. @param inputs {Array.<Object>} Array with all layer input values.
onClickCfg: function
Allows to customize the Click Select controller. The additional parameters are listed in http://dev.openlayers.org/docs/files/OpenLayers/Control/SelectFeature-js.html. #checar tipa
updateAutomatically: Boolean
#TODO VICTOR: Isso está certo? Defines whether the calculations are made automatically after user interaction with parameters or not.
onLoad: function
Callback function after the layer is loaded or added to map. PS: Callback called on layer Context function(widgetValues)
popupCallback: function
#TODO VICTOR: melhorar descrição Function on popup. on callback param. (attributes, inputs) Scope in layer. @param attributes {Array} attributes for popupCallback @param inputs {Array} inputs for popupCallback
isCalculationPaused: function() : Boolean
Returns the current calculation status. If it is paused returns true. Ps: This one always returns true
getLayerDefinedFunctionsByName: function(name) : function|Undefined
Get layer inner function. Define layer inner function at VectorLayer. Ex: { name: 'CSR:map_name', function: { nameFunctionExample: function(){alert('a');} } } @param name {String} Function name
setDrawing: function(enabled, callbackOnAdd)
Controls drawing features on layer. PS: Function available to the VectorLayer. @param enabled {Boolean} True to enable drawing, False otherwise. @param callbackOnAdd {function} Callback when a new feature is drew. function(vectorLayer, drawEvent) vectorLayer: Current layer. drawEvent: The info of the added polygon. PS: This callback function is called on layer scope.
clusterDistance: Numeric
Set the minimum relative (pixel) distance to clusterize points. Set 0 to never clusterize, or a value greater than 0 to set the minimum distance. PS: When filters were applied you can use the property 'count' to check how many points exists in the current cluster.
getLonLat: function
Define the function to parse the data to get the geometry. Callback Function getVector function(attribute, config) @param attribute {Object} Object with attributes. @param config {Object} Layer config.
convertJsonEntryToFeature: function(curObj, optionalGetLonLat) : OpenLayers.Feature.Vector
Help to convert a JsonObject into a Layer Feature (can be added to layer). @param curObj {JsonObject} Object with properties. @param optionalGetLonLat {function} Optional function to get position coordinates from JSON. PS: Optional function to get X,Y values from Obj. (By default Longitude and Latitude use fields: lon and lat) function(curObj) returns OpenLayers.LonLat curObj: Object with JSON properties. This function receive the 'curObj' and expects to returns the object properties.
styleMap: Object
This attribute allows you to customize the layer visualization. (advanced parameter, is easier to use selectedStyle, defaultStyle and hoverStyle) It can be: undefined, a Config Object or an OpenLayers.StyleMap PS: Hover uses 'temporary' style.
onFeatureChangeCallback: function
Callback when a layer feature is added, removed or edited. onFeatureChangeCallback: function (operationType, arrFeatures) operationType: {String} Receive the operation type: 'add' or 'remove' when adding or removing respectively. arrFeatures: Array of features affected.
onBeforeFeatureChangeCallback: function
Callback before a layer feature is added, removed or edited. onBeforeFeatureChangeCallback: function(operationType, arrFeatures) operationType: {String} Receive the operation type: 'add' or 'remove' when adding or removing respectively. arrFeatures: Array of features affected. PS: Return false cancel the change operation.
onAdded: function
Callback function called when the layer is added to layer list. AddedEvent { element: {DOM} 'DOM element of the layer', layer: {OpenLayers.Layer.Vector} 'Javascript Object of the layer', map: {Map} 'MapPanel where the layer was added.', type: {String} 'Type of the event ( added )' }
defaultStyle: Object
Default style for the geometry. (PS: Accept 'context' and 'rules') Look at some examples at: http://dev.openlayers.org/examples/ PS: property 'context': allows definition of functions, PS2: property 'rules': allows definition of filters (only the geometries that fit into this rule will be displayed).
selectStyle: Object
Style for the selected geometry. (PS: Accept 'context' and 'rules') PS: Selected depends on 'onClick' property that allows to select. Look at some examples at: http://dev.openlayers.org/examples/ PS: property 'context': allows definition of functions, PS2: property 'rules': allows definition of filters (only the geometries that fit into this rule will be displayed).
hoverStyle: Object
Style for geometry when mouse is hovering. (PS: Accept 'context' and 'rules') PS: Hover depends on 'onHover' property that allows to hovering. Look at some examples at: http://dev.openlayers.org/examples/ PS: property 'context': allows definition of functions, PS2: property 'rules': allows definition of filters (only the geometries that fit into this rule will be displayed).
url: String
Define the url where the map can be fetched. Use ${x} ${y} ${z} as placeholder for x,y,z coordinates.
source: Object
#TODO VICTORD: CHECAR TIPO Add a layer to store source. PS: LayerConfig { url: url, name: name, isBaseLayer: isBaseLayer, sphericalMercator: sphericalMercator } @param layerCfg {LayerConfig} Layer XYZ configuration. LayerConfig { url: url, name: name, isBaseLayer: isBaseLayer, sphericalMercator: sphericalMercator }
Helper Functions
Set of functions that help creating map interactions
otherNames: String
Define adittional maps to be available for the query, wich will be listed in the filtered stored capabilities. PS: This property is to use along with the 'capabilities' option, wich filter the GetCapabilities cache only the maps in use. (Performance Optimization, faster loading).
changeLayers: function(newConfig, force)
Change a internal layer in a given index by another. PS: Its highly recommended to pass multiple configuration in a array, avoid call this function multiple times in the same callback. @param newConfig {Array|Object} One or more layers configurations with a property 'index' indicating the replacing layer. Each config object must contain at least the following properties: [{name: 'MAP_FULL_NAME', styles: 'MAP_STYLE', index: 'MAP_INDEX_TO_CHANGE'}, ... ] @param force {Boolean} Force redraw even if no change is done when the layer is the same.
log: function(msg, config)
Shows an user notification (if enabled). PS: The messages before layer loading are delayed, when it finishes only the last message will be shown. @param msg {String} Notification HTML content. @param config {Object} Message configuration parameters. {force: {Boolean} Force to show notification even when disabled. func: {Callback} Callback function when the notification is clicked. onlyMsg: {Boolean} True to only show message and hide the close and the stop notifications, False otherwise. delay: {Numeric} Amout of time in milisseconds before the message hide. spamTime: {Numeric} Time the same message to be shown again is considered spam. (even with force = true). }
runOnceLayerVisible: function(layer, callback)
Function that ensures that a function is called after layer is rendered. If the layer is already visible, the function is executed immediately. This may cause problems, for example, highcharts recognize it as an error. @param layer {OpenLayers.Layer} Layer that has to be rendered. @param callback {function} Function to be called.
addLayer: function(cfg)
Properly add layer from its definition. @param cfg {Object} Layer definition
addRemoteWMSServer: function(wmsDefinitions, QUERY_DESCRIPTION) : boolean
Function to add custom remote servers. @param wmsDefinitions {Object} A object with all custom WMS definitions. The object could contain the following properties: *url: {String} Url of the source (Mandatory). ?cors: {Boolean} True to accept (Cross Domain Request Security) CORS for servers without permission, False otherwise. ?updateWMS: {Boolean} True to purge the WMS cache and get the updated content, False otherwise. (Useful to avoid long waitings) ?storage: {String} Name of the storage service, supported services so far: 'github'. Storage type tips: 'github': The Github contenct directly. 'jsdelivr': The jsDelivr cache the results to force a instantly update the user could use different release version. Tutorial about creating releases: https://help.github.com/en/articles/creating-releases After creating the user could append @VERSION_NUMBER to the URL to force updating the map cache. @param QUERY_DESCRIPTION {ConfigLayer} Array Array of layers in the query. Usage: ExtjsUtils.QUERY.setQueryGlobalProperties({globalCount: 0}) && QUERY_DESCRIPTION
setQueryGlobalProperties: function(globalProperties, QUERY_DESCRIPTION) : bool
A function that allows to define custom global functions that can be used in order to define properties or even inside the functions callbacks. PS: All properties defined here are added to the global scope and are removed when the query is changed. @param globalProperties {Object} Object The object that all his functions will became globals, each property can be a value or a object or evan a function. @param QUERY_DESCRIPTION {ConfigLayer} Array Array of layers in the query. Usage: ExtjsUtils.QUERY.setQueryGlobalProperties({globalCount: 0}) && QUERY_DESCRIPTION
shapefile2GeojsonAsync: function(shpFile, paramOptions)
Parse shapefile to compatible Layer features. DBF file is optional. PS:ParamOptions { callback: {Function} 'Callback function with parsed shapefile' function(layer, parsedGeojson, originalData), fromProj: {String?} 'Projection name.' (EPSG:4326 or EPSG:900913), dbf: (Optional?)'DBF file to load along with shapefile.', limitCount: (Optional?)'Limit the amount of processed geometries' } @param shpFile {File} Shapefile content (Needs to be in projection EPSG:4326 or EPSG:900913. @param paramOptions {ParamOptions} Additional configuration for handling shapefile. ParamOptions { callback: {Function} 'Callback function with parsed shapefile' function(layer, parsedGeojson, originalData), fromProj: {String?} 'Projection name.' (EPSG:4326 or EPSG:900913), dbf: (Optional?)'DBF file to load along with shapefile.', limitCount: (Optional?)'Limit the amount of processed geometries' }
getLayersRecord: function(layerName, storeName) : Array.<Ext.data.Record>|Ext.data.Record|Null
Gets store layer information from its full name. PS: Parameter must be the full layer name such as: 'CSR:estados' or 'CSR:altimetria'. @param layerName {String} Optional Full layer name to look for, otherwise will return all records. (Leave it blank to get all records) @param storeName {String} Optional name to look only in a specific sources for 'layerName'. (Fill it to prevent from searching in all stores)
abbreviateNumber: function(value, useFixed, abbreviateNumbers) : Number|String
Auxiliary function to shorten the display of numbers. PS: The number loses a little precision but becomes more meaningful. @param value {Number} Value to be displayed. @param useFixed {Number} If set it will limit the number of decimal places, otherwise it will use the default value. @param abbreviateNumbers {Array.<Number>} Number suffix name.
External Libraries
External libraries that may be useful for creating data visualisation
Tools
Widgets that can be used to create interactions or load data to the application, they must be used in descriptionHtml and its parameters should be passed preceded by vertical bars. Examples: { ..., descriptionHtml: '\{\{widgetIdentifier|paramName=paramValue\}\}', ... } { ..., descriptionHtml: '\{\{button|id=btn_id|enableToggle=false\}\}' + '\{\{opacityslider\}\}', ... }
preventClick: Boolean
Defines state of filtering map by clicking at its legend. True to ignore the legend click, false otherwise.
filterLayers: Array
Array of indexes of layers to be included in map legend (from 0 to quantity of layers). If not defined, all layer legends are shown. Otherwise, only the indexes according to layer are included. Ex: A composed layer with three maps: name: "CSR:estados,CSR:roads,CSR:municipalities", If 'filterLayers=[1,2]' is in the layer object only the legends of 'CSR:roads' and 'CSR:municipalities' are shown.
hideLabel: Boolean
true to completely hide the label element (label and separator). Defaults to false. By default, even if you do not specify a fieldLabel the space will still be reserved so that the field will line up with other fields that do have labels. Setting this to true will cause the field to not reserve that space.
onPlayToggle: function
Callback function when the timeline start/stop playing. @param pressed {Boolean} True if the button was pressed, False otherwise. @param layer {Object} The layer associated to this timeline. @param timeline {Object} The timeline associated. @param playBtn {Object} The button changed.
description: function(name, config, layer, parameters) : Ext.Container
Create an input of summatory in any arbitrary area. CallBack parameters (context {OpenLayers.Layer}, layersValues {Array[Number]}, inputs {[Object]}, feature {Geometry}) runOnClick {Function} Callback called exactly after sum the map region., PS: 'layersValues' return the sum of each internal layer and an adittional value which is the sum of all pixels of resulting layer. @param name {String} Input name "summedarea". @param config {Object} Properties to customize the element. @param layer {OpenLayers.Layer} Layer which the widget is defined. @param parameters {Array} Array de parametros antes do processamento para o input.
onBeforeHide: function
Callback function to be called before hiding the floating window. @param layer {Object} Scope of the layer @param data {Array} [window, button, windowConfig] window: Window object; button: Button created; windowConfig: Window object configuration
ignoreVisibility: Boolean
Ignore the layer visibility toggle. True to window show or hide ignoring the layer visibility, False otherwise. PS: This 'ignoreVisibility' is not compatible with the 'associatedButtonID' property, when both are used together this value is ignored.
underButtons: Boolean
If true set the initial position of the window as under the right buttons panel.
x: Number
Initial absolute X position of the window. PS: Can be overwritten if defined together with 'underButtons' property.