/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.

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.

Parameters:
NameTypeDescription
catobject

The category object.

layerlayer

The layer reference for the style/theme/cat object.

(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.

Parameters:
NameTypeDescription
layerlayer

A json layer object.

Properties
NameTypeDescription
layer.stylelayer-style

The mapp-layer style configuration.

layer.clusterObject

Cluster configuration for a point layer.

style.defaultfeature-style

Default feature style.

style.clusterfeature-style

Style for cluster feature.

style.selectedfeature-style

Style for features of selected locations.

(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.

Parameters:
NameTypeDescription
themeObject

A json theme object.

layerlayer

A json layer object.

Properties
NameTypeDescription
theme.typestring

The type of the theme.

theme.graduated_breaksstring

The value order of categories, eg. 'less_than' or 'greater_than'

theme.categoriesarray

An ordered array of theme categories.

(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.

Parameters:
NameTypeDescription
layerlayer

The layer reference for the style/hover/s object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The mapp-layer style configuration.

style.hoverstring<optional>

The current hover applied to the feature styling.

style.hoversarray<optional>

An array of hover objects available to be applied as the layer.style.hover.

(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.

Parameters:
NameTypeDescription
stylefeature-style
Properties
NameTypeAttributesDescription
style.iconobject<optional>

The style object already has an icon definition.

(inner) parseTheme(theme, layer)

The parseTheme method checks whether a theme and it's categories have consistent style objects.

Parameters:
NameTypeDescription
themeObject

A json theme object.

layerlayer

A json layer object.

Properties
NameTypeDescription
theme.typestring

The type of the theme.

theme.categoriesarray

An ordered array of theme categories.

layer.stylelayer-style

The mapp-layer style configuration.

style.defaultfeature-style

Default feature style.

(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.

Parameters:
NameTypeDescription
layerlayer

A json layer object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The mapp-layer style configuration.

style.highlightfeature-style<optional>

The feature style applied to features by the highlight interaction.

style.themeobject<optional>

The current theme applied to the feature styling.

style.themesarray<optional>

An array of theme objects available to be applied as the layer.style.theme.

(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.

Parameters:
NameTypeDescription
layerlayer

A json layer object.

Properties
NameTypeAttributesDescription
layer.clusterObject<optional>

Cluster configuration for a point layer.

layer.hoverObject<optional>

Legacy configuration for style.hover.

layer.icon_scalingObject<optional>

Legacy configuration for style.icon_scaling.

layer.stylelayer-style

The mapp-layer style configuration.

style.defaultfeature-style

Default feature style.

style.zIndexinteger<optional>

Legacy configuration for layer.zIndex.