diff --git a/examples/al-easy-access-simbad-ned.html b/examples/al-easy-access-simbad-ned.html index 44330271..0bc18dd7 100644 --- a/examples/al-easy-access-simbad-ned.html +++ b/examples/al-easy-access-simbad-ned.html @@ -22,10 +22,8 @@ samp: true, }); - A.catalogFromSimbad('09 55 52.4 +69 40 47', 0.1, {onClick: 'showTable', limit: 1000}, (cat) => { - aladin.addCatalog(cat) - }); - aladin.addCatalog(A.catalogFromNED('09 55 52.4 +69 40 47', 0.1, {onClick: 'showPopup', shape: 'plus'})); + aladin.addCatalog(A.catalogFromSimbad('M 82', 0.1, {onClick: 'showTable'})); + aladin.addCatalog(A.catalogFromNED('09 55 52.4 +69 40 47', 0.1, {onClick: 'showPopup', shape: 'plus'})); }); diff --git a/examples/al-simbad-filter.html b/examples/al-simbad-filter.html new file mode 100644 index 00000000..8460cfba --- /dev/null +++ b/examples/al-simbad-filter.html @@ -0,0 +1,45 @@ + + + + + + + + +
+ +Show sources with proper motion greater than: + +0 mas/yr

+ + + + + + + diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index 097891aa..c954b1fe 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -3,7 +3,7 @@ name = "aladin-lite" description = "Aladin Lite v3 introduces a new graphical engine written in Rust with the use of WebGL" license = "BSD-3-Clause" repository = "https://github.com/cds-astro/aladin-lite" -version = "3.3.0" +version = "3.3.1" authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",] edition = "2018" diff --git a/src/css/aladin.css b/src/css/aladin.css index e7427bb1..89ba1ea3 100644 --- a/src/css/aladin.css +++ b/src/css/aladin.css @@ -1,8 +1,8 @@ -body { overscroll-behavior: contain; } +/*body { overscroll-behavior: contain; }*/ .aladin-container { position: relative; - height: 100%; + /*height: 100%;*/ border: 0px solid #ddd; /* SVG inside divs add a 4px height: https://stackoverflow.com/questions/75751593/why-there-is-additional-4px-height-for-div-when-there-is-svg-inside-it */ @@ -115,6 +115,7 @@ body { overscroll-behavior: contain; } .aladin-measurement-div.aladin-dark-theme table thead { background-color: #000; + color: white; } .aladin-measurement-div table td.aladin-href-td-container a:hover { @@ -412,6 +413,9 @@ canvas { .aladin-measurement-div.aladin-dark-theme { background-color: rgba(0, 0, 0, 0.5); border: 1px solid white; +} + +.aladin-measurement-div.aladin-dark-theme table { color: white; } @@ -1168,6 +1172,9 @@ canvas { max-width: calc(100% - 0.4rem); line-height: 1rem; } +.aladin-measurement-div.aladin-dark-theme { + color: white; +} .aladin-share-control { position: absolute; diff --git a/src/js/A.js b/src/js/A.js index 2e373898..8f2691b7 100644 --- a/src/js/A.js +++ b/src/js/A.js @@ -44,6 +44,7 @@ import { Aladin } from "./Aladin.js"; import { ActionButton } from "./gui/Widgets/ActionButton.js"; import { Box } from "./gui/Widgets/Box.js"; import { AladinUtils } from "./AladinUtils.js"; +import { Sesame } from "./Sesame.js"; // Wasm top level import import init, * as module from './../core/pkg'; @@ -502,9 +503,9 @@ A.catalogFromURL = function (url, options, successCallback, errorCallback, usePr * @param {number} target.dec - Declination in degrees of the cone's center * @param {number} radius - Radius of the cone in degrees * @param {Object|CatalogOptions} [options] - Additional configuration options for SIMBAD cone search. See the {@link https://simbad.cds.unistra.fr/cone/help/#/ConeSearch/get_ SIMBAD cone search} parameters. - * @param {Object} [options.limit] - The max number of sources to return - * @param {Object} [options.orderBy] - Order the result by specific - * + * @param {number} [options.limit] - The max number of sources to return + * @param {string} [options.orderBy='nb_ref'] - Order the result by specific ref number + * @param {number} [options.verbosity=2] - Verbosity, put 3 if you want all the column * @param {function} [successCallback] - The callback function to execute on successful catalog creation. * @param {function} [errorCallback] - The callback function to execute on error during catalog creation. * @returns {Catalog} A new instance of the Catalog class created from the SIMBAD cone search. @@ -519,8 +520,8 @@ A.catalogFromSimbad = function (target, radius, options, successCallback, errorC if (!('name' in options)) { options['name'] = 'Simbad'; } - - return new Promise((resolve, reject) => { + let cat = A.catalog(options); + new Promise((resolve, reject) => { let coo; if (target && (typeof target === "object")) { if ('ra' in target && 'dec' in target) { @@ -556,8 +557,45 @@ A.catalogFromSimbad = function (target, radius, options, successCallback, errorC } }).then((coo) => { const url = URLBuilder.buildSimbadCSURL(coo.lon, coo.lat, radius, options) - return A.catalogFromURL(url, options, successCallback, errorCallback, false); + const processVOTable = function (table) { + let {sources, footprints, fields, type} = table; + cat.setFields(fields); + + if (cat.type === 'ObsCore') { + // The fields corresponds to obscore ones + // Set the name of the catalog to be ObsCore: + cat.name = "ObsCore:" + url; + } + + cat.addFootprints(footprints) + cat.addSources(sources); + + if (successCallback) { + successCallback(cat); + } + + if (sources.length === 0) { + console.warn(cat.name + ' has no sources!') + } + + // Even if the votable is not a proper ObsCore one, try to see if specific columns are given + // e.g. access_format and access_url + //ObsCore.handleActions(catalog); + }; + + + Catalog.parseVOTable( + url, + processVOTable, + errorCallback, + cat.maxNbSources, + false, + cat.raField, cat.decField + ); + }) + + return cat; }; /** diff --git a/src/js/Aladin.js b/src/js/Aladin.js index bd675347..56c50b4d 100644 --- a/src/js/Aladin.js +++ b/src/js/Aladin.js @@ -2057,7 +2057,8 @@ export let Aladin = (function () { * @param {Function} successCallback - The callback function to be executed on a successful display. * The callback gives the ra, dec, and fov of the image; * @param {Function} errorCallback - The callback function to be executed if an error occurs during display. - * + * @param {string} [layer="base"] - The name of the layer. If not specified, it will be replace the base layer. +* * @example * aladin.displayJPG( * // the JPG to transform to HiPS @@ -2099,6 +2100,7 @@ export let Aladin = (function () { * @param {Function} successCallback - The callback function to be executed on a successful display. * The callback gives the ra, dec, and fov of the image; * @param {Function} errorCallback - The callback function to be executed if an error occurs during display. + * @param {string} [layer="overlay"] - The name of the layer. If not specified, it will add a new overlay layer on top of the base. * * @example * aladin.displayJPG( @@ -2113,7 +2115,7 @@ export let Aladin = (function () { * }) *); */ - Aladin.prototype.displayJPG = function (url, options, successCallback, errorCallback) { + Aladin.prototype.displayJPG = function (url, options, successCallback, errorCallback, layer = "overlay") { options = options || {}; options.color = true; options.label = options.label || "JPG/PNG image"; @@ -2163,7 +2165,7 @@ export let Aladin = (function () { var meta = response.data.meta; const survey = self.createImageSurvey(response.data.url, label, response.data.url); - self.setOverlayImageLayer(survey, "overlay"); + self.setOverlayImageLayer(survey, layer); var transparency = (options && options.transparency) || 1.0; survey.setOpacity(transparency); diff --git a/src/js/ImageFITS.js b/src/js/ImageFITS.js index e9a1bd18..51ac6235 100644 --- a/src/js/ImageFITS.js +++ b/src/js/ImageFITS.js @@ -209,8 +209,6 @@ export let ImageFITS = (function () { return self; }).catch((e) => { - window.alert(e + ". See the javascript console for more logging details.") - if (self.errorCallback) { self.errorCallback() } diff --git a/src/js/URLBuilder.js b/src/js/URLBuilder.js index 250376ac..68be13dc 100644 --- a/src/js/URLBuilder.js +++ b/src/js/URLBuilder.js @@ -40,6 +40,10 @@ export let URLBuilder = (function() { url += '&MAXREC=' + options.limit; } + if (options && options.verbosity) { + url += '&VERB=' + options.verbosity; + } + const orderBy = options && options.orderBy || 'nb_ref'; url += '&ORDER_BY=' + orderBy; diff --git a/src/js/View.js b/src/js/View.js index 70e2ddd6..8ad08693 100644 --- a/src/js/View.js +++ b/src/js/View.js @@ -351,8 +351,8 @@ export let View = (function () { this.aladinDiv.style.setProperty('line-height', 0); Utils.cssScale = undefined; - var computedWidth = parseFloat(window.getComputedStyle(this.aladinDiv).width) || 1.0; - var computedHeight = parseFloat(window.getComputedStyle(this.aladinDiv).height) || 1.0; + var computedWidth = parseFloat(this.aladinDiv.getBoundingClientRect().width) || 1.0; + var computedHeight = parseFloat(this.aladinDiv.getBoundingClientRect().height) || 1.0; this.width = Math.max(computedWidth, 1); this.height = Math.max(computedHeight, 1); // this prevents many problems when div size is equal to 0 diff --git a/src/js/gui/Box/ServiceQueryBox.js b/src/js/gui/Box/ServiceQueryBox.js index e5f9d6c2..cb0f1272 100644 --- a/src/js/gui/Box/ServiceQueryBox.js +++ b/src/js/gui/Box/ServiceQueryBox.js @@ -85,10 +85,6 @@ export class ServiceQueryBox extends Box { .catch((e) => { window.alert(e) }) - .finally(() => { - // set cursor back to the normal mode - //loadingBtn.remove(); - }) }, subInputs: [] });