Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Chore]: Technical: Setup for different Visual channels per layer (#1751)
Maksim Suslov0057a1e4f94f
diff --git a/src/layers/base-layer.ts b/src/layers/base-layer.tsindex d29c42067..5678c6b24 100644--- a/src/layers/base-layer.ts+++ b/src/layers/base-layer.ts@@ -72,6 +72,7 @@ export type LayerColumns = {};export type VisualChannelDomain = number[] | string[];export type VisualChannelField = Field | null;+export type VisualChannelScale = keyof typeof SCALE_TYPES;export type LayerBaseConfig = {dataId: string | null;@@ -96,6 +97,27 @@ export type LayerBaseConfig = {};};+export type LayerColorConfig = {+ colorField: VisualChannelField;+ colorDomain: VisualChannelDomain;+ colorScale: VisualChannelScale;+};+export type LayerSizeConfig = {+ // color by size, domain is set by filters, field, scale type+ sizeDomain: VisualChannelDomain;+ sizeScale: VisualChannelScale;+ sizeField: VisualChannelField;+};+export type LayerHeightConfig = {+ heightField: VisualChannelField;+ heightDomain: VisualChannelDomain;+ heightScale: VisualChannelScale;+};++export type LayerWeightConfig = {+ weightField: VisualChannelField;+};+export type VisualChannel = {property: string;field: string;@@ -156,13 +178,13 @@ function* generateColor(): Generator<RGBColor> {export const colorMaker = generateColor();-class Layer {+class Layer<LayerConfig extends LayerBaseConfig = LayerBaseConfig> {id: string;// TODO: define metameta: {};// TODO: define visConfigSettingsvisConfigSettings: {};- config: LayerBaseConfig;+ config: LayerConfig;// TODO: define _oldDataUpdateTriggers_oldDataUpdateTriggers: any;@@ -179,6 +201,7 @@ class Layer {// visConfigSettingsthis.visConfigSettings = {};+ // @ts-expect-errorthis.config = this.getDefaultLayerConfig({columns: this.getLayerColumns(),...props