UNPKG

@danmarshall/deckgl-typings

Version:
1,504 lines (1,475 loc) 91.8 kB
//typings for @deck.gl/core v8.1.3 declare module '@deck.gl/core/utils/log' { const _default: any; export default _default; } declare module '@deck.gl/core/debug/loggers' { export const getLoggers: (log: any) => { 'layer.changeFlag': (layer: any, key: any, flags: any) => void; 'layer.initialize': (layer: any) => void; 'layer.update': (layer: any, needsUpdate: any) => void; 'layer.matched': (layer: any, changed: any) => void; 'layer.finalize': (layer: any) => void; 'compositeLayer.renderLayers': (layer: any, updated: any, subLayers: any) => void; 'layerManager.setLayers': (layerManager: any, updated: any, layers: any) => void; 'layerManager.activateViewport': (layerManager: any, viewport: any) => void; 'attributeManager.invalidate': (attributeManager: any, trigger: any, attributeNames: any) => void; 'attributeManager.updateStart': (attributeManager: any) => void; 'attributeManager.updateEnd': (attributeManager: any, numInstances: any) => void; 'attribute.updateStart': (attribute: any) => void; 'attribute.allocate': (attribute: any, numInstances: any) => void; 'attribute.updateEnd': (attribute: any, numInstances: any) => void; 'deckRenderer.renderLayers': (deckRenderer: any, renderStats: any, opts: any) => void; }; } declare module '@deck.gl/core/utils/json-loader' { function isJSON(text: any): boolean; const _default: { name: string; extensions: string[]; testText: typeof isJSON; parseTextSync: (text: string, reviver?: (this: any, key: string, value: any) => any) => any; }; export default _default; } declare module '@deck.gl/core/lib/init' { const _default: any; export default _default; } declare module '@deck.gl/core/shaderlib/misc/geometry' { const _default: { name: string; vs: string; fs: string; }; export default _default; } declare module '@deck.gl/core/lib/constants' { export const COORDINATE_SYSTEM: { DEFAULT: number; LNGLAT: number; METER_OFFSETS: number; LNGLAT_OFFSETS: number; CARTESIAN: number; }; export const PROJECTION_MODE: { WEB_MERCATOR: number; GLOBE: number; WEB_MERCATOR_AUTO_OFFSET: number; IDENTITY: number; }; export const UNIT: { common: number; meters: number; pixels: number; }; export const EVENTS: { click: { handler: string; }; panstart: { handler: string; }; panmove: { handler: string; }; panend: { handler: string; }; }; } //declare module '@deck.gl/core/shaderlib/project/project.glsl' { // const _default: string; // export default _default; //} declare module '@deck.gl/core/utils/memoize' { /** * Speed up consecutive function calls by caching the result of calls with identical input * https://en.wikipedia.org/wiki/Memoization * @param {function} compute - the function to be memoized */ export default function memoize(compute: any): (args: any) => any; } declare module '@deck.gl/core/utils/assert' { export default function assert(condition: any, message: any): void; } declare module '@deck.gl/core/shaderlib/project/viewport-uniforms' { import { Matrix4 } from '@math.gl/core'; export function getOffsetOrigin( viewport: any, coordinateSystem: any, coordinateOrigin?: number[] ): { geospatialOrigin: any; shaderCoordinateOrigin: number[]; offsetMode: boolean; }; /** * Returns uniforms for shaders based on current projection * includes: projection matrix suitable for shaders * * TODO - Ensure this works with any viewport, not just WebMercatorViewports * * @param {WebMercatorViewport} viewport - * @return {Float32Array} - 4x4 projection matrix that can be used in shaders */ export function getUniformsFromViewport({ viewport, devicePixelRatio, modelMatrix, coordinateSystem, coordinateOrigin, wrapLongitude, projectionMode, positionOrigin, }?: { viewport: any; devicePixelRatio?: number; modelMatrix?: Matrix4; coordinateSystem?: number; coordinateOrigin: number[]; wrapLongitude?: boolean; projectionMode: any; positionOrigin: any; }): any; } declare module '@deck.gl/core/shaderlib/project/project' { function getUniforms(opts?: {}): any; const _default: { name: string; dependencies: any[]; vs: string; getUniforms: typeof getUniforms; }; export default _default; } declare module '@deck.gl/core/shaderlib/project32/project32' { const _default: { name: string; dependencies: { name: string; dependencies: any[]; vs: string; getUniforms: (opts?: {}) => any; }[]; vs: string; }; export default _default; } declare module '@deck.gl/core/shaderlib/shadow/shadow' { const _default: { name: string; dependencies: { name: string; dependencies: any[]; vs: string; getUniforms: (opts?: {}) => any; }[]; vs: string; fs: string; inject: { 'vs:DECKGL_FILTER_GL_POSITION': string; 'fs:DECKGL_FILTER_COLOR': string; }; getUniforms: (opts?: {}, context?: {}) => {}; }; export default _default; } declare module '@deck.gl/core/shaderlib/picking/picking' { const _default: any; export default _default; } declare module '@deck.gl/core/shaderlib' { import { gouraudLighting, phongLighting } from '@luma.gl/core'; import project from '@deck.gl/core/shaderlib/project/project'; import project32 from '@deck.gl/core/shaderlib/project32/project32'; import shadow from '@deck.gl/core/shaderlib/shadow/shadow'; import picking from '@deck.gl/core/shaderlib/picking/picking'; export function createProgramManager(gl: any): any; export { picking, project, project32, gouraudLighting, phongLighting, shadow }; } declare module '@deck.gl/core/effects/lighting/ambient-light' { export class AmbientLight { constructor(props?: {}); } } declare module '@deck.gl/core/effects/lighting/directional-light' { export class DirectionalLight { constructor(props?: {}); getProjectedLight(l?: { layer: any }): this; } } declare module '@deck.gl/core/lib/effect' { export default class Effect { constructor(props?: {}); preRender(...params: any[]): void; getModuleParameters(layer?: any): void; cleanup(): void; } } declare module '@deck.gl/core/passes/pass' { export default class Pass { constructor(gl: any, props?: {}); setProps(props: any): void; render(params?: any): any[] | void; cleanup(): void; } } declare module '@deck.gl/core/passes/layers-pass' { import Pass from '@deck.gl/core/passes/pass'; export default class LayersPass extends Pass { render(props: any): any[] | void; _drawLayers(props: any): any[]; _drawLayersInViewport( gl: any, { layers, layerFilter, onError, viewport, view, pass, effects, moduleParameters, }: { layers: any; layerFilter: any; onError: any; viewport: any; view: any; pass?: string; effects: any; moduleParameters: any; } ): { totalCount: any; visibleCount: number; compositeCount: number; pickableCount: number; }; shouldDrawLayer(layer: any): boolean; getModuleParameters(layer: any, effects: any): any; getLayerParameters(layer: any, layerIndex: any): any; _shouldDrawLayer(layer: any, viewport: any, pass: any, layerFilter: any): any; _getModuleParameters(layer: any, effects: any, pass: any, overrides: any): any; } export function layerIndexResolver(startIndex?: number, layerIndices?: {}): (layer: any, isDrawn: any) => any; } declare module '@deck.gl/core/passes/shadow-pass' { import { default as LayersPass } from '@deck.gl/core/passes/layers-pass'; export default class ShadowPass extends LayersPass { constructor(gl: any, props: any); render(params: any): void; shouldDrawLayer(layer: any): boolean; getModuleParameters(): { drawToShadowMap: boolean; }; delete(): void; } } declare module '@deck.gl/core/effects/lighting/lighting-effect' { import Effect from '@deck.gl/core/lib/effect'; export default class LightingEffect extends Effect { constructor(props: any); preRender( gl: any, { layers, layerFilter, viewports, onViewportActive, views, }: { layers: any; layerFilter: any; viewports: any; onViewportActive: any; views: any; } ): void; getModuleParameters(layer: any): | { shadowMaps: any; dummyShadowMap: any; shadowColor: any; shadowMatrices: any; } | { shadowMaps?: undefined; dummyShadowMap?: undefined; shadowColor?: undefined; shadowMatrices?: undefined; }; cleanup(): void; _createLightMatrix(): any[]; _createShadowPasses(gl: any): void; _applyDefaultLights(): void; } } declare module '@deck.gl/core/shaderlib/project/project-functions' { import { Position } from '@deck.gl/core/utils/positions'; import { Matrix4 } from '@math.gl/core'; export function getWorldPosition( position: Position, { viewport, modelMatrix, coordinateSystem, coordinateOrigin, offsetMode, }: { viewport: any; modelMatrix: Matrix4; coordinateSystem: any; coordinateOrigin: any; offsetMode: any; } ): any; /** * Equivalent to project_position in project.glsl * projects a user supplied position to world position directly with or without * a reference coordinate system * @param {array} position - [x, y, z] * @param {object} params * @param {Viewport} params.viewport - the current viewport * @param {number} params.coordinateSystem - the reference coordinate system used * align world position * @param {array} params.coordinateOrigin - the reference coordinate origin used * to align world position * @param {Matrix4} [params.modelMatrix] - the model matrix of the supplied position * @param {number} [params.fromCoordinateSystem] - the coordinate system that the * supplied position is in. Default to the same as `coordinateSystem`. * @param {array} [params.fromCoordinateOrigin] - the coordinate origin that the * supplied position is in. Default to the same as `coordinateOrigin`. */ export function projectPosition(position: any, params: any): any; } declare module '@deck.gl/core/lib/attribute/shader-attribute' { export default class ShaderAttribute { constructor(dataColumn: any, opts: any); get value(): any; getValue(): any; getAccessor(): any; } } declare module '@deck.gl/core/lib/attribute/gl-utils' { export function glArrayFromType( glType: any ): | Float32ArrayConstructor | Float64ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Uint8ClampedArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor; } declare module '@deck.gl/core/utils/typed-array-manager' { export class TypedArrayManager { constructor({ overAlloc, poolSize }?: { overAlloc?: number; poolSize?: number }); allocate( typedArray: any, count: any, { size, type, padding, copy, }: { size?: number; type: any; padding?: number; copy?: boolean; } ): any; release(typedArray: any): void; _allocate(Type: any, size: any): any; _release(typedArray: any): void; } const _default: TypedArrayManager; export default _default; } declare module '@deck.gl/core/utils/math-utils' { export function createMat4(): number[]; export function mod(value: any, divisor: any): any; export function extractCameraVectors({ viewMatrix, viewMatrixInverse, }: { viewMatrix: any; viewMatrixInverse: any; }): { eye: any[]; direction: number[]; up: any[]; right: any[]; }; export function getFrustumPlanes({ aspect, near, far, fovyRadians, position, direction, up, right, }: { aspect: any; near: any; far: any; fovyRadians: any; position: any; direction: any; up: any; right: any; }): { near: { distance: any; normal: any; }; far: { distance: any; normal: any; }; }; /** * Calculate the low part of a WebGL 64 bit float * @param x {number} - the input float number * @returns {number} - the lower 32 bit of the number */ export function fp64LowPart(x: any): number; /** * Split a Float64Array into a double-length Float32Array * @param typedArray {Float64Array} * @param size {Number} - per attribute size * @param [startIndex] {Number} - start index in the source array * @param [endIndex] {Number} - end index in the source array * @returns {Float32Array} - high part, low part for each attribute: [1xHi, 1yHi, 1zHi, 1xLow, 1yLow, 1zLow, 2xHi, ...] */ export function toDoublePrecisionArray( typedArray: any, { size, startIndex, endIndex, }: { size?: number; startIndex?: number; endIndex: any; } ): any; } declare module '@deck.gl/core/lib/attribute/data-column' { export default class DataColumn { constructor(gl: any, opts: any); get buffer(): any; get byteOffset(): number; delete(): void; getShaderAttributes(id: any, options: any): {}; getBuffer(): any; getValue(): any; getAccessor(): any; setData(opts: any): boolean; updateSubBuffer(opts?: {}): void; allocate({ numInstances, copy }: { numInstances: any; copy?: boolean }): boolean; _checkExternalBuffer(opts: any): void; _normalizeConstant(value: any): any; _normalizeValue(value: any, out: any, start: any): any; _areValuesEqual(value1: any, value2: any): boolean; } } declare module '@deck.gl/core/utils/iterable-utils' { export function createIterable( data: any, startRow?: number, endRow?: number ): { iterable: any[]; objectInfo: { index: number; data: any; target: any[]; }; }; export function isAsyncIterable(data: any): any; export function getAccessorFromBuffer( typedArray: any, { size, stride, offset, startIndices, nested, }: { size: any; stride: any; offset: any; startIndices: any; nested: any; } ): ( _: any, { index, target, }: { index: any; target: any; } ) => any; } declare module '@deck.gl/core/utils/flatten' { /** * Flattens a nested array into a single level array, * or a single value into an array with one value * @example flatten([[1, [2]], [3], 4]) => [1, 2, 3, 4] * @example flatten(1) => [1] * @param {Array} array The array to flatten. * @param {Function} filter= - Optional predicate called on each `value` to * determine if it should be included (pushed onto) the resulting array. * @param {Function} map= - Optional transform applied to each array elements. * @param {Array} result=[] - Optional array to push value into * @return {Array} Returns the new flattened array (new array or `result` if provided) */ export function flatten(array: any, filter?: () => boolean): any; export function fillArray({ target, source, start, count, }: { target: any; source: any; start?: number; count?: number; }): any; } declare module '@deck.gl/core/utils/range' { export const EMPTY: any[]; export const FULL: number[][]; export function add(rangeList: any, range: any): any; } declare module '@deck.gl/core/utils/array-utils' { export function padArray({ source, target, size, getData, sourceStartIndices, targetStartIndices, }: { source: any; target: any; size: any; getData: any; sourceStartIndices: any; targetStartIndices: any; }): any; } declare module '@deck.gl/core/lib/attribute/attribute-transition-utils' { export function normalizeTransitionSettings(userSettings: any, layerSettings: any): any; export function getSourceBufferAttribute(gl: any, attribute: any): any; export function getAttributeTypeFromSize(size: any): 'float' | 'vec2' | 'vec3' | 'vec4'; export function cycleBuffers(buffers: any): void; export function getAttributeBufferLength(attribute: any, numInstances: any): number; export function padBuffer({ buffer, numInstances, attribute, fromLength, fromStartIndices, getData, }: { buffer: any; numInstances: any; attribute: any; fromLength: any; fromStartIndices: any; getData?: (x: any) => any; }): void; } declare module '@deck.gl/core/lib/attribute/attribute' { import DataColumn from '@deck.gl/core/lib/attribute/data-column'; export default class Attribute extends DataColumn { constructor(gl: any, opts?: {}); get startIndices(): any; set startIndices(layout: any); needsUpdate(): any; needsRedraw({ clearChangedFlags }?: { clearChangedFlags?: boolean }): any; getUpdateTriggers(): any[]; supportsTransition(): boolean; getTransitionSetting(opts: any): any; setNeedsUpdate(reason: any, dataRange: any): void; clearNeedsUpdate(): void; setNeedsRedraw(reason?: any): void; update(opts: any): void; allocate(numInstances: any): boolean; updateBuffer({ numInstances, data, props, context, }: { numInstances: any; data: any; props: any; context: any; }): boolean; setConstantValue(value: any): boolean; setExternalBuffer(buffer: any): boolean; setBinaryValue(buffer: any, startIndices?: any): boolean; getVertexOffset(row: any): number; getShaderAttributes(): {}; _autoUpdater( attribute: any, { data, startRow, endRow, props, numInstances, }: { data: any; startRow: any; endRow: any; props: any; numInstances: any; } ): void; _validateAttributeUpdaters(): void; _checkAttributeArray(): void; } } declare module '@deck.gl/core/transitions/transition' { export default class Transition { /** * @params timeline {Timeline} */ constructor(timeline: any); get inProgress(): any; /** * (re)start this transition. * @params props {object} - optional overriding props. see constructor */ start(props: any): void; /** * end this transition if it is in progress. */ end(): void; /** * cancel this transition if it is in progress. */ cancel(): void; /** * update this transition. Returns `true` if updated. */ update(): boolean; _onUpdate(): void; } } declare module '@deck.gl/core/transitions/gpu-interpolation-transition' { export default class GPUInterpolationTransition { constructor({ gl, attribute, timeline }: { gl: any; attribute: any; timeline: any }); get inProgress(): any; start(transitionSettings: any, numInstances: any): void; update(): any; cancel(): void; } } declare module '@deck.gl/core/transitions/gpu-spring-transition' { export default class GPUSpringTransition { constructor({ gl, attribute, timeline }: { gl: any; attribute: any; timeline: any }); get inProgress(): any; start(transitionSettings: any, numInstances: any): void; update(): boolean; cancel(): void; } } declare module '@deck.gl/core/lib/attribute/attribute-transition-manager' { export default class AttributeTransitionManager { constructor( gl: any, { id, timeline, }: { id: any; timeline: any; } ); finalize(): void; update({ attributes, transitions, numInstances }: { attributes: any; transitions?: {}; numInstances: any }): void; hasAttribute(attributeName: any): any; getAttributes(): {}; run(): any; _removeTransition(attributeName: any): void; _updateAttribute(attributeName: any, attribute: any, settings: any): void; } } declare module '@deck.gl/core/lib/attribute/attribute-manager' { import Attribute from '@deck.gl/core/lib/attribute/attribute'; export default class AttributeManager { /** * @classdesc * Automated attribute generation and management. Suitable when a set of * vertex shader attributes are generated by iteration over a data array, * and updates to these attributes are needed either when the data itself * changes, or when other data relevant to the calculations change. * * - First the application registers descriptions of its dynamic vertex * attributes using AttributeManager.add(). * - Then, when any change that affects attributes is detected by the * application, the app will call AttributeManager.invalidate(). * - Finally before it renders, it calls AttributeManager.update() to * ensure that attributes are automatically rebuilt if anything has been * invalidated. * * The application provided update functions describe how attributes * should be updated from a data array and are expected to traverse * that data array (or iterable) and fill in the attribute's typed array. * * Note that the attribute manager intentionally does not do advanced * change detection, but instead makes it easy to build such detection * by offering the ability to "invalidate" each attribute separately. */ constructor( gl: any, { id, stats, timeline, }?: { id?: string; stats: any; timeline: any; } ); finalize(): void; getNeedsRedraw(opts?: { clearRedrawFlags: boolean }): any; setNeedsRedraw(redraw?: boolean): this; add(attributes: any, updaters: any): void; addInstanced(attributes: any, updaters: any): void; /** * Removes attributes * Takes an array of attribute names and delete them from * the attribute map if they exists * * @example * attributeManager.remove(['position']); * * @param {Object} attributeNameArray - attribute name array (see above) */ remove(attributeNameArray: any): void; invalidate(triggerName: any, dataRange: any): void; invalidateAll(dataRange: any): void; update({ data, numInstances, startIndices, transitions, props, buffers, context, }?: { data: any; numInstances: any; startIndices?: any; transitions: any; props?: {}; buffers?: {}; context?: {}; }): void; updateTransition(): any; /** * Returns all attribute descriptors * Note: Format matches luma.gl Model/Program.setAttributes() * @return {Object} attributes - descriptors */ getAttributes(): any; /** * Returns changed attribute descriptors * This indicates which WebGLBuffers need to be updated * @return {Object} attributes - descriptors */ getChangedAttributes(opts?: { clearChangedFlags: boolean }): any; getShaderAttributes(attributes: any, excludeAttributes?: {}): {}; getAccessors(): any; _add(attributes: any, updaters: any, extraProps?: {}): void; _createAttribute(name: any, attribute: any, extraProps: any): Attribute; _mapUpdateTriggersToAttributes(): void; _invalidateTrigger(triggerName: any, dataRange: any): any; _updateAttribute(opts: any): void; } } declare module '@deck.gl/core/transitions/cpu-interpolation-transition' { import Transition from '@deck.gl/core/transitions/transition'; export default class CPUInterpolationTransition extends Transition { get value(): any; _onUpdate(): void; } } declare module '@deck.gl/core/transitions/cpu-spring-transition' { import Transition from '@deck.gl/core/transitions/transition'; export default class CPUSpringTransition extends Transition { get value(): any; _onUpdate(): void; } } declare module '@deck.gl/core/lib/uniform-transition-manager' { export default class UniformTransitionManager { constructor(timeline: any); get active(): boolean; add(key: any, fromValue: any, toValue: any, settings: any): void; remove(key: any): void; update(): {}; clear(): void; } } declare module '@deck.gl/core/lifecycle/constants' { export const LIFECYCLE: { NO_STATE: string; MATCHED: string; INITIALIZED: string; AWAITING_GC: string; AWAITING_FINALIZATION: string; FINALIZED: string; }; export const PROP_SYMBOLS: { COMPONENT: symbol; ASYNC_DEFAULTS: symbol; ASYNC_ORIGINAL: symbol; ASYNC_RESOLVED: symbol; }; } declare module '@deck.gl/core/lifecycle/props' { export function validateProps(props: any): void; export function diffProps( props: any, oldProps: any ): { dataChanged: any; propsChanged: string; updateTriggersChanged: boolean; extensionsChanged: string | boolean; transitionsChanged: {}; }; /** * Performs equality by iterating through keys on an object and returning false * when any key has values which are not strictly equal between the arguments. * @param {Object} opt.oldProps - object with old key/value pairs * @param {Object} opt.newProps - object with new key/value pairs * @param {Object} opt.ignoreProps={} - object, keys that should not be compared * @returns {null|String} - null when values of all keys are strictly equal. * if unequal, returns a string explaining what changed. */ export function compareProps({ newProps, oldProps, ignoreProps, propTypes, triggerName, }?: { newProps: any; oldProps: any; ignoreProps?: {}; propTypes?: {}; triggerName?: string; }): string; } declare module '@deck.gl/core/utils/count' { /** * Deduces numer of elements in a JavaScript container. * - Auto-deduction for ES6 containers that define a count() method * - Auto-deduction for ES6 containers that define a size member * - Auto-deduction for Classic Arrays via the built-in length attribute * - Also handles objects, although note that this an O(N) operation */ export function count(container: any): any; } declare module '@deck.gl/core/utils/shader' { export function mergeShaders(target: any, source: any): any; } declare module '@deck.gl/core/lifecycle/prop-types' { export function parsePropTypes(propDefs: any): { propTypes: {}; defaultProps: {}; deprecatedProps: {}; }; } declare module '@deck.gl/core/lifecycle/create-props' { export function createProps(): any; } declare module '@deck.gl/core/lifecycle/component-state' { export default class ComponentState { constructor(component?: any); getOldProps(): any; resetOldProps(): void; freezeAsyncOldProps(): void; hasAsyncProp(propName: any): boolean; getAsyncProp(propName: any): any; isAsyncPropLoading(propName: any): boolean; setAsyncProps(props: any): void; _updateAsyncProp(propName: any, value: any): void; _didAsyncInputValueChange(propName: any, value: any): boolean; _setPropValue(propName: any, value: any): void; _setAsyncPropValue(propName: any, value: any, loadCount: any): void; _watchPromise(propName: any, promise: any): void; _resolveAsyncIterable(propName: any, iterable: any): Promise<void>; _postProcessValue(propName: any, value: any, previousValue: any): any; _createAsyncPropData(propName: any, value: any, defaultValue: any): void; } } declare module '@deck.gl/core/lifecycle/component' { import { LayerContext } from '@deck.gl/core/lib/layer'; export default class Component<P> { constructor(props: P, ...additionalProps: P[]); clone(newProps?: Partial<P>): any; get stats(): any; _initState(): void; props: P; /** * The layer's id, used for matching with layers from last render cycle */ id: string; /** * Keep track of how many layer instances you are generating */ count: number; /** * Helps track and debug the life cycle of the layers */ lifecycle: string; /** * reference to the composite layer parent that rendered this layer */ parent: Component<P>; /** * Will reference layer manager's context, contains state shared by layers */ context: LayerContext; /** * Will be set to the shared layer state object during layer matching */ state: any; internalState: any; } } declare module '@deck.gl/core/lib/layer-state' { import ComponentState from '@deck.gl/core/lifecycle/component-state'; export default class LayerState extends ComponentState { constructor({ attributeManager, layer }: { attributeManager: any; layer: any }); get layer(): any; set layer(layer: any); } } declare module '@deck.gl/core/lib/layer' { import AttributeManager from '@deck.gl/core/lib/attribute/attribute-manager'; import Component from '@deck.gl/core/lifecycle/component'; import Deck, { PickInfo, PickMode } from '@deck.gl/core/lib/deck'; import * as hammerjs from 'hammerjs'; import { RGBColor, RGBAColor } from '@deck.gl/core/utils/color'; import LayerManager from '@deck.gl/core/lib/layer-manager'; import Viewport from '@deck.gl/core/viewports/viewport'; import { Position } from '@deck.gl/core/utils/positions'; import { Matrix4 } from '@math.gl/core'; import { UNIT } from '@deck.gl/core/lib/constants'; export interface LayerContext { layerManager: LayerManager; deck: Deck; viewport: Viewport; // General resources mousePosition: [number, number] | null; // GL Resources gl: WebGL2RenderingContext; } export interface BaseTransitionTiming { enter?: (v: number) => number; onStart?: () => void; onEnd?: () => void; onInterrupt?: () => void; } export interface InterpolationTransitionTiming extends BaseTransitionTiming { type: 'interpolation'; duration: number; easing?: (t: number) => number; } export interface SpringTransitionTiming extends BaseTransitionTiming { type: 'spring'; stiffness: number; damping: number; } export type TransitionTiming = InterpolationTransitionTiming | SpringTransitionTiming; export interface LayerInputHandler<D = any> { (o: PickInfo<D>, e: HammerInput): any; } export type DataSet<D> = Iterable<D>; export type WidthUnits = keyof typeof UNIT; export interface ObjectInfo<D, T> { // the index of the current iteration index: number; // the value of the 'data' prop on the layer. data: DataSet<D> | Promise<DataSet<D>> | string; // a pre-allocated array. // the accessor function can optionally fill data into this array and // return it, instead of creating a new array for every object. // In some browsers this improves performance significantly by // reducing garbage collection. target: T[]; } // | AsyncIterable ToDo: Add AsyncIterable // | { length: number } Todo: Support non-iterable objects, see deck.gl docs: /docs/developer-guide/using-layers.md#accessors export interface LayerProps<D> { //https://deck.gl/#/documentation/deckgl-api-reference/layers/layer?section=properties id?: string; data?: D | DataSet<D> | Promise<DataSet<D>> | string; visible?: boolean; opacity?: number; extensions?: any[]; //Interaction Properties pickable?: boolean; onHover?: LayerInputHandler<D>; onClick?: LayerInputHandler<D>; onDragStart?: LayerInputHandler<D>; onDrag?: LayerInputHandler<D>; onDragEnd?: LayerInputHandler<D>; highlightColor?: RGBAColor | ((pickInfo: PickInfo<D>) => RGBAColor); highlightedObjectIndex?: number; autoHighlight?: boolean; //Coordinate System Properties coordinateSystem?: number; coordinateOrigin?: Position; wrapLongitude?: boolean; modelMatrix?: Matrix4; //Data Properties dataComparator?: (newData: D, oldData: D) => boolean; dataTransform?: () => D[] | Iterable<D>; _dataDiff?: (newData: D, oldData: D) => { startRow: number; endRow: number }; positionFormat?: 'XYZ' | 'XY'; colorFormat?: 'RGBA' | 'RGB'; numInstances?: number; updateTriggers?: any; loaders?: any[]; loadOptions?: any; onDataLoad?: (value: D[] | Iterable<D>, context: { layer: Layer<D> }) => void; //Render Properties parameters?: any; getPolygonOffset?: (uniform: any) => [number, number]; transitions?: { [attributeGetter: string]: TransitionTiming }; filterEnabled?: boolean; filterTransformSize?: boolean; filterTransformColor?: boolean; } export interface LayerChangeFlags { dataChanged: boolean | string | null; propsChanged: boolean | string | null; updateTriggersChanged: boolean | string | null; viewportChanged: boolean | string | null; stateChanged: boolean | string | null; extensionsChanged: boolean | string | null; propsOrDataChanged: boolean | string | null; somethingChanged: boolean | string | null; } export interface UpdateStateInfo<P> { oldProps: P; props: P; context: LayerContext; changeFlags: LayerChangeFlags; } export interface DefaultPropType { name: string; value: any; async?: boolean; validate?: (value: any) => boolean; equal?: (value1: any, value2: any) => boolean; deprecatedFor?: string | string[]; } export default class Layer<D, P extends LayerProps<D> = LayerProps<D>> extends Component<P> { constructor(props: P, ...additionalProps: P[]); toString(): string; setState(updateObject: any): void; setNeedsRedraw(redraw?: boolean): void; setNeedsUpdate(): void; getNeedsRedraw(opts?: { clearRedrawFlags: boolean }): boolean; needsUpdate(): any; hasUniformTransition(): any; get isLoaded(): boolean; isPickable(): any; getModels(): any; getAttributeManager(): any; getCurrentLayer(): any; getLoadOptions(): any; project(xyz: [number, number, number]): [number, number, number]; unproject(xy: any): any; projectPosition(xyz: any): any; use64bitPositions(): boolean; onHover(info: any, pickingEvent: any): any; onClick(info: any, pickingEvent: any): any; nullPickingColor(): RGBColor; encodePickingColor(i: any, target?: any[]): RGBColor; decodePickingColor(color: RGBColor): number; initializeState(params: any): void; getShaders(shaders: any): any; shouldUpdateState({ oldProps, props, context, changeFlags }: UpdateStateInfo<P>): any; updateState({ oldProps, props, context, changeFlags }: UpdateStateInfo<P>): void; finalizeState(): void; draw(opts: { moduleParameters?: any; uniforms?: any; parameters?: any; context?: WebGLRenderingContext }): void; getPickingInfo({ info, mode, sourceLayer, }: { info: PickInfo<D>; mode: PickMode; sourceLayer: Layer<any>; }): PickInfo<D>; invalidateAttribute(name?: string, diffReason?: string): void; updateAttributes(changedAttributes: any): void; _updateAttributes(props: any): void; _updateAttributeTransition(): void; _updateUniformTransition(): any; calculateInstancePickingColors( attribute: any, { numInstances, }: { numInstances: any; } ): void; _setModelAttributes(model: any, changedAttributes: any): void; clearPickingColor(color: any): void; restorePickingColors(): void; getNumInstances(props: any): any; getStartIndices(props: any): any; _initialize(): void; _update(): void; _updateState(): void; _finalize(): void; drawLayer({ moduleParameters, uniforms, parameters, }: { moduleParameters?: any; uniforms?: {}; parameters?: {}; }): void; getChangeFlags(): any; setChangeFlags(flags: any): void; clearChangeFlags(): void; diffProps(newProps: any, oldProps: any): void; validateProps(): void; setModuleParameters(moduleParameters: any): void; _updateModules({ props, oldProps }: { props: any; oldProps: any }): void; _getUpdateParams(): UpdateStateInfo<P>; _getNeedsRedraw(opts: any): boolean; _getAttributeManager(): AttributeManager; _initState(): void; _transferState(oldLayer: any): void; _onAsyncPropUpdated(): void; static layerName: string; static defaultProps?: Record<string, DefaultPropType | Record<string, any> | any>; // DefaultPropType is a hint } } declare module '@deck.gl/core/lib/composite-layer' { import Layer, { LayerProps } from '@deck.gl/core/lib/layer'; import Viewport from '@deck.gl/core/viewports/viewport'; export interface CompositeLayerProps<D> extends LayerProps<D> { _subLayerProps?: Object; } export default class CompositeLayer<D, P extends CompositeLayerProps<D> = CompositeLayerProps<D>> extends Layer< D, P > { get isComposite(): boolean; get isLoaded(): any; getSubLayers(): any; initializeState(params?: any): void; setState(updateObject: any): void; renderLayers(): any; filterSubLayer({ layer, viewport, isPicking, renderPass, }: { layer: Layer<any>; viewport: Viewport; isPicking: boolean; renderPass: string; }): boolean; shouldRenderSubLayer(id: any, data: any): boolean; getSubLayerClass(id: any, DefaultLayerClass: any): any; getSubLayerRow(row: any, sourceObject: any, sourceObjectIndex: any): any; getSubLayerAccessor(accessor: any): any; getSubLayerProps<SD, SP extends LayerProps<SD> = LayerProps<SD>>(sublayerProps?: {}): SP; _getAttributeManager(): any; _renderLayers(): void; } } declare module '@deck.gl/core/viewports/viewport' { import { Position } from '@deck.gl/core/utils/positions'; export default class Viewport { /** * @classdesc * Manages coordinate system transformations for deck.gl. * * Note: The Viewport is immutable in the sense that it only has accessors. * A new viewport instance should be created if any parameters have changed. */ constructor(opts?: {}); id?: string; x: number; y: number; width: number; height: number; isGeospatial: boolean; zoom: number; scale: number; position: Position; get metersPerPixel(): number; get projectionMode(): number; equals(viewport: any): any; /** * Projects xyz (possibly latitude and longitude) to pixel coordinates in window * using viewport projection parameters * - [longitude, latitude] to [x, y] * - [longitude, latitude, Z] => [x, y, z] * Note: By default, returns top-left coordinates for canvas/SVG type render * * @param {Array} lngLatZ - [lng, lat] or [lng, lat, Z] * @param {Object} opts - options * @param {Object} opts.topLeft=true - Whether projected coords are top left * @return {Array} - [x, y] or [x, y, z] in top left coords */ project( xyz: any, { topLeft, }?: { topLeft?: boolean; } ): any[]; /** * Unproject pixel coordinates on screen onto world coordinates, * (possibly [lon, lat]) on map. * - [x, y] => [lng, lat] * - [x, y, z] => [lng, lat, Z] * @param {Array} xyz - * @param {Object} opts - options * @param {Object} opts.topLeft=true - Whether origin is top left * @return {Array|null} - [lng, lat, Z] or [X, Y, Z] */ unproject( xyz: any, { topLeft, targetZ, }?: { topLeft?: boolean; targetZ: any; } ): any[]; projectPosition(xyz: any): any[]; unprojectPosition(xyz: any): any[]; /** * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile. * Performs the nonlinear part of the web mercator projection. * Remaining projection is done with 4x4 matrices which also handles * perspective. * @param {Array} lngLat - [lng, lat] coordinates * Specifies a point on the sphere to project onto the map. * @return {Array} [x,y] coordinates. */ projectFlat(xyz: any): any; /** * Unproject world point [x,y] on map onto {lat, lon} on sphere * @param {object|Vector} xy - object with {x,y} members * representing point on projected map plane * @return {GeoCoordinates} - object with {lat,lon} of point on sphere. * Has toArray method if you need a GeoJSON Array. * Per cartographic tradition, lat and lon are specified as degrees. */ unprojectFlat(xyz: any): any; getDistanceScales(coordinateOrigin?: any): any; containsPixel({ x, y, width, height }: { x: any; y: any; width?: number; height?: number }): boolean; getFrustumPlanes(): any; getCameraPosition(): any; getCameraDirection(): any; getCameraUp(): any; _createProjectionMatrix({ orthographic, fovyRadians, aspect, focalDistance, near, far, }: { orthographic: any; fovyRadians: any; aspect: any; focalDistance: any; near: any; far: any; }): any; _initViewMatrix(opts: any): void; _getCenterInWorld({ longitude, latitude }: { longitude: any; latitude: any }): any; _initProjectionMatrix(opts: any): void; _initPixelMatrices(): void; } } declare module '@deck.gl/core/lib/layer-manager' { import { Layer } from '@deck.gl/core'; export default class LayerManager { constructor( gl: any, { deck, stats, viewport, timeline, }?: { deck: any; stats: any; viewport?: any; timeline?: any; } ); finalize(): void; needsRedraw(opts?: { clearRedrawFlags: boolean }): any; needsUpdate(): any; setNeedsRedraw(reason: any): void; setNeedsUpdate(reason: any): void; getLayers({ layerIds }?: { layerIds?: any }): Layer<any, any>[]; setProps(props: any): void; setLayers(newLayers: any, forceUpdate?: boolean): this; updateLayers(): void; activateViewport(viewport: any): this; _handleError(stage: any, error: any, layer: any): void; _updateLayers(oldLayers: any, newLayers: any): void; _updateSublayersRecursively(newLayers: any, oldLayerMap: any, generatedLayers: any): void; _finalizeOldLayers(oldLayerMap: any): void; _initializeLayer(layer: any): void; _transferLayerState(oldLayer: any, newLayer: any): void; _updateLayer(layer: any): void; _finalizeLayer(layer: any): void; layers: Layer<any, any>[]; } } declare module '@deck.gl/core/utils/deep-equal' { export function deepEqual(a: any, b: any): boolean; } declare module '@deck.gl/core/lib/view-manager' { export default class ViewManager { constructor(props?: {}); finalize(): void; needsRedraw(opts?: { clearRedrawFlags: boolean }): any; setNeedsUpdate(reason: any): void; updateViewStates(): void; /** Get a set of viewports for a given width and height * TODO - Intention is for deck.gl to autodeduce width and height and drop the need for props * @param rect (object, optional) - filter the viewports * + not provided - return all viewports * + {x, y} - only return viewports that contain this pixel * + {x, y, width, height} - only return viewports that overlap with this rectangle */ getViewports(rect: any): any; getViews(): {}; getView(viewOrViewId: any): any; getViewState(viewId: any): any; getViewport(viewId: any): any; /** * Unproject pixel coordinates on screen onto world coordinates, * (possibly [lon, lat]) on map. * - [x, y] => [lng, lat] * - [x, y, z] => [lng, lat, Z] * @param {Array} xyz - * @param {Object} opts - options * @param {Object} opts.topLeft=true - Whether origin is top left * @return {Array|null} - [lng, lat, Z] or [X, Y, Z] */ unproject(xyz: any, opts: any): any; setProps(props: any): void; _update(): void; _setSize(width: any, height: any): void; _setViews(views: any): void; _setViewState(viewState: any): void; _onViewStateChange(viewId: any, event: any): void; _createController(props: any): any; _updateController(view: any, viewState: any, viewport: any, controller: any): any; _rebuildViewports(): void; _buildViewportMap(): void; _diffViews(newViews: any, oldViews: any): any; } } declare module '@deck.gl/core/utils/positions' { export type Position2D = [number, number]; export type Position3D = [number, number, number]; export type Position = Position2D | Position3D; export function parsePosition(value: any): { position: number; relative: boolean; }; export function getPosition(position: any, extent: any): any; export type ExtentsLeftBottomRightTop = [number, number, number, number]; // [left, bottom, right, top] or [minX, minY, maxX, maxY] export type ScaleXYZ = [number, number, number]; export type TranslationXYZ = [number, number, number]; export type PitchYawRoll = [number, number, number]; // [pitch, yaw, roll] } declare module '@deck.gl/core/views/view' { import Viewport from '@deck.gl/core/viewports/viewport'; import { Matrix4 } from '@math.gl/core'; export interface ViewProps { id?: string; // The position and extent of the view on the canvas x?: number | string; // A relative (e.g. `'50%'`) or absolute position. Default `0`. y?: number | string; // A relative (e.g. `'50%'`) or absolute position. Default `0`. height?: number | string; // A relative (e.g. `'50%'`) or absolute extent. Default `'100%'`. width?: number | string; // A relative (e.g. `'50%'`) or absolute extent. Default `'100%'`. controller?: boolean | object; // Options for viewport interactivity. // Viewport Options projectionMatrix?: number[]; // 4x4 Projection matrix - Array[16] // Perspective projection parameters, used if projectionMatrix not supplied fovy?: number; // Field of view covered by camera, in the perspective case. In degrees. Default `50`. aspect?: number; // Aspect ratio. Defaults to the Viewport's `width/height` ratio. near?: number; // Distance of near clipping plane. Default `0.1`. (Note that in geospatial viewports, this actual distance used is scaled by the height of the screen). far?: number; // Distance of far clipping plane. Default `1000`. (Note that in geospatial viewports, this actual distance used is scaled by the height of the screen). focalDistance?: number; // Modifier of viewport scale. Corresponds to the number of pixels per meter. Default `1`. modelMatrix?: Matrix4; // A model matrix to be applied to position, to match the layer props API type?: typeof Viewport; // Internal: Viewport Type } export default class View { constructor(props?: ViewProps); equals(view: any): any; makeViewport({ width, height, viewState }: { width: any; height: any; viewState: any }): any; getViewStateId(): any; filterViewState(viewState: any): any; getDimensions({ width, height }: { width: any; height: any }): { x: any; y: any; width: any; height: any; }; _getControllerProps(defaultOpts: any): any; _getViewport(props: any): any; _parseDimensions({ x, y, width, height }: { x: any; y: any; width: any; height: any }): void; } } declare module '@deck.gl/core/viewports/web-mercator-viewport' { import Viewport from '@deck.gl/core/viewports/viewport'; export default class WebMercatorViewport extends Viewport { /** * @classdesc * Creates view/projection matrices from mercator params * Note: The Viewport is immutable in the sense that it only has accessors. * A new viewport instance should be created if any parameters have changed. */ constructor(opts?: {}); get subViewports(): any; /** * Add a meter delta to a base lnglat coordinate, returning a new lnglat array * * Note: Uses simple linear approximation around the viewport center * Error increases with size of offset (roughly 1% per 100km) *