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(),
visibility: map["layout"]["visibility"] == null
? Visibility.VISIBLE
: Visibility.values.firstWhere((e) => e
.toString()
.split('.')
.last
.toLowerCase()
.contains(map["layout"]["visibility"])),
hillshadeAccentColor:
(map["paint"]["hillshade-accent-color"] as List?)?.toRGBAInt(),
hillshadeExaggeration: map["paint"]["hillshade-exaggeration"]?.toDouble(),
hillshadeHighlightColor:
(map["paint"]["hillshade-highlight-color"] as List?)?.toRGBAInt(),
hillshadeIlluminationAnchor:
map["paint"]["hillshade-illumination-anchor"] == null
? null
: HillshadeIlluminationAnchor.values.firstWhere((e) => e
.toString()
.split('.')
.last
.toLowerCase()
.contains(map["paint"]["hillshade-illumination-anchor"])),
hillshadeIlluminationDirection:
map["paint"]["hillshade-illumination-direction"]?.toDouble(),
hillshadeShadowColor:
(map["paint"]["hillshade-shadow-color"] as List?)?.toRGBAInt(),
);
}