@webviz/subsurface-viewer
Version:
3D visualization component for subsurface reservoir data
74 lines (73 loc) • 3.43 kB
TypeScript
import type { Texture } from "@luma.gl/core";
import type { colorTablesArray, createColorMapFunction as createColormapFunction } from "@emerson-eps/color-tables/";
import type { DeckGLLayerContext } from "./layerTools";
import type { Color } from "../../utils/Color";
/** Type of functions returning a color from a value in the [0,1] range. */
export type ColormapFunctionType = ReturnType<typeof createColormapFunction>;
/** @deprecated Use ColormapFunctionType instead. */
export type colorMapFunctionType = ColormapFunctionType;
/** @deprecated Use ColormapFunctionType instead. */
export type ColorMapFunctionType = ColormapFunctionType;
export interface IColormapHints {
discreteData: boolean;
colormapSize: number;
}
/**
* Colormap definition, taken from the application color tables,
* used for mapping data values to colors.
*
* @property colormapName - The name of the colormap.
*/
export interface ColorTableProps {
colormapName: string;
colorTables?: colorTablesArray;
}
/**
* Represents the possible types of colormap inputs that can be used in the subsurface viewer.
*
* - `ColormapFunctionType`: A function that returns a color from a property value.
* - `Uint8Array`: A raw array of color values, typically representing RGBA or RGB data.
* - `ColorTableProps`: An object describing a color table with additional properties.
*
* This union type allows flexibility in specifying how colormaps are provided to components or utilities.
*/
export type ColormapProps = ColormapFunctionType | Uint8Array | ColorTableProps;
/**
* Configuration options for setting up a colormap.
*/
export interface ColormapSetup {
/**
* Minimum and maximum value range, used to map values to the the colormap colors.
* Values outside of this range will be displayed with either the clamp color if activated,
* or with the color of the corresponding colormap end color.
*/
valueRange?: [number, number];
/**
* Range specifying the minimum and maximum values to clamp the data.
* If it is undefined or not provided, the colormap range will be used.
* If it is null, no clamping will be applied.
*/
clampRange?: [number, number] | null;
/**
* Color or pair of colors used for clamped values.
* If a single color is provided, it is used for both ends of the range.
* If it is undefined or not provided, the default clamp color will be used.
* If it is null, no clamping will be applied.
*/
clampColor?: Color | [Color, Color] | null;
/** Value used to represent undefined data. */
undefinedValue?: number;
/** Color used for undefined data. */
undefinedColor?: Color;
/** Control used to apply or not smoothing to the display of the property. */
smooth?: boolean;
}
/**
* Creates an array of colors as RGB triplets in range [0, 1] using the colormap definition.
* @param colormapDef Definition of the colormap.
* @param colormapSize Number of colors in the color map.
* @param discreteColormapFunction If true, the color map function is targeting indices ranging from 0 to colormapSize.
* @returns Array of colors.
*/
export declare function getImageData(colormapDef: ColormapProps, colormapSize?: number, discreteColormapFunction?: boolean): Uint8Array;
export declare function createColormapTexture(colormap: ColormapProps, context: DeckGLLayerContext, colormapHints: IColormapHints): Texture;