Compare commits

...

8 Commits

Author SHA1 Message Date
Matthieu Baumann
cdc1733c4f Add label to checkbox UI filter enabler 2025-09-12 11:05:32 +02:00
Matthieu Baumann
6e40dbbfc1 update testing snapshots 2025-09-11 17:52:27 +02:00
Matthieu Baumann
e03b16119b several fixes: panic when delaying resources treatments + ICRS sexa 2025-09-11 17:49:05 +02:00
Matthieu Baumann
e3162426be fix: restore polyselect 2025-09-11 15:35:39 +02:00
Matthieu Baumann
5a285dabed cargo clippy 2025-09-11 15:00:53 +02:00
Matthieu Baumann
2d04730623 fix: read pixel for jpg (works like rgba) and fits (1px offset fix + switch bytes order) 2025-09-11 14:31:45 +02:00
bmatthieu3
390c9096d7 NED tap access 2025-09-10 11:52:15 +02:00
Thomas Boch
0e9998a7fc Merge pull request #327 from cds-astro/customize-share-url-function
Customize share URL function
2025-09-10 11:22:42 +02:00
22 changed files with 87 additions and 63 deletions

View File

@@ -16,7 +16,7 @@
showSimbadPointerControl: true,
projection: 'AIT', // set a projection
fov: 8.0, // initial field of view in degrees
target: '00 42 21.37 +41 07 29.8', // initial target
target: '10.6875598 +41.1402170', // initial target
cooFrame: 'icrs', // set galactic frame
reticleColor: '#ff89ff', // change reticle color
showContextMenu: true,

View File

@@ -17,6 +17,8 @@
});
aladin.addCatalog(A.catalogFromVizieR("B/assocdata/obscore", "0 +0", 20, {onClick: 'showTable', hoverColor: 'yellow', limit: 1000}))
aladin.addCatalog(A.catalogFromSKAORucio("0 +0", 70, {onClick: 'showTable', hoverColor: 'yellow', limit: 1000}))
});
</script>
</body>

View File

