add entry point for AladinUtils object

This commit is contained in:
Matthieu Baumann
2024-03-22 15:12:02 +01:00
parent 7ad1e56912
commit 856fc84025
10 changed files with 46 additions and 26 deletions

View File

@@ -6,14 +6,18 @@
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<div id='aladin-statsDiv'></div>
<script>let aladin, hips</script>
<script type="module">
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {cooFrame: 'galactic', target: 'galactic center', survey: 'P/Finkbeiner'});
// possible values are 'blues', 'cividis', 'cubehelix', 'eosb', 'grayscale', 'inferno', 'magma', 'native', 'parula', 'plasma', 'rainbow',
// 'rdbu', 'rdylbu', 'redtemperature', 'sinebow', 'spectral', 'summer', 'viridis', 'ylgnbu' and 'ylorbr'
aladin.getBaseImageLayer().setColormap("cubehelix");
hips = aladin.getBaseImageLayer()
hips.setColormap("cubehelix");
aladin.setImageSurvey('astron.nl/P/lotss_dr2_high')
//aladin.getBaseImageLayer().setColor([1.0, 0.0, 1.0, 1.0], { tf: 'Linear'} );
});
</script>

View File

@@ -10,9 +10,9 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, target: "Abell 194", fov: 180, projection: 'SIN', showContextMenu: true});
A.catalogFromSKAORucio("m51", 90, {onClick: 'showTable'}, (cat) => {
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, target: "Abell 194", fov: 180, projection: 'AIT', showContextMenu: true});
aladin.setImageSurvey('astron.nl/P/lotss_dr2_high')
A.catalogFromSKAORucio("Abell 194", 90, {onClick: 'showTable'}, (cat) => {
aladin.addCatalog(cat);
});

View File

@@ -5,8 +5,6 @@
<body>
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<div id='aladin-statsDiv'></div>
<script type="module">
import A from '../src/js/A.js';

View File

@@ -6,9 +6,10 @@
<body>
<div id="aladin-lite-div" style="width: 500px; height: 500px"></div>
<script type="text/javascript" src="./../dist/aladin.umd.cjs" charset="utf-8"></script>
<script type="text/javascript" src="https://aladin.cds.unistra.fr/AladinLite/alpha/aladin.js" charset="utf-8"></script>
<script type="text/javascript">
var aladin;
console.log(A.AladinUtils.HEALPix)
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, cooFrame: "ICRSd", showSimbadPointerControl: true, showShareControl: true, showShareControl: true, survey: 'https://alasky.cds.unistra.fr/DSS/DSSColor/', fov: 180, showContextMenu: true});
// manage URL parameters
@@ -40,6 +41,11 @@
enabled: b
});
}
A.catalogFromSKAORucio("Abell 194", 90, {onClick: 'showTable'}, (cat) => {
aladin.addCatalog(cat);
});
});
</script>

View File

@@ -100,7 +100,6 @@ impl TileFetcherQueue {
//Request the allsky for the small tile size or if base tiles are not available
if tile_size <= 128 || cfg.get_min_depth_tile() > 0 {
// Request the allsky
use al_core::log::console_log;
downloader.fetch(query::Allsky::new(cfg));
}
/*else {

View File

@@ -2,9 +2,8 @@ body { overscroll-behavior: contain; }
.aladin-container {
position: relative;
border: 1px solid #ddd;
height: 100%;
border: 1px solid #ddd;
/* disable x swipe on chrome, firefox */
/* see. https://stackoverflow.com/questions/30636930/disable-web-page-navigation-on-swipeback-and-forward */

View File

@@ -43,6 +43,8 @@ import { Footprint } from './Footprint.js';
import { Aladin } from "./Aladin.js";
import { ActionButton } from "./gui/Widgets/ActionButton.js";
import { Box } from "./gui/Widgets/Box.js";
import { AladinUtils } from "./AladinUtils.js";
// Wasm top level import
import init, * as module from './../core/pkg';
@@ -821,6 +823,19 @@ A.getAvailableListOfColormaps = function() {
return ColorCfg.COLORMAPS;
};
/**
* Returns utils object
*
* This contains utilitary methods such as HEALPix basic or projection methods.
*
* @function
* @memberof A
* @name Utils
*
* @returns {AladinUtils} Returns a new box window object.
*/
A.Utils = AladinUtils;
/**
* Initializes the Aladin Lite library, checking for WebGL2 support.
* This method must be called before instancing an Aladin Lite object.

View File

@@ -213,12 +213,12 @@ export let Aladin = (function () {
this.options = options;
this.reduceDeformations = true;
// parent div
aladinDiv.classList.add("aladin-container");
// Init the measurement table
this.measurementTable = new MeasurementTable(this);
// parent div
aladinDiv.classList.add("aladin-container");
// set different options
// Reticle
this.view = new View(this);

View File

@@ -27,8 +27,6 @@
* Author: Thomas Boch[CDS]
*
*****************************************************************************/
import { HPXVertices } from "../core/pkg/core";
import A from "./A";
import { Aladin } from "./Aladin";
/**

View File

@@ -195,7 +195,6 @@ export let View = (function () {
this.empty = true;
//this.fixLayoutDimensions();
this.promises = [];
this.firstHiPS = true;
this.curNorder = 1;
@@ -229,18 +228,20 @@ export let View = (function () {
self.fixLayoutDimensions();
})
} else {*/
let resizeLayout = () => {
self.fixLayoutDimensions();
}
let doit;
this.resizeObserver = new ResizeObserver(() => {
clearTimeout(doit);
doit = setTimeout(resizeLayout, 100);
});
let resizeLayout = () => {
self.fixLayoutDimensions();
}
self.resizeObserver.observe(this.aladinDiv);
let doit;
this.resizeObserver = new ResizeObserver(() => {
clearTimeout(doit);
doit = setTimeout(resizeLayout, 100);
});
self.resizeObserver.observe(this.aladinDiv);
//}
/**/
this.throttledPositionChanged = Utils.throttle(
@@ -349,10 +350,10 @@ export let View = (function () {
// The WebGL backend is resized
View.prototype.fixLayoutDimensions = function () {
Utils.cssScale = undefined;
var computedWidth = parseFloat(window.getComputedStyle(this.aladinDiv).width) || 1.0;
var computedHeight = parseFloat(window.getComputedStyle(this.aladinDiv).height) || 1.0;
console.log(this.height, computedHeight)
this.width = Math.max(computedWidth, 1);
this.height = Math.max(computedHeight, 1); // this prevents many problems when div size is equal to 0