From 8ee161481e45c40c29ef7cfc0d6eab4216be02b3 Mon Sep 17 00:00:00 2001 From: Matthieu Baumann Date: Wed, 11 Sep 2024 16:40:51 +0200 Subject: [PATCH] expose in the doc the api of coo class --- CHANGELOG.md | 1 + package.json | 2 +- src/js/libs/astro/coo.js | 35 +++++++++++++---------------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3d7a02b..f14e4f54c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * [feat] Add support for name removing in `removeOverlay` method * [test] Add support of playwright. Instructions in the readme for running the test matching snapshots [PR #176] * [fixed] Order of overlays in the stack now matches the addMOC/addCatalog/addOverlay calls ordering +* [doc] Expose the API of Coo class ## 3.5.0-beta diff --git a/package.json b/package.json index f92c770ba..63061f627 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:build": "cd src/core && cargo test --release --features webgl2", "test:playwright": "npx playwright test", "test:update-snapshots": "npx playwright test --update-snapshots", - "doc": "jsdoc -c jsdoc.json src/js src/js/shapes && cp aladin-logo.png docs/", + "doc": "jsdoc -c jsdoc.json src/js src/js/shapes src/js/libs/astro && cp aladin-logo.png docs/", "doc:dev": "npm run doc && open docs/index.html" }, "devDependencies": { diff --git a/src/js/libs/astro/coo.js b/src/js/libs/astro/coo.js index d82d4c145..b1eb49a83 100644 --- a/src/js/libs/astro/coo.js +++ b/src/js/libs/astro/coo.js @@ -5,10 +5,14 @@ import { AstroMath } from "./astroMath.js"; /** - * Constructor - * @param longitude longitude (decimal degrees) - * @param latitude latitude (decimal degrees) - * @param prec precision + * Represents a Coo with configurable parsing options. + * + * @class + * @constructs Coo + * + * @param {number} longitude longitude (decimal degrees) + * @param {number} latitude latitude (decimal degrees) + * @param {number} prec precision * (8: 1/1000th sec, 7: 1/100th sec, 6: 1/10th sec, 5: sec, 4: 1/10th min, 3: min, 2: 1/10th deg, 1: deg */ export let Coo = function(longitude, latitude, prec) { @@ -52,7 +56,7 @@ Coo.prototype = { /** * Squared distance between 2 points (= 4.sin2(r/2)) - * @param pos another position on the sphere + * @param {Coo} pos another position on the sphere * @return ||pos-this||2 = 4.sin2(r/2) **/ dist2: function(pos) { @@ -67,7 +71,7 @@ Coo.prototype = { /** * Distance between 2 points on the sphere. - * @param pos another position on the sphere + * @param {Coo} pos another position on the sphere * @return distance in degrees in range [0, 180] **/ distance: function(pos) { @@ -77,10 +81,6 @@ Coo.prototype = { return (2. * AstroMath.asind(0.5 * Math.sqrt(this.dist2(pos)))); }, - /** - * Transform the position into another frame. - * @param new_frame The frame of the resulting position. - **/ convertTo: function(new_frame) { // Verify first if frames identical -- then nothing to do ! if (this.frame.equals(new_frame)) { @@ -94,10 +94,6 @@ Coo.prototype = { this.lon = this.lat = 0./0.; // Actual angles not recomputed }, - /** - * Rotate a coordinate (apply a rotation to the position). - * @param R [3][3] Rotation Matrix - */ rotate: function(R) { var X, Y, Z; if (R == Umatrix3) return; @@ -109,11 +105,6 @@ Coo.prototype = { this.lon = this.lat = 0./0.; }, - /** - * Rotate a coordinate (apply a rotation to the position) in reverse direction. - * The method is the inverse of rotate. - * @param R [3][3] Rotation Matrix - */ rotate_1: function(R) { var X, Y, Z; if (R == Umatrix3) return; @@ -128,7 +119,7 @@ Coo.prototype = { /** * Test equality of Coo. - * @param coo Second coordinate to compare with + * @param {Coo} coo Second coordinate to compare with * @return True if the two coordinates are equal */ equals: function(coo) { @@ -137,7 +128,7 @@ Coo.prototype = { /** * parse a coordinate string. The coordinates can be in decimal or sexagesimal - * @param str string to parse + * @param {string} str string to parse * @return true if the parsing succeded, false otherwise */ parse: function(str) { @@ -234,7 +225,7 @@ Coo.prototype = { /** * Format coordinates according to the options - * @param options 'd': decimal, 's': sexagésimal, '/': space separated, '2': return [ra,dec] in an array + * @param {string} options 'd': decimal, 's': sexagésimal, '/': space separated, '2': return [ra,dec] in an array * @return the formatted coordinates */ format: function(options) {