UNPKG

1.13 kBPlain TextView Raw
1import circle from './style_layer/circle_style_layer';
2import heatmap from './style_layer/heatmap_style_layer';
3import hillshade from './style_layer/hillshade_style_layer';
4import fill from './style_layer/fill_style_layer';
5import fillExtrusion from './style_layer/fill_extrusion_style_layer';
6import line from './style_layer/line_style_layer';
7import symbol from './style_layer/symbol_style_layer';
8import background from './style_layer/background_style_layer';
9import raster from './style_layer/raster_style_layer';
10import CustomStyleLayer from './style_layer/custom_style_layer';
11import type {CustomLayerInterface} from './style_layer/custom_style_layer';
12
13import type {LayerSpecification} from '../style-spec/types.g';
14
15const subclasses = {
16 circle,
17 heatmap,
18 hillshade,
19 fill,
20 'fill-extrusion': fillExtrusion,
21 line,
22 symbol,
23 background,
24 raster
25};
26
27export default function createStyleLayer(layer: LayerSpecification | CustomLayerInterface) {
28 if (layer.type === 'custom') {
29 return new CustomStyleLayer(layer);
30 } else {
31 return new subclasses[layer.type](layer);
32 }
33}
34