Compare commits
39 Commits
hips_3d
...
v3.7.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdc1733c4f | ||
|
|
6e40dbbfc1 | ||
|
|
e03b16119b | ||
|
|
e3162426be | ||
|
|
5a285dabed | ||
|
|
2d04730623 | ||
|
|
390c9096d7 | ||
|
|
0e9998a7fc | ||
|
|
22cfc972e2 | ||
|
|
a1386c2a13 | ||
|
|
7bdf0cc912 | ||
|
|
634d652c54 | ||
|
|
a10699c271 | ||
|
|
52b0b6fc4f | ||
|
|
9739b87439 | ||
|
|
9db098ce6a | ||
|
|
b35f79ad0a | ||
|
|
6cab5f9efd | ||
|
|
556388e260 | ||
|
|
e186713aa1 | ||
|
|
97995834bf | ||
|
|
11a87901e1 | ||
|
|
5948e6063b | ||
|
|
a91b2154a1 | ||
|
|
c6c17f0ba2 | ||
|
|
6879c22b02 | ||
|
|
48802d4494 | ||
|
|
5c6405bf8b | ||
|
|
e4689cf674 | ||
|
|
a4fad91abf | ||
|
|
0462a451b3 | ||
|
|
1dca5b1845 | ||
|
|
d73cc1c66d | ||
|
|
560696a6e1 | ||
|
|
258bc47d47 | ||
|
|
729f86066e | ||
|
|
86002f3e89 | ||
|
|
9ea92b3bff | ||
|
|
f9722a69ff |
22
examples/al-customize-share-url-fn.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, height=device-height, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
|
||||
</head>
|
||||
<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">
|
||||
var aladin;
|
||||
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: 1.0, target: 'M 20', showContextMenu: true});
|
||||
|
||||
// customize share URL function
|
||||
aladin.customizeShareURLFunction(() => {return 'https://sky.esa.int/esasky/?target=' + aladin.getRaDec()[0] + '%20' + aladin.getRaDec()[1] + '&fov=' + aladin.getFoV()[0]})
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,7 +16,7 @@
|
||||
showSimbadPointerControl: true,
|
||||
projection: 'AIT', // set a projection
|
||||
fov: 8.0, // initial field of view in degrees
|
||||
target: '00 42 21.37 +41 07 29.8', // initial target
|
||||
target: '10.6875598 +41.1402170', // initial target
|
||||
cooFrame: 'icrs', // set galactic frame
|
||||
reticleColor: '#ff89ff', // change reticle color
|
||||
showContextMenu: true,
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
});
|
||||
|
||||
aladin.addCatalog(A.catalogFromVizieR("B/assocdata/obscore", "0 +0", 20, {onClick: 'showTable', hoverColor: 'yellow', limit: 1000}))
|
||||
aladin.addCatalog(A.catalogFromSKAORucio("0 +0", 70, {onClick: 'showTable', hoverColor: 'yellow', limit: 1000}))
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
let bValues = [];
|
||||
|
||||
let i = 0;
|
||||
for(var [r, g, b] of base.probe({type: 'line', x1: p.a.x, y1: p.a.y, x2: p.b.x, y2: p.b.y})) {
|
||||
for(var [r, g, b] of base.probePixels({type: 'line', x1: p.a.x, y1: p.a.y, x2: p.b.x, y2: p.b.y})) {
|
||||
xValues.push(i)
|
||||
rValues.push(r)
|
||||
gValues.push(g)
|
||||
|
||||
@@ -91,7 +91,7 @@ impl Texture2DArray {
|
||||
|
||||
// Attach the texture as the first color attachment
|
||||
self.gl.framebuffer_texture_layer(
|
||||
WebGlRenderingCtx::READ_FRAMEBUFFER,
|
||||
WebGlRenderingCtx::FRAMEBUFFER,
|
||||
WebGlRenderingCtx::COLOR_ATTACHMENT0,
|
||||
self.texture.as_ref(),
|
||||
0,
|
||||
|
||||
@@ -203,5 +203,3 @@ impl PixelType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub const NUM_CHANNELS: usize = 6;
|
||||
|
||||
@@ -311,7 +311,7 @@ impl Texture2D {
|
||||
// Attach the texture as the first color attachment
|
||||
//self.attach_to_framebuffer();
|
||||
self.gl.framebuffer_texture_2d(
|
||||
WebGlRenderingCtx::READ_FRAMEBUFFER,
|
||||
WebGlRenderingCtx::FRAMEBUFFER,
|
||||
WebGlRenderingCtx::COLOR_ATTACHMENT0,
|
||||
WebGlRenderingCtx::TEXTURE_2D,
|
||||
self.texture.as_ref(),
|
||||
|
||||
@@ -21,32 +21,6 @@ pub trait Pixel:
|
||||
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue>;
|
||||
}
|
||||
|
||||
impl Pixel for [f32; 1] {
|
||||
type Item = f32;
|
||||
type Container = ArrayF32;
|
||||
const BLACK: Self = [f32::NAN];
|
||||
|
||||
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
|
||||
let p = js_sys::Uint8Array::new_with_length(4);
|
||||
gl.read_pixels_with_opt_array_buffer_view(
|
||||
x,
|
||||
y,
|
||||
1,
|
||||
1,
|
||||
WebGlRenderingCtx::RGBA,
|
||||
WebGlRenderingCtx::UNSIGNED_BYTE,
|
||||
Some(&p),
|
||||
)?;
|
||||
|
||||
Ok([f32::from_le_bytes([
|
||||
p.at(0).unwrap(),
|
||||
p.at(1).unwrap(),
|
||||
p.at(2).unwrap(),
|
||||
p.at(3).unwrap(),
|
||||
])])
|
||||
}
|
||||
}
|
||||
|
||||
impl Pixel for [u8; 4] {
|
||||
type Item = u8;
|
||||
type Container = ArrayU8;
|
||||
@@ -74,13 +48,13 @@ impl Pixel for [u8; 3] {
|
||||
const BLACK: Self = [0, 0, 0];
|
||||
|
||||
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
|
||||
let pixels = js_sys::Uint8Array::new_with_length(3);
|
||||
let pixels = js_sys::Uint8Array::new_with_length(4);
|
||||
gl.read_pixels_with_opt_array_buffer_view(
|
||||
x,
|
||||
y,
|
||||
1,
|
||||
1,
|
||||
WebGlRenderingCtx::RGB,
|
||||
WebGlRenderingCtx::RGBA,
|
||||
WebGlRenderingCtx::UNSIGNED_BYTE,
|
||||
Some(&pixels),
|
||||
)?;
|
||||
@@ -147,7 +121,7 @@ impl Pixel for [i16; 1] {
|
||||
Some(&p),
|
||||
)?;
|
||||
|
||||
Ok([i16::from_le_bytes([p.at(0).unwrap(), p.at(1).unwrap()])])
|
||||
Ok([i16::from_le_bytes([p.at(1).unwrap(), p.at(0).unwrap()])])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,10 +143,36 @@ impl Pixel for [i32; 1] {
|
||||
)?;
|
||||
|
||||
Ok([i32::from_le_bytes([
|
||||
p.at(0).unwrap(),
|
||||
p.at(1).unwrap(),
|
||||
p.at(2).unwrap(),
|
||||
p.at(3).unwrap(),
|
||||
p.at(2).unwrap(),
|
||||
p.at(1).unwrap(),
|
||||
p.at(0).unwrap(),
|
||||
])])
|
||||
}
|
||||
}
|
||||
|
||||
impl Pixel for [f32; 1] {
|
||||
type Item = f32;
|
||||
type Container = ArrayF32;
|
||||
const BLACK: Self = [f32::NAN];
|
||||
|
||||
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
|
||||
let p = js_sys::Uint8Array::new_with_length(4);
|
||||
gl.read_pixels_with_opt_array_buffer_view(
|
||||
x,
|
||||
y,
|
||||
1,
|
||||
1,
|
||||
WebGlRenderingCtx::RGBA,
|
||||
WebGlRenderingCtx::UNSIGNED_BYTE,
|
||||
Some(&p),
|
||||
)?;
|
||||
|
||||
Ok([f32::from_le_bytes([
|
||||
p.at(3).unwrap(),
|
||||
p.at(2).unwrap(),
|
||||
p.at(1).unwrap(),
|
||||
p.at(0).unwrap(),
|
||||
])])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,12 +49,32 @@ impl WebGlContext {
|
||||
|
||||
#[cfg(feature = "webgl2")]
|
||||
{
|
||||
/*if let Ok(r) =
|
||||
get_extension::<web_sys::ExtColorBufferFloat>(&gl, "EXT_color_buffer_float")
|
||||
{
|
||||
let _ = r;
|
||||
}*/
|
||||
|
||||
let ctx = WebGlContext { inner: gl };
|
||||
Ok(ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn _get_extension<T>(context: &WebGlRenderingCtx, name: &str) -> Result<T, JsValue>
|
||||
where
|
||||
T: wasm_bindgen::JsCast,
|
||||
{
|
||||
// `unchecked_into` is used here because WebGL extensions aren't actually JS classes
|
||||
// these objects are duck-type representations of the actual Rust classes
|
||||
// https://github.com/rustwasm/wasm-bindgen/pull/1449
|
||||
context
|
||||
.get_extension(name)
|
||||
.ok()
|
||||
.and_then(|maybe_ext| maybe_ext.map(|ext| ext.unchecked_into::<T>()))
|
||||
.ok_or_else(|| JsValue::from_str("Failed to load ext"))
|
||||
}
|
||||
|
||||
use std::ops::Deref;
|
||||
impl Deref for WebGlContext {
|
||||
type Target = WebGlRenderingCtx;
|
||||
|
||||
@@ -96,11 +96,7 @@ impl Downloader {
|
||||
}
|
||||
|
||||
pub fn delay(&mut self, r: RequestType) {
|
||||
match r {
|
||||
RequestType::Tile(tile) => {
|
||||
self.cache.insert(tile.id.clone(), RequestType::Tile(tile));
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
let id = r.id().to_owned();
|
||||
self.cache.insert(id, r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,28 +83,30 @@ fn create_hpx_texture_storage(
|
||||
),
|
||||
];
|
||||
match channel {
|
||||
PixelType::RGBA8U => Texture2DArray::create_empty::<RGBA8U>(
|
||||
gl, tile_size, tile_size,
|
||||
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
|
||||
num_tiles, tex_params,
|
||||
),
|
||||
PixelType::RGB8U => Texture2DArray::create_empty::<RGB8U>(
|
||||
gl, tile_size, tile_size,
|
||||
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
|
||||
num_tiles, tex_params,
|
||||
),
|
||||
PixelType::RGBA8U => {
|
||||
Texture2DArray::create_empty::<RGBA8U>(
|
||||
gl, tile_size, tile_size,
|
||||
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
|
||||
num_tiles, tex_params,
|
||||
)
|
||||
}
|
||||
PixelType::RGB8U => {
|
||||
Texture2DArray::create_empty::<RGB8U>(
|
||||
gl, tile_size, tile_size,
|
||||
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
|
||||
num_tiles, tex_params,
|
||||
)
|
||||
}
|
||||
PixelType::R32F => Texture2DArray::create_empty::<R32F>(
|
||||
gl, tile_size, tile_size,
|
||||
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
|
||||
num_tiles, tex_params,
|
||||
),
|
||||
|
||||
PixelType::R8U => Texture2DArray::create_empty::<R8U>(
|
||||
gl, tile_size, tile_size,
|
||||
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
|
||||
num_tiles, tex_params,
|
||||
),
|
||||
|
||||
PixelType::R16I => Texture2DArray::create_empty::<R16I>(
|
||||
gl, tile_size, tile_size,
|
||||
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
|
||||
@@ -285,7 +287,7 @@ impl HiPS2DBuffer {
|
||||
.tile_pixels
|
||||
.read_pixel(pos_tex.x, pos_tex.y, pos_tex.z)?,
|
||||
_ => {
|
||||
let uvy = 1.0 - (pos_tex.y as f32 / tile_size);
|
||||
let uvy = 1.0 - (dx as f32);
|
||||
pos_tex.y = (uvy * tile_size) as i32;
|
||||
|
||||
let f64_v = self
|
||||
|
||||
126
src/js/Aladin.js
@@ -107,21 +107,21 @@ import { Polyline } from "./shapes/Polyline";
|
||||
* @property {boolean} [showCooGridControl=false] - Whether to show the coordinate grid control toolbar.
|
||||
* CSS class for that button is `aladin-grid-control`
|
||||
* @property {boolean} [showSettingsControl=false] - Whether to show the settings control toolbar.
|
||||
* CSS class for that button is `aladin-settings-control`
|
||||
* CSS class for that button is `aladin-settings-control`
|
||||
* @property {boolean} [showColorPickerControl=false] - Whether to show the color picker tool.
|
||||
* CSS class for that button is `aladin-colorPicker-control`
|
||||
* @property {boolean} [showShareControl=false] - Whether to show the share control toolbar.
|
||||
* CSS class for that button is `aladin-share-control`
|
||||
* CSS class for that button is `aladin-share-control`
|
||||
* @property {boolean} [showStatusBar=true] - Whether to show the status bar. Enabled by default.
|
||||
* CSS class for that button is `aladin-status-bar`
|
||||
* CSS class for that button is `aladin-status-bar`
|
||||
* @property {boolean} [showFrame=true] - Whether to show the viewport frame.
|
||||
* CSS class for that button is `aladin-cooFrame`
|
||||
* CSS class for that button is `aladin-cooFrame`
|
||||
* @property {boolean} [showFov=true] - Whether to show the field of view indicator.
|
||||
* CSS class for that button is `aladin-fov`
|
||||
* CSS class for that button is `aladin-fov`
|
||||
* @property {boolean} [showCooLocation=true] - Whether to show the coordinate location indicator.
|
||||
* CSS class for that button is `aladin-location`
|
||||
* CSS class for that button is `aladin-location`
|
||||
* @property {boolean} [showProjectionControl=true] - Whether to show the projection control toolbar.
|
||||
* CSS class for that button is `aladin-projection-control`
|
||||
* CSS class for that button is `aladin-projection-control`
|
||||
* @property {boolean} [showContextMenu=false] - Whether to show the context menu.
|
||||
* @property {boolean} [showReticle=true] - Whether to show the reticle.
|
||||
* @property {boolean} [showCatalog=true] - Whether to show the catalog.
|
||||
@@ -131,20 +131,20 @@ import { Polyline } from "./shapes/Polyline";
|
||||
* @property {boolean} [fullScreen=false] - Whether to start in full-screen mode.
|
||||
* @property {string} [reticleColor="rgb(178, 50, 178)"] - Color of the reticle in RGB format.
|
||||
* @property {number} [reticleSize=22] - Size of the reticle.
|
||||
*
|
||||
* @property {string} [gridColor="rgb(178, 50, 178)"] - Color of the grid in RGB format.
|
||||
*
|
||||
* @property {string} [gridColor="rgb(178, 50, 178)"] - Color of the grid in RGB format.
|
||||
* Is overshadowed by gridOptions.color if defined.
|
||||
* @property {number} [gridOpacity=0.8] - Opacity of the grid (0 to 1).
|
||||
* @property {number} [gridOpacity=0.8] - Opacity of the grid (0 to 1).
|
||||
* Is overshadowed by gridOptions.opacity if defined.
|
||||
* @property {Object} [gridOptions] - More options for the grid.
|
||||
* @property {string} [gridOptions.color="rgb(178, 50, 178)"] - Color of the grid. Can be specified as a named color
|
||||
* @property {string} [gridOptions.color="rgb(178, 50, 178)"] - Color of the grid. Can be specified as a named color
|
||||
* (see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/named-color| named colors}),
|
||||
* as rgb (ex: "rgb(178, 50, 178)"), or as a hex color (ex: "#86D6AE").
|
||||
* as rgb (ex: "rgb(178, 50, 178)"), or as a hex color (ex: "#86D6AE").
|
||||
* @property {number} [gridOptions.thickness=2] - The thickness of the grid, in pixels.
|
||||
* @property {number} [gridOptions.opacity=0.8] - Opacity of the grid and labels. It is comprised between 0 and 1.
|
||||
* @property {boolean} [gridOptions.showLabels=true] - Whether the grid has labels.
|
||||
* @property {number} [gridOptions.labelSize=15] - The font size of the labels.
|
||||
*
|
||||
*
|
||||
* @property {string} [projection="SIN"] - Projection type. Can be 'SIN' for orthographic, 'MOL' for mollweide, 'AIT' for hammer-aitoff, 'ZEA' for zenital equal-area or 'MER' for mercator
|
||||
* @property {boolean} [longitudeReversed=false] - Longitude reverse axis flag. Set to true to reverse the longitude axis. This is especially needed for planetary survey visualization. Default is set to false.
|
||||
* @property {boolean} [log=true] - Whether to log events.
|
||||
@@ -155,7 +155,7 @@ import { Polyline } from "./shapes/Polyline";
|
||||
* @property {Object} [selector] - More options for the the selector.
|
||||
* @property {string} [selector.color] - Color of the selector, defaults to the color of the reticle. Can be a hex color or a function returning a hex color.
|
||||
* @property {number} [selector.lineWidth=2] - Width of the selector line.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* let aladin = A.aladin({
|
||||
target: 'galactic center',
|
||||
@@ -254,7 +254,7 @@ import { Polyline } from "./shapes/Polyline";
|
||||
|
||||
/**
|
||||
* @typedef {('select'|'objectsSelected'|'objectClicked'|'objectHovered'|'objectHoveredStop'|'footprintClicked'|'footprintHovered'|'positionChanged'|'zoomChanged'|'rotationChanged'|'click'|'rightClickMove'|'mouseMove'|'wheelTriggered'|'fullScreenToggled'|'cooFrameChanged'|'resizeChanged'|'projectionChanged'|'layerChanged')} EventListener
|
||||
*
|
||||
*
|
||||
* <ul>
|
||||
* <li>'positionChanged' is triggered when the view position has been changed. It gives the user the new center position of the view in ICRS frame. See {@link positionChangedParam}</li>
|
||||
* <li>'select' is <b>deprecated</b>, please use 'objectsSelected' instead.</li>
|
||||
@@ -285,6 +285,9 @@ export let Aladin = (function () {
|
||||
this.callbacksByEventName = {}; // we store the callback functions (on 'zoomChanged', 'positionChanged', ...) here
|
||||
this.hipsCache = new HiPSCache();
|
||||
|
||||
this.customShareURLFn = null;
|
||||
|
||||
|
||||
// check that aladinDiv exists, stop immediately otherwise
|
||||
if (!aladinDiv) {
|
||||
console.error(
|
||||
@@ -390,7 +393,7 @@ export let Aladin = (function () {
|
||||
this.createCatalogFromVOTable(options.catalogUrls[k]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Format the hipslist given by the user before storing it in the aladin objec
|
||||
this.hipsFavorites = [];
|
||||
let hipsList = [].concat(options.hipsList);
|
||||
@@ -768,7 +771,7 @@ export let Aladin = (function () {
|
||||
ui.toggle();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (realFullscreen) {
|
||||
// go to "real" full screen mode
|
||||
if (self.isInFullscreen) {
|
||||
@@ -895,14 +898,14 @@ export let Aladin = (function () {
|
||||
|
||||
/**
|
||||
* Read pixels inside the Aladin Lite canvas
|
||||
*
|
||||
*
|
||||
* @description
|
||||
* Returns the rgba pixels composing the current view.
|
||||
* Please keep in mind that this method returns the actual colors that you see in the screen, it is not intended to return values coming from the progenitors.
|
||||
* For a knowing exactly the values of a specific HiPS (e.g. the real FITS values from HiPS FITS tiles) please use the method {@link HiPS#readPixel}.
|
||||
*
|
||||
*
|
||||
* @memberof Aladin
|
||||
* @param {PixelProber[]|RectProber[]} [prober] - A prob object. Can be unique prober or a list of it. By default, the center of the view is probed, i.e. the pixel under the reticle.
|
||||
* @param {PixelProber[]|RectProber[]} [prober] - A prob object. Can be unique prober or a list of it. By default, the center of the view is probed, i.e. the pixel under the reticle.
|
||||
* @returns {ImageData} A {@link https://developer.mozilla.org/fr/docs/Web/API/ImageData| ImageData} JS object coming from the canvas probing. Its `data` field stores the byte pixel array containing a list of 4 bytes RGBA values.
|
||||
*/
|
||||
Aladin.prototype.readCanvas = function (prober) {
|
||||
@@ -1579,7 +1582,7 @@ export let Aladin = (function () {
|
||||
for (var ui of ui) {
|
||||
this.ui.push(ui);
|
||||
ui.attachTo(this.aladinDiv);
|
||||
|
||||
|
||||
// as the ui is pushed to the dom, setting position may need the aladin instance to work
|
||||
// so we recompute it
|
||||
if (ui.options) {
|
||||
@@ -1698,10 +1701,10 @@ export let Aladin = (function () {
|
||||
|
||||
/**
|
||||
* Remove a HiPS from the list of favorites.
|
||||
*
|
||||
* This send a event of type
|
||||
*
|
||||
* This send a event of type
|
||||
* FAVORITE_HIPS_LIST_UPDATED which can be listened to
|
||||
*
|
||||
*
|
||||
* @throws A warning when the asset is currently present in the view
|
||||
*
|
||||
* @memberof Aladin
|
||||
@@ -1728,7 +1731,7 @@ export let Aladin = (function () {
|
||||
}
|
||||
})
|
||||
|
||||
// a hips matches
|
||||
// a hips matches
|
||||
if (idx >= 0) {
|
||||
this.hipsFavorites.splice(idx, 1);
|
||||
// Send a change of favorites for the UI selector to adapt their optional list
|
||||
@@ -1738,11 +1741,11 @@ export let Aladin = (function () {
|
||||
|
||||
/**
|
||||
* Add a HiPS to the list of favorites.
|
||||
*
|
||||
* If already present it will not add it again. This send a event of type
|
||||
*
|
||||
* If already present it will not add it again. This send a event of type
|
||||
* FAVORITE_HIPS_LIST_UPDATED which can be listened to. Once added, the favorite list
|
||||
* will be sorted by the name of the hips.
|
||||
*
|
||||
*
|
||||
* @memberof Aladin
|
||||
* @param {HiPS} hips - The HiPS to add to the favorites
|
||||
*/
|
||||
@@ -1869,7 +1872,7 @@ export let Aladin = (function () {
|
||||
Aladin.prototype.newImageSurvey = function (id, options) {
|
||||
// a wrapper on createImageSurvey that aggregates all params in an options object
|
||||
return this.createImageSurvey(
|
||||
id,
|
||||
id,
|
||||
options && options.name,
|
||||
id,
|
||||
options && options.cooFrame,
|
||||
@@ -2046,7 +2049,7 @@ export let Aladin = (function () {
|
||||
if (cachedOptions) {
|
||||
imageLayer = A.HiPS(idOrUrl, cachedOptions);
|
||||
} else {
|
||||
// 2/ Not in the cache, then we create the hips from this url/id and
|
||||
// 2/ Not in the cache, then we create the hips from this url/id and
|
||||
// go to the case 3
|
||||
imageLayer = A.HiPS(idOrUrl);
|
||||
|
||||
@@ -2108,12 +2111,12 @@ export let Aladin = (function () {
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the view center to north pole angle in degrees. This is equivalent to getting the 3rd Euler angle
|
||||
*
|
||||
* @memberof Aladin
|
||||
*
|
||||
*
|
||||
* @returns {number} - Angle between the position center and the north pole
|
||||
*/
|
||||
Aladin.prototype.getRotation = function () {
|
||||
@@ -2122,7 +2125,7 @@ export let Aladin = (function () {
|
||||
|
||||
/**
|
||||
* Set the view center rotation in degrees
|
||||
*
|
||||
*
|
||||
* @deprecated Use Aladin.prototype.setRotation instead
|
||||
*
|
||||
* @memberof Aladin
|
||||
@@ -2135,9 +2138,9 @@ export let Aladin = (function () {
|
||||
* Get the view center to north pole angle in degrees. This is equivalent to getting the 3rd Euler angle
|
||||
*
|
||||
* @memberof Aladin
|
||||
*
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
*
|
||||
* @returns {number} - Angle between the position center and the north pole
|
||||
*/
|
||||
Aladin.prototype.getViewCenter2NorthPoleAngle = Aladin.prototype.getRotation;
|
||||
@@ -2303,7 +2306,7 @@ export let Aladin = (function () {
|
||||
|
||||
/**
|
||||
* Select specific objects in the view
|
||||
*
|
||||
*
|
||||
* @memberof Aladin
|
||||
* @param {?Array.<Source, Footprint, Circle, Ellipse, Polyline, Vector>} objects - If null is passed then nothing will be selected and sources already selected will be deselected
|
||||
*/
|
||||
@@ -2645,7 +2648,7 @@ export let Aladin = (function () {
|
||||
|
||||
// Reverse the Eq 9 from the WCS II paper from Mark Calabretta to obtain LONPOLE
|
||||
// function of CRVAL2 and native coordinates of the fiducial ref point, i.e. (phi_0, theta_0) = (0, 0)
|
||||
// for cylindrical projections
|
||||
// for cylindrical projections
|
||||
WCS.LONPOLE = Math.asin(Math.sin(dLon * toRad) * Math.cos(WCS.CRVAL2 * toRad)) * toDeg;
|
||||
|
||||
if (WCS.CRVAL2 < 0) {
|
||||
@@ -2725,7 +2728,7 @@ export let Aladin = (function () {
|
||||
if (frame instanceof string) {
|
||||
frame = CooFrameEnum.fromString(frame, CooFrameEnum.ICRS);
|
||||
}
|
||||
|
||||
|
||||
if (frame.label == CooFrameEnum.SYSTEMS.GAL) {
|
||||
frame = Aladin.wasmLibs.core.CooSystem.GAL;
|
||||
}
|
||||
@@ -2906,23 +2909,23 @@ export let Aladin = (function () {
|
||||
this.popup.hide();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the URL corresponding to the current view
|
||||
*
|
||||
* @memberof Aladin
|
||||
*
|
||||
* @returns {string} The URL allowing to share the current view
|
||||
// @API
|
||||
/*
|
||||
* return a URL allowing to share the current view
|
||||
*/
|
||||
Aladin.prototype.getShareURL = function () {
|
||||
var radec = this.getRaDec();
|
||||
var coo = new Coo();
|
||||
// do we have a custom share URL function set?
|
||||
if (this.customShareURLFn) {
|
||||
return this.customShareURLFn();
|
||||
}
|
||||
|
||||
const radec = this.getRaDec();
|
||||
const coo = new Coo();
|
||||
coo.prec = 7;
|
||||
coo.lon = radec[0];
|
||||
coo.lat = radec[1];
|
||||
|
||||
return (
|
||||
Aladin.URL_PREVIEWER +
|
||||
return Aladin.URL_PREVIEWER +
|
||||
"?target=" +
|
||||
encodeURIComponent(coo.format("s")) +
|
||||
"&fov=" +
|
||||
@@ -2930,10 +2933,25 @@ export let Aladin = (function () {
|
||||
"&survey=" +
|
||||
encodeURIComponent(
|
||||
this.getBaseImageLayer().id || this.getBaseImageLayer().rootUrl
|
||||
)
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Customize share URL creation
|
||||
* @memberof Aladin
|
||||
* @param {Function} [customShareURLFn] - The function that will be called when a user clicks on "Get view URL", to share with collaborators
|
||||
*
|
||||
* @example
|
||||
aladin.customizeShareURLFunction(() => {return 'https://sky.esa.int/esasky/?target=' + aladin.getRaDec()[0] + '%20' + aladin.getRaDec()[1] + '&fov=' + aladin.getFoV()[0]})
|
||||
*/
|
||||
Aladin.prototype.customizeShareURLFunction = function(customShareURLFn) {
|
||||
if (! typeof customShareURLFn === 'function') {
|
||||
this.customShareURLFn = null;
|
||||
}
|
||||
|
||||
this.customShareURLFn = customShareURLFn;
|
||||
}
|
||||
|
||||
// @API
|
||||
/*
|
||||
* return, as a string, the HTML embed code
|
||||
@@ -3148,7 +3166,7 @@ aladin.displayFITS(
|
||||
* Add a custom colormap from a list of colors
|
||||
*
|
||||
* @memberof Aladin
|
||||
*
|
||||
*
|
||||
* @returns - The list of all the colormap labels
|
||||
*/
|
||||
Aladin.prototype.getListOfColormaps = function() {
|
||||
@@ -3161,9 +3179,9 @@ aladin.displayFITS(
|
||||
* @memberof Aladin
|
||||
* @param {string} label - The label of the colormap
|
||||
* @param {string[]} colors - A list string colors
|
||||
*
|
||||
*
|
||||
* @example
|
||||
*
|
||||
*
|
||||
* aladin.addColormap('mycmap', ["lightblue", "red", "violet", "#ff00aaff"])
|
||||
*/
|
||||
Aladin.prototype.addColormap = function(label, colors) {
|
||||
|
||||
@@ -50,6 +50,7 @@ export class PolySelect extends FSM {
|
||||
|
||||
view.aladin.removeStatusBarMessage('selector')
|
||||
}
|
||||
|
||||
let btn;
|
||||
let mouseout = (params) => {
|
||||
let {e, coo} = params;
|
||||
@@ -215,7 +216,7 @@ export class PolySelect extends FSM {
|
||||
};
|
||||
|
||||
let fsm;
|
||||
if (Utils.hasTouchScreen()) {
|
||||
//if (Utils.hasTouchScreen()) {
|
||||
let mousedown = click;
|
||||
let mouseup = click;
|
||||
|
||||
@@ -259,7 +260,7 @@ export class PolySelect extends FSM {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*} else {
|
||||
// desktop, laptops...
|
||||
fsm = {
|
||||
state: 'off',
|
||||
@@ -296,7 +297,7 @@ export class PolySelect extends FSM {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
super(fsm)
|
||||
let self = this;
|
||||
|
||||
@@ -54,7 +54,8 @@ export let URLBuilder = (function() {
|
||||
},
|
||||
|
||||
buildNEDPositionCSURL: function(ra, dec, radiusDegrees) {
|
||||
return 'https://ned.ipac.caltech.edu/cgi-bin/nph-objsearch?search_type=Near+Position+Search&of=xml_main&RA=' + ra + '&DEC=' + dec + '&SR=' + radiusDegrees;
|
||||
//OLD return 'https://ned.ipac.caltech.edu/cgi-bin/nph-objsearch?search_type=Near+Position+Search&of=xml_main&RA=' + ra + '&DEC=' + dec + '&SR=' + radiusDegrees;
|
||||
return 'https://ned.ipac.caltech.edu/tap/sync?query=SELECT+*+FROM+objdir+WHERE+CONTAINS(POINT(\'J2000\',ra,dec),CIRCLE(\'J2000\',' + ra + ',' + dec + ',' + radiusDegrees + '))=1&LANG=ADQL&REQUEST=doQuery&FORMAT=votable'
|
||||
},
|
||||
|
||||
buildNEDObjectCSURL: function(object, radiusDegrees) {
|
||||
|
||||
@@ -1300,7 +1300,7 @@ export let View = (function () {
|
||||
|
||||
if (!view.throttledTouchPadZoom) {
|
||||
view.throttledTouchPadZoom = () => {
|
||||
const factor = Utils.detectTrackPad(e) ? 1.05 : 1.2;
|
||||
const factor = Utils.detectTrackPad(e) ? 1.06 : 1.2;
|
||||
const currZoomFactor = view.zoom.isZooming ? view.zoom.finalZoom : view.zoomFactor;
|
||||
let newZoomFactor = view.delta > 0 ? currZoomFactor * factor : currZoomFactor / factor;
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ export class HiPSBrowserBox extends Box {
|
||||
|
||||
let filterEnabler = Input.checkbox({
|
||||
name: "filter-enabler",
|
||||
tooltip: { content: "enable/disable" },
|
||||
checked: false,
|
||||
click(e) {
|
||||
let on = e.target.checked;
|
||||
|
||||
@@ -331,7 +331,7 @@ import { TogglerActionButton } from "../Button/Toggler.js";
|
||||
update(options) {
|
||||
if (options.layer) {
|
||||
let self = this;
|
||||
if (options.layer.isSpectralCube()) {
|
||||
if (options.layer.isSpectralCube && options.layer.isSpectralCube()) {
|
||||
let spectraDisplayer = self.aladin.view.spectraDisplayer;
|
||||
|
||||
self.spectraBtn = new TogglerActionButton({
|
||||
|
||||
@@ -225,6 +225,9 @@ export class Location extends DOMElement {
|
||||
// lon and lat must be given in cooFrame
|
||||
const updateFromLonLatFunc = (lon, lat, cooFrame) => {
|
||||
var coo = new Coo(lon, lat, Location.prec);
|
||||
|
||||
cooFrame = CooFrameEnum.fromString(cooFrame);
|
||||
|
||||
if (cooFrame == CooFrameEnum.ICRS) {
|
||||
self.field.set(coo.format('s/'));
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 188 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 133 KiB |