import Position from './Position'; /** * 坐标的 JSON 对象表示形式 * * @english * * JSON object representation of a coordinate */ export type CoordinateJson = { x: number; y: number; z?: number; }; /** * 坐标的数组表示形式,格式为 [x, y] 或 [x, y, z] * * @english * * Array representation of a coordinate, in [x, y] or [x, y, z] format */ export type CoordinateArray = [number, number] | [number, number, number]; /** * 可接受的坐标类型,包括 Coordinate 对象、JSON 对象或数组 * * @english * * Acceptable coordinate types, including Coordinate object, JSON object, or array */ export type CoordinateLike = Coordinate | CoordinateJson | CoordinateArray; /** * 坐标 `Coordinate` 的实现,例如一个地理坐标点(经度,纬度) * * @english * * Represents a coordinate point
* e.g.
* A geographical point (longitude, latitude) * @example * * ```ts * const coord = new Coordinate(0, 0); * ``` * @example * * ```ts * const coord = new Coordinate([ 0, 0 ]); * ``` * @example * * ```ts * const coord = new Coordinate({ x : 0, y : 0 }); * ``` * @category basic types */ declare class Coordinate extends Position { /** * 将一个或多个坐标对象转换为GeoJSON风格的坐标。 * * @english * * Convert one or more Coordinate objects to GeoJSON style coordinates * @param coordinates - coordinates to convert * @example * * ```ts * // result is [[100,0], [101,1]] * const numCoords = Coordinate.toNumberArrays([new Coordinate(100,0), new Coordinate(101,1)]); * ``` */ static toNumberArrays(coordinates: Coordinate): any; static toNumberArrays(coordinates: Coordinate[]): any; static toNumberArrays(coordinates: Coordinate[][]): any; static toNumberArrays(coordinates: Coordinate[][][]): any; /** * 将一个或多个GeoJSON风格的坐标转换为坐标对象。 * * @english * * Convert one or more GeoJSON style coordiantes to Coordinate objects * @param coordinates - coordinates to convert * @example * * ```ts * const coordinates = Coordinate.toCoordinates([[100,0], [101,1]]); * ``` */ static toCoordinates(coordinates: CoordinateArray | CoordinateArray[] | CoordinateArray[][] | Coordinate | Coordinate[] | Coordinate[][]): Coordinate | Coordinate[] | Coordinate[][]; /** * 使用差值与另一个坐标进行比较,判断是否临近 * * @english * * Compare with another Coordinate with a delta * @param p * @param delta */ closeTo(p: Coordinate, delta?: number): boolean; /** * 返回该坐标 x、y、z 绝对值的坐标对象(不会改变原始数据,z 存在时才会处理 z) * * @english * * Return abs value of the coordinate (z is processed only if present) * @returns abs Coordinate */ abs(): Coordinate; /** * 类似于数学中的四舍五入,对坐标的 x、y、z 进行舍入,返回一个新 Coordinate(z 存在时才会处理 z) * * @english * * Like math.round, rounding the coordinate's xyz. (z is processed only if present) * @returns rounded coordinate */ round(): Coordinate; /** * 对坐标的 x、y、z 向上取整,返回一个新 Coordinate(z 存在时才会处理 z) * * @english * * Like math.ceil, ceil the coordinate's xyz. (z is processed only if present) * @returns ceiled coordinate */ ceil(): Coordinate; /** * 对坐标的 x、y、z 向下取整,返回一个新 Coordinate(z 存在时才会处理 z) * * @english * * Like math.floor, floor the coordinate's xyz. (z is processed only if present) * @returns floored coordinate */ floor(): Coordinate; /** * 返回当前坐标的 copy * * @english * * Returns a copy of the coordinate * @returns copy */ copy(): Coordinate; /** * 坐标数字保留指定位数的小数 * * @english * * Formats coordinate number using fixed-coordinate notation. * @param n - The number of digits to appear after the decimal coordinate * @returns fixed coordinate */ toFixed(n: number): Coordinate; /** * 与传入坐标相加,返回一个新 Coordinate * * @english * * Returns the result of addition of another coordinate. * @param x - coordinate to add * @returns result */ add(x: CoordinateLike): Coordinate; /** * 与传入坐标相加,返回一个新 Coordinate * * @english * * Returns the result of addition of another coordinate. * @param x - coordinate to add * @param y - coordinate to add * @returns result */ add(x: number, y: number, z?: number): Coordinate; /** * 与传入坐标相减,返回一个新 Coordinate。 * * @english * * Returns the result of subtraction of another coordinate. * @param x - coordinate to add * @returns result */ sub(x: CoordinateLike): Coordinate; /** * 与传入坐标相减,返回一个新 Coordinate。 * * @english * * Returns the result of subtraction of another coordinate. * @param x - coordinate to add * @param y - coordinate to add * @param z - altitude to add * @returns result */ sub(x: number, y: number, z?: number): Coordinate; /** * 将当前坐标与给定数字相乘,返回一个新 Coordinate。 * * @english * * Returns the result of multiplication of the current coordinate by the given number. * @param ratio - ratio to multi * @returns result */ multi(ratio: number): Coordinate; /** * 与另外一个 coordinate 进行比较,以查看它们是否相等 * * @english * * Compare with another coordinate to see whether they are equal. * @param c - coordinate to compare */ equals(c: Coordinate): boolean; } export default Coordinate; //# sourceMappingURL=Coordinate.d.ts.map