/layer/featureFields
The featureFields module exports methods to reset and process the layer.featureFields{} object.
The layer.featureFields{} object has field properties for each field in the layer.params.fields[] array.
The layer.params.fields[] array will be populated from the fieldsArray method prior to requesting features to be added to an Openlayers layer source.
The featureFields.process() method will be called from the featureFormats methods while creating Openlayers features.
- Source
Members
(inner, constant) processedThemes
The processedThemes WeakMap holds the theme for which the distribution of the current layer data has been processed.
The legend of a theme with a data distribution must only be drawn once the distribution has been processed from the layer data. A legend drawn prior would create the icons for every category in the theme configuration, which may be thousands of categories not present in the data.
- Source
Methods
(inner) count(layer)
The count distribution method counts values in the featureFields.values[] array.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
- Source
(inner) distributionReady(layer) → {Boolean}
The distributionReady method checks whether the legend for the current layer theme can be drawn.
A theme without a data distribution can always be drawn. A theme with a data distribution can only be drawn once its distribution has been processed from the current layer data. The legend of such a theme is drawn by the process method once the data has been received.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
| Name | Type | Attributes | Description |
|---|---|---|---|
style.theme | Object | <optional> | The current theme. |
theme.distribution | string | <optional> | The key of a featureFields distribution method. |
- Source
The legend for the current theme can be drawn.
- Type:
- Boolean
(inner) fieldsArray(layer) → {array}
The fieldsArray method checks the layer params and style to create a Set of fields which are required as feature properties.
An array without duplicates or undefined fields is returned from the Set.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp vector layer. |
- Source
Array of feature fields.
- Type:
- array
(inner) jenks(layer)
The jenks distribution method requires the stats.jenks utility method to calculate natural breaks within the featureFields.values[] array.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
- Source
(inner) process(layer)
The featureFields.process(layer) method will calculate the distribution of featureFields fields.values[] for featureStyle methods.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
| Name | Type | Description |
|---|---|---|
layer.style | layer-style | The layer style configuration. |
style.icon_scaling | Object | Configuration to scale style icons for point features. |
style.theme | Object | The current theme to style features according to their properties. |
- Source
(inner) reset(layer)
featureFields.reset(layer) method will reset the layer.featureFields{} object and create empty field.values[] arrays each field in the layer.params.fields[] array.
The processed distribution of the previous layer data is invalidated.
| Name | Type | Description |
|---|---|---|
layer | layer | A decorated mapp layer object. |
| Name | Type | Description |
|---|---|---|
layer.params | Object | |
params.fields | Array | Array of strings for feature property fields. |
- Source