Remove opt_ prefix

This commit is contained in:
Tim Schaub
2022-08-11 17:46:31 -06:00
committed by Tim Schaub
parent dd1edc37ca
commit 99612e7f9a
183 changed files with 1918 additions and 2079 deletions
+14 -14
View File
@@ -26,13 +26,13 @@ export const DEFAULT_RADIUS = 6371008.8;
* Get the great circle distance (in meters) between two geographic coordinates.
* @param {Array} c1 Starting coordinate.
* @param {Array} c2 Ending coordinate.
* @param {number} [opt_radius] The sphere radius to use. Defaults to the Earth's
* @param {number} [radius] The sphere radius to use. Defaults to the Earth's
* mean radius using the WGS84 ellipsoid.
* @return {number} The great circle distance between the points (in meters).
* @api
*/
export function getDistance(c1, c2, opt_radius) {
const radius = opt_radius || DEFAULT_RADIUS;
export function getDistance(c1, c2, radius) {
radius = radius || DEFAULT_RADIUS;
const lat1 = toRadians(c1[1]);
const lat2 = toRadians(c2[1]);
const deltaLatBy2 = (lat2 - lat1) / 2;
@@ -66,14 +66,14 @@ function getLengthInternal(coordinates, radius) {
* the sum of all rings. For points, the length is zero. For multi-part
* geometries, the length is the sum of the length of each part.
* @param {import("./geom/Geometry.js").default} geometry A geometry.
* @param {SphereMetricOptions} [opt_options] Options for the
* @param {SphereMetricOptions} [options] Options for the
* length calculation. By default, geometries are assumed to be in 'EPSG:3857'.
* You can change this by providing a `projection` option.
* @return {number} The spherical length (in meters).
* @api
*/
export function getLength(geometry, opt_options) {
const options = opt_options || {};
export function getLength(geometry, options) {
options = options || {};
const radius = options.radius || DEFAULT_RADIUS;
const projection = options.projection || 'EPSG:3857';
const type = geometry.getType();
@@ -123,7 +123,7 @@ export function getLength(geometry, opt_options) {
geometry
).getGeometries();
for (i = 0, ii = geometries.length; i < ii; ++i) {
length += getLength(geometries[i], opt_options);
length += getLength(geometries[i], options);
}
break;
}
@@ -169,14 +169,14 @@ function getAreaInternal(coordinates, radius) {
* Get the spherical area of a geometry. This is the area (in meters) assuming
* that polygon edges are segments of great circles on a sphere.
* @param {import("./geom/Geometry.js").default} geometry A geometry.
* @param {SphereMetricOptions} [opt_options] Options for the area
* @param {SphereMetricOptions} [options] Options for the area
* calculation. By default, geometries are assumed to be in 'EPSG:3857'.
* You can change this by providing a `projection` option.
* @return {number} The spherical area (in square meters).
* @api
*/
export function getArea(geometry, opt_options) {
const options = opt_options || {};
export function getArea(geometry, options) {
options = options || {};
const radius = options.radius || DEFAULT_RADIUS;
const projection = options.projection || 'EPSG:3857';
const type = geometry.getType();
@@ -222,7 +222,7 @@ export function getArea(geometry, opt_options) {
geometry
).getGeometries();
for (i = 0, ii = geometries.length; i < ii; ++i) {
area += getArea(geometries[i], opt_options);
area += getArea(geometries[i], options);
}
break;
}
@@ -240,12 +240,12 @@ export function getArea(geometry, opt_options) {
* @param {number} distance The great-circle distance between the origin
* point and the target point.
* @param {number} bearing The bearing (in radians).
* @param {number} [opt_radius] The sphere radius to use. Defaults to the Earth's
* @param {number} [radius] The sphere radius to use. Defaults to the Earth's
* mean radius using the WGS84 ellipsoid.
* @return {import("./coordinate.js").Coordinate} The target point.
*/
export function offset(c1, distance, bearing, opt_radius) {
const radius = opt_radius || DEFAULT_RADIUS;
export function offset(c1, distance, bearing, radius) {
radius = radius || DEFAULT_RADIUS;
const lat1 = toRadians(c1[1]);
const lon1 = toRadians(c1[0]);
const dByR = distance / radius;