Skip to content

Commit

Permalink
Merge pull request #113 from cds-astro/features/lineRasterizer
Browse files Browse the repository at this point in the history
Features/line rasterizer
  • Loading branch information
bmatthieu3 authored Aug 12, 2023
2 parents 7cfbb83 + a4e4ec8 commit 6c4ddce
Show file tree
Hide file tree
Showing 112 changed files with 7,240 additions and 4,897 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ package-lock.json
src/core/target/
src/core/Cargo.lock

AladinLiteAssets.tar.gz
aladin-lite-3.1.0.tgz

.vscode
6 changes: 3 additions & 3 deletions examples/al-coronelli.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<body>

<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>

<script type="text/javascript">
let aladin;
</script>
<div id="aladin-lite-div" style="width:100vw;height:100vh;">
<div id="calibCircle" style="display: none;"></div>
<div id="explain" class="aladin-box"></div>
Expand Down Expand Up @@ -225,8 +227,6 @@

<script type="module">
import A from '../src/js/A.js';

let aladin;
A.init.then(() => {
var hipsDir="http://alasky.u-strasbg.fr/CDS_P_Coronelli";
aladin = A.aladin("#aladin-lite-div", {showSimbadPointerControl: true, realFullscreen: true, fov: 100, allowFullZoomout: true, showReticle: false });
Expand Down
2 changes: 1 addition & 1 deletion examples/al-easy-access-vizier.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: 'M 45', fov: 5});
aladin = A.aladin('#aladin-lite-div', {target: 'M 45', fov: 5, showContextMenu: true});
const cat = A.catalogFromVizieR('I/311/hip2', 'M 45', 5, {onClick: 'showTable'});
aladin.addCatalog(cat);
});
Expand Down
2 changes: 1 addition & 1 deletion examples/al-ellipse.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
let aladin;
A.init.then(() => {
// Start up Aladin Lite
aladin = A.aladin('#aladin-lite-div', {survey: "CDS/P/DSS2/color", target: 'M 31', fov: 0.2});
aladin = A.aladin('#aladin-lite-div', {survey: "CDS/P/DSS2/color", target: 'M 31', fov: 3});
var overlay = A.graphicOverlay({color: '#ee2345', lineWidth: 3});
aladin.addOverlay(overlay);
overlay.addFootprints([
Expand Down
23 changes: 23 additions & 0 deletions examples/al-eso-catalogs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<html>
<head>
</head>
<body>

<div id="aladin-lite-div" style="width: 500px; height: 400px"></div>

<script type="module">
import A from '../src/js/A.js';
var vmc_cepheids = 'https://archive.eso.org/tap_cat/sync?REQUEST=doQuery&LANG=ADQL&MAXREC=401&FORMAT=votable&QUERY=SELECT%20*%20from%20vmc_er4_yjks_cepheidCatMetaData_fits_V3%20where%20%20CONTAINS(POINT(%27%27,RA2000,DEC2000),%20CIRCLE(%27%27,80.894167,-69.756111,2.7))=1';
var pessto = 'https://archive.eso.org/tap_cat/sync?REQUEST=doQuery&LANG=ADQL&MAXREC=3&FORMAT=votable&QUERY=SELECT%20*%20from%20safcat.PESSTO_TRAN_CAT_V3%20where%20CONTAINS(POINT(%27%27,TRANSIENT_RAJ2000,TRANSIENT_DECJ2000),%20CIRCLE(%27%27,80.894167,-69.756111,2.7))=1';

var aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: 'P/DSS2/red', target: 'LMC', fov: 5});
aladin.addCatalog(A.catalogFromURL('https://vizier.u-strasbg.fr/viz-bin/votable?-source=HIP2&-c=LMC&-out.add=_RAJ,_DEJ&-oc.form=dm&-out.meta=DhuL&-out.max=9999&-c.rm=180', {sourceSize:12, color: '#f08080'}));
aladin.addCatalog(A.catalogFromURL(vmc_cepheids, {onClick: 'showTable', sourceSize:14, color: '#fff080'}));
aladin.addCatalog(A.catalogFromURL(pessto, {onClick: 'showPopup', sourceSize:14, color: '#00f080'}), undefined, true);
});
</script>
</body>
</html>
5 changes: 2 additions & 3 deletions examples/al-event-listeners.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
var aladin = A.aladin('#aladin-lite-div', {target: '05 37 58 +08 17 35', fov: 12, backgroundColor: 'rgb(120, 0, 0)'});
var cat = A.catalog({sourceSize: 20});
aladin.addCatalog(cat);
cat.addSources([A.source(83.784490, 09.934156, {name: 'Meissa'}), A.source(88.792939, 7.407064, {name: 'Betelgeuse'}), A.source(81.282764, 6.349703, {name: 'Bellatrix'})]);
cat.addSources([A.source(83.784490, 9.934156, {name: 'Meissa'}), A.source(88.792939, 7.407064, {name: 'Betelgeuse'}), A.source(81.282764, 6.349703, {name: 'Bellatrix'})]);
var msg;

