Skip to content

Commit

Permalink
add local hips example, hips cache is not a static variable anymore, …
Browse files Browse the repository at this point in the history
…disable scroll bar style in the measurementdiv table
  • Loading branch information
bmatthieu3 committed Jul 22, 2024
1 parent 7c4fdb8 commit 0cf53a6
Show file tree
Hide file tree
Showing 46 changed files with 1,659 additions and 188 deletions.
10 changes: 3 additions & 7 deletions examples/al-displayFITS.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@

aladin.displayFITS(
//'https://fits.gsfc.nasa.gov/samples/FOCx38i0101t_c0f.fits', // url of the fits file
'data/fits/HorseHead.fits',
'images/panstarrs-g-m61.fits',
//'data/fits/neowise.fits',
//'data/fits/irac.fits',
//'data/fits/FOCx38i0101t_c0f.fits',
{
name: 'horsehead',
minCut: 5000,
maxCut: 17000,
name: 'm61',
colormap: 'viridis'
}, // no optional params
(ra, dec, fov, image) => {
(ra, dec, fov, _) => {
// ra, dec and fov are centered around the fits image
image.setColormap("magma", {stretch: "asinh"});

aladin.gotoRaDec(ra, dec);
aladin.setFoV(fov);
},
Expand Down
6 changes: 4 additions & 2 deletions examples/al-hips-local.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
<body>

<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<!--<script type="text/javascript" src="./../dist/aladin.umd.cjs" charset="utf-8"></script>-->

<script type="module">
import A from '../src/js/A.js';

let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: 'galactic center'});
aladin = A.aladin('#aladin-lite-div', {target: "05 40 59.12 -02 27 04.1", fov: 2});

let survey = aladin.createImageSurvey('hips gaia', "hips gaia name", "data/hips/gaia", undefined, undefined, {colormap:"viridis"});
let survey = aladin.createImageSurvey('DSS2 local', "local hips", "hips/CDS_P_DSS2_color");
aladin.setBaseImageLayer(survey);
});
</script>
Expand Down
Binary file added examples/hips/CDS_P_DSS2_color/Moc.fits
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/hips/CDS_P_DSS2_color/Norder3/Allsky.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,399 changes: 1,399 additions & 0 deletions examples/hips/CDS_P_DSS2_color/index.html

Large diffs are not rendered by default.