@@ -77,7 +77,7 @@
let bValues = [];
let i = 0;
for(var [r, g, b] of base.probe({type: 'line', x1: p.a.x, y1: p.a.y, x2: p.b.x, y2: p.b.y})) {
for(var [r, g, b] of base.probePixels({type: 'line', x1: p.a.x, y1: p.a.y, x2: p.b.x, y2: p.b.y})) {
xValues.push(i)
rValues.push(r)
gValues.push(g)

View File

@@ -91,7 +91,7 @@ impl Texture2DArray {
// Attach the texture as the first color attachment
self.gl.framebuffer_texture_layer(
WebGlRenderingCtx::READ_FRAMEBUFFER,
WebGlRenderingCtx::FRAMEBUFFER,
WebGlRenderingCtx::COLOR_ATTACHMENT0,
self.texture.as_ref(),
0,

View File

@@ -203,5 +203,3 @@ impl PixelType {
}
}
}
pub const NUM_CHANNELS: usize = 6;

View File

@@ -311,7 +311,7 @@ impl Texture2D {
// Attach the texture as the first color attachment
//self.attach_to_framebuffer();
self.gl.framebuffer_texture_2d(
WebGlRenderingCtx::READ_FRAMEBUFFER,
WebGlRenderingCtx::FRAMEBUFFER,
WebGlRenderingCtx::COLOR_ATTACHMENT0,
WebGlRenderingCtx::TEXTURE_2D,
self.texture.as_ref(),

View File

@@ -21,32 +21,6 @@ pub trait Pixel:
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue>;
}
impl Pixel for [f32; 1] {
type Item = f32;
type Container = ArrayF32;
const BLACK: Self = [f32::NAN];
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
let p = js_sys::Uint8Array::new_with_length(4);
gl.read_pixels_with_opt_array_buffer_view(
x,
y,
1,
1,
WebGlRenderingCtx::RGBA,
WebGlRenderingCtx::UNSIGNED_BYTE,
Some(&p),
)?;
Ok([f32::from_le_bytes([
p.at(0).unwrap(),
p.at(1).unwrap(),
p.at(2).unwrap(),
p.at(3).unwrap(),
])])
}
}
impl Pixel for [u8; 4] {
type Item = u8;
type Container = ArrayU8;
@@ -74,13 +48,13 @@ impl Pixel for [u8; 3] {
const BLACK: Self = [0, 0, 0];
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
let pixels = js_sys::Uint8Array::new_with_length(3);
let pixels = js_sys::Uint8Array::new_with_length(4);
gl.read_pixels_with_opt_array_buffer_view(
x,
y,
1,
1,
WebGlRenderingCtx::RGB,
WebGlRenderingCtx::RGBA,
WebGlRenderingCtx::UNSIGNED_BYTE,
Some(&pixels),
)?;
@@ -147,7 +121,7 @@ impl Pixel for [i16; 1] {
Some(&p),
)?;
Ok([i16::from_le_bytes([p.at(0).unwrap(), p.at(1).unwrap()])])
Ok([i16::from_le_bytes([p.at(1).unwrap(), p.at(0).unwrap()])])
}
}
@@ -169,10 +143,36 @@ impl Pixel for [i32; 1] {
)?;
Ok([i32::from_le_bytes([
p.at(0).unwrap(),
p.at(1).unwrap(),
p.at(2).unwrap(),
p.at(3).unwrap(),
p.at(2).unwrap(),
p.at(1).unwrap(),
p.at(0).unwrap(),
])])
}
}
impl Pixel for [f32; 1] {
type Item = f32;
type Container = ArrayF32;
const BLACK: Self = [f32::NAN];
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
let p = js_sys::Uint8Array::new_with_length(4);
gl.read_pixels_with_opt_array_buffer_view(
x,
y,
1,
1,
WebGlRenderingCtx::RGBA,
WebGlRenderingCtx::UNSIGNED_BYTE,
Some(&p),
)?;
Ok([f32::from_le_bytes([
p.at(3).unwrap(),
p.at(2).unwrap(),
p.at(1).unwrap(),
p.at(0).unwrap(),
])])
}
}

View File

@@ -49,12 +49,32 @@ impl WebGlContext {
#[cfg(feature = "webgl2")]
{
/*if let Ok(r) =
get_extension::<web_sys::ExtColorBufferFloat>(&gl, "EXT_color_buffer_float")
{
let _ = r;
}*/
let ctx = WebGlContext { inner: gl };
Ok(ctx)
}
}
}
fn _get_extension<T>(context: &WebGlRenderingCtx, name: &str) -> Result<T, JsValue>
where
T: wasm_bindgen::JsCast,
{
// `unchecked_into` is used here because WebGL extensions aren't actually JS classes
// these objects are duck-type representations of the actual Rust classes
// https://github.com/rustwasm/wasm-bindgen/pull/1449
context
.get_extension(name)
.ok()
.and_then(|maybe_ext| maybe_ext.map(|ext| ext.unchecked_into::<T>()))
.ok_or_else(|| JsValue::from_str("Failed to load ext"))
}
use std::ops::Deref;
impl Deref for WebGlContext {
type Target = WebGlRenderingCtx;

View File

@@ -96,11 +96,7 @@ impl Downloader {
}
pub fn delay(&mut self, r: RequestType) {
match r {
RequestType::Tile(tile) => {
self.cache.insert(tile.id.clone(), RequestType::Tile(tile));
}
_ => unimplemented!(),
}
let id = r.id().to_owned();
self.cache.insert(id, r);
}
}

View File

