UNPKG

@arcgis/core

Version:

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

70 lines (66 loc) 4.03 kB
/** * Simplifies geometries to enforce topological correctness according to the [OGC Simple Feature Access specification 1.2.1](https://www.ogc.org/standards/sfa/). * This operator uses stricter rules than [simplifyOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOperator/). * * ![Simplify OGC operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/isSimpleOGC.png "Simplify OGC operator") * * @since 4.33 */ import type { GeometryUnion, GeometryWithoutMeshUnion } from "../types.js"; /** * Performs the OGC simplify operation on a single geometry. * * @param geometry - The geometry to be simplified. * @returns Returns the simplified geometry, or null. Geometry's with non-finite x or y, or infinite Zs return null. * The method will set NaN z values to 0. * @example * // Topologically simplifies a geometry * const simplified = simplifyOGCOperator.execute(polyline); * console.log(simplifyOGCOperator.isSimple(simplified)); // true */ export function execute(geometry: GeometryUnion): GeometryWithoutMeshUnion | null | undefined; /** * Performs the OGC 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 the simplified geometry, or null. Geometry's with non-finite x or y, or infinite Zs return null. * The method will set NaN z values to 0. */ export function executeMany(geometries: GeometryUnion[]): (GeometryWithoutMeshUnion | null | undefined)[]; /** * Indicates if the given geometry is 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 taken into account. * * For a given [Polyline](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polyline/) path, there can be no intersections between segments with exception of the first and the last points of a path, which can coincide forming a closed path with no boundary points. * Different paths can only intersect at the boundary points. * * [Polygon](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polygon/) geometries are considered simple if the following is true: * * Rings cannot have self intersections, or self-tangency. * * Rings are sorted such that each exterior ring is followed by its immediate interior ring (holes). The exterior ring with the corresponding holes form the OGC polygon type. * * The interior has to be a connected set. Any two points in the interior can be connected by a path that contains only interior points. * * Exterior rings have to be oriented clockwise, holes are oriented counterclockwise. * * All tests for equality or segment intersections use the tolerance and resolution. * The operator uses 2 * sqrt(2) * tolerance when checking whether two points are equal, and sqrt(2) * tolerance when checking if a point lies on a segment. * Both values are 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. * Resolution is added to take into account possible rounding errors. * * @param geometry - The input geometry. * @returns Returns true if the geometry is simple, otherwise returns false. * @example * // returns true if given geometry is OGC simple * const simple = simplifyOGCOperator.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;