diff --git a/examples/al-displayFITS.html b/examples/al-displayFITS.html index e58bf208..17c17917 100644 --- a/examples/al-displayFITS.html +++ b/examples/al-displayFITS.html @@ -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); }, diff --git a/examples/al-hips-local.html b/examples/al-hips-local.html index b39542c2..c7e40d18 100644 --- a/examples/al-hips-local.html +++ b/examples/al-hips-local.html @@ -5,14 +5,16 @@
+ diff --git a/examples/hips/CDS_P_DSS2_color/Moc.fits b/examples/hips/CDS_P_DSS2_color/Moc.fits new file mode 100644 index 00000000..b83719b9 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Moc.fits differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder0/Dir0/Npix5.jpg b/examples/hips/CDS_P_DSS2_color/Norder0/Dir0/Npix5.jpg new file mode 100644 index 00000000..e2058e16 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder0/Dir0/Npix5.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder1/Dir0/Npix22.jpg b/examples/hips/CDS_P_DSS2_color/Norder1/Dir0/Npix22.jpg new file mode 100644 index 00000000..c9177d87 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder1/Dir0/Npix22.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder2/Dir0/Npix89.jpg b/examples/hips/CDS_P_DSS2_color/Norder2/Dir0/Npix89.jpg new file mode 100644 index 00000000..e3f02ec3 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder2/Dir0/Npix89.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder3/Allsky.jpg b/examples/hips/CDS_P_DSS2_color/Norder3/Allsky.jpg new file mode 100644 index 00000000..f838564e Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder3/Allsky.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder3/Dir0/Npix357.jpg b/examples/hips/CDS_P_DSS2_color/Norder3/Dir0/Npix357.jpg new file mode 100644 index 00000000..16c52579 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder3/Dir0/Npix357.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1428.jpg b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1428.jpg new file mode 100644 index 00000000..70e25bc8 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1428.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1429.jpg b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1429.jpg new file mode 100644 index 00000000..d9e83f92 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1429.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1430.jpg b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1430.jpg new file mode 100644 index 00000000..2e7105a1 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1430.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1431.jpg b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1431.jpg new file mode 100644 index 00000000..b3a97c84 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder4/Dir0/Npix1431.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5712.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5712.jpg new file mode 100644 index 00000000..0dd7f0fb Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5712.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5713.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5713.jpg new file mode 100644 index 00000000..c2428891 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5713.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5714.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5714.jpg new file mode 100644 index 00000000..8c7e683c Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5714.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5715.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5715.jpg new file mode 100644 index 00000000..9fdd337e Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5715.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5716.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5716.jpg new file mode 100644 index 00000000..6bd2e150 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5716.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5717.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5717.jpg new file mode 100644 index 00000000..528cde61 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5717.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5718.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5718.jpg new file mode 100644 index 00000000..436616c1 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5718.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5719.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5719.jpg new file mode 100644 index 00000000..0a9646d2 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5719.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5720.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5720.jpg new file mode 100644 index 00000000..af823aec Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5720.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5721.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5721.jpg new file mode 100644 index 00000000..e059227f Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5721.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5722.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5722.jpg new file mode 100644 index 00000000..11cb080b Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5722.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5723.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5723.jpg new file mode 100644 index 00000000..650a25a7 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5723.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5724.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5724.jpg new file mode 100644 index 00000000..9a714344 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5724.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5725.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5725.jpg new file mode 100644 index 00000000..851fd3ea Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5725.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5726.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5726.jpg new file mode 100644 index 00000000..47390d34 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5726.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5727.jpg b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5727.jpg new file mode 100644 index 00000000..e9aa1797 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/Norder5/Dir0/Npix5727.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/index.html b/examples/hips/CDS_P_DSS2_color/index.html new file mode 100644 index 00000000..722f772a --- /dev/null +++ b/examples/hips/CDS_P_DSS2_color/index.html @@ -0,0 +1,1399 @@ + + + + + + + + + + + + + + + + + diff --git a/examples/hips/CDS_P_DSS2_color/preview.jpg b/examples/hips/CDS_P_DSS2_color/preview.jpg new file mode 100644 index 00000000..63c95570 Binary files /dev/null and b/examples/hips/CDS_P_DSS2_color/preview.jpg differ diff --git a/examples/hips/CDS_P_DSS2_color/properties b/examples/hips/CDS_P_DSS2_color/properties new file mode 100644 index 00000000..fe6d927a --- /dev/null +++ b/examples/hips/CDS_P_DSS2_color/properties @@ -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 diff --git a/examples/images/panstarrs-g-m61.fits b/examples/images/panstarrs-g-m61.fits new file mode 100644 index 00000000..55eb23e2 Binary files /dev/null and b/examples/images/panstarrs-g-m61.fits differ diff --git a/src/core/src/app.rs b/src/core/src/app.rs index 2ca684b7..a03ddd94 100644 --- a/src/core/src/app.rs +++ b/src/core/src/app.rs @@ -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, @@ -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, @@ -196,7 +196,7 @@ impl App { let (img_send, img_recv) = async_channel::unbounded::(); let (ack_img_send, ack_img_recv) = async_channel::unbounded::(); - let line_renderer = RasterizedLineRenderer::new(&gl)?; + //let line_renderer = RasterizedLineRenderer::new(&gl)?; let dist_dragging = 0.0; let time_start_dragging = Time::now(); @@ -231,7 +231,7 @@ impl App { _fbo_ui, _final_rendering_pass, - line_renderer, + //line_renderer, // inertia inertia, diff --git a/src/core/src/renderable/grid/mod.rs b/src/core/src/renderable/grid/mod.rs index e1dbc74f..8b603bc8 100644 --- a/src/core/src/renderable/grid/mod.rs +++ b/src/core/src/renderable/grid/mod.rs @@ -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) diff --git a/src/css/aladin.css b/src/css/aladin.css index 8e790c4e..b97295fe 100644 --- a/src/css/aladin.css +++ b/src/css/aladin.css @@ -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; @@ -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 { diff --git a/src/js/A.js b/src/js/A.js index e48dd2a8..2b81fdcf 100644 --- a/src/js/A.js +++ b/src/js/A.js @@ -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); diff --git a/src/js/Aladin.js b/src/js/Aladin.js index 1ff66d96..74616b05 100644 --- a/src/js/Aladin.js +++ b/src/js/Aladin.js @@ -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"; @@ -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", } ] })*/ @@ -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( @@ -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: ", @@ -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); } }; @@ -642,7 +620,7 @@ export let Aladin = (function () { } if (options.expandLayersControl) { - stack.toggle(); + stack.click(); } this._applyMediaQueriesUI(); @@ -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", @@ -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; }; @@ -1615,7 +1596,7 @@ export let Aladin = (function () { survey = survey.id; } - HiPSCache.delete(survey); + this.hipsCache.delete(survey); } /** @@ -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; }; @@ -1829,7 +1811,7 @@ export let Aladin = (function () { *
  • 1. An url that refers to a HiPS.
  • *
  • 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}
  • *
  • 3. A {@link ImageHiPS} HiPS object created from {@link A.imageHiPS}
  • - *
  • 4. A {@link Image} FITS image object
  • + *
  • 4. A {@link Image} FITS/jped/png image
  • * * @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. @@ -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); }; diff --git a/src/js/DefaultHiPSCache.js b/src/js/DefaultHiPSList.js similarity index 67% rename from src/js/DefaultHiPSCache.js rename to src/js/DefaultHiPSList.js index 450018fd..85f0d2ed 100644 --- a/src/js/DefaultHiPSCache.js +++ b/src/js/DefaultHiPSList.js @@ -1,72 +1,7 @@ -// Copyright 2013 - UDS/CNRS -// The Aladin Lite program is distributed under the terms -// of the GNU General Public License version 3. -// -// This file is part of Aladin Lite. -// -// Aladin Lite is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3 of the License. -// -// Aladin Lite is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// The GNU General Public License is available in COPYING file -// along with Aladin Lite. -// +export let HiPSList = (function () { + function HiPSList() {} -/****************************************************************************** - * Aladin Lite project - * - * File ImageHiPS - * - * Authors: Thomas Boch & Matthieu Baumann [CDS] - * - *****************************************************************************/ -import { ALEvent } from "./events/ALEvent.js"; - -export let HiPSCache = (function () { - function HiPSCache() {} - - /* - * key can be a CDS ID or an url. TODO could be an options.name too. - */ - HiPSCache.append = function (key, image) { - HiPSCache.cache[key] = image; - - console.log(HiPSCache.cache) - ALEvent.HIPS_CACHE_UPDATED.dispatchedTo(document.body); - }; - - /* - * key can be a CDS ID or an url. TODO could be an options.name too. - */ - HiPSCache.delete = function (key) { - delete HiPSCache.cache[key]; - - ALEvent.HIPS_CACHE_UPDATED.dispatchedTo(document.body); - }; - - /* - * key can be a CDS ID or an url. TODO could be an options.name too. - */ - HiPSCache.get = function (key) { - return HiPSCache.cache[key]; - }; - - /* - * key can be a CDS ID or an url. TODO could be an options.name too. - */ - HiPSCache.contains = function (key) { - return HiPSCache.cache[key] !== undefined && HiPSCache.cache[key] !== null; - }; - - // A cache storing directly surveys important information to not query for the properties each time - HiPSCache.cache = {}; - - HiPSCache.DEFAULT_HIPS_LIST = [ + HiPSList.DEFAULT = [ { creatorDid: "ivo://CDS/P/DSS2/color", name: "DSS colored", @@ -254,16 +189,16 @@ export let HiPSCache = (function () { maxOrder: 8, }, /*{ - 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", - maxOrder: 9, - imgFormat: "jpeg", - minOrder: 3, - }*/ + 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", + maxOrder: 9, + imgFormat: "jpeg", + minOrder: 3, + }*/ ]; - return HiPSCache; -})(); + return HiPSList; +})(); \ No newline at end of file diff --git a/src/js/HiPSCache.js b/src/js/HiPSCache.js new file mode 100644 index 00000000..08c6f90c --- /dev/null +++ b/src/js/HiPSCache.js @@ -0,0 +1,69 @@ +// Copyright 2013 - UDS/CNRS +// The Aladin Lite program is distributed under the terms +// of the GNU General Public License version 3. +// +// This file is part of Aladin Lite. +// +// Aladin Lite is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3 of the License. +// +// Aladin Lite is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// The GNU General Public License is available in COPYING file +// along with Aladin Lite. +// + +/****************************************************************************** + * Aladin Lite project + * + * File ImageHiPS + * + * Authors: Thomas Boch & Matthieu Baumann [CDS] + * + *****************************************************************************/ +import { ALEvent } from "./events/ALEvent.js"; + +export let HiPSCache = (function () { + + let HiPSCache = function() { + this.cache = {} + }; + + /* + * key can be a CDS ID or an url. TODO could be an options.name too. + */ + HiPSCache.prototype.append = function (key, image) { + this.cache[key] = image; + + ALEvent.HIPS_CACHE_UPDATED.dispatchedTo(document.body); + }; + + /* + * key can be a CDS ID or an url. TODO could be an options.name too. + */ + HiPSCache.prototype.delete = function (key) { + delete this.cache[key]; + + ALEvent.HIPS_CACHE_UPDATED.dispatchedTo(document.body); + }; + + /* + * key can be a CDS ID or an url. TODO could be an options.name too. + */ + HiPSCache.prototype.get = function (key) { + return this.cache[key]; + }; + + /* + * key can be a CDS ID or an url. TODO could be an options.name too. + */ + HiPSCache.prototype.contains = function (key) { + return this.cache[key] !== undefined && this.cache[key] !== null; + }; + + return HiPSCache; +})(); diff --git a/src/js/HiPSProperties.js b/src/js/HiPSProperties.js index 3c3c646d..e6121f6f 100644 --- a/src/js/HiPSProperties.js +++ b/src/js/HiPSProperties.js @@ -76,6 +76,7 @@ HiPSProperties.fetchFromUrl = async function(urlOrId) { // Relative path test try { urlOrId = Utils.getAbsoluteURL(urlOrId) + console.log(urlOrId) urlOrId = new URL(urlOrId); } catch(e) { diff --git a/src/js/Image.js b/src/js/Image.js index a261ff85..0e707bc7 100644 --- a/src/js/Image.js +++ b/src/js/Image.js @@ -27,7 +27,6 @@ *****************************************************************************/ import { ALEvent } from "./events/ALEvent.js"; import { ColorCfg } from "./ColorCfg.js"; -import { HiPSCache } from "./DefaultHiPSCache"; import { Aladin } from "./Aladin.js"; /** @@ -124,15 +123,14 @@ export let Image = (function () { this.query = Promise.resolve(self); } + /* Precondition: view is already attached */ Image.prototype._saveInCache = function () { - if (HiPSCache.contains(self.id)) { - HiPSCache.append(this.id, this); + let hipsCache = this.view.aladin.hipsCache; + if (hipsCache.contains(self.id)) { + hipsCache.append(this.id, this); } }; - // A cache storing directly the images to not query for the properties each time - //Image.cache = {}; - Image.prototype.setView = function (view) { this.view = view; diff --git a/src/js/ImageHiPS.js b/src/js/ImageHiPS.js index 072e7c0b..791ba977 100644 --- a/src/js/ImageHiPS.js +++ b/src/js/ImageHiPS.js @@ -29,7 +29,6 @@ import { Utils } from "./Utils"; import { ALEvent } from "./events/ALEvent.js"; import { ColorCfg } from "./ColorCfg.js"; import { HiPSProperties } from "./HiPSProperties.js"; -import { HiPSCache } from "./DefaultHiPSCache.js"; let PropertyParser = {}; // Utilitary functions for parsing the properties and giving default values @@ -201,11 +200,10 @@ export let ImageHiPS = (function () { // do not allow to call setView multiple times otherwise // the querying to the properties and the search to the best // HiPS node will be done again for the same imageHiPS - if (self.view) { + if (this.view) { return; } - - self.view = view; + this.view = view; let isMOCServerToBeQueried = true; if (this.imgFormat === "fits") { @@ -458,9 +456,10 @@ export let ImageHiPS = (function () { })() }; + /* Precondition: view is attached */ ImageHiPS.prototype._saveInCache = function () { let self = this; - let colorOpt = Object.fromEntries(Object.entries(this.colorCfg)); + /*let colorOpt = Object.fromEntries(Object.entries(this.colorCfg)); let surveyOpt = { id: self.id, creatorDid: self.creatorDid, @@ -481,9 +480,12 @@ export let ImageHiPS = (function () { if (self.numBitsPerPixel) { surveyOpt.numBitsPerPixel = self.numBitsPerPixel; - } + }*/ + + let hipsCache = this.view.aladin.hipsCache; + - if (HiPSCache.contains(self.id)) { + if (hipsCache.contains(self.id)) { /*HiPSCache.append(self.id, { // Erase by the cache already put values which is considered // as the ground truth @@ -491,7 +493,7 @@ export let ImageHiPS = (function () { // append new important infos from the properties queried ...surveyOpt, });*/ - HiPSCache.append(self.id, this) + hipsCache.append(self.id, this) } }; diff --git a/src/js/MeasurementTable.js b/src/js/MeasurementTable.js index 67d342c7..00751a7c 100644 --- a/src/js/MeasurementTable.js +++ b/src/js/MeasurementTable.js @@ -74,6 +74,11 @@ export let MeasurementTable = (function() { this.hide(); this.table = new Tabs({ + tooltip: { + global: true, + aladin: this.aladin, + content: 'Press Shift + mouse wheel for scrolling horizontally' + }, aladin: this.aladin, layout, }, this.aladin.aladinDiv); diff --git a/src/js/View.js b/src/js/View.js index e126d293..5753fea6 100644 --- a/src/js/View.js +++ b/src/js/View.js @@ -47,7 +47,7 @@ import { ObsCore } from "./vo/ObsCore.js"; import { DefaultActionsForContextMenu } from "./DefaultActionsForContextMenu.js"; import { Layout } from "./gui/Layout.js"; import { SAMPActionButton } from "./gui/Button/SAMP.js"; -import { HiPSCache } from "./DefaultHiPSCache.js"; +import { HiPSCache } from "./HiPSCache.js"; import { ImageHiPS } from "./ImageHiPS.js"; import { Image } from "./Image.js"; @@ -104,7 +104,7 @@ export let View = (function () { aladin.setFoV(fov * 1.1); } ); - self.setOverlayImageLayer(image, file.name) + self.aladin.setOverlayImageLayer(image, file.name) } catch(e) { let moc = A.MOCFromURL(url); self.aladin.addMOC(moc); @@ -1735,7 +1735,7 @@ export let View = (function () { }) .catch((e) => { // remove it from the cache - HiPSCache.delete(imageLayer.id) + this.aladin.hipsCache.delete(imageLayer.id) if (imageLayer.errorCallback) { imageLayer.errorCallback(e); @@ -1866,8 +1866,8 @@ export let View = (function () { } // maybe it has not been added yet - let found = this.imageLayersBeingQueried - .values() + let found = Array.from(this.imageLayersBeingQueried + .values()) .some((s) => { return s === survey; }); @@ -2157,23 +2157,33 @@ export let View = (function () { } let closests = []; - let closest = null; - footprints.forEach((footprint) => { - if (!footprint.source || !footprint.source.tooSmallFootprint) { - // Hidden footprints are not considered - let lineWidth = footprint.getLineWidth(); - - footprint.setLineWidth(10.0); - if (footprint.isShowing && footprint.isInStroke(ctx, this, x * window.devicePixelRatio, y * window.devicePixelRatio)) { - closest = footprint; - if (closest) { - closests.push(closest); + const startLw = (footprints && footprints[0] && footprints[0].getLineWidth()) || 1; + let endLw = 10; + let finish = false; + for (var lw = startLw; lw <= endLw; lw++) { + footprints.forEach((footprint) => { + if (!footprint.source || !footprint.source.tooSmallFootprint) { + // Hidden footprints are not considered + //let originLineWidth = footprint.getLineWidth(); + + footprint.setLineWidth(lw); + if (footprint.isShowing && footprint.isInStroke(ctx, this, x * window.devicePixelRatio, y * window.devicePixelRatio)) { + closests.push(footprint); } + footprint.setLineWidth(startLw); } - footprint.setLineWidth(lineWidth); + }) + + if (closests.length > 0 && !finish) { + endLw = lw + 3; + finish = true; } - }) + if (finish && lw === endLw) { + break; + } + } + return closests; }; @@ -2212,7 +2222,8 @@ export let View = (function () { //ctx.lineWidth = pastLineWidth; - //var closest, dist; + var dist = Number.POSITIVE_INFINITY; + var closest = null; //for (var r = 0; r <= maxRadius; r++) { //closest = dist = null; for (var dx = -maxRadius; dx <= maxRadius; dx++) { @@ -2221,16 +2232,21 @@ export let View = (function () { } for (var dy = -maxRadius; dy <= maxRadius; dy++) { if (this.objLookup[x + dx][y + dy]) { - //var d = dx * dx + dy * dy; - /*if (!closest || d < dist) { - closest = this.objLookup[x + dx][y + dy]; - //dist = d; - }*/ - closests = closests.concat(this.objLookup[x + dx][y + dy]) + var d = dx * dx + dy * dy; + if (d < dist) { + dist = d; + closest = this.objLookup[x + dx][y + dy] + } else if (d == dist) { + closest.concat(this.objLookup[x + dx][y + dy]) + } } } } + if (closest && closest.length > 0) { + closests = closests.concat(closest) + } + /*if (closest) { closests = closests.concat(closest); }*/ diff --git a/src/js/gui/Box/StackBox.js b/src/js/gui/Box/StackBox.js index facc6f9f..f50feeb0 100644 --- a/src/js/gui/Box/StackBox.js +++ b/src/js/gui/Box/StackBox.js @@ -51,7 +51,6 @@ import { Box } from "../Widgets/Box.js"; import { CtxMenuActionButtonOpener } from "../Button/CtxMenuOpener.js"; import { Input } from "../Widgets/Input.js"; import { Image } from "../../Image.js"; -import { HiPSCache } from "../../DefaultHiPSCache.js"; import { HiPSBrowserBox } from "./HiPSBrowserBox.js"; export class OverlayStackBox extends Box { @@ -689,13 +688,14 @@ export class OverlayStackBox extends Box { ); updateOverlayList(); + let hipsCache = this.aladin.hipsCache; // Add a listener for HiPS list changes ALEvent.HIPS_CACHE_UPDATED.listenedBy(document.body, () => { self.cachedHiPS = {}; - for (var key in HiPSCache.cache) { - let HiPS = HiPSCache.cache[key]; + for (var key in hipsCache.cache) { + let HiPS = hipsCache.cache[key]; if (HiPS.name) { self.cachedHiPS[HiPS.name.toString()] = HiPS; diff --git a/src/js/shapes/Polyline.js b/src/js/shapes/Polyline.js index f2fd9598..c7731371 100644 --- a/src/js/shapes/Polyline.js +++ b/src/js/shapes/Polyline.js @@ -349,7 +349,7 @@ export let Polyline = (function() { if (Polyline.isInsideView(l.x1, l.y1, l.x2, l.y2, view.width, view.height)) { const mag2 = _calculateMag2ForNoSinProjections(l, view); - if (mag2 < 0.1) { + if (mag2 < 0.2) { _drawLine(l, ctx); } } @@ -360,7 +360,7 @@ export let Polyline = (function() { const mag2 = _calculateMag2ForNoSinProjections(l, view); - if (mag2 < 0.1) { + if (mag2 < 0.2) { if (index === 0) { ctx.beginPath(); ctx.moveTo(l.x1, l.y1);