@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
59 lines (57 loc) • 2.86 kB
TypeScript
/**
* This module provides a function for regenerating renderers based on the current state of the layer and view.
* This is useful when you want to update a renderer based on changes to the layer's data, the data
* visible in the view, binning configuration, or the view's scale.
*
* @since 4.31
* @see [Renderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/)
*/
import type FeatureFilter from "../../../layers/support/FeatureFilter.js";
import type { MapViewOrSceneView } from "../../../views/MapViewOrSceneView.js";
import type { AbortOptions } from "../../../core/promiseUtils.js";
import type { RendererUnion } from "../../../renderers/types.js";
import type { FeatureLikeLayerOrAdapter } from "../../support/adapters/types.js";
/**
* Regenerates the renderer for a layer based on the current state of the layer and view.
*
* @param params - An object containing the following properties.
* @returns Returns a promise that resolves with the updated renderer.
*/
export function regenerateRenderer(params: RegenerateRendererParameters): Promise<RendererUnion>;
export interface RegenerateRendererParameters extends AbortOptions {
/** The layer for which to regenerate the renderer. */
layer: FeatureLikeLayerOrAdapter;
/** The view in which the layer is rendered. */
view: MapViewOrSceneView;
/**
* The renderer to update. If not provided,
* the renderer will be derived from the layer or feature reduction object.
*/
renderer?: RendererUnion;
/**
* Indicates whether to regenerate the binning renderer
* or the renderer set on the layer.
*/
forBinning?: boolean;
/**
* When defined, only features included in the filter
* are considered in the attribute and spatial statistics calculations when determining the final renderer.
* This is useful when a lot of variation exists in the data
* that could result in undesired data ranges. A common use case would be to set a filter that only
* includes features in the current extent of the view where the data is most likely to be viewed. Currently, only
* geometry filters with an `intersects` spatial relationship are supported. All other filter types (including `where`) are ignored.
* This parameter is only supported when `forBinning` is `false`.
*/
filter?: FeatureFilter;
/**
* An array of strings indicating which
* parts of the renderer to include in the regeneration.
* If not provided, all parts are included by default. The available options are:
* - `color-variable`: Only regenerate the color visual variable.
* - `size-variable`: Only regenerate the size visual variable.
* - `class-breaks`: Regenerate the class breaks for the renderer.
*
* @since 4.33
*/
includedParts?: ("color-variable" | "size-variable" | "class-breaks")[];
}