UNPKG

@vertigis/viewer-spec

Version:

VertiGIS Viewer Specification

280 lines (279 loc) 8.82 kB
import type Point from "@arcgis/core/geometry/Point"; import type Polygon from "@arcgis/core/geometry/Polygon"; import type Polyline from "@arcgis/core/geometry/Polyline"; import type SpatialReference from "@arcgis/core/geometry/SpatialReference"; import type GeographicTransformation from "@arcgis/core/geometry/operators/support/GeographicTransformation.js"; import type GeographicTransformationLegacy from "@arcgis/core/geometry/support/GeographicTransformation"; import type { GeometryUnion } from "@arcgis/core/unionTypes.js"; import type { Command } from "../Command.js"; import { CommandRegistry } from "../CommandRegistry.js"; import type { Operation } from "../Operation.js"; import { OperationRegistry } from "../OperationRegistry.js"; import type { Geometries, HasFeatures, HasGeometry, HasMaps, HasUITarget, MapsLike } from "../common.js"; import type { CaptureGeometryResult } from "./sketching.js"; /** * Arguments for the geometry.project operation. */ export interface ProjectArgs { /** * The geometries to project. */ geometries: GeometryUnion | GeometryUnion[]; /** * The target spatial reference. */ outSpatialReference: SpatialReference; /** * The geographic transformation which contains the steps to transform the * input spatial reference to the output spatial reference. */ transformation?: GeographicTransformation | GeographicTransformationLegacy; } /** * The units for distance buffers supported by ArcGIS. */ export type LengthUnits = "meters" | "feet" | "kilometers" | "miles" | "nautical-miles" | "yards"; /** * The units for distance supported by Mobile. */ export type LengthUnitsMobile = LengthUnits | "millimeters" | "centimeters" | "inches" | "mm" | "cm" | "m" | "km" | "in" | "ft" | "yd" | "mi" | "nm"; /** * The result of a geometry.buffer operation. */ export interface BufferResult { /** * The buffered geometry. */ geometry: GeometryUnion | GeometryUnion[]; /** * Any maps that were included within the input arguments. */ maps?: MapsLike; } /** * Arguments for the geometry.add-point operation. */ export interface AddPointArgs { /** * The starting geometry. */ geometry: Polyline | Polygon; /** * The index of the part to which the point will be added. If null, the last * part will be used. */ partIndex?: number; /** * The index at which the point will be added. If null, the point will be * added as the last point. */ pointIndex?: number; /** * The new point to be added to 'geometry'. The spatial reference must match * 'geometry' or an error will be thrown. */ newPoint: Point; } /** * Arguments for the geometry.add-part operation. */ export interface AddPartArgs { /** * The starting geometry. */ geometry: Polyline | Polygon; /** * The new part to be added to 'geometry'. */ part: Point[]; } /** * A reference line used by the geometry.get-point operation. */ export interface ReferenceLine { /** * The geometry that contains the reference line. */ geometry: Polyline | Polygon; /** * The index of the part in 'geometry' that contains the reference line. If * null, the last part will be used. */ partIndex?: number; /** * The index of the segment that will be used as the reference line. If * null, the last segment will be used. */ segmentIndex?: number; } /** * The different types of curves that can be used for geodetic distance * calculations. */ export type GeodeticCurveType = "geodesic" | "loxodrome" | "normal-section" | "great-elliptic"; /** * Arguments for the geometry.calculate-point operation. */ export interface CalculatePointArgs { /** * The units to be used for 'distance' and 'offset'. Defaults to the default * units of the map. */ units: LengthUnitsMobile; /** * The reference line that will be used to calculate the new point. */ referenceLine: ReferenceLine; /** * The distance that will be used to calculate the new point. * * If using 'offset', this indicates the distance along the reference line. * * If using 'angle', this indicates the distance directly from the new point * to the start point of the reference line. * * Cannot be negative. */ distance: number; /** * The offset that will be used to calculate the new point. The 'offset' * corresponds to the distance perpendicularly away from the reference * line. * * Positive values will result in a point to the right of the reference * line, negative values will be to the left. * * Exactly one of 'offset' and 'angle' must be set. */ offset?: number; /** * The angle, relative to the angle of the reference line, that will be used * to calculate the new point. Positive angles are calculated clockwise from * the angle of the reference line, negative angles are calculated * counter-clockwise. * * Exactly one of 'offset' and 'angle' must be set. */ angle?: number; /** * Whether the distance calculations will be geodetic or planar. Defaults to * true. */ geodetic?: boolean; /** * The geodetic curve type used when calculating the new point. Only applies * when 'geodetic' is true. Defaults to 'geodesic'. */ geodeticCurveType: GeodeticCurveType; } /** * Arguments for the geometry.remove-point operation. */ export interface RemovePointArgs { /** * The starting geometry. */ geometry: Polyline | Polygon; /** * The index of the part from which the point will be removed. If null, the * last part will be used. */ partIndex?: number; /** * The index of the point to be removed. If null, the last point wil be * removed. */ pointIndex?: number; } /** * Arguments for the geometry.buffer operation. */ export interface BufferGeometryArgs extends HasGeometry, HasFeatures { /** * Optionally override the configured buffer distance. */ bufferDistance?: number; } export declare class GeometryOperations extends OperationRegistry { protected readonly _prefix = "geometry"; /** * Projects a set of geometries to a new spatial reference. Web only. * * @webOnly */ get project(): Operation<ProjectArgs, GeometryUnion[]>; /** * Buffers a point geometry by a distance equivalent to the number of pixels * at the current map scale. Web only. * * @webOnly */ get addPixelTolerance(): Operation<(HasFeatures | HasGeometry) & Required<HasMaps>, CaptureGeometryResult>; /** * Buffers a set of geometries by some distance to create a multi-part * polygon geometry. The distance value respects the user's preferences and * falls back on the default configured for the viewer session. Web only. * * @webOnly */ get buffer(): Operation<BufferGeometryArgs | Geometries, BufferResult>; /** * Returns the default buffer distance for the viewer session. Web only. * * @webOnly */ get getBufferDistance(): Operation<void, number>; /** * Returns the default buffer units for the viewer session. Web only. * * @webOnly */ get getBufferUnits(): Operation<void, LengthUnits>; /** * Adds a point to a given geometry. Mobile only. * * @mobileOnly */ get addPoint(): Operation<AddPointArgs, GeometryUnion>; /** * Adds a part to a given geometry. Mobile only. * * @mobileOnly */ get addPart(): Operation<AddPartArgs, GeometryUnion>; /** * Calculates a point relative to a given reference line. Mobile only. * * @mobileOnly */ get calculatePoint(): Operation<CalculatePointArgs, Point>; /** * Removes a point from a given geometry. Mobile only. * * @mobileOnly */ get removePoint(): Operation<RemovePointArgs, GeometryUnion>; } export declare class GeometryCommands extends CommandRegistry { protected readonly _prefix = "geometry"; /** * Display the geometry settings dialog. This allows you to configure buffer * distance and buffer units. Web only. * * @webOnly */ get displaySettings(): Command<HasUITarget>; /** * Sets the default buffer distance for the viewer session. The buffer * distance must be a number > 0. Web only. * * @webOnly */ get setBufferDistance(): Command<number>; /** * Sets the default buffer units for the viewer session. Web only. * * @webOnly */ get setBufferUnits(): Command<LengthUnits>; }