mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-12 15:49:18 -08:00
Add selector in the UI for HiPS/FITS images
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
"dateModified": "2023-01-31",
|
||||
"issueTracker": "https://github.com/cds-astro/aladin-lite/issues",
|
||||
"name": "Aladin Lite",
|
||||
"version": "3.3.3-beta",
|
||||
"softwareVersion": "3.3.3-beta",
|
||||
"version": "3.4.0-beta",
|
||||
"softwareVersion": "3.4.0-beta",
|
||||
"description": "An astronomical HiPS visualizer in the browser.",
|
||||
"identifier": "10.5281/zenodo.7638833",
|
||||
"applicationCategory": "Astronomy, Visualization",
|
||||
|
||||
@@ -1,36 +1,42 @@
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<head> </head>
|
||||
<body>
|
||||
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
|
||||
|
||||
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
|
||||
<script type="module">
|
||||
import A from "../src/js/A.js";
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin("#aladin-lite-div", {
|
||||
target: "12 25 41.512 +12 48 47.2",
|
||||
inertia: false,
|
||||
fov: 1,
|
||||
showContextMenu: true,
|
||||
});
|
||||
// define custom draw function
|
||||
|
||||
<script type="module">
|
||||
import A from '../src/js/A.js';
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin('#aladin-lite-div', {target: '12 25 41.512 +12 48 47.2', inertia: false, fov: 1, showContextMenu: true});
|
||||
// define custom draw function
|
||||
var hips = A.catalogHiPS(
|
||||
"https://axel.u-strasbg.fr/HiPSCatService/Simbad",
|
||||
{
|
||||
onClick: "showTable",
|
||||
name: "Simbad",
|
||||
color: "cyan",
|
||||
hoverColor: "red",
|
||||
shape: (s) => {
|
||||
let a = +s.data.size_maj;
|
||||
let b = +s.data.size_min;
|
||||
|
||||
var drawFunctionFootprint = function(s) {
|
||||
let a = +s.data.size_maj;
|
||||
let b = +s.data.size_min;
|
||||
let galaxy = ["Seyfert","Gin","StarburstG","LINER","AGN","Galaxy"].some((n) => s.data.main_type.indexOf(n) >= 0);
|
||||
if (!galaxy) return;
|
||||
|
||||
let galaxy = ['Seyfert', 'Gin', 'StarburstG', 'LINER', 'AGN', 'Galaxy'].some((n) => s.data.main_type.indexOf(n) >= 0)
|
||||
if (!galaxy)
|
||||
return;
|
||||
|
||||
let theta = +s.data.size_angle || 0.0;
|
||||
return A.ellipse(s.ra, s.dec, a / 60, b / 60, theta, {color: 'cyan'});
|
||||
};
|
||||
|
||||
var hips = A.catalogHiPS('https://axel.u-strasbg.fr/HiPSCatService/Simbad', {onClick: 'showTable', name: 'Simbad', color: 'cyan', hoverColor: 'red', shape: drawFunctionFootprint});
|
||||
aladin.addCatalog(hips);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
let theta = +s.data.size_angle || 0.0;
|
||||
return A.ellipse(s.ra, s.dec, a / 60, b / 60, theta, { color: "cyan" });
|
||||
},
|
||||
}
|
||||
);
|
||||
aladin.addCatalog(hips);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
}, // no optional params
|
||||
(ra, dec, fov, image) => {
|
||||
// ra, dec and fov are centered around the fits image
|
||||
console.log("jjj", image)
|
||||
image.setColormap("magma", {stretch: "asinh"});
|
||||
|
||||
aladin.gotoRaDec(ra, dec);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
fullScreen: true,
|
||||
target: "centaurus A",
|
||||
fov: 10,
|
||||
projection: 'SIN',
|
||||
projection: 'AIT',
|
||||
showContextMenu: true,
|
||||
showSimbadPointerControl: true,
|
||||
expandLayersControl: true,
|
||||
@@ -75,6 +75,18 @@
|
||||
]
|
||||
});
|
||||
|
||||
const gleam072_103 = aladin.newImageSurvey('ov-gso/P/GLEAM/072-103', {imgFormat: 'fits', colormap: "red", stretch: "asinh"});
|
||||
const gleam103_134 = aladin.newImageSurvey('ov-gso/P/GLEAM/103-134', {imgFormat: 'fits', colormap: "green", additive: true, stretch: "asinh"});
|
||||
const gleam170_231 = aladin.newImageSurvey('ov-gso/P/GLEAM/170-231', {imgFormat: 'fits', colormap: "blue", additive: true, stretch: "asinh"});
|
||||
|
||||
//const HSCBlueSurvey = aladin.newImageSurvey('CDS/P/HSC/DR2/deep/z', {imgFormat: 'fits', colormap: "blue", minCut: -0.01218, maxCut: 2.27397, additive: true, stretch: "asinh"});
|
||||
|
||||
aladin.setBaseImageLayer(gleam072_103);
|
||||
aladin.setOverlayImageLayer(gleam103_134, 'gl2');
|
||||
aladin.setOverlayImageLayer(gleam170_231, 'gl3');
|
||||
|
||||
//aladin.setOverlayImageLayer('CDS/P/HSC/DR2/deep/z', 'hsc blue layer');
|
||||
|
||||
//const c1 = A.catalogFromURL('./data/eso.xml', {onClick: 'showTable'});
|
||||
//aladin.addCatalog(c1);
|
||||
});
|
||||
|
||||
@@ -1,33 +1,88 @@
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<head> </head>
|
||||
|
||||
<div id="aladin-lite-div" style="width: 500px; height: 400px"></div>
|
||||
<body>
|
||||
<div id="aladin-lite-div" style="width: 500px; height: 400px"></div>
|
||||
|
||||
<script type="module">
|
||||
import A from '../src/js/A.js';
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, target: "Abell 194", fov: 180, projection: 'AIT', showContextMenu: true});
|
||||
aladin.setImageSurvey('astron.nl/P/lotss_dr2_high')
|
||||
A.catalogFromSKAORucio("Abell 194", 90, {onClick: 'showTable', hoverColor: 'yellow'}, (cat) => {
|
||||
aladin.addCatalog(cat);
|
||||
});
|
||||
<script type="module">
|
||||
import A from "../src/js/A.js";
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin("#aladin-lite-div", {
|
||||
fullScreen: true,
|
||||
target: "m51",
|
||||
fov: 90,
|
||||
projection: "AIT",
|
||||
showContextMenu: true,
|
||||
showShareControl: true,
|
||||
hipsList: [
|
||||
// High energy (Gamma and X-rays)
|
||||
"CDS/P/HGPS/Flux",
|
||||
"CDS/P/Fermi/5",
|
||||
"CDS/P/Fermi/4",
|
||||
"CDS/P/Fermi/3",
|
||||
"ov-gso/P/Fermi/Band2",
|
||||
"ov-gso/P/BAT/150-195keV",
|
||||
"ov-gso/P/BAT/35-50keV",
|
||||
"ov-gso/P/BAT/14-20keV",
|
||||
"erosita/dr1/rate/023",
|
||||
"erosita/dr1/rate/024",
|
||||
// Uv/Optical/Infrared
|
||||
"CDS/P/GALEXGR6_7/FUV",
|
||||
"CDS/P/GALEXGR6_7/NUV",
|
||||
"CDS/P/DSS2/color",
|
||||
"CDS/P/PanSTARRS/DR1/g",
|
||||
"CDS/P/PanSTARRS/DR1/r",
|
||||
"CDS/P/Finkbeiner",
|
||||
"CDS/P/PanSTARRS/DR1/i",
|
||||
"CDS/P/PanSTARRS/DR1/color-i-r-g",
|
||||
"CDS/P/PanSTARRS/DR1/z",
|
||||
"CDS/P/PanSTARRS/DR1/y",
|
||||
"CDS/P/DES-DR2/ColorIRG",
|
||||
"CDS/P/2MASS/color",
|
||||
"ov-gso/P/GLIMPSE/irac1",
|
||||
"ov-gso/P/GLIMPSE/irac2",
|
||||
"CDS/P/unWISE/color-W2-W1W2-W1",
|
||||
"ov-gso/P/GLIMPSE/irac3",
|
||||
"ov-gso/P/GLIMPSE/irac4",
|
||||
"CDS/P/IRIS/color",
|
||||
"ESAVO/P/AKARI/N60",
|
||||
"ESAVO/P/AKARI/WideL",
|
||||
"ESAVO/P/HERSCHEL/SPIRE-250",
|
||||
"ESAVO/P/HERSCHEL/SPIRE-350",
|
||||
"ESAVO/P/HERSCHEL/SPIRE-500",
|
||||
// sub-mm/mm/radio
|
||||
"CDS/P/PLANCK/R3/HFI/color",
|
||||
"CDS/P/ACT_Planck/DR5/f220",
|
||||
"CDS/P/CO",
|
||||
"CDS/P/PLANCK/R3/HFI100",
|
||||
"CDS/P/PLANCK/R3/LFI30",
|
||||
"CDS/P/NVSS",
|
||||
"CSIRO/P/RACS/mid/I",
|
||||
"ov-gso/P/CGPS/VGPS",
|
||||
"CDS/C/HI4PI/HI",
|
||||
"CDS/P/MeerKAT/Galactic-Centre-1284MHz-StokesI",
|
||||
"CSIRO/P/RACS/low/I",
|
||||
"astron.nl/P/tgssadr",
|
||||
"ov-gso/P/GLEAM/170-231",
|
||||
"ov-gso/P/GLEAM/139-170",
|
||||
"astron.nl/P/lotss_dr2_high",
|
||||
"ov-gso/P/GLEAM/103-134",
|
||||
"ov-gso/P/GLEAM/072-103",
|
||||
],
|
||||
});
|
||||
|
||||
/*A.catalogFromURL('https://aladin.cds.unistra.fr/AladinLite/ska/obscoreRucio.xml', {onClick: 'showTable'}, (cat) => {
|
||||
aladin.addCatalog(cat);
|
||||
});
|
||||
aladin.setImageLayer(A.imageHiPS("astron.nl/P/lotss_dr2_high"));
|
||||
|
||||
A.catalogFromURL('data/votable/CDS-B-jcmt-obscore.xml', {onClick: 'showTable'}, (cat) => {
|
||||
aladin.addCatalog(cat);
|
||||
});*/
|
||||
A.catalogFromURL('https://aladin.cds.unistra.fr/ObsCoreRucioScs.xml', {onClick: 'showTable'}, (cat) => {
|
||||
aladin.addCatalog(cat);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
aladin.addCatalog(
|
||||
A.catalogFromSKAORucio("m51", 10, {
|
||||
onClick: "showTable",
|
||||
hoverColor: "yellow",
|
||||
})
|
||||
);
|
||||
//aladin.addCatalog(A.catalogFromURL('https://aladin.cds.unistra.fr/ObsCoreRucioScs.xml', {onClick: 'showTable'}));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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.3-beta"
|
||||
version = "3.4.0-beta"
|
||||
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -417,17 +417,6 @@ canvas {
|
||||
height: 1.7rem;
|
||||
}
|
||||
|
||||
.aladin-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.aladin-input-text.aladin-dark-theme.search {
|
||||
width: 15rem;
|
||||
text-shadow: 0px 0px 2px #000;
|
||||
@@ -439,7 +428,7 @@ canvas {
|
||||
background-repeat: no-repeat;
|
||||
text-indent: 1.8rem;
|
||||
}
|
||||
|
||||
|
||||
.aladin-input-text.search {
|
||||
background-image:none;
|
||||
text-indent: 0rem;
|
||||
@@ -1120,6 +1109,10 @@ canvas {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.aladin-stack-box .aladin-input-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.aladin-location {
|
||||
position: absolute;
|
||||
top: 0.2rem;
|
||||
|
||||
118
src/js/Aladin.js
118
src/js/Aladin.js
@@ -91,7 +91,7 @@ import { CooFrame } from './gui/Input/CooFrame';
|
||||
* This element belongs to the FoV UI thus its CSS class is `aladin-fov`
|
||||
* @property {boolean} [showLayersControl=true] - Whether to show the layers control toolbar.
|
||||
* CSS class for that button is `aladin-stack-control`
|
||||
* @property {boolean} [expandLayersControl=false] - Whether to show the stack box at starting
|
||||
* @property {boolean} [expandLayersControl=false] - Whether to show the stack box opened at starting
|
||||
* CSS class for the stack box is `aladin-stack-box`
|
||||
* @property {boolean} [showFullscreenControl=true] - Whether to show the fullscreen control toolbar.
|
||||
* CSS class for that button is `aladin-fullScreen-control`
|
||||
@@ -225,6 +225,27 @@ import { CooFrame } from './gui/Input/CooFrame';
|
||||
* String with possible values: 'equatorial', 'ICRS', 'ICRSd', 'j2000', 'gal, 'galactic'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {string} ListenerCallback
|
||||
* String with possible values: 'select',
|
||||
'objectClicked',
|
||||
'objectHovered',
|
||||
'objectHoveredStop',
|
||||
|
||||
'footprintClicked',
|
||||
'footprintHovered',
|
||||
|
||||
'positionChanged',
|
||||
'zoomChanged',
|
||||
|
||||
'click',
|
||||
'rightClickMove',
|
||||
'mouseMove',
|
||||
|
||||
'fullScreenToggled',
|
||||
'cooFrameChanged'
|
||||
*/
|
||||
|
||||
export let Aladin = (function () {
|
||||
/**
|
||||
* Creates an instance of the Aladin interactive sky atlas.
|
||||
@@ -420,14 +441,14 @@ export let Aladin = (function () {
|
||||
|
||||
cachedSurvey = {...cachedSurvey, ...survey}
|
||||
|
||||
if (survey.properties) {
|
||||
/*if (survey.properties) {
|
||||
delete cachedSurvey.properties;
|
||||
cachedSurvey = {...cachedSurvey, ...survey.properties}
|
||||
}
|
||||
if (survey.options) {
|
||||
delete cachedSurvey.options;
|
||||
cachedSurvey = {...cachedSurvey, ...survey.options}
|
||||
}
|
||||
}*/
|
||||
|
||||
} else {
|
||||
console.warn('unable to parse the survey list item: ', survey)
|
||||
@@ -447,41 +468,38 @@ export let Aladin = (function () {
|
||||
// at least id or url is defined
|
||||
let key = id || url;
|
||||
|
||||
if (!(key in ImageSurvey.cache)) {
|
||||
ImageSurvey.cache[key] = cachedSurvey
|
||||
}
|
||||
//if (!(key in ImageSurvey.cache)) {
|
||||
// Merge what is already in the cache for that HiPS with new properties
|
||||
// coming from the MOCServer
|
||||
ImageSurvey.cache[key] = {...ImageSurvey.cache[key], ...cachedSurvey}
|
||||
//}
|
||||
}
|
||||
|
||||
ALEvent.HIPS_LIST_UPDATED.dispatchedTo(this.aladinDiv);
|
||||
}
|
||||
|
||||
let HiPSQuery;
|
||||
if (hipsList.length === 0) {
|
||||
HiPSQuery = MocServer.getAllHiPSes()
|
||||
} else {
|
||||
let IDs = hipsList.map((h) => {
|
||||
if (h instanceof Object) {
|
||||
return h.id;
|
||||
} else {
|
||||
return h;
|
||||
}
|
||||
});
|
||||
/*let IDs = hipsList.map((h) => {
|
||||
if (h instanceof Object) {
|
||||
return h.id;
|
||||
} else {
|
||||
return h;
|
||||
}
|
||||
});
|
||||
|
||||
HiPSQuery = MocServer.getHiPSesFromIDs(IDs)
|
||||
}
|
||||
|
||||
HiPSQuery.then((HiPSes) => {
|
||||
MocServer.getHiPSesFromIDs(IDs).then((HiPSes) => {
|
||||
hipsList = [];
|
||||
HiPSes.forEach((h) => {
|
||||
hipsList.push({
|
||||
id: h.ID,
|
||||
name: h.obs_title,
|
||||
regime: h.obs_regime,
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
fillHiPSCache();
|
||||
});
|
||||
});*/
|
||||
fillHiPSCache();
|
||||
|
||||
this.view.showCatalog(options.showCatalog);
|
||||
|
||||
@@ -648,7 +666,7 @@ export let Aladin = (function () {
|
||||
Aladin.DEFAULT_OPTIONS = {
|
||||
survey: ImageSurvey.DEFAULT_SURVEY_ID,
|
||||
// surveys suggestion list
|
||||
hipsList: [],
|
||||
hipsList: ImageSurvey.DEFAULT_HIPS_LIST,
|
||||
//surveyUrl: ["https://alaskybis.unistra.fr/DSS/DSSColor", "https://alasky.unistra.fr/DSS/DSSColor"],
|
||||
target: "0 +0",
|
||||
cooFrame: "J2000",
|
||||
@@ -1448,13 +1466,15 @@ export let Aladin = (function () {
|
||||
url = new URL(url);
|
||||
}
|
||||
|
||||
url = url.toString()
|
||||
|
||||
// Do not use proxy with CORS headers until we solve that: https://github.com/MattiasBuelens/wasm-streams/issues/20
|
||||
//url = Utils.handleCORSNotSameOrigin(url);
|
||||
|
||||
let image = ImageFITS.cache[url];
|
||||
let image = ImageSurvey.cache[url];
|
||||
if (!image) {
|
||||
image = new ImageFITS(url, name, options, successCallback, errorCallback)
|
||||
ImageFITS.cache[url] = image;
|
||||
ImageSurvey.cache[url] = image;
|
||||
}
|
||||
|
||||
return image;
|
||||
@@ -1702,9 +1722,51 @@ export let Aladin = (function () {
|
||||
'fullScreenToggled',
|
||||
'cooFrameChanged'
|
||||
];
|
||||
// API
|
||||
//
|
||||
// setting callbacks
|
||||
|
||||
/**
|
||||
* Listen aladin for specific events
|
||||
*
|
||||
* @memberof Aladin
|
||||
* @param {ListenerCallback} what - e.g. objectHovered, select, zoomChanged, positionChanged
|
||||
* @param {function} myFunction - a callback function
|
||||
*
|
||||
* @example
|
||||
// define function triggered when a source is hovered
|
||||
aladin.on('objectHovered', function(object, xyMouseCoords) {
|
||||
if (object) {
|
||||
msg = 'You hovered object ' + object.data.name + ' located at ' + object.ra + ', ' + object.dec + '; mouse coords - x: '
|
||||
+ xyMouseCoords.x + ', y: ' + xyMouseCoords.y;
|
||||
}
|
||||
else {
|
||||
msg = 'No object hovered';
|
||||
}
|
||||
$('#infoDiv').html(msg);
|
||||
});
|
||||
|
||||
aladin.on('objectHoveredStop', function(object, xyMouseCoords) {
|
||||
if (object) {
|
||||
msg = 'You stopped hove object ' + object.data.name + ' located at ' + object.ra + ', ' + object.dec + '; mouse coords - x: '
|
||||
+ xyMouseCoords.x + ', y: ' + xyMouseCoords.y;
|
||||
}
|
||||
$('#infoDiv').html(msg);
|
||||
});
|
||||
|
||||
// define function triggered when an object is clicked
|
||||
var objClicked;
|
||||
aladin.on('objectClicked', function(object, xyMouseCoords) {
|
||||
if (object) {
|
||||
objClicked = object;
|
||||
object.select();
|
||||
msg = 'You clicked object ' + object.data.name + ' located at ' + object.ra + ', ' + object.dec + '; mouse coords - x: '
|
||||
+ xyMouseCoords.x + ', y: ' + xyMouseCoords.y;
|
||||
}
|
||||
else {
|
||||
objClicked.deselect();
|
||||
msg = 'You clicked in void';
|
||||
}
|
||||
$('#infoDiv').html(msg);
|
||||
});
|
||||
*/
|
||||
Aladin.prototype.on = function (what, myFunction) {
|
||||
if (Aladin.AVAILABLE_CALLBACKS.indexOf(what) < 0) {
|
||||
return;
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
import { ALEvent } from "./events/ALEvent.js";
|
||||
import { ColorCfg } from "./ColorCfg.js";
|
||||
import { Utils } from "./Utils";
|
||||
import { ImageSurvey } from "./ImageSurvey.js";
|
||||
|
||||
|
||||
export let ImageFITS = (function () {
|
||||
|
||||
@@ -39,9 +41,8 @@ export let ImageFITS = (function () {
|
||||
this.added = false;
|
||||
this.subtype = "fits";
|
||||
// Set it to a default value
|
||||
this.url = url.toString();
|
||||
|
||||
this.id = url.toString();
|
||||
this.url = url;
|
||||
this.id = url;
|
||||
this.name = name || this.url;
|
||||
|
||||
this.imgFormat = "fits";
|
||||
@@ -59,10 +60,33 @@ export let ImageFITS = (function () {
|
||||
let self = this;
|
||||
|
||||
this.query = Promise.resolve(self);
|
||||
this._saveInCache();
|
||||
}
|
||||
|
||||
ImageFITS.prototype._saveInCache = function() {
|
||||
let self = this;
|
||||
|
||||
let colorOpt = Object.fromEntries(Object.entries(this.colorCfg));
|
||||
let fitsOpt = {
|
||||
id: self.id,
|
||||
name: self.name,
|
||||
url: self.url,
|
||||
imgFormat: self.imgFormat,
|
||||
...colorOpt
|
||||
}
|
||||
|
||||
ImageSurvey.cache[self.id] = self;
|
||||
|
||||
//console.log('new CACHE', ImageSurvey.cache, self.id, surveyOpt, ImageSurvey.cache[self.id], ImageSurvey.cache["CSIRO/P/RACS/mid/I"])
|
||||
|
||||
// Tell that the HiPS List has been updated
|
||||
if (this.view) {
|
||||
ALEvent.HIPS_LIST_UPDATED.dispatchedTo(this.view.aladin.aladinDiv);
|
||||
}
|
||||
}
|
||||
|
||||
// A cache storing directly the images to not query for the properties each time
|
||||
ImageFITS.cache = {};
|
||||
//ImageFITS.cache = {};
|
||||
|
||||
ImageFITS.prototype.setView = function(view) {
|
||||
this.view = view;
|
||||
@@ -139,6 +163,9 @@ export let ImageFITS = (function () {
|
||||
});
|
||||
ALEvent.HIPS_LAYER_CHANGED.dispatchedTo(this.view.aladinDiv, { layer: this });
|
||||
}
|
||||
|
||||
// save it in the JS HiPS cache
|
||||
this._saveInCache()
|
||||
} catch (e) {
|
||||
// Display the error message
|
||||
console.error(e);
|
||||
|
||||
@@ -154,7 +154,7 @@ export let ImageSurvey = (function () {
|
||||
this.added = false;
|
||||
// Unique identifier for a survey
|
||||
this.id = id;
|
||||
this.name = options.name || id || url;
|
||||
this.name = options && options.name || undefined;
|
||||
this.subtype = "survey";
|
||||
|
||||
this.url = url;
|
||||
@@ -295,11 +295,11 @@ export let ImageSurvey = (function () {
|
||||
}
|
||||
|
||||
// Give a better name if we have the HiPS metadata
|
||||
self.name = self.name || properties.obsTitle;
|
||||
|
||||
self.cooFrame = properties.cooFrame || self.cooFrame;
|
||||
self.name = self.name || properties.obs_title;
|
||||
}
|
||||
|
||||
self.name = self.name || self.id || self.url;
|
||||
|
||||
self.creatorDid = self.creatorDid || self.id || self.url;
|
||||
|
||||
// Image format
|
||||
@@ -752,29 +752,31 @@ export let ImageSurvey = (function () {
|
||||
ImageSurvey.DEFAULT_SURVEY_ID = "CDS/P/DSS2/color";
|
||||
|
||||
// A cache storing directly surveys important information to not query for the properties each time
|
||||
ImageSurvey.cache = {
|
||||
/*DSS2_color: {
|
||||
ImageSurvey.cache = {};
|
||||
|
||||
ImageSurvey.DEFAULT_HIPS_LIST = [
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/DSS2/color",
|
||||
name: "DSS colored",
|
||||
url: "https://alasky.cds.unistra.fr/DSS/DSSColor",
|
||||
id: "CDS/P/DSS2/color",
|
||||
maxOrder: 9,
|
||||
tileSize: 512,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: "ICRS"
|
||||
},
|
||||
MASS2_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/2MASS/color",
|
||||
name: "2MASS colored",
|
||||
url: "https://alasky.cds.unistra.fr/2MASS/Color",
|
||||
id: "CDS/P/2MASS/color",
|
||||
maxOrder: 9,
|
||||
tileSize: 512,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: "ICRS"
|
||||
},
|
||||
DSS2_red: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/DSS2/red",
|
||||
name: "DSS2 Red (F+R)",
|
||||
url: "https://alasky.cds.unistra.fr/DSS/DSS2Merged",
|
||||
id: "CDS/P/DSS2/red",
|
||||
maxOrder: 9,
|
||||
tileSize: 512,
|
||||
imgFormat: 'fits',
|
||||
@@ -787,10 +789,10 @@ export let ImageSurvey = (function () {
|
||||
stretch: 'Linear',
|
||||
imgFormat: "fits"
|
||||
},
|
||||
GAIA_EDR3: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/DM/I/350/gaiaedr3",
|
||||
name: "Density map for Gaia EDR3 (I/350/gaiaedr3)",
|
||||
url: "https://alasky.cds.unistra.fr/ancillary/GaiaEDR3/density-map",
|
||||
id: "CDS/P/DM/I/350/gaiaedr3",
|
||||
maxOrder: 7,
|
||||
tileSize: 512,
|
||||
numBitsPerPixel: -32,
|
||||
@@ -801,10 +803,10 @@ export let ImageSurvey = (function () {
|
||||
colormap: "rdylbu",
|
||||
imgFormat: "fits",
|
||||
},
|
||||
PanSTARRS_DR1_g: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/PanSTARRS/DR1/g",
|
||||
name: "PanSTARRS DR1 g",
|
||||
url: "https://alasky.cds.unistra.fr/Pan-STARRS/DR1/g",
|
||||
id: "CDS/P/PanSTARRS/DR1/g",
|
||||
maxOrder: 11,
|
||||
tileSize: 512,
|
||||
imgFormat: 'fits',
|
||||
@@ -816,98 +818,91 @@ export let ImageSurvey = (function () {
|
||||
stretch: 'asinh',
|
||||
colormap: "redtemperature",
|
||||
},
|
||||
PanSTARRS_DR1_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/PanSTARRS/DR1/color-z-zg-g",
|
||||
name: "PanSTARRS DR1 color",
|
||||
url: "https://alasky.cds.unistra.fr/Pan-STARRS/DR1/color-z-zg-g",
|
||||
id: "CDS/P/PanSTARRS/DR1/color-z-zg-g",
|
||||
maxOrder: 11,
|
||||
tileSize: 512,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: "ICRS",
|
||||
},
|
||||
DECaPS_DR2_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/DECaPS/DR2/color",
|
||||
name: "DECaPS DR2 color",
|
||||
url: "https://alasky.cds.unistra.fr/DECaPS/DR2/CDS_P_DECaPS_DR2_color/",
|
||||
id: "CDS/P/DECaPS/DR2/color",
|
||||
maxOrder: 11,
|
||||
cooFrame: "equatorial",
|
||||
tileSize: 512,
|
||||
imgFormat: 'png',
|
||||
},
|
||||
Fermi_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/Fermi/color",
|
||||
name: "Fermi color",
|
||||
url: "https://alasky.cds.unistra.fr/Fermi/Color",
|
||||
id: "CDS/P/Fermi/color",
|
||||
maxOrder: 3,
|
||||
imgFormat: 'jpeg',
|
||||
tileSize: 512,
|
||||
cooFrame: 'equatorial'
|
||||
},
|
||||
Galex_NUV: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/GALEXGR6_7/NUV",
|
||||
id: "P/GALEXGR6_7/NUV",
|
||||
name: "GALEXGR6_7 NUV",
|
||||
url: "http://alasky.cds.unistra.fr/GALEX/GALEXGR6_7_NUV/",
|
||||
maxOrder: 8,
|
||||
imgFormat: 'png',
|
||||
tileSize: 512,
|
||||
cooFrame: 'equatorial'
|
||||
},
|
||||
IRIS_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/IRIS/color",
|
||||
id: "P/IRIS/color",
|
||||
id: "CDS/P/IRIS/color",
|
||||
name: "IRIS colored",
|
||||
url: "https://alasky.cds.unistra.fr/IRISColor",
|
||||
maxOrder: 3,
|
||||
tileSize: 256,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: 'galactic'
|
||||
},
|
||||
Mellinger_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/Mellinger/color",
|
||||
id: "P/Mellinger/color",
|
||||
id: "CDS/P/Mellinger/color",
|
||||
name: "Mellinger colored",
|
||||
url: "https://alasky.cds.unistra.fr/MellingerRGB",
|
||||
maxOrder: 4,
|
||||
tileSize: 512,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: 'galactic'
|
||||
},
|
||||
SDSS9_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/SDSS9/color",
|
||||
id: "P/SDSS9/color",
|
||||
id: "CDS/P/SDSS9/color",
|
||||
name: "SDSS9 colored",
|
||||
url: "https://alasky.cds.unistra.fr/SDSS/DR9/color",
|
||||
maxOrder: 10,
|
||||
tileSize: 512,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: 'equatorial'
|
||||
},
|
||||
SPITZER_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/SPITZER/color",
|
||||
id: "P/SPITZER/color",
|
||||
id: "CDS/P/SPITZER/color",
|
||||
name: "IRAC color I1,I2,I4 - (GLIMPSE, SAGE, SAGE-SMC, SINGS)",
|
||||
url: "http://alasky.cds.unistra.fr/Spitzer/SpitzerI1I2I4color/",
|
||||
maxOrder: 9,
|
||||
tileSize: 512,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: 'galactic'
|
||||
},
|
||||
allWISE_color: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/allWISE/color",
|
||||
id: "P/allWISE/color",
|
||||
id: "CDS/P/allWISE/color",
|
||||
name: "AllWISE color",
|
||||
url: "https://alasky.cds.unistra.fr/AllWISE/RGB-W4-W2-W1/",
|
||||
maxOrder: 8,
|
||||
tileSize: 512,
|
||||
imgFormat: 'jpeg',
|
||||
cooFrame: 'equatorial'
|
||||
},
|
||||
SDSS9_g: {
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/SDSS9/g",
|
||||
id: "P/SDSS9/g",
|
||||
id: "CDS/P/SDSS9/g",
|
||||
name: "SDSS9 band-g",
|
||||
url: "https://alasky.cds.unistra.fr/SDSS/DR9/band-g",
|
||||
maxOrder: 10,
|
||||
tileSize: 512,
|
||||
numBitsPerPixel: 16,
|
||||
@@ -917,105 +912,46 @@ export let ImageSurvey = (function () {
|
||||
maxCut: 1.8,
|
||||
stretch: 'linear',
|
||||
colormap: "redtemperature",
|
||||
}
|
||||
*/
|
||||
/*
|
||||
},
|
||||
{
|
||||
id: "P/Finkbeiner",
|
||||
id: "CDS/P/Finkbeiner",
|
||||
name: "Halpha",
|
||||
url: "https://alasky.cds.unistra.fr/FinkbeinerHalpha",
|
||||
maxOrder: 3,
|
||||
subtype: "survey",
|
||||
// options
|
||||
options: {
|
||||
minCut: -10,
|
||||
maxCut: 800,
|
||||
colormap: "rdbu",
|
||||
imgFormat: "fits",
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: "P/IRIS/color",
|
||||
name: "IRIS colored",
|
||||
url: "https://alasky.cds.unistra.fr/IRISColor",
|
||||
maxOrder: 3,
|
||||
subtype: "survey",
|
||||
minCut: -10,
|
||||
maxCut: 800,
|
||||
colormap: "rdbu",
|
||||
imgFormat: "fits",
|
||||
},
|
||||
{
|
||||
id: "P/Mellinger/color",
|
||||
name: "Mellinger colored",
|
||||
url: "https://alasky.cds.unistra.fr/MellingerRGB",
|
||||
maxOrder: 4,
|
||||
subtype: "survey",
|
||||
},
|
||||
{
|
||||
id: "P/SDSS9/color",
|
||||
name: "SDSS9 colored",
|
||||
url: "https://alasky.cds.unistra.fr/SDSS/DR9/color",
|
||||
maxOrder: 10,
|
||||
subtype: "survey",
|
||||
},
|
||||
{
|
||||
id: "P/SDSS9/g",
|
||||
name: "SDSS9 band-g",
|
||||
url: "https://alasky.cds.unistra.fr/SDSS/DR9/band-g",
|
||||
maxOrder: 10,
|
||||
subtype: "survey",
|
||||
options: {
|
||||
stretch: 'asinh',
|
||||
colormap: "redtemperature",
|
||||
imgFormat: 'fits'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "P/SPITZER/color",
|
||||
name: "IRAC color I1,I2,I4 - (GLIMPSE, SAGE, SAGE-SMC, SINGS)",
|
||||
url: "http://alasky.cds.unistra.fr/Spitzer/SpitzerI1I2I4color/",
|
||||
maxOrder: 9,
|
||||
subtype: "survey",
|
||||
},
|
||||
{
|
||||
id: "P/VTSS/Ha",
|
||||
id: "CDS/P/VTSS/Ha",
|
||||
name: "VTSS-Ha",
|
||||
url: "https://alasky.cds.unistra.fr/VTSS/Ha",
|
||||
maxOrder: 3,
|
||||
subtype: "survey",
|
||||
options: {
|
||||
minCut: -10.0,
|
||||
maxCut: 100.0,
|
||||
colormap: "grayscale",
|
||||
imgFormat: "fits"
|
||||
}
|
||||
minCut: -10.0,
|
||||
maxCut: 100.0,
|
||||
colormap: "grayscale",
|
||||
imgFormat: "fits"
|
||||
},
|
||||
{
|
||||
id: "xcatdb/P/XMM/PN/color",
|
||||
name: "XMM PN colored",
|
||||
url: "https://alasky.cds.unistra.fr/cgi/JSONProxy?url=https://saada.unistra.fr/PNColor",
|
||||
maxOrder: 7,
|
||||
subtype: "survey",
|
||||
},
|
||||
{
|
||||
id: "P/allWISE/color",
|
||||
id: "CDS/P/allWISE/color",
|
||||
name: "AllWISE color",
|
||||
url: "https://alasky.cds.unistra.fr/AllWISE/RGB-W4-W2-W1/",
|
||||
maxOrder: 8,
|
||||
subtype: "survey",
|
||||
},
|
||||
{
|
||||
id: "P/GLIMPSE360",
|
||||
/*{
|
||||
id: "CDS/P/GLIMPSE360",
|
||||
name: "GLIMPSE360",
|
||||
// This domain is not giving the CORS headers
|
||||
// We need to query by with a proxy equipped with CORS header.
|
||||
url: "https://alasky.cds.unistra.fr/cgi/JSONProxy?url=https://www.spitzer.caltech.edu/glimpse360/aladin/data",
|
||||
subtype: "survey",
|
||||
options: {
|
||||
maxOrder: 9,
|
||||
imgFormat: "jpg",
|
||||
minOrder: 3,
|
||||
}
|
||||
},*/
|
||||
};
|
||||
//url: "https://alasky.cds.unistra.fr/cgi/JSONProxy?url=https://www.spitzer.caltech.edu/glimpse360/aladin/data",
|
||||
maxOrder: 9,
|
||||
imgFormat: "jpeg",
|
||||
minOrder: 3,
|
||||
}*/
|
||||
];
|
||||
|
||||
return ImageSurvey;
|
||||
})();
|
||||
|
||||
@@ -1643,7 +1643,7 @@ export let View = (function () {
|
||||
.catch((e) => {
|
||||
// remove it from the cache
|
||||
delete ImageSurvey.cache[imageLayer.id]
|
||||
delete ImageFITS.cache[imageLayer.id]
|
||||
ALEvent.HIPS_LIST_UPDATED.dispatchedTo(this.aladin.aladinDiv);
|
||||
|
||||
throw e;
|
||||
})
|
||||
|
||||
@@ -44,15 +44,14 @@ import settingsIconUrl from "../../../../assets/icons/settings.svg";
|
||||
import filterOnUrl from "../../../../assets/icons/filter-on.svg";
|
||||
import filterOffUrl from "../../../../assets/icons/filter-off.svg";
|
||||
|
||||
import { ImageFITS } from "../../ImageFITS.js";
|
||||
import searchIconImg from "../../../../assets/icons/search.svg";
|
||||
import { TogglerActionButton } from "../Button/Toggler.js";
|
||||
import { Icon } from "../Widgets/Icon.js";
|
||||
import { ImageSurvey } from "../../ImageSurvey.js";
|
||||
import { Box } from "../Widgets/Box.js";
|
||||
import { CtxMenuActionButtonOpener } from "../Button/CtxMenuOpener.js";
|
||||
import { HiPSSearch } from "../Input/HiPSSearch.js";
|
||||
import { Input } from "../Widgets/Input.js";
|
||||
import { ImageFITS } from "../../ImageFITS.js";
|
||||
|
||||
export class OverlayStackBox extends Box {
|
||||
/*static previewImagesUrl = {
|
||||
@@ -134,6 +133,8 @@ export class OverlayStackBox extends Box {
|
||||
},
|
||||
aladin.aladinDiv
|
||||
);
|
||||
this.cachedHiPS = {};
|
||||
|
||||
this.aladin = aladin;
|
||||
|
||||
this.filterHiPSOn = false;
|
||||
@@ -159,6 +160,7 @@ export class OverlayStackBox extends Box {
|
||||
this._addListeners();
|
||||
|
||||
this.mocHiPSUrls = {};
|
||||
|
||||
this.HiPSui = {};
|
||||
let self = this;
|
||||
// Add overlay button
|
||||
@@ -692,12 +694,14 @@ export class OverlayStackBox extends Box {
|
||||
let updateOverlayList = () => {
|
||||
let wasHidden = self.isHidden;
|
||||
self._hide();
|
||||
|
||||
// recompute the ui
|
||||
// If it is shown, update it
|
||||
// show will update the content of the stack
|
||||
self.update({ content: self.createLayout() });
|
||||
|
||||
if (!wasHidden) self._show();
|
||||
|
||||
};
|
||||
|
||||
ALEvent.GRAPHIC_OVERLAY_LAYER_ADDED.listenedBy(
|
||||
@@ -759,13 +763,16 @@ export class OverlayStackBox extends Box {
|
||||
// change the ui from parameter changes
|
||||
// show button
|
||||
const opacity = hips.getOpacity();
|
||||
if (opacity !== 0.0) {
|
||||
ui.showBtn.update({
|
||||
let showBtn = ui.showBtn;
|
||||
let hiddenBtn = showBtn.options.icon.url === hideIconUrl;
|
||||
|
||||
if (opacity !== 0.0 && hiddenBtn) {
|
||||
showBtn.update({
|
||||
icon: { monochrome: true, url: showIconUrl },
|
||||
tooltip: { content: "Hide" },
|
||||
});
|
||||
} else {
|
||||
ui.showBtn.update({
|
||||
} else if (opacity === 0.0 && !hiddenBtn) {
|
||||
showBtn.update({
|
||||
icon: { monochrome: true, url: hideIconUrl },
|
||||
tooltip: { content: "Show" },
|
||||
});
|
||||
@@ -777,6 +784,25 @@ export class OverlayStackBox extends Box {
|
||||
|
||||
// Add a listener for HiPS list changes
|
||||
ALEvent.HIPS_LIST_UPDATED.listenedBy(this.aladin.aladinDiv, () => {
|
||||
self.cachedHiPS = {};
|
||||
|
||||
for (var key in ImageSurvey.cache) {
|
||||
let HiPS = ImageSurvey.cache[key];
|
||||
|
||||
self.cachedHiPS[HiPS.name] = HiPS;
|
||||
}
|
||||
|
||||
// Update the options of the selector
|
||||
const options = Object.keys(self.cachedHiPS);
|
||||
options.sort();
|
||||
|
||||
for (var key in self.HiPSui) {
|
||||
let hips = self.HiPSui[key];
|
||||
hips.HiPSSelector.update({options});
|
||||
}
|
||||
});
|
||||
|
||||
/*ALEvent.HIPS_LIST_UPDATED.listenedBy(this.aladin.aladinDiv, () => {
|
||||
// Recompute the autocompletion as the cache has changed
|
||||
HiPSSearch.HiPSList = {};
|
||||
for (var key in ImageSurvey.cache) {
|
||||
@@ -801,7 +827,7 @@ export class OverlayStackBox extends Box {
|
||||
let hips = this.HiPSui[key];
|
||||
hips.searchInput.setAutocompletionList(keys);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
_hide() {
|
||||
@@ -962,31 +988,34 @@ export class OverlayStackBox extends Box {
|
||||
let overlay = self.aladin.getOverlayImageLayer(name);
|
||||
return overlay;
|
||||
});
|
||||
|
||||
// survey list
|
||||
let selectedLayer = self.aladin.getSelectedLayer();
|
||||
|
||||
/*if (!layers) {
|
||||
super.attach(layout);
|
||||
return;
|
||||
}*/
|
||||
|
||||
let layout = [];
|
||||
const defaultLayers = Object.entries(ImageSurvey.cache).sort(function (
|
||||
e1,
|
||||
e2
|
||||
) {
|
||||
let a = e1[1];
|
||||
let b = e2[1];
|
||||
|
||||
if (!a.order) {
|
||||
return a.name > b.name ? 1 : -1;
|
||||
}
|
||||
|
||||
return a.maxOrder && a.maxOrder > b.maxOrder ? 1 : -1;
|
||||
});
|
||||
let hipsOptions = Object.keys(self.cachedHiPS);
|
||||
hipsOptions.sort()
|
||||
|
||||
for (const layer of layers) {
|
||||
let searchInput = new HiPSSearch(self.aladin, { layer });
|
||||
let HiPSSelector = Input.select({
|
||||
value: layer.name,
|
||||
options: hipsOptions,
|
||||
title: layer.name,
|
||||
change: (e) => {
|
||||
let name = e.target.value;
|
||||
// search for the
|
||||
let HiPS = self.cachedHiPS[name];
|
||||
|
||||
let image;
|
||||
if (HiPS instanceof ImageFITS) {
|
||||
image = HiPS;
|
||||
} else {
|
||||
// HiPS
|
||||
image = HiPS.id || HiPS.url || undefined;
|
||||
}
|
||||
|
||||
self.aladin.setOverlayImageLayer(image, layer.layer);
|
||||
}
|
||||
});
|
||||
|
||||
let deleteBtn = ActionButton.createSmallSizedIconBtn({
|
||||
icon: { url: removeIconUrl, monochrome: true },
|
||||
@@ -1137,14 +1166,14 @@ export class OverlayStackBox extends Box {
|
||||
btns.push(deleteBtn);
|
||||
|
||||
let item = Layout.horizontal({
|
||||
layout: [searchInput, Layout.horizontal(btns)],
|
||||
layout: [HiPSSelector, Layout.horizontal(btns)],
|
||||
});
|
||||
|
||||
layout.push(item);
|
||||
|
||||
if (!(layer.layer in self.HiPSui)) {
|
||||
self.HiPSui[layer.layer] = {
|
||||
searchInput,
|
||||
HiPSSelector,
|
||||
settingsBox,
|
||||
settingsBtn,
|
||||
showBtn,
|
||||
@@ -1205,27 +1234,5 @@ export class OverlayStackBox extends Box {
|
||||
...options,
|
||||
...{ position: this.position },
|
||||
});
|
||||
|
||||
/*const innerHeight = this.aladin.aladinDiv.offsetHeight;
|
||||
this.element()
|
||||
.querySelectorAll(".surveyItem")
|
||||
.forEach((surveyItem) => {
|
||||
surveyItem
|
||||
.querySelectorAll(".aladin-context-sub-menu")
|
||||
// skip the first menu
|
||||
.forEach((subMenu) => {
|
||||
subMenu.style.display = "block";
|
||||
|
||||
let Y =
|
||||
innerHeight -
|
||||
(subMenu.getBoundingClientRect().y -
|
||||
this.aladin.aladinDiv.getBoundingClientRect()
|
||||
.y);
|
||||
subMenu.style.display = "none";
|
||||
|
||||
subMenu.style.maxHeight = Y + "px";
|
||||
subMenu.style.overflowY = "scroll";
|
||||
});
|
||||
});*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +106,6 @@ export class Layout extends DOMElement {
|
||||
return layout;
|
||||
}
|
||||
|
||||
static toolbar(options, target, position = "beforeend") {
|
||||
let layout = new Layout(options, target, position);
|
||||
layout.addClass('aladin-toolbar');
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append an item at the beginning
|
||||
* @param {DOMElement} item - Represents the structure of the Tabs
|
||||
|
||||
Reference in New Issue
Block a user