decode static method
Implementation
static HillshadeLayer decode(String properties) {
var map = json.decode(properties);
if (map["layout"] == null) {
map["layout"] = {};
}
if (map["paint"] == null) {
map["paint"] = {};
}
return HillshadeLayer(
id: map["id"],
sourceId: map["source"],
sourceLayer: map["source-layer"],
minZoom: map["minzoom"]?.toDouble(),
maxZoom: map["maxzoom"]?.toDouble(),
slot: map["slot"],
visibility: map["layout"]["visibility"] == null
? Visibility.VISIBLE
: Visibility.values.firstWhere(
(e) => e.name
.toLowerCase()
.replaceAll("_", "-")
.contains(map["layout"]["visibility"]),
),
visibilityExpression: styleOptionalCastList(map["layout"]["visibility"]),
filter: styleOptionalCastList(map["filter"]),
hillshadeAccentColor: (map["paint"]["hillshade-accent-color"] as List?)
?.toRGBAInt(),
hillshadeAccentColorExpression: styleOptionalCastList(
map["paint"]["hillshade-accent-color"],
),
hillshadeEmissiveStrength: styleOptionalCast(
map["paint"]["hillshade-emissive-strength"],
),
hillshadeEmissiveStrengthExpression: styleOptionalCastList(
map["paint"]["hillshade-emissive-strength"],
),
hillshadeExaggeration: styleOptionalCast(
map["paint"]["hillshade-exaggeration"],
),
hillshadeExaggerationExpression: styleOptionalCastList(
map["paint"]["hillshade-exaggeration"],
),
hillshadeHighlightColor:
(map["paint"]["hillshade-highlight-color"] as List?)?.toRGBAInt(),
hillshadeHighlightColorExpression: styleOptionalCastList(
map["paint"]["hillshade-highlight-color"],
),
hillshadeIlluminationAnchor:
map["paint"]["hillshade-illumination-anchor"] == null
? null
: HillshadeIlluminationAnchor.values.firstWhere(
(e) => e.name
.toLowerCase()
.replaceAll("_", "-")
.contains(map["paint"]["hillshade-illumination-anchor"]),
),
hillshadeIlluminationAnchorExpression: styleOptionalCastList(
map["paint"]["hillshade-illumination-anchor"],
),
hillshadeIlluminationDirection: styleOptionalCast(
map["paint"]["hillshade-illumination-direction"],
),
hillshadeIlluminationDirectionExpression: styleOptionalCastList(
map["paint"]["hillshade-illumination-direction"],
),
hillshadeShadowColor: (map["paint"]["hillshade-shadow-color"] as List?)
?.toRGBAInt(),
hillshadeShadowColorExpression: styleOptionalCastList(
map["paint"]["hillshade-shadow-color"],
),
);
}