UNPKG

tile-painter

Version:

Parse Mapbox style documents into rendering functions

27 lines (25 loc) 930 B
import { initBackgroundFill, initRasterFill } from "./roller.js"; import { initCircle, initLine, initFill } from "./brush-setup.js"; import { initLabeler } from "./labeler.js"; export function initRenderer(style, sprite, canvasSize) { switch (style.type) { case "background": return initBackgroundFill(style.layout, style.paint); case "raster": return initRasterFill(style.layout, style.paint, canvasSize); case "symbol": return initLabeler(style.layout, style.paint, sprite, canvasSize); case "circle": return initCircle(style.layout, style.paint); case "line": return initLine(style.layout, style.paint); case "fill": return initFill(style.layout, style.paint, sprite); case "fill-extrusion": case "heatmap": case "hillshade": default: return console.log("ERROR in initRenderer: layer.type = " + style.type + " not supported!"); } }