UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

73 lines (69 loc) 4.02 kB
/** * Applies Esri (non-OGC) simplification to 2D geometries by removing unnecessary vertices while preserving the geometry shape. * This makes them topologically legal with respect to their geometry type. * This operator is less strict than [simplifyOGCOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOGCOperator/). * * ![Simplify operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/isSimple.png "Simplify operator") * * @since 4.31 */ import type { GeometryUnion, GeometryWithoutMeshUnion } from "../types.js"; /** * Performs the simplify operation on a single geometry. * * @param geometry - The geometry to be simplified. * @returns Returns the simplified geometry or null. * @example * // Topologically simplifies a geometry * const simplified = simplifyOperator.execute(polyline); * console.log(simplifyOperator.isSimple(simplified)); // true */ export function execute(geometry: GeometryUnion): GeometryWithoutMeshUnion | null | undefined; /** * Performs the simplify operation on the geometry set. * * @param geometries - The array of geometries to be simplified, * All the geometries must have the same spatial reference. * @returns Returns an array whose elements may either be simplified geometries or null. */ export function executeMany(geometries: GeometryUnion[]): (GeometryWithoutMeshUnion | null | undefined)[]; /** * Indicates if the given geometry is non-OGC topologically simple. This operation takes into account z-values. * * [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) geometries are always simple. * * [Multipoint](https://developers.arcgis.com/javascript/latest/references/core/geometry/Multipoint/) geometries cannot have any points with exactly equal x and y. * The tolerance is not taken into account. * * [Polyline](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polyline/) geometries can have self-intersecting paths, however they cannot have degenerate segments. * A degenerate segment is a zero-length segment where the start and end points are essentially the same. * When the polyline has no z, degenerate segments are those that have a length in the xy plane less than or equal to the tolerance. * When the polyline has z, degenerate segments are those that are shorter than the tolerance in the xy plane, and the change in the z-value along the segment is less than or equal to the z-tolerance. * * [Polygon](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polygon/) geometries are considered simple if the following is true: * * Contains no self-intersecting rings. * * Exterior rings are clockwise, and interior rings (holes) are counterclockwise. * * Rings can touch other rings in a finite number of points. * * Rings can be self-tangent in a finite number of points. * * Vertices are either exactly coincident, or further than the 2 * sqrt(2) * tolerance from each other. * * If a vertex is not equal to any boundary point of a segment, it has to be further than sqrt(2) * tolerance from any segment. * * No segment length is zero. * * Each path contains at least three non-equal vertices. * * No empty paths are allowed. * * Order of rings does not matter. * * The tolerance value is obtained from the geometry's spatial reference. If it is null, then a small tolerance value is calculated from the geometry coordinates using double-precision. * * @param geometry - The input geometry. * @returns Returns true if the geometry is simple, otherwise returns false. * @example * // returns true if given geometry is simple * const simple = simplifyOperator.isSimple(polyline); * console.log(simple); // true | false */ export function isSimple(geometry: GeometryUnion): boolean; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. */ export const supportsCurves: boolean;