Compare commits

...

80 Commits

Author SHA1 Message Date
Matthieu Baumann
5b3b038a08 Merge branch 'develop' 2026-03-05 15:25:03 +01:00
Matthieu Baumann
543fc7ef8e fix doc 2026-03-05 14:57:24 +01:00
Matthieu Baumann
1780d6c55d v3.8.1 2026-03-05 14:41:30 +01:00
Matthieu Baumann
abb75ddb47 unstage snapshots 2026-03-05 14:31:58 +01:00
Matthieu Baumann
d29d900354 add test on rotation angle before giving it to aladin lite: https://github.com/cds-astro/aladin-lite/issues/330 2026-03-05 14:29:14 +01:00
Matthieu Baumann
3a6455e018 impl https://github.com/cds-astro/aladin-lite/issues/337 2026-03-05 11:43:38 +01:00
Tom Donaldson
fb0a562b09 Update CHANGELOG.md 2026-03-05 09:40:48 +01:00
Tom Donaldson
19f06fe0bf Minor doc text update 2026-03-05 09:40:48 +01:00
Tom Donaldson
2fed96e2a4 Minor doc text update 2026-03-05 09:40:48 +01:00
Tom Donaldson
5f5fd7b555 Support selectionLineWidth option for shapes and catalogs 2026-03-05 09:40:48 +01:00
Matthieu Baumann
bdb4f4aa5b fix https://github.com/cds-astro/aladin-lite/issues/342 change wcs if the real size of the image does not match the NAXIS values 2026-03-04 18:51:10 +01:00
Matthieu Baumann
5567b14b6a add getFrequencyWindow on HiPS3D object 2026-03-04 17:55:39 +01:00
Matthieu Baumann
bf290e13e4 Fix stackChanged 2026-03-04 15:19:29 +01:00
Matthieu Baumann
f41765adcd Fix commit
* HiPS3D in fits black artifact removed
* accepts fits ext files when searching for a FITS image to display
2026-03-04 14:34:17 +01:00
Matthieu Baumann
cf8c793312 impl Worker for handling png cropping of tiles 2026-03-03 22:47:20 +01:00
Matthieu Baumann
abd97ffade fix #352 2026-03-03 15:55:54 +01:00
Matthieu Baumann
55cdf454b7 open the context menu if rightclick is not called. potential fix to #348 2026-03-03 11:56:45 +01:00
Matthieu Baumann
a7c412088c do not clip the windows out of the aladin lite div #345 2026-03-02 17:43:43 +01:00
Matthieu Baumann
887284da23 fix #350: preventDefault prevents click event to be triggered after a starttouch/endtouch 2026-03-02 11:30:30 +01:00
Matthieu Baumann
ff6399471c fix #351 2026-03-02 11:02:22 +01:00
Matthieu Baumann
0861294c66 fix #353 by adding more precision when displaying meridian grid labels 2026-03-02 10:11:06 +01:00
Matthieu Baumann
7aab92cb54 web worker WIP 2026-02-05 14:22:35 +01:00
Matthieu Baumann
c8a75b98db fix cargo clippy 2026-02-03 17:43:50 +01:00
Matthieu Baumann
47cbcee65a fix offsrte color picker 2026-02-03 11:36:13 +01:00
Matthieu Baumann
9d29a4f500 add documentation for Toolbar.add method 2026-02-01 16:55:21 +01:00
Matthieu Baumann
ab5019603b remove comment 2026-01-31 23:06:29 +01:00
Matthieu Baumann
5a9561a13a change license from GPL3 to LGPL3 2026-01-31 23:06:29 +01:00
Matthieu Baumann
63cd03426b versionning 3.8 2026-01-31 16:46:50 +01:00
Matthieu Baumann
743fad666e fix cargo clippy 2026-01-31 16:46:50 +01:00
Matthieu Baumann
8b645824c7 toolbar functional 2026-01-31 16:46:50 +01:00
Matthieu Baumann
45129708db fix some bgs before beta 2026-01-31 16:46:50 +01:00
Matthieu Baumann
796603596d colorpicker valid tooltip 2026-01-31 16:46:50 +01:00
Matthieu Baumann
fe18121e54 add toolbar 2026-01-31 16:46:50 +01:00
Matthieu Baumann
e7d58d42ee toggle refac + toolbar 2026-01-31 16:46:50 +01:00
Matthieu Baumann
09ebaeea79 fix local hips bug 2026-01-31 16:46:50 +01:00
Matthieu Baumann
94411f9ca9 fix displacement bug when the inertia is triggered after a zoom/unzoom 2026-01-31 16:46:50 +01:00
Matthieu Baumann
79e6a33d88 HiPS browser adjustements 2026-01-31 16:46:50 +01:00
Matthieu Baumann
df32ba250b wip hips composite ui 2026-01-31 16:46:50 +01:00
Matthieu Baumann
c50fdb7430 fix polygonal selection #339 2026-01-31 16:46:50 +01:00
Matthieu Baumann
1894f908f4 add settings for catalogs 2026-01-31 16:46:50 +01:00
Matthieu Baumann
c674864762 simplify UI Layout 2026-01-31 16:46:50 +01:00
Matthieu Baumann
ba86645204 enhance hips browsing window stability 2026-01-31 16:46:50 +01:00
Matthieu Baumann
3aff9b308b add floating tooltip 2026-01-31 16:46:50 +01:00
Matthieu Baumann
6cc06ab51e first commit 2026-01-31 16:46:50 +01:00
Matthieu Baumann
2ef5e47c27 update changelog 2026-01-07 11:39:10 +01:00
Matthieu Baumann
337618d6ef remove logs 2026-01-07 10:09:13 +01:00
Matthieu Baumann
832e8cd4bd bugfix allsky fits not appearing 2026-01-07 10:05:04 +01:00
Matthieu Baumann
28869645cd fix opacity restore in UI, and screen size shrinking 2025-12-12 11:27:03 +01:00
Matthieu Baumann
da8eb6f76e feat: swap layer orders 2025-12-08 17:46:34 +01:00
Matthieu Baumann
0e3a359108 wip base layer 2025-12-08 14:33:31 +01:00
Matthieu Baumann
af89535a91 first commit tree 2025-12-08 14:33:29 +01:00
Matthieu Baumann
8d244596ba 3.7.3-beta 2025-11-05 15:16:36 +01:00
Matthieu Baumann
2a23e83c13 update fitsrs version 2025-10-20 14:41:30 +02:00
Matthieu Baumann
7b8272795d cargo clippy 2025-10-20 10:12:58 +02:00
Matthieu Baumann
4d8b4bfb21 Many fixes
* fix: HiPS3D probing spectra in galactic frame
* ui: new more option in the HiPS selector allowing to change the base layer with an arbitrary HiPS from the UI
* fits: support tile compressed image in bintable extensions (SRCNet feature: https://jira.skatelescope.org/browse/MAN-559)
2025-10-20 09:59:49 +02:00
Matthieu Baumann
ebf8845e83 fix opacity param for PolyLines #316 2025-09-29 15:35:02 +02:00
Matthieu Baumann
f863ac902c fix 0.5 pixel offset when plotting FITS image files 2025-09-29 14:29:38 +02:00
Matthieu Baumann
75123e6bc8 first commit 2025-09-25 10:37:40 +02:00
Matthieu Baumann
d5d7d2a650 3.7.2 2025-09-25 10:36:14 +02:00
Matthieu Baumann
d22c25ea8a add npm deploy routine in package json 2025-09-24 17:13:24 +02:00
Matthieu Baumann
acef664b45 cargo clippy 2025-09-24 17:08:32 +02:00
Matthieu Baumann
9e8db0379b cargo clippy & fmt 2025-09-24 16:59:31 +02:00
Matthieu Baumann
032bb57517 rotation improve perf and numerical instabilities 2025-09-23 17:20:16 +02:00
Matthieu Baumann
f0fc39d2c8 drag outside the projection domain 2025-09-22 15:38:58 +02:00
Matthieu Baumann
2df32cb643 change u-strasbg to cds.unistra urls + enhance/simplify inertia effect 2025-09-22 11:11:12 +02:00
Matthieu Baumann
904d449006 fix: setCuts with imageFormat, Add more HiPS search 2025-09-19 13:59:25 +02:00
Matthieu Baumann
2594aff1b6 fix: crossOrigin set for HtmlImageElement from requestCredentials 2025-09-17 17:02:40 +02:00
Matthieu Baumann
547c5422d4 add minified shaders 2025-09-17 14:26:45 +02:00
Matthieu Baumann
9bcc93877b change changelog 2025-09-15 14:11:52 +02:00
Matthieu Baumann
3f6f247735 add changelog 3.7.0 2025-09-15 11:58:51 +02:00
Matthieu Baumann
c6c7ad44c9 add a prod routine only for internal production deployment on our server. npm run serve should behave like before 2025-09-12 18:04:08 +02:00
Matthieu Baumann
cdc1733c4f Add label to checkbox UI filter enabler 2025-09-12 11:05:32 +02:00
Matthieu Baumann
6e40dbbfc1 update testing snapshots 2025-09-11 17:52:27 +02:00
Matthieu Baumann
e03b16119b several fixes: panic when delaying resources treatments + ICRS sexa 2025-09-11 17:49:05 +02:00
Matthieu Baumann
e3162426be fix: restore polyselect 2025-09-11 15:35:39 +02:00
Matthieu Baumann
5a285dabed cargo clippy 2025-09-11 15:00:53 +02:00
Matthieu Baumann
2d04730623 fix: read pixel for jpg (works like rgba) and fits (1px offset fix + switch bytes order) 2025-09-11 14:31:45 +02:00
bmatthieu3
390c9096d7 NED tap access 2025-09-10 11:52:15 +02:00
Thomas Boch
0e9998a7fc Merge pull request #327 from cds-astro/customize-share-url-function
Customize share URL function
2025-09-10 11:22:42 +02:00
Thomas Boch
7f1f69983f Create AUTHORS file 2025-04-22 15:23:56 +02:00
235 changed files with 7622 additions and 11839 deletions

View File

@@ -32,7 +32,7 @@ jobs:
npm install
- name: "Build Aladin Lite"
run: |
npm run build
npm run build:npm
- name: "Publish Aladin Lite to npm"
run: |
npm publish

10
.gitignore vendored
View File

@@ -15,9 +15,11 @@ package-lock.json
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
# the tmp glsl files used when minifying the shaders into the wasm (build.rs)
src/glsl/webgl2/**/*.min
src/glsl/webgl2/**/*.tmp
package/
## python related
# python environment
@@ -37,6 +39,8 @@ jsdoc-make-responsivedocs
test-results/
playwright-report/
tests/run-examples.spec.ts-snapshots
## packaged tar obtained from the cmd: npm run predeploy or npm run deploy
aladin-lite*.tgz
# folder where the generated bundle lies

25
AUTHORS Normal file
View File

@@ -0,0 +1,25 @@
AUTHORS
=======
This file lists the main developers and contributors to this project.
For a full list of commit authors, see: https://github.com/cds-astro/aladin-lite/graphs/contributors
Institutional Affiliation
--------------------------
Centre de Données astronomiques de Strasbourg (CDS)
https://cds.unistra.fr/
Main Developers
---------------
Thomas Boch (@tboch)
Matthieu Baumann (@bmatthieu3)
Acknowledgments
---------------
We also acknowledge all contributors who have submitted bug reports, feature requests,
documentation improvements, and patches through GitHub issues and pull requests.
This project is hosted on GitHub:
https://github.com/cds-astro/aladin-lite

View File

@@ -4,11 +4,51 @@
### 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.8.0
* [feat] Selected and hovered items (shapes, sources, ...) are rendered at last. <https://github.com/cds-astro/aladin-lite/issues/337>
* [feat] Add selectionLineWidth option for shapes and catalogs. <https://github.com/cds-astro/aladin-lite/pull/354>
* [fix] horizontal/vertical overlay lines appearing correctly <https://github.com/cds-astro/aladin-lite/issues/334>
* [fix] layer opacity restored when switching from not visible to visible <https://github.com/cds-astro/aladin-lite/issues/332>
* [feat] dark/light mode for the interface
* [fix] polylines shapes size not consistent w.r.t to div size <https://github.com/cds-astro/aladin-lite/issues/331>
* [feat] 'stackChanged' new event informing when a layer has been added, removed or swapped.
* [ui] a new HiPS browser window to search and find HiPS among the HiPS worldwide network.
* [ui] new settings panel for Catalog overlays to change the size, color or shapes of sources
* [ui] possibility to swap 2 layers. Functional but not definitive, it would be better to allow drag and drop amond the layers.
* [fix] fix local HiPS loading.
* [ui] WIP. A toolbar object
* [fix] fix selection of footprints. In the future allow a skew selection mode and a additive selection shortkey.
* [fix] inertia bug when zooming in/out
* [license] License change from GPLv3 to LGPLv3-or-later
### 3.7.0-beta
#### What's Changed
* [feat] flip longitude axis global method on Aladin by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/245>
* [feat] add rotation event by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/283>
* [docs] just fixing typo in image's doc by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/284>
* [docs] change to an image with correct astrometry in example by [@ManonMarchand][ManonMarchand] in <https://github.com/cds-astro/aladin-lite/pull/290>
* [docs] clarify use of precision in Coo by [@alexgoff][alexgoff] in <https://github.com/cds-astro/aladin-lite/pull/294>
* [feat] allow setting HiPS CORS and credential options by [@pmatsson][pmatsson] in <https://github.com/cds-astro/aladin-lite/pull/281>
* [feat] color picker and read pixel(s) API methods by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/280>
* [fix] chandra hips display and akari by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/306>
* [enhancement] update to the new version of fitsrs by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/310>
* [fix] 26 channel color offset by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/320>
* [fix] Circle intersectsBBox by [@emellega][emellega] in <https://github.com/cds-astro/aladin-lite/pull/309>
* [feat] anti aliasing on lines plotted by the GPU by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/239>
* [feat] source custom color and size from its data content by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/321>
* [feat] catalog new select method by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/322>
* [feat] HiPS 3D impl by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/314>
* [feat] customize share URL function by [@tboch][tboch] in <https://github.com/cds-astro/aladin-lite/pull/327>
* enhancement: use TAP entry point to query NED by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/257>
* [perf] refac geometrical computations using Vec3/Mat3 instead of Vec4/Mat4 [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/276>
* [fix] distortion at poles by [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/247>
* [feat] new aladin option `lockNorthUp` to keep north pole up [@bmatthieu3][bmatthieu3] in <https://github.com/cds-astro/aladin-lite/pull/272>
### 3.6.3
#### What's Changed

304
COPYING.LESSER Normal file
View File

@@ -0,0 +1,304 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License.
"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version".
The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

964
LICENSE
View File

@@ -1,674 +1,304 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License.
"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version".
The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -1,4 +1,4 @@
# [Aladin Lite](https://aladin.u-strasbg.fr/AladinLite)
# [Aladin Lite](https://aladin.cds.unistra.fr/AladinLite)
**An astronomical HiPS visualizer in the browser** <img src="aladin-logo.png" alt="Aladin Lite logo" width="220">
@@ -8,14 +8,14 @@ See [A&A 578, A114 (2015)](https://arxiv.org/abs/1505.02291) and [IVOA HiPS Reco
Aladin Lite is built to be easily embeddable in any web page. It powers astronomical portals like [ESASky](https://sky.esa.int/), [ESO Science Archive portal](http://archive.eso.org/scienceportal/) and [ALMA Portal](https://almascience.eso.org/asax/).
More details on [Aladin Lite documentation page](http://aladin.u-strasbg.fr/AladinLite/doc/).
More details on [Aladin Lite documentation page](http://aladin.cds.unistra.fr/AladinLite/doc/).
A new [API technical documentation](https://cds-astro.github.io/aladin-lite/) is now available.
[![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)
[![Release page](https://img.shields.io/badge/Release-download-yellow.svg)](https://aladin.cds.unistra.fr/AladinLite/doc/release/)
Try Aladin Lite [here](https://aladin.u-strasbg.fr/AladinLite).
Try Aladin Lite [here](https://aladin.cds.unistra.fr/AladinLite).
Aladin Lite is made possible thanks to pure Rust core libraries:
* [cdshealpix](https://github.com/cds-astro/cds-healpix-rust) - for HEALPix projection and unprojection to/from sky coordinates

17
assets/icons/enlarge.svg Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="-9 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>arrow-up-down</title>
<desc>Created with Sketch Beta.</desc>
<defs>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-213.000000, -1193.000000)" fill="#000000">
<path d="M225,1217 L222,1217 L222,1201 L225,1201 C225.643,1201 226.293,1201.02 226.687,1200.62 C227.08,1200.23 227.08,1199.6 226.687,1199.2 L220.747,1193.28 C220.537,1193.07 220.259,1192.98 219.984,1193 C219.71,1192.98 219.432,1193.07 219.222,1193.28 L213.283,1199.2 C212.89,1199.6 212.89,1200.23 213.283,1200.62 C213.676,1201.02 214.294,1201 215,1201 L218,1201 L218,1217 L215,1217 C214.357,1217 213.676,1216.98 213.283,1217.38 C212.89,1217.77 212.89,1218.4 213.283,1218.8 L219.222,1224.72 C219.432,1224.93 219.71,1225.02 219.984,1225 C220.259,1225.02 220.537,1224.93 220.747,1224.72 L226.687,1218.8 C227.08,1218.4 227.08,1217.77 226.687,1217.38 C226.293,1216.98 225.737,1217 225,1217" id="arrow-up-down" sketch:type="MSShapeGroup">
</path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

4
assets/icons/folder.svg Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 1H5L8 3H13V5H3.7457L2.03141 11H4.11144L5.2543 7H16L14 14H0V1Z" fill="#000000"/>
</svg>

After

Width:  |  Height:  |  Size: 322 B

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M15.7955 15.8111L21 21M18 10.5C18 14.6421 14.6421 18 10.5 18C6.35786 18 3 14.6421 3 10.5C3 6.35786 6.35786 3 10.5 3C14.6421 3 18 6.35786 18 10.5Z"
stroke="#ffffff"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>

After

Width:  |  Height:  |  Size: 393 B

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M15.7955 15.8111L21 21M18 10.5C18 14.6421 14.6421 18 10.5 18C6.35786 18 3 14.6421 3 10.5C3 6.35786 6.35786 3 10.5 3C14.6421 3 18 6.35786 18 10.5Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 455 B

View File

@@ -1,4 +1,10 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.7955 15.8111L21 21M18 10.5C18 14.6421 14.6421 18 10.5 18C6.35786 18 3 14.6421 3 10.5C3 6.35786 6.35786 3 10.5 3C14.6421 3 18 6.35786 18 10.5Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M15.7955 15.8111L21 21M18 10.5C18 14.6421 14.6421 18 10.5 18C6.35786 18 3 14.6421 3 10.5C3 6.35786 6.35786 3 10.5 3C14.6421 3 18 6.35786 18 10.5Z"
stroke="#000000"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 393 B

View File

@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.1546 3.36026C12.4835 3.00999 11.5741 3.00459 10.8976 3.35396C8.30466 4.6931 5.95279 6.22853 3.89182 7.93154C3.57311 8.19489 3.34693 8.57758 3.35079 9.02802C3.35463 9.47662 3.58541 9.85419 3.90218 10.1132C5.94604 11.7844 8.29985 13.3212 10.8453 14.6497C11.5165 15 12.4258 15.0054 13.1023 14.656C15.6953 13.3169 18.0472 11.7815 20.1081 10.0785C20.4268 9.8151 20.653 9.43242 20.6492 8.98197C20.6453 8.53338 20.4145 8.1558 20.0978 7.89679C18.0539 6.22562 15.7001 4.6888 13.1546 3.36026ZM11.5859 4.68671C11.8256 4.56294 12.2193 4.56411 12.4606 4.69004C14.8899 5.95796 17.1283 7.41666 19.0675 8.99223C17.1167 10.5932 14.885 12.0471 12.414 13.3233C12.1744 13.4471 11.7807 13.4459 11.5394 13.32C9.11004 12.052 6.87163 10.5933 4.9324 9.01777C6.88321 7.41684 9.11496 5.96285 11.5859 4.68671Z" fill="#000000"/>
<path d="M21.197 12.698C21.4164 13.0494 21.3094 13.512 20.958 13.7314L14.8508 17.5443C14.022 18.0617 12.9938 18.3009 11.9999 18.301C11.006 18.301 9.9777 18.0619 9.14884 17.5446L3.10851 13.7749C2.75711 13.5556 2.65003 13.093 2.86934 12.7416C3.08864 12.3902 3.55128 12.2831 3.90268 12.5024L9.94301 16.2721C10.4872 16.6117 11.2264 16.801 11.9998 16.801C12.7732 16.8009 13.5124 16.6116 14.0564 16.2719L20.1636 12.459C20.515 12.2397 20.9776 12.3467 21.197 12.698Z" fill="#000000"/>
<path d="M21.197 16.4527C21.4164 16.804 21.3094 17.2667 20.9581 17.4861L15.6692 20.7889C14.6115 21.4494 13.2886 21.7602 11.9998 21.7602C10.7111 21.7603 9.38808 21.4497 8.3303 20.7894L3.10843 17.5296C2.75706 17.3102 2.65004 16.8476 2.86938 16.4962C3.08873 16.1448 3.55139 16.0378 3.90276 16.2572L9.12462 19.517C9.89764 19.9995 10.9316 20.2603 11.9998 20.2602C13.068 20.2602 14.1018 19.9993 14.8746 19.5167L20.1635 16.2138C20.5149 15.9944 20.9776 16.1013 21.197 16.4527Z" fill="#000000"/>
<svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" version="1.1" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
<path d="m1.75 11 6.25 3.25 6.25-3.25m-12.5-3 6.25 3.25 6.25-3.25m-6.25-6.25-6.25 3.25 6.25 3.25 6.25-3.25z"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 437 B

15
assets/icons/swap.svg Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<title>swap-vertical-circle</title>
<g id="Layer_2" data-name="Layer 2">
<g id="invisible_box" data-name="invisible box">
<rect width="48" height="48" fill="none"/>
</g>
<g id="icons_Q2" data-name="icons Q2">
<path d="M19.4,36.4l5-4.9a2.1,2.1,0,0,0,.2-2.7,1.9,1.9,0,0,0-3-.2L20,30.2V15a2,2,0,0,0-4,0V30.2l-1.6-1.6a1.9,1.9,0,0,0-3,.2,2.1,2.1,0,0,0,.2,2.7l5,4.9A1.9,1.9,0,0,0,19.4,36.4Z"/>
<path d="M32,33V17.8l1.6,1.6a1.9,1.9,0,0,0,3-.2,2.1,2.1,0,0,0-.2-2.7l-5-4.9a1.9,1.9,0,0,0-2.8,0l-5,4.9a2.1,2.1,0,0,0-.2,2.7,1.9,1.9,0,0,0,3,.2L28,17.8V33a2,2,0,0,0,4,0Z"/>
<path d="M24,42A18,18,0,1,1,42,24,18.1,18.1,0,0,1,24,42m0,4A22,22,0,1,0,2,24,21.9,21.9,0,0,0,24,46Z"/>
</g>
</g>

After

Width:  |  Height:  |  Size: 948 B

6
assets/icons/tree.svg Normal file
View File

@@ -0,0 +1,6 @@
<?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 36 36" version="1.1" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>tree-view-line</title>
<path d="M15,32H11a1,1,0,0,1-1-1V27a1,1,0,0,1,1-1h4a1,1,0,0,1,1,1v4A1,1,0,0,1,15,32Zm-3-2h2V28H12Z" class="clr-i-outline clr-i-outline-path-1"></path><path d="M15,16H11a1,1,0,0,0-1,1v1.2H5.8V12H7a1,1,0,0,0,1-1V7A1,1,0,0,0,7,6H3A1,1,0,0,0,2,7v4a1,1,0,0,0,1,1H4.2V29.8h6.36a.8.8,0,0,0,0-1.6H5.8V19.8H10V21a1,1,0,0,0,1,1h4a1,1,0,0,0,1-1V17A1,1,0,0,0,15,16ZM4,8H6v2H4ZM14,20H12V18h2Z" class="clr-i-outline clr-i-outline-path-2"></path><path d="M34,9a1,1,0,0,0-1-1H10v2H33A1,1,0,0,0,34,9Z" class="clr-i-outline clr-i-outline-path-3"></path><path d="M33,18H18v2H33a1,1,0,0,0,0-2Z" class="clr-i-outline clr-i-outline-path-4"></path><path d="M33,28H18v2H33a1,1,0,0,0,0-2Z" class="clr-i-outline clr-i-outline-path-5"></path>
<rect x="0" y="0" width="36" height="36" fill-opacity="0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

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

View File

@@ -30,7 +30,7 @@
fov *= 0.997;
rotation += 0.07;
aladin.setViewCenter2NorthPoleAngle(rotation)
aladin.setRotation(rotation)
aladin.setFoV(fov);
if (fov < 3 && fov > 0.5) {

View File

@@ -7,7 +7,7 @@
<script type="module">
import A from '../src/js/A.js';
A.init.then(() => {
let aladin = A.aladin('#aladin-lite-div', {fov: 70,projection: "AIT"});
let aladin = A.aladin('#aladin-lite-div', {target: "23 28 32.46 -00 10 38.9", fov: 4, projection: "AIT"});
let hsc = aladin.newImageSurvey("P/HSC/DR2/deep/g", {colormap:"Purples", imgFormat: "fits"});
aladin.setBaseImageLayer(hsc);

View File

@@ -11,7 +11,7 @@
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: 'P/DSS2/red', target: 'M50', fov: 0.3});
aladin = A.aladin('#aladin-lite-div', {survey: 'P/DSS2/red', target: '05 23 07.72 -69 46 09.1', fov: 0.3});
var customImg = new Image();
customImg.onload = function() {

View File

@@ -4,7 +4,7 @@
</head>
<body>
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
<div id="aladin-lite-div" style="width: 200px; height: 768px"></div>
<script>let aladin;</script>
<script type="module">
import A from '../src/js/A.js';
@@ -14,7 +14,6 @@
target: "M31",
fov: 89.78,
showContextMenu: true,
fullScreen: true,
showSimbadPointerControl: true,
showShareControl: true,
showSettingsControl: true,

View File

@@ -16,8 +16,6 @@
fov: 10,
showContextMenu: true,
fullScreen: true,
showSimbadPointerControl: true,
showShareControl: true,
showSettingsControl: true,
showStackLayerControl: true,
samp: true,

View File

@@ -4,13 +4,16 @@
</head>
<body>
<div id="aladin-lite-div" style="width: 512px; height: 512px"></div>
<div id="aladin-lite-div" style="width: 512px; height: 512px">
<div id="toolbar"></div>
</div>
<script type="module">
import showUrl from './../assets/icons/show.svg';
import A from '../src/js/A.js';
let aladin;
A.init.then(() => {
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 = A.aladin('#aladin-lite-div', {toolbar: {divSelector: '#toolbar'}, 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'});
@@ -20,6 +23,16 @@
aladin.setOverlayImageLayer('JWST2', 'overlay_JWST2');
aladin.getOverlayImageLayer('overlay_JWST1').setAlpha(0.0);
aladin.getOverlayImageLayer('overlay_JWST2').setAlpha(0.0);
aladin.toolbar.add('action_custom', {
icon: {
url: showUrl,
size: "medium"
},
action(_) {
console.log("do a thing")
}
});
});
</script>

View File

@@ -37,7 +37,10 @@
colorPicker.value = cat.color;
colorPicker.addEventListener('input', function (e) {
// Change the color of the catalog
cat.updateShape({color: this.value});
console.log(this.value)
cat.updateShape({color: () => {
return '#00ff00'
}});
})
// Define the box

View File

@@ -19,7 +19,6 @@
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head>
<body>
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
let aladin;
@@ -38,8 +37,8 @@
<!-- fin temporaire gestion cercle -->
<b>Orientation</b><br>
<button id="hips-coronelli" class="pure-button" name="ref-hips" onclick="longitudeReversed = false; aladin.reverseLongitude(longitudeReversed)">Normal</button><br>
<button id="hips-illenoroc" class="pure-button" name="ref-hips" onclick="longitudeReversed = true; aladin.reverseLongitude(longitudeReversed)">Inversé</button>
<button id="hips-coronelli" class="pure-button" name="ref-hips" onclick="aladin.reverseLongitude(false)">Normal</button><br>
<button id="hips-illenoroc" class="pure-button" name="ref-hips" onclick="aladin.reverseLongitude(true);">Inversé</button>
<br><br>
<b>Constellations</b>
@@ -75,6 +74,13 @@
<a href="#"><img id="coronelli-stars-red" class="catcoro coro-star" src="star_red.png"></a>
<a href="#"><img id="coronelli-stars-blue" class="catcoro coro-star" src="star_blue.png"></a>
</div>
<div>Coronelli2<br>
<!--a id="coronelli-stars" class="pure-button catcoro" href="#">Coronelli</a-->
<a href="#"><img id="coronelli-stars-white" class="catcoro coro-star" src="star_white.png"></a>
<a href="#"><img id="coronelli-stars-yellow" class="catcoro coro-star" src="star_yellow.png"></a><br>
<a href="#"><img id="coronelli-stars-red" class="catcoro coro-star" src="star_red.png"></a>
<a href="#"><img id="coronelli-stars-blue" class="catcoro coro-star" src="star_blue.png"></a>
</div>
<br><br>
<b>Navigation</b>&nbsp;&nbsp;<br><button id="stop">Stop</button>
@@ -99,6 +105,14 @@
<a class="pure-button nav-button nav-goto" href="#">Halley</a><br>
&nbsp;&nbsp;<a class="pure-button nav-button nav-flyto" href="#">Move</a>
</div>
<div id="coo_halley">
<a class="pure-button nav-button nav-goto" href="#">Halley</a><br>
&nbsp;&nbsp;<a class="pure-button nav-button nav-flyto" href="#">Move</a>
</div>
<div id="coo_halley">
<a class="pure-button nav-button nav-goto" href="#">Halley</a><br>
&nbsp;&nbsp;<a class="pure-button nav-button nav-flyto" href="#">Move</a>
</div>
</div>
<style type="text/css"> .aladin-reticleColor { color: rgb(178, 50, 178); font-weight:bold;} </style>
@@ -231,11 +245,10 @@
import {Utils} from '../src/js/Utils';
A.init.then(() => {
var hipsDir="http://alasky.u-strasbg.fr/CDS_P_Coronelli";
aladin = A.aladin("#aladin-lite-div", {showSimbadPointerControl: true, expandLayersControl: true, realFullscreen: true, fov: 100, allowFullZoomout: true, showReticle: false });
aladin.createImageSurvey('Coronelli', 'Coronelli', hipsDir, 'equatorial', 4, {imgFormat: 'jpg'});
aladin.setImageSurvey('Coronelli');
var hipsDir="http://alasky.cds.unistra.fr/CDS_P_Coronelli";
aladin = A.aladin("#aladin-lite-div", {showSimbadPointerControl: true, lockNorthUp: true, reverseLongitude: true, realFullscreen: true, fov: 100, allowFullZoomout: true, showReticle: false });
aladin.createImageSurvey('Coronelli', 'Coronelli', hipsDir, 'equatorial', 4, {imgFormat: 'jpg', minOrder: 3});
aladin.setImageSurvey('Coronelli')
$('#layersControlLeft').show();
$('#layersCL2').show();
$('#layersControlRight').show();
@@ -344,14 +357,14 @@
// listen click on navigation buttons
$('.nav-button').click(function() {
var cooTarget = $(this).parent().attr('id');
var cooTarget = $(this).parent().attr('id');
if ($(this).hasClass("nav-goto")) {
aladin.gotoRaDec(cooNav[cooTarget].ra, cooNav[cooTarget].dec);
}
else if ($(this).hasClass("nav-flyto")) {
aladin.animateToRaDec(cooNav[cooTarget].ra, cooNav[cooTarget].dec, cooNav[cooTarget].time);
}
if ($(this).hasClass("nav-goto")) {
aladin.gotoRaDec(cooNav[cooTarget].ra, cooNav[cooTarget].dec);
}
else if ($(this).hasClass("nav-flyto")) {
aladin.animateToRaDec(cooNav[cooTarget].ra, cooNav[cooTarget].dec, cooNav[cooTarget].time);
}
});
// stop animations

View File

@@ -10,12 +10,12 @@
import A from '../src/js/A.js';
var aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {projection: 'AIT', cooFrame: 'galactic', fov: 200, target: 'galactic center'});
aladin = A.aladin('#aladin-lite-div', {projection: 'AIT', cooFrame: 'galactic', fov: 200, target: 'galactic center', showSettingsControl: true, showCooGridControl: true});
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);
dss.setCuts(2, 10000);
dss.setCuts(2, 100, 'jpeg');
});

View File

@@ -23,6 +23,9 @@ Image Opacity: <br/> <input id="slider" type="range" value=1 min=0 max=1 step=0.
aladin = A.aladin('#aladin-lite-div', {target: "0 0", cooFrame: "gal"});
var callback = function(ra, dec, fov) {
aladin.gotoRaDec(ra, dec)
aladin.setFov(fov)
A.catalogFromSimbad( {ra: ra, dec: dec} , 1 , {shape: 'circle', color: '#5d5', onClick: 'showTable'}, (cat) => {
aladin.addCatalog(cat)
});
@@ -37,16 +40,14 @@ Image Opacity: <br/> <input id="slider" type="range" value=1 min=0 max=1 step=0.
aladin.setBaseImageLayer('P/Mellinger/color');
//let fits = aladin.displayFITS('http://goldmine.mib.infn.it/data//B/fits/A04_VC1316_ooooog.fits', 'overlay');
let jpg = aladin.displayJPG(
aladin.setOverlayImageLayer(A.image(
// the JPG to transform to HiPS
'https://owncloud.tuebingen.mpg.de/index.php/s/sdxfNgcEaaXoBp7/download/nightskycam3_2025_08_07_05_17_30_healpix1024_red.fits',
'https://www.astropix.org/archive/esahubble/potm2602b/esahubble_potm2602b_1024.jpg',
// no options
{
transparency: 1.0,
successCallback: callback
},
// A callback fn once the overlay is set
callback
);
));
$('input[name=survey]').change(function() {
let surveyName = $(this).val();

View File

@@ -10,6 +10,10 @@
import A from '../src/js/A.js';
A.init.then(() => {
var aladin = A.aladin('#aladin-lite-div', {showContextMenu: true, target: '05 37 58 +08 17 35', fov: 12, backgroundColor: 'rgb(120, 0, 0)'});
aladin.on('stackChanged', function(state) {
console.log(state)
});
var cat = A.catalog({sourceSize: 20, onClick: (s) => {console.log("kjk", s)}});
aladin.addCatalog(cat);
cat.addSources([A.source(83.784490, 9.934156, {name: 'Meissa'}), A.source(88.792939, 7.407064, {name: 'Betelgeuse'}), A.source(81.282764, 6.349703, {name: 'Bellatrix'})]);
@@ -68,10 +72,6 @@
console.log(pos)
});
aladin.on('layerChanged', function(imageLayer, layer, state){
console.log(imageLayer, layer, state)
});
cat.sources[0].actionClicked();
});
</script>

View File

@@ -12,7 +12,8 @@
A.init.then(() => {
// Start up Aladin Lite
aladin = A.aladin('#aladin-lite-div', {target: 'M 1', fov: 0.2, showContextMenu: true, fullScreen: true});
var overlay = A.graphicOverlay({color: '#ee2345', lineWidth: 3, lineDash: [2, 2]});
var overlay = A.graphicOverlay({color: 'purple', lineWidth: 3, lineDash: [2, 2]});
aladin.addOverlay(overlay);
overlay.addFootprints([
A.polygon([[83.64287, 22.01713], [83.59872, 22.01692], [83.59852, 21.97629], [83.64295, 21.97629]], {hoverColor: 'green'}),

View File

@@ -16,7 +16,7 @@
showSimbadPointerControl: true,
projection: 'AIT', // set a projection
fov: 8.0, // initial field of view in degrees
target: '00 42 21.37 +41 07 29.8', // initial target
target: '10.6875598 +41.1402170', // initial target
cooFrame: 'icrs', // set galactic frame
reticleColor: '#ff89ff', // change reticle color
showContextMenu: true,
@@ -28,7 +28,7 @@
}
);
hips = aladin.newImageSurvey("http://alasky.cds.unistra.fr/HIPS3D/GalfaHI", {
hips = aladin.newImageSurvey("https://alasky.cds.unistra.fr/HIPS3D/LGLBSHI-test-compression/", {
successCallback: (hips) => {
//hips.setFrequency({value: 6.374279333565797E-7, unit: "m"}) // GALFA
}

View File

@@ -11,7 +11,7 @@
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: "data/hips/CDS_P_DSS2_color", target: "05 40 59.12 -02 27 04.1", fov: 2, log: false});
aladin = A.aladin('#aladin-lite-div', {survey: "./data/hips/CDS_P_DSS2_color", target: "05 40 59.12 -02 27 04.1", fov: 2, log: false});
});
</script>

View File

@@ -7,31 +7,55 @@
<script type="module">
import A from '../src/js/A.js';
A.init.then(() => {
let aladin = A.aladin('#aladin-lite-div', {fov: 30, survey: "CDS/P/GALEXGR6/AIS/FUV", target: "280 +0", projection: "AIT", showShareControl:true, showSettingsControl: true, showContextMenu:true});
let aladin = A.aladin('#aladin-lite-div', {fov: 30, target: "286.411023328 -37.3460065319", projection: "AIT", showShareControl:true, showSettingsControl: true, showContextMenu:true});
aladin.setOverlayImageLayer(A.image(
"https://nova.astrometry.net/image/25038473?filename=M61.jpg",
"data/img/m82.png",
{
name: "M61",
name: "M82",
wcs: {
NAXIS: 2, // Minimal header
CTYPE1: 'RA---TAN', // TAN (gnomic) projection
CTYPE2: 'DEC--TAN', // TAN (gnomic) projection
NAXIS: 2, // number of axes
NAXIS1: 3000, // image width
NAXIS2: 1918, // image height
CTYPE3: "RGB", // Tell Aladin this is RGB
WCSAXES: 2, // no comment
CTYPE1: "RA---TAN", // TAN (gnomic) projection + SIP distortions
CTYPE2: "DEC--TAN", // TAN (gnomic) projection + SIP distortions
EQUINOX: 2000.0, // Equatorial coordinates definition (yr)
LONPOLE: 180.0, // no comment
LATPOLE: 0.0, // no comment
CRVAL1: 185.445488837, // RA of reference point
CRVAL2: 4.47896032431, // DEC of reference point
CRPIX1: 588.995094299, // X reference pixel
CRPIX2: 308.307905197, // Y reference pixel
CUNIT1: 'deg', // X pixel scale units
CUNIT2: 'deg', // Y pixel scale units
CD1_1: -0.000223666022989, // Transformation matrix
CD1_2: -0.000296578064584, // no comment
CD2_1: -0.000296427555509, // no comment
CD2_2: 0.000223774308964, // no comment
NAXIS1: 1080, // Image width, in pixels.
NAXIS2: 705 // Image height, in pixels.
CRVAL1: 286.411023328, // RA of reference point
CRVAL2: -37.3460065319, // DEC of reference point
CRPIX1: 2264.1858724, // X reference pixel
CRPIX2: 583.14634196, // Y reference pixel
CUNIT1: "deg", // X pixel scale units
CUNIT2: "deg", // Y pixel scale units
CD1_1: -0.00284225200648, // Transformation matrix
CD1_2: 0.00145908284254, // no comment
CD2_1: -0.00145832184852, // no comment
CD2_2: -0.0028440175499, // no comment
A_ORDER: 2, // Polynomial order, axis 1
A_0_0: 0, A_0_1: 0, A_0_2: 1.97760279295e-7,
A_1_0: 0, A_1_1: 5.32298396638e-7,
A_2_0: -2.16045473726e-6,
B_ORDER: 2, // Polynomial order, axis 2
B_0_0: 0, B_0_1: 0, B_0_2: 3.97377848239e-7,
B_1_0: 0, B_1_1: -2.25823401545e-6,
B_2_0: -1.47800507759e-7,
AP_ORDER: 2, // Inv polynomial order, axis 1
AP_0_0: 0.00617616810622,
AP_0_1: -1.68315582233e-6,
AP_0_2: -1.96504899588e-7,
AP_1_0: -5.8320637913e-6,
AP_1_1: -5.26081207663e-7,
AP_2_0: 2.13760782681e-6,
BP_ORDER: 2, // Inv polynomial order, axis 2
BP_0_0: -0.000681183014773,
BP_0_1: -2.15389849968e-7,
BP_0_2: -3.94508397022e-7,
BP_1_0: 4.51837961352e-6,
BP_1_1: 2.24050293101e-6,
BP_2_0: 1.49195269783e-7
},
successCallback: (ra, dec, fov, image) => {
aladin.gotoRaDec(ra, dec);

View File

@@ -3,8 +3,6 @@
<head>
</head>
<body>
<div id="aladin-lite-div" style="width: 768px; height: 512px"></div>
<script>let aladin;</script>
<script type="module">
@@ -23,6 +21,8 @@
reticleSize: 64, // change reticle size
showContextMenu: true,
showShareControl: true,
showCooGridControl: true,
showColorPickerControl: true,
showFrame: true,
showZoomControl:true,
showSettingsControl:true,

View File

@@ -3,9 +3,9 @@
<head>
</head>
<body>
<div id="al1" style="width: 500px; height: 500px">
<div id="al1" style="width: 200px; height: 200px">
</div>
<div id="al2" style="width: 500px; height: 500px">
<div id="al2" style="width: 200px; height: 200px">
</div>
<script type="module">
@@ -15,7 +15,7 @@
A.init.then(() => {
// Start up Aladin Lite
al1 = A.aladin('#al1', {target: 'M51', fov: 0.3, survey: 'P/DSS2/color', fullScreen: false, showContextMenu: true, showShareControl: true});
al2 = A.aladin('#al2', {target: 'M51', fov: 180, survey: 'P/PanSTARRS/DR1/z', fullScreen: false, showContextMenu: true, showShareControl: true});
al2 = A.aladin('#al2', {target: 'M51', fov: 180, survey: 'P/PanSTARRS/DR1/z', showColorPickerControl: true, fullScreen: false, showContextMenu: true, showShareControl: true});
});
</script>

View File

@@ -8,7 +8,7 @@
<script type="module">
import A from '../src/js/A.js';
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {projection: 'MOL', fullScreen: true, fov: 360, survey: ['P/DM/vizMine', 'P/HST/GOODS/color', 'P/MATLAS/g'], target: '0 0', showProjectionControl: false, showSettingsControl: false, showLayersControl: true, showCooGrid: false, showFrame: false, showCooLocation: false});
aladin = A.aladin('#aladin-lite-div', {projection: 'MOL', lockNorthUp: true, fullScreen: true, showSettingsControl: true, fov: 360, survey: ['P/DM/vizMine', 'P/HST/GOODS/color', 'P/MATLAS/g'], target: '0 0', showProjectionControl: false, showSettingsControl: true, showLayersControl: true, showCooGrid: true, showFrame: false, showCooLocation: false});
});
</script>

View File

@@ -17,6 +17,8 @@
});
aladin.addCatalog(A.catalogFromVizieR("B/assocdata/obscore", "0 +0", 20, {onClick: 'showTable', hoverColor: 'yellow', limit: 1000}))
aladin.addCatalog(A.catalogFromSKAORucio("0 +0", 70, {onClick: 'showTable', hoverColor: 'yellow', limit: 1000}))
});
</script>
</body>

View File

@@ -9,7 +9,7 @@
let aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {survey: 'data/hips/CDS_P_DSS2_color', target: '05 34 30.89 +22 00 52.9', fov: 0.3, log: false, showSettingsControl: true});
var cat = A.catalogFromURL('data/votable/labels.vot', {sourceSize:12, color: '#cc99bb', displayLabel: true, labelColumn: 'main_id', labelColor: '#ae4', labelFont: '9px sans-serif'});
var cat = A.catalogFromURL('data/votable/labels.vot', {sourceSize:20, shape: 'cross', color: '#cc99bb', displayLabel: true, labelColumn: 'main_id', labelColor: '#ae4', labelFont: '9px sans-serif'});
aladin.addCatalog(cat);
});
</script>

View File

@@ -21,6 +21,7 @@
expandLayersControl: true,
hipsList: [
// High energy (Gamma and X-rays)
'https://alasky.cds.unistra.fr/HIPS3D/GalfaHI',
'CDS/P/HGPS/Flux',
'CDS/P/Fermi/5',
'CDS/P/Fermi/4',

View File

@@ -13,9 +13,15 @@
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {target: 'Gamma Cas', fov: 10, cooFrame: 'icrs'});
var overlay = A.graphicOverlay({lineWidth: 2});
var overlay = A.graphicOverlay({color: 'green', lineWidth: 2});
aladin.addOverlay(overlay);
overlay.add(A.polyline([ [2.29452158, 59.14978110], [10.12683778, 56.53733116], [14.1772154, 60.7167403], [21.45396446, 60.23528403], [28.59885697, 63.67010079] ], {color: 'green'}));
overlay.add(A.polyline([ [2.29452158, 59.14978110], [10.12683778, 56.53733116], [14.1772154, 60.7167403], [21.45396446, 60.23528403], [28.59885697, 63.67010079] ], {
opacity: 0.7
}));
aladin.on('rotationChanged', (rot) => {
aladin.setRotation(rot)
})
});
</script>
</body>

View File

@@ -77,7 +77,7 @@
let bValues = [];
let i = 0;
for(var [r, g, b] of base.probe({type: 'line', x1: p.a.x, y1: p.a.y, x2: p.b.x, y2: p.b.y})) {
for(var [r, g, b] of base.probePixels({type: 'line', x1: p.a.x, y1: p.a.y, x2: p.b.x, y2: p.b.y})) {
xValues.push(i)
rValues.push(r)
gValues.push(g)

View File

@@ -10,7 +10,7 @@
<script type="text/javascript">
var aladin;
A.init.then(() => {
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, cooFrame: "ICRSd", showSimbadPointerControl: true, showShareControl: true, showShareControl: true, survey: 'https://alasky.cds.unistra.fr/DSS/DSSColor/', fov: 180, showContextMenu: true});
aladin = A.aladin('#aladin-lite-div', {fullScreen: true, showCooLocation: true, showSettingsControl: true, cooFrame: "ICRSd", showSimbadPointerControl: true, showShareControl: true, showShareControl: true, fov: 180, showContextMenu: true});
// manage URL parameters
const searchParams = new URL(document.location).searchParams;
if (searchParams.has('baseImageLayer')) {

View File

@@ -1,8 +1,8 @@
{
"homepage": "https://aladin.u-strasbg.fr/",
"homepage": "https://aladin.cds.unistra.fr/",
"name": "aladin-lite",
"type": "module",
"version": "3.7.0-beta",
"version": "3.8.1",
"description": "An astronomical HiPS visualizer in the browser",
"author": "Thomas Boch and Matthieu Baumann",
"license": "GPL-3",
@@ -30,13 +30,17 @@
"HiPS"
],
"scripts": {
"wasm": "wasm-pack build ./src/core --target web --release --out-name core -- --features webgl2",
"wasm:npm": "wasm-pack build ./src/core --target web --release --out-name core -- --features webgl2",
"wasm:prod": "wasm-pack build ./src/core --target web --release --out-name core -- --features \"webgl2 minify_shaders\" && wasm-opt -Oz --strip-debug --strip-producers --dce -o src/core/pkg/core_bg.wasm src/core/pkg/core_bg.wasm",
"wasm:dev": "wasm-pack build ./src/core --target web --release --out-name core -- --features webgl2",
"wasm:dbg": "wasm-pack build --dev ./src/core --target web --out-name core -- --features=webgl2,dbg",
"predeploy": "npm run build && rm -rf aladin-lite*.tgz && npm pack",
"predeploy": "npm run build:prod && rm -rf aladin-lite*.tgz && npm pack",
"deploy": "python3 deploy/deploy.py",
"build": "npm run wasm && vite build",
"build:npm": "npm run wasm:npm && vite build",
"build:prod": "npm run wasm:prod && vite build",
"build:dev": "npm run wasm:dev && vite build",
"build:dbg": "npm run wasm:dbg && vite build",
"dev": "npm run build && vite",
"dev": "npm run build:dev && vite",
"dev:dbg": "npm run build:dbg && vite",
"serve": "npm run dev",
"serve:dbg": "npm run dev:dbg",
@@ -44,15 +48,16 @@
"test:build": "cd src/core && cargo test --release --features webgl2",
"test:playwright": "npx playwright test",
"test:update-snapshots": "npx playwright test --update-snapshots",
"doc": "jsdoc -c jsdoc.json src/js src/js/shapes src/js/libs/astro && cp aladin-logo.png docs/ && cp jsdoc-custom-style.css docs/ && cp jsdoc-make-responsive.js docs/",
"doc:dev": "npm run doc && open docs/index.html"
"doc": "jsdoc -c jsdoc.json src/js src/js/gui src/js/shapes src/js/libs/astro && cp aladin-logo.png docs/ && cp jsdoc-custom-style.css docs/ && cp jsdoc-make-responsive.js docs/",
"doc:dev": "npm run doc && open docs/index.html",
"analyze": "vite build --mode analyze"
},
"devDependencies": {
"@playwright/test": "^1.47.0",
"docdash": "^2.0.2",
"jsdoc": "^4.0.2",
"rollup-plugin-visualizer": "^6.0.3",
"vite": "^4.3.8",
"vite-plugin-glsl": "^1.1.2",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.2.2",
"vite-plugin-wasm-pack": "^0.1.12"

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.7.0"
version = "3.8.1"
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
edition = "2018"
@@ -18,21 +18,20 @@ futures = "0.3.12"
js-sys = "0.3.47"
wasm-bindgen-futures = "0.4.20"
cgmath = "*"
# 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-streams = "0.3.0"
async-channel = "1.8.0"
mapproj = "0.3.0"
fitsrs = "0.3.4"
colorgrad = "0.6.2"
fitsrs = "0.4.1"
[features]
webgl1 = [ "al-core/webgl1", "al-api/webgl1", "web-sys/WebGlRenderingContext", "web-sys/AngleInstancedArrays", "web-sys/ExtSRgb", "web-sys/OesTextureFloat",]
webgl2 = [ "al-core/webgl2", "al-api/webgl2", "web-sys/WebGl2RenderingContext", "web-sys/WebGlVertexArrayObject", "web-sys/ExtColorBufferFloat",]
dbg = [ "dep:console_error_panic_hook",]
minify_shaders = []
[dev-dependencies]
rand = "0.8"
@@ -50,8 +49,7 @@ version = "0.7.3"
[dependencies.moclib]
package = "moc"
git = "https://github.com/cds-astro/cds-moc-rust"
branch = "main"
version = "0.19.1"
[dependencies.serde]
version = "^1.0.183"
@@ -65,7 +63,7 @@ path = "./al-api"
[dependencies.web-sys]
version = "0.3.56"
features = [ "console", "CssStyleDeclaration", "Document", "Element", "HtmlCollection", "CustomEvent", "CustomEventInit", "HtmlElement", "HtmlImageElement", "HtmlCanvasElement", "Blob", "ImageBitmap", "ImageData", "CanvasRenderingContext2d", "WebGlBuffer", "WebGlContextAttributes", "WebGlFramebuffer", "WebGlProgram", "WebGlShader", "WebGlUniformLocation", "WebGlTexture", "WebGlActiveInfo", "Headers", "Window", "Request", "RequestInit", "RequestMode", "RequestCredentials", "Response", "XmlHttpRequest", "XmlHttpRequestResponseType", "PerformanceTiming", "Performance", "Url", "ReadableStream", "File", "FileList",]
features = [ "console", "CssStyleDeclaration", "Document", "Element", "HtmlCollection", "CustomEvent", "CustomEventInit", "HtmlElement", "HtmlImageElement", "HtmlCanvasElement", "Blob", "Url", "ImageBitmap", "ImageData", "CanvasRenderingContext2d", "WebGlBuffer", "WebGlContextAttributes", "WebGlFramebuffer", "WebGlProgram", "WebGlShader", "WebGlUniformLocation", "WebGlTexture", "WebGlActiveInfo", "Headers", "Window", "Request", "RequestInit", "RequestMode", "RequestCredentials", "Response", "XmlHttpRequest", "XmlHttpRequestResponseType", "PerformanceTiming", "Performance", "Url", "ReadableStream", "File", "FileList", "OffscreenCanvas", "OffscreenCanvasRenderingContext2d", "Worker", "WorkerOptions", "WorkerType",]
[dev-dependencies.image-decoder]
package = "image"
@@ -84,7 +82,7 @@ overflow-checks = false
lto = true
panic = "abort"
incremental = false
codegen-units = 16
codegen-units = 1
rpath = false
[package.metadata.wasm-pack.profile.release]

View File

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

View File

@@ -179,11 +179,12 @@ impl HiPSProperties {
#[wasm_bindgen]
#[serde(rename_all = "camelCase")]
pub enum ImageExt {
#[serde(alias = "fits", alias = "fits.fz")]
Fits,
Jpeg,
Png,
Webp,
#[serde(alias = "fits.fz")]
FitsFz,
}
#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -199,6 +200,7 @@ pub enum DataproductType {
impl std::fmt::Display for ImageExt {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
ImageExt::FitsFz => write!(f, "fits.fz"),
ImageExt::Fits => write!(f, "fits"),
ImageExt::Png => write!(f, "png"),
ImageExt::Jpeg => write!(f, "jpg"),

View File

@@ -1,15 +1,13 @@
[package]
name = "al-core"
version = "3.7.0"
version = "3.8.1"
authors = ["baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr"]
edition = "2018"
[dependencies]
js-sys = "0.3.47"
cgmath = "*"
#jpeg-decoder = "0.3.0"
#png = "0.17.6"
fitsrs = "0.3.4"
fitsrs = "0.4.1"
al-api = { path = "../al-api" }
serde = { version = "^1.0.59", features = ["derive"] }
serde_json = "1.0"
@@ -37,43 +35,8 @@ webgl2 = [
[dependencies.web-sys]
version = "0.3.56"
features = [
'console',
'CssStyleDeclaration',
'Document',
'Element',
'HtmlCollection',
'HtmlElement',
'HtmlImageElement',
'HtmlCanvasElement',
'Blob',
'ImageBitmap',
'ImageData',
features = [ "console", "CssStyleDeclaration", "Document", "Element", "HtmlCollection", "CustomEvent", "CustomEventInit", "HtmlElement", "HtmlImageElement", "HtmlCanvasElement", "Blob", "ImageBitmap", "ImageData", "CanvasRenderingContext2d", "WebGlBuffer", "WebGlContextAttributes", "WebGlFramebuffer", "WebGlProgram", "WebGlShader", "WebGlUniformLocation", "WebGlTexture", "WebGlActiveInfo", "Headers", "Window", "Request", "RequestInit", "RequestMode", "RequestCredentials", "Response", "XmlHttpRequest", "XmlHttpRequestResponseType", "PerformanceTiming", "Performance", "Url", "ReadableStream", "File", "FileList", "OffscreenCanvas", "OffscreenCanvasRenderingContext2d", "Worker", "WorkerOptions", "WorkerType"]
'CanvasRenderingContext2d',
'WebGlBuffer',
'WebGlContextAttributes',
'WebGlFramebuffer',
'WebGlProgram',
'WebGlShader',
'WebGlUniformLocation',
'WebGlTexture',
'WebGlActiveInfo',
'Window',
'Request',
'RequestInit',
'RequestMode',
'Response',
'XmlHttpRequest',
'XmlHttpRequestResponseType',
'PerformanceTiming',
'Performance',
'Url',
'File',
'FileList'
]
[profile.dev]
opt-level = 's'

View File

@@ -1,12 +1,13 @@
use crate::texture::format::TextureFormat;
use crate::texture::format::R8U;
use cgmath::Vector3;
use fitsrs::card::Value;
use fitsrs::hdu::data::bintable::data::BinaryTableData;
use fitsrs::hdu::data::bintable::tile_compressed::pixels::Pixels;
use fitsrs::hdu::header::extension::bintable::TileCompressedImage;
use fitsrs::hdu::header::Bitpix;
use fitsrs::hdu::header::Header;
use fitsrs::hdu::header::Xtension;
use fitsrs::WCS;
use fitsrs::{Fits, HDU};
use std::borrow::Cow;
use std::fmt::Debug;
use std::io::Cursor;
use std::ops::Range;
@@ -35,15 +36,7 @@ pub struct FitsImage<'a> {
// bytes offset where the data bytes are located inside the fits
pub data_byte_offset: Range<usize>,
// raw bytes of the data image (in Big-Endian)
pub raw_bytes: &'a [u8],
}
fn parse_keyword_as_number<X: Xtension + Debug>(header: &Header<X>, keyword: &str) -> Option<f32> {
match header.get(keyword) {
Some(Value::Integer { value, .. }) => Some(*value as f32),
Some(Value::Float { value, .. }) => Some(*value as f32),
_ => None,
}
pub raw_bytes: Cow<'a, [u8]>,
}
impl<'a> FitsImage<'a> {
@@ -57,22 +50,21 @@ impl<'a> FitsImage<'a> {
HDU::XImage(hdu) | HDU::Primary(hdu) => {
// Prefer getting the dimension directly from NAXIS1/NAXIS2 instead of from the WCS
// because it may not exist in all HDU images
let width = hdu.get_header().get_xtension().get_naxisn(1);
let height = hdu.get_header().get_xtension().get_naxisn(2);
if let (Some(&width), Some(&height)) = (width, height) {
let depth =
*hdu.get_header().get_xtension().get_naxisn(3).unwrap_or(&1) as u32;
let naxis = hdu.get_header().get_xtension().get_naxis();
if naxis.len() >= 2 {
let width = naxis[0];
let height = naxis[1];
let depth = if naxis.len() >= 3 { naxis[2] } else { 1 };
let header = hdu.get_header();
let bscale = parse_keyword_as_number(header, "BSCALE").unwrap_or(1.0);
let bzero = parse_keyword_as_number(header, "BZERO").unwrap_or(0.0);
let blank = parse_keyword_as_number(header, "BLANK");
let bscale = header.get_parsed::<f32>("BSCALE").unwrap_or(1.0);
let bzero = header.get_parsed::<f32>("BZERO").unwrap_or(0.0);
let blank = header.get_parsed::<f32>("BLANK").ok();
let trim1 = parse_keyword_as_number(header, "TRIM1").unwrap_or(0.0) as u32;
let trim2 = parse_keyword_as_number(header, "TRIM2").unwrap_or(0.0) as u32;
let trim3 = parse_keyword_as_number(header, "TRIM3").unwrap_or(0.0) as u32;
let trim1 = header.get_parsed::<u32>("TRIM1").unwrap_or(0);
let trim2 = header.get_parsed::<u32>("TRIM2").unwrap_or(0);
let trim3 = header.get_parsed::<u32>("TRIM3").unwrap_or(0);
let bitpix = hdu.get_header().get_xtension().get_bitpix();
@@ -80,7 +72,7 @@ impl<'a> FitsImage<'a> {
let len = hdu.get_data_unit_byte_size() as usize;
let data_byte_offset = off..(off + len);
let raw_bytes = &bytes[data_byte_offset.clone()];
let raw_bytes = Cow::Borrowed(&bytes[data_byte_offset.clone()]);
let wcs = hdu.wcs().ok();
@@ -90,7 +82,7 @@ impl<'a> FitsImage<'a> {
trim3,
width: width as u32,
height: height as u32,
depth,
depth: depth as u32,
bitpix,
bscale,
wcs,
@@ -101,6 +93,81 @@ impl<'a> FitsImage<'a> {
});
}
}
HDU::XBinaryTable(hdu) => {
let header = hdu.get_header();
let bin_table = header.get_xtension();
if let Some(TileCompressedImage {
z_bitpix: bitpix,
z_naxisn: naxis,
..
}) = &bin_table.get_z_image()
{
if naxis.len() >= 2 {
let width = naxis[0] as u32;
let height = naxis[1] as u32;
let depth = if naxis.len() >= 3 { naxis[2] as u32 } else { 1 };
let bscale = header.get_parsed::<f32>("BSCALE").unwrap_or(1.0);
let bzero = header.get_parsed::<f32>("BZERO").unwrap_or(0.0);
let blank = header.get_parsed::<f32>("BLANK").ok();
let trim1 = header.get_parsed::<u32>("TRIM1").unwrap_or(0);
let trim2 = header.get_parsed::<u32>("TRIM2").unwrap_or(0);
let trim3 = header.get_parsed::<u32>("TRIM3").unwrap_or(0);
let wcs = hdu.wcs().ok();
let off = hdu.get_data_unit_byte_offset() as usize;
let len = hdu.get_data_unit_byte_size() as usize;
let data_byte_offset = off..(off + len);
let mut bitpix = *bitpix;
let raw_bytes = match fits.get_data(&hdu) {
BinaryTableData::TileCompressed(Pixels::U8(pixels)) => {
Some(pixels.collect::<Vec<_>>())
}
BinaryTableData::TileCompressed(Pixels::I16(pixels)) => {
Some(pixels.flat_map(|p| p.to_be_bytes()).collect::<Vec<_>>())
}
BinaryTableData::TileCompressed(Pixels::I32(pixels)) => {
Some(pixels.flat_map(|p| p.to_be_bytes()).collect::<Vec<_>>())
}
BinaryTableData::TileCompressed(Pixels::F32(pixels)) => {
Some(pixels.flat_map(|p| p.to_be_bytes()).collect::<Vec<_>>())
}
BinaryTableData::TileCompressed(Pixels::F64(pixels)) => {
bitpix = Bitpix::F32;
let raw_bytes =
pixels.flat_map(|p| p.to_be_bytes()).collect::<Vec<_>>();
Some(raw_bytes)
}
_ => None,
};
if let Some(raw_bytes) = raw_bytes {
images.push(Self {
trim1,
trim2,
trim3,
width,
height,
depth,
bitpix,
bscale,
wcs,
bzero,
blank,
data_byte_offset,
raw_bytes: Cow::Owned(raw_bytes),
});
}
}
}
}
_ => (),
}
}
@@ -141,6 +208,7 @@ impl Image for FitsImage<'_> {
R8U::view(&new_bytes)
}
Bitpix::F64 => {
// convert to i64 first
let new_bytes: Vec<_> = self
.raw_bytes
.chunks_exact(8)
@@ -154,7 +222,7 @@ impl Image for FitsImage<'_> {
R8U::view(&new_bytes)
}
_ => R8U::view(self.raw_bytes),
_ => R8U::view(&self.raw_bytes),
}
};

View File

@@ -93,8 +93,6 @@ pub trait VertexAttribPointerType: std::marker::Sized {
}
}
use crate::webgl_ctx::WebGlRenderingCtx;
use js_sys::WebAssembly;
use wasm_bindgen::JsCast;
impl VertexAttribPointerType for u8 {
type ArrayBufferView = js_sys::Uint8Array;
@@ -308,7 +306,7 @@ impl VertexAttribPointerType for f32 {
type ArrayBufferView = Float32Array;
fn array_buffer_view<'a, B: BufferDataStorage<'a, Self>>(data: B) -> Self::ArrayBufferView {
let data = data.get_slice();
/*let data = data.get_slice();
//unsafe { Self::ArrayBufferView::view(&data) }
let memory_buffer = wasm_bindgen::memory()
.unchecked_ref::<WebAssembly::Memory>()
@@ -316,7 +314,9 @@ impl VertexAttribPointerType for f32 {
let len = data.len();
let ptr = data.as_ptr() as u32 / 4;
Float32Array::new(&memory_buffer).subarray(ptr, ptr + len as u32)
Float32Array::new(&memory_buffer).subarray(ptr, ptr + len as u32)*/
let data = data.get_slice();
unsafe { Self::ArrayBufferView::view(data) }
}
fn buffer_sub_data_with_i32_and_array_buffer_view<'a, B: BufferDataStorage<'a, Self>>(
@@ -462,6 +462,30 @@ impl ArrayBuffer {
);
}
}
/*pub fn update_from_js_array<'a, T: VertexAttribPointerType>(
&mut self,
usage: u32,
data: T::ArrayBufferView,
) {
self.bind();
if self.len >= data.len() {
T::buffer_sub_data_with_i32_and_array_buffer_view(
&self.gl,
data,
WebGlRenderingCtx::ARRAY_BUFFER,
);
} else {
self.len = data.len();
T::buffer_data_with_array_buffer_view(
&self.gl,
data,
WebGlRenderingCtx::ARRAY_BUFFER,
usage,
);
}
}*/
}
impl VertexBufferObject for ArrayBuffer {

View File

@@ -132,6 +132,20 @@ pub mod vao {
self
}
/*pub fn update_from_js_array<T: VertexAttribPointerType>(
&mut self,
attr: &'static str,
usage: u32,
js_array: T::ArrayBufferView,
) -> &mut Self {
self.vao
.array_buffer
.get_mut(attr)
.unwrap_abort()
.update_from_js_array::<T>(usage, js_array);
self
}*/
pub fn update_element_array<T: VertexAttribPointerType, B: BufferDataStorage<'a, T>>(
&mut self,
usage: u32,

View File

@@ -58,11 +58,23 @@ impl Texture3D {
pixel_type: F::PIXEL_TYPE,
})));
Ok(Texture3D {
let s = Texture3D {
texture,
gl: gl.clone(),
metadata,
})
};
let voxel_count = F::NUM_CHANNELS * (width as usize) * (height as usize) * (depth as usize);
let zeros = vec![0xff; voxel_count];
s.bind().tex_sub_image_3d_with_opt_u8_array(
0,
0,
0,
width,
height,
depth,
Some(&zeros[..]),
);
Ok(s)
}
pub fn generate_mipmap(&self) {

View File

@@ -91,7 +91,7 @@ impl Texture2DArray {
// Attach the texture as the first color attachment
self.gl.framebuffer_texture_layer(
WebGlRenderingCtx::READ_FRAMEBUFFER,
WebGlRenderingCtx::FRAMEBUFFER,
WebGlRenderingCtx::COLOR_ATTACHMENT0,
self.texture.as_ref(),
0,

View File

@@ -203,5 +203,3 @@ impl PixelType {
}
}
}
pub const NUM_CHANNELS: usize = 6;

View File

@@ -311,7 +311,7 @@ impl Texture2D {
// Attach the texture as the first color attachment
//self.attach_to_framebuffer();
self.gl.framebuffer_texture_2d(
WebGlRenderingCtx::READ_FRAMEBUFFER,
WebGlRenderingCtx::FRAMEBUFFER,
WebGlRenderingCtx::COLOR_ATTACHMENT0,
WebGlRenderingCtx::TEXTURE_2D,
self.texture.as_ref(),

View File

@@ -21,32 +21,6 @@ pub trait Pixel:
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue>;
}
impl Pixel for [f32; 1] {
type Item = f32;
type Container = ArrayF32;
const BLACK: Self = [f32::NAN];
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
let p = js_sys::Uint8Array::new_with_length(4);
gl.read_pixels_with_opt_array_buffer_view(
x,
y,
1,
1,
WebGlRenderingCtx::RGBA,
WebGlRenderingCtx::UNSIGNED_BYTE,
Some(&p),
)?;
Ok([f32::from_le_bytes([
p.at(0).unwrap(),
p.at(1).unwrap(),
p.at(2).unwrap(),
p.at(3).unwrap(),
])])
}
}
impl Pixel for [u8; 4] {
type Item = u8;
type Container = ArrayU8;
@@ -74,13 +48,13 @@ impl Pixel for [u8; 3] {
const BLACK: Self = [0, 0, 0];
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
let pixels = js_sys::Uint8Array::new_with_length(3);
let pixels = js_sys::Uint8Array::new_with_length(4);
gl.read_pixels_with_opt_array_buffer_view(
x,
y,
1,
1,
WebGlRenderingCtx::RGB,
WebGlRenderingCtx::RGBA,
WebGlRenderingCtx::UNSIGNED_BYTE,
Some(&pixels),
)?;
@@ -147,7 +121,7 @@ impl Pixel for [i16; 1] {
Some(&p),
)?;
Ok([i16::from_le_bytes([p.at(0).unwrap(), p.at(1).unwrap()])])
Ok([i16::from_le_bytes([p.at(1).unwrap(), p.at(0).unwrap()])])
}
}
@@ -169,10 +143,36 @@ impl Pixel for [i32; 1] {
)?;
Ok([i32::from_le_bytes([
p.at(0).unwrap(),
p.at(1).unwrap(),
p.at(2).unwrap(),
p.at(3).unwrap(),
p.at(2).unwrap(),
p.at(1).unwrap(),
p.at(0).unwrap(),
])])
}
}
impl Pixel for [f32; 1] {
type Item = f32;
type Container = ArrayF32;
const BLACK: Self = [f32::NAN];
fn read_pixel(gl: &WebGlContext, x: i32, y: i32) -> Result<Self, JsValue> {
let p = js_sys::Uint8Array::new_with_length(4);
gl.read_pixels_with_opt_array_buffer_view(
x,
y,
1,
1,
WebGlRenderingCtx::RGBA,
WebGlRenderingCtx::UNSIGNED_BYTE,
Some(&p),
)?;
Ok([f32::from_le_bytes([
p.at(3).unwrap(),
p.at(2).unwrap(),
p.at(1).unwrap(),
p.at(0).unwrap(),
])])
}
}

View File

@@ -49,12 +49,32 @@ impl WebGlContext {
#[cfg(feature = "webgl2")]
{
/*if let Ok(r) =
get_extension::<web_sys::ExtColorBufferFloat>(&gl, "EXT_color_buffer_float")
{
let _ = r;
}*/
let ctx = WebGlContext { inner: gl };
Ok(ctx)
}
}
}
fn _get_extension<T>(context: &WebGlRenderingCtx, name: &str) -> Result<T, JsValue>
where
T: wasm_bindgen::JsCast,
{
// `unchecked_into` is used here because WebGL extensions aren't actually JS classes
// these objects are duck-type representations of the actual Rust classes
// https://github.com/rustwasm/wasm-bindgen/pull/1449
context
.get_extension(name)
.ok()
.and_then(|maybe_ext| maybe_ext.map(|ext| ext.unchecked_into::<T>()))
.ok_or_else(|| JsValue::from_str("Failed to load ext"))
}
use std::ops::Deref;
impl Deref for WebGlContext {
type Target = WebGlRenderingCtx;

View File

@@ -1,21 +0,0 @@
[package]
name = "al-task-exec"
version = "0.1.0"
authors = ["Matthieu Baumann <matthieu.baumann@astro.unistra.fr>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
futures = "0.3.5"
futures-task = "0.3.5"
wasm-bindgen = "0.2.79"
[dependencies.web-sys]
version = "0.3.40"
features = [
'Document',
'Window',
'PerformanceTiming',
'Performance',
]

View File

@@ -1,338 +0,0 @@
use {
futures::{
future::FutureExt,
task::{waker_ref, ArcWake},
},
std::{
future::Future,
sync::Arc,
task::{Context, Poll},
},
};
struct Thread {
_thread: std::thread::Thread,
}
use std::thread;
thread_local! {
static CURRENT_THREAD_NOTIFY: Arc<Thread> = Arc::new(Thread {
_thread: thread::current(),
});
}
impl ArcWake for Thread {
fn wake_by_ref(_arc_self: &Arc<Self>) {}
}
use std::cell::RefCell;
/// `Spawner` spawns new futures onto the task channel.
use std::collections::VecDeque;
use std::pin::Pin;
use std::rc::{Rc, Weak};
use std::collections::HashMap;
// A queue that contains keyed element
struct KeyedVecDeque<K, V>
where
K: Hash + Eq + Clone,
{
keys: VecDeque<K>,
values: HashMap<K, V>,
}
use std::hash::Hash;
impl<K, V> KeyedVecDeque<K, V>
where
K: Hash + Eq + Clone,
{
fn new() -> Self {
let keys = VecDeque::new();
let values = HashMap::new();
Self { keys, values }
}
fn push_front(&mut self, key: K, value: V) {
self.keys.push_front(key.clone());
self.values.insert(key, value);
}
fn pop_back(&mut self) -> Option<(K, V)> {
if self.keys.is_empty() {
None
} else {
let mut v = None;
while !self.keys.is_empty() && v.is_none() {
let k = self.keys.pop_back().unwrap();
v = self.values.remove(&k).map(|v| (k, v));
}
v
}
}
fn remove(&mut self, k: &K) -> Option<V> {
self.values.remove(k)
}
}
type Incoming<K, T> = RefCell<KeyedVecDeque<K, Pin<Box<dyn Future<Output = T> + 'static>>>>;
#[derive(Clone)]
pub struct Spawner<K, T>
where
K: Hash + Eq + Clone,
{
tasks: Weak<Incoming<K, T>>,
}
impl<K, T> Spawner<K, T>
where
K: Hash + Eq + Clone,
{
pub fn spawn(&mut self, key: K, future: impl Future<Output = T> + 'static) {
let future = future.boxed_local();
self.tasks
.upgrade() // convert to Rc
.unwrap()
.borrow_mut() // Push the new task to the front of the queue
.push_front(key, future);
}
}
/// Task executor that receives tasks off of a channel and runs them.
pub struct Executor<K, T>
where
K: Hash + Eq + Clone,
{
tasks: Rc<Incoming<K, T>>,
spawner: Spawner<K, T>,
}
impl<K, T> Default for Executor<K, T>
where
K: Hash + Eq + Clone,
{
fn default() -> Self {
let tasks = Rc::new(RefCell::new(KeyedVecDeque::new()));
let spawner = Spawner {
tasks: Rc::downgrade(&tasks),
};
Executor { tasks, spawner }
}
}
impl<K, T> Executor<K, T>
where
K: Hash + Eq + Clone + Sized,
{
pub fn new() -> Self {
Self::default()
}
pub fn spawner(&mut self) -> &mut Spawner<K, T> {
&mut self.spawner
}
pub fn run(&mut self, timeout: f32) -> Vec<T> {
let mut results = vec![];
CURRENT_THREAD_NOTIFY.with(|thread| {
// Create a `LocalWaker` from the current thread itself
let waker = waker_ref(thread);
let mut cx = Context::from_waker(&waker);
// Take all the task available from the channel
// Exit the loop when either the channel is disconnected or
// there are no tasks available to process.
let mut tasks = self.tasks.borrow_mut();
let window = web_sys::window().expect("should have a window in this context");
let performance = window
.performance()
.expect("performance should be available");
let start = performance.now() as f32;
while let Some((k, mut task)) = tasks.pop_back() {
// Take the future, and if it has not yet completed (is still Some),
// poll it in an attempt to complete it.
// We store `Pin<Box<dyn Future<Output = T> + 'static>>`.
// We can get a `Pin<&mut dyn Future + 'static>`
// from it by calling the `Pin::as_mut` method.
let r = task.as_mut().poll(&mut cx);
match r {
Poll::Pending => {
// Wake up the task pending immediately
cx.waker().clone().wake();
// Reinsert not finished futures into the tasks queue
tasks.push_front(k, task);
}
Poll::Ready(result) => {
// If the future is completed, get the result
// and return it to the user
results.push(result);
}
}
let now = performance.now() as f32;
// Break the running if we exceed the timeout
if (now - start) >= timeout {
break;
}
}
});
results
}
// Remove a task from the executor so that
// it won't be polled anymore
pub fn remove(&mut self, k: &K) {
self.tasks.borrow_mut().remove(k);
}
}
#[cfg(test)]
mod tests {
use super::Executor;
use futures::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
// Define some futures to run concurrently on a single thread
struct LearnTask(usize);
impl LearnTask {
fn new() -> Self {
LearnTask(0)
}
}
impl Future for LearnTask {
type Output = u8;
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
self.0 += 1;
println!("I'm learning {}", self.0);
if self.0 == 10000 {
Poll::Ready(0)
} else {
//cx.waker().clone().wake();
Poll::Pending
}
}
}
struct DanceTask(usize);
impl DanceTask {
fn new() -> Self {
DanceTask(0)
}
}
impl Future for DanceTask {
type Output = u8;
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
self.0 += 1;
println!("I'm dancing {}", self.0);
if self.0 == 10000 {
Poll::Ready(0)
} else {
//cx.waker().clone().wake();
Poll::Pending
}
}
}
#[test]
fn it_works() {
let mut executor = Executor::new();
let spawner = executor.spawner();
// Spawn a task to print before and after waiting on a timer.
spawner.spawn("learning", async {
println!("LEARN begin!");
// Wait for our timer future to complete after two seconds.
LearnTask::new().await;
println!("LEARN done!");
10
});
spawner.spawn("dancing", async {
println!("DANCE begin!");
// Wait for our timer future to complete after two seconds.
DanceTask::new().await;
println!("DANCE done!");
10
});
// Run the executor for a duration of 5 milliseconds
executor.run(5_f32);
}
use futures::stream::Stream;
pub struct ParseTable {
table: Vec<u32>,
ready: bool,
idx: u32,
}
impl ParseTable {
pub fn new(table: Vec<u32>) -> Self {
let idx = 0;
let ready = false;
Self { table, idx, ready }
}
}
impl Stream for ParseTable {
type Item = u32;
/// Attempt to resolve the next item in the stream.
/// Returns `Poll::Pending` if not ready, `Poll::Ready(Some(x))` if a value
/// is ready, and `Poll::Ready(None)` if the stream has completed.
fn poll_next(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
// Deserialize row by row.
let len = self.table.len();
let idx = self.idx as usize;
while self.idx < len as u32 {
if !self.ready {
self.table[idx] += 10;
self.ready = true;
return Poll::Pending;
} else {
println!("{}", idx);
let row = self.table[idx];
self.idx += 1;
self.ready = false;
return Poll::Ready(Some(row));
}
}
Poll::Ready(None)
}
}
use futures::stream::StreamExt; // for `next`
#[test]
fn it_works2() {
let mut executor = Executor::new();
let spawner = executor.spawner();
// Spawn a task to print before and after waiting on a timer.
spawner.spawn("parsing", async {
println!("BEGIN parsing!");
let mut stream = ParseTable::new((0..100000).collect());
let mut results: Vec<u32> = vec![];
while let Some(item) = stream.next().await {
results.push(item);
}
println!("END parsing!");
10
});
// Run the executor for a duration of 5 milliseconds
executor.run(50_f32);
}
}

View File

@@ -3,6 +3,8 @@ use walkdir::WalkDir;
extern crate walkdir;
use std::io::BufRead;
use std::process::Command;
// All my shaders reside in the 'src/shaders' directory
fn generate_shaders() -> std::result::Result<(), Box<dyn Error>> {
println!("generate shaders");
@@ -26,9 +28,48 @@ fn generate_shaders() -> std::result::Result<(), Box<dyn Error>> {
.into_owned()
.replace("/", "_")
.replace("\\", "_");
//let out_name = format!("{}/{}", OUT_PATH, out_file_name);
let src = read_shader(path)?;
let mut src = read_shader(path)?;
if std::env::var("CARGO_FEATURE_MINIFY_SHADERS").is_ok() {
println!("Feature `minify_shaders` enabled: running shader minifier");
// save to a minified path
let mut tmp_path = PathBuf::from(path);
let mut min_path = PathBuf::from(path);
let stem = path.file_stem().unwrap();
// Build new filename: stem + ".min" + extension
let tmp_file_name =
format!("{}.{}.tmp", stem.to_string_lossy(), ext.to_string_lossy());
tmp_path.set_file_name(tmp_file_name);
let min_file_name =
format!("{}.{}.min", stem.to_string_lossy(), ext.to_string_lossy());
min_path.set_file_name(min_file_name);
fs::write(tmp_path.clone(), &src)?;
Command::new("mono")
.args([
"/Users/matthieubaumann/Downloads/shader_minifier.exe",
"--format",
"text",
"--aggressive-inlining",
"--preserve-externals",
"--move-declarations",
"-o",
min_path.as_os_str().to_str().expect("Invalid UTF-8!"),
tmp_path.as_os_str().to_str().expect("Invalid UTF-8!"),
])
.status()
.expect("Failed to run shader_minifier");
src = read_shader(min_path)?;
} else {
println!("Feature `minify_shaders` not enabled: skipping");
}
shaders.insert(out_file_name, src);
println!("cargo:rerun-if-changed=src/shaders/{file_name}");

View File

@@ -62,6 +62,7 @@ pub struct App {
//ui: GuiRef,
shaders: ShaderManager,
pub camera: CameraViewPort,
worker: Worker,
downloader: Rc<RefCell<Downloader>>,
tile_fetcher: TileFetcherQueue,
@@ -87,6 +88,7 @@ pub struct App {
time_start_dragging: Time,
time_mouse_high_vel: Time,
dragging: bool,
vel_history: Vec<f32>,
prev_cam_position: Vector3<f64>,
//prev_center: Vector3<f64>,
@@ -104,6 +106,8 @@ pub struct App {
pub projection: ProjectionType,
cubic_tile_recv: async_channel::Receiver<WorkerResponse>,
// Async data receivers
//img_send: async_channel::Sender<ImageLayer>,
img_recv: async_channel::Receiver<ImageLayer>,
@@ -115,7 +119,7 @@ pub struct App {
//callback_position_changed: js_sys::Function,
}
use cgmath::{Vector2, Vector3};
use cgmath::{Vector2, Vector3, Zero};
use crate::math::projection::*;
pub const BLENDING_ANIM_DURATION: DeltaTime = DeltaTime::from_millis(200.0); // in ms
@@ -198,8 +202,7 @@ impl App {
let (_, img_recv) = async_channel::unbounded::<ImageLayer>();
let (ack_img_send, _) = async_channel::unbounded::<ImageParams>();
//let line_renderer = RasterizedLineRenderer::new(&gl)?;
let (cubic_tile_send, cubic_tile_recv) = async_channel::unbounded::<WorkerResponse>();
let dist_dragging = 0.0;
let time_start_dragging = Time::now();
@@ -208,6 +211,49 @@ impl App {
let browser_features_support = BrowserFeaturesSupport::new();
let vel_history = vec![];
let worker = create_worker()?;
// Send the ack to the js promise so that she finished
let onmessage = Closure::<dyn FnMut(web_sys::MessageEvent)>::new(
move |event: web_sys::MessageEvent| {
let data = event.data();
let bytes_js = js_sys::Reflect::get(&data, &"bytes".into())
.unwrap()
.dyn_into::<js_sys::Uint8Array>()
.expect("is not a uint8 buffer");
// Zero-copy clone from JS memory
let mut bytes = vec![0u8; bytes_js.length() as usize];
bytes_js.copy_to(&mut bytes);
let meta: WorkerResponseMeta = serde_wasm_bindgen::from_value(data).unwrap();
let response = WorkerResponse {
bytes,
tile_size: meta.tile_size,
tile_depth: meta.tile_depth,
cell: meta.cell,
hips_cdid: meta.hips_cdid,
};
let c = cubic_tile_send.clone();
wasm_bindgen_futures::spawn_local(async move {
c.send(response).await.unwrap_throw();
})
},
);
worker.set_onmessage(Some(onmessage.as_ref().unchecked_ref()));
// 🚨 VERY IMPORTANT: prevent the closure from being dropped
onmessage.forget();
gl.blend_func(
WebGl2RenderingContext::SRC_ALPHA,
WebGl2RenderingContext::ONE_MINUS_SRC_ALPHA,
);
Ok(App {
gl,
//ui,
@@ -244,6 +290,8 @@ impl App {
time_start_dragging,
time_mouse_high_vel,
dragging,
vel_history,
worker,
prev_cam_position,
out_of_fov,
@@ -259,17 +307,27 @@ impl App {
//img_send,
img_recv,
ack_img_send,
cubic_tile_recv,
browser_features_support, //ack_img_recv,
})
}
fn _update_hips_location(&mut self) {
let camera = &self.camera;
for hips in self.layers.get_mut_hipses() {
if let HiPS::D3(hips) = hips {
hips.set_cursor_location(camera);
}
}
}
fn look_for_new_tiles(&mut self) -> Result<(), JsValue> {
// Move the views of the different active hipss
self.tile_fetcher.clear();
// Loop over the hipss
for hips in self.layers.get_mut_hipses() {
if self.camera.get_tile_depth() == 0 {
/*if self.camera.get_tile_depth() == 0 {
match hips {
HiPS::D2(h) => {
let query = query::Allsky::new(h.get_config(), None);
@@ -281,7 +339,7 @@ impl App {
// no Allsky generated for HiPS3D
HiPS::D3(_) => (),
}
}
}*/
hips.look_for_new_tiles(
&mut self.tile_fetcher,
@@ -492,7 +550,7 @@ impl App {
self.inertia.is_some()
}
pub(crate) fn update(&mut self, dt: DeltaTime) -> Result<bool, JsValue> {
pub(crate) fn update(&mut self, dt: f64) -> Result<bool, JsValue> {
// a timer stopping the frame if it takes too long
// useful for garanting a framerate
let rendering_timer = Time::now();
@@ -505,7 +563,7 @@ impl App {
// The threshold stopping criteria must be dependant
// of the zoom level, in this case the initial angular distance
// speed
let thresh_speed = inertia.get_start_ampl() * 1e-3;
let thresh_speed = inertia.get_start_ampl() * 1e-4;
let cur_speed = inertia.get_cur_speed();
if cur_speed < thresh_speed {
@@ -513,8 +571,6 @@ impl App {
}
}
self.draw()?;
// Check for async retrieval
if let Ok(img) = self.img_recv.try_recv() {
let params = img.get_params();
@@ -533,6 +589,27 @@ impl App {
})
}
if let Ok(WorkerResponse {
cell,
hips_cdid,
tile_size,
tile_depth,
bytes,
..
}) = self.cubic_tile_recv.try_recv()
{
if let Some(HiPS::D3(hips)) = self.layers.get_mut_hips_from_cdid(&hips_cdid) {
hips.push_tile_from_png(
&cell,
bytes.into_boxed_slice(),
(tile_size, tile_size, tile_depth),
Time::now(),
)?;
}
self.request_redraw = true;
}
let has_camera_moved = self.camera.has_moved();
{
@@ -543,9 +620,10 @@ impl App {
/*let is_there_new_available_tiles = self
.downloader
.get_resolved_tiles(/*&available_tiles, */&mut self.hipss);*/
//self.tile_fetcher.clear();
if self.request_for_new_tiles
//&& Time::now() - self.last_time_request_for_new_tiles > DeltaTime::from(200.0)
&& Time::now() - self.last_time_request_for_new_tiles > DeltaTime::from(500.0)
{
self.look_for_new_tiles()?;
@@ -554,25 +632,29 @@ impl App {
}
// Tiles are fetched if:
let fetch_tiles =
// * the user is not panning the view
// * or the user is but did not move for at least 100ms
(Time::now() - self.camera.get_time_of_last_move() >= DeltaTime(100.0) || !self.dragging) &&
// * no inertia action is in progress
self.inertia.is_none() &&
// * the user is not zooming
!self.camera.has_zoomed();
//let fetch_tiles =
// * the user is not panning the view
// * or the user is but did not move for at least 100ms
//(Time::now() - self.camera.get_time_of_last_move() >= DeltaTime(100.0) || !self.dragging) &&
// * no inertia action is in progress
//self.inertia.is_none() &&
// * the user is not zooming
// !self.camera.has_zoomed();
if fetch_tiles {
self.tile_fetcher.notify(self.downloader.clone(), None);
}
//if fetch_tiles {
self.tile_fetcher.notify(self.downloader.clone(), None);
//}
}
let rscs_received = self.downloader.borrow_mut().get_received_resources();
let mut tile_copied = false;
const MAX_FRAME_TIME: DeltaTime = DeltaTime::from_millis(1000.0 / 25.0);
const MAX_FRAME_TIME: DeltaTime = DeltaTime::from_millis(1000.0 / 40.0);
// - there is at least one tile in its blending phase
let blending_anim_occuring =
(Time::now() - self.time_start_blending) < BLENDING_ANIM_DURATION;
for rsc in rscs_received {
if Time::now() - rendering_timer >= MAX_FRAME_TIME {
@@ -677,92 +759,40 @@ impl App {
ImageType::ImageRgba8u {
image: Bitmap { image, .. },
} => {
let document = web_sys::window()
.unwrap_abort()
.document()
.unwrap_abort();
let canvas = document
.create_element("canvas")?
.dyn_into::<web_sys::HtmlCanvasElement>()?;
canvas.set_width(image.width());
canvas.set_height(image.height());
let context = canvas
.get_context("2d")?
.unwrap_abort()
.dyn_into::<web_sys::CanvasRenderingContext2d>()?;
// Get the data once for all for the whole image
// This takes time so better do it once and not repeatly
context.draw_image_with_image_bitmap(
image, 0.0, 0.0,
let msg = js_sys::Object::new();
js_sys::Reflect::set(
&msg,
&"bitmap".into(),
image,
)?;
js_sys::Reflect::set(
&msg,
&"tileSize".into(),
&JsValue::from_f64(*tile_size as f64),
)?;
js_sys::Reflect::set(
&msg,
&"tileDepth".into(),
&JsValue::from_f64(*tile_depth as f64),
)?;
js_sys::Reflect::set(
&msg,
&"cell".into(),
&serde_wasm_bindgen::to_value(&cell)
.expect("Failed to serialize"),
)?;
// Cut the png in several tile images. See page 3 of
// https://aladin.cds.unistra.fr/java/DocTechHiPS3D.pdf
let tile_depth = *tile_depth;
let num_cols =
(tile_depth as f32).sqrt().floor() as u32;
let num_rows = ((tile_depth as f32)
/ (num_cols as f32))
.ceil()
as u32;
js_sys::Reflect::set(
&msg,
&"HiPS".into(),
&JsValue::from_str(&tile.hips_cdid),
)?;
let tile_size = *tile_size;
// Transfer ownership (zero-copy)
let transfer = js_sys::Array::of1(image);
let bytes = context
.get_image_data(
0_f64,
0_f64,
(num_cols * tile_size) as f64,
(num_rows * tile_size) as f64,
)?
.data()
.0;
let mut decoded_bytes = vec![
0_u8;
(tile_size * tile_size * tile_depth * 2)
as usize
];
let mut k = 0;
let mut num_tiles_cropped = 0;
for y in 0..num_rows {
let sy = y * tile_size;
for x in 0..num_cols {
let sx = x * tile_size;
for i in sy..(sy + tile_size) {
for j in sx..(sx + tile_size) {
let id_byte = (j + i
* num_cols
* tile_size)
* 4;
decoded_bytes[k] =
bytes[id_byte as usize];
decoded_bytes[k + 1] =
bytes[id_byte as usize + 3];
k += 2;
}
}
num_tiles_cropped += 1;
if num_tiles_cropped == tile_depth {
break;
}
}
if num_tiles_cropped == tile_depth {
break;
}
}
hips.push_tile_from_png(
cell,
decoded_bytes.into_boxed_slice(),
(tile_size, tile_size, tile_depth),
tile.request.time_request,
self.worker.post_message_with_transfer(
&msg, &transfer,
)?;
}
ImageType::ImageRgb8u {
@@ -922,16 +952,14 @@ impl App {
}
}
// - there is at least one tile in its blending phase
let blending_anim_occuring =
(Time::now() - self.time_start_blending) < BLENDING_ANIM_DURATION;
self.rendering = blending_anim_occuring
| has_camera_moved
| self.camera.has_zoomed()
| self.request_redraw
| self.inertia.is_some();
self.draw()?;
// Reset the flags about the user action
self.camera.reset();
@@ -1028,64 +1056,63 @@ impl App {
self.layers.reset_frame();*/
//let scene_redraw = self.rendering | force_render;
let scene_redraw = true;
//let mut ui = self.ui.lock();
//let ui_redraw = ui.redraw_needed();
//if scene_redraw || ui_redraw {
if scene_redraw {
self.request_redraw = false;
let shaders = &mut self.shaders;
self.request_redraw = false;
let gl = self.gl.clone();
let shaders = &mut self.shaders;
let camera = &mut self.camera;
let gl = self.gl.clone();
let grid = &mut self.grid;
let moc = &mut self.moc;
let projection = &self.projection;
let camera = &mut self.camera;
let layers = &mut self.layers;
//let catalogs = &self.manager;
let colormaps = &self.colormaps;
//let fbo_view = &self._fbo_view;
//let final_rendering_pass = &self._final_rendering_pass;
let grid = &mut self.grid;
let moc = &mut self.moc;
let projection = &self.projection;
//fbo_view.draw_onto(
// move || {
// Render the scene
// Clear all the screen first (only the region set by the scissor)
gl.clear(WebGl2RenderingContext::COLOR_BUFFER_BIT);
let layers = &mut self.layers;
//let catalogs = &self.manager;
let colormaps = &self.colormaps;
//let fbo_view = &self._fbo_view;
//let final_rendering_pass = &self._final_rendering_pass;
// set the blending options
layers.draw(camera, shaders, colormaps, projection)?;
//fbo_view.draw_onto(
// move || {
// Render the scene
// Clear all the screen first (only the region set by the scissor)
gl.clear(WebGl2RenderingContext::COLOR_BUFFER_BIT);
// Draw the catalog
//let fbo_view = &self.fbo_view;
//catalogs.draw(&gl, shaders, camera, colormaps, fbo_view)?;
//catalogs.draw(&gl, shaders, camera, colormaps, None, self.projection)?;
/*gl.blend_func_separate(
WebGl2RenderingContext::SRC_ALPHA,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
);*/
moc.draw(camera, projection, shaders)?;
// set the blending options
layers.draw(camera, shaders, colormaps, projection)?;
/*gl.blend_func_separate(
WebGl2RenderingContext::SRC_ALPHA,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
);*/
grid.draw(camera, projection, shaders)?;
// Ok(())
// },
// None,
//)?;
// Draw the catalog
//let fbo_view = &self.fbo_view;
//catalogs.draw(&gl, shaders, camera, colormaps, fbo_view)?;
//catalogs.draw(&gl, shaders, camera, colormaps, None, self.projection)?;
/*gl.blend_func_separate(
WebGl2RenderingContext::SRC_ALPHA,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
);*/
moc.draw(camera, projection, shaders)?;
//final_rendering_pass.draw_on_screen(fbo_view, &mut self.shaders)?;
}
/*gl.blend_func_separate(
WebGl2RenderingContext::SRC_ALPHA,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
WebGl2RenderingContext::ONE,
);*/
grid.draw(camera, projection, shaders)?;
// Ok(())
// },
// None,
//)?;
//final_rendering_pass.draw_on_screen(fbo_view, &mut self.shaders)?;
Ok(())
}
@@ -1103,10 +1130,6 @@ impl App {
Ok(())
}
pub(crate) fn rename_layer(&mut self, layer: &str, new_layer: &str) -> Result<(), JsValue> {
self.layers.rename_layer(layer, new_layer)
}
pub(crate) fn swap_layers(
&mut self,
first_layer: &str,
@@ -1220,7 +1243,7 @@ impl App {
&gl,
wcs,
bitpix,
raw_bytes,
raw_bytes.as_ref(),
bscale,
bzero,
blank,
@@ -1304,6 +1327,18 @@ impl App {
}
}
pub(crate) fn get_hips_frequency_window(&mut self, layer: &str) -> Result<[Freq; 2], JsValue> {
let hips = self
.layers
.get_mut_hips_from_layer(layer)
.ok_or_else(|| JsValue::from_str("Layer not found"))?;
match hips {
HiPS::D2(_) => Err(JsValue::from_str("layer do not refers to a cube")),
HiPS::D3(hips) => Ok(hips.get_freq_window()),
}
}
pub(crate) fn get_freq_from_hash(&mut self, layer: &str, hash: u64) -> Result<f64, JsValue> {
let hips = self
.layers
@@ -1529,6 +1564,8 @@ impl App {
// And stop the current inertia as well if there is one
self.inertia = None;
self._update_hips_location();
}
pub(crate) fn move_mouse(&mut self, s1x: f32, s1y: f32, s2x: f32, s2y: f32) {
@@ -1538,7 +1575,16 @@ impl App {
let dx = crate::math::vector::dist2(&from_mouse_pos, &to_mouse_pos).sqrt();
self.dist_dragging += dx;
//let now = Time::now();
//let dragging_duration = (now - self.time_start_dragging).as_secs();
//let dragging_vel = self.dist_dragging / dragging_duration;
// 1. Use smoothed velocity instead of instantaneous velocity
let dv = dx / (Time::now() - self.camera.get_time_of_last_move()).as_secs();
self.vel_history.push(dv);
if self.vel_history.len() > 5 {
self.vel_history.remove(0);
}
if dv > 10000.0 {
self.time_mouse_high_vel = Time::now();
@@ -1586,16 +1632,23 @@ impl App {
return;
}
if self.vel_history.len() < 5 {
return;
}
let now = Time::now();
let dragging_duration = (now - self.time_start_dragging).as_secs();
let dragging_vel = self.dist_dragging / dragging_duration;
let avg_vel = self.vel_history.iter().copied().sum::<f32>() / self.vel_history.len() as f32;
// 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
|| (Time::now() - self.time_start_dragging).as_secs() < 0.1;
// 2. Clamp minimum + maximum velocities
let min_vel = 1000.0; // tweak
if dragging_vel < 2000.0 && !recent_acceleration {
// 3. Better condition for “recent acceleration
let t_since_drag = (now - self.time_start_dragging).as_secs();
let t_since_accel = (now - self.time_mouse_high_vel).as_secs();
let inertia_trigger =
avg_vel > min_vel || ((t_since_drag < 0.15) || (t_since_accel < 0.15));
if !inertia_trigger {
return;
}
@@ -1605,10 +1658,8 @@ impl App {
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;
let ampl = (delta_angle * avg_vel as f64) * 5e-3;
self.inertia = Some(Inertia::new(ampl.to_radians(), axis, self.north_up))
}
@@ -1630,6 +1681,11 @@ impl App {
// For the moment, no animation is triggered.
// The fov is directly set
self.camera.set_aperture(fov, &self.projection);
// reset the parameters that determine if an inertia is needed
self.vel_history.clear();
self.dist_dragging = 0.0;
self.request_for_new_tiles = true;
self.request_redraw = true;
}
@@ -1718,7 +1774,6 @@ impl App {
}
} 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();
@@ -1728,9 +1783,39 @@ impl App {
self.prev_cam_position = prev_cam_position;
self.request_for_new_tiles = true;
self._update_hips_location();
}
} else {
self.out_of_fov = true;
// approx move
let origin2next = Vector2::new(s2x - s1x, s2y - s1y);
if origin2next != Vector2::zero() {
let prev_pos = self.camera.get_center();
let prev_cam_position = self.get_center().vector();
let center_screen = self
.projection
.model_to_screen_space(&prev_cam_position, &self.camera)
.unwrap();
let next_s = origin2next + center_screen;
if let Some(cur_pos) = self.projection.screen_to_model_space(&next_s, &self.camera)
{
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;
self._update_hips_location();
}
}
}
}
@@ -1758,6 +1843,12 @@ impl App {
pub(crate) fn set_zoom_factor(&mut self, zoom_factor: f64) {
self.camera.set_zoom_factor(zoom_factor, &self.projection);
// reset the parameters that determine if an inertia is needed
self.vel_history.clear();
self.dist_dragging = 0.0;
self._update_hips_location();
self.request_for_new_tiles = true;
self.request_redraw = true;
}
@@ -1778,3 +1869,132 @@ impl App {
self.rendering
}
}
use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct WorkerResponse {
#[serde(rename = "tileSize")]
pub tile_size: u32,
#[serde(rename = "tileDepth")]
pub tile_depth: u32,
pub bytes: Vec<u8>,
#[serde(rename = "HiPSCDid")]
pub hips_cdid: String,
pub cell: HEALPixFreqCell,
}
#[derive(Deserialize, Debug)]
pub struct WorkerResponseMeta {
#[serde(rename = "tileSize")]
pub tile_size: u32,
#[serde(rename = "tileDepth")]
pub tile_depth: u32,
#[serde(rename = "HiPSCDid")]
pub hips_cdid: String,
pub cell: HEALPixFreqCell,
}
use web_sys::{Worker, WorkerOptions};
pub fn create_worker() -> Result<Worker, JsValue> {
// JS source code of the worker
let worker_source = r#"
self.onmessage = (e) => {
const { bitmap, tileDepth, tileSize, HiPS, cell } = e.data;
// Compute tiling layout
const numCols = Math.floor(bitmap.width / tileSize);
// See HiPS3D doc
const numRows = Math.ceil(tileDepth / numCols);
// Create OffscreenCanvas
const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
const context = canvas.getContext("2d");
// Draw full image once
context.drawImage(bitmap, 0, 0);
// Extract full region needed
const imageData = context.getImageData(
0,
0,
numCols * tileSize,
numRows * tileSize
);
const bytes = imageData.data; // Uint8ClampedArray (RGBA)
// Allocate output buffer (2 bytes per pixel)
const decodedBytes = new Uint8Array(
tileSize * tileSize * tileDepth * 2
);
let k = 0;
let numTilesCropped = 0;
for (let y = 0; y < numRows; y++) {
const sy = y * tileSize;
for (let x = 0; x < numCols; x++) {
const sx = x * tileSize;
for (let i = sy; i < sy + tileSize; i++) {
for (let j = sx; j < sx + tileSize; j++) {
const idByte = (j + i * numCols * tileSize) * 4;
// Copy R channel
decodedBytes[k] = bytes[idByte];
// Copy A channel
decodedBytes[k + 1] = bytes[idByte + 3];
k += 2;
}
}
numTilesCropped++;
if (numTilesCropped === tileDepth) {
break;
}
}
if (numTilesCropped === tileDepth) {
break;
}
}
self.postMessage(
{
tileSize,
tileDepth,
HiPSCDid: HiPS,
cell,
bytes: decodedBytes,
},
[decodedBytes.buffer] // transfer of ownership
);
};
"#;
// Create Blob
let parts = js_sys::Array::of1(&JsValue::from_str(worker_source));
let blob = web_sys::Blob::new_with_str_sequence(&parts)?;
// Create object URL
let url = web_sys::Url::create_object_url_with_blob(&blob)?;
let opts = WorkerOptions::new();
let worker = Worker::new_with_options(&url, &opts)?;
Ok(worker)
}

View File

@@ -224,6 +224,8 @@ impl CameraViewPort {
self.view_hpx_cells.get_cells(depth, frame)
}
// This method has the role to determine the render mode based on the fov
// For large FoV, raytracing drawing mode, rasterizer otherwise
pub fn is_raytracing(&self, proj: &ProjectionType) -> bool {
// Check whether the tile depth is 0 for square projection
// definition domains i.e. Mercator
@@ -240,6 +242,7 @@ impl CameraViewPort {
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(),
_ => self.aperture >= 140.0_f64.to_radians(),
}
}
@@ -315,11 +318,7 @@ impl CameraViewPort {
}
pub fn compute_ndc_to_clip_factor(&mut self, proj: &ProjectionType) {
self.ndc_to_clip = if self.height < self.width {
Vector2::new(1.0, (self.height as f64) / (self.width as f64))
} else {
Vector2::new((self.width as f64) / (self.height as f64), 1.0)
};
self.ndc_to_clip = Vector2::new(1.0, (self.height as f64) / (self.width as f64));
let bounds_size_ratio = proj.bounds_size_ratio();
self.ndc_to_clip.y *= bounds_size_ratio;
@@ -570,42 +569,48 @@ impl CameraViewPort {
}
fn compute_texture_depth(&mut self) {
/*// Compute a depth from a number of pixels on screen
let width = self.width;
let aperture = self.aperture.0 as f32;
// Compute a depth from a number of pixels on screen
/*let width = self.width;
let aperture = self.aperture as f32;
let angle_per_pixel = aperture / width;
let angle_per_pixel = aperture / width;
let two_power_two_times_depth_pixel =
std::f32::consts::PI / (3.0 * angle_per_pixel * angle_per_pixel);
let depth_pixel = (two_power_two_times_depth_pixel.log2() / 2.0).floor() as u32;
let two_power_two_times_depth_pixel =
std::f32::consts::PI / (3.0 * angle_per_pixel * angle_per_pixel);
let depth_pixel = (two_power_two_times_depth_pixel.log2() / 2.0).ceil() as u32;
//let survey_max_depth = conf.get_max_depth();
// The depth of the texture
// A texture of 512x512 pixels will have a depth of 9
const DEPTH_OFFSET_TEXTURE: u32 = 9;
// The depth of the texture corresponds to the depth of a pixel
// minus the offset depth of the texture
self.texture_depth = if DEPTH_OFFSET_TEXTURE > depth_pixel {
0_u8
} else {
(depth_pixel - DEPTH_OFFSET_TEXTURE) as u8
};*/
//let survey_max_depth = conf.get_max_depth();
// The depth of the texture
// A texture of 512x512 pixels will have a depth of 9
const DEPTH_OFFSET_TEXTURE: u32 = 9;
// The depth of the texture corresponds to the depth of a pixel
// minus the offset depth of the texture
self.texture_depth = if DEPTH_OFFSET_TEXTURE > depth_pixel {
0_u8
} else {
(depth_pixel - DEPTH_OFFSET_TEXTURE) as u8
};
*/
let w_screen_device_px = self.width as f64 / (self.dpi as f64);
//let depth_pixel = 29_usize;
let w_screen_px = self.width as f64;
let smallest_cell_size_px = self.dpi as f64;
let mut depth_pixel = 29_usize;
let pixel_angle_rad = self.get_aperture() / w_screen_device_px;
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 {
break;
// Find the smallest depth such that MEAN_HPX_CELL_RES[depth] > pixel_angle_rad
let depth_pixel = match crate::healpix::utils::MEAN_HPX_CELL_RES.binary_search_by(|&res| {
if res < pixel_angle_rad {
std::cmp::Ordering::Greater
} else if res > pixel_angle_rad {
std::cmp::Ordering::Less
} else {
std::cmp::Ordering::Equal
}
}) {
Ok(idx) => idx, // exact match
Err(idx) => idx,
};
depth_pixel -= 1;
}
depth_pixel += 1;
//al_core::log(&format!("{:?}", depth_pixel));
const DEPTH_OFFSET_TEXTURE: usize = 9;
self.texture_depth = if DEPTH_OFFSET_TEXTURE > depth_pixel {
0_u8

View File

@@ -96,11 +96,7 @@ impl Downloader {
}
pub fn delay(&mut self, r: RequestType) {
match r {
RequestType::Tile(tile) => {
self.cache.insert(tile.id.clone(), RequestType::Tile(tile));
}
_ => unimplemented!(),
}
let id = r.id().to_owned();
self.cache.insert(id, r);
}
}

View File

@@ -147,7 +147,7 @@ impl From<query::Allsky> for AllskyRequest {
let FitsImage {
raw_bytes, bitpix, ..
} = FitsImage::from_raw_bytes(raw_bytes.as_slice())?[0];
} = &FitsImage::from_raw_bytes(raw_bytes.as_slice())?[0];
match bitpix {
Bitpix::U8 => {
Ok(handle_allsky_fits(raw_bytes, tile_size, allsky_tile_size)?
@@ -213,7 +213,6 @@ impl From<query::Allsky> for AllskyRequest {
Self {
id,
hips_cdid,
//depth_tile,
url,
request,
channel: slice,

View File

@@ -133,8 +133,9 @@ async fn query_html_image(
// Set the CORS and credentials options for the image
let cors_value = match credentials {
RequestCredentials::Include => Some("use-credentials"),
RequestCredentials::SameOrigin => Some("anonymous"),
_ => Some(""),
RequestCredentials::Omit => Some("anonymous"),
RequestCredentials::SameOrigin => Some(""),
_ => None,
};
let promise = js_sys::Promise::new(

View File

@@ -1,6 +1,6 @@
use std::cmp::Ordering;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Deserialize, serde::Serialize)]
pub struct HEALPixCell(pub u8, pub u64);
#[derive(Debug)]
@@ -492,7 +492,7 @@ impl Ord for HEALPixCell {
}
/// A simple object describing a cubic tile of a HiPS3D
#[derive(Eq, Hash, PartialEq, Clone, Debug)]
#[derive(Eq, Hash, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct HEALPixFreqCell {
pub hpx: HEALPixCell,
pub f_hash: u64,

View File

@@ -99,10 +99,6 @@ impl FreqSpaceMoc {
let f_hash_0 = f_hash << (Frequency::<u64>::MAX_DEPTH - f_depth);
let f_hash_1 = (f_hash + 1) << (Frequency::<u64>::MAX_DEPTH - f_depth);
//let f0 = Frequency::<u64>::hash2freq(5171582628058365952);
//let f1 = Frequency::<u64>::hash2freq(5171590187200806912);
//al_core::log(&format!("F1: {f0}"));
let hpx_ranges_2d = HpxRanges2D::create_from_freq_ranges_positions(
vec![f_hash_0..f_hash_1; 1],
vec![hpx.idx()],

View File

@@ -3,7 +3,6 @@ use cgmath::Vector3;
use crate::camera::CameraViewPort;
use crate::math::angle::ToAngle;
use crate::math::projection::ProjectionType;
use crate::time::{DeltaTime, Time};
/// State for inertia
pub struct Inertia {
// Initial angular distance
@@ -12,21 +11,20 @@ pub struct Inertia {
// Vector of rotation
axis: Vector3<f64>,
// The time when the inertia begins
time_start: Time,
north_up: bool,
}
impl Inertia {
pub fn new(ampl: f64, axis: Vector3<f64>, north_up: bool) -> Self {
Inertia {
time_start: Time::now(),
ampl,
speed: ampl,
speed: (ampl * 0.5).min(0.1),
axis,
north_up,
}
}
/*
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, _dt: DeltaTime) {
let t = ((Time::now() - self.time_start).as_millis() / 1000.0) as f64;
// Undamped angular frequency of the oscillator
@@ -46,6 +44,27 @@ impl Inertia {
let fov = start_fov * (1_f32 - alpha) + goal_fov * alpha;*/
camera.apply_axis_rotation(&self.axis, self.speed.to_angle(), proj);
if self.north_up {
camera.set_position_angle(0.0.to_angle(), proj);
}
}*/
pub fn apply(&mut self, camera: &mut CameraViewPort, proj: &ProjectionType, dt: f64) {
// Initial angular velocity
//let v0 = self.ampl * 0.5;
// Friction coefficient (tweak this)
const DAMPING_FACTOR: f64 = 5e-3;
self.speed *= (-DAMPING_FACTOR * dt).exp();
let delta_angle = self.speed * dt;
// Exponential decay of angular velocity
// self.speed = (v0 * (-damping * t).exp()).min(3.0);
//camera.apply_axis_rotation(&self.axis, self.speed.to_angle(), proj);
camera.apply_axis_rotation(&self.axis, delta_angle.to_angle(), proj);
if self.north_up {
camera.set_position_angle(0.0.to_angle(), proj);
}

View File

@@ -17,6 +17,7 @@
//extern crate num;
//extern crate num_traits;
//use crate::time::Time;
#[cfg(feature = "dbg")]
use std::panic;
@@ -115,7 +116,6 @@ mod time;
use crate::{
camera::CameraViewPort, healpix::moc::SpaceMoc, math::lonlat::LonLatT, shader::ShaderManager,
time::DeltaTime,
};
use al_api::color::{Color, ColorRGBA};
@@ -136,10 +136,6 @@ use math::angle::ArcDeg;
pub struct WebClient {
// The app
app: App,
// The time between the previous and the current
// frame
dt: DeltaTime,
}
use al_api::hips::ImageMetadata;
@@ -166,9 +162,7 @@ impl WebClient {
let app = App::new(&gl, aladin_div, shaders, resources)?;
let dt = DeltaTime::zero();
let webclient = WebClient { app, dt };
let webclient = WebClient { app };
Ok(webclient)
}
@@ -193,15 +187,15 @@ impl WebClient {
///
/// # Return
/// Whether the view is moving or not
pub fn update(&mut self, dt: f32) -> Result<bool, JsValue> {
pub fn update(&mut self, dt: f64) -> Result<bool, JsValue> {
// dt refers to the time taking (in ms) rendering the previous frame
self.dt = DeltaTime::from_millis(dt);
//self.dt = DeltaTime::from_millis(dt as f32);
// Update the application and get back the
// world coordinates of the center of projection in (ra, dec)
self.app.update(
// Time of the previous frame rendering
self.dt,
dt,
)
}
@@ -237,7 +231,7 @@ impl WebClient {
"ZEA" => self
.app
.set_projection(ProjectionType::Zea(mapproj::zenithal::zea::Zea::new())), /* Equal-area */
/*"FEYE" => self
"FEYE" => self
.app
.set_projection(ProjectionType::Feye(mapproj::zenithal::feye::Feye::new())),
"AIR" => {
@@ -245,19 +239,19 @@ impl WebClient {
//air_proj.set_n_iter(10);
//air_proj.set_eps(1e-12);
self.app.set_projection(ProjectionType::Air(air_proj))
}*/
}
//"AZP",
/*"ARC" => self
"ARC" => self
.app
.set_projection(ProjectionType::Arc(mapproj::zenithal::arc::Arc::new())),
"NCP" => self
.app
.set_projection(ProjectionType::Ncp(mapproj::zenithal::ncp::Ncp::new())),*/
.set_projection(ProjectionType::Ncp(mapproj::zenithal::ncp::Ncp::new())),
// Cylindrical
"MER" => self
.app
.set_projection(ProjectionType::Mer(mapproj::cylindrical::mer::Mer::new())),
/*"CAR" => self
"CAR" => self
.app
.set_projection(ProjectionType::Car(mapproj::cylindrical::car::Car::new())),
"CEA" => self
@@ -265,17 +259,17 @@ impl WebClient {
.set_projection(ProjectionType::Cea(mapproj::cylindrical::cea::Cea::new())),
"CYP" => self
.app
.set_projection(ProjectionType::Cyp(mapproj::cylindrical::cyp::Cyp::new())),*/
.set_projection(ProjectionType::Cyp(mapproj::cylindrical::cyp::Cyp::new())),
// Pseudo-cylindrical
"AIT" => self
.app
.set_projection(ProjectionType::Ait(mapproj::pseudocyl::ait::Ait::new())),
/*"PAR" => self
"PAR" => self
.app
.set_projection(ProjectionType::Par(mapproj::pseudocyl::par::Par::new())),
"SFL" => self
.app
.set_projection(ProjectionType::Sfl(mapproj::pseudocyl::sfl::Sfl::new())),*/
.set_projection(ProjectionType::Sfl(mapproj::pseudocyl::sfl::Sfl::new())),
"MOL" => {
let mut mol_proj = mapproj::pseudocyl::mol::Mol::new();
mol_proj.set_n_iter(10);
@@ -283,13 +277,13 @@ impl WebClient {
self.app.set_projection(ProjectionType::Mol(mol_proj))
} // Conic
/*"COD" => self
"COD" => self
.app
.set_projection(ProjectionType::Cod(mapproj::conic::cod::Cod::new())),
// Hybrid
"HPX" => self
.app
.set_projection(ProjectionType::Hpx(mapproj::hybrid::hpx::Hpx::new())),*/
.set_projection(ProjectionType::Hpx(mapproj::hybrid::hpx::Hpx::new())),
_ => Err(JsValue::from_str(
"Not a valid projection name. AIT, ZEA, SIN, STG, TAN, MOL and MER are accepted",
)),
@@ -378,12 +372,6 @@ impl WebClient {
Ok(())
}
#[wasm_bindgen(js_name = renameLayer)]
pub fn rename_layer(&mut self, layer: String, new_layer: String) -> Result<(), JsValue> {
// Deserialize the hips objects that compose the hips
self.app.rename_layer(&layer, &new_layer)
}
#[wasm_bindgen(js_name = swapLayers)]
pub fn swap_layers(
&mut self,
@@ -422,6 +410,13 @@ impl WebClient {
self.app.get_hips_frequency(&layer)
}
#[wasm_bindgen(js_name = getFreqWindow)]
pub fn get_hips_frequency_window(&mut self, layer: String) -> Result<Vec<f32>, JsValue> {
let fw = self.app.get_hips_frequency_window(&layer)?;
Ok(vec![fw[0].0 as f32, fw[1].0 as f32])
}
#[wasm_bindgen(js_name = freq2hash)]
pub fn get_freq_hash(&mut self, layer: String, freq: f64) -> Result<u64, JsValue> {
self.app.get_freq_hash(&layer, freq)

View File

@@ -579,8 +579,14 @@ use std::fmt::Display;
impl Display for Angle<f64> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.fmt {
AngleFormatter::Sexagesimal { prec, plus, hours } => {
AngleFormatter::Sexagesimal {
mut prec,
plus,
hours,
} => {
let unit = if hours {
// to preserve the same angular precision the new prec is p+log10(15) ≈ p+1.18 < p+2
prec += 2;
self.to_hours()
} else {
self.to_degrees()

View File

@@ -9,6 +9,7 @@
// World space
use crate::camera::CameraViewPort;
use crate::domain::sdf::ProjDefType;
use crate::math::rotation::Rotation;
use coo_space::XYZModel;
//use crate::num_traits::FloatConst;
@@ -22,7 +23,7 @@ pub mod domain;
use crate::math::angle::ToAngle;
use crate::math::angle::Angle;
use domain::{basic, full::FullScreen};
use domain::{basic, cod::Cod, full::FullScreen, hpx::Hpx, par::Par};
/* S <-> NDC space conversion methods */
pub fn screen_to_ndc_space(
pos_screen_space: &XYScreen<f64>,
@@ -114,15 +115,15 @@ pub enum ProjectionType {
/* ZEA, Equal-area */
Zea(mapproj::zenithal::zea::Zea),
/* FEYE, Fish-eyes */
//Feye(mapproj::zenithal::feye::Feye),
Feye(mapproj::zenithal::feye::Feye),
/* AIR, */
//Air(mapproj::zenithal::air::Air),
Air(mapproj::zenithal::air::Air),
//AZP: {fov: 180},
//Azp(mapproj::zenithal::azp::Azp),
/* ARC, */
//Arc(mapproj::zenithal::arc::Arc),
Arc(mapproj::zenithal::arc::Arc),
/* NCP, */
//Ncp(mapproj::zenithal::ncp::Ncp),
Ncp(mapproj::zenithal::ncp::Ncp),
// Pseudo-cylindrical projections
/* AIT, Aitoff */
@@ -130,26 +131,26 @@ pub enum ProjectionType {
// MOL, Mollweide */
Mol(mapproj::pseudocyl::mol::Mol),
// PAR, */
//Par(mapproj::pseudocyl::par::Par),
Par(mapproj::pseudocyl::par::Par),
// SFL, */
//Sfl(mapproj::pseudocyl::sfl::Sfl),
Sfl(mapproj::pseudocyl::sfl::Sfl),
// Cylindrical projections
// MER, Mercator */
Mer(mapproj::cylindrical::mer::Mer),
// CAR, */
//Car(mapproj::cylindrical::car::Car),
Car(mapproj::cylindrical::car::Car),
// CEA, */
//Cea(mapproj::cylindrical::cea::Cea),
Cea(mapproj::cylindrical::cea::Cea),
// CYP, */
//Cyp(mapproj::cylindrical::cyp::Cyp),
Cyp(mapproj::cylindrical::cyp::Cyp),
// Conic projections
// COD, */
//Cod(mapproj::conic::cod::Cod),
Cod(mapproj::conic::cod::Cod),
// HEALPix hybrid projection
//Hpx(mapproj::hybrid::hpx::Hpx),
Hpx(mapproj::hybrid::hpx::Hpx),
}
use crate::math::lonlat::LonLat;
@@ -305,38 +306,38 @@ impl ProjectionType {
/* ZEA, Equal-area */
ProjectionType::Zea(_) => 1.0,
/* FEYE, Fish-eyes */
//ProjectionType::Feye(_) => 1.0,
ProjectionType::Feye(_) => 1.0,
/* AIR, */
//ProjectionType::Air(_) => 1.0,
ProjectionType::Air(_) => 1.0,
//AZP: {fov: 180},
//Azp(mapproj::zenithal::azp::Azp),
/* ARC, */
//ProjectionType::Arc(_) => 1.0,
ProjectionType::Arc(_) => 1.0,
/* NCP, */
//ProjectionType::Ncp(_) => 1.0,
ProjectionType::Ncp(_) => 1.0,
// Pseudo-cylindrical projections
/* AIT, Aitoff */
ProjectionType::Ait(_) => 2.0,
// MOL, Mollweide */
ProjectionType::Mol(_) => 2.0,
// PAR, */
//ProjectionType::Par(_) => 2.0,
ProjectionType::Par(_) => 2.0,
// SFL, */
//ProjectionType::Sfl(_) => 2.0,
ProjectionType::Sfl(_) => 2.0,
// Cylindrical projections
// MER, Mercator */
ProjectionType::Mer(_) => 1.0,
// CAR, */
//ProjectionType::Car(_) => 1.0,
ProjectionType::Car(_) => 1.0,
// CEA, */
//ProjectionType::Cea(_) => 1.0,
ProjectionType::Cea(_) => 1.0,
// CYP, */
//ProjectionType::Cyp(_) => 1.0,
ProjectionType::Cyp(_) => 1.0,
// Conic projections
// COD, */
//ProjectionType::Cod(_) => 1.0,
ProjectionType::Cod(_) => 1.0,
// HEALPix hybrid projection
//ProjectionType::Hpx(_) => 2.0,
ProjectionType::Hpx(_) => 2.0,
}
}
@@ -352,15 +353,15 @@ impl ProjectionType {
/* ZEA, Equal-area */
ProjectionType::Zea(_) => 359.9_f64.to_radians().to_angle(),
/* FEYE, Fish-eyes */
//ProjectionType::Feye(_) => 190.0,
ProjectionType::Feye(_) => 190.0_f64.to_radians().to_angle(),
/* AIR, */
//ProjectionType::Air(_) => 360.0,
ProjectionType::Air(_) => 360.0_f64.to_radians().to_angle(),
//AZP: {fov: 180},
//Azp(mapproj::zenithal::azp::Azp),
//ProjectionType::Azp(mapproj::zenithal::azp::Azp),
/* ARC, */
//ProjectionType::Arc(_) => 360.0,
ProjectionType::Arc(_) => 360.0_f64.to_radians().to_angle(),
/* NCP, */
//ProjectionType::Ncp(_) => 180.0,
ProjectionType::Ncp(_) => 180.0_f64.to_radians().to_angle(),
// Pseudo-cylindrical projections
/* AIT, Aitoff */
@@ -368,26 +369,26 @@ impl ProjectionType {
// MOL, Mollweide */
ProjectionType::Mol(_) => 360.0_f64.to_radians().to_angle(),
// PAR, */
//ProjectionType::Par(_) => 360.0,
ProjectionType::Par(_) => 360.0_f64.to_radians().to_angle(),
// SFL, */
//ProjectionType::Sfl(_) => 360.0,
ProjectionType::Sfl(_) => 360.0_f64.to_radians().to_angle(),
// Cylindrical projections
// MER, Mercator */
ProjectionType::Mer(_) => 360.0_f64.to_radians().to_angle(),
// CAR, */
//ProjectionType::Car(_) => 360.0,
ProjectionType::Car(_) => 360.0_f64.to_radians().to_angle(),
// CEA, */
//ProjectionType::Cea(_) => 360.0,
ProjectionType::Cea(_) => 360.0_f64.to_radians().to_angle(),
// CYP, */
//ProjectionType::Cyp(_) => 360.0,
ProjectionType::Cyp(_) => 360.0_f64.to_radians().to_angle(),
// Conic projections
// COD, */
//ProjectionType::Cod(_) => 330.0,
ProjectionType::Cod(_) => 330.0_f64.to_radians().to_angle(),
// HEALPix hybrid projection
//ProjectionType::Hpx(_) => 360.0,
ProjectionType::Hpx(_) => 360.0_f64.to_radians().to_angle(),
}
}
@@ -415,27 +416,27 @@ impl ProjectionType {
&DISK
}
/* FEYE, Fish-eyes */
/*ProjectionType::Feye(_) => {
ProjectionType::Feye(_) => {
const DISK: ProjDefType = ProjDefType::Disk(basic::disk::Disk { radius: 1.0 });
&DISK
}*/
}
/* AIR, */
/*ProjectionType::Air(_) => {
ProjectionType::Air(_) => {
const DISK: ProjDefType = ProjDefType::FullScreen(FullScreen);
&DISK
}*/
}
//AZP: {fov: 180},
//Azp(mapproj::zenithal::azp::Azp),
/* ARC, */
/*ProjectionType::Arc(_) => {
ProjectionType::Arc(_) => {
const DISK: ProjDefType = ProjDefType::Disk(basic::disk::Disk { radius: 1.0 });
&DISK
}*/
}
/* NCP, */
/*ProjectionType::Ncp(_) => {
ProjectionType::Ncp(_) => {
const DISK: ProjDefType = ProjDefType::Disk(basic::disk::Disk { radius: 1.0 });
&DISK
}*/
}
// Pseudo-cylindrical projections
/* AIT, Aitoff */
@@ -449,15 +450,15 @@ impl ProjectionType {
&ELLIPSE
}
// PAR, */
/*ProjectionType::Par(_) => {
ProjectionType::Par(_) => {
const PAR: ProjDefType = ProjDefType::Par(Par);
&PAR
}*/
}
// SFL, */
/*ProjectionType::Sfl(_) => {
ProjectionType::Sfl(_) => {
const PAR: ProjDefType = ProjDefType::Par(Par);
&PAR
}*/
}
// Cylindrical projections
// MER, Mercator */
@@ -465,32 +466,32 @@ impl ProjectionType {
const FULL_SCREEN: ProjDefType = ProjDefType::FullScreen(FullScreen);
&FULL_SCREEN
} // CAR, */
/*ProjectionType::Car(_) => {
const FULL_SCREEN: ProjDefType = ProjDefType::FullScreen(FullScreen);
&FULL_SCREEN
}*/
// CEA, */
/*ProjectionType::Cea(_) => {
const FULL_SCREEN: ProjDefType = ProjDefType::FullScreen(FullScreen);
&FULL_SCREEN
}*/
// CYP, */
/*ProjectionType::Cyp(_) => {
const FULL_SCREEN: ProjDefType = ProjDefType::FullScreen(FullScreen);
&FULL_SCREEN
}*/
ProjectionType::Car(_) => {
const FULL_SCREEN: ProjDefType = ProjDefType::FullScreen(FullScreen);
&FULL_SCREEN
}
// CEA, */
ProjectionType::Cea(_) => {
const FULL_SCREEN: ProjDefType = ProjDefType::FullScreen(FullScreen);
&FULL_SCREEN
}
// CYP, */
ProjectionType::Cyp(_) => {
const FULL_SCREEN: ProjDefType = ProjDefType::FullScreen(FullScreen);
&FULL_SCREEN
}
// Conic projections
// COD, */
/*ProjectionType::Cod(_) => {
const CONIC: ProjDefType = ProjDefType::Cod(Cod::new());
&CONIC
}*/
// HEALPix hybrid projection
/*ProjectionType::Hpx(_) => {
const HPX_DEF_REG: ProjDefType = ProjDefType::Hpx(Hpx);
&HPX_DEF_REG
}*/
// Conic projections
// COD, */
ProjectionType::Cod(_) => {
const CONIC: ProjDefType = ProjDefType::Cod(Cod::new());
&CONIC
}
// HEALPix hybrid projection
ProjectionType::Hpx(_) => {
const HPX_DEF_REG: ProjDefType = ProjDefType::Hpx(Hpx);
&HPX_DEF_REG
}
}
}
}
@@ -509,15 +510,15 @@ impl Projection for ProjectionType {
/* ZEA, Equal-area */
ProjectionType::Zea(zea) => zea.clip_to_world_space(xy),
/* FEYE, Fish-eyes */
//ProjectionType::Feye(feye) => feye.clip_to_world_space(xy),
ProjectionType::Feye(feye) => feye.clip_to_world_space(xy),
/* AIR, */
//ProjectionType::Air(air) => air.clip_to_world_space(xy),
ProjectionType::Air(air) => air.clip_to_world_space(xy),
//AZP: {fov: 180},
//Azp(mapproj::zenithal::azp::Azp),
/* ARC, */
//ProjectionType::Arc(arc) => arc.clip_to_world_space(xy),
ProjectionType::Arc(arc) => arc.clip_to_world_space(xy),
/* NCP, */
//ProjectionType::Ncp(ncp) => ncp.clip_to_world_space(xy),
ProjectionType::Ncp(ncp) => ncp.clip_to_world_space(xy),
// Pseudo-cylindrical projections
/* AIT, Aitoff */
@@ -525,30 +526,34 @@ impl Projection for ProjectionType {
// MOL, Mollweide */
ProjectionType::Mol(mol) => mol.clip_to_world_space(xy),
// PAR, */
//ProjectionType::Par(par) => par.clip_to_world_space(xy),
ProjectionType::Par(par) => par.clip_to_world_space(xy),
// SFL, */
//ProjectionType::Sfl(sfl) => sfl.clip_to_world_space(xy),
ProjectionType::Sfl(sfl) => sfl.clip_to_world_space(xy),
// Cylindrical projections
// MER, Mercator */
ProjectionType::Mer(mer) => mer.clip_to_world_space(xy),
// CAR, */
//ProjectionType::Car(car) => car.clip_to_world_space(xy),
ProjectionType::Car(car) => car.clip_to_world_space(xy),
// CEA, */
//ProjectionType::Cea(cea) => cea.clip_to_world_space(xy),
ProjectionType::Cea(cea) => cea.clip_to_world_space(xy),
// CYP, */
//ProjectionType::Cyp(cyp) => cyp.clip_to_world_space(xy),
ProjectionType::Cyp(cyp) => cyp.clip_to_world_space(xy),
// Conic projections
// COD, */
/*ProjectionType::Cod(cod) => cod.clip_to_world_space(xy).map(|xyz| {
ProjectionType::Cod(cod) => cod.clip_to_world_space(xy).map(|xyz| {
let rot = Rotation::from_sky_position(
&LonLatT::new(0.0_f64.to_angle(), (HALF_PI * 0.5).to_angle()).vector(),
&LonLatT::new(
0.0_f64.to_angle(),
(mapproj::math::HALF_PI * 0.5).to_angle(),
)
.vector(),
);
rot.inv_rotate(&xyz)
}),*/
}),
// HEALPix hybrid projection
//ProjectionType::Hpx(hpx) => hpx.clip_to_world_space(xy),
ProjectionType::Hpx(hpx) => hpx.clip_to_world_space(xy),
}
}
@@ -565,15 +570,15 @@ impl Projection for ProjectionType {
/* ZEA, Equal-area */
ProjectionType::Zea(zea) => zea.world_to_clip_space(xyz),
/* FEYE, Fish-eyes */
//ProjectionType::Feye(feye) => feye.world_to_clip_space(xyz),
ProjectionType::Feye(feye) => feye.world_to_clip_space(xyz),
/* AIR, */
//ProjectionType::Air(air) => air.world_to_clip_space(xyz),
ProjectionType::Air(air) => air.world_to_clip_space(xyz),
//AZP: {fov: 180},
//Azp(mapproj::zenithal::azp::Azp),
/* ARC, */
//ProjectionType::Arc(arc) => arc.world_to_clip_space(xyz),
ProjectionType::Arc(arc) => arc.world_to_clip_space(xyz),
/* NCP, */
//ProjectionType::Ncp(ncp) => ncp.world_to_clip_space(xyz),
ProjectionType::Ncp(ncp) => ncp.world_to_clip_space(xyz),
// Pseudo-cylindrical projections
/* AIT, Aitoff */
@@ -581,30 +586,34 @@ impl Projection for ProjectionType {
// MOL, Mollweide */
ProjectionType::Mol(mol) => mol.world_to_clip_space(xyz),
// PAR, */
//ProjectionType::Par(par) => par.world_to_clip_space(xyz),
ProjectionType::Par(par) => par.world_to_clip_space(xyz),
// SFL, */
//ProjectionType::Sfl(sfl) => sfl.world_to_clip_space(xyz),
ProjectionType::Sfl(sfl) => sfl.world_to_clip_space(xyz),
// Cylindrical projections
// MER, Mercator */
ProjectionType::Mer(mer) => mer.world_to_clip_space(xyz),
// CAR, */
//ProjectionType::Car(car) => car.world_to_clip_space(xyz),
ProjectionType::Car(car) => car.world_to_clip_space(xyz),
// CEA, */
//ProjectionType::Cea(cea) => cea.world_to_clip_space(xyz),
ProjectionType::Cea(cea) => cea.world_to_clip_space(xyz),
// CYP, */
//ProjectionType::Cyp(cyp) => cyp.world_to_clip_space(xyz),
ProjectionType::Cyp(cyp) => cyp.world_to_clip_space(xyz),
// Conic projections
// COD, */
/*ProjectionType::Cod(cod) => {
ProjectionType::Cod(cod) => {
// The Cod projection is centered on (0, 45 deg)
let rot = Rotation::from_sky_position(
&LonLatT::new(0.0_f64.to_angle(), (HALF_PI * 0.5).to_angle()).vector(),
&LonLatT::new(
0.0_f64.to_angle(),
(mapproj::math::HALF_PI * 0.5).to_angle(),
)
.vector(),
);
cod.world_to_clip_space(&rot.rotate(&xyz))
}*/
cod.world_to_clip_space(&rot.rotate(xyz))
}
// HEALPix hybrid projection
//ProjectionType::Hpx(hpx) => hpx.world_to_clip_space(xyz),
ProjectionType::Hpx(hpx) => hpx.world_to_clip_space(xyz),
}
}
}
@@ -634,6 +643,7 @@ impl UniformType for ProjectionType {
// Cylindrical projections
// MER, Mercator */
ProjectionType::Mer(_) => gl.uniform1i(location, 6),
_ => gl.uniform1i(location, 6),
}
}
}
@@ -808,7 +818,7 @@ mod tests {
"./../img/zea.jpg",
ProjectionType::Zea(mapproj::zenithal::zea::Zea),
);
/*generate_projection_map(
generate_projection_map(
"./../img/feye.png",
ProjectionType::Feye(mapproj::zenithal::feye::Feye),
);
@@ -823,14 +833,14 @@ mod tests {
generate_projection_map(
"./../img/air.png",
ProjectionType::Air(mapproj::zenithal::air::Air::new()),
);*/
);
// Cylindrical
generate_projection_map(
"./../img/mer.jpg",
ProjectionType::Mer(mapproj::cylindrical::mer::Mer),
);
/*generate_projection_map(
generate_projection_map(
"./../img/car.png",
ProjectionType::Car(mapproj::cylindrical::car::Car),
);
@@ -841,26 +851,26 @@ mod tests {
generate_projection_map(
"./../img/cyp.png",
ProjectionType::Cyp(mapproj::cylindrical::cyp::Cyp::new()),
);*/
);
// Pseudo-cylindrical
generate_projection_map(
"./../img/ait.jpg",
ProjectionType::Ait(mapproj::pseudocyl::ait::Ait),
);
/*generate_projection_map(
generate_projection_map(
"./../img/car.png",
ProjectionType::Par(mapproj::pseudocyl::par::Par),
);
generate_projection_map(
"./../img/cea.png",
ProjectionType::Sfl(mapproj::pseudocyl::sfl::Sfl),
);*/
);
generate_projection_map(
"./../img/mol.jpg",
ProjectionType::Mol(mapproj::pseudocyl::mol::Mol::new()),
);
// Conic
/*generate_projection_map(
generate_projection_map(
"./../img/cod.png",
ProjectionType::Cod(mapproj::conic::cod::Cod::new()),
);
@@ -868,6 +878,6 @@ mod tests {
generate_projection_map(
"./../img/hpx.png",
ProjectionType::Hpx(mapproj::hybrid::hpx::Hpx),
);*/
);
}
}

View File

@@ -111,27 +111,50 @@ where
// Define a rotation from an axis and a angle
pub fn from_axis_angle(axis: &Vector3<S>, angle: Angle<S>) -> Rotation<S> {
let angle: Rad<S> = angle.into();
let mat = Matrix3::from_axis_angle(axis.normalize(), angle);
(&mat).into()
let half = angle.0 * S::from(0.5).unwrap();
let (s, c) = half.sin_cos();
let axis = axis.normalize();
let q = Quaternion::new(c, axis.x * s, axis.y * s, axis.z * s);
Rotation(q)
}
// Define a rotation from a normalized vector
pub fn from_sky_position(pos: &Vector3<S>) -> Rotation<S> {
let (lon, lat) = math::lonlat::xyz_to_radec(pos);
let qy = Self::from_axis_angle(&Vector3::unit_y(), lon);
let qx = Self::from_axis_angle(&Vector3::unit_x(), -lat);
qy * qx
}
/*pub fn from_sky_position(pos: &Vector3<S>) -> Rotation<S> {
let (lon, lat) = math::lonlat::xyz_to_radec(pos);
let rot_y = Matrix3::from_angle_y(lon);
let rot_x = Matrix3::from_angle_x(-lat);
let mat = rot_y * rot_x;
(&(mat)).into()
}
}*/
// Apply a rotation to a position
pub fn rotate(&self, pos_world_space: &Vector3<S>) -> Vector3<S> {
let w2m: &Matrix3<S> = &self.into();
pub fn rotate(&self, v: &Vector3<S>) -> Vector3<S> {
/*let w2m: &Matrix3<S> = &self.into();
w2m * v*/
let qvec = self.0.v; // vector part of the quaternion
w2m * pos_world_space
// uv = qvec × v
let uv = qvec.cross(*v);
// uuv = qvec × uv
let uuv = qvec.cross(uv);
// v' = v + 2 * (uv * q.w + uuv)
*v + ((uv * self.0.s) + uuv) * (S::from(2.0).unwrap())
}
pub fn inv_rotate(&self, pos_model_space: &Vector3<S>) -> Vector3<S> {
let w2m: &Matrix3<S> = &self.into();
let m2w = w2m.transpose();

View File

@@ -215,7 +215,7 @@ impl ProjetedGrid {
let start_lon = bbox.lon_min() - (bbox.lon_min() % step_lon);
let mut stop_lon = bbox.lon_max();
if bbox.all_lon() {
stop_lon -= 1e-3;
stop_lon += 1e-3;
}
let mut meridians = vec![];

View File

@@ -77,7 +77,7 @@ impl HiPSConfig {
}
let format = match img_ext {
ImageExt::Fits => {
ImageExt::Fits | ImageExt::FitsFz => {
// Check the bitpix to determine the internal format of the tiles
if let Some(bitpix) = bitpix {
let fmt = (match bitpix {
@@ -176,7 +176,7 @@ impl HiPSConfig {
pub fn set_image_ext(&mut self, ext: ImageExt) -> Result<(), JsValue> {
let format = match ext {
ImageExt::Fits => {
ImageExt::Fits | ImageExt::FitsFz => {
// Check the bitpix to determine the internal format of the tiles
if let Some(bitpix) = self.bitpix {
let fmt = (match bitpix {

View File

@@ -77,34 +77,37 @@ fn create_hpx_texture_storage(
WebGlRenderingCtx::TEXTURE_WRAP_T,
WebGlRenderingCtx::CLAMP_TO_EDGE,
),
// Prevents r-coordinate wrapping (repeating)
(
WebGlRenderingCtx::TEXTURE_WRAP_R,
WebGlRenderingCtx::CLAMP_TO_EDGE,
),
];
match channel {
PixelType::RGBA8U => Texture2DArray::create_empty::<RGBA8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::RGB8U => Texture2DArray::create_empty::<RGB8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::RGBA8U => {
Texture2DArray::create_empty::<RGBA8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
)
}
PixelType::RGB8U => {
Texture2DArray::create_empty::<RGB8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
)
}
PixelType::R32F => Texture2DArray::create_empty::<R32F>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::R8U => Texture2DArray::create_empty::<R8U>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
num_tiles, tex_params,
),
PixelType::R16I => Texture2DArray::create_empty::<R16I>(
gl, tile_size, tile_size,
// 256 is a consensus for targetting the maximum GPU architectures. We create a 128 slices to optimize performance
@@ -211,9 +214,9 @@ impl HiPS2DBuffer {
)?;
self.num_root_textures_available += 1;
if self.num_root_textures_available == 12 {
/*if self.num_root_textures_available == 12 {
self.allsky_pixels.generate_mipmap()
}
}*/
}
self.available_tiles_during_frame = true;
@@ -285,7 +288,7 @@ impl HiPS2DBuffer {
.tile_pixels
.read_pixel(pos_tex.x, pos_tex.y, pos_tex.z)?,
_ => {
let uvy = 1.0 - (pos_tex.y as f32 / tile_size);
let uvy = 1.0 - (dx as f32);
pos_tex.y = (uvy * tile_size) as i32;
let f64_v = self
@@ -357,6 +360,7 @@ impl HpxTileBuffer for HiPS2DBuffer {
HpxTex::new(&HEALPixCell(0, 10), 10, now),
HpxTex::new(&HEALPixCell(0, 11), 11, now),
];
let channel = config.get_format().get_pixel_format();
let tile_size = config.get_tile_size();
let tile_pixels = create_hpx_texture_storage(gl, channel, 128, tile_size)?;
@@ -390,6 +394,7 @@ impl HpxTileBuffer for HiPS2DBuffer {
self.config.set_image_ext(ext)?;
let channel = self.config.get_format().get_pixel_format();
let tile_size = self.config.get_tile_size();
self.tile_pixels = create_hpx_texture_storage(gl, channel, 128, tile_size)?;

View File

@@ -219,6 +219,9 @@ pub struct HiPS2D {
//#[cfg(feature = "webgl1")]
// layout (location = 0) in vec3 position;
position: Vec<f32>,
//js_position: Float32Array,
//cap: usize,
//ptr: usize,
//#[cfg(feature = "webgl1")]
// layout (location = 1) in vec3 uv_start;
uv_start: Vec<f32>,
@@ -235,7 +238,6 @@ pub struct HiPS2D {
vao: VertexArrayObject,
gl: WebGlContext,
moc: Option<SpaceMoc>,
// A buffer storing the cells in the view
@@ -304,6 +306,7 @@ impl HiPS2D {
let gl = gl.clone();
let moc = None;
let hpx_cells_in_view = vec![];
// request the allsky texture
Ok(Self {
// The image survey texture buffer
@@ -494,6 +497,7 @@ impl HiPS2D {
}
fn recompute_vertices(&mut self, camera: &mut CameraViewPort, projection: &ProjectionType) {
//al_core::log(&format!("num position: {:?}", self.position.len()));
self.position.clear();
self.uv_start.clear();
self.uv_end.clear();

View File

@@ -4,11 +4,16 @@ pub mod texture;
use crate::browser_support::BrowserFeaturesSupport;
use crate::healpix::moc::FreqSpaceMoc;
use crate::math::angle::ToAngle;
use crate::math::lonlat;
use crate::math::lonlat::LonLatT;
use crate::math::spectra::SpectralUnit;
use crate::math::spectra::FREQ_MAX;
use crate::math::spectra::FREQ_MIN;
use crate::coosys;
use crate::CooSystem;
use crate::tile_fetcher::TileFetcherQueue;
use al_api::hips::DataproductType;
use al_api::hips::ImageExt;
@@ -304,6 +309,19 @@ impl Cursor {
fn get_freq(&self) -> Freq {
self.freq
}
fn get_freq_window(&self) -> [Freq; 2] {
let FrequencyWindow {
window_pixel_hash: f_hash_val,
pixel_depth,
..
} = self.get_window_frequency_range();
let f0 = Freq::from_hash_with_order(f_hash_val.start, pixel_depth);
let f1 = Freq::from_hash_with_order(f_hash_val.end, pixel_depth);
[f0, f1]
}
}
use super::HpxTileBuffer;
@@ -400,9 +418,6 @@ impl HiPS3D {
camera: &CameraViewPort,
browser_features_support: &BrowserFeaturesSupport,
) {
// update the cursor center before downloading new tiles
self.set_cursor_location(camera.get_center().into(), camera);
// do not add tiles if the view is already at depth 0
let cfg = self.get_config();
let depth_tile = camera
@@ -589,7 +604,7 @@ impl HiPS3D {
let mut start = window_pixel_hash.start.max(domain_pixel_hash.start);
let mut end = window_pixel_hash.end.min(domain_pixel_hash.end);
if start < end {
if start <= end {
start = start - pixel_hash_0 - indices.start;
end = end - pixel_hash_0 - indices.start;
@@ -657,7 +672,15 @@ impl HiPS3D {
crate::event::send_custom_event("spectra", JsValue::from(spectra_js_obj));
}
pub fn set_cursor_location(&mut self, lonlat: LonLatT<f64>, camera: &CameraViewPort) {
pub fn set_cursor_location(&mut self, camera: &CameraViewPort) {
let (lon, lat) = lonlat::xyz_to_radec(&coosys::apply_coo_system(
camera.get_coo_system(),
CooSystem::ICRS,
camera.get_center(),
));
let lonlat = LonLatT(lon, lat);
let cfg = self.get_config();
let s_order = camera
.get_tile_depth()
@@ -714,6 +737,10 @@ impl HiPS3D {
self.cursor.get_freq()
}
pub fn get_freq_window(&self) -> [Freq; 2] {
self.cursor.get_freq_window()
}
fn recompute_vertices(&mut self, camera: &CameraViewPort, proj: &ProjectionType) {
self.cells.clear();
@@ -915,6 +942,9 @@ impl HiPS3D {
idx + off_indices,
idx + 3 + off_indices,
]);
idx += 4;
// GL LINES
/*self.idx_vertices.extend([
idx + off_indices,
@@ -929,8 +959,6 @@ impl HiPS3D {
idx + 3 + off_indices,
idx + off_indices,
]);*/
idx += 4;
}
off_indices += pos.len() as u16;
@@ -946,23 +974,21 @@ impl HiPS3D {
}
}
{
let mut vao = self.vao.bind_for_update();
vao.update_array(
"position",
WebGl2RenderingContext::DYNAMIC_DRAW,
VecData(&self.position),
)
.update_array(
"uv",
WebGl2RenderingContext::DYNAMIC_DRAW,
VecData(&self.uv),
)
.update_element_array(
WebGl2RenderingContext::DYNAMIC_DRAW,
VecData(&self.idx_vertices),
);
}
let mut vao = self.vao.bind_for_update();
vao.update_array(
"position",
WebGl2RenderingContext::DYNAMIC_DRAW,
VecData(&self.position),
)
.update_array(
"uv",
WebGl2RenderingContext::DYNAMIC_DRAW,
VecData(&self.uv),
)
.update_element_array(
WebGl2RenderingContext::DYNAMIC_DRAW,
VecData(&self.idx_vertices),
);
}
fn reset_available_tiles(&mut self) -> bool {

View File

@@ -11,6 +11,7 @@ use al_core::texture::Texture3D;
use al_core::webgl_ctx::WebGlRenderingCtx;
use cgmath::Vector3;
use fitsrs::hdu::header::Bitpix;
use std::borrow::Cow;
use std::cmp::Ordering;
use std::ops::Range;
use wasm_bindgen::JsValue;
@@ -283,37 +284,45 @@ impl HpxFreqTex {
) -> Result<(), JsValue> {
let raw_bytes = raw_bytes.to_vec().into_boxed_slice();
let (trim1, trim2, trim3, width, height, depth, bitpix, data_byte_offset, bscale, bzero) = {
let fits = FitsImage::from_raw_bytes(&raw_bytes[..])?;
fits[0].insert_into_3d_texture(&self.texture, &Vector3::<i32>::new(0, 0, 0))?;
self.data = {
let image = FitsImage::from_raw_bytes(&raw_bytes[..])?.pop().unwrap();
image.insert_into_3d_texture(&self.texture, &Vector3::<i32>::new(0, 0, 0))?;
(
fits[0].trim1,
fits[0].trim2,
fits[0].trim3,
fits[0].width,
fits[0].height,
fits[0].depth,
fits[0].bitpix,
fits[0].data_byte_offset.clone(),
fits[0].bscale,
fits[0].bzero,
)
let bitpix = image.bitpix;
let trim = (image.trim1, image.trim2, image.trim3);
let naxis = (image.width, image.height, image.depth);
let bscale = image.bscale;
let bzero = image.bzero;
if let Cow::Owned(uncompressed_bytes) = image.raw_bytes {
Some(HpxFreqData::Fits {
data_byte_offset: 0..uncompressed_bytes.len(),
raw_bytes: uncompressed_bytes.into_boxed_slice(),
bitpix,
trim,
naxis,
bscale,
bzero,
size,
})
} else {
let data_byte_offset = image.data_byte_offset.clone();
std::mem::drop(image);
Some(HpxFreqData::Fits {
raw_bytes,
data_byte_offset,
bitpix,
trim,
naxis,
bscale,
bzero,
size,
})
}
};
let trim = (trim1, trim2, trim3);
let naxis = (width, height, depth);
self.data = Some(HpxFreqData::Fits {
raw_bytes,
data_byte_offset: data_byte_offset.clone(),
bitpix,
trim,
naxis,
bscale,
bzero,
size,
});
self.num_stored_slices = self.num_slices;
self.start_time = Some(Time::now());
@@ -368,7 +377,7 @@ impl HpxFreqTex {
// size of the cube
size: (u32, u32, u32),
) -> Result<(), JsValue> {
let cubic_tile = ImageBuffer::<R16I>::new(decoded_bytes, size.0, size.1, size.2);
let cubic_tile = ImageBuffer::<R8U>::new(decoded_bytes, size.0, size.1, size.2);
cubic_tile.insert_into_3d_texture(&self.texture, &Vector3::<i32>::new(0, 0, 0))?;

View File

@@ -19,17 +19,6 @@ use wasm_bindgen::JsValue;
mod subdivide;
/*
pub(crate) trait HpxTile {
// Getter
// Returns the current time if the texture is not full
fn start_time(&self) -> Time;
fn time_request(&self) -> Time;
fn cell(&self) -> &HEALPixCell;
}*/
pub(crate) trait HpxTileBuffer {
type T;
type C;

View File

@@ -98,7 +98,7 @@ fn get_coord_uv_it(
)
.chain(std::iter::once((
xmax,
if xmax % max_tex_size == 0 {
if xmax.is_multiple_of(max_tex_size) {
1.0
} else {
get_uv_in_tex_chunk(xmax)
@@ -129,7 +129,7 @@ fn get_coord_uv_it(
})
.chain(std::iter::once((
xmax,
if xmax % max_tex_size == 0 {
if xmax.is_multiple_of(max_tex_size) {
1.0
} else {
get_uv_in_tex_chunk(xmax)
@@ -199,7 +199,9 @@ pub fn vertices(
};
x_it.clone().map(move |(x, uvx)| {
let ndc = if let Some(xyz) = wcs.unproj_xyz(&ImgXY::new(x as f64, y as f64)) {
let ndc = if let Some(xyz) =
wcs.unproj_xyz(&ImgXY::new(x as f64 + 0.5, y as f64 + 0.5))
{
let xyz = crate::coosys::apply_coo_system(
CooSystem::ICRS,
camera.get_coo_system(),

View File

@@ -162,7 +162,10 @@ impl Image {
// Compute the fov
let center = wcs
.unproj_lonlat(&ImgXY::new(width as f64 / 2.0, height as f64 / 2.0))
.unproj_lonlat(&ImgXY::new(
(width as f64 / 2.0) + 0.5,
(height as f64 / 2.0) + 0.5,
))
.ok_or(JsValue::from_str("(w / 2, h / 2) px cannot be unprojected"))?;
let center_xyz = center.to_xyz();
let inside = crate::coosys::apply_coo_system(
@@ -172,13 +175,13 @@ impl Image {
);
let vertices = [
wcs.unproj_lonlat(&ImgXY::new(0.0, 0.0))
wcs.unproj_lonlat(&ImgXY::new(0.5, 0.5))
.ok_or(JsValue::from_str("(0, 0) does not lie in the sky"))?,
wcs.unproj_lonlat(&ImgXY::new(width as f64 - 1.0, 0.0))
wcs.unproj_lonlat(&ImgXY::new(width as f64 - 0.5, 0.5))
.ok_or(JsValue::from_str("(w - 1, 0) does not lie in the sky"))?,
wcs.unproj_lonlat(&ImgXY::new(width as f64 - 1.0, height as f64 - 1.0))
wcs.unproj_lonlat(&ImgXY::new(width as f64 - 0.5, height as f64 - 0.5))
.ok_or(JsValue::from_str("(w - 1, h - 1) does not lie in the sky"))?,
wcs.unproj_lonlat(&ImgXY::new(0.0, height as f64 - 1.0))
wcs.unproj_lonlat(&ImgXY::new(0.5, height as f64 - 0.5))
.ok_or(JsValue::from_str("(0, h - 1) does not lie in the sky"))?,
]
.iter()
@@ -669,7 +672,10 @@ impl Image {
// let's redefine the region
let center = self
.wcs
.unproj_lonlat(&ImgXY::new(width as f64 / 2.0, height as f64 / 2.0))
.unproj_lonlat(&ImgXY::new(
(width as f64 / 2.0) + 0.5,
(height as f64 / 2.0) + 0.5,
))
.ok_or(JsValue::from_str("(w / 2, h / 2) px cannot be unprojected"))?;
let center_xyz = center.to_xyz();
let inside = crate::coosys::apply_coo_system(
@@ -680,16 +686,16 @@ impl Image {
let vertices = [
self.wcs
.unproj_lonlat(&ImgXY::new(0.0, 0.0))
.unproj_lonlat(&ImgXY::new(0.5, 0.5))
.ok_or(JsValue::from_str("(0, 0) does not lie in the sky"))?,
self.wcs
.unproj_lonlat(&ImgXY::new(width as f64 - 1.0, 0.0))
.unproj_lonlat(&ImgXY::new(width as f64 - 0.5, 0.5))
.ok_or(JsValue::from_str("(w - 1, 0) does not lie in the sky"))?,
self.wcs
.unproj_lonlat(&ImgXY::new(width as f64 - 1.0, height as f64 - 1.0))
.unproj_lonlat(&ImgXY::new(width as f64 - 0.5, height as f64 - 0.5))
.ok_or(JsValue::from_str("(w - 1, h - 1) does not lie in the sky"))?,
self.wcs
.unproj_lonlat(&ImgXY::new(0.0, height as f64 - 1.0))
.unproj_lonlat(&ImgXY::new(0.5, height as f64 - 0.5))
.ok_or(JsValue::from_str("(0, h - 1) does not lie in the sky"))?,
]
.iter()

View File

@@ -88,7 +88,7 @@ where
pixels_written += num_pixels_to_read;
if F::PIXEL_TYPE.num_channels() == 1 && y % step_cut == 0 {
if F::PIXEL_TYPE.num_channels() == 1 && y.is_multiple_of(step_cut) {
// on a good line
let bytes_line = &buf[id_tx][off_bytes_dst..(off_bytes_dst + num_bytes_to_read)];
for x_in_patch in (0..w_patch).step_by(step_cut) {
@@ -153,7 +153,7 @@ where
}
}
if (((dy + 1) % (max_tex_size as usize) == 0) && id_tx == buf.len() - 1)
if ((dy + 1).is_multiple_of(max_tex_size as usize) && id_tx == buf.len() - 1)
|| pixels_written >= num_pixels
{
// we can create new textures of size max_tex_size

View File

@@ -351,29 +351,6 @@ impl Layers {
}
}
pub fn rename_layer(&mut self, layer: &str, new_layer: &str) -> Result<(), JsValue> {
let err_layer_not_found =
JsValue::from_str(&format!("Layer {layer:?} not found, so cannot be removed."));
// layer from layers does also need to be removed
let id_layer = self
.layers
.iter()
.position(|l| layer == l)
.ok_or(err_layer_not_found.clone())?;
self.layers[id_layer] = new_layer.to_string();
let meta = self.meta.remove(layer).ok_or(err_layer_not_found.clone())?;
let id = self.ids.remove(layer).ok_or(err_layer_not_found)?;
// Add the new
self.meta.insert(new_layer.to_string(), meta);
self.ids.insert(new_layer.to_string(), id);
Ok(())
}
pub fn swap_layers(&mut self, first_layer: &str, second_layer: &str) -> Result<(), JsValue> {
let id_first_layer =
self.layers
@@ -454,7 +431,11 @@ impl Layers {
// HiPS cube
DataproductType::Cube => HiPS::D3(HiPS3D::new(cfg, gl, &layer)?),
// HiPS 3D
DataproductType::SpectralCube => HiPS::D3(HiPS3D::new(cfg, gl, &layer)?),
DataproductType::SpectralCube => {
let mut hips = HiPS3D::new(cfg, gl, &layer)?;
hips.set_cursor_location(camera);
HiPS::D3(hips)
}
// Typical HiPS image
_ => HiPS::D2(HiPS2D::new(cfg, gl)?),
};

View File

@@ -28,4 +28,16 @@ where
pub fn is_ccw(&self) -> bool {
crate::math::utils::ccw_tri(self.v1, self.v2, self.v3)
}
pub fn is_elongated(&self) -> bool {
let mag2_12 = (self.v1[0] - self.v2[0]) * (self.v1[0] - self.v2[0])
+ (self.v1[1] - self.v2[1]) * (self.v1[1] - self.v2[1]);
let mag2_13 = (self.v1[0] - self.v3[0]) * (self.v1[0] - self.v3[0])
+ (self.v1[1] - self.v3[1]) * (self.v1[1] - self.v3[1]);
let mag2_23 = (self.v2[0] - self.v3[0]) * (self.v2[0] - self.v3[0])
+ (self.v2[1] - self.v3[1]) * (self.v2[1] - self.v3[1]);
let l = S::from(0.2).unwrap();
mag2_12 >= l || mag2_23 >= l || mag2_13 >= l
}
}

246
src/core/src/shaders.rs Normal file
View File

@@ -0,0 +1,246 @@
use std::collections::HashMap;
#[allow(dead_code)]
pub fn get_all() -> HashMap<&'static str, &'static str> {
let mut out = HashMap::new();
out.insert(
r"hips_raytracer_f32.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;precision mediump int;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity;uniform sampler2DArray tex;struct TileColor{Tile tile;vec4 color;bool found;};uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float f){f=t(f);return f*f;}float v(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}highp float s(highp vec4 v){highp float f=2.*mod(v[0],128.)+step(128.,v[1])-127.;return abs(f+127.)<.001?0.:(1.-step(128.,v[0])*2.)*exp2(f)*((mod(v[1],128.)*65536.+v[2]*256.+v[3]+float(8388608))*exp2(-23.));}vec4 s(float s){float i=v(s*scale+offset);i=mix(i,1.-i,reversed);vec4 H=mix(texture(colormaps,vec2(i,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(s)||isnan(s)));return f(t(v(vec4(H.xyz+k_brightness,H.w))));}int f(vec2 v){int f=int(v.y<0.);return int(v.x<0.)+f|f<<1;}float s(vec2 v){float f=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-f:f-1.;}float f(vec3 v){float f=dot(v.xy,v.xy);return f<.1?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):1.f-v.z;}float s(vec3 v){float f=dot(v.xy,v.xy);return f<.1f?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):v.z+1.;}int f(int v,int f){v|=f<<2;f=(v^v>>1)&572662306;return v^f^f<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy t(vec3 v){float H=float(1<<0)*.5,t=s(v.xy),e,i;int a=f(v.xy),r=0,u,m;vec2 o=vec2(0);if(v.z>.66666666666){float s=sqrt(3.*f(v));o=vec2(t*s,2.-s);r=a;}else if(v.z<-.66666666666){float f=sqrt(3.*s(v));o=vec2(t*f,f);r=a+8;}else{float f=v.z*1.5;int i=int(t>f),s=int(t>=-f),H=1-s;o=vec2(t-float(i+s-1),f+float(i+H));r=(i+H<<2)+(a+(i&s)&3);}e=H*(o.x+o.y);i=H*(o.y-o.x);u=int(e);m=int(i);return HashDxDy((r<<(0<<1))+f(u,m),e-float(u),i-float(m));}vec3 f(){HashDxDy v=t(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}void main(){vec3 v=f();v.y=1.-v.y;vec4 i=s(s(texture(tex,v).xyzw*255.));out_frag_color=i;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"catalogs_aitoff.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_aitoff(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
);
out.insert(
r"hips_raytracer_i16.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float i(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 i(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 t(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 v(float v){float r=i(v*scale+offset);r=mix(r,1.-r,reversed);vec4 H=mix(texture(colormaps,vec2(r,(colormap_id+.5)/num_colormaps)),vec4(0),float(v==blank));return f(i(t(vec4(H.xyz+k_brightness,H.w))));}vec4 f(vec3 i){float H=float(f(texture(tex,i).xy));return mix(v(H),vec4(0),float(H==-1.));}int i(vec2 v){int H=int(v.y<0.);return int(v.x<0.)+H|H<<1;}float t(vec2 v){float H=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-H:H-1.;}float i(vec3 v){float H=dot(v.xy,v.xy);return H<.1?H*(.5+H*(.125+H*(.0625+H*(.0390625+H*.02734375)))):1.f-v.z;}float t(vec3 v){float H=dot(v.xy,v.xy);return H<.1f?H*(.5+H*(.125+H*(.0625+H*(.0390625+H*.02734375)))):v.z+1.;}int f(int v,int H){v|=H<<2;H=(v^v>>1)&572662306;return v^H^H<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy v(vec3 v){float H=float(1<<0)*.5,r=t(v.xy),e,a;int c=i(v.xy),u=0,s,x;vec2 m=vec2(0);if(v.z>.66666666666){float H=sqrt(3.*i(v));m=vec2(r*H,2.-H);u=c;}else if(v.z<-.66666666666){float H=sqrt(3.*t(v));m=vec2(r*H,H);u=c+8;}else{float H=v.z*1.5;int f=int(r>H),x=int(r>=-H),a=1-x;m=vec2(r-float(f+x-1),H+float(f+a));u=(f+a<<2)+(c+(f&x)&3);}e=H*(m.x+m.y);a=H*(m.y-m.x);s=int(e);x=int(a);return HashDxDy((u<<(0<<1))+f(s,x),e-float(s),a-float(x));}vec3 f(){HashDxDy H=v(normalize(frag_pos).zxy);return vec3(vec2(H.dy,H.dx),float(textures_tiles[H.idx].texture_idx));}void main(){vec3 v=f();v.y=1.-v.y;vec4 H=f(v);out_frag_color=H;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips_raytracer_backcolor.frag",
r#"#version 300 es
precision lowp float;precision mediump int;out vec4 out_frag_color;uniform vec3 color;void main(){out_frag_color=vec4(color,1);}"#,
);
out.insert(
r"image_base.vert",
r#"#version 300 es
precision highp float;layout(location=0)in vec2 ndc_pos;layout(location=1)in vec2 uv;out vec2 frag_uv;void main(){gl_Position=vec4(ndc_pos,0,1);frag_uv=uv;}"#,
);
out.insert(
r"hips_rasterizer_rgba.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float t(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 t(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}vec4 f(vec3 a){vec4 r=texture(tex,a).xyzw;r.x=t(r.x);r.y=t(r.y);r.z=t(r.z);r.xyz=mix(r.xyz,1.-r.xyz,reversed);return f(t(v(vec4(r.xyz+k_brightness,r.w))));}void main(){out_frag_color=mix(f(frag_uv_start),f(frag_uv_end),frag_blending_factor);out_frag_color.w=opacity*out_frag_color.w;}"#,
);
out.insert(
r"hips3d_i32.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler3D;precision lowp isampler3D;precision lowp usampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int c(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 c(float w){float s=v(w*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(w==blank));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}vec4 c(vec3 v){float f=float(c(texture(tex,v).xyzw));return mix(c(f),vec4(0),float(f==-1.));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 f=c(v);out_frag_color=f;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"line_base.frag",
r#"#version 300 es
precision highp float;out vec4 color;in vec2 l;uniform vec4 u_color;uniform float u_thickness,u_width,u_height;void main(){if(l.x>.05)discard;else{color=u_color;float u=(u_thickness+2.)*.5;color.w=color.w*(1.-smoothstep(u-1.,u,abs((u_thickness+2.)*l.y)));}}"#,
);
out.insert(
r"hips3d_i16.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler3D;precision lowp isampler3D;precision lowp usampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 c(float H){float s=v(H*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}vec4 c(vec3 v){float H=float(f(texture(tex,v).xy));return mix(c(H),vec4(0),float(H==-1.));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 f=c(v);out_frag_color=f;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"line_base.vert",
r#"#version 300 es
precision highp float;layout(location=0)in vec2 ndc_pos;out float l;void main(){gl_Position=vec4(ndc_pos,0,1);}"#,
);
out.insert(
r"catalogs_catalog.frag",
r#"#version 300 es
precision lowp float;in vec2 out_uv;in vec3 out_p;out vec4 color;uniform sampler2D kernel_texture;uniform float max_density,fov,strength;void main(){color=texture(kernel_texture,out_uv)/max(log2(fov*1e2),1.);color.x*=strength;}"#,
);
out.insert(
r"fits_i32.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2D;precision mediump int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float v(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int c(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 c(float H){float s=v(H*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}void main(){out_frag_color=c(float(c(texture(tex,frag_uv).xyzw)));out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips_raytracer_rgba.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec2 out_clip_pos;in vec3 frag_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float v(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float t(float f){f=v(f);return f*f;}float f(float f){return H==0?v(f):H==1?sqrt(v(f)):H==2?log(1e3*v(f)+1.)/log(1e3):H==3?asinh(10.*v(f))/3.:t(f);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 t(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}vec4 f(vec3 i){vec4 r=texture(tex,i).xyzw;r.x=f(r.x);r.y=f(r.y);r.z=f(r.z);r.xyz=mix(r.xyz,1.-r.xyz,reversed);return f(t(v(vec4(r.xyz+k_brightness,r.w))));}int f(vec2 f){int v=int(f.y<0.);return int(f.x<0.)+v|v<<1;}float t(vec2 f){float v=atan(abs(f.y),abs(f.x))*1.27323954474;return f.x<0.!=f.y<0.?1.-v:v-1.;}float t(vec3 f){float v=dot(f.xy,f.xy);return v<.1?v*(.5+v*(.125+v*(.0625+v*(.0390625+v*.02734375)))):1.f-f.z;}float v(vec3 f){float v=dot(f.xy,f.xy);return v<.1f?v*(.5+v*(.125+v*(.0625+v*(.0390625+v*.02734375)))):f.z+1.;}int f(int f,int v){f|=v<<2;v=(f^f>>1)&572662306;return f^v^v<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy i(vec3 i){float H=float(1<<0)*.5,r=t(i.xy),e,a;int n=f(i.xy),u=0,x,o;vec2 s=vec2(0);if(i.z>.66666666666){float f=sqrt(3.*t(i));s=vec2(r*f,2.-f);u=n;}else if(i.z<-.66666666666){float f=sqrt(3.*v(i));s=vec2(r*f,f);u=n+8;}else{float f=i.z*1.5;int v=int(r>f),x=int(r>=-f),a=1-x;s=vec2(r-float(v+x-1),f+float(v+a));u=(v+a<<2)+(n+(v&x)&3);}e=H*(s.x+s.y);a=H*(s.y-s.x);x=int(e);o=int(a);return HashDxDy((u<<(0<<1))+f(x,o),e-float(x),a-float(o));}vec3 f(){HashDxDy f=i(normalize(frag_pos).zxy);return vec3(vec2(f.dy,f.dx),float(textures_tiles[f.idx].texture_idx));}uniform float opacity;uniform vec4 no_tile_color;void main(){vec3 v=f();vec4 r=f(v);out_frag_color=r;out_frag_color=vec4(r.xyz,opacity*r.w);}"#,
);
out.insert(
r"hips_rasterizer_rgba2cmap.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float t(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 t(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}vec4 f(vec3 a){vec4 m=texture(colormaps,vec2(t(texture(tex,a).x),(colormap_id+.5)/num_colormaps));m.xyz=mix(m.xyz,1.-m.xyz,reversed);return f(t(v(vec4(m.xyz+k_brightness,m.w))));}void main(){out_frag_color=mix(f(frag_uv_start),f(frag_uv_end),frag_blending_factor);out_frag_color.w=opacity*out_frag_color.w;}"#,
);
out.insert(
r"hips3d_red.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler3D;precision lowp isampler3D;precision lowp usampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float v(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float f){f=v(f);return f*f;}float t(float c){return H==0?v(c):H==1?sqrt(v(c)):H==2?log(1e3*v(c)+1.)/log(1e3):H==3?asinh(10.*v(c))/3.:f(c);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 f(){vec2 c=texture(tex,vec3(frag_uv)).xy;c.x=t(c.x);c.x=mix(c.x,1.-c.x,reversed);vec3 s=texture(colormaps,vec2(c.x,(colormap_id+.5)/num_colormaps)).xyz;return f(t(v(vec4(vec4(s,c.y).xyz+k_brightness,vec4(s,c.y).w))));}void main(){out_frag_color=f();out_frag_color.w=opacity*out_frag_color.w;}"#,
);
out.insert(
r"hips_raytracer_raytracer.vert",
r#"#version 300 es
precision lowp float;precision mediump int;layout(location=0)in vec2 pos_clip_space;layout(location=1)in vec3 pos_world_space;out vec2 out_clip_pos;out vec3 frag_pos;uniform vec2 ndc_to_clip;uniform float czf;uniform mat3 model;void main(){frag_pos=model*pos_world_space;gl_Position=vec4(pos_clip_space/(ndc_to_clip*czf),0,1);out_clip_pos=pos_clip_space;}"#,
);
out.insert(
r"catalogs_mercator.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_mercator(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
);
out.insert(
r"hips_rasterizer_u8.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 s(float s){float u=v(s*scale+offset);u=mix(u,1.-u,reversed);vec4 H=mix(texture(colormaps,vec2(u,(colormap_id+.5)/num_colormaps)),vec4(0),float(s==blank));return f(t(v(vec4(H.xyz+k_brightness,H.w))));}vec4 f(vec3 v){return s(float(uint(texture(tex,v).x*255.+.5)));}uniform float opacity;void main(){vec3 v=frag_uv_start,H=frag_uv_end;v.y=1.-v.y;H.y=1.-H.y;vec4 s=f(v),u=f(H);out_frag_color=mix(s,u,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips_raytracer_i32.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;precision lowp usampler2DArray;precision lowp isampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity;int t(vec2 v){int i=int(v.y<0.);return int(v.x<0.)+i|i<<1;}float i(vec2 v){float f=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-f:f-1.;}float i(vec3 v){float i=dot(v.xy,v.xy);return i<.1?i*(.5+i*(.125+i*(.0625+i*(.0390625+i*.02734375)))):1.f-v.z;}float t(vec3 v){float i=dot(v.xy,v.xy);return i<.1f?i*(.5+i*(.125+i*(.0625+i*(.0390625+i*.02734375)))):v.z+1.;}int i(int v,int i){v|=i<<2;i=(v^v>>1)&572662306;return v^i^i<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy f(vec3 v){float f=float(1<<0)*.5,H=i(v.xy),e,r;int c=t(v.xy),o=0,u,s;vec2 m=vec2(0);if(v.z>.66666666666){float f=sqrt(3.*i(v));m=vec2(H*f,2.-f);o=c;}else if(v.z<-.66666666666){float f=sqrt(3.*t(v));m=vec2(H*f,f);o=c+8;}else{float f=v.z*1.5;int i=int(H>f),e=int(H>=-f),s=1-e;m=vec2(H-float(i+e-1),f+float(i+s));o=(i+s<<2)+(c+(i&e)&3);}e=f*(m.x+m.y);r=f*(m.y-m.x);u=int(e);s=int(r);return HashDxDy((o<<(0<<1))+i(u,s),e-float(u),r-float(s));}vec3 f(){HashDxDy v=f(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float i(float v){v=f(v);return v*v;}float t(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:i(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 i(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 t(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int v(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 v(float v){float m=t(v*scale+offset);m=mix(m,1.-m,reversed);vec4 H=mix(texture(colormaps,vec2(m,(colormap_id+.5)/num_colormaps)),vec4(0),float(v==blank));return f(i(t(vec4(H.xyz+k_brightness,H.w))));}vec4 v(vec3 f){float i=float(v(texture(tex,f).xyzw));return mix(v(i),vec4(0),float(i==-1.));}void main(){vec3 i=f();i.y=1.-i.y;vec4 H=v(i);out_frag_color=H;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"catalogs_ortho.frag",
r#"#version 300 es
precision lowp float;in vec2 out_uv;in vec3 out_p;out vec4 color;uniform sampler2D kernel_texture;uniform float max_density,fov,strength;void main(){if(out_p.z<0.f)discard;color=texture(kernel_texture,out_uv)/max(log2(fov*1e2),1.);color.x*=strength;}"#,
);
out.insert(
r"catalogs_healpix.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_healpix(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
);
out.insert(
r"colormaps_colormap.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2D;in vec2 out_uv;out vec4 color;uniform sampler2D texture_fbo;uniform float alpha;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;void main(){float s=texture(texture_fbo,out_uv).x;color=texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps));color.w=smoothstep(0.,.1,s)*alpha;}"#,
);
out.insert(
r"catalogs_arc.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_arc(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
);
out.insert(
r"fits_u8.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2D;precision mediump int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 m(float H){float m=v(H*scale+offset);m=mix(m,1.-m,reversed);vec4 k=mix(texture(colormaps,vec2(m,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}void main(){out_frag_color=m(float(uint(texture(tex,frag_uv).x*255.+.5)));out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"fits_i16.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2D;precision mediump int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 m(float H){float m=v(H*scale+offset);m=mix(m,1.-m,reversed);vec4 k=mix(texture(colormaps,vec2(m,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}void main(){out_frag_color=m(float(f(texture(tex,frag_uv).xy)));out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips3d_f32.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float s(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 s(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}highp float t(highp vec4 v){highp float t=2.*mod(v[0],128.)+step(128.,v[1])-127.;return abs(t+127.)<.001?0.:(1.-step(128.,v[0])*2.)*exp2(t)*((mod(v[1],128.)*65536.+v[2]*256.+v[3]+float(8388608))*exp2(-23.));}vec4 t(float t){float H=s(t*scale+offset);H=mix(H,1.-H,reversed);vec4 m=mix(texture(colormaps,vec2(H,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(t)||isnan(t)));return f(s(v(vec4(m.xyz+k_brightness,m.w))));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 f=t(t(texture(tex,v).xyzw*255.));out_frag_color=f;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips_rasterizer_f32.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float s(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 f){return vec4(pow(f.x,k_gamma),pow(f.y,k_gamma),pow(f.z,k_gamma),f.w);}vec4 s(vec4 f){return vec4(mix(vec3(dot(f.xyz,vec3(.2126,.7152,.0722))),f.xyz,1.+k_saturation),f.w);}vec4 v(vec4 f){return vec4(.5+(1.+k_contrast)*(f.xyz-.5),f.w);}highp float t(highp vec4 f){highp float t=2.*mod(f[0],128.)+step(128.,f[1])-127.;return abs(t+127.)<.001?0.:(1.-step(128.,f[0])*2.)*exp2(t)*((mod(f[1],128.)*65536.+f[2]*256.+f[3]+float(8388608))*exp2(-23.));}vec4 t(float t){float H=s(t*scale+offset);H=mix(H,1.-H,reversed);vec4 m=mix(texture(colormaps,vec2(H,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(t)||isnan(t)));return f(s(v(vec4(m.xyz+k_brightness,m.w))));}vec4 f(vec3 f){return t(t(texture(tex,f).xyzw*255.));}uniform float opacity;void main(){vec3 t=frag_uv_start,v=frag_uv_end;t.y=1.-t.y;v.y=1.-v.y;vec4 H=f(t),m=f(v);out_frag_color=mix(H,m,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips_raytracer_u8.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;precision lowp usampler2DArray;precision lowp isampler2DArray;precision mediump int;uniform sampler2DArray tex;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float i(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 i(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 t(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 v(float v){float r=i(v*scale+offset);r=mix(r,1.-r,reversed);vec4 H=mix(texture(colormaps,vec2(r,(colormap_id+.5)/num_colormaps)),vec4(0),float(v==blank));return f(i(t(vec4(H.xyz+k_brightness,H.w))));}int f(vec2 v){int H=int(v.y<0.);return int(v.x<0.)+H|H<<1;}float i(vec2 v){float H=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-H:H-1.;}float f(vec3 v){float H=dot(v.xy,v.xy);return H<.1?H*(.5+H*(.125+H*(.0625+H*(.0390625+H*.02734375)))):1.f-v.z;}float i(vec3 v){float H=dot(v.xy,v.xy);return H<.1f?H*(.5+H*(.125+H*(.0625+H*(.0390625+H*.02734375)))):v.z+1.;}int f(int v,int H){v|=H<<2;H=(v^v>>1)&572662306;return v^H^H<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy t(vec3 v){float H=float(1<<0)*.5,r=i(v.xy),t,e;int c=f(v.xy),o=0,u,s;vec2 m=vec2(0);if(v.z>.66666666666){float H=sqrt(3.*f(v));m=vec2(r*H,2.-H);o=c;}else if(v.z<-.66666666666){float H=sqrt(3.*i(v));m=vec2(r*H,H);o=c+8;}else{float H=v.z*1.5;int f=int(r>H),e=int(r>=-H),s=1-e;m=vec2(r-float(f+e-1),H+float(f+s));o=(f+s<<2)+(c+(f&e)&3);}t=H*(m.x+m.y);e=H*(m.y-m.x);u=int(t);s=int(e);return HashDxDy((o<<(0<<1))+f(u,s),t-float(u),e-float(s));}vec3 f(){HashDxDy v=t(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}void main(){vec3 H=f();H.y=1.-H.y;vec4 i=v(float(uint(texture(tex,H).x*255.+.5)));out_frag_color=i;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"passes_post_fragment_100es.frag",
r#"#version 300 es
precision mediump float;in vec2 v_tc;out vec4 color;uniform sampler2D fbo_tex;void main(){color=texture(fbo_tex,v_tc);}"#,
);
out.insert(
r"colormaps_colormap.vert",
r#"#version 300 es
precision lowp float;precision lowp sampler2D;layout(location=0)in vec2 position;layout(location=1)in vec2 uv;out vec2 out_uv;void main(){gl_Position=vec4(position,0,1);out_uv=uv;}"#,
);
out.insert(
r"image_sampler.frag",
r#"#version 300 es
precision highp float;precision highp sampler2D;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity;void main(){out_frag_color=texture(tex,frag_uv);out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"fits_base.vert",
r#"#version 300 es
precision highp float;precision highp int;layout(location=0)in vec2 ndc_pos;layout(location=1)in vec2 uv;out vec2 frag_uv;void main(){gl_Position=vec4(ndc_pos,0,1);frag_uv=uv;}"#,
);
out.insert(
r"passes_post_vertex_100es.vert",
r#"#version 300 es
precision mediump float;layout(location=0)in vec2 a_pos;out vec2 v_tc;void main(){gl_Position=vec4(a_pos*2.-1.,0,1);v_tc=a_pos;}"#,
);
out.insert(
r"fits_f32.frag",
r#"#version 300 es
precision highp float;precision highp sampler2D;precision highp int;out vec4 out_frag_color;in vec2 frag_uv;uniform sampler2D tex;uniform float opacity,scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float v(float v){v=f(v);return v*v;}float t(float t){return H==0?f(t):H==1?sqrt(f(t)):H==2?log(1e3*f(t)+1.)/log(1e3):H==3?asinh(10.*f(t))/3.:v(t);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}highp float h(highp vec4 v){highp float t=2.*mod(v[0],128.)+step(128.,v[1])-127.;return abs(t+127.)<.001?0.:(1.-step(128.,v[0])*2.)*exp2(t)*((mod(v[1],128.)*65536.+v[2]*256.+v[3]+float(8388608))*exp2(-23.));}vec4 h(float h){float s=t(h*scale+offset);s=mix(s,1.-s,reversed);vec4 H=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(isinf(h)||isnan(h)));return f(t(v(vec4(H.xyz+k_brightness,H.w))));}void main(){out_frag_color=h(h(texture(tex,frag_uv).xyzw*255.));out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips3d_u8.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler3D;uniform sampler3D tex;in vec3 frag_uv;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float v(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 s(float H){float s=v(H*scale+offset);s=mix(s,1.-s,reversed);vec4 k=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(H==blank));return f(t(v(vec4(k.xyz+k_brightness,k.w))));}uniform float opacity;void main(){vec3 v=vec3(frag_uv);v.y=1.-v.y;vec4 f=s(float(uint(texture(tex,v).x*255.+.5)));out_frag_color=f;out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"hips_rasterizer_raster.vert",
r#"#version 300 es
precision highp float;layout(location=0)in vec3 xyz;layout(location=1)in vec3 uv_start;layout(location=2)in vec3 uv_end;layout(location=3)in float time_tile_received;out vec3 frag_uv_start,frag_uv_end;out float frag_blending_factor;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf,current_time;vec2 n(vec3 f){vec2 v=vec2(-f.x,f.y);return f.z>=0.f?v:normalize(v);}vec2 v(vec3 v){float f=length(v.zx),n=sqrt((1.+sqrt(f*(f+v.z)*.5f))*.5f),z=v.y/n,l=0.;if(abs(v.x)<.005){float t=v.x/f;l=-v.x*(1.-t*t/21.)/n;}else n=sqrt((f*f-f*v.z)*2.)/n,l=sign(-v.x)*n;return vec2(l*.5,z)/1.4142135623731;}float n(float v){float f=acos(-1.)*v,z=2.*asin(v);v=z+sin(z)-f;int n=0;for(;abs(v)>125e-10&&n<100;n+=1)z-=v/(1.+cos(z)),v=z+sin(z)-f;return.5*z;}vec2 s(vec3 v){float f=n(v.y);return vec2(atan(-v.x,v.z)*cos(f)/acos(-1.),sin(f));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}uniform int u_proj;vec2 n(){vec3 f=inv_model*xyz;return u_proj==0?t(f):u_proj==1?vec2(-f.x,f.y)/(acos(-1.)*((1.+f.z)*.5)):u_proj==2?n(f):u_proj==3?vec2(-f.x,f.y)*.5/sqrt(.5+.5*f.z):u_proj==4?v(f):u_proj==5?s(f):vec2(atan(-f.x,f.z),atanh(f.y))/acos(-1.);}void main(){gl_Position=vec4(n()/(ndc_to_clip*czf),0,1);frag_uv_start=uv_start;frag_uv_end=uv_end;frag_blending_factor=min((current_time-time_tile_received)/2e2,1.);}"#,
);
out.insert(
r"hips_rasterizer_i16.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float m(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 m(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 t(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int f(vec2 v){int f=int(v.x*255.+.5)<<8|int(v.y*255.+.5);if(f>=32768)f-=65536;return f;}vec4 v(float v){float s=m(v*scale+offset);s=mix(s,1.-s,reversed);vec4 H=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(v==blank));return f(m(t(vec4(H.xyz+k_brightness,H.w))));}vec4 f(vec3 m){float H=float(f(texture(tex,m).xy));return mix(v(H),vec4(0),float(H==-1.));}uniform float opacity;void main(){vec3 v=frag_uv_start,H=frag_uv_end;v.y=1.-v.y;H.y=1.-H.y;vec4 t=f(v),m=f(H);out_frag_color=mix(t,m,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"catalogs_ortho.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_orthographic(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
);
out.insert(
r"catalogs_tan.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_gnomonic(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
);
out.insert(
r"hips3d_raster.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 lonlat;layout(location=1)in vec3 uv;out vec3 frag_uv;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;vec2 n(vec3 v){vec2 l=vec2(-v.x,v.y);return v.z>=0.f?l:normalize(l);}vec2 s(vec3 v){float l=length(v.zx),j=sqrt((1.+sqrt(l*(l+v.z)*.5f))*.5f),y=v.y/j,a=0.;if(abs(v.x)<.005){float n=v.x/l;a=-v.x*(1.-n*n/21.)/j;}else j=sqrt((l*l-l*v.z)*2.)/j,a=sign(-v.x)*j;return vec2(a*.5,y)/1.4142135623731;}float n(float v){float j=acos(-1.)*v,l=2.*asin(v);v=l+sin(l)-j;int n=0;for(;abs(v)>125e-10&&n<100;n+=1)l-=v/(1.+cos(l)),v=l+sin(l)-j;return.5*l;}vec2 v(vec3 v){float l=n(v.y);return vec2(atan(-v.x,v.z)*cos(l)/acos(-1.),sin(l));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}vec3 n(){float v=cos(lonlat.y);return vec3(v*sin(lonlat.x),sin(lonlat.y),v*cos(lonlat.x));}uniform int u_proj;vec2 l(vec3 l){return u_proj==0?t(l):u_proj==1?vec2(-l.x,l.y)/(acos(-1.)*((1.+l.z)*.5)):u_proj==2?n(l):u_proj==3?vec2(-l.x,l.y)*.5/sqrt(.5+.5*l.z):u_proj==4?s(l):u_proj==5?v(l):vec2(atan(-l.x,l.z),atanh(l.y))/acos(-1.);}void main(){gl_Position=vec4(l((inv_model*n()).xyz)/(ndc_to_clip*czf),0,1);frag_uv=uv;}"#,
);
out.insert(
r"line_inst_lonlat.vert",
r#"#version 300 es
precision highp float;layout(location=0)in vec2 p_a_lonlat;layout(location=1)in vec2 p_b_lonlat;layout(location=2)in vec2 vertex;uniform mat3 u_2world;uniform vec2 ndc_to_clip;uniform float czf,u_width,u_height,u_thickness;out vec2 l;vec2 v(vec3 v){vec2 n=vec2(-v.x,v.y);return v.z>=0.f?n:normalize(n);}vec2 n(vec3 v){float n=length(v.zx),u=sqrt((1.+sqrt(n*(n+v.z)*.5f))*.5f),y=v.y/u,l=0.;if(abs(v.x)<.005){float c=v.x/n;l=-v.x*(1.-c*c/21.)/u;}else u=sqrt((n*n-n*v.z)*2.)/u,l=sign(-v.x)*u;return vec2(l*.5,y)/1.4142135623731;}float n(float v){float n=acos(-1.)*v,u=2.*asin(v);v=u+sin(u)-n;int l=0;for(;abs(v)>125e-10&&l<100;l+=1)u-=v/(1.+cos(u)),v=u+sin(u)-n;return.5*u;}vec2 s(vec3 v){float u=n(v.y);return vec2(atan(-v.x,v.z)*cos(u)/acos(-1.),sin(u));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}vec3 n(vec2 v){float u=cos(v.y);return vec3(u*sin(v.x),sin(v.y),u*cos(v.x));}uniform int u_proj;vec2 e(vec3 u){return u_proj==0?t(u):u_proj==1?vec2(-u.x,u.y)/(acos(-1.)*((1.+u.z)*.5)):u_proj==2?v(u):u_proj==3?vec2(-u.x,u.y)*.5/sqrt(.5+.5*u.z):u_proj==4?n(u):u_proj==5?s(u):vec2(atan(-u.x,u.z),atanh(u.y))/acos(-1.);}void main(){vec2 v=e(u_2world*n(p_a_lonlat)),u=e(u_2world*n(p_b_lonlat)),y=v-u,j=v/(ndc_to_clip*czf);v=u/(ndc_to_clip*czf)-j;gl_Position=vec4(j+v*vertex.x+(u_thickness+2.)*normalize(vec2(-v.y,v))*vertex.y*vec2(1,u_width/u_height)*(2./u_width),0,1);l=vec2(dot(y,y),vertex.y);}"#,
);
out.insert(
r"catalogs_mollweide.vert",
r#"#version 300 es
precision lowp float;layout(location=0)in vec2 offset;layout(location=1)in vec2 uv;layout(location=2)in vec3 center;uniform float current_time;uniform mat3 inv_model;uniform vec2 ndc_to_clip;uniform float czf;uniform vec2 kernel_size;out vec2 out_uv;out vec3 out_p;uniform int u_proj;void main(){vec3 v=inv_model*center;vec2 n=world2clip_mollweide(v);gl_Position=vec4(n/(ndc_to_clip*czf)+offset*kernel_size,0,1);out_uv=uv;out_p=v;}"#,
);
out.insert(
r"hips_raytracer_backcolor.vert",
r#"#version 300 es
precision lowp float;precision mediump int;layout(location=0)in vec2 pos_clip_space;uniform vec2 ndc_to_clip;uniform float czf;void main(){gl_Position=vec4(pos_clip_space/(ndc_to_clip*czf),0,1);}"#,
);
out.insert(
r"hips_rasterizer_i32.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;uniform sampler2DArray tex;in vec3 frag_uv_start,frag_uv_end;in float frag_blending_factor;out vec4 out_frag_color;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float f(float f){return clamp((f-min_value)/(max_value-min_value),0.,1.);}float t(float v){v=f(v);return v*v;}float m(float v){return H==0?f(v):H==1?sqrt(f(v)):H==2?log(1e3*f(v)+1.)/log(1e3):H==3?asinh(10.*f(v))/3.:t(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 m(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 t(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}int v(vec4 v){return int(v.x*255.+.5)<<24|int(v.y*255.+.5)<<16|int(v.z*255.+.5)<<8|int(v.w*255.+.5);}vec4 v(float v){float s=m(v*scale+offset);s=mix(s,1.-s,reversed);vec4 H=mix(texture(colormaps,vec2(s,(colormap_id+.5)/num_colormaps)),vec4(0),float(v==blank));return f(m(t(vec4(H.xyz+k_brightness,H.w))));}vec4 f(vec3 f){float H=float(v(texture(tex,f).xyzw));return mix(v(H),vec4(0),float(H==-1.));}uniform float opacity;void main(){vec3 v=frag_uv_start,H=frag_uv_end;v.y=1.-v.y;H.y=1.-H.y;vec4 t=f(v),e=f(H);out_frag_color=mix(t,e,frag_blending_factor);out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"moc_base.frag",
r#"#version 300 es
precision lowp float;out vec4 color;uniform vec4 u_color;void main(){color=u_color;}"#,
);
out.insert(
r"line_inst_ndc.vert",
r#"#version 300 es
precision highp float;layout(location=0)in vec2 p_a;layout(location=1)in vec2 p_b;layout(location=2)in vec2 vertex;out vec2 l;uniform float u_width,u_height,u_thickness;void main(){vec2 v=p_b-p_a;gl_Position=vec4(p_a+v*vertex.x+(u_thickness+2.)*normalize(vec2(-v.y,v))*vertex.y*vec2(1,u_width/u_height)*(2./u_width),0,1);l=vec2(0,vertex.y);}"#,
);
out.insert(
r"hips_raytracer_rgba2cmap.frag",
r#"#version 300 es
precision lowp float;precision lowp sampler2DArray;precision lowp sampler2DArray;precision lowp isampler2DArray;precision mediump int;in vec3 frag_pos;in vec2 out_clip_pos;out vec4 out_frag_color;struct Tile{int uniq;int texture_idx;float start_time;float empty;};uniform Tile textures_tiles[12];uniform float opacity;uniform sampler2DArray tex;uniform float scale,offset,blank,min_value,max_value;uniform int H;uniform float reversed;uniform sampler2D colormaps;uniform float num_colormaps,colormap_id;float t(float v){return clamp((v-min_value)/(max_value-min_value),0.,1.);}float f(float v){v=t(v);return v*v;}float v(float v){return H==0?t(v):H==1?sqrt(t(v)):H==2?log(1e3*t(v)+1.)/log(1e3):H==3?asinh(10.*t(v))/3.:f(v);}uniform float k_gamma,k_saturation,k_contrast,k_brightness,k_exposure;vec4 f(vec4 v){return vec4(pow(v.x,k_gamma),pow(v.y,k_gamma),pow(v.z,k_gamma),v.w);}vec4 t(vec4 v){return vec4(mix(vec3(dot(v.xyz,vec3(.2126,.7152,.0722))),v.xyz,1.+k_saturation),v.w);}vec4 v(vec4 v){return vec4(.5+(1.+k_contrast)*(v.xyz-.5),v.w);}vec4 f(vec3 s){vec4 i=texture(colormaps,vec2(v(texture(tex,s).x),(colormap_id+.5)/num_colormaps));i.xyz=mix(i.xyz,1.-i.xyz,reversed);return f(t(v(vec4(i.xyz+k_brightness,i.w))));}int f(vec2 v){int f=int(v.y<0.);return int(v.x<0.)+f|f<<1;}float t(vec2 v){float f=atan(abs(v.y),abs(v.x))*1.27323954474;return v.x<0.!=v.y<0.?1.-f:f-1.;}float t(vec3 v){float f=dot(v.xy,v.xy);return f<.1?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):1.f-v.z;}float v(vec3 v){float f=dot(v.xy,v.xy);return f<.1f?f*(.5+f*(.125+f*(.0625+f*(.0390625+f*.02734375)))):v.z+1.;}int f(int v,int f){v|=f<<2;f=(v^v>>1)&572662306;return v^f^f<<1;}struct HashDxDy{int idx;float dx;float dy;};uniform sampler2D ang2pixd;HashDxDy i(vec3 i){float H=float(1<<0)*.5,a=t(i.xy),e,r;int s=f(i.xy),u=0,m,x;vec2 o=vec2(0);if(i.z>.66666666666){float v=sqrt(3.*t(i));o=vec2(a*v,2.-v);u=s;}else if(i.z<-.66666666666){float f=sqrt(3.*v(i));o=vec2(a*f,f);u=s+8;}else{float v=i.z*1.5;int f=int(a>v),x=int(a>=-v),e=1-x;o=vec2(a-float(f+x-1),v+float(f+e));u=(f+e<<2)+(s+(f&x)&3);}e=H*(o.x+o.y);r=H*(o.y-o.x);m=int(e);x=int(r);return HashDxDy((u<<(0<<1))+f(m,x),e-float(m),r-float(x));}vec3 f(){HashDxDy v=i(normalize(frag_pos).zxy);return vec3(vec2(v.dy,v.dx),float(textures_tiles[v.idx].texture_idx));}void main(){vec3 v=f();out_frag_color=f(v);out_frag_color.w=out_frag_color.w*opacity;}"#,
);
out.insert(
r"moc_base.vert",
r#"#version 300 es
precision highp float;layout(location=0)in vec2 lonlat;uniform mat3 u_2world;uniform vec2 ndc_to_clip;uniform float czf;vec2 n(vec3 y){vec2 v=vec2(-y.x,y.y);return y.z>=0.f?v:normalize(v);}vec2 s(vec3 v){float a=length(v.zx),j=sqrt((1.+sqrt(a*(a+v.z)*.5f))*.5f),y=v.y/j,l=0.;if(abs(v.x)<.005){float y=v.x/a;l=-v.x*(1.-y*y/21.)/j;}else j=sqrt((a*a-a*v.z)*2.)/j,l=sign(-v.x)*j;return vec2(l*.5,y)/1.4142135623731;}float n(float v){float j=acos(-1.)*v,a=2.*asin(v);v=a+sin(a)-j;int l=0;for(;abs(v)>125e-10&&l<100;l+=1)a-=v/(1.+cos(a)),v=a+sin(a)-j;return.5*a;}vec2 v(vec3 v){float a=n(v.y);return vec2(atan(-v.x,v.z)*cos(a)/acos(-1.),sin(a));}vec2 t(vec3 v){v.z=max(v.z,.01);return vec2(-v.x,v.y)/(v.z*acos(-1.));}vec3 n(){float v=cos(lonlat.y);return vec3(v*sin(lonlat.x),sin(lonlat.y),v*cos(lonlat.x));}uniform int u_proj;vec2 l(vec3 a){return u_proj==0?t(a):u_proj==1?vec2(-a.x,a.y)/(acos(-1.)*((1.+a.z)*.5)):u_proj==2?n(a):u_proj==3?vec2(-a.x,a.y)*.5/sqrt(.5+.5*a.z):u_proj==4?s(a):u_proj==5?v(a):vec2(atan(-a.x,a.z),atanh(a.y))/acos(-1.);}void main(){gl_Position=vec4(l(u_2world*n())/(ndc_to_clip*czf),0,1);}"#,
);
out
}

View File

@@ -69,6 +69,7 @@ impl HiPSLocalFiles {
ImageExt::Jpeg => &self.tiles[1],
ImageExt::Png => &self.tiles[2],
ImageExt::Webp => &self.tiles[3],
ImageExt::FitsFz => todo!(),
};
tiles_per_fmt[d].get(&i)

View File

@@ -50,15 +50,9 @@ pub unsafe fn transmute_boxed_slice<I, O>(s: Box<[I]>) -> Box<[O]> {
Box::from_raw(out_slice_ptr)
}
#[allow(dead_code)]
pub unsafe fn transmute_vec_to_u8<I>(mut s: Vec<I>) -> Vec<u8> {
s.set_len(std::mem::size_of_val(&s[..]));
std::mem::transmute(s)
}
#[allow(dead_code)]
pub unsafe fn transmute_vec<I, O>(mut s: Vec<I>) -> Result<Vec<O>, &'static str> {
if std::mem::size_of::<I>() % std::mem::size_of::<O>() > 0 {
if !std::mem::size_of::<I>().is_multiple_of(std::mem::size_of::<O>()) {
Err("The input type is not a multiple of the output type")
} else {
s.set_len(s.len() * (std::mem::size_of::<I>() / std::mem::size_of::<O>()));

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ vec4 val2c_f32(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x) || isnan(x)));
return apply_tonal(new_color);
}
@@ -32,7 +32,7 @@ vec4 val2c(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank || isnan(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank));
return apply_tonal(new_color);
}

View File

@@ -74,7 +74,7 @@ vec4 val2c_f32(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(isinf(x) || isnan(x)));
return apply_tonal(new_color);
}
@@ -85,7 +85,7 @@ vec4 val2c(float x) {
// apply reversed
alpha = mix(alpha, 1.0 - alpha, reversed);
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank || isnan(x)));
vec4 new_color = mix(colormap_f(alpha), vec4(0.0), float(x == blank));
return apply_tonal(new_color);
}
@@ -96,12 +96,12 @@ vec4 uvw2c_f32(vec3 uv) {
vec4 uvw2c_i32(vec3 uv) {
float val = float(decode_i32(texture(tex, uv).rgba));
return val2c(val);
return mix(val2c(val), vec4(0.0), float(val == -1.0));
}
vec4 uvw2c_i16(vec3 uv) {
float val = float(decode_i16(texture(tex, uv).rg));
return val2c(val);
return mix(val2c(val), vec4(0.0), float(val == -1.0));
}
vec4 uvw2c_u8(vec3 uv) {

View File

@@ -1,23 +1,25 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
* Aladin Lite project
*
@@ -97,13 +99,37 @@ A.aladin = function (divSelector, options) {
divElement = divSelector;
}
let retrieveDefaultMode = () => {
const storedPreference = localStorage.getItem("theme");
const systemPrefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
const theme = storedPreference || (systemPrefersDark ? "dark" : "light");
return theme;
}
let theme;
if (options && options.mode) {
let mode = options.mode.toLowerCase();
if (mode === 'dark' || mode === 'light') {
theme = mode;
} else {
console.warn("Interface mode option not recognized, only `dark` or `light` are possible values.")
theme = retrieveDefaultMode()
}
} else {
theme = retrieveDefaultMode()
}
// Associate the CSS inside the div
var cssStyleSheet = document.createElement('style')
cssStyleSheet.classList.add("aladin-css");
cssStyleSheet.innerHTML = aladinCSS;
divElement.appendChild(cssStyleSheet)
return new Aladin(divElement, options);
let aladin = new Aladin(divElement, options);
aladin._applyTheme(theme)
return aladin;
};
/**
@@ -362,7 +388,7 @@ A.graphicOverlay = function (options) {
* @returns {ProgressiveCat} Returns a new Overlay object representing the graphic overlay.
*
* @example
* let gaia = A.catalogHiPS('http://axel.u-strasbg.fr/HiPSCatService/I/345/gaia2', {onClick: 'showTable', color: 'orange', name: 'Gaia', filter: myFilterFunction});
* let gaia = A.catalogHiPS('http://axel.cds.unistra.fr/HiPSCatService/I/345/gaia2', {onClick: 'showTable', color: 'orange', name: 'Gaia', filter: myFilterFunction});
* aladin.addCatalog(gaia)
*/
A.catalogHiPS = function (url, options) {
@@ -395,7 +421,7 @@ A.coo = function (longitude, latitude, prec) {
*
* @param {Circle[]|Polyline[]|Ellipse[]|Vector[]} shapes - an array of A.polygon objects
* @param {Source} [source] - a A.source object associated with the footprint
*
*
* @returns {Footprint} Returns a new Footprint object
*/
A.footprint = function(shapes, source) {
@@ -592,6 +618,7 @@ A.catalogFromURL = function (url, options, successCallback, errorCallback, usePr
fp.setColor(c.color);
fp.setHoverColor(c.hoverColor);
fp.setSelectionColor(c.selectionColor);
fp.setSelectionLineWidth(c.selectionLineWidth);
return fp;
})
@@ -881,7 +908,7 @@ A.catalogFromSkyBot = function (ra, dec, radius, epoch, queryOptions, options, s
* @param {function} [options.action] - The callback function to execute when the button is clicked.
* @param {string} [options.title] - The title attribute for the button.
* @param {Object} [options.icon] - An icon object for the button.
* @param {boolean} [options.disable=false] - Whether the button is initially disabled.
* @param {boolean} [options.disabled=false] - Whether the button is initially disabled.
* @param {HTMLElement|string|Widget} [options.content] - The content to be added to the button.
* @param {CSSStyleSheet} [options.cssStyle] - The CSS styles to apply to the button.
* @param {Object} [options.tooltip] - A tooltip.

View File

@@ -1,20 +1,23 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
@@ -42,7 +45,7 @@ import { Coo } from "./libs/astro/coo.js";
import { CooConversion } from "./CooConversion.js";
import { HiPSCache } from "./HiPSCache.js";
import { HiPSList } from "./DefaultHiPSList.js";
import { Toolbar } from "./gui/Toolbar.js";
import { ProjectionEnum } from "./ProjectionEnum.js";
import { ALEvent } from "./events/ALEvent.js";
@@ -64,12 +67,11 @@ import A from "./A.js";
import { StatusBarBox } from "./gui/Box/StatusBarBox.js";
import { FullScreenActionButton } from "./gui/Button/FullScreen.js";
import { ProjectionActionButton } from "./gui/Button/Projection.js";
import { Stack } from "./gui/Button/Stack.js";
// features
import { SettingsButton } from "./gui/Button/Settings";
import { SimbadPointer } from "./gui/Button/SimbadPointer";
import { ColorPicker } from "./gui/Button/ColorPicker";
import { OverlayStackButton } from "./gui/Button/OverlayStack";
import { GridEnabler } from "./gui/Button/GridEnabler";
import { CooFrame } from "./gui/Input/CooFrame";
import { Circle } from "./shapes/Circle";
@@ -152,9 +154,14 @@ import { Polyline } from "./shapes/Polyline";
* @property {boolean} [realFullscreen=false] - Whether to use real fullscreen mode.
* @property {boolean} [pixelateCanvas=true] - Whether to pixelate the canvas.
* @property {boolean} [manualSelection=false] - When set to true, no selection will be performed, only events will be generated.
* @property {string} [mode] - Interface theme, can be either 'dark' or 'light'. If not set, the mode will be retrieved from your browser preference or your localStorage.
* @property {Object} [selector] - More options for the the selector.
* @property {string} [selector.color] - Color of the selector, defaults to the color of the reticle. Can be a hex color or a function returning a hex color.
* @property {number} [selector.lineWidth=2] - Width of the selector line.
* @property {Object} [toolbar] - Toolbar object
* @property {string} [toolbar.divSelector="null"] - A selector to put the toolbar in. By default the toolbar will be inserted in the Aladin Lite view.
* @property {string} [toolbar.position="topleft"] - Can be 'topleft', 'topright', 'bottomleft', 'bottomright'. Default to 'topleft'
* @property {boolean} [toolbar.vertical=true] - Is the toolbar horizontal or not. Default to vertical
*
* @example
* let aladin = A.aladin({
@@ -253,7 +260,7 @@ import { Polyline } from "./shapes/Polyline";
*/
/**
* @typedef {('select'|'objectsSelected'|'objectClicked'|'objectHovered'|'objectHoveredStop'|'footprintClicked'|'footprintHovered'|'positionChanged'|'zoomChanged'|'rotationChanged'|'click'|'rightClickMove'|'mouseMove'|'wheelTriggered'|'fullScreenToggled'|'cooFrameChanged'|'resizeChanged'|'projectionChanged'|'layerChanged')} EventListener
* @typedef {('select'|'objectsSelected'|'objectClicked'|'objectHovered'|'objectHoveredStop'|'footprintClicked'|'footprintHovered'|'positionChanged'|'zoomChanged'|'rotationChanged'|'click'|'rightClickMove'|'mouseMove'|'wheelTriggered'|'fullScreenToggled'|'cooFrameChanged'|'resizeChanged'|'projectionChanged'|'stackChanged')} EventListener
*
* <ul>
* <li>'positionChanged' is triggered when the view position has been changed. It gives the user the new center position of the view in ICRS frame. See {@link positionChangedParam}</li>
@@ -261,6 +268,7 @@ import { Polyline } from "./shapes/Polyline";
* <li>'mouseMove' is triggered when the mouse move over the view. It gives the the user the new position of the cursor in the current frame. See {@link mouseMoveParam}</li>
* <li>'wheelTriggered' allows to redefine the zooming. Listening for it will disable the default zooming heuristic.</li>
* <li>'objectsSelected', 'objectClicked', 'objectHovered', 'objectHoveredStop', 'footprintClicked', 'footprintHovered' are triggered when a catalog source/footprint has been clicked, hovered, ...
* <li>'stackChanged' is triggered when a layer has been added, removed or swapped. The callback passed is an object having fields. The layer object that has been added/removed (or the swapped layers) and a flag that tells you if it has been 'added', 'removed' or 'swapped'.
* </ul>
*/
@@ -300,14 +308,55 @@ export let Aladin = (function () {
const self = this;
ALEvent.HIPS_LAYER_ADDED.listenedBy(aladinDiv, (imageLayer) => {
this.callbacksByEventName["layerChanged"] &&
this.callbacksByEventName["layerChanged"](imageLayer.detail.layer, imageLayer.detail.layer.layer, "ADDED");
ALEvent.GRAPHIC_OVERLAY_LAYER_ADDED.listenedBy(
aladinDiv,
(e) => {
const {overlay} = e.detail;
let callback = this.callbacksByEventName["stackChanged"];
callback && callback({
change: 'added',
overlay,
});
}
);
ALEvent.GRAPHIC_OVERLAY_LAYER_REMOVED.listenedBy(
aladinDiv, (e) => {
const {overlay} = e.detail;
let callback = this.callbacksByEventName["stackChanged"];
callback && callback({
change: 'removed',
overlay,
});
}
);
ALEvent.LAYER_ADDED.listenedBy(aladinDiv, (e) => {
const {layer} = e.detail;
let callback = this.callbacksByEventName["stackChanged"];
callback && callback({
change: 'added',
layer,
});
});
ALEvent.HIPS_LAYER_REMOVED.listenedBy(aladinDiv, (imageLayer) => {
this.callbacksByEventName["layerChanged"] &&
this.callbacksByEventName["layerChanged"](imageLayer.detail.layer, imageLayer.detail.layer.layer, "REMOVED");
ALEvent.LAYER_REMOVED.listenedBy(aladinDiv, (e) => {
const {layer} = e.detail;
let callback = this.callbacksByEventName["stackChanged"];
callback && callback({
change: 'removed',
layer
});
});
ALEvent.LAYER_SWAPPED.listenedBy(aladinDiv, (e) => {
const {layer1, layer2} = e.detail;
let callback = this.callbacksByEventName["stackChanged"];
callback && callback({
change: 'swapped',
layer1,
layer2
});
});
// if not options was set, try to retrieve them from the query string
@@ -334,6 +383,10 @@ export let Aladin = (function () {
...Aladin.DEFAULT_OPTIONS.gridOptions,
...requestedOptions.gridOptions
},
toolbar: {
...Aladin.DEFAULT_OPTIONS.toolbar,
...requestedOptions.toolbar
},
// and use the slice method to create a new array for the hipsList property:
// https://stackoverflow.com/questions/7486085/copy-array-by-value
hipsList: requestedOptions.hipsList || Aladin.DEFAULT_OPTIONS.hipsList.slice()
@@ -357,6 +410,11 @@ export let Aladin = (function () {
this.reticle = new Reticle(this.options, this);
this.popup = new Popup(this.aladinDiv, this.view);
this.tooltip = document.createElement('div')
this.tooltip.id = 'aladin-tooltip-mouse';
this.tooltip.classList.add("aladin-box")
this.aladinDiv.appendChild(this.tooltip)
this.ui = [];
@@ -394,7 +452,7 @@ export let Aladin = (function () {
}
}
// Format the hipslist given by the user before storing it in the aladin objec
// Format the hipslist given by the user before storing it in the aladin instance
this.hipsFavorites = [];
let hipsList = [].concat(options.hipsList);
@@ -405,6 +463,7 @@ export let Aladin = (function () {
if (typeof hips === "string") {
try {
url = new URL(hips).href;
id = url;
} catch (e) {
id = hips;
}
@@ -420,7 +479,7 @@ export let Aladin = (function () {
name = hips.name || hips.id || hips.url;
hipsObj = { ...hipsObj, ...hips };
hipsObj = { ...hips };
} else {
console.warn(
"unable to parse the survey list item: ",
@@ -439,9 +498,6 @@ export let Aladin = (function () {
hipsObj["name"] = name;
}
// at least id or url is defined
//let key = name || id || url;
// Merge what is already in the cache for that HiPS with new properties
// coming from the MOCServer
this.hipsFavorites.push(hipsObj);
@@ -531,9 +587,9 @@ export let Aladin = (function () {
// set right click context menu
if (options.showContextMenu) {
this.contextMenu = new ContextMenu(this);
this.contextMenu.attach(
DefaultActionsForContextMenu.getDefaultActions(this)
DefaultActionsForContextMenu.getDefaultActions(this),
null
);
}
@@ -556,9 +612,25 @@ export let Aladin = (function () {
}
};
Aladin.prototype._applyTheme = function(newTheme) {
this.aladinDiv.setAttribute("data-theme", newTheme);
this.toolbar.el.setAttribute("data-theme", newTheme);
}
Aladin.prototype._setupUI = function (options) {
let self = this;
this.contextMenu = new ContextMenu(this);
let toolbarDivSelector = options && options.toolbar.divSelector || this.aladinDiv;
if (!(toolbarDivSelector instanceof HTMLElement)) {
toolbarDivSelector = document.querySelector(toolbarDivSelector);
}
this.toolbar = new Toolbar({
classList: ["aladin-widgets-toolbar"],
...options.toolbar
}, toolbarDivSelector)
// Status bar
if (options.showStatusBar) {
this.statusBar = new StatusBarBox(this);
@@ -581,48 +653,48 @@ export let Aladin = (function () {
}
////////////////////////////////////////////////////
let stack = new OverlayStackButton(this);
let simbad = new SimbadPointer(this);
let colorPicker = new ColorPicker(this);
let grid = new GridEnabler(this);
this.addUI(stack);
this.addUI(simbad);
this.addUI(grid);
this.addUI(colorPicker)
let widgets = {};
let stack;
// Add the layers control
if (!options.showLayersControl) {
stack._hide();
}
// Add the simbad pointer control
if (!options.showSimbadPointerControl) {
simbad._hide();
}
// Add the projection control
// Add the coo grid control
if (!options.showCooGridControl) {
grid._hide();
}
// Add the projection control
// Add the coo grid control
if (!options.showColorPickerControl) {
colorPicker._hide();
if (options.showLayersControl) {
stack = new Stack(this);
widgets["stack"] = stack
}
// Settings control
if (options.showSettingsControl) {
let settings = new SettingsButton(this, {
features: { stack, simbad, grid },
});
this.addUI(settings);
let settings = new SettingsButton(this);
widgets["settings"] = settings
}
// Add the simbad pointer control
if (options.showSimbadPointerControl) {
let simbad = new SimbadPointer(this);
widgets["simbad"] = simbad
}
// Add the projection control
// Add the coo grid control
if (options.showCooGridControl) {
let grid = new GridEnabler(this);
widgets["grid"] = grid;
}
// Add the projection control
// Add the coo grid control
if (options.showColorPickerControl) {
let picker = new ColorPicker(this);
widgets["picker"] = picker;
}
// share control panel
if (options.showShareControl) {
this.addUI(new ShareActionButton(self));
let share = new ShareActionButton(this);
widgets["share"] = share;
}
for (let [name, widget] of Object.entries(widgets)) {
this.toolbar.add(name, widget);
}
if (options.showProjectionControl) {
@@ -635,7 +707,7 @@ export let Aladin = (function () {
}
if (options.expandLayersControl) {
stack.click();
stack && stack.click();
}
this._applyMediaQueriesUI();
@@ -749,7 +821,12 @@ export let Aladin = (function () {
longitudeReversed: false,
realFullscreen: false,
pixelateCanvas: true,
manualSelection: false
manualSelection: false,
toolbar: {
divSelector: null,
vertical: true,
position: 'topleft'
}
};
/**
@@ -763,7 +840,7 @@ export let Aladin = (function () {
self.isInFullscreen = !self.isInFullscreen;
ContextMenu.hideAll();
this.contextMenu && this.contextMenu._hide();
this.ui.forEach(ui => {
if (ui.toggle) {
@@ -941,7 +1018,7 @@ export let Aladin = (function () {
objectName +
"'";
var url =
"//simbad.u-strasbg.fr/simbad/sim-tap/sync?query=" +
"//simbad.cds.unistra.fr/simbad/sim-tap/sync?query=" +
encodeURIComponent(query) +
"&request=doQuery&lang=adql&format=json&phase=run";
@@ -1096,7 +1173,6 @@ export let Aladin = (function () {
return projName;
};
``;
/**
* Returns the current coordinate system: possible values are 'ICRS', 'ICRSd', and 'Galactic' .
@@ -1113,6 +1189,16 @@ export let Aladin = (function () {
return this.view.cooFrame.label;
};
/**
* Get a reference to the Aladin Lite toolbar object. User can append, remove DOMElement/widgets to it
*
* @memberof Aladin
* @returns {Toolbar}
*/
Aladin.prototype.getToolbar = function () {
return this.toolbar;
};
/**
* Moves the Aladin instance to the specified astronomical object.
*
@@ -1538,7 +1624,7 @@ export let Aladin = (function () {
this.view.addCatalog(catalog);
ALEvent.GRAPHIC_OVERLAY_LAYER_ADDED.dispatchedTo(this.aladinDiv, {
layer: catalog,
overlay: catalog,
});
};
@@ -1551,9 +1637,7 @@ export let Aladin = (function () {
Aladin.prototype.addOverlay = function (overlay) {
this.view.addOverlay(overlay);
ALEvent.GRAPHIC_OVERLAY_LAYER_ADDED.dispatchedTo(this.aladinDiv, {
layer: overlay,
});
ALEvent.GRAPHIC_OVERLAY_LAYER_ADDED.dispatchedTo(this.aladinDiv, { overlay });
};
@@ -1771,14 +1855,6 @@ export let Aladin = (function () {
name: hips.name,
})
// and resort the favorites
this.hipsFavorites.sort((h1, h2) => {
let k1 = h1.name || h1.id || h1.url;
let k2 = h2.name || h2.id || h2.url;
return k1 < k2;
})
// send the final event
ALEvent.FAVORITE_HIPS_LIST_UPDATED.dispatchedTo(document.body, this.hipsFavorites);
}
@@ -2004,7 +2080,7 @@ export let Aladin = (function () {
* </ul>
*/
Aladin.prototype.setBaseImageLayer = function (urlOrHiPSOrFITS) {
return this.setOverlayImageLayer(urlOrHiPSOrFITS, "base");
return this.setOverlayImageLayer(urlOrHiPSOrFITS, (this.view.overlayLayers && this.view.overlayLayers[0]) || Utils.uuidv4());
};
/**
@@ -2014,7 +2090,7 @@ export let Aladin = (function () {
* @returns {HiPS|Image} - Returns the image layer corresponding to the base layer
*/
Aladin.prototype.getBaseImageLayer = function () {
return this.view.getImageLayer("base");
return this.view.getImageLayer(this.view.overlayLayers && this.view.overlayLayers[0]);
};
/**
@@ -2107,6 +2183,10 @@ export let Aladin = (function () {
* view in the counter clockwise order (or towards the east)
*/
Aladin.prototype.setRotation = function (rotation) {
if (!rotation) {
console.warn("Rotation angle is not valid:", rotation)
return;
}
this.view.setRotation(rotation);
};
@@ -2230,7 +2310,7 @@ export let Aladin = (function () {
"cooFrameChanged",
"resizeChanged",
"projectionChanged",
"layerChanged"
"stackChanged"
];
/**
@@ -2288,9 +2368,9 @@ export let Aladin = (function () {
console.log("positionChanged", ra, dec)
})
aladin.on("layerChanged", (layer, layerName, state) => {
console.log("layerChanged", layer, layerName, state)
})
aladin.on('stackChanged', function(state) {
console.log(state)
});
*/
Aladin.prototype.on = function (what, myFunction) {
if (Aladin.AVAILABLE_CALLBACKS.indexOf(what) < 0) {
@@ -3003,7 +3083,7 @@ aladin.customizeShareURLFunction(() => {return 'https://sky.esa.int/esasky/?targ
* @param {Function} [successCallback=<center the view on the FITS file>] - The callback function to be executed on a successful display.
* The callback gives the ra, dec, and fov of the image; By default, it centers the view on the FITS file loaded.
* @param {Function} [errorCallback] - The callback function to be executed if an error occurs during display.
* @param {string} [layer="base"] - The name of the layer. If not specified, it will be replace the base layer.
* @param {string} [layer] - The name of the layer. If not specified, it will be replace the base layer.
*
* @example
aladin.displayFITS(
@@ -3027,7 +3107,7 @@ aladin.displayFITS(
options,
successCallback,
errorCallback,
layer = "base"
layer
) {
successCallback =
successCallback ||
@@ -3041,6 +3121,7 @@ aladin.displayFITS(
successCallback,
errorCallback
);
layer = layer || (this.view.overlayLayers && this.view.overlayLayers[0])
return this.setOverlayImageLayer(image, layer);
};
@@ -3117,7 +3198,6 @@ aladin.displayFITS(
get("https://alasky.unistra.fr/cgi/fits2HiPS", data).then(
async (response) => {
console.log(response, data)
if (response.status != "success") {
console.error("An error occured: " + response.message);
if (errorCallback) {

View File

@@ -1,24 +1,26 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
* Aladin Lite project
*

View File

@@ -1,20 +1,23 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
@@ -52,6 +55,7 @@ If a function is given, user can return Image, HTMLImageCanvas, HTMLImageElement
* @property {string} [decField] - The ID or name of the field holding Declination (dec).
* @property {function} [filter] - The filtering function for sources.
* @property {string} [selectionColor="#00ff00"] - The color to apply to selected sources in the catalog.
* @property {string} [selectionLineWidth] - The line width to apply to selected source footprints in the catalog (i.e. the shapes returned by a custom shape function).
* @property {string} [hoverColor=color] - The color to apply to sources in the catalog when they are hovered.
* @property {boolean} [displayLabel=false] - Whether to display labels for sources.
* @property {string} [labelColumn] - The name of the column to be used for the label.
@@ -110,6 +114,7 @@ export let Catalog = (function () {
// allows for filtering of sources
this.filterFn = options.filter || undefined; // TODO: do the same for catalog
this.selectionColor = options.selectionColor || "#00ff00";
this.selectionLineWidth = options.selectionLineWidth || undefined;
this.hoverColor = options.hoverColor || undefined;
// when footprints are associated to source, do we need to draw the point source as well ?
@@ -140,19 +145,6 @@ export let Catalog = (function () {
// cacheCanvas permet de ne créer le path de la source qu'une fois, et de le réutiliser (cf. http://simonsarris.com/blog/427-increasing-performance-by-caching-paths-on-canvas)
this.updateShape(options);
this.cacheMarkerCanvas = document.createElement("canvas");
this.cacheMarkerCanvas.width = this.markerSize;
this.cacheMarkerCanvas.height = this.markerSize;
var cacheMarkerCtx = this.cacheMarkerCanvas.getContext("2d");
cacheMarkerCtx.fillStyle = this.color;
cacheMarkerCtx.beginPath();
var half = this.markerSize / 2;
cacheMarkerCtx.arc(half, half, half - 2, 0, 2 * Math.PI, false);
cacheMarkerCtx.fill();
cacheMarkerCtx.lineWidth = 2;
cacheMarkerCtx.strokeStyle = "#ccc";
cacheMarkerCtx.stroke();
this.isShowing = true;
}
@@ -502,6 +494,7 @@ export let Catalog = (function () {
* @param {Object} [options] - shape options
* @param {string} [options.color] - the color of the shape
* @param {string} [options.selectionColor] - the color of the shape when selected
* @param {string} [selectionLineWidth] - The line width to apply to selected source footprints in the catalog.
* @param {number} [options.sourceSize] - size of the shape
* @param {string} [options.hoverColor=options.color] - the color to apply to sources in the catalog when they are hovered.
* @param {string|Function|HTMLImageCanvas|HTMLImageElement} [options.shape="square"] - the type of the shape. Can be square, rhomb, plus, cross, triangle, circle.
@@ -512,9 +505,25 @@ export let Catalog = (function () {
options = options || {};
this.color = options.color || this.color || Color.getNextColor();
this.selectionColor = options.selectionColor || this.selectionColor || Color.getNextColor();
this.selectionLineWidth = options.selectionLineWidth || this.selectionLineWidth;
this.hoverColor = options.hoverColor || this.hoverColor || undefined;
this.sourceSize = options.sourceSize || this.sourceSize || 6;
this.shape = options.shape || this.shape || "square";
this.markerSize = this.sourceSize;
this.cacheMarkerCanvas = document.createElement("canvas");
this.cacheMarkerCanvas.width = this.markerSize;
this.cacheMarkerCanvas.height = this.markerSize;
var cacheMarkerCtx = this.cacheMarkerCanvas.getContext("2d");
cacheMarkerCtx.fillStyle = this.color;
cacheMarkerCtx.beginPath();
var half = this.markerSize / 2;
cacheMarkerCtx.arc(half, half, half - 2, 0, 2 * Math.PI, false);
cacheMarkerCtx.fill();
cacheMarkerCtx.lineWidth = 2;
cacheMarkerCtx.strokeStyle = '#ccc';
cacheMarkerCtx.stroke();
if (typeof this.shape === "function") {
this.shapeFn = this.shape;
this.shape = "custom"
@@ -557,7 +566,7 @@ export let Catalog = (function () {
this.reportChange();
};
/**
* Add sources to the catalog
@@ -626,11 +635,12 @@ export let Catalog = (function () {
let hoverColor = this.hoverColor || color;
for (var shape of shapes) {
// Set the same color of the shape than the catalog.
// Set the same color of the shape than the catalog.
// FIXME: the color/shape could be a parameter at the source level, allowing the user single catalogs handling different shapes
shape.setColor(color)
shape.setSelectionColor(this.selectionColor);
shape.setHoverColor(hoverColor);
shape.setSelectionLineWidth(this.selectionLineWidth);
}
let footprint;
@@ -782,9 +792,9 @@ export let Catalog = (function () {
* Get one source by its index in the catalog
*
* @memberof Catalog
*
*
* @param {number} idx - the index of the source in the catalog sources
*
*
* @returns {Source} - the source at the index
*/
Catalog.prototype.getSource = function (idx) {
@@ -808,7 +818,7 @@ export let Catalog = (function () {
* Set the color of the catalog
*
* @memberof Catalog
*
*
* @param {String} - the new color
*/
Catalog.prototype.setColor = function (color) {
@@ -820,7 +830,7 @@ export let Catalog = (function () {
* Set the color of selected sources
*
* @memberof Catalog
*
*
* @param {String} - the new color
*/
Catalog.prototype.setSelectionColor = function (color) {
@@ -828,11 +838,23 @@ export let Catalog = (function () {
this.updateShape();
};
/**
* Set the selectionLineWidth which can be used by the shape draw function for selected catalog elements.
*
* @memberof Catalog
*
* @param {String} - the new selection line width
*/
Catalog.prototype.setSelectionLineWidth = function (selectionLineWidth) {
this.selectionLineWidth = selectionLineWidth;
this.updateShape();
};
/**
* Select sources of the catalog matching a given callback
*
* @memberof Catalog
*
*
* @param {Function} filter - A filter callback to select sources of a catalog.
*/
Catalog.prototype.select = function(filter) {
@@ -858,7 +880,7 @@ export let Catalog = (function () {
* Set the color of hovered sources
*
* @memberof Catalog
*
*
* @param {String} - the new color
*/
Catalog.prototype.setHoverColor = function (color) {
@@ -870,7 +892,7 @@ export let Catalog = (function () {
* Set the size of the catalog sources
*
* @memberof Catalog
*
*
* @param {number} - the new size
*/
Catalog.prototype.setSourceSize = function (sourceSize) {
@@ -883,7 +905,7 @@ export let Catalog = (function () {
* Set the shape of the catalog sources
*
* @memberof Catalog
*
*
* @param {string|Function|HTMLImageCanvas|HTMLImageElement} [shape="square"] - the type of the shape. Can be square, rhomb, plus, cross, triangle, circle.
* A callback function can also be called that return an HTMLImageElement in function of the source object. A canvas or an image can also be given.
*/
@@ -896,7 +918,7 @@ export let Catalog = (function () {
* Get the size of the catalog sources
*
* @memberof Catalog
*
*
* @returns {number} - the size of the sources
*/
Catalog.prototype.getSourceSize = function () {
@@ -907,7 +929,7 @@ export let Catalog = (function () {
* Remove a specific source from the catalog
*
* @memberof Catalog
*
*
* @param {Source} - the source to remove
*/
Catalog.prototype.remove = function (source) {
@@ -983,12 +1005,18 @@ export let Catalog = (function () {
s.x = xy[2 * idx];
s.y = xy[2 * idx + 1];
if (s.isHovered || s.isSelected) {
// These sources will be drawn on the top of the others so we mark it as drawn
// for the moment but will really draw them after all catalogs have been drawn
return true;
}
return self.drawSource(s, ctx, width, height)
};
this.sources.forEach((s, idx) => {
let drawn = false;
if (xy[2 * idx] && xy[2 * idx + 1]) {
if (self.filterFn) {
if(!self.filterFn(s)) {
@@ -1092,7 +1120,7 @@ export let Catalog = (function () {
let color = s.color || this.color;
let cacheCanvas = this.getCacheCanvas(shape, color, size)
ctx.drawImage(
cacheCanvas,
s.x - cacheCanvas.width / 2,
@@ -1116,7 +1144,7 @@ export let Catalog = (function () {
return;
}
ctx.fillText(label, s.x, s.y);
ctx.fillText(label, s.x + this.sourceSize / 2, s.y);
};
// callback function to be called when the status of one of the sources has changed

View File

@@ -1,24 +1,26 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
* Aladin Lite project
*

View File

@@ -1,20 +1,23 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
@@ -59,9 +62,9 @@
}
this.maxCut = {
webp: 1.0,
jpeg: 1.0,
png: 1.0,
webp: 255.0,
jpeg: 255.0,
png: 255.0,
fits: undefined // wait the default value coming from the properties
};
if (options && Number.isFinite(options.maxCut)) {
@@ -95,6 +98,16 @@
}
}
let minCut = this.minCut[this.imgFormat]
if (this.imgFormat !== "fits") {
minCut /= 255.0
}
let maxCut = this.maxCut[this.imgFormat]
if (this.imgFormat !== "fits") {
maxCut /= 255.0
}
// Reset the whole meta object
return {
blendCfg: blend,
@@ -107,8 +120,8 @@
kContrast: this.kContrast,
stretch: this.stretch,
minCut: this.minCut[this.imgFormat],
maxCut: this.maxCut[this.imgFormat],
minCut,
maxCut,
reversed: this.reversed,
cmapName: this.colormap,
}
@@ -121,7 +134,7 @@
this.setColormap(options.colormap, options)
this.setCuts(options.minCut, options.maxCut)
this.setCuts(options.minCut, options.maxCut, options.cutFormat)
this.setBrightness(options.brightness)
this.setSaturation(options.saturation)
@@ -249,18 +262,20 @@
};
// Sets the cuts for the current image format
ColorCfg.prototype.setCuts = function(minCut, maxCut) {
ColorCfg.prototype.setCuts = function(minCut, maxCut, imgFormat) {
imgFormat = imgFormat || this.imgFormat;
if (minCut instanceof Object) {
// Mincut is given in the form of an javascript object with all the formats
this.minCut = minCut
this.minCut = {...this.minCut, ...minCut};
} else if (minCut !== null && minCut !== undefined) {
this.minCut[this.imgFormat] = minCut;
this.minCut[imgFormat] = minCut;
}
if (maxCut instanceof Object) {
this.maxCut = maxCut;
this.maxCut = {...this.maxCut, ...maxCut};
} else if (maxCut !== null && maxCut !== undefined) {
this.maxCut[this.imgFormat] = maxCut;
this.maxCut[imgFormat] = maxCut;
}
};

View File

@@ -1 +1,23 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
export const JSONP_PROXY = "https://alaskybis.cds.unistra.fr/cgi/JSONProxy";

View File

@@ -1,24 +1,25 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
export let CooConversion = (function() {
let CooConversion = {};

View File

@@ -1,24 +1,25 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
* Aladin Lite project
*

View File

@@ -1,24 +1,26 @@
// Copyright 2023 - UDS/CNRS
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
* Aladin Lite project
*
@@ -127,6 +129,7 @@ export let DefaultActionsForContextMenu = (function () {
label: 'FITS image', action(o) {
let input = document.createElement('input');
input.type = 'file';
input.accept = ".fits";
input.onchange = _ => {
let files = Array.from(input.files);

View File

@@ -1,3 +1,25 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
export let HiPSList = (function () {
function HiPSList() {}

View File

@@ -1,24 +1,26 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2013 - UDS/CNRS
// The Aladin Lite program is distributed under the terms
// of the GNU General Public License version 3.
// of the GNU Lesser General Public License version 3
// or (at your option) any later version.
//
// This file is part of Aladin Lite.
//
// Aladin Lite is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 of the License.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Aladin Lite is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// The GNU General Public License is available in COPYING file
// along with Aladin Lite.
// You should have received a copy of the GNU Lesser General Public License
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
//
/******************************************************************************
* Aladin Lite project
*

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