UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

141 lines (140 loc) 6.24 kB
import { RGBAColor } from '@kepler.gl/types'; import type ClusterBuilder from './cluster-utils'; interface Bin { points: Record<string, unknown>[]; filteredPoints?: Record<string, unknown>[] | null; index?: number; } interface AggregatedBin { i: number; value: number; counts: number; } declare class BinSorter { maxCount: number; maxValue: number; minValue: number; totalCount: number; aggregatedBins: AggregatedBin[]; sortedBins: AggregatedBin[]; binMap: Record<number, AggregatedBin>; constructor(bins?: Bin[], props?: Record<string, any>); _getAggregatedBins(bins: Bin[], props: Record<string, any>): AggregatedBin[]; _updateMinMaxValues(): void; _getBinMap(): {}; _percentileToIndex(percentileRange: number[]): number[]; getValueDomainByScale(scale: string, [lower, upper]?: number[]): number[]; _getScaleDomain(scaleType: string, [lowerIdx, upperIdx]: number[]): number[]; getValueRange(percentileRange?: number[]): number[]; } export type UpdaterType = (this: CPUAggregator, step: any, props: any, dimensionUpdater: any) => void; export type BindedUpdaterType = () => void; export type AggregatedUpdaterType = (this: CPUAggregator, step: any, props: any, aggregation: any, aggregationParams: any) => void; export type BindedAggregatedUpdaterType = (aggregationParams: any) => void; export type UpdateStepsType = { key: string; triggers: { [key: string]: { prop: string; updateTrigger?: string; }; }; onSet?: { props: string; }; updater: UpdaterType; }; export type DimensionType<ValueType = any> = { key: string; accessor: string; getPickingInfo: (dimensionState: any, cell: any, layerProps?: any) => any; nullValue: ValueType; updateSteps: UpdateStepsType[]; getSubLayerAccessor: any; }; export type AggregationUpdateStepsType = { key: string; triggers: { [key: string]: { prop: string; updateTrigger?: string; }; }; updater: AggregatedUpdaterType; }; export type AggregationType = { key: string; updateSteps: AggregationUpdateStepsType[]; }; export declare const DECK_AGGREGATION_MAP: { SUM: "sum"; MEAN: "average"; MIN: "minimum"; MAX: "maximum"; }; export declare function getValueFunc(aggregation: string, accessor: (d: Record<string, unknown>) => number): (pts: any) => any; export declare function getScaleFunctor(scaleType: string): any; export declare function getGetValue(this: CPUAggregator, step: any, props: any, dimensionUpdater: any): void; export declare function getDimensionSortedBins(this: CPUAggregator, step: any, props: any, dimensionUpdater: any): void; export declare function getDimensionValueDomain(this: CPUAggregator, step: any, props: any, dimensionUpdater: any): void; export declare function getDimensionScale(this: CPUAggregator, step: any, props: any, dimensionUpdater: any): void; export declare function getAggregatedData(this: CPUAggregator, step: any, props: any, aggregation: any, aggregationParams: any): void; export declare const defaultAggregation: AggregationType; export declare const defaultColorDimension: DimensionType<RGBAColor>; export declare const defaultElevationDimension: DimensionType<number>; export declare const defaultDimensions: (DimensionType<RGBAColor> | DimensionType<number>)[]; export type CPUAggregatorState = { layerData: { data?: Record<string, unknown>[]; }; dimensions: Record<string, { getValue?: (...args: unknown[]) => number; sortedBins?: BinSorter; valueDomain?: number[]; scaleFunc?: ((...args: unknown[]) => unknown) & { domain: () => number[]; scaleType?: string; }; }>; geoJSON?: GeoJSON.FeatureCollection; clusterBuilder?: ClusterBuilder; }; export default class CPUAggregator { static getDimensionScale: any; state: CPUAggregatorState; dimensionUpdaters: { [key: string]: DimensionType; }; aggregationUpdater: AggregationType; constructor(opts?: { initialState?: CPUAggregatorState; dimensions?: DimensionType[]; aggregation?: AggregationType; }); static defaultDimensions(): (DimensionType<RGBAColor> | DimensionType<number>)[]; updateAllDimensions(props: Record<string, any>): void; updateAggregation(props: Record<string, any>, aggregationParams: Record<string, any>): void; updateState(opts: { oldProps: Record<string, any>; props: Record<string, any>; changeFlags: Record<string, any>; }, aggregationParams: Record<string, any>): CPUAggregatorState; setState(updateObject: Partial<CPUAggregatorState>): void; _setDimensionState(key: string, updateObject: Record<string, any>): void; _addAggregation(aggregation: AggregationType): void; _addDimension(dimensions?: DimensionType[]): void; _needUpdateStep(dimensionStep: UpdateStepsType | AggregationUpdateStepsType, oldProps: any, props: any, changeFlags: any): boolean; _accumulateUpdaters<UpdaterObjectType extends DimensionType | AggregationType>(step: any, props: any, dimension: UpdaterObjectType): (UpdaterObjectType extends DimensionType<any> ? BindedUpdaterType : BindedAggregatedUpdaterType)[]; _getAllUpdaters<UpdaterObjectType extends DimensionType | AggregationType>(dimension: UpdaterObjectType, oldProps: any, props: any, changeFlags: any): (UpdaterObjectType extends DimensionType<any> ? BindedUpdaterType : BindedAggregatedUpdaterType)[]; _getAggregationChanges(oldProps: Record<string, any>, props: Record<string, any>, changeFlags: Record<string, any>): BindedAggregatedUpdaterType[] | null; _getDimensionChanges(oldProps: Record<string, any>, props: Record<string, any>, changeFlags: Record<string, any>): BindedUpdaterType[] | null; getUpdateTriggers(props: Record<string, any>): {}; getPickingInfo({ info }: { info: Record<string, any>; }, layerProps: Record<string, any>): Record<string, any> & { picked: boolean; object: Record<string, any> | null; }; getAccessor(dimensionKey: string, layerProps: Record<string, any>): any; } export {};