buildLayerProperties function

LayerProperties buildLayerProperties(
  1. String type,
  2. Map<String, dynamic> props
)

Dựng LayerProperties từ map phẳng kebab-case (gộp paint + layout).

*LayerProperties.fromJson đọc đúng khoá kebab-case của MapLibre style spec (circle-radius, line-color, visibility…), nên không cần bảng ánh xạ.

Implementation

LayerProperties buildLayerProperties(String type, Map<String, dynamic> props) {
  switch (type) {
    case 'circle':
      return CircleLayerProperties.fromJson(props);
    case 'line':
      return LineLayerProperties.fromJson(props);
    case 'fill':
      return FillLayerProperties.fromJson(props);
    case 'fill-extrusion':
      return FillExtrusionLayerProperties.fromJson(props);
    case 'symbol':
      return SymbolLayerProperties.fromJson(props);
    case 'heatmap':
      return HeatmapLayerProperties.fromJson(props);
    default:
      throw ArgumentError("Unsupported layer type '$type'");
  }
}