Files
coopgo/node_modules/ol/coordinate.d.ts
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

265 lines
9.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* An array of numbers representing an xy coordinate. Example: `[16, 48]`.
* @typedef {Array<number>} Coordinate
* @api
*/
/**
* A function that takes a {@link module:ol/coordinate~Coordinate} and
* transforms it into a `{string}`.
*
* @typedef {function((Coordinate|undefined)): string} CoordinateFormat
* @api
*/
/**
* Add `delta` to `coordinate`. `coordinate` is modified in place and returned
* by the function.
*
* Example:
*
* import {add} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* add(coord, [-2, 4]);
* // coord is now [5.85, 51.983333]
*
* @param {Coordinate} coordinate Coordinate.
* @param {Coordinate} delta Delta.
* @return {Coordinate} The input coordinate adjusted by
* the given delta.
* @api
*/
export function add(coordinate: Coordinate, delta: Coordinate): Coordinate;
/**
* Calculates the point closest to the passed coordinate on the passed circle.
*
* @param {Coordinate} coordinate The coordinate.
* @param {import("./geom/Circle.js").default} circle The circle.
* @return {Coordinate} Closest point on the circumference.
*/
export function closestOnCircle(coordinate: Coordinate, circle: import("./geom/Circle.js").default): Coordinate;
/**
* Calculates the point closest to the passed coordinate on the passed segment.
* This is the foot of the perpendicular of the coordinate to the segment when
* the foot is on the segment, or the closest segment coordinate when the foot
* is outside the segment.
*
* @param {Coordinate} coordinate The coordinate.
* @param {Array<Coordinate>} segment The two coordinates
* of the segment.
* @return {Coordinate} The foot of the perpendicular of
* the coordinate to the segment.
*/
export function closestOnSegment(coordinate: Coordinate, segment: Array<Coordinate>): Coordinate;
/**
* Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be
* used to format
* a {Coordinate} to a string.
*
* Example without specifying the fractional digits:
*
* import {createStringXY} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var stringifyFunc = createStringXY();
* var out = stringifyFunc(coord);
* // out is now '8, 48'
*
* Example with explicitly specifying 2 fractional digits:
*
* import {createStringXY} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var stringifyFunc = createStringXY(2);
* var out = stringifyFunc(coord);
* // out is now '7.85, 47.98'
*
* @param {number} [opt_fractionDigits] The number of digits to include
* after the decimal point. Default is `0`.
* @return {CoordinateFormat} Coordinate format.
* @api
*/
export function createStringXY(opt_fractionDigits?: number | undefined): CoordinateFormat;
/**
* @param {string} hemispheres Hemispheres.
* @param {number} degrees Degrees.
* @param {number} [opt_fractionDigits] The number of digits to include
* after the decimal point. Default is `0`.
* @return {string} String.
*/
export function degreesToStringHDMS(hemispheres: string, degrees: number, opt_fractionDigits?: number | undefined): string;
/**
* Transforms the given {@link module:ol/coordinate~Coordinate} to a string
* using the given string template. The strings `{x}` and `{y}` in the template
* will be replaced with the first and second coordinate values respectively.
*
* Example without specifying the fractional digits:
*
* import {format} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var template = 'Coordinate is ({x}|{y}).';
* var out = format(coord, template);
* // out is now 'Coordinate is (8|48).'
*
* Example explicitly specifying the fractional digits:
*
* import {format} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var template = 'Coordinate is ({x}|{y}).';
* var out = format(coord, template, 2);
* // out is now 'Coordinate is (7.85|47.98).'
*
* @param {Coordinate} coordinate Coordinate.
* @param {string} template A template string with `{x}` and `{y}` placeholders
* that will be replaced by first and second coordinate values.
* @param {number} [opt_fractionDigits] The number of digits to include
* after the decimal point. Default is `0`.
* @return {string} Formatted coordinate.
* @api
*/
export function format(coordinate: Coordinate, template: string, opt_fractionDigits?: number | undefined): string;
/**
* @param {Coordinate} coordinate1 First coordinate.
* @param {Coordinate} coordinate2 Second coordinate.
* @return {boolean} The two coordinates are equal.
*/
export function equals(coordinate1: Coordinate, coordinate2: Coordinate): boolean;
/**
* Rotate `coordinate` by `angle`. `coordinate` is modified in place and
* returned by the function.
*
* Example:
*
* import {rotate} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var rotateRadians = Math.PI / 2; // 90 degrees
* rotate(coord, rotateRadians);
* // coord is now [-47.983333, 7.85]
*
* @param {Coordinate} coordinate Coordinate.
* @param {number} angle Angle in radian.
* @return {Coordinate} Coordinate.
* @api
*/
export function rotate(coordinate: Coordinate, angle: number): Coordinate;
/**
* Scale `coordinate` by `scale`. `coordinate` is modified in place and returned
* by the function.
*
* Example:
*
* import {scale as scaleCoordinate} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var scale = 1.2;
* scaleCoordinate(coord, scale);
* // coord is now [9.42, 57.5799996]
*
* @param {Coordinate} coordinate Coordinate.
* @param {number} scale Scale factor.
* @return {Coordinate} Coordinate.
*/
export function scale(coordinate: Coordinate, scale: number): Coordinate;
/**
* @param {Coordinate} coord1 First coordinate.
* @param {Coordinate} coord2 Second coordinate.
* @return {number} Squared distance between coord1 and coord2.
*/
export function squaredDistance(coord1: Coordinate, coord2: Coordinate): number;
/**
* @param {Coordinate} coord1 First coordinate.
* @param {Coordinate} coord2 Second coordinate.
* @return {number} Distance between coord1 and coord2.
*/
export function distance(coord1: Coordinate, coord2: Coordinate): number;
/**
* Calculate the squared distance from a coordinate to a line segment.
*
* @param {Coordinate} coordinate Coordinate of the point.
* @param {Array<Coordinate>} segment Line segment (2
* coordinates).
* @return {number} Squared distance from the point to the line segment.
*/
export function squaredDistanceToSegment(coordinate: Coordinate, segment: Array<Coordinate>): number;
/**
* Format a geographic coordinate with the hemisphere, degrees, minutes, and
* seconds.
*
* Example without specifying fractional digits:
*
* import {toStringHDMS} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var out = toStringHDMS(coord);
* // out is now '47° 58 60″ N 7° 50 60″ E'
*
* Example explicitly specifying 1 fractional digit:
*
* import {toStringHDMS} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var out = toStringHDMS(coord, 1);
* // out is now '47° 58 60.0″ N 7° 50 60.0″ E'
*
* @param {Coordinate} coordinate Coordinate.
* @param {number} [opt_fractionDigits] The number of digits to include
* after the decimal point. Default is `0`.
* @return {string} Hemisphere, degrees, minutes and seconds.
* @api
*/
export function toStringHDMS(coordinate: Coordinate, opt_fractionDigits?: number | undefined): string;
/**
* Format a coordinate as a comma delimited string.
*
* Example without specifying fractional digits:
*
* import {toStringXY} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var out = toStringXY(coord);
* // out is now '8, 48'
*
* Example explicitly specifying 1 fractional digit:
*
* import {toStringXY} from 'ol/coordinate';
*
* var coord = [7.85, 47.983333];
* var out = toStringXY(coord, 1);
* // out is now '7.8, 48.0'
*
* @param {Coordinate} coordinate Coordinate.
* @param {number} [opt_fractionDigits] The number of digits to include
* after the decimal point. Default is `0`.
* @return {string} XY.
* @api
*/
export function toStringXY(coordinate: Coordinate, opt_fractionDigits?: number | undefined): string;
/**
* Modifies the provided coordinate in-place to be within the real world
* extent. The lower projection extent boundary is inclusive, the upper one
* exclusive.
*
* @param {Coordinate} coordinate Coordinate.
* @param {import("./proj/Projection.js").default} projection Projection.
* @return {Coordinate} The coordinate within the real world extent.
*/
export function wrapX(coordinate: Coordinate, projection: import("./proj/Projection.js").default): Coordinate;
/**
* @param {Coordinate} coordinate Coordinate.
* @param {import("./proj/Projection.js").default} projection Projection.
* @param {number} [opt_sourceExtentWidth] Width of the source extent.
* @return {number} Offset in world widths.
*/
export function getWorldsAway(coordinate: Coordinate, projection: import("./proj/Projection.js").default, opt_sourceExtentWidth?: number | undefined): number;
/**
* An array of numbers representing an xy coordinate. Example: `[16, 48]`.
*/
export type Coordinate = Array<number>;
/**
* A function that takes a {@link module :ol/coordinate~Coordinate} and
* transforms it into a `{string}`.
*/
export type CoordinateFormat = (arg0: (number[] | undefined)) => string;
//# sourceMappingURL=coordinate.d.ts.map