mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2026-06-12 11:01:37 -07:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"license": "GPL-3.0",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"access_right": "open",
|
||||
"description": "An astronomical HiPS visualizer in the browser ",
|
||||
"keywords": ["astronomy", "visualizer", "images"],
|
||||
|
||||
+19
-1
@@ -6,8 +6,25 @@
|
||||
|
||||
## Released
|
||||
|
||||
### 3.9.0-beta
|
||||
|
||||
* [feat] AVM tag reading from PNG extension images by [@bmatthieu3][bmatthieu3] <https://github.com/cds-astro/aladin-lite/issues/349>
|
||||
* [feat] Export of aladin lite view with AVM tags [@tboch][tboch] <https://github.com/cds-astro/aladin-lite/issues/349>
|
||||
* [fix] Switching back and forth the layer to an image <https://github.com/cds-astro/aladin-lite/issues/359> by [@bmatthieu3][bmatthieu3]
|
||||
* [fix] Open settings on catalog with a HiPS3D <https://github.com/cds-astro/aladin-lite/issues/360>
|
||||
* [fix] keep the cut values for each tile format <https://github.com/cds-astro/aladin-lite/issues/361>
|
||||
* [fix] Keep approx the same level of zoom when the screen is resized <https://github.com/cds-astro/aladin-lite/issues/362>
|
||||
* [fix] <https://github.com/cds-astro/aladin-lite/issues/363>
|
||||
* [fix] <https://github.com/cds-astro/aladin-lite/issues/364>
|
||||
* [feat] Support of SIP astrometry keywords in FITS file <https://github.com/cds-astro/aladin-lite/issues/365>
|
||||
* [fix] <https://github.com/cds-astro/aladin-lite/issues/371>
|
||||
* [feat] Progressive catalogs: first try loading metadata.xml, switch back on Metadata.xml if it fails <https://github.com/cds-astro/aladin-lite/issues/357>
|
||||
* [feat] Support skewer selection for footprints/shapes <https://github.com/cds-astro/aladin-lite/issues/369> by [@tomdonaldson][tomdonaldson]
|
||||
|
||||
### 3.8.0
|
||||
|
||||
|
||||
* [fix] Fix shape hover colors when overlay uses named color (increaseBrightness() accepts names now) <https://github.com/cds-astro/aladin-lite/issues/355>
|
||||
* [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>
|
||||
@@ -525,6 +542,7 @@ Aladin Lite is made possible thanks to those people:
|
||||
* [@simontorres][simontorres]
|
||||
* [@szpetny][szpetny]
|
||||
* [@tboch][tboch]
|
||||
* [@tomdonaldson][tomdonaldson]
|
||||
* [@Xen0Xys][Xen0Xys]
|
||||
|
||||
[alexgoff]: https://github.com/alexgoff
|
||||
@@ -537,5 +555,5 @@ Aladin Lite is made possible thanks to those people:
|
||||
[simontorres]: https://github.com/simontorres
|
||||
[szpetny]: https://github.com/szpetny
|
||||
[tboch]: https://github.com/tboch
|
||||
[tomdonaldson]: https://github.com/tomdonaldson
|
||||
[Xen0Xys]: https://github.com/Xen0Xys
|
||||
|
||||
|
||||
-304
@@ -1,304 +0,0 @@
|
||||
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>.
|
||||
@@ -1,304 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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>.
|
||||
"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.
|
||||
@@ -120,7 +120,7 @@ Aladin Lite can be imported with:
|
||||
|
||||
## Licence
|
||||
|
||||
Aladin Lite is currently licensed under GPL v3.0
|
||||
Aladin Lite is currently licensed under LGPL-3.0-or-later
|
||||
|
||||
If you think this license might prevent you from using Aladin Lite in your pages/application/portal, please open an issue or [contact us](mailto:cds-question@unistra.fr)
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24">
|
||||
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
|
||||
<path d="M.7,12.3l11.3-4.9,11.3,4.9-11.1,7.1L.7,12.3ZM12,16.6l7.4-4.1-7.1-3.4-7.4,3.4s7.1,4.1,7.1,4.1Z"/>
|
||||
<polygon points="4.9 1.8 5 8 6.3 9.1 7.6 8 7.6 1.8 4.9 1.8"/>
|
||||
<polygon points="24 24 20.4 24 24 20.4 24 24"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 453 B |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24">
|
||||
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
|
||||
<path d="M.7,12.3l11.3-4.9,11.3,4.9-11.1,7.1L.7,12.3ZM12,16.6l7.4-4.1-7.1-3.4-7.4,3.4,7.1,4.1Z"/>
|
||||
<polygon points="4.9 1.8 5 8 6.3 9.1 7.6 8 7.6 1.8 4.9 1.8"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 395 B |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24">
|
||||
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
|
||||
<polygon points="11.6 7.9 14 7.9 14 4.4 14 4.4 14 2.9 14 2.9 14 .8 11.6 .8 11.6 2.4 11.6 2.4 11.6 4 11.6 4 11.6 7.9"/>
|
||||
<path d="M22.5,7.5l-7.5-3.2v1.7l3.5,1.7-6,3.6-6.5-3.5,4.7-2.2v-1.7L2.2,7.5l4.2,2.5-5,2.6,11.1,6.5,10.8-6.6-5.1-2.4,4.2-2.6s.1,0,.1,0ZM19.8,12.4l-7.2,4-7.7-4.1,2.9-1.5,4.7,2.8,4.3-2.6,3,1.4Z"/>
|
||||
<polygon points="11.3 19.6 11.3 22.1 12.6 23.3 14 22.1 14 19.5 12.5 20.3 11.3 19.6"/>
|
||||
<polygon points="24 24 20.4 24 24 20.4 24 24"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 685 B |
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 24 24">
|
||||
<!-- Generator: Adobe Illustrator 30.2.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 1) -->
|
||||
<polygon points="11.6 7.9 14 7.9 14 4.4 14 4.4 14 2.9 14 2.9 14 .8 11.6 .8 11.6 2.4 11.6 2.4 11.6 4 11.6 4 11.6 7.9"/>
|
||||
<path d="M22.5,7.5l-7.5-3.2v1.7c0,0,3.5,1.7,3.5,1.7l-6,3.6-6.5-3.5,4.7-2.2v-1.7S2.2,7.5,2.2,7.5l4.2,2.5-5,2.6,11.1,6.5,10.8-6.6-5.1-2.4,4.2-2.6h.1ZM19.8,12.4l-7.2,4-7.7-4.1,2.9-1.5,4.7,2.8,4.3-2.6s3,1.4,3,1.4Z"/>
|
||||
<polygon points="11.3 19.6 11.3 22.1 12.6 23.3 14 22.1 14 19.5 12.5 20.3 11.3 19.6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 655 B |
+3
-3
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
|
||||
"@type": "SoftwareSourceCode",
|
||||
"license": "https://spdx.org/licenses/GPL-3.0",
|
||||
"license": "https://spdx.org/licenses/LGPL-3.0-or-later",
|
||||
"codeRepository": "https://github.com/cds-astro/aladin-lite",
|
||||
"dateCreated": "2013-05-01",
|
||||
"datePublished": "2013-05-01",
|
||||
"dateModified": "2023-01-31",
|
||||
"issueTracker": "https://github.com/cds-astro/aladin-lite/issues",
|
||||
"name": "Aladin Lite",
|
||||
"version": "3.8.1",
|
||||
"softwareVersion": "3.8.1",
|
||||
"version": "3.8.2",
|
||||
"softwareVersion": "3.8.2",
|
||||
"description": "An astronomical HiPS visualizer in the browser.",
|
||||
"identifier": "10.5281/zenodo.7638833",
|
||||
"applicationCategory": "Astronomy, Visualization",
|
||||
|
||||
@@ -107,7 +107,7 @@ if (params.has('fov')) {
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin("#aladin-lite-div", {showSimbadPointerControl: true, target: target, fov: fov });
|
||||
aladin.setOverlayImageLayer('https://alasky.cds.unistra.fr/HST-outreach/CDS_P_HST_EPO');
|
||||
aladin.getOverlayImageLayer().setAlpha(1.0);
|
||||
aladin.getOverlayImageLayer().setAlpha(0.5);
|
||||
aladin.toggleFullscreen();
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin('#aladin-lite-div', { fov:0.15, target: 'Arp 240', showContextMenu: true, showReticle: false, fullScreen: true });
|
||||
aladin.setBaseImageLayer(aladin.newImageSurvey('P/SDSS9/g', {colormap: "eosb", stretch: "linear"}));
|
||||
aladin.setBaseImageLayer(aladin.newImageSurvey('P/SDSS9/g', {url: 'https://alasky.cds.unistra.fr/SDSS/DR9/band-g/', maxOrder: 10, cooFrame: 'icrs', imgFormat: 'png', colormap: "eosb", stretch: "linear"}));
|
||||
|
||||
var simbad = A.catalog({name: 'Simbad', sourceSize: 16, color: '#4050F0'});
|
||||
aladin.addCatalog(simbad);
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
<script type="module">
|
||||
import A from '../src/js/A.js';
|
||||
A.init.then(() => {
|
||||
let aladin = A.aladin('#aladin-lite-div', {target: "23 28 32.46 -00 10 38.9", fov: 4, projection: "AIT"});
|
||||
let aladin = A.aladin('#aladin-lite-div', {survey: ["lksldf", 'ljkjsdf'], 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);
|
||||
//let hsc = aladin.newImageSurvey("P/HSC/DR2/deep/g", {colormap:"Purples", imgFormat: "fits"});
|
||||
//aladin.setBaseImageLayer(hsc);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import A from '../src/js/A.js';
|
||||
let aladin;
|
||||
A.init.then(() => {
|
||||
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 = A.aladin('#aladin-lite-div', {toolbar: {divSelector: '#toolbar'}, showContextMenu: true, 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'});
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
{
|
||||
name: "spitzer-ssc2005-24a1",
|
||||
successCallback: (ra, dec, fov, image) => {
|
||||
console.log(ra, dec)
|
||||
aladin.gotoRaDec(ra, dec);
|
||||
aladin.setFoV(fov * 5)
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="al1" style="width: 200px; height: 200px">
|
||||
<div id="al1" style="width: 512px; height: 512px">
|
||||
</div>
|
||||
<div id="al2" style="width: 200px; height: 200px">
|
||||
<div id="al2" style="width: 512px; height: 512px">
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
@@ -14,7 +14,7 @@
|
||||
let al2;
|
||||
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});
|
||||
al1 = A.aladin('#al1', {target: 'M51', fov: 0.3, survey: 'https://alasky.cds.unistra.fr/HIPS3D/LGLBSHI-test-compression/', 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>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="aladin-lite-div" style="width: 1024px; height: 768px"></div>
|
||||
<script type="module">
|
||||
import A from '../src/js/A.js';
|
||||
let aladin;
|
||||
|
||||
A.init.then(() => {
|
||||
aladin = A.aladin("#aladin-lite-div", {
|
||||
fov: 2,
|
||||
survey:
|
||||
"https://images.rubinobservatory.org/hips/SVImages_v2/color_ugri",
|
||||
backgroundColor: "rgb(0,0,0)",
|
||||
cooFrame: "ICRSd",
|
||||
});
|
||||
|
||||
aladin.setFoVRange(0.002, 10);
|
||||
aladin.gotoRaDec(186.5, 6.95);
|
||||
|
||||
const secondSurvey = {
|
||||
imgFormat: "webp",
|
||||
cooFrame: "ICRSd",
|
||||
maxOrder: 11,
|
||||
url: "https://images.rubinobservatory.org/hips/asteroids/color_ugri",
|
||||
};
|
||||
|
||||
const hips = A.HiPS(secondSurvey.url, { ...secondSurvey, opacity: 1 });
|
||||
|
||||
aladin.setOverlayImageLayer(hips);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -21,7 +21,7 @@
|
||||
console.log("Rotation just changed to ", rotation);
|
||||
})
|
||||
aladin.on("positionChanged", ({ra, dec}) => {
|
||||
console.log('call to aladin', aladin.pix2world(300, 300))
|
||||
console.log('call to aladin', aladin.pix2world(300, 300, 'gal'))
|
||||
console.log('positionChanged in icrs', ra, dec)
|
||||
})
|
||||
|
||||
|
||||
+5
-1
@@ -1,12 +1,16 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta name="viewport" content="width=device-width, height=device-height, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
|
||||
<script type="text/javascript" src="./../dist/aladin.umd.cjs" charset="utf-8"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="aladin-lite-div" style="width: 500px; height: 500px"></div>
|
||||
|
||||
<script type="text/javascript" src="./../dist/aladin.umd.cjs" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
var aladin;
|
||||
A.init.then(() => {
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
"homepage": "https://aladin.cds.unistra.fr/",
|
||||
"name": "aladin-lite",
|
||||
"type": "module",
|
||||
"version": "3.8.1",
|
||||
"version": "3.9.0-beta",
|
||||
"description": "An astronomical HiPS visualizer in the browser",
|
||||
"author": "Thomas Boch and Matthieu Baumann",
|
||||
"license": "GPL-3",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"module": "./dist/aladin.js",
|
||||
"main": "./dist/aladin.js",
|
||||
"files": [
|
||||
|
||||
+3
-2
@@ -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.8.1"
|
||||
version = "3.9.0"
|
||||
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
|
||||
edition = "2018"
|
||||
|
||||
@@ -25,7 +25,8 @@ wasm-bindgen = "=0.2.92"
|
||||
async-channel = "1.8.0"
|
||||
mapproj = "0.3.0"
|
||||
colorgrad = "0.6.2"
|
||||
fitsrs = "0.4.1"
|
||||
#fitsrs = "0.4.1"
|
||||
fitsrs = { git = "https://github.com/cds-astro/fitsrs", branch = "master" }
|
||||
|
||||
[features]
|
||||
webgl1 = [ "al-core/webgl1", "al-api/webgl1", "web-sys/WebGlRenderingContext", "web-sys/AngleInstancedArrays", "web-sys/ExtSRgb", "web-sys/OesTextureFloat",]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "al-api"
|
||||
version = "3.8.1"
|
||||
version = "3.9.0"
|
||||
authors = ["baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
+25
-117
@@ -1,5 +1,3 @@
|
||||
use wasm_bindgen::JsValue;
|
||||
|
||||
use super::blend::BlendCfg;
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -45,15 +43,15 @@ pub struct HiPSProperties {
|
||||
sky_fraction: Option<f32>,
|
||||
min_order: Option<u8>,
|
||||
|
||||
hips_initial_fov: Option<f64>,
|
||||
hips_initial_ra: Option<f64>,
|
||||
hips_initial_dec: Option<f64>,
|
||||
initial_fov: Option<f64>,
|
||||
initial_ra: Option<f64>,
|
||||
initial_dec: Option<f64>,
|
||||
// HiPS cube
|
||||
hips_cube_depth: Option<u32>,
|
||||
cube_depth: Option<u32>,
|
||||
|
||||
// HiPS 3D keywords
|
||||
hips_order_freq: Option<u8>,
|
||||
hips_tile_depth: Option<u8>,
|
||||
order_freq: Option<u8>,
|
||||
tile_depth: Option<u8>,
|
||||
|
||||
/// Start of spectral coordinates (in meters)
|
||||
em_min: Option<f32>,
|
||||
@@ -77,11 +75,11 @@ pub struct HiPSProperties {
|
||||
impl HiPSProperties {
|
||||
#[inline(always)]
|
||||
pub fn get_hips_order_freq(&self) -> Option<u8> {
|
||||
self.hips_order_freq
|
||||
self.order_freq
|
||||
}
|
||||
#[inline(always)]
|
||||
pub fn get_hips_tile_depth(&self) -> Option<u8> {
|
||||
self.hips_tile_depth
|
||||
self.tile_depth
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -111,7 +109,7 @@ impl HiPSProperties {
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_cube_depth(&self) -> Option<u32> {
|
||||
self.hips_cube_depth
|
||||
self.cube_depth
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -141,17 +139,17 @@ impl HiPSProperties {
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_initial_fov(&self) -> Option<f64> {
|
||||
self.hips_initial_fov
|
||||
self.initial_fov
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_initial_ra(&self) -> Option<f64> {
|
||||
self.hips_initial_ra
|
||||
self.initial_ra
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_initial_dec(&self) -> Option<f64> {
|
||||
self.hips_initial_dec
|
||||
self.initial_dec
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -246,9 +244,13 @@ impl From<String> for TransferFunction {
|
||||
}
|
||||
|
||||
use crate::colormap::CmapLabel;
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct HiPSColor {
|
||||
#[derive(Clone)]
|
||||
#[wasm_bindgen]
|
||||
pub struct ImageMetadata {
|
||||
/// Color config
|
||||
// transfer function called before evaluating the colormap
|
||||
pub stretch: TransferFunction,
|
||||
// low cut
|
||||
@@ -258,26 +260,17 @@ pub struct HiPSColor {
|
||||
// flag to tell the colormap is queried reversed
|
||||
pub reversed: bool,
|
||||
// the colormap
|
||||
pub cmap_name: CmapLabel,
|
||||
/// tonal color tuning factors
|
||||
pub k_gamma: f32,
|
||||
pub k_saturation: f32,
|
||||
pub k_contrast: f32,
|
||||
pub k_brightness: f32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[derive(Clone)]
|
||||
#[wasm_bindgen]
|
||||
pub struct ImageMetadata {
|
||||
/// Color config
|
||||
#[wasm_bindgen(skip)]
|
||||
pub color: HiPSColor,
|
||||
pub colormap: CmapLabel,
|
||||
/// tonal color tuning factors
|
||||
pub gamma: f32,
|
||||
pub saturation: f32,
|
||||
pub contrast: f32,
|
||||
pub brightness: f32,
|
||||
|
||||
// Blending config
|
||||
#[serde(default)]
|
||||
pub blend_cfg: BlendCfg,
|
||||
pub blending: BlendCfg,
|
||||
#[serde(default = "default_opacity")]
|
||||
pub opacity: f32,
|
||||
/// the current format chosen
|
||||
@@ -287,91 +280,6 @@ pub struct ImageMetadata {
|
||||
fn default_opacity() -> f32 {
|
||||
1.0
|
||||
}
|
||||
use crate::Abort;
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl ImageMetadata {
|
||||
#[wasm_bindgen(setter = color)]
|
||||
pub fn set_color(&mut self, color: JsValue) -> std::result::Result<(), JsValue> {
|
||||
self.color = serde_wasm_bindgen::from_value(color)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[wasm_bindgen(getter = color)]
|
||||
pub fn color(&self) -> JsValue {
|
||||
let js_color_obj = js_sys::Object::new();
|
||||
|
||||
let HiPSColor {
|
||||
stretch,
|
||||
min_cut,
|
||||
max_cut,
|
||||
reversed,
|
||||
cmap_name,
|
||||
k_gamma,
|
||||
k_saturation,
|
||||
k_brightness,
|
||||
k_contrast,
|
||||
} = &self.color;
|
||||
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"stretch".into(),
|
||||
&serde_wasm_bindgen::to_value(&stretch).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"minCut".into(),
|
||||
&serde_wasm_bindgen::to_value(&min_cut).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"maxCut".into(),
|
||||
&serde_wasm_bindgen::to_value(&max_cut).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"kGamma".into(),
|
||||
&serde_wasm_bindgen::to_value(&k_gamma).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"kSaturation".into(),
|
||||
&serde_wasm_bindgen::to_value(&k_saturation).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"kBrightness".into(),
|
||||
&serde_wasm_bindgen::to_value(&k_brightness).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"kContrast".into(),
|
||||
&serde_wasm_bindgen::to_value(&k_contrast).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"reversed".into(),
|
||||
&JsValue::from_bool(*reversed),
|
||||
)
|
||||
.unwrap_abort();
|
||||
js_sys::Reflect::set(
|
||||
&js_color_obj,
|
||||
&"colormap".into(),
|
||||
&serde_wasm_bindgen::to_value(&cmap_name).unwrap_abort(),
|
||||
)
|
||||
.unwrap_abort();
|
||||
|
||||
js_color_obj.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl ImageMetadata {
|
||||
pub fn visible(&self) -> bool {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[package]
|
||||
name = "al-core"
|
||||
version = "3.8.1"
|
||||
version = "3.9.0"
|
||||
authors = ["baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
js-sys = "0.3.47"
|
||||
cgmath = "*"
|
||||
fitsrs = "0.4.1"
|
||||
fitsrs = { git = "https://github.com/cds-astro/fitsrs", branch = "master" }
|
||||
al-api = { path = "../al-api" }
|
||||
serde = { version = "^1.0.59", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -13,6 +13,8 @@ use std::io::Cursor;
|
||||
use std::ops::Range;
|
||||
use wasm_bindgen::JsValue;
|
||||
|
||||
use fitsrs::hdu::header::ValueMap;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FitsImage<'a> {
|
||||
// Margin values for HiPS3D cubic tiles
|
||||
@@ -37,6 +39,9 @@ pub struct FitsImage<'a> {
|
||||
pub data_byte_offset: Range<usize>,
|
||||
// raw bytes of the data image (in Big-Endian)
|
||||
pub raw_bytes: Cow<'a, [u8]>,
|
||||
|
||||
// keep the header keywords and their values
|
||||
pub header: ValueMap,
|
||||
}
|
||||
|
||||
impl<'a> FitsImage<'a> {
|
||||
@@ -76,6 +81,7 @@ impl<'a> FitsImage<'a> {
|
||||
|
||||
let wcs = hdu.wcs().ok();
|
||||
|
||||
let values: &ValueMap = header;
|
||||
images.push(Self {
|
||||
trim1,
|
||||
trim2,
|
||||
@@ -90,6 +96,7 @@ impl<'a> FitsImage<'a> {
|
||||
blank,
|
||||
data_byte_offset,
|
||||
raw_bytes,
|
||||
header: values.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -149,6 +156,8 @@ impl<'a> FitsImage<'a> {
|
||||
};
|
||||
|
||||
if let Some(raw_bytes) = raw_bytes {
|
||||
let values: &ValueMap = header;
|
||||
|
||||
images.push(Self {
|
||||
trim1,
|
||||
trim2,
|
||||
@@ -163,6 +172,7 @@ impl<'a> FitsImage<'a> {
|
||||
blank,
|
||||
data_byte_offset,
|
||||
raw_bytes: Cow::Owned(raw_bytes),
|
||||
header: values.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,20 +289,9 @@ impl UniformType for TransferFunction {
|
||||
}
|
||||
}
|
||||
|
||||
use al_api::hips::HiPSColor;
|
||||
use al_api::hips::ImageMetadata;
|
||||
|
||||
impl SendUniforms for ImageMetadata {
|
||||
fn attach_uniforms<'a>(&self, shader: &'a ShaderBound<'a>) -> &'a ShaderBound<'a> {
|
||||
shader
|
||||
.attach_uniforms_from(&self.color)
|
||||
.attach_uniform("opacity", &self.opacity);
|
||||
|
||||
shader
|
||||
}
|
||||
}
|
||||
|
||||
impl SendUniforms for HiPSColor {
|
||||
fn attach_uniforms<'a>(&self, shader: &'a ShaderBound<'a>) -> &'a ShaderBound<'a> {
|
||||
let reversed = self.reversed as u8 as f32;
|
||||
|
||||
@@ -310,17 +299,18 @@ impl SendUniforms for HiPSColor {
|
||||
.attach_uniform("H", &self.stretch)
|
||||
.attach_uniform("min_value", &self.min_cut.unwrap_or(0.0))
|
||||
.attach_uniform("max_value", &self.max_cut.unwrap_or(1.0))
|
||||
.attach_uniform("k_gamma", &self.k_gamma)
|
||||
.attach_uniform("k_saturation", &self.k_saturation)
|
||||
.attach_uniform("k_brightness", &self.k_brightness)
|
||||
.attach_uniform("k_contrast", &self.k_contrast)
|
||||
.attach_uniform("reversed", &reversed);
|
||||
.attach_uniform("k_gamma", &self.gamma)
|
||||
.attach_uniform("k_saturation", &self.saturation)
|
||||
.attach_uniform("k_brightness", &self.brightness)
|
||||
.attach_uniform("k_contrast", &self.contrast)
|
||||
.attach_uniform("reversed", &reversed)
|
||||
.attach_uniform("opacity", &self.opacity);
|
||||
|
||||
shader
|
||||
}
|
||||
}
|
||||
|
||||
impl SendUniformsWithParams<Colormaps> for HiPSColor {
|
||||
impl SendUniformsWithParams<Colormaps> for ImageMetadata {
|
||||
fn attach_uniforms_with_params<'a>(
|
||||
&self,
|
||||
shader: &'a ShaderBound<'a>,
|
||||
@@ -328,18 +318,19 @@ impl SendUniformsWithParams<Colormaps> for HiPSColor {
|
||||
) -> &'a ShaderBound<'a> {
|
||||
let reversed = self.reversed as u8 as f32;
|
||||
|
||||
let cmap = cmaps.get(self.cmap_name.as_ref());
|
||||
let cmap = cmaps.get(self.colormap.as_ref());
|
||||
shader
|
||||
.attach_uniforms_from(cmaps)
|
||||
.attach_uniforms_with_params_from(cmap, cmaps)
|
||||
.attach_uniform("H", &self.stretch)
|
||||
.attach_uniform("min_value", &self.min_cut.unwrap_or(0.0))
|
||||
.attach_uniform("max_value", &self.max_cut.unwrap_or(1.0))
|
||||
.attach_uniform("k_gamma", &self.k_gamma)
|
||||
.attach_uniform("k_saturation", &self.k_saturation)
|
||||
.attach_uniform("k_brightness", &self.k_brightness)
|
||||
.attach_uniform("k_contrast", &self.k_contrast)
|
||||
.attach_uniform("reversed", &reversed);
|
||||
.attach_uniform("k_gamma", &self.gamma)
|
||||
.attach_uniform("k_saturation", &self.saturation)
|
||||
.attach_uniform("k_brightness", &self.brightness)
|
||||
.attach_uniform("k_contrast", &self.contrast)
|
||||
.attach_uniform("reversed", &reversed)
|
||||
.attach_uniform("opacity", &self.opacity);
|
||||
|
||||
shader
|
||||
}
|
||||
|
||||
@@ -29,16 +29,15 @@ impl WebGlContext {
|
||||
.dyn_into::<web_sys::HtmlCanvasElement>()
|
||||
.unwrap_abort();
|
||||
|
||||
// See https://stackoverflow.com/a/26790802/13456997
|
||||
// preserveDrawingBuffer enabled for exporting the view as a PNG
|
||||
let context_options =
|
||||
js_sys::JSON::parse("{\"antialias\":false, \"preserveDrawingBuffer\": true}")?;
|
||||
//let context_options = js_sys::JSON::parse("{}")?;
|
||||
//let context_options =
|
||||
// js_sys::JSON::parse("{\"antialias\":false}")?;
|
||||
//js_sys::JSON::parse("{\"antialias\":false}")?;
|
||||
|
||||
#[cfg(feature = "webgl2")]
|
||||
let gl = Rc::new(
|
||||
canvas
|
||||
.get_context_with_context_options("webgl2", context_options.as_ref())?
|
||||
.get_context("webgl2")?
|
||||
.unwrap_abort()
|
||||
.dyn_into::<WebGlRenderingCtx>()
|
||||
.unwrap_abort(),
|
||||
|
||||
+62
-43
@@ -1176,7 +1176,7 @@ impl App {
|
||||
layer: String,
|
||||
bytes: &[u8],
|
||||
wcs: WCS,
|
||||
cfg: ImageMetadata,
|
||||
options: ImageMetadata,
|
||||
) -> Result<js_sys::Promise, JsValue> {
|
||||
let gl = self.gl.clone();
|
||||
|
||||
@@ -1188,7 +1188,7 @@ impl App {
|
||||
images: vec![image],
|
||||
id: layer.clone(),
|
||||
layer,
|
||||
meta: cfg,
|
||||
options,
|
||||
};
|
||||
|
||||
let params = layer.get_params();
|
||||
@@ -1212,9 +1212,11 @@ impl App {
|
||||
pub(crate) fn add_fits_image(
|
||||
&mut self,
|
||||
bytes: &[u8],
|
||||
meta: ImageMetadata,
|
||||
options: ImageMetadata,
|
||||
layer: String,
|
||||
) -> Result<js_sys::Promise, JsValue> {
|
||||
use fitsrs::hdu::header::ValueMap;
|
||||
|
||||
let gl = self.gl.clone();
|
||||
// Stop the current inertia
|
||||
// And disable it while the fits has not been loaded
|
||||
@@ -1225,41 +1227,45 @@ impl App {
|
||||
let gz = fitsrs::gz::GzReader::new(Cursor::new(bytes))
|
||||
.map_err(|_| JsValue::from_str("Error creating gz wrapper"))?;
|
||||
|
||||
let parse_fits_images_from_bytes = |raw_bytes: &[u8]| -> Result<Vec<Image>, JsValue> {
|
||||
Ok(FitsImage::from_raw_bytes(raw_bytes)?
|
||||
.into_iter()
|
||||
.filter_map(
|
||||
|FitsImage {
|
||||
bitpix,
|
||||
bscale,
|
||||
bzero,
|
||||
blank,
|
||||
wcs,
|
||||
raw_bytes,
|
||||
..
|
||||
}| {
|
||||
if let Some(wcs) = wcs {
|
||||
let image = Image::from_fits_hdu(
|
||||
&gl,
|
||||
wcs,
|
||||
bitpix,
|
||||
raw_bytes.as_ref(),
|
||||
bscale,
|
||||
bzero,
|
||||
blank,
|
||||
camera_coo_sys,
|
||||
)
|
||||
.ok()?;
|
||||
Some(image)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
)
|
||||
.collect::<Vec<_>>())
|
||||
};
|
||||
let parse_fits_images_from_bytes =
|
||||
|raw_bytes: &[u8]| -> Result<(Vec<Image>, Vec<ValueMap>), JsValue> {
|
||||
let (images, headers) = FitsImage::from_raw_bytes(raw_bytes)?
|
||||
.into_iter()
|
||||
.filter_map(
|
||||
|FitsImage {
|
||||
bitpix,
|
||||
bscale,
|
||||
bzero,
|
||||
blank,
|
||||
wcs,
|
||||
raw_bytes,
|
||||
header,
|
||||
..
|
||||
}| {
|
||||
if let Some(wcs) = wcs {
|
||||
let image = Image::from_fits_hdu(
|
||||
&gl,
|
||||
wcs,
|
||||
bitpix,
|
||||
raw_bytes.as_ref(),
|
||||
bscale,
|
||||
bzero,
|
||||
blank,
|
||||
camera_coo_sys,
|
||||
)
|
||||
.ok()?;
|
||||
Some((image, header))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
)
|
||||
.collect::<(Vec<_>, Vec<_>)>();
|
||||
|
||||
let images = match gz {
|
||||
Ok((images, headers))
|
||||
};
|
||||
|
||||
let (images, headers) = match gz {
|
||||
fitsrs::gz::GzReader::GzReader(bytes) => parse_fits_images_from_bytes(bytes.get_ref())?,
|
||||
fitsrs::gz::GzReader::Reader(bytes) => parse_fits_images_from_bytes(bytes.get_ref())?,
|
||||
};
|
||||
@@ -1272,7 +1278,7 @@ impl App {
|
||||
id: layer.clone(),
|
||||
|
||||
layer,
|
||||
meta,
|
||||
options,
|
||||
};
|
||||
|
||||
let params = layer.get_params();
|
||||
@@ -1284,7 +1290,17 @@ impl App {
|
||||
)?;
|
||||
self.request_redraw = true;
|
||||
|
||||
let promise = js_sys::Promise::resolve(&serde_wasm_bindgen::to_value(¶ms)?);
|
||||
let obj: js_sys::Object = serde_wasm_bindgen::to_value(¶ms)?.dyn_into()?;
|
||||
|
||||
use std::iter::FromIterator;
|
||||
let arr = js_sys::Array::from_iter(
|
||||
headers
|
||||
.iter()
|
||||
.map(|header| serde_wasm_bindgen::to_value(&header).unwrap()),
|
||||
);
|
||||
js_sys::Reflect::set(&obj, &"headers".into(), &arr).unwrap();
|
||||
|
||||
let promise = js_sys::Promise::resolve(&obj.into());
|
||||
Ok(promise)
|
||||
}
|
||||
}
|
||||
@@ -1452,8 +1468,8 @@ impl App {
|
||||
|
||||
pub(crate) fn resize(&mut self, width: f32, height: f32) {
|
||||
self.camera.set_screen_size(width, height, &self.projection);
|
||||
self.camera
|
||||
.set_zoom_factor(self.camera.get_zoom_factor(), &self.projection);
|
||||
//self.camera
|
||||
// .set_zoom_factor(self.camera.get_zoom_factor(), &self.projection);
|
||||
|
||||
// resize the view fbo
|
||||
//let screen_size = self.camera.get_screen_size();
|
||||
@@ -1853,8 +1869,11 @@ impl App {
|
||||
self.request_redraw = true;
|
||||
}
|
||||
|
||||
pub(crate) fn get_fov(&self) -> f64 {
|
||||
self.camera.get_aperture().to_degrees()
|
||||
pub(crate) fn get_fov(&self) -> [f64; 2] {
|
||||
[
|
||||
self.camera.get_aperture().to_degrees(),
|
||||
self.camera.get_aperture_y().to_degrees(),
|
||||
]
|
||||
}
|
||||
|
||||
pub(crate) fn get_colormaps(&self) -> &Colormaps {
|
||||
|
||||
@@ -24,6 +24,7 @@ const ZOOM_FACTOR_UPPER_LIMIT: f64 = 2.0;
|
||||
pub struct CameraViewPort {
|
||||
// The field of view angle
|
||||
aperture: f64,
|
||||
aperture_y: f64,
|
||||
// The rotation of the camera
|
||||
center: Vector3<f64>,
|
||||
w2m_rot: Rotation<f64>,
|
||||
@@ -78,6 +79,9 @@ pub struct CameraViewPort {
|
||||
pub(crate) min_fov: Option<f64>,
|
||||
// an optional max field of view
|
||||
pub(crate) max_fov: Option<f64>,
|
||||
|
||||
scissor_w: f64,
|
||||
scissor_h: f64,
|
||||
}
|
||||
use al_api::coo_system::CooSystem;
|
||||
use al_core::WebGlContext;
|
||||
@@ -104,6 +108,7 @@ impl CameraViewPort {
|
||||
let last_user_action = UserAction::Starting;
|
||||
|
||||
let aperture = projection.aperture_start().to_radians();
|
||||
let aperture_y = aperture;
|
||||
|
||||
let w2m = Matrix3::identity();
|
||||
let m2w = w2m;
|
||||
@@ -127,6 +132,9 @@ impl CameraViewPort {
|
||||
let width = width * dpi;
|
||||
let height = height * dpi;
|
||||
|
||||
let scissor_w = width as f64;
|
||||
let scissor_h = height as f64;
|
||||
|
||||
let aspect = height / width;
|
||||
let ndc_to_clip = Vector2::new(1.0, (height as f64) / (width as f64));
|
||||
let zoom_factor = 1.0;
|
||||
@@ -144,6 +152,8 @@ impl CameraViewPort {
|
||||
CameraViewPort {
|
||||
// The field of view angle
|
||||
aperture,
|
||||
aperture_y,
|
||||
|
||||
center,
|
||||
// The rotation of the cameraq
|
||||
w2m_rot,
|
||||
@@ -187,6 +197,9 @@ impl CameraViewPort {
|
||||
|
||||
min_fov: None,
|
||||
max_fov: None,
|
||||
|
||||
scissor_w,
|
||||
scissor_h,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +259,7 @@ impl CameraViewPort {
|
||||
}
|
||||
}
|
||||
|
||||
fn recompute_scissor(&self) {
|
||||
fn recompute_scissor(&mut self) {
|
||||
// Clear all the screen before updating the scissor
|
||||
//self.gl.scissor(0, 0, self.width as i32, self.height as i32);
|
||||
//self.gl.clear(web_sys::WebGl2RenderingContext::COLOR_BUFFER_BIT);
|
||||
@@ -274,6 +287,9 @@ impl CameraViewPort {
|
||||
let w = (tr_s.x - tl_s.x).min(self.width as f64);
|
||||
let h = (br_s.y - tr_s.y).min(self.height as f64);
|
||||
|
||||
self.scissor_w = w;
|
||||
self.scissor_h = h;
|
||||
|
||||
// Specify a scissor here
|
||||
self.gl.scissor(
|
||||
(tl_s.x as i32).max(0),
|
||||
@@ -284,6 +300,7 @@ impl CameraViewPort {
|
||||
}
|
||||
|
||||
pub fn set_screen_size(&mut self, width: f32, height: f32, projection: &ProjectionType) {
|
||||
let old_w = self.width;
|
||||
self.width = width * self.dpi;
|
||||
self.height = height * self.dpi;
|
||||
|
||||
@@ -291,8 +308,9 @@ impl CameraViewPort {
|
||||
// Compute the new clip zoom factor
|
||||
self.compute_ndc_to_clip_factor(projection);
|
||||
|
||||
self.fov
|
||||
.set_aperture(&self.ndc_to_clip, self.zoom_factor, &self.w2m, projection);
|
||||
self.set_zoom_factor(self.zoom_factor * ((self.width / old_w) as f64), projection);
|
||||
|
||||
//self.set_aperture(self.aperture * ((self.width / old_w) as f64), projection);
|
||||
|
||||
let proj_area = projection.get_area();
|
||||
self.is_allsky = !proj_area.is_in(&math::projection::ndc_to_clip_space(
|
||||
@@ -445,6 +463,12 @@ impl CameraViewPort {
|
||||
// Limit later the aperture to aperture_start
|
||||
self.aperture = aperture.min(aperture_start);
|
||||
|
||||
if self.scissor_h < (self.height - 1.0).into() {
|
||||
self.aperture_y = aperture_start;
|
||||
} else {
|
||||
self.aperture_y = self.aperture / (self.aspect as f64);
|
||||
}
|
||||
|
||||
// Project this vertex into the screen
|
||||
self.moved = true;
|
||||
self.zoomed = true;
|
||||
@@ -539,6 +563,12 @@ impl CameraViewPort {
|
||||
|
||||
self.aperture = aperture;
|
||||
|
||||
if self.scissor_h < (self.height - 1.0).into() {
|
||||
self.aperture_y = aperture_start;
|
||||
} else {
|
||||
self.aperture_y = self.aperture / (self.aspect as f64);
|
||||
}
|
||||
|
||||
// Project this vertex into the screen
|
||||
self.moved = true;
|
||||
self.zoomed = true;
|
||||
@@ -610,7 +640,6 @@ impl CameraViewPort {
|
||||
Err(idx) => idx,
|
||||
};
|
||||
|
||||
//al_core::log(&format!("{:?}", depth_pixel));
|
||||
const DEPTH_OFFSET_TEXTURE: usize = 9;
|
||||
self.texture_depth = if DEPTH_OFFSET_TEXTURE > depth_pixel {
|
||||
0_u8
|
||||
@@ -799,6 +828,11 @@ impl CameraViewPort {
|
||||
self.aperture
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_aperture_y(&self) -> f64 {
|
||||
self.aperture_y
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_center(&self) -> &Vector3<f64> {
|
||||
&self.center
|
||||
|
||||
+2
-2
@@ -465,9 +465,9 @@ impl WebClient {
|
||||
|
||||
/// Get the field of the view in degrees
|
||||
#[wasm_bindgen(js_name = getFieldOfView)]
|
||||
pub fn get_fov(&self) -> Result<f64, JsValue> {
|
||||
pub fn get_fov(&self) -> Result<Vec<f64>, JsValue> {
|
||||
let fov = self.app.get_fov();
|
||||
Ok(fov)
|
||||
Ok(fov.into())
|
||||
}
|
||||
|
||||
/// Get the max aperture of a projection (in degrees)
|
||||
|
||||
@@ -796,28 +796,27 @@ impl HiPS2D {
|
||||
let config = self.get_config();
|
||||
|
||||
let ImageMetadata {
|
||||
color,
|
||||
opacity,
|
||||
blend_cfg,
|
||||
blending,
|
||||
colormap,
|
||||
..
|
||||
} = cfg;
|
||||
|
||||
// Get the colormap from the color
|
||||
let cmap = colormaps.get(color.cmap_name.as_ref());
|
||||
let colormap = colormaps.get(colormap.as_ref());
|
||||
|
||||
blend_cfg.enable(&self.gl, || {
|
||||
blending.enable(&self.gl, || {
|
||||
if draw_allsky {
|
||||
let w2v = c * (*camera.get_w2m());
|
||||
|
||||
let shader = get_raytracer_shader(cmap, &self.gl, shaders, config)?;
|
||||
let shader = get_raytracer_shader(colormap, &self.gl, shaders, config)?;
|
||||
|
||||
let shader = shader.bind(&self.gl);
|
||||
shader
|
||||
.attach_uniforms_from(camera)
|
||||
.attach_uniforms_from(&self.buffer)
|
||||
// send the cmap appart from the color config
|
||||
.attach_uniforms_with_params_from(cmap, colormaps)
|
||||
.attach_uniforms_from(color)
|
||||
.attach_uniforms_with_params_from(cfg, colormaps)
|
||||
.attach_uniform("model", &w2v)
|
||||
.attach_uniform("current_time", &utils::get_current_time())
|
||||
.attach_uniform(
|
||||
@@ -851,13 +850,13 @@ impl HiPS2D {
|
||||
// - The UVs are changed if:
|
||||
// * new cells are added/removed (because new cells are added)
|
||||
// * there are new available tiles for the GPU
|
||||
let shader = get_raster_shader(cmap, &self.gl, shaders, config)?.bind(&self.gl);
|
||||
let shader = get_raster_shader(colormap, &self.gl, shaders, config)?.bind(&self.gl);
|
||||
|
||||
shader
|
||||
.attach_uniforms_from(&self.buffer)
|
||||
// send the cmap appart from the color config
|
||||
.attach_uniforms_with_params_from(cmap, colormaps)
|
||||
.attach_uniforms_from(color)
|
||||
.attach_uniforms_with_params_from(colormap, colormaps)
|
||||
.attach_uniforms_from(cfg)
|
||||
.attach_uniforms_from(camera)
|
||||
.attach_uniform("inv_model", &v2w)
|
||||
.attach_uniform("current_time", &utils::get_current_time())
|
||||
|
||||
@@ -1064,13 +1064,13 @@ impl HiPS3D {
|
||||
}
|
||||
|
||||
let ImageMetadata {
|
||||
color,
|
||||
colormap,
|
||||
opacity,
|
||||
blend_cfg,
|
||||
blending,
|
||||
..
|
||||
} = cfg;
|
||||
|
||||
let cmap = colormaps.get(color.cmap_name.as_ref());
|
||||
let colormap = colormaps.get(colormap.as_ref());
|
||||
|
||||
let v2w = (*camera.get_m2w()) * c.transpose();
|
||||
|
||||
@@ -1090,7 +1090,7 @@ impl HiPS3D {
|
||||
|
||||
let shader = get_raster_shader(&self.gl, shaders, hips_cfg)?;
|
||||
for (cell, num_indices) in self.cells.iter().zip(self.num_indices.iter()) {
|
||||
blend_cfg.enable(&self.gl, || {
|
||||
blending.enable(&self.gl, || {
|
||||
// Bind the shader at each draw of a cell to not exceed the max number of tex image units bindable
|
||||
// to a shader. It is 32 in my case
|
||||
let shaderbound = shader.bind(&self.gl);
|
||||
@@ -1098,8 +1098,8 @@ impl HiPS3D {
|
||||
shaderbound
|
||||
.attach_uniform("tex", &self.buffer.get(cell).unwrap_abort().texture)
|
||||
.attach_uniforms_from(&self.buffer)
|
||||
.attach_uniforms_with_params_from(cmap, colormaps)
|
||||
.attach_uniforms_from(color)
|
||||
.attach_uniforms_with_params_from(colormap, colormaps)
|
||||
.attach_uniforms_from(cfg)
|
||||
.attach_uniforms_from(camera)
|
||||
.attach_uniform("inv_model", &v2w)
|
||||
.attach_uniform("opacity", opacity)
|
||||
|
||||
@@ -722,10 +722,7 @@ impl Image {
|
||||
//self.gl.enable(WebGl2RenderingContext::BLEND);
|
||||
|
||||
let ImageMetadata {
|
||||
color,
|
||||
opacity,
|
||||
blend_cfg,
|
||||
..
|
||||
opacity, blending, ..
|
||||
} = cfg;
|
||||
|
||||
let shader = match self.pixel_type {
|
||||
@@ -758,7 +755,7 @@ impl Image {
|
||||
//self.gl.disable(WebGl2RenderingContext::CULL_FACE);
|
||||
|
||||
// 2. Draw it if its opacity is not null
|
||||
blend_cfg.enable(&self.gl, || {
|
||||
blending.enable(&self.gl, || {
|
||||
let mut off_indices = 0;
|
||||
for &idx_tex in self.idx_tex.iter() {
|
||||
let texture = &self.textures[idx_tex];
|
||||
@@ -767,7 +764,7 @@ impl Image {
|
||||
let shader_bound = shader.bind(&self.gl);
|
||||
|
||||
shader_bound
|
||||
.attach_uniforms_with_params_from(color, colormaps)
|
||||
.attach_uniforms_with_params_from(cfg, colormaps)
|
||||
.attach_uniform("opacity", opacity)
|
||||
.attach_uniform("tex", texture)
|
||||
.attach_uniform("scale", &self.bscale)
|
||||
|
||||
@@ -103,8 +103,8 @@ pub struct ImageLayer {
|
||||
pub layer: String,
|
||||
pub id: String,
|
||||
pub images: Vec<Image>,
|
||||
/// Its color
|
||||
pub meta: ImageMetadata,
|
||||
/// Display options
|
||||
pub options: ImageMetadata,
|
||||
}
|
||||
|
||||
impl ImageLayer {
|
||||
@@ -464,7 +464,8 @@ impl Layers {
|
||||
layer,
|
||||
id,
|
||||
images,
|
||||
meta,
|
||||
options,
|
||||
..
|
||||
} = image;
|
||||
|
||||
// 1. Add the layer name
|
||||
@@ -479,7 +480,7 @@ impl Layers {
|
||||
self.layers.insert(idx, layer.to_string());
|
||||
|
||||
// 2. Add the meta information of the layer
|
||||
self.meta.insert(layer.clone(), meta);
|
||||
self.meta.insert(layer.clone(), options);
|
||||
|
||||
// 3. Add the fits image
|
||||
// The layer does not already exist
|
||||
|
||||
+7865
-207
File diff suppressed because it is too large
Load Diff
+32
-21
@@ -3,7 +3,7 @@
|
||||
border: 0px solid #ddd;
|
||||
/* SVG inside divs add a 4px height: https://stackoverflow.com/questions/75751593/why-there-is-additional-4px-height-for-div-when-there-is-svg-inside-it */
|
||||
/* disable x swipe on chrome, firefox */
|
||||
/* see. https://stackoverflow.com/questions/30636930/disable-web-page-navigation-on-swipeback-and-forward */
|
||||
/* Prevent page navigation swipe on windows phone: https://stackoverflow.com/questions/30636930/disable-web-page-navigation-on-swipeback-and-forward */
|
||||
overscroll-behavior-x: none;
|
||||
overscroll-behavior-y: none; /* Prevents vertical pull-to-refresh */
|
||||
/* Hide the draggable boxes that goes out of the view */
|
||||
@@ -15,7 +15,7 @@
|
||||
font-size: 0.9rem;
|
||||
|
||||
/* Aladin lite default color */
|
||||
--aladin-color: #b232b2;
|
||||
--aladin-color: #ff54ff;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
@@ -114,27 +114,30 @@
|
||||
background: black;
|
||||
}
|
||||
|
||||
.aladin-lite-spectra-displayer .aladin-spectra-unit-selector {
|
||||
.aladin-spectra-displayer {
|
||||
position: absolute;
|
||||
bottom: 3rem;
|
||||
right: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
.aladin-lite-spectra-displayer .aladin-spectra-home {
|
||||
|
||||
.aladin-spectra-displayer .aladin-spectra-unit {
|
||||
position: absolute;
|
||||
bottom: 5rem;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
right: 8rem;
|
||||
}
|
||||
.aladin-lite-spectra-displayer .aladin-spectra-extraction {
|
||||
.aladin-spectra-displayer .aladin-spectra-home {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 6rem;
|
||||
}
|
||||
.aladin-spectra-displayer .aladin-spectra-extraction {
|
||||
position: absolute;
|
||||
bottom: 7rem;
|
||||
right: 0;
|
||||
}
|
||||
.aladin-lite-spectra-displayer .aladin-spectra-hips-selector {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
max-width: 10rem;
|
||||
}
|
||||
|
||||
.aladin-imageCanvas {
|
||||
position: absolute;
|
||||
@@ -1302,14 +1305,21 @@ otherwise it fits its content options. If those are too big the select can go ou
|
||||
line-height: 1.7rem;
|
||||
}
|
||||
|
||||
.aladin-fov .aladin-zoom-out {
|
||||
margin-right: 0;
|
||||
border-right: none;
|
||||
border-radius: 0.4rem 0px 0px 0.4rem;
|
||||
.aladin-zoom {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.aladin-fov .aladin-zoom-in {
|
||||
border-radius: 0px 0.4rem 0.4rem 0px;
|
||||
.aladin-zoom-out {
|
||||
margin-right: 0;
|
||||
border-top: none;
|
||||
border-radius: 0 0 0.4rem 0.4rem;
|
||||
}
|
||||
|
||||
.aladin-zoom-in {
|
||||
border-radius: 0.4rem 0.4rem 0 0;
|
||||
}
|
||||
|
||||
.aladin-status-bar {
|
||||
@@ -1348,6 +1358,7 @@ otherwise it fits its content options. If those are too big the select can go ou
|
||||
position: absolute;
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 5rem;
|
||||
left: 0.2rem;
|
||||
}
|
||||
|
||||
.aladin-widgets-toolbar > * {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
layout (location = 0) in vec2 offset;
|
||||
layout (location = 1) in vec2 uv;
|
||||
layout (location = 2) in vec3 center;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
layout (location = 0) in vec2 offset;
|
||||
layout (location = 1) in vec2 uv;
|
||||
layout (location = 2) in vec3 center;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
|
||||
in vec2 out_uv;
|
||||
in vec3 out_p;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 offset;
|
||||
layout (location = 1) in vec2 uv;
|
||||
layout (location = 2) in vec3 center;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
layout (location = 0) in vec2 offset;
|
||||
layout (location = 1) in vec2 uv;
|
||||
layout (location = 2) in vec3 center;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
layout (location = 0) in vec2 offset;
|
||||
layout (location = 1) in vec2 uv;
|
||||
layout (location = 2) in vec3 center;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
|
||||
in vec2 out_uv;
|
||||
in vec3 out_p;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
layout (location = 0) in vec2 offset;
|
||||
layout (location = 1) in vec2 uv;
|
||||
layout (location = 2) in vec3 center;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 offset;
|
||||
layout (location = 1) in vec2 uv;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2D;
|
||||
precision highp float;
|
||||
precision highp sampler2D;
|
||||
|
||||
in vec2 out_uv;
|
||||
out vec4 color;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2D;
|
||||
precision highp float;
|
||||
precision highp sampler2D;
|
||||
|
||||
layout (location = 0) in vec2 position;
|
||||
layout (location = 1) in vec2 uv;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2D;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2D;
|
||||
precision highp int;
|
||||
|
||||
out vec4 out_frag_color;
|
||||
in vec2 frag_uv;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2D;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2D;
|
||||
precision highp int;
|
||||
|
||||
out vec4 out_frag_color;
|
||||
in vec2 frag_uv;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2D;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2D;
|
||||
precision highp int;
|
||||
|
||||
out vec4 out_frag_color;
|
||||
in vec2 frag_uv;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
|
||||
out vec4 out_frag_color;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
|
||||
layout (location = 0) in vec2 pos_clip_space;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
precision highp int;
|
||||
|
||||
in vec3 frag_pos;
|
||||
in vec2 out_clip_pos;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
precision highp int;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision lowp usampler2DArray;
|
||||
precision lowp isampler2DArray;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
precision highp usampler2DArray;
|
||||
precision highp isampler2DArray;
|
||||
precision highp int;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
|
||||
layout (location = 0) in vec2 pos_clip_space;
|
||||
layout (location = 1) in vec3 pos_world_space;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
precision highp int;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision lowp sampler2DArray;
|
||||
precision lowp isampler2DArray;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
precision highp sampler2DArray;
|
||||
precision highp isampler2DArray;
|
||||
precision highp int;
|
||||
|
||||
in vec3 frag_pos;
|
||||
in vec2 out_clip_pos;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler2DArray;
|
||||
precision lowp usampler2DArray;
|
||||
precision lowp isampler2DArray;
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
precision highp sampler2DArray;
|
||||
precision highp usampler2DArray;
|
||||
precision highp isampler2DArray;
|
||||
precision highp int;
|
||||
|
||||
uniform sampler2DArray tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler3D;
|
||||
precision highp float;
|
||||
precision highp sampler3D;
|
||||
|
||||
uniform sampler3D tex;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler3D;
|
||||
precision lowp isampler3D;
|
||||
precision lowp usampler3D;
|
||||
precision highp float;
|
||||
precision highp sampler3D;
|
||||
precision highp isampler3D;
|
||||
precision highp usampler3D;
|
||||
|
||||
uniform sampler3D tex;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler3D;
|
||||
precision lowp isampler3D;
|
||||
precision lowp usampler3D;
|
||||
precision highp float;
|
||||
precision highp sampler3D;
|
||||
precision highp isampler3D;
|
||||
precision highp usampler3D;
|
||||
|
||||
uniform sampler3D tex;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 lonlat;
|
||||
layout (location = 1) in vec3 uv;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler3D;
|
||||
precision lowp isampler3D;
|
||||
precision lowp usampler3D;
|
||||
precision highp float;
|
||||
precision highp sampler3D;
|
||||
precision highp isampler3D;
|
||||
precision highp usampler3D;
|
||||
|
||||
uniform sampler3D tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
precision lowp float;
|
||||
precision lowp sampler3D;
|
||||
precision highp float;
|
||||
precision highp sampler3D;
|
||||
|
||||
uniform sampler3D tex;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 300 es
|
||||
|
||||
precision lowp float;
|
||||
precision highp float;
|
||||
out vec4 color;
|
||||
|
||||
uniform vec4 u_color;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp float;
|
||||
|
||||
in vec2 v_tc;
|
||||
out vec4 color;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp float;
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
out vec2 v_tc;
|
||||
|
||||
+2
-3
@@ -29,7 +29,6 @@
|
||||
* Author: Thomas Boch[CDS]
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
import { MOC } from "./MOC.js";
|
||||
import { GraphicOverlay } from "./Overlay.js";
|
||||
import { Circle } from "./shapes/Circle.js";
|
||||
@@ -58,7 +57,6 @@ import aladinCSS from './../css/aladin.css?inline';
|
||||
///////////////////////////////
|
||||
/////// Aladin Lite API ///////
|
||||
///////////////////////////////
|
||||
|
||||
/**
|
||||
* @namespace A
|
||||
* @description Aladin Lite API namespace for creating celestial objects.
|
||||
@@ -1062,6 +1060,7 @@ A.Utils = AladinUtils;
|
||||
* console.error('Error initializing Aladin Lite:', error);
|
||||
* });
|
||||
*/
|
||||
|
||||
A.init = (async () => {
|
||||
const isWebGL2Supported = document
|
||||
.createElement('canvas')
|
||||
@@ -1076,6 +1075,6 @@ A.init = (async () => {
|
||||
// According to caniuse, https://caniuse.com/webgl2, webgl2 is supported by 89% of users
|
||||
throw "WebGL2 not supported by your browser";
|
||||
}
|
||||
})();
|
||||
})()
|
||||
|
||||
export default A;
|
||||
|
||||
+84
-70
@@ -74,6 +74,7 @@ import { SimbadPointer } from "./gui/Button/SimbadPointer";
|
||||
import { ColorPicker } from "./gui/Button/ColorPicker";
|
||||
import { GridEnabler } from "./gui/Button/GridEnabler";
|
||||
import { CooFrame } from "./gui/Input/CooFrame";
|
||||
import { SelectionMode } from "./gui/Button/SelectionMode";
|
||||
import { Circle } from "./shapes/Circle";
|
||||
import { Ellipse } from "./shapes/Ellipse";
|
||||
import { Polyline } from "./shapes/Polyline";
|
||||
@@ -110,6 +111,8 @@ import { Polyline } from "./shapes/Polyline";
|
||||
* CSS class for that button is `aladin-grid-control`
|
||||
* @property {boolean} [showSettingsControl=false] - Whether to show the settings control toolbar.
|
||||
* CSS class for that button is `aladin-settings-control`
|
||||
* @property {boolean} [showSelectionModeControl=false] - Whether to show the selection mode menu opener button.
|
||||
* CSS class for that button is `aladin-selectionMode-control`
|
||||
* @property {boolean} [showColorPickerControl=false] - Whether to show the color picker tool.
|
||||
* CSS class for that button is `aladin-colorPicker-control`
|
||||
* @property {boolean} [showShareControl=false] - Whether to show the share control toolbar.
|
||||
@@ -155,6 +158,7 @@ import { Polyline } from "./shapes/Polyline";
|
||||
* @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 {string} [selectionMode="edge"] - When set to 'skewer' footprints are selected by clicking inside them. For 'edge' footprints are selected by clicking on their edges.
|
||||
* @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.
|
||||
@@ -407,7 +411,6 @@ export let Aladin = (function () {
|
||||
|
||||
// Aladin logo
|
||||
new AladinLogo(this.aladinDiv);
|
||||
|
||||
this.reticle = new Reticle(this.options, this);
|
||||
this.popup = new Popup(this.aladinDiv, this.view);
|
||||
this.tooltip = document.createElement('div')
|
||||
@@ -453,7 +456,7 @@ export let Aladin = (function () {
|
||||
}
|
||||
|
||||
// Format the hipslist given by the user before storing it in the aladin instance
|
||||
this.hipsFavorites = [];
|
||||
this.layerFavorites = [];
|
||||
let hipsList = [].concat(options.hipsList);
|
||||
|
||||
for (var hips of hipsList) {
|
||||
@@ -498,9 +501,11 @@ export let Aladin = (function () {
|
||||
hipsObj["name"] = name;
|
||||
}
|
||||
|
||||
hipsObj["type"] = "hips";
|
||||
|
||||
// Merge what is already in the cache for that HiPS with new properties
|
||||
// coming from the MOCServer
|
||||
this.hipsFavorites.push(hipsObj);
|
||||
this.layerFavorites.push(hipsObj);
|
||||
// Favorites are also directly pushed to the cache
|
||||
this.hipsCache.append(hipsObj.id, hipsObj)
|
||||
}
|
||||
@@ -511,7 +516,7 @@ export let Aladin = (function () {
|
||||
|
||||
this._setupUI(options);
|
||||
|
||||
ALEvent.FAVORITE_HIPS_LIST_UPDATED.dispatchedTo(document.body, this.hipsFavorites);
|
||||
ALEvent.FAVORITE_LAYERS_LIST_UPDATED.dispatchedTo(document, this.layerFavorites);
|
||||
|
||||
if (options.survey) {
|
||||
if (Array.isArray(options.survey)) {
|
||||
@@ -673,15 +678,19 @@ export let Aladin = (function () {
|
||||
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
|
||||
// Show selection mode control
|
||||
if (options.showSelectionModeControl) {
|
||||
let selectionMode = new SelectionMode(this);
|
||||
widgets["selectionMode"] = selectionMode
|
||||
}
|
||||
|
||||
// Add the color picker control
|
||||
if (options.showColorPickerControl) {
|
||||
let picker = new ColorPicker(this);
|
||||
widgets["picker"] = picker;
|
||||
@@ -697,6 +706,7 @@ export let Aladin = (function () {
|
||||
this.toolbar.add(name, widget);
|
||||
}
|
||||
|
||||
// Add the projection control
|
||||
if (options.showProjectionControl) {
|
||||
this.projBtn = new ProjectionActionButton(this);
|
||||
this.addUI(this.projBtn);
|
||||
@@ -759,9 +769,6 @@ export let Aladin = (function () {
|
||||
/**** CONSTANTS ****/
|
||||
Aladin.VERSION = version;
|
||||
|
||||
Aladin.JSONP_PROXY = "https://alaskybis.cds.unistra.fr/cgi/JSONProxy";
|
||||
//Aladin.JSONP_PROXY = "https://alaskybis.unistra.fr/cgi/JSONProxy";
|
||||
|
||||
Aladin.URL_PREVIEWER = "https://aladin.cds.unistra.fr/AladinLite/";
|
||||
|
||||
// access to WASM libraries
|
||||
@@ -786,6 +793,7 @@ export let Aladin = (function () {
|
||||
showSimbadPointerControl: false,
|
||||
showCooGridControl: false,
|
||||
showSettingsControl: false,
|
||||
showSelectionModeControl: false,
|
||||
showColorPickerControl: false,
|
||||
// Share toolbar
|
||||
showShareControl: false,
|
||||
@@ -804,10 +812,10 @@ export let Aladin = (function () {
|
||||
showCatalog: true, // TODO: still used ??
|
||||
|
||||
fullScreen: false,
|
||||
reticleColor: "rgb(178, 50, 178)",
|
||||
reticleColor: "#ff54ff",
|
||||
reticleSize: 22,
|
||||
gridColor: "rgb(178, 50, 178)",
|
||||
gridOpacity: 0.8,
|
||||
gridColor: "#ff54ff",
|
||||
gridOpacity: 1.0,
|
||||
gridOptions: {
|
||||
enabled: false,
|
||||
showLabels: true,
|
||||
@@ -1751,7 +1759,7 @@ export let Aladin = (function () {
|
||||
maxOrder,
|
||||
options
|
||||
) {
|
||||
let hipsOptions = { id, name, maxOrder, url, cooFrame, ...options };
|
||||
let hipsOptions = { id, name, maxOrder, url, cooFrame, type: "hips", ...options };
|
||||
let hips = new HiPS(id, url || id, hipsOptions)
|
||||
|
||||
// A HiPS can be refered by its unique ID thus we add it to the cache (cf excample/al-cfht.html that refers to HiPS object just by their unique ID)
|
||||
@@ -1787,7 +1795,7 @@ export let Aladin = (function () {
|
||||
* Remove a HiPS from the list of favorites.
|
||||
*
|
||||
* This send a event of type
|
||||
* FAVORITE_HIPS_LIST_UPDATED which can be listened to
|
||||
* FAVORITE_LAYERS_LIST_UPDATED which can be listened to
|
||||
*
|
||||
* @throws A warning when the asset is currently present in the view
|
||||
*
|
||||
@@ -1807,7 +1815,7 @@ export let Aladin = (function () {
|
||||
}
|
||||
|
||||
// find the index of the hips to remove
|
||||
const idx = this.hipsFavorites.findIndex((hipsObj) => {
|
||||
const idx = this.layerFavorites.findIndex((hipsObj) => {
|
||||
if (typeof hips !== "string") {
|
||||
return hipsObj.name == hips.name || hipsObj.id == hips.id || hipsObj.url == hips.url;
|
||||
} else {
|
||||
@@ -1817,9 +1825,9 @@ export let Aladin = (function () {
|
||||
|
||||
// a hips matches
|
||||
if (idx >= 0) {
|
||||
this.hipsFavorites.splice(idx, 1);
|
||||
this.layerFavorites.splice(idx, 1);
|
||||
// Send a change of favorites for the UI selector to adapt their optional list
|
||||
ALEvent.FAVORITE_HIPS_LIST_UPDATED.dispatchedTo(document.body, this.hipsFavorites);
|
||||
ALEvent.FAVORITE_LAYERS_LIST_UPDATED.dispatchedTo(document, this.layerFavorites);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1827,19 +1835,19 @@ export let Aladin = (function () {
|
||||
* Add a HiPS to the list of favorites.
|
||||
*
|
||||
* If already present it will not add it again. This send a event of type
|
||||
* FAVORITE_HIPS_LIST_UPDATED which can be listened to. Once added, the favorite list
|
||||
* FAVORITE_LAYERS_LIST_UPDATED which can be listened to. Once added, the favorite list
|
||||
* will be sorted by the name of the hips.
|
||||
*
|
||||
* @memberof Aladin
|
||||
* @param {HiPS} hips - The HiPS to add to the favorites
|
||||
* @param {HiPS|Image} layer - The HiPS to add to the favorites
|
||||
*/
|
||||
Aladin.prototype.addHiPSToFavorites = function(hips) {
|
||||
Aladin.prototype.addHiPSToFavorites = function(layer) {
|
||||
// find the index of the hips to remove
|
||||
const idx = this.hipsFavorites.findIndex((hipsObj) => {
|
||||
if (typeof hips !== "string") {
|
||||
return hipsObj.name == hips.name || hipsObj.id == hips.id || hipsObj.url == hips.url;
|
||||
const idx = this.layerFavorites.findIndex((obj) => {
|
||||
if (typeof layer !== "string") {
|
||||
return obj.id == layer.id;
|
||||
} else {
|
||||
return hipsObj.name == hips || hipsObj.id == hips || hipsObj.url == hips;
|
||||
return obj.id == layer;
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1849,14 +1857,14 @@ export let Aladin = (function () {
|
||||
}
|
||||
|
||||
// add the new favorite HiPS
|
||||
this.hipsFavorites.push({
|
||||
url: hips.url,
|
||||
id: hips.id,
|
||||
name: hips.name,
|
||||
this.layerFavorites.push({
|
||||
url: layer.url,
|
||||
id: layer.id,
|
||||
name: layer.name,
|
||||
})
|
||||
|
||||
// send the final event
|
||||
ALEvent.FAVORITE_HIPS_LIST_UPDATED.dispatchedTo(document.body, this.hipsFavorites);
|
||||
ALEvent.FAVORITE_LAYERS_LIST_UPDATED.dispatchedTo(document, this.layerFavorites);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1950,7 +1958,7 @@ export let Aladin = (function () {
|
||||
return this.createImageSurvey(
|
||||
id,
|
||||
options && options.name,
|
||||
id,
|
||||
options && options.url || id,
|
||||
options && options.cooFrame,
|
||||
options && options.maxOrder,
|
||||
options
|
||||
@@ -1982,6 +1990,11 @@ export let Aladin = (function () {
|
||||
Aladin.prototype.addNewImageLayer = function (survey = "P/DSS2/color") {
|
||||
let layerName = Utils.uuidv4();
|
||||
return this.setOverlayImageLayer(survey, layerName);
|
||||
//let newHiPS = A.HiPS(survey);
|
||||
//newHiPS.id = this.hipsCache.makeUniqLayerName(newHiPS.id);
|
||||
//newHiPS.name = newHiPS.id;
|
||||
|
||||
//return this.setOverlayImageLayer(newHiPS, layerName);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2080,7 +2093,14 @@ export let Aladin = (function () {
|
||||
* </ul>
|
||||
*/
|
||||
Aladin.prototype.setBaseImageLayer = function (urlOrHiPSOrFITS) {
|
||||
return this.setOverlayImageLayer(urlOrHiPSOrFITS, (this.view.overlayLayers && this.view.overlayLayers[0]) || Utils.uuidv4());
|
||||
/*if (this.view._waitsForLayer()) {
|
||||
// delay this call
|
||||
this.view.delayedBaseLayerCalledParams = urlOrHiPSOrFITS;
|
||||
return;
|
||||
}*/
|
||||
let firstLayer = this.view.getFirstLayer();
|
||||
|
||||
return this.setOverlayImageLayer(urlOrHiPSOrFITS, firstLayer || Utils.uuidv4());
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2090,7 +2110,9 @@ export let Aladin = (function () {
|
||||
* @returns {HiPS|Image} - Returns the image layer corresponding to the base layer
|
||||
*/
|
||||
Aladin.prototype.getBaseImageLayer = function () {
|
||||
return this.view.getImageLayer(this.view.overlayLayers && this.view.overlayLayers[0]);
|
||||
let firstLayer = this.view.getFirstLayer();
|
||||
|
||||
return this.view.getImageLayer(firstLayer);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2108,7 +2130,7 @@ export let Aladin = (function () {
|
||||
* on top the 'base' layer. If the layer is already present in the view, it will be replaced by the new HiPS/FITS image given here.
|
||||
*/
|
||||
Aladin.prototype.setOverlayImageLayer = function (
|
||||
urlOrHiPSOrFITS,
|
||||
urlOrHiPSOrImage,
|
||||
layer = "overlay"
|
||||
) {
|
||||
let imageLayer;
|
||||
@@ -2116,14 +2138,17 @@ export let Aladin = (function () {
|
||||
let hipsCache = this.hipsCache;
|
||||
|
||||
// 1. User gives an ID
|
||||
if (typeof urlOrHiPSOrFITS === "string") {
|
||||
const idOrUrl = urlOrHiPSOrFITS;
|
||||
if (typeof urlOrHiPSOrImage === "string") {
|
||||
const idOrUrl = urlOrHiPSOrImage;
|
||||
// many cases here
|
||||
// 1/ It has been already added to the cache
|
||||
let cachedOptions = hipsCache.get(idOrUrl)
|
||||
|
||||
if (cachedOptions) {
|
||||
imageLayer = A.HiPS(idOrUrl, cachedOptions);
|
||||
if (cachedOptions.type === "hips") {
|
||||
imageLayer = A.HiPS(idOrUrl, cachedOptions)
|
||||
} else if (cachedOptions.type === "image") {
|
||||
imageLayer = A.image(idOrUrl, cachedOptions);
|
||||
}
|
||||
} else {
|
||||
// 2/ Not in the cache, then we create the hips from this url/id and
|
||||
// go to the case 3
|
||||
@@ -2133,17 +2158,20 @@ export let Aladin = (function () {
|
||||
}
|
||||
} else {
|
||||
// 3/ It is an image survey.
|
||||
imageLayer = urlOrHiPSOrFITS;
|
||||
imageLayer = urlOrHiPSOrImage;
|
||||
|
||||
if (imageLayer instanceof HiPS) {
|
||||
let cachedLayerOptions = hipsCache.get(imageLayer.id)
|
||||
let cachedLayerOptions = hipsCache.get(imageLayer.id)
|
||||
|
||||
if (!cachedLayerOptions) {
|
||||
hipsCache.append(imageLayer.id, imageLayer.options)
|
||||
} else {
|
||||
// Set the image layer object with the options from the cache.
|
||||
imageLayer.setOptions(cachedLayerOptions)
|
||||
if (!cachedLayerOptions) {
|
||||
let type = "hips";
|
||||
if (imageLayer instanceof Image) {
|
||||
type = "image";
|
||||
}
|
||||
|
||||
hipsCache.append(imageLayer.id, {...imageLayer.options, type})
|
||||
} else {
|
||||
// Set the image layer object with the options from the cache.
|
||||
imageLayer.setOptions(cachedLayerOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2183,7 +2211,7 @@ export let Aladin = (function () {
|
||||
* view in the counter clockwise order (or towards the east)
|
||||
*/
|
||||
Aladin.prototype.setRotation = function (rotation) {
|
||||
if (!rotation) {
|
||||
if (!Utils.isNumber(rotation)) {
|
||||
console.warn("Rotation angle is not valid:", rotation)
|
||||
return;
|
||||
}
|
||||
@@ -2777,18 +2805,13 @@ export let Aladin = (function () {
|
||||
*/
|
||||
Aladin.prototype.pix2world = function (x, y, frame) {
|
||||
if (frame) {
|
||||
frame = CooFrameEnum.fromString(frame, CooFrameEnum.ICRS);
|
||||
if (typeof frame === "string") {
|
||||
frame = CooFrameEnum.fromString(frame, CooFrameEnum.ICRS);
|
||||
}
|
||||
}
|
||||
let [lon, lat] = this.view.wasm.pix2world(x, y, CooFrameEnum.toWasm(frame));
|
||||
|
||||
let lonlat = this.view.wasm.pix2world(x, y, frame && frame.system);
|
||||
|
||||
let [lon, lat] = lonlat;
|
||||
|
||||
if (lon < 0) {
|
||||
return [lon + 360.0, lat];
|
||||
}
|
||||
|
||||
return [lon, lat];
|
||||
return [lon < 0 ? lon + 360.0 : lon, lat];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2805,19 +2828,13 @@ export let Aladin = (function () {
|
||||
*/
|
||||
Aladin.prototype.world2pix = function (lon, lat, frame) {
|
||||
if (frame) {
|
||||
if (frame instanceof string) {
|
||||
if (typeof frame === "string") {
|
||||
frame = CooFrameEnum.fromString(frame, CooFrameEnum.ICRS);
|
||||
}
|
||||
|
||||
if (frame.label == CooFrameEnum.SYSTEMS.GAL) {
|
||||
frame = Aladin.wasmLibs.core.CooSystem.GAL;
|
||||
}
|
||||
else {
|
||||
frame = Aladin.wasmLibs.core.CooSystem.ICRS;
|
||||
}
|
||||
}
|
||||
// frame === undefined/null → passed as-is, WASM treats as None (default system)
|
||||
|
||||
return this.view.wasm.world2pix(lon, lat, frame);
|
||||
return this.view.wasm.world2pix(lon, lat, CooFrameEnum.toWasm(frame));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2891,10 +2908,7 @@ export let Aladin = (function () {
|
||||
*/
|
||||
Aladin.prototype.getFov = function () {
|
||||
var fovX = this.view.fov;
|
||||
var s = this.getSize();
|
||||
|
||||
var fovY = (s[1] / s[0]) * fovX;
|
||||
fovY = Math.min(fovY, 180);
|
||||
var fovY = this.view.fovY;
|
||||
|
||||
return [fovX, fovY];
|
||||
};
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
// Copyright 2013 - UDS/CNRS
|
||||
|
||||
function crc32(bytes) {
|
||||
let crc = 0xffffffff;
|
||||
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
crc ^= bytes[i];
|
||||
|
||||
for (let j = 0; j < 8; j++) {
|
||||
const mask = -(crc & 1);
|
||||
crc = (crc >>> 1) ^ (0xedb88320 & mask);
|
||||
}
|
||||
}
|
||||
|
||||
return (crc ^ 0xffffffff) >>> 0;
|
||||
}
|
||||
|
||||
function u32be(n) {
|
||||
return new Uint8Array([
|
||||
(n >>> 24) & 0xff,
|
||||
(n >>> 16) & 0xff,
|
||||
(n >>> 8) & 0xff,
|
||||
n & 0xff,
|
||||
]);
|
||||
}
|
||||
|
||||
function concatUint8Arrays(arrays) {
|
||||
const total = arrays.reduce((sum, array) => sum + array.length, 0);
|
||||
const out = new Uint8Array(total);
|
||||
let offset = 0;
|
||||
|
||||
for (const array of arrays) {
|
||||
out.set(array, offset);
|
||||
offset += array.length;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function escapeXml(value) {
|
||||
return String(value)
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """);
|
||||
}
|
||||
|
||||
function renderAvmValue(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return [
|
||||
"<rdf:Seq>",
|
||||
...value.map((item) => ` <rdf:li>${escapeXml(item)}</rdf:li>`),
|
||||
"</rdf:Seq>",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
return escapeXml(value);
|
||||
}
|
||||
|
||||
function serializeFitsHeaderValue(value) {
|
||||
if (typeof value === "string") {
|
||||
return `'${value}'`;
|
||||
}
|
||||
|
||||
if (typeof value === "boolean") {
|
||||
return value ? "T" : "F";
|
||||
}
|
||||
|
||||
return `${value}`;
|
||||
}
|
||||
|
||||
function buildFitsHeaderFromWcs(wcs) {
|
||||
const orderedKeys = [
|
||||
"NAXIS",
|
||||
"NAXIS1",
|
||||
"NAXIS2",
|
||||
"CTYPE1",
|
||||
"CTYPE2",
|
||||
"CRPIX1",
|
||||
"CRPIX2",
|
||||
"CRVAL1",
|
||||
"CRVAL2",
|
||||
"CUNIT1",
|
||||
"CUNIT2",
|
||||
"CD1_1",
|
||||
"CD1_2",
|
||||
"CD2_1",
|
||||
"CD2_2",
|
||||
"PC1_1",
|
||||
"PC1_2",
|
||||
"PC2_1",
|
||||
"PC2_2",
|
||||
"CDELT1",
|
||||
"CDELT2",
|
||||
"CROTA2",
|
||||
"LONPOLE",
|
||||
"LATPOLE",
|
||||
"EQUINOX",
|
||||
"RADESYS",
|
||||
];
|
||||
|
||||
return orderedKeys
|
||||
.filter((key) => wcs[key] !== undefined && wcs[key] !== null)
|
||||
.map((key) => `${key.padEnd(8, " ")}= ${serializeFitsHeaderValue(wcs[key])}`)
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
function getCoordinateFrameFromWcs(wcs) {
|
||||
const ctype1 = `${wcs.CTYPE1 || ""}`.trim().toUpperCase();
|
||||
const ctype2 = `${wcs.CTYPE2 || ""}`.trim().toUpperCase();
|
||||
const radesys = `${wcs.RADESYS || ""}`.trim().toUpperCase();
|
||||
|
||||
if (ctype1.startsWith("GLON-") && ctype2.startsWith("GLAT-")) {
|
||||
return "GAL";
|
||||
}
|
||||
|
||||
if (ctype1.startsWith("RA---") && ctype2.startsWith("DEC--")) {
|
||||
return radesys || "ICRS";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getProjectionFromWcs(wcs) {
|
||||
const ctype1 = `${wcs.CTYPE1 || ""}`.trim().toUpperCase();
|
||||
const projection = ctype1.slice(-3);
|
||||
|
||||
return /^[A-Z0-9]{3}$/.test(projection) ? projection : null;
|
||||
}
|
||||
|
||||
export function buildAvmFromWcs(wcs, options = {}) {
|
||||
if (!wcs || typeof wcs !== "object") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const coordinateFrame = getCoordinateFrameFromWcs(wcs);
|
||||
const projection = getProjectionFromWcs(wcs);
|
||||
|
||||
if (!coordinateFrame || !projection) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const avm = {
|
||||
"MetadataVersion": "1.2",
|
||||
"Spatial.CoordinateFrame": coordinateFrame,
|
||||
"Spatial.ReferenceValue": [wcs.CRVAL1, wcs.CRVAL2],
|
||||
"Spatial.ReferenceDimension": [wcs.NAXIS1, wcs.NAXIS2],
|
||||
"Spatial.ReferencePixel": [wcs.CRPIX1, wcs.CRPIX2],
|
||||
"Spatial.CoordsystemProjection": projection,
|
||||
"Spatial.FITSheader": buildFitsHeaderFromWcs(wcs),
|
||||
};
|
||||
|
||||
if (wcs.EQUINOX !== undefined && wcs.EQUINOX !== null) {
|
||||
avm["Spatial.Equinox"] = wcs.EQUINOX;
|
||||
}
|
||||
|
||||
if (
|
||||
wcs.CD1_1 !== undefined &&
|
||||
wcs.CD1_2 !== undefined &&
|
||||
wcs.CD2_1 !== undefined &&
|
||||
wcs.CD2_2 !== undefined
|
||||
) {
|
||||
avm["Spatial.CDMatrix"] = [wcs.CD1_1, wcs.CD1_2, wcs.CD2_1, wcs.CD2_2];
|
||||
} else if (wcs.CDELT1 !== undefined && wcs.CDELT2 !== undefined) {
|
||||
avm["Spatial.Scale"] = [wcs.CDELT1, wcs.CDELT2];
|
||||
|
||||
const rotation = options.rotation ?? wcs.CROTA2;
|
||||
if (rotation !== undefined && rotation !== null) {
|
||||
avm["Spatial.Rotation"] = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
return avm;
|
||||
}
|
||||
|
||||
export function buildAvmXmpPacket(avm) {
|
||||
const entries = Object.entries(avm)
|
||||
.map(([key, value]) => ` <avm:${key}>${renderAvmValue(value)}</avm:${key}>`)
|
||||
.join("\n");
|
||||
|
||||
return [
|
||||
`<?xpacket begin="${"\uFEFF"}" id="W5M0MpCehiHzreSzNTczkc9d"?>`,
|
||||
'<x:xmpmeta xmlns:x="adobe:ns:meta/">',
|
||||
' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">',
|
||||
' <rdf:Description rdf:about="" xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">',
|
||||
entries,
|
||||
' </rdf:Description>',
|
||||
' </rdf:RDF>',
|
||||
'</x:xmpmeta>',
|
||||
'<?xpacket end="w"?>',
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
function makePngChunk(type4, data) {
|
||||
const encoder = new TextEncoder();
|
||||
const type = encoder.encode(type4);
|
||||
|
||||
if (type.length !== 4) {
|
||||
throw new Error("PNG chunk type must be 4 bytes");
|
||||
}
|
||||
|
||||
const crcInput = concatUint8Arrays([type, data]);
|
||||
const crc = crc32(crcInput);
|
||||
|
||||
return concatUint8Arrays([
|
||||
u32be(data.length),
|
||||
type,
|
||||
data,
|
||||
u32be(crc),
|
||||
]);
|
||||
}
|
||||
|
||||
function makeXmpITXtChunk(xmpString) {
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
const keyword = encoder.encode("XML:com.adobe.xmp");
|
||||
const compressionFlag = new Uint8Array([0]);
|
||||
const compressionMethod = new Uint8Array([0]);
|
||||
const languageTag = new Uint8Array([0]);
|
||||
const translatedKeyword = new Uint8Array([0]);
|
||||
const text = encoder.encode(xmpString);
|
||||
|
||||
const data = concatUint8Arrays([
|
||||
keyword,
|
||||
new Uint8Array([0]),
|
||||
compressionFlag,
|
||||
compressionMethod,
|
||||
languageTag,
|
||||
translatedKeyword,
|
||||
text,
|
||||
]);
|
||||
|
||||
return makePngChunk("iTXt", data);
|
||||
}
|
||||
|
||||
export function insertXmpIntoPng(pngBytes, xmpString) {
|
||||
if (!(pngBytes instanceof Uint8Array)) {
|
||||
throw new Error("pngBytes must be a Uint8Array");
|
||||
}
|
||||
|
||||
const pngSignature = new Uint8Array([
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
|
||||
]);
|
||||
|
||||
for (let i = 0; i < 8; i++) {
|
||||
if (pngBytes[i] !== pngSignature[i]) {
|
||||
throw new Error("Not a valid PNG");
|
||||
}
|
||||
}
|
||||
|
||||
const xmpChunk = makeXmpITXtChunk(xmpString);
|
||||
let pos = 8;
|
||||
let insertPos = -1;
|
||||
|
||||
while (pos + 12 <= pngBytes.length) {
|
||||
const length =
|
||||
(pngBytes[pos] << 24) |
|
||||
(pngBytes[pos + 1] << 16) |
|
||||
(pngBytes[pos + 2] << 8) |
|
||||
pngBytes[pos + 3];
|
||||
|
||||
const type = String.fromCharCode(
|
||||
pngBytes[pos + 4],
|
||||
pngBytes[pos + 5],
|
||||
pngBytes[pos + 6],
|
||||
pngBytes[pos + 7],
|
||||
);
|
||||
|
||||
const chunkEnd = pos + 12 + length;
|
||||
if (chunkEnd > pngBytes.length) {
|
||||
throw new Error("Corrupt PNG");
|
||||
}
|
||||
|
||||
if (type === "IDAT" || type === "IEND") {
|
||||
insertPos = pos;
|
||||
break;
|
||||
}
|
||||
|
||||
pos = chunkEnd;
|
||||
}
|
||||
|
||||
if (insertPos === -1) {
|
||||
throw new Error("Could not find insertion point in PNG");
|
||||
}
|
||||
|
||||
return concatUint8Arrays([
|
||||
pngBytes.subarray(0, insertPos),
|
||||
xmpChunk,
|
||||
pngBytes.subarray(insertPos),
|
||||
]);
|
||||
}
|
||||
|
||||
export async function injectAvmIntoPngBlob(blob, avm) {
|
||||
const pngBytes = new Uint8Array(await blob.arrayBuffer());
|
||||
const xmp = buildAvmXmpPacket(avm);
|
||||
const outBytes = insertXmpIntoPng(pngBytes, xmp);
|
||||
|
||||
return new Blob([outBytes], { type: "image/png" });
|
||||
}
|
||||
|
||||
export function blobToDataURL(blob) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result);
|
||||
reader.onerror = () => reject(new Error("Error reading blob as data URL"));
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
|
||||
export function blobToArrayBuffer(blob) {
|
||||
return blob.arrayBuffer();
|
||||
}
|
||||
+2
-1
@@ -517,7 +517,8 @@ export let Catalog = (function () {
|
||||
var cacheMarkerCtx = this.cacheMarkerCanvas.getContext("2d");
|
||||
cacheMarkerCtx.fillStyle = this.color;
|
||||
cacheMarkerCtx.beginPath();
|
||||
var half = this.markerSize / 2;
|
||||
var half = Math.max(this.markerSize / 2, 2.0);
|
||||
|
||||
cacheMarkerCtx.arc(half, half, half - 2, 0, 2 * Math.PI, false);
|
||||
cacheMarkerCtx.fill();
|
||||
cacheMarkerCtx.lineWidth = 2;
|
||||
|
||||
@@ -1,291 +0,0 @@
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
/******************************************************************************
|
||||
* Aladin Lite project
|
||||
*
|
||||
* File ColorCfg
|
||||
*
|
||||
* Authors: Thomas Boch & Matthieu Baumann [CDS]
|
||||
*
|
||||
*****************************************************************************/
|
||||
export let ColorCfg = (function() {
|
||||
/** Constructor
|
||||
* cooFrame and maxOrder can be set to null
|
||||
* They will be determined by reading the properties file
|
||||
*/
|
||||
function ColorCfg(options) {
|
||||
// Opacity of the survey/image
|
||||
this.opacity = (options && options.opacity) || 1.0;
|
||||
|
||||
// Colormap config options
|
||||
this.colormap = (options && options.colormap) || "native";
|
||||
this.colormap = this.colormap.toLowerCase();
|
||||
|
||||
this.stretch = (options && options.stretch) || "linear";
|
||||
this.stretch = this.stretch.toLowerCase();
|
||||
this.reversed = false;
|
||||
// Keep the image tile format because we want the cuts
|
||||
this.imgFormat = options.imgFormat || 'png';
|
||||
|
||||
if (options && options.reversed === true) {
|
||||
this.reversed = true;
|
||||
}
|
||||
|
||||
this.minCut = {
|
||||
webp: 0.0,
|
||||
jpeg: 0.0,
|
||||
png: 0.0,
|
||||
fits: undefined // wait the default value coming from the properties
|
||||
};
|
||||
if (options && Number.isFinite(options.minCut)) {
|
||||
this.minCut[this.imgFormat] = options.minCut;
|
||||
}
|
||||
|
||||
this.maxCut = {
|
||||
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)) {
|
||||
this.maxCut[this.imgFormat] = options.maxCut;
|
||||
}
|
||||
|
||||
this.additiveBlending = options && options.additive;
|
||||
if (this.additiveBlending === undefined) {
|
||||
this.additiveBlending = false;
|
||||
}
|
||||
|
||||
// A default value for gamma correction
|
||||
this.kGamma = (options && options.gamma) || 1.0;
|
||||
this.kSaturation = (options && options.saturation) || 0.0;
|
||||
this.kBrightness = (options && options.brightness) || 0.0;
|
||||
this.kContrast = (options && options.contrast) || 0.0;
|
||||
};
|
||||
|
||||
ColorCfg.prototype.get = function() {
|
||||
let blend = {
|
||||
srcColorFactor: 'SrcAlpha',
|
||||
dstColorFactor: 'OneMinusSrcAlpha',
|
||||
func: 'FuncAdd'
|
||||
};
|
||||
|
||||
if (this.additiveBlending) {
|
||||
blend = {
|
||||
srcColorFactor: 'SrcAlpha',
|
||||
dstColorFactor: 'One',
|
||||
func: 'FuncAdd'
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
opacity: this.opacity,
|
||||
color: {
|
||||
// Tonal corrections constants
|
||||
kGamma: this.kGamma,
|
||||
kSaturation: this.kSaturation,
|
||||
kBrightness: this.kBrightness,
|
||||
kContrast: this.kContrast,
|
||||
|
||||
stretch: this.stretch,
|
||||
minCut,
|
||||
maxCut,
|
||||
reversed: this.reversed,
|
||||
cmapName: this.colormap,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ColorCfg.prototype.setOptions = function(options) {
|
||||
// Update the imgFormat
|
||||
this.imgFormat = options.imgFormat || this.imgFormat;
|
||||
|
||||
this.setColormap(options.colormap, options)
|
||||
|
||||
this.setCuts(options.minCut, options.maxCut, options.cutFormat)
|
||||
|
||||
this.setBrightness(options.brightness)
|
||||
this.setSaturation(options.saturation)
|
||||
this.setContrast(options.contrast)
|
||||
|
||||
this.setGamma(options.gamma)
|
||||
|
||||
this.setOpacity(options.opacity)
|
||||
|
||||
this.setBlendingConfig(options.additive)
|
||||
}
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.setBrightness = function(kBrightness) {
|
||||
if (kBrightness == null || kBrightness == undefined)
|
||||
return;
|
||||
|
||||
kBrightness = +kBrightness || 0.0; // coerce to number
|
||||
this.kBrightness = Math.max(-1, Math.min(kBrightness, 1));
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.getBrightness = function() {
|
||||
return this.kBrightness;
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.setContrast = function(kContrast) {
|
||||
if (kContrast == null || kContrast == undefined)
|
||||
return;
|
||||
|
||||
kContrast = +kContrast || 0.0; // coerce to number
|
||||
this.kContrast = Math.max(-1, Math.min(kContrast, 1));
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.getContrast = function() {
|
||||
return this.kContrast;
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.setSaturation = function(kSaturation) {
|
||||
if (kSaturation == null || kSaturation == undefined)
|
||||
return;
|
||||
|
||||
kSaturation = +kSaturation || 0.0; // coerce to number
|
||||
|
||||
this.kSaturation = Math.max(-1, Math.min(kSaturation, 1));
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.getSaturation = function() {
|
||||
return this.kSaturation;
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.setGamma = function(gamma) {
|
||||
if (gamma == null || gamma == undefined)
|
||||
return;
|
||||
|
||||
gamma = +gamma; // coerce to number
|
||||
this.kGamma = Math.max(0.1, Math.min(gamma, 10));
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.getGamma = function() {
|
||||
return this.kGamma;
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.setOpacity = function(opacity) {
|
||||
if (opacity == null || opacity == undefined)
|
||||
return;
|
||||
|
||||
opacity = +opacity; // coerce to number
|
||||
this.opacity = Math.max(0, Math.min(opacity, 1));
|
||||
};
|
||||
|
||||
// @oldapi
|
||||
ColorCfg.prototype.setAlpha = ColorCfg.prototype.setOpacity;
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.getOpacity = function() {
|
||||
return this.opacity;
|
||||
};
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.getAlpha = ColorCfg.prototype.getOpacity;
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.setBlendingConfig = function(additive) {
|
||||
if (additive === null || additive === undefined)
|
||||
return;
|
||||
|
||||
this.additiveBlending = additive;
|
||||
};
|
||||
|
||||
ColorCfg.prototype.getBlendingConfig = function() {
|
||||
return this.additiveBlending;
|
||||
};
|
||||
|
||||
// @api
|
||||
// Optional arguments,
|
||||
ColorCfg.prototype.setColormap = function(colormap, options) {
|
||||
/// colormap
|
||||
this.colormap = (colormap && colormap.toLowerCase()) || this.colormap;
|
||||
|
||||
/// stretch
|
||||
let stretch = (options && options.stretch) || this.stretch || "linear";
|
||||
this.stretch = stretch.toLowerCase()
|
||||
|
||||
/// reversed
|
||||
if (options && options.reversed !== undefined) {
|
||||
this.reversed = options.reversed;
|
||||
}
|
||||
}
|
||||
|
||||
// @api
|
||||
ColorCfg.prototype.getColormap = function() {
|
||||
return this.colormap;
|
||||
};
|
||||
|
||||
ColorCfg.prototype.getReversed = function() {
|
||||
return this.reversed;
|
||||
};
|
||||
|
||||
// Sets the cuts for the current image format
|
||||
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 = {...this.minCut, ...minCut};
|
||||
} else if (minCut !== null && minCut !== undefined) {
|
||||
this.minCut[imgFormat] = minCut;
|
||||
}
|
||||
|
||||
if (maxCut instanceof Object) {
|
||||
this.maxCut = {...this.maxCut, ...maxCut};
|
||||
} else if (maxCut !== null && maxCut !== undefined) {
|
||||
this.maxCut[imgFormat] = maxCut;
|
||||
}
|
||||
};
|
||||
|
||||
// Returns the cuts for the current image format
|
||||
ColorCfg.prototype.getCuts = function() {
|
||||
return [
|
||||
this.minCut[this.imgFormat],
|
||||
this.maxCut[this.imgFormat]
|
||||
];
|
||||
};
|
||||
|
||||
return ColorCfg;
|
||||
})();
|
||||
@@ -29,6 +29,8 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
import { Aladin } from "./Aladin";
|
||||
|
||||
export let CooFrameEnum = (function() {
|
||||
|
||||
// Corresponds to the Rust CooSystem enum possibilities.
|
||||
@@ -59,6 +61,20 @@ export let CooFrameEnum = (function() {
|
||||
else {
|
||||
return defaultValue ? defaultValue : null;
|
||||
}
|
||||
},
|
||||
|
||||
toWasm: function(cooFrame) {
|
||||
let frame = null;
|
||||
|
||||
let system = cooFrame?.system;
|
||||
|
||||
if (system === CooFrameEnum.SYSTEMS.ICRS) {
|
||||
frame = Aladin.wasmLibs.core.CooSystem.ICRS;
|
||||
} else if (system === CooFrameEnum.SYSTEMS.GAL) {
|
||||
frame = Aladin.wasmLibs.core.CooSystem.GAL;
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -126,10 +126,10 @@ export let DefaultActionsForContextMenu = (function () {
|
||||
},
|
||||
subMenu: [
|
||||
{
|
||||
label: 'FITS image', action(o) {
|
||||
label: 'Load image', action(o) {
|
||||
let input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.accept = ".fits";
|
||||
input.accept = ['.fits', '.png', '.jpg'];
|
||||
input.onchange = _ => {
|
||||
let files = Array.from(input.files);
|
||||
|
||||
@@ -138,14 +138,16 @@ export let DefaultActionsForContextMenu = (function () {
|
||||
const name = file.name;
|
||||
|
||||
// Consider other cases
|
||||
const image = a.createImageFITS(
|
||||
const image = A.image(
|
||||
url,
|
||||
{name},
|
||||
(ra, dec, fov, _) => {
|
||||
// Center the view around the new fits object
|
||||
a.gotoRaDec(ra, dec);
|
||||
a.setFoV(fov * 1.1);
|
||||
}
|
||||
{
|
||||
name,
|
||||
successCallback: (ra, dec, fov, _) => {
|
||||
// Center the view around the new fits object
|
||||
a.gotoRaDec(ra, dec);
|
||||
a.setFoV(fov * 1.1);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
a.setOverlayImageLayer(image, name)
|
||||
|
||||
+43
-23
@@ -20,6 +20,8 @@
|
||||
// along with Aladin Lite. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
import { DataproductType } from "../core/pkg/core";
|
||||
|
||||
export let HiPSList = (function () {
|
||||
function HiPSList() {}
|
||||
|
||||
@@ -33,6 +35,7 @@ export let HiPSList = (function () {
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://alasky.cds.unistra.fr/DSS/DSSColor",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://erosita/dr1/rate/rgb",
|
||||
@@ -42,7 +45,8 @@ export let HiPSList = (function () {
|
||||
tileSize: 512,
|
||||
imgFormat: "png",
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://erosita.mpe.mpg.de/dr1/erodat/static/hips/eRASS1_RGB_Rate_c010/"
|
||||
startUrl: "https://erosita.mpe.mpg.de/dr1/erodat/static/hips/eRASS1_RGB_Rate_c010/",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/2MASS/color",
|
||||
@@ -53,6 +57,7 @@ export let HiPSList = (function () {
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://alaskybis.cds.unistra.fr/2MASS/Color",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/DSS2/red",
|
||||
@@ -64,12 +69,13 @@ export let HiPSList = (function () {
|
||||
cooFrame: "equatorial",
|
||||
numBitsPerPixel: 16,
|
||||
// options
|
||||
minCut: 1000.0,
|
||||
maxCut: 10000.0,
|
||||
minCut: {fits: 1000.0, jpeg: 0.0, png: 0.0},
|
||||
maxCut: {fits: 10000.0, jpeg: 255.0, png: 255.0},
|
||||
colormap: "magma",
|
||||
stretch: "Linear",
|
||||
imgFormat: "fits",
|
||||
startUrl: "https://alaskybis.cds.unistra.fr/DSS/DSS2Merged",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/DM/I/350/gaiaedr3",
|
||||
@@ -79,12 +85,13 @@ export let HiPSList = (function () {
|
||||
tileSize: 512,
|
||||
numBitsPerPixel: -32,
|
||||
cooFrame: "equatorial",
|
||||
minCut: 0,
|
||||
maxCut: 12000,
|
||||
minCut: {fits: 0.0, jpeg: 0.0, png: 0.0},
|
||||
maxCut: {fits: 12000.0, jpeg: 255.0, png: 255.0},
|
||||
stretch: "asinh",
|
||||
colormap: "rdylbu",
|
||||
imgFormat: "fits",
|
||||
startUrl: "https://alaskybis.cds.unistra.fr/ancillary/GaiaEDR3/density-map",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/PanSTARRS/DR1/g",
|
||||
@@ -96,11 +103,12 @@ export let HiPSList = (function () {
|
||||
cooFrame: "equatorial",
|
||||
numBitsPerPixel: -32,
|
||||
// options
|
||||
minCut: -34,
|
||||
maxCut: 7000,
|
||||
minCut: {fits: -34.0, jpeg: 0.0, png: 0.0},
|
||||
maxCut: {fits: 7000.0, jpeg: 255.0, png: 255.0},
|
||||
stretch: "asinh",
|
||||
colormap: "redtemperature",
|
||||
startUrl: "https://alasky.cds.unistra.fr/Pan-STARRS/DR1/g"
|
||||
startUrl: "https://alasky.cds.unistra.fr/Pan-STARRS/DR1/g",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/PanSTARRS/DR1/color-z-zg-g",
|
||||
@@ -111,6 +119,7 @@ export let HiPSList = (function () {
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://alasky.cds.unistra.fr/Pan-STARRS/DR1/color-z-zg-g",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/DECaPS/DR2/color",
|
||||
@@ -120,7 +129,8 @@ export let HiPSList = (function () {
|
||||
cooFrame: "equatorial",
|
||||
tileSize: 512,
|
||||
imgFormat: "png",
|
||||
startUrl: "https://alasky.cds.unistra.fr/DECaPS/DR2/CDS_P_DECaPS_DR2_color"
|
||||
startUrl: "https://alasky.cds.unistra.fr/DECaPS/DR2/CDS_P_DECaPS_DR2_color",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/Fermi/color",
|
||||
@@ -131,6 +141,7 @@ export let HiPSList = (function () {
|
||||
tileSize: 512,
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://alasky.cds.unistra.fr/Fermi/Color",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/GALEXGR6_7/NUV",
|
||||
@@ -140,7 +151,8 @@ export let HiPSList = (function () {
|
||||
imgFormat: "png",
|
||||
tileSize: 512,
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://alasky.cds.unistra.fr/GALEX/GALEXGR6_7_NUV"
|
||||
startUrl: "https://alasky.cds.unistra.fr/GALEX/GALEXGR6_7_NUV",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/IRIS/color",
|
||||
@@ -151,6 +163,7 @@ export let HiPSList = (function () {
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "galactic",
|
||||
startUrl: "https://alasky.cds.unistra.fr/IRISColor",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/Mellinger/color",
|
||||
@@ -160,7 +173,8 @@ export let HiPSList = (function () {
|
||||
tileSize: 512,
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "galactic",
|
||||
startUrl: "https://alasky.cds.unistra.fr/MellingerRGB"
|
||||
startUrl: "https://alasky.cds.unistra.fr/MellingerRGB",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/SDSS9/color",
|
||||
@@ -170,7 +184,8 @@ export let HiPSList = (function () {
|
||||
tileSize: 512,
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://alasky.cds.unistra.fr/SDSS/DR9/color"
|
||||
startUrl: "https://alasky.cds.unistra.fr/SDSS/DR9/color",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/SPITZER/color",
|
||||
@@ -180,7 +195,8 @@ export let HiPSList = (function () {
|
||||
tileSize: 512,
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "galactic",
|
||||
startUrl: "https://alasky.cds.unistra.fr/Spitzer/SpitzerI1I2I4color"
|
||||
startUrl: "https://alasky.cds.unistra.fr/Spitzer/SpitzerI1I2I4color",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/allWISE/color",
|
||||
@@ -190,7 +206,8 @@ export let HiPSList = (function () {
|
||||
tileSize: 512,
|
||||
imgFormat: "jpeg",
|
||||
cooFrame: "equatorial",
|
||||
startUrl: "https://alaskybis.cds.unistra.fr/AllWISE/RGB-W4-W2-W1"
|
||||
startUrl: "https://alaskybis.cds.unistra.fr/AllWISE/RGB-W4-W2-W1",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
creatorDid: "ivo://CDS/P/SDSS9/g",
|
||||
@@ -201,31 +218,34 @@ export let HiPSList = (function () {
|
||||
numBitsPerPixel: 16,
|
||||
imgFormat: "fits",
|
||||
cooFrame: "equatorial",
|
||||
minCut: 0,
|
||||
maxCut: 1.8,
|
||||
minCut: {fits: 0.0, jpeg: 0.0, png: 0.0},
|
||||
maxCut: {fits: 1.8, jpeg: 255.0, png: 255.0},
|
||||
stretch: "linear",
|
||||
colormap: "redtemperature",
|
||||
startUrl: "https://alasky.cds.unistra.fr/SDSS/DR9/band-g"
|
||||
startUrl: "https://alasky.cds.unistra.fr/SDSS/DR9/band-g",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
id: "P/Finkbeiner",
|
||||
name: "Halpha",
|
||||
maxOrder: 3,
|
||||
minCut: -10,
|
||||
maxCut: 800,
|
||||
minCut: {fits: -10.0, jpeg: 0.0, png: 0.0},
|
||||
maxCut: {fits: 800.0, jpeg: 255.0, png: 255.0},
|
||||
colormap: "rdbu",
|
||||
imgFormat: "fits",
|
||||
startUrl: "https://alasky.cds.unistra.fr/FinkbeinerHalpha"
|
||||
startUrl: "https://alasky.cds.unistra.fr/FinkbeinerHalpha",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
id: "P/VTSS/Ha",
|
||||
name: "VTSS-Ha",
|
||||
maxOrder: 3,
|
||||
minCut: -10.0,
|
||||
maxCut: 100.0,
|
||||
minCut: {fits: -10.0, jpeg: 0.0, png: 0.0},
|
||||
maxCut: {fits: 100.0, jpeg: 255.0, png: 255.0},
|
||||
colormap: "grayscale",
|
||||
imgFormat: "fits",
|
||||
startUrl: "https://alasky.cds.unistra.fr/VTSS/Ha"
|
||||
startUrl: "https://alasky.cds.unistra.fr/VTSS/Ha",
|
||||
dataproductType: "image",
|
||||
},
|
||||
{
|
||||
id: "P/GLIMPSE360",
|
||||
|
||||
+430
-184
@@ -30,7 +30,6 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
import { ALEvent } from "./events/ALEvent.js";
|
||||
import { ColorCfg } from "./ColorCfg.js";
|
||||
import { HiPSProperties } from "./HiPSProperties.js";
|
||||
import { Aladin } from "./Aladin.js";
|
||||
import { CooFrameEnum } from "./CooFrameEnum.js";
|
||||
@@ -43,11 +42,10 @@ PropertyParser.tileSize = function (properties) {
|
||||
let tileSize =
|
||||
(properties &&
|
||||
properties.hips_tile_width &&
|
||||
+properties.hips_tile_width) ||
|
||||
512;
|
||||
+properties.hips_tile_width)
|
||||
|
||||
// Check if the tile width size is a power of 2
|
||||
if (tileSize & (tileSize - 1 !== 0)) {
|
||||
if (tileSize && ((tileSize & (tileSize - 1)) !== 0)) {
|
||||
tileSize = 512;
|
||||
}
|
||||
|
||||
@@ -59,7 +57,7 @@ PropertyParser.cooFrame = function (properties) {
|
||||
let cooFrame =
|
||||
(properties && properties.hips_body && "ICRSd") ||
|
||||
(properties && properties.hips_frame) ||
|
||||
"icrs";
|
||||
"ICRS";
|
||||
return cooFrame;
|
||||
};
|
||||
|
||||
@@ -80,12 +78,12 @@ PropertyParser.minOrder = function (properties) {
|
||||
return minOrder;
|
||||
};
|
||||
|
||||
PropertyParser.acceptedFormats = function (properties) {
|
||||
let acceptedFormats = (properties && properties.hips_tile_format) || "jpeg";
|
||||
PropertyParser.formats = function (properties) {
|
||||
let formats = properties?.hips_tile_format;
|
||||
|
||||
acceptedFormats = acceptedFormats.split(" ").map((fmt) => fmt.toLowerCase());
|
||||
formats = formats?.split(" ").map((fmt) => fmt.toLowerCase());
|
||||
|
||||
return acceptedFormats;
|
||||
return formats;
|
||||
};
|
||||
|
||||
PropertyParser.initialFov = function (properties) {
|
||||
@@ -122,6 +120,18 @@ PropertyParser.hipsDataMinmax = function (properties) {
|
||||
return [minData, maxData];
|
||||
};
|
||||
|
||||
PropertyParser.dataRange = function (properties) {
|
||||
let range =
|
||||
properties &&
|
||||
properties.hips_data_range &&
|
||||
properties.hips_data_range.split(" ");
|
||||
|
||||
const minRange = range && parseFloat(range[0]);
|
||||
const maxRange = range && parseFloat(range[1]);
|
||||
|
||||
return [minRange, maxRange];
|
||||
};
|
||||
|
||||
PropertyParser.cutouts = function (properties) {
|
||||
let cuts =
|
||||
properties &&
|
||||
@@ -164,11 +174,11 @@ PropertyParser.isPlanetaryBody = function (properties) {
|
||||
* @property {Function} [successCallback] - A callback executed when the HiPS has been loaded
|
||||
* @property {Function} [errorCallback] - A callback executed when the HiPS could not be loaded
|
||||
* @property {string} [imgFormat] - Formats accepted 'webp', 'png', 'jpeg' or 'fits'. Will raise an error if the HiPS does not contain tiles in this format
|
||||
* @property {CooFrame} [cooFrame] - Coordinate frame of the survey tiles. If not given, the one from the parsed properties file will be retrieved.
|
||||
* @property {string} [cooFrame] - Coordinate frame of the survey tiles. If not given, the one from the parsed properties file will be retrieved. Possible values: 'ICRS', 'ICRSd', 'galactic', 'equatorial', 'j2000'
|
||||
* @property {number} [maxOrder] - The maximum HEALPix order of the HiPS, i.e the HEALPix order of the most refined tile images of the HiPS.
|
||||
* @property {number} [numBitsPerPixel] - Useful if you want to display the FITS tiles of a HiPS. It specifies the number of bits per pixel. Possible values are:
|
||||
* @property {number} [bitpix] - Useful if you want to display the FITS tiles of a HiPS. It specifies the number of bits per pixel. Possible values are:
|
||||
* -64: double, -32: float, 8: unsigned byte, 16: short, 32: integer 32 bits, 64: integer 64 bits
|
||||
* @property {number} [tileSize] - The width of the HEALPix tile images. Mostly 512 pixels but can be 256, 128, 64, 32
|
||||
* @property {number} [tileSize=512] - The width of the HEALPix tile images. Mostly 512 pixels but can be 256, 128, 64, 32
|
||||
* @property {number} [minOrder] - If not given, retrieved from the properties of the survey.
|
||||
* @property {boolean} [longitudeReversed] - Deprecated The longitudeReversed property is now deprecated since version 3.6.1. This property has been removed since version 3.7.0 and replaced with {@link Aladin#reverseLongitude} set directly on the {@link Aladin} view object and not at the HiPS level.
|
||||
* @property {number} [opacity=1.0] - Opacity of the survey or image (value between 0 and 1).
|
||||
@@ -177,7 +187,7 @@ PropertyParser.isPlanetaryBody = function (properties) {
|
||||
* @property {boolean} [reversed=false] - If true, the colormap is reversed; otherwise, it is not reversed.
|
||||
* @property {number} [minCut] - The minimum cut value for the color configuration. If not given, 0.0 for JPEG/PNG surveys, the value of the property file for FITS surveys
|
||||
* @property {number} [maxCut] - The maximum cut value for the color configuration. If not given, 1.0 for JPEG/PNG surveys, the value of the property file for FITS surveys
|
||||
* @property {boolean} [additive=false] - If true, additive blending is applied; otherwise, it is not applied.
|
||||
* @property {boolean} [blending=false] - If true, additive blending is applied; otherwise, it is not applied.
|
||||
* @property {number} [gamma=1.0] - The gamma correction value for the color configuration.
|
||||
* @property {number} [saturation=0.0] - The saturation value for the color configuration.
|
||||
* @property {number} [brightness=0.0] - The brightness value for the color configuration.
|
||||
@@ -256,7 +266,7 @@ export let HiPS = (function () {
|
||||
* @constructs HiPS
|
||||
*
|
||||
* @param {string} id - Mandatory unique identifier for the layer. Can be an arbitrary name
|
||||
* @param {string|FileList|HiPSLocalFiles} url - Can be:
|
||||
* @param {string|FileList|HiPSLocalFiles} location - Can be:
|
||||
* <ul>
|
||||
* <li>An http url towards a HiPS.</li>
|
||||
* <li>A relative path to your HiPS</li>
|
||||
@@ -270,14 +280,14 @@ export let HiPS = (function () {
|
||||
*/
|
||||
function HiPS(id, location, options) {
|
||||
this.added = false;
|
||||
// Unique identifier for a survey
|
||||
// Required ID, synonym of the CreatorDid of a HiPS
|
||||
this.id = id;
|
||||
|
||||
this.options = options;
|
||||
this.name = (options && options.name) || id;
|
||||
this.startUrl = options.startUrl;
|
||||
this.startUrl = options && options.startUrl;
|
||||
this.requestMode = options && options.requestMode || 'cors';
|
||||
this.requestCredentials = options && options.requestCredentials || 'same-origin';
|
||||
this.type = "hips"
|
||||
|
||||
this.slice = 0;
|
||||
|
||||
@@ -318,21 +328,71 @@ export let HiPS = (function () {
|
||||
|
||||
this.url = location;
|
||||
|
||||
this.maxOrder = options.maxOrder;
|
||||
this.minOrder = options.minOrder || 0;
|
||||
this.cooFrame = CooFrameEnum.fromString(options.cooFrame, null);
|
||||
this.tileSize = options.tileSize;
|
||||
this.skyFraction = options.skyFraction;
|
||||
this.imgFormat = options.imgFormat;
|
||||
this.acceptedFormats = options.formats;
|
||||
this.defaultFitsMinCut = options.defaultFitsMinCut;
|
||||
this.defaultFitsMaxCut = options.defaultFitsMaxCut;
|
||||
this.numBitsPerPixel = options.numBitsPerPixel;
|
||||
this.creatorDid = options.creatorDid;
|
||||
this.errorCallback = options.errorCallback;
|
||||
this.successCallback = options.successCallback;
|
||||
// Max order Required
|
||||
this.maxOrder = options && options.maxOrder;
|
||||
this.minOrder = (options && options.minOrder) || 0;
|
||||
// Frame Required
|
||||
this.cooFrame = options && CooFrameEnum.fromString(options.cooFrame, null)?.system;
|
||||
this.tileSize = options && options.tileSize || 512;
|
||||
this.skyFraction = options && options.skyFraction;
|
||||
// Image format Required
|
||||
this.imgFormat = options && options.imgFormat;
|
||||
this.formats = (options && options.formats) || (this.imgFormat && [this.imgFormat]);
|
||||
this.defaultFitsMinCut = options && options.defaultFitsMinCut;
|
||||
this.defaultFitsMaxCut = options && options.defaultFitsMaxCut;
|
||||
this.bitpix = options && options.bitpix;
|
||||
this.creatorDid = (options && options.creatorDid) || this.id || this.url;
|
||||
this.errorCallback = options && options.errorCallback;
|
||||
this.successCallback = options && options.successCallback;
|
||||
this.dataproductType = options && options.dataproductType || 'image';
|
||||
this.tileDepth = options && options.tileDepth;
|
||||
this.orderFreq = options && options.orderFreq;
|
||||
this.emMin = options && options.emMin;
|
||||
this.emMax = options && options.emMax;
|
||||
|
||||
this.colorCfg = new ColorCfg(options);
|
||||
// Opacity of the survey/image
|
||||
this.opacity = (options && options.opacity) || 1.0;
|
||||
|
||||
// Colormap config options
|
||||
this.colormap = (options && options.colormap) || "native";
|
||||
this.colormap = this.colormap.toLowerCase();
|
||||
|
||||
this.stretch = (options && options.stretch) || "linear";
|
||||
this.stretch = this.stretch.toLowerCase();
|
||||
this.reversed = false;
|
||||
// Keep the image tile format because we want the cuts
|
||||
this.imgFormat = (options && options.imgFormat) || 'png';
|
||||
|
||||
if (options && options.reversed === true) {
|
||||
this.reversed = true;
|
||||
}
|
||||
|
||||
this.minCut = {
|
||||
webp: 0.0,
|
||||
jpeg: 0.0,
|
||||
png: 0.0,
|
||||
fits: undefined // wait the default value coming from the properties
|
||||
};
|
||||
|
||||
this.maxCut = {
|
||||
webp: 255.0,
|
||||
jpeg: 255.0,
|
||||
png: 255.0,
|
||||
fits: undefined // wait the default value coming from the properties
|
||||
};
|
||||
|
||||
this.setCuts(options.minCut, options.maxCut);
|
||||
|
||||
this.blending = options && options.blending;
|
||||
if (this.blending === undefined) {
|
||||
this.blending = false;
|
||||
}
|
||||
|
||||
// A default value for gamma correction
|
||||
this.gamma = (options && options.gamma) || 1.0;
|
||||
this.saturation = (options && options.saturation) || 0.0;
|
||||
this.brightness = (options && options.brightness) || 0.0;
|
||||
this.contrast = (options && options.contrast) || 0.0;
|
||||
|
||||
let self = this;
|
||||
|
||||
@@ -352,34 +412,33 @@ export let HiPS = (function () {
|
||||
resolve(self);
|
||||
});
|
||||
} else {
|
||||
let isIncompleteOptions = true;
|
||||
let mustRequestProperties = true;
|
||||
|
||||
let isID = Utils.isUrl(this.url) === undefined;
|
||||
let isUrl = Utils.isUrl(this.url) !== undefined;
|
||||
|
||||
if (this.imgFormat === "fits") {
|
||||
// a fits is given
|
||||
isIncompleteOptions = !(
|
||||
mustRequestProperties = !(
|
||||
this.maxOrder &&
|
||||
(!isID && this.url) &&
|
||||
isUrl &&
|
||||
this.imgFormat &&
|
||||
this.tileSize &&
|
||||
this.cooFrame &&
|
||||
this.numBitsPerPixel
|
||||
// TODO: this should not be mandatory, one just parse FITS files
|
||||
this.bitpix
|
||||
);
|
||||
} else {
|
||||
isIncompleteOptions = !(
|
||||
mustRequestProperties = !(
|
||||
this.maxOrder &&
|
||||
(!isID && this.url) &&
|
||||
isUrl &&
|
||||
this.imgFormat &&
|
||||
this.tileSize &&
|
||||
this.cooFrame
|
||||
);
|
||||
}
|
||||
|
||||
this.query = new Promise(async (resolve, reject) => {
|
||||
if (isIncompleteOptions) {
|
||||
if (mustRequestProperties) {
|
||||
// ID typed url
|
||||
if (self.startUrl && isID) {
|
||||
if (self.startUrl && !isUrl) {
|
||||
// First download the properties from the start url
|
||||
await HiPSProperties.fetchFromUrl(self.startUrl, self.requestMode, self.requestCredentials)
|
||||
.then((p) => {
|
||||
@@ -407,7 +466,7 @@ export let HiPS = (function () {
|
||||
},
|
||||
1000
|
||||
);
|
||||
} else if (!self.startUrl && isID) {
|
||||
} else if (!self.startUrl && !isUrl) {
|
||||
// the url stores a "CDS ID" we take it prioritaly
|
||||
// if the url is null, take the id, this is for some tests
|
||||
// to pass because some users might just give null as url param and a "CDS ID" as id param
|
||||
@@ -437,17 +496,16 @@ export let HiPS = (function () {
|
||||
.catch((e) => reject("HiPS " + self.id + " error: HiPS not found at url " + self.url + "\nReason: " + e.stack))
|
||||
}
|
||||
} else {
|
||||
self._parseProperties({
|
||||
/*self._parseProperties({
|
||||
hips_order: self.maxOrder,
|
||||
hips_service_url: self.url,
|
||||
hips_tile_width: self.tileSize,
|
||||
hips_frame: self.cooFrame.label
|
||||
})
|
||||
hips_frame: self.cooFrame
|
||||
})*/
|
||||
}
|
||||
|
||||
if (self.updateHiPSCache) {
|
||||
self._saveInCache();
|
||||
self.updateHiPSCache = false;
|
||||
self._updateMetadata()
|
||||
}
|
||||
|
||||
resolve(self);
|
||||
@@ -491,8 +549,8 @@ export let HiPS = (function () {
|
||||
// HiPS Cube special keywords
|
||||
self.cubeDepth = properties && properties.hips_cube_depth && +properties.hips_cube_depth;
|
||||
self.cubeFirstFrame = properties && properties.hips_cube_firstframe && +properties.hips_cube_firstframe;
|
||||
self.emMin = properties && properties.em_min && +properties.em_min;
|
||||
self.emMax = properties && properties.em_max && +properties.em_max;
|
||||
self.emMin = (properties && properties.em_min && +properties.em_min) || self.emMin;
|
||||
self.emMax = (properties && properties.em_max && +properties.em_max) || self.emMax;
|
||||
|
||||
if (self.emMax < self.emMin) {
|
||||
let tmp = self.emMin;
|
||||
@@ -500,11 +558,13 @@ export let HiPS = (function () {
|
||||
self.emMax = tmp;
|
||||
}
|
||||
|
||||
self.hipsDataMinMax = PropertyParser.hipsDataMinmax(properties);
|
||||
self.dataMinMax = PropertyParser.hipsDataMinmax(properties);
|
||||
|
||||
self.dataRange = PropertyParser.dataRange(properties);
|
||||
|
||||
// HiPS3D special keywords
|
||||
self.hipsOrderFreq = properties && properties.hips_order_freq && +properties.hips_order_freq;
|
||||
self.hipsTileDepth = properties && properties.hips_tile_depth && +properties.hips_tile_depth;
|
||||
self.orderFreq = (properties && properties.hips_order_freq && +properties.hips_order_freq) || self.orderFreq;
|
||||
self.tileDepth = (properties && properties.hips_tile_depth && +properties.hips_tile_depth) || self.tileDepth;
|
||||
self.obsRestFreq = properties && properties.obs_restfreq && +properties.obs_restfreq;
|
||||
|
||||
// Max order
|
||||
@@ -514,15 +574,15 @@ export let HiPS = (function () {
|
||||
}
|
||||
|
||||
// dataproduct type
|
||||
self.dataproductType = properties && properties.dataproduct_type;
|
||||
self.dataproductType = properties && properties.dataproduct_type || self.dataproductType;
|
||||
|
||||
// Tile size
|
||||
self.tileSize =
|
||||
PropertyParser.tileSize(properties) || self.tileSize;
|
||||
|
||||
// Tile formats
|
||||
self.acceptedFormats =
|
||||
PropertyParser.acceptedFormats(properties) || self.acceptedFormats;
|
||||
self.formats =
|
||||
PropertyParser.formats(properties) || self.formats;
|
||||
|
||||
// Min order
|
||||
const minOrder = PropertyParser.minOrder(properties)
|
||||
@@ -535,7 +595,7 @@ export let HiPS = (function () {
|
||||
PropertyParser.cooFrame(properties);
|
||||
// Parse the cooframe from the properties but if it fails, take the one given by the user
|
||||
// If the user gave nothing, then take ICRS as the default one
|
||||
self.cooFrame = CooFrameEnum.fromString(cooFrame, self.cooFrame || CooFrameEnum.ICRS);
|
||||
self.cooFrame = CooFrameEnum.fromString(cooFrame, null)?.system || self.cooFrame || CooFrameEnum.ICRS.system;
|
||||
|
||||
// sky fraction
|
||||
self.skyFraction = PropertyParser.skyFraction(properties);
|
||||
@@ -557,8 +617,8 @@ export let HiPS = (function () {
|
||||
self.defaultFitsMaxCut = cutoutFromProperties[1] || 1.0;
|
||||
|
||||
// Bitpix
|
||||
self.numBitsPerPixel =
|
||||
PropertyParser.bitpix(properties) || self.numBitsPerPixel;
|
||||
self.bitpix =
|
||||
PropertyParser.bitpix(properties) || self.bitpix;
|
||||
|
||||
// HiPS body
|
||||
if (properties.hips_body) {
|
||||
@@ -573,24 +633,22 @@ export let HiPS = (function () {
|
||||
self.name = self.name || self.id || self.url;
|
||||
self.name = self.name.replace(/ +/g, ' ');
|
||||
|
||||
self.creatorDid = self.creatorDid || self.id || self.url;
|
||||
|
||||
// check the imgFormat with respect to the formats accepted image format
|
||||
const chooseTileFormat = (acceptedFormats) => {
|
||||
if (acceptedFormats.indexOf("webp") >= 0) {
|
||||
const chooseTileFormat = (formats) => {
|
||||
if (formats.indexOf("webp") >= 0) {
|
||||
return "webp";
|
||||
} else if (acceptedFormats.indexOf("png") >= 0) {
|
||||
} else if (formats.indexOf("png") >= 0) {
|
||||
return "png";
|
||||
} else if (acceptedFormats.indexOf("jpeg") >= 0) {
|
||||
} else if (formats.indexOf("jpeg") >= 0) {
|
||||
return "jpeg";
|
||||
} else if (acceptedFormats.indexOf("fits") >= 0) {
|
||||
} else if (formats.indexOf("fits") >= 0) {
|
||||
return "fits";
|
||||
} else if (acceptedFormats.indexOf("fits.fz") >= 0) {
|
||||
} else if (formats.indexOf("fits.fz") >= 0) {
|
||||
return "fits";
|
||||
} else {
|
||||
throw (
|
||||
"Unsupported format(s) found in the properties: " +
|
||||
acceptedFormats
|
||||
formats
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -598,9 +656,9 @@ export let HiPS = (function () {
|
||||
// Set an image format with respect to the ones available for that HiPS if:
|
||||
// * the format is unknown
|
||||
// * the format is known but is not available for that HiPS
|
||||
if (!self.imgFormat || !self.acceptedFormats.includes(self.imgFormat)) {
|
||||
if (!self.imgFormat || !self.formats.includes(self.imgFormat)) {
|
||||
// Switch automatically to a available format
|
||||
let imgFormat = chooseTileFormat(self.acceptedFormats);
|
||||
let imgFormat = chooseTileFormat(self.formats);
|
||||
self.setImageFormat(imgFormat)
|
||||
|
||||
console.info(self.id + " tile format chosen: " + self.imgFormat)
|
||||
@@ -649,18 +707,7 @@ export let HiPS = (function () {
|
||||
* @returns {string[]} Returns the formats accepted for the survey, i.e. the formats of tiles that are availables. Could be PNG, WEBP, JPG and FITS.
|
||||
*/
|
||||
HiPS.prototype.getAvailableFormats = function () {
|
||||
return this.acceptedFormats;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the opacity factor when rendering the HiPS
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @param {number} opacity - Opacity of the survey to set. Between 0 and 1
|
||||
*/
|
||||
HiPS.prototype.setOpacity = function (opacity) {
|
||||
this.setOptions({opacity})
|
||||
return this.formats;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -668,7 +715,7 @@ export let HiPS = (function () {
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @param {boolean} [additive=false] - When rendering this survey on top of the already rendered ones, the final color of the screen is computed like:
|
||||
* @param {boolean} [blending=false] - When rendering this survey on top of the already rendered ones, the final color of the screen is computed like:
|
||||
* <br />
|
||||
* <br />opacity * this_survey_color + (1 - opacity) * already_rendered_color for the default mode
|
||||
* <br />opacity * this_survey_color + already_rendered_color for the additive mode
|
||||
@@ -677,12 +724,12 @@ export let HiPS = (function () {
|
||||
* Additive mode allows you to do linear survey color combination i.e. let's define 3 surveys named s1, s2, s3. Each could be associated to one color channel, i.e. s1 with red, s2 with green and s3 with the blue color channel.
|
||||
* If the additive blending mode is enabled, then the final pixel color of your screen will be: rgb = [s1_opacity * s1_color; s2_opacity * s2_color; s3_opacity * s3_color]
|
||||
*/
|
||||
HiPS.prototype.setBlendingConfig = function (additive = false) {
|
||||
this.setOptions({additive});
|
||||
HiPS.prototype.setBlendingConfig = function (blending = false) {
|
||||
this.setOptions({blending});
|
||||
};
|
||||
|
||||
HiPS.prototype.isSpectralCube = function() {
|
||||
return this.hipsTileDepth !== undefined && this.hipsTileDepth !== null;
|
||||
return this.tileDepth !== undefined && this.tileDepth !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -721,9 +768,7 @@ export let HiPS = (function () {
|
||||
* @param {boolean} [options.reversed=false] - Reverse the colormap axis.
|
||||
*/
|
||||
HiPS.prototype.setColormap = function (colormap, options) {
|
||||
colormap = colormap || this.options.colormap;
|
||||
|
||||
this.setOptions({colormap, ...options})
|
||||
this.setOptions({colormap, ...options});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -737,54 +782,11 @@ export let HiPS = (function () {
|
||||
* @param {number} maxCut - The high cut value to set for the HiPS.
|
||||
* @param {string} [imgFormat] - The image format for which one wants to set the cuts. By default, the format used is the current imageFormat
|
||||
*/
|
||||
HiPS.prototype.setCuts = function (minCut, maxCut, imgFormat) {
|
||||
imgFormat = imgFormat?.toLowerCase();
|
||||
|
||||
if (imgFormat === "jpg") {
|
||||
imgFormat = "jpeg";
|
||||
}
|
||||
|
||||
this.setOptions({minCut, maxCut, cutFormat: imgFormat})
|
||||
HiPS.prototype.setCuts = function (minCut, maxCut, cutFormat) {
|
||||
this.setOptions({minCut, maxCut, cutFormat})
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the low and high cuts under the form of a 2 element array
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @returns {number[]} The low and high cut values for the HiPS.
|
||||
*/
|
||||
HiPS.prototype.getCuts = function () {
|
||||
return this.colorCfg.getCuts();
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the gamma correction factor for the HiPS.
|
||||
*
|
||||
* This method updates the gamma of the HiPS.
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @param {number} gamma - The saturation value to set for the HiPS. Between 0.1 and 10
|
||||
*/
|
||||
HiPS.prototype.setGamma = function (gamma) {
|
||||
this.setOptions({gamma})
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the saturation for the HiPS.
|
||||
*
|
||||
* This method updates the saturation of the HiPS.
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @param {number} saturation - The saturation value to set for the HiPS. Between 0 and 1
|
||||
*/
|
||||
HiPS.prototype.setSaturation = function (saturation) {
|
||||
this.setOptions({saturation})
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sets the brightness for the HiPS.
|
||||
*
|
||||
* This method updates the brightness of the HiPS.
|
||||
@@ -793,10 +795,15 @@ export let HiPS = (function () {
|
||||
*
|
||||
* @param {number} brightness - The brightness value to set for the HiPS. Between 0 and 1
|
||||
*/
|
||||
HiPS.prototype.setBrightness = function (brightness) {
|
||||
HiPS.prototype.setBrightness = function(brightness) {
|
||||
this.setOptions({brightness})
|
||||
};
|
||||
|
||||
// @api
|
||||
HiPS.prototype.getBrightness = function() {
|
||||
return this.brightness;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the contrast for the HiPS.
|
||||
*
|
||||
@@ -806,10 +813,103 @@ export let HiPS = (function () {
|
||||
*
|
||||
* @param {number} contrast - The contrast value to set for the HiPS. Between 0 and 1
|
||||
*/
|
||||
HiPS.prototype.setContrast = function (contrast) {
|
||||
HiPS.prototype.setContrast = function(contrast) {
|
||||
this.setOptions({contrast})
|
||||
};
|
||||
|
||||
// @api
|
||||
HiPS.prototype.getContrast = function() {
|
||||
return this.kContrast;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the saturation for the HiPS.
|
||||
*
|
||||
* This method updates the saturation of the HiPS.
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @param {number} saturation - The saturation value to set for the HiPS. Between 0 and 1
|
||||
*/
|
||||
HiPS.prototype.setSaturation = function(saturation) {
|
||||
this.setOptions({saturation})
|
||||
};
|
||||
|
||||
// @api
|
||||
HiPS.prototype.getSaturation = function() {
|
||||
return this.kSaturation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the gamma correction factor for the HiPS.
|
||||
*
|
||||
* This method updates the gamma of the HiPS.
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @param {number} gamma - The saturation value to set for the HiPS. Between 0.1 and 10
|
||||
*/
|
||||
HiPS.prototype.setGamma = function(gamma) {
|
||||
this.setOptions({gamma})
|
||||
};
|
||||
|
||||
// @api
|
||||
HiPS.prototype.getGamma = function() {
|
||||
return this.kGamma;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the opacity factor when rendering the HiPS
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @param {number} opacity - Opacity of the survey to set. Between 0 and 1
|
||||
*/
|
||||
HiPS.prototype.setOpacity = function(opacity) {
|
||||
this.setOptions({opacity})
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the opacity of the HiPS layer
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @returns {number} The opacity of the layer
|
||||
*/
|
||||
HiPS.prototype.getOpacity = function() {
|
||||
return this.opacity;
|
||||
};
|
||||
|
||||
// @api
|
||||
HiPS.prototype.getAlpha = HiPS.prototype.getOpacity;
|
||||
|
||||
HiPS.prototype.getBlendingConfig = function() {
|
||||
return this.blending;
|
||||
};
|
||||
|
||||
// @api
|
||||
HiPS.prototype.getColormap = function() {
|
||||
return this.colormap;
|
||||
};
|
||||
|
||||
HiPS.prototype.getReversed = function() {
|
||||
return this.reversed;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the low and high cuts under the form of a 2 element array
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @returns {number[]} The low and high cut values for the HiPS.
|
||||
*/
|
||||
HiPS.prototype.getCuts = function() {
|
||||
return [
|
||||
this.minCut[this.imgFormat],
|
||||
this.maxCut[this.imgFormat]
|
||||
];
|
||||
};
|
||||
|
||||
HiPS.prototype.setSliceNumber = function(slice) {
|
||||
this.slice = slice;
|
||||
|
||||
@@ -830,6 +930,9 @@ export let HiPS = (function () {
|
||||
* @param {number} [options.value] = The frequency value expressed in `options.unit`
|
||||
* @param {"Hz"|"m"|"m/s"} [options.unit="Hz"] - The unit of the frequency passed
|
||||
* @param {number} [options.restFreq] - "The rest frequency (in Hz) to use for computing the velocity in m.s-1"
|
||||
*
|
||||
* @example
|
||||
* hips3d.setFrequency({ value: 1420302592, unit: 'Hz' })
|
||||
*/
|
||||
HiPS.prototype.setFrequency = function(options) {
|
||||
if (this.added) {
|
||||
@@ -858,12 +961,22 @@ export let HiPS = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the frequency in Hz
|
||||
*
|
||||
* @memberof HiPS
|
||||
*/
|
||||
HiPS.prototype.getFrequency = function() {
|
||||
if (this.added) {
|
||||
return this.view.wasm.getFreq(this.layer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the frequency window around the current observed frequency in Hz
|
||||
*
|
||||
* @memberof HiPS
|
||||
*/
|
||||
HiPS.prototype.getFrequencyWindow = function() {
|
||||
if (this.added) {
|
||||
return this.view.wasm.getFreqWindow(this.layer);
|
||||
@@ -874,10 +987,7 @@ export let HiPS = (function () {
|
||||
HiPS.prototype._updateMetadata = function () {
|
||||
try {
|
||||
if (this.added) {
|
||||
this.view.wasm.setImageMetadata(this.layer, {
|
||||
...this.colorCfg.get(),
|
||||
imgFormat: this.imgFormat,
|
||||
});
|
||||
this.view.wasm.setImageMetadata(this.layer, this._prepareMetadataForWASM());
|
||||
// once the meta have been well parsed, we can set the meta
|
||||
ALEvent.LAYER_CHANGED.dispatchedTo(this.view.aladinDiv, {
|
||||
layer: this,
|
||||
@@ -906,14 +1016,93 @@ export let HiPS = (function () {
|
||||
* @param {boolean} [options.reversed=false] - If true, the colormap is reversed; otherwise, it is not reversed.
|
||||
* @param {number} [options.minCut] - The minimum cut value for the color configuration. If not given, 0.0 for JPEG/PNG surveys, the value of the property file for FITS surveys
|
||||
* @param {number} [options.maxCut] - The maximum cut value for the color configuration. If not given, 1.0 for JPEG/PNG surveys, the value of the property file for FITS surveys
|
||||
* @param {boolean} [options.additive=false] - If true, additive blending is applied; otherwise, it is not applied.
|
||||
* @param {boolean} [options.blending=false] - If true, additive blending is applied; otherwise, it is not applied.
|
||||
* @param {number} [options.gamma=1.0] - The gamma correction value for the color configuration.
|
||||
* @param {number} [options.saturation=0.0] - The saturation value for the color configuration.
|
||||
* @param {number} [options.brightness=0.0] - The brightness value for the color configuration.
|
||||
* @param {number} [options.contrast=0.0] - The contrast value for the color configuration.
|
||||
*/
|
||||
HiPS.prototype.setOptions = function(options) {
|
||||
this.colorCfg.setOptions(options);
|
||||
/// imgFormat
|
||||
if (options && options.imgFormat) {
|
||||
this.imgFormat = options.imgFormat
|
||||
}
|
||||
|
||||
/// colormap
|
||||
if (options && options.colormap) {
|
||||
this.colormap = options.colormap.toLowerCase()
|
||||
}
|
||||
|
||||
/// stretch
|
||||
if (options && options.stretch) {
|
||||
let stretch = options.stretch;
|
||||
this.stretch = stretch.toLowerCase()
|
||||
}
|
||||
|
||||
/// reversed
|
||||
if (options && options.reversed !== undefined) {
|
||||
this.reversed = options.reversed;
|
||||
}
|
||||
|
||||
/// cuts
|
||||
let cutFormat = options.cutFormat?.toLowerCase() || this.imgFormat;
|
||||
|
||||
if (cutFormat === "jpg") {
|
||||
cutFormat = "jpeg";
|
||||
}
|
||||
|
||||
|
||||
let minCut = options && options.minCut;
|
||||
if (minCut instanceof Object) {
|
||||
// Mincut is given in the form of an javascript object with all the formats
|
||||
this.minCut = {...this.minCut, ...minCut};
|
||||
} else if (minCut !== null && minCut !== undefined) {
|
||||
this.minCut[cutFormat] = minCut;
|
||||
}
|
||||
|
||||
let maxCut = options && options.maxCut;
|
||||
if (maxCut instanceof Object) {
|
||||
this.maxCut = {...this.maxCut, ...maxCut};
|
||||
} else if (maxCut !== null && maxCut !== undefined) {
|
||||
this.maxCut[cutFormat] = maxCut;
|
||||
}
|
||||
|
||||
if (options && Utils.isNumber(options.brightness)) {
|
||||
let brightness = options.brightness;
|
||||
|
||||
brightness = +brightness || 0.0; // coerce to number
|
||||
this.brightness = Math.max(-1, Math.min(brightness, 1));
|
||||
}
|
||||
|
||||
if (options && Utils.isNumber(options.saturation)) {
|
||||
let saturation = options.saturation;
|
||||
saturation = +saturation || 0.0; // coerce to number
|
||||
|
||||
this.saturation = Math.max(-1, Math.min(saturation, 1));
|
||||
}
|
||||
|
||||
if (options && Utils.isNumber(options.contrast)) {
|
||||
let contrast = options.contrast;
|
||||
|
||||
contrast = +contrast || 0.0; // coerce to number
|
||||
this.contrast = Math.max(-1, Math.min(contrast, 1));
|
||||
}
|
||||
|
||||
if (options && Utils.isNumber(options.gamma)) {
|
||||
let gamma = options.gamma;
|
||||
gamma = +gamma; // coerce to number
|
||||
this.gamma = Math.max(0.1, Math.min(gamma, 10));
|
||||
}
|
||||
|
||||
if (options && Utils.isNumber(options.opacity)) {
|
||||
let opacity = options.opacity;
|
||||
opacity = +opacity; // coerce to number
|
||||
this.opacity = Math.max(0, Math.min(opacity, 1));
|
||||
}
|
||||
|
||||
if (options && options.blending) {
|
||||
this.blending = options.blending;
|
||||
}
|
||||
|
||||
/// Set image format
|
||||
if (options.imgFormat) {
|
||||
@@ -932,10 +1121,10 @@ export let HiPS = (function () {
|
||||
} else {
|
||||
// Passed the check, we erase the image format with the new one
|
||||
// We do nothing if the imgFormat is the same
|
||||
|
||||
|
||||
// Check the properties to see if the given format is available among the list
|
||||
// If the properties have not been retrieved yet, it will be tested afterwards
|
||||
const availableFormats = this.acceptedFormats;
|
||||
const availableFormats = this.formats;
|
||||
// user wants a fits but the metadata tells this format is not available
|
||||
if (!availableFormats || (availableFormats && availableFormats.indexOf(imgFormat) >= 0)) {
|
||||
this.imgFormat = imgFormat;
|
||||
@@ -951,13 +1140,6 @@ export let HiPS = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
this.options = {
|
||||
...this.options,
|
||||
...options,
|
||||
minCut: this.colorCfg.minCut,
|
||||
maxCut: this.colorCfg.maxCut
|
||||
};
|
||||
|
||||
this._updateMetadata();
|
||||
};
|
||||
|
||||
@@ -984,24 +1166,6 @@ export let HiPS = (function () {
|
||||
*/
|
||||
HiPS.prototype.setAlpha = HiPS.prototype.setOpacity;
|
||||
|
||||
// @api
|
||||
HiPS.prototype.getColorCfg = function () {
|
||||
return this.colorCfg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the opacity of the HiPS layer
|
||||
*
|
||||
* @memberof HiPS
|
||||
*
|
||||
* @returns {number} The opacity of the layer
|
||||
*/
|
||||
HiPS.prototype.getOpacity = function () {
|
||||
return this.colorCfg.getOpacity();
|
||||
};
|
||||
|
||||
HiPS.prototype.getAlpha = HiPS.prototype.getOpacity;
|
||||
|
||||
/**
|
||||
* Probe the HiPS at a screen pixel location.
|
||||
*
|
||||
@@ -1076,11 +1240,43 @@ export let HiPS = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateHiPSCache = false;
|
||||
|
||||
let self = this;
|
||||
let hipsCache = this.view.aladin.hipsCache;
|
||||
|
||||
if (hipsCache.contains(self.id)) {
|
||||
hipsCache.append(self.id, this.options)
|
||||
hipsCache.update(self.id, {
|
||||
creatorDid: self.creatorDid,
|
||||
url: self.url,
|
||||
maxOrder: self.maxOrder,
|
||||
cooFrame: self.cooFrame,
|
||||
tileSize: self.tileSize,
|
||||
formats: self.formats,
|
||||
bitpix: self.bitpix,
|
||||
skyFraction: self.skyFraction,
|
||||
minOrder: self.minOrder,
|
||||
initialFov: self.initialFov,
|
||||
initialRa: self.initialRa,
|
||||
initialDec: self.initialDec,
|
||||
emMin: self.emMin,
|
||||
emMax: self.emMax,
|
||||
// HiPS Cube
|
||||
cubeDepth: self.cubeDepth,
|
||||
// HiPS3D
|
||||
tileDepth: self.tileDepth,
|
||||
orderFreq: self.orderFreq,
|
||||
// Dataproduct type
|
||||
dataproductType: self.dataproductType,
|
||||
isPlanetaryBody: self.isPlanetaryBody(),
|
||||
hipsBody: self.hipsBody,
|
||||
requestCredentials: self.requestCredentials,
|
||||
requestMode: self.requestMode,
|
||||
name: this.name,
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
...this._getMetadata(),
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1093,6 +1289,25 @@ export let HiPS = (function () {
|
||||
}
|
||||
};
|
||||
|
||||
HiPS.prototype._getMetadata = function() {
|
||||
return {
|
||||
imgFormat: this.imgFormat,
|
||||
blending: this.blending,
|
||||
opacity: this.opacity,
|
||||
// Tonal corrections constants
|
||||
gamma: this.gamma,
|
||||
saturation: this.saturation,
|
||||
brightness: this.brightness,
|
||||
contrast: this.contrast,
|
||||
|
||||
stretch: this.stretch,
|
||||
minCut: this.minCut,
|
||||
maxCut: this.maxCut,
|
||||
reversed: this.reversed,
|
||||
colormap: this.colormap,
|
||||
};
|
||||
};
|
||||
|
||||
HiPS.prototype._addToView = function (layer) {
|
||||
if (!this.view)
|
||||
return this;
|
||||
@@ -1106,22 +1321,22 @@ export let HiPS = (function () {
|
||||
creatorDid: self.creatorDid,
|
||||
url: self.url,
|
||||
maxOrder: self.maxOrder,
|
||||
cooFrame: self.cooFrame.system,
|
||||
cooFrame: self.cooFrame,
|
||||
tileSize: self.tileSize,
|
||||
formats: self.acceptedFormats,
|
||||
bitpix: self.numBitsPerPixel,
|
||||
formats: self.formats,
|
||||
bitpix: self.bitpix,
|
||||
skyFraction: self.skyFraction,
|
||||
minOrder: self.minOrder,
|
||||
hipsInitialFov: self.initialFov,
|
||||
hipsInitialRa: self.initialRa,
|
||||
hipsInitialDec: self.initialDec,
|
||||
initialFov: self.initialFov,
|
||||
initialRa: self.initialRa,
|
||||
initialDec: self.initialDec,
|
||||
emMin: self.emMin,
|
||||
emMax: self.emMax,
|
||||
// HiPS Cube
|
||||
hipsCubeDepth: self.cubeDepth,
|
||||
cubeDepth: self.cubeDepth,
|
||||
// HiPS3D
|
||||
hipsTileDepth: self.hipsTileDepth,
|
||||
hipsOrderFreq: self.hipsOrderFreq,
|
||||
tileDepth: self.tileDepth,
|
||||
orderFreq: self.orderFreq,
|
||||
// Dataproduct type
|
||||
dataproductType: self.dataproductType,
|
||||
isPlanetaryBody: self.isPlanetaryBody(),
|
||||
@@ -1129,10 +1344,7 @@ export let HiPS = (function () {
|
||||
requestCredentials: self.requestCredentials,
|
||||
requestMode: self.requestMode,
|
||||
},
|
||||
meta: {
|
||||
...this.colorCfg.get(),
|
||||
imgFormat: this.imgFormat,
|
||||
}
|
||||
meta: this._prepareMetadataForWASM()
|
||||
};
|
||||
|
||||
let localFiles;
|
||||
@@ -1175,7 +1387,41 @@ export let HiPS = (function () {
|
||||
return this
|
||||
};
|
||||
|
||||
HiPS.prototype._prepareMetadataForWASM = function() {
|
||||
let metadata = this._getMetadata();
|
||||
let blending = {
|
||||
srcColorFactor: 'SrcAlpha',
|
||||
dstColorFactor: 'OneMinusSrcAlpha',
|
||||
func: 'FuncAdd'
|
||||
};
|
||||
|
||||
if (this.blending) {
|
||||
blending = {
|
||||
srcColorFactor: 'SrcAlpha',
|
||||
dstColorFactor: 'One',
|
||||
func: 'FuncAdd'
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
metadata["minCut"] = minCut;
|
||||
metadata["maxCut"] = maxCut;
|
||||
metadata["blending"] = blending;
|
||||
|
||||
return metadata;
|
||||
};
|
||||
|
||||
HiPS.DEFAULT_SURVEY_ID = "P/DSS2/color";
|
||||
|
||||
return HiPS;
|
||||
})();
|
||||
|
||||
|
||||
+11
-3
@@ -37,11 +37,17 @@ export let HiPSCache = (function () {
|
||||
this.cache = {}
|
||||
};
|
||||
|
||||
HiPSCache.prototype.update = function (key, obj) {
|
||||
this.cache[key] = obj;
|
||||
|
||||
ALEvent.HIPS_CACHE_UPDATED.dispatchedTo(document.body);
|
||||
};
|
||||
|
||||
/*
|
||||
* key can be a CDS ID or an url. TODO could be an options.name too.
|
||||
*/
|
||||
HiPSCache.prototype.append = function (key, options) {
|
||||
this.cache[key] = options;
|
||||
HiPSCache.prototype.append = function (key, obj) {
|
||||
this.cache[key] = obj;
|
||||
|
||||
ALEvent.HIPS_CACHE_UPDATED.dispatchedTo(document.body);
|
||||
};
|
||||
@@ -59,7 +65,9 @@ export let HiPSCache = (function () {
|
||||
* key can be a CDS ID or an url. TODO could be an options.name too.
|
||||
*/
|
||||
HiPSCache.prototype.get = function (key) {
|
||||
return this.cache[key];
|
||||
let obj = this.cache[key];
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -186,6 +186,11 @@ HiPSProperties.getFasterMirrorUrl = function (metadata) {
|
||||
mode: 'cors',
|
||||
cache: "no-cache",
|
||||
};
|
||||
|
||||
if (baseUrl.slice(-1) === '/') {
|
||||
baseUrl = baseUrl.substr(0, baseUrl.length - 1);
|
||||
}
|
||||
|
||||
let validRequest = await fetch(baseUrl + '/properties', options).then((resp) => {
|
||||
// completed request before timeout fired
|
||||
clearTimeout(timeoutId)
|
||||
|
||||
+134
-52
@@ -29,11 +29,10 @@
|
||||
* Authors: Matthieu Baumann [CDS]
|
||||
*
|
||||
*****************************************************************************/
|
||||
import { ColorCfg } from "./ColorCfg.js";
|
||||
import { Aladin } from "./Aladin.js";
|
||||
import { Utils } from "./Utils";
|
||||
import { AVM } from "./libs/avm.js";
|
||||
import { HiPS } from "./HiPS.js";
|
||||
import { JSONP_PROXY } from "./Constants";
|
||||
|
||||
/**
|
||||
* @typedef {Object} WCS
|
||||
@@ -140,13 +139,55 @@ export let Image = (function () {
|
||||
this.id = url;
|
||||
this.name = (options && options.name) || this.url;
|
||||
this.imgFormat = options && options.imgFormat;
|
||||
this.acceptedFormats = [this.imgFormat];
|
||||
this.formats = [this.imgFormat];
|
||||
this.type = "image"
|
||||
|
||||
// Opacity of the survey/image
|
||||
this.opacity = (options && options.opacity) || 1.0;
|
||||
|
||||
// Colormap config options
|
||||
this.colormap = (options && options.colormap) || "native";
|
||||
this.colormap = this.colormap.toLowerCase();
|
||||
|
||||
this.stretch = (options && options.stretch) || "linear";
|
||||
this.stretch = this.stretch.toLowerCase();
|
||||
this.reversed = false;
|
||||
|
||||
if (options && options.reversed === true) {
|
||||
this.reversed = true;
|
||||
}
|
||||
|
||||
this.minCut = {
|
||||
webp: 0.0,
|
||||
jpeg: 0.0,
|
||||
png: 0.0,
|
||||
fits: undefined // wait the default value coming from the properties
|
||||
};
|
||||
|
||||
this.maxCut = {
|
||||
webp: 255.0,
|
||||
jpeg: 255.0,
|
||||
png: 255.0,
|
||||
fits: undefined // wait the default value coming from the properties
|
||||
};
|
||||
|
||||
this.setCuts(options.minCut, options.maxCut);
|
||||
|
||||
this.blending = options && options.blending;
|
||||
if (this.blending === undefined) {
|
||||
this.blending = false;
|
||||
}
|
||||
|
||||
// A default value for gamma correction
|
||||
this.gamma = (options && options.gamma) || 1.0;
|
||||
this.saturation = (options && options.saturation) || 0.0;
|
||||
this.brightness = (options && options.brightness) || 0.0;
|
||||
this.contrast = (options && options.contrast) || 0.0;
|
||||
|
||||
// callbacks
|
||||
this.successCallback = options && options.successCallback;
|
||||
this.errorCallback = options && options.errorCallback;
|
||||
|
||||
this.colorCfg = new ColorCfg(options);
|
||||
this.options = options || {};
|
||||
|
||||
let self = this;
|
||||
@@ -301,8 +342,6 @@ export let Image = (function () {
|
||||
*/
|
||||
Image.prototype.setAlpha = HiPS.prototype.setOpacity;
|
||||
|
||||
Image.prototype.getColorCfg = HiPS.prototype.getColorCfg;
|
||||
|
||||
/**
|
||||
* Get the opacity of the image layer
|
||||
*
|
||||
@@ -341,7 +380,13 @@ export let Image = (function () {
|
||||
*/
|
||||
Image.prototype.getAvailableFormats = HiPS.prototype.getAvailableFormats;
|
||||
|
||||
|
||||
Image.prototype.getColormap = HiPS.prototype.getColormap;
|
||||
Image.prototype.getReversed = HiPS.prototype.getReversed;
|
||||
Image.prototype.getBrightness = HiPS.prototype.getBrightness;
|
||||
Image.prototype.getSaturation = HiPS.prototype.getSaturation;
|
||||
Image.prototype.getContrast = HiPS.prototype.getContrast;
|
||||
Image.prototype.getGamma = HiPS.prototype.getGamma;
|
||||
|
||||
Image.prototype._setView = function (view) {
|
||||
this.view = view;
|
||||
};
|
||||
@@ -361,7 +406,29 @@ export let Image = (function () {
|
||||
};
|
||||
|
||||
/* Private method view is already attached */
|
||||
Image.prototype._saveInCache = HiPS.prototype._saveInCache;
|
||||
/* Precondition: view is attached */
|
||||
Image.prototype._saveInCache = function () {
|
||||
if (!this.view) {
|
||||
this.updateHiPSCache = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateHiPSCache = false;
|
||||
|
||||
let self = this;
|
||||
let hipsCache = this.view.aladin.hipsCache;
|
||||
|
||||
if (hipsCache.contains(self.id)) {
|
||||
hipsCache.update(self.id, {
|
||||
url: self.url,
|
||||
formats: self.formats,
|
||||
name: this.name,
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
...this._getMetadata(),
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// Private method for updating the view with the new meta
|
||||
Image.prototype._updateMetadata = HiPS.prototype._updateMetadata;
|
||||
@@ -401,7 +468,7 @@ export let Image = (function () {
|
||||
}
|
||||
|
||||
promise = promise.then((imageParams) => {
|
||||
self.acceptedFormats = [self.imgFormat];
|
||||
self.formats = [self.imgFormat];
|
||||
|
||||
// There is at least one entry in imageParams
|
||||
self.added = true;
|
||||
@@ -451,31 +518,27 @@ export let Image = (function () {
|
||||
url: this.url,
|
||||
dataType: 'arrayBuffer',
|
||||
success: (buf) => {
|
||||
self.imgFormat = 'fits';
|
||||
return self.view.wasm.addFITSImage(
|
||||
new Uint8Array(buf),
|
||||
{
|
||||
...self.colorCfg.get(),
|
||||
imgFormat: 'fits',
|
||||
},
|
||||
self._prepareMetadataForWASM(),
|
||||
layer
|
||||
)
|
||||
},
|
||||
error: (e) => {
|
||||
console.error(e)
|
||||
console.info("Trying querying the FITS through proxy:" + Aladin.JSONP_PROXY)
|
||||
console.info("Trying querying the FITS through proxy:" + JSONP_PROXY)
|
||||
// try as cors
|
||||
const url = Aladin.JSONP_PROXY + '?url=' + self.url;
|
||||
const url = JSONP_PROXY + '?url=' + self.url;
|
||||
|
||||
return Utils.fetch({
|
||||
url: url,
|
||||
url,
|
||||
dataType: 'arrayBuffer',
|
||||
success: (buf) => {
|
||||
self.imgFormat = 'fits';
|
||||
return self.view.wasm.addFITSImage(
|
||||
new Uint8Array(buf),
|
||||
{
|
||||
...self.colorCfg.get(),
|
||||
imgFormat: 'fits',
|
||||
},
|
||||
self._prepareMetadataForWASM(),
|
||||
layer
|
||||
)
|
||||
},
|
||||
@@ -484,17 +547,32 @@ export let Image = (function () {
|
||||
})
|
||||
.then((imageParams) => {
|
||||
self.imgFormat = 'fits'
|
||||
self.colorCfg.setOptions({imgFormat: 'fits'});
|
||||
|
||||
return Promise.resolve(imageParams);
|
||||
})
|
||||
};
|
||||
|
||||
Image.prototype._getMetadata = HiPS.prototype._getMetadata;
|
||||
|
||||
Image.prototype._prepareMetadataForWASM = HiPS.prototype._prepareMetadataForWASM;
|
||||
|
||||
Image.prototype._addJPGOrPNG = function(layer) {
|
||||
let self = this;
|
||||
let img = document.createElement('img');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let checkImgFormat = Utils.fetchWithProxy({url: this.url, dataType: 'arrayBuffer'})
|
||||
.then(arrayBuffer => {
|
||||
const view = new DataView(arrayBuffer);
|
||||
// See the magic bytes for JPEG or PNG files
|
||||
if (view.getUint8(0) === 0xFF && view.getUint8(1) === 0xD8) {
|
||||
return "jpeg";
|
||||
} else if (view.getUint8(0) === 0x89 && view.getUint8(1) === 0x50) {
|
||||
return "png";
|
||||
} else {
|
||||
throw new Error("Unknown image format");
|
||||
}
|
||||
})
|
||||
|
||||
let loadImg = new Promise((resolve, reject) => {
|
||||
img.src = this.url;
|
||||
img.crossOrigin = "Anonymous";
|
||||
img.onload = () => {
|
||||
@@ -504,6 +582,8 @@ export let Image = (function () {
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
|
||||
img.arrat
|
||||
|
||||
// Copy the image contents to the canvas
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, img.width, img.height);
|
||||
@@ -525,12 +605,20 @@ export let Image = (function () {
|
||||
// obj.tags (object) = An array containing all the loaded tags e.g. obj.tags['Headline']
|
||||
// obj.wcs (object) = The wcs parsed from the image
|
||||
if (obj.wcsdata) {
|
||||
if (obj.wcs.NAXIS1 === undefined) {
|
||||
obj.wcs.NAXIS1 = img.width;
|
||||
}
|
||||
|
||||
if (img.width !== obj.wcs.NAXIS1) {
|
||||
obj.wcs.CDELT1 = obj.wcs.CDELT1 * (obj.wcs.NAXIS1 / img.width);
|
||||
obj.wcs.CRPIX1 *= img.width / obj.wcs.NAXIS1;
|
||||
obj.wcs.NAXIS1 = img.width;
|
||||
}
|
||||
|
||||
if (obj.wcs.NAXIS2 === undefined) {
|
||||
obj.wcs.NAXIS2 = img.height;
|
||||
}
|
||||
|
||||
if (img.height !== obj.wcs.NAXIS2) {
|
||||
obj.wcs.CDELT2 = obj.wcs.CDELT2 * (obj.wcs.NAXIS2 / img.height);
|
||||
obj.wcs.CRPIX2 *= img.height / obj.wcs.NAXIS2;
|
||||
@@ -561,38 +649,32 @@ export let Image = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
console.error(e);
|
||||
console.info("Using proxy", Aladin.JSONP_PROXY)
|
||||
console.info("Using proxy", JSONP_PROXY)
|
||||
proxyUsed = true;
|
||||
img.src = Aladin.JSONP_PROXY + '?url=' + self.url;
|
||||
img.src = JSONP_PROXY + '?url=' + self.url;
|
||||
}
|
||||
})
|
||||
.then((bytes) => {
|
||||
let wcs = self.options && self.options.wcs;
|
||||
wcs.NAXIS1 = wcs.NAXIS1 || img.width;
|
||||
wcs.NAXIS2 = wcs.NAXIS2 || img.height;
|
||||
return self.view.wasm
|
||||
.addRGBAImage(
|
||||
bytes,
|
||||
wcs,
|
||||
{
|
||||
...self.colorCfg.get(),
|
||||
imgFormat: 'jpeg',
|
||||
},
|
||||
layer
|
||||
)
|
||||
})
|
||||
.then((imageParams) => {
|
||||
self.imgFormat = 'jpeg'
|
||||
self.colorCfg.setOptions({imgFormat: 'jpeg'});
|
||||
return Promise.resolve(imageParams);
|
||||
})
|
||||
/*.catch((e) => {
|
||||
console.error(e)
|
||||
})*/
|
||||
.finally(() => {
|
||||
img.remove();
|
||||
});
|
||||
|
||||
return Promise.all([loadImg, checkImgFormat])
|
||||
.then(([imgBytes, imgFormat]) => {
|
||||
let wcs = self.options && self.options.wcs;
|
||||
wcs.NAXIS1 = wcs.NAXIS1 || img.width;
|
||||
wcs.NAXIS2 = wcs.NAXIS2 || img.height;
|
||||
wcs.NAXIS = wcs.NAXIS || 2;
|
||||
|
||||
self.imgFormat = imgFormat;
|
||||
|
||||
return self.view.wasm
|
||||
.addRGBAImage(
|
||||
imgBytes,
|
||||
wcs,
|
||||
self._prepareMetadataForWASM(),
|
||||
layer
|
||||
)
|
||||
})
|
||||
.finally(() => {
|
||||
img.remove();
|
||||
});
|
||||
};
|
||||
|
||||
return Image;
|
||||
|
||||
+4
-3
@@ -50,7 +50,7 @@ export class MocServer {
|
||||
static getAllHiPSes() {
|
||||
if (!this._allHiPSes) {
|
||||
const params = {
|
||||
expr: "dataproduct_type=image||dataproduct_type=cube",
|
||||
expr: "dataproduct_type=image||dataproduct_type=spectral-cube",
|
||||
//expr: "dataproduct_type=image",
|
||||
get: "record",
|
||||
fmt: "json",
|
||||
@@ -69,8 +69,8 @@ export class MocServer {
|
||||
|
||||
static getAllHiPSesInsideView(aladin) {
|
||||
let params = {
|
||||
//expr: "dataproduct_type=image||dataproduct_type=cube",
|
||||
expr: "dataproduct_type=image",
|
||||
expr: "dataproduct_type=image||dataproduct_type=spectral-cube",
|
||||
//expr: "dataproduct_type=image",
|
||||
get: "record",
|
||||
fmt: "json",
|
||||
fields: "ID",
|
||||
@@ -118,6 +118,7 @@ export class MocServer {
|
||||
};
|
||||
|
||||
this._allCatalogHiPSes = Utils.loadFromUrls(MocServer.MIRRORS_HTTPS, {data: params, dataType: 'json'})
|
||||
this._allCatalogHiPSes.then((aa) => console.log(aa))
|
||||
}
|
||||
|
||||
return this._allCatalogHiPSes;
|
||||
|
||||
+5
-2
@@ -309,12 +309,15 @@ export let GraphicOverlay = (function() {
|
||||
*
|
||||
* @memberof GraphicOverlay
|
||||
*
|
||||
* @param {string} hex - The color given in hexadecimal e.g. '#ffa0bb'
|
||||
* @param {string} color - Any CSS color string (hex e.g. '#ffa0bb', rgb(), named color)
|
||||
* @param {number} percent - The percentage to increase the brightness of
|
||||
*
|
||||
* @returns {string} The new color given as an hexadecimal string
|
||||
*/
|
||||
GraphicOverlay.increaseBrightness = function(hex, percent){
|
||||
GraphicOverlay.increaseBrightness = function(color, percent){
|
||||
// Normalize the color to hex.
|
||||
var hex = Color.standardizeColor(color);
|
||||
|
||||
// strip the leading # if it's there
|
||||
hex = hex.replace(/^\s*#|\s*$/g, '');
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ export let ProgressiveCat = (function() {
|
||||
|
||||
|
||||
// allows for filtering of sources
|
||||
this.filterFn = options.filter || undefined; // TODO: do the same for catalog
|
||||
this.filterFn = options.filter || undefined; // TODO: do the same for catalog
|
||||
|
||||
|
||||
this.onClick = options.onClick || undefined; // TODO: inherit from catalog
|
||||
@@ -248,18 +248,28 @@ export let ProgressiveCat = (function() {
|
||||
|
||||
_loadMetadata: function() {
|
||||
var self = this;
|
||||
let request = new Request(self.rootUrl + '/' + 'Metadata.xml', {
|
||||
let request = new Request(self.rootUrl + '/' + 'metadata.xml', {
|
||||
method: 'GET'
|
||||
})
|
||||
fetch(request)
|
||||
.then((resp) => resp.text())
|
||||
.then((resp) => {
|
||||
if (!resp.ok) {
|
||||
let request = new Request(self.rootUrl + '/' + 'Metadata.xml', {
|
||||
method: 'GET'
|
||||
})
|
||||
return fetch(request)
|
||||
.then((resp) => resp.text())
|
||||
} else {
|
||||
return resp.text()
|
||||
}
|
||||
})
|
||||
.then((text) => {
|
||||
let xml = ProgressiveCat.parser.parseFromString(text, "text/xml")
|
||||
|
||||
self.fields = getFields(self, xml);
|
||||
self._loadAllskyNewMethod();
|
||||
})
|
||||
.catch(err => self._loadAllskyOldMethod());
|
||||
.catch(err => self._loadAllskyOldMethod())
|
||||
},
|
||||
|
||||
_loadAllskyNewMethod: function() {
|
||||
@@ -598,10 +608,6 @@ export let ProgressiveCat = (function() {
|
||||
(function(self, norder, ipix) { // wrapping function is needed to be able to retrieve norder and ipix in ajax success function
|
||||
var key = norder + '-' + ipix;
|
||||
Utils.fetch({
|
||||
/*
|
||||
url: Aladin.JSONP_PROXY,
|
||||
data: {"url": self.getTileURL(norder, ipix)},
|
||||
*/
|
||||
// ATTENTION : je passe en JSON direct, car je n'arrive pas a choper les 404 en JSONP
|
||||
url: self.getTileURL(norder, ipix),
|
||||
desc: "Get tile .tsv " + norder + ' ' + ipix + ' of ' + self.name,
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ export let Reticle = (function() {
|
||||
|
||||
let color = options && options.reticleColor || Aladin.DEFAULT_OPTIONS.reticleColor;
|
||||
let size = options && options.reticleSize || Aladin.DEFAULT_OPTIONS.reticleSize;
|
||||
|
||||
|
||||
let show;
|
||||
if (options.showReticle === undefined) {
|
||||
show = Aladin.DEFAULT_OPTIONS.showReticle;
|
||||
|
||||
+62
-5
@@ -27,15 +27,16 @@ import { PolySelect } from "./FiniteStateMachine/PolySelect";
|
||||
import { LineSelect } from "./FiniteStateMachine/LineSelect";
|
||||
import { RectSelect } from "./FiniteStateMachine/RectSelect";
|
||||
import { ALEvent } from "./events/ALEvent";
|
||||
import { Utils } from './Utils';
|
||||
/******************************************************************************
|
||||
* Aladin Lite project
|
||||
*
|
||||
*
|
||||
* Class Selector
|
||||
*
|
||||
*
|
||||
* A selector
|
||||
*
|
||||
*
|
||||
* Author: Matthieu Baumann[CDS]
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
export class Selector {
|
||||
@@ -121,7 +122,7 @@ export class Selector {
|
||||
continue;
|
||||
}
|
||||
sources = cat.getSources();
|
||||
|
||||
|
||||
for (var l = 0; l < sources.length; l++) {
|
||||
s = sources[l];
|
||||
|
||||
@@ -172,4 +173,60 @@ export class Selector {
|
||||
|
||||
return objList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves objects skewered by the cursor position or specified coordinates. An object is
|
||||
* skewered if it is a shape that contains the specified coordinate, or is a catalog object within 3 pixels
|
||||
* of the specified coordinate.
|
||||
*
|
||||
* If e is a mouse event (as opposed to an object with x and y values), the mouse coordinates
|
||||
* of the event are used.
|
||||
*
|
||||
* This is implemented by simulating the interactive selection of a circle region with a 3 pixel radius)
|
||||
* around the given coordinates and returns all catalog sources and overlay items intersecting with it.
|
||||
*
|
||||
* @param {Event|Object} e - Mouse coordinate via mouse event or object with x and y properties
|
||||
* @param {Object} view - The Aladin View instance containing catalogs and overlays
|
||||
* @returns {Array<Array>} Array of object lists, where each subarray contains objects
|
||||
* from a single catalog or overlay that intersect with the selection region.
|
||||
* Returns empty array if no objects are found.
|
||||
*/
|
||||
static getSkewerObjects(e, view) {
|
||||
// Get the xy from the event
|
||||
let xymouse;
|
||||
if (e instanceof Event) {
|
||||
xymouse = Utils.relMouseCoords(e);
|
||||
} else {
|
||||
xymouse = e;
|
||||
}
|
||||
const x = xymouse.x;
|
||||
const y = xymouse.y;
|
||||
|
||||
// Perform a selection using a circle around x, y as if drawn by dragging 3 pixels.
|
||||
const r2 = 9;
|
||||
const r = Math.sqrt(r2);
|
||||
|
||||
let selectorObject = {
|
||||
x, y, r,
|
||||
label: 'circle',
|
||||
contains(s) {
|
||||
let dx = (s.x - x)
|
||||
let dy = (s.y - y);
|
||||
|
||||
return dx*dx + dy*dy <= r2;
|
||||
},
|
||||
bbox() {
|
||||
return {
|
||||
x: x - r,
|
||||
y: y - r,
|
||||
w: 2*r,
|
||||
h: 2*r
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let objList = Selector.getObjects(selectorObject, view);
|
||||
|
||||
return objList;
|
||||
}
|
||||
}
|
||||
+115
-50
@@ -120,6 +120,12 @@ export class SpectraDisplayer extends DOMElement {
|
||||
}
|
||||
};
|
||||
|
||||
updateCanvas() {
|
||||
this.divNode.querySelectorAll("canvas").forEach(canvas => {
|
||||
canvas.width = this.view.aladin.aladinDiv.getBoundingClientRect().width
|
||||
});
|
||||
}
|
||||
|
||||
constructor(view, options) {
|
||||
super()
|
||||
|
||||
@@ -142,7 +148,7 @@ export class SpectraDisplayer extends DOMElement {
|
||||
this.scaleX = undefined;
|
||||
this.scaleY = undefined;
|
||||
this.height = options && options.height || 300;
|
||||
this.width = options && options.width || 600;
|
||||
this.width = options && options.width || view.aladin.aladinDiv.getBoundingClientRect().width;
|
||||
this.minY = undefined;
|
||||
this.maxY = undefined;
|
||||
this.mouseFreq = undefined;
|
||||
@@ -167,19 +173,22 @@ export class SpectraDisplayer extends DOMElement {
|
||||
name: "unit selector",
|
||||
value: "f",
|
||||
type: 'select',
|
||||
classList: ['aladin-spectra-unit-selector'],
|
||||
classList: ['aladin-spectra-unit'],
|
||||
options: [
|
||||
SpectraDisplayer.UNIT.FREQUENCY.label,
|
||||
SpectraDisplayer.UNIT.WAVELENGTH.label,
|
||||
SpectraDisplayer.UNIT.VELOCITY.label,
|
||||
],
|
||||
tooltip: {
|
||||
content: `Unit: ${SpectraDisplayer.UNIT.FREQUENCY.label}, ${SpectraDisplayer.UNIT.WAVELENGTH.label} and ${SpectraDisplayer.UNIT.VELOCITY.label}`,
|
||||
position: {direction: "right"}
|
||||
aladin: view.aladin,
|
||||
global: true,
|
||||
content: `Unit: Hz, m or km/s`,
|
||||
},
|
||||
change: (e) => {
|
||||
let label = e.target.value;
|
||||
|
||||
let prevUnit = self.unit;
|
||||
|
||||
if (label === SpectraDisplayer.UNIT.FREQUENCY.label) {
|
||||
self.unit = SpectraDisplayer.UNIT.FREQUENCY
|
||||
} else if (label === SpectraDisplayer.UNIT.WAVELENGTH.label) {
|
||||
@@ -188,7 +197,15 @@ export class SpectraDisplayer extends DOMElement {
|
||||
self.unit = SpectraDisplayer.UNIT.VELOCITY
|
||||
}
|
||||
|
||||
self._redrawLabels();
|
||||
if (prevUnit === SpectraDisplayer.UNIT.FREQUENCY) {
|
||||
self.data.values.reverse();
|
||||
} else if (prevUnit === SpectraDisplayer.UNIT.WAVELENGTH && self.unit === SpectraDisplayer.UNIT.FREQUENCY) {
|
||||
self.data.values.reverse();
|
||||
} else if (prevUnit === SpectraDisplayer.UNIT.VELOCITY && self.unit === SpectraDisplayer.UNIT.FREQUENCY) {
|
||||
self.data.values.reverse();
|
||||
}
|
||||
|
||||
self._redraw(self.ctx);
|
||||
},
|
||||
})
|
||||
|
||||
@@ -199,8 +216,9 @@ export class SpectraDisplayer extends DOMElement {
|
||||
url: HomeIconUrl
|
||||
},
|
||||
tooltip: {
|
||||
content: "Scale for data",
|
||||
position: {direction: "right"}
|
||||
aladin: view.aladin,
|
||||
global: true,
|
||||
content: `Auto scale to fit window height`,
|
||||
},
|
||||
classList: ['aladin-spectra-home'],
|
||||
action(e) {
|
||||
@@ -227,24 +245,23 @@ export class SpectraDisplayer extends DOMElement {
|
||||
this.unit = SpectraDisplayer.UNIT.FREQUENCY;
|
||||
|
||||
let divNode = document.createElement("div");
|
||||
divNode.style.position = "absolute";
|
||||
divNode.style.left = "50%";
|
||||
divNode.style.transform = "translateX(-50%)";
|
||||
divNode.style.bottom = "2px";
|
||||
divNode.style.width = this.width + "px";
|
||||
//divNode.style.width = this.width + "px";
|
||||
divNode.style.height = this.height + "px";
|
||||
divNode.classList.add("aladin-lite-spectra-displayer")
|
||||
divNode.classList.add("aladin-spectra-displayer")
|
||||
|
||||
divNode.appendChild(this.canvas)
|
||||
divNode.appendChild(canvasCursor)
|
||||
divNode.appendChild(canvasLabels)
|
||||
divNode.appendChild(unitSelector.element())
|
||||
divNode.appendChild(autoCenterBtn.element())
|
||||
//divNode.appendChild(extractionBtn.element())
|
||||
|
||||
this.divNode = divNode;
|
||||
|
||||
this.view.aladin.aladinDiv.appendChild(divNode);
|
||||
let statusBar = this.view.aladin.statusBar;
|
||||
this.view.aladin.aladinDiv.insertBefore(
|
||||
divNode,
|
||||
statusBar && statusBar.element()
|
||||
)
|
||||
|
||||
this.defineEventListeners()
|
||||
this.hips3DList = new Map();
|
||||
@@ -381,7 +398,8 @@ export class SpectraDisplayer extends DOMElement {
|
||||
|
||||
canvas.style.cursor = 'default';
|
||||
|
||||
this.ctxCursor.clearRect(0, 0, this.width, this.height);
|
||||
let w = this.view.aladin.aladinDiv.getBoundingClientRect().width;
|
||||
this.ctxCursor.clearRect(0, 0, w, this.height);
|
||||
this.mouseFreq = null;
|
||||
|
||||
if (my >= v) {
|
||||
@@ -398,12 +416,18 @@ export class SpectraDisplayer extends DOMElement {
|
||||
let curFreq = self.hips.getFrequency();
|
||||
let curHash = Number(self.view.wasm.freq2hash(self.hips.layer, curFreq));
|
||||
|
||||
let mouseHash = curHash + Math.round((mx - (this.width / 2)) / this.scaleX)
|
||||
let mouseHash;
|
||||
if (self.unit === SpectraDisplayer.UNIT.FREQUENCY) {
|
||||
mouseHash = curHash + Math.round((mx - (w / 2)) / this.scaleX);
|
||||
} else {
|
||||
mouseHash = curHash - Math.round((mx - (w / 2)) / this.scaleX);
|
||||
}
|
||||
this.mouseFreq = self.view.wasm.hash2freq(self.hips.layer, BigInt(mouseHash));
|
||||
}
|
||||
|
||||
this._redrawLabels()
|
||||
|
||||
|
||||
if (!this.isDragging) {
|
||||
// Draw the vertical line that can be grabed to move the slice
|
||||
this.ctx.beginPath();
|
||||
@@ -416,6 +440,12 @@ export class SpectraDisplayer extends DOMElement {
|
||||
this.canvas.style.cursor = 'grab';
|
||||
}
|
||||
|
||||
if (my >= v) {
|
||||
this.lastMouse = { x: mx, y: my };
|
||||
} else {
|
||||
this.lastMouse = undefined;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -429,28 +459,35 @@ export class SpectraDisplayer extends DOMElement {
|
||||
|
||||
// look where we are in the freq range
|
||||
let j = Utils.binarySearch(self.data.freqs, self.data.freq);
|
||||
let df, f;
|
||||
let df, f, f0;
|
||||
if (j > 0 && j < self.data.freqs.length - 1) {
|
||||
df = (self.data.freqs[j + 1] - self.data.freqs[j - 1]) * 0.5;
|
||||
f = self.data.freq - dx * df;
|
||||
f0 = self.data.freq;
|
||||
} else if (j == 0) {
|
||||
df = self.data.freqs[1] - self.data.freqs[0]
|
||||
f = self.data.freqs[0] - dx * df;
|
||||
f0 = self.data.freq[0];
|
||||
} else {
|
||||
df = self.data.freqs[self.data.freqs.length - 1] - self.data.freqs[self.data.freqs.length - 2];
|
||||
f = self.data.freqs[self.data.freqs.length - 1] - dx * df;
|
||||
f0 = self.data.freqs[self.data.freqs.length - 1];
|
||||
}
|
||||
|
||||
if (this.unit === SpectraDisplayer.UNIT.FREQUENCY) {
|
||||
f = f0 - dx * df;
|
||||
} else {
|
||||
f = f0 + dx * df;
|
||||
}
|
||||
|
||||
self.hips.setFrequency({
|
||||
value: f,
|
||||
unit: 'Hz'
|
||||
})
|
||||
|
||||
this.lastMouse = { x: mx, y: my };
|
||||
}
|
||||
});
|
||||
|
||||
Utils.on(canvas, 'mouseup touchend', (e) => {
|
||||
let w = this.view.aladin.aladinDiv.getBoundingClientRect().width;
|
||||
|
||||
if (!this.enabled) {
|
||||
let paramsEvent = {
|
||||
bubbles: e.bubbles,
|
||||
@@ -496,20 +533,27 @@ export class SpectraDisplayer extends DOMElement {
|
||||
if (my >= v) {
|
||||
let dx = (mx - rect.width * 0.5) / this.scaleX;
|
||||
if (dx != 0) {
|
||||
|
||||
// Set the frequency
|
||||
|
||||
// look where we are in the freq range
|
||||
let j = Utils.binarySearch(self.data.freqs, self.data.freq);
|
||||
let df, f;
|
||||
let df, f, f0;
|
||||
if (j > 0 && j < self.data.freqs.length - 1) {
|
||||
df = (self.data.freqs[j + 1] - self.data.freqs[j - 1]) * 0.5;
|
||||
f = self.data.freq + dx * df;
|
||||
f0 = self.data.freq;
|
||||
} else if (j == 0) {
|
||||
df = self.data.freqs[1] - self.data.freqs[0]
|
||||
f = self.data.freqs[0] + dx * df;
|
||||
f0 = self.data.freq[0];
|
||||
} else {
|
||||
df = self.data.freqs[self.data.freqs.length - 1] - self.data.freqs[self.data.freqs.length - 2];
|
||||
f = self.data.freqs[self.data.freqs.length - 1] + dx * df;
|
||||
f0 = self.data.freqs[self.data.freqs.length - 1];
|
||||
}
|
||||
|
||||
if (this.unit === SpectraDisplayer.UNIT.FREQUENCY) {
|
||||
f = f0 + dx * df;
|
||||
} else {
|
||||
f = f0 - dx * df;
|
||||
}
|
||||
|
||||
self.hips.setFrequency({
|
||||
@@ -517,11 +561,11 @@ export class SpectraDisplayer extends DOMElement {
|
||||
unit: 'Hz'
|
||||
})
|
||||
}
|
||||
|
||||
this.lastMouse = { x: mx, y: my };
|
||||
|
||||
}
|
||||
|
||||
//this.ctxCursor.clearRect(0, 0, this.width, this.height);
|
||||
//this.ctxCursor.clearRect(0, 0, w, this.height);
|
||||
this.mouseFreq = null;
|
||||
}
|
||||
|
||||
@@ -542,7 +586,13 @@ export class SpectraDisplayer extends DOMElement {
|
||||
});
|
||||
|
||||
Utils.on(canvas, 'wheel', (e) => {
|
||||
this.ctxCursor.clearRect(0, 0, this.width, this.height);
|
||||
// stop the propagation to prevent scrolling on the page
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
let w = this.view.aladin.aladinDiv.getBoundingClientRect().width;
|
||||
|
||||
this.ctxCursor.clearRect(0, 0, w, this.height);
|
||||
|
||||
const wheelEvent = new WheelEvent('wheel', {
|
||||
bubbles: true,
|
||||
@@ -594,7 +644,10 @@ export class SpectraDisplayer extends DOMElement {
|
||||
let data = event.detail;
|
||||
if (data.layer === this.hips.layer) {
|
||||
this.data = data;
|
||||
console.log(data)
|
||||
if (this.unit !== SpectraDisplayer.UNIT.FREQUENCY) {
|
||||
this.data.values.reverse();
|
||||
}
|
||||
|
||||
this._redraw(this.ctx);
|
||||
}
|
||||
};
|
||||
@@ -623,11 +676,14 @@ export class SpectraDisplayer extends DOMElement {
|
||||
}
|
||||
|
||||
_redraw() {
|
||||
|
||||
const values = this.data.values;
|
||||
let len = values.length;
|
||||
|
||||
// Clear previous drawing
|
||||
this.ctx.clearRect(0, 0, this.width, this.height);
|
||||
let w = this.view.aladin.aladinDiv.getBoundingClientRect().width;
|
||||
|
||||
this.ctx.clearRect(0, 0, w, this.height);
|
||||
|
||||
// Find min and max for scaling
|
||||
let valuesWithNoNans = values.filter(v=>Number.isFinite(v));
|
||||
@@ -643,7 +699,7 @@ export class SpectraDisplayer extends DOMElement {
|
||||
this.maxY = Math.max(...valuesWithNoNans)
|
||||
}
|
||||
|
||||
this.scaleX = this.width / (len - 1);
|
||||
this.scaleX = w / (len - 1);
|
||||
this.scaleY = (this.maxY - this.minY === 0) ? 1 : this.height / (this.maxY - this.minY);
|
||||
|
||||
this._redrawSpectra(values)
|
||||
@@ -656,15 +712,18 @@ export class SpectraDisplayer extends DOMElement {
|
||||
this.ctx.lineWidth = 2;
|
||||
this.ctx.stroke();
|
||||
|
||||
this.ctxCursor.clearRect(0, 0, this.width, this.height);
|
||||
this.ctxCursor.beginPath();
|
||||
this.ctxCursor.moveTo(this.lastMouse.x, this.height);
|
||||
let v = this.data.values[Math.round(this.lastMouse.x / this.scaleX)]
|
||||
v = this.height - (v - this.minY) * this.scaleY
|
||||
this.ctxCursor.lineTo(this.lastMouse.x, v);
|
||||
this.ctxCursor.strokeStyle = "yellow";
|
||||
this.ctxCursor.lineWidth = 2;
|
||||
this.ctxCursor.stroke()
|
||||
this.ctxCursor.clearRect(0, 0, w, this.height);
|
||||
|
||||
if (this.lastMouse) {
|
||||
this.ctxCursor.beginPath();
|
||||
this.ctxCursor.moveTo(this.lastMouse.x, this.height);
|
||||
let v = this.data.values[Math.round(this.lastMouse.x / this.scaleX)]
|
||||
v = this.height - (v - this.minY) * this.scaleY;
|
||||
this.ctxCursor.lineTo(this.lastMouse.x, v);
|
||||
this.ctxCursor.strokeStyle = "yellow";
|
||||
this.ctxCursor.lineWidth = 2;
|
||||
this.ctxCursor.stroke()
|
||||
}
|
||||
|
||||
this._redrawLabels()
|
||||
}
|
||||
@@ -697,17 +756,20 @@ export class SpectraDisplayer extends DOMElement {
|
||||
|
||||
if (Math.abs(value) >= 1 || unit === units[units.length - 1].unit) {
|
||||
// Calculate number of decimal places needed to show the given precision
|
||||
const decimals = Math.max(0, Math.ceil(-Math.log10(precisionInUnit)));
|
||||
const decimals = Math.min(8, Math.max(0, Math.ceil(-Math.log10(precisionInUnit))));
|
||||
return value.toFixed(decimals) + " " + unit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let w = this.view.aladin.aladinDiv.getBoundingClientRect().width;
|
||||
|
||||
// Clear previous drawing
|
||||
this.ctxLabels.clearRect(0, 0, this.width, this.height);
|
||||
this.ctxLabels.clearRect(0, 0, w, this.height);
|
||||
|
||||
let drawLabel = (ctx, str, x, y, strokeStyle, font, fillStyle) => {
|
||||
ctx.strokeStyle = strokeStyle; // contour color
|
||||
ctx.lineWidth = 3;
|
||||
ctx.strokeText(str, x, y);
|
||||
|
||||
ctx.fillStyle = fillStyle;
|
||||
@@ -722,11 +784,14 @@ export class SpectraDisplayer extends DOMElement {
|
||||
|
||||
// min window freq
|
||||
this.ctxLabels.textAlign = "left"; // Horizontally centered
|
||||
let fmin = spectraValue2String(this.data.freqMin, this.data.freqs[1] - this.data.freqs[0]);
|
||||
let fmax = spectraValue2String(this.data.freqMax, this.data.freqs[this.data.freqs.length - 1] - this.data.freqs[this.data.freqs.length - 2]);
|
||||
|
||||
drawLabel(
|
||||
this.ctxLabels,
|
||||
spectraValue2String(this.data.freqMin, this.data.freqs[1] - this.data.freqs[0]),
|
||||
this.unit === SpectraDisplayer.UNIT.FREQUENCY ? fmin : fmax,
|
||||
0,
|
||||
this.height - 20,
|
||||
this.height - 60,
|
||||
'black',
|
||||
'20px monospace',
|
||||
'lightgreen'
|
||||
@@ -736,9 +801,9 @@ export class SpectraDisplayer extends DOMElement {
|
||||
this.ctxLabels.textAlign = "right"; // Horizontally centered
|
||||
drawLabel(
|
||||
this.ctxLabels,
|
||||
spectraValue2String(this.data.freqMax, this.data.freqs[this.data.freqs.length - 1] - this.data.freqs[this.data.freqs.length - 2]),
|
||||
this.width,
|
||||
this.height - 20,
|
||||
this.unit === SpectraDisplayer.UNIT.FREQUENCY ? fmax : fmin,
|
||||
w,
|
||||
this.height - 60,
|
||||
'black',
|
||||
'20px monospace',
|
||||
'lightgreen'
|
||||
@@ -757,8 +822,8 @@ export class SpectraDisplayer extends DOMElement {
|
||||
drawLabel(
|
||||
this.ctxLabels,
|
||||
str,
|
||||
this.width / 2,
|
||||
this.height - 20,
|
||||
w / 2,
|
||||
this.height - 10,
|
||||
'black',
|
||||
'20px monospace',
|
||||
fillStyle
|
||||
|
||||
@@ -431,6 +431,22 @@ Utils.fetch = function(params) {
|
||||
})
|
||||
}
|
||||
|
||||
Utils.fetchWithProxy = function(params) {
|
||||
return Utils.fetch({
|
||||
...params,
|
||||
error: (e) => {
|
||||
console.error(e)
|
||||
console.info("Trying querying the proxy:" + JSONP_PROXY)
|
||||
// Try as CORS
|
||||
const url = JSONP_PROXY + '?url=' + params.url;
|
||||
return Utils.fetch({
|
||||
...params,
|
||||
url,
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Utils.on = function(element, events, callback) {
|
||||
events.split(' ')
|
||||
.forEach(e => {
|
||||
|
||||
+423
-136
@@ -50,8 +50,55 @@ import { Color } from "./Color.js";
|
||||
import { SpectraDisplayer } from "./SpectraDisplayer.js";
|
||||
import { DefaultActionsForContextMenu } from "./DefaultActionsForContextMenu.js";
|
||||
import { Source } from "./Source.js";
|
||||
import { blobToArrayBuffer, blobToDataURL, buildAvmFromWcs, injectAvmIntoPngBlob } from "./AvmUtils.js";
|
||||
export let View = (function () {
|
||||
|
||||
const normalizeImageType = function (imgType) {
|
||||
return imgType || "image/png";
|
||||
};
|
||||
|
||||
const canvasToBlob = function (canvas, imgType) {
|
||||
return new Promise((resolve, reject) => {
|
||||
canvas.toBlob((blob) => {
|
||||
if (blob) {
|
||||
resolve(blob);
|
||||
} else {
|
||||
reject(new Error("Canvas toBlob failed"));
|
||||
}
|
||||
}, imgType);
|
||||
});
|
||||
};
|
||||
|
||||
const exportCanvasBlob = async function (view, canvas, imgType) {
|
||||
const effectiveImgType = normalizeImageType(imgType);
|
||||
let blob = await canvasToBlob(canvas, effectiveImgType);
|
||||
|
||||
if (effectiveImgType !== "image/png") {
|
||||
return blob;
|
||||
}
|
||||
|
||||
const wcs = view.aladin.getViewWCS();
|
||||
if (!wcs || typeof wcs !== "object") {
|
||||
return blob;
|
||||
}
|
||||
|
||||
const avm = buildAvmFromWcs(wcs, {
|
||||
rotation: view.aladin.getRotation(),
|
||||
});
|
||||
|
||||
if (!avm) {
|
||||
return blob;
|
||||
}
|
||||
|
||||
try {
|
||||
blob = await injectAvmIntoPngBlob(blob, avm);
|
||||
} catch (error) {
|
||||
console.warn("Could not inject AVM metadata into PNG export", error);
|
||||
}
|
||||
|
||||
return blob;
|
||||
};
|
||||
|
||||
/** Constructor */
|
||||
function View(aladin) {
|
||||
this.aladin = aladin;
|
||||
@@ -105,6 +152,11 @@ export let View = (function () {
|
||||
this.debounceResize = Utils.debounce(() => {
|
||||
self.wasm.resize(self.width, self.height);
|
||||
self.updateZoomState()
|
||||
|
||||
if (self.spectraDisplayer) {
|
||||
self.spectraDisplayer.updateCanvas()
|
||||
self.spectraDisplayer._redraw()
|
||||
}
|
||||
}, 2);
|
||||
|
||||
// Attach the drag and drop events to the view
|
||||
@@ -221,6 +273,13 @@ export let View = (function () {
|
||||
this.selector = new Selector(this, this.options.selector);
|
||||
this.manualSelection = (this.options && this.options.manualSelection) || false;
|
||||
|
||||
// Selection mode
|
||||
this.selectionMode = View.SELECTION_MODE_EDGE;
|
||||
if (this.options.selectionMode === 'skewer') {
|
||||
this.selectionMode = View.SELECTION_MODE_SKEWER;
|
||||
}
|
||||
|
||||
|
||||
// current reference image survey displayed
|
||||
this.imageLayers = new Map();
|
||||
|
||||
@@ -307,6 +366,10 @@ export let View = (function () {
|
||||
View.TOOL_SIMBAD_POINTER = 2;
|
||||
View.TOOL_COLOR_PICKER = 3;
|
||||
|
||||
// Selection modes
|
||||
View.SELECTION_MODE_EDGE = 0;
|
||||
View.SELECTION_MODE_SKEWER = 1;
|
||||
|
||||
// TODO: should be put as an option at layer level
|
||||
View.DRAW_SOURCES_WHILE_DRAGGING = true;
|
||||
View.DRAW_MOCS_WHILE_DRAGGING = true;
|
||||
@@ -318,7 +381,7 @@ export let View = (function () {
|
||||
Object.defineProperties(this, {
|
||||
fov: {
|
||||
get() {
|
||||
return this.wasm.getFieldOfView();
|
||||
return this.wasm.getFieldOfView()[0];
|
||||
},
|
||||
set(newFov) {
|
||||
this.setFoV(newFov);
|
||||
@@ -462,6 +525,13 @@ export let View = (function () {
|
||||
}
|
||||
|
||||
View.prototype.setMode = function (mode, params) {
|
||||
|
||||
// Undo the specialized cursors, if any.
|
||||
const prevMode = this.mode;
|
||||
if (prevMode == View.TOOL_SIMBAD_POINTER) {
|
||||
this.catalogCanvas.classList.remove('aladin-sp-cursor');
|
||||
}
|
||||
|
||||
// hide the picker tooltip
|
||||
this.colorPickerTool.domElement.style.display = "none";
|
||||
// in case we are in the selection mode
|
||||
@@ -494,6 +564,14 @@ export let View = (function () {
|
||||
ALEvent.MODE.dispatchedTo(this.aladin.aladinDiv, {mode});
|
||||
};
|
||||
|
||||
View.prototype.setSelectionMode = function (selectionMode) {
|
||||
this.selectionMode = selectionMode;
|
||||
};
|
||||
|
||||
View.prototype.getSelectionMode = function () {
|
||||
return this.selectionMode;
|
||||
};
|
||||
|
||||
View.prototype.setCursor = function (cursor) {
|
||||
if (this.catalogCanvas.style.cursor == cursor) {
|
||||
return;
|
||||
@@ -503,6 +581,10 @@ export let View = (function () {
|
||||
};
|
||||
|
||||
View.prototype.getRawPixelsCanvas = function(width, height) {
|
||||
// important: redraw must be called just before getting the pixels
|
||||
// because the drawing buffer is not preserved (preserveDrawingBuffer = false)
|
||||
this.redraw()
|
||||
|
||||
const canvas = this.wasm.canvas();
|
||||
|
||||
const c = document.createElement('canvas');
|
||||
@@ -557,20 +639,16 @@ export let View = (function () {
|
||||
*/
|
||||
View.prototype.getCanvasDataURL = async function (imgType, width, height, withLogo=true) {
|
||||
const c = await this.getCanvas(width, height, withLogo);
|
||||
return c.toDataURL(imgType);
|
||||
const blob = await exportCanvasBlob(this, c, imgType);
|
||||
return blobToDataURL(blob);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return ArrayBuffer corresponding to the current view
|
||||
*/
|
||||
View.prototype.getCanvasArrayBuffer = async function (imgType, width, height, withLogo=true) {
|
||||
return this.getCanvasBlob(imgType, width, height, withLogo)
|
||||
.then((blob) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result);
|
||||
reader.onerror = () => reject(new Error('Error reading blob as ArrayBuffer'));
|
||||
reader.readAsArrayBuffer(blob);
|
||||
});
|
||||
const blob = await this.getCanvasBlob(imgType, width, height, withLogo);
|
||||
return blobToArrayBuffer(blob);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -578,15 +656,7 @@ export let View = (function () {
|
||||
*/
|
||||
View.prototype.getCanvasBlob = async function (imgType, width, height, withLogo=true) {
|
||||
const c = await this.getCanvas(width, height, withLogo);
|
||||
return new Promise((resolve, reject) => {
|
||||
c.toBlob(blob => {
|
||||
if (blob) {
|
||||
resolve(blob);
|
||||
} else {
|
||||
reject(new Error('Canvas toBlob failed'));
|
||||
}
|
||||
}, imgType);
|
||||
});
|
||||
return exportCanvasBlob(this, c, imgType);
|
||||
}
|
||||
|
||||
View.prototype.selectLayer = function (layer) {
|
||||
@@ -601,7 +671,7 @@ export let View = (function () {
|
||||
|
||||
if (imageLayer.dataproductType === "spectral-cube") {
|
||||
if (!this.spectraDisplayer) {
|
||||
this.spectraDisplayer = new SpectraDisplayer(this, {width: 800, height: 300});
|
||||
this.spectraDisplayer = new SpectraDisplayer(this, {height: 250});
|
||||
}
|
||||
|
||||
this.spectraDisplayer.attachHiPS3D(imageLayer)
|
||||
@@ -641,16 +711,19 @@ export let View = (function () {
|
||||
// prevent default context menu from appearing (potential clash with right-click cuts control)
|
||||
Utils.on(view.catalogCanvas, "contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
let ctxMenu = view.aladin.contextMenu;
|
||||
if(ctxMenu) {
|
||||
e.stopPropagation();
|
||||
if (!view.rightClick && showContextMenu) {
|
||||
ctxMenu.attach(
|
||||
DefaultActionsForContextMenu.getDefaultActions(view.aladin),
|
||||
null
|
||||
);
|
||||
ctxMenu._show({e});
|
||||
}
|
||||
|
||||
if (view.aladin.options.showContextMenu) {
|
||||
let ctxMenu = view.aladin.contextMenu;
|
||||
if(ctxMenu) {
|
||||
e.stopPropagation();
|
||||
if (!view.rightClick && showContextMenu) {
|
||||
ctxMenu.attach(
|
||||
DefaultActionsForContextMenu.getDefaultActions(view.aladin),
|
||||
null
|
||||
);
|
||||
ctxMenu._show({e});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -670,12 +743,10 @@ export let View = (function () {
|
||||
var showContextMenu = true;
|
||||
var xystart;
|
||||
|
||||
var handleSelect = function(xy, tolerance) {
|
||||
var handleSelect = function(xy, tolerance, withModifierKey=false) {
|
||||
tolerance = tolerance || 5;
|
||||
var objs = view.closestObjects(xy.x, xy.y, tolerance);
|
||||
|
||||
view.unselectObjects();
|
||||
|
||||
if (objs) {
|
||||
var objClickedFunction = view.aladin.callbacksByEventName['objectClicked'];
|
||||
var footprintClickedFunction = view.aladin.callbacksByEventName['footprintClicked'];
|
||||
@@ -714,11 +785,14 @@ export let View = (function () {
|
||||
if (shapes.length > 0) {
|
||||
objs.push(shapes)
|
||||
}
|
||||
view.selectObjects(objs);
|
||||
view.selectObjects(objs, withModifierKey);
|
||||
|
||||
view.lastClickedObject = objs;
|
||||
|
||||
} else {
|
||||
|
||||
view.unselectObjects();
|
||||
|
||||
// If there is a past clicked object
|
||||
if (view.lastClickedObject) {
|
||||
// TODO: do we need to keep that triggering ?
|
||||
@@ -729,6 +803,95 @@ export let View = (function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a skewer-based selection of objects at the specified mouse position.
|
||||
*
|
||||
* @param {Event|Object} e - Mouse coordinate via mouse event or object with x and y properties
|
||||
* @param {boolean} withModifierKey - If true, toggles selection (adds/removes from existing selection);
|
||||
* if false, replaces current selection
|
||||
*/
|
||||
var handleSkewerSelect = function(e, withModifierKey) {
|
||||
|
||||
const objList = Selector.getSkewerObjects(e, view);
|
||||
view.selectObjects(objList, withModifierKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the selected objects appear hovered and make all other objects appear unhovered,
|
||||
* firing the appropriate callbacks for both cases.
|
||||
*
|
||||
* The also sets the cursor to a pointer to indicate that some object(s) would be
|
||||
* select on click in the current mouse position.
|
||||
*
|
||||
* @param {Array} objects - Array of objects to apply hover state to
|
||||
* @param {Object} xymouse - Mouse coordinates with x and y properties
|
||||
*/
|
||||
var hoverObjects = function(objects, xymouse) {
|
||||
var objHoveredFunction = view.aladin.callbacksByEventName['objectHovered'];
|
||||
var footprintHoveredFunction = view.aladin.callbacksByEventName['footprintHovered'];
|
||||
|
||||
view.setCursor('pointer');
|
||||
|
||||
for (let o of objects) {
|
||||
|
||||
if (typeof objHoveredFunction === 'function' && (!view.lastHoveredObject || !view.lastHoveredObject.includes(o))) {
|
||||
var ret = objHoveredFunction(o, xymouse);
|
||||
}
|
||||
|
||||
if (o.isFootprint()) {
|
||||
if (typeof footprintHoveredFunction === 'function' && (!view.lastHoveredObject || !view.lastHoveredObject.includes(o))) {
|
||||
var ret = footprintHoveredFunction(o, xymouse);
|
||||
}
|
||||
}
|
||||
|
||||
if (!view.lastHoveredObject || !view.lastHoveredObject.includes(o)) {
|
||||
o.hover();
|
||||
}
|
||||
}
|
||||
|
||||
// unhover the objects in lastHoveredObjects that are not in closest anymore
|
||||
if (view.lastHoveredObject) {
|
||||
var objHoveredStopFunction = view.aladin.callbacksByEventName['objectHoveredStop'];
|
||||
|
||||
for (let lho of view.lastHoveredObject) {
|
||||
if (!objects.includes(lho)) {
|
||||
lho.unhover();
|
||||
|
||||
if (typeof objHoveredStopFunction === 'function') {
|
||||
objHoveredStopFunction(lho, xymouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
view.lastHoveredObject = objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes hover state from all previously hovered objects and fires the
|
||||
* apropriate callbacks.
|
||||
*
|
||||
* The also resets the cursor to the default to indicate that no objects would be
|
||||
* selected on click in the current mouse position.
|
||||
*
|
||||
* @param {Object} xymouse - Mouse coordinates with x and y properties
|
||||
*/
|
||||
var unhoverObjects = function(xymouse) {
|
||||
view.setCursor('default');
|
||||
if (view.lastHoveredObject) {
|
||||
var objHoveredStopFunction = view.aladin.callbacksByEventName['objectHoveredStop'];
|
||||
for (let lho of view.lastHoveredObject) {
|
||||
lho.unhover();
|
||||
|
||||
if (typeof objHoveredStopFunction === 'function') {
|
||||
objHoveredStopFunction(lho, xymouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.lastHoveredObject = null;
|
||||
}
|
||||
|
||||
var touchStartTime;
|
||||
Utils.on(view.catalogCanvas, "mousedown touchstart", function (e) {
|
||||
e.stopPropagation();
|
||||
@@ -875,6 +1038,7 @@ export let View = (function () {
|
||||
// reacting on 'click' rather on 'mouseup' is more reliable when panning the view
|
||||
Utils.on(view.catalogCanvas, "mouseup mouseout touchend touchcancel", function (e) {
|
||||
const xymouse = Utils.relMouseCoords(e);
|
||||
const withModifierKey = e.ctrlKey || e.metaKey;
|
||||
|
||||
ALEvent.CANVAS_EVENT.dispatchedTo(view.aladinDiv, {
|
||||
state: {
|
||||
@@ -941,7 +1105,7 @@ export let View = (function () {
|
||||
|
||||
if (view.rightClick) {
|
||||
let ctxMenu = view.aladin.contextMenu;
|
||||
if (showContextMenu && ctxMenu) {
|
||||
if (showContextMenu && ctxMenu && view.aladin.options.showContextMenu) {
|
||||
ctxMenu.attach(
|
||||
DefaultActionsForContextMenu.getDefaultActions(view.aladin),
|
||||
null
|
||||
@@ -963,11 +1127,19 @@ export let View = (function () {
|
||||
const elapsedTime = Date.now() - touchStartTime;
|
||||
if (elapsedTime < 100) {
|
||||
view.updateObjectsLookup();
|
||||
handleSelect(xymouse, 15);
|
||||
if (view.selectionMode === View.SELECTION_MODE_SKEWER) {
|
||||
handleSkewerSelect(e, withModifierKey)
|
||||
} else {
|
||||
handleSelect(xymouse, 15, withModifierKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
handleSelect(xymouse);
|
||||
if (view.selectionMode === View.SELECTION_MODE_EDGE) {
|
||||
handleSelect(xymouse, 5, withModifierKey);
|
||||
} else {
|
||||
handleSkewerSelect(e, withModifierKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1150,71 +1322,31 @@ export let View = (function () {
|
||||
lastMouseMovePos = pos;
|
||||
}
|
||||
|
||||
// closestObjects is very costly, we would like to not do it
|
||||
// especially if the objectHovered function is not defined.
|
||||
var closests = view.closestObjects(xymouse.x, xymouse.y, 5);
|
||||
if (view.selectionMode === View.SELECTION_MODE_EDGE) {
|
||||
// We're in edge selection mode for footprints. closestObjects() will find those footprints by closeness to a footprint edge.
|
||||
// closestObjects is very costly, we would like to not do it
|
||||
// especially if the objectHovered function is not defined.
|
||||
var closests = view.closestObjects(xymouse.x, xymouse.y, 5);
|
||||
|
||||
if (closests) {
|
||||
var objHoveredFunction = view.aladin.callbacksByEventName['objectHovered'];
|
||||
var footprintHoveredFunction = view.aladin.callbacksByEventName['footprintHovered'];
|
||||
if (closests) {
|
||||
hoverObjects(closests, xymouse);
|
||||
} else {
|
||||
unhoverObjects(view, xymouse);
|
||||
}
|
||||
} else if (view.selectionMode === View.SELECTION_MODE_SKEWER) {
|
||||
// We're in skewer mode. Let's see what would be selected.
|
||||
const skewerTargetsByLayer = Selector.getSkewerObjects(e, view);
|
||||
const skewerObjects = skewerTargetsByLayer.flat();
|
||||
|
||||
view.setCursor('pointer');
|
||||
|
||||
for (let o of closests) {
|
||||
|
||||
if (typeof objHoveredFunction === 'function' && (!view.lastHoveredObject || !view.lastHoveredObject.includes(o))) {
|
||||
var ret = objHoveredFunction(o, xymouse);
|
||||
}
|
||||
|
||||
if (o.isFootprint()) {
|
||||
if (typeof footprintHoveredFunction === 'function' && (!view.lastHoveredObject || !view.lastHoveredObject.includes(o))) {
|
||||
var ret = footprintHoveredFunction(o, xymouse);
|
||||
}
|
||||
}
|
||||
|
||||
if (!view.lastHoveredObject || !view.lastHoveredObject.includes(o)) {
|
||||
o.hover();
|
||||
}
|
||||
if (skewerObjects.length > 0) {
|
||||
hoverObjects(skewerObjects, xymouse);
|
||||
} else {
|
||||
unhoverObjects(view, xymouse);
|
||||
}
|
||||
|
||||
// unhover the objects in lastHoveredObjects that are not in closest anymore
|
||||
if (view.lastHoveredObject) {
|
||||
var objHoveredStopFunction = view.aladin.callbacksByEventName['objectHoveredStop'];
|
||||
|
||||
for (let lho of view.lastHoveredObject) {
|
||||
if (!closests.includes(lho)) {
|
||||
lho.unhover();
|
||||
|
||||
if (typeof objHoveredStopFunction === 'function') {
|
||||
objHoveredStopFunction(lho, xymouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
view.lastHoveredObject = closests;
|
||||
} else {
|
||||
view.setCursor('default');
|
||||
if (view.lastHoveredObject) {
|
||||
var objHoveredStopFunction = view.aladin.callbacksByEventName['objectHoveredStop'];
|
||||
|
||||
/*if (typeof objHoveredStopFunction === 'function') {
|
||||
// call callback function to notify we left the hovered object
|
||||
var ret = objHoveredStopFunction(view.lastHoveredObject, xymouse);
|
||||
}
|
||||
|
||||
view.lastHoveredObject.unhover();*/
|
||||
for (let lho of view.lastHoveredObject) {
|
||||
lho.unhover();
|
||||
|
||||
if (typeof objHoveredStopFunction === 'function') {
|
||||
objHoveredStopFunction(lho, xymouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.lastHoveredObject = null;
|
||||
}
|
||||
|
||||
|
||||
if (e.type === "mousemove") {
|
||||
return;
|
||||
}
|
||||
@@ -1348,6 +1480,7 @@ export let View = (function () {
|
||||
|
||||
view.displayHpxGrid = false;
|
||||
view.displayCatalog = false;
|
||||
view.skewerEnabled = false;
|
||||
};
|
||||
|
||||
View.prototype.requestRedrawAtDate = function (date) {
|
||||
@@ -1593,6 +1726,9 @@ export let View = (function () {
|
||||
return imageData;
|
||||
};
|
||||
|
||||
/**
|
||||
* Unselects all currently selected objects.
|
||||
*/
|
||||
View.prototype.unselectObjects = function() {
|
||||
if (this.manualSelection) {
|
||||
return;
|
||||
@@ -1611,11 +1747,24 @@ export let View = (function () {
|
||||
this.requestRedraw();
|
||||
}
|
||||
|
||||
View.prototype.selectObjects = function(selection) {
|
||||
/**
|
||||
* Selects the specified objects in the view.
|
||||
*
|
||||
* If withModifierKey is true, it modifies the existing selection (adds/removes).
|
||||
* Otherwise, it replaces the current selection.
|
||||
*
|
||||
* @param {Array|Object} selection - The objects to select, either an array or a selector object.
|
||||
* @param {boolean} [withModifierKey=false] - Whether to modify (versus replace) the existing selections.
|
||||
*/
|
||||
View.prototype.selectObjects = function(selection, withModifierKey=false) {
|
||||
if (this.manualSelection) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Array.isArray(selection) && withModifierKey) {
|
||||
selection = this.computeModifiedSelection(selection)
|
||||
}
|
||||
|
||||
// unselect the previous selection
|
||||
this.unselectObjects();
|
||||
|
||||
@@ -1693,6 +1842,113 @@ export let View = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
View.prototype._getLayerForObj = function(obj) {
|
||||
let layer = null;
|
||||
if (obj.getCatalog) {
|
||||
layer = obj.getCatalog()
|
||||
} else {
|
||||
layer = obj.overlay
|
||||
}
|
||||
return layer
|
||||
}
|
||||
|
||||
View.prototype._copySelectionsToStage = function(selections, stage, overlays, exclude) {
|
||||
for (const group of selections) {
|
||||
for (const obj of group) {
|
||||
const objExcluded = exclude.includes(obj)
|
||||
if (!objExcluded) {
|
||||
const layer = this._getLayerForObj(obj)
|
||||
const idx = overlays.findIndex(item => item.uuid === layer.uuid);
|
||||
if (idx >= 0) {
|
||||
stage[idx].push(obj)
|
||||
} else {
|
||||
console.warn("Layer not found for selected obj: " + obj)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the full set of selections that should result if the specified (pending) objects were
|
||||
* selected with a modifier key pressed.
|
||||
*
|
||||
* If there are existing selections, it adds pending items that aren't selected,
|
||||
* or removes all pending items if they are all already selected.
|
||||
*
|
||||
* Organizes selections by overlay layers as expected by selectObjects.
|
||||
*
|
||||
* @param {Array<Array>} pending - Array of array of objects to potentially add/remove from selection.
|
||||
* @returns {Array<Array>} The modified selection array.
|
||||
*/
|
||||
View.prototype.computeModifiedSelection = function(pending) {
|
||||
const current = this.selection
|
||||
let modSelection = pending
|
||||
if (current && current.length > 0) {
|
||||
// There are some items already selected.
|
||||
// We will be adding all the pending selections that are not already selected,
|
||||
// UNLESS all of the pending selections are already selected, in which case
|
||||
// they will all be unselected.
|
||||
const toAdd = []
|
||||
let mightRemove = []
|
||||
modSelection = [] // We will build a new selection list from the current and pending selections
|
||||
|
||||
// stage will have one row for each existing overlay in which to collect all desired selections.
|
||||
const overlays = this.aladin.getOverlays()
|
||||
const stage = new Array(overlays.length).fill(null).map(() => []);
|
||||
|
||||
// Put already-selected items in mightRemove and not-yet-selected items in toAdd.
|
||||
for (const group of pending) {
|
||||
for (const obj of group) {
|
||||
if (obj.isSelected) {
|
||||
mightRemove.push(obj)
|
||||
} else {
|
||||
toAdd.push(obj)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there is anything in toAdd, then clear mightRemove since they will be left selected.
|
||||
if (toAdd.length > 0) {
|
||||
mightRemove = []
|
||||
}
|
||||
|
||||
// Copy current selections to stage except for anything in mightRemove
|
||||
this._copySelectionsToStage(current, stage, overlays, mightRemove)
|
||||
|
||||
// Copy toAdd selections to stage
|
||||
this._copySelectionsToStage([toAdd], stage, overlays, [])
|
||||
|
||||
// Build new modified selections list from stage.
|
||||
// I can preserve the layer order, but I don't know how to preserve the order within
|
||||
// layers without looping through all objects. Hopefully that order doesn't matter.
|
||||
for (let i=0; i<stage.length; i++) {
|
||||
if (stage[i].length > 0) {
|
||||
// We have selected objects in this layer so will add the layer (or list of overlays) to modSelection
|
||||
|
||||
if (overlays[i].type === 'catalog') {
|
||||
// The layer is a catalog so we add one entry for all its selections
|
||||
const catLayer = []
|
||||
modSelection.push(catLayer)
|
||||
for (const obj of stage[i]) {
|
||||
catLayer.push(obj)
|
||||
}
|
||||
|
||||
} else {
|
||||
// Assume it's a graphicalOverlay and add separate entries for each selected obj
|
||||
// (That is the way objects in graphicalOverlays are currently selected. If they start
|
||||
// being selected all in one list per overlay, then that can change here.)
|
||||
for (const obj of stage[i]) {
|
||||
modSelection.push([obj])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return modSelection;
|
||||
}
|
||||
|
||||
View.prototype.getVisibleCells = function (norder) {
|
||||
return this.wasm.getVisibleCells(norder);
|
||||
};
|
||||
@@ -1760,10 +2016,12 @@ export let View = (function () {
|
||||
this.computeNorder();
|
||||
|
||||
let fovX = this.fov;
|
||||
let fovY = this.height / this.width * fovX;
|
||||
let fovY = this.wasm.getFieldOfView()[1];
|
||||
fovX = Math.min(fovX, 360);
|
||||
fovY = Math.min(fovY, 180);
|
||||
|
||||
this.fovY = fovY;
|
||||
|
||||
this.debounceProgCatOnZoom();
|
||||
|
||||
ALEvent.ZOOM_CHANGED.dispatchedTo(this.aladinDiv, { fovX, fovY });
|
||||
@@ -1801,27 +2059,6 @@ export let View = (function () {
|
||||
// register its promise
|
||||
this.imageLayersBeingQueried.set(layer, imageLayer);
|
||||
|
||||
// Check whether this layer already exist
|
||||
const idxOverlayLayer = this.overlayLayers.findIndex(overlayLayer => overlayLayer == layer);
|
||||
let alreadyPresentImageLayer;
|
||||
if (idxOverlayLayer == -1) {
|
||||
// it does not exist so we add it to the stack
|
||||
this.overlayLayers.push(layer);
|
||||
} else {
|
||||
// it exists
|
||||
alreadyPresentImageLayer = this.imageLayers.get(layer);
|
||||
|
||||
if (alreadyPresentImageLayer) {
|
||||
if (alreadyPresentImageLayer.added === true) {
|
||||
ALEvent.LAYER_REMOVED.dispatchedTo(this.aladinDiv, { layer: alreadyPresentImageLayer });
|
||||
}
|
||||
|
||||
alreadyPresentImageLayer.added = false;
|
||||
}
|
||||
// Notify that this image layer has been replaced by the wasm part
|
||||
this.imageLayers.delete(layer);
|
||||
}
|
||||
|
||||
this.addImageLayer(imageLayer, layer);
|
||||
|
||||
return imageLayer;
|
||||
@@ -1833,6 +2070,25 @@ export let View = (function () {
|
||||
const layer = imageLayer.layer;
|
||||
imageLayer.added = true;
|
||||
|
||||
const idxOverlayLayer = this.overlayLayers.findIndex(overlayLayer => overlayLayer == layer);
|
||||
if (idxOverlayLayer === -1) {
|
||||
this.overlayLayers.push(layer);
|
||||
} else {
|
||||
// layer already present
|
||||
// it exists
|
||||
var alreadyPresentImageLayer = this.imageLayers.get(layer);
|
||||
|
||||
if (alreadyPresentImageLayer) {
|
||||
//let idx = this.removeImageLayer(layer)
|
||||
//if (idx >= 0) {
|
||||
// this.overlayLayers.splice(idx, 0, layer);
|
||||
//}
|
||||
}
|
||||
|
||||
// Notify that this image layer has been replaced by the wasm part
|
||||
//this.imageLayers.delete(layer);
|
||||
}
|
||||
|
||||
this.imageLayers.set(layer, imageLayer);
|
||||
|
||||
// select the layer if he is on top
|
||||
@@ -1841,13 +2097,26 @@ export let View = (function () {
|
||||
ALEvent.LAYER_ADDED.dispatchedTo(this.aladinDiv, { layer: imageLayer });
|
||||
}
|
||||
|
||||
View.prototype._waitsForLayer = function() {
|
||||
return this.promises.length !== 0;
|
||||
}
|
||||
|
||||
View.prototype.getFirstLayer = function() {
|
||||
let layer = this.overlayLayers && this.overlayLayers[0];
|
||||
|
||||
if (!layer) {
|
||||
// the overlay has not yet been added and is currently queried.
|
||||
layer = this.imageLayersBeingQueried.keys().next().value;
|
||||
}
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
View.prototype.addImageLayer = function (imageLayer, layer) {
|
||||
let self = this;
|
||||
// start the query
|
||||
const imageLayerPromise = imageLayer.query;
|
||||
|
||||
let idx = this.promises.length;
|
||||
this.promises.push(imageLayerPromise);
|
||||
const promise = imageLayer.query;
|
||||
this.promises.push(promise);
|
||||
|
||||
// All image layer promises must be completed (fullfilled or rejected)
|
||||
const task = {
|
||||
@@ -1858,7 +2127,7 @@ export let View = (function () {
|
||||
ALEvent.FETCH.dispatchedTo(document, {task});
|
||||
// All the remaining promises must be terminated and the current one must be resolved
|
||||
// so that we can add it to the view (call of _add2View)
|
||||
Promise.all([Promise.allSettled(this.promises), imageLayerPromise])
|
||||
Promise.all([Promise.allSettled(this.promises), promise])
|
||||
// Then we add the layer to the view
|
||||
.then((_) => imageLayer._addToView(layer))
|
||||
// Then we keep a track of the layer in the JS front
|
||||
@@ -1883,6 +2152,8 @@ export let View = (function () {
|
||||
imageLayer.errorCallback(e);
|
||||
}
|
||||
|
||||
this.removeImageLayer(imageLayer);
|
||||
|
||||
throw e;
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -1890,9 +2161,25 @@ export let View = (function () {
|
||||
ALEvent.RESOURCE_FETCHED.dispatchedTo(document, {task});
|
||||
|
||||
self.imageLayersBeingQueried.delete(layer);
|
||||
|
||||
// Remove the settled promise
|
||||
this.promises.splice(idx, 1);
|
||||
this.promises = this.promises.filter(p => p !== promise);
|
||||
|
||||
const waitsForLayer = this._waitsForLayer();
|
||||
|
||||
if (!waitsForLayer && this.delayedBaseLayerCalledParams && this.delayedBaseLayerCalledParams !== layer) {
|
||||
this.aladin.setBaseImageLayer(this.delayedBaseLayerCalledParams)
|
||||
this.delayedBaseLayerCalledParams = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!waitsForLayer && this.empty) {
|
||||
// no promises to launch and the view has no HiPS.
|
||||
// This situation can occurs if the MOCServer is out
|
||||
// If so we can directly put the url of the DSS hosted in alasky,
|
||||
// it the best I can do if the MOCServer is out
|
||||
self.aladin.setBaseImageLayer(Aladin.DEFAULT_OPTIONS.survey);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1924,7 +2211,7 @@ export let View = (function () {
|
||||
|
||||
if (imageLayer === undefined) {
|
||||
// there is nothing to remove
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Update the backend
|
||||
@@ -1932,26 +2219,22 @@ export let View = (function () {
|
||||
|
||||
// Get the survey to remove to dissociate it from the view
|
||||
imageLayer.added = false;
|
||||
// Delete it
|
||||
this.imageLayers.delete(layer);
|
||||
|
||||
const idxOverlaidLayer = this.overlayLayers.findIndex(overlaidLayer => overlaidLayer == layer);
|
||||
if (idxOverlaidLayer == -1) {
|
||||
// layer not found
|
||||
return;
|
||||
}
|
||||
// Delete it
|
||||
this.imageLayers.delete(layer);
|
||||
|
||||
// Remove it from the layer stack
|
||||
this.overlayLayers.splice(idxOverlaidLayer, 1);
|
||||
|
||||
if (this.overlayLayers.length === 0) {
|
||||
//this.empty = true;
|
||||
} else if (this.selectedLayer === layer) {
|
||||
if (this.overlayLayers.length > 0 && this.selectedLayer === layer) {
|
||||
// If the layer removed was selected then we select the last layer
|
||||
this.selectLayer(this.overlayLayers[this.overlayLayers.length - 1]);
|
||||
}
|
||||
|
||||
ALEvent.LAYER_REMOVED.dispatchedTo(this.aladinDiv, { layer: imageLayer });
|
||||
|
||||
return idxOverlaidLayer;
|
||||
};
|
||||
|
||||
View.prototype.contains = function(survey) {
|
||||
@@ -2003,7 +2286,9 @@ export let View = (function () {
|
||||
let imageLayerQueried = this.imageLayersBeingQueried.get(layer);
|
||||
let imageLayer = this.imageLayers.get(layer);
|
||||
|
||||
return imageLayer || imageLayerQueried;
|
||||
let obj = imageLayer || imageLayerQueried;
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
View.prototype.requestRedraw = function () {
|
||||
@@ -2355,3 +2640,5 @@ export let View = (function () {
|
||||
|
||||
return View;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export class ALEvent {
|
||||
static LAYER_CHANGED = new ALEvent("AL:Layer.changed");
|
||||
|
||||
static HIPS_CACHE_UPDATED = new ALEvent("AL:HiPSCache.updated");
|
||||
static FAVORITE_HIPS_LIST_UPDATED = new ALEvent("AL:HiPSFavorites.updated");
|
||||
static FAVORITE_LAYERS_LIST_UPDATED = new ALEvent("AL:HiPSFavorites.updated");
|
||||
|
||||
static GRAPHIC_OVERLAY_LAYER_ADDED = new ALEvent("AL:GraphicOverlayLayer.added");
|
||||
static GRAPHIC_OVERLAY_LAYER_REMOVED = new ALEvent("AL:GraphicOverlayLayer.removed");
|
||||
|
||||
@@ -43,15 +43,19 @@ import { ActionButton } from "../Widgets/ActionButton.js";
|
||||
|
||||
export class CatalogQueryBox extends Box {
|
||||
static catalogs = {};
|
||||
static catTitle2Id = {};
|
||||
constructor(aladin, options) {
|
||||
// Query the mocserver
|
||||
MocServer.getAllCatalogHiPSes()
|
||||
.then((catalogs) => {
|
||||
catalogs.forEach((cat) => {
|
||||
CatalogQueryBox.catalogs[cat.obs_title] = cat;
|
||||
//console.log(cat)
|
||||
CatalogQueryBox.catalogs[cat.ID] = cat;
|
||||
CatalogQueryBox.catTitle2Id[cat.obs_title] = cat.ID;
|
||||
});
|
||||
|
||||
searchDropdown.update({options: Object.keys(CatalogQueryBox.catalogs)})
|
||||
//console.log(CatalogQueryBox.catalogs)
|
||||
searchDropdown.update({options: Object.keys(CatalogQueryBox.catTitle2Id)})
|
||||
})
|
||||
|
||||
const fnIdSelected = function(type, params) {
|
||||
@@ -130,7 +134,8 @@ import { ActionButton } from "../Widgets/ActionButton.js";
|
||||
})
|
||||
} catch (e) {
|
||||
// Or he can select a HiPS from the list given
|
||||
const catalog = CatalogQueryBox.catalogs[value];
|
||||
const catID = CatalogQueryBox.catTitle2Id[value];
|
||||
const catalog = CatalogQueryBox.catalogs[catID];
|
||||
|
||||
if (catalog) {
|
||||
self._selectItem(catalog, aladin);
|
||||
|
||||
@@ -22,7 +22,7 @@ import hipsIconUrl from "../../../../assets/icons/hips.svg";
|
||||
import addIconUrl from "../../../../assets/icons/plus.svg";
|
||||
import settingsIconUrl from "../../../../assets/icons/settings.svg";
|
||||
import { Icon } from "../Widgets/Icon.js";
|
||||
import { HiPSSelector } from "../Input/HiPSSelector.js";
|
||||
import { LayerSelector } from "../Input/LayerSelector.js";
|
||||
import { HiPSBrowserBox } from "./HiPSBrowserBox.js";
|
||||
import { Input } from "../Widgets/Input.js";
|
||||
import { ActionButton } from "../Widgets/ActionButton.js";
|
||||
@@ -131,7 +131,7 @@ export class HiPSCompositeBox extends Box {
|
||||
this.hipsOptions.push({});
|
||||
let self = this;
|
||||
let newLayerLayout = [
|
||||
new HiPSSelector({
|
||||
new LayerSelector({
|
||||
change(e) {
|
||||
let name = e.target.value;
|
||||
let idLayer = getIdHiPS(e.target);
|
||||
@@ -149,7 +149,7 @@ export class HiPSCompositeBox extends Box {
|
||||
});
|
||||
} else {
|
||||
// it is an hips
|
||||
let HiPSOptions = HiPSSelector.cachedHiPS[name];
|
||||
let HiPSOptions = LayerSelector.cachedLayers[name];
|
||||
self.hipsOptions[idLayer].id = HiPSOptions.id || HiPSOptions.url
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import { Form } from "../Widgets/Form.js";
|
||||
import waveOnIconUrl from '../../../../assets/icons/wave-on.svg';
|
||||
import { WidgetTogglerButton } from "../Button/Toggler.js";
|
||||
import { Layout } from "../Layout.js";
|
||||
import { Utils } from "../../Utils";
|
||||
|
||||
export class HiPSSettingsBox extends Box {
|
||||
// Constructor
|
||||
@@ -204,7 +205,7 @@ import { WidgetTogglerButton } from "../Button/Toggler.js";
|
||||
value: 'linear',
|
||||
options: ['sqrt', 'linear', 'asinh', 'pow2', 'log'],
|
||||
change(e) {
|
||||
self.options.layer.setColormap(self.options.layer.getColorCfg().getColormap(), {stretch: e.target.value});
|
||||
self.options.layer.setColormap(self.options.layer.getColormap(), {stretch: e.target.value});
|
||||
},
|
||||
tooltip: {content: 'stretch function', position: {direction: 'bottom'}}
|
||||
},
|
||||
@@ -216,7 +217,7 @@ import { WidgetTogglerButton } from "../Button/Toggler.js";
|
||||
value: 0.0,
|
||||
change: (e) => {
|
||||
let minCut = +e.target.value
|
||||
self.options.layer.setCuts(minCut, self.options.layer.getColorCfg().getCuts()[1])
|
||||
self.options.layer.setCuts(minCut, self.options.layer.getCuts()[1])
|
||||
},
|
||||
cssStyle: { width: '7rem' }
|
||||
},
|
||||
@@ -228,7 +229,7 @@ import { WidgetTogglerButton } from "../Button/Toggler.js";
|
||||
value: 1.0,
|
||||
change: (e) => {
|
||||
let maxCut = +e.target.value
|
||||
self.options.layer.setCuts(self.options.layer.getColorCfg().getCuts()[0], maxCut)
|
||||
self.options.layer.setCuts(self.options.layer.getCuts()[0], maxCut)
|
||||
},
|
||||
cssStyle: { width: '7rem' }
|
||||
}]
|
||||
@@ -281,17 +282,19 @@ import { WidgetTogglerButton } from "../Button/Toggler.js";
|
||||
}
|
||||
|
||||
_update(layer) {
|
||||
let colorCfg = layer.getColorCfg();
|
||||
let stretch = colorCfg.stretch;
|
||||
let colormap = colorCfg.getColormap();
|
||||
let reversed = colorCfg.getReversed();
|
||||
let stretch = layer.stretch;
|
||||
let colormap = layer.getColormap();
|
||||
let reversed = layer.getReversed();
|
||||
|
||||
let [minCut, maxCut] = colorCfg.getCuts();
|
||||
if (minCut)
|
||||
let [minCut, maxCut] = layer.getCuts();
|
||||
if (Utils.isNumber(minCut)) {
|
||||
this.pixelSettingsContent.set('mincut', +minCut.toFixed(4))
|
||||
if (maxCut)
|
||||
}
|
||||
|
||||
if (Utils.isNumber(maxCut)) {
|
||||
this.pixelSettingsContent.set('maxcut', +maxCut.toFixed(4))
|
||||
|
||||
}
|
||||
|
||||
this.pixelSettingsContent.set('stretch', stretch)
|
||||
let fmtInput = this.pixelSettingsContent.getInput('fmt')
|
||||
fmtInput.innerHTML = '';
|
||||
@@ -309,10 +312,10 @@ import { WidgetTogglerButton } from "../Button/Toggler.js";
|
||||
this.colorSettingsContent.set('reverse', reversed);
|
||||
|
||||
this.opacitySettingsContent.set('opacity', layer.getOpacity());
|
||||
this.luminositySettingsContent.set('brightness', colorCfg.getBrightness());
|
||||
this.luminositySettingsContent.set('contrast', colorCfg.getContrast());
|
||||
this.luminositySettingsContent.set('gamma', colorCfg.getGamma());
|
||||
this.luminositySettingsContent.set('saturation', colorCfg.getSaturation());
|
||||
this.luminositySettingsContent.set('brightness', layer.getBrightness());
|
||||
this.luminositySettingsContent.set('contrast', layer.getContrast());
|
||||
this.luminositySettingsContent.set('gamma', layer.getGamma());
|
||||
this.luminositySettingsContent.set('saturation', layer.getSaturation());
|
||||
}
|
||||
|
||||
update(options) {
|
||||
|
||||
+20
-17
@@ -58,7 +58,7 @@ import { HiPSCompositeBox } from "./HiPSCompositeBox.js"
|
||||
import { Catalog } from "../../Catalog.js";
|
||||
import { ProgressiveCat } from "../../ProgressiveCat.js";
|
||||
import { Form } from "../Widgets/Form.js";
|
||||
import { HiPSSelector } from "./../Input/HiPSSelector.js";
|
||||
import { LayerSelector } from "../Input/LayerSelector.js";
|
||||
import { HiPS } from "../../HiPS.js";
|
||||
|
||||
export class OverlayStackBox extends Box {
|
||||
@@ -541,11 +541,6 @@ export class OverlayStackBox extends Box {
|
||||
|
||||
aladin.hipsBrowser._show({
|
||||
selected: (hips) => {
|
||||
let oldHiPS = aladin.getOverlayImageLayer(newLayer);
|
||||
if (oldHiPS && hips.id === oldHiPS.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
aladin.setOverlayImageLayer(hips, newLayer);
|
||||
},
|
||||
position: {
|
||||
@@ -912,9 +907,10 @@ export class OverlayStackBox extends Box {
|
||||
}
|
||||
}
|
||||
|
||||
let spectraDisplayer = aladin.view.spectraDisplayer;
|
||||
if (spectraDisplayer)
|
||||
/*let spectraDisplayer = aladin.view.spectraDisplayer;
|
||||
if (spectraDisplayer) {
|
||||
spectraDisplayer.attachHiPS3D(options.layer)
|
||||
} */
|
||||
},
|
||||
widget: catSettingsBox,
|
||||
openDirection: "right"
|
||||
@@ -967,7 +963,7 @@ export class OverlayStackBox extends Box {
|
||||
continue;
|
||||
}
|
||||
|
||||
let HiPSselect = new HiPSSelector({
|
||||
let layerSelect = new LayerSelector({
|
||||
layer: hips,
|
||||
change(e) {
|
||||
let name = e.target.value;
|
||||
@@ -976,10 +972,12 @@ export class OverlayStackBox extends Box {
|
||||
if (!aladin.hipsBrowser) {
|
||||
aladin.hipsBrowser = new HiPSBrowserBox(aladin);
|
||||
}
|
||||
|
||||
|
||||
let newLayer = hips.layer;
|
||||
aladin.hipsBrowser._show({
|
||||
selected: (hips) => {
|
||||
self.aladin.setOverlayImageLayer(hips, hips.layer);
|
||||
|
||||
self.aladin.setOverlayImageLayer(hips, newLayer);
|
||||
},
|
||||
position: { anchor: "center center" }
|
||||
});
|
||||
@@ -987,10 +985,15 @@ export class OverlayStackBox extends Box {
|
||||
}
|
||||
|
||||
let overlayLayer;
|
||||
if (name in HiPSSelector.cachedHiPS) {
|
||||
if (name in LayerSelector.cachedLayers) {
|
||||
// it is an hips
|
||||
let HiPSOptions = HiPSSelector.cachedHiPS[name];
|
||||
overlayLayer = A.HiPS(HiPSOptions.id || HiPSOptions.url, HiPSOptions);
|
||||
let layerOptions = LayerSelector.cachedLayers[name];
|
||||
//if (layerOptions.type === "hips") {
|
||||
// overlayLayer = A.HiPS(layerOptions.id || layerOptions.url, layerOptions);
|
||||
//} else if (layerOptions.type === "image") {
|
||||
// overlayLayer = A.image(layerOptions.url, layerOptions);
|
||||
//}
|
||||
overlayLayer = layerOptions.id;
|
||||
} else {
|
||||
overlayLayer = hips
|
||||
}
|
||||
@@ -1090,7 +1093,7 @@ export class OverlayStackBox extends Box {
|
||||
monochrome: true,
|
||||
},
|
||||
tooltip: {
|
||||
content: "Swap 2 layers",
|
||||
content: "Click on this button for both layers you want to swap",
|
||||
position: { direction: "top" },
|
||||
},
|
||||
toggled: false,
|
||||
@@ -1121,12 +1124,12 @@ export class OverlayStackBox extends Box {
|
||||
}
|
||||
btns = btns.concat([swapBtn, deleteBtn]);
|
||||
|
||||
let item = Layout.horizontal([HiPSselect, Layout.horizontal(btns)]);
|
||||
let item = Layout.horizontal([layerSelect, Layout.horizontal(btns)]);
|
||||
layout.push(item);
|
||||
|
||||
if (!(hips.layer in self.ui)) {
|
||||
self.ui[hips.layer] = {
|
||||
HiPSSelector: HiPSselect,
|
||||
//layerSelector: layerSelect,
|
||||
settingsBox,
|
||||
settingsBtn,
|
||||
showBtn,
|
||||
|
||||
@@ -51,7 +51,7 @@ export class CtxMenuActionButtonOpener extends WidgetTogglerButton {
|
||||
widget: aladin.contextMenu,
|
||||
enable(e) {
|
||||
// If it was hidden then reopen it
|
||||
if (self.layout) {
|
||||
if (self.layout && self.ctxMenu) {
|
||||
self.ctxMenu.attach(self.layout, self)
|
||||
}
|
||||
},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user