// define function triggered when a source is hovered
aladin.on('objectHovered', function(object) {
var msg;
if (object) {
msg = 'You hovered object ' + object.data.name + ' located at ' + object.ra + ', ' + object.dec;
}
Expand All @@ -37,7 +37,6 @@
// define function triggered when an object is clicked
var objClicked;
aladin.on('objectClicked', function(object) {
var msg;
if (object) {
objClicked = object;
object.select();
Expand Down
8 changes: 4 additions & 4 deletions examples/al-gaiadr3.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<form class="pure-form pure-form-stacked">
<fieldset>
<label for="option-gdr3-flux-color-map" class="pure-radio">
<input id="option-gdr3-flux-color-map" type="radio" name="img-hips" value="CDS/P/DM/flux-color-Rp-G-Bp/I/350/gaiaedr3" checked>
<input id="option-gdr3-flux-color-map" type="radio" name="img-hips" value="CDS/P/DM/flux-color-Rp-G-Bp/I/350/gaiaedr3">
Gaia DR3 flux map
</label>
<label for="option-gdr3-density-map" class="pure-radio">
<input id="option-gdr3-density-map" type="radio" name="img-hips" value="CDS/P/DM/I/350/gaiaedr3">
<input id="option-gdr3-density-map" type="radio" name="img-hips" value="CDS/P/DM/I/350/gaiaedr3" checked>
Gaia DR3 density map
</label>
<label for="option-DSS-map" class="pure-radio">
Expand Down Expand Up @@ -50,7 +50,7 @@
const fluxMap = aladin.createImageSurvey('gdr3-color-flux-map', 'Gaia DR3 flux map', 'https://alasky.u-strasbg.fr/ancillary/GaiaEDR3/color-Rp-G-Bp-flux-map', 'equatorial', 7);
const densityMap = aladin.createImageSurvey('gdr3-density-map', 'Gaia DR3 density map', 'https://alasky.u-strasbg.fr/ancillary/GaiaEDR3/density-map', 'equatorial', 7, {imgFormat: 'fits'});

aladin.setImageSurvey(fluxMap);
aladin.setImageSurvey(densityMap);

var hipsCats = {
//'gdr3': A.catalogHiPS('https://axel.u-strasbg.fr/HiPSCatService/I/355/gaiadr3', { name: 'Gaia DR3 sources', shape: 'circle', sourceSize: 8, color: '#d66bae' }),
Expand All @@ -62,7 +62,7 @@
aladin.addCatalog(hipsCats['simbad']);
//aladin.addCatalog(hipsCats['gdr3']);

cmDensMapChanged = false;
//cmDensMapChanged = false;
// listen changes on HiPS image background selection
$('input[type=radio][name=img-hips]').change(function () {
if (this.value == 'CDS/P/DM/I/350/gaiaedr3') {
Expand Down
10 changes: 5 additions & 5 deletions examples/al-gw.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {projection: "TAN", target: '15 16 57.636 -60 55 7.49', showCooGrid: true, fov: 90});
aladin = A.aladin('#aladin-lite-div', {projection: "TAN", target: '15 16 57.636 -60 55 7.49', showCooGrid: true, fov: 90, fullScreen: true});

var moc_0_99 = A.MOCFromURL("./gw/gw_0.9.fits",{ name: "GW 90%", color: "#ff0000", opacity: 0.5, lineWidth: 1, adaptativeDisplay: true});
var moc_0_95 = A.MOCFromURL("./gw/gw_0.6.fits",{ name: "GW 60%", color: "#00ff00", opacity: 0.5, lineWidth: 1, adaptativeDisplay: true});
var moc_0_5 = A.MOCFromURL("./gw/gw_0.3.fits",{ name: "GW 30%", color: "#00ffff", opacity: 0.5, lineWidth: 1, adaptativeDisplay: false});
var moc_0_2 = A.MOCFromURL("./gw/gw_0.1.fits",{ name: "GW 10%", color: "#ff00ff", opacity: 0.5, lineWidth: 1, adaptativeDisplay: false});
var moc_0_99 = A.MOCFromURL("./gw/gw_0.9.fits",{ name: "GW 90%", color: "#ff0000", opacity: 0.7, lineWidth: 5, perimeter: true});
var moc_0_95 = A.MOCFromURL("./gw/gw_0.6.fits",{ name: "GW 60%", color: "#00ff00", opacity: 0.8, lineWidth: 5, perimeter: true});
var moc_0_5 = A.MOCFromURL("./gw/gw_0.3.fits",{ name: "GW 30%", color: "#00ffff", opacity: 1.0, lineWidth: 5, perimeter: true});
var moc_0_2 = A.MOCFromURL("./gw/gw_0.1.fits",{ name: "GW 10%", color: "#ff00ff", opacity: 1.0, lineWidth: 5, perimeter: true});

aladin.addMOC(moc_0_99);
aladin.addMOC(moc_0_95);
Expand Down
4 changes: 2 additions & 2 deletions examples/al-hips-local.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: 'galactic center'});

let hsc = aladin.createImageSurvey('hips gaia', "hips gaia name", "./hips/gaia/", undefined, undefined, {colormap:"viridis"});
aladin.setBaseImageLayer(hsc);
let survey = aladin.createImageSurvey('hips gaia', "hips gaia name", "./hips/gaia", undefined, undefined, {colormap:"viridis"});
aladin.setBaseImageLayer(survey);
});
</script>

Expand Down
3 changes: 3 additions & 0 deletions examples/al-moc-json.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"7":[131423,131439,131443,131523,131556,131557,131580,131581,132099,132612,132613,132624,132625,132627,132637,
132680,132681,132683,132709,132720,132721,132904,132905,132948,132952,132964,132968,133008,133009,133012,135252,135256,135268,135316,135320,135332,135336,148143,148152,148154,149507,149520
,149522,149523,149652,149654,149660,149662,149684,149686,149692,149694,149695,150120,150122,150208,150210,150216,150218,150240,150242,150243,155748,155752,155796,155800,155812,155816]};
//var json = {"3":[517],
//"4":[2065, 2067]};

var moc = A.MOCFromJSON(json, {opacity: 0.25, color: 'magenta', lineWidth: 1, adaptativeDisplay: false});
aladin.addMOC(moc);
});
Expand Down
6 changes: 3 additions & 3 deletions examples/al-moc-sdss9.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: '00 00 00 +07 00 00', fov: 130, survey: 'P/Mellinger/color'});
var moc11 = A.MOCFromURL('http://skies.esac.esa.int/HST/NICMOS/Moc.fits', {color: '#84f', lineWidth: 1, opacity: 1.0}, (moc) => {
var moc11 = A.MOCFromURL('http://skies.esac.esa.int/HST/NICMOS/Moc.fits', {color: '#84f', lineWidth: 3, opacity: 1.0}, (moc) => {
// moc is ready
console.log(moc.contains(205.9019247, +2.4492764));
console.log(moc.contains(-205.9019247, +2.4492764));

});
var moc10 = A.MOCFromURL('https://alasky.unistra.fr/MocServer/query?ivorn=ivo%3A%2F%2FCDS%2FV%2F139%2Fsdss9&get=moc&order=11&fmt=fits', {color: '#aabbcc', opacity: 0.1, lineWidth: 1});
var moc9 = A.MOCFromURL('https://alasky.unistra.fr/MocServer/query?ivorn=ivo%3A%2F%2FCDS%2FV%2F139%2Fsdss9&get=moc&order=4&fmt=fits', {color: '#00ff00', opacity: 0.5, lineWidth: 1});
var moc10 = A.MOCFromURL('https://alasky.unistra.fr/MocServer/query?ivorn=ivo%3A%2F%2FCDS%2FV%2F139%2Fsdss9&get=moc&order=11&fmt=fits', {color: '#ffffff', perimeter: true, fillColor: '#aabbcc', opacity: 0.1, fill: true, lineWidth: 3});
var moc9 = A.MOCFromURL('https://alasky.unistra.fr/MocServer/query?ivorn=ivo%3A%2F%2FCDS%2FV%2F139%2Fsdss9&get=moc&order=4&fmt=fits', {color: '#00ff00', opacity: 0.5, lineWidth: 3, perimeter: true});

aladin.addMOC(moc11);
aladin.addMOC(moc10);
Expand Down
2 changes: 1 addition & 1 deletion examples/al-obscore.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: '14 18 16.868 +56 44 29.37', fov: 360, projection: 'AIT', showContextMenu: true});

