/layer/themes/categorized
The layer theme module exports a method for categorized themes.
Methods
(inner) categorized(theme, feature)
The categorized theme method will assign a style from category matching the features properties.
Cluster features may not be styled by a categorized theme.
| Name | Type | Description |
|---|---|---|
theme | Object | The theme configuration object. |
feature | Object | The feature object. |
| Name | Type | Attributes | Description |
|---|---|---|---|
theme.categories | Array | ||
theme.field | string | <optional> | The feature property field to theme. |
feature.properties | Object | ||
properties.features | Array | <optional> | A cluster feature will have a features array property. |
(inner) themeFieldsLookup(theme, feature)
For categorical themes on multiple fields, the themeFieldsLookup function will loop through the theme.fields and apply an array of icon styles to the feature.style.icon property for each matching category.
The feature.style will be null if the matching category for any of the theme.fields has a null style [eg. the category is toggled off in the legend]. The feature is filtered out and must not be rendered with the icons from the remaining fields.
The icon styles array will not be reassigned if it already exists on the feature.style to prevent parsing the theme.categories on every feature in the render.
| Name | Type | Description |
|---|---|---|
theme | Object | The theme configuration object. |
feature | Object | The feature object. |
| Name | Type | Attributes | Description |
|---|---|---|---|
theme.categories | Array | ||
theme.fields | array | <optional> | A fields array to style multiple feature properties. |
feature.properties | Object |