/** * Generalizes 2D geometries using Douglas-Peucker algorithm. * * ![Generalize operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/generalize.avif "Generalize operator") * * @since 4.31 */ import type { LengthUnit } from "../../core/units.js"; import type { GeometryUnion, GeometryWithoutMeshUnion } from "../types.js"; /** @since 5.2 */ export interface GeneralizeOptions { /** * Preserves degenerate parts. * The operator will try to output three distinct vertices for closed polyline paths and polygon rings, * and it will output two distinct vertices for open polyline paths. * * When set to `true`, the degenerate parts of the geometries will be removed from the output. * This may not be desirable for displaying the geometries. * * @default false */ removeDegenerateParts?: boolean; /** * The length unit of `maxDeviation`. * The default is the input geometry's spatial reference unit. * An error will be thrown if this is set for Geographic Coordinate Systems. */ unit?: LengthUnit; } /** * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [GeneralizeOptions](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/generalizeOperator/#GeneralizeOptions). */ export type Options = GeneralizeOptions; /** * Performs the generalize operation on the input geometry. * * @param geometry - The input geometry to be generalized. * @param maxDeviation - The maximum allowed deviation from the generalized geometry to the original geometry. * If maxDeviation <= 0 the operator returns the input geometry. * Unless the `unit` option is set, the default is the spatial reference unit of `geometry`. * @param options - Additional options. * @returns Returns the generalized geometry or null. * @since 5.2 * @example * // Generalize a polyline geometry * const generalizedPolyline = generalizeExecute(polyline, 10); */ export function generalizeExecute(geometry: GeometryUnion, maxDeviation: number, options?: GeneralizeOptions): GeometryWithoutMeshUnion | null | undefined; /** * Performs the generalize operation on the input geometry. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [generalizeExecute()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/generalizeOperator/#generalizeExecute). * @param geometry - The input geometry to be generalized. * @param maxDeviation - The maximum allowed deviation from the generalized geometry to the original geometry. * If maxDeviation less than or equal to zero, the operator will return the input geometry. * If `unit` is unspecified in the optional options, the spatial reference unit of `geometry` will be used. * @param options - Additional options. * @returns Returns the generalized geometry or null. * @example * // Generalize a polyline geometry * const generalizedPolyline = generalizeExecute(polyline, 10); */ export function execute(geometry: GeometryUnion, maxDeviation: number, options?: GeneralizeOptions): GeometryWithoutMeshUnion | null | undefined; /** * Performs the generalize operation on the input geometries. * * @param geometries - The input geometries to be generalized. * All the geometries must have the same spatial reference. * @param maxDeviation - The maximum allowed deviation from the generalized geometry to the original geometry. * If the value is less than or equal to zero, then the operator returns the input geometries. * Unless the `unit` option is set, the default is the spatial reference unit of `geometries`. * @param options - Additional options. * @returns Returns an array of generalized geometries. Geometries with a dimension of < 1 are simply passed along. * @since 5.2 */ export function generalizeExecuteMany(geometries: GeometryUnion[], maxDeviation: number, options?: GeneralizeOptions): GeometryWithoutMeshUnion[]; /** * Performs the generalize operation on the input geometries. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [generalizeExecuteMany()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/generalizeOperator/#generalizeExecuteMany). * @param geometries - The input geometries to be generalized. * All the geometries must have the same spatial reference. * @param maxDeviation - The maximum allowed deviation from the generalized geometry to the original geometry. * If the value is less than or equal to zero, then the operator returns the input geometries. * Unless the `unit` option is set, the default is the spatial reference unit of `geometries`. * @param options - Additional options. * @returns Returns an array of generalized geometries. Geometries with a dimension of < 1 are simply passed along. */ export function executeMany(geometries: GeometryUnion[], maxDeviation: number, options?: GeneralizeOptions): GeometryWithoutMeshUnion[]; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. This will produce densified output geometries. * * @since 5.2 */ export const generalizeSupportsCurves: boolean; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. This will produce densified output geometries. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [generalizeSupportsCurves](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/generalizeOperator/#generalizeSupportsCurves). */ export const supportsCurves: ReturnType;