(
presenter: Presenter,
config: PresenterConfig,
stage: Stage,
lightSettings: any /*LightSettings*/,
lightingMix: number,
interpolator: LinearInterpolator_Class<CubeLayerInterpolatedProps>,
guideLines: StyledLine[],
)
| 23 | import { TextLayerProps } from '@deck.gl/layers/text-layer/text-layer'; |
| 24 | |
| 25 | export function getLayers( |
| 26 | presenter: Presenter, |
| 27 | config: PresenterConfig, |
| 28 | stage: Stage, |
| 29 | lightSettings: any /*LightSettings*/, |
| 30 | lightingMix: number, |
| 31 | interpolator: LinearInterpolator_Class<CubeLayerInterpolatedProps>, |
| 32 | guideLines: StyledLine[], |
| 33 | ): Layer<any>[] { |
| 34 | const cubeLayer = newCubeLayer(presenter, config, stage.cubeData, presenter.style.highlightColor, lightSettings, lightingMix, interpolator); |
| 35 | const { x, y, z } = stage.axes; |
| 36 | const lines = concat(stage.gridLines, guideLines); |
| 37 | const texts = [...stage.textData]; |
| 38 | [x, y, z].forEach(axes => { |
| 39 | axes.forEach(axis => { |
| 40 | if (axis.domain) lines.push(axis.domain); |
| 41 | if (axis.ticks) lines.push.apply(lines, axis.ticks); |
| 42 | if (axis.tickText) texts.push.apply(texts, axis.tickText); |
| 43 | if (axis.title) texts.push(axis.title); |
| 44 | }); |
| 45 | }); |
| 46 | let characterSet: string[]; |
| 47 | if (config.getCharacterSet) { |
| 48 | characterSet = config.getCharacterSet(stage); |
| 49 | } else { |
| 50 | //Basic symbols, numbers, and uppercase / lowercase alphabet |
| 51 | characterSet = new Array(95).fill(1).map((_, i) => String.fromCharCode(32 + i)); |
| 52 | } |
| 53 | if (stage.facets) { |
| 54 | stage.facets.forEach(f => { |
| 55 | if (f.lines) lines.push.apply(lines, f.lines); |
| 56 | }); |
| 57 | } |
| 58 | const lineLayer = newLineLayer(layerNames.lines, lines); |
| 59 | const textLayer = newTextLayer(presenter, layerNames.text, texts, config, presenter.style.fontFamily, characterSet); |
| 60 | const pathLayer = newPathLayer(layerNames.paths, stage.pathData); |
| 61 | const polygonLayer = newPolygonLayer(layerNames.polygons, stage.polygonData); |
| 62 | return [textLayer, cubeLayer, lineLayer, pathLayer, polygonLayer]; |
| 63 | } |
| 64 | |
| 65 | function newCubeLayer(presenter: Presenter, config: PresenterConfig, cubeData: Cube[], highlightColor: RGBAColor, lightSettings: any /*LightSettings*/, lightingMix: number, interpolator?: LinearInterpolator_Class<CubeLayerInterpolatedProps>) { |
| 66 | const getPosition = getTiming(config.transitionDurations.position, easing); |
no test coverage detected