@@ -83,28 +83,30 @@ fn create_hpx_texture_storage(
),
];
match channel {
PixelType::RGBA8U => Texture2DArray::create_empty::<RGBA8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::RGB8U => Texture2DArray::create_empty::<RGB8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::RGBA8U => {
Texture2DArray::create_empty::<RGBA8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
)
}
PixelType::RGB8U => {
Texture2DArray::create_empty::<RGB8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
)
}
PixelType::R32F => Texture2DArray::create_empty::<R32F>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::R8U => Texture2DArray::create_empty::<R8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::R16I => Texture2DArray::create_empty::<R16I>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
@@ -285,7 +287,7 @@ impl HiPS2DBuffer {
.tile_pixels
.read_pixel(pos_tex.x, pos_tex.y, pos_tex.z)?,
_ => {
let uvy = 1.0 - (pos_tex.y as f32 / tile_size);
let uvy = 1.0 - (dx as f32);
pos_tex.y = (uvy * tile_size) as i32;
let f64_v = self

View File

@@ -50,6 +50,7 @@ export class PolySelect extends FSM {
view.aladin.removeStatusBarMessage('selector')
}
let btn;
let mouseout = (params) => {
let {e, coo} = params;
@@ -215,7 +216,7 @@ export class PolySelect extends FSM {
};
let fsm;
if (Utils.hasTouchScreen()) {
//if (Utils.hasTouchScreen()) {
let mousedown = click;
let mouseup = click;
@@ -259,7 +260,7 @@ export class PolySelect extends FSM {
}
}
}
} else {
/*} else {
// desktop, laptops...
fsm = {
state: 'off',
@@ -296,7 +297,7 @@ export class PolySelect extends FSM {
}
}
}
}
}*/
super(fsm)
let self = this;

View File

@@ -54,7 +54,8 @@ export let URLBuilder = (function() {
},
buildNEDPositionCSURL: function(ra, dec, radiusDegrees) {
return 'https://ned.ipac.caltech.edu/cgi-bin/nph-objsearch?search_type=Near+Position+Search&of=xml_main&RA=' + ra + '&DEC=' + dec + '&SR=' + radiusDegrees;
//OLD return 'https://ned.ipac.caltech.edu/cgi-bin/nph-objsearch?search_type=Near+Position+Search&of=xml_main&RA=' + ra + '&DEC=' + dec + '&SR=' + radiusDegrees;
return 'https://ned.ipac.caltech.edu/tap/sync?query=SELECT+*+FROM+objdir+WHERE+CONTAINS(POINT(\'J2000\',ra,dec),CIRCLE(\'J2000\',' + ra + ',' + dec + ',' + radiusDegrees + '))=1&LANG=ADQL&REQUEST=doQuery&FORMAT=votable'
},
buildNEDObjectCSURL: function(object, radiusDegrees) {

View File

@@ -1300,7 +1300,7 @@ export let View = (function () {
if (!view.throttledTouchPadZoom) {
view.throttledTouchPadZoom = () => {
const factor = Utils.detectTrackPad(e) ? 1.05 : 1.2;
const factor = Utils.detectTrackPad(e) ? 1.06 : 1.2;
const currZoomFactor = view.zoom.isZooming ? view.zoom.finalZoom : view.zoomFactor;
let newZoomFactor = view.delta > 0 ? currZoomFactor * factor : currZoomFactor / factor;

View File

@@ -131,6 +131,7 @@ export class HiPSBrowserBox extends Box {
let filterEnabler = Input.checkbox({
name: "filter-enabler",
tooltip: { content: "enable/disable" },
checked: false,
click(e) {
let on = e.target.checked;

View File

@@ -331,7 +331,7 @@ import { TogglerActionButton } from "../Button/Toggler.js";
update(options) {
if (options.layer) {
let self = this;
if (options.layer.isSpectralCube()) {
if (options.layer.isSpectralCube && options.layer.isSpectralCube()) {
let spectraDisplayer = self.aladin.view.spectraDisplayer;
self.spectraBtn = new TogglerActionButton({

View File

@@ -225,6 +225,9 @@ export class Location extends DOMElement {
// lon and lat must be given in cooFrame
const updateFromLonLatFunc = (lon, lat, cooFrame) => {
var coo = new Coo(lon, lat, Location.prec);
cooFrame = CooFrameEnum.fromString(cooFrame);
if (cooFrame == CooFrameEnum.ICRS) {
self.field.set(coo.format('s/'));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 133 KiB