mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-12 07:40:26 -08:00
remove rust warnings and update wcs dep to a the fixed version 0.3.1
This commit is contained in:
@@ -27,6 +27,7 @@ wasm-streams = "0.3.0"
|
||||
async-channel = "1.8.0"
|
||||
mapproj = "0.3.0"
|
||||
fitsrs = "0.2.11"
|
||||
wcs = "0.3.1"
|
||||
colorgrad = "0.6.2"
|
||||
|
||||
[features]
|
||||
@@ -40,10 +41,6 @@ rand = "0.8"
|
||||
[build-dependencies]
|
||||
walkdir = "2.3.2"
|
||||
|
||||
[dependencies.wcs]
|
||||
git = "https://github.com/cds-astro/wcs-rs"
|
||||
branch = "master"
|
||||
|
||||
[dependencies.console_error_panic_hook]
|
||||
version = "0.1.7"
|
||||
optional = true
|
||||
|
||||
@@ -19,7 +19,7 @@ where
|
||||
|
||||
use crate::image::format::ImageFormat;
|
||||
use crate::image::Image;
|
||||
use crate::texture::{Tex3D, Texture2DArray};
|
||||
use crate::texture::Tex3D;
|
||||
use cgmath::Vector3;
|
||||
use wasm_bindgen::JsValue;
|
||||
impl<F> Image for HTMLImage<F>
|
||||
|
||||
@@ -181,7 +181,6 @@ impl ArrayBuffer for ArrayF64 {
|
||||
|
||||
use self::canvas::Canvas;
|
||||
use self::html::HTMLImage;
|
||||
use super::Texture2DArray;
|
||||
use wasm_bindgen::JsValue;
|
||||
pub trait Image {
|
||||
fn insert_into_3d_texture<T: Tex3D>(
|
||||
|
||||
@@ -138,7 +138,6 @@ pub enum ImageBufferType {
|
||||
}
|
||||
|
||||
use crate::image::{ArrayBuffer, Image};
|
||||
use crate::Texture2DArray;
|
||||
use cgmath::{Vector2, Vector3};
|
||||
impl<I> Image for ImageBuffer<I>
|
||||
where
|
||||
|
||||
@@ -19,7 +19,7 @@ pub struct Texture3D {
|
||||
texture: Option<WebGlTexture>,
|
||||
|
||||
metadata: Option<Rc<RefCell<Texture2DMeta>>>,
|
||||
depth: i32,
|
||||
_depth: i32,
|
||||
}
|
||||
|
||||
impl Texture3D {
|
||||
@@ -62,7 +62,7 @@ impl Texture3D {
|
||||
Ok(Texture3D {
|
||||
texture,
|
||||
gl: gl.clone(),
|
||||
depth,
|
||||
_depth: depth,
|
||||
metadata,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -274,10 +274,6 @@ impl App {
|
||||
let min_tile_depth = cfg.delta_depth().max(cfg.get_min_depth_tile());
|
||||
let mut ancestors = HashSet::new();
|
||||
|
||||
let creator_did = cfg.get_creator_did().to_string();
|
||||
let root_url = cfg.get_root_url().to_string();
|
||||
let format = cfg.get_format();
|
||||
|
||||
if let Some(tiles) = hips.look_for_new_tiles(&mut self.camera, &self.projection) {
|
||||
for tile_cell in tiles {
|
||||
self.tile_fetcher.append(hips.get_tile_query(&tile_cell));
|
||||
@@ -539,7 +535,7 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
self.draw(false)?;
|
||||
self.draw()?;
|
||||
|
||||
// Check for async retrieval
|
||||
if let Ok(img) = self.img_recv.try_recv() {
|
||||
@@ -810,7 +806,7 @@ impl App {
|
||||
self.grid.draw_labels()
|
||||
}
|
||||
|
||||
pub(crate) fn draw(&mut self, force_render: bool) -> Result<(), JsValue> {
|
||||
pub(crate) fn draw(&mut self) -> Result<(), JsValue> {
|
||||
/*let scene_redraw = self.rendering | force_render;
|
||||
let mut ui = self.ui.lock();
|
||||
|
||||
@@ -888,10 +884,10 @@ impl App {
|
||||
let projection = &self.projection;
|
||||
|
||||
let layers = &mut self.layers;
|
||||
let catalogs = &self.manager;
|
||||
//let catalogs = &self.manager;
|
||||
let colormaps = &self.colormaps;
|
||||
let fbo_view = &self._fbo_view;
|
||||
let final_rendering_pass = &self._final_rendering_pass;
|
||||
//let fbo_view = &self._fbo_view;
|
||||
//let final_rendering_pass = &self._final_rendering_pass;
|
||||
|
||||
//fbo_view.draw_onto(
|
||||
// move || {
|
||||
@@ -1281,7 +1277,7 @@ impl App {
|
||||
// keep the old meta data
|
||||
let new_img_ext = meta.img_format;
|
||||
self.layers
|
||||
.set_layer_cfg(layer.clone(), meta, &mut self.camera, &self.projection)?;
|
||||
.set_layer_cfg(layer.clone(), meta)?;
|
||||
|
||||
if old_meta.img_format != new_img_ext {
|
||||
// The image format has been changed
|
||||
|
||||
@@ -26,7 +26,7 @@ impl Inertia {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, dt: DeltaTime) {
|
||||
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, _dt: DeltaTime) {
|
||||
let t = ((Time::now() - self.time_start).as_millis() / 1000.0) as f64;
|
||||
// Undamped angular frequency of the oscillator
|
||||
// From wiki: https://en.wikipedia.org/wiki/Harmonic_oscillator
|
||||
|
||||
@@ -578,8 +578,6 @@ fn send_to_gpu<I: Image>(
|
||||
let delta_depth = cfg.delta_depth();
|
||||
let (idx_col_in_tex, idx_row_in_tex) = cell.get_offset_in_texture_cell(delta_depth);
|
||||
|
||||
// The size of the global texture containing the tiles
|
||||
let texture_size = cfg.get_texture_size();
|
||||
// The size of a tile in its texture
|
||||
let tile_size = cfg.get_tile_size();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use al_core::VecData;
|
||||
use al_core::VertexArrayObject;
|
||||
use al_core::WebGlContext;
|
||||
|
||||
use crate::math::{angle::Angle, vector::dist2};
|
||||
use crate::math::angle::Angle;
|
||||
use crate::ProjectionType;
|
||||
|
||||
use crate::camera::CameraViewPort;
|
||||
@@ -505,8 +505,8 @@ impl HiPS2D {
|
||||
ending_texture,
|
||||
}) = texture_to_draw
|
||||
{
|
||||
let uv_0 = TileUVW::new(cell, starting_texture, cfg);
|
||||
let uv_1 = TileUVW::new(cell, ending_texture, cfg);
|
||||
let uv_0 = TileUVW::new(cell, starting_texture);
|
||||
let uv_1 = TileUVW::new(cell, ending_texture);
|
||||
let d01s = uv_0[TileCorner::BottomRight].x - uv_0[TileCorner::BottomLeft].x;
|
||||
let d02s = uv_0[TileCorner::TopLeft].y - uv_0[TileCorner::BottomLeft].y;
|
||||
let d01e = uv_1[TileCorner::BottomRight].x - uv_1[TileCorner::BottomLeft].x;
|
||||
|
||||
@@ -152,11 +152,9 @@ impl HpxTileBuffer for HiPS3DBuffer {
|
||||
available_tiles_during_frame
|
||||
}
|
||||
|
||||
fn set_image_ext(&mut self, gl: &WebGlContext, ext: ImageExt) -> Result<(), JsValue> {
|
||||
fn set_image_ext(&mut self, _gl: &WebGlContext, ext: ImageExt) -> Result<(), JsValue> {
|
||||
self.config.set_image_ext(ext)?;
|
||||
|
||||
let channel = self.config.get_format().get_channel();
|
||||
|
||||
self.textures.clear();
|
||||
//self.ready = false;
|
||||
self.available_tiles_during_frame = true;
|
||||
@@ -164,7 +162,7 @@ impl HpxTileBuffer for HiPS3DBuffer {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_pixel(&self, pos: &LonLatT<f64>, camera: &CameraViewPort) -> Result<JsValue, JsValue> {
|
||||
fn read_pixel(&self, _pos: &LonLatT<f64>, _camera: &CameraViewPort) -> Result<JsValue, JsValue> {
|
||||
todo!();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ use al_core::VecData;
|
||||
use al_core::VertexArrayObject;
|
||||
use al_core::WebGlContext;
|
||||
|
||||
use crate::math::{angle::Angle, vector::dist2};
|
||||
use crate::ProjectionType;
|
||||
|
||||
use crate::camera::CameraViewPort;
|
||||
@@ -25,7 +24,7 @@ use crate::camera::CameraViewPort;
|
||||
use crate::downloader::query;
|
||||
|
||||
use crate::shader::ShaderManager;
|
||||
use crate::{math::lonlat::LonLatT, utils};
|
||||
use crate::math::lonlat::LonLatT;
|
||||
|
||||
use crate::downloader::request::allsky::Allsky;
|
||||
use crate::healpix::{cell::HEALPixCell, coverage::HEALPixCoverage};
|
||||
@@ -38,10 +37,8 @@ use std::collections::HashSet;
|
||||
// Recursively compute the number of subdivision needed for a cell
|
||||
// to not be too much skewed
|
||||
|
||||
use super::d2::texture::HpxTexture2D;
|
||||
use buffer::HiPS3DBuffer;
|
||||
|
||||
use super::raytracing::RayTracer;
|
||||
use super::uv::{TileCorner, TileUVW};
|
||||
|
||||
use cgmath::Matrix;
|
||||
@@ -314,7 +311,6 @@ impl HiPS3D {
|
||||
shaders: &mut ShaderManager,
|
||||
colormaps: &Colormaps,
|
||||
camera: &mut CameraViewPort,
|
||||
raytracer: &RayTracer,
|
||||
cfg: &ImageMetadata,
|
||||
proj: &ProjectionType,
|
||||
) -> Result<(), JsValue> {
|
||||
@@ -332,7 +328,7 @@ impl HiPS3D {
|
||||
self.recompute_vertices(camera, proj);
|
||||
}
|
||||
|
||||
self.draw_internal(shaders, colormaps, camera, raytracer, cfg, proj)
|
||||
self.draw_internal(shaders, colormaps, camera, cfg, proj)
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -396,7 +392,7 @@ impl HiPS3D {
|
||||
// The slice is sure to be contained so we can unwrap
|
||||
let hpx_slice_tex = texture.extract_2d_slice_texture(slice_contained).unwrap();
|
||||
|
||||
let uv_1 = TileUVW::new(cell, &hpx_slice_tex, self.get_config());
|
||||
let uv_1 = TileUVW::new(cell, &hpx_slice_tex);
|
||||
let d01e = uv_1[TileCorner::BottomRight].x - uv_1[TileCorner::BottomLeft].x;
|
||||
let d02e = uv_1[TileCorner::TopLeft].y - uv_1[TileCorner::BottomLeft].y;
|
||||
|
||||
@@ -540,7 +536,6 @@ impl HiPS3D {
|
||||
shaders: &mut ShaderManager,
|
||||
colormaps: &Colormaps,
|
||||
camera: &mut CameraViewPort,
|
||||
raytracer: &RayTracer,
|
||||
cfg: &ImageMetadata,
|
||||
proj: &ProjectionType,
|
||||
) -> Result<(), JsValue> {
|
||||
|
||||
@@ -296,7 +296,7 @@ impl HpxTexture3D {
|
||||
image.insert_into_3d_texture(texture, &Vector3::<i32>::new(0, 0, slice_idx as i32))?;
|
||||
|
||||
match self.block_indices.binary_search(&block_idx) {
|
||||
Ok(i) => {} // element already in vector @ `pos`
|
||||
Ok(_) => {} // element already in vector @ `pos`
|
||||
Err(i) => self.block_indices.insert(i, block_idx),
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,11 @@ use crate::HEALPixCoverage;
|
||||
use crate::LonLatT;
|
||||
use crate::WebGlContext;
|
||||
use al_api::hips::ImageExt;
|
||||
use al_core::image::Image;
|
||||
use wasm_bindgen::JsValue;
|
||||
|
||||
mod subdivide;
|
||||
|
||||
trait HpxTile {
|
||||
pub(crate) trait HpxTile {
|
||||
// Getter
|
||||
// Returns the current time if the texture is not full
|
||||
fn start_time(&self) -> Time;
|
||||
@@ -32,7 +31,7 @@ trait HpxTile {
|
||||
fn cell(&self) -> &HEALPixCell;
|
||||
}
|
||||
|
||||
pub trait HpxTileBuffer {
|
||||
pub(crate) trait HpxTileBuffer {
|
||||
type T: HpxTile;
|
||||
|
||||
fn new(gl: &WebGlContext, config: HiPSConfig) -> Result<Self, JsValue>
|
||||
|
||||
@@ -12,14 +12,13 @@ impl<T> Deref for UV<T> {
|
||||
}
|
||||
}
|
||||
|
||||
use super::config::HiPSConfig;
|
||||
use super::d2::texture::HpxTexture2D;
|
||||
use crate::healpix::cell::HEALPixCell;
|
||||
use crate::renderable::hips::HpxTile;
|
||||
pub struct TileUVW([Vector3<f32>; 4]);
|
||||
impl TileUVW {
|
||||
// The texture cell passed must be a child of texture
|
||||
pub fn new(cell: &HEALPixCell, texture: &HpxTexture2D, cfg: &HiPSConfig) -> TileUVW {
|
||||
pub fn new(cell: &HEALPixCell, texture: &HpxTexture2D) -> TileUVW {
|
||||
// Index of the texture in the total set of textures
|
||||
let texture_idx = texture.idx();
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ impl Layers {
|
||||
hips.draw(shaders, colormaps, camera, raytracer, draw_opt, projection)?;
|
||||
}
|
||||
HiPS::D3(hips) => {
|
||||
hips.draw(shaders, colormaps, camera, raytracer, draw_opt, projection)?;
|
||||
hips.draw(shaders, colormaps, camera, draw_opt, projection)?;
|
||||
}
|
||||
}
|
||||
} else if let Some(images) = self.images.get_mut(id) {
|
||||
@@ -565,45 +565,7 @@ impl Layers {
|
||||
&mut self,
|
||||
layer: String,
|
||||
meta: ImageMetadata,
|
||||
camera: &CameraViewPort,
|
||||
projection: &ProjectionType,
|
||||
) -> Result<(), JsValue> {
|
||||
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(hips) = self.get_mut_hips_from_layer(layer_ref) {
|
||||
hips.recompute_vertices(camera, projection);
|
||||
}
|
||||
|
||||
if let Some(images) = self.get_mut_image_from_layer(layer_ref) {
|
||||
for image in images {
|
||||
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(hips) = self.get_mut_hips_from_layer(&cur_layer) {
|
||||
hips.recompute_vertices(camera, projection);
|
||||
} else if let Some(images) = self.get_mut_image_from_layer(&cur_layer) {
|
||||
for image in images {
|
||||
image.recompute_vertices(camera, projection)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Expect the image hips to be found in the hash map
|
||||
self.meta.insert(layer.clone(), meta).ok_or_else(|| {
|
||||
JsValue::from(js_sys::Error::new(&format!("{:?} layer not found", layer)))
|
||||
|
||||
@@ -5,7 +5,7 @@ use serde::Deserialize;
|
||||
mod circle;
|
||||
mod ellipsis;
|
||||
mod image;
|
||||
mod polyline;
|
||||
//mod polyline;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@@ -6,7 +6,7 @@ use al_core::WebGlContext;
|
||||
|
||||
use al_api::color::ColorRGBA;
|
||||
|
||||
pub struct PolylineRenderer {
|
||||
struct PolylineRenderer {
|
||||
gl: WebGlContext,
|
||||
vao: VertexArrayObject,
|
||||
|
||||
@@ -27,7 +27,7 @@ use super::Catalog;
|
||||
|
||||
impl PolylineRenderer {
|
||||
/// Init the buffers, VAO and shader
|
||||
pub fn new<'a>(gl: &WebGlContext, catalog: &Catalog) -> Result<Self, JsValue> {
|
||||
fn new<'a>(gl: &WebGlContext, catalog: &Catalog) -> Result<Self, JsValue> {
|
||||
let lines = catalog
|
||||
.shapes
|
||||
.iter()
|
||||
@@ -170,7 +170,7 @@ impl PolylineRenderer {
|
||||
});
|
||||
}*/
|
||||
|
||||
pub fn draw(
|
||||
fn draw(
|
||||
&mut self,
|
||||
shaders: &mut ShaderManager,
|
||||
camera: &CameraViewPort,
|
||||
|
||||
@@ -5,7 +5,7 @@ use web_sys::CanvasRenderingContext2d;
|
||||
pub struct TextRenderManager {
|
||||
// The text canvas
|
||||
ctx: CanvasRenderingContext2d,
|
||||
color: JsValue,
|
||||
color: String,
|
||||
font_size: u32,
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ impl TextRenderManager {
|
||||
.dyn_into::<web_sys::CanvasRenderingContext2d>()
|
||||
.unwrap_abort();
|
||||
|
||||
let color = JsValue::from_str("#00ff00");
|
||||
let color = String::from("#00ff00");
|
||||
let font_size = 15;
|
||||
Ok(Self {
|
||||
font_size,
|
||||
@@ -50,7 +50,7 @@ impl TextRenderManager {
|
||||
(color.b * 255.0) as u8,
|
||||
(color.a * 255.0) as u8,
|
||||
);
|
||||
self.color = JsValue::from_str(&hex);
|
||||
self.color = String::from(&hex);
|
||||
}
|
||||
|
||||
pub fn set_font_size(&mut self, size: u32) {
|
||||
@@ -95,7 +95,7 @@ impl Renderer for TextRenderManager {
|
||||
// reset the font and color
|
||||
self.ctx
|
||||
.set_font(&format!("{}px verdana, sans-serif", self.font_size));
|
||||
self.ctx.set_fill_style(&self.color);
|
||||
self.ctx.set_fill_style_str(&self.color);
|
||||
}
|
||||
|
||||
fn end(&mut self) {}
|
||||
|
||||
@@ -224,23 +224,16 @@ impl TileFetcherQueue {
|
||||
));
|
||||
} else if cfg.get_min_depth_tile() == 0 {
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
let hips_cdid = cfg.get_creator_did().to_string();
|
||||
let hips_url = cfg.get_root_url().to_string();
|
||||
let hips_fmt = cfg.get_format();
|
||||
let min_order = cfg.get_min_depth_texture();
|
||||
for tile_cell in crate::healpix::cell::ALLSKY_HPX_CELLS_D0 {
|
||||
if let Ok(query) = self.check_in_file_list(hips.get_tile_query(tile_cell)) {
|
||||
let dl = downloader.clone();
|
||||
|
||||
for tile_cell in crate::healpix::cell::ALLSKY_HPX_CELLS_D0 {
|
||||
if let Ok(query) = self.check_in_file_list(hips.get_tile_query(tile_cell)) {
|
||||
let dl = downloader.clone();
|
||||
|
||||
crate::utils::set_timeout(
|
||||
move || {
|
||||
dl.borrow_mut().fetch(query);
|
||||
},
|
||||
2_000,
|
||||
);
|
||||
}
|
||||
crate::utils::set_timeout(
|
||||
move || {
|
||||
dl.borrow_mut().fetch(query);
|
||||
},
|
||||
2_000,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user