diff --git a/examples/al-moc-sky-fraction.html b/examples/al-moc-sky-fraction.html
index 0b4ae048..8e95607b 100644
--- a/examples/al-moc-sky-fraction.html
+++ b/examples/al-moc-sky-fraction.html
@@ -1,8 +1,6 @@
-
-
diff --git a/examples/al-moment.html b/examples/al-moment.html
index 21c544f5..caecd79e 100644
--- a/examples/al-moment.html
+++ b/examples/al-moment.html
@@ -1,9 +1,6 @@
-
-
diff --git a/examples/al-multiple-instances.html b/examples/al-multiple-instances.html
index 89859f63..115ab86b 100644
--- a/examples/al-multiple-instances.html
+++ b/examples/al-multiple-instances.html
@@ -1,8 +1,6 @@
-
-
diff --git a/examples/al-multiple-surveys.html b/examples/al-multiple-surveys.html
index e7f79e34..b0717096 100644
--- a/examples/al-multiple-surveys.html
+++ b/examples/al-multiple-surveys.html
@@ -1,7 +1,6 @@
-
diff --git a/examples/al-onames-labels.html b/examples/al-onames-labels.html
index 319fc23d..d0d109b9 100644
--- a/examples/al-onames-labels.html
+++ b/examples/al-onames-labels.html
@@ -1,11 +1,6 @@
-
-
-
-
-
diff --git a/examples/al-overlay-image-layer.html b/examples/al-overlay-image-layer.html
index 23302719..1656e546 100644
--- a/examples/al-overlay-image-layer.html
+++ b/examples/al-overlay-image-layer.html
@@ -1,11 +1,6 @@
-
-
-
-
-
diff --git a/examples/al-perseverence.html b/examples/al-perseverence.html
index 445c298a..449ce06c 100644
--- a/examples/al-perseverence.html
+++ b/examples/al-perseverence.html
@@ -1,8 +1,6 @@
-
-
diff --git a/examples/al-polyline.html b/examples/al-polyline.html
index b57d77bc..c93c1b0e 100644
--- a/examples/al-polyline.html
+++ b/examples/al-polyline.html
@@ -2,12 +2,6 @@
-
-
-
-
-
-
diff --git a/examples/al-remove-source.html b/examples/al-remove-source.html
index 34c87690..cf2d1222 100644
--- a/examples/al-remove-source.html
+++ b/examples/al-remove-source.html
@@ -1,11 +1,6 @@
-
-
-
-
-
diff --git a/examples/al-response-div.html b/examples/al-response-div.html
index 88041865..bcdf3a4a 100644
--- a/examples/al-response-div.html
+++ b/examples/al-response-div.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/examples/al-reverse-longitude.html b/examples/al-reverse-longitude.html
index 2af7c3c5..82bf0cb7 100644
--- a/examples/al-reverse-longitude.html
+++ b/examples/al-reverse-longitude.html
@@ -1,11 +1,6 @@
-
-
-
-
-
diff --git a/examples/al-rightclick-fits.html b/examples/al-rightclick-fits.html
index f3f39466..729735af 100644
--- a/examples/al-rightclick-fits.html
+++ b/examples/al-rightclick-fits.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/examples/al-sdc2.html b/examples/al-sdc2.html
index 48775198..692fc0c5 100644
--- a/examples/al-sdc2.html
+++ b/examples/al-sdc2.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/examples/al-set-colormap.html b/examples/al-set-colormap.html
index d9913746..fa3c4694 100644
--- a/examples/al-set-colormap.html
+++ b/examples/al-set-colormap.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/examples/al-simbad-density.html b/examples/al-simbad-density.html
index 3d175309..5a96bfbc 100644
--- a/examples/al-simbad-density.html
+++ b/examples/al-simbad-density.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/examples/al-simbad-pointer.html b/examples/al-simbad-pointer.html
index 40e7934d..af57de44 100644
--- a/examples/al-simbad-pointer.html
+++ b/examples/al-simbad-pointer.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/examples/al-stcs-footprints.html b/examples/al-stcs-footprints.html
index b8c7ee3e..b5a19e8b 100644
--- a/examples/al-stcs-footprints.html
+++ b/examples/al-stcs-footprints.html
@@ -2,12 +2,6 @@
-
-
-
-
-
-
diff --git a/examples/al-stephan-quintet.html b/examples/al-stephan-quintet.html
index af3811f6..4b16927a 100644
--- a/examples/al-stephan-quintet.html
+++ b/examples/al-stephan-quintet.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/examples/al-zoom-meerkat.html b/examples/al-zoom-meerkat.html
index c106e92d..eed7b653 100644
--- a/examples/al-zoom-meerkat.html
+++ b/examples/al-zoom-meerkat.html
@@ -1,9 +1,6 @@
-
-
-
diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml
index 3a7cb286..db1b0d74 100644
--- a/src/core/Cargo.toml
+++ b/src/core/Cargo.toml
@@ -30,7 +30,7 @@ serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"
serde-wasm-bindgen = "0.4"
console_error_panic_hook = "0.1.7"
-fitsrs = "0.2.4"
+fitsrs = "0.2.6"
enum_dispatch = "0.3.8"
wasm-bindgen = "0.2.79"
wasm-streams = "0.3.0"
@@ -39,7 +39,7 @@ al-core = { path = "./al-core" }
al-task-exec = { path = "./al-task-exec" }
al-api = { path = "./al-api" }
mapproj = "0.3.0"
-wcs = "0.2.2"
+wcs = "0.2.4"
colorgrad = "0.6.2"
image-decoder = { package = "image", version = "0.24.2", default-features = false, features = ["jpeg", "png"] }
diff --git a/src/core/al-core/Cargo.toml b/src/core/al-core/Cargo.toml
index 13a21f3d..83d2f939 100644
--- a/src/core/al-core/Cargo.toml
+++ b/src/core/al-core/Cargo.toml
@@ -9,7 +9,7 @@ js-sys = "0.3.47"
cgmath = "*"
jpeg-decoder = "0.3.0"
png = "0.17.6"
-fitsrs = "0.1.1"
+fitsrs = "0.2.6"
al-api = { path = "../al-api" }
serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"
diff --git a/src/core/al-core/src/image/fits.rs b/src/core/al-core/src/image/fits.rs
index e1c7b4ba..f0855c68 100644
--- a/src/core/al-core/src/image/fits.rs
+++ b/src/core/al-core/src/image/fits.rs
@@ -9,8 +9,6 @@ pub struct Fits<'a> {
}
use std::borrow::Cow;
-use std::io::BufReader;
-use std::io::Read;
use std::fmt::Debug;
#[derive(Debug)]
pub enum Data<'a> {
@@ -19,40 +17,46 @@ pub enum Data<'a> {
I32(Cow<'a, [i32]>),
F32(Cow<'a, [f32]>),
}
-use fitsrs::hdu::{AsyncHDU, HDU};
-use wasm_streams::readable::IntoAsyncRead;
-use futures::stream::StreamExt;
+use std::io::Cursor;
+use fitsrs::{
+ hdu::data::InMemData,
+ fits::Fits as FitsData,
+};
+
impl<'a> Fits<'a> {
- pub fn from_byte_slice(bytes: &'a [u8]) -> Result
{
- let fitsrs::fits::Fits { hdu: HDU { data, header } } = fitsrs::fits::Fits::from_reader(bytes)
+ pub fn from_byte_slice(bytes_reader: &'a mut Cursor<&[u8]>) -> Result {
+ let FitsData { hdu } = FitsData::from_reader(bytes_reader)
.map_err(|_| {
JsValue::from_str(&"Parsing fits error")
})?;
- let width = header.get_axis_size(1)
+ let header = hdu.get_header();
+ let xtension = header.get_xtension();
+ let width = xtension.get_naxisn(1)
.ok_or_else(|| JsValue::from_str("NAXIS1 not found in the fits"))?;
- let height = header.get_axis_size(2)
+ let height = xtension.get_naxisn(2)
.ok_or_else(|| JsValue::from_str("NAXIS2 not found in the fits"))?;
-
- let data = match data {
- fitsrs::hdu::data::DataBorrowed::U8(slice) => {
+
+ let data = hdu.get_data();
+ let data = match *data {
+ InMemData::U8(slice) => {
Data::U8(Cow::Borrowed(slice))
},
- fitsrs::hdu::data::DataBorrowed::I16(slice) => {
+ InMemData::I16(slice) => {
Data::I16(Cow::Borrowed(slice))
},
- fitsrs::hdu::data::DataBorrowed::I32(slice) => {
+ InMemData::I32(slice) => {
Data::I32(Cow::Borrowed(slice))
},
- fitsrs::hdu::data::DataBorrowed::I64(slice) => {
+ InMemData::I64(slice) => {
let data = slice.iter().map(|v| *v as i32).collect();
Data::I32(Cow::Owned(data))
},
- fitsrs::hdu::data::DataBorrowed::F32(slice) => {
+ InMemData::F32(slice) => {
Data::F32(Cow::Borrowed(slice))
},
- fitsrs::hdu::data::DataBorrowed::F64(slice) => {
+ InMemData::F64(slice) => {
let data = slice.iter().map(|v| *v as f32).collect();
Data::F32(Cow::Owned(data))
}
@@ -67,59 +71,12 @@ impl<'a> Fits<'a> {
})
}
- pub fn from_reader(reader: BufReader) -> Result
- where
- R: Read + Debug
- {
- let fitsrs::fits::Fits { hdu: HDU { data, header } } = fitsrs::fits::Fits::from_reader(reader)
- .map_err(|_| {
- JsValue::from_str(&"Parsing fits error")
- })?;
-
- let width = header.get_axis_size(1)
- .ok_or_else(|| JsValue::from_str("NAXIS1 not found in the fits"))?;
-
- let height = header.get_axis_size(2)
- .ok_or_else(|| JsValue::from_str("NAXIS2 not found in the fits"))?;
-
- let data = match data {
- fitsrs::hdu::data::DataOwned::U8(it) => {
- Data::U8(Cow::Owned(it.collect()))
- },
- fitsrs::hdu::data::DataOwned::I16(it) => {
- Data::I16(Cow::Owned(it.collect()))
- },
- fitsrs::hdu::data::DataOwned::I32(it) => {
- Data::I32(Cow::Owned(it.collect()))
- },
- fitsrs::hdu::data::DataOwned::I64(it) => {
- let data = it.map(|v| v as i32).collect();
- Data::I32(Cow::Owned(data))
- },
- fitsrs::hdu::data::DataOwned::F32(it) => {
- Data::F32(Cow::Owned(it.collect()))
- },
- fitsrs::hdu::data::DataOwned::F64(it) => {
- let data = it.map(|v| v as f32).collect();
- Data::F32(Cow::Owned(data))
- }
- };
-
- Ok(Self {
- // Tile size
- size: Vector2::new(*width as i32, *height as i32),
-
- // Allocation info of the layout
- data
- })
- }
-
pub fn get_size(&self) -> &Vector2 {
&self.size
}
}
-impl Fits<'static> {
+/*impl Fits<'static> {
pub async fn from_async_reader(reader: IntoAsyncRead<'static>) -> Result {
let fitsrs::fits::AsyncFits { hdu: AsyncHDU { data, header } } = fitsrs::fits::AsyncFits::from_reader(futures::io::BufReader::new(reader))
.await
@@ -168,7 +125,8 @@ impl Fits<'static> {
data
})
}
-}
+}*/
+
use crate::Texture2DArray;
use crate::image::Image;
impl Image for Fits<'_> {
diff --git a/src/core/al-core/src/image/mod.rs b/src/core/al-core/src/image/mod.rs
index 214440be..c1b8539f 100644
--- a/src/core/al-core/src/image/mod.rs
+++ b/src/core/al-core/src/image/mod.rs
@@ -211,7 +211,7 @@ where
}
}
-use std::rc::Rc;
+use std::{rc::Rc, io::Cursor};
impl Image for Rc
where
I: Image,
@@ -304,7 +304,8 @@ impl Image for ImageType {
unsafe { raw_bytes.set_len(num_bytes); }
raw_bytes_buf.copy_to(&mut raw_bytes[..]);
- let fits_img = Fits::from_byte_slice(raw_bytes.as_slice())?;
+ let mut bytes_reader = Cursor::new(raw_bytes.as_slice());
+ let fits_img = Fits::from_byte_slice(&mut bytes_reader)?;
fits_img.tex_sub_image_3d(textures, offset)?
},
ImageType::Canvas { canvas } => canvas.tex_sub_image_3d(textures, offset)?,
diff --git a/src/core/al-ui/Cargo.toml b/src/core/al-ui/Cargo.toml
index 11f20fe3..bf45c4eb 100644
--- a/src/core/al-ui/Cargo.toml
+++ b/src/core/al-ui/Cargo.toml
@@ -16,7 +16,7 @@ serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"
serde-wasm-bindgen = "0.4"
num = "*"
-fitsrs = { package = "fitsrs", git = 'https://github.com/cds-astro/fitsrs', branch = 'master' }
+fitsrs = "0.2.6"
num-traits = "0.2.14"
image-decoder = { package = "image", version = "0.24.*", default-features = false, features = ["jpeg", "png"] }
egui = "0.15.0"
diff --git a/src/core/src/app.rs b/src/core/src/app.rs
index b8c3052e..d2680529 100644
--- a/src/core/src/app.rs
+++ b/src/core/src/app.rs
@@ -667,7 +667,7 @@ impl App {
self.layers.refresh_views(&mut self.camera);
}
- if self.request_for_new_tiles && Time::now() - self.last_time_request_for_new_tiles > DeltaTime::from(500_f32) {
+ if self.request_for_new_tiles && Time::now() - self.last_time_request_for_new_tiles > DeltaTime::from(100_f32) {
self.look_for_new_tiles()?;
self.request_for_new_tiles = false;
@@ -932,117 +932,122 @@ impl App {
let mut hdu_ext_idx = 0;
let mut images_params = vec![];
- if let Ok(image) = Image::from_fits_hdu_async(&gl, &mut hdu.0).await {
- let layer_ext = layer.clone();
- let url_ext = url.clone();
-
- let fits = ImageCfg {
- image: image,
- layer: layer_ext,
- url: url_ext,
- meta: meta.clone()
- };
+ match Image::from_fits_hdu_async(&gl, &mut hdu.0).await {
+ Ok(image) => {
+ let layer_ext = layer.clone();
+ let url_ext = url.clone();
- fits_sender.send(fits).await
- .unwrap();
-
- // Wait for the ack here
- let image_params = ack_recv.recv().await
- .map_err(|_| JsValue::from_str("Problem receiving fits"))?;
-
- images_params.push(image_params);
-
- let mut hdu_ext = hdu.next().await;
-
- // Continue parsing the file extensions here
- while let Ok(Some(mut xhdu)) = hdu_ext {
- match &mut xhdu {
- AsyncXtensionHDU::Image(xhdu_img) => {
- match Image::from_fits_hdu_async(&gl, xhdu_img).await {
- Ok(image) => {
- let layer_ext = layer.clone() + "_ext_" + &format!("{hdu_ext_idx}");
- let url_ext = url.clone() + "_ext_" + &format!("{hdu_ext_idx}");
-
- let fits_ext = ImageCfg {
- image: image,
- layer: layer_ext,
- url: url_ext,
- meta: meta.clone()
- };
-
- fits_sender.send(fits_ext).await
- .unwrap();
-
- let image_params = ack_recv.recv().await
- .map_err(|_| JsValue::from_str("Problem receving fits"))?;
-
- images_params.push(image_params);
- },
- Err(error) => {
- al_core::log::console_warn(&
- format!("The extension {hdu_ext_idx} has not been parsed, reason:")
- );
-
- al_core::log::console_warn(error);
- }
- }
- },
- _ => {
- al_core::log::console_warn(&
- format!("The extension {hdu_ext_idx} is a BinTable/AsciiTable and is thus discarded")
- );
- }
- }
-
- hdu_ext_idx += 1;
-
- hdu_ext = xhdu.next().await;
- }
- } else {
- let mut hdu_ext = hdu.next().await;
-
- while let Ok(Some(mut xhdu)) = hdu_ext {
- match &mut xhdu {
- AsyncXtensionHDU::Image(xhdu_img) => {
- match Image::from_fits_hdu_async(&gl, xhdu_img).await {
- Ok(image) => {
- let layer_ext = layer.clone() + "_ext_" + &format!("{hdu_ext_idx}");
- let url_ext = url.clone() + "_ext_" + &format!("{hdu_ext_idx}");
+ let fits = ImageCfg {
+ image: image,
+ layer: layer_ext,
+ url: url_ext,
+ meta: meta.clone()
+ };
- let fits_ext = ImageCfg {
- image: image,
- layer: layer_ext,
- url: url_ext,
- meta: meta.clone()
- };
-
- fits_sender.send(fits_ext).await
- .unwrap();
-
- let image_params = ack_recv.recv().await
- .map_err(|_| JsValue::from_str("Problem receving fits"))?;
-
- images_params.push(image_params);
- },
- Err(error) => {
- al_core::log::console_warn(&
- format!("The extension {hdu_ext_idx} has not been parsed, reason:")
- );
-
- al_core::log::console_warn(error);
+ fits_sender.send(fits).await
+ .unwrap();
+
+ // Wait for the ack here
+ let image_params = ack_recv.recv().await
+ .map_err(|_| JsValue::from_str("Problem receiving fits"))?;
+
+ images_params.push(image_params);
+
+ let mut hdu_ext = hdu.next().await;
+
+ // Continue parsing the file extensions here
+ while let Ok(Some(mut xhdu)) = hdu_ext {
+ match &mut xhdu {
+ AsyncXtensionHDU::Image(xhdu_img) => {
+ match Image::from_fits_hdu_async(&gl, xhdu_img).await {
+ Ok(image) => {
+ let layer_ext = layer.clone() + "_ext_" + &format!("{hdu_ext_idx}");
+ let url_ext = url.clone() + "_ext_" + &format!("{hdu_ext_idx}");
+
+ let fits_ext = ImageCfg {
+ image: image,
+ layer: layer_ext,
+ url: url_ext,
+ meta: meta.clone()
+ };
+
+ fits_sender.send(fits_ext).await
+ .unwrap();
+
+ let image_params = ack_recv.recv().await
+ .map_err(|_| JsValue::from_str("Problem receving fits"))?;
+
+ images_params.push(image_params);
+ },
+ Err(error) => {
+ al_core::log::console_warn(&
+ format!("The extension {hdu_ext_idx} has not been parsed, reason:")
+ );
+
+ al_core::log::console_warn(error);
+ }
}
+ },
+ _ => {
+ al_core::log::console_warn(&
+ format!("The extension {hdu_ext_idx} is a BinTable/AsciiTable and is thus discarded")
+ );
}
- },
- _ => {
- al_core::log::console_warn(&
- format!("The extension {hdu_ext_idx} is a BinTable/AsciiTable and is thus discarded")
- );
}
+
+ hdu_ext_idx += 1;
+
+ hdu_ext = xhdu.next().await;
}
+ },
+ Err(error) => {
+ al_core::log::console_warn(error);
- hdu_ext_idx += 1;
+ let mut hdu_ext = hdu.next().await;
- hdu_ext = xhdu.next().await;
+ while let Ok(Some(mut xhdu)) = hdu_ext {
+ match &mut xhdu {
+ AsyncXtensionHDU::Image(xhdu_img) => {
+ match Image::from_fits_hdu_async(&gl, xhdu_img).await {
+ Ok(image) => {
+ let layer_ext = layer.clone() + "_ext_" + &format!("{hdu_ext_idx}");
+ let url_ext = url.clone() + "_ext_" + &format!("{hdu_ext_idx}");
+
+ let fits_ext = ImageCfg {
+ image: image,
+ layer: layer_ext,
+ url: url_ext,
+ meta: meta.clone()
+ };
+
+ fits_sender.send(fits_ext).await
+ .unwrap();
+
+ let image_params = ack_recv.recv().await
+ .map_err(|_| JsValue::from_str("Problem receving fits"))?;
+
+ images_params.push(image_params);
+ },
+ Err(error) => {
+ al_core::log::console_warn(&
+ format!("The extension {hdu_ext_idx} has not been parsed, reason:")
+ );
+
+ al_core::log::console_warn(error);
+ }
+ }
+ },
+ _ => {
+ al_core::log::console_warn(&
+ format!("The extension {hdu_ext_idx} is a BinTable/AsciiTable and is thus discarded")
+ );
+ }
+ }
+
+ hdu_ext_idx += 1;
+
+ hdu_ext = xhdu.next().await;
+ }
}
}
@@ -1097,7 +1102,6 @@ impl App {
let new_img_fmt = meta.img_format;
self.layers.set_layer_cfg(layer.clone(), meta, &self.camera, &self.projection)?;
-
if old_meta.img_format != new_img_fmt {
// The image format has been changed
let hips = self.layers
diff --git a/src/core/src/renderable/image/grid.rs b/src/core/src/renderable/image/grid.rs
index 0d1f3ff7..ad979244 100644
--- a/src/core/src/renderable/image/grid.rs
+++ b/src/core/src/renderable/image/grid.rs
@@ -158,7 +158,7 @@ fn build_range_indices(it: impl Iterator- + Clone) -> Vec (Vec<[f32; 2]>, Vec<[f32; 2]>, Vec, Vec) {
+pub fn get_grid_vertices(xy_min: &(f64, f64), xy_max: &(f64, f64), max_tex_size: u64, num_tri_per_tex_patch: u64, camera: &CameraViewPort, wcs: &WCS, projection: &ProjectionType) -> (Vec<[f32; 2]>, Vec<[f32; 2]>, Vec, Vec) {
let (x_it, y_it) = get_grid_params(xy_min, xy_max, max_tex_size, num_tri_per_tex_patch);
let idx_x_ranges = build_range_indices(x_it.clone());
@@ -255,7 +255,7 @@ impl<'a> BuildPatchIndicesIter<'a> {
}
impl<'a> Iterator for BuildPatchIndicesIter<'a> {
- type Item = [(u32, u32, u32); 2];
+ type Item = [(u16, u16, u16); 2];
fn next(&mut self) -> Option {
if self.cur_idx_x == *self.idx_x_range.end() {
@@ -297,8 +297,8 @@ impl<'a> Iterator for BuildPatchIndicesIter<'a> {
self.next() // crossing projection tri
} else {
Some([
- (idx_tl as u32, idx_tr as u32, idx_bl as u32),
- (idx_tr as u32, idx_br as u32, idx_bl as u32)
+ (idx_tl as u16, idx_tr as u16, idx_bl as u16),
+ (idx_tr as u16, idx_br as u16, idx_bl as u16)
])
}
},
diff --git a/src/core/src/renderable/image/mod.rs b/src/core/src/renderable/image/mod.rs
index 87abbdbc..f81276dc 100644
--- a/src/core/src/renderable/image/mod.rs
+++ b/src/core/src/renderable/image/mod.rs
@@ -43,7 +43,7 @@ pub struct Image {
/// The vertex array object of the screen in NDC
vao: VertexArrayObject,
num_indices: Vec,
- indices: Vec,
+ indices: Vec,
pos: Vec,
uv: Vec,
@@ -84,8 +84,6 @@ impl Image {
if naxis == 0 {
return Err(JsValue::from_str("The fits is empty, NAXIS=0"));
- } else if naxis != 2 {
- return Err(JsValue::from_str("Multi dimentional cubes are not supported"))
}
let scale = header
@@ -202,7 +200,7 @@ impl Image {
// Set the element buffer
.add_element_buffer(
WebGl2RenderingContext::DYNAMIC_DRAW,
- VecData::(&indices),
+ VecData::(&indices),
)
.unbind();
#[cfg(feature = "webgl1")]
@@ -222,7 +220,7 @@ impl Image {
// Set the element buffer
.add_element_buffer(
WebGl2RenderingContext::DYNAMIC_DRAW,
- VecData::(&indices),
+ VecData::(&indices),
)
.unbind();
@@ -417,7 +415,7 @@ impl Image {
)
.update_element_array(
WebGl2RenderingContext::DYNAMIC_DRAW,
- VecData::(&self.indices),
+ VecData::(&self.indices),
);
Ok(())
@@ -464,8 +462,8 @@ impl Image {
.draw_elements_with_i32(
WebGl2RenderingContext::TRIANGLES,
Some(num_indices),
- WebGl2RenderingContext::UNSIGNED_INT,
- ((off_indices as usize) * std::mem::size_of::()) as i32,
+ WebGl2RenderingContext::UNSIGNED_SHORT,
+ ((off_indices as usize) * std::mem::size_of::()) as i32,
);
off_indices += self.num_indices[idx];
diff --git a/src/core/src/renderable/mod.rs b/src/core/src/renderable/mod.rs
index 78880c7d..c69f8c32 100644
--- a/src/core/src/renderable/mod.rs
+++ b/src/core/src/renderable/mod.rs
@@ -558,15 +558,32 @@ impl Layers {
camera: &CameraViewPort,
projection: &ProjectionType,
) -> Result<(), JsValue> {
- if let Some(meta_old) = self.meta.get(&layer) {
+ let layer_ref = layer.as_str();
+
+ if let Some(meta_old) = self.meta.get(layer_ref) {
if !meta_old.visible() && meta.visible() {
- if let Some(survey) = self.get_mut_hips_from_layer(&layer) {
+ if let Some(survey) = self.get_mut_hips_from_layer(layer_ref) {
survey.recompute_vertices(camera, projection);
}
- if let Some(image) = self.get_mut_image_from_layer(&layer) {
+ if let Some(image) = self.get_mut_image_from_layer(layer_ref) {
image.recompute_vertices(camera, projection)?;
}
+ } else if meta_old.visible() && !meta.visible() {
+ // There is an important point here, if we hide a specific layer
+ // then we must recompute the vertices of the layers underneath
+ let layer_idx = self.layers.iter().position(|l| l == layer_ref)
+ .ok_or(JsValue::from_str("Expect the layer to be found!"))?;
+
+ for idx in 0..layer_idx {
+ let cur_layer = self.layers[idx].clone();
+
+ if let Some(survey) = self.get_mut_hips_from_layer(&cur_layer) {
+ survey.recompute_vertices(camera, projection);
+ } else if let Some(image) = self.get_mut_image_from_layer(&cur_layer) {
+ image.recompute_vertices(camera, projection)?;
+ }
+ }
}
}
diff --git a/src/js/ImageFITS.js b/src/js/ImageFITS.js
index 4a7f4963..a885cba1 100644
--- a/src/js/ImageFITS.js
+++ b/src/js/ImageFITS.js
@@ -165,7 +165,7 @@ export let ImageFITS = (function () {
// There is at least one entry in imageParams
self.added = true;
self.children = [];
-
+
let hduIdx = 0;
imagesParams.forEach((imageParams) => {
// This fits has HDU extensions
diff --git a/src/js/ImageLayer.js b/src/js/ImageLayer.js
index 97a32bed..f27ad227 100644
--- a/src/js/ImageLayer.js
+++ b/src/js/ImageLayer.js
@@ -17,6 +17,7 @@ ImageLayer.update = function (layer) {
name: layer.name,
url: layer.url,
options: options,
+ subtype: layer.subtype,
});
}
}
@@ -27,18 +28,21 @@ ImageLayer.LAYERS = [
name: "2MASS colored",
url: "https://alasky.cds.unistra.fr/2MASS/Color",
maxOrder: 9,
+ subtype: "survey",
},
{
id: "P/DSS2/color",
name: "DSS colored",
url: "https://alasky.cds.unistra.fr/DSS/DSSColor",
maxOrder: 9,
+ subtype: "survey",
},
{
id: "P/DSS2/red",
name: "DSS2 Red (F+R)",
url: "https://alasky.cds.unistra.fr/DSS/DSS2Merged",
maxOrder: 9,
+ subtype: "survey",
// options
options: {
minCut: 1000.0,
@@ -53,6 +57,7 @@ ImageLayer.LAYERS = [
name: "Density map for Gaia EDR3 (I/350/gaiaedr3)",
url: "https://alasky.cds.unistra.fr/ancillary/GaiaEDR3/density-map",
maxOrder: 7,
+ subtype: "survey",
// options
options: {
minCut: 0,
@@ -67,6 +72,7 @@ ImageLayer.LAYERS = [
name: "PanSTARRS DR1 g",
url: "https://alasky.cds.unistra.fr/Pan-STARRS/DR1/g",
maxOrder: 11,
+ subtype: "survey",
// options
options: {
minCut: -34,
@@ -81,24 +87,28 @@ ImageLayer.LAYERS = [
name: "PanSTARRS DR1 color",
url: "https://alasky.cds.unistra.fr/Pan-STARRS/DR1/color-z-zg-g",
maxOrder: 11,
+ subtype: "survey",
},
{
id: "P/DECaPS/DR1/color",
name: "DECaPS DR1 color",
url: "https://alasky.cds.unistra.fr/DECaPS/DR1/color",
maxOrder: 11,
+ subtype: "survey",
},
{
id: "P/Fermi/color",
name: "Fermi color",
url: "https://alasky.cds.unistra.fr/Fermi/Color",
maxOrder: 3,
+ subtype: "survey",
},
{
id: "P/Finkbeiner",
name: "Halpha",
url: "https://alasky.cds.unistra.fr/FinkbeinerHalpha",
maxOrder: 3,
+ subtype: "survey",
// options
options: {
minCut: -10,
@@ -112,30 +122,35 @@ ImageLayer.LAYERS = [
name: "GALEXGR6_7 NUV",
url: "http://alasky.cds.unistra.fr/GALEX/GALEXGR6_7_NUV/",
maxOrder: 8,
+ subtype: "survey",
},
{
id: "P/IRIS/color",
name: "IRIS colored",
url: "https://alasky.cds.unistra.fr/IRISColor",
maxOrder: 3,
+ subtype: "survey",
},
{
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",
@@ -147,12 +162,14 @@ ImageLayer.LAYERS = [
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",
name: "VTSS-Ha",
url: "https://alasky.cds.unistra.fr/VTSS/Ha",
maxOrder: 3,
+ subtype: "survey",
options: {
minCut: -10.0,
maxCut: 100.0,
@@ -165,12 +182,14 @@ ImageLayer.LAYERS = [
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",
name: "AllWISE color",
url: "https://alasky.cds.unistra.fr/AllWISE/RGB-W4-W2-W1/",
maxOrder: 8,
+ subtype: "survey",
},
{
id: "P/GLIMPSE360",
@@ -178,6 +197,7 @@ ImageLayer.LAYERS = [
// 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",
diff --git a/src/js/URLBuilder.js b/src/js/URLBuilder.js
index 1978dfa0..0643cd4d 100644
--- a/src/js/URLBuilder.js
+++ b/src/js/URLBuilder.js
@@ -51,7 +51,6 @@ export let URLBuilder = (function() {
},
buildVizieRCSURL: function(vizCatId, target, radiusDegrees, options) {
- console.log(target)
if (target && (typeof target === "object")) {
if ('ra' in target && 'dec' in target) {
var coo = new Coo(target.ra, target.dec, 7);
@@ -65,6 +64,8 @@ export let URLBuilder = (function() {
maxNbSources = parseInt(options.limit);
}
return 'https://vizier.unistra.fr/viz-bin/votable/A?-source=' + vizCatId + '&-c=' + encodeURIComponent(target) + '&-out.max=' + maxNbSources + '&-c.rd=' + radiusDegrees;
+ //return 'https://vizier.unistra.fr/viz-bin/conesearch/' + vizCatId + '?ra=' + target.ra + '&dec=' + target.dec + '&sr=' + radiusDegrees;
+
},
buildSkyBotCSURL: function(ra, dec, radius, epoch, queryOptions) {
diff --git a/src/js/View.js b/src/js/View.js
index afacd2e3..097cd7b4 100644
--- a/src/js/View.js
+++ b/src/js/View.js
@@ -871,10 +871,10 @@ export let View = (function () {
// touchpad
newTime = new Date().getTime();
- if ( newTime - oldTime > 20 ) {
- triggerZoom(0.005);
+ //if ( newTime - oldTime > 20 ) {
+ triggerZoom(0.002);
oldTime = new Date().getTime();
- }
+ //}
} else {
// mouse
triggerZoom(0.007);
diff --git a/src/js/gui/HiPSLayer.js b/src/js/gui/HiPSLayer.js
index f4ae7792..9deaf706 100644
--- a/src/js/gui/HiPSLayer.js
+++ b/src/js/gui/HiPSLayer.js
@@ -160,7 +160,7 @@ export class HiPSLayer {
let layer;
// Max order is specific for surveys
- if (!cfg.maxOrder) {
+ if (cfg.subtype === "fits") {
// FITS
layer = self.aladin.createImageFITS(
cfg.url,