const c1 = A.catalogFromURL('https://raw.githubusercontent.com/bmatthieu3/SKA-Discovery-Service-Mockup/aladin/ObsCore/ObsCore_003.xml', {onClick: 'showTable'});
const c1 = A.catalogFromURL('https://raw.githubusercontent.com/VisIVOLab/SKA-Discovery-Service-Mockup/main/ObsCore/ObsCore_003.xml', {onClick: 'showTable'});
aladin.addCatalog(c1);

const c2 = A.catalogFromVizieR('B/assocdata/obscore', '14 18 16.868 +56 44 29.37', 100, {onClick: 'showTable', limit: 1000});
Expand Down
2 changes: 1 addition & 1 deletion examples/al-stcs-footprints.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

A.init.then(() => {
// Start up Aladin Lite
aladin = A.aladin('#aladin-lite-div', {survey: "CDS/P/DSS2/color", target: 'Sgr a*', fov: 0.5});
let aladin = A.aladin('#aladin-lite-div', {survey: "CDS/P/DSS2/color", target: 'Sgr a*', fov: 0.5});
// This table contains a s_region column containing stcs expressed regions
// that are automatically parsed
aladin.addCatalog(A.catalogFromURL('https://aladin.cds.unistra.fr/AladinLite/doc/API/examples/data/alma-footprints.xml', {onClick: 'showTable'}));
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions src/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ members = [
crate-type = ["cdylib"]

[dependencies]
getrandom = {version="0.2", features = ["js"]}
rand = {version = "0.8.5", features = ["getrandom"]}
futures = "0.3.12"
js-sys = "0.3.47"
wasm-bindgen-futures = "0.4.20"
cgmath = "*"
cdshealpix = "0.6.4"
moclib = { package = "moc", version = "0.10.1" }
serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"
serde-wasm-bindgen = "0.4"
healpix = { package = "cdshealpix", git = "https://github.com/bmatthieu3/cds-healpix-rust", branch = "polygonIntersectVertices" }
#moclib = { package = "moc", git = "https://github.com/cds-astro/cds-moc-rust", branch = "main" }
moclib = { package = "moc", git = "https://github.com/bmatthieu3/cds-moc-rust", branch = "cellsWithUnidirectionalNeigs" }
serde = { version = "^1.0.183", features = ["derive"] }
serde_json = "1.0.104"
serde-wasm-bindgen = "0.5"
console_error_panic_hook = "0.1.7"
enum_dispatch = "0.3.8"
wasm-bindgen = "0.2.79"
Expand All @@ -42,7 +41,8 @@ fitsrs = "0.2.9"
wcs = "0.2.8"
colorgrad = "0.6.2"
image-decoder = { package = "image", version = "0.24.2", default-features = false, features = ["jpeg", "png"] }
votable = "0.2.3"
votable = { package = "votable", git = "https://github.com/cds-astro/cds-votable-rust", branch = "main"}
lyon = "1.0.1"

[features]
webgl1 = [
Expand Down
13 changes: 6 additions & 7 deletions src/core/al-api/src/color.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
use wasm_bindgen::prelude::*;

#[wasm_bindgen(raw_module = "../../js/Color")]
#[wasm_bindgen(raw_module = "../../js/Color.js")]
extern "C" {
pub type Color;

#[wasm_bindgen(static_method_of = Color)]
pub fn hexToRgb(hex: String) -> JsValue;
#[wasm_bindgen(static_method_of = Color)]
pub fn hexToRgba(hex: String) -> JsValue;
#[wasm_bindgen(static_method_of = Color)]
pub fn rgbToHex(r: u8, g: u8, b: u8) -> String;
}

#[derive(Debug, Clone, Copy)]
#[derive(Deserialize, Serialize)]
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
#[wasm_bindgen]
pub struct ColorRGB {
pub r: f32,
Expand All @@ -20,8 +21,7 @@ pub struct ColorRGB {
}

use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy)]
#[derive(Deserialize, Serialize)]
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
#[wasm_bindgen]
pub struct ColorRGBA {
Expand All @@ -45,7 +45,6 @@ impl<'a> Mul<f32> for &'a ColorRGB {
}
}


/*
#[wasm_bindgen]
impl Color {
Expand Down Expand Up @@ -96,4 +95,4 @@ impl TryFrom<JsValue> for ColorRGBA {

Ok(c)
}
}
}
2 changes: 1 addition & 1 deletion src/core/al-api/src/coo_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub const NUM_COOSYSTEM: usize = 2;

impl CooSystem {
#[inline]
pub fn to<S>(&self, coo_system: &Self) -> &Matrix4<S>
pub fn to<S>(&self, coo_system: Self) -> &Matrix4<S>
where
S: BaseFloat + CooBaseFloat,
{
Expand Down
6 changes: 6 additions & 0 deletions src/core/al-api/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use super::color::ColorRGB;
pub struct GridCfg {
#[serde(default = "default_color")]
pub color: Option<ColorRGB>,
#[serde(default = "default_thickness")]
pub thickness: Option<f32>,
pub opacity: Option<f32>,
#[serde(default = "default_labels")]
pub show_labels: Option<bool>,
Expand Down Expand Up @@ -39,6 +41,10 @@ fn default_label_size() -> Option<f32> {
None
}

fn default_thickness() -> Option<f32> {
None
}

fn default_fmt() -> Option<AngleSerializeFmt> {
None
}
Loading

0 comments on commit 6c4ddce

Please sign in to comment.