Skip to content

Commit

Permalink
clean rust warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatthieu3 committed Jun 11, 2024
1 parent 813589b commit 6df2ee9
Show file tree
Hide file tree
Showing 39 changed files with 114 additions and 194 deletions.
3 changes: 3 additions & 0 deletions src/core/al-api/src/hips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub struct HiPSProperties {
tile_size: i32,
formats: Vec<ImageExt>,

#[allow(unused)]
is_planetary_body: Option<bool>,

bitpix: Option<i32>,
Expand All @@ -58,7 +59,9 @@ pub struct HiPSProperties {
hips_initial_dec: Option<f64>,

// Parametrable by the user
#[allow(unused)]
min_cutout: Option<f32>,
#[allow(unused)]
max_cutout: Option<f32>,

creator_did: String,
Expand Down
3 changes: 0 additions & 3 deletions src/core/al-core/src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ pub mod buffer_data;
pub mod element_array_buffer;
pub mod vertex_array_object;

pub use array_buffer::ArrayBuffer;
pub use array_buffer::VertexAttribPointerType;
pub use framebuffer::FrameBufferObject;
pub use vertex_array_object::vao::{
ShaderVertexArrayObjectBound, ShaderVertexArrayObjectBoundRef, VertexArrayObject,
};
24 changes: 10 additions & 14 deletions src/core/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
inertia::Inertia,
math::{
self,
angle::{Angle, ArcDeg, ToAngle},
angle::{Angle, ArcDeg},
lonlat::{LonLat, LonLatT},
},
renderable::Layers,
Expand All @@ -18,10 +18,6 @@ use crate::{
tile_fetcher::TileFetcherQueue,
time::DeltaTime,
};
use al_core::{
info, inforec,
log::{self, console_log},
};

use wasm_bindgen::prelude::*;

Expand Down Expand Up @@ -111,7 +107,7 @@ pub struct App {
}

use cgmath::{Vector2, Vector3};
use futures::{io::BufReader, stream::StreamExt}; // for `next`
use futures::io::BufReader; // for `next`

use crate::math::projection::*;
pub const BLENDING_ANIM_DURATION: DeltaTime = DeltaTime::from_millis(200.0); // in ms
Expand Down Expand Up @@ -268,7 +264,7 @@ impl App {
// Move the views of the different active surveys
self.tile_fetcher.clear();
// Loop over the surveys
let raytracer = self.layers.get_raytracer();
let _raytracer = self.layers.get_raytracer();

for survey in self.layers.values_mut_hips() {
if self.camera.get_texture_depth() == 0
Expand Down Expand Up @@ -408,7 +404,7 @@ use al_api::cell::HEALPixCellProjeted;

use crate::downloader::request::tile::Tile;
use crate::healpix::cell::HEALPixCell;
use crate::renderable::coverage::moc::MOC;

use al_api::color::ColorRGB;

impl App {
Expand Down Expand Up @@ -504,7 +500,7 @@ impl App {

pub(crate) fn add_moc(
&mut self,
mut cfg: al_api::moc::MOC,
cfg: al_api::moc::MOC,
moc: HEALPixCoverage,
) -> Result<(), JsValue> {
self.moc
Expand Down Expand Up @@ -654,7 +650,7 @@ impl App {
};
use al_core::image::ImageType;
use fitsrs::fits::Fits;
use std::{io::Cursor, rc::Rc};
use std::io::Cursor;
if let Some(image) = image.as_ref() {
match &*image.lock().unwrap_abort() {
Some(ImageType::FitsImage {
Expand Down Expand Up @@ -755,7 +751,7 @@ impl App {
Resource::PixelMetadata(metadata) => {
if let Some(hips) = self.layers.get_mut_hips_from_cdid(&metadata.hips_cdid)
{
let mut cfg = hips.get_config_mut();
let cfg = hips.get_config_mut();

if let Some(metadata) = *metadata.value.lock().unwrap_abort() {
cfg.blank = metadata.blank;
Expand Down Expand Up @@ -882,7 +878,7 @@ impl App {
}

pub(crate) fn draw_grid_labels(&mut self) -> Result<(), JsValue> {
self.grid.draw_labels(&self.camera)
self.grid.draw_labels()
}

pub(crate) fn draw(&mut self, force_render: bool) -> Result<(), JsValue> {
Expand Down Expand Up @@ -1320,9 +1316,9 @@ impl App {
self.camera.get_longitude_reversed()
}

pub(crate) fn add_catalog(&mut self, name: String, table: JsValue, _colormap: String) {
pub(crate) fn add_catalog(&mut self, _name: String, table: JsValue, _colormap: String) {
//let mut exec_ref = self.exec.borrow_mut();
let table = table;
let _table = table;

/*exec_ref
.spawner()
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/camera/fov.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::math::projection::coo_space::{XYZWModel, XYZWWorld, XYNDC};
use crate::math::sph_geom::region::{Intersection, PoleContained, Region};
use crate::math::{projection::Projection, sph_geom::bbox::BoundingBox};
use crate::LonLatT;
use cgmath::Vector3;


use crate::ProjectionType;
use std::iter;
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/camera/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod viewport;
use crate::math::lonlat::LonLat;
use crate::math::projection::coo_space::XYZWModel;
pub use viewport::{CameraViewPort, UserAction};
pub use viewport::{CameraViewPort};

pub mod fov;
pub use fov::FieldOfView;
Expand Down
51 changes: 0 additions & 51 deletions src/core/src/camera/view_hpx_cells.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,6 @@ use crate::HEALPixCoverage;

use std::ops::Range;

use al_api::cell::HEALPixCellProjeted;
use al_core::log::console_log;

pub fn project(
cell: HEALPixCellProjeted,
camera: &CameraViewPort,
projection: &ProjectionType,
) -> Option<HEALPixCellProjeted> {
match projection {
/*ProjectionType::Hpx(_) => {
let tri_idx_in_collignon_zone = |x: f64, y: f64| -> u8 {
let zoom_factor = camera.get_clip_zoom_factor() as f32;
let x = (((x as f32) / camera.get_width()) - 0.5) * zoom_factor;
let y = (((y as f32) / camera.get_height()) - 0.5) * zoom_factor;
let x_zone = ((x + 0.5) * 4.0).floor() as u8;
x_zone + 4 * ((y > 0.0) as u8)
};
let is_in_collignon = |_x: f64, y: f64| -> bool {
let y = (((y as f32) / camera.get_height()) - 0.5)
* (camera.get_clip_zoom_factor() as f32);
!(-0.25..=0.25).contains(&y)
};
if is_in_collignon(cell.vx[0], cell.vy[0])
&& is_in_collignon(cell.vx[1], cell.vy[1])
&& is_in_collignon(cell.vx[2], cell.vy[2])
&& is_in_collignon(cell.vx[3], cell.vy[3])
{
let all_vertices_in_same_collignon_region =
tri_idx_in_collignon_zone(cell.vx[0], cell.vy[0])
== tri_idx_in_collignon_zone(cell.vx[1], cell.vy[1])
&& (tri_idx_in_collignon_zone(cell.vx[0], cell.vy[0])
== tri_idx_in_collignon_zone(cell.vx[2], cell.vy[2]))
&& (tri_idx_in_collignon_zone(cell.vx[0], cell.vy[0])
== tri_idx_in_collignon_zone(cell.vx[3], cell.vy[3]));
if !all_vertices_in_same_collignon_region {
None
} else {
Some(cell)
}
} else {
Some(cell)
}
}*/
_ => Some(cell),
}
}

pub(super) struct ViewHpxCells {
hpx_cells: [HpxCells; NUM_COOSYSTEM],
reg_frames: [u8; NUM_COOSYSTEM],
Expand Down Expand Up @@ -162,7 +112,6 @@ impl Default for HpxCells {
}
}

use crate::camera::CameraViewPort;
use al_api::coo_system::{CooSystem, NUM_COOSYSTEM};

use super::FieldOfView;
Expand Down
10 changes: 5 additions & 5 deletions src/core/src/camera/viewport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::healpix::cell::HEALPixCell;
use crate::healpix::coverage::HEALPixCoverage;
use crate::math::angle::ToAngle;
use crate::math::{projection::coo_space::XYZWModel, projection::domain::sdf::ProjDef};
use al_core::log::console_log;
use al_core::{info, inforec, log};



use cgmath::{Matrix4, Vector2};
pub struct CameraViewPort {
Expand Down Expand Up @@ -212,7 +212,7 @@ impl CameraViewPort {

pub fn get_hpx_cells<'a>(
&'a mut self,
mut depth: u8,
depth: u8,
frame: CooSystem,
) -> impl Iterator<Item = &'a HEALPixCell> {
self.view_hpx_cells.get_cells(depth, frame)
Expand Down Expand Up @@ -341,7 +341,7 @@ impl CameraViewPort {
self.last_user_action
};

let can_unzoom_more = match proj {
let _can_unzoom_more = match proj {
ProjectionType::Tan(_)
| ProjectionType::Mer(_)
//| ProjectionType::Air(_)
Expand Down Expand Up @@ -443,7 +443,7 @@ impl CameraViewPort {
(smallest_cell_size_px / w_screen_px) * self.get_aperture().to_radians();

while depth_pixel > 0 {
if (crate::healpix::utils::MEAN_HPX_CELL_RES[depth_pixel] > hpx_cell_size_rad) {
if crate::healpix::utils::MEAN_HPX_CELL_RES[depth_pixel] > hpx_cell_size_rad {
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/src/coosys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cgmath::{BaseFloat, Vector4};
use al_api::coo_system::CooBaseFloat;
use al_api::coo_system::CooSystem;

use crate::math::lonlat::LonLat;

/// This is conversion method returning a transformation
/// matrix when the system requested by the user is not
/// icrs j2000.
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/downloader/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod query;
pub mod request;

use crate::renderable::Url;

use std::collections::HashSet;

use query::QueryId;
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/downloader/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub trait Query: Sized {
pub type QueryId = String;

use al_core::image::format::ImageFormatType;
use al_core::log::console_log;

#[derive(Eq, Hash, PartialEq, Clone)]
pub struct Tile {
pub cell: HEALPixCell,
Expand Down
1 change: 0 additions & 1 deletion src/core/src/downloader/request/allsky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use crate::renderable::Url;
use wasm_bindgen_futures::JsFuture;
use web_sys::{RequestInit, RequestMode, Response};

use crate::downloader::query::Query;
use al_core::{image::raw::ImageBuffer, texture::pixel::Pixel};
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
Expand Down
1 change: 0 additions & 1 deletion src/core/src/downloader/request/blank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl From<PixelMetadataRequest> for RequestType {
}
}

use crate::downloader::query::Query;
use crate::renderable::Url;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/downloader/request/moc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::downloader::query;
use crate::renderable::CreatorDid;

use super::{Request, RequestType};
use crate::downloader::QueryId;

use crate::healpix::coverage::Smoc;
use moclib::deser::fits::MocType;
use moclib::qty::Hpx;
Expand Down Expand Up @@ -37,7 +37,7 @@ pub fn from_fits_hpx<T: Idx>(moc: MocType<T, Hpx<T>, Cursor<&[u8]>>) -> Smoc {
}
}
}
use crate::downloader::query::Query;

use crate::healpix::coverage::HEALPixCoverage;
use crate::Abort;
use moclib::deser::fits::MocIdxType;
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/downloader/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub enum RequestType {
PixelMetadata(PixelMetadataRequest),
Moc(MOCRequest), //..
}
use super::query::Url;

use crate::downloader::QueryId;
impl RequestType {
pub fn id(&self) -> &QueryId {
Expand Down
1 change: 0 additions & 1 deletion src/core/src/downloader/request/tile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::downloader::query;
use al_core::image::ImageType;

use super::{Request, RequestType};
use crate::downloader::query::Query;
use crate::downloader::QueryId;

pub struct TileRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/grid/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Label {
options: LabelOptions,
camera: &CameraViewPort,
projection: &ProjectionType,
fmt: &SerializeFmt,
_fmt: &SerializeFmt,
) -> Option<Self> {
let fov = camera.get_field_of_view();
let d = if fov.contains_north_pole() {
Expand Down
6 changes: 2 additions & 4 deletions src/core/src/grid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use crate::ProjectionType;
use al_api::color::ColorRGBA;

use al_api::grid::GridCfg;
use cgmath::InnerSpace;

use crate::grid::label::Label;
pub struct ProjetedGrid {
Expand Down Expand Up @@ -218,21 +217,20 @@ impl ProjetedGrid {
.flatten()
.map(|vertices| PathVertices { vertices });

let m = camera.get_screen_size().magnitude();
rasterizer.add_stroke_paths(paths, self.thickness, &self.color, &self.line_style);

Ok(())
}

pub fn draw_labels(&mut self, camera: &CameraViewPort) -> Result<(), JsValue> {
pub fn draw_labels(&mut self) -> Result<(), JsValue> {
if self.enabled && self.show_labels {
let labels = self
.meridians
.iter()
.filter_map(|m| m.get_label())
.chain(self.parallels.iter().filter_map(|p| p.get_label()));

let dpi = camera.get_dpi();
//let dpi = camera.get_dpi();
self.text_renderer.begin();
for Label {
content,
Expand Down
1 change: 1 addition & 0 deletions src/core/src/healpix/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ pub fn nside2depth(nside: u32) -> u8 {
crate::math::utils::log_2_unchecked(nside) as u8
}

#[cfg(test)]
mod tests {
use super::HEALPixCell;

Expand Down
2 changes: 1 addition & 1 deletion src/core/src/healpix/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::math::lonlat::LonLatT;
use crate::math::PI;
use crate::math::{self, lonlat::LonLat};

use cgmath::{Vector3, Vector4};
use cgmath::{Vector4};
use moclib::{
moc::range::{CellSelection, RangeMOC},
qty::Hpx,
Expand Down
1 change: 1 addition & 0 deletions src/core/src/healpix/index_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impl IdxVec {
}

// Create an index vector from a list of segments
#[allow(unused)]
pub fn from_great_circle_arc(arcs: &mut [GreatCircleArc]) -> Self {
arcs.sort_unstable_by(|a1, a2| {
let bbox1 = a1.get_containing_hpx_cell();
Expand Down
Loading

0 comments on commit 6df2ee9

Please sign in to comment.