UNPKG

@arcgis/core

Version:

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

42 lines (39 loc) 1.62 kB
/** * Calculates a label point for the given 2D geometries. The point is guaranteed to be on the interior of the geometry. * It can be used to place a label on a feature and help to ensure readability on the map. * * Based on the input geometry type, the label point is defined as follows: * * Extent - the center of the extent. * * Multipoint - the point which is closest to the center of the geometry's envelope. * * Point - the point itself. * * Polygon - a point near the centroid of the ring with greatest area. * * Polyline - a vertex near the middle of the longest segment. * * @since 4.31 * @see [Sample - Geometry operator - centroid analysis](https://developers.arcgis.com/javascript/latest/sample-code/geometry-operator-centroid/) */ import type Point from "../Point.js"; import type { GeometryUnion } from "../types.js"; /** * Performs the label point operation on the geometry. * * @param geometry - The input geometry. * @returns Returns the label point. * @example * // Perform the label point operation * const labelPoint = labelPointOperator.execute(polygon); */ export function execute(geometry: GeometryUnion): Point; /** * Performs the label point operation on the geometry set. * * @param geometries - The set of input geometries. * All the geometries must have the same spatial reference. * @returns Returns the label points for each geometry. */ export function executeMany(geometries: GeometryUnion[]): Point[]; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. */ export const supportsCurves: boolean;