Compare commits

..

94 Commits

Author SHA1 Message Date
bmatthieu3
45845fad02 New option to make the north pole remain up to the view
* lockNorthUp new Aladin init option. False by default.
* setRotation is still allowed if lockNorthUp=true but when panning, the
view resets its orientation so that the north pole is up
2025-04-03 11:53:07 +02:00
bmatthieu3
01cbb149c1 Performance
Do all CPU computations on Vec3 and not Vec4
2025-04-03 09:30:28 +02:00
bmatthieu3
ea83e2b199 Set zoomfactor when using smartphones
Refers back to PR #249
2025-04-01 16:55:29 +02:00
bmatthieu3
9922690355 update readme, make the release page link more visible 2025-04-01 14:54:57 +02:00
bmatthieu3
3b926fe5a0 add getZoomFactor method in Aladin 2025-04-01 14:52:54 +02:00
bmatthieu3
d82ab61a2f Enhance zooming on mouse/trackpad
When zooming with a mouse or a trackpad a wheel event is triggered.
Originally the fov of the viewport was changed but it happened setting
the fov is projection dependant therefore leading to big zooming effect
for TAN projection for example.
Now there is a new way of zooming which is done by setting the screen
zoom factor instead of the fov. Zooming with this factor is projection
agnostic.
With that the pr adds:
* an interpolated zooming effect moving the viewport from a start screen
zoom factor to another by following a hermite cubic interpolation
function
* bugfix: originally, multiple wheel events done shortly in time resulted in a
zooming "congestion" bug leading to a zoom effect similar to only one
isolated wheel event. Now triggering several wheel event allow to zoom
more than only one isolated.
* a new listener `wheelTriggered` allowing the user to define its own zooming.
When wheelTriggered is set, the default zooming is not executed
2025-04-01 14:52:54 +02:00
bmatthieu3
e548aec016 Update changelog 2025-04-01 14:52:54 +02:00
Matthieu Baumann
e6818af3b0 First commit for 3.7.0
* add MOC setable properties: fill, edge and perimeter
* change package.json to 3.7.0-beta
2025-04-01 14:52:51 +02:00
Matthieu Baumann
4a5d66768c 3.6.4 2025-04-01 11:10:17 +02:00
Matthieu Baumann
239ae2ce74 fix make it work for safari 16.1
Revert wasm-bindgen version to 0.2.92 to make it work for safari 16.1 (and maybe older?)
(This is very obscure)
2025-03-31 17:09:05 +02:00
Matthieu Baumann
9bf898c104 3.6.3 2025-03-26 18:06:12 +01:00
Matthieu Baumann
6f085429f5 background color set to (0.1, 0.1, 0.1)
jpeg HiPS that does not cover all the sky are plotted as black when data is missing. This allow to recognize the border of the projection
2025-03-26 17:18:23 +01:00
Matthieu Baumann
b49c763e07 Improved distant HiPS url detection
This targets #270

* Use js URL object to detect if the user gives an url
* There is important point: a user can give a path pointing towards a local HiPS. For those Aladin Lite will think the path is an ID but it is not. That is why after failing fetching the MocServer for its properties, we simply try to reconsider it as an URL so that a local HiPS can be load afterwards.
2025-03-26 17:10:13 +01:00
Matthieu Baumann
fcacda0c19 Several fixes:
* use Utils.copy2Clipboard in contextmenu and shareview
* check for a mousedown before computing distance from the position when the mouse has been clicked
* smartphone 2 fingers pinched rotation between lon pi and 2*pi seems to have been fixed. The bug seem to be there from a long time ago.
2025-03-26 15:47:32 +01:00
Matthieu Baumann
f6acb3a324 3.6.2 2025-03-26 11:51:57 +01:00
Matthieu Baumann
14d54b03bc Fix css selector
Add a width: 100% to make the selector fits in its parent
2025-03-26 11:42:32 +01:00
Matthieu Baumann
9e2779837d Remove Shift shortcut
We will work on keyboard shortcuts for a next version
2025-03-26 11:03:04 +01:00
Matthieu Baumann
e29b5202b3 Fix context menu showing up
Change heuristic for showing up the contextual menu. Before we were waiting 100ms before changing the cuts but this does not work for users doing long timed right click without moving. Now, we look for the mouse offset after rightclicking. If it exceeds an offset of 10px then the contextual menu will not open and the cuts will change instead.
2025-03-26 10:34:32 +01:00
Matthieu Baumann
13125b155e 3.6.1 release 2025-03-25 18:27:53 +01:00
Matthieu Baumann
f56468d402 change package json to 3.6.1 2025-03-25 18:12:09 +01:00
bmatthieu3
5823901e92 Revert #264
* rename J2000 to ICRS as HiPSes are built in ICRS
* update the ancient J2000 conversion matrices to ICRS ones.
2025-03-25 18:09:36 +01:00
bmatthieu3
3b00a79e02 fix label name from ICRS to FK5J2000 2025-03-25 14:11:04 +01:00
bmatthieu3
31e7d6f0ac additionnal commit for solving #246 2025-03-24 17:46:15 +01:00
bmatthieu3
f656176e28 Fix MOC settings after its creation
MOC settings after their creation was not possible. This PR fix it.
It is also possible to directly set the 'color', 'fillColor', 'opacity'
and 'lineWidth' MOC properties without doing any reportChange
afterwards. These settings will automatically notify the wasm part for
change of the MOC options and will update the view.
2025-03-24 11:56:37 +01:00
bmatthieu3
9b31210066 set wasm opt 2025-03-20 20:55:05 +01:00
bmatthieu3
425e3e2459 hide the popup when its associated Source is out of fov 2025-03-20 20:52:09 +01:00
bmatthieu3
6bd9c43d88 Shape function given to a catalog
* fix: returning nothing or an invalid value from it will displays the
source as the square shape. Before, it was forgetting to display the
source
* Possibility to return a string in "rhomb", "circle", "square",
"cross", "triangle" from it.
* Set the color of footprint to the color of the Catalog. This thus
overwrites the color that could have been given in the footprint
directly. To compensate that, I think it could be great to allow a color func as well.
2025-03-20 18:54:40 +01:00
bmatthieu3
ebb9d6d3d6 Display labels
Two modes of display:
* ICRSd & GALACTIC frame set the formatting of grid labels to decimal
with digit precision being computed from the grid step selected
* ICRS frame set the formatting to sexagesimal in the format: deg min
sec.ddd .

