UNPKG

@arcgis/core

Version:

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

98 lines (95 loc) 3.59 kB
import type Accessor from "../../core/Accessor.js"; import type { Area, Length, RotationType, Volume } from "../../core/quantity.js"; import type { AngleUnit } from "../../core/units.js"; /** * @internal * @internal */ export interface QuantityFormatterProperties {} /** * The format to use for the quantity. * * @internal * @internal */ export type FormattingStyle = "singular" | "plural" | "abbr"; /** * Class which has methods to format quantities like lengths and areas. To be used in components until we have a public * API for unit conversion and formatting. * * @internal * @internal */ export default class QuantityFormatter extends Accessor { /** @internal */ constructor(properties?: QuantityFormatterProperties); /** * Formats an angle quantity to degrees. Absolute angles are always formatted in the domain [0, 360). * * @param angle - Angle to be formatted. * @param unit - Unit of the original angle. * @param rotationType - The rotation type of the original angle. * @param preferredType - The preferred type of the resulting formatted angle. * @param precision - Precision to be used when formatting values. * @returns The formatted angle. * @internal */ formatAngleDegrees(angle: number, unit: AngleUnit, rotationType: RotationType, preferredType: RotationType, precision?: number | null | undefined): string; /** * Formats an area quantity to a string. * * @param quantity - The quantity to format. * @param precision - The number of decimal places to include in the formatted string. * @param format - The format to use for the quantity. * @returns The formatted quantity. * @internal */ formatArea(quantity: Area, precision?: number, format?: FormattingStyle): string; /** * Formats any quantity to a string. * * @param quantity - The quantity to format. * @param precision - The number of decimal places to include in the formatted string. * @param format - The format to use for the quantity. * @returns The formatted quantity. * @internal */ formatDecimal(quantity: Length | Area, precision?: number, format?: FormattingStyle): string; /** * Formats a length quantity to a string. * * @param quantity - The quantity to format. * @param precision - The number of decimal places to include in the formatted string. * @param format - The format to use for the quantity. * @returns The formatted length quantity. * @internal */ formatLength(quantity: Length, precision?: number, format?: FormattingStyle): string; /** * Formats a vertical length quantity (e.g. elevation) to a string. * * @param quantity - The quantity to format. * @param precision - The number of decimal places to include in the formatted string. * @param format - The format to use for the quantity. * @returns The formatted quantity. * @internal */ formatVerticalLength(quantity: Length, precision?: number, format?: FormattingStyle): string; /** * Formats a volume quantity to a string. * * @param quantity - The quantity to format. * @param precision - The number of decimal places to include in the formatted string. * @param format - The format to use for the quantity. * @returns The formatted quantity. * @internal */ formatVolume(quantity: Volume, precision?: number, format?: FormattingStyle): string; /** * Returns a promise that resolves when the messages are loaded. * * @returns A promise that resolves when the messages are loaded. * @internal */ when(): Promise<void>; }