kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
98 lines (97 loc) • 4.39 kB
TypeScript
import { Layer as DeckLayer, LayerProps as DeckLayerProps } from '@deck.gl/core/typed';
import { Field, TooltipField, CompareType, SplitMapLayers, Editor, Feature, FeatureSelectionContext, BindedLayerCallbacks, LayerCallbacks, Viewport } from '@kepler.gl/types';
import { Layer, LayerClassesType } from '@kepler.gl/layers';
import KeplerTable from '@kepler.gl/table';
import { VisState } from '@kepler.gl/schemas';
import { DataRow } from '@kepler.gl/utils';
export declare type LayersToRender = {
[layerId: string]: boolean;
};
export declare type AggregationLayerHoverData = {
points: any[];
colorValue?: any;
elevationValue?: any;
aggregatedData?: Record<string, {
measure: string;
value?: any;
}>;
};
export declare type LayerHoverProp = {
data: DataRow | AggregationLayerHoverData | null;
fields: Field[];
fieldsToShow: TooltipField[];
layer: Layer;
primaryData?: DataRow | AggregationLayerHoverData | null;
compareType?: CompareType;
currentTime?: VisState['animationConfig']['currentTime'];
};
/**
* Find default layers from fields
*/
export declare function findDefaultLayer(dataset: KeplerTable, layerClasses: LayerClassesType): Layer[];
declare type MinVisStateForLayerData = {
datasets: VisState['datasets'];
animationConfig: VisState['animationConfig'];
};
/**
* Calculate layer data based on layer type, col Config,
* return updated layer if colorDomain, dataMap has changed.
* Also, returns updated layer in case the input layer was in invalid state.
* Adds an error message to the layer in case of an exception.
*/
export declare function calculateLayerData<S extends MinVisStateForLayerData>(layer: Layer, state: S, oldLayerData?: any): {
layerData: any;
layer: Layer;
};
/**
* Calculate props passed to LayerHoverInfo
*/
export declare function getLayerHoverProp({ animationConfig, interactionConfig, hoverInfo, layers, layersToRender, datasets }: {
interactionConfig: VisState['interactionConfig'];
animationConfig: VisState['animationConfig'];
hoverInfo: VisState['hoverInfo'];
layers: VisState['layers'];
layersToRender: LayersToRender;
datasets: VisState['datasets'];
}): LayerHoverProp | null;
export declare function renderDeckGlLayer(props: any, layerCallbacks: {
[key: string]: any;
}): any;
export declare function isLayerRenderable(layer: Layer, layerData: any): boolean;
export declare function isLayerVisible(layer: any, mapLayers: any): any;
export declare function prepareLayersForDeck(layers: Layer[], layerData: VisState['layerData']): {
[key: string]: boolean;
};
export declare function prepareLayersToRender(layers: Layer[], layerData: VisState['layerData'], mapLayers?: SplitMapLayers | undefined | null): LayersToRender;
declare type CustomDeckLayer = DeckLayer<DeckLayerProps>;
export declare function getCustomDeckLayers(deckGlProps?: any): [CustomDeckLayer[], CustomDeckLayer[]];
export declare type ComputeDeckLayersProps = {
mapIndex?: number;
mapboxApiAccessToken?: string;
mapboxApiUrl?: string;
primaryMap?: boolean;
layersForDeck?: {
[key: string]: boolean;
};
editorInfo?: {
editor: Editor;
editorMenuActive: boolean;
onSetFeatures: (features: Feature[]) => any;
setSelectedFeature: (feature: Feature | null, selectionContext?: FeatureSelectionContext) => any;
featureCollection: {
type: string;
features: Feature[];
};
selectedFeatureIndexes: number[];
viewport: Viewport;
};
};
export declare function bindLayerCallbacks(layerCallbacks: LayerCallbacks | undefined, idx: number): BindedLayerCallbacks;
export declare function computeDeckLayers({ visState, mapState, mapStyle }: any, options?: ComputeDeckLayersProps, layerCallbacks?: LayerCallbacks, deckGlProps?: any): Layer[];
export declare function getLayerOrderFromLayers<T extends {
id: string;
}>(layers: T[]): string[];
export declare function reorderLayerOrder(layerOrder: VisState['layerOrder'], originLayerId: string, destinationLayerId: string): VisState['layerOrder'];
export declare function addLayerToLayerOrder(layerOrder: VisState['layerOrder'], layerId: string): string[];
export declare function getLayerHoverPropValue(data: DataRow | AggregationLayerHoverData | null | undefined, fieldIndex: number): any;
export {};