kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
193 lines (192 loc) • 7.58 kB
TypeScript
/// <reference types="react" />
/// <reference types="deck.gl" />
/// <reference types="@danmarshall/deckgl-typings/deck.gl__geo-layers" />
import Layer, { LayerBaseConfig } from '../base-layer';
import { TripsLayer as DeckGLTripsLayer } from '@deck.gl/geo-layers';
import TripLayerIcon from './trip-layer-icon';
import { GeojsonDataMaps } from '../geojson-layer/geojson-utils';
import { ColorRange, Merge, VisConfigColorRange, VisConfigNumber, VisConfigRange, LayerColumn } from '@kepler.gl/types';
import { default as KeplerTable, Datasets } from '@kepler.gl/table';
import { DataContainerInterface } from '@kepler.gl/utils';
export declare type TripLayerVisConfigSettings = {
opacity: VisConfigNumber;
thickness: VisConfigNumber;
colorRange: VisConfigColorRange;
trailLength: VisConfigNumber;
sizeRange: VisConfigRange;
};
export declare type TripLayerColumnsConfig = {
geojson: LayerColumn;
};
export declare type TripLayerVisConfig = {
opacity: number;
thickness: number;
colorRange: ColorRange;
trailLength: number;
sizeRange: [number, number];
billboard: boolean;
fadeTrail: boolean;
};
export declare type TripLayerConfig = Merge<LayerBaseConfig, {
columns: TripLayerColumnsConfig;
visConfig: TripLayerVisConfig;
}>;
export declare type TripLayerMeta = {
getFeature: any;
};
export declare const defaultThickness = 0.5;
export declare const defaultLineWidth = 1;
export declare const tripVisConfigs: {
opacity: 'opacity';
thickness: VisConfigNumber;
colorRange: 'colorRange';
trailLength: 'trailLength';
fadeTrail: 'fadeTrail';
billboard: 'billboard';
sizeRange: 'strokeWidthRange';
};
export declare const featureAccessor: ({ geojson }: TripLayerColumnsConfig) => (dc: DataContainerInterface) => (d: any) => any;
export declare const featureResolver: ({ geojson }: TripLayerColumnsConfig) => number;
export declare const COLUMN_MODE_GEOJSON = "geojson";
export declare const COLUMN_MODE_TABLE = "table";
export default class TripLayer extends Layer {
visConfigSettings: TripLayerVisConfigSettings;
config: TripLayerConfig;
meta: TripLayerMeta;
dataContainer: DataContainerInterface | null;
dataToFeature: GeojsonDataMaps;
dataToTimeStamp: any[];
getFeature: (columns: TripLayerColumnsConfig) => (dataContainer: DataContainerInterface) => any;
_layerInfoModal: Record<string, () => JSX.Element>;
constructor(props: any);
get supportedColumnModes(): ({
key: string;
label: string;
requiredColumns: string[];
optionalColumns?: undefined;
} | {
key: string;
label: string;
requiredColumns: string[];
optionalColumns: string[];
})[];
static get type(): 'trip';
get type(): "trip";
get name(): 'Trip';
get layerIcon(): typeof TripLayerIcon;
get columnPairs(): import("@kepler.gl/types").ColumnPairs;
accessVSFieldValue(): (field: any, d: any) => any;
get visualChannels(): {
color: {
accessor: string;
nullValue: any;
getAttributeValue: (config: any) => (d: any) => any;
defaultValue: (config: any) => any;
property: string;
field: string;
scale: string;
domain: string;
range: string;
key: string;
channelScaleType: string;
defaultMeasure?: any;
condition?: ((config: any) => boolean) | undefined;
fixed?: any;
supportedFieldTypes?: import("@kepler.gl/types").SupportedFieldTypes[] | undefined;
aggregation?: import("@kepler.gl/types").VisualChannelAggregation | undefined;
};
size: {
property: string;
accessor: string;
condition: (config: any) => any;
nullValue: number;
getAttributeValue: () => (d: any) => any;
field: string;
scale: string;
domain: string;
range: string;
key: string;
channelScaleType: string;
defaultMeasure?: any;
defaultValue?: any;
fixed?: any;
supportedFieldTypes?: import("@kepler.gl/types").SupportedFieldTypes[] | undefined;
aggregation?: import("@kepler.gl/types").VisualChannelAggregation | undefined;
};
};
get animationDomain(): [number, number] | null | undefined;
get layerInfoModal(): {
geojson: {
id: string;
template: () => JSX.Element;
modalProps: {
title: string;
};
};
table: {
id: string;
template: () => JSX.Element;
modalProps: {
title: string;
};
};
};
getPositionAccessor(dataContainer: DataContainerInterface): any;
static findDefaultLayerProps({ label, fields, dataContainer, id }: KeplerTable, foundLayers?: any[]): {
props: {
label: string;
columns: any;
isVisible: boolean;
columnMode: string;
}[];
foundLayers: any[] | undefined;
} | {
props: never[];
foundLayers?: undefined;
};
getDefaultLayerConfig(props: any): {
columnMode: any;
animation: {
enabled: boolean;
domain: null;
};
dataId: string;
label: string;
color: import("@kepler.gl/types").RGBColor;
columns: import("@kepler.gl/types").LayerColumns;
isVisible: boolean;
isConfigActive: boolean;
highlightColor: import("@kepler.gl/types").RGBColor | import("@kepler.gl/types").RGBAColor;
hidden: boolean;
visConfig: import("@kepler.gl/types").LayerVisConfig;
textLabel: import("@kepler.gl/types").LayerTextLabel[];
colorUI: {
color: import("@kepler.gl/types").ColorUI;
colorRange: import("@kepler.gl/types").ColorUI;
};
aggregatedBins?: import("@kepler.gl/types").AggregatedBin[] | undefined;
heightField?: import("@kepler.gl/types").VisualChannelField | undefined;
heightDomain?: import("@kepler.gl/types").VisualChannelDomain | undefined;
heightScale?: string | undefined;
colorField?: import("@kepler.gl/types").VisualChannelField | undefined;
colorDomain?: import("@kepler.gl/types").VisualChannelDomain | undefined;
colorScale?: string | number | symbol | undefined;
sizeDomain?: import("@kepler.gl/types").VisualChannelDomain | undefined;
sizeScale?: string | number | symbol | undefined;
sizeField?: import("@kepler.gl/types").VisualChannelField | undefined;
};
getHoverData(object: any, dataContainer: DataContainerInterface, fields: any, animationConfig: any): any;
calculateDataAttribute(dataset: KeplerTable): any;
formatLayerData(datasets: Datasets, oldLayerData: any): {};
updateAnimationDomain(domain: any): void;
updateLayerMeta(dataset: KeplerTable): void;
setInitialLayerConfig(dataset: any): this;
renderLayer(opts: any): DeckGLTripsLayer<unknown, import("@deck.gl/geo-layers/trips-layer/trips-layer").TripsLayerProps<unknown>>[];
/**
* Finds coordinates and datum at the current animation time by the specified feature index.
* @param featureIndex
* @param time
* @returns {{datum: (null|string|*), idx: *, coords}|{datum: null, idx: number, coords: null}}
*/
private _findColumnModeDatumForFeature;
}