fix #225. I set to the hips object the cached options if there are instead of erasing the Hips object given by the user with a new one with the cached options

This commit is contained in:
Matthieu Baumann
2025-02-11 19:04:14 +01:00
parent 8844dc3c61
commit f75211902b
5 changed files with 279 additions and 272 deletions

View File

@@ -10,7 +10,7 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:2.0, target: "22 35 58.39 +33 57 57.8", showSettingsControl: true, log: false});
aladin = A.aladin('#aladin-lite-div', {samp: true, survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:2.0, target: "22 35 58.39 +33 57 57.8", showSettingsControl: true, log: false});
aladin.setProjection('AIT');
let cfht = aladin.createImageSurvey("CFHT", "CFHT MegaCam u+g+r", "./data/hips/CFHT", "equatorial", 10, {imgFormat: 'png'});
let jwst1 = aladin.createImageSurvey("CDS/P/JWST/Stephans-Quintet/NIRCam+MIRI", "JWST NIRCam+MIRI", "data/hips/JWST_NIRCam_MIRI", null, null, {imgFormat: 'png'});

View File

@@ -12,10 +12,13 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {projection: 'AIT', cooFrame: 'galactic', fov: 200, target: 'galactic center'});
let dss = aladin.createImageSurvey("DSS blue band", "Color DSS blue HiPS", "http://alasky.cds.unistra.fr/DSS/DSS2-blue-XJ-S/", "equatorial", 9, {imgFormat: 'fits'})
aladin.setBaseImageLayer(dss);
aladin.getBaseImageLayer().setCuts(2, 10000);
});
</script>

View File

@@ -15,10 +15,6 @@
// 'rdbu', 'rdylbu', 'redtemperature', 'sinebow', 'spectral', 'summer', 'viridis', 'ylgnbu' and 'ylorbr'
hips = aladin.getBaseImageLayer()
hips.setColormap("cubehelix");
aladin.setImageSurvey('astron.nl/P/lotss_dr2_high')
//aladin.getBaseImageLayer().setColor([1.0, 0.0, 1.0, 1.0], { tf: 'Linear'} );
});
</script>

View File

@@ -1876,22 +1876,21 @@ export let Aladin = (function () {
// 2/ Not in the cache, then we create the hips from this url/id and
// go to the case 3
imageLayer = A.HiPS(idOrUrl);
return this.setOverlayImageLayer(imageLayer, layer);
}
} else {
// 3/ It is an image survey.
imageLayer = urlOrHiPSOrFITS;
if (imageLayer instanceof HiPS) {
let cachedLayerOptions = hipsCache.get(imageLayer.id)
if (!cachedLayerOptions) {
hipsCache.append(imageLayer.id, imageLayer.options)
} else {
// first set the options of the cached layer to the one of the user
// if it is in the cache we get it from the cache
imageLayer = A.HiPS(imageLayer.id, cachedLayerOptions)
// set the options from what is in the cache
imageLayer.setOptions(cachedLayerOptions);
}
}
}

View File

@@ -47,9 +47,7 @@ export let Datalink = (function() {
Datalink.prototype.handleActions = function(url, obscoreRow, aladinInstance) {
//const url = obscoreRow["access_url"];
new VOTable(
url,
(rsc) => {
let success = (rsc) => {
rsc = VOTable.parseRsc(rsc);
// It is a table
@@ -340,8 +338,19 @@ export let Datalink = (function() {
this.services[serviceDesc.name] = serviceDesc;
}
}
},
};
new VOTable(
url,
success,
() => {
new VOTable(
url,
success,
undefined,
true
)
},
false
)
};