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:
- 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 toInfinity
. - 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.
- Parsing theme styles:
- If
layer.style.theme
exists, it calls theparseTheme
function to process the theme style configuration. - If
layer.style.themes
exists, it iterates over each theme and calls theparseTheme
function for each theme.
- Handling multiple themes, hovers, and labels:
- If multiple themes are defined in
layer.style.themes
, it selects the appropriate theme based on thelayer.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 thelayer.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 thelayer.style.label
value or the first label style in the object.
- 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.
- 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.
- 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.
- Source
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.
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) styleParser(layer)
The styleParser method parses and validates the mapp.style object and its properties.
Name | Type | Description |
---|---|---|
layer | layer | A json layer object. |
Name | Type | Description |
---|---|---|
layer.style | layer-style | The mapp-layer style configuration. |
- Source