mapp.layer.styleParser()

The styleParser module method is responsible for parsing and validating the layer.style object for assigning feature styles.

The main tasks performed by the styleParser module include:

  1. Assigning default styles:
  • It assigns a default highlight style to the layer if not explicitly provided.
  • It sets the default zIndex value for the highlight style to Infinity.
  • It assigns an empty object to layer.style if it doesn't exist.
  • It assigns an empty object to layer.style.default if it doesn't exist.
  1. Parsing theme styles:
  • If layer.style.theme exists, it calls the parseTheme function to process the theme style configuration.
  • If layer.style.themes exists, it iterates over each theme and calls the parseTheme function for each theme.
  1. Handling multiple themes, hovers, and labels:
  • If multiple themes are defined in layer.style.themes, it selects the appropriate theme based on the layer.style.theme value or the first theme in the object.
  • If multiple hovers are defined in layer.style.hovers, it selects the appropriate hover style based on the layer.style.hover value or the first hover style in the object.
  • If multiple labels are defined in layer.style.labels, it selects the appropriate label style based on the layer.style.label value or the first label style in the object.
  1. Handling warnings and deprecation notices:
  • It calls the warnings function to handle warnings and deprecation notices related to the layer style configuration.
  • It checks for deprecated properties and provides appropriate warnings or fallback values.
  1. Processing style objects:
  • It calls the styleObject function to process individual style objects within themes or categories.
  • It merges the category style with the default style and handles icon styles separately.
  1. Processing icon style objects:
  • It calls the iconObject function to process icon style objects within the layer style.
  • It moves icon-related properties into a separate icon object within the style.

Overall, the styleParser module ensures that the layer style configuration is properly structured, applies default styles where necessary, handles multiple themes, hovers, and labels, and processes individual style objects and icon styles. It helps to maintain a consistent and valid style configuration for the layer in the mapping application.

Methods

(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) styleParser(layer)

The styleParser method parses and validates the mapp.style object and its properties.

Parameters:
NameTypeDescription
layerlayer

A json layer object.

Properties
NameTypeDescription
layer.stylelayer-style

The mapp-layer style configuration.