Binary file added examples/hips/CDS_P_DSS2_color/preview.jpg
48 changes: 48 additions & 0 deletions examples/hips/CDS_P_DSS2_color/properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
hips_doi = 10.26093/cds/aladin/ht9n-7r
creator_did = ivo://CDS/P/DSS2/color
obs_collection = DSS colored
obs_title = DSS colored
obs_description = Color composition generated by CDS. This HiPS survey is based on 2 others HiPS surveys, respectively DSS2-red and DSS2-blue HiPS, both of them directly generated from original scanned plates downloaded from STScI site. The red component has been built from POSS-II F, AAO-SES,SR and SERC-ER plates. The blue component has been build from POSS-II J and SERC-J,EJ. The green component is based on the mean of other components. Three missing plates from red survey (253, 260, 359) has been replaced by pixels from the DSSColor STScI jpeg survey. The 11 missing blue plates (mainly in galactic plane) have not been replaced (only red component).
obs_copyright = Digitized Sky Survey - STScI/NASA, Colored & Healpixed by CDS
obs_copyright_url = http://archive.stsci.edu/dss/copyright.html
client_category = Image/Optical/DSS
client_sort_key = 03-00
hips_builder = Aladin/HipsGen v10.123
hips_creation_date = 2010-05-01T19:05Z
hips_release_date = 2019-05-07T10:55Z
hips_creator = Oberto A. (CDS) , Fernique P. (CDS)
hips_version = 1.4
hips_order = 5
hips_frame = equatorial
hips_tile_width = 512
hips_tile_format = jpeg
dataproduct_type = image
client_application = AladinLite
#hips_service_url = http://alasky.u-strasbg.fr/DSS/DSSColor
hips_status = public partial unclonable
hips_rgb_red = DSS2Merged [1488.0 8488.8125 14666.0 Linear]
hips_rgb_blue = DSS2-blue-XJ-S [4286.0 12122.5 19959.0 Linear]
hips_hierarchy = median
hips_pixel_scale = 2.236E-4
hips_initial_ra = 085.30251
hips_initial_dec = -02.25468
hips_initial_fov = 2
moc_sky_fraction = 0.001302
hips_copyright = CNRS/Unistra
obs_ack = The Digitized Sky Surveys were produced at the Space Telescope Science Institute under U.S. Government grant NAG W-2166. The images of these surveys are based on photographic data obtained using the Oschin Schmidt Telescope on Palomar Mountain and the UK Schmidt Telescope. The plates were processed into the present compressed digital form with the permission of these institutions. The National Geographic Society - Palomar Observatory Sky Atlas (POSS-I) was made by the California Institute of Technology with grants from the National Geographic Society. The Second Palomar Observatory Sky Survey (POSS-II) was made by the California Institute of Technology with funds from the National Science Foundation, the National Geographic Society, the Sloan Foundation, the Samuel Oschin Foundation, and the Eastman Kodak Corporation. The Oschin Schmidt Telescope is operated by the California Institute of Technology and Palomar Observatory. The UK Schmidt Telescope was operated by the Royal Observatory Edinburgh, with funding from the UK Science and Engineering Research Council (later the UK Particle Physics and Astronomy Research Council), until 1988 June, and thereafter by the Anglo-Australian Observatory. The blue plates of the southern Sky Atlas and its Equatorial Extension (together known as the SERC-J), as well as the Equatorial Red (ER), and the Second Epoch [red] Survey (SES) were all taken with the UK Schmidt. Supplemental funding for sky-survey work at the ST ScI is provided by the European Southern Observatory.
prov_progenitor = STScI
bib_reference = 1996ASPC..101...88L
bib_reference_url = http://cdsads.u-strasbg.fr/abs/1996ASPC..101...88L
# 1975-1999
t_min = 42413
t_max = 51179
obs_regime = Optical
em_min = 4e-7
em_max = 6e-7
#hips_master_url = ex: http://yourHipsServer/null
hips_order_min = 0
dataproduct_subtype = color
hipsgen_date = 2019-05-07T10:55Z
hipsgen_params = out=/asd-volumes/sc1-asd-volume8/DSS/DSSColor UPDATE
hipsgen_date_1 = 2024-07-22T14:13Z
hipsgen_params_1 = order=5 region=3/357 in=https://alasky.cds.unistra.fr/DSS/DSSColor/ MIRROR
Binary file added examples/images/panstarrs-g-m61.fits
Binary file not shown.
8 changes: 4 additions & 4 deletions src/core/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
},
renderable::grid::ProjetedGrid,
renderable::Layers,
renderable::{catalog::Manager, line::RasterizedLineRenderer, moc::MOCRenderer, Renderer},
renderable::{catalog::Manager, moc::MOCRenderer},
shader::ShaderManager,
tile_fetcher::TileFetcherQueue,
time::DeltaTime,
Expand Down Expand Up @@ -89,7 +89,7 @@ pub struct App {
_final_rendering_pass: RenderPass,
_fbo_view: FrameBufferObject,
_fbo_ui: FrameBufferObject,
line_renderer: RasterizedLineRenderer,
//line_renderer: RasterizedLineRenderer,

colormaps: Colormaps,

Expand Down Expand Up @@ -196,7 +196,7 @@ impl App {
let (img_send, img_recv) = async_channel::unbounded::<ImageLayer>();
let (ack_img_send, ack_img_recv) = async_channel::unbounded::<ImageParams>();

let line_renderer = RasterizedLineRenderer::new(&gl)?;
//let line_renderer = RasterizedLineRenderer::new(&gl)?;

let dist_dragging = 0.0;
let time_start_dragging = Time::now();
Expand Down Expand Up @@ -231,7 +231,7 @@ impl App {
_fbo_ui,
_final_rendering_pass,

line_renderer,
//line_renderer,

// inertia
inertia,
Expand Down
3 changes: 1 addition & 2 deletions src/core/src/renderable/grid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ impl ProjetedGrid {
);

let num_instances = buf.len() / 4;
let c = self.color.clone();
log!(c);

self.gl.enable(WebGl2RenderingContext::BLEND);
crate::shader::get_shader(&self.gl, shaders, "line_inst_ndc.vert", "line_base.frag")?
.bind(&self.gl)
Expand Down
13 changes: 11 additions & 2 deletions src/css/aladin.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,22 @@

max-height: 30vh;
max-width: 100%;
-ms-overflow-style: none;
overscroll-behavior-x: none;
overflow-y: scroll;

/* Hide scrollbar for IE, Edge and Firefox */
-ms-overflow-style: none;
scrollbar-width: none;

border-radius: 3px;
border-top-left-radius: 0;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.aladin-measurement-div::-webkit-scrollbar {
display: none;
}

.aladin-btn.tab {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
Expand Down Expand Up @@ -632,8 +639,10 @@ canvas {
overscroll-behavior-x: none;
overflow-y: scroll;
scrollbar-width: none;
}

max-width: 20rem;
.aladin-status-bar-message::-webkit-scrollbar {
display: none;
}

.aladin-sp-title a {
Expand Down
1 change: 1 addition & 0 deletions src/js/A.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ A.ellipse = function (ra, dec, radiusRaDeg, radiusDecDeg, rotationDeg, options)
* @returns {Vector}
*/
A.vector = function (ra1, dec1, ra2, dec2, options) {
options = options || {};
options['arrow'] = true;

return new Vector(ra1, dec1, ra2, dec2, options);
Expand Down
87 changes: 39 additions & 48 deletions src/js/Aladin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import { MeasurementTable } from "./MeasurementTable.js";
import { ImageHiPS } from "./ImageHiPS.js";
import { Coo } from "./libs/astro/coo.js";
import { CooConversion } from "./CooConversion.js";
import { HiPSCache } from "./DefaultHiPSCache";
import { HiPSCache } from "./HiPSCache.js";
import { HiPSList } from "./DefaultHiPSList.js";

import { ProjectionEnum } from "./ProjectionEnum.js";

Expand Down Expand Up @@ -159,36 +160,20 @@ import { Polyline } from "./shapes/Polyline";
name: 'DESI Legacy Surveys color (g, r, i, z)',
id: 'CDS/P/DESI-Legacy-Surveys/DR10/color',
},
// Fully described HiPS
{
name: "DECaPS DR2 color",
url: "https://alasky.cds.unistra.fr/DECaPS/DR2/CDS_P_DECaPS_DR2_color/",
properties: {
creatorDid: "ivo://CDS/P/DECaPS/DR2/color",
maxOrder: 11,
cooFrame: "equatorial",
tileSize: 512,
imgFormat: 'png',
},
},
// HiPS with options
// HiPS with options. Fields accepted are those described in {@link A.imageHiPSOptions}.
{
name: "SDSS9 band-g",
id: "P/SDSS9/g",
properties: {
creatorDid: "ivo://CDS/P/SDSS9/g",
maxOrder: 10,
tileSize: 512,
numBitsPerPixel: 16,
imgFormat: 'fits',
cooFrame: 'equatorial',
},
options: {
minCut: 0,
maxCut: 1.8,
stretch: 'linear',
colormap: "redtemperature",
}
creatorDid: "ivo://CDS/P/SDSS9/g",
maxOrder: 10,
tileSize: 512,
numBitsPerPixel: 16,
imgFormat: 'fits',
cooFrame: 'equatorial',
minCut: 0,
maxCut: 1.8,
stretch: 'linear',
colormap: "redtemperature",
}
]
})*/
Expand Down Expand Up @@ -275,7 +260,9 @@ export let Aladin = (function () {
*/
var Aladin = function (aladinDiv, requestedOptions) {
this.callbacksByEventName = {}; // we store the callback functions (on 'zoomChanged', 'positionChanged', ...) here
this.hipsCache = new HiPSCache();

console.log(this.hipsCache)
// check that aladinDiv exists, stop immediately otherwise
if (!aladinDiv) {
console.error(
Expand Down Expand Up @@ -468,15 +455,6 @@ export let Aladin = (function () {
}

cachedSurvey = { ...cachedSurvey, ...survey };

/*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: ",
Expand Down Expand Up @@ -506,7 +484,7 @@ export let Aladin = (function () {
...cachedSurvey,
});*/
let hips = new ImageHiPS(key, cachedSurvey.url, cachedSurvey)
HiPSCache.append(key, hips);
self.hipsCache.append(key, hips);
}
};

Expand Down Expand Up @@ -642,7 +620,7 @@ export let Aladin = (function () {
}

if (options.expandLayersControl) {
stack.toggle();
stack.click();
}

this._applyMediaQueriesUI();
Expand Down Expand Up @@ -704,7 +682,7 @@ export let Aladin = (function () {
Aladin.DEFAULT_OPTIONS = {
survey: ImageHiPS.DEFAULT_SURVEY_ID,
// surveys suggestion list
hipsList: HiPSCache.DEFAULT_HIPS_LIST,
hipsList: HiPSList.DEFAULT,
//surveyUrl: ["https://alaskybis.unistra.fr/DSS/DSSColor", "https://alasky.unistra.fr/DSS/DSSColor"],
target: "0 +0",
cooFrame: "J2000",
Expand Down Expand Up @@ -1559,12 +1537,15 @@ export let Aladin = (function () {
surveyOptions = {...surveyOptions, ...options};
}*/

let hips = HiPSCache.get(id);
/*let hips = this.hipsCache.get(id);
if (!hips) {
options = { name, maxOrder, url, cooFrame, ...options };
hips = new ImageHiPS(id, options.url, options)
HiPSCache.append(id, hips);
}
this.hipsCache.append(id, hips);
} */

let hips = new ImageHiPS(id, url, { name, maxOrder, url, cooFrame, ...options })


return hips;
};
Expand Down Expand Up @@ -1615,7 +1596,7 @@ export let Aladin = (function () {
survey = survey.id;
}

HiPSCache.delete(survey);
this.hipsCache.delete(survey);
}

/**
Expand Down Expand Up @@ -1666,12 +1647,13 @@ export let Aladin = (function () {
// Do not use proxy with CORS headers until we solve that: https://github.com/MattiasBuelens/wasm-streams/issues/20
//url = Utils.handleCORSNotSameOrigin(url).href;

let image = HiPSCache.get(url);
/*let image = this.hipsCache.get(url);
if (!image) {
options = { successCallback, errorCallback, ...options };
image = new Image(url, options);
HiPSCache.append(url, image);
}
this.hipsCache.append(url, image);
}*/
let image = new Image(url, {...options, successCallback, errorCallback});

return image;
};
Expand Down Expand Up @@ -1829,7 +1811,7 @@ export let Aladin = (function () {
* <li>1. An url that refers to a HiPS.</li>
* <li>2. Or it can be a CDS ID that refers to a HiPS. One can found the list of IDs {@link https://aladin.cds.unistra.fr/hips/list| here}</li>
* <li>3. A {@link ImageHiPS} HiPS object created from {@link A.imageHiPS}</li>
* <li>4. A {@link Image} FITS image object</li>
* <li>4. A {@link Image} FITS/jped/png image</li>
* </ul>
* @param {string} [layer="overlay"] - A layer name. By default 'overlay' is chosen and it is destined to be plot
* on top the 'base' layer. If the layer is already present in the view, it will be replaced by the new HiPS/FITS image given here.
Expand All @@ -1850,6 +1832,15 @@ export let Aladin = (function () {
imageLayer = urlOrHiPSOrFITS;
}


let hipsCache = this.hipsCache;
let cachedLayer = hipsCache.get(imageLayer.id)
if (cachedLayer && !cachedLayer.added) {
imageLayer = cachedLayer
} else {
this.hipsCache.append(imageLayer.id, imageLayer);
}

return this.view.setOverlayImageLayer(imageLayer, layer);
};

Expand Down
Loading

0 comments on commit 0cf53a6

Please sign in to comment.