/layer/styleParser
The styleParser module exports the styleParser method as default which is intended to check the consistency of layer styles and issue console warnings in regards to backwards compatibility.
- Source
Methods
(inner) catStyle(cat, layer)
The catStyle method parses the style object of a theme category object.
Category themes are attempted to be merged with the default style if possible.
Name | Type | Description |
---|---|---|
cat | object | The category object. |
layer | layer | The layer reference for the style/theme/cat object. |
- Source
(inner) clusterChecks(layer)
The clusterChecks styleParser module method checks the style configuration for a cluster layer.
Cluster layer are by defintion point layer and must have style.default.icon to represent point feature geometries.
Other vector geometries can not be displayed in a cluster feature layer. Stroke and fill styles will be removed from the style.default{} configuration.
The style.cluster{} configuration will be spread into a default cluster style object with clusterScale=1.
zoomInScale and zoomOutScale may apply to point features which are not cluster features and are moved to the layer.style.
Name | Type | Description |
---|---|---|
layer | layer | A json layer object. |
Name | Type | Description |
---|---|---|
layer.style | layer-style | The mapp-layer style configuration. |
layer.cluster | Object | Cluster configuration for a point layer. |
style.default | feature-style | Default feature style. |
style.cluster | feature-style | Style for cluster feature. |
style.selected | feature-style | Style for features of selected locations. |
- Source
(inner) graduatedTheme(theme, layer)
The checks the order of theme categories according to their value. The method will shortcircuit if the type of the theme is not graduated.
Name | Type | Description |
---|---|---|
theme | Object | A json theme object. |
layer | layer | A json layer object. |
Name | Type | Description |
---|---|---|
theme.type | string | The type of the theme. |
theme.graduated_breaks | string | The value order of categories, eg. 'less_than' or 'greater_than' |
theme.categories | array | An ordered array of theme categories. |
- Source
(inner) handleHovers(layer)
The handleHovers method parses the layer's hover/s properties. It provides fallback values to the hover/s key, title properties as well as assign a featureHover method if not provided. It also assigns the first hover string from the hovers if undefined.
Name | Type | Description |
---|---|---|
layer | layer | The layer reference for the style/hover/s object. |
Name | Type | Attributes | Description |
---|---|---|---|
layer.style | layer-style | The mapp-layer style configuration. | |
style.hover | string | <optional> | The current hover applied to the feature styling. |
style.hovers | array | <optional> | An array of hover objects available to be applied as the layer.style.hover. |
- Source
(inner) iconObject(style)
The iconObject method parses a feature-style object without an icon object to check whether there are icon object specific properties defined in the style object. An icon object will be created from the icon specific properties with these properties being removed from the style object itself.
Name | Type | Description |
---|---|---|
style | feature-style |
Name | Type | Attributes | Description |
---|---|---|---|
style.icon | object | <optional> | The style object already has an icon definition. |
- Source
(inner) parseTheme(theme, layer)
The parseTheme method checks whether a theme and it's categories have consistent style objects.
Name | Type | Description |
---|---|---|
theme | Object | A json theme object. |
layer | layer | A json layer object. |
Name | Type | Description |
---|---|---|
theme.type | string | The type of the theme. |
theme.categories | array | An ordered array of theme categories. |
layer.style | layer-style | The mapp-layer style configuration. |
style.default | feature-style | Default feature style. |
- Source
(inner) styleParser(layer)
The styleParser method parses and validates the mapp.style object and its properties.
The styleParser method checks the highlight features style and calls the warnings method.
The clusterStyle method is called to ensure that cluster layer have a cluster style.
Individual themes in the themes object are parsed and a theme is assigned to the
The parseTheme method is called for the layer.style.theme and each of the layer.style.themes.
A lookup will be attempted if the theme property is a string. Otherwise the first theme object property from the themes object is assigned as theme if undefined.
A lookup will be attempted if the hover property is a string. Otherwise the first hover object property from the hovers object is assigned as hover if undefined.
A lookup will be attempted if the label property is a string. Otherwise the first label object property from the labels object is assigned as label if undefined.
Name | Type | Description |
---|---|---|
layer | layer | A json layer object. |
Name | Type | Attributes | Description |
---|---|---|---|
layer.style | layer-style | The mapp-layer style configuration. | |
style.highlight | feature-style | <optional> | The feature style applied to features by the highlight interaction. |
style.theme | object | <optional> | The current theme applied to the feature styling. |
style.themes | array | <optional> | An array of theme objects available to be applied as the layer.style.theme. |
- Source
(inner) warnings(layer)
The warnings method parses the layer style configuration and warns on legacy configurations while trying to rectify these issues.
The method ensures that the layer-style object has a default feature-style. The default feature-style must have an icon if the layer is a cluster layer.
The default is a feature-style which must not contain a style object property.
The icon object of the default style is checked.
The layer.hover legacy configuration is checked.
The layer.style.zIndex legacy configuration is checked.
The layer.icon_scaling legacy configuartion is checked.
Name | Type | Description |
---|---|---|
layer | layer | A json layer object. |
Name | Type | Attributes | Description |
---|---|---|---|
layer.cluster | Object | <optional> | Cluster configuration for a point layer. |
layer.hover | Object | <optional> | Legacy configuration for style.hover. |
layer.icon_scaling | Object | <optional> | Legacy configuration for style.icon_scaling. |
layer.style | layer-style | The mapp-layer style configuration. | |
style.default | feature-style | Default feature style. | |
style.zIndex | integer | <optional> | Legacy configuration for layer.zIndex. |
- Source