MCPcopy
hub / github.com/microsoft/SandDance / getLayers

Function getLayers

packages/vega-deck.gl/src/layers.ts:25–63  ·  view source on GitHub ↗
(
    presenter: Presenter,
    config: PresenterConfig,
    stage: Stage,
    lightSettings: any /*LightSettings*/,
    lightingMix: number,
    interpolator: LinearInterpolator_Class<CubeLayerInterpolatedProps>,
    guideLines: StyledLine[],
)

Source from the content-addressed store, hash-verified

23import { TextLayerProps } from '@deck.gl/layers/text-layer/text-layer';
24
25export 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
65function 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);

Callers 1

setDeckPropsMethod · 0.90

Calls 8

concatFunction · 0.90
newCubeLayerFunction · 0.70
newLineLayerFunction · 0.70
newTextLayerFunction · 0.70
newPathLayerFunction · 0.70
newPolygonLayerFunction · 0.70
forEachMethod · 0.45
getCharacterSetMethod · 0.45

Tested by

no test coverage detected