diff --git a/src/ol/sphere.js b/src/ol/sphere.js index 48af84e903..cbc9937b58 100644 --- a/src/ol/sphere.js +++ b/src/ol/sphere.js @@ -1,9 +1,9 @@ /** -* @license -* Latitude/longitude spherical geodesy formulae taken from -* http://www.movable-type.co.uk/scripts/latlong.html -* Licensed under CC-BY-3.0. -*/ + * @license + * Latitude/longitude spherical geodesy formulae taken from + * http://www.movable-type.co.uk/scripts/latlong.html + * Licensed under CC-BY-3.0. + */ /** * @module ol/sphere @@ -13,12 +13,15 @@ import GeometryType from './geom/GeometryType.js'; /** - * Object literal with options for the {@link getLength} or - * {@link getArea} functions. - * @typedef {{projection: (ol.ProjectionLike|undefined), - * radius: (number|undefined)}} + * Object literal with options for the {@link getLength} or {@link getArea} + * functions. + * @typedef {Object} SphereMetricOptions + * @property {module:ol/types~ProjectionLike} [projection='EPSG:3857'] + * Projection of the geometry. By default, the geometry is assumed to be in + * Web Mercator. + * @property {number} [radius=6371008.8] Sphere radius. By default, the radius of the + * earth is used (Clarke 1866 Authalic Sphere). */ -export let SphereMetricOptions; /** @@ -71,15 +74,10 @@ function getLengthInternal(coordinates, radius) { * great circle distances between coordinates. For polygons, the length is * 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 {ol.geom.Geometry} geometry A geometry. - * @param {SphereMetricOptions=} opt_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. - * @param {(ol.ProjectionLike|undefined)} opt_options.projection Projection of - * the geometry. By default, the geometry is assumed to be in EPSG:3857 - * (Web Mercator). - * @param {(number|undefined)} opt_options.radius Sphere radius. Defaults to - * the Earth's mean radius using the WGS84 ellipsoid. + * @param {module:ol/geom/Geometry~Geometry} geometry A geometry. + * @param {module:ol/sphere~SphereMetricOptions=} opt_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 */ @@ -100,20 +98,20 @@ export function getLength(geometry, opt_options) { } case GeometryType.LINE_STRING: case GeometryType.LINEAR_RING: { - coordinates = /** @type {ol.geom.SimpleGeometry} */ (geometry).getCoordinates(); + coordinates = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (geometry).getCoordinates(); length = getLengthInternal(coordinates, radius); break; } case GeometryType.MULTI_LINE_STRING: case GeometryType.POLYGON: { - coordinates = /** @type {ol.geom.SimpleGeometry} */ (geometry).getCoordinates(); + coordinates = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (geometry).getCoordinates(); for (i = 0, ii = coordinates.length; i < ii; ++i) { length += getLengthInternal(coordinates[i], radius); } break; } case GeometryType.MULTI_POLYGON: { - coordinates = /** @type {ol.geom.SimpleGeometry} */ (geometry).getCoordinates(); + coordinates = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (geometry).getCoordinates(); for (i = 0, ii = coordinates.length; i < ii; ++i) { coords = coordinates[i]; for (j = 0, jj = coords.length; j < jj; ++j) { @@ -123,7 +121,7 @@ export function getLength(geometry, opt_options) { break; } case GeometryType.GEOMETRY_COLLECTION: { - const geometries = /** @type {ol.geom.GeometryCollection} */ (geometry).getGeometries(); + const geometries = /** @type {module:ol/geom/GeometryCollection~GeometryCollection} */ (geometry).getGeometries(); for (i = 0, ii = geometries.length; i < ii; ++i) { length += getLength(geometries[i], opt_options); } @@ -145,7 +143,7 @@ export function getLength(geometry, opt_options) { * Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion * Laboratory, Pasadena, CA, June 2007 * - * @param {Array.