Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -16,7 +16,7 @@ import {padNumber} from './string.js';
|
||||
* A function that takes a {@link module:ol/coordinate~Coordinate} and
|
||||
* transforms it into a `{string}`.
|
||||
*
|
||||
* @typedef {function((module:ol/coordinate~Coordinate|undefined)): string} CoordinateFormat
|
||||
* @typedef {function((Coordinate|undefined)): string} CoordinateFormat
|
||||
* @api
|
||||
*/
|
||||
|
||||
@@ -33,9 +33,9 @@ import {padNumber} from './string.js';
|
||||
* add(coord, [-2, 4]);
|
||||
* // coord is now [5.85, 51.983333]
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {module:ol/coordinate~Coordinate} delta Delta.
|
||||
* @return {module:ol/coordinate~Coordinate} The input coordinate adjusted by
|
||||
* @param {Coordinate} coordinate Coordinate.
|
||||
* @param {Coordinate} delta Delta.
|
||||
* @return {Coordinate} The input coordinate adjusted by
|
||||
* the given delta.
|
||||
* @api
|
||||
*/
|
||||
@@ -49,9 +49,9 @@ export function add(coordinate, delta) {
|
||||
/**
|
||||
* Calculates the point closest to the passed coordinate on the passed circle.
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate The coordinate.
|
||||
* @param {module:ol/geom/Circle} circle The circle.
|
||||
* @return {module:ol/coordinate~Coordinate} Closest point on the circumference.
|
||||
* @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, circle) {
|
||||
const r = circle.getRadius();
|
||||
@@ -81,10 +81,10 @@ export function closestOnCircle(coordinate, circle) {
|
||||
* the foot is on the segment, or the closest segment coordinate when the foot
|
||||
* is outside the segment.
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate The coordinate.
|
||||
* @param {Array<module:ol/coordinate~Coordinate>} segment The two coordinates
|
||||
* @param {Coordinate} coordinate The coordinate.
|
||||
* @param {Array<Coordinate>} segment The two coordinates
|
||||
* of the segment.
|
||||
* @return {module:ol/coordinate~Coordinate} The foot of the perpendicular of
|
||||
* @return {Coordinate} The foot of the perpendicular of
|
||||
* the coordinate to the segment.
|
||||
*/
|
||||
export function closestOnSegment(coordinate, segment) {
|
||||
@@ -118,7 +118,7 @@ export function closestOnSegment(coordinate, segment) {
|
||||
/**
|
||||
* Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be
|
||||
* used to format
|
||||
* a {module:ol/coordinate~Coordinate} to a string.
|
||||
* a {Coordinate} to a string.
|
||||
*
|
||||
* Example without specifying the fractional digits:
|
||||
*
|
||||
@@ -140,13 +140,13 @@ export function closestOnSegment(coordinate, segment) {
|
||||
*
|
||||
* @param {number=} opt_fractionDigits The number of digits to include
|
||||
* after the decimal point. Default is `0`.
|
||||
* @return {module:ol/coordinate~CoordinateFormat} Coordinate format.
|
||||
* @return {CoordinateFormat} Coordinate format.
|
||||
* @api
|
||||
*/
|
||||
export function createStringXY(opt_fractionDigits) {
|
||||
return (
|
||||
/**
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {Coordinate} coordinate Coordinate.
|
||||
* @return {string} String XY.
|
||||
*/
|
||||
function(coordinate) {
|
||||
@@ -213,7 +213,7 @@ export function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) {
|
||||
* var out = format(coord, template, 2);
|
||||
* // out is now 'Coordinate is (7.85|47.98).'
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @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
|
||||
@@ -233,8 +233,8 @@ export function format(coordinate, template, opt_fractionDigits) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate1 First coordinate.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate2 Second coordinate.
|
||||
* @param {Coordinate} coordinate1 First coordinate.
|
||||
* @param {Coordinate} coordinate2 Second coordinate.
|
||||
* @return {boolean} The two coordinates are equal.
|
||||
*/
|
||||
export function equals(coordinate1, coordinate2) {
|
||||
@@ -262,9 +262,9 @@ export function equals(coordinate1, coordinate2) {
|
||||
* rotate(coord, rotateRadians);
|
||||
* // coord is now [-47.983333, 7.85]
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {Coordinate} coordinate Coordinate.
|
||||
* @param {number} angle Angle in radian.
|
||||
* @return {module:ol/coordinate~Coordinate} Coordinate.
|
||||
* @return {Coordinate} Coordinate.
|
||||
* @api
|
||||
*/
|
||||
export function rotate(coordinate, angle) {
|
||||
@@ -291,9 +291,9 @@ export function rotate(coordinate, angle) {
|
||||
* scaleCoordinate(coord, scale);
|
||||
* // coord is now [9.42, 57.5799996]
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {Coordinate} coordinate Coordinate.
|
||||
* @param {number} scale Scale factor.
|
||||
* @return {module:ol/coordinate~Coordinate} Coordinate.
|
||||
* @return {Coordinate} Coordinate.
|
||||
*/
|
||||
export function scale(coordinate, scale) {
|
||||
coordinate[0] *= scale;
|
||||
@@ -303,8 +303,8 @@ export function scale(coordinate, scale) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/coordinate~Coordinate} coord1 First coordinate.
|
||||
* @param {module:ol/coordinate~Coordinate} coord2 Second coordinate.
|
||||
* @param {Coordinate} coord1 First coordinate.
|
||||
* @param {Coordinate} coord2 Second coordinate.
|
||||
* @return {number} Squared distance between coord1 and coord2.
|
||||
*/
|
||||
export function squaredDistance(coord1, coord2) {
|
||||
@@ -315,8 +315,8 @@ export function squaredDistance(coord1, coord2) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/coordinate~Coordinate} coord1 First coordinate.
|
||||
* @param {module:ol/coordinate~Coordinate} coord2 Second coordinate.
|
||||
* @param {Coordinate} coord1 First coordinate.
|
||||
* @param {Coordinate} coord2 Second coordinate.
|
||||
* @return {number} Distance between coord1 and coord2.
|
||||
*/
|
||||
export function distance(coord1, coord2) {
|
||||
@@ -327,8 +327,8 @@ export function distance(coord1, coord2) {
|
||||
/**
|
||||
* Calculate the squared distance from a coordinate to a line segment.
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate of the point.
|
||||
* @param {Array<module:ol/coordinate~Coordinate>} segment Line segment (2
|
||||
* @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.
|
||||
*/
|
||||
@@ -358,7 +358,7 @@ export function squaredDistanceToSegment(coordinate, segment) {
|
||||
* var out = toStringHDMS(coord, 1);
|
||||
* // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @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.
|
||||
@@ -393,7 +393,7 @@ export function toStringHDMS(coordinate, opt_fractionDigits) {
|
||||
* var out = toStringXY(coord, 1);
|
||||
* // out is now '7.8, 48.0'
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {Coordinate} coordinate Coordinate.
|
||||
* @param {number=} opt_fractionDigits The number of digits to include
|
||||
* after the decimal point. Default is `0`.
|
||||
* @return {string} XY.
|
||||
|
||||
Reference in New Issue
Block a user