This fixes #172
2025-03-20 15:47:59 +01:00
bmatthieu3
ee2eb6e704 Fix NaN detection by the GPU on float textures for window platform
float textures coming from BITPIX<0 fits images are sent to GPU as
RGBA8UI textures. Float decoding from a vec4 rgba is done in the shader.
Then this obtained decoded float can be tested against nan/inf in the
shader
2025-03-19 15:45:23 +01:00
bmatthieu3
68d9e67774 fix: download csv from measurement table 2025-03-19 13:34:03 +01:00
bmatthieu3
109cb48367 add click event on labels associated to checkbox so that the user can (un)check the checkbox by clicking on its label too. 2025-03-19 12:35:18 +01:00
bmatthieu3
749d963029 reduce +/- zooming factor 2025-03-19 12:35:18 +01:00
bmatthieu3
b2bb7df6e3 min cut and max cuts in 0-255 range for jpeg/png colors HiPS 2025-03-19 12:35:18 +01:00
bmatthieu3
492927c557 access HiPS2FITS interface from the contextual menu by giving the WCS object 2025-03-19 12:35:18 +01:00
bmatthieu3
accd4a6c7e show the scrollbar appear and impl a scrollbar offset save 2025-03-19 12:35:18 +01:00
bmatthieu3
6b21b2899f remove second contextual menu as it brings nothing more than the full contextual menu 2025-03-19 12:35:18 +01:00
bmatthieu3
628ea826bf make the toolbar elements aligned vertically and with the same size 2025-03-19 12:35:18 +01:00
bmatthieu3
5604ea2be6 disable changing cuts the first 100ms after the right click to prevent changing cuts when opening the context menu 2025-03-19 12:35:18 +01:00
Alexandra Moskowitz
6d458ccab7 fix: stop contextmenu event propagation only if context menu enabled 2025-03-18 16:29:36 +01:00
bmatthieu3
ae00021fab deprecate the property in the api doc 2025-03-12 10:09:49 +01:00
bmatthieu3
7512adf900 fix commit 2025-03-12 09:52:53 +01:00
bmatthieu3
a19a050ee7 fix exiting when realfullscreen is true. Refers back to #151 2025-03-10 17:50:51 +01:00
bmatthieu3
5f9c9d9154 JPEG case: draw black when the tile is missing 2025-03-05 11:12:50 +01:00
bmatthieu3
3f248a82ea add docs on HiPSOptions to explain some properties that prevent to fetch the properties file of a HiPS. Copied from #242 2025-03-04 17:12:24 +01:00
bmatthieu3
c2dd66c5b3 fix issue #234 2025-02-28 18:01:56 +01:00
Patrick Custer
35f6037f7f include hipsList in options merge 2025-02-28 13:28:14 +01:00
Patrick Custer
255f123652 combine requsetedOptions and Aladin.DEFAULT_OPTIONS with spread operator 2025-02-28 13:28:14 +01:00
bmatthieu3
43faf2170d fix issue 2025-02-27 14:26:47 +01:00
bmatthieu3
efdfb190dd remove rust warnings and update wcs dep to a the fixed version 0.3.1 2025-02-20 12:52:33 +01:00
Matthieu Baumann
1b2f298817 Update README.md 2025-02-15 09:02:21 +01:00
Matthieu Baumann
98e1c6cfca Update README.md 2025-02-15 09:02:01 +01:00
Matthieu Baumann
fa7781037e update playwright snapshots on darwin 2025-02-14 17:48:31 +01:00
bmatthieu3
834b831084 v3.6.1-beta 2025-02-14 17:33:05 +01:00
bmatthieu3
2dd8ab643b add playwright snapshots for linux 2025-02-14 17:23:37 +01:00
Carlos Quiroz
02c6b6e468 Remove old files using jquery 2025-02-14 15:30:26 +01:00
bmatthieu3
826ef4fdb7 Fix #151. It is now possible to escape the fullscreen. I fixed a refresh of the fullscreen button bug by defining a special alevent:fullscreen_toggled that the fullscreen button can listen to in order to change its arrow image (opening or closing). Also fix mouseup bug during selection 2025-02-14 15:26:52 +01:00
Matthieu Baumann
bf12e85c70 fix #228, complete the api doc to help the user understand the edge, fill and perimeter booleans 2025-02-14 09:55:10 +01:00
Matthieu Baumann
ac880608af #160 apply the workaround for non secured context. Not tested 2025-02-14 09:12:07 +01:00
Matthieu Baumann
7994ecc40e add a .gitignore to help the compilation phase and contribution #205 2025-02-14 08:42:09 +01:00
Matthieu Baumann
9049fec040 restore setrotation and getrotation in aladin object API. #211 2025-02-14 08:42:09 +01:00
Matthieu Baumann
4eea3d3bf9 #210 add documentation for catalogFromSimbad and fix the default nb_ref order to be in desc order direction by default 2025-02-14 08:42:09 +01:00
Matthieu Baumann
aed511abd8 fix #214 2025-02-14 08:42:09 +01:00
Matthieu Baumann
e654f4376e add a addHiPSToFavorites to counterbalance the removeHiPSFromFavorites, asked by #199 2025-02-14 08:42:09 +01:00
Matthieu Baumann
5d3d0b2cfc fix #225 2025-02-14 08:42:09 +01:00
Matthieu Baumann
f75211902b fix #225. I set to the hips object the cached options if there are instead of erasing the Hips object given by the user with a new one with the cached options 2025-02-14 08:42:09 +01:00
bmatthieu3
8844dc3c61 fix compiling issues on windows + update readme for contributors, they do not need rust nightly anymore 2025-02-08 13:58:56 +01:00
bmatthieu3
165c246605 fix compiling issues on windows + update readme for contributors, they do not need rust nightly anymore 2025-02-08 13:57:50 +01:00
Matthieu Baumann
542b1d0ace fix access to ska dachs service 2025-02-06 11:59:06 +01:00
Thomas Boch
6cc5814868 Merge pull request #226 from cds-astro/add-zenodo-file
maint: add zenodo.json file
2025-01-23 15:14:45 +01:00
MARCHAND MANON
712fe2bff0 maint: add zenodo.json file 2025-01-22 17:20:52 +01:00
bmatthieu3
ccc329be04 remove npm dev dep in package json 2025-01-16 17:03:04 +01:00
bmatthieu3
6833c21115 perform radec2xyz on double before sending it to the GPU. Should fix https://github.com/cds-astro/aladin-lite/issues/219 2025-01-16 16:42:02 +01:00
Thomas Boch
bb8116eb4e Merge pull request #224 from cds-astro/fix-pr-213
Bug fix for issue #213: CSS style for canvas element is more selective
2025-01-16 14:14:35 +01:00
Thomas Boch
afce55f1dd Bug fix for issue #213: CSS style for canvas element is more selective 2025-01-16 14:09:53 +01:00
MARCHAND MANON
718a8a073c fix: this.view does not exist, so it's better to use reportChange than requestRedraw 2025-01-16 13:09:51 +01:00
Thomas Boch
c620069c18 Bug fix for issue #216: circle radius is computed more accurately now 2025-01-16 12:01:14 +01:00
Thomas Boch
921d395cb2 Merge pull request #222 from cds-astro/fix-circle-opacity-not-working
Fix circle opacity not working
2025-01-16 10:12:20 +01:00
Thomas Boch
bbd5848bdb Bug fix: opacity is now available for Circle overlays (issue #215) 2025-01-16 09:58:17 +01:00
Thomas Boch
cc8becb437 Merge pull request #218 from cds-astro/fix-redraw-after-footprints
fix: request a redraw after adding an array of footprints
2025-01-15 11:19:07 +01:00
MARCHAND MANON
e28c37e5e0 fix: request a redraw after adding an array of footprints 2025-01-15 11:10:50 +01:00
Thomas Boch
7062a3cd76 Update README.md with terms of use
Add Terms of use for Aladin Lite embedding.
2024-12-05 10:26:32 +01:00
Matthieu Baumann
5f57f037f8 fix removal when rebasing, remove z-index of the tooltip causing bugs in the ui 2024-11-08 14:55:28 +01:00
Philip Matsson
765c0d0dcb Add documentation for the selector options 2024-11-08 14:55:28 +01:00
Philip Matsson
1f790a4b54 Fix issue with selection fillColor opacity 2024-11-08 14:55:28 +01:00
Philip Matsson
baa8f53349 Cleaning up 2024-11-08 14:55:28 +01:00
Philip Matsson
42ece4fba1 Add option for manual selection logic 2024-11-08 14:55:28 +01:00
Philip Matsson
35f13fe1f0 Push overlayItems in selector getObjects as an array for consistency 2024-11-08 14:55:28 +01:00
Philip Matsson
ddfd5ead05 Update select logic 2024-11-08 14:55:28 +01:00
Philip Matsson
5410544404 Allow color as function for select types 2024-11-08 14:55:28 +01:00
Philip Matsson
00c9d6ffc5 Customize select logic 2024-11-08 14:55:28 +01:00
Philip Matsson
3fb4a6493a Update polyline select implementation 2024-11-08 14:55:28 +01:00
Philip Matsson
0e27fb8765 Fix typo in polyline BB intersect function 2024-11-08 14:55:28 +01:00
Philip Matsson
6f2730893f Modify objects returned from selector and finish poly select impl 2024-11-08 14:55:28 +01:00
Matthieu Baumann
a83cfaab25 CD: use rustup stable 2024-11-06 16:45:52 +01:00
236 changed files with 6770 additions and 3630 deletions

View File

@@ -24,8 +24,6 @@ jobs:
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
rustup default nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: "Install wasm-pack"
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y

43
.gitignore vendored Normal file
View File

@@ -0,0 +1,43 @@
# vscode files
.vscode/
# for mac os users
.DS_Store
out/
# deployment scripts
deploy/
# node dependencies
node_modules/
package-lock.json
# rust tmp files for useful for the compilation phase
src/core/Cargo.lock
src/core/target/
# this rust file is generated when compiling the code, so it is not
# useful to put it on git
src/core/src/shaders.rs
## python related
# python environment
aladin-lite-venv
# python cached files
__pycache__/
## API doc related
# folder containing the generated HTML API documentation files
docs/
# style jsdoc files generated with npm run doc
jsdoc-custom-styledocs
# responsive jsdoc files generated with npm run doc
jsdoc-make-responsivedocs
## playwright testing framework related
test-results/
playwright-report/
## packaged tar obtained from the cmd: npm run predeploy or npm run deploy
aladin-lite*.tgz
# folder where the generated bundle lies
dist/

33
.zenodo.json Normal file
View File

@@ -0,0 +1,33 @@
{
"license": "GPL-3.0",
"access_right": "open",
"description": "An astronomical HiPS visualizer in the browser ",
"keywords": ["astronomy", "visualizer", "images"],
"language": "eng",
"title": "Aladin Lite",
"grants": [
{
"id": "824064"
}
],
"creators": [
{
"type": "ProjectLeader",
"orcid": "0000-0002-7123-773X",
"name": "Baumann, Matthieu",
"affiliation": "Université de Strasbourg, CNRS, Observatoire astronomique de Strasbourg, UMR 7550, F-67000 Strasbourg, France"
},
{
"type": "ProjectLeader",
"orcid": "0000-0001-5818-2781",
"name": "Boch, Thomas",
"affiliation": "Université de Strasbourg, CNRS, Observatoire astronomique de Strasbourg, UMR 7550, F-67000 Strasbourg, France"
},
{
"type": "ProjectMember",
"orcid": "0000-0001-5713-0998",
"name": "Marchand, Manon",
"affiliation": "Université de Strasbourg, CNRS, Observatoire astronomique de Strasbourg, UMR 7550, F-67000 Strasbourg, France"
}
]
}

View File

@@ -1,34 +1,113 @@
# Changelogs
## 3.5.1-beta
## Unreleased
### What's Changed
* [perf] perform CPU computations with Vec3 and Matrix3 and not 4 dimensions matrices/vectors
* [feat] lockNorthUp Aladin object new option locking the north pole up to the view center
## Released
### 3.6.3
#### What's Changed
* [maint] remove Shift shorcut for triggering rectangular source selection. Shortcuts will be implemented later. by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/269>
* [fix] decide to show the contextual menu only if user has not right click while moving more than 10px. by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/269>
* [fix] CSS selector took the whole div in smartphone usage. by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/269>
* [fix] smartphone 2 fingers zoom pinching around the 180deg meridian. by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/269>
* [fix] use copy2Clipboard utils functions from contextual menu. by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/269>
* [fix] improved ID/HiPS url detection (retry if a relative path to a local HiPS is given as it is considered as an ID). by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/269>
### 3.6.1
#### What's Changed
* [feat] AVM tags support found in jpeg headers by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/178>
* [feat] Merge remove overlay by name to Develop by [@Xen0Xys][Xen0Xys] in <https://github.com/cds-astro/aladin-lite/pull/182>
* [fix] Restore A.footprint function by [@szpetny][szpetny] in <https://github.com/cds-astro/aladin-lite/pull/183>
* [testing] Merge playwright tests to Develop by [@Xen0Xys][Xen0Xys] in <https://github.com/cds-astro/aladin-lite/pull/176>
* [fix] Version 3.5.1 by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/180>
* [fix] Also add style sheet in shadow dom context by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/194>
* [feat] Add selectionColor, onClick to catalog parameters handled by updateShape by [@simontorres][simontorres] in <https://github.com/cds-astro/aladin-lite/pull/198>
* [feat] HiPS cube support by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/204>
* [feat] PolySelect implementation and miscellaneous selection improvements by [@pmatsson][pmatsson] in <https://github.com/cds-astro/aladin-lite/pull/195>
* [fix] Request a redraw after adding an array of footprints by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/218>
* [fix] Circle opacity not working by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/222>
* [fix] Bug introduced in #218 by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/223>
* [fix] CSS style for canvas element is more selective by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/224>
* [maint] Add zenodo.json file by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/226>
* [maint] Remove old files using jquery by [@cquiroz][cquiroz] in <https://github.com/cds-astro/aladin-lite/pull/231>
* [fix] Display of HiPS with maxOrder = 0 by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/236>
* [fix] Combine requestedOptions and Aladin.DEFAULT_OPTIONS with spread operator by [@pcuste1][pcuste1] in <https://github.com/cds-astro/aladin-lite/pull/237>
* [fix] Add back cmap reverse checkbox by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/238>
* [fix] JPEG draw black screen when tiles are missing by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/246>
* [fix] Filled moc drawing reverse longitude by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/250>
* [doc] Deprecate longitudeReversed HiPS options property by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/251>
* [fix] Stop contextmenu event propagation only if context menu enabled by [@alexgoff][alexgoff] in <https://github.com/cds-astro/aladin-lite/pull/259>
* [ui] Minor fixes and enhancements by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/256>
* [fix] Handle NaNs by the GPU (fix for windows) by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/254>
* [fix] Grid labels formatting by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/261>
* [feat] Shape function given to a catalog by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/262>
* [fix] Tooltip pos out of fov by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/263>
* [fix] MOC settings after its creation by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/265>
* [fix] ICRS to FK5J2000 cooframe renaming by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/264>
* [fix] Revert #264 by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/268>
#### New Contributors
* [@cquiroz][cquiroz] made their first contribution in <https://github.com/cds-astro/aladin-lite/pull/231>
* [@pcuste1][pcuste1] made their first contribution in <https://github.com/cds-astro/aladin-lite/pull/237>
* [@alexgoff][alexgoff] made their first contribution in <https://github.com/cds-astro/aladin-lite/pull/259>
**Full Changelog**: <https://github.com/cds-astro/aladin-lite/compare/3.4.5...3.6.1>
### 3.6.1-beta
#### What's Changed
* [feat] Add selectionColor, onClick to catalog parameters handled by updateShape by [@simontorres][simontorres] in <https://github.com/cds-astro/aladin-lite/pull/198>
* [feat] HiPS cube support by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/204>
* [feat] PolySelect implementation and miscellaneous selection improvements by [@pmatsson][pmatsson] in <https://github.com/cds-astro/aladin-lite/pull/195>
* [fix] Request a redraw after adding an array of footprints by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/218>
* [fix] Circle opacity not working by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/222>
* [fix] Bug introduced in #218 by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/223>
* [fix] CSS style for canvas element is more selective by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/224>
* [maint] add zenodo.json file by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/226>
* [maint] Remove old files using jquery by [@cquiroz][cquiroz] in <https://github.com/cds-astro/aladin-lite/pull/231>
#### New Contributors
* [@cquiroz][cquiroz] made their first contribution in <https://github.com/cds-astro/aladin-lite/pull/231>
**Full Changelog**: <https://github.com/cds-astro/aladin-lite/compare/3.5.1-beta...3.6.1-beta>
### 3.5.1-beta
* [feat] Add support for name removing in `removeOverlay` method
* [test] Add support of playwright. Instructions in the readme for running the test matching snapshots [PR #176]
* [fix] Order of overlays in the stack now matches the addMOC/addCatalog/addOverlay calls ordering
* [doc] Expose the API of Coo class
* [fix] Insert aladin css inside the aladin lite so that it should be compliant with the use of shadow DOMs [cds-astro/ipyaladin#113], [marimo-team/marimo#2106]
* [feat] Add possibility of giving a local JS FileList to load a locally-stored HiPS without starting an HTTP server [cds-astro/aladin-lite#103]
* [feat] Add possibility of giving a local JS FileList to load a locally-stored HiPS without starting an HTTP server <https://github.com/cds-astro/aladin-lite/pull/103>
* [fix] removeOverlayByName
## 3.5.0-beta
### 3.5.0-beta
* [enhancement] add `options.colnames` to A.catalogFromVizieR to tell VizieR we want absolutely want to retrieve specific columns
* [feat] provide a new drawAxes option to A.ellipse. This is useful for plotting error ellipsis.
## 3.4.5-beta
### 3.4.5-beta
* [feat] add `layerChanged` event when a layer is added or removed
* [deprecate] of `select` event, use `objectsSelected` event instead
* [ui] add the ability to switch the tile format to download
## 3.4.3-beta
### 3.4.3-beta
* [bugfix] zoom control buttons
* [feat] save a MOC as a JSON file from the UI <https://github.com/cds-astro/aladin-lite/issues/154>
* [feat] save a source selection from the measurement table as a CSV file
* [feat] allow to display jpeg/jpg images with a wcs passed as a JS dictionary: <https://github.com/cds-astro/aladin-lite/issues/173>
## 3.4.2-beta
### 3.4.2-beta
* [impr] Improve smartphone support by setting media queries + a better logic for deploying the contextual menu sub options.
* [impr] Improve `WCS` view export with 3rd euler rotation encoding: <https://github.com/cds-astro/aladin-lite/issues/170>. Still some cases are to be handled like: crval on the equator or cylindrical with a galactic frame rotation.
@@ -36,21 +115,21 @@
* [feat] Add new method `Aladin#getViewImageBuffer` to get the current view as a PNG buffer
* [feat] New line rasterizer using GL instancing. This enhances the rendering speed of MOCs.
## 3.3.3
### 3.3.3
* [feat] UI: add HiPS basic filter that filters the `hipsList` given
* [feat] New `hipsList` option parameter when instancing a new Aladin object.
* [feat] Zoom smoothing using hermite cubic interpolation functions
* [feat] shape option of Catalog and ProgressiveCat accepts a function returning a Footprint. This allow user to
associate a footprint to a specific source
* [feat] Hover color support by @pmatsson and @bmatthieu3 in <https://github.com/cds-astro/aladin-lite/pull/145>
* [feat] Hover color support by [@pmatsson][pmatsson] and [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/145>
## 3.3.2
### 3.3.2
* [fixed] do not allow to query the properties several times for an imageHiPS
* [fixed] Detecting raytracing rendering mode. Adapt the rendering mode in function of the fov value and the projection used. Some projections do have more distortions with wide FoVs so it is better to use the raytracing rendering mode when fov >= smaller FoV threshold.
## 3.3.0
### 3.3.0
* [fixed] multiple calls to setImageSurvey with the same survey object led to strange behaviour.
* [perf] Display the first tile received instantly with no blending. Should enhance the slow reported in issue #88.
@@ -71,61 +150,61 @@
* [fixed] The parameters `gridColor` and `gridOpacity`, `gridOptions.showLabels` now work as expected
* New documentation API (W.I.P) here: <https://cds-astro.github.io/aladin-lite/>
* New release page here: <https://aladin.cds.unistra.fr/AladinLite/doc/release/>
* A major UI update by @bmatthieu3
* A major UI update by [@bmatthieu3][bmatthieu3]
1. Some API new classes A.box, A.button
2. A status bar where the user can enque messages for a specific amount of time (Aladin.addStatusBarMessage)
* Remove of JQuery and autocompletejs dependencies by @bmatthieu3
* Fix some performances issues, i.e. a bug when resizing the aladin lite view and which launched several parallel requestAnimationFrame by @bmatthieu3
* Remove of JQuery and autocompletejs dependencies by [@bmatthieu3][bmatthieu3]
* Fix some performances issues, i.e. a bug when resizing the aladin lite view and which launched several parallel requestAnimationFrame by [@bmatthieu3][bmatthieu3]
* Polygon and circular selection (see Aladin class API documentation for how to use it)
* ObsCore and Datalink votable parsing and interpretation. This work is still in progress and made in the frame of the SKA radio mission by @bmatthieu3 in <https://github.com/cds-astro/aladin-lite/pull/116>
* SODA service query window formular by @bmatthieu3 in <https://github.com/cds-astro/aladin-lite/pull/116>
* read only catalog option by @szpetny in <https://github.com/cds-astro/aladin-lite/pull/117>
* Small changed regarding drawing a footprint by @szpetny in <https://github.com/cds-astro/aladin-lite/pull/118>
* Object and footprint click/hover events expose mouse coordinates by @szpetny in <https://github.com/cds-astro/aladin-lite/pull/121>
* A proposal of a new feature - fill the polygon with a color by @szpetny in <https://github.com/cds-astro/aladin-lite/pull/122>
* update getViewWCS to adapt to projection by @ManonMarchand in <https://github.com/cds-astro/aladin-lite/pull/119>
* New SAMP support by @bmatthieu3 in <https://github.com/cds-astro/aladin-lite/pull/128>
* A possibility to create Coo and Footprint objects by @szpetny in <https://github.com/cds-astro/aladin-lite/pull/130>
* ObsCore and Datalink votable parsing and interpretation. This work is still in progress and made in the frame of the SKA radio mission by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/116>
* SODA service query window formular by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/116>
* read only catalog option by [@szpetny][szpetny] in <https://github.com/cds-astro/aladin-lite/pull/117>
* Small changed regarding drawing a footprint by [@szpetny][szpetny] in <https://github.com/cds-astro/aladin-lite/pull/118>
* Object and footprint click/hover events expose mouse coordinates by [@szpetny][szpetny] in <https://github.com/cds-astro/aladin-lite/pull/121>
* A proposal of a new feature - fill the polygon with a color by [@szpetny][szpetny] in <https://github.com/cds-astro/aladin-lite/pull/122>
* update getViewWCS to adapt to projection by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/119>
* New SAMP support by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/128>
* A possibility to create Coo and Footprint objects by [@szpetny][szpetny] in <https://github.com/cds-astro/aladin-lite/pull/130>
* new method aladin.getFrame() that returns the name of the current coordinate system
* `getViewWCS` now adapts to the `cooFrame` and the `projection`
* `getFov` is no longer capped at 180°
* bugfix `setProjection` now also updates for 'PAR' and 'SFL' projections
## 3.2.0
### 3.2.0
* MOC rendering perf enhanced. Possibility to draw only the perimeter of a MOC object (perimeter set to True)
* Many fixes e.g. footprint rendering for all sky projections
* A line/shape webgl rasterizer thanks to the use of the `lyon`crate. MOCs and grid lines are rendered that way. Therefore, it is possible to change the grid lines thickness
* Use of vite for the project management and deployment
## 3.1.0
### 3.1.0
* Add message for safari users to enable WebGL2 feature and reload the page by @bmatthieu3 in <https://github.com/cds-astro/aladin-lite/pull/54>
* Starting fits support by @bmatthieu3 in <https://github.com/cds-astro/aladin-lite/pull/70>
* display fits images with the drag and drop by @bmatthieu3
* Add message for safari users to enable WebGL2 feature and reload the page by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/54>
* Starting fits support by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/70>
* display fits images with the drag and drop by [@bmatthieu3][bmatthieu3]
![Kapture 2023-03-23 at 14 34 28](https://user-images.githubusercontent.com/2772384/227264124-8e05a3d8-1565-497f-a118-39fab3c6ed83.gif)
* support `webp` tile format by @bmatthieu3 and @tboch
* planetary name resolver by @tboch
* small ui changes and bug fixes by @bmatthieu3
* add codemeta and its validatior action by @ManonMarchand in <https://github.com/cds-astro/aladin-lite/pull/66>
* support `webp` tile format by [@bmatthieu3][bmatthieu3] and [@tboch][tboch]
* planetary name resolver by [@tboch][tboch]
* small ui changes and bug fixes by [@bmatthieu3][bmatthieu3]
* add codemeta and its validatior action by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/66>
## 3.0.0
### 3.0.0
Official release of Aladin Lite v3, [as announced in CDS news](https://cds.unistra.fr/news.php?fn_mode=fullnews&fn_incl=0&fn_id=958).
* Fix missing tiles issue by @tboch in <https://github.com/cds-astro/aladin-lite/pull/18>
* Hips catalogue filtering by @tboch in <https://github.com/cds-astro/aladin-lite/pull/28>
* Make footprint selection easier by @tboch in <https://github.com/cds-astro/aladin-lite/pull/19>
* Bug fix: enable different colors for multiple polylines in same layer by @tboch in <https://github.com/cds-astro/aladin-lite/pull/30>
* Method remove to delete individual source from a catalogue layer by @tboch in <https://github.com/cds-astro/aladin-lite/pull/37>
* Stop animation by @tboch in <https://github.com/cds-astro/aladin-lite/pull/40>
* Add message for safari users to enable WebGL2 feature and reload the page by @bmatthieu3 in <https://github.com/cds-astro/aladin-lite/pull/54>
* Fix missing tiles issue by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/18>
* Hips catalogue filtering by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/28>
* Make footprint selection easier by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/19>
* Bug fix: enable different colors for multiple polylines in same layer by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/30>
* Method remove to delete individual source from a catalogue layer by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/37>
* Stop animation by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/40>
* Add message for safari users to enable WebGL2 feature and reload the page by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/54>
## 2.x.x
## Version: 2.x.x
### 2020-08
* polyline improvements (by @imbasimba)
* polyline improvements (by [@imbasimba][imbasimba])
### 2020-07
@@ -390,3 +469,33 @@ New in the API:
* ajout catalogue progressif
* ajout on select, objectClicked, objectHovered
## Contributors
Aladin Lite is made possible thanks to those people:
* [@alexgoff][alexgoff]
* [@bmatthieu3][bmatthieu3]
* [@cquiroz][cquiroz]
* [@imbasimba][imbasimba]
* [@ManonMarchand][ManonMarchand]
* [@pcuste1][pcuste1]
* [@pmatsson][pmatsson]
* [@simontorres][simontorres]
* [@szpetny][szpetny]
* [@tboch][tboch]
* [@Xen0Xys][Xen0Xys]
[alexgoff]: https://github.com/alexgoff
[bmatthieu3]: https://github.com/bmatthieu3
[cquiroz]: https://github.com/cquiroz
[imbasimba]: https://github.com/imbasimba
[ManonMarchand]: https://github.com/ManonMarchand
[pcuste1]: https://github.com/pcuste1
[pmatsson]: https://github.com/pmatsson
[simontorres]: https://github.com/simontorres
[szpetny]: https://github.com/szpetny
[tboch]: https://github.com/tboch
[Xen0Xys]: https://github.com/Xen0Xys

View File

@@ -13,7 +13,7 @@ A new [API technical documentation](https://cds-astro.github.io/aladin-lite/) is
[![Run tests](https://github.com/cds-astro/aladin-lite/actions/workflows/test.yml/badge.svg)](https://github.com/cds-astro/aladin-lite/actions/workflows/test.yml)
[![API Documentation](https://img.shields.io/badge/API-documentation-blue.svg)](https://cds-astro.github.io/aladin-lite)
[![Releases page](https://img.shields.io/badge/Releases-forge-yellow.svg)](https://aladin.cds.unistra.fr/AladinLite/doc/release/)
[![Release page](https://img.shields.io/badge/Release-download-yellow.svg)](https://aladin.cds.unistra.fr/AladinLite/doc/release/)
Aladin Lite is available [at this link](https://aladin.u-strasbg.fr/AladinLite).
@@ -48,6 +48,8 @@ Editable examples showing the API can also be found [here](https://aladin.cds.un
## Embed it into your projects
**Terms of use**: you are welcome to integrate Aladin Lite in your web pages and to customize its GUI to your needs, but **please leave the Aladin logo and link intact** at the bottom right of the view.
You can embed Aladin Lite it into your webpages in two ways
### The vanilla way
@@ -140,12 +142,6 @@ to compile the core project into WebAssembly.
Follow the steps from the Rust official website [here](https://www.rust-lang.org/learn/get-started)
You will also need [wasm-pack](https://rustwasm.github.io/wasm-pack/), a tool helping compiling rust into a proper .wasm file.
Once it's installed you will need to switch to the nightly rust version:
```sh
rustup default nightly
```
Then you can build the project:
```sh
@@ -158,15 +154,14 @@ npm run build
> ```sh
> cargo install wasm-pack --version ~0.12
> ```
> - Make sure you are using the rust **nightly** toolchain
> ```sh
> rustup default nightly
> ```
> - Remove your `src/core/Cargo.lock` file and `src/core/target` directory -- this ensures that you'd escape any bad compilation state:
> ```sh
> git clean -di
> ```
> - then recompile with `npm run build`.
> - Then recompile
> ```sh
> npm run build
> ```
It will generate the aladin lite compiled code into a `dist/` directory located at the root of the repository. This directory contains two javascript files. `aladin.umd.cjs` follows the UMD module export convention and it is the one you need to use for your project.

5
assets/icons/freq.svg Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M3 4.5L6 7L6 5.25H18V7L21 4.5L18 2V3.75H6L6 2L3 4.5Z" />
<path d="M6.63935 11.9367C7.14967 10.7061 8.89138 10.7018 9.4077 11.9299L12.735 19.8442C13.9443 22.7205 18.0283 22.6965 19.2036 19.8061L21.1579 15H18.9989L17.351 19.0527C16.8472 20.2915 15.0969 20.3018 14.5787 19.0691L11.2514 11.1548C10.0466 8.28919 5.98264 8.29911 4.79189 11.1706L3.20392 15H5.36906L6.63935 11.9367Z" />
</svg>

After

Width:  |  Height:  |  Size: 623 B

2
assets/icons/inside.svg Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4,3H9A1,1,0,0,1,9,5H5V9A1,1,0,0,1,3,9V4A1,1,0,0,1,4,3ZM9,19H5V15a1,1,0,0,0-2,0v5a1,1,0,0,0,1,1H9a1,1,0,0,0,0-2Zm11-5a1,1,0,0,0-1,1v4H15a1,1,0,0,0,0,2h5a1,1,0,0,0,1-1V15A1,1,0,0,0,20,14ZM20,3H15a1,1,0,0,0,0,2h4V9a1,1,0,0,0,2,0V4A1,1,0,0,0,20,3ZM7,8v8a1,1,0,0,0,1,1h8a1,1,0,0,0,1-1V8a1,1,0,0,0-1-1H8A1,1,0,0,0,7,8Z"/></svg>

After

Width:  |  Height:  |  Size: 555 B

View File

@@ -8,8 +8,8 @@
"dateModified": "2023-01-31",
"issueTracker": "https://github.com/cds-astro/aladin-lite/issues",
"name": "Aladin Lite",
"version": "3.5.1-beta",
"softwareVersion": "3.5.1-beta",
"version": "3.6.4",
"softwareVersion": "3.6.4",
"description": "An astronomical HiPS visualizer in the browser.",
"identifier": "10.5281/zenodo.7638833",
"applicationCategory": "Astronomy, Visualization",

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,45 @@
hips_doi = 10.26093/cds/aladin/ht9n-7r
creator_did = ivo://CDS/P/DSS2/color
obs_collection = DSS colored
obs_title = DSS colored
obs_description = Color composition generated by CDS. This HiPS survey is based on 2 others HiPS surveys, respectively DSS2-red and DSS2-blue HiPS, both of them directly generated from original scanned plates downloaded from STScI site. The red component has been built from POSS-II F, AAO-SES,SR and SERC-ER plates. The blue component has been build from POSS-II J and SERC-J,EJ. The green component is based on the mean of other components. Three missing plates from red survey (253, 260, 359) has been replaced by pixels from the DSSColor STScI jpeg survey. The 11 missing blue plates (mainly in galactic plane) have not been replaced (only red component).
obs_copyright = Digitized Sky Survey - STScI/NASA, Colored & Healpixed by CDS
obs_copyright_url = http://archive.stsci.edu/dss/copyright.html
client_category = Image/Optical/DSS
client_sort_key = 03-00
hips_builder = Aladin/HipsGen v10.123
hips_creation_date = 2010-05-01T19:05Z
hips_release_date = 2019-05-07T10:55Z
hips_creator = Oberto A. (CDS) , Fernique P. (CDS)
hips_version = 1.4
hips_order = 7
hips_frame = equatorial
hips_tile_width = 512
hips_tile_format = jpeg
dataproduct_type = image
client_application = AladinLite
hips_status = public partial unclonable
hips_rgb_red = DSS2Merged [1488.0 8488.8125 14666.0 Linear]
hips_rgb_blue = DSS2-blue-XJ-S [4286.0 12122.5 19959.0 Linear]
hips_hierarchy = median
hips_pixel_scale = 2.236E-4
hips_initial_ra = 085.30251
hips_initial_dec = -02.25468
hips_initial_fov = 2
moc_sky_fraction = 1.0
hips_copyright = CNRS/Unistra
obs_ack = The Digitized Sky Surveys were produced at the Space Telescope Science Institute under U.S. Government grant NAG W-2166. The images of these surveys are based on photographic data obtained using the Oschin Schmidt Telescope on Palomar Mountain and the UK Schmidt Telescope. The plates were processed into the present compressed digital form with the permission of these institutions. The National Geographic Society - Palomar Observatory Sky Atlas (POSS-I) was made by the California Institute of Technology with grants from the National Geographic Society. The Second Palomar Observatory Sky Survey (POSS-II) was made by the California Institute of Technology with funds from the National Science Foundation, the National Geographic Society, the Sloan Foundation, the Samuel Oschin Foundation, and the Eastman Kodak Corporation. The Oschin Schmidt Telescope is operated by the California Institute of Technology and Palomar Observatory. The UK Schmidt Telescope was operated by the Royal Observatory Edinburgh, with funding from the UK Science and Engineering Research Council (later the UK Particle Physics and Astronomy Research Council), until 1988 June, and thereafter by the Anglo-Australian Observatory. The blue plates of the southern Sky Atlas and its Equatorial Extension (together known as the SERC-J), as well as the Equatorial Red (ER), and the Second Epoch [red] Survey (SES) were all taken with the UK Schmidt. Supplemental funding for sky-survey work at the ST ScI is provided by the European Southern Observatory.
prov_progenitor = STScI
bib_reference = 1996ASPC..101...88L
bib_reference_url = http://cdsads.u-strasbg.fr/abs/1996ASPC..101...88L
t_min = 42413
t_max = 51179
obs_regime = Optical
em_min = 4e-7
em_max = 6e-7
hips_order_min = 0
dataproduct_subtype = color
hipsgen_date = 2019-05-07T10:55Z
hipsgen_params = out=/asd-volumes/sc1-asd-volume8/DSS/DSSColor UPDATE
hipsgen_date_1 = 2024-09-10T16:50Z
hipsgen_params_1 = in=https://alasky.cds.unistra.fr/DSS/DSSColor/ out=./CDS_P_DSS2_color region=3/357 order=5 MIRROR

View File

@@ -8,7 +8,7 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', { fov:0.15, target: 'Arp 240', showReticle: false, fullScreen: true });
aladin = A.aladin('#aladin-lite-div', { fov:0.15, target: 'Arp 240', showContextMenu: true, showReticle: false, fullScreen: true });
aladin.setBaseImageLayer(aladin.newImageSurvey('P/SDSS9/g', {colormap: "eosb", stretch: "linear"}));
var simbad = A.catalog({name: 'Simbad', sourceSize: 16, color: '#4050F0'});

View File

@@ -5,7 +5,8 @@
<body>
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<script type="module">
import A from '../src/js/A.js';
import A from '../src/js/A.js';
A.init.then(() => {
let aladin = A.aladin('#aladin-lite-div', {projection: "TAN", survey: "P/HSC/DR2/deep/g", target: '02 21 36.529 -05 31 20.16', fov: 0.1});
@@ -16,6 +17,7 @@ A.init.then(() => {
const HSCRedSurvey = aladin.newImageSurvey('P/HSC/DR2/deep/r', {imgFormat: 'fits', colormap: "red", minCut: 0.34228, maxCut: 2.75785, additive: true, stretch: "asinh"});
const HSCBlueSurvey = aladin.newImageSurvey('P/HSC/DR2/deep/z', {imgFormat: 'fits', colormap: "blue", minCut: -0.01218, maxCut: 2.27397, additive: true, stretch: "asinh"});
HSCRedSurvey.setColormap('red', {stretch: 'linear'});
aladin.setOverlayImageLayer('P/HSC/DR2/deep/r', 'hsc red layer');
aladin.setOverlayImageLayer('P/HSC/DR2/deep/z', 'hsc blue layer');

View File

@@ -10,7 +10,7 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:2.0, target: "22 35 58.39 +33 57 57.8", showSettingsControl: true, log: false});
aladin = A.aladin('#aladin-lite-div', {samp: true, survey: "data/hips/PanSTARRS_DR1_color-z-zg-g", fov:2.0, target: "22 35 58.39 +33 57 57.8", showSettingsControl: true, log: false});
aladin.setProjection('AIT');
let cfht = aladin.createImageSurvey("CFHT", "CFHT MegaCam u+g+r", "./data/hips/CFHT", "equatorial", 10, {imgFormat: 'png'});
let jwst1 = aladin.createImageSurvey("CDS/P/JWST/Stephans-Quintet/NIRCam+MIRI", "JWST NIRCam+MIRI", "data/hips/JWST_NIRCam_MIRI", null, null, {imgFormat: 'png'});

View File

@@ -0,0 +1,81 @@
<!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: 1024px; height: 768px">
<div class="box-content" style="width:200px">
<div style="display:inline-flex">
<label for="cat-color">Color</label>
<input type="color" id="cat-color" value="#ff0000">
</div>
</div>
</div>
<script type="module">
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
var aladin = A.aladin(
'#aladin-lite-div',
{
fov: 1.5, // initial field of view in degrees
target: 'NGC 2175', // initial target
}
);
// Add a catalog
let cat = A.catalogFromSimbad('NGC 2175', 0.1, {onClick: 'showTable'});
aladin.addCatalog(cat);
// Logic for changing the color of catalog sources
let colorPicker = document.querySelector('#cat-color');
colorPicker.value = cat.color;
colorPicker.addEventListener('input', function (e) {
// Change the color of the catalog
cat.updateShape({color: this.value});
})
// Define the box
let catalogSettingsBox = A.box({
header: {
title: "Settings",
},
content: document.querySelectorAll('.box-content')[0],
});
catalogSettingsBox._hide();
// Define the button that toggles the box
let catalogSettingsBtn = A.button({
content: 'Catalog',
classList: ['catalogSettingsTogglerBtn'],
action(o) {
if (catalogSettingsBox.isHidden) {
catalogSettingsBox._show({
position: {
nextTo: catalogSettingsBtn,
direction: 'right',
}
})
} else {
catalogSettingsBox._hide()
}
}
});
aladin.addUI([catalogSettingsBtn, catalogSettingsBox])
});
</script>
<style>
.catalogSettingsTogglerBtn {
position: absolute;
top: 200px;
left: 0;
}
</style>
</body>
</html>

View File

@@ -12,9 +12,11 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {projection: 'AIT', cooFrame: 'galactic', fov: 200, target: 'galactic center'});
let dss = aladin.createImageSurvey("DSS blue band", "Color DSS blue HiPS", "http://alasky.cds.unistra.fr/DSS/DSS2-blue-XJ-S/", "equatorial", 9, {imgFormat: 'fits'})
aladin.setBaseImageLayer(dss);
aladin.getBaseImageLayer().setCuts(2, 10000);
dss.setCuts(2, 10000);
});
</script>

View File

@@ -11,7 +11,7 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {cooFrame: "icrs", log: false});
aladin = A.aladin('#aladin-lite-div', {cooFrame: "icrs", log: false, backgroundColor: 'red'});
aladin.displayFITS(
//'https://fits.gsfc.nasa.gov/samples/FOCx38i0101t_c0f.fits', // url of the fits file

19
examples/al-disto.html Normal file
View File

@@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
</head>
<body>
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<script type="module">
import A from '../src/js/A.js';
var aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {showContextMenu: true, survey: 'https://alasky.cds.unistra.fr/Pan-STARRS/DR1/color-i-r-g/', fov: 0.00833333333, target: '270.334079 66.730469'});
aladin.showHealpixGrid(true)
});
</script>
</body>
</html>

View File

@@ -20,6 +20,7 @@
showSettingsControl: true,
showStackLayerControl: true,
samp: true,
showCooGrid: true,
});
aladin.addCatalog(A.catalogFromSimbad('M 82', 0.1, {onClick: 'showTable'}));

View File

@@ -14,10 +14,10 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/CDS_P_DSS2_color", showReticle: true, showSurveyStackControl: true, showOverlayStackControl: false, projection: "TAN", target: '15 16 57.636 -60 55 7.49', showProjectionControl: true, realFullscreen: true, showZoomControl: true, showSimbadPointerControl: true, showShareControl: true, showContextMenu: true, showCooGridControl: true, fullScreen: true, showCooGrid: true, fov: 180, log: false});
var moc_0_99 = A.MOCFromURL("./data/gw/gw_0.9.fits",{ name: "GW 90%", color: "#ff0000", opacity: 0.0, lineWidth: 10, fill: false, perimeter: true});
var moc_0_95 = A.MOCFromURL("./data/gw/gw_0.6.fits",{ name: "GW 60%", color: "#00ff00", opacity: 0.5, lineWidth: 3, fill: true, perimeter: true});
var moc_0_5 = A.MOCFromURL("./data/gw/gw_0.3.fits",{ name: "GW 30%", color: "#00ffff", opacity: 0.5, lineWidth: 3, fill: true, perimeter: true});
var moc_0_2 = A.MOCFromURL("./data/gw/gw_0.1.fits",{ name: "GW 10%", color: "#ff00ff", opacity: 0.5, lineWidth: 3, fill: true, perimeter: true});
var moc_0_99 = A.MOCFromURL("./data/gw/gw_0.9.fits",{ name: "GW 90%", color: "#ff0000", opacity: 0.7, lineWidth: 10, fill: false, perimeter: true});
var moc_0_95 = A.MOCFromURL("./data/gw/gw_0.6.fits",{ name: "GW 60%", color: "#00ff00", opacity: 0.3, lineWidth: 3, fill: false, perimeter: true});
var moc_0_5 = A.MOCFromURL("./data/gw/gw_0.3.fits",{ name: "GW 30%", color: "#00ffff", opacity: 0.2, lineWidth: 3, fill: true, perimeter: true});
var moc_0_2 = A.MOCFromURL("./data/gw/gw_0.1.fits",{ name: "GW 10%", color: "#ff00ff", opacity: 0.1, lineWidth: 3});
aladin.addMOC(moc_0_99);
aladin.addMOC(moc_0_95);

View File

@@ -30,8 +30,8 @@
}
);
//hips = aladin.newImageSurvey("https://alasky.cds.unistra.fr/GALFAHI/GALFAHI-Narrow-DR2/");
//aladin.setImageLayer(hips)
hips = aladin.newImageSurvey("https://alasky.cds.unistra.fr/GALFAHI/GALFAHI-Narrow-DR2/");
aladin.setImageLayer(hips)
/*let id;
aladin.on("zoomChanged", () => {

View File

@@ -22,29 +22,17 @@
reticleColor: '#ff89ff', // change reticle color
reticleSize: 64, // change reticle size
showContextMenu: true,
showShareControl: true,
showFrame: true,
showZoomControl:true,
showSettingsControl:true,
showCooGrid: true,
fullScreen: true,
samp: true,
lockNorthUp: true,
}
);
/*let id;
aladin.on("zoomChanged", () => {
if (id)
clearTimeout(id);
id = setTimeout(() => {
console.log("wheel stopped, new cone search here")
}, 500);
})*/
});
</script>
<style>
.aladin-cat-browser-box {
width: 600px;
}
</style>
</body>
</html>

View File

@@ -0,0 +1,135 @@
<!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";
let aladin;
A.init.then(() => {
aladin = A.aladin("#aladin-lite-div", {
fullScreen: true,
target: "abell 194",
fov: 15,
projection: "AIT",
showContextMenu: true,
showShareControl: true,
samp: true,
showSettingsControl: true,
showZoomControl: true,
});
/*let pmraMean = null, pmdecMean = null;
const pmCat = A.catalogFromURL('./data/proper_motion.xml', {
onClick: 'showTable',
name: 'mean pm over HPX cells around LMC from GaiaDR2',
hoverColor: 'yellow',
selectionColor: 'white',
color: 'yellow',
// Footprint associated to sources
shape: (s) => {
// discard drawing a vector for big pm
let totalPmSquared = s.data.pmra*s.data.pmra + s.data.pmdec*s.data.pmdec;
if (totalPmSquared > 6) {
return;
}
let color = rainbowColorMap((totalPmSquared - 2.5) / 2)
// Compute the mean of pm over the catalog sources
if (!pmraMean || !pmdecMean) {
pmraMean = 0, pmdecMean = 0;
for (var s of pmCat.getSources()) {
pmraMean += +s.data.pmra;
pmdecMean += +s.data.pmdec;
}
const numSources = pmCat.getSources().length;
pmraMean /= numSources
pmdecMean /= numSources
}
let dra = +s.data.pmra - pmraMean;
let ddec = +s.data.pmdec - pmdecMean;
return A.vector(
s.ra,
s.dec,
s.ra + dra,
s.dec + ddec,
{lineWidth: 3, color}
)
}
});
aladin.addCatalog(pmCat);*/
/*aladin.addCatalog(
A.catalogFromURL("./data/votable/obscore_rucio-sdc03.votable", {
name: 'SKA discovery ObsCore around: SDC03',
onClick: 'showTable',
hoverColor: "yellow",
})
);
aladin.addCatalog(
A.catalogFromURL("./data/votable/obscore_rucio-abell194.votable", {
name: 'SKA discovery ObsCore around: Abell 194',
onClick: 'showTable',
hoverColor: "yellow",
})
);*/
aladin.addCatalog(
A.catalogFromSKAORucio("abell 194", 15, {
onClick: 'showTable',
hoverColor: "yellow",
})
);
aladin.addCatalog(
A.catalogFromSKAORucio("m51", 15, {
onClick: 'showTable',
hoverColor: "yellow",
})
);
});
function rainbowColorMap(value) {
// Ensure value is within range [0, 1]
value = Math.max(0, Math.min(1, value));
// Convert value to hue
var hue = (1 - value) * 240; // 240 is the maximum hue value for blue
// Convert HSV to RGB
var chroma = 1;
var x = chroma * (1 - Math.abs((hue / 60) % 2 - 1));
var r1, g1, b1;
if (hue >= 0 && hue < 60) {
[r1, g1, b1] = [chroma, x, 0];
} else if (hue >= 60 && hue < 120) {
[r1, g1, b1] = [x, chroma, 0];
} else if (hue >= 120 && hue < 180) {
[r1, g1, b1] = [0, chroma, x];
} else if (hue >= 180 && hue < 240) {
[r1, g1, b1] = [0, x, chroma];
}
var m = 1 - chroma;
var r = r1 + m;
var g = g1 + m;
var b = b1 + m;
// Convert RGB to HEX
r = Math.round(r * 255);
g = Math.round(g * 255);
b = Math.round(b * 255);
var colorHex = "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
return colorHex;
}
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -55,7 +55,7 @@
aladin.addCatalog(A.catalogFromURL('https://aladin.cds.unistra.fr/AladinLite/doc/API/examples/data/mars-features.xml', {name: "Mars features", raField: 'Longitude', decField: 'Latitude', shape: drawFunction, onClick: 'showTable'}));
aladin.getBaseImageLayer().setColormap('yiorbr')
aladin.getBaseImageLayer().setColormap('ylorbr')
aladin.gotoRaDec(226.1433542, 18.6308694);
});

View File

@@ -24,8 +24,14 @@
//var json = {"3":[517],
//"4":[2065, 2067]};
var moc = A.MOCFromJSON(json, {opacity: 0.25, color: 'magenta', lineWidth: 1, adaptativeDisplay: false});
var moc = A.MOCFromJSON(json, {opacity: 0.5, color: 'magenta', lineWidth: 1, fill: true});
aladin.addMOC(moc);
// Change the moc options after its creation
setTimeout(() => {
moc.opacity = 0.2
moc.fillColor = "orange"
}, 3000)
});
</script>
</body>

View File

@@ -20,7 +20,7 @@
console.log(moc.serialize("json"))
});
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.3, lineWidth: 3});
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, fill:true, fillColor: '#aabbcc', opacity: 0.3, 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);

View File

@@ -77,7 +77,7 @@
});
aladin.addCatalog(
A.catalogFromSKAORucio("ngc 1436", 15, {
A.catalogFromSKAORucio("abell 196", 90, {
onClick: 'showTable',
hoverColor: "yellow",
})

View File

@@ -15,10 +15,6 @@
// 'rdbu', 'rdylbu', 'redtemperature', 'sinebow', 'spectral', 'summer', 'viridis', 'ylgnbu' and 'ylorbr'
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

@@ -2,7 +2,7 @@
"homepage": "https://aladin.u-strasbg.fr/",
"name": "aladin-lite",
"type": "module",
"version": "3.6.0-beta",
"version": "3.7.0-beta",
"description": "An astronomical HiPS visualizer in the browser",
"author": "Thomas Boch and Matthieu Baumann",
"license": "GPL-3",

View File

@@ -3,7 +3,7 @@ name = "aladin-lite"
description = "Aladin Lite v3 introduces a new graphical engine written in Rust with the use of WebGL"
license = "BSD-3-Clause"
repository = "https://github.com/cds-astro/aladin-lite"
version = "3.5.1-beta"
version = "3.7.0"
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
edition = "2018"
@@ -22,11 +22,12 @@ url-lite = "0.1.0"
serde_json = "1.0.104"
serde-wasm-bindgen = "0.5"
enum_dispatch = "0.3.8"
wasm-bindgen = "0.2.92"
wasm-bindgen = "=0.2.92"
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,17 +41,13 @@ 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
[dependencies.healpix]
package = "cdshealpix"
version = "0.7.0"
version = "0.7.3"
[dependencies.moclib]
package = "moc"
@@ -67,7 +64,7 @@ path = "./al-core"
path = "./al-api"
[dependencies.web-sys]
version = "*"
version = "0.3.56"
features = [ "console", "CssStyleDeclaration", "Document", "Element", "HtmlCollection", "HtmlElement", "HtmlImageElement", "HtmlCanvasElement", "Blob", "ImageBitmap", "ImageData", "CanvasRenderingContext2d", "WebGlBuffer", "WebGlContextAttributes", "WebGlFramebuffer", "WebGlProgram", "WebGlShader", "WebGlUniformLocation", "WebGlTexture", "WebGlActiveInfo", "Headers", "Window", "Request", "RequestInit", "RequestMode", "Response", "XmlHttpRequest", "XmlHttpRequestResponseType", "PerformanceTiming", "Performance", "Url", "ReadableStream", "File", "FileList",]
[dev-dependencies.image-decoder]
@@ -80,7 +77,7 @@ features = [ "jpeg", "png",]
debug = true
[profile.release]
opt-level = 'z'
opt-level = "z"
debug = false
debug-assertions = false
overflow-checks = false
@@ -91,4 +88,4 @@ codegen-units = 16
rpath = false
[package.metadata.wasm-pack.profile.release]
wasm-opt = true
wasm-opt = false

View File

@@ -1,6 +1,6 @@
[package]
name = "al-api"
version = "0.1.0"
version = "3.6.4"
authors = ["baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr"]
edition = "2018"

View File

@@ -1,8 +1,6 @@
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
use std::fmt;
#[wasm_bindgen(raw_module = "../../js/libs/astro/coo.js")]
extern "C" {
#[wasm_bindgen(js_name = Format)]
@@ -28,28 +26,11 @@ extern "C" {
pub fn toDecimal(num: f64, prec: u8) -> String;
}
#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq)]
use std::cmp::Eq;
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[serde(rename_all = "camelCase")]
#[wasm_bindgen]
pub enum AngleSerializeFmt {
DMM,
DD,
DMS,
HMS,
}
impl fmt::Display for AngleSerializeFmt {
// This trait requires `fmt` with this exact signature.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Write strictly the first element into the supplied output
// stream: `f`. Returns `fmt::Result` which indicates whether the
// operation succeeded or failed. Note that `write!` uses syntax which
// is very similar to `println!`.
let str = match self {
Self::DMM => "DMM",
Self::DD => "DD",
Self::DMS => "DMS",
Self::HMS => "HMS",
};
write!(f, "{}", str)
}
}
pub enum Formatter {
Sexagesimal,
Decimal
}

View File

@@ -1,119 +1,58 @@
use cgmath::Matrix4;
pub trait CooBaseFloat: Sized + 'static {
const GALACTIC_TO_J2000: &'static Matrix4<Self>;
const J2000_TO_GALACTIC: &'static Matrix4<Self>;
const ID: &'static Matrix4<Self>;
}
use cgmath::Matrix3;
impl CooBaseFloat for f32 {
const GALACTIC_TO_J2000: &'static Matrix4<Self> = &Matrix4::new(
-0.444_829_64,
0.746_982_2,
0.494_109_42,
0.0,
-0.198_076_37,
0.455_983_8,
-0.867_666_1,
0.0,
-0.873_437_1,
-0.483_835,
-0.054_875_56,
0.0,
0.0,
0.0,
0.0,
1.0,
);
const GAL2ICRS: &'static Matrix3<f64> = &Matrix3::new(
-0.44482972122205372312012370920248,
0.74698218398450941835110635824212,
0.49410943719710765017955928850141,
const J2000_TO_GALACTIC: &'static Matrix4<Self> = &Matrix4::new(
-0.444_829_64,
-0.198_076_37,
-0.873_437_1,
0.0,
0.746_982_2,
0.455_983_8,
-0.483_835,
0.0,
0.494_109_42,
-0.867_666_1,
-0.054_875_56,
0.0,
0.0,
0.0,
0.0,
1.0,
);
-0.19807633727507056817237662907031,
0.45598381369115237931077906137440,
-0.86766613755716255824577781583414,
const ID: &'static Matrix4<Self> = &Matrix4::new(
1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
);
}
impl CooBaseFloat for f64 {
const GALACTIC_TO_J2000: &'static Matrix4<Self> = &Matrix4::new(
-0.4448296299195045,
0.7469822444763707,
0.4941094279435681,
0.0,
-0.1980763734646737,
0.4559837762325372,
-0.867_666_148_981_161,
0.0,
-0.873437090247923,
-0.4838350155267381,
-0.0548755604024359,
0.0,
0.0,
0.0,
0.0,
1.0,
);
-0.87343705195577915249273984034980,
-0.48383507361641838378786914298189,
-0.05487565771261968232908806948676,
);
const J2000_TO_GALACTIC: &'static Matrix4<Self> = &Matrix4::new(
-0.4448296299195045,
-0.1980763734646737,
-0.873437090247923,
0.0,
0.7469822444763707,
0.4559837762325372,
-0.4838350155267381,
0.0,
0.4941094279435681,
-0.867_666_148_981_161,
-0.0548755604024359,
0.0,
0.0,
0.0,
0.0,
1.0,
);
const ICRS2GAL: &'static Matrix3<f64> = &Matrix3::new(
-0.44482972122205372312012370920248,
-0.19807633727507056817237662907031,
-0.87343705195577915249273984034980,
0.74698218398450941835110635824212,
0.45598381369115237931077906137440,
-0.48383507361641838378786914298189,
0.49410943719710765017955928850141,
-0.86766613755716255824577781583414,
-0.05487565771261968232908806948676,
);
const ID: &'static Matrix3<f64> = &Matrix3::new(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
);
const ID: &'static Matrix4<Self> = &Matrix4::new(
1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
);
}
use cgmath::BaseFloat;
use serde::Deserialize;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Deserialize, Hash)]
pub enum CooSystem {
ICRS = 0,
GAL = 1,
ICRS,
GAL,
}
pub const NUM_COOSYSTEM: usize = 2;
impl CooSystem {
#[inline]
pub fn to<S>(&self, coo_system: Self) -> &Matrix4<S>
where
S: BaseFloat + CooBaseFloat,
{
pub fn to(&self, coo_system: Self) -> &Matrix3<f64> {
match (self, coo_system) {
(CooSystem::GAL, CooSystem::ICRS) => S::GALACTIC_TO_J2000,
(CooSystem::ICRS, CooSystem::GAL) => S::J2000_TO_GALACTIC,
(_, _) => S::ID,
(CooSystem::GAL, CooSystem::ICRS) => GAL2ICRS,
(CooSystem::ICRS, CooSystem::GAL) => ICRS2GAL,
(_, _) => ID,
}
}
}

View File

@@ -1,12 +1,9 @@
use wasm_bindgen::prelude::*;
use serde::{Deserialize, Serialize};
use crate::angle_fmt::AngleSerializeFmt;
use crate::angle::Formatter;
use super::color::ColorRGB;
#[wasm_bindgen]
#[derive(Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GridCfg {
@@ -22,7 +19,7 @@ pub struct GridCfg {
#[serde(default = "default_enabled")]
pub enabled: Option<bool>,
#[serde(default = "default_fmt")]
pub fmt: Option<AngleSerializeFmt>,
pub fmt: Option<Formatter>,
}
fn default_labels() -> Option<bool> {
@@ -45,6 +42,6 @@ fn default_thickness() -> Option<f32> {
None
}
fn default_fmt() -> Option<AngleSerializeFmt> {
fn default_fmt() -> Option<Formatter> {
None
}

View File

@@ -29,6 +29,7 @@ use crate::coo_system::CooSystem;
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
#[wasm_bindgen]
pub struct HiPSProperties {
// Associated with the HiPS
url: String,

View File

@@ -13,7 +13,7 @@ pub mod resources;
pub mod cell;
pub mod fov;
pub mod image;
pub mod angle_fmt;
pub mod angle;
pub trait Abort {
type Item;

View File

@@ -4,7 +4,7 @@ use super::color::{Color, ColorRGBA};
#[derive(Clone, Debug)]
#[wasm_bindgen]
pub struct MOC {
pub struct MOCOptions {
uuid: String,
pub line_width: f32,
pub perimeter: bool,
@@ -18,7 +18,7 @@ pub struct MOC {
use crate::{color::ColorRGB, Abort};
use std::convert::TryInto;
#[wasm_bindgen]
impl MOC {
impl MOCOptions {
#[wasm_bindgen(constructor)]
pub fn new(
uuid: String,
@@ -42,7 +42,7 @@ impl MOC {
}
};
let color = parse_color(hex_color, 1.0);
let color = parse_color(hex_color, opacity);
let fill_color = parse_color(fill_color, opacity);
Self {
@@ -58,13 +58,13 @@ impl MOC {
}
}
impl MOC {
impl MOCOptions {
pub fn get_uuid(&self) -> &String {
&self.uuid
}
}
impl Default for MOC {
impl Default for MOCOptions {
fn default() -> Self {
Self {
uuid: String::from("moc"),

View File

@@ -1,6 +1,6 @@
[package]
name = "al-core"
version = "0.1.0"
version = "3.6.4"
authors = ["baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr"]
edition = "2018"
@@ -17,9 +17,7 @@ serde-wasm-bindgen = "0.4"
wasm-streams = "0.3.0"
futures = "0.3.25"
colorgrad = "0.6.2"
[dependencies.wasm-bindgen]
version = "0.2.92"
wasm-bindgen = "0.2.92"
[dev-dependencies]
fontdue = "0.7.2"

View File

@@ -163,7 +163,7 @@ impl Image for Fits<'_> {
);
}
Data::F32(data) => {
let view = unsafe { R32F::view(&data) };
let view = unsafe { R8UI::view(&std::slice::from_raw_parts(data.as_ptr() as *const u8, data.len() * 4)) };
textures.tex_sub_image_3d_with_opt_array_buffer_view(
offset.x,
offset.y,

View File

@@ -152,21 +152,13 @@ impl ImageFormat for RGB32F {
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub struct R32F;
impl ImageFormat for R32F {
type P = [f32; 1];
type P = [u8; 4];
const NUM_CHANNELS: usize = 1;
const NUM_CHANNELS: usize = 4;
#[cfg(feature = "webgl2")]
const FORMAT: u32 = WebGlRenderingCtx::RED as u32;
#[cfg(feature = "webgl1")]
const FORMAT: u32 = WebGlRenderingCtx::LUMINANCE as u32;
#[cfg(feature = "webgl2")]
const INTERNAL_FORMAT: i32 = WebGlRenderingCtx::R32F as i32;
#[cfg(feature = "webgl1")]
const INTERNAL_FORMAT: i32 = WebGlRenderingCtx::LUMINANCE as i32;
const TYPE: u32 = WebGlRenderingCtx::FLOAT;
const FORMAT: u32 = WebGlRenderingCtx::RGBA as u32;
const INTERNAL_FORMAT: i32 = WebGlRenderingCtx::RGBA8 as i32;
const TYPE: u32 = WebGlRenderingCtx::UNSIGNED_BYTE;
const CHANNEL_TYPE: ChannelType = ChannelType::R32F;
@@ -174,41 +166,31 @@ impl ImageFormat for R32F {
Ok(Bytes::Borrowed(raw_bytes))
}
type ArrayBufferView = js_sys::Float32Array;
type ArrayBufferView = js_sys::Uint8Array;
unsafe fn view(s: &[<Self::P as Pixel>::Item]) -> Self::ArrayBufferView {
Self::ArrayBufferView::view(s)
}
}
#[cfg(feature = "webgl2")]
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub struct R64F;
#[cfg(feature = "webgl2")]
impl ImageFormat for R64F {
type P = [f32; 1];
type P = [u8; 4];
const NUM_CHANNELS: usize = 1;
const NUM_CHANNELS: usize = 4;
#[cfg(feature = "webgl2")]
const FORMAT: u32 = WebGlRenderingCtx::RED as u32;
#[cfg(feature = "webgl1")]
const FORMAT: u32 = WebGlRenderingCtx::LUMINANCE as u32;
const FORMAT: u32 = WebGlRenderingCtx::RGBA as u32;
const INTERNAL_FORMAT: i32 = WebGlRenderingCtx::RGBA8 as i32;
const TYPE: u32 = WebGlRenderingCtx::UNSIGNED_BYTE;
#[cfg(feature = "webgl2")]
const INTERNAL_FORMAT: i32 = WebGlRenderingCtx::R32F as i32;
#[cfg(feature = "webgl1")]
const INTERNAL_FORMAT: i32 = WebGlRenderingCtx::LUMINANCE as i32;
const TYPE: u32 = WebGlRenderingCtx::FLOAT;
const CHANNEL_TYPE: ChannelType = ChannelType::R64F;
const CHANNEL_TYPE: ChannelType = ChannelType::R32F;
fn decode(raw_bytes: &[u8]) -> Result<Bytes<'_>, &'static str> {
Ok(Bytes::Borrowed(raw_bytes))
}
type ArrayBufferView = js_sys::Float32Array;
type ArrayBufferView = js_sys::Uint8Array;
unsafe fn view(s: &[<Self::P as Pixel>::Item]) -> Self::ArrayBufferView {
Self::ArrayBufferView::view(s)
@@ -309,6 +291,18 @@ pub enum ChannelType {
R32I,
}
impl ChannelType {
pub fn is_colored(&self) -> bool {
match self {
ChannelType::RGBA32F
| ChannelType::RGB32F
| ChannelType::RGBA8U
| ChannelType::RGB8U => true,
_ => false,
}
}
}
pub const NUM_CHANNELS: usize = 9;
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
@@ -327,12 +321,6 @@ impl ImageFormatType {
}
pub fn is_colored(&self) -> bool {
match self.channel {
ChannelType::RGBA32F
| ChannelType::RGB32F
| ChannelType::RGBA8U
| ChannelType::RGB8U => true,
_ => false,
}
self.channel.is_colored()
}
}

View File

@@ -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>

View File

@@ -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>(

View File

@@ -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

View File

@@ -218,19 +218,19 @@ impl UniformType for Matrix2<f32> {
}
}
use cgmath::Matrix4;
impl UniformType for Matrix4<f32> {
use cgmath::Matrix3;
impl UniformType for Matrix3<f32> {
fn uniform(gl: &WebGlContext, location: Option<&WebGlUniformLocation>, value: &Self) {
gl.uniform_matrix4fv_with_f32_array(location, false, value.as_ref() as &[f32; 16]);
gl.uniform_matrix3fv_with_f32_array(location, false, value.as_ref() as &[f32; 9]);
}
}
use crate::Abort;
impl UniformType for Matrix4<f64> {
impl UniformType for Matrix3<f64> {
fn uniform(gl: &WebGlContext, location: Option<&WebGlUniformLocation>, value: &Self) {
// Cast the matrix
let mat_f32 = value.cast::<f32>().unwrap_abort();
gl.uniform_matrix4fv_with_f32_array(location, false, mat_f32.as_ref() as &[f32; 16]);
gl.uniform_matrix3fv_with_f32_array(location, false, mat_f32.as_ref() as &[f32; 9]);
}
}
use super::texture::Texture2D;

View File

@@ -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,
})
}

View File

@@ -11,6 +11,7 @@ pub trait Pixel:
+ Copy
+ std::fmt::Debug
+ cgmath::Zero
+ cgmath::One
+ std::cmp::PartialEq
+ crate::convert::Cast<f32>;
type Container: ArrayBuffer<Item = Self::Item>;

View File

@@ -24,7 +24,8 @@ fn generate_shaders() -> std::result::Result<(), Box<dyn Error>> {
//.with_extension("")
.to_string_lossy()
.to_owned()
.replace("/", "_");
.replace("/", "_")
.replace("\\", "_");
//let out_name = format!("{}/{}", OUT_PATH, out_file_name);
let src = read_shader(path)?;
@@ -86,7 +87,7 @@ pub fn write(path: PathBuf, entries: HashMap<String, String>) -> Result<(), Box<
for (name, content) in entries {
writeln!(
&mut all_the_files,
r##" out.insert("{name}", r#"{content}"#);"##,
r##" out.insert(r"{name}", r#"{content}"#);"##,
)?;
}

View File

@@ -1,6 +1,7 @@
use crate::renderable::ImageLayer;
use crate::tile_fetcher::HiPSLocalFiles;
use crate::math::angle::ToAngle;
use crate::renderable::hips::HiPS;
use crate::{
//async_task::{BuildCatalogIndex, ParseTableTask, TaskExecutor, TaskResult, TaskType},
@@ -20,6 +21,7 @@ use crate::{
tile_fetcher::TileFetcherQueue,
time::DeltaTime,
};
use al_api::moc::MOCOptions;
use wcs::WCS;
use wasm_bindgen::prelude::*;
@@ -33,7 +35,6 @@ use al_api::{
grid::GridCfg,
hips::{HiPSCfg, ImageMetadata},
};
use cgmath::Vector4;
use fitsrs::{fits::AsyncFits, hdu::extension::AsyncXtensionHDU};
use web_sys::{HtmlElement, WebGl2RenderingContext};
@@ -73,6 +74,7 @@ pub struct App {
// Task executor
//exec: Rc<RefCell<TaskExecutor>>,
inertia: Option<Inertia>,
north_up: bool,
disable_inertia: Rc<RefCell<bool>>,
dist_dragging: f32,
time_start_dragging: Time,
@@ -170,7 +172,7 @@ impl App {
//let tasks_finished = false;
let request_redraw = false;
let rendering = true;
let prev_cam_position = camera.get_center().truncate();
let prev_cam_position = *camera.get_center();
//let prev_center = Vector3::new(0.0, 1.0, 0.0);
let out_of_fov = false;
let catalog_loaded = false;
@@ -186,7 +188,7 @@ impl App {
let request_for_new_tiles = true;
let moc = MOCRenderer::new(&gl)?;
gl.clear_color(0.0, 0.0, 0.0, 1.0);
gl.clear_color(0.1, 0.1, 0.1, 1.0);
let (img_send, img_recv) = async_channel::unbounded::<ImageLayer>();
let (ack_img_send, ack_img_recv) = async_channel::unbounded::<ImageParams>();
@@ -242,7 +244,7 @@ impl App {
catalog_loaded,
tile_fetcher,
north_up: false,
colormaps,
projection,
@@ -274,10 +276,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));
@@ -405,7 +403,7 @@ impl App {
}
pub(crate) fn get_visible_cells(&self, depth: u8) -> Box<[HEALPixCellProjeted]> {
// Convert the camera frame vertices to icrs before doing the moc
// Convert the camera frame vertices to ICRS before doing the moc
let coverage = crate::camera::build_fov_coverage(
depth,
self.camera.get_field_of_view(),
@@ -418,22 +416,22 @@ impl App {
let cells: Vec<_> = coverage
.flatten_to_fixed_depth_cells()
.filter_map(|ipix| {
// this cell is defined in ICRS
// This cell is defined in ICRS
let cell = HEALPixCell(depth, ipix);
let v = cell.vertices();
let proj2screen = |(lon, lat): &(f64, f64)| -> Option<[f64; 2]> {
// 1. convert to xyzw
let xyzw = crate::math::lonlat::radec_to_xyzw(Angle(*lon), Angle(*lat));
// 1. convert to xyz
let xyz = crate::math::lonlat::radec_to_xyz(lon.to_angle(), lat.to_angle());
// 2. get it back to the camera frame system
let xyzw = crate::coosys::apply_coo_system(
let xyz = crate::coosys::apply_coo_system(
CooSystem::ICRS,
self.camera.get_coo_system(),
&xyzw,
&xyz,
);
// 3. project on screen
if let Some(p) = self.projection.model_to_clip_space(&xyzw, &self.camera) {
if let Some(p) = self.projection.model_to_clip_space(&xyz, &self.camera) {
Some([p.x, p.y])
} else {
None
@@ -479,25 +477,25 @@ impl App {
self.catalog_loaded
}
pub(crate) fn get_moc(&self, cfg: &al_api::moc::MOC) -> Option<&HEALPixCoverage> {
self.moc.get_hpx_coverage(cfg)
pub(crate) fn get_moc(&self, moc_uuid: &str) -> Option<&HEALPixCoverage> {
self.moc.get_hpx_coverage(moc_uuid)
}
pub(crate) fn add_moc(
&mut self,
cfg: al_api::moc::MOC,
moc: HEALPixCoverage,
options: MOCOptions,
) -> Result<(), JsValue> {
self.moc
.push_back(moc, cfg, &mut self.camera, &self.projection);
.push_back(moc, options, &mut self.camera, &self.projection);
self.request_redraw = true;
Ok(())
}
pub(crate) fn remove_moc(&mut self, cfg: &al_api::moc::MOC) -> Result<(), JsValue> {
pub(crate) fn remove_moc(&mut self, moc_uuid: &str) -> Result<(), JsValue> {
self.moc
.remove(cfg, &mut self.camera, &self.projection)
.remove(moc_uuid, &mut self.camera, &self.projection)
.ok_or_else(|| JsValue::from_str("MOC not found"))?;
self.request_redraw = true;
@@ -505,9 +503,9 @@ impl App {
Ok(())
}
pub(crate) fn set_moc_cfg(&mut self, cfg: al_api::moc::MOC) -> Result<(), JsValue> {
pub(crate) fn set_moc_options(&mut self, options: MOCOptions) -> Result<(), JsValue> {
self.moc
.set_cfg(cfg, &mut self.camera, &self.projection, &mut self.shaders)
.set_options(options)
.ok_or_else(|| JsValue::from_str("MOC not found"))?;
self.request_redraw = true;
@@ -539,7 +537,7 @@ impl App {
}
}
self.draw(false)?;
self.draw()?;
// Check for async retrieval
if let Ok(img) = self.img_recv.try_recv() {
@@ -715,10 +713,9 @@ impl App {
tile.channel.unwrap() as u16,
)?,
}
self.time_start_blending = Time::now();
}
None => (),
_ => (),
};
}
}
@@ -810,7 +807,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 +885,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 || {
@@ -1280,8 +1277,7 @@ impl App {
// Set the new meta
// 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)?;
self.layers.set_layer_cfg(layer.clone(), meta)?;
if old_meta.img_format != new_img_ext {
// The image format has been changed
@@ -1319,7 +1315,7 @@ impl App {
Ok(())
}
pub(crate) fn get_max_fov(&self) -> f64 {
pub(crate) fn get_max_fov(&self) -> Angle<f64> {
self.projection.aperture_start()
}
@@ -1357,11 +1353,12 @@ impl App {
pub(crate) fn resize(&mut self, width: f32, height: f32) {
self.camera.set_screen_size(width, height, &self.projection);
self.camera
.set_aperture(self.camera.get_aperture(), &self.projection);
.set_zoom_factor(self.camera.get_zoom_factor(), &self.projection);
// resize the view fbo
let screen_size = self.camera.get_screen_size();
self._fbo_view
.resize(screen_size.x as usize, screen_size.y as usize);
//let screen_size = self.camera.get_screen_size();
//self._fbo_view
// .resize(screen_size.x as usize, screen_size.y as usize);
// resize the ui fbo
//self.fbo_ui.resize(w as usize, h as usize);
@@ -1447,12 +1444,12 @@ impl App {
}
pub(crate) fn view_to_icrs_coosys(&self, lonlat: &LonLatT<f64>) -> LonLatT<f64> {
let icrs_pos: Vector4<_> = lonlat.vector();
let celestial_pos = lonlat.vector();
let view_system = self.camera.get_coo_system();
let (ra, dec) = math::lonlat::xyzw_to_radec(&coosys::apply_coo_system(
let (ra, dec) = math::lonlat::xyz_to_radec(&coosys::apply_coo_system(
view_system,
CooSystem::ICRS,
&icrs_pos,
&celestial_pos,
));
LonLatT::new(ra, dec)
@@ -1460,7 +1457,7 @@ impl App {
/// lonlat must be given in icrs frame
pub(crate) fn set_center(&mut self, lonlat: &LonLatT<f64>) {
self.prev_cam_position = self.camera.get_center().truncate();
self.prev_cam_position = *self.camera.get_center();
self.camera.set_center(lonlat, &self.projection);
self.request_for_new_tiles = true;
@@ -1524,11 +1521,11 @@ impl App {
return;
}
let now = Time::now();
let dragging_duration = (now - self.time_start_dragging).as_secs();
let dragging_vel = self.dist_dragging / dragging_duration;
let _dist_dragging = self.dist_dragging;
// Detect if there has been a recent acceleration
// It is also possible that the dragging time is too short and if it is the case, trigger the inertia
let recent_acceleration = (Time::now() - self.time_mouse_high_vel).as_secs() < 0.1
@@ -1541,31 +1538,31 @@ impl App {
// Start inertia here
// Angular distance between the previous and current
// center position
let center = self.camera.get_center().truncate();
let axis = self.prev_cam_position.cross(center).normalize();
let center = self.camera.get_center();
let axis = self.prev_cam_position.cross(*center).normalize();
//let delta_time = ((now - time_of_last_move).0 as f64).max(1.0);
let delta_angle = math::vector::angle3(&self.prev_cam_position, &center).to_radians();
let ampl = delta_angle * (dragging_vel as f64) * 5e-3;
//let ampl = (dragging_vel * 0.01) as f64;
self.inertia = Some(Inertia::new(ampl.to_radians(), axis))
self.inertia = Some(Inertia::new(ampl.to_radians(), axis, self.north_up))
}
pub(crate) fn set_view_center_pos_angle(&mut self, theta: ArcDeg<f64>) {
pub(crate) fn set_position_angle(&mut self, theta: ArcDeg<f64>) {
self.camera
.set_center_pos_angle(theta.into(), &self.projection);
.set_position_angle(theta.into(), &self.projection);
// New tiles can be needed and some tiles can be removed
self.request_for_new_tiles = true;
self.request_redraw = true;
}
pub(crate) fn get_north_shift_angle(&self) -> Angle<f64> {
self.camera.get_center_pos_angle()
pub(crate) fn get_position_angle(&self) -> Angle<f64> {
self.camera.get_position_angle()
}
pub(crate) fn set_fov(&mut self, fov: Angle<f64>) {
pub(crate) fn set_fov(&mut self, fov: f64) {
// For the moment, no animation is triggered.
// The fov is directly set
self.camera.set_aperture(fov, &self.projection);
@@ -1573,17 +1570,20 @@ impl App {
self.request_redraw = true;
}
pub(crate) fn set_fov_range(&mut self, min_fov: Option<f64>, max_fov: Option<f64>) {
self.camera.set_fov_range(
min_fov.map(|v| v.to_radians()),
max_fov.map(|v| v.to_radians()),
&self.projection,
);
self.request_for_new_tiles = true;
self.request_redraw = true;
}
pub(crate) fn set_inertia(&mut self, inertia: bool) {
*self.disable_inertia.borrow_mut() = !inertia;
}
/*pub(crate) fn project_line(&self, lon1: f64, lat1: f64, lon2: f64, lat2: f64) -> Vec<Vector2<f64>> {
let v1: Vector3<f64> = LonLatT::new(ArcDeg(lon1).into(), ArcDeg(lat1).into()).vector();
let v2: Vector3<f64> = LonLatT::new(ArcDeg(lon2).into(), ArcDeg(lat2).into()).vector();
line::project_along_great_circles(&v1, &v2, &self.camera, self.projection)
}*/
pub(crate) fn go_from_to(&mut self, s1x: f64, s1y: f64, s2x: f64, s2y: f64) {
// Select the HiPS layer rendered lastly
if let (Some(w1), Some(w2)) = (
@@ -1592,22 +1592,65 @@ impl App {
self.projection
.screen_to_model_space(&Vector2::new(s2x, s2y), &self.camera),
) {
let prev_pos = w1.truncate();
//let cur_pos = w1.truncate();
let cur_pos = w2.truncate();
//let next_pos = w2.truncate();
let prev_pos = w1;
let cur_pos = w2;
if prev_pos != cur_pos {
/* 1. Rotate by computing the angle between the last and current position */
let prev_cam_position = self.camera.get_center().clone();
// Apply the rotation to the camera to
// go from the current pos to the next position
let axis = prev_pos.cross(cur_pos).normalize();
if self.north_up {
let lonlat1 = prev_pos.lonlat();
let lonlat2 = cur_pos.lonlat();
let d = math::vector::angle3(&prev_pos, &cur_pos);
let dlon = lonlat2.lon() - lonlat1.lon();
let dlat = lonlat2.lat() - lonlat1.lat();
self.camera.apply_lonlat_rotation(dlon, dlat, &self.projection);
self.prev_cam_position = self.camera.get_center().truncate();
self.camera.apply_rotation(&(-axis), d, &self.projection);
// Detect if a pole has been crossed
let north_pole = Vector3::new(0.0, 1.0, 0.0);
let south_pole = Vector3::new(0.0, -1.0, 0.0);
let cross_north_pole = crate::math::lonlat::is_in(&prev_cam_position, &self.camera.get_center(), &north_pole);
let cross_south_pole = crate::math::lonlat::is_in(&prev_cam_position, &self.camera.get_center(), &south_pole);
let cross_pole = cross_north_pole | cross_south_pole;
// Detect if a pole has been crossed
let center = if cross_pole {
&prev_cam_position
} else {
self.camera.get_center()
};
let fov = self.camera.get_aperture();
let pole = if center.y >= 0.0 {
north_pole
} else {
south_pole
};
let c2p = crate::math::vector::angle3(center, &pole).to_radians();
let near_pole = c2p.abs() < 5e-3 * fov;
if near_pole || cross_pole {
// too near to the pole
let axis = center.cross(pole).normalize();
use crate::math::rotation::Rotation;
let new_center = Rotation::from_axis_angle(&axis, (-5e-3 * fov).to_angle()).rotate(&pole);
self.camera.set_center_xyz(&new_center, &self.projection);
self.camera.set_position_angle(0.0.to_angle(), &self.projection);
}
} else {
/* 1. Rotate by computing the angle between the last and current position */
let d = math::vector::angle3(&prev_pos, &cur_pos);
let axis = prev_pos.cross(cur_pos).normalize();
self.camera.apply_axis_rotation(&(-axis), d, &self.projection);
}
self.prev_cam_position = prev_cam_position;
self.request_for_new_tiles = true;
}
} else {
@@ -1615,6 +1658,10 @@ impl App {
}
}
pub(crate) fn lock_north_up(&mut self) {
self.north_up = true;
}
pub(crate) fn add_cmap(&mut self, label: String, cmap: Colormap) -> Result<(), JsValue> {
self.colormaps.add_cmap(label, cmap)
}
@@ -1628,13 +1675,19 @@ impl App {
self.camera.get_texture_depth() as i32
}
pub(crate) fn get_clip_zoom_factor(&self) -> f64 {
self.camera.get_clip_zoom_factor()
pub(crate) fn get_zoom_factor(&self) -> f64 {
self.camera.get_zoom_factor()
}
pub(crate) fn set_zoom_factor(&mut self, zoom_factor: f64) {
self.camera.set_zoom_factor(zoom_factor, &self.projection);
self.request_for_new_tiles = true;
self.request_redraw = true;
}
pub(crate) fn get_fov(&self) -> f64 {
let deg: ArcDeg<f64> = self.camera.get_aperture().into();
deg.0
self.camera.get_aperture().to_degrees()
}
pub(crate) fn get_colormaps(&self) -> &Colormaps {

View File

@@ -1,6 +1,6 @@
use cgmath::{Matrix4, Vector2};
use cgmath::{Matrix3, Vector2};
use crate::math::projection::coo_space::{XYZWModel, XYZWWorld, XYNDC};
use crate::math::projection::coo_space::{XYZModel, XYZWorld, XYNDC};
use crate::math::sph_geom::region::{Intersection, PoleContained, Region};
use crate::math::{projection::Projection, sph_geom::bbox::BoundingBox};
@@ -14,7 +14,7 @@ fn ndc_to_world(
ndc_to_clip: &Vector2<f64>,
clip_zoom_factor: f64,
projection: &ProjectionType,
) -> Option<Vec<XYZWWorld<f64>>> {
) -> Option<Vec<XYZWorld<f64>>> {
// Deproject the FOV from ndc to the world space
let mut world_coo = Vec::with_capacity(ndc_coo.len());
@@ -34,7 +34,7 @@ fn ndc_to_world(
Some(world_coo)
}
fn world_to_model(world_coo: &[XYZWWorld<f64>], w2m: &Matrix4<f64>) -> Vec<XYZWModel<f64>> {
fn world_to_model(world_coo: &[XYZWorld<f64>], w2m: &Matrix3<f64>) -> Vec<XYZModel<f64>> {
let mut model_coo = Vec::with_capacity(world_coo.len());
for w in world_coo.iter() {
@@ -61,8 +61,8 @@ const NUM_VERTICES: usize = 4 + 2 * NUM_VERTICES_WIDTH + 2 * NUM_VERTICES_HEIGHT
pub struct FieldOfView {
// Vertices
ndc_vertices: Vec<XYNDC<f64>>,
world_vertices: Option<Vec<XYZWWorld<f64>>>,
model_vertices: Option<Vec<XYZWModel<f64>>>,
world_vertices: Option<Vec<XYZWorld<f64>>>,
model_vertices: Option<Vec<XYZModel<f64>>>,
reg: Region,
}
@@ -73,7 +73,7 @@ impl FieldOfView {
ndc_to_clip: &Vector2<f64>,
clip_zoom_factor: f64,
// rotation
rotation_mat: &Matrix4<f64>,
rotation_mat: &Matrix3<f64>,
// projection
projection: &ProjectionType,
) -> Self {
@@ -123,7 +123,7 @@ impl FieldOfView {
&mut self,
ndc_to_clip: &Vector2<f64>,
clip_zoom_factor: f64,
rotate_mat: &Matrix4<f64>,
rotate_mat: &Matrix3<f64>,
projection: &ProjectionType,
) {
self.world_vertices = ndc_to_world(
@@ -135,7 +135,7 @@ impl FieldOfView {
self.set_rotation(rotate_mat);
}
pub fn set_rotation(&mut self, rotate_mat: &Matrix4<f64>) {
pub fn set_rotation(&mut self, rotate_mat: &Matrix3<f64>) {
if let Some(world_vertices) = &self.world_vertices {
self.model_vertices = Some(world_to_model(world_vertices, rotate_mat));
} else {
@@ -186,7 +186,7 @@ impl FieldOfView {
}
}
pub fn get_vertices(&self) -> Option<&Vec<XYZWModel<f64>>> {
pub fn get_vertices(&self) -> Option<&Vec<XYZModel<f64>>> {
self.model_vertices.as_ref()
}

View File

@@ -1,6 +1,6 @@
pub mod viewport;
use crate::math::lonlat::LonLat;
use crate::math::projection::coo_space::XYZWModel;
use crate::math::projection::coo_space::XYZModel;
pub use viewport::CameraViewPort;
pub mod fov;
@@ -14,7 +14,7 @@ use crate::ProjectionType;
pub fn build_fov_coverage(
depth: u8,
fov: &FieldOfView,
camera_center: &XYZWModel<f64>,
camera_center: &XYZModel<f64>,
camera_frame: CooSystem,
frame: CooSystem,
proj: &ProjectionType,
@@ -40,8 +40,8 @@ pub fn build_fov_coverage(
// See https://github.com/cds-astro/cds-moc-rust/issues/3
let hpx_idxs_iter = vertices_iter.map(|v| {
let (lon, lat) = crate::math::lonlat::xyzw_to_radec(&v);
::healpix::nested::hash(depth, lon.0, lat.0)
let (lon, lat) = crate::math::lonlat::xyz_to_radec(&v);
::healpix::nested::hash(depth, lon.to_radians(), lat.to_radians())
});
HEALPixCoverage::from_fixed_hpx_cells(depth, hpx_idxs_iter, Some(vertices.len()))
@@ -55,10 +55,10 @@ pub fn build_fov_coverage(
moc
}
} else {
let center_xyzw = crate::coosys::apply_coo_system(camera_frame, frame, camera_center);
let center_xyz = crate::coosys::apply_coo_system(camera_frame, frame, camera_center);
let biggest_fov_rad = proj.aperture_start().to_radians();
let lonlat = center_xyzw.lonlat();
let lonlat = center_xyz.lonlat();
HEALPixCoverage::from_cone(&lonlat, biggest_fov_rad * 0.5, depth)
}
}

View File

@@ -1,4 +1,4 @@
use crate::camera::XYZWModel;
use crate::camera::XYZModel;
use crate::healpix::cell::HEALPixCell;
use crate::math::projection::*;
@@ -30,7 +30,7 @@ impl ViewHpxCells {
&mut self,
camera_depth: u8,
fov: &FieldOfView,
center: &XYZWModel<f64>,
center: &XYZModel<f64>,
camera_frame: CooSystem,
proj: &ProjectionType,
// survey frame
@@ -48,7 +48,7 @@ impl ViewHpxCells {
&mut self,
camera_depth: u8,
fov: &FieldOfView,
center: &XYZWModel<f64>,
center: &XYZModel<f64>,
camera_frame: CooSystem,
proj: &ProjectionType,
// survey frame
@@ -68,7 +68,7 @@ impl ViewHpxCells {
&mut self,
camera_depth: u8,
fov: &FieldOfView,
center: &XYZWModel<f64>,
center: &XYZModel<f64>,
camera_frame: CooSystem,
proj: &ProjectionType,
) {
@@ -149,7 +149,7 @@ impl HpxCells {
&mut self,
camera_depth: u8,
fov: &FieldOfView,
center: &XYZWModel<f64>,
center: &XYZModel<f64>,
camera_frame: CooSystem,
proj: &ProjectionType,
) {

View File

@@ -6,27 +6,34 @@ pub enum UserAction {
Starting = 4,
}
use web_sys::WebGl2RenderingContext;
// Longitude reversed identity matrix
const ID_R: &Matrix4<f64> = &Matrix4::new(
-1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
const ID_R: &Matrix3<f64> = &Matrix3::new(
-1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
);
use cgmath::{Vector3, InnerSpace};
use super::{fov::FieldOfView, view_hpx_cells::ViewHpxCells};
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 crate::math::{projection::coo_space::XYZModel, projection::domain::sdf::ProjDef};
use cgmath::{Matrix3, Vector2};
const APERTURE_LOWER_LIMIT_RAD: f64 = (1.0_f64 / 36000.0).to_radians();
const ZOOM_FACTOR_UPPER_LIMIT: f64 = 2.0;
use cgmath::{Matrix4, Vector2};
pub struct CameraViewPort {
// The field of view angle
aperture: Angle<f64>,
aperture: f64,
// The rotation of the camera
center: Vector4<f64>,
center: Vector3<f64>,
w2m_rot: Rotation<f64>,
w2m: Matrix4<f64>,
m2w: Matrix4<f64>,
w2m: Matrix3<f64>,
m2w: Matrix3<f64>,
// The width over height ratio
aspect: f32,
// The width of the screen in pixels
@@ -43,7 +50,7 @@ pub struct CameraViewPort {
// Internal variable used for projection purposes
ndc_to_clip: Vector2<f64>,
clip_zoom_factor: f64,
zoom_factor: f64,
// The vertices in model space of the camera
// This is useful for computing views according
// to different image surveys
@@ -70,6 +77,11 @@ pub struct CameraViewPort {
gl: WebGlContext,
coo_sys: CooSystem,
reversed_longitude: bool,
// min field of view, by default 0.1 arcsec
pub(crate) min_fov: Option<f64>,
// an optional max field of view
pub(crate) max_fov: Option<f64>,
}
use al_api::coo_system::CooSystem;
use al_core::WebGlContext;
@@ -80,14 +92,13 @@ use crate::{
};
use crate::LonLatT;
use cgmath::{SquareMatrix, Vector4};
use cgmath::SquareMatrix;
use wasm_bindgen::JsCast;
const MAX_DPI_LIMIT: f32 = 2.0;
use crate::math;
use crate::time::Time;
use crate::Abort;
use crate::ArcDeg;
impl CameraViewPort {
pub fn new(
gl: &WebGlContext,
@@ -96,11 +107,11 @@ impl CameraViewPort {
) -> CameraViewPort {
let last_user_action = UserAction::Starting;
let aperture = Angle(projection.aperture_start());
let aperture = projection.aperture_start().to_radians();
let w2m = Matrix4::identity();
let w2m = Matrix3::identity();
let m2w = w2m;
let center = Vector4::new(0.0, 0.0, 0.0, 1.0);
let center = Vector3::new(0.0, 0.0, 0.0);
let moved = false;
let zoomed = false;
@@ -122,9 +133,9 @@ impl CameraViewPort {
let aspect = height / width;
let ndc_to_clip = Vector2::new(1.0, (height as f64) / (width as f64));
let clip_zoom_factor = 1.0;
let zoom_factor = 1.0;
let fov = FieldOfView::new(&ndc_to_clip, clip_zoom_factor, &w2m, projection);
let fov = FieldOfView::new(&ndc_to_clip, zoom_factor, &w2m, projection);
let gl = gl.clone();
let is_allsky = true;
@@ -154,7 +165,7 @@ impl CameraViewPort {
// Internal variable used for projection purposes
ndc_to_clip,
clip_zoom_factor,
zoom_factor,
// The field of view
fov,
view_hpx_cells,
@@ -177,6 +188,9 @@ impl CameraViewPort {
coo_sys,
// a flag telling if the viewport has a reversed longitude axis
reversed_longitude,
min_fov: None,
max_fov: None,
}
}
@@ -223,13 +237,13 @@ impl CameraViewPort {
// check the projection
match proj {
ProjectionType::Tan(_) => self.aperture >= 100.0_f64.to_radians().to_angle(),
ProjectionType::Mer(_) => self.aperture >= 120.0_f64.to_radians().to_angle(),
ProjectionType::Stg(_) => self.aperture >= 200.0_f64.to_radians().to_angle(),
ProjectionType::Tan(_) => self.aperture >= 100.0_f64.to_radians(),
ProjectionType::Mer(_) => self.aperture >= 120.0_f64.to_radians(),
ProjectionType::Stg(_) => self.aperture >= 200.0_f64.to_radians(),
ProjectionType::Sin(_) => false,
ProjectionType::Ait(_) => self.aperture >= 100.0_f64.to_radians().to_angle(),
ProjectionType::Mol(_) => self.aperture >= 100.0_f64.to_radians().to_angle(),
ProjectionType::Zea(_) => self.aperture >= 140.0_f64.to_radians().to_angle(),
ProjectionType::Ait(_) => self.aperture >= 100.0_f64.to_radians(),
ProjectionType::Mol(_) => self.aperture >= 100.0_f64.to_radians(),
ProjectionType::Zea(_) => self.aperture >= 140.0_f64.to_radians(),
}
}
@@ -278,12 +292,8 @@ impl CameraViewPort {
// Compute the new clip zoom factor
self.compute_ndc_to_clip_factor(projection);
self.fov.set_aperture(
&self.ndc_to_clip,
self.clip_zoom_factor,
&self.w2m,
projection,
);
self.fov
.set_aperture(&self.ndc_to_clip, self.zoom_factor, &self.w2m, projection);
let proj_area = projection.get_area();
self.is_allsky = !proj_area.is_in(&math::projection::ndc_to_clip_space(
@@ -325,7 +335,74 @@ impl CameraViewPort {
self.set_aperture(self.aperture, proj);
}
pub fn set_aperture(&mut self, aperture: Angle<f64>, proj: &ProjectionType) {
/// Give a FoV range in radians
pub(crate) fn set_fov_range(
&mut self,
mut min_fov: Option<f64>,
mut max_fov: Option<f64>,
proj: &ProjectionType,
) {
// Invert the min and max bounds if min > max
if let (Some(min_fov), Some(max_fov)) = (min_fov.as_mut(), max_fov.as_mut()) {
if *max_fov < *min_fov {
std::mem::swap(max_fov, min_fov);
}
}
self.min_fov = min_fov;
self.max_fov = max_fov;
self.set_aperture(self.aperture, proj);
}
pub(crate) fn at_zoom_boundaries(&self, proj: &ProjectionType) -> bool {
// The zoom factor cannot exceed an upper limit
if self.zoom_factor >= ZOOM_FACTOR_UPPER_LIMIT {
return true;
}
// The field of view cannot go deeper a lower limit
if self.aperture <= APERTURE_LOWER_LIMIT_RAD {
return true;
}
// The field of view might be forced in a user defined range
if let Some(min_fov) = self.min_fov {
if self.aperture <= min_fov {
return true;
}
}
if let Some(max_fov) = self.max_fov {
if self.aperture >= max_fov {
return true;
}
}
let can_unzoom_more = match proj {
ProjectionType::Tan(_) | ProjectionType::Mer(_) | ProjectionType::Stg(_) => false,
_ => true,
};
if !can_unzoom_more && self.zoom_factor >= 1.0 {
return true;
}
false
}
pub(crate) fn set_aperture(&mut self, mut aperture: f64, proj: &ProjectionType) {
// Force the given aperture by a range given by the user
if let Some(min_fov) = self.min_fov {
aperture = aperture.max(min_fov);
}
if let Some(max_fov) = self.max_fov {
aperture = aperture.min(max_fov);
}
// Limit internally the aperture to 0.1 arcsec
aperture = aperture.max(APERTURE_LOWER_LIMIT_RAD);
// Checking if we are zooming or unzooming
// This is used internaly for the raytracer to compute
// blending between tiles and their parents (or children)
@@ -338,23 +415,15 @@ impl CameraViewPort {
};
let can_unzoom_more = match proj {
ProjectionType::Tan(_)
| ProjectionType::Mer(_)
//| ProjectionType::Air(_)
| ProjectionType::Stg(_) => false,
//| ProjectionType::Car(_)
//| ProjectionType::Cea(_)
//| ProjectionType::Cyp(_)
//| ProjectionType::Hpx(_) => false,
ProjectionType::Tan(_) | ProjectionType::Mer(_) | ProjectionType::Stg(_) => false,
_ => true,
};
let aperture_start: Angle<f64> = ArcDeg(proj.aperture_start()).into();
let aperture_start: f64 = proj.aperture_start().to_radians();
self.clip_zoom_factor = if aperture > aperture_start {
//al_core::log(&format!("a: {:?}, as: {:?}", aperture, aperture_start));
self.zoom_factor = if aperture > aperture_start {
if can_unzoom_more {
aperture.0 / aperture_start.0
aperture / aperture_start
} else {
1.0
}
@@ -362,35 +431,24 @@ impl CameraViewPort {
// Compute the new clip zoom factor
let a = aperture.abs();
let v0 = math::lonlat::radec_to_xyzw(-a / 2.0, Angle(0.0));
let v1 = math::lonlat::radec_to_xyzw(a / 2.0, Angle(0.0));
let v0 = math::lonlat::radec_to_xyz(-a.to_angle() / 2.0, 0.0.to_angle());
let v1 = math::lonlat::radec_to_xyz(a.to_angle() / 2.0, 0.0.to_angle());
// Vertex in the WCS of the FOV
if self.width < self.height {
if let (Some(p0), Some(p1)) =
(proj.world_to_clip_space(&v0), proj.world_to_clip_space(&v1))
{
(0.5 * (p1.x - p0.x).abs()).min(1.0)
} else {
1.0
}
if let (Some(p0), Some(p1)) =
(proj.world_to_clip_space(&v0), proj.world_to_clip_space(&v1))
{
(0.5 * (p1.x - p0.x).abs()).min(1.0)
} else {
if let (Some(p0), Some(p1)) =
(proj.world_to_clip_space(&v0), proj.world_to_clip_space(&v1))
{
(0.5 * (p1.x - p0.x).abs()).min(1.0)
} else {
1.0
}
1.0
}
};
// Limit the zoom factor to not unzoom too much
self.zoom_factor = self.zoom_factor.min(ZOOM_FACTOR_UPPER_LIMIT);
// Limit later the aperture to aperture_start
self.aperture = aperture.min(aperture_start);
//self.aperture = aperture;
//al_core::log(&format!("zoom factor {:?}", self.clip_zoom_factor));
//console_log(&format!("clip factor {:?}", self.aperture));
// Project this vertex into the screen
self.moved = true;
@@ -398,7 +456,101 @@ impl CameraViewPort {
self.time_last_move = Time::now();
self.fov
.set_aperture(&self.ndc_to_clip, self.clip_zoom_factor, &self.w2m, proj);
.set_aperture(&self.ndc_to_clip, self.zoom_factor, &self.w2m, proj);
let proj_area = proj.get_area();
self.is_allsky = !proj_area.is_in(&math::projection::ndc_to_clip_space(
&Vector2::new(-1.0, -1.0),
self,
));
self.compute_texture_depth();
// Recompute the scissor with the new aperture
self.recompute_scissor();
// Compute the hpx cells
self.view_hpx_cells.update(
self.texture_depth,
&self.fov,
&self.center,
self.get_coo_system(),
proj,
);
}
pub(crate) fn set_zoom_factor(&mut self, zoom_factor: f64, proj: &ProjectionType) {
// Checking if we are zooming or unzooming
// This is used internaly for the raytracer to compute
// blending between tiles and their parents (or children)
self.last_user_action = if self.zoom_factor > zoom_factor {
UserAction::Zooming
} else if self.zoom_factor < zoom_factor {
UserAction::Unzooming
} else {
self.last_user_action
};
let can_unzoom_more = match proj {
ProjectionType::Tan(_) | ProjectionType::Mer(_) | ProjectionType::Stg(_) => false,
_ => true,
};
// Set the zoom factor
self.zoom_factor = zoom_factor;
// Limit it to prevent unzooming infinitely
self.zoom_factor = self.zoom_factor.min(ZOOM_FACTOR_UPPER_LIMIT);
let aperture_start = proj.aperture_start().to_radians();
// clamp it to one if we cannot unzoom more (because of the projection)
let aperture = if !can_unzoom_more && zoom_factor >= 1.0 {
self.zoom_factor = 1.0;
aperture_start
} else if can_unzoom_more && zoom_factor >= 1.0 {
aperture_start
} else {
// zoom_factor < 1.0
if let Some((lon, _)) = proj
.clip_to_world_space(&Vector2::new(self.zoom_factor, 0.0))
.map(|xyz| math::lonlat::xyz_to_radec(&xyz))
{
lon.to_radians().abs() * 2.0
} else {
aperture_start
}
};
// Force the given aperture to be in an optional range given by the user
let mut clamped_aperture = aperture;
if let Some(min_fov) = self.min_fov {
clamped_aperture = clamped_aperture.max(min_fov);
}
if let Some(max_fov) = self.max_fov {
clamped_aperture = clamped_aperture.min(max_fov);
}
// The aperture must also be > to a lower limit
clamped_aperture = clamped_aperture.max(APERTURE_LOWER_LIMIT_RAD);
if clamped_aperture != aperture {
// there has been a clamping of the aperture, then we recompute the zoom factor
// with the new clamped aperture
self.set_aperture(clamped_aperture, proj);
return;
}
self.aperture = aperture;
// Project this vertex into the screen
self.moved = true;
self.zoomed = true;
self.time_last_move = Time::now();
self.fov
.set_aperture(&self.ndc_to_clip, self.zoom_factor, &self.w2m, proj);
let proj_area = proj.get_area();
self.is_allsky = !proj_area.is_in(&math::projection::ndc_to_clip_space(
@@ -448,8 +600,7 @@ impl CameraViewPort {
let smallest_cell_size_px = self.dpi as f64;
let mut depth_pixel = 29 as usize;
let hpx_cell_size_rad =
(smallest_cell_size_px / w_screen_px) * self.get_aperture().to_radians();
let hpx_cell_size_rad = (smallest_cell_size_px / w_screen_px) * self.get_aperture();
while depth_pixel > 0 {
if crate::healpix::utils::MEAN_HPX_CELL_RES[depth_pixel] > hpx_cell_size_rad {
@@ -471,7 +622,7 @@ impl CameraViewPort {
self.texture_depth
}
pub fn apply_rotation(
pub fn apply_axis_rotation(
&mut self,
axis: &cgmath::Vector3<f64>,
angle: Angle<f64>,
@@ -484,15 +635,30 @@ impl CameraViewPort {
self.update_rot_matrices(proj);
}
pub fn apply_lonlat_rotation(
&mut self,
dlon: Angle<f64>,
dlat: Angle<f64>,
proj: &ProjectionType
) {
let center = self.get_center();
let rot = Rotation::from_axis_angle(&Vector3::new(center.z, 0.0, -center.x).normalize(), dlat) * Rotation::from_axis_angle(&Vector3::unit_y(), -dlon) * Rotation::from_sky_position(&center);
self.set_rotation(&rot, proj);
}
/// center lonlat must be given in icrs frame
pub fn set_center(&mut self, lonlat: &LonLatT<f64>, proj: &ProjectionType) {
let icrs_pos: Vector4<_> = lonlat.vector();
let icrs_pos = lonlat.vector();
self.set_center_xyz(&icrs_pos, proj);
}
let view_pos = CooSystem::ICRS.to(self.get_coo_system()) * icrs_pos;
let rot_to_center = Rotation::from_sky_position(&view_pos);
pub fn set_center_xyz(&mut self, xyz: &Vector3<f64>, proj: &ProjectionType) {
let center = CooSystem::ICRS.to(self.get_coo_system()) * xyz;
let rot_to_center = Rotation::from_sky_position(&center);
let phi = self.get_center_pos_angle();
let third_euler_rot = Rotation::from_axis_angle(&view_pos.truncate(), phi);
let phi = self.get_position_angle();
let third_euler_rot = Rotation::from_axis_angle(&center, phi);
let rot = third_euler_rot * rot_to_center;
@@ -501,15 +667,16 @@ impl CameraViewPort {
self.set_rotation(&rot, proj);
}
pub fn set_center_pos_angle(&mut self, phi: Angle<f64>, proj: &ProjectionType) {
let rot_to_center = Rotation::from_sky_position(&self.center);
let third_euler_rot = Rotation::from_axis_angle(&self.center.truncate(), phi);
pub fn set_position_angle(&mut self, phi: Angle<f64>, proj: &ProjectionType) {
let c = self.center;
let rot_to_center = Rotation::from_sky_position(&c);
let third_euler_rot = Rotation::from_axis_angle(&c, phi);
let total_rot = third_euler_rot * rot_to_center;
self.set_rotation(&total_rot, proj);
}
fn set_rotation(&mut self, rot: &Rotation<f64>, proj: &ProjectionType) {
pub fn set_rotation(&mut self, rot: &Rotation<f64>, proj: &ProjectionType) {
self.w2m_rot = *rot;
self.update_rot_matrices(proj);
@@ -548,6 +715,13 @@ impl CameraViewPort {
if self.reversed_longitude != reversed_longitude {
self.reversed_longitude = reversed_longitude;
// Change the cull face, this fixes the display of MOC hpx cells when longitude is reversed
if self.reversed_longitude {
self.gl.cull_face(WebGl2RenderingContext::FRONT);
} else {
self.gl.cull_face(WebGl2RenderingContext::BACK);
}
self.update_rot_matrices(proj);
}
}
@@ -557,11 +731,11 @@ impl CameraViewPort {
}
// Accessors
pub fn get_w2m(&self) -> &cgmath::Matrix4<f64> {
pub fn get_w2m(&self) -> &cgmath::Matrix3<f64> {
&self.w2m
}
pub fn get_m2w(&self) -> &cgmath::Matrix4<f64> {
pub fn get_m2w(&self) -> &cgmath::Matrix3<f64> {
&self.m2w
}
@@ -573,11 +747,11 @@ impl CameraViewPort {
&self.ndc_to_clip
}
pub fn get_clip_zoom_factor(&self) -> f64 {
self.clip_zoom_factor
pub fn get_zoom_factor(&self) -> f64 {
self.zoom_factor
}
pub fn get_vertices(&self) -> Option<&Vec<XYZWModel<f64>>> {
pub fn get_vertices(&self) -> Option<&Vec<XYZModel<f64>>> {
self.fov.get_vertices()
}
@@ -615,13 +789,14 @@ impl CameraViewPort {
self.zoomed = false;
}
/// Aperture is given in radians
#[inline]
pub fn get_aperture(&self) -> Angle<f64> {
pub fn get_aperture(&self) -> f64 {
self.aperture
}
#[inline]
pub fn get_center(&self) -> &Vector4<f64> {
pub fn get_center(&self) -> &Vector3<f64> {
&self.center
}
@@ -638,7 +813,7 @@ impl CameraViewPort {
self.coo_sys
}
pub fn get_center_pos_angle(&self) -> Angle<f64> {
pub fn get_position_angle(&self) -> Angle<f64> {
(self.w2m.x.y).atan2(self.w2m.y.y).to_angle()
}
}
@@ -680,7 +855,7 @@ impl SendUniforms for CameraViewPort {
fn attach_uniforms<'a>(&self, shader: &'a ShaderBound<'a>) -> &'a ShaderBound<'a> {
shader
.attach_uniform("ndc_to_clip", &self.ndc_to_clip) // Send ndc to clip
.attach_uniform("czf", &self.clip_zoom_factor); // Send clip zoom factor
.attach_uniform("czf", &self.zoom_factor); // Send clip zoom factor
shader
}

Some files were not shown because too many files have changed in this diff Show More