diff --git a/.Rbuildignore b/.Rbuildignore index 045847c8..71494fb9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -13,3 +13,4 @@ inst/examples ^revdep$ ^README\.Rmd$ ^CRAN-SUBMISSION$ +^LICENSE\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index df757804..1bd73f40 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,14 +1,14 @@ Package: antaresViz Type: Package Title: Antares Visualizations -Version: 0.18.0 +Version: 0.18.3 Authors@R: c( person("Tatiana", "Vargas", email = "tatiana.vargas@rte-france.com", role = c("aut", "cre")), - person("Jalal-Edine", "Zawam", role = "aut"), - person("Francois", "Guillem", role = "aut"), - person("Benoit", "Thieurmel", role = "aut"), - person("Titouan", "Robert", role = "aut"), - person("Paul", "Plessiez", role = "aut"), + person("Jalal-Edine", "Zawam", role = "ctb"), + person("Francois", "Guillem", role = "ctb"), + person("Benoit", "Thieurmel", role = "ctb"), + person("Titouan", "Robert", role = "ctb"), + person("Paul", "Plessiez", role = "ctb"), person("Baptiste", "Seguinot", role = "ctb"), person("RTE", role = "cph") ) @@ -19,7 +19,7 @@ Description: Visualize results generated by Antares, a powerful open source soft 'Antares' users visually explore the results of their simulations. URL: https://github.com/rte-antares-rpackage/antaresViz BugReports: https://github.com/rte-antares-rpackage/antaresViz/issues -License: GPL (>= 2) | file LICENSE +License: GPL (>= 3) Encoding: UTF-8 Depends: antaresRead (>= 2.2.9), @@ -45,14 +45,13 @@ Imports: leaflet.minicharts (>= 0.5.3), assertthat, rAmCharts, - utils + utils, + lifecycle RoxygenNote: 7.2.2 Suggests: testthat, covr, - rhdf5 (>= 2.20.2), ggplot2, - hexbin, knitr, visNetwork, rmarkdown diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..175443ce --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,595 @@ +GNU General Public License +========================== + +_Version 3, 29 June 2007_ +_Copyright © 2007 Free Software Foundation, Inc. <>_ + +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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +<>. + +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 +<>. diff --git a/NAMESPACE b/NAMESPACE index ac472e79..48d300b7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -56,6 +56,9 @@ importFrom(grDevices,rainbow) importFrom(grDevices,rgb) importFrom(graphics,par) importFrom(graphics,plot.default) +importFrom(lifecycle,deprecate_warn) +importFrom(lifecycle,deprecated) +importFrom(lifecycle,is_present) importFrom(methods,is) importFrom(plotly,add_bars) importFrom(plotly,add_heatmap) diff --git a/NEWS.md b/NEWS.md index ee6a7218..c8ac0117 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,16 @@ Copyright 2016 RTE Reseau de transport d'electricite +# antaresViz 0.18.3 +* The package has been accepted but archived as version 0.18.2. +New version for distribution on CRAN +* Licence file updated and documentation for `exchangesStack()` updated + +# antaresViz 0.18.2 +* fix cran issue on test not skip well + +# antaresViz 0.18.1 +* delete package dependecies `rhdf5` + # antaresViz 0.18.0 * fix deprecated dependencies (issue #200) * packages `rgeos`, `raster` removed and replaced by `sf` diff --git a/R/graph_utils.R b/R/graph_utils.R index f730f234..d41cd4ce 100644 --- a/R/graph_utils.R +++ b/R/graph_utils.R @@ -289,71 +289,6 @@ } - - -#' List of h5 params -#' -#' @param X_I, list -#' @param xyCompare, character -#' -#' @noRd -.h5ParamList <- function(X_I, xyCompare, h5requestFilter = NULL){ - listParam <- lapply(1:length(X_I), function(i){ - x <- X_I[[i]] - if (.isSimOpts(x)){ - tmp <- .h5Inf(x) - h5_filter <- h5requestFilter[[i]] - h5_tables <- c("areas", "districts", "clusters", "links") - if (!is.null(h5_filter)){ - if (!(is.null(h5_filter$areas) & is.null(h5_filter$districts) & - is.null(h5_filter$links) & is.null(h5_filter$clusters))){ - h5_tables <- c("areas", "districts", "clusters", "links") - h5_tables <- h5_tables[which(c(!is.null(h5_filter$areas), !is.null(h5_filter$districts), - !is.null(h5_filter$clusters), !is.null(h5_filter$links)))] - } - } - tmp$tabl <- intersect(tmp$tabl, h5_tables) - rhdf5::H5close() - tmp - }else{ - mcY <- unique(unlist(lapply(x, function(y){unique(y$mcYears)}))) - timeStepS <- attributes(x)$timeStep - tabl <- names(x) - list( - timeStepS = timeStepS, - mcYearS = mcY, - tabl = tabl - ) - } - }) - res <- lapply(.transposeL(listParam), function(x){ - .compareOperation(x, xyCompare) - }) - - res$h5requestFilter <- h5requestFilter - res -} - -#' Load information from h5 file -#' -#' @param x, opts -#' -#' @noRd -.h5Inf <- function(x){ - fid <- rhdf5::H5Fopen(x$h5path) - timeStepS <- .getTimeStep(fid) - timeStepS <- as.character(timeStepS) - mcYearS <- x$mcYears - tabl <- .getTableInH5(fid, timeStepS[1]) - rhdf5::H5Fclose(fid) - xPart = list( - timeStepS = timeStepS, - mcYearS = mcYearS, - tabl = tabl - ) -} - - .transposeL <- function(data){ do.call(c, apply(do.call(rbind, data), 2, list)) } diff --git a/R/h5_utils.R b/R/h5_utils.R index 3405373d..c9b8053f 100644 --- a/R/h5_utils.R +++ b/R/h5_utils.R @@ -1,109 +1,109 @@ -.convertH5Filtering <- function(h5requestFiltering, x) -{ - if (length(h5requestFiltering) > 0) - { - if (!is.list(h5requestFiltering[[1]])){ - if (!any(c("simOptions", "antaresDataTable") %in% class(x))) - { - h5requestFiltering <- rep(list(h5requestFiltering), length(x)) - }else{ - h5requestFiltering <- list(h5requestFiltering) - } - }else{ - if (inherits(x, "list")){ - if (length(h5requestFiltering) != length(x)){ - h5requestFiltering <- h5requestFiltering[1:length(x) %% length(h5requestFiltering) + 1] - } - } - } - }else{ - if (!any(c("simOptions", "antaresDataTable") %in% class(x))) - { - h5requestFiltering <- replicate(length(x), list()) - }else{ - h5requestFiltering <- replicate(1, list()) - } - } - h5requestFiltering -} +# .convertH5Filtering <- function(h5requestFiltering, x) +# { +# if (length(h5requestFiltering) > 0) +# { +# if (!is.list(h5requestFiltering[[1]])){ +# if (!any(c("simOptions", "antaresDataTable") %in% class(x))) +# { +# h5requestFiltering <- rep(list(h5requestFiltering), length(x)) +# }else{ +# h5requestFiltering <- list(h5requestFiltering) +# } +# }else{ +# if (inherits(x, "list")){ +# if (length(h5requestFiltering) != length(x)){ +# h5requestFiltering <- h5requestFiltering[1:length(x) %% length(h5requestFiltering) + 1] +# } +# } +# } +# }else{ +# if (!any(c("simOptions", "antaresDataTable") %in% class(x))) +# { +# h5requestFiltering <- replicate(length(x), list()) +# }else{ +# h5requestFiltering <- replicate(1, list()) +# } +# } +# h5requestFiltering +# } -.getTableInH5 <- function(fid, timeStep){ - dataExist <- NULL - if (rhdf5::H5Lexists(fid, paste0(timeStep, "/areas"))) - { - dataExist <- c(dataExist, "areas") - } - if (rhdf5::H5Lexists(fid, paste0(timeStep, "/links"))) - { - dataExist <- c(dataExist, "links") - } - if (rhdf5::H5Lexists(fid, paste0(timeStep, "/clusters"))) - { - dataExist <- c(dataExist, "clusters") - } - if (rhdf5::H5Lexists(fid, paste0(timeStep, "/districts"))) - { - dataExist <- c(dataExist, "districts") - } - dataExist -} +# .getTableInH5 <- function(fid, timeStep){ +# dataExist <- NULL +# if (rhdf5::H5Lexists(fid, paste0(timeStep, "/areas"))) +# { +# dataExist <- c(dataExist, "areas") +# } +# if (rhdf5::H5Lexists(fid, paste0(timeStep, "/links"))) +# { +# dataExist <- c(dataExist, "links") +# } +# if (rhdf5::H5Lexists(fid, paste0(timeStep, "/clusters"))) +# { +# dataExist <- c(dataExist, "clusters") +# } +# if (rhdf5::H5Lexists(fid, paste0(timeStep, "/districts"))) +# { +# dataExist <- c(dataExist, "districts") +# } +# dataExist +# } -.getVariablesH5 <- function(fid, timeStep, tables){ - sapply(tables, function(X){ - struct <- .getstructure(fid, paste0(timeStep, "/", X, "/mcInd/", "/structure"))$variable - if ("timeId" %in% struct){ - struct <- struct[struct != "timeId"] - } - struct - }, simplify = FALSE) -} +# .getVariablesH5 <- function(fid, timeStep, tables){ +# sapply(tables, function(X){ +# struct <- .getstructure(fid, paste0(timeStep, "/", X, "/mcInd/", "/structure"))$variable +# if ("timeId" %in% struct){ +# struct <- struct[struct != "timeId"] +# } +# struct +# }, simplify = FALSE) +# } -.getClustersNames <- function(fid, timeStep){ - unique(unlist(lapply(strsplit(.getstructure(fid, paste0(timeStep, "/clusters/mcInd/structure"))$cluster, "/"), function(X)X[1]))) -} +# .getClustersNames <- function(fid, timeStep){ +# unique(unlist(lapply(strsplit(.getstructure(fid, paste0(timeStep, "/clusters/mcInd/structure"))$cluster, "/"), function(X)X[1]))) +# } -.getElements <- function(opts, tables, fid, timeStep){ - elements <- list() - if ("areas" %in% tables) elements$areas <- opts$areaList - if ("links" %in% tables) elements$links <- opts$linkList - if ("districts" %in% tables) elements$districts <- opts$districtList - if ("clusters" %in% tables){ - elements$clusters <- .getClustersNames(fid, timeStep) - } - elements -} +# .getElements <- function(opts, tables, fid, timeStep){ +# elements <- list() +# if ("areas" %in% tables) elements$areas <- opts$areaList +# if ("links" %in% tables) elements$links <- opts$linkList +# if ("districts" %in% tables) elements$districts <- opts$districtList +# if ("clusters" %in% tables){ +# elements$clusters <- .getClustersNames(fid, timeStep) +# } +# elements +# } +# +# .getDateRange <- function(opts, timeStep){ +# tim <- .timeIdToDate(sort( +# unique( +# antaresRead::.h5ReadAntares(opts$h5path, timeStep = timeStep, select = "timeId", +# areas = opts$areaList[1], mcYears = opts$mcYears[1], perf = FALSE)$timeId) +# ), timeStep = timeStep, opts = opts) +# dt <- as.Date(range(tim)) +# dt +# } +# +# +# .getGraphFunction <- function(type){ +# switch(type, +# "ts" = .plotTS, +# "barplot" = .barplot, +# "monotone" = .plotMonotone, +# "density" = .density, +# "cdf" = .cdf, +# "heatmap" = .heatmap, +# stop("Invalid type") +# ) +# } -.getDateRange <- function(opts, timeStep){ - tim <- .timeIdToDate(sort( - unique( - antaresRead::.h5ReadAntares(opts$h5path, timeStep = timeStep, select = "timeId", - areas = opts$areaList[1], mcYears = opts$mcYears[1], perf = FALSE)$timeId) - ), timeStep = timeStep, opts = opts) - dt <- as.Date(range(tim)) - dt -} - - -.getGraphFunction <- function(type){ - switch(type, - "ts" = .plotTS, - "barplot" = .barplot, - "monotone" = .plotMonotone, - "density" = .density, - "cdf" = .cdf, - "heatmap" = .heatmap, - stop("Invalid type") - ) -} - -.getTimeStep <- function(fid){ - timeSteps <- sapply(c("hourly", "daily", "weekly", "monthly", "annual"), function(X){ - rhdf5::H5Lexists(fid, X) - }) - names(timeSteps[which(timeSteps == TRUE)]) -} +# .getTimeStep <- function(fid){ +# timeSteps <- sapply(c("hourly", "daily", "weekly", "monthly", "annual"), function(X){ +# rhdf5::H5Lexists(fid, X) +# }) +# names(timeSteps[which(timeSteps == TRUE)]) +# } .compareOperation <- function(a, opType){ if (length(a) == 1) return(unlist(unique(a))) diff --git a/R/h5_utils_plot.R b/R/h5_utils_plot.R index fd2418b4..5b8e0720 100644 --- a/R/h5_utils_plot.R +++ b/R/h5_utils_plot.R @@ -1,20 +1,20 @@ -.getstructure <- function(fid, strgp){ - gid <- rhdf5::H5Gopen(fid, strgp) - data <- rhdf5::h5dump(gid) - rhdf5::H5Gclose(gid) - if(length(which(data$reCalcVar!="")) > 0) - { - data$reCalcVar <- data$reCalcVar[which(data$reCalcVar!="")] - data$variable <- c(data$variable, data$reCalcVar) - data$reCalcVar <- NULL - } - data -} - -.tryCloseH5 <- function(){ - try(rhdf5::H5close(), silent = TRUE) -} +# .getstructure <- function(fid, strgp){ +# gid <- rhdf5::H5Gopen(fid, strgp) +# data <- rhdf5::h5dump(gid) +# rhdf5::H5Gclose(gid) +# if(length(which(data$reCalcVar!="")) > 0) +# { +# data$reCalcVar <- data$reCalcVar[which(data$reCalcVar!="")] +# data$variable <- c(data$variable, data$reCalcVar) +# data$reCalcVar <- NULL +# } +# data +# } +# +# .tryCloseH5 <- function(){ +# try(rhdf5::H5close(), silent = TRUE) +# } diff --git a/R/map.R b/R/map.R index 9cbba1bd..9dea34c1 100644 --- a/R/map.R +++ b/R/map.R @@ -8,11 +8,11 @@ #' #' @param x #' Object of class \code{antaresDataList} created with -#' \code{\link[antaresRead]{readAntares}} and containing areas and links data. +#' [antaresRead::readAntares()] and containing areas and links data. #' It can be a list of \code{antaresData} objects. #' In this case, one chart is created for each object. #' @param mapLayout -#' Object created with function \code{\link{mapLayout}} +#' Object created with function [antaresViz::mapLayout()] #' @param colAreaVar #' Name of a variable present in \code{x$areas}. The values of this variable #' are represented by the color of the areas on the map. If \code{"none"}, then @@ -28,7 +28,7 @@ #' \code{logical}. Select \code{sizeAreaVars} using alias ? Default to \code{FALSE} #' @param aliasSizeAreaVars #' If \code{typeSizeAreaVars} is set to TRUE, name of alias. You can find the list -#' of alias with the function \code{\link[antaresRead]{showAliases}} +#' of alias with the function [antaresRead::showAliases()] #' @param areaChartType #' If parameter \code{sizeAreaVars} contains multiple variables, this parameter #' determines the type of representation. Possible values are \code{"bar"} for @@ -70,12 +70,12 @@ #' Title of the map. #' @param options #' List of parameters that override some default visual settings. See the -#' help of \code{\link{plotMapOptions}}. +#' help of [antaresViz::plotMapOptions()]. #' @param sizeMiniPlot \code{boolean} variable size for miniplot #' @param h5requestFiltering Contains arguments used by default for h5 request, #' typically h5requestFiltering = list(mcYears = 3) #' @inheritParams prodStack -#' +#' @importFrom lifecycle is_present deprecate_warn deprecated #' #' @details #' @@ -181,14 +181,30 @@ plotMap <- function(x, compareOpts = list(), interactive = getInteractivity(), options = plotMapOptions(), - width = NULL, height = NULL, dateRange = NULL, xyCompare = c("union","intersect"), - h5requestFiltering = list(), - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + width = NULL, + height = NULL, + dateRange = NULL, + xyCompare = c("union","intersect"), + h5requestFiltering = deprecated(), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), sizeMiniPlot = FALSE,language = "en", hidden = NULL, ...) { + deprecated_vector_params <- c(lifecycle::is_present(h5requestFiltering), + lifecycle::is_present(timeSteph5), + lifecycle::is_present(mcYearh5), + lifecycle::is_present(tablesh5)) + + if(any(deprecated_vector_params)) + lifecycle::deprecate_warn( + when = "0.18.1", + what = "plotMap(h5requestFiltering)", + details = "all these parameters are relative to the 'rhdf5' package, + which is removed from the dependencies" + ) + .check_x(x) .check_compare_interactive(compare, interactive) @@ -251,7 +267,7 @@ plotMap <- function(x, } # .testXclassAndInteractive(x, interactive) - h5requestFiltering <- .convertH5Filtering(h5requestFiltering = h5requestFiltering, x = x) + # h5requestFiltering <- .convertH5Filtering(h5requestFiltering = h5requestFiltering, x = x) compareOptions <- .compOpts(x, compare) @@ -512,15 +528,15 @@ plotMap <- function(x, if (!interactive) { - listParamH5NoInt <- list( - timeSteph5 = timeSteph5, - mcYearh5 = mcYearh5, - tablesh5 = tablesh5, - h5requestFiltering = h5requestFiltering - ) + # listParamH5NoInt <- list( + # timeSteph5 = timeSteph5, + # mcYearh5 = mcYearh5, + # tablesh5 = tablesh5, + # h5requestFiltering = h5requestFiltering + # ) params <- .getParamsNoInt(x = x, refStudy = refStudy, - listParamH5NoInt = listParamH5NoInt, + listParamH5NoInt = NULL, compare = compare, compareOptions = compareOptions, processFun = processFun, @@ -560,7 +576,7 @@ plotMap <- function(x, { if(!is.null(params)) { - .tryCloseH5() + # .tryCloseH5() # udpate for mw 0.11 & 0.10.1 if(!is.null(params)){ ind <- .id %% length(params$x) @@ -617,82 +633,82 @@ plotMap <- function(x, .giveListFormat(x) }), - h5requestFiltering = mwSharedValue({h5requestFiltering}), + # h5requestFiltering = mwSharedValue({h5requestFiltering}), - paramsH5 = mwSharedValue({ - paramsH5List <- .h5ParamList(X_I = x_in, xyCompare = xyCompare, h5requestFilter = h5requestFiltering) - rhdf5::H5close() - paramsH5List - }), - H5request = mwGroup( - label = .getLabelLanguage("H5request", language), - timeSteph5 = mwSelect( - { - if(length(paramsH5) > 0){ - choices = paramsH5$timeStepS - names(choices) <- sapply(choices, function(x) .getLabelLanguage(x, language)) - } else { - choices <- NULL - } - choices - }, - value = paramsH5$timeStepS[1], - label = .getLabelLanguage("timeStep", language), - multiple = FALSE, .display = !"timeSteph5" %in% hidden - ), - tables = mwSelect( - { - if(length(paramsH5) > 0){ - choices = paramsH5[["tabl"]][paramsH5[["tabl"]] %in% c("areas", "links")] - names(choices) <- sapply(choices, function(x) .getLabelLanguage(x, language)) - } else { - choices <- NULL - } - choices - }, - value = { - if(.initial) {paramsH5[["tabl"]][paramsH5[["tabl"]] %in% c("areas", "links")]} else {NULL} - }, - label = .getLabelLanguage("table", language), multiple = TRUE, - .display = !"tables" %in% hidden - ), - mcYearH5 = mwSelectize( - choices = { - ch <- c("Average" = "", paramsH5[["mcYearS"]]) - names(ch)[1] <- .getLabelLanguage("Average", language) - ch - }, - value = { - if(.initial){paramsH5[["mcYearS"]][1]}else{NULL} - }, - label = .getLabelLanguage("mcYears to be imported", language), - multiple = TRUE, options = list(maxItems = 4), - .display = (!"mcYearH5" %in% hidden & !meanYearH5) - ), - meanYearH5 = mwCheckbox(value = FALSE, - label = .getLabelLanguage("Average mcYear", language), - .display = !"meanYearH5" %in% hidden), - .display = {any(unlist(lapply(x_in, .isSimOpts))) & !"H5request" %in% hidden} - ), - sharerequest = mwSharedValue({ - if(length(meanYearH5) > 0){ - if(meanYearH5){ - list(timeSteph5_l = timeSteph5, mcYearh_l = NULL, tables_l = tables) - } else { - list(timeSteph5_l = timeSteph5, mcYearh_l = mcYearH5, tables_l = tables) - } - } else { - list(timeSteph5_l = timeSteph5, mcYearh_l = mcYearH5, tables_l = tables) - } - }), - x_tranform = mwSharedValue({ - resXT <- .get_x_transform(x_in = x_in, - sharerequest = sharerequest, - refStudy = refStudy, - h5requestFilter = paramsH5$h5requestFilter ) - resXT - - }), + # paramsH5 = mwSharedValue({ + # paramsH5List <- .h5ParamList(X_I = x_in, xyCompare = xyCompare, h5requestFilter = h5requestFiltering) + # rhdf5::H5close() + # paramsH5List + # }), + # H5request = mwGroup( + # label = .getLabelLanguage("H5request", language), + # timeSteph5 = mwSelect( + # { + # if(length(paramsH5) > 0){ + # choices = paramsH5$timeStepS + # names(choices) <- sapply(choices, function(x) .getLabelLanguage(x, language)) + # } else { + # choices <- NULL + # } + # choices + # }, + # value = paramsH5$timeStepS[1], + # label = .getLabelLanguage("timeStep", language), + # multiple = FALSE, .display = !"timeSteph5" %in% hidden + # ), + # tables = mwSelect( + # { + # if(length(paramsH5) > 0){ + # choices = paramsH5[["tabl"]][paramsH5[["tabl"]] %in% c("areas", "links")] + # names(choices) <- sapply(choices, function(x) .getLabelLanguage(x, language)) + # } else { + # choices <- NULL + # } + # choices + # }, + # value = { + # if(.initial) {paramsH5[["tabl"]][paramsH5[["tabl"]] %in% c("areas", "links")]} else {NULL} + # }, + # label = .getLabelLanguage("table", language), multiple = TRUE, + # .display = !"tables" %in% hidden + # ), + # mcYearH5 = mwSelectize( + # choices = { + # ch <- c("Average" = "", paramsH5[["mcYearS"]]) + # names(ch)[1] <- .getLabelLanguage("Average", language) + # ch + # }, + # value = { + # if(.initial){paramsH5[["mcYearS"]][1]}else{NULL} + # }, + # label = .getLabelLanguage("mcYears to be imported", language), + # multiple = TRUE, options = list(maxItems = 4), + # .display = (!"mcYearH5" %in% hidden & !meanYearH5) + # ), + # meanYearH5 = mwCheckbox(value = FALSE, + # label = .getLabelLanguage("Average mcYear", language), + # .display = !"meanYearH5" %in% hidden), + # .display = {any(unlist(lapply(x_in, .isSimOpts))) & !"H5request" %in% hidden} + # ), + # sharerequest = mwSharedValue({ + # if(length(meanYearH5) > 0){ + # if(meanYearH5){ + # list(timeSteph5_l = timeSteph5, mcYearh_l = NULL, tables_l = tables) + # } else { + # list(timeSteph5_l = timeSteph5, mcYearh_l = mcYearH5, tables_l = tables) + # } + # } else { + # list(timeSteph5_l = timeSteph5, mcYearh_l = mcYearH5, tables_l = tables) + # } + # }), + # x_tranform = mwSharedValue({ + # resXT <- .get_x_transform(x_in = x_in, + # sharerequest = sharerequest, + # refStudy = refStudy, + # h5requestFilter = paramsH5$h5requestFilter ) + # resXT + # + # }), ##Stop h5 mcYear = mwSelect( diff --git a/R/map_layout.R b/R/map_layout.R index 8509562d..68efd8ee 100644 --- a/R/map_layout.R +++ b/R/map_layout.R @@ -8,19 +8,19 @@ #' study. The result should then be saved in an external file and be reused. #' #' @param layout -#' object returned by function \code{\link[antaresRead]{readLayout}} +#' object returned by function [antaresRead::readLayout()] #' @param what #' Either "areas" or "districts". Indicates what type of object to place #' on the map. #' @param map -#' An optional \code{\link[sp]{SpatialPolygons}} or -#' \code{\link[sp:SpatialPolygons]{SpatialPolygonsDataFrame}} object. See \code{\link[spMaps:spMaps]{getSpMaps}} +#' An optional [sp::SpatialPolygons()] or +#' [sp::SpatialPolygonsDataFrame()] object. See [spMaps::getSpMaps()] #' #' @param map_builder \code{logical} Add inputs for build custom map ? Defaut to TRUE. #' #' @details #' With \code{map_builder} option, you can build a quiet custom map using \code{spMaps} package. -#' This package help you to build \code{\link[sp:SpatialPolygons]{SpatialPolygonsDataFrame}} on Europe. +#' This package help you to build [sp::SpatialPolygons()] on Europe. #' Moreover, you can use two options in the module : #' #' \itemize{ @@ -51,7 +51,7 @@ #' @export #' @import spMaps #' -#' @seealso \code{\link{plotMapLayout}} +#' @seealso [plotMapLayout()] mapLayout <- function(layout, what = c("areas", "districts"), map = getSpMaps(), map_builder = TRUE) { what <- match.arg(what) @@ -73,7 +73,7 @@ mapLayout <- function(layout, what = c("areas", "districts"), map = getSpMaps(), #' Visualize mapLayout output. #' #' @param mapLayout -#' object returned by function \code{\link{mapLayout}} +#' object returned by function [mapLayout()] #' #' @examples #' @@ -90,7 +90,7 @@ mapLayout <- function(layout, what = c("areas", "districts"), map = getSpMaps(), #' #' @export #' -#' @seealso \code{\link{mapLayout}} +#' @seealso [mapLayout()] plotMapLayout <- function(mapLayout){ if (!is.null(mapLayout$all_coords)){ @@ -513,10 +513,10 @@ changeCoordsServer <- function(input, output, session, #' #' This method can be used to visualize the network of an antares study. #' It generates an interactive map with a visual representaiton of a -#' map layout created with function \code{\link{mapLayout}}. +#' map layout created with function [mapLayout()]. #' #' @param x -#' Object created with function \code{\link{mapLayout}} +#' Object created with function [mapLayout()] #' @param colAreas #' Vector of colors for areas. By default, the colors used in the Antares #' software are used. @@ -554,7 +554,7 @@ changeCoordsServer <- function(input, output, session, #' @return #' The function generates an \code{htmlwidget} of class \code{leaflet}. It can #' be stored in a variable and modified with package -#' \code{\link[leaflet]{leaflet}} +#' [leaflet::leaflet()] #' #' @method plot mapLayout #' diff --git a/R/map_options.R b/R/map_options.R index ccbb66b5..e82740c9 100644 --- a/R/map_options.R +++ b/R/map_options.R @@ -3,7 +3,7 @@ #' Graphical options for plotMap #' #' These functions get and set options that control some graphical aspects -#' of maps created with \code{\link{plotMap}}. +#' of maps created with [plotMap()]. #' #' @param areaDefaultCol #' default color of areas. diff --git a/R/mod_XY.R b/R/mod_XY.R index 4780ca47..0176af2f 100644 --- a/R/mod_XY.R +++ b/R/mod_XY.R @@ -45,11 +45,11 @@ modXY <- function(x, xyCompare = c("union","intersect")) x_in = mwSharedValue({ .giveListFormat(x) }), - paramsH5 = mwSharedValue({ - paramsH5List <- .h5ParamList(X_I = x_in, xyCompare = xyCompare) - rhdf5::H5close() - paramsH5List - }), + # paramsH5 = mwSharedValue({ + # paramsH5List <- .h5ParamList(X_I = x_in, xyCompare = xyCompare) + # rhdf5::H5close() + # paramsH5List + # }), H5request = mwGroup( timeSteph5 = mwSelect(choices = paramsH5$timeStepS, value = paramsH5$timeStepS[1], diff --git a/R/mod_rpart.R b/R/mod_rpart.R index 4fdb34aa..bd634f85 100644 --- a/R/mod_rpart.R +++ b/R/mod_rpart.R @@ -2,7 +2,7 @@ #' Make rpart from antares data #' -#' @param data an antaresData after use of \code{\link[antaresProcessing]{mergeAllAntaresData}} +#' @param data an antaresData after use of [antaresProcessing::mergeAllAntaresData] #' #' @examples #' \dontrun{ diff --git a/R/plot.R b/R/plot.R index 6530131b..410922ac 100644 --- a/R/plot.R +++ b/R/plot.R @@ -61,7 +61,7 @@ #' Label of the Y axis. #' @param colorScaleOpts #' A list of parameters that control the creation of color scales. It is used -#' only for heatmaps. See \code{\link{colorScaleOptions}}() for available +#' only for heatmaps. See [colorScaleOptions()] for available #' parameters. #' @param xyCompare #' Use when you compare studies, can be "union" or "intersect". If union, all @@ -106,7 +106,6 @@ #' #' @examples #' \dontrun{ -#' setSimulationPath(path = path1) #' mydata <- readAntares(areas = "all", timeStep = "hourly") #' plot(x = mydata) #' @@ -170,8 +169,9 @@ #' # Compare 2 studies with argument refStudy #' plot(x = opts, refStudy = opts2) #' plot(x = opts, refStudy = opts2, type = "ts", interactive = FALSE, mcYearh5 = 2) -#' plot(x = opts, refStudy = opts2, type = "ts", dateRange = DR, h5requestFiltering = list( -#' mcYears = mcYears = mcYearToTest)) +#' plot(x = opts, refStudy = opts2, type = "ts", +#' dateRange = DR, +#' h5requestFiltering = list(mcYears = mcYears = mcYearToTest)) #' #' #' } @@ -204,13 +204,38 @@ tsPlot <- function(x, legendItemsPerRow = 5, colorScaleOpts = colorScaleOptions(20), width = NULL, height = NULL, xyCompare = c("union","intersect"), - h5requestFiltering = list(), highlight = FALSE, stepPlot = FALSE, drawPoints = FALSE, + h5requestFiltering = deprecated(), highlight = FALSE, stepPlot = FALSE, drawPoints = FALSE, secondAxis = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), language = "en", + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, ...) { + deprecated_vector_params <- c(lifecycle::is_present(h5requestFiltering), + lifecycle::is_present(timeSteph5), + lifecycle::is_present(mcYearh5), + lifecycle::is_present(tablesh5)) + + if(any(deprecated_vector_params)){ + lifecycle::deprecate_warn( + when = "0.18.1", + what = "tsPlot(h5requestFiltering)", + details = "all these parameters are relative to the 'rhdf5' package, + which is removed from the dependencies" + ) + + h5requestFiltering <- NULL + timeSteph5 <- NULL + mcYearh5 <- NULL + tablesh5 <- NULL + } + + # force (deprecated) + h5requestFiltering <- NULL + timeSteph5 <- NULL + mcYearh5 <- NULL + tablesh5 <- NULL + .check_x(x) .check_compare_interactive(compare, interactive) @@ -258,7 +283,7 @@ tsPlot <- function(x, } # .testXclassAndInteractive(x, interactive) - h5requestFiltering <- .convertH5Filtering(h5requestFiltering = h5requestFiltering, x = x) + # h5requestFiltering <- .convertH5Filtering(h5requestFiltering = h5requestFiltering, x = x) # Generate a group number for dygraph objects @@ -478,7 +503,7 @@ tsPlot <- function(x, meanYearH5 <- NULL manipulateWidget({ - .tryCloseH5() + # .tryCloseH5() # udpate for mw 0.11 & 0.10.1 if(!is.null(params)){ @@ -531,9 +556,9 @@ tsPlot <- function(x, h5requestFiltering = mwSharedValue({h5requestFiltering}), - paramsH5 = mwSharedValue({ - .h5ParamList(X_I = x_in, xyCompare = xyCompare, h5requestFilter = h5requestFiltering) - }), + # paramsH5 = mwSharedValue({ + # .h5ParamList(X_I = x_in, xyCompare = xyCompare, h5requestFilter = h5requestFiltering) + # }), H5request = mwGroup( label = .getLabelLanguage("H5request", language), diff --git a/R/plot_utils.R b/R/plot_utils.R index 67e78438..56a8b9db 100644 --- a/R/plot_utils.R +++ b/R/plot_utils.R @@ -214,7 +214,7 @@ listParamsCheck$x <- list(listParamsCheck$x, listParamsCheck$x) } - listParamsCheck$h5requestFiltering <- .convertH5Filtering(h5requestFiltering = listParamsCheck$h5requestFiltering, x = listParamsCheck$x) + # listParamsCheck$h5requestFiltering <- .convertH5Filtering(h5requestFiltering = listParamsCheck$h5requestFiltering, x = listParamsCheck$x) listParamsCheck$compareOptions <- .compOpts(listParamsCheck$x, listParamsCheck$compare) if (is.null(listParamsCheck$compare)){ diff --git a/R/savePlotAsPng.R b/R/savePlotAsPng.R index 76ea316e..6f57d9ed 100644 --- a/R/savePlotAsPng.R +++ b/R/savePlotAsPng.R @@ -13,7 +13,7 @@ #' @param height #' height of the output file #' @param ... -#' Other parameters passed to function \code{\link[webshot]{webshot}} +#' Other parameters passed to function [webshot::webshot] #' #' @return #' The function only creates the required file. Nothing is returned diff --git a/R/stack_exchanges.R b/R/stack_exchanges.R index 553b73c5..b23b9e9f 100644 --- a/R/stack_exchanges.R +++ b/R/stack_exchanges.R @@ -1,8 +1,8 @@ # Copyright © 2016 RTE Réseau de transport d’électricité -#' Plot the exchanges of an area +#' @title Plot the exchanges of an area #' -#' This function draws a stack representing the evolution of the exchanges of +#' @description This function draws a stack representing the evolution of the exchanges of #' an area with its neighbours. Positive values denotes exports and negative #' values imports. #' User can either plot all flows from/to an area using the \code{default} stack or use a custom one. @@ -11,7 +11,7 @@ #' #' @param x #' Object of class \code{antaresData} created with function -#' \code{\link[antaresRead]{readAntares}}. It is required to contain link data. +#' [antaresRead::readAntares]. It is required to contain link data. #' If it also contains area data with column `ROW BAL.`, then exchanges with #' the rest of the world are also displayed on the chart. #' @param stack @@ -46,50 +46,46 @@ #' } #' #' @examples -#' \dontrun{ -#' mydata <- readAntares(links = "all", timeStep = "daily") -#' exchangesStack(mydata) -#' -#' # Also display exchanges with the rest of the world -#' mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") -#' exchangesStack(mydata) -#' -#' # Use compare : -#' exchangesStack(mydata, compare = "mcYear") -#' exchangesStack(mydata, compare = "area") -#' exchangesStack(mydata, compare = "unit") -#' exchangesStack(mydata, compare = "legend") -#' # Compare studies with refStudy argument -#' exchangesStack(x = myData1, refStudy = myData2) -#' exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) -#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) -#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) -#' -#' # Use h5 opts -#' # Set path of simulaiton -#' setSimulationPath(path = path1) -#' -#' # Convert your study in h5 format -#' writeAntaresH5(path = mynewpath) -#' -#' # Redefine sim path with h5 file -#' opts <- setSimulationPath(path = mynewpath) -#' exchangesStack(x = opts) -#' -#' # Compare elements in a single study -#' exchangesStack(x = opts, .compare = "mcYear") -#' -#' # Compare 2 studies -#' exchangesStack(x = list(opts, opts2)) -#' -#' # Compare 2 studies with argument refStudy -#' exchangesStack(x = opts, refStudy = opts2) -#' exchangesStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea) -#' exchangesStack(x = opts, refStudy = opts2, h5requestFiltering = list( -#' areas = getAreas(select = "a"), -#' links = getLinks(areas = myArea), -#' mcYears = myMcYear)) +#' \donttest{ +#' library(antaresRead) +#' # with study test for example (study is in package antaresRead) +#' sourcedir <- system.file("testdata", package = "antaresRead") #' +#' # untar study in temp dir +#' path_latest <- file.path(tempdir(), "latest") +#' untar(file.path(sourcedir, "antares-test-study.tar.gz"), exdir = path_latest) +#' +#' study_path <- file.path(path_latest, "test_case") +#' +#' # set path to your Antares simulation +#' opts <- setSimulationPath(study_path) +#' +#' if(interactive()){ +#' mydata <- readAntares(links = "all", timeStep = "daily") +#' exchangesStack(mydata) +#' +#' # Also display exchanges with the rest of the world +#' mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") +#' exchangesStack(mydata) +#' +#' # Use compare : +#' exchangesStack(mydata, compare = "mcYear") +#' exchangesStack(mydata, compare = "area") +#' exchangesStack(mydata, compare = "unit") +#' exchangesStack(mydata, compare = "legend") +#' # Compare studies with refStudy argument +#' exchangesStack(x = myData1, refStudy = myData2) +#' exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) +#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) +#' exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) +#' +#' +#' # Compare 2 studies +#' exchangesStack(x = list(opts, opts)) +#' +#' # Compare 2 studies with argument refStudy +#' exchangesStack(x = opts, refStudy = opts) +#' } #' } #' #' @export @@ -107,15 +103,41 @@ exchangesStack <- function(x, legendItemsPerRow = 5, width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), + h5requestFiltering = deprecated(), stepPlot = FALSE, drawPoints = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, refStudy = NULL, ...) { + + deprecated_vector_params <- c(lifecycle::is_present(h5requestFiltering), + lifecycle::is_present(timeSteph5), + lifecycle::is_present(mcYearh5), + lifecycle::is_present(tablesh5)) + + if(any(deprecated_vector_params)){ + lifecycle::deprecate_warn( + when = "0.18.1", + what = "exchangesStack(h5requestFiltering)", + details = "all these parameters are relative to the 'rhdf5' package, + which is removed from the dependencies" + ) + + h5requestFiltering <- NULL + timeSteph5 <- NULL + mcYearh5 <- NULL + tablesh5 <- NULL + } + + # force (deprecated) + h5requestFiltering <- NULL + timeSteph5 <- NULL + mcYearh5 <- NULL + tablesh5 <- NULL + #we can hide these values exchangesStackValHidden <- c("H5request", "timeSteph5", "mcYearhH5", "mcYear", "main", @@ -385,7 +407,7 @@ exchangesStack <- function(x, manipulateWidget( { - .tryCloseH5() + # .tryCloseH5() # udpate for mw 0.11 & 0.10.1 if(!is.null(params)){ ind <- .id %% length(params$x) @@ -404,9 +426,9 @@ exchangesStack <- function(x, .giveListFormat(x) }), - paramsH5 = mwSharedValue({ - .h5ParamList(X_I = x_in, xyCompare = xyCompare, h5requestFilter = h5requestFiltering) - }), + # paramsH5 = mwSharedValue({ + # .h5ParamList(X_I = x_in, xyCompare = xyCompare, h5requestFilter = h5requestFiltering) + # }), H5request = mwGroup( label = .getLabelLanguage("H5request", language), diff --git a/R/stack_map.R b/R/stack_map.R index 4407bd2c..9edad46c 100644 --- a/R/stack_map.R +++ b/R/stack_map.R @@ -6,7 +6,7 @@ #' #' @param x \code{antaresDataList} antaresDataList contian areas ans links. #' @param mapLayout -#' Object created with function \code{\link{mapLayout}} +#' Object created with function [mapLayout()] #' #' @examples #' \dontrun{ diff --git a/R/stack_prod.R b/R/stack_prod.R index 6a4a541d..d249369d 100644 --- a/R/stack_prod.R +++ b/R/stack_prod.R @@ -8,13 +8,13 @@ #' #' @param x #' An object of class \code{antaresData} created with function -#' \code{\link[antaresRead]{readAntares}} containing data for areas and or +#' [antaresRead::readAntares()] containing data for areas and or #' districts. it can be a list of \code{antaresData} objects. #' In this case, one chart is created for each object. #' Can also contains opts who refer to a h5 file or list of opts. #' @param refStudy #' An object of class \code{antaresData} created with function -#' \code{\link[antaresRead]{readAntares}} containing data for areas and or +#' [antaresRead::readAntares()] containing data for areas and or #' districts. Can also contains an opts who refer to a h5 file. #' @param stack #' Name of the stack to use. One can visualize available stacks with @@ -49,7 +49,7 @@ #' @param compareOpts #' List of options that indicates the number of charts to create and their #' position. Check out the documentation of -#' \code{\link[manipulateWidget]{compareOptions}} to see available options. +#' [manipulateWidget::compareOptions] to see available options. #' @param width #' Width of the graph expressed in pixels or in percentage of #' the parent element. For instance "500px" and "100\%" are valid values. @@ -62,10 +62,10 @@ #' @param legend #' Logical value indicating if a legend should be drawn. This argument is #' usefull when one wants to create a shared legend with -#' \code{\link{prodStackLegend}} +#' [prodStackLegend()] #' @param legendId Id of the legend linked to the graph. This argument is #' usefull when one wants to create a shared legend with -#' \code{\link{prodStackLegend}} +#' [prodStackLegend()] #' @param groupId Parameter that can be used to synchronize the horizontal #' zoom of multiple charts. All charts that need to be synchronized must #' have the same group. @@ -76,7 +76,7 @@ #' @param name #' name of the stack to create or update #' @param variables -#' A named list of expressions created with \code{\link[base:list]{alist}}. The +#' A named list of expressions created with [base::alist]. The #' name of each element is the name of the variable to draw in the stacked #' graph. The element itself is an expression explaining how to compute the #' variable (see examples). @@ -85,7 +85,7 @@ #' \code{variables} is an alias, then this argument should be \code{NULL} in #' order to use default colors. #' @param lines -#' A named list of expressions created with \code{\link[base:list]{alist}} +#' A named list of expressions created with [base::alist] #' indicating how to compute the curves to display on top of the stacked graph. #' It should be \code{NULL} if there is no curve to trace or if parameter #' \code{variables} is an alias. @@ -111,7 +111,7 @@ #' @param tablesh5 \code{character} tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode. #' @param language \code{character} language use for label. Defaut to 'en'. Can be 'fr'. #' @param hidden \code{logical} Names of input to hide. Defaut to NULL -#' @param ... Other arguments for \code{\link{manipulateWidget}} +#' @param ... Other arguments for [manipulateWidget::manipulateWidget] #' #' @return #' \code{prodStack} returns an interactive html graphic. If argument @@ -123,7 +123,7 @@ #' #' \code{setProdStackAlias} creates or updates a stack alias. #' -#' @seealso \code{\link{prodStackLegend}} +#' @seealso [prodStackLegend()] #' #' @details #' compare argument can take following values : @@ -233,14 +233,38 @@ prodStack <- function(x, updateLegendOnMouseOver = TRUE, legendItemsPerRow = 5, width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), stepPlot = FALSE, drawPoints = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), language = "en", + h5requestFiltering = deprecated(), stepPlot = FALSE, drawPoints = FALSE, + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, refStudy = NULL, ...) { + deprecated_vector_params <- c(lifecycle::is_present(h5requestFiltering), + lifecycle::is_present(timeSteph5), + lifecycle::is_present(mcYearh5), + lifecycle::is_present(tablesh5)) + + if(any(deprecated_vector_params)){ + lifecycle::deprecate_warn( + when = "0.18.1", + what = "prodStack(h5requestFiltering)", + details = "all these parameters are relative to the 'rhdf5' package, + which is removed from the dependencies" + ) + + h5requestFiltering <- NULL + timeSteph5 <- NULL + mcYearh5 <- NULL + tablesh5 <- NULL + } + + # force (deprecated) + h5requestFiltering <- NULL + timeSteph5 <- NULL + mcYearh5 <- NULL + tablesh5 <- NULL #we can hide these values prodStackValHidden <- c("H5request", "timeSteph5", "tables", "mcYearH5", "mcYear", "main", "dateRange", @@ -436,7 +460,7 @@ prodStack <- function(x, manipulateWidget( { - .tryCloseH5() + # .tryCloseH5() # udpate for mw 0.11 & 0.10.1 if(!is.null(params)){ @@ -458,11 +482,11 @@ prodStack <- function(x, h5requestFiltering = mwSharedValue({ h5requestFiltering }), - paramsH5 = mwSharedValue({ - tmp <- .h5ParamList(X_I = x_in, xyCompare = xyCompare, - h5requestFilter = h5requestFiltering) - tmp - }), + # paramsH5 = mwSharedValue({ + # tmp <- .h5ParamList(X_I = x_in, xyCompare = xyCompare, + # h5requestFilter = h5requestFiltering) + # tmp + # }), H5request = mwGroup( label = .getLabelLanguage("H5request", language), timeSteph5 = mwSelect( diff --git a/R/zzz.R b/R/zzz.R index d3fdac69..5e9438f7 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -29,7 +29,6 @@ globalVariables( .timeIdToDate <- antaresRead:::.timeIdToDate .getTimeId <- antaresRead:::.getTimeId .mergeByRef <- antaresRead:::.mergeByRef -.requireRhdf5_Antares <- antaresRead:::.requireRhdf5_Antares .checkColumns <- antaresProcessing:::.checkColumns .checkAttrs <- antaresProcessing:::.checkAttrs @@ -279,70 +278,50 @@ colorsVars <- unique(rbindlist(list(colorsVars, col_fr))) return(resList) } -#' edit h5 file only for TEST -#' currently only for hourly data and areas -#' -#' @param pathH5 path H5 file -#' @param area character -#' @param timeId timeId to change -#' @param antVar antares Variable to change -#' @param newValue the newValue -#' -#' @noRd -.h5Antares_edit_variable <- function(pathH5 = NULL, area = NULL, timeId = 1, antVar = NULL, newValue = NULL, mcYear = NULL, link = NULL){ - - if (!is.null(area) & !is.null(link)){ - stop("area and link must not be set together") - } - - if (!is.null(area)){ - categoryVar <- "areas" - }else{ - categoryVar <- "links" - } - - if (is.null(mcYear)){ - typeOfData <- "/mcAll" - }else{ - typeOfData <- "/mcInd" - } - timeStepType <- paste("/hourly", categoryVar, sep = "/") - nameStructure <- paste0(timeStepType, typeOfData, "/structure") - - H5locAntaresh5 <- rhdf5::H5Fopen(name = pathH5) - hourlyDataStructure <- rhdf5::h5read(H5locAntaresh5, name = nameStructure) - - if (!is.null(area)){ - indexCateroryInstance <- grep(area, hourlyDataStructure$area)[1] - }else{ - indexCateroryInstance <- grep(link, hourlyDataStructure$link)[1] - } - - indexAntVar <- grep(antVar, hourlyDataStructure$variable)[1] - indexTimeId <- timeId - if (is.null(mcYear)){ - indexMcYear <- 1 - }else{ - indexMcYear <- grep(mcYear, hourlyDataStructure$mcYear)[1] - } - - listIndex <- list(indexTimeId, indexAntVar, indexCateroryInstance, indexMcYear) - #debug print(listIndex) - - hourlyData <- rhdf5::h5read( - H5locAntaresh5, - name = paste0(timeStepType, typeOfData, "/data"), - index = listIndex) - - hourlyData[,,,] <- newValue - - rhdf5::h5writeDataset( - obj = hourlyData, - h5loc = H5locAntaresh5, - name = paste0(timeStepType, typeOfData, "/data"), - index = listIndex - ) - - rhdf5::H5Fclose(h5file = H5locAntaresh5) - rhdf5::h5closeAll() -} +#' #' edit h5 file only for TEST +#' #' currently only for hourly data and areas +#' #' +#' #' @param pathH5 path H5 file +#' #' @param area character +#' #' @param timeId timeId to change +#' #' @param antVar antares Variable to change +#' #' @param newValue the newValue +#' #' +#' #' @noRd +#' .h5Antares_edit_variable <- function(pathH5 = NULL, area = NULL, timeId = 1, antVar = NULL, newValue = NULL, mcYear = NULL, link = NULL){ +#' +#' if (!is.null(area) & !is.null(link)){ +#' stop("area and link must not be set together") +#' } +#' +#' if (!is.null(area)){ +#' categoryVar <- "areas" +#' }else{ +#' categoryVar <- "links" +#' } +#' +#' if (is.null(mcYear)){ +#' typeOfData <- "/mcAll" +#' }else{ +#' typeOfData <- "/mcInd" +#' } +#' timeStepType <- paste("/hourly", categoryVar, sep = "/") +#' nameStructure <- paste0(timeStepType, typeOfData, "/structure") +#' +#' if (!is.null(area)){ +#' indexCateroryInstance <- grep(area, hourlyDataStructure$area)[1] +#' }else{ +#' indexCateroryInstance <- grep(link, hourlyDataStructure$link)[1] +#' } +#' +#' indexAntVar <- grep(antVar, hourlyDataStructure$variable)[1] +#' indexTimeId <- timeId +#' if (is.null(mcYear)){ +#' indexMcYear <- 1 +#' }else{ +#' indexMcYear <- grep(mcYear, hourlyDataStructure$mcYear)[1] +#' } +#' +#' listIndex <- list(indexTimeId, indexAntVar, indexCateroryInstance, indexMcYear) +#' #debug print(listIndex) +#' } diff --git a/cran-comments.md b/cran-comments.md index 9679632f..c613b104 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -21,3 +21,26 @@ Flavor: r-devel-linux-x86_64-debian-gcc Check: tests, Result: NOTE Running 'testthat.R' [143s/16s] Running R code in 'testthat.R' had CPU time 8.9 times elapsed time + +## v0.18.1 +new version to fix pb with dependencies `AntaresRead` : + - "M1mac" issue + +We have to fix dependencies with package `rhdf5` on this package before to push `antaresRead` 2.7.1 + +## v0.18.2 +Cran check in ERROR cause test skip not skip + +## v0.18.3 +To put the package back on CRAN + - `exchangesStack()` documentation updated with `\donttest` and rewrite example + - Update file "Licence" with GPL licence `usethis::use_gpl_license()` + +``` +> devtools::check_man() +ℹ Updating antaresViz documentation +ℹ Loading antaresViz +ℹ Checking documentation... +✔ No issues detected +``` + diff --git a/docs/404.html b/docs/404.html index f9409273..57c90e70 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,163 +1,118 @@ - - - - - - - - -Page not found (404) • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -Content not found. Please use links in the navbar. - -
- - - -
- - - -
- - -
-

Site built with pkgdown 1.6.1.

-
- -
-
- - - - - - - - + + + + + + + +Page not found (404) • antaresViz + + + + + + + + + + + +
+
+ + + + +
+
+ + +Content not found. Please use links in the navbar. + +
+ + + +
+ + + +
+ +
+

+

Site built with pkgdown 2.0.9.

+
+ +
+
+ + + + + + + + diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index deb9c045..664c952d 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,66 +1,12 @@ - - - - - - - -License • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -License • antaresViz - + + - - - -
-
- -
- -
+
+
-
- +
- - + + diff --git a/docs/articles/antaresViz.html b/docs/articles/antaresViz.html index 24d4af84..55f7e708 100644 --- a/docs/articles/antaresViz.html +++ b/docs/articles/antaresViz.html @@ -6,19 +6,21 @@ Quick presentation of antaresViz • antaresViz - - - - + + + + + - - + - + + +
-

This package works along with RTE’s adequacy software ANTARES : https://antares-simulator.org/

-

antaresViz is a package which proposes relevant graphs and maps to vizualize the results of an ANTARES study, with numerous settings and possible customizations.

-
-

-Where everything starts

-
library(antaresViz)
-

The data from an ANTARES study can be imported and easily manipulated using the antaresRead package.

-

The examples presented below have been build on a fictionnal study whose output have been loaded with antaresRead. They contains different types of elements :

+

This package works along with RTE’s adequacy software ANTARES : https://antares-simulator.org/

+

antaresViz is a package which proposes relevant graphs +and maps to vizualize the results of an ANTARES study, with numerous +settings and possible customizations.

+
+

Where everything starts +

+ +

The data from an ANTARES study can be imported and easily manipulated +using the antaresRead +package.

+

The examples presented below have been build on a fictionnal study +whose output have been loaded with antaresRead. They contains different +types of elements :

  • outputs with an annual and an hourly time step,
  • -
  • synthetic outputs (averaged on several Monte-Carlo years) and detailled outputs (given year by year),
  • +
  • synthetic outputs (averaged on several Monte-Carlo years) and +detailled outputs (given year by year),
  • outputs for areas, links, clusters and districts.
-
load("data_for_antaresViz_vignette_extralight.Rdata")
-

The aim of this vignette is to give a quick overview of the possibilities offered by the package antaresViz. The data with which the following graphs have been plotted are fictionnal.

+
+load("data_for_antaresViz_vignette_extralight.Rdata")
+

The aim of this vignette is to give a quick overview of the +possibilities offered by the package antaresViz. The data with which the +following graphs have been plotted are fictionnal.

-
-

-The simple power of the plot function

-

The plot() function, used with an antaresDataList object (i.e. an object returned by the antaresRead::readAntares() function) offers different possible vizualisations.

-

Moreover, this function is really easy to use. It opens a shiny interface which let the user decide :

+
+

The simple power of the plot function +

+

The plot() function, used with an antaresDataList object +(i.e. an object returned by the antaresRead::readAntares() +function) offers different possible vizualisations.

+

Moreover, this function is really easy to use. It +opens a shiny interface which let the user decide :

    -
  • Which type of element he wants to study : areas, links or disctricts.
  • +
  • Which type of element he wants to study : areas, +links or disctricts.
  • Which variable he wants to analyze.
  • -
  • With which type of graph : barplot, time series, probability density function, heatmap, etc.
  • +
  • With which type of graph : barplot, time series, +probability density function, heatmap, etc.
  • For which area(s), link(s), or district(s).
  • And during which time period.
-
plot(data_hourly_synthesis)
+
+plot(data_hourly_synthesis)

-

Note that all the interface manipulation can also be set directly in the arguments of the plot function. Some examples of the multiple graphs that can be returned by this function are given below.

-
-
Barplot of Loss of Load Duration (LOLD) for several districts of the study
- +

Note that all the interface manipulation can also be set directly in +the arguments of the plot function. Some examples of the +multiple graphs that can be returned by this function are given +below.

+
+
Barplot of Loss of Load Duration (LOLD) for several districts of the +study +
+
+plot(
+  data_annual_synthesis, 
+  table = "districts", 
+  variable = "LOLD", 
+  type = "barplot", 
+  elements = c("00_a", "00_b", "00_c", "00_d",
+               "00_e", "00_f", "00_g", "00_h", "00_i"), 
+  interactive = FALSE, 
+  width = "100%",
+  height = 400
+)
-
-
Time series of the load in an area with average value and 95% confidence interval.
- +
+
Time series of the load in an area with average value and 95% +confidence interval. +
+
+plot(
+  data_hourly_allmc,
+  table = "areas",
+  variable = "LOAD",
+  type = "ts", 
+  elements = "23_b",
+  confInt = 0.95,
+  dateRange = c("2018-01-08", "2018-01-14"), 
+  width = "100%",
+  height = 400,
+  interactive = FALSE
+)
-
-
Probability density function of the wind power generation in two areas
- +
+
Probability density function of the wind power generation in two +areas +
+
+plot(
+  data_hourly_synthesis, 
+  table = "areas",
+  variable = "WIND",
+  type = "density", 
+  elements = c("01_a", "02_a"),
+  interactive = FALSE, 
+  width = "100%",
+  height = 400
+)
-
-
Heatmap of the congestion probability of one interconnection
- -

Note that the plot() function also contains a compare argument which allows comparisons between :

+
+
Heatmap of the congestion probability of one interconnection +
+
+plot(
+  data_hourly_synthesis_1year, 
+  table = "links", 
+  variable = "CONG. PROB +",
+  type = "heatmap", 
+  elements = "25_c - 26_d", 
+  interactive = FALSE, 
+  width = "100%", 
+  height = 400,
+  main = "Congestion probability"
+)
+

Note that the plot() function also contains a +compare argument which allows comparisons between :

  • different variables
  • different areas/links/district
  • @@ -188,46 +219,67 @@
    Heatmap of the congestion probability of one interconnection
-
-

-When the production meets the demand

-

The prodStack function builds a graph which contains the time series of demand in one area (or the sum of the demand of a set of areas) along with the generation of this area (or set of areas), divided between the different fuel types (e.g. nuclear, gas, wind, etc).

-
prodStack(data_hourly_synthesis)
-

Once again, this function is easy to use and opens a shiny interface which let the user manipulate the selected areas and time range. Some settings can also be passed to the function through its (optionnal) arguments.

- -

The graphical template used by default is the one of the RTE’s application eco2mix. This template can though be redefined completely by the user with the function setProdStackAlias().

-

The exchangesStack() function proposes similar graphs with a superposition of all the imports and exports of an area.

- +
+

When the production meets the demand +

+

The prodStack function builds a graph which contains the +time series of demand in one area (or the sum of the demand of a set of +areas) along with the generation of this area (or set of areas), divided +between the different fuel types (e.g. nuclear, gas, wind, etc).

+
+prodStack(data_hourly_synthesis)
+

Once again, this function is easy to use and opens a shiny interface +which let the user manipulate the selected areas and time range. Some +settings can also be passed to the function through its (optionnal) +arguments.

+
+prodStack(
+  data_hourly_synthesis, 
+  stack = "eco2mix",
+  areas = "37_h", 
+  dateRange = c("2018-01-08", "2018-01-21"),
+  main = "Production stack",
+  unit = "GWh",  
+  interactive = FALSE, 
+  width = "100%",
+  height = 500
+)
+

The graphical template used by default is the one of the RTE’s +application eco2mix

+
https://www.rte-france.com/eco2mix/la-production-delectricite-par-filiere
+

This template can though be redefined completely by the user with the +function setProdStackAlias().

+

The exchangesStack() function proposes similar graphs +with a superposition of all the imports and exports of an area.

+
+exchangesStack(
+  data_hourly_synthesis, 
+  area = "37_h", 
+  dateRange = c("2018-01-08", "2018-01-21"),
+  main = "Import/Export of area 37_h", 
+  unit = "GWh", 
+  interactive = FALSE,
+  width = "100%", 
+  height = 500
+)
-
-

-Everything looks better on a map

-

Last but not least, antaresViz proposes several function to vizualise the results of a study on a map.

-

To do so, the first function to use is mapLayout(). This function launches an interactive application that let the user place areas of the ANTARES study on a map.

-
antares_layout <- antaresRead::readLayout(opts = antaresRead::setSimulationPath(study_path))
-map_layout <- mapLayout(layout = antares_layout)
+
+

Everything looks better on a map +

+

Last but not least, antaresViz proposes several function +to vizualise the results of a study on a map.

+

To do so, the first function to use is mapLayout(). This +function launches an interactive application that let the user place +areas of the ANTARES study on a map.

+
+antares_layout <- antaresRead::readLayout(opts = antaresRead::setSimulationPath(study_path))
+map_layout <- mapLayout(layout = antares_layout)

(Once again : the study presented here is fictionnal !)

-

The function plotMap() then generates an interactive map that let the user visually explore the results of an Antares simulation. By default the function starts a Shiny gadget that let the user choose :

+

The function plotMap() then generates an interactive map +that let the user visually explore the results of an Antares simulation. +By default the function starts a Shiny gadget that let the user choose +:

  • Which variable to represent
  • With which type of vizualisation @@ -236,116 +288,125 @@

  • links : color, width of the link, popup
-
  • For which time step or date range +
  • For which time step or date +range
  • -
    plotMap(data_hourly_synthesis, map_layout)
    -

    Some examples of results returned by the plotMap() function are depicted below.

    -
    -
    C02 emissions
    -

    This first map depicts the annual CO2 emissions of all the areas of the ANTARES study.

    - +
    +plotMap(data_hourly_synthesis, map_layout)
    +

    Some examples of results returned by the plotMap() +function are depicted below.

    +
    +
    C02 emissions +
    +

    This first map depicts the annual CO2 emissions of all the areas of +the ANTARES study.

    +
    +plotMap(
    +  data_annual_filtered, map_layout, 
    +  showLabels = TRUE, 
    +  sizeAreaVar = "CO2 EMIS.",
    +  interactive = FALSE,
    +  labelAreaVar = "CO2 EMIS.", 
    +  colAreaVar = "CO2 EMIS.",
    +  type = "avg",
    +  options = plotMapOptions(
    +    areaDefaultSize = 30, 
    +    labelMaxSize = 8,
    +    labelMinSize = 14,
    +    areaColorScaleOpts = colorScaleOptions(
    +      zeroCol = "white", 
    +      posCol = "red2"
    +    )
    +  ), 
    +  width = "100%", 
    +  height = 600
    +)
    -
    -
    Average balance and flows in the system
    -

    This map illustrates the annual balance (MWh exported if positive - or imported if negative - during an hour) of each area and the annual flows of each link.

    - +
    +
    Average balance and flows in the system +
    +

    This map illustrates the annual balance (MWh exported if positive - +or imported if negative - during an hour) of each area and the annual +flows of each link.

    +
    +plotMap(
    +  data_annual_synthesis, 
    +  map_layout,
    +  showLabels = TRUE,
    +  colAreaVar = "BALANCE", 
    +  interactive = FALSE, 
    +  labelAreaVar = "BALANCE",
    +  sizeLinkVar = "FLOW LIN.",
    +  type = "avg",
    +  options = plotMapOptions(
    +    areaDefaultSize = 30,
    +    labelMaxSize = 10,
    +    labelMinSize = 8, 
    +    areaColorScaleOpts = colorScaleOptions(
    +      negCol = "tomato3",
    +      zeroCol = "white",
    +      posCol = "blue3"
    +    )
    +  ),
    +  width = "100%",
    +  height = 600
    +)
    -
    -
    Energy mixes
    -

    The proportion of each energy type in the annual production of each area is illustrated on this next map. The actual generated energies (in MWh) can be known by clicking on the pie charts.

    - +
    +
    Energy mixes +
    +

    The proportion of each energy type in the annual production of each +area is illustrated on this next map. The actual generated energies (in +MWh) can be known by clicking on the pie charts.

    +
    +data_annual_synthesis$areas <- data_annual_synthesis$areas[, `:=`(
    +  THERMAL = NUCLEAR + LIGNITE + COAL + GAS + OIL + `MIX. FUEL` + `MISC. DTG`, HYDRO =`H. ROR` + `H. STOR`
    +)]
    +
    +plotMap(
    +  data_annual_synthesis,
    +  map_layout,
    +  interactive = FALSE,
    +  sizeAreaVars = c("HYDRO", "SOLAR", "WIND", "THERMAL"), 
    +  popupAreaVars = c("HYDRO", "SOLAR", "WIND", "THERMAL"),
    +  areaChartType = "pie", type = "avg", 
    +  options = plotMapOptions(
    +    areaDefaultSize = 25
    +  ),
    +  width = "100%",
    +  height = 600
    +)
    -
    -

    -Let’s get started

    -

    The antaresViz package is available on the CRAN and can be installed with :

    -
    install.packages("antaresViz")
    +
    +

    Let’s get started +

    +

    The antaresViz package is available on the CRAN and can +be installed with :

    +
    +install.packages("antaresViz")
    -
    -

    Site built with pkgdown 1.4.1.

    +

    +

    Site built with pkgdown 2.0.9.

    @@ -354,5 +415,7 @@

    + + diff --git a/docs/articles/article/creating_new_layouts.html b/docs/articles/article/creating_new_layouts.html index 49fa88ba..50de1a86 100644 --- a/docs/articles/article/creating_new_layouts.html +++ b/docs/articles/article/creating_new_layouts.html @@ -6,19 +6,21 @@ Creating new layouts • antaresViz - - - - + + + + + - - + - + + +
    -

    The antaresViz package allows to visualize simulation results. Several default layouts are available in the package, but, in some cases, the user will need to create a custom layout.

    -

    In this vignette we illustrate how to create a custom layout along the German inner borders.

    -
    library(antaresViz)
    -library(dplyr)
    -library(rnaturalearth)
    -library(ggplot2)
    -library(sf)
    -

    The coordinates of administratives regions of most countries can be found in the rnaturalearth package. Grouping these regions together often allows to obtain the desired layout. For instance:

    - +

    The antaresViz package allows to visualize simulation +results. Several default layouts are available in the package, but, in +some cases, the user will need to create a custom layout.

    +

    In this vignette we illustrate how to create a custom layout along +the German inner borders.

    + +

    The coordinates of administratives regions of most countries can be +found in the rnaturalearth package. Grouping these regions +together often allows to obtain the desired layout. For instance:

    +
    +germany <- rnaturalearth::ne_states(
    +  geounit = "germany",
    +  returnclass = "sf"
    +)
    +
    +german_zones <- germany %>% 
    +  select(iso_3166_2, geometry) %>% 
    +  transmute(zone = case_when(
    +    iso_3166_2 %in% c("DE-SL", "DE-RP", "DE-NW", "DE-HE") ~ "34_DE",
    +    iso_3166_2 %in% c("DE-BW", "DE-BY") ~ "35_DE",
    +    iso_3166_2 %in% c("DE-NI", "DE-HH", "DE-HB", "DE-SH") ~ "36_DE",
    +    TRUE ~ "37_DE"
    +  )) %>% 
    +  group_by(zone) %>% 
    +  summarise()
    +
    +ggplot(german_zones) +
    +  geom_sf(aes()) +
    +  theme_minimal() +
    +  theme(
    +    legend.position = "none",
    +    axis.title.x = element_blank(),
    +    axis.title.y = element_blank()
    +  )

    -

    Then the layout map can be generated from german_zones with a single line of code:

    - +

    Then the layout map can be generated from +german_zones with a single line of code:

    +
    +map <- as(st_transform(german_zones, crs = 4326), "Spatial")
    +

    This map is then used to generate a +mapLayout object:

    +
    +zone_layout <- list(
    +  coords = coords,
    +  links = links,
    +  map = map,
    +  all_coords = coords
    +)
    +class(zone_layout) <- "mapLayout"
    +attr(zone_layout, "type") <- "areas"
    - - - - - +
    + + + + + + diff --git a/docs/news/index.html b/docs/news/index.html new file mode 100644 index 00000000..143185ce --- /dev/null +++ b/docs/news/index.html @@ -0,0 +1,192 @@ + +Changelog • antaresViz + + +
    +
    + + + +
    +
    + + +
    + +
    • delete package dependecies rhdf5 +
    • +
    +
    + +
    • fix deprecated dependencies (issue #200) +
      • packages rgeos, raster removed and replaced by sf +
      • +
    • +
    +
    + +
    • Fixed tests failing on CRAN.
    • +
    +
    + +
    • antares V8.1 support
    • +
    +
    + +
    • Fixed bug with new shiny version
    • +
    • Fixed bug due to language
    • +
    • manipulateWidget > 0.11 support
    • +
    +
    + +
    • Fixed tests failing on CRAN
    • +
    +
    + +
    • Fixed tests failing on CRAN.
    • +
    +
    + +
    • Fixed CRAN errors. Replaced {rbokeh} dependency by {plotly} + {ggplot2}.
    • +
    +
    + +

    NEW FEATURES: * In prodStack(), exchangesStack(), tsPlot() and plotMap() it is now possible to compare several studies with a reference. A new ‘refStudy’ parameter can be used to set the reference study. * runAppAntaresViz() we can use a reference study with all manipulateWidget modules.

    +

    BUGFIXES: * prodStack() and exchangesStack() were not working correctly with a list of antaresData or antaresDataList, only one legend was working when the interactive parameter was set to FALSE. * plotMap() was not working correctly with a list of optsH5, the first graph was not updated correctly when the interactive parameter was set to TRUE.

    +
    +
    + +

    NEW FEATURES: * In prodStack(), exchangesStack() and tsPlot(), it is now possible to save a plot as PNG or HTML.

    +
    +
    + +

    NEW FEATURES: * In runAppAntaresViz(), prodStack(), exchangesStack() and tsPlot(), it is now possible to change the language from ‘en’ to ‘fr’. * prodStack() and exchangesStack() can now represent annual data. * In plotMap(), it is now possible to give an alias to the parameter “size”. A user can specify a new alias with the function setAlias() of ‘antaresRead’. * tsPlot() can now plot several mcYear for several variables.

    +

    BUGFIXES: * plotMap() was not working with ‘leaflet’ version 2.0.0.

    +
    +
    + +

    NEW FEATURES: * plot(), prodStack(), exchangesStack(), plotMap() work with studies in h5. * new function runAppAntaresViz(). * new function plotThermalGroupCapacities(). * new function limitSizeGraph(). * new function plotXY(). * new function modXY(). * new function stackMap(). * new option stepPlot in plot(), prodStack() and exchangesStack().

    +
    +
    + +

    NEW FEATURES: * In plotMap(), it is now possible to represent areas with polygons instead of circles. To do see, user needs to provide a SpatialPolygonsDataFrame object to function mapLayout(). He is then able to interactively set associations between an area and a polygon.

    +

    BUGFIXES: * Hour was not correctly printed in some charts. * It was not possible anymore to choose a specific Monte-Carlo scenario in plotMap() when interactive = FALSE. * Non numeric columns were not correcly handled by plotMap(). * Heatmaps were not correctly displayed in comparison mode.

    +
    +
    + +

    BREAKING CHANGES: * Function plotMapOptions() has lost some parameters of little use and has gained new ones. This may break some scripts.

    +

    NEW FEATURES: * Comparison mode: All functions can now be used to compare two or more antaresData objects. It is also possible to use a single antaresData object but to compare multiple charts with different parameters.

    +

    BUGFIXES: * mapLayout() was containing references to the deprecated ‘mapStudio’ package. This causes a crash on computers where this package has not been installed when it was alive.

    +
    +
    + +

    NEW FEATURES: * plotMap() can now export animated maps. * It is now possible to set minimal and maximal size of labels in maps. * plotMap() can now bind non-numeric columns to the color of areas and links. * It is now possible to set the size of plots in Rmarkdown documents with “runtime:shiny”

    +

    BUGFIXES: * plotMap(interactive=TRUE) now works in Rmarkdown documents with “runtime:shiny”

    +
    +
    + +

    NEW FEATURES: * All visualisation functions now accept synthetic and detailed data. A new parameter “mcYear” permits to choose whether to view averaged data or a given Monte-Carlo scenario. * plotMap() now always uses the absolute value of variable ‘FLOW LIN.’ to avoid any confusion. Direction of flows are represented with arrows. * plotMap() can now also represent categorical variables. * It is now possible to use custom color palette for continuous color scales in maps and heatmaps. * In heatmaps, the y-axis now contains month names instead of week ids. Moreover the info displayed when hovering data has been improved. * exchangesStack() can now also represent exchanges with rest of the world (column ‘ROW BAL.’). * A new function called setInteractivity() has been added to globally turn off or turn on interactive mode.

    +

    BUGFIXES: * In plotMap(), several parameters were not working in non-interactive mode. * In plotMap(), some links were not displayed if the associated values were small. * Numbers are now correctly rounded on popups and legend in plotMap(). * Invalid date/hours were displayed on charts due to problems of timezone. * It was not possible to change width and height of heatmaps.

    +
    +
    + +

    NEW FEATURES: * plot() method can now generate heatmaps. * plot() method has a new parameter “aggregate” to choose whether to visualize individual plots or aggregated plot. * plotMap() can now display labels. This may require to increase area size so there is enough place for labels.

    +

    BUGFIXES: * Many small problems detected by R CMD CHECK have been solved.

    +
    +
    + +

    BREAKING CHANGES: * productionStack and has been renamed prodStack.

    +

    NEW FEATURES: * plotMap() can now use pie charts, bar charts and polar area charts to represent multiple variables. * plotMap() can now represent average values on the whole period instead of representing only a single time step. * plotMap() can now display labels on areas. This feature is still experimental for now and will be improved in next versions. * It is now possible to choose which variables are displayed in popups in maps created with plotMap(). * It is now possible to manually set break points for color scales in maps thourgh parameter “options” of plotMap. * plot() method for antaresDataTable can now output monotone, density and cululated distribution. * There is now a plot() method for antaresDataList objects. * It is now possible to register custom production stack aliases with function ‘setProdStackLegend’. New aliases are then available in prodStack(). * The package now also provides a plot method for antaresDataList objects.

    +

    BUGFIXES: * plot() was not working with annual data.

    +
    +
    + +

    NEW FEATURES: * plotMap() can now represent only areas and/or links. It is not necessary anymore to import both to create a map. * plotMap() can now represent multiple variables with barcharts. A new option is available to choose whether to use the same scale for different variables or one scale per variable. * plotMap() now displays a nice and clear legend. * It is now possible to add a title to a map. * plotMap() has a new parameter “options”. With this parameter, user can modify many graphical parameters like colors, size of elements, parameters to construct color scales, etc. * It is now possible to use a custom base map imported with package “sp”. So an internet connection is not necesary anymore to display a nice map. * When user clicks on a link or an area in a map, a popup appears and display values of the variables represented.

    +
    +
    + +

    BREAKING CHANGES: * add a file LICENSE and copyright to sources files

    +
    +
    + +

    NEW FEATURES: * New function exchangesStack to draw the exchanges of an area with its neighbours * New function mapLayout that helps the user to bind areas of an antares study with geographical coordinates. The function launches an interactive widget where the user can place and move areas. * New plot method for objects return by mapLayout(). It generates an interactive map that represents the network of an antares study. * New function plotMap to visualize the results of an Antares simulation on a map. * All functions have gained new arguments to control graphical parameters like title, axis label, colors, width and height. * All functions that produce time series (stacked or not) now produce a beautiful and very clear legend. * Time series plots (stacked or not) can share a unique legend. When they do, their zoom is synchronised: if the users zooms on one graphic, the zoom is also applied to the other graphics. This can be very helpful in shiny application or interactive documents produced with Rmarkdown.

    +
    +
    + +

    NEW FEATURES: * plot method for antaresTable objects and productionStack have an improved interface that helps user choose what he wants to visualize. * plot method for antaresTable objects can now draw time series but also barplots and monotones.

    +
    +
    + + + +
    + + +
    + +
    +

    Site built with pkgdown 2.0.9.

    +
    + +
    + + + + + + + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index 1273238d..80ea5b83 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -56,8 +56,10 @@ img.icon { float: right; } -img { +/* Ensure in-page images don't run outside their container */ +.contents img { max-width: 100%; + height: auto; } /* Fix bug in bootstrap (only seen in firefox) */ @@ -78,11 +80,10 @@ dd { /* Section anchors ---------------------------------*/ a.anchor { - margin-left: -30px; - display:inline-block; - width: 30px; - height: 30px; - visibility: hidden; + display: none; + margin-left: 5px; + width: 20px; + height: 20px; background-image: url(./link.svg); background-repeat: no-repeat; @@ -90,17 +91,15 @@ a.anchor { background-position: center center; } -.hasAnchor:hover a.anchor { - visibility: visible; -} - -@media (max-width: 767px) { - .hasAnchor:hover a.anchor { - visibility: hidden; - } +h1:hover .anchor, +h2:hover .anchor, +h3:hover .anchor, +h4:hover .anchor, +h5:hover .anchor, +h6:hover .anchor { + display: inline-block; } - /* Fixes for fixed navbar --------------------------*/ .contents h1, .contents h2, .contents h3, .contents h4 { @@ -264,31 +263,26 @@ table { /* Syntax highlighting ---------------------------------------------------- */ -pre { - word-wrap: normal; - word-break: normal; - border: 1px solid #eee; -} - -pre, code { +pre, code, pre code { background-color: #f8f8f8; color: #333; } +pre, pre code { + white-space: pre-wrap; + word-break: break-all; + overflow-wrap: break-word; +} -pre code { - overflow: auto; - word-wrap: normal; - white-space: pre; +pre { + border: 1px solid #eee; } -pre .img { +pre .img, pre .r-plt { margin: 5px 0; } -pre .img img { +pre .img img, pre .r-plt img { background-color: #fff; - display: block; - height: auto; } code a, pre a { @@ -305,9 +299,8 @@ a.sourceLine:hover { .kw {color: #264D66;} /* keyword */ .co {color: #888888;} /* comment */ -.message { color: black; font-weight: bolder;} -.error { color: orange; font-weight: bolder;} -.warning { color: #6A0366; font-weight: bolder;} +.error {font-weight: bolder;} +.warning {font-weight: bolder;} /* Clipboard --------------------------*/ @@ -365,3 +358,27 @@ mark { content: ""; } } + +/* Section anchors --------------------------------- + Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 +*/ + +div.csl-bib-body { } +div.csl-entry { + clear: both; +} +.hanging-indent div.csl-entry { + margin-left:2em; + text-indent:-2em; +} +div.csl-left-margin { + min-width:2em; + float:left; +} +div.csl-right-inline { + margin-left:2em; + padding-left:1em; +} +div.csl-indent { + margin-left: 2em; +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index 7e7048fa..6f0eee40 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -80,7 +80,7 @@ $(document).ready(function() { var copyButton = ""; - $(".examples, div.sourceCode").addClass("hasCopyButton"); + $("div.sourceCode").addClass("hasCopyButton"); // Insert copy buttons: $(copyButton).prependTo(".hasCopyButton"); @@ -91,7 +91,7 @@ // Initialize clipboard: var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { text: function(trigger) { - return trigger.parentNode.textContent; + return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); } }); diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index afde2ba4..992f6a8b 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,8 +1,8 @@ -pandoc: 2.11.4 -pkgdown: 1.6.1 +pandoc: 3.1.1 +pkgdown: 2.0.9 pkgdown_sha: ~ articles: antaresViz: antaresViz.html - article/creating_new_layouts: creating_new_layouts.html -last_built: 2021-08-05T13:37Z + creating_new_layouts: article/creating_new_layouts.html +last_built: 2024-06-26T09:18Z diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png new file mode 100644 index 00000000..17a35806 Binary files /dev/null and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/addShadows.html b/docs/reference/addShadows.html index 76f7d9de..e1ced388 100644 --- a/docs/reference/addShadows.html +++ b/docs/reference/addShadows.html @@ -1,68 +1,13 @@ - - - - - - - -Add a shadow to map layers — addShadows • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Add a shadow to map layers — addShadows • antaresViz - - + + - - -
    -
    - -
    - -
    +
    @@ -137,57 +67,62 @@

    Add a shadow to map layers

    can greatly improve the lisibility of the map.

    -
    addShadows(map)
    - -

    Arguments

    - - - - - - -
    map

    A leaflet map object.

    +
    +
    addShadows(map)
    +
    -

    Value

    +
    +

    Arguments

    +
    map
    +

    A leaflet map object.

    -

    The modified map object

    +
    +
    +

    Value

    + -

    Examples

    -
    #> Le chargement a nécessité le package : leaflet
    require(leaflet.minicharts) -
    #> Le chargement a nécessité le package : leaflet.minicharts
    -leaflet() %>% - addTiles() %>% - addFlows(0, 0, 1, 0, col= gray(0.9)) %>% - addCircleMarkers(c(0, 1), c(0, 0), color = "white", fillOpacity = 1, stroke = FALSE) %>% - addShadows() +

    The modified map object

    +
    -
    +
    +

    Examples

    +
    require(leaflet)
    +#> Loading required package: leaflet
    +#> Warning: package 'leaflet' was built under R version 4.2.3
    +require(leaflet.minicharts)
    +#> Loading required package: leaflet.minicharts
    +#> Warning: package 'leaflet.minicharts' was built under R version 4.2.3
    +
    +leaflet() %>%
    +  addTiles() %>% 
    +  addFlows(0, 0, 1, 0, col= gray(0.9)) %>%
    +  addCircleMarkers(c(0, 1), c(0, 0), color = "white", fillOpacity = 1, stroke = FALSE) %>%
    +  addShadows()
    +
    + +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/exchangesStack.html b/docs/reference/exchangesStack.html index 5afda018..2e4d091c 100644 --- a/docs/reference/exchangesStack.html +++ b/docs/reference/exchangesStack.html @@ -1,72 +1,17 @@ - - - - - - - -Plot the exchanges of an area — exchangesStack • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot the exchanges of an area — exchangesStack • antaresViz - - - - - - - - - - + + - - - -
    -
    - -
    - -
    +
    @@ -145,345 +75,343 @@

    Plot the exchanges of an area

    with setExchangesStackAlias.

    -
    exchangesStack(
    -  x,
    -  stack = "default",
    -  area = NULL,
    -  mcYear = "average",
    -  dateRange = NULL,
    -  colors = NULL,
    -  yMin = NULL,
    -  yMax = NULL,
    -  customTicks = NULL,
    -  main = NULL,
    -  ylab = NULL,
    -  unit = c("MWh", "GWh", "TWh"),
    -  compare = NULL,
    -  compareOpts = list(),
    -  interactive = getInteractivity(),
    -  legend = TRUE,
    -  legendId = sample(1e+09, 1),
    -  groupId = legendId,
    -  updateLegendOnMouseOver = TRUE,
    -  legendItemsPerRow = 5,
    -  width = NULL,
    -  height = NULL,
    -  xyCompare = c("union", "intersect"),
    -  h5requestFiltering = list(),
    -  stepPlot = FALSE,
    -  drawPoints = FALSE,
    -  timeSteph5 = "hourly",
    -  mcYearh5 = NULL,
    -  tablesh5 = c("areas", "links"),
    -  language = "en",
    -  hidden = NULL,
    -  refStudy = NULL,
    -  ...
    -)
    -
    -exchangesStackAliases()
    -
    -setExchangesStackAlias(
    -  name,
    -  variables,
    -  colors,
    -  lines = NULL,
    -  lineColors = NULL,
    -  lineWidth = 3,
    -  description = NULL
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    x

    Object of class antaresData created with function -readAntares. It is required to contain link data. +

    +
    exchangesStack(
    +  x,
    +  stack = "default",
    +  area = NULL,
    +  mcYear = "average",
    +  dateRange = NULL,
    +  colors = NULL,
    +  yMin = NULL,
    +  yMax = NULL,
    +  customTicks = NULL,
    +  main = NULL,
    +  ylab = NULL,
    +  unit = c("MWh", "GWh", "TWh"),
    +  compare = NULL,
    +  compareOpts = list(),
    +  interactive = getInteractivity(),
    +  legend = TRUE,
    +  legendId = sample(1e+09, 1),
    +  groupId = legendId,
    +  updateLegendOnMouseOver = TRUE,
    +  legendItemsPerRow = 5,
    +  width = NULL,
    +  height = NULL,
    +  xyCompare = c("union", "intersect"),
    +  h5requestFiltering = deprecated(),
    +  stepPlot = FALSE,
    +  drawPoints = FALSE,
    +  timeSteph5 = deprecated(),
    +  mcYearh5 = deprecated(),
    +  tablesh5 = deprecated(),
    +  language = "en",
    +  hidden = NULL,
    +  refStudy = NULL,
    +  ...
    +)
    +
    +exchangesStackAliases()
    +
    +setExchangesStackAlias(
    +  name,
    +  variables,
    +  colors,
    +  lines = NULL,
    +  lineColors = NULL,
    +  lineWidth = 3,
    +  description = NULL
    +)
    +
    + +
    +

    Arguments

    +
    x
    +

    Object of class antaresData created with function +[antaresRead::readAntares]. It is required to contain link data. If it also contains area data with column `ROW BAL.`, then exchanges with -the rest of the world are also displayed on the chart.

    stack

    Name of the stack to use. If default, all flows available will be plotted. One can visualize available stacks with -exchangesStackAliases

    area

    Name of a single area. The flows from/to this area will be drawn by the -function.

    mcYear

    If x, contains multiple Monte-Carlo scenarios, this parameter +the rest of the world are also displayed on the chart.

    + + +
    stack
    +

    Name of the stack to use. If default, all flows available will be plotted. One can visualize available stacks with +exchangesStackAliases

    + + +
    area
    +

    Name of a single area. The flows from/to this area will be drawn by the +function.

    + + +
    mcYear
    +

    If x, contains multiple Monte-Carlo scenarios, this parameter determine which scenario is displayed. Must be an integer representing the index of the scenario or the word "average". In this case data are -averaged.

    dateRange

    A vector of two dates. Only data points between these two dates are -displayed. If NULL, then all data is displayed.

    colors

    Vector of colors with same length as parameter variables. If +averaged.

    + + +
    dateRange
    +

    A vector of two dates. Only data points between these two dates are +displayed. If NULL, then all data is displayed.

    + + +
    colors
    +

    Vector of colors with same length as parameter variables. If variables is an alias, then this argument should be NULL in -order to use default colors.

    yMin

    numeric, the minimum value to be displayed on all y Axis. If NULL, the min value is automatically set

    yMax

    numeric, the maximum value to be displayed on all y Axis. If NULL, the max value is automatically set

    customTicks

    numeric vector of the custom ticks values to be displayed on the y Axis. If NULL, the ticks are automatically generated

    main

    Title of the graph.

    ylab

    Title of the Y-axis.

    unit

    Unit used in the graph. Possible values are "MWh", "GWh" or "TWh".

    compare

    An optional character vector containing names of parameters. When it is set, +order to use default colors.

    + + +
    yMin
    +

    numeric, the minimum value to be displayed on all y Axis. If NULL, the min value is automatically set

    + + +
    yMax
    +

    numeric, the maximum value to be displayed on all y Axis. If NULL, the max value is automatically set

    + + +
    customTicks
    +

    numeric vector of the custom ticks values to be displayed on the y Axis. If NULL, the ticks are automatically generated

    + + +
    main
    +

    Title of the graph.

    + + +
    ylab
    +

    Title of the Y-axis.

    + + +
    unit
    +

    Unit used in the graph. Possible values are "MWh", "GWh" or "TWh".

    + + +
    compare
    +

    An optional character vector containing names of parameters. When it is set, two charts are outputed with their own input controls. Alternatively, it can be a named list with names corresponding to parameter names and values being list with the initial values of the given parameter for each chart. See details - if you are drawing a map.

    compareOpts

    List of options that indicates the number of charts to create and their + if you are drawing a map.

    + + +
    compareOpts
    +

    List of options that indicates the number of charts to create and their position. Check out the documentation of -compareOptions to see available options.

    interactive

    LogicalValue. If TRUE, then a shiny gadget is launched that lets -the user interactively choose the areas or districts to display.

    legend

    Logical value indicating if a legend should be drawn. This argument is +[manipulateWidget::compareOptions] to see available options.

    + + +
    interactive
    +

    LogicalValue. If TRUE, then a shiny gadget is launched that lets +the user interactively choose the areas or districts to display.

    + + +
    legend
    +

    Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with -prodStackLegend

    legendId

    Id of the legend linked to the graph. This argument is +[prodStackLegend()]

    + + +
    legendId
    +

    Id of the legend linked to the graph. This argument is usefull when one wants to create a shared legend with -prodStackLegend

    groupId

    Parameter that can be used to synchronize the horizontal +[prodStackLegend()]

    + + +
    groupId
    +

    Parameter that can be used to synchronize the horizontal zoom of multiple charts. All charts that need to be synchronized must -have the same group.

    updateLegendOnMouseOver

    LogicalValue. If TRUE the legend will be updated when the mouse is over a stack. If FALSE the legend will be updated on a click

    legendItemsPerRow

    Number of elements to put in each row of the legend.

    width

    Width of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    height

    Height of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    xyCompare

    Use when you compare studies, can be "union" or "intersect". If union, all +have the same group.

    + + +
    updateLegendOnMouseOver
    +

    LogicalValue. If TRUE the legend will be updated when the mouse is over a stack. If FALSE the legend will be updated on a click

    + + +
    legendItemsPerRow
    +

    Number of elements to put in each row of the legend.

    + + +
    width
    +

    Width of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    height
    +

    Height of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    xyCompare
    +

    Use when you compare studies, can be "union" or "intersect". If union, all of mcYears in one of studies will be selectable. If intersect, only mcYears in all -studies will be selectable.

    h5requestFiltering

    Contains arguments used by default for h5 request, -typically h5requestFiltering = list(links = getLinks(areas = myArea), mcYears = myMcYear)

    stepPlot

    boolean, step style for curves.

    drawPoints

    boolean, add points on graph

    timeSteph5

    character timeStep to read in h5 file. Only for Non interactive mode.

    mcYearh5

    numeric mcYear to read for h5. Only for Non interactive mode.

    tablesh5

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    language

    character language use for label. Defaut to 'en'. Can be 'fr'.

    hidden

    logical Names of input to hide. Defaut to NULL

    refStudy

    An object of class antaresData created with function -readAntares containing data for areas and or -districts. Can also contains an opts who refer to a h5 file.

    ...

    Other arguments for manipulateWidget

    name

    name of the stack to create or update

    variables

    A named list of expressions created with alist. The -name of each element is the name of the variable to draw in the stacked -graph. The element itself is an expression explaining how to compute the -variable (see examples).

    lines

    A named list of expressions created with alist -indicating how to compute the curves to display on top of the stacked graph. -It should be NULL if there is no curve to trace or if parameter -variables is an alias.

    lineColors

    Vector of colors with same length as parameter lines. This argument -should be NULL if there is no curve to trace or if parameter -variables is an alias.

    lineWidth

    Optionnal. Defaut to 3. Vector of width with same length as parameter lines (or only one value).

    description

    Description of the stack. It is displayed by function -exchangesStackAliases.

    - -

    Value

    - -

    A htmlwidget of class dygraph. It can be modified with functions from -package dygraphs.

    -

    Details

    +studies will be selectable.

    + + +
    h5requestFiltering
    +

    Contains arguments used by default for h5 request, +typically h5requestFiltering = list(links = getLinks(areas = myArea), mcYears = myMcYear)

    + + +
    stepPlot
    +

    boolean, step style for curves.

    + + +
    drawPoints
    +

    boolean, add points on graph

    -

    Compare argument can take following values :

      -
    • "mcYear"

    • -
    • "main"

    • -
    • "unit"

    • -
    • "area"

    • -
    • "legend"

    • -
    • "stepPlot"

    • -
    • "drawPoints"

    • -
    +
    timeSteph5
    +

    character timeStep to read in h5 file. Only for Non interactive mode.

    -

    Examples

    -
    if (FALSE) { -mydata <- readAntares(links = "all", timeStep = "daily") -exchangesStack(mydata) -# Also display exchanges with the rest of the world -mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") -exchangesStack(mydata) +
    mcYearh5
    +

    numeric mcYear to read for h5. Only for Non interactive mode.

    -# Use compare : -exchangesStack(mydata, compare = "mcYear") -exchangesStack(mydata, compare = "area") -exchangesStack(mydata, compare = "unit") -exchangesStack(mydata, compare = "legend") -# Compare studies with refStudy argument -exchangesStack(x = myData1, refStudy = myData2) -exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) -exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) -exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) -# Use h5 opts -# Set path of simulaiton -setSimulationPath(path = path1) +
    tablesh5
    +

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    -# Convert your study in h5 format -writeAntaresH5(path = mynewpath) -# Redefine sim path with h5 file -opts <- setSimulationPath(path = mynewpath) -exchangesStack(x = opts) +
    language
    +

    character language use for label. Defaut to 'en'. Can be 'fr'.

    -# Compare elements in a single study -exchangesStack(x = opts, .compare = "mcYear") -# Compare 2 studies -exchangesStack(x = list(opts, opts2)) +
    hidden
    +

    logical Names of input to hide. Defaut to NULL

    -# Compare 2 studies with argument refStudy -exchangesStack(x = opts, refStudy = opts2) -exchangesStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea) -exchangesStack(x = opts, refStudy = opts2, h5requestFiltering = list( -areas = getAreas(select = "a"), -links = getLinks(areas = myArea), -mcYears = myMcYear)) -} +
    refStudy
    +

    An object of class antaresData created with function +[antaresRead::readAntares()] containing data for areas and or +districts. Can also contains an opts who refer to a h5 file.

    -
    + +
    ...
    +

    Other arguments for manipulateWidget

    + + +
    name
    +

    name of the stack to create or update

    + + +
    variables
    +

    A named list of expressions created with [base::alist]. The +name of each element is the name of the variable to draw in the stacked +graph. The element itself is an expression explaining how to compute the +variable (see examples).

    + + +
    lines
    +

    A named list of expressions created with [base::alist] +indicating how to compute the curves to display on top of the stacked graph. +It should be NULL if there is no curve to trace or if parameter +variables is an alias.

    + + +
    lineColors
    +

    Vector of colors with same length as parameter lines. This argument +should be NULL if there is no curve to trace or if parameter +variables is an alias.

    + + +
    lineWidth
    +

    Optionnal. Defaut to 3. Vector of width with same length as parameter lines (or only one value).

    + + +
    description
    +

    Description of the stack. It is displayed by function +exchangesStackAliases.

    + +
    +
    +

    Value

    + + +

    A htmlwidget of class dygraph. It can be modified with functions from +package dygraphs.

    +
    +
    +

    Details

    +

    Compare argument can take following values :

    • "mcYear"

    • +
    • "main"

    • +
    • "unit"

    • +
    • "area"

    • +
    • "legend"

    • +
    • "stepPlot"

    • +
    • "drawPoints"

    • +
    + +
    +

    Examples

    +
    if (FALSE) {
    +mydata <- readAntares(links = "all", timeStep = "daily")
    +exchangesStack(mydata)
    +
    +# Also display exchanges with the rest of the world
    +mydata <- readAntares(areas = "all", links = "all", timeStep = "daily")
    +exchangesStack(mydata)
    +
    +# Use compare :
    +exchangesStack(mydata, compare = "mcYear")
    +exchangesStack(mydata, compare = "area")
    +exchangesStack(mydata, compare = "unit")
    +exchangesStack(mydata, compare = "legend")
    +# Compare studies with refStudy argument
    +exchangesStack(x = myData1, refStudy = myData2)
    +exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE)
    +exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1)
    +exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE)
    +
    +# Use h5 opts
    +# Set path of simulaiton
    +setSimulationPath(path = path1)
    +
    +# Convert your study in h5 format
    +writeAntaresH5(path = mynewpath)
    +
    +# Redefine sim path with h5 file
    +opts <- setSimulationPath(path = mynewpath)
    +exchangesStack(x = opts)
    +
    +# Compare elements in a single study
    +exchangesStack(x = opts, .compare = "mcYear")
    +
    +# Compare 2 studies
    +exchangesStack(x = list(opts, opts2))
    +
    +# Compare 2 studies with argument refStudy
    +exchangesStack(x = opts, refStudy = opts2)
    +exchangesStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea)
    +exchangesStack(x = opts, refStudy = opts2, h5requestFiltering = list(
    +areas = getAreas(select = "a"),
    +links = getLinks(areas = myArea),
    +mcYears = myMcYear))
    +
    +}
    +
    +
    +
    +

    -
    - +
    - - + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 18d8a5c6..e41fe494 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,66 +1,12 @@ - - - - - - - -Function reference • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function reference • antaresViz + + - - - - -
    -
    - -
    - -
    +
    - - - - - - - - - - -
    -

    All functions

    + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +

    All functions

    +

    addShadows()

    Add a shadow to map layers

    +

    exchangesStack() exchangesStackAliases() setExchangesStackAlias()

    Plot the exchanges of an area

    +

    limitSizeGraph()

    Use to change limit size of graph (in Mb)

    +

    mapLayout()

    Place areas of a study on a map

    +

    modRpart()

    Make rpart from antares data

    +

    modXY()

    Make X-Y bockey plot, interactive version

    +

    leafletDragPointsOutput() renderLeafletDragPoints()

    Shiny bindings for placeGeoPoints

    +

    plot(<mapLayout>)

    Plot method for map layout

    +

    plotMap()

    Display results of a simulation on a map

    +

    plotMapLayout()

    Visualize mapLayout output.

    +

    plotMapOptions() defaultTilesURL() colorScaleOptions()

    Graphical options for plotMap

    +

    plotThermalGroupCapacities()

    Plot for Thermal Group Capacities

    +

    plotXY()

    Plot density between X et Y with ggplot2 and plotly

    +

    prodStackAliases() setProdStackAlias() prodStack()

    Visualize the production stack of an area

    +

    runAppAntaresViz()

    Run app antaresViz

    +

    savePlotAsPng()

    Save interactive plot as a png image

    +

    setInteractivity() getInteractivity()

    Get and set interactivity mode

    +

    stackMap()

    plot stack and map

    +

    prodStackExchangesLegend() prodStackLegend() tsLegend()

    Plot an interactive legend for time series plots

    +

    tsPlot() plot(<antaresData>) plot(<simOptions>) plot(<list>)

    plot time series contained in an antaresData object

    - +
    +
    -
    - +
    - - + + diff --git a/docs/reference/libs/Proj4Leaflet-1.0.1/proj4leaflet.js b/docs/reference/libs/Proj4Leaflet-1.0.1/proj4leaflet.js new file mode 100644 index 00000000..5ce8d471 --- /dev/null +++ b/docs/reference/libs/Proj4Leaflet-1.0.1/proj4leaflet.js @@ -0,0 +1,272 @@ +(function (factory) { + var L, proj4; + if (typeof define === 'function' && define.amd) { + // AMD + define(['leaflet', 'proj4'], factory); + } else if (typeof module === 'object' && typeof module.exports === "object") { + // Node/CommonJS + L = require('leaflet'); + proj4 = require('proj4'); + module.exports = factory(L, proj4); + } else { + // Browser globals + if (typeof window.L === 'undefined' || typeof window.proj4 === 'undefined') + throw 'Leaflet and proj4 must be loaded first'; + factory(window.L, window.proj4); + } +}(function (L, proj4) { + if (proj4.__esModule && proj4.default) { + // If proj4 was bundled as an ES6 module, unwrap it to get + // to the actual main proj4 object. + // See discussion in https://github.com/kartena/Proj4Leaflet/pull/147 + proj4 = proj4.default; + } + + L.Proj = {}; + + L.Proj._isProj4Obj = function(a) { + return (typeof a.inverse !== 'undefined' && + typeof a.forward !== 'undefined'); + }; + + L.Proj.Projection = L.Class.extend({ + initialize: function(code, def, bounds) { + var isP4 = L.Proj._isProj4Obj(code); + this._proj = isP4 ? code : this._projFromCodeDef(code, def); + this.bounds = isP4 ? def : bounds; + }, + + project: function (latlng) { + var point = this._proj.forward([latlng.lng, latlng.lat]); + return new L.Point(point[0], point[1]); + }, + + unproject: function (point, unbounded) { + var point2 = this._proj.inverse([point.x, point.y]); + return new L.LatLng(point2[1], point2[0], unbounded); + }, + + _projFromCodeDef: function(code, def) { + if (def) { + proj4.defs(code, def); + } else if (proj4.defs[code] === undefined) { + var urn = code.split(':'); + if (urn.length > 3) { + code = urn[urn.length - 3] + ':' + urn[urn.length - 1]; + } + if (proj4.defs[code] === undefined) { + throw 'No projection definition for code ' + code; + } + } + + return proj4(code); + } + }); + + L.Proj.CRS = L.Class.extend({ + includes: L.CRS, + + options: { + transformation: new L.Transformation(1, 0, -1, 0) + }, + + initialize: function(a, b, c) { + var code, + proj, + def, + options; + + if (L.Proj._isProj4Obj(a)) { + proj = a; + code = proj.srsCode; + options = b || {}; + + this.projection = new L.Proj.Projection(proj, options.bounds); + } else { + code = a; + def = b; + options = c || {}; + this.projection = new L.Proj.Projection(code, def, options.bounds); + } + + L.Util.setOptions(this, options); + this.code = code; + this.transformation = this.options.transformation; + + if (this.options.origin) { + this.transformation = + new L.Transformation(1, -this.options.origin[0], + -1, this.options.origin[1]); + } + + if (this.options.scales) { + this._scales = this.options.scales; + } else if (this.options.resolutions) { + this._scales = []; + for (var i = this.options.resolutions.length - 1; i >= 0; i--) { + if (this.options.resolutions[i]) { + this._scales[i] = 1 / this.options.resolutions[i]; + } + } + } + + this.infinite = !this.options.bounds; + + }, + + scale: function(zoom) { + var iZoom = Math.floor(zoom), + baseScale, + nextScale, + scaleDiff, + zDiff; + if (zoom === iZoom) { + return this._scales[zoom]; + } else { + // Non-integer zoom, interpolate + baseScale = this._scales[iZoom]; + nextScale = this._scales[iZoom + 1]; + scaleDiff = nextScale - baseScale; + zDiff = (zoom - iZoom); + return baseScale + scaleDiff * zDiff; + } + }, + + zoom: function(scale) { + // Find closest number in this._scales, down + var downScale = this._closestElement(this._scales, scale), + downZoom = this._scales.indexOf(downScale), + nextScale, + nextZoom, + scaleDiff; + // Check if scale is downScale => return array index + if (scale === downScale) { + return downZoom; + } + if (downScale === undefined) { + return -Infinity; + } + // Interpolate + nextZoom = downZoom + 1; + nextScale = this._scales[nextZoom]; + if (nextScale === undefined) { + return Infinity; + } + scaleDiff = nextScale - downScale; + return (scale - downScale) / scaleDiff + downZoom; + }, + + distance: L.CRS.Earth.distance, + + R: L.CRS.Earth.R, + + /* Get the closest lowest element in an array */ + _closestElement: function(array, element) { + var low; + for (var i = array.length; i--;) { + if (array[i] <= element && (low === undefined || low < array[i])) { + low = array[i]; + } + } + return low; + } + }); + + L.Proj.GeoJSON = L.GeoJSON.extend({ + initialize: function(geojson, options) { + this._callLevel = 0; + L.GeoJSON.prototype.initialize.call(this, geojson, options); + }, + + addData: function(geojson) { + var crs; + + if (geojson) { + if (geojson.crs && geojson.crs.type === 'name') { + crs = new L.Proj.CRS(geojson.crs.properties.name); + } else if (geojson.crs && geojson.crs.type) { + crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code); + } + + if (crs !== undefined) { + this.options.coordsToLatLng = function(coords) { + var point = L.point(coords[0], coords[1]); + return crs.projection.unproject(point); + }; + } + } + + // Base class' addData might call us recursively, but + // CRS shouldn't be cleared in that case, since CRS applies + // to the whole GeoJSON, inluding sub-features. + this._callLevel++; + try { + L.GeoJSON.prototype.addData.call(this, geojson); + } finally { + this._callLevel--; + if (this._callLevel === 0) { + delete this.options.coordsToLatLng; + } + } + } + }); + + L.Proj.geoJson = function(geojson, options) { + return new L.Proj.GeoJSON(geojson, options); + }; + + L.Proj.ImageOverlay = L.ImageOverlay.extend({ + initialize: function (url, bounds, options) { + L.ImageOverlay.prototype.initialize.call(this, url, null, options); + this._projectedBounds = bounds; + }, + + // Danger ahead: Overriding internal methods in Leaflet. + // Decided to do this rather than making a copy of L.ImageOverlay + // and doing very tiny modifications to it. + // Future will tell if this was wise or not. + _animateZoom: function (event) { + var scale = this._map.getZoomScale(event.zoom); + var northWest = L.point(this._projectedBounds.min.x, this._projectedBounds.max.y); + var offset = this._projectedToNewLayerPoint(northWest, event.zoom, event.center); + + L.DomUtil.setTransform(this._image, offset, scale); + }, + + _reset: function () { + var zoom = this._map.getZoom(); + var pixelOrigin = this._map.getPixelOrigin(); + var bounds = L.bounds( + this._transform(this._projectedBounds.min, zoom)._subtract(pixelOrigin), + this._transform(this._projectedBounds.max, zoom)._subtract(pixelOrigin) + ); + var size = bounds.getSize(); + + L.DomUtil.setPosition(this._image, bounds.min); + this._image.style.width = size.x + 'px'; + this._image.style.height = size.y + 'px'; + }, + + _projectedToNewLayerPoint: function (point, zoom, center) { + var viewHalf = this._map.getSize()._divideBy(2); + var newTopLeft = this._map.project(center, zoom)._subtract(viewHalf)._round(); + var topLeft = newTopLeft.add(this._map._getMapPanePos()); + + return this._transform(point, zoom)._subtract(topLeft); + }, + + _transform: function (point, zoom) { + var crs = this._map.options.crs; + var transformation = crs.transformation; + var scale = crs.scale(zoom); + + return transformation.transform(point, scale); + } + }); + + L.Proj.imageOverlay = function (url, bounds, options) { + return new L.Proj.ImageOverlay(url, bounds, options); + }; + + return L.Proj; +})); diff --git a/docs/reference/libs/font-awesome-4.7.0/css/font-awesome.min.css b/docs/reference/libs/font-awesome-4.7.0/css/font-awesome.min.css new file mode 100644 index 00000000..c098a465 --- /dev/null +++ b/docs/reference/libs/font-awesome-4.7.0/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/docs/reference/libs/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf b/docs/reference/libs/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf new file mode 100644 index 00000000..35acda2f Binary files /dev/null and b/docs/reference/libs/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf differ diff --git a/docs/reference/libs/htmlwidgets-1.6.4/htmlwidgets.js b/docs/reference/libs/htmlwidgets-1.6.4/htmlwidgets.js new file mode 100644 index 00000000..1067d029 --- /dev/null +++ b/docs/reference/libs/htmlwidgets-1.6.4/htmlwidgets.js @@ -0,0 +1,901 @@ +(function() { + // If window.HTMLWidgets is already defined, then use it; otherwise create a + // new object. This allows preceding code to set options that affect the + // initialization process (though none currently exist). + window.HTMLWidgets = window.HTMLWidgets || {}; + + // See if we're running in a viewer pane. If not, we're in a web browser. + var viewerMode = window.HTMLWidgets.viewerMode = + /\bviewer_pane=1\b/.test(window.location); + + // See if we're running in Shiny mode. If not, it's a static document. + // Note that static widgets can appear in both Shiny and static modes, but + // obviously, Shiny widgets can only appear in Shiny apps/documents. + var shinyMode = window.HTMLWidgets.shinyMode = + typeof(window.Shiny) !== "undefined" && !!window.Shiny.outputBindings; + + // We can't count on jQuery being available, so we implement our own + // version if necessary. + function querySelectorAll(scope, selector) { + if (typeof(jQuery) !== "undefined" && scope instanceof jQuery) { + return scope.find(selector); + } + if (scope.querySelectorAll) { + return scope.querySelectorAll(selector); + } + } + + function asArray(value) { + if (value === null) + return []; + if ($.isArray(value)) + return value; + return [value]; + } + + // Implement jQuery's extend + function extend(target /*, ... */) { + if (arguments.length == 1) { + return target; + } + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var prop in source) { + if (source.hasOwnProperty(prop)) { + target[prop] = source[prop]; + } + } + } + return target; + } + + // IE8 doesn't support Array.forEach. + function forEach(values, callback, thisArg) { + if (values.forEach) { + values.forEach(callback, thisArg); + } else { + for (var i = 0; i < values.length; i++) { + callback.call(thisArg, values[i], i, values); + } + } + } + + // Replaces the specified method with the return value of funcSource. + // + // Note that funcSource should not BE the new method, it should be a function + // that RETURNS the new method. funcSource receives a single argument that is + // the overridden method, it can be called from the new method. The overridden + // method can be called like a regular function, it has the target permanently + // bound to it so "this" will work correctly. + function overrideMethod(target, methodName, funcSource) { + var superFunc = target[methodName] || function() {}; + var superFuncBound = function() { + return superFunc.apply(target, arguments); + }; + target[methodName] = funcSource(superFuncBound); + } + + // Add a method to delegator that, when invoked, calls + // delegatee.methodName. If there is no such method on + // the delegatee, but there was one on delegator before + // delegateMethod was called, then the original version + // is invoked instead. + // For example: + // + // var a = { + // method1: function() { console.log('a1'); } + // method2: function() { console.log('a2'); } + // }; + // var b = { + // method1: function() { console.log('b1'); } + // }; + // delegateMethod(a, b, "method1"); + // delegateMethod(a, b, "method2"); + // a.method1(); + // a.method2(); + // + // The output would be "b1", "a2". + function delegateMethod(delegator, delegatee, methodName) { + var inherited = delegator[methodName]; + delegator[methodName] = function() { + var target = delegatee; + var method = delegatee[methodName]; + + // The method doesn't exist on the delegatee. Instead, + // call the method on the delegator, if it exists. + if (!method) { + target = delegator; + method = inherited; + } + + if (method) { + return method.apply(target, arguments); + } + }; + } + + // Implement a vague facsimilie of jQuery's data method + function elementData(el, name, value) { + if (arguments.length == 2) { + return el["htmlwidget_data_" + name]; + } else if (arguments.length == 3) { + el["htmlwidget_data_" + name] = value; + return el; + } else { + throw new Error("Wrong number of arguments for elementData: " + + arguments.length); + } + } + + // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + + function hasClass(el, className) { + var re = new RegExp("\\b" + escapeRegExp(className) + "\\b"); + return re.test(el.className); + } + + // elements - array (or array-like object) of HTML elements + // className - class name to test for + // include - if true, only return elements with given className; + // if false, only return elements *without* given className + function filterByClass(elements, className, include) { + var results = []; + for (var i = 0; i < elements.length; i++) { + if (hasClass(elements[i], className) == include) + results.push(elements[i]); + } + return results; + } + + function on(obj, eventName, func) { + if (obj.addEventListener) { + obj.addEventListener(eventName, func, false); + } else if (obj.attachEvent) { + obj.attachEvent(eventName, func); + } + } + + function off(obj, eventName, func) { + if (obj.removeEventListener) + obj.removeEventListener(eventName, func, false); + else if (obj.detachEvent) { + obj.detachEvent(eventName, func); + } + } + + // Translate array of values to top/right/bottom/left, as usual with + // the "padding" CSS property + // https://developer.mozilla.org/en-US/docs/Web/CSS/padding + function unpackPadding(value) { + if (typeof(value) === "number") + value = [value]; + if (value.length === 1) { + return {top: value[0], right: value[0], bottom: value[0], left: value[0]}; + } + if (value.length === 2) { + return {top: value[0], right: value[1], bottom: value[0], left: value[1]}; + } + if (value.length === 3) { + return {top: value[0], right: value[1], bottom: value[2], left: value[1]}; + } + if (value.length === 4) { + return {top: value[0], right: value[1], bottom: value[2], left: value[3]}; + } + } + + // Convert an unpacked padding object to a CSS value + function paddingToCss(paddingObj) { + return paddingObj.top + "px " + paddingObj.right + "px " + paddingObj.bottom + "px " + paddingObj.left + "px"; + } + + // Makes a number suitable for CSS + function px(x) { + if (typeof(x) === "number") + return x + "px"; + else + return x; + } + + // Retrieves runtime widget sizing information for an element. + // The return value is either null, or an object with fill, padding, + // defaultWidth, defaultHeight fields. + function sizingPolicy(el) { + var sizingEl = document.querySelector("script[data-for='" + el.id + "'][type='application/htmlwidget-sizing']"); + if (!sizingEl) + return null; + var sp = JSON.parse(sizingEl.textContent || sizingEl.text || "{}"); + if (viewerMode) { + return sp.viewer; + } else { + return sp.browser; + } + } + + // @param tasks Array of strings (or falsy value, in which case no-op). + // Each element must be a valid JavaScript expression that yields a + // function. Or, can be an array of objects with "code" and "data" + // properties; in this case, the "code" property should be a string + // of JS that's an expr that yields a function, and "data" should be + // an object that will be added as an additional argument when that + // function is called. + // @param target The object that will be "this" for each function + // execution. + // @param args Array of arguments to be passed to the functions. (The + // same arguments will be passed to all functions.) + function evalAndRun(tasks, target, args) { + if (tasks) { + forEach(tasks, function(task) { + var theseArgs = args; + if (typeof(task) === "object") { + theseArgs = theseArgs.concat([task.data]); + task = task.code; + } + var taskFunc = tryEval(task); + if (typeof(taskFunc) !== "function") { + throw new Error("Task must be a function! Source:\n" + task); + } + taskFunc.apply(target, theseArgs); + }); + } + } + + // Attempt eval() both with and without enclosing in parentheses. + // Note that enclosing coerces a function declaration into + // an expression that eval() can parse + // (otherwise, a SyntaxError is thrown) + function tryEval(code) { + var result = null; + try { + result = eval("(" + code + ")"); + } catch(error) { + if (!(error instanceof SyntaxError)) { + throw error; + } + try { + result = eval(code); + } catch(e) { + if (e instanceof SyntaxError) { + throw error; + } else { + throw e; + } + } + } + return result; + } + + function initSizing(el) { + var sizing = sizingPolicy(el); + if (!sizing) + return; + + var cel = document.getElementById("htmlwidget_container"); + if (!cel) + return; + + if (typeof(sizing.padding) !== "undefined") { + document.body.style.margin = "0"; + document.body.style.padding = paddingToCss(unpackPadding(sizing.padding)); + } + + if (sizing.fill) { + document.body.style.overflow = "hidden"; + document.body.style.width = "100%"; + document.body.style.height = "100%"; + document.documentElement.style.width = "100%"; + document.documentElement.style.height = "100%"; + cel.style.position = "absolute"; + var pad = unpackPadding(sizing.padding); + cel.style.top = pad.top + "px"; + cel.style.right = pad.right + "px"; + cel.style.bottom = pad.bottom + "px"; + cel.style.left = pad.left + "px"; + el.style.width = "100%"; + el.style.height = "100%"; + + return { + getWidth: function() { return cel.getBoundingClientRect().width; }, + getHeight: function() { return cel.getBoundingClientRect().height; } + }; + + } else { + el.style.width = px(sizing.width); + el.style.height = px(sizing.height); + + return { + getWidth: function() { return cel.getBoundingClientRect().width; }, + getHeight: function() { return cel.getBoundingClientRect().height; } + }; + } + } + + // Default implementations for methods + var defaults = { + find: function(scope) { + return querySelectorAll(scope, "." + this.name); + }, + renderError: function(el, err) { + var $el = $(el); + + this.clearError(el); + + // Add all these error classes, as Shiny does + var errClass = "shiny-output-error"; + if (err.type !== null) { + // use the classes of the error condition as CSS class names + errClass = errClass + " " + $.map(asArray(err.type), function(type) { + return errClass + "-" + type; + }).join(" "); + } + errClass = errClass + " htmlwidgets-error"; + + // Is el inline or block? If inline or inline-block, just display:none it + // and add an inline error. + var display = $el.css("display"); + $el.data("restore-display-mode", display); + + if (display === "inline" || display === "inline-block") { + $el.hide(); + if (err.message !== "") { + var errorSpan = $("").addClass(errClass); + errorSpan.text(err.message); + $el.after(errorSpan); + } + } else if (display === "block") { + // If block, add an error just after the el, set visibility:none on the + // el, and position the error to be on top of the el. + // Mark it with a unique ID and CSS class so we can remove it later. + $el.css("visibility", "hidden"); + if (err.message !== "") { + var errorDiv = $("
    ").addClass(errClass).css("position", "absolute") + .css("top", el.offsetTop) + .css("left", el.offsetLeft) + // setting width can push out the page size, forcing otherwise + // unnecessary scrollbars to appear and making it impossible for + // the element to shrink; so use max-width instead + .css("maxWidth", el.offsetWidth) + .css("height", el.offsetHeight); + errorDiv.text(err.message); + $el.after(errorDiv); + + // Really dumb way to keep the size/position of the error in sync with + // the parent element as the window is resized or whatever. + var intId = setInterval(function() { + if (!errorDiv[0].parentElement) { + clearInterval(intId); + return; + } + errorDiv + .css("top", el.offsetTop) + .css("left", el.offsetLeft) + .css("maxWidth", el.offsetWidth) + .css("height", el.offsetHeight); + }, 500); + } + } + }, + clearError: function(el) { + var $el = $(el); + var display = $el.data("restore-display-mode"); + $el.data("restore-display-mode", null); + + if (display === "inline" || display === "inline-block") { + if (display) + $el.css("display", display); + $(el.nextSibling).filter(".htmlwidgets-error").remove(); + } else if (display === "block"){ + $el.css("visibility", "inherit"); + $(el.nextSibling).filter(".htmlwidgets-error").remove(); + } + }, + sizing: {} + }; + + // Called by widget bindings to register a new type of widget. The definition + // object can contain the following properties: + // - name (required) - A string indicating the binding name, which will be + // used by default as the CSS classname to look for. + // - initialize (optional) - A function(el) that will be called once per + // widget element; if a value is returned, it will be passed as the third + // value to renderValue. + // - renderValue (required) - A function(el, data, initValue) that will be + // called with data. Static contexts will cause this to be called once per + // element; Shiny apps will cause this to be called multiple times per + // element, as the data changes. + window.HTMLWidgets.widget = function(definition) { + if (!definition.name) { + throw new Error("Widget must have a name"); + } + if (!definition.type) { + throw new Error("Widget must have a type"); + } + // Currently we only support output widgets + if (definition.type !== "output") { + throw new Error("Unrecognized widget type '" + definition.type + "'"); + } + // TODO: Verify that .name is a valid CSS classname + + // Support new-style instance-bound definitions. Old-style class-bound + // definitions have one widget "object" per widget per type/class of + // widget; the renderValue and resize methods on such widget objects + // take el and instance arguments, because the widget object can't + // store them. New-style instance-bound definitions have one widget + // object per widget instance; the definition that's passed in doesn't + // provide renderValue or resize methods at all, just the single method + // factory(el, width, height) + // which returns an object that has renderValue(x) and resize(w, h). + // This enables a far more natural programming style for the widget + // author, who can store per-instance state using either OO-style + // instance fields or functional-style closure variables (I guess this + // is in contrast to what can only be called C-style pseudo-OO which is + // what we required before). + if (definition.factory) { + definition = createLegacyDefinitionAdapter(definition); + } + + if (!definition.renderValue) { + throw new Error("Widget must have a renderValue function"); + } + + // For static rendering (non-Shiny), use a simple widget registration + // scheme. We also use this scheme for Shiny apps/documents that also + // contain static widgets. + window.HTMLWidgets.widgets = window.HTMLWidgets.widgets || []; + // Merge defaults into the definition; don't mutate the original definition. + var staticBinding = extend({}, defaults, definition); + overrideMethod(staticBinding, "find", function(superfunc) { + return function(scope) { + var results = superfunc(scope); + // Filter out Shiny outputs, we only want the static kind + return filterByClass(results, "html-widget-output", false); + }; + }); + window.HTMLWidgets.widgets.push(staticBinding); + + if (shinyMode) { + // Shiny is running. Register the definition with an output binding. + // The definition itself will not be the output binding, instead + // we will make an output binding object that delegates to the + // definition. This is because we foolishly used the same method + // name (renderValue) for htmlwidgets definition and Shiny bindings + // but they actually have quite different semantics (the Shiny + // bindings receive data that includes lots of metadata that it + // strips off before calling htmlwidgets renderValue). We can't + // just ignore the difference because in some widgets it's helpful + // to call this.renderValue() from inside of resize(), and if + // we're not delegating, then that call will go to the Shiny + // version instead of the htmlwidgets version. + + // Merge defaults with definition, without mutating either. + var bindingDef = extend({}, defaults, definition); + + // This object will be our actual Shiny binding. + var shinyBinding = new Shiny.OutputBinding(); + + // With a few exceptions, we'll want to simply use the bindingDef's + // version of methods if they are available, otherwise fall back to + // Shiny's defaults. NOTE: If Shiny's output bindings gain additional + // methods in the future, and we want them to be overrideable by + // HTMLWidget binding definitions, then we'll need to add them to this + // list. + delegateMethod(shinyBinding, bindingDef, "getId"); + delegateMethod(shinyBinding, bindingDef, "onValueChange"); + delegateMethod(shinyBinding, bindingDef, "onValueError"); + delegateMethod(shinyBinding, bindingDef, "renderError"); + delegateMethod(shinyBinding, bindingDef, "clearError"); + delegateMethod(shinyBinding, bindingDef, "showProgress"); + + // The find, renderValue, and resize are handled differently, because we + // want to actually decorate the behavior of the bindingDef methods. + + shinyBinding.find = function(scope) { + var results = bindingDef.find(scope); + + // Only return elements that are Shiny outputs, not static ones + var dynamicResults = results.filter(".html-widget-output"); + + // It's possible that whatever caused Shiny to think there might be + // new dynamic outputs, also caused there to be new static outputs. + // Since there might be lots of different htmlwidgets bindings, we + // schedule execution for later--no need to staticRender multiple + // times. + if (results.length !== dynamicResults.length) + scheduleStaticRender(); + + return dynamicResults; + }; + + // Wrap renderValue to handle initialization, which unfortunately isn't + // supported natively by Shiny at the time of this writing. + + shinyBinding.renderValue = function(el, data) { + Shiny.renderDependencies(data.deps); + // Resolve strings marked as javascript literals to objects + if (!(data.evals instanceof Array)) data.evals = [data.evals]; + for (var i = 0; data.evals && i < data.evals.length; i++) { + window.HTMLWidgets.evaluateStringMember(data.x, data.evals[i]); + } + if (!bindingDef.renderOnNullValue) { + if (data.x === null) { + el.style.visibility = "hidden"; + return; + } else { + el.style.visibility = "inherit"; + } + } + if (!elementData(el, "initialized")) { + initSizing(el); + + elementData(el, "initialized", true); + if (bindingDef.initialize) { + var rect = el.getBoundingClientRect(); + var result = bindingDef.initialize(el, rect.width, rect.height); + elementData(el, "init_result", result); + } + } + bindingDef.renderValue(el, data.x, elementData(el, "init_result")); + evalAndRun(data.jsHooks.render, elementData(el, "init_result"), [el, data.x]); + }; + + // Only override resize if bindingDef implements it + if (bindingDef.resize) { + shinyBinding.resize = function(el, width, height) { + // Shiny can call resize before initialize/renderValue have been + // called, which doesn't make sense for widgets. + if (elementData(el, "initialized")) { + bindingDef.resize(el, width, height, elementData(el, "init_result")); + } + }; + } + + Shiny.outputBindings.register(shinyBinding, bindingDef.name); + } + }; + + var scheduleStaticRenderTimerId = null; + function scheduleStaticRender() { + if (!scheduleStaticRenderTimerId) { + scheduleStaticRenderTimerId = setTimeout(function() { + scheduleStaticRenderTimerId = null; + window.HTMLWidgets.staticRender(); + }, 1); + } + } + + // Render static widgets after the document finishes loading + // Statically render all elements that are of this widget's class + window.HTMLWidgets.staticRender = function() { + var bindings = window.HTMLWidgets.widgets || []; + forEach(bindings, function(binding) { + var matches = binding.find(document.documentElement); + forEach(matches, function(el) { + var sizeObj = initSizing(el, binding); + + var getSize = function(el) { + if (sizeObj) { + return {w: sizeObj.getWidth(), h: sizeObj.getHeight()} + } else { + var rect = el.getBoundingClientRect(); + return {w: rect.width, h: rect.height} + } + }; + + if (hasClass(el, "html-widget-static-bound")) + return; + el.className = el.className + " html-widget-static-bound"; + + var initResult; + if (binding.initialize) { + var size = getSize(el); + initResult = binding.initialize(el, size.w, size.h); + elementData(el, "init_result", initResult); + } + + if (binding.resize) { + var lastSize = getSize(el); + var resizeHandler = function(e) { + var size = getSize(el); + if (size.w === 0 && size.h === 0) + return; + if (size.w === lastSize.w && size.h === lastSize.h) + return; + lastSize = size; + binding.resize(el, size.w, size.h, initResult); + }; + + on(window, "resize", resizeHandler); + + // This is needed for cases where we're running in a Shiny + // app, but the widget itself is not a Shiny output, but + // rather a simple static widget. One example of this is + // an rmarkdown document that has runtime:shiny and widget + // that isn't in a render function. Shiny only knows to + // call resize handlers for Shiny outputs, not for static + // widgets, so we do it ourselves. + if (window.jQuery) { + window.jQuery(document).on( + "shown.htmlwidgets shown.bs.tab.htmlwidgets shown.bs.collapse.htmlwidgets", + resizeHandler + ); + window.jQuery(document).on( + "hidden.htmlwidgets hidden.bs.tab.htmlwidgets hidden.bs.collapse.htmlwidgets", + resizeHandler + ); + } + + // This is needed for the specific case of ioslides, which + // flips slides between display:none and display:block. + // Ideally we would not have to have ioslide-specific code + // here, but rather have ioslides raise a generic event, + // but the rmarkdown package just went to CRAN so the + // window to getting that fixed may be long. + if (window.addEventListener) { + // It's OK to limit this to window.addEventListener + // browsers because ioslides itself only supports + // such browsers. + on(document, "slideenter", resizeHandler); + on(document, "slideleave", resizeHandler); + } + } + + var scriptData = document.querySelector("script[data-for='" + el.id + "'][type='application/json']"); + if (scriptData) { + var data = JSON.parse(scriptData.textContent || scriptData.text); + // Resolve strings marked as javascript literals to objects + if (!(data.evals instanceof Array)) data.evals = [data.evals]; + for (var k = 0; data.evals && k < data.evals.length; k++) { + window.HTMLWidgets.evaluateStringMember(data.x, data.evals[k]); + } + binding.renderValue(el, data.x, initResult); + evalAndRun(data.jsHooks.render, initResult, [el, data.x]); + } + }); + }); + + invokePostRenderHandlers(); + } + + + function has_jQuery3() { + if (!window.jQuery) { + return false; + } + var $version = window.jQuery.fn.jquery; + var $major_version = parseInt($version.split(".")[0]); + return $major_version >= 3; + } + + /* + / Shiny 1.4 bumped jQuery from 1.x to 3.x which means jQuery's + / on-ready handler (i.e., $(fn)) is now asyncronous (i.e., it now + / really means $(setTimeout(fn)). + / https://jquery.com/upgrade-guide/3.0/#breaking-change-document-ready-handlers-are-now-asynchronous + / + / Since Shiny uses $() to schedule initShiny, shiny>=1.4 calls initShiny + / one tick later than it did before, which means staticRender() is + / called renderValue() earlier than (advanced) widget authors might be expecting. + / https://github.com/rstudio/shiny/issues/2630 + / + / For a concrete example, leaflet has some methods (e.g., updateBounds) + / which reference Shiny methods registered in initShiny (e.g., setInputValue). + / Since leaflet is privy to this life-cycle, it knows to use setTimeout() to + / delay execution of those methods (until Shiny methods are ready) + / https://github.com/rstudio/leaflet/blob/18ec981/javascript/src/index.js#L266-L268 + / + / Ideally widget authors wouldn't need to use this setTimeout() hack that + / leaflet uses to call Shiny methods on a staticRender(). In the long run, + / the logic initShiny should be broken up so that method registration happens + / right away, but binding happens later. + */ + function maybeStaticRenderLater() { + if (shinyMode && has_jQuery3()) { + window.jQuery(window.HTMLWidgets.staticRender); + } else { + window.HTMLWidgets.staticRender(); + } + } + + if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", function() { + document.removeEventListener("DOMContentLoaded", arguments.callee, false); + maybeStaticRenderLater(); + }, false); + } else if (document.attachEvent) { + document.attachEvent("onreadystatechange", function() { + if (document.readyState === "complete") { + document.detachEvent("onreadystatechange", arguments.callee); + maybeStaticRenderLater(); + } + }); + } + + + window.HTMLWidgets.getAttachmentUrl = function(depname, key) { + // If no key, default to the first item + if (typeof(key) === "undefined") + key = 1; + + var link = document.getElementById(depname + "-" + key + "-attachment"); + if (!link) { + throw new Error("Attachment " + depname + "/" + key + " not found in document"); + } + return link.getAttribute("href"); + }; + + window.HTMLWidgets.dataframeToD3 = function(df) { + var names = []; + var length; + for (var name in df) { + if (df.hasOwnProperty(name)) + names.push(name); + if (typeof(df[name]) !== "object" || typeof(df[name].length) === "undefined") { + throw new Error("All fields must be arrays"); + } else if (typeof(length) !== "undefined" && length !== df[name].length) { + throw new Error("All fields must be arrays of the same length"); + } + length = df[name].length; + } + var results = []; + var item; + for (var row = 0; row < length; row++) { + item = {}; + for (var col = 0; col < names.length; col++) { + item[names[col]] = df[names[col]][row]; + } + results.push(item); + } + return results; + }; + + window.HTMLWidgets.transposeArray2D = function(array) { + if (array.length === 0) return array; + var newArray = array[0].map(function(col, i) { + return array.map(function(row) { + return row[i] + }) + }); + return newArray; + }; + // Split value at splitChar, but allow splitChar to be escaped + // using escapeChar. Any other characters escaped by escapeChar + // will be included as usual (including escapeChar itself). + function splitWithEscape(value, splitChar, escapeChar) { + var results = []; + var escapeMode = false; + var currentResult = ""; + for (var pos = 0; pos < value.length; pos++) { + if (!escapeMode) { + if (value[pos] === splitChar) { + results.push(currentResult); + currentResult = ""; + } else if (value[pos] === escapeChar) { + escapeMode = true; + } else { + currentResult += value[pos]; + } + } else { + currentResult += value[pos]; + escapeMode = false; + } + } + if (currentResult !== "") { + results.push(currentResult); + } + return results; + } + // Function authored by Yihui/JJ Allaire + window.HTMLWidgets.evaluateStringMember = function(o, member) { + var parts = splitWithEscape(member, '.', '\\'); + for (var i = 0, l = parts.length; i < l; i++) { + var part = parts[i]; + // part may be a character or 'numeric' member name + if (o !== null && typeof o === "object" && part in o) { + if (i == (l - 1)) { // if we are at the end of the line then evalulate + if (typeof o[part] === "string") + o[part] = tryEval(o[part]); + } else { // otherwise continue to next embedded object + o = o[part]; + } + } + } + }; + + // Retrieve the HTMLWidget instance (i.e. the return value of an + // HTMLWidget binding's initialize() or factory() function) + // associated with an element, or null if none. + window.HTMLWidgets.getInstance = function(el) { + return elementData(el, "init_result"); + }; + + // Finds the first element in the scope that matches the selector, + // and returns the HTMLWidget instance (i.e. the return value of + // an HTMLWidget binding's initialize() or factory() function) + // associated with that element, if any. If no element matches the + // selector, or the first matching element has no HTMLWidget + // instance associated with it, then null is returned. + // + // The scope argument is optional, and defaults to window.document. + window.HTMLWidgets.find = function(scope, selector) { + if (arguments.length == 1) { + selector = scope; + scope = document; + } + + var el = scope.querySelector(selector); + if (el === null) { + return null; + } else { + return window.HTMLWidgets.getInstance(el); + } + }; + + // Finds all elements in the scope that match the selector, and + // returns the HTMLWidget instances (i.e. the return values of + // an HTMLWidget binding's initialize() or factory() function) + // associated with the elements, in an array. If elements that + // match the selector don't have an associated HTMLWidget + // instance, the returned array will contain nulls. + // + // The scope argument is optional, and defaults to window.document. + window.HTMLWidgets.findAll = function(scope, selector) { + if (arguments.length == 1) { + selector = scope; + scope = document; + } + + var nodes = scope.querySelectorAll(selector); + var results = []; + for (var i = 0; i < nodes.length; i++) { + results.push(window.HTMLWidgets.getInstance(nodes[i])); + } + return results; + }; + + var postRenderHandlers = []; + function invokePostRenderHandlers() { + while (postRenderHandlers.length) { + var handler = postRenderHandlers.shift(); + if (handler) { + handler(); + } + } + } + + // Register the given callback function to be invoked after the + // next time static widgets are rendered. + window.HTMLWidgets.addPostRenderHandler = function(callback) { + postRenderHandlers.push(callback); + }; + + // Takes a new-style instance-bound definition, and returns an + // old-style class-bound definition. This saves us from having + // to rewrite all the logic in this file to accomodate both + // types of definitions. + function createLegacyDefinitionAdapter(defn) { + var result = { + name: defn.name, + type: defn.type, + initialize: function(el, width, height) { + return defn.factory(el, width, height); + }, + renderValue: function(el, x, instance) { + return instance.renderValue(x); + }, + resize: function(el, width, height, instance) { + return instance.resize(width, height); + } + }; + + if (defn.find) + result.find = defn.find; + if (defn.renderError) + result.renderError = defn.renderError; + if (defn.clearError) + result.clearError = defn.clearError; + + return result; + } +})(); diff --git a/docs/reference/libs/leaflet-1.3.1/images/layers-2x.png b/docs/reference/libs/leaflet-1.3.1/images/layers-2x.png new file mode 100644 index 00000000..200c333d Binary files /dev/null and b/docs/reference/libs/leaflet-1.3.1/images/layers-2x.png differ diff --git a/docs/reference/libs/leaflet-1.3.1/images/layers.png b/docs/reference/libs/leaflet-1.3.1/images/layers.png new file mode 100644 index 00000000..1a72e578 Binary files /dev/null and b/docs/reference/libs/leaflet-1.3.1/images/layers.png differ diff --git a/docs/reference/libs/leaflet-1.3.1/images/marker-icon-2x.png b/docs/reference/libs/leaflet-1.3.1/images/marker-icon-2x.png new file mode 100644 index 00000000..88f9e501 Binary files /dev/null and b/docs/reference/libs/leaflet-1.3.1/images/marker-icon-2x.png differ diff --git a/docs/reference/libs/leaflet-1.3.1/images/marker-icon.png b/docs/reference/libs/leaflet-1.3.1/images/marker-icon.png new file mode 100644 index 00000000..950edf24 Binary files /dev/null and b/docs/reference/libs/leaflet-1.3.1/images/marker-icon.png differ diff --git a/docs/reference/libs/leaflet-1.3.1/images/marker-shadow.png b/docs/reference/libs/leaflet-1.3.1/images/marker-shadow.png new file mode 100644 index 00000000..9fd29795 Binary files /dev/null and b/docs/reference/libs/leaflet-1.3.1/images/marker-shadow.png differ diff --git a/docs/reference/libs/leaflet-1.3.1/leaflet.css b/docs/reference/libs/leaflet-1.3.1/leaflet.css new file mode 100644 index 00000000..d1b47a12 --- /dev/null +++ b/docs/reference/libs/leaflet-1.3.1/leaflet.css @@ -0,0 +1,636 @@ +/* required styles */ + +.leaflet-pane, +.leaflet-tile, +.leaflet-marker-icon, +.leaflet-marker-shadow, +.leaflet-tile-container, +.leaflet-pane > svg, +.leaflet-pane > canvas, +.leaflet-zoom-box, +.leaflet-image-layer, +.leaflet-layer { + position: absolute; + left: 0; + top: 0; + } +.leaflet-container { + overflow: hidden; + } +.leaflet-tile, +.leaflet-marker-icon, +.leaflet-marker-shadow { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + -webkit-user-drag: none; + } +/* Safari renders non-retina tile on retina better with this, but Chrome is worse */ +.leaflet-safari .leaflet-tile { + image-rendering: -webkit-optimize-contrast; + } +/* hack that prevents hw layers "stretching" when loading new tiles */ +.leaflet-safari .leaflet-tile-container { + width: 1600px; + height: 1600px; + -webkit-transform-origin: 0 0; + } +.leaflet-marker-icon, +.leaflet-marker-shadow { + display: block; + } +/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */ +/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */ +.leaflet-container .leaflet-overlay-pane svg, +.leaflet-container .leaflet-marker-pane img, +.leaflet-container .leaflet-shadow-pane img, +.leaflet-container .leaflet-tile-pane img, +.leaflet-container img.leaflet-image-layer { + max-width: none !important; + max-height: none !important; + } + +.leaflet-container.leaflet-touch-zoom { + -ms-touch-action: pan-x pan-y; + touch-action: pan-x pan-y; + } +.leaflet-container.leaflet-touch-drag { + -ms-touch-action: pinch-zoom; + /* Fallback for FF which doesn't support pinch-zoom */ + touch-action: none; + touch-action: pinch-zoom; +} +.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { + -ms-touch-action: none; + touch-action: none; +} +.leaflet-container { + -webkit-tap-highlight-color: transparent; +} +.leaflet-container a { + -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4); +} +.leaflet-tile { + filter: inherit; + visibility: hidden; + } +.leaflet-tile-loaded { + visibility: inherit; + } +.leaflet-zoom-box { + width: 0; + height: 0; + -moz-box-sizing: border-box; + box-sizing: border-box; + z-index: 800; + } +/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ +.leaflet-overlay-pane svg { + -moz-user-select: none; + } + +.leaflet-pane { z-index: 400; } + +.leaflet-tile-pane { z-index: 200; } +.leaflet-overlay-pane { z-index: 400; } +.leaflet-shadow-pane { z-index: 500; } +.leaflet-marker-pane { z-index: 600; } +.leaflet-tooltip-pane { z-index: 650; } +.leaflet-popup-pane { z-index: 700; } + +.leaflet-map-pane canvas { z-index: 100; } +.leaflet-map-pane svg { z-index: 200; } + +.leaflet-vml-shape { + width: 1px; + height: 1px; + } +.lvml { + behavior: url(#default#VML); + display: inline-block; + position: absolute; + } + + +/* control positioning */ + +.leaflet-control { + position: relative; + z-index: 800; + pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ + pointer-events: auto; + } +.leaflet-top, +.leaflet-bottom { + position: absolute; + z-index: 1000; + pointer-events: none; + } +.leaflet-top { + top: 0; + } +.leaflet-right { + right: 0; + } +.leaflet-bottom { + bottom: 0; + } +.leaflet-left { + left: 0; + } +.leaflet-control { + float: left; + clear: both; + } +.leaflet-right .leaflet-control { + float: right; + } +.leaflet-top .leaflet-control { + margin-top: 10px; + } +.leaflet-bottom .leaflet-control { + margin-bottom: 10px; + } +.leaflet-left .leaflet-control { + margin-left: 10px; + } +.leaflet-right .leaflet-control { + margin-right: 10px; + } + + +/* zoom and fade animations */ + +.leaflet-fade-anim .leaflet-tile { + will-change: opacity; + } +.leaflet-fade-anim .leaflet-popup { + opacity: 0; + -webkit-transition: opacity 0.2s linear; + -moz-transition: opacity 0.2s linear; + -o-transition: opacity 0.2s linear; + transition: opacity 0.2s linear; + } +.leaflet-fade-anim .leaflet-map-pane .leaflet-popup { + opacity: 1; + } +.leaflet-zoom-animated { + -webkit-transform-origin: 0 0; + -ms-transform-origin: 0 0; + transform-origin: 0 0; + } +.leaflet-zoom-anim .leaflet-zoom-animated { + will-change: transform; + } +.leaflet-zoom-anim .leaflet-zoom-animated { + -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); + -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); + -o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1); + transition: transform 0.25s cubic-bezier(0,0,0.25,1); + } +.leaflet-zoom-anim .leaflet-tile, +.leaflet-pan-anim .leaflet-tile { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; + } + +.leaflet-zoom-anim .leaflet-zoom-hide { + visibility: hidden; + } + + +/* cursors */ + +.leaflet-interactive { + cursor: pointer; + } +.leaflet-grab { + cursor: -webkit-grab; + cursor: -moz-grab; + } +.leaflet-crosshair, +.leaflet-crosshair .leaflet-interactive { + cursor: crosshair; + } +.leaflet-popup-pane, +.leaflet-control { + cursor: auto; + } +.leaflet-dragging .leaflet-grab, +.leaflet-dragging .leaflet-grab .leaflet-interactive, +.leaflet-dragging .leaflet-marker-draggable { + cursor: move; + cursor: -webkit-grabbing; + cursor: -moz-grabbing; + } + +/* marker & overlays interactivity */ +.leaflet-marker-icon, +.leaflet-marker-shadow, +.leaflet-image-layer, +.leaflet-pane > svg path, +.leaflet-tile-container { + pointer-events: none; + } + +.leaflet-marker-icon.leaflet-interactive, +.leaflet-image-layer.leaflet-interactive, +.leaflet-pane > svg path.leaflet-interactive { + pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ + pointer-events: auto; + } + +/* visual tweaks */ + +.leaflet-container { + background: #ddd; + outline: 0; + } +.leaflet-container a { + color: #0078A8; + } +.leaflet-container a.leaflet-active { + outline: 2px solid orange; + } +.leaflet-zoom-box { + border: 2px dotted #38f; + background: rgba(255,255,255,0.5); + } + + +/* general typography */ +.leaflet-container { + font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; + } + + +/* general toolbar styles */ + +.leaflet-bar { + box-shadow: 0 1px 5px rgba(0,0,0,0.65); + border-radius: 4px; + } +.leaflet-bar a, +.leaflet-bar a:hover { + background-color: #fff; + border-bottom: 1px solid #ccc; + width: 26px; + height: 26px; + line-height: 26px; + display: block; + text-align: center; + text-decoration: none; + color: black; + } +.leaflet-bar a, +.leaflet-control-layers-toggle { + background-position: 50% 50%; + background-repeat: no-repeat; + display: block; + } +.leaflet-bar a:hover { + background-color: #f4f4f4; + } +.leaflet-bar a:first-child { + border-top-left-radius: 4px; + border-top-right-radius: 4px; + } +.leaflet-bar a:last-child { + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + border-bottom: none; + } +.leaflet-bar a.leaflet-disabled { + cursor: default; + background-color: #f4f4f4; + color: #bbb; + } + +.leaflet-touch .leaflet-bar a { + width: 30px; + height: 30px; + line-height: 30px; + } +.leaflet-touch .leaflet-bar a:first-child { + border-top-left-radius: 2px; + border-top-right-radius: 2px; + } +.leaflet-touch .leaflet-bar a:last-child { + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; + } + +/* zoom control */ + +.leaflet-control-zoom-in, +.leaflet-control-zoom-out { + font: bold 18px 'Lucida Console', Monaco, monospace; + text-indent: 1px; + } + +.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out { + font-size: 22px; + } + + +/* layers control */ + +.leaflet-control-layers { + box-shadow: 0 1px 5px rgba(0,0,0,0.4); + background: #fff; + border-radius: 5px; + } +.leaflet-control-layers-toggle { + background-image: url(images/layers.png); + width: 36px; + height: 36px; + } +.leaflet-retina .leaflet-control-layers-toggle { + background-image: url(images/layers-2x.png); + background-size: 26px 26px; + } +.leaflet-touch .leaflet-control-layers-toggle { + width: 44px; + height: 44px; + } +.leaflet-control-layers .leaflet-control-layers-list, +.leaflet-control-layers-expanded .leaflet-control-layers-toggle { + display: none; + } +.leaflet-control-layers-expanded .leaflet-control-layers-list { + display: block; + position: relative; + } +.leaflet-control-layers-expanded { + padding: 6px 10px 6px 6px; + color: #333; + background: #fff; + } +.leaflet-control-layers-scrollbar { + overflow-y: scroll; + overflow-x: hidden; + padding-right: 5px; + } +.leaflet-control-layers-selector { + margin-top: 2px; + position: relative; + top: 1px; + } +.leaflet-control-layers label { + display: block; + } +.leaflet-control-layers-separator { + height: 0; + border-top: 1px solid #ddd; + margin: 5px -10px 5px -6px; + } + +/* Default icon URLs */ +.leaflet-default-icon-path { + background-image: url(images/marker-icon.png); + } + + +/* attribution and scale controls */ + +.leaflet-container .leaflet-control-attribution { + background: #fff; + background: rgba(255, 255, 255, 0.7); + margin: 0; + } +.leaflet-control-attribution, +.leaflet-control-scale-line { + padding: 0 5px; + color: #333; + } +.leaflet-control-attribution a { + text-decoration: none; + } +.leaflet-control-attribution a:hover { + text-decoration: underline; + } +.leaflet-container .leaflet-control-attribution, +.leaflet-container .leaflet-control-scale { + font-size: 11px; + } +.leaflet-left .leaflet-control-scale { + margin-left: 5px; + } +.leaflet-bottom .leaflet-control-scale { + margin-bottom: 5px; + } +.leaflet-control-scale-line { + border: 2px solid #777; + border-top: none; + line-height: 1.1; + padding: 2px 5px 1px; + font-size: 11px; + white-space: nowrap; + overflow: hidden; + -moz-box-sizing: border-box; + box-sizing: border-box; + + background: #fff; + background: rgba(255, 255, 255, 0.5); + } +.leaflet-control-scale-line:not(:first-child) { + border-top: 2px solid #777; + border-bottom: none; + margin-top: -2px; + } +.leaflet-control-scale-line:not(:first-child):not(:last-child) { + border-bottom: 2px solid #777; + } + +.leaflet-touch .leaflet-control-attribution, +.leaflet-touch .leaflet-control-layers, +.leaflet-touch .leaflet-bar { + box-shadow: none; + } +.leaflet-touch .leaflet-control-layers, +.leaflet-touch .leaflet-bar { + border: 2px solid rgba(0,0,0,0.2); + background-clip: padding-box; + } + + +/* popup */ + +.leaflet-popup { + position: absolute; + text-align: center; + margin-bottom: 20px; + } +.leaflet-popup-content-wrapper { + padding: 1px; + text-align: left; + border-radius: 12px; + } +.leaflet-popup-content { + margin: 13px 19px; + line-height: 1.4; + } +.leaflet-popup-content p { + margin: 18px 0; + } +.leaflet-popup-tip-container { + width: 40px; + height: 20px; + position: absolute; + left: 50%; + margin-left: -20px; + overflow: hidden; + pointer-events: none; + } +.leaflet-popup-tip { + width: 17px; + height: 17px; + padding: 1px; + + margin: -10px auto 0; + + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); + } +.leaflet-popup-content-wrapper, +.leaflet-popup-tip { + background: white; + color: #333; + box-shadow: 0 3px 14px rgba(0,0,0,0.4); + } +.leaflet-container a.leaflet-popup-close-button { + position: absolute; + top: 0; + right: 0; + padding: 4px 4px 0 0; + border: none; + text-align: center; + width: 18px; + height: 14px; + font: 16px/14px Tahoma, Verdana, sans-serif; + color: #c3c3c3; + text-decoration: none; + font-weight: bold; + background: transparent; + } +.leaflet-container a.leaflet-popup-close-button:hover { + color: #999; + } +.leaflet-popup-scrolled { + overflow: auto; + border-bottom: 1px solid #ddd; + border-top: 1px solid #ddd; + } + +.leaflet-oldie .leaflet-popup-content-wrapper { + zoom: 1; + } +.leaflet-oldie .leaflet-popup-tip { + width: 24px; + margin: 0 auto; + + -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; + filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); + } +.leaflet-oldie .leaflet-popup-tip-container { + margin-top: -1px; + } + +.leaflet-oldie .leaflet-control-zoom, +.leaflet-oldie .leaflet-control-layers, +.leaflet-oldie .leaflet-popup-content-wrapper, +.leaflet-oldie .leaflet-popup-tip { + border: 1px solid #999; + } + + +/* div icon */ + +.leaflet-div-icon { + background: #fff; + border: 1px solid #666; + } + + +/* Tooltip */ +/* Base styles for the element that has a tooltip */ +.leaflet-tooltip { + position: absolute; + padding: 6px; + background-color: #fff; + border: 1px solid #fff; + border-radius: 3px; + color: #222; + white-space: nowrap; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + pointer-events: none; + box-shadow: 0 1px 3px rgba(0,0,0,0.4); + } +.leaflet-tooltip.leaflet-clickable { + cursor: pointer; + pointer-events: auto; + } +.leaflet-tooltip-top:before, +.leaflet-tooltip-bottom:before, +.leaflet-tooltip-left:before, +.leaflet-tooltip-right:before { + position: absolute; + pointer-events: none; + border: 6px solid transparent; + background: transparent; + content: ""; + } + +/* Directions */ + +.leaflet-tooltip-bottom { + margin-top: 6px; +} +.leaflet-tooltip-top { + margin-top: -6px; +} +.leaflet-tooltip-bottom:before, +.leaflet-tooltip-top:before { + left: 50%; + margin-left: -6px; + } +.leaflet-tooltip-top:before { + bottom: 0; + margin-bottom: -12px; + border-top-color: #fff; + } +.leaflet-tooltip-bottom:before { + top: 0; + margin-top: -12px; + margin-left: -6px; + border-bottom-color: #fff; + } +.leaflet-tooltip-left { + margin-left: -6px; +} +.leaflet-tooltip-right { + margin-left: 6px; +} +.leaflet-tooltip-left:before, +.leaflet-tooltip-right:before { + top: 50%; + margin-top: -6px; + } +.leaflet-tooltip-left:before { + right: 0; + margin-right: -12px; + border-left-color: #fff; + } +.leaflet-tooltip-right:before { + left: 0; + margin-left: -12px; + border-right-color: #fff; + } diff --git a/docs/reference/libs/leaflet-1.3.1/leaflet.js b/docs/reference/libs/leaflet-1.3.1/leaflet.js new file mode 100644 index 00000000..4eca8af7 --- /dev/null +++ b/docs/reference/libs/leaflet-1.3.1/leaflet.js @@ -0,0 +1,5 @@ +/* @preserve + * Leaflet 1.3.1+Detached: ba6f97fff8647e724e4dfe66d2ed7da11f908989.ba6f97f, a JS library for interactive maps. https://leafletjs.com + * (c) 2010-2017 Vladimir Agafonkin, (c) 2010-2011 CloudMade + */ +!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(t.L={})}(this,function(t){"use strict";function i(t){var i,e,n,o;for(e=1,n=arguments.length;e=0}function I(t,i,e,n){return"touchstart"===i?O(t,e,n):"touchmove"===i?W(t,e,n):"touchend"===i&&H(t,e,n),this}function B(t,i,e){var n=t["_leaflet_"+i+e];return"touchstart"===i?t.removeEventListener(Qi,n,!1):"touchmove"===i?t.removeEventListener(te,n,!1):"touchend"===i&&(t.removeEventListener(ie,n,!1),t.removeEventListener(ee,n,!1)),this}function O(t,i,n){var o=e(function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(ne.indexOf(t.target.tagName)<0))return;$(t)}j(t,i)});t["_leaflet_touchstart"+n]=o,t.addEventListener(Qi,o,!1),se||(document.documentElement.addEventListener(Qi,R,!0),document.documentElement.addEventListener(te,D,!0),document.documentElement.addEventListener(ie,N,!0),document.documentElement.addEventListener(ee,N,!0),se=!0)}function R(t){oe[t.pointerId]=t,re++}function D(t){oe[t.pointerId]&&(oe[t.pointerId]=t)}function N(t){delete oe[t.pointerId],re--}function j(t,i){t.touches=[];for(var e in oe)t.touches.push(oe[e]);t.changedTouches=[t],i(t)}function W(t,i,e){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&j(t,i)};t["_leaflet_touchmove"+e]=n,t.addEventListener(te,n,!1)}function H(t,i,e){var n=function(t){j(t,i)};t["_leaflet_touchend"+e]=n,t.addEventListener(ie,n,!1),t.addEventListener(ee,n,!1)}function F(t,i,e){function n(t){var i;if(Ui){if(!Pi||"mouse"===t.pointerType)return;i=re}else i=t.touches.length;if(!(i>1)){var e=Date.now(),n=e-(s||e);r=t.touches?t.touches[0]:t,a=n>0&&n<=h,s=e}}function o(t){if(a&&!r.cancelBubble){if(Ui){if(!Pi||"mouse"===t.pointerType)return;var e,n,o={};for(n in r)e=r[n],o[n]=e&&e.bind?e.bind(r):e;r=o}r.type="dblclick",i(r),s=null}}var s,r,a=!1,h=250;return t[ue+ae+e]=n,t[ue+he+e]=o,t[ue+"dblclick"+e]=i,t.addEventListener(ae,n,!1),t.addEventListener(he,o,!1),t.addEventListener("dblclick",i,!1),this}function U(t,i){var e=t[ue+ae+i],n=t[ue+he+i],o=t[ue+"dblclick"+i];return t.removeEventListener(ae,e,!1),t.removeEventListener(he,n,!1),Pi||t.removeEventListener("dblclick",o,!1),this}function V(t,i,e,n){if("object"==typeof i)for(var o in i)G(t,o,i[o],e);else for(var s=0,r=(i=u(i)).length;s100&&n<500||t.target._simulatedClick&&!t._simulated?Q(t):(pi=e,i(t))}function rt(t){return"string"==typeof t?document.getElementById(t):t}function at(t,i){var e=t.style[i]||t.currentStyle&&t.currentStyle[i];if((!e||"auto"===e)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);e=n?n[i]:null}return"auto"===e?null:e}function ht(t,i,e){var n=document.createElement(t);return n.className=i||"",e&&e.appendChild(n),n}function ut(t){var i=t.parentNode;i&&i.removeChild(t)}function lt(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function ct(t){var i=t.parentNode;i.lastChild!==t&&i.appendChild(t)}function _t(t){var i=t.parentNode;i.firstChild!==t&&i.insertBefore(t,i.firstChild)}function dt(t,i){if(void 0!==t.classList)return t.classList.contains(i);var e=gt(t);return e.length>0&&new RegExp("(^|\\s)"+i+"(\\s|$)").test(e)}function pt(t,i){if(void 0!==t.classList)for(var e=u(i),n=0,o=e.length;nh&&(s=r,h=a);h>e&&(i[s]=1,Et(t,i,e,n,s),Et(t,i,e,s,o))}function kt(t,i){for(var e=[t[0]],n=1,o=0,s=t.length;ni&&(e.push(t[n]),o=n);return oi.max.x&&(e|=2),t.yi.max.y&&(e|=8),e}function Ot(t,i){var e=i.x-t.x,n=i.y-t.y;return e*e+n*n}function Rt(t,i,e,n){var o,s=i.x,r=i.y,a=e.x-s,h=e.y-r,u=a*a+h*h;return u>0&&((o=((t.x-s)*a+(t.y-r)*h)/u)>1?(s=e.x,r=e.y):o>0&&(s+=a*o,r+=h*o)),a=t.x-s,h=t.y-r,n?a*a+h*h:new x(s,r)}function Dt(t){return!ei(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Nt(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Dt(t)}function jt(t,i,e){var n,o,s,r,a,h,u,l,c,_=[1,4,2,8];for(o=0,u=t.length;o0?Math.floor(t):Math.ceil(t)};x.prototype={clone:function(){return new x(this.x,this.y)},add:function(t){return this.clone()._add(w(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(w(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new x(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new x(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=li(this.x),this.y=li(this.y),this},distanceTo:function(t){var i=(t=w(t)).x-this.x,e=t.y-this.y;return Math.sqrt(i*i+e*e)},equals:function(t){return(t=w(t)).x===this.x&&t.y===this.y},contains:function(t){return t=w(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+a(this.x)+", "+a(this.y)+")"}},P.prototype={extend:function(t){return t=w(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new x((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new x(this.min.x,this.max.y)},getTopRight:function(){return new x(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var i,e;return(t="number"==typeof t[0]||t instanceof x?w(t):b(t))instanceof P?(i=t.min,e=t.max):i=e=t,i.x>=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=b(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>=i.x&&n.x<=e.x,r=o.y>=i.y&&n.y<=e.y;return s&&r},overlaps:function(t){t=b(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>i.x&&n.xi.y&&n.y=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=z(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=i.lat&&n.lat<=e.lat,r=o.lng>=i.lng&&n.lng<=e.lng;return s&&r},overlaps:function(t){t=z(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>i.lat&&n.lati.lng&&n.lng1,Yi=!!document.createElement("canvas").getContext,Xi=!(!document.createElementNS||!E("svg").createSVGRect),Ji=!Xi&&function(){try{var t=document.createElement("div");t.innerHTML='';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}(),$i=(Object.freeze||Object)({ie:wi,ielt9:Li,edge:Pi,webkit:bi,android:Ti,android23:zi,androidStock:Ci,opera:Zi,chrome:Si,gecko:Ei,safari:ki,phantom:Ai,opera12:Ii,win:Bi,ie3d:Oi,webkit3d:Ri,gecko3d:Di,any3d:Ni,mobile:ji,mobileWebkit:Wi,mobileWebkit3d:Hi,msPointer:Fi,pointer:Ui,touch:Vi,mobileOpera:qi,mobileGecko:Gi,retina:Ki,canvas:Yi,svg:Xi,vml:Ji}),Qi=Fi?"MSPointerDown":"pointerdown",te=Fi?"MSPointerMove":"pointermove",ie=Fi?"MSPointerUp":"pointerup",ee=Fi?"MSPointerCancel":"pointercancel",ne=["INPUT","SELECT","OPTION"],oe={},se=!1,re=0,ae=Fi?"MSPointerDown":Ui?"pointerdown":"touchstart",he=Fi?"MSPointerUp":Ui?"pointerup":"touchend",ue="_leaflet_",le="_leaflet_events",ce=Bi&&Si?2*window.devicePixelRatio:Ei?window.devicePixelRatio:1,_e={},de=(Object.freeze||Object)({on:V,off:q,stopPropagation:Y,disableScrollPropagation:X,disableClickPropagation:J,preventDefault:$,stop:Q,getMousePosition:tt,getWheelDelta:it,fakeStop:et,skipped:nt,isExternalTarget:ot,addListener:V,removeListener:q}),pe=xt(["transform","WebkitTransform","OTransform","MozTransform","msTransform"]),me=xt(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),fe="webkitTransition"===me||"OTransition"===me?me+"End":"transitionend";if("onselectstart"in document)mi=function(){V(window,"selectstart",$)},fi=function(){q(window,"selectstart",$)};else{var ge=xt(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);mi=function(){if(ge){var t=document.documentElement.style;gi=t[ge],t[ge]="none"}},fi=function(){ge&&(document.documentElement.style[ge]=gi,gi=void 0)}}var ve,ye,xe=(Object.freeze||Object)({TRANSFORM:pe,TRANSITION:me,TRANSITION_END:fe,get:rt,getStyle:at,create:ht,remove:ut,empty:lt,toFront:ct,toBack:_t,hasClass:dt,addClass:pt,removeClass:mt,setClass:ft,getClass:gt,setOpacity:vt,testProp:xt,setTransform:wt,setPosition:Lt,getPosition:Pt,disableTextSelection:mi,enableTextSelection:fi,disableImageDrag:bt,enableImageDrag:Tt,preventOutline:zt,restoreOutline:Mt}),we=ui.extend({run:function(t,i,e,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=e||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Pt(t),this._offset=i.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=f(this._animate,this),this._step()},_step:function(t){var i=+new Date-this._startTime,e=1e3*this._duration;ithis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),n=this._limitCenter(e,this._zoom,z(t));return e.equals(n)||this.panTo(n,i),this._enforcingBounds=!1,this},invalidateSize:function(t){if(!this._loaded)return this;t=i({animate:!1,pan:!0},!0===t?{animate:!0}:t);var n=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var o=this.getSize(),s=n.divideBy(2).round(),r=o.divideBy(2).round(),a=s.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(e(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:o})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=i({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var n=e(this._handleGeolocationResponse,this),o=e(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,o,t):navigator.geolocation.getCurrentPosition(n,o,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var i=t.code,e=t.message||(1===i?"permission denied":2===i?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:i,message:"Geolocation error: "+e+"."})},_handleGeolocationResponse:function(t){var i=new M(t.coords.latitude,t.coords.longitude),e=i.toBounds(t.coords.accuracy),n=this._locateOptions;if(n.setView){var o=this.getBoundsZoom(e);this.setView(i,n.maxZoom?Math.min(o,n.maxZoom):o)}var s={latlng:i,bounds:e,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,i){if(!i)return this;var e=this[t]=new i(this);return this._handlers.push(e),this.options[t]&&e.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ut(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)ut(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,i){var e=ht("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i||this._mapPane);return t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new T(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,i,e){t=z(t),e=w(e||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),h=this.getSize().subtract(e),u=b(this.project(a,n),this.project(r,n)).getSize(),l=Ni?this.options.zoomSnap:1,c=h.x/u.x,_=h.y/u.y,d=i?Math.max(c,_):Math.min(c,_);return n=this.getScaleZoom(d,n),l&&(n=Math.round(n/(l/100))*(l/100),n=i?Math.ceil(n/l)*l:Math.floor(n/l)*l),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new x(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,i){var e=this._getTopLeftPoint(t,i);return new P(e,e.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,i){var e=this.options.crs;return i=void 0===i?this._zoom:i,e.scale(t)/e.scale(i)},getScaleZoom:function(t,i){var e=this.options.crs;i=void 0===i?this._zoom:i;var n=e.zoom(t*e.scale(i));return isNaN(n)?1/0:n},project:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.latLngToPoint(C(t),i)},unproject:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.pointToLatLng(w(t),i)},layerPointToLatLng:function(t){var i=w(t).add(this.getPixelOrigin());return this.unproject(i)},latLngToLayerPoint:function(t){return this.project(C(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(C(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(z(t))},distance:function(t,i){return this.options.crs.distance(C(t),C(i))},containerPointToLayerPoint:function(t){return w(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return w(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var i=this.containerPointToLayerPoint(w(t));return this.layerPointToLatLng(i)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(C(t)))},mouseEventToContainerPoint:function(t){return tt(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var i=this._container=rt(t);if(!i)throw new Error("Map container not found.");if(i._leaflet_id)throw new Error("Map container is already initialized.");V(i,"scroll",this._onScroll,this),this._containerId=n(i)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&Ni,pt(t,"leaflet-container"+(Vi?" leaflet-touch":"")+(Ki?" leaflet-retina":"")+(Li?" leaflet-oldie":"")+(ki?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var i=at(t,"position");"absolute"!==i&&"relative"!==i&&"fixed"!==i&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Lt(this._mapPane,new x(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(pt(t.markerPane,"leaflet-zoom-hide"),pt(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,i){Lt(this._mapPane,new x(0,0));var e=!this._loaded;this._loaded=!0,i=this._limitZoom(i),this.fire("viewprereset");var n=this._zoom!==i;this._moveStart(n,!1)._move(t,i)._moveEnd(n),this.fire("viewreset"),e&&this.fire("load")},_moveStart:function(t,i){return t&&this.fire("zoomstart"),i||this.fire("movestart"),this},_move:function(t,i,e){void 0===i&&(i=this._zoom);var n=this._zoom!==i;return this._zoom=i,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||e&&e.pinch)&&this.fire("zoom",e),this.fire("move",e)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return g(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Lt(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[n(this._container)]=this;var i=t?q:V;i(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress",this._handleDOMEvent,this),this.options.trackResize&&i(window,"resize",this._onResize,this),Ni&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){g(this._resizeRequest),this._resizeRequest=f(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,o=[],s="mouseout"===i||"mouseover"===i,r=t.target||t.srcElement,a=!1;r;){if((e=this._targets[n(r)])&&("click"===i||"preclick"===i)&&!t._simulated&&this._draggableMoved(e)){a=!0;break}if(e&&e.listens(i,!0)){if(s&&!ot(r,t))break;if(o.push(e),s)break}if(r===this._container)break;r=r.parentNode}return o.length||a||s||!ot(r,t)||(o=[this]),o},_handleDOMEvent:function(t){if(this._loaded&&!nt(t)){var i=t.type;"mousedown"!==i&&"keypress"!==i||zt(t.target||t.srcElement),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,n){if("click"===t.type){var o=i({},t);o.type="preclick",this._fireDOMEvent(o,o.type,n)}if(!t._stopped&&(n=(n||[]).concat(this._findEventTargets(t,e))).length){var s=n[0];"contextmenu"===e&&s.listens(e,!0)&&$(t);var r={originalEvent:t};if("keypress"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var h=0;h0?Math.round(t-i)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(i))},_limitZoom:function(t){var i=this.getMinZoom(),e=this.getMaxZoom(),n=Ni?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(i,Math.min(e,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){mt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,i){var e=this._getCenterOffset(t)._trunc();return!(!0!==(i&&i.animate)&&!this.getSize().contains(e))&&(this.panBy(e,i),!0)},_createAnimProxy:function(){var t=this._proxy=ht("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(t){var i=pe,e=this._proxy.style[i];wt(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),e===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",function(){var t=this.getCenter(),i=this.getZoom();wt(this._proxy,this.project(t,i),this.getZoomScale(i,1))},this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ut(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,i,e){if(this._animatingZoom)return!0;if(e=e||{},!this._zoomAnimated||!1===e.animate||this._nothingToAnimate()||Math.abs(i-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(o))&&(f(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,n,o){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,pt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:o}),setTimeout(e(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&mt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),f(function(){this._moveEnd(!0)},this))}}),Pe=v.extend({options:{position:"topright"},initialize:function(t){l(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),n=t._controlCorners[e];return pt(i,"leaflet-control"),-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this},remove:function(){return this._map?(ut(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),be=function(t){return new Pe(t)};Le.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){function t(t,o){var s=e+t+" "+e+o;i[t+o]=ht("div",s,n)}var i=this._controlCorners={},e="leaflet-",n=this._controlContainer=ht("div",e+"control-container",this._container);t("top","left"),t("top","right"),t("bottom","left"),t("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ut(this._controlCorners[t]);ut(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Te=Pe.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,i,e,n){return e1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=i&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var i=this._getLayer(n(t.target)),e=i.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;e&&this._map.fire(e,i)},_createRadioElement:function(t,i){var e='",n=document.createElement("div");return n.innerHTML=e,n.firstChild},_addItem:function(t){var i,e=document.createElement("label"),o=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=o):i=this._createRadioElement("leaflet-base-layers",o),this._layerControlInputs.push(i),i.layerId=n(t.layer),V(i,"click",this._onInputClick,this);var s=document.createElement("span");s.innerHTML=" "+t.name;var r=document.createElement("div");return e.appendChild(r),r.appendChild(i),r.appendChild(s),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;s>=0;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;s=0;o--)t=e[o],i=this._getLayer(t.layerId).layer,t.disabled=void 0!==i.options.minZoom&&ni.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ze=Pe.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=ht("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){var s=ht("a",e,n);return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),J(s),V(s,"click",Q),V(s,"click",o,this),V(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";mt(this._zoomInButton,i),mt(this._zoomOutButton,i),(this._disabled||t._zoom===t.getMinZoom())&&pt(this._zoomOutButton,i),(this._disabled||t._zoom===t.getMaxZoom())&&pt(this._zoomInButton,i)}});Le.mergeOptions({zoomControl:!0}),Le.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ze,this.addControl(this.zoomControl))});var Me=Pe.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i=ht("div","leaflet-control-scale"),e=this.options;return this._addScales(e,"leaflet-control-scale-line",i),t.on(e.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=ht("div",i,e)),t.imperial&&(this._iScale=ht("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,e=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t),e=i<1e3?i+" m":i/1e3+" km";this._updateScale(this._mScale,e,i/t)},_updateImperial:function(t){var i,e,n,o=3.2808399*t;o>5280?(i=o/5280,e=this._getRoundNum(i),this._updateScale(this._iScale,e+" mi",e/i)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,i,e){t.style.width=Math.round(this.options.maxWidth*e)+"px",t.innerHTML=i},_getRoundNum:function(t){var i=Math.pow(10,(Math.floor(t)+"").length-1),e=t/i;return e=e>=10?10:e>=5?5:e>=3?3:e>=2?2:1,i*e}}),Ce=Pe.extend({options:{position:"bottomright",prefix:'Leaflet'},initialize:function(t){l(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=ht("div","leaflet-control-attribution"),J(this._container);for(var i in t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var i in this._attributions)this._attributions[i]&&t.push(i);var e=[];this.options.prefix&&e.push(this.options.prefix),t.length&&e.push(t.join(", ")),this._container.innerHTML=e.join(" | ")}}});Le.mergeOptions({attributionControl:!0}),Le.addInitHook(function(){this.options.attributionControl&&(new Ce).addTo(this)});Pe.Layers=Te,Pe.Zoom=ze,Pe.Scale=Me,Pe.Attribution=Ce,be.layers=function(t,i,e){return new Te(t,i,e)},be.zoom=function(t){return new ze(t)},be.scale=function(t){return new Me(t)},be.attribution=function(t){return new Ce(t)};var Ze=v.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ze.addTo=function(t,i){return t.addHandler(i,this),this};var Se,Ee={Events:hi},ke=Vi?"touchstart mousedown":"mousedown",Ae={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},Ie={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},Be=ui.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){l(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(V(this._dragStartTarget,ke,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Be._dragging===this&&this.finishDrag(),q(this._dragStartTarget,ke,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!dt(this._element,"leaflet-zoom-anim")&&!(Be._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(Be._dragging=this,this._preventOutline&&zt(this._element),bt(),mi(),this._moving)))){this.fire("down");var i=t.touches?t.touches[0]:t;this._startPoint=new x(i.clientX,i.clientY),V(document,Ie[t.type],this._onMove,this),V(document,Ae[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var i=t.touches&&1===t.touches.length?t.touches[0]:t,e=new x(i.clientX,i.clientY).subtract(this._startPoint);(e.x||e.y)&&(Math.abs(e.x)+Math.abs(e.y)1e-7;h++)i=s*Math.sin(a),i=Math.pow((1-i)/(1+i),s/2),a+=u=Math.PI/2-2*Math.atan(r*i)-a;return new M(a*e,t.x*e/n)}},je=(Object.freeze||Object)({LonLat:De,Mercator:Ne,SphericalMercator:di}),We=i({},_i,{code:"EPSG:3395",projection:Ne,transformation:function(){var t=.5/(Math.PI*Ne.R);return S(t,.5,-t,.5)}()}),He=i({},_i,{code:"EPSG:4326",projection:De,transformation:S(1/180,1,-1/180,.5)}),Fe=i({},ci,{projection:De,transformation:S(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,i){var e=i.lng-t.lng,n=i.lat-t.lat;return Math.sqrt(e*e+n*n)},infinite:!0});ci.Earth=_i,ci.EPSG3395=We,ci.EPSG3857=vi,ci.EPSG900913=yi,ci.EPSG4326=He,ci.Simple=Fe;var Ue=ui.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[n(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[n(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var i=t.target;if(i.hasLayer(this)){if(this._map=i,this._zoomAnimated=i._zoomAnimated,this.getEvents){var e=this.getEvents();i.on(e,this),this.once("remove",function(){i.off(e,this)},this)}this.onAdd(i),this.getAttribution&&i.attributionControl&&i.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),i.fire("layeradd",{layer:this})}}});Le.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var i=n(t);return this._layers[i]?this:(this._layers[i]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var i=n(t);return this._layers[i]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[i],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&n(t)in this._layers},eachLayer:function(t,i){for(var e in this._layers)t.call(i,this._layers[e]);return this},_addLayers:function(t){for(var i=0,e=(t=t?ei(t)?t:[t]:[]).length;ithis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()i)return r=(n-i)/e,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,i){return i=i||this._defaultShape(),t=C(t),i.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new T,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Dt(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var i=[],e=Dt(t),n=0,o=t.length;n=2&&i[0]instanceof M&&i[0].equals(i[e-1])&&i.pop(),i},_setLatLngs:function(t){tn.prototype._setLatLngs.call(this,t),Dt(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Dt(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,i=this.options.weight,e=new x(i,i);if(t=new P(t.min.subtract(e),t.max.add(e)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;ot.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(u=!u);return u||tn.prototype._containsPoint.call(this,t,!0)}}),nn=qe.extend({initialize:function(t,i){l(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=ei(t)?t:t.features;if(o){for(i=0,e=o.length;i0?o:[i.src]}else{ei(this._url)||(this._url=[this._url]),i.autoplay=!!this.options.autoplay,i.loop=!!this.options.loop;for(var a=0;ao?(i.height=o+"px",pt(t,"leaflet-popup-scrolled")):mt(t,"leaflet-popup-scrolled"),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),e=this._getAnchor();Lt(this._container,i.add(e))},_adjustPan:function(){if(!(!this.options.autoPan||this._map._panAnim&&this._map._panAnim._inProgress)){var t=this._map,i=parseInt(at(this._container,"marginBottom"),10)||0,e=this._container.offsetHeight+i,n=this._containerWidth,o=new x(this._containerLeft,-e-this._containerBottom);o._add(Pt(this._container));var s=t.layerPointToContainerPoint(o),r=w(this.options.autoPanPadding),a=w(this.options.autoPanPaddingTopLeft||r),h=w(this.options.autoPanPaddingBottomRight||r),u=t.getSize(),l=0,c=0;s.x+n+h.x>u.x&&(l=s.x+n-u.x+h.x),s.x-l-a.x<0&&(l=s.x-a.x),s.y+e+h.y>u.y&&(c=s.y+e-u.y+h.y),s.y-c-a.y<0&&(c=s.y-a.y),(l||c)&&t.fire("autopanstart").panBy([l,c])}},_onCloseButtonClick:function(t){this._close(),Q(t)},_getAnchor:function(){return w(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Le.mergeOptions({closePopupOnClick:!0}),Le.include({openPopup:function(t,i,e){return t instanceof un||(t=new un(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Ue.include({bindPopup:function(t,i){return t instanceof un?(l(t,i),this._popup=t,t._source=this):(this._popup&&!i||(this._popup=new un(i,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,i){if(t instanceof Ue||(i=t,t=this),t instanceof qe)for(var e in this._layers){t=this._layers[e];break}return i||(i=t.getCenter?t.getCenter():t.getLatLng()),this._popup&&this._map&&(this._popup._source=t,this._popup.update(),this._map.openPopup(this._popup,i)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i=t.layer||t.target;this._popup&&this._map&&(Q(t),i instanceof Je?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===i?this.closePopup():this.openPopup(i,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var ln=hn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){hn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){hn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=hn.prototype.getEvents.call(this);return Vi&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ht("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i=this._map,e=this._container,n=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(t),s=this.options.direction,r=e.offsetWidth,a=e.offsetHeight,h=w(this.options.offset),u=this._getAnchor();"top"===s?t=t.add(w(-r/2+h.x,-a+h.y+u.y,!0)):"bottom"===s?t=t.subtract(w(r/2-h.x,-h.y,!0)):"center"===s?t=t.subtract(w(r/2+h.x,a/2-u.y+h.y,!0)):"right"===s||"auto"===s&&o.xthis.options.maxZoom||en&&this._retainParent(o,s,r,n))},_retainChildren:function(t,i,e,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*i;s<2*i+2;s++){var r=new x(o,s);r.z=e+1;var a=this._tileCoordsToKey(r),h=this._tiles[a];h&&h.active?h.retain=!0:(h&&h.loaded&&(h.retain=!0),e+1this.options.maxZoom||void 0!==this.options.minZoom&&o1)this._setView(t,e);else{for(var c=o.min.y;c<=o.max.y;c++)for(var _=o.min.x;_<=o.max.x;_++){var d=new x(_,c);if(d.z=this._tileZoom,this._isValidTile(d)){var p=this._tiles[this._tileCoordsToKey(d)];p?p.current=!0:r.push(d)}}if(r.sort(function(t,i){return t.distanceTo(s)-i.distanceTo(s)}),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(_=0;_e.max.x)||!i.wrapLat&&(t.ye.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return z(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),o=n.add(e);return[i.unproject(n,t.z),i.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var i=this._tileCoordsToNwSe(t),e=new T(i[0],i[1]);return this.options.noWrap||(e=this._map.wrapLatLngBounds(e)),e},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),e=new x(+i[0],+i[1]);return e.z=+i[2],e},_removeTile:function(t){var i=this._tiles[t];i&&(Ci||i.el.setAttribute("src",ni),ut(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){pt(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=r,t.onmousemove=r,Li&&this.options.opacity<1&&vt(t,this.options.opacity),Ti&&!zi&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,i){var n=this._getTilePos(t),o=this._tileCoordsToKey(t),s=this.createTile(this._wrapCoords(t),e(this._tileReady,this,t));this._initTile(s),this.createTile.length<2&&f(e(this._tileReady,this,t,null,s)),Lt(s,n),this._tiles[o]={el:s,coords:t,current:!0},i.appendChild(s),this.fire("tileloadstart",{tile:s,coords:t})},_tileReady:function(t,i,n){if(this._map){i&&this.fire("tileerror",{error:i,tile:n,coords:t});var o=this._tileCoordsToKey(t);(n=this._tiles[o])&&(n.loaded=+new Date,this._map._fadeAnimated?(vt(n.el,0),g(this._fadeFrame),this._fadeFrame=f(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),i||(pt(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Li||!this._map._fadeAnimated?f(this._pruneTiles,this):setTimeout(e(this._pruneTiles,this),250)))}},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new x(this._wrapX?s(t.x,this._wrapX):t.x,this._wrapY?s(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new P(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),dn=_n.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,i){this._url=t,(i=l(this,i)).detectRetina&&Ki&&i.maxZoom>0&&(i.tileSize=Math.floor(i.tileSize/2),i.zoomReverse?(i.zoomOffset--,i.minZoom++):(i.zoomOffset++,i.maxZoom--),i.minZoom=Math.max(0,i.minZoom)),"string"==typeof i.subdomains&&(i.subdomains=i.subdomains.split("")),Ti||this.on("tileunload",this._onTileRemove)},setUrl:function(t,i){return this._url=t,i||this.redraw(),this},createTile:function(t,i){var n=document.createElement("img");return V(n,"load",e(this._tileOnLoad,this,i,n)),V(n,"error",e(this._tileOnError,this,i,n)),this.options.crossOrigin&&(n.crossOrigin=""),n.alt="",n.setAttribute("role","presentation"),n.src=this.getTileUrl(t),n},getTileUrl:function(t){var e={r:Ki?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var n=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=n),e["-y"]=n}return _(this._url,i(e,this.options))},_tileOnLoad:function(t,i){Li?setTimeout(e(t,this,null,i),0):t(null,i)},_tileOnError:function(t,i,e){var n=this.options.errorTileUrl;n&&i.getAttribute("src")!==n&&(i.src=n),t(e,i)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,i=this.options.maxZoom,e=this.options.zoomReverse,n=this.options.zoomOffset;return e&&(t=i-t),t+n},_getSubdomain:function(t){var i=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[i]},_abortLoading:function(){var t,i;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((i=this._tiles[t].el).onload=r,i.onerror=r,i.complete||(i.src=ni,ut(i),delete this._tiles[t]))}}),pn=dn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var n=i({},this.defaultWmsParams);for(var o in e)o in this.options||(n[o]=e[o]);var s=(e=l(this,e)).detectRetina&&Ki?2:1,r=this.getTileSize();n.width=r.x*s,n.height=r.y*s,this.wmsParams=n},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var i=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[i]=this._crs.code,dn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var i=this._tileCoordsToNwSe(t),e=this._crs,n=b(e.project(i[0]),e.project(i[1])),o=n.min,s=n.max,r=(this._wmsVersion>=1.3&&this._crs===He?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=L.TileLayer.prototype.getTileUrl.call(this,t);return a+c(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return i(this.wmsParams,t),e||this.redraw(),this}});dn.WMS=pn,Yt.wms=function(t,i){return new pn(t,i)};var mn=Ue.extend({options:{padding:.1,tolerance:0},initialize:function(t){l(this,t),n(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&pt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,i){var e=this._map.getZoomScale(i,this._zoom),n=Pt(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,i),r=this._map.project(t,i).subtract(s),a=o.multiplyBy(-e).add(n).add(o).subtract(r);Ni?wt(this._container,a,e):Lt(this._container,a)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,i=this._map.getSize(),e=this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round();this._bounds=new P(e,e.add(i.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),fn=mn.extend({getEvents:function(){var t=mn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){mn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");V(t,"mousemove",o(this._onMouseMove,32,this),this),V(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),V(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){delete this._ctx,ut(this._container),q(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){this._redrawBounds=null;for(var t in this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){this._drawnLayers={},mn.prototype._update.call(this);var t=this._bounds,i=this._container,e=t.getSize(),n=Ki?2:1;Lt(i,t.min),i.width=n*e.x,i.height=n*e.y,i.style.width=e.x+"px",i.style.height=e.y+"px",Ki&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){mn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[n(t)]=t;var i=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=i),this._drawLast=i,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var i=t._order,e=i.next,n=i.prev;e?e.prev=n:this._drawLast=n,n?n.next=e:this._drawFirst=e,delete t._order,delete this._layers[L.stamp(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(t.options.dashArray){var i,e=t.options.dashArray.split(","),n=[];for(i=0;i')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),vn={_initContainer:function(){this._container=ht("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(mn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=gn("shape");pt(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=gn("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[n(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;ut(i),t.removeInteractiveTarget(i),delete this._layers[n(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i||(i=t._stroke=gn("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=ei(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e||(e=t._fill=gn("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){ct(t._container)},_bringToBack:function(t){_t(t._container)}},yn=Ji?gn:E,xn=mn.extend({getEvents:function(){var t=mn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=yn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=yn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ut(this._container),q(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){mn.prototype._update.call(this);var t=this._bounds,i=t.getSize(),e=this._container;this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),Lt(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update")}},_initPath:function(t){var i=t._path=yn("path");t.options.className&&pt(i,t.options.className),t.options.interactive&&pt(i,"leaflet-interactive"),this._updateStyle(t),this._layers[n(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ut(t._path),t.removeInteractiveTarget(t._path),delete this._layers[n(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,e=t.options;i&&(e.stroke?(i.setAttribute("stroke",e.color),i.setAttribute("stroke-opacity",e.opacity),i.setAttribute("stroke-width",e.weight),i.setAttribute("stroke-linecap",e.lineCap),i.setAttribute("stroke-linejoin",e.lineJoin),e.dashArray?i.setAttribute("stroke-dasharray",e.dashArray):i.removeAttribute("stroke-dasharray"),e.dashOffset?i.setAttribute("stroke-dashoffset",e.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),e.fill?(i.setAttribute("fill",e.fillColor||e.color),i.setAttribute("fill-opacity",e.fillOpacity),i.setAttribute("fill-rule",e.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,k(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,o)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){ct(t._path)},_bringToBack:function(t){_t(t._path)}});Ji&&xn.include(vn),Le.include({getRenderer:function(t){var i=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return i||(i=this._renderer=this.options.preferCanvas&&Xt()||Jt()),this.hasLayer(i)||this.addLayer(i),i},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=xn&&Jt({pane:t})||fn&&Xt({pane:t}),this._paneRenderers[t]=i),i}});var wn=en.extend({initialize:function(t,i){en.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=z(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});xn.create=yn,xn.pointsToPath=k,nn.geometryToLayer=Wt,nn.coordsToLatLng=Ht,nn.coordsToLatLngs=Ft,nn.latLngToCoords=Ut,nn.latLngsToCoords=Vt,nn.getFeature=qt,nn.asFeature=Gt,Le.mergeOptions({boxZoom:!0});var Ln=Ze.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){V(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){q(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ut(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),mi(),bt(),this._startPoint=this._map.mouseEventToContainerPoint(t),V(document,{contextmenu:Q,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ht("div","leaflet-zoom-box",this._container),pt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new P(this._point,this._startPoint),e=i.getSize();Lt(this._box,i.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ut(this._box),mt(this._container,"leaflet-crosshair")),fi(),Tt(),q(document,{contextmenu:Q,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(e(this._resetState,this),0);var i=new T(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(i).fire("boxzoomend",{boxZoomBounds:i})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Le.addInitHook("addHandler","boxZoom",Ln),Le.mergeOptions({doubleClickZoom:!0});var Pn=Ze.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,o=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(o):i.setZoomAround(t.containerPoint,o)}});Le.addInitHook("addHandler","doubleClickZoom",Pn),Le.mergeOptions({dragging:!0,inertia:!zi,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var bn=Ze.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new Be(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}pt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){mt(this._map._container,"leaflet-grab"),mt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var i=z(this._map.options.maxBounds);this._offsetLimit=b(this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(i.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(e),this._times.push(i),this._prunePositions(i)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),i=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=i.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,i){return t-(t-i)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),i=this._offsetLimit;t.xi.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,s=(n+i+e)%t-i-e,r=Math.abs(o+e)0?s:-s))-i;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(i+r):t.setZoomAround(this._lastMousePos,i+r))}});Le.addInitHook("addHandler","scrollWheelZoom",zn),Le.mergeOptions({tap:!0,tapTolerance:15});var Mn=Ze.extend({addHooks:function(){V(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){q(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if($(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var i=t.touches[0],n=i.target;this._startPos=this._newPos=new x(i.clientX,i.clientY),n.tagName&&"a"===n.tagName.toLowerCase()&&pt(n,"leaflet-active"),this._holdTimeout=setTimeout(e(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3),this._simulateEvent("mousedown",i),V(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),q(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var i=t.changedTouches[0],e=i.target;e&&e.tagName&&"a"===e.tagName.toLowerCase()&&mt(e,"leaflet-active"),this._simulateEvent("mouseup",i),this._isTapValid()&&this._simulateEvent("click",i)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var i=t.touches[0];this._newPos=new x(i.clientX,i.clientY),this._simulateEvent("mousemove",i)},_simulateEvent:function(t,i){var e=document.createEvent("MouseEvents");e._simulated=!0,i.target._simulatedClick=!0,e.initMouseEvent(t,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),i.target.dispatchEvent(e)}});Vi&&!Ui&&Le.addInitHook("addHandler","tap",Mn),Le.mergeOptions({touchZoom:Vi&&!zi,bounceAtZoomLimits:!0});var Cn=Ze.extend({addHooks:function(){pt(this._map._container,"leaflet-touch-zoom"),V(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){mt(this._map._container,"leaflet-touch-zoom"),q(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var i=this._map;if(t.touches&&2===t.touches.length&&!i._animatingZoom&&!this._zooming){var e=i.mouseEventToContainerPoint(t.touches[0]),n=i.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=i.getSize()._divideBy(2),this._startLatLng=i.containerPointToLatLng(this._centerPoint),"center"!==i.options.touchZoom&&(this._pinchStartLatLng=i.containerPointToLatLng(e.add(n)._divideBy(2))),this._startDist=e.distanceTo(n),this._startZoom=i.getZoom(),this._moved=!1,this._zooming=!0,i._stop(),V(document,"touchmove",this._onTouchMove,this),V(document,"touchend",this._onTouchEnd,this),$(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var i=this._map,n=i.mouseEventToContainerPoint(t.touches[0]),o=i.mouseEventToContainerPoint(t.touches[1]),s=n.distanceTo(o)/this._startDist;if(this._zoom=i.getScaleZoom(s,this._startZoom),!i.options.bounceAtZoomLimits&&(this._zoomi.getMaxZoom()&&s>1)&&(this._zoom=i._limitZoom(this._zoom)),"center"===i.options.touchZoom){if(this._center=this._startLatLng,1===s)return}else{var r=n._add(o)._divideBy(2)._subtract(this._centerPoint);if(1===s&&0===r.x&&0===r.y)return;this._center=i.unproject(i.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(i._moveStart(!0,!1),this._moved=!0),g(this._animRequest);var a=e(i._move,i,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=f(a,this,!0),$(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,g(this._animRequest),q(document,"touchmove",this._onTouchMove),q(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});Le.addInitHook("addHandler","touchZoom",Cn),Le.BoxZoom=Ln,Le.DoubleClickZoom=Pn,Le.Drag=bn,Le.Keyboard=Tn,Le.ScrollWheelZoom=zn,Le.Tap=Mn,Le.TouchZoom=Cn;var Zn=window.L;window.L=t,Object.freeze=$t,t.version="1.3.1+HEAD.ba6f97f",t.noConflict=function(){return window.L=Zn,this},t.Control=Pe,t.control=be,t.Browser=$i,t.Evented=ui,t.Mixin=Ee,t.Util=ai,t.Class=v,t.Handler=Ze,t.extend=i,t.bind=e,t.stamp=n,t.setOptions=l,t.DomEvent=de,t.DomUtil=xe,t.PosAnimation=we,t.Draggable=Be,t.LineUtil=Oe,t.PolyUtil=Re,t.Point=x,t.point=w,t.Bounds=P,t.bounds=b,t.Transformation=Z,t.transformation=S,t.Projection=je,t.LatLng=M,t.latLng=C,t.LatLngBounds=T,t.latLngBounds=z,t.CRS=ci,t.GeoJSON=nn,t.geoJSON=Kt,t.geoJson=sn,t.Layer=Ue,t.LayerGroup=Ve,t.layerGroup=function(t,i){return new Ve(t,i)},t.FeatureGroup=qe,t.featureGroup=function(t){return new qe(t)},t.ImageOverlay=rn,t.imageOverlay=function(t,i,e){return new rn(t,i,e)},t.VideoOverlay=an,t.videoOverlay=function(t,i,e){return new an(t,i,e)},t.DivOverlay=hn,t.Popup=un,t.popup=function(t,i){return new un(t,i)},t.Tooltip=ln,t.tooltip=function(t,i){return new ln(t,i)},t.Icon=Ge,t.icon=function(t){return new Ge(t)},t.DivIcon=cn,t.divIcon=function(t){return new cn(t)},t.Marker=Xe,t.marker=function(t,i){return new Xe(t,i)},t.TileLayer=dn,t.tileLayer=Yt,t.GridLayer=_n,t.gridLayer=function(t){return new _n(t)},t.SVG=xn,t.svg=Jt,t.Renderer=mn,t.Canvas=fn,t.canvas=Xt,t.Path=Je,t.CircleMarker=$e,t.circleMarker=function(t,i){return new $e(t,i)},t.Circle=Qe,t.circle=function(t,i,e){return new Qe(t,i,e)},t.Polyline=tn,t.polyline=function(t,i){return new tn(t,i)},t.Polygon=en,t.polygon=function(t,i){return new en(t,i)},t.Rectangle=wn,t.rectangle=function(t,i){return new wn(t,i)},t.Map=Le,t.map=function(t,i){return new Le(t,i)}}); \ No newline at end of file diff --git a/docs/reference/libs/leaflet-binding-2.2.2/leaflet.js b/docs/reference/libs/leaflet-binding-2.2.2/leaflet.js new file mode 100644 index 00000000..79dbe714 --- /dev/null +++ b/docs/reference/libs/leaflet-binding-2.2.2/leaflet.js @@ -0,0 +1,2787 @@ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i this.effectiveLength) throw new Error("Row argument was out of bounds: " + row + " > " + this.effectiveLength); + var colIndex = -1; + + if (typeof col === "undefined") { + var rowData = {}; + this.colnames.forEach(function (name, i) { + rowData[name] = _this3.columns[i][row % _this3.columns[i].length]; + }); + return rowData; + } else if (typeof col === "string") { + colIndex = this._colIndex(col); + } else if (typeof col === "number") { + colIndex = col; + } + + if (colIndex < 0 || colIndex > this.columns.length) { + if (missingOK) return void 0;else throw new Error("Unknown column index: " + col); + } + + return this.columns[colIndex][row % this.columns[colIndex].length]; + } + }, { + key: "nrow", + value: function nrow() { + return this.effectiveLength; + } + }]); + + return DataFrame; +}(); + +exports["default"] = DataFrame; + + +},{"./util":17}],5:[function(require,module,exports){ +"use strict"; + +var _leaflet = require("./global/leaflet"); + +var _leaflet2 = _interopRequireDefault(_leaflet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +// In RMarkdown's self-contained mode, we don't have a way to carry around the +// images that Leaflet needs but doesn't load into the page. Instead, we'll use +// the unpkg CDN. +if (typeof _leaflet2["default"].Icon.Default.imagePath === "undefined") { + _leaflet2["default"].Icon.Default.imagePath = "https://unpkg.com/leaflet@1.3.1/dist/images/"; +} + + +},{"./global/leaflet":10}],6:[function(require,module,exports){ +"use strict"; + +var _leaflet = require("./global/leaflet"); + +var _leaflet2 = _interopRequireDefault(_leaflet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +// add texxtsize, textOnly, and style +_leaflet2["default"].Tooltip.prototype.options.textsize = "10px"; +_leaflet2["default"].Tooltip.prototype.options.textOnly = false; +_leaflet2["default"].Tooltip.prototype.options.style = null; // copy original layout to not completely stomp it. + +var initLayoutOriginal = _leaflet2["default"].Tooltip.prototype._initLayout; + +_leaflet2["default"].Tooltip.prototype._initLayout = function () { + initLayoutOriginal.call(this); + this._container.style.fontSize = this.options.textsize; + + if (this.options.textOnly) { + _leaflet2["default"].DomUtil.addClass(this._container, "leaflet-tooltip-text-only"); + } + + if (this.options.style) { + for (var property in this.options.style) { + this._container.style[property] = this.options.style[property]; + } + } +}; + + +},{"./global/leaflet":10}],7:[function(require,module,exports){ +"use strict"; + +var _leaflet = require("./global/leaflet"); + +var _leaflet2 = _interopRequireDefault(_leaflet); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var protocolRegex = /^\/\//; + +var upgrade_protocol = function upgrade_protocol(urlTemplate) { + if (protocolRegex.test(urlTemplate)) { + if (window.location.protocol === "file:") { + // if in a local file, support http + // http should auto upgrade if necessary + urlTemplate = "http:" + urlTemplate; + } + } + + return urlTemplate; +}; + +var originalLTileLayerInitialize = _leaflet2["default"].TileLayer.prototype.initialize; + +_leaflet2["default"].TileLayer.prototype.initialize = function (urlTemplate, options) { + urlTemplate = upgrade_protocol(urlTemplate); + originalLTileLayerInitialize.call(this, urlTemplate, options); +}; + +var originalLTileLayerWMSInitialize = _leaflet2["default"].TileLayer.WMS.prototype.initialize; + +_leaflet2["default"].TileLayer.WMS.prototype.initialize = function (urlTemplate, options) { + urlTemplate = upgrade_protocol(urlTemplate); + originalLTileLayerWMSInitialize.call(this, urlTemplate, options); +}; + + +},{"./global/leaflet":10}],8:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = global.HTMLWidgets; + + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],9:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = global.jQuery; + + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = global.L; + + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],11:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = global.L.Proj; + + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],12:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = global.Shiny; + + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],13:[function(require,module,exports){ +"use strict"; + +var _jquery = require("./global/jquery"); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _leaflet = require("./global/leaflet"); + +var _leaflet2 = _interopRequireDefault(_leaflet); + +var _shiny = require("./global/shiny"); + +var _shiny2 = _interopRequireDefault(_shiny); + +var _htmlwidgets = require("./global/htmlwidgets"); + +var _htmlwidgets2 = _interopRequireDefault(_htmlwidgets); + +var _util = require("./util"); + +var _crs_utils = require("./crs_utils"); + +var _controlStore = require("./control-store"); + +var _controlStore2 = _interopRequireDefault(_controlStore); + +var _layerManager = require("./layer-manager"); + +var _layerManager2 = _interopRequireDefault(_layerManager); + +var _methods = require("./methods"); + +var _methods2 = _interopRequireDefault(_methods); + +require("./fixup-default-icon"); + +require("./fixup-default-tooltip"); + +require("./fixup-url-protocol"); + +var _dataframe = require("./dataframe"); + +var _dataframe2 = _interopRequireDefault(_dataframe); + +var _clusterLayerStore = require("./cluster-layer-store"); + +var _clusterLayerStore2 = _interopRequireDefault(_clusterLayerStore); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +window.LeafletWidget = {}; +window.LeafletWidget.utils = {}; + +var methods = window.LeafletWidget.methods = _jquery2["default"].extend({}, _methods2["default"]); + +window.LeafletWidget.DataFrame = _dataframe2["default"]; +window.LeafletWidget.ClusterLayerStore = _clusterLayerStore2["default"]; +window.LeafletWidget.utils.getCRS = _crs_utils.getCRS; // Send updated bounds back to app. Takes a leaflet event object as input. + +function updateBounds(map) { + var id = map.getContainer().id; + var bounds = map.getBounds(); + + _shiny2["default"].onInputChange(id + "_bounds", { + north: bounds.getNorthEast().lat, + east: bounds.getNorthEast().lng, + south: bounds.getSouthWest().lat, + west: bounds.getSouthWest().lng + }); + + _shiny2["default"].onInputChange(id + "_center", { + lng: map.getCenter().lng, + lat: map.getCenter().lat + }); + + _shiny2["default"].onInputChange(id + "_zoom", map.getZoom()); +} + +function preventUnintendedZoomOnScroll(map) { + // Prevent unwanted scroll capturing. Similar in purpose to + // https://github.com/CliffCloud/Leaflet.Sleep but with a + // different set of heuristics. + // The basic idea is that when a mousewheel/DOMMouseScroll + // event is seen, we disable scroll wheel zooming until the + // user moves their mouse cursor or clicks on the map. This + // is slightly trickier than just listening for mousemove, + // because mousemove is fired when the page is scrolled, + // even if the user did not physically move the mouse. We + // handle this by examining the mousemove event's screenX + // and screenY properties; if they change, we know it's a + // "true" move. + // lastScreen can never be null, but its x and y can. + var lastScreen = { + x: null, + y: null + }; + (0, _jquery2["default"])(document).on("mousewheel DOMMouseScroll", "*", function (e) { + // Disable zooming (until the mouse moves or click) + map.scrollWheelZoom.disable(); // Any mousemove events at this screen position will be ignored. + + lastScreen = { + x: e.originalEvent.screenX, + y: e.originalEvent.screenY + }; + }); + (0, _jquery2["default"])(document).on("mousemove", "*", function (e) { + // Did the mouse really move? + if (map.options.scrollWheelZoom) { + if (lastScreen.x !== null && e.screenX !== lastScreen.x || e.screenY !== lastScreen.y) { + // It really moved. Enable zooming. + map.scrollWheelZoom.enable(); + lastScreen = { + x: null, + y: null + }; + } + } + }); + (0, _jquery2["default"])(document).on("mousedown", ".leaflet", function (e) { + // Clicking always enables zooming. + if (map.options.scrollWheelZoom) { + map.scrollWheelZoom.enable(); + lastScreen = { + x: null, + y: null + }; + } + }); +} + +_htmlwidgets2["default"].widget({ + name: "leaflet", + type: "output", + factory: function factory(el, width, height) { + var map = null; + return { + // we need to store our map in our returned object. + getMap: function getMap() { + return map; + }, + renderValue: function renderValue(data) { + // Create an appropriate CRS Object if specified + if (data && data.options && data.options.crs) { + data.options.crs = (0, _crs_utils.getCRS)(data.options.crs); + } // As per https://github.com/rstudio/leaflet/pull/294#discussion_r79584810 + + + if (map) { + map.remove(); + + map = function () { + return; + }(); // undefine map + + } + + if (data.options.mapFactory && typeof data.options.mapFactory === "function") { + map = data.options.mapFactory(el, data.options); + } else { + map = _leaflet2["default"].map(el, data.options); + } + + preventUnintendedZoomOnScroll(map); // Store some state in the map object + + map.leafletr = { + // Has the map ever rendered successfully? + hasRendered: false, + // Data to be rendered when resize is called with area != 0 + pendingRenderData: null + }; // Check if the map is rendered statically (no output binding) + + if (_htmlwidgets2["default"].shinyMode && /\bshiny-bound-output\b/.test(el.className)) { + map.id = el.id; // Store the map on the element so we can find it later by ID + + (0, _jquery2["default"])(el).data("leaflet-map", map); // When the map is clicked, send the coordinates back to the app + + map.on("click", function (e) { + _shiny2["default"].onInputChange(map.id + "_click", { + lat: e.latlng.lat, + lng: e.latlng.lng, + ".nonce": Math.random() // Force reactivity if lat/lng hasn't changed + + }); + }); + var groupTimerId = null; + map.on("moveend", function (e) { + updateBounds(e.target); + }).on("layeradd layerremove", function (e) { + // If the layer that's coming or going is a group we created, tell + // the server. + if (map.layerManager.getGroupNameFromLayerGroup(e.layer)) { + // But to avoid chattiness, coalesce events + if (groupTimerId) { + clearTimeout(groupTimerId); + groupTimerId = null; + } + + groupTimerId = setTimeout(function () { + groupTimerId = null; + + _shiny2["default"].onInputChange(map.id + "_groups", map.layerManager.getVisibleGroups()); + }, 100); + } + }); + } + + this.doRenderValue(data, map); + }, + doRenderValue: function doRenderValue(data, map) { + // Leaflet does not behave well when you set up a bunch of layers when + // the map is not visible (width/height == 0). Popups get misaligned + // relative to their owning markers, and the fitBounds calculations + // are off. Therefore we wait until the map is actually showing to + // render the value (we rely on the resize() callback being invoked + // at the appropriate time). + if (el.offsetWidth === 0 || el.offsetHeight === 0) { + map.leafletr.pendingRenderData = data; + return; + } + + map.leafletr.pendingRenderData = null; // Merge data options into defaults + + var options = _jquery2["default"].extend({ + zoomToLimits: "always" + }, data.options); + + if (!map.layerManager) { + map.controls = new _controlStore2["default"](map); + map.layerManager = new _layerManager2["default"](map); + } else { + map.controls.clear(); + map.layerManager.clear(); + } + + var explicitView = false; + + if (data.setView) { + explicitView = true; + map.setView.apply(map, data.setView); + } + + if (data.fitBounds) { + explicitView = true; + methods.fitBounds.apply(map, data.fitBounds); + } + + if (data.flyTo) { + if (!explicitView && !map.leafletr.hasRendered) { + // must be done to give a initial starting point + map.fitWorld(); + } + + explicitView = true; + map.flyTo.apply(map, data.flyTo); + } + + if (data.flyToBounds) { + if (!explicitView && !map.leafletr.hasRendered) { + // must be done to give a initial starting point + map.fitWorld(); + } + + explicitView = true; + methods.flyToBounds.apply(map, data.flyToBounds); + } + + if (data.options.center) { + explicitView = true; + } // Returns true if the zoomToLimits option says that the map should be + // zoomed to map elements. + + + function needsZoom() { + return options.zoomToLimits === "always" || options.zoomToLimits === "first" && !map.leafletr.hasRendered; + } + + if (!explicitView && needsZoom() && !map.getZoom()) { + if (data.limits && !_jquery2["default"].isEmptyObject(data.limits)) { + // Use the natural limits of what's being drawn on the map + // If the size of the bounding box is 0, leaflet gets all weird + var pad = 0.006; + + if (data.limits.lat[0] === data.limits.lat[1]) { + data.limits.lat[0] = data.limits.lat[0] - pad; + data.limits.lat[1] = data.limits.lat[1] + pad; + } + + if (data.limits.lng[0] === data.limits.lng[1]) { + data.limits.lng[0] = data.limits.lng[0] - pad; + data.limits.lng[1] = data.limits.lng[1] + pad; + } + + map.fitBounds([[data.limits.lat[0], data.limits.lng[0]], [data.limits.lat[1], data.limits.lng[1]]]); + } else { + map.fitWorld(); + } + } + + for (var i = 0; data.calls && i < data.calls.length; i++) { + var call = data.calls[i]; + if (methods[call.method]) methods[call.method].apply(map, call.args);else (0, _util.log)("Unknown method " + call.method); + } + + map.leafletr.hasRendered = true; + + if (_htmlwidgets2["default"].shinyMode) { + setTimeout(function () { + updateBounds(map); + }, 1); + } + }, + resize: function resize(width, height) { + if (map) { + map.invalidateSize(); + + if (map.leafletr.pendingRenderData) { + this.doRenderValue(map.leafletr.pendingRenderData, map); + } + } + } + }; + } +}); + +if (_htmlwidgets2["default"].shinyMode) { + _shiny2["default"].addCustomMessageHandler("leaflet-calls", function (data) { + var id = data.id; + var el = document.getElementById(id); + var map = el ? (0, _jquery2["default"])(el).data("leaflet-map") : null; + + if (!map) { + (0, _util.log)("Couldn't find map with id " + id); + return; + } // If the map has not rendered, stash the proposed `leafletProxy()` calls + // in `pendingRenderData.calls` to be run on display via `doRenderValue()`. + // This is necessary if the map has not been rendered. + // If new pendingRenderData is set via a new `leaflet()`, the previous calls will be discarded. + + + if (!map.leafletr.hasRendered) { + map.leafletr.pendingRenderData.calls = map.leafletr.pendingRenderData.calls.concat(data.calls); + return; + } + + for (var i = 0; i < data.calls.length; i++) { + var call = data.calls[i]; + var args = call.args; + + for (var _i = 0; _i < call.evals.length; _i++) { + window.HTMLWidgets.evaluateStringMember(args, call.evals[_i]); + } + + if (call.dependencies) { + _shiny2["default"].renderDependencies(call.dependencies); + } + + if (methods[call.method]) methods[call.method].apply(map, args);else (0, _util.log)("Unknown method " + call.method); + } + }); +} + + +},{"./cluster-layer-store":1,"./control-store":2,"./crs_utils":3,"./dataframe":4,"./fixup-default-icon":5,"./fixup-default-tooltip":6,"./fixup-url-protocol":7,"./global/htmlwidgets":8,"./global/jquery":9,"./global/leaflet":10,"./global/shiny":12,"./layer-manager":14,"./methods":15,"./util":17}],14:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = undefined; + +var _jquery = require("./global/jquery"); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _leaflet = require("./global/leaflet"); + +var _leaflet2 = _interopRequireDefault(_leaflet); + +var _util = require("./util"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var LayerManager = /*#__PURE__*/function () { + function LayerManager(map) { + _classCallCheck(this, LayerManager); + + this._map = map; // BEGIN layer indices + // {: {: layer}} + + this._byGroup = {}; // {: {: layer}} + + this._byCategory = {}; // {: layer} + + this._byLayerId = {}; // {: { + // "group": , + // "layerId": , + // "category": , + // "container": + // } + // } + + this._byStamp = {}; // {: {: [, , ...], ...}} + + this._byCrosstalkGroup = {}; // END layer indices + // {: L.layerGroup} + + this._categoryContainers = {}; // {: L.layerGroup} + + this._groupContainers = {}; + } + + _createClass(LayerManager, [{ + key: "addLayer", + value: function addLayer(layer, category, layerId, group, ctGroup, ctKey) { + var _this = this; + + // Was a group provided? + var hasId = typeof layerId === "string"; + var grouped = typeof group === "string"; + var stamp = _leaflet2["default"].Util.stamp(layer) + ""; // This will be the default layer group to add the layer to. + // We may overwrite this let before using it (i.e. if a group is assigned). + // This one liner creates the _categoryContainers[category] entry if it + // doesn't already exist. + + var container = this._categoryContainers[category] = this._categoryContainers[category] || _leaflet2["default"].layerGroup().addTo(this._map); + + var oldLayer = null; + + if (hasId) { + // First, remove any layer with the same category and layerId + var prefixedLayerId = this._layerIdKey(category, layerId); + + oldLayer = this._byLayerId[prefixedLayerId]; + + if (oldLayer) { + this._removeLayer(oldLayer); + } // Update layerId index + + + this._byLayerId[prefixedLayerId] = layer; + } // Update group index + + + if (grouped) { + this._byGroup[group] = this._byGroup[group] || {}; + this._byGroup[group][stamp] = layer; // Since a group is assigned, don't add the layer to the category's layer + // group; instead, use the group's layer group. + // This one liner creates the _groupContainers[group] entry if it doesn't + // already exist. + + container = this.getLayerGroup(group, true); + } // Update category index + + + this._byCategory[category] = this._byCategory[category] || {}; + this._byCategory[category][stamp] = layer; // Update stamp index + + var layerInfo = this._byStamp[stamp] = { + layer: layer, + group: group, + ctGroup: ctGroup, + ctKey: ctKey, + layerId: layerId, + category: category, + container: container, + hidden: false + }; // Update crosstalk group index + + if (ctGroup) { + if (layer.setStyle) { + // Need to save this info so we know what to set opacity to later + layer.options.origOpacity = typeof layer.options.opacity !== "undefined" ? layer.options.opacity : 0.5; + layer.options.origFillOpacity = typeof layer.options.fillOpacity !== "undefined" ? layer.options.fillOpacity : 0.2; + } + + var ctg = this._byCrosstalkGroup[ctGroup]; + + if (!ctg) { + ctg = this._byCrosstalkGroup[ctGroup] = {}; + var crosstalk = global.crosstalk; + + var handleFilter = function handleFilter(e) { + if (!e.value) { + var groupKeys = Object.keys(ctg); + + for (var i = 0; i < groupKeys.length; i++) { + var key = groupKeys[i]; + var _layerInfo = _this._byStamp[ctg[key]]; + + _this._setVisibility(_layerInfo, true); + } + } else { + var selectedKeys = {}; + + for (var _i = 0; _i < e.value.length; _i++) { + selectedKeys[e.value[_i]] = true; + } + + var _groupKeys = Object.keys(ctg); + + for (var _i2 = 0; _i2 < _groupKeys.length; _i2++) { + var _key = _groupKeys[_i2]; + var _layerInfo2 = _this._byStamp[ctg[_key]]; + + _this._setVisibility(_layerInfo2, selectedKeys[_groupKeys[_i2]]); + } + } + }; + + var filterHandle = new crosstalk.FilterHandle(ctGroup); + filterHandle.on("change", handleFilter); + + var handleSelection = function handleSelection(e) { + if (!e.value || !e.value.length) { + var groupKeys = Object.keys(ctg); + + for (var i = 0; i < groupKeys.length; i++) { + var key = groupKeys[i]; + var _layerInfo3 = _this._byStamp[ctg[key]]; + + _this._setOpacity(_layerInfo3, 1.0); + } + } else { + var selectedKeys = {}; + + for (var _i3 = 0; _i3 < e.value.length; _i3++) { + selectedKeys[e.value[_i3]] = true; + } + + var _groupKeys2 = Object.keys(ctg); + + for (var _i4 = 0; _i4 < _groupKeys2.length; _i4++) { + var _key2 = _groupKeys2[_i4]; + var _layerInfo4 = _this._byStamp[ctg[_key2]]; + + _this._setOpacity(_layerInfo4, selectedKeys[_groupKeys2[_i4]] ? 1.0 : 0.2); + } + } + }; + + var selHandle = new crosstalk.SelectionHandle(ctGroup); + selHandle.on("change", handleSelection); + setTimeout(function () { + handleFilter({ + value: filterHandle.filteredKeys + }); + handleSelection({ + value: selHandle.value + }); + }, 100); + } + + if (!ctg[ctKey]) ctg[ctKey] = []; + ctg[ctKey].push(stamp); + } // Add to container + + + if (!layerInfo.hidden) container.addLayer(layer); + return oldLayer; + } + }, { + key: "brush", + value: function brush(bounds, extraInfo) { + var _this2 = this; + + /* eslint-disable no-console */ + // For each Crosstalk group... + Object.keys(this._byCrosstalkGroup).forEach(function (ctGroupName) { + var ctg = _this2._byCrosstalkGroup[ctGroupName]; + var selection = []; // ...iterate over each Crosstalk key (each of which may have multiple + // layers)... + + Object.keys(ctg).forEach(function (ctKey) { + // ...and for each layer... + ctg[ctKey].forEach(function (stamp) { + var layerInfo = _this2._byStamp[stamp]; // ...if it's something with a point... + + if (layerInfo.layer.getLatLng) { + // ... and it's inside the selection bounds... + // TODO: Use pixel containment, not lat/lng containment + if (bounds.contains(layerInfo.layer.getLatLng())) { + // ...add the key to the selection. + selection.push(ctKey); + } + } + }); + }); + new global.crosstalk.SelectionHandle(ctGroupName).set(selection, extraInfo); + }); + } + }, { + key: "unbrush", + value: function unbrush(extraInfo) { + Object.keys(this._byCrosstalkGroup).forEach(function (ctGroupName) { + new global.crosstalk.SelectionHandle(ctGroupName).clear(extraInfo); + }); + } + }, { + key: "_setVisibility", + value: function _setVisibility(layerInfo, visible) { + if (layerInfo.hidden ^ visible) { + return; + } else if (visible) { + layerInfo.container.addLayer(layerInfo.layer); + layerInfo.hidden = false; + } else { + layerInfo.container.removeLayer(layerInfo.layer); + layerInfo.hidden = true; + } + } + }, { + key: "_setOpacity", + value: function _setOpacity(layerInfo, opacity) { + if (layerInfo.layer.setOpacity) { + layerInfo.layer.setOpacity(opacity); + } else if (layerInfo.layer.setStyle) { + layerInfo.layer.setStyle({ + opacity: opacity * layerInfo.layer.options.origOpacity, + fillOpacity: opacity * layerInfo.layer.options.origFillOpacity + }); + } + } + }, { + key: "getLayer", + value: function getLayer(category, layerId) { + return this._byLayerId[this._layerIdKey(category, layerId)]; + } + }, { + key: "removeLayer", + value: function removeLayer(category, layerIds) { + var _this3 = this; + + // Find layer info + _jquery2["default"].each((0, _util.asArray)(layerIds), function (i, layerId) { + var layer = _this3._byLayerId[_this3._layerIdKey(category, layerId)]; + + if (layer) { + _this3._removeLayer(layer); + } + }); + } + }, { + key: "clearLayers", + value: function clearLayers(category) { + var _this4 = this; + + // Find all layers in _byCategory[category] + var catTable = this._byCategory[category]; + + if (!catTable) { + return false; + } // Remove all layers. Make copy of keys to avoid mutating the collection + // behind the iterator you're accessing. + + + var stamps = []; + + _jquery2["default"].each(catTable, function (k, v) { + stamps.push(k); + }); + + _jquery2["default"].each(stamps, function (i, stamp) { + _this4._removeLayer(stamp); + }); + } + }, { + key: "getLayerGroup", + value: function getLayerGroup(group, ensureExists) { + var g = this._groupContainers[group]; + + if (ensureExists && !g) { + this._byGroup[group] = this._byGroup[group] || {}; + g = this._groupContainers[group] = _leaflet2["default"].featureGroup(); + g.groupname = group; + g.addTo(this._map); + } + + return g; + } + }, { + key: "getGroupNameFromLayerGroup", + value: function getGroupNameFromLayerGroup(layerGroup) { + return layerGroup.groupname; + } + }, { + key: "getVisibleGroups", + value: function getVisibleGroups() { + var _this5 = this; + + var result = []; + + _jquery2["default"].each(this._groupContainers, function (k, v) { + if (_this5._map.hasLayer(v)) { + result.push(k); + } + }); + + return result; + } + }, { + key: "getAllGroupNames", + value: function getAllGroupNames() { + var result = []; + + _jquery2["default"].each(this._groupContainers, function (k, v) { + result.push(k); + }); + + return result; + } + }, { + key: "clearGroup", + value: function clearGroup(group) { + var _this6 = this; + + // Find all layers in _byGroup[group] + var groupTable = this._byGroup[group]; + + if (!groupTable) { + return false; + } // Remove all layers. Make copy of keys to avoid mutating the collection + // behind the iterator you're accessing. + + + var stamps = []; + + _jquery2["default"].each(groupTable, function (k, v) { + stamps.push(k); + }); + + _jquery2["default"].each(stamps, function (i, stamp) { + _this6._removeLayer(stamp); + }); + } + }, { + key: "clear", + value: function clear() { + function clearLayerGroup(key, layerGroup) { + layerGroup.clearLayers(); + } // Clear all indices and layerGroups + + + this._byGroup = {}; + this._byCategory = {}; + this._byLayerId = {}; + this._byStamp = {}; + this._byCrosstalkGroup = {}; + + _jquery2["default"].each(this._categoryContainers, clearLayerGroup); + + this._categoryContainers = {}; + + _jquery2["default"].each(this._groupContainers, clearLayerGroup); + + this._groupContainers = {}; + } + }, { + key: "_removeLayer", + value: function _removeLayer(layer) { + var stamp; + + if (typeof layer === "string") { + stamp = layer; + } else { + stamp = _leaflet2["default"].Util.stamp(layer); + } + + var layerInfo = this._byStamp[stamp]; + + if (!layerInfo) { + return false; + } + + layerInfo.container.removeLayer(stamp); + + if (typeof layerInfo.group === "string") { + delete this._byGroup[layerInfo.group][stamp]; + } + + if (typeof layerInfo.layerId === "string") { + delete this._byLayerId[this._layerIdKey(layerInfo.category, layerInfo.layerId)]; + } + + delete this._byCategory[layerInfo.category][stamp]; + delete this._byStamp[stamp]; + + if (layerInfo.ctGroup) { + var ctGroup = this._byCrosstalkGroup[layerInfo.ctGroup]; + var layersForKey = ctGroup[layerInfo.ctKey]; + var idx = layersForKey ? layersForKey.indexOf(stamp) : -1; + + if (idx >= 0) { + if (layersForKey.length === 1) { + delete ctGroup[layerInfo.ctKey]; + } else { + layersForKey.splice(idx, 1); + } + } + } + } + }, { + key: "_layerIdKey", + value: function _layerIdKey(category, layerId) { + return category + "\n" + layerId; + } + }]); + + return LayerManager; +}(); + +exports["default"] = LayerManager; + + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./global/jquery":9,"./global/leaflet":10,"./util":17}],15:[function(require,module,exports){ +(function (global){(function (){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _jquery = require("./global/jquery"); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _leaflet = require("./global/leaflet"); + +var _leaflet2 = _interopRequireDefault(_leaflet); + +var _shiny = require("./global/shiny"); + +var _shiny2 = _interopRequireDefault(_shiny); + +var _htmlwidgets = require("./global/htmlwidgets"); + +var _htmlwidgets2 = _interopRequireDefault(_htmlwidgets); + +var _util = require("./util"); + +var _crs_utils = require("./crs_utils"); + +var _dataframe = require("./dataframe"); + +var _dataframe2 = _interopRequireDefault(_dataframe); + +var _clusterLayerStore = require("./cluster-layer-store"); + +var _clusterLayerStore2 = _interopRequireDefault(_clusterLayerStore); + +var _mipmapper = require("./mipmapper"); + +var _mipmapper2 = _interopRequireDefault(_mipmapper); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var methods = {}; +exports["default"] = methods; + +function mouseHandler(mapId, layerId, group, eventName, extraInfo) { + return function (e) { + if (!_htmlwidgets2["default"].shinyMode) return; + var latLng = e.target.getLatLng ? e.target.getLatLng() : e.latlng; + + if (latLng) { + // retrieve only lat, lon values to remove prototype + // and extra parameters added by 3rd party modules + // these objects are for json serialization, not javascript + var latLngVal = _leaflet2["default"].latLng(latLng); // make sure it has consistent shape + + + latLng = { + lat: latLngVal.lat, + lng: latLngVal.lng + }; + } + + var eventInfo = _jquery2["default"].extend({ + id: layerId, + ".nonce": Math.random() // force reactivity + + }, group !== null ? { + group: group + } : null, latLng, extraInfo); + + _shiny2["default"].onInputChange(mapId + "_" + eventName, eventInfo); + }; +} + +methods.mouseHandler = mouseHandler; + +methods.clearGroup = function (group) { + var _this = this; + + _jquery2["default"].each((0, _util.asArray)(group), function (i, v) { + _this.layerManager.clearGroup(v); + }); +}; + +methods.setView = function (center, zoom, options) { + this.setView(center, zoom, options); +}; + +methods.fitBounds = function (lat1, lng1, lat2, lng2, options) { + this.fitBounds([[lat1, lng1], [lat2, lng2]], options); +}; + +methods.flyTo = function (center, zoom, options) { + this.flyTo(center, zoom, options); +}; + +methods.flyToBounds = function (lat1, lng1, lat2, lng2, options) { + this.flyToBounds([[lat1, lng1], [lat2, lng2]], options); +}; + +methods.setMaxBounds = function (lat1, lng1, lat2, lng2) { + this.setMaxBounds([[lat1, lng1], [lat2, lng2]]); +}; + +methods.addPopups = function (lat, lng, popup, layerId, group, options) { + var _this2 = this; + + var df = new _dataframe2["default"]().col("lat", lat).col("lng", lng).col("popup", popup).col("layerId", layerId).col("group", group).cbind(options); + + var _loop = function _loop(i) { + if (_jquery2["default"].isNumeric(df.get(i, "lat")) && _jquery2["default"].isNumeric(df.get(i, "lng"))) { + (function () { + var popup = _leaflet2["default"].popup(df.get(i)).setLatLng([df.get(i, "lat"), df.get(i, "lng")]).setContent(df.get(i, "popup")); + + var thisId = df.get(i, "layerId"); + var thisGroup = df.get(i, "group"); + this.layerManager.addLayer(popup, "popup", thisId, thisGroup); + }).call(_this2); + } + }; + + for (var i = 0; i < df.nrow(); i++) { + _loop(i); + } +}; + +methods.removePopup = function (layerId) { + this.layerManager.removeLayer("popup", layerId); +}; + +methods.clearPopups = function () { + this.layerManager.clearLayers("popup"); +}; + +methods.addTiles = function (urlTemplate, layerId, group, options) { + this.layerManager.addLayer(_leaflet2["default"].tileLayer(urlTemplate, options), "tile", layerId, group); +}; + +methods.removeTiles = function (layerId) { + this.layerManager.removeLayer("tile", layerId); +}; + +methods.clearTiles = function () { + this.layerManager.clearLayers("tile"); +}; + +methods.addWMSTiles = function (baseUrl, layerId, group, options) { + if (options && options.crs) { + options.crs = (0, _crs_utils.getCRS)(options.crs); + } + + this.layerManager.addLayer(_leaflet2["default"].tileLayer.wms(baseUrl, options), "tile", layerId, group); +}; // Given: +// {data: ["a", "b", "c"], index: [0, 1, 0, 2]} +// returns: +// ["a", "b", "a", "c"] + + +function unpackStrings(iconset) { + if (!iconset) { + return iconset; + } + + if (typeof iconset.index === "undefined") { + return iconset; + } + + iconset.data = (0, _util.asArray)(iconset.data); + iconset.index = (0, _util.asArray)(iconset.index); + return _jquery2["default"].map(iconset.index, function (e, i) { + return iconset.data[e]; + }); +} + +function addMarkers(map, df, group, clusterOptions, clusterId, markerFunc) { + (function () { + var _this3 = this; + + var clusterGroup = this.layerManager.getLayer("cluster", clusterId), + cluster = clusterOptions !== null; + + if (cluster && !clusterGroup) { + clusterGroup = _leaflet2["default"].markerClusterGroup.layerSupport(clusterOptions); + + if (clusterOptions.freezeAtZoom) { + var freezeAtZoom = clusterOptions.freezeAtZoom; + delete clusterOptions.freezeAtZoom; + clusterGroup.freezeAtZoom(freezeAtZoom); + } + + clusterGroup.clusterLayerStore = new _clusterLayerStore2["default"](clusterGroup); + } + + var extraInfo = cluster ? { + clusterId: clusterId + } : {}; + + var _loop2 = function _loop2(i) { + if (_jquery2["default"].isNumeric(df.get(i, "lat")) && _jquery2["default"].isNumeric(df.get(i, "lng"))) { + (function () { + var marker = markerFunc(df, i); + var thisId = df.get(i, "layerId"); + var thisGroup = cluster ? null : df.get(i, "group"); + + if (cluster) { + clusterGroup.clusterLayerStore.add(marker, thisId); + } else { + this.layerManager.addLayer(marker, "marker", thisId, thisGroup, df.get(i, "ctGroup", true), df.get(i, "ctKey", true)); + } + + var popup = df.get(i, "popup"); + var popupOptions = df.get(i, "popupOptions"); + + if (popup !== null) { + if (popupOptions !== null) { + marker.bindPopup(popup, popupOptions); + } else { + marker.bindPopup(popup); + } + } + + var label = df.get(i, "label"); + var labelOptions = df.get(i, "labelOptions"); + + if (label !== null) { + if (labelOptions !== null) { + if (labelOptions.permanent) { + marker.bindTooltip(label, labelOptions).openTooltip(); + } else { + marker.bindTooltip(label, labelOptions); + } + } else { + marker.bindTooltip(label); + } + } + + marker.on("click", mouseHandler(this.id, thisId, thisGroup, "marker_click", extraInfo), this); + marker.on("mouseover", mouseHandler(this.id, thisId, thisGroup, "marker_mouseover", extraInfo), this); + marker.on("mouseout", mouseHandler(this.id, thisId, thisGroup, "marker_mouseout", extraInfo), this); + marker.on("dragend", mouseHandler(this.id, thisId, thisGroup, "marker_dragend", extraInfo), this); + }).call(_this3); + } + }; + + for (var i = 0; i < df.nrow(); i++) { + _loop2(i); + } + + if (cluster) { + this.layerManager.addLayer(clusterGroup, "cluster", clusterId, group); + } + }).call(map); +} + +methods.addGenericMarkers = addMarkers; + +methods.addMarkers = function (lat, lng, icon, layerId, group, options, popup, popupOptions, clusterOptions, clusterId, label, labelOptions, crosstalkOptions) { + var icondf; + var getIcon; + + if (icon) { + // Unpack icons + icon.iconUrl = unpackStrings(icon.iconUrl); + icon.iconRetinaUrl = unpackStrings(icon.iconRetinaUrl); + icon.shadowUrl = unpackStrings(icon.shadowUrl); + icon.shadowRetinaUrl = unpackStrings(icon.shadowRetinaUrl); // This cbinds the icon URLs and any other icon options; they're all + // present on the icon object. + + icondf = new _dataframe2["default"]().cbind(icon); // Constructs an icon from a specified row of the icon dataframe. + + getIcon = function getIcon(i) { + var opts = icondf.get(i); + + if (!opts.iconUrl) { + return new _leaflet2["default"].Icon.Default(); + } // Composite options (like points or sizes) are passed from R with each + // individual component as its own option. We need to combine them now + // into their composite form. + + + if (opts.iconWidth) { + opts.iconSize = [opts.iconWidth, opts.iconHeight]; + } + + if (opts.shadowWidth) { + opts.shadowSize = [opts.shadowWidth, opts.shadowHeight]; + } + + if (opts.iconAnchorX) { + opts.iconAnchor = [opts.iconAnchorX, opts.iconAnchorY]; + } + + if (opts.shadowAnchorX) { + opts.shadowAnchor = [opts.shadowAnchorX, opts.shadowAnchorY]; + } + + if (opts.popupAnchorX) { + opts.popupAnchor = [opts.popupAnchorX, opts.popupAnchorY]; + } + + return new _leaflet2["default"].Icon(opts); + }; + } + + if (!(_jquery2["default"].isEmptyObject(lat) || _jquery2["default"].isEmptyObject(lng)) || _jquery2["default"].isNumeric(lat) && _jquery2["default"].isNumeric(lng)) { + var df = new _dataframe2["default"]().col("lat", lat).col("lng", lng).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).cbind(options).cbind(crosstalkOptions || {}); + if (icon) icondf.effectiveLength = df.nrow(); + addMarkers(this, df, group, clusterOptions, clusterId, function (df, i) { + var options = df.get(i); + if (icon) options.icon = getIcon(i); + return _leaflet2["default"].marker([df.get(i, "lat"), df.get(i, "lng")], options); + }); + } +}; + +methods.addAwesomeMarkers = function (lat, lng, icon, layerId, group, options, popup, popupOptions, clusterOptions, clusterId, label, labelOptions, crosstalkOptions) { + var icondf; + var getIcon; + + if (icon) { + // This cbinds the icon URLs and any other icon options; they're all + // present on the icon object. + icondf = new _dataframe2["default"]().cbind(icon); // Constructs an icon from a specified row of the icon dataframe. + + getIcon = function getIcon(i) { + var opts = icondf.get(i); + + if (!opts) { + return new _leaflet2["default"].AwesomeMarkers.icon(); + } + + if (opts.squareMarker) { + opts.className = "awesome-marker awesome-marker-square"; + } + + return new _leaflet2["default"].AwesomeMarkers.icon(opts); + }; + } + + if (!(_jquery2["default"].isEmptyObject(lat) || _jquery2["default"].isEmptyObject(lng)) || _jquery2["default"].isNumeric(lat) && _jquery2["default"].isNumeric(lng)) { + var df = new _dataframe2["default"]().col("lat", lat).col("lng", lng).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).cbind(options).cbind(crosstalkOptions || {}); + if (icon) icondf.effectiveLength = df.nrow(); + addMarkers(this, df, group, clusterOptions, clusterId, function (df, i) { + var options = df.get(i); + if (icon) options.icon = getIcon(i); + return _leaflet2["default"].marker([df.get(i, "lat"), df.get(i, "lng")], options); + }); + } +}; + +function addLayers(map, category, df, layerFunc) { + var _loop3 = function _loop3(i) { + (function () { + var layer = layerFunc(df, i); + + if (!_jquery2["default"].isEmptyObject(layer)) { + var thisId = df.get(i, "layerId"); + var thisGroup = df.get(i, "group"); + this.layerManager.addLayer(layer, category, thisId, thisGroup, df.get(i, "ctGroup", true), df.get(i, "ctKey", true)); + + if (layer.bindPopup) { + var popup = df.get(i, "popup"); + var popupOptions = df.get(i, "popupOptions"); + + if (popup !== null) { + if (popupOptions !== null) { + layer.bindPopup(popup, popupOptions); + } else { + layer.bindPopup(popup); + } + } + } + + if (layer.bindTooltip) { + var label = df.get(i, "label"); + var labelOptions = df.get(i, "labelOptions"); + + if (label !== null) { + if (labelOptions !== null) { + layer.bindTooltip(label, labelOptions); + } else { + layer.bindTooltip(label); + } + } + } + + layer.on("click", mouseHandler(this.id, thisId, thisGroup, category + "_click"), this); + layer.on("mouseover", mouseHandler(this.id, thisId, thisGroup, category + "_mouseover"), this); + layer.on("mouseout", mouseHandler(this.id, thisId, thisGroup, category + "_mouseout"), this); + var highlightStyle = df.get(i, "highlightOptions"); + + if (!_jquery2["default"].isEmptyObject(highlightStyle)) { + var defaultStyle = {}; + + _jquery2["default"].each(highlightStyle, function (k, v) { + if (k != "bringToFront" && k != "sendToBack") { + if (df.get(i, k)) { + defaultStyle[k] = df.get(i, k); + } + } + }); + + layer.on("mouseover", function (e) { + this.setStyle(highlightStyle); + + if (highlightStyle.bringToFront) { + this.bringToFront(); + } + }); + layer.on("mouseout", function (e) { + this.setStyle(defaultStyle); + + if (highlightStyle.sendToBack) { + this.bringToBack(); + } + }); + } + } + }).call(map); + }; + + for (var i = 0; i < df.nrow(); i++) { + _loop3(i); + } +} + +methods.addGenericLayers = addLayers; + +methods.addCircles = function (lat, lng, radius, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions, crosstalkOptions) { + if (!(_jquery2["default"].isEmptyObject(lat) || _jquery2["default"].isEmptyObject(lng)) || _jquery2["default"].isNumeric(lat) && _jquery2["default"].isNumeric(lng)) { + var df = new _dataframe2["default"]().col("lat", lat).col("lng", lng).col("radius", radius).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).col("highlightOptions", highlightOptions).cbind(options).cbind(crosstalkOptions || {}); + addLayers(this, "shape", df, function (df, i) { + if (_jquery2["default"].isNumeric(df.get(i, "lat")) && _jquery2["default"].isNumeric(df.get(i, "lng")) && _jquery2["default"].isNumeric(df.get(i, "radius"))) { + return _leaflet2["default"].circle([df.get(i, "lat"), df.get(i, "lng")], df.get(i, "radius"), df.get(i)); + } else { + return null; + } + }); + } +}; + +methods.addCircleMarkers = function (lat, lng, radius, layerId, group, options, clusterOptions, clusterId, popup, popupOptions, label, labelOptions, crosstalkOptions) { + if (!(_jquery2["default"].isEmptyObject(lat) || _jquery2["default"].isEmptyObject(lng)) || _jquery2["default"].isNumeric(lat) && _jquery2["default"].isNumeric(lng)) { + var df = new _dataframe2["default"]().col("lat", lat).col("lng", lng).col("radius", radius).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).cbind(crosstalkOptions || {}).cbind(options); + addMarkers(this, df, group, clusterOptions, clusterId, function (df, i) { + return _leaflet2["default"].circleMarker([df.get(i, "lat"), df.get(i, "lng")], df.get(i)); + }); + } +}; +/* + * @param lat Array of arrays of latitude coordinates for polylines + * @param lng Array of arrays of longitude coordinates for polylines + */ + + +methods.addPolylines = function (polygons, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions) { + if (polygons.length > 0) { + var df = new _dataframe2["default"]().col("shapes", polygons).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).col("highlightOptions", highlightOptions).cbind(options); + addLayers(this, "shape", df, function (df, i) { + var shapes = df.get(i, "shapes"); + shapes = shapes.map(function (shape) { + return _htmlwidgets2["default"].dataframeToD3(shape[0]); + }); + + if (shapes.length > 1) { + return _leaflet2["default"].polyline(shapes, df.get(i)); + } else { + return _leaflet2["default"].polyline(shapes[0], df.get(i)); + } + }); + } +}; + +methods.removeMarker = function (layerId) { + this.layerManager.removeLayer("marker", layerId); +}; + +methods.clearMarkers = function () { + this.layerManager.clearLayers("marker"); +}; + +methods.removeMarkerCluster = function (layerId) { + this.layerManager.removeLayer("cluster", layerId); +}; + +methods.removeMarkerFromCluster = function (layerId, clusterId) { + var cluster = this.layerManager.getLayer("cluster", clusterId); + if (!cluster) return; + cluster.clusterLayerStore.remove(layerId); +}; + +methods.clearMarkerClusters = function () { + this.layerManager.clearLayers("cluster"); +}; + +methods.removeShape = function (layerId) { + this.layerManager.removeLayer("shape", layerId); +}; + +methods.clearShapes = function () { + this.layerManager.clearLayers("shape"); +}; + +methods.addRectangles = function (lat1, lng1, lat2, lng2, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions) { + var df = new _dataframe2["default"]().col("lat1", lat1).col("lng1", lng1).col("lat2", lat2).col("lng2", lng2).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).col("highlightOptions", highlightOptions).cbind(options); + addLayers(this, "shape", df, function (df, i) { + if (_jquery2["default"].isNumeric(df.get(i, "lat1")) && _jquery2["default"].isNumeric(df.get(i, "lng1")) && _jquery2["default"].isNumeric(df.get(i, "lat2")) && _jquery2["default"].isNumeric(df.get(i, "lng2"))) { + return _leaflet2["default"].rectangle([[df.get(i, "lat1"), df.get(i, "lng1")], [df.get(i, "lat2"), df.get(i, "lng2")]], df.get(i)); + } else { + return null; + } + }); +}; +/* + * @param lat Array of arrays of latitude coordinates for polygons + * @param lng Array of arrays of longitude coordinates for polygons + */ + + +methods.addPolygons = function (polygons, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions) { + if (polygons.length > 0) { + var df = new _dataframe2["default"]().col("shapes", polygons).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).col("highlightOptions", highlightOptions).cbind(options); + addLayers(this, "shape", df, function (df, i) { + // This code used to use L.multiPolygon, but that caused + // double-click on a multipolygon to fail to zoom in on the + // map. Surprisingly, putting all the rings in a single + // polygon seems to still work; complicated multipolygons + // are still rendered correctly. + var shapes = df.get(i, "shapes").map(function (polygon) { + return polygon.map(_htmlwidgets2["default"].dataframeToD3); + }).reduce(function (acc, val) { + return acc.concat(val); + }, []); + return _leaflet2["default"].polygon(shapes, df.get(i)); + }); + } +}; + +methods.addGeoJSON = function (data, layerId, group, style) { + // This time, self is actually needed because the callbacks below need + // to access both the inner and outer senses of "this" + var self = this; + + if (typeof data === "string") { + data = JSON.parse(data); + } + + var globalStyle = _jquery2["default"].extend({}, style, data.style || {}); + + var gjlayer = _leaflet2["default"].geoJson(data, { + style: function style(feature) { + if (feature.style || feature.properties.style) { + return _jquery2["default"].extend({}, globalStyle, feature.style, feature.properties.style); + } else { + return globalStyle; + } + }, + onEachFeature: function onEachFeature(feature, layer) { + var extraInfo = { + featureId: feature.id, + properties: feature.properties + }; + var popup = feature.properties ? feature.properties.popup : null; + if (typeof popup !== "undefined" && popup !== null) layer.bindPopup(popup); + layer.on("click", mouseHandler(self.id, layerId, group, "geojson_click", extraInfo), this); + layer.on("mouseover", mouseHandler(self.id, layerId, group, "geojson_mouseover", extraInfo), this); + layer.on("mouseout", mouseHandler(self.id, layerId, group, "geojson_mouseout", extraInfo), this); + } + }); + + this.layerManager.addLayer(gjlayer, "geojson", layerId, group); +}; + +methods.removeGeoJSON = function (layerId) { + this.layerManager.removeLayer("geojson", layerId); +}; + +methods.clearGeoJSON = function () { + this.layerManager.clearLayers("geojson"); +}; + +methods.addTopoJSON = function (data, layerId, group, style) { + // This time, self is actually needed because the callbacks below need + // to access both the inner and outer senses of "this" + var self = this; + + if (typeof data === "string") { + data = JSON.parse(data); + } + + var globalStyle = _jquery2["default"].extend({}, style, data.style || {}); + + var gjlayer = _leaflet2["default"].geoJson(null, { + style: function style(feature) { + if (feature.style || feature.properties.style) { + return _jquery2["default"].extend({}, globalStyle, feature.style, feature.properties.style); + } else { + return globalStyle; + } + }, + onEachFeature: function onEachFeature(feature, layer) { + var extraInfo = { + featureId: feature.id, + properties: feature.properties + }; + var popup = feature.properties.popup; + if (typeof popup !== "undefined" && popup !== null) layer.bindPopup(popup); + layer.on("click", mouseHandler(self.id, layerId, group, "topojson_click", extraInfo), this); + layer.on("mouseover", mouseHandler(self.id, layerId, group, "topojson_mouseover", extraInfo), this); + layer.on("mouseout", mouseHandler(self.id, layerId, group, "topojson_mouseout", extraInfo), this); + } + }); + + global.omnivore.topojson.parse(data, null, gjlayer); + this.layerManager.addLayer(gjlayer, "topojson", layerId, group); +}; + +methods.removeTopoJSON = function (layerId) { + this.layerManager.removeLayer("topojson", layerId); +}; + +methods.clearTopoJSON = function () { + this.layerManager.clearLayers("topojson"); +}; + +methods.addControl = function (html, position, layerId, classes) { + function onAdd(map) { + var div = _leaflet2["default"].DomUtil.create("div", classes); + + if (typeof layerId !== "undefined" && layerId !== null) { + div.setAttribute("id", layerId); + } + + this._div = div; // It's possible for window.Shiny to be true but Shiny.initializeInputs to + // not be, when a static leaflet widget is included as part of the shiny + // UI directly (not through leafletOutput or uiOutput). In this case we + // don't do the normal Shiny stuff as that will all happen when Shiny + // itself loads and binds the entire doc. + + if (window.Shiny && _shiny2["default"].initializeInputs) { + _shiny2["default"].renderHtml(html, this._div); + + _shiny2["default"].initializeInputs(this._div); + + _shiny2["default"].bindAll(this._div); + } else { + this._div.innerHTML = html; + } + + return this._div; + } + + function onRemove(map) { + if (window.Shiny && _shiny2["default"].unbindAll) { + _shiny2["default"].unbindAll(this._div); + } + } + + var Control = _leaflet2["default"].Control.extend({ + options: { + position: position + }, + onAdd: onAdd, + onRemove: onRemove + }); + + this.controls.add(new Control(), layerId, html); +}; + +methods.addCustomControl = function (control, layerId) { + this.controls.add(control, layerId); +}; + +methods.removeControl = function (layerId) { + this.controls.remove(layerId); +}; + +methods.getControl = function (layerId) { + this.controls.get(layerId); +}; + +methods.clearControls = function () { + this.controls.clear(); +}; + +methods.addLegend = function (options) { + var legend = _leaflet2["default"].control({ + position: options.position + }); + + var gradSpan; + + legend.onAdd = function (map) { + var div = _leaflet2["default"].DomUtil.create("div", options.className), + colors = options.colors, + labels = options.labels, + legendHTML = ""; + + if (options.type === "numeric") { + // # Formatting constants. + var singleBinHeight = 20; // The distance between tick marks, in px + + var vMargin = 8; // If 1st tick mark starts at top of gradient, how + // many extra px are needed for the top half of the + // 1st label? (ditto for last tick mark/label) + + var tickWidth = 4; // How wide should tick marks be, in px? + + var labelPadding = 6; // How much distance to reserve for tick mark? + // (Must be >= tickWidth) + // # Derived formatting parameters. + // What's the height of a single bin, in percentage (of gradient height)? + // It might not just be 1/(n-1), if the gradient extends past the tick + // marks (which can be the case for pretty cut points). + + var singleBinPct = (options.extra.p_n - options.extra.p_1) / (labels.length - 1); // Each bin is `singleBinHeight` high. How tall is the gradient? + + var totalHeight = 1 / singleBinPct * singleBinHeight + 1; // How far should the first tick be shifted down, relative to the top + // of the gradient? + + var tickOffset = singleBinHeight / singleBinPct * options.extra.p_1; + gradSpan = (0, _jquery2["default"])("").css({ + "background": "linear-gradient(" + colors + ")", + "opacity": options.opacity, + "height": totalHeight + "px", + "width": "18px", + "display": "block", + "margin-top": vMargin + "px" + }); + var leftDiv = (0, _jquery2["default"])("
    ").css("float", "left"), + rightDiv = (0, _jquery2["default"])("
    ").css("float", "left"); + leftDiv.append(gradSpan); + (0, _jquery2["default"])(div).append(leftDiv).append(rightDiv).append((0, _jquery2["default"])("
    ")); // Have to attach the div to the body at this early point, so that the + // svg text getComputedTextLength() actually works, below. + + document.body.appendChild(div); + var ns = "http://www.w3.org/2000/svg"; + var svg = document.createElementNS(ns, "svg"); + rightDiv.append(svg); + var g = document.createElementNS(ns, "g"); + (0, _jquery2["default"])(g).attr("transform", "translate(0, " + vMargin + ")"); + svg.appendChild(g); // max label width needed to set width of svg, and right-justify text + + var maxLblWidth = 0; // Create tick marks and labels + + _jquery2["default"].each(labels, function (i, label) { + var y = tickOffset + i * singleBinHeight + 0.5; + var thisLabel = document.createElementNS(ns, "text"); + (0, _jquery2["default"])(thisLabel).text(labels[i]).attr("y", y).attr("dx", labelPadding).attr("dy", "0.5ex"); + g.appendChild(thisLabel); + maxLblWidth = Math.max(maxLblWidth, thisLabel.getComputedTextLength()); + var thisTick = document.createElementNS(ns, "line"); + (0, _jquery2["default"])(thisTick).attr("x1", 0).attr("x2", tickWidth).attr("y1", y).attr("y2", y).attr("stroke-width", 1); + g.appendChild(thisTick); + }); // Now that we know the max label width, we can right-justify + + + (0, _jquery2["default"])(svg).find("text").attr("dx", labelPadding + maxLblWidth).attr("text-anchor", "end"); // Final size for + + (0, _jquery2["default"])(svg).css({ + width: maxLblWidth + labelPadding + "px", + height: totalHeight + vMargin * 2 + "px" + }); + + if (options.na_color && _jquery2["default"].inArray(options.na_label, labels) < 0) { + (0, _jquery2["default"])(div).append("
    " + options.na_label + "
    "); + } + } else { + if (options.na_color && _jquery2["default"].inArray(options.na_label, labels) < 0) { + colors.push(options.na_color); + labels.push(options.na_label); + } + + for (var i = 0; i < colors.length; i++) { + legendHTML += " " + labels[i] + "
    "; + } + + div.innerHTML = legendHTML; + } + + if (options.title) (0, _jquery2["default"])(div).prepend("
    " + options.title + "
    "); + return div; + }; + + if (options.group) { + // Auto generate a layerID if not provided + if (!options.layerId) { + options.layerId = _leaflet2["default"].Util.stamp(legend); + } + + var map = this; + map.on("overlayadd", function (e) { + if (e.name === options.group) { + map.controls.add(legend, options.layerId); + } + }); + map.on("overlayremove", function (e) { + if (e.name === options.group) { + map.controls.remove(options.layerId); + } + }); + map.on("groupadd", function (e) { + if (e.name === options.group) { + map.controls.add(legend, options.layerId); + } + }); + map.on("groupremove", function (e) { + if (e.name === options.group) { + map.controls.remove(options.layerId); + } + }); + } + + this.controls.add(legend, options.layerId); +}; + +methods.addLayersControl = function (baseGroups, overlayGroups, options) { + var _this4 = this; + + // Only allow one layers control at a time + methods.removeLayersControl.call(this); + var firstLayer = true; + var base = {}; + + _jquery2["default"].each((0, _util.asArray)(baseGroups), function (i, g) { + var layer = _this4.layerManager.getLayerGroup(g, true); + + if (layer) { + base[g] = layer; // Check if >1 base layers are visible; if so, hide all but the first one + + if (_this4.hasLayer(layer)) { + if (firstLayer) { + firstLayer = false; + } else { + _this4.removeLayer(layer); + } + } + } + }); + + var overlay = {}; + + _jquery2["default"].each((0, _util.asArray)(overlayGroups), function (i, g) { + var layer = _this4.layerManager.getLayerGroup(g, true); + + if (layer) { + overlay[g] = layer; + } + }); + + this.currentLayersControl = _leaflet2["default"].control.layers(base, overlay, options); + this.addControl(this.currentLayersControl); +}; + +methods.removeLayersControl = function () { + if (this.currentLayersControl) { + this.removeControl(this.currentLayersControl); + this.currentLayersControl = null; + } +}; + +methods.addScaleBar = function (options) { + // Only allow one scale bar at a time + methods.removeScaleBar.call(this); + + var scaleBar = _leaflet2["default"].control.scale(options).addTo(this); + + this.currentScaleBar = scaleBar; +}; + +methods.removeScaleBar = function () { + if (this.currentScaleBar) { + this.currentScaleBar.remove(); + this.currentScaleBar = null; + } +}; + +methods.hideGroup = function (group) { + var _this5 = this; + + _jquery2["default"].each((0, _util.asArray)(group), function (i, g) { + var layer = _this5.layerManager.getLayerGroup(g, true); + + if (layer) { + _this5.removeLayer(layer); + } + }); +}; + +methods.showGroup = function (group) { + var _this6 = this; + + _jquery2["default"].each((0, _util.asArray)(group), function (i, g) { + var layer = _this6.layerManager.getLayerGroup(g, true); + + if (layer) { + _this6.addLayer(layer); + } + }); +}; + +function setupShowHideGroupsOnZoom(map) { + if (map.leafletr._hasInitializedShowHideGroups) { + return; + } + + map.leafletr._hasInitializedShowHideGroups = true; + + function setVisibility(layer, visible, group) { + if (visible !== map.hasLayer(layer)) { + if (visible) { + map.addLayer(layer); + map.fire("groupadd", { + "name": group, + "layer": layer + }); + } else { + map.removeLayer(layer); + map.fire("groupremove", { + "name": group, + "layer": layer + }); + } + } + } + + function showHideGroupsOnZoom() { + if (!map.layerManager) return; + var zoom = map.getZoom(); + map.layerManager.getAllGroupNames().forEach(function (group) { + var layer = map.layerManager.getLayerGroup(group, false); + + if (layer && typeof layer.zoomLevels !== "undefined") { + setVisibility(layer, layer.zoomLevels === true || layer.zoomLevels.indexOf(zoom) >= 0, group); + } + }); + } + + map.showHideGroupsOnZoom = showHideGroupsOnZoom; + map.on("zoomend", showHideGroupsOnZoom); +} + +methods.setGroupOptions = function (group, options) { + var _this7 = this; + + _jquery2["default"].each((0, _util.asArray)(group), function (i, g) { + var layer = _this7.layerManager.getLayerGroup(g, true); // This slightly tortured check is because 0 is a valid value for zoomLevels + + + if (typeof options.zoomLevels !== "undefined" && options.zoomLevels !== null) { + layer.zoomLevels = (0, _util.asArray)(options.zoomLevels); + } + }); + + setupShowHideGroupsOnZoom(this); + this.showHideGroupsOnZoom(); +}; + +methods.addRasterImage = function (uri, bounds, layerId, group, options) { + // uri is a data URI containing an image. We want to paint this image as a + // layer at (top-left) bounds[0] to (bottom-right) bounds[1]. + // We can't simply use ImageOverlay, as it uses bilinear scaling which looks + // awful as you zoom in (and sometimes shifts positions or disappears). + // Instead, we'll use a TileLayer.Canvas to draw pieces of the image. + // First, some helper functions. + // degree2tile converts latitude, longitude, and zoom to x and y tile + // numbers. The tile numbers returned can be non-integral, as there's no + // reason to expect that the lat/lng inputs are exactly on the border of two + // tiles. + // + // We'll use this to convert the bounds we got from the server, into coords + // in tile-space at a given zoom level. Note that once we do the conversion, + // we don't to do any more trigonometry to convert between pixel coordinates + // and tile coordinates; the source image pixel coords, destination canvas + // pixel coords, and tile coords all can be scaled linearly. + function degree2tile(lat, lng, zoom) { + // See http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames + var latRad = lat * Math.PI / 180; + var n = Math.pow(2, zoom); + var x = (lng + 180) / 360 * n; + var y = (1 - Math.log(Math.tan(latRad) + 1 / Math.cos(latRad)) / Math.PI) / 2 * n; + return { + x: x, + y: y + }; + } // Given a range [from,to) and either one or two numbers, returns true if + // there is any overlap between [x,x1) and the range--or if x1 is omitted, + // then returns true if x is within [from,to). + + + function overlap(from, to, x, + /* optional */ + x1) { + if (arguments.length == 3) x1 = x; + return x < to && x1 >= from; + } + + function getCanvasSmoothingProperty(ctx) { + var candidates = ["imageSmoothingEnabled", "mozImageSmoothingEnabled", "webkitImageSmoothingEnabled", "msImageSmoothingEnabled"]; + + for (var i = 0; i < candidates.length; i++) { + if (typeof ctx[candidates[i]] !== "undefined") { + return candidates[i]; + } + } + + return null; + } // Our general strategy is to: + // 1. Load the data URI in an Image() object, so we can get its pixel + // dimensions and the underlying image data. (We could have done this + // by not encoding as PNG at all but just send an array of RGBA values + // from the server, but that would inflate the JSON too much.) + // 2. Create a hidden canvas that we use just to extract the image data + // from the Image (using Context2D.getImageData()). + // 3. Create a TileLayer.Canvas and add it to the map. + // We want to synchronously create and attach the TileLayer.Canvas (so an + // immediate call to clearRasters() will be respected, for example), but + // Image loads its data asynchronously. Fortunately we can resolve this + // by putting TileLayer.Canvas into async mode, which will let us create + // and attach the layer but have it wait until the image is loaded before + // it actually draws anything. + // These are the variables that we will populate once the image is loaded. + + + var imgData = null; // 1d row-major array, four [0-255] integers per pixel + + var imgDataMipMapper = null; + var w = null; // image width in pixels + + var h = null; // image height in pixels + // We'll use this array to store callbacks that need to be invoked once + // imgData, w, and h have been resolved. + + var imgDataCallbacks = []; // Consumers of imgData, w, and h can call this to be notified when data + // is available. + + function getImageData(callback) { + if (imgData != null) { + // Must not invoke the callback immediately; it's too confusing and + // fragile to have a function invoke the callback *either* immediately + // or in the future. Better to be consistent here. + setTimeout(function () { + callback(imgData, w, h, imgDataMipMapper); + }, 0); + } else { + imgDataCallbacks.push(callback); + } + } + + var img = new Image(); + + img.onload = function () { + // Save size + w = img.width; + h = img.height; // Create a dummy canvas to extract the image data + + var imgDataCanvas = document.createElement("canvas"); + imgDataCanvas.width = w; + imgDataCanvas.height = h; + imgDataCanvas.style.display = "none"; + document.body.appendChild(imgDataCanvas); + var imgDataCtx = imgDataCanvas.getContext("2d"); + imgDataCtx.drawImage(img, 0, 0); // Save the image data. + + imgData = imgDataCtx.getImageData(0, 0, w, h).data; + imgDataMipMapper = new _mipmapper2["default"](img); // Done with the canvas, remove it from the page so it can be gc'd. + + document.body.removeChild(imgDataCanvas); // Alert any getImageData callers who are waiting. + + for (var i = 0; i < imgDataCallbacks.length; i++) { + imgDataCallbacks[i](imgData, w, h, imgDataMipMapper); + } + + imgDataCallbacks = []; + }; + + img.src = uri; + + var canvasTiles = _leaflet2["default"].gridLayer(Object.assign({}, options, { + detectRetina: true, + async: true + })); // NOTE: The done() function MUST NOT be invoked until after the current + // tick; done() looks in Leaflet's tile cache for the current tile, and + // since it's still being constructed, it won't be found. + + + canvasTiles.createTile = function (tilePoint, done) { + var zoom = tilePoint.z; + + var canvas = _leaflet2["default"].DomUtil.create("canvas"); + + var error; // setup tile width and height according to the options + + var size = this.getTileSize(); + canvas.width = size.x; + canvas.height = size.y; + getImageData(function (imgData, w, h, mipmapper) { + try { + // The Context2D we'll being drawing onto. It's always 256x256. + var ctx = canvas.getContext("2d"); // Convert our image data's top-left and bottom-right locations into + // x/y tile coordinates. This is essentially doing a spherical mercator + // projection, then multiplying by 2^zoom. + + var topLeft = degree2tile(bounds[0][0], bounds[0][1], zoom); + var bottomRight = degree2tile(bounds[1][0], bounds[1][1], zoom); // The size of the image in x/y tile coordinates. + + var extent = { + x: bottomRight.x - topLeft.x, + y: bottomRight.y - topLeft.y + }; // Short circuit if tile is totally disjoint from image. + + if (!overlap(tilePoint.x, tilePoint.x + 1, topLeft.x, bottomRight.x)) return; + if (!overlap(tilePoint.y, tilePoint.y + 1, topLeft.y, bottomRight.y)) return; // The linear resolution of the tile we're drawing is always 256px per tile unit. + // If the linear resolution (in either direction) of the image is less than 256px + // per tile unit, then use nearest neighbor; otherwise, use the canvas's built-in + // scaling. + + var imgRes = { + x: w / extent.x, + y: h / extent.y + }; // We can do the actual drawing in one of three ways: + // - Call drawImage(). This is easy and fast, and results in smooth + // interpolation (bilinear?). This is what we want when we are + // reducing the image from its native size. + // - Call drawImage() with imageSmoothingEnabled=false. This is easy + // and fast and gives us nearest-neighbor interpolation, which is what + // we want when enlarging the image. However, it's unsupported on many + // browsers (including QtWebkit). + // - Do a manual nearest-neighbor interpolation. This is what we'll fall + // back to when enlarging, and imageSmoothingEnabled isn't supported. + // In theory it's slower, but still pretty fast on my machine, and the + // results look the same AFAICT. + // Is imageSmoothingEnabled supported? If so, we can let canvas do + // nearest-neighbor interpolation for us. + + var smoothingProperty = getCanvasSmoothingProperty(ctx); + + if (smoothingProperty || imgRes.x >= 256 && imgRes.y >= 256) { + // Use built-in scaling + // Turn off anti-aliasing if necessary + if (smoothingProperty) { + ctx[smoothingProperty] = imgRes.x >= 256 && imgRes.y >= 256; + } // Don't necessarily draw with the full-size image; if we're + // downscaling, use the mipmapper to get a pre-downscaled image + // (see comments on Mipmapper class for why this matters). + + + mipmapper.getBySize(extent.x * 256, extent.y * 256, function (mip) { + // It's possible that the image will go off the edge of the canvas-- + // that's OK, the canvas should clip appropriately. + ctx.drawImage(mip, // Convert abs tile coords to rel tile coords, then *256 to convert + // to rel pixel coords + (topLeft.x - tilePoint.x) * 256, (topLeft.y - tilePoint.y) * 256, // Always draw the whole thing and let canvas clip; so we can just + // convert from size in tile coords straight to pixels + extent.x * 256, extent.y * 256); + }); + } else { + // Use manual nearest-neighbor interpolation + // Calculate the source image pixel coordinates that correspond with + // the top-left and bottom-right of this tile. (If the source image + // only partially overlaps the tile, we use max/min to limit the + // sourceStart/End to only reflect the overlapping portion.) + var sourceStart = { + x: Math.max(0, Math.floor((tilePoint.x - topLeft.x) * imgRes.x)), + y: Math.max(0, Math.floor((tilePoint.y - topLeft.y) * imgRes.y)) + }; + var sourceEnd = { + x: Math.min(w, Math.ceil((tilePoint.x + 1 - topLeft.x) * imgRes.x)), + y: Math.min(h, Math.ceil((tilePoint.y + 1 - topLeft.y) * imgRes.y)) + }; // The size, in dest pixels, that each source pixel should occupy. + // This might be greater or less than 1 (e.g. if x and y resolution + // are very different). + + var pixelSize = { + x: 256 / imgRes.x, + y: 256 / imgRes.y + }; // For each pixel in the source image that overlaps the tile... + + for (var row = sourceStart.y; row < sourceEnd.y; row++) { + for (var col = sourceStart.x; col < sourceEnd.x; col++) { + // ...extract the pixel data... + var i = (row * w + col) * 4; + var r = imgData[i]; + var g = imgData[i + 1]; + var b = imgData[i + 2]; + var a = imgData[i + 3]; + ctx.fillStyle = "rgba(" + [r, g, b, a / 255].join(",") + ")"; // ...calculate the corresponding pixel coord in the dest image + // where it should be drawn... + + var pixelPos = { + x: (col / imgRes.x + topLeft.x - tilePoint.x) * 256, + y: (row / imgRes.y + topLeft.y - tilePoint.y) * 256 + }; // ...and draw a rectangle there. + + ctx.fillRect(Math.round(pixelPos.x), Math.round(pixelPos.y), // Looks crazy, but this is necessary to prevent rounding from + // causing overlap between this rect and its neighbors. The + // minuend is the location of the next pixel, while the + // subtrahend is the position of the current pixel (to turn an + // absolute coordinate to a width/height). Yes, I had to look + // up minuend and subtrahend. + Math.round(pixelPos.x + pixelSize.x) - Math.round(pixelPos.x), Math.round(pixelPos.y + pixelSize.y) - Math.round(pixelPos.y)); + } + } + } + } catch (e) { + error = e; + } finally { + done(error, canvas); + } + }); + return canvas; + }; + + this.layerManager.addLayer(canvasTiles, "image", layerId, group); +}; + +methods.removeImage = function (layerId) { + this.layerManager.removeLayer("image", layerId); +}; + +methods.clearImages = function () { + this.layerManager.clearLayers("image"); +}; + +methods.addMeasure = function (options) { + // if a measureControl already exists, then remove it and + // replace with a new one + methods.removeMeasure.call(this); + this.measureControl = _leaflet2["default"].control.measure(options); + this.addControl(this.measureControl); +}; + +methods.removeMeasure = function () { + if (this.measureControl) { + this.removeControl(this.measureControl); + this.measureControl = null; + } +}; + +methods.addSelect = function (ctGroup) { + var _this8 = this; + + methods.removeSelect.call(this); + this._selectButton = _leaflet2["default"].easyButton({ + states: [{ + stateName: "select-inactive", + icon: "ion-qr-scanner", + title: "Make a selection", + onClick: function onClick(btn, map) { + btn.state("select-active"); + _this8._locationFilter = new _leaflet2["default"].LocationFilter2(); + + if (ctGroup) { + var selectionHandle = new global.crosstalk.SelectionHandle(ctGroup); + selectionHandle.on("change", function (e) { + if (e.sender !== selectionHandle) { + if (_this8._locationFilter) { + _this8._locationFilter.disable(); + + btn.state("select-inactive"); + } + } + }); + + var handler = function handler(e) { + _this8.layerManager.brush(_this8._locationFilter.getBounds(), { + sender: selectionHandle + }); + }; + + _this8._locationFilter.on("enabled", handler); + + _this8._locationFilter.on("change", handler); + + _this8._locationFilter.on("disabled", function () { + selectionHandle.close(); + _this8._locationFilter = null; + }); + } + + _this8._locationFilter.addTo(map); + } + }, { + stateName: "select-active", + icon: "ion-close-round", + title: "Dismiss selection", + onClick: function onClick(btn, map) { + btn.state("select-inactive"); + + _this8._locationFilter.disable(); // If explicitly dismissed, clear the crosstalk selections + + + _this8.layerManager.unbrush(); + } + }] + }); + + this._selectButton.addTo(this); +}; + +methods.removeSelect = function () { + if (this._locationFilter) { + this._locationFilter.disable(); + } + + if (this._selectButton) { + this.removeControl(this._selectButton); + this._selectButton = null; + } +}; + +methods.createMapPane = function (name, zIndex) { + this.createPane(name); + this.getPane(name).style.zIndex = zIndex; +}; + + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./cluster-layer-store":1,"./crs_utils":3,"./dataframe":4,"./global/htmlwidgets":8,"./global/jquery":9,"./global/leaflet":10,"./global/shiny":12,"./mipmapper":16,"./util":17}],16:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +// This class simulates a mipmap, which shrinks images by powers of two. This +// stepwise reduction results in "pixel-perfect downscaling" (where every +// pixel of the original image has some contribution to the downscaled image) +// as opposed to a single-step downscaling which will discard a lot of data +// (and with sparse images at small scales can give very surprising results). +var Mipmapper = /*#__PURE__*/function () { + function Mipmapper(img) { + _classCallCheck(this, Mipmapper); + + this._layers = [img]; + } // The various functions on this class take a callback function BUT MAY OR MAY + // NOT actually behave asynchronously. + + + _createClass(Mipmapper, [{ + key: "getBySize", + value: function getBySize(desiredWidth, desiredHeight, callback) { + var _this = this; + + var i = 0; + var lastImg = this._layers[0]; + + var testNext = function testNext() { + _this.getByIndex(i, function (img) { + // If current image is invalid (i.e. too small to be rendered) or + // it's smaller than what we wanted, return the last known good image. + if (!img || img.width < desiredWidth || img.height < desiredHeight) { + callback(lastImg); + return; + } else { + lastImg = img; + i++; + testNext(); + return; + } + }); + }; + + testNext(); + } + }, { + key: "getByIndex", + value: function getByIndex(i, callback) { + var _this2 = this; + + if (this._layers[i]) { + callback(this._layers[i]); + return; + } + + this.getByIndex(i - 1, function (prevImg) { + if (!prevImg) { + // prevImg could not be calculated (too small, possibly) + callback(null); + return; + } + + if (prevImg.width < 2 || prevImg.height < 2) { + // Can't reduce this image any further + callback(null); + return; + } // If reduce ever becomes truly asynchronous, we should stuff a promise or + // something into this._layers[i] before calling this.reduce(), to prevent + // redundant reduce operations from happening. + + + _this2.reduce(prevImg, function (reducedImg) { + _this2._layers[i] = reducedImg; + callback(reducedImg); + return; + }); + }); + } + }, { + key: "reduce", + value: function reduce(img, callback) { + var imgDataCanvas = document.createElement("canvas"); + imgDataCanvas.width = Math.ceil(img.width / 2); + imgDataCanvas.height = Math.ceil(img.height / 2); + imgDataCanvas.style.display = "none"; + document.body.appendChild(imgDataCanvas); + + try { + var imgDataCtx = imgDataCanvas.getContext("2d"); + imgDataCtx.drawImage(img, 0, 0, img.width / 2, img.height / 2); + callback(imgDataCanvas); + } finally { + document.body.removeChild(imgDataCanvas); + } + } + }]); + + return Mipmapper; +}(); + +exports["default"] = Mipmapper; + + +},{}],17:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.log = log; +exports.recycle = recycle; +exports.asArray = asArray; + +function log(message) { + /* eslint-disable no-console */ + if (console && console.log) console.log(message); + /* eslint-enable no-console */ +} + +function recycle(values, length, inPlace) { + if (length === 0 && !inPlace) return []; + + if (!(values instanceof Array)) { + if (inPlace) { + throw new Error("Can't do in-place recycling of a non-Array value"); + } + + values = [values]; + } + + if (typeof length === "undefined") length = values.length; + var dest = inPlace ? values : []; + var origLength = values.length; + + while (dest.length < length) { + dest.push(values[dest.length % origLength]); + } + + if (dest.length > length) { + dest.splice(length, dest.length - length); + } + + return dest; +} + +function asArray(value) { + if (value instanceof Array) return value;else return [value]; +} + + +},{}]},{},[13]); diff --git a/docs/reference/libs/leafletfix-1.0.0/leafletfix.css b/docs/reference/libs/leafletfix-1.0.0/leafletfix.css new file mode 100644 index 00000000..466d8681 --- /dev/null +++ b/docs/reference/libs/leafletfix-1.0.0/leafletfix.css @@ -0,0 +1,36 @@ +/* Work around CSS properties introduced on img by bootstrap */ +img.leaflet-tile { + padding: 0; + margin: 0; + border-radius: 0; + border: none; +} +.leaflet .info { + padding: 6px 8px; + font: 14px/16px Arial, Helvetica, sans-serif; + background: white; + background: rgba(255,255,255,0.8); + box-shadow: 0 0 15px rgba(0,0,0,0.2); + border-radius: 5px; +} +.leaflet .legend { + line-height: 18px; + color: #555; +} +.leaflet .legend svg text { + fill: #555; +} +.leaflet .legend svg line { + stroke: #555; +} +.leaflet .legend i { + width: 18px; + height: 18px; + margin-right: 4px; + opacity: 0.7; + display: inline-block; + vertical-align: top; + /*For IE 7*/ + zoom: 1; + *display: inline; +} diff --git a/docs/reference/libs/minichart-0.2.2/DESCRIPTION b/docs/reference/libs/minichart-0.2.2/DESCRIPTION new file mode 100644 index 00000000..6b0a775b --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/DESCRIPTION @@ -0,0 +1,37 @@ +Package: leaflet.minicharts +Type: Package +Title: Mini Charts for Interactive Maps +Version: 0.6.2 +Authors@R: c( + person(given = "Veronique", + family = "Bachelier", + role = c("aut", "cre"), + email = "veronique.bachelier@rte-france.com"), + person("Jalal-Edine", "ZAWAM", role = "aut"), + person("Benoit", "Thieurmel", email = "benoit.thieurmel@datastorm.fr", role = "aut"), + person("Francois", "Guillem", role = "aut"), + person("RTE", role = "cph") + ) +Description: Add and modify small charts on an interactive map created with + package 'leaflet'. These charts can be used to represent at same time multiple + variables on a single map. +License: GPL (>= 2) | file LICENSE +Depends: R (>= 2.10) +Imports: leaflet (>= 1.1.0), htmltools +Encoding: UTF-8 +LazyData: true +RoxygenNote: 7.1.1 +Suggests: knitr, rmarkdown, dplyr, shiny, manipulateWidget, testthat, + covr +VignetteBuilder: knitr +NeedsCompilation: no +Packaged: 2021-05-11 08:41:37 UTC; bthie +Author: Veronique Bachelier [aut, cre], + Jalal-Edine ZAWAM [aut], + Benoit Thieurmel [aut], + Francois Guillem [aut], + RTE [cph] +Maintainer: Veronique Bachelier +Repository: CRAN +Date/Publication: 2021-05-11 09:20:10 UTC +Built: R 4.2.3; ; 2024-01-20 03:42:39 UTC; windows diff --git a/docs/reference/libs/minichart-0.2.2/INDEX b/docs/reference/libs/minichart-0.2.2/INDEX new file mode 100644 index 00000000..b0526249 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/INDEX @@ -0,0 +1,7 @@ +addFlows Add or modify flows on a leaflet map +addMinicharts Add or update charts on a leaflet map +d3.schemeCategory10 d3 color palette +eco2mix Electric production, consumption and exchanges + of France +popupArgs Options for popup generation +syncWith Synchronize multiple maps diff --git a/LICENSE b/docs/reference/libs/minichart-0.2.2/LICENSE similarity index 100% rename from LICENSE rename to docs/reference/libs/minichart-0.2.2/LICENSE diff --git a/docs/reference/libs/minichart-0.2.2/MD5 b/docs/reference/libs/minichart-0.2.2/MD5 new file mode 100644 index 00000000..d166d22f --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/MD5 @@ -0,0 +1,34 @@ +e4b65b31165c49522084ee06cd17b4cb *DESCRIPTION +4a51b6a410f99f3ed0f14fb87d843ed5 *INDEX +8eb461f447c32f3085f846907a97ca26 *LICENSE +026b3ced55aedbfdf3f261126035434d *Meta/Rd.rds +f2492753b0ce75a0b2ec1210c49b2280 *Meta/data.rds +9f7a4637f056aa0787fb29bc9c21a1ff *Meta/features.rds +14d27f31f34823c0cbb80a01ae8aa68d *Meta/hsearch.rds +ae918179e6310247fd0541784b56945b *Meta/links.rds +1a1279fbf7a2fdd5bd8b06eb2da11bb9 *Meta/nsInfo.rds +a0fe3ff67c101aabe1b1c5c42033d456 *Meta/package.rds +c11b96334f8b59b50d47f9d2b36cebdb *Meta/vignette.rds +c7d2a34bb20fa125dffb8aa602dc6bbc *NAMESPACE +613f7d33f993bf3262aeeb8ef581708d *NEWS +d6c68f1fe41ced6e98a766a3757313da *R/leaflet.minicharts +bea7efb35eb60adbfddbdbbf4576f1eb *R/leaflet.minicharts.rdb +adbd1ca39fe5df62ac97815a8d920720 *R/leaflet.minicharts.rdx +a7364d300af2656a4512686de0e6fe85 *data/Rdata.rdb +bb750736a7b0ebf7ea051270a775fbd0 *data/Rdata.rds +c1956df704a0d4ecae47090013289bdb *data/Rdata.rdx +07c74524071185ba0cdb69046f685611 *doc/index.html +28f3273f8e952480d90abfee6f532442 *doc/introduction.R +bfd8ae720154bb7cf8871df0574cc84a *doc/introduction.Rmd +e6f7fac70e0f3a6bf6c0b4da2137b2d1 *doc/introduction.html +84518f462e8bc084193cc6fa72185846 *font-awesome-4.7.0/css/font-awesome.min.css +b06871f281fee6b241d60582ae9369b9 *font-awesome-4.7.0/fonts/fontawesome-webfont.ttf +9d10a5315d88c539d245e00c156c07d3 *help/AnIndex +28ae86232b457293dec07566f5855e86 *help/aliases.rds +4381ed9045ffbb1667e64c8bcea7bfee *help/leaflet.minicharts.rdb +ceadd4c56db691d6ca5fbb4aa7050558 *help/leaflet.minicharts.rdx +55f8ec66cef76f2aa41ac9146d9cf9e4 *help/paths.rds +2dbb1845843272545d81c424a7f87e1b *html/00Index.html +3845aef6126cf18c45937f292f23508c *html/R.css +c08fb4dee4ee39803405105a313eb9d2 *leaflet.minicharts.min.js +d4bdd5245a5275edcc3cd36291fd8328 *minicharts.css diff --git a/docs/reference/libs/minichart-0.2.2/Meta/Rd.rds b/docs/reference/libs/minichart-0.2.2/Meta/Rd.rds new file mode 100644 index 00000000..9700ffec Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/Rd.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/Meta/data.rds b/docs/reference/libs/minichart-0.2.2/Meta/data.rds new file mode 100644 index 00000000..42ed5d82 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/data.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/Meta/features.rds b/docs/reference/libs/minichart-0.2.2/Meta/features.rds new file mode 100644 index 00000000..88a05a5e Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/features.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/Meta/hsearch.rds b/docs/reference/libs/minichart-0.2.2/Meta/hsearch.rds new file mode 100644 index 00000000..c68dce15 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/hsearch.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/Meta/links.rds b/docs/reference/libs/minichart-0.2.2/Meta/links.rds new file mode 100644 index 00000000..ba0258d0 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/links.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/Meta/nsInfo.rds b/docs/reference/libs/minichart-0.2.2/Meta/nsInfo.rds new file mode 100644 index 00000000..1a213c45 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/nsInfo.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/Meta/package.rds b/docs/reference/libs/minichart-0.2.2/Meta/package.rds new file mode 100644 index 00000000..b26a6803 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/package.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/Meta/vignette.rds b/docs/reference/libs/minichart-0.2.2/Meta/vignette.rds new file mode 100644 index 00000000..b4602ac3 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/Meta/vignette.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/NAMESPACE b/docs/reference/libs/minichart-0.2.2/NAMESPACE new file mode 100644 index 00000000..a954b0ce --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/NAMESPACE @@ -0,0 +1,17 @@ +# Generated by roxygen2: do not edit by hand + +export(addFlows) +export(addMinicharts) +export(clearFlows) +export(clearMinicharts) +export(popupArgs) +export(removeFlows) +export(removeMinicharts) +export(syncWith) +export(updateFlows) +export(updateMinicharts) +importFrom(leaflet,"%>%") +importFrom(leaflet,JS) +importFrom(leaflet,addLegend) +importFrom(leaflet,expandLimits) +importFrom(leaflet,invokeMethod) diff --git a/docs/reference/libs/minichart-0.2.2/NEWS b/docs/reference/libs/minichart-0.2.2/NEWS new file mode 100644 index 00000000..8020db40 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/NEWS @@ -0,0 +1,87 @@ +Changes in version 0.6.2 (2021-04-07) + +NEW FEATURES: +* add popupOptions + +Changes in version 0.6.1 (2019-12-16) + +BUGFIXES: +* Fix / improve syncWith + +Changes in version 0.6.0 (2019-11-26) + +BUGFIXES: +* Fix syncGroups +* Fix flow with NULL value / nearest position + +Changes in version 0.5.4 (2018-06-06) + +BUGFIXES: +* Fix syncGroups using leaflet 2.0.0 +* Fix clear and remove methods leaflet 2.0.0 + +Changes in version 0.5.3 (2018-04-25) + +* leaflet.minicharts take into account leaflet 2.0.0 and leaflet.flow 0.2.3 + +Changes in version 0.5.2 (2017-12-06) + +BUGFIXES: +* update file description +* Invalid maxValues (0, NA, ...) + +Changes in version 0.5.1 (2017-08-17) + +BUGFIXES: +* updateMinicharts() was incapable of updating color palette (#19) + +Changes in version 0.5.0 (2017-07-10) + +NEW FEATURES: +* addMinicharts() and updateMinicharts() gain a new parameter "onChange" that permits to execute some arbitrary javascript code each time a minichart is updated. +* The package now uses unit testing, code coverage and continuous integration in order to improve code quality and reliability. + +BUGFIXES: +* Some warnings that appeared with R 3.4 have been removed. +* Parameter "initialTime" was not working correctly in some situations. +* Parameter "fillColor" was ignored if someone tried to add a single minicharts. + + +Changes in version 0.4.0 (2017-06-19) + +NEW FEATURES: +* New function syncWith() to synchronize zoom, center and time of multiple leaflet maps. + + +Changes in version 0.3.1 (2017-05-30) + +BUGFIXES: +* addMinicharts() uses functions that are only available in package leaflet >= 1.1.0. The package now requires this version of leaflet. + + +Changes in version 0.3 (2017-05-19) + +NEW FEATURES: +* Default popups are now automatically generated for charts and flows. A new function "popupArgs()" has been added to control how popups are generated. +* The size of the JSON data passed from R to javascript has been optimized. In some situations it has been divided by 10, so maps are generated quicker and when they are saved on harddrive, the resulting files are smaller. + +BUGFIXES: +* The default color palette was not found when leaflet.minicharts was imported in another package. +* add/updateMinicharts/Flows were crashing if layerId was a factor and some levels were missing. +* Some bugs were occuring if after an update of a map, the number of timesteps increased. + + +Changes in version 0.2 (2017-05-05) + +BREAKING CHANGES: +* Argument "data" of addMinicharts() and updateMinicharts() has been renamed "chartdata" to avoid confusion with parameter "data" of function leaflet(). + +NEW FEATURES: +* addMinicharts() now automatically adds a legend to the map by default. +* addMinicharts() has new parameters "labelMinSize" and "labelMaxSize" to control label size. +* addMinicharts() has a new parameter "time" that can be used to create an animated map that represents the evolution of one or more variables. Animations can be shared by saving the map as html or including it in a Ramrkdown document. No need to use Shiny anymore! +* New functions removeMinicharts() and clearMinicharts() to remove some or all minicharts from a map. +* It is now possible to represent flows between two points with function addFlow() and the associated functions updateFlows(), removeFlows() and clearFlows(). + +BUGFIXES: +* addMinicharts was crashing if user tried to add a single chart to a map. diff --git a/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts b/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# 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 2 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. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts.rdb b/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts.rdb new file mode 100644 index 00000000..03d80bf8 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts.rdb differ diff --git a/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts.rdx b/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts.rdx new file mode 100644 index 00000000..657f078b Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/R/leaflet.minicharts.rdx differ diff --git a/docs/reference/libs/minichart-0.2.2/data/Rdata.rdb b/docs/reference/libs/minichart-0.2.2/data/Rdata.rdb new file mode 100644 index 00000000..85ca994d Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/data/Rdata.rdb differ diff --git a/docs/reference/libs/minichart-0.2.2/data/Rdata.rds b/docs/reference/libs/minichart-0.2.2/data/Rdata.rds new file mode 100644 index 00000000..b3f50bea Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/data/Rdata.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/data/Rdata.rdx b/docs/reference/libs/minichart-0.2.2/data/Rdata.rdx new file mode 100644 index 00000000..2d5acd98 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/data/Rdata.rdx differ diff --git a/docs/reference/libs/minichart-0.2.2/doc/index.html b/docs/reference/libs/minichart-0.2.2/doc/index.html new file mode 100644 index 00000000..37e1842b --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/doc/index.html @@ -0,0 +1,29 @@ + + +R: Vignettes and other documentation + + + +
    +

    Vignettes and other documentation + +

    +
    +
    +[Top] +
    +

    Vignettes from package 'leaflet.minicharts'

    + +++++++ + + + + +
    leaflet.minicharts::introductionintroductionHTMLsourceR code
    +
    diff --git a/docs/reference/libs/minichart-0.2.2/doc/introduction.R b/docs/reference/libs/minichart-0.2.2/doc/introduction.R new file mode 100644 index 00000000..fd961b19 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/doc/introduction.R @@ -0,0 +1,107 @@ +## ----------------------------------------------------------------------------- +library(leaflet.minicharts) +data("eco2mix") +head(eco2mix) + +## ----message=FALSE------------------------------------------------------------ +library(dplyr) + +prod2016 <- eco2mix %>% + mutate( + renewable = bioenergy + solar + wind + hydraulic, + non_renewable = total - bioenergy - solar - wind - hydraulic + ) %>% + filter(grepl("2016", month) & area != "France") %>% + select(-month) %>% + group_by(area, lat, lng) %>% + summarise_all(sum) %>% + ungroup() + +head(prod2016) + +## ----message=FALSE, results='hide'-------------------------------------------- +library(leaflet) + +tilesURL <- "http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}" + +basemap <- leaflet(width = "100%", height = "400px") %>% + addTiles(tilesURL) + +## ----------------------------------------------------------------------------- +colors <- c("#4fc13c", "#cccccc") + +basemap %>% + addMinicharts( + prod2016$lng, prod2016$lat, + type = "pie", + chartdata = prod2016[, c("renewable", "non_renewable")], + colorPalette = colors, + width = 60 * sqrt(prod2016$total) / sqrt(max(prod2016$total)), transitionTime = 0 + ) + +## ----------------------------------------------------------------------------- +renewable2016 <- prod2016 %>% select(hydraulic, solar, wind) +colors <- c("#3093e5", "#fcba50", "#a0d9e8") +basemap %>% + addMinicharts( + prod2016$lng, prod2016$lat, + chartdata = renewable2016, + colorPalette = colors, + width = 45, height = 45 + ) + +## ----------------------------------------------------------------------------- +basemap %>% + addMinicharts( + prod2016$lng, prod2016$lat, + chartdata = prod2016$load, + showLabels = TRUE, + width = 45 + ) + +## ----------------------------------------------------------------------------- +prodRegions <- eco2mix %>% filter(area != "France") + +## ----------------------------------------------------------------------------- +basemap %>% + addMinicharts( + prodRegions$lng, prodRegions$lat, + chartdata = prodRegions[, c("hydraulic", "solar", "wind")], + time = prodRegions$month, + colorPalette = colors, + width = 45, height = 45 + ) + +## ----------------------------------------------------------------------------- +data("eco2mixBalance") +bal <- eco2mixBalance +basemap %>% + addFlows( + bal$lng0, bal$lat0, bal$lng1, bal$lat1, + flow = bal$balance, + time = bal$month + ) + +## ----eval = FALSE------------------------------------------------------------- +# server <- function(input, output, session) { +# # Initialize map +# output$mymap <- renderLeaflet( +# leaflet() %>% addTiles() %>% +# addMinicharts(lon, lat, layerId = uniqueChartIds) +# ) +# } + +## ----eval = FALSE------------------------------------------------------------- +# server <- function(input, output, session) { +# # Initialize map +# ... +# +# # Update map +# observe({ +# newdata <- getData(input$myinput) +# +# leafletProxy("mymap") %>% +# updateMinicharts(uniqueChartIds, chartdata = newdata, ...) +# }) +# } + diff --git a/docs/reference/libs/minichart-0.2.2/doc/introduction.Rmd b/docs/reference/libs/minichart-0.2.2/doc/introduction.Rmd new file mode 100644 index 00000000..6668d725 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/doc/introduction.Rmd @@ -0,0 +1,184 @@ +--- +title: "Introduction to leaflet.minicharts" +author: "Francois Guillem" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{introduction} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +For a few years now, it has become very to create interactive maps with R thanks to the package `leaflet` by the Rstudio team. Nevertheless, it only provides only a few functions to create basic shapes on a map, so the information that can be represented on a single map is limited: if you have some data associated to some points, you can only represent at most two variables by drawing circles and changing their radius and color according to data. + +`leaflet.minicharts` is an R package that provides two functions to add and update small charts on an interactive maps created with the package `leaflet`. These charts can be used to represent as many variables as desired associated to geographical points. Currently, three types of chart are supported: barcharts (the default), pie charts and polar area charts. + +let's have a look to a concrete example. + +## Data + +The package provides a table that contains the electric production, consumption and exchanges of France from january 2010 to february 2017 and of 12 french regions from january 2013 to february 2017. + +In addition to the total production, the table contains one column for each type of production. The table also contains the latitude and longitude of the center of the regions. + +```{r} +library(leaflet.minicharts) +data("eco2mix") +head(eco2mix) +``` + +## Renewable productions in 2016 + +Nowadays, France has an objective of 23% of renewable energies in the consumption of the country by 2020. Are the country close to its objective. Is the share of renewable energies similar in all regions? + +To answer this question let us focus on the year 2016 We first prepare the required data with package `dplyr`: + +```{r message=FALSE} +library(dplyr) + +prod2016 <- eco2mix %>% + mutate( + renewable = bioenergy + solar + wind + hydraulic, + non_renewable = total - bioenergy - solar - wind - hydraulic + ) %>% + filter(grepl("2016", month) & area != "France") %>% + select(-month) %>% + group_by(area, lat, lng) %>% + summarise_all(sum) %>% + ungroup() + +head(prod2016) +``` + +We also create a base map that will be used in all the following examples + +```{r message=FALSE, results='hide'} +library(leaflet) + +tilesURL <- "http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}" + +basemap <- leaflet(width = "100%", height = "400px") %>% + addTiles(tilesURL) +``` + +We now add to the base map a pie chart for each region that represents the share of renewable energies. We also change the width of the pie charts so their area is proportional to the total production of the corresponding region. + +```{r} +colors <- c("#4fc13c", "#cccccc") + +basemap %>% + addMinicharts( + prod2016$lng, prod2016$lat, + type = "pie", + chartdata = prod2016[, c("renewable", "non_renewable")], + colorPalette = colors, + width = 60 * sqrt(prod2016$total) / sqrt(max(prod2016$total)), transitionTime = 0 + ) +``` + +We can see that the three south east regions exceed the target of 23%, but most regions are far from this objective. Globally, renewable energies represented only 19% percent of the production of 2016. + +Now let's represent the different types of renewable production using bar charts. + +```{r} +renewable2016 <- prod2016 %>% select(hydraulic, solar, wind) +colors <- c("#3093e5", "#fcba50", "#a0d9e8") +basemap %>% + addMinicharts( + prod2016$lng, prod2016$lat, + chartdata = renewable2016, + colorPalette = colors, + width = 45, height = 45 + ) +``` + +Hydraulic production is far more important than solar and wind. Without surprise, solar production is more important in south while wind production is more important in the north. + +## Representing a single variable + +`leaflet.minicharts` has been designed to represent multiple variables at once, but you still may want to use it to represent a single variable. In the next example, we represent the total load of each french region in 2016. When data passed to `addMinicharts` contains a single column, it automatically represents it with circle which area is proportional to the corresponding value. In the example we also use the parameter `showLabels` to display rounded values of the variable inside the circles. + +```{r} +basemap %>% + addMinicharts( + prod2016$lng, prod2016$lat, + chartdata = prod2016$load, + showLabels = TRUE, + width = 45 + ) +``` + +This is nice, isn't it? + +## Animated maps + +Until now, we have only represented aggregated data but it would be nice to create a map that represents the evolution over time of some variables. It is actually easy with `leaflet.minicharts`. The first step is to construct a table containing longitude, latitude, a time column and the variables we want to represent. The table `eco2mix` already has all these columns. We only need to filter the rows containing data for the entire country. + +```{r} +prodRegions <- eco2mix %>% filter(area != "France") +``` + +Now we can create our animated map by using the argument "time": + +```{r} +basemap %>% + addMinicharts( + prodRegions$lng, prodRegions$lat, + chartdata = prodRegions[, c("hydraulic", "solar", "wind")], + time = prodRegions$month, + colorPalette = colors, + width = 45, height = 45 + ) +``` + +## Represent flows + +Since version 0.2, `leaflet.minicharts` has also functions to represent flows between points and their evolution. To illustrate this, let's represent the evolution of electricity exchanges between France and Neighboring countries. + +To do that, we use function `addFlows`. It requires coordinates of two points for each flow and the value of the flow. Other arguments are similar to `addMinicharts`. + +```{r} +data("eco2mixBalance") +bal <- eco2mixBalance +basemap %>% + addFlows( + bal$lng0, bal$lat0, bal$lng1, bal$lat1, + flow = bal$balance, + time = bal$month + ) +``` + +Of course, you can represent flows and minicharts on the same map! + +## Use in shiny web applications + +In shiny applications, you can create nice transition effects by using functions `leafletproxy` and `updateMinicharts`/`updateFlows`. In the server function you first need to initialize the map and the minicharts. The important thing here is to use parameter `layerId` so that `updateMinicharts` can know which chart to update with which values. + +```{r eval = FALSE} +server <- function(input, output, session) { + # Initialize map + output$mymap <- renderLeaflet( + leaflet() %>% addTiles() %>% + addMinicharts(lon, lat, layerId = uniqueChartIds) + ) +} +``` + +Then use `leafletProxy()` and `updateMinicharts` in your reactive code: + +```{r eval = FALSE} +server <- function(input, output, session) { + # Initialize map + ... + + # Update map + observe({ + newdata <- getData(input$myinput) + + leafletProxy("mymap") %>% + updateMinicharts(uniqueChartIds, chartdata = newdata, ...) + }) +} +``` + +You can find a [live example here](https://francoisguillem.shinyapps.io/shiny-demo/). diff --git a/docs/reference/libs/minichart-0.2.2/doc/introduction.html b/docs/reference/libs/minichart-0.2.2/doc/introduction.html new file mode 100644 index 00000000..57bff84f --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/doc/introduction.html @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + +Introduction to leaflet.minicharts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Introduction to leaflet.minicharts

    +

    Francois Guillem

    +

    2021-05-11

    + + + +

    For a few years now, it has become very to create interactive maps with R thanks to the package leaflet by the Rstudio team. Nevertheless, it only provides only a few functions to create basic shapes on a map, so the information that can be represented on a single map is limited: if you have some data associated to some points, you can only represent at most two variables by drawing circles and changing their radius and color according to data.

    +

    leaflet.minicharts is an R package that provides two functions to add and update small charts on an interactive maps created with the package leaflet. These charts can be used to represent as many variables as desired associated to geographical points. Currently, three types of chart are supported: barcharts (the default), pie charts and polar area charts.

    +

    let’s have a look to a concrete example.

    +
    +

    Data

    +

    The package provides a table that contains the electric production, consumption and exchanges of France from january 2010 to february 2017 and of 12 french regions from january 2013 to february 2017.

    +

    In addition to the total production, the table contains one column for each type of production. The table also contains the latitude and longitude of the center of the regions.

    +
    library(leaflet.minicharts)
    +data("eco2mix")
    +head(eco2mix)
    +
    ##                   area      lng      lat   month total nuclear coal fuel gaz
    +## 1 Auvergne-Rhone-Alpes 4.537338 45.51266 2015-03 11430    8230    6   40 200
    +## 2 Auvergne-Rhone-Alpes 4.537338 45.51266 2015-06 10056    7200    4   35   5
    +## 3 Auvergne-Rhone-Alpes 4.537338 45.51266 2013-04 10532    7410    0   31   3
    +## 4 Auvergne-Rhone-Alpes 4.537338 45.51266 2015-04 10103    7275    4   39  86
    +## 5 Auvergne-Rhone-Alpes 4.537338 45.51266 2014-08  9052    6357    0   25  -1
    +## 6 Auvergne-Rhone-Alpes 4.537338 45.51266 2015-11  9258    7192    5   45 250
    +##   hydraulic wind solar bioenergy load balance export import balanceUK balanceES
    +## 1      2737   74    57        82 6326    4747     NA     NA        NA        NA
    +## 2      2606   44   101        58 4848    4891     NA     NA        NA        NA
    +## 3      2948   55    39        42   NA      NA     NA     NA        NA        NA
    +## 4      2487   66    81        61 5283    4439     NA     NA        NA        NA
    +## 5      2487   38    76        68 4299    4447     NA     NA        NA        NA
    +## 6      1563   75    40        86 5829    3141     NA     NA        NA        NA
    +##   balanceIT balanceCH balanceDEBE
    +## 1        NA        NA          NA
    +## 2        NA        NA          NA
    +## 3        NA        NA          NA
    +## 4        NA        NA          NA
    +## 5        NA        NA          NA
    +## 6        NA        NA          NA
    +
    +
    +

    Renewable productions in 2016

    +

    Nowadays, France has an objective of 23% of renewable energies in the consumption of the country by 2020. Are the country close to its objective. Is the share of renewable energies similar in all regions?

    +

    To answer this question let us focus on the year 2016 We first prepare the required data with package dplyr:

    +
    library(dplyr)
    +
    +prod2016 <- eco2mix %>%
    +  mutate(
    +    renewable = bioenergy + solar + wind + hydraulic,
    +    non_renewable = total - bioenergy - solar - wind - hydraulic
    +  ) %>%
    +  filter(grepl("2016", month) & area != "France") %>%
    +  select(-month) %>%
    +  group_by(area, lat, lng) %>%
    +  summarise_all(sum) %>%
    +  ungroup()
    +
    +head(prod2016)
    +
    ## # A tibble: 6 x 23
    +##   area          lat   lng  total nuclear  coal  fuel   gaz hydraulic  wind solar
    +##   <chr>       <dbl> <dbl>  <dbl>   <dbl> <dbl> <dbl> <dbl>     <dbl> <dbl> <dbl>
    +## 1 Auvergne-R~  45.5  4.54 108517   75002    59   101  2318     28398   849   803
    +## 2 Bourgogne-~  47.2  4.81   2762       0     0     1   644       939   773   211
    +## 3 Bretagne     48.2 -2.84   3141       0     0     9   543       581  1472   192
    +## 4 Centre-Val~  47.5  1.69  78430   75733     0     0   274       120  1616   238
    +## 5 Grand-Est    48.7  5.61 107755   82734  1650    41  8282      8990  4917   462
    +## 6 Hauts-de-F~  50.0  2.77  45593   31222    48    17  8302         8  4851   122
    +## # ... with 12 more variables: bioenergy <dbl>, load <dbl>, balance <dbl>,
    +## #   export <dbl>, import <dbl>, balanceUK <dbl>, balanceES <dbl>,
    +## #   balanceIT <dbl>, balanceCH <dbl>, balanceDEBE <dbl>, renewable <dbl>,
    +## #   non_renewable <dbl>
    +

    We also create a base map that will be used in all the following examples

    +
    library(leaflet)
    +
    +tilesURL <- "http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}"
    +
    +basemap <- leaflet(width = "100%", height = "400px") %>%
    +  addTiles(tilesURL)
    +

    We now add to the base map a pie chart for each region that represents the share of renewable energies. We also change the width of the pie charts so their area is proportional to the total production of the corresponding region.

    +
    colors <- c("#4fc13c", "#cccccc")
    +
    +basemap %>%
    +  addMinicharts(
    +    prod2016$lng, prod2016$lat,
    +    type = "pie",
    +    chartdata = prod2016[, c("renewable", "non_renewable")], 
    +    colorPalette = colors, 
    +    width = 60 * sqrt(prod2016$total) / sqrt(max(prod2016$total)), transitionTime = 0
    +  )
    +
    + +

    We can see that the three south east regions exceed the target of 23%, but most regions are far from this objective. Globally, renewable energies represented only 19% percent of the production of 2016.

    +

    Now let’s represent the different types of renewable production using bar charts.

    +
    renewable2016 <- prod2016 %>% select(hydraulic, solar, wind)
    +colors <- c("#3093e5", "#fcba50", "#a0d9e8")
    +basemap %>%
    +  addMinicharts(
    +    prod2016$lng, prod2016$lat,
    +    chartdata = renewable2016,
    +    colorPalette = colors,
    +    width = 45, height = 45
    +  )
    +
    + +

    Hydraulic production is far more important than solar and wind. Without surprise, solar production is more important in south while wind production is more important in the north.

    +
    +
    +

    Representing a single variable

    +

    leaflet.minicharts has been designed to represent multiple variables at once, but you still may want to use it to represent a single variable. In the next example, we represent the total load of each french region in 2016. When data passed to addMinicharts contains a single column, it automatically represents it with circle which area is proportional to the corresponding value. In the example we also use the parameter showLabels to display rounded values of the variable inside the circles.

    +
    basemap %>%
    +  addMinicharts(
    +    prod2016$lng, prod2016$lat,
    +    chartdata = prod2016$load,
    +    showLabels = TRUE,
    +    width = 45
    +  )
    +
    + +

    This is nice, isn’t it?

    +
    +
    +

    Animated maps

    +

    Until now, we have only represented aggregated data but it would be nice to create a map that represents the evolution over time of some variables. It is actually easy with leaflet.minicharts. The first step is to construct a table containing longitude, latitude, a time column and the variables we want to represent. The table eco2mix already has all these columns. We only need to filter the rows containing data for the entire country.

    +
    prodRegions <- eco2mix %>% filter(area != "France")
    +

    Now we can create our animated map by using the argument “time”:

    +
    basemap %>% 
    +  addMinicharts(
    +    prodRegions$lng, prodRegions$lat, 
    +    chartdata = prodRegions[, c("hydraulic", "solar", "wind")],
    +    time = prodRegions$month,
    +    colorPalette = colors,
    +    width = 45, height = 45
    +  )
    +
    + +
    +
    +

    Represent flows

    +

    Since version 0.2, leaflet.minicharts has also functions to represent flows between points and their evolution. To illustrate this, let’s represent the evolution of electricity exchanges between France and Neighboring countries.

    +

    To do that, we use function addFlows. It requires coordinates of two points for each flow and the value of the flow. Other arguments are similar to addMinicharts.

    +
    data("eco2mixBalance")
    +bal <- eco2mixBalance
    +basemap %>%
    +  addFlows(
    +    bal$lng0, bal$lat0, bal$lng1, bal$lat1,
    +    flow = bal$balance,
    +    time = bal$month
    +  )
    +
    + +

    Of course, you can represent flows and minicharts on the same map!

    +
    +
    +

    Use in shiny web applications

    +

    In shiny applications, you can create nice transition effects by using functions leafletproxy and updateMinicharts/updateFlows. In the server function you first need to initialize the map and the minicharts. The important thing here is to use parameter layerId so that updateMinicharts can know which chart to update with which values.

    +
    server <- function(input, output, session) {
    +  # Initialize map
    +  output$mymap <- renderLeaflet(
    +    leaflet() %>% addTiles() %>%
    +      addMinicharts(lon, lat, layerId = uniqueChartIds)
    +  )
    +}
    +

    Then use leafletProxy() and updateMinicharts in your reactive code:

    +
    server <- function(input, output, session) {
    +  # Initialize map
    +  ...
    +  
    +  # Update map
    +  observe({
    +    newdata <- getData(input$myinput)
    +    
    +    leafletProxy("mymap") %>% 
    +      updateMinicharts(uniqueChartIds, chartdata = newdata, ...)
    +  })
    +}
    +

    You can find a live example here.

    +
    + + + + + + + + + + + diff --git a/docs/reference/libs/minichart-0.2.2/font-awesome-4.7.0/css/font-awesome.min.css b/docs/reference/libs/minichart-0.2.2/font-awesome-4.7.0/css/font-awesome.min.css new file mode 100644 index 00000000..c098a465 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/font-awesome-4.7.0/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/docs/reference/libs/minichart-0.2.2/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf b/docs/reference/libs/minichart-0.2.2/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf new file mode 100644 index 00000000..35acda2f Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf differ diff --git a/docs/reference/libs/minichart-0.2.2/help/AnIndex b/docs/reference/libs/minichart-0.2.2/help/AnIndex new file mode 100644 index 00000000..ed001894 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/help/AnIndex @@ -0,0 +1,13 @@ +addFlows addFlows +addMinicharts addMinicharts +clearFlows addFlows +clearMinicharts addMinicharts +d3.schemeCategory10 d3.schemeCategory10 +eco2mix eco2mix +eco2mixBalance eco2mix +popupArgs popupArgs +removeFlows addFlows +removeMinicharts addMinicharts +syncWith syncWith +updateFlows addFlows +updateMinicharts addMinicharts diff --git a/docs/reference/libs/minichart-0.2.2/help/aliases.rds b/docs/reference/libs/minichart-0.2.2/help/aliases.rds new file mode 100644 index 00000000..77dc5c05 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/help/aliases.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/help/leaflet.minicharts.rdb b/docs/reference/libs/minichart-0.2.2/help/leaflet.minicharts.rdb new file mode 100644 index 00000000..a92e0ef4 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/help/leaflet.minicharts.rdb differ diff --git a/docs/reference/libs/minichart-0.2.2/help/leaflet.minicharts.rdx b/docs/reference/libs/minichart-0.2.2/help/leaflet.minicharts.rdx new file mode 100644 index 00000000..5d801012 Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/help/leaflet.minicharts.rdx differ diff --git a/docs/reference/libs/minichart-0.2.2/help/paths.rds b/docs/reference/libs/minichart-0.2.2/help/paths.rds new file mode 100644 index 00000000..8a1b18bd Binary files /dev/null and b/docs/reference/libs/minichart-0.2.2/help/paths.rds differ diff --git a/docs/reference/libs/minichart-0.2.2/html/00Index.html b/docs/reference/libs/minichart-0.2.2/html/00Index.html new file mode 100644 index 00000000..c3e50f70 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/html/00Index.html @@ -0,0 +1,53 @@ + + +R: Mini Charts for Interactive Maps + + + +
    +

    Mini Charts for Interactive Maps + +

    +
    +
    +[Up] +[Top] +

    Documentation for package ‘leaflet.minicharts’ version 0.6.2

    + + + +

    Help Pages

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    addFlowsAdd or modify flows on a leaflet map
    addMinichartsAdd or update charts on a leaflet map
    clearFlowsAdd or modify flows on a leaflet map
    clearMinichartsAdd or update charts on a leaflet map
    d3.schemeCategory10d3 color palette
    eco2mixElectric production, consumption and exchanges of France
    eco2mixBalanceElectric production, consumption and exchanges of France
    popupArgsOptions for popup generation
    removeFlowsAdd or modify flows on a leaflet map
    removeMinichartsAdd or update charts on a leaflet map
    syncWithSynchronize multiple maps
    updateFlowsAdd or modify flows on a leaflet map
    updateMinichartsAdd or update charts on a leaflet map
    +
    diff --git a/docs/reference/libs/minichart-0.2.2/html/R.css b/docs/reference/libs/minichart-0.2.2/html/R.css new file mode 100644 index 00000000..2ef6cd60 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/html/R.css @@ -0,0 +1,120 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} diff --git a/docs/reference/libs/minichart-0.2.2/leaflet.minicharts.min.js b/docs/reference/libs/minichart-0.2.2/leaflet.minicharts.min.js new file mode 100644 index 00000000..dd9b136e --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/leaflet.minicharts.min.js @@ -0,0 +1,15 @@ +/*! leaflet.minicharts 0.2.1 2021-05-11 +Copyright © 2016 RTE Réseau de transport d’électricité */ + +!function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){return e(b[g][1][a]||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h=a.length;f=d(a),g=new l(3*h/4-f),c=f>0?h-4:h;var i=0;for(b=0;b>16&255,g[i++]=e>>8&255,g[i++]=255&e;return 2===f?(e=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,g[i++]=255&e):1===f&&(e=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,g[i++]=e>>8&255,g[i++]=255&e),g}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;fi?i:g+16383));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;nX)throw new RangeError("Invalid typed array length");var b=new Uint8Array(a);return b.__proto__=e.prototype,b}function e(a,b,c){if("number"==typeof a){if("string"==typeof b)throw new Error("If encoding is specified then the first argument must be a string");return i(a)}return f(a,b,c)}function f(a,b,c){if("number"==typeof a)throw new TypeError('"value" argument must not be a number');return T(a)||a&&T(a.buffer)?l(a,b,c):"string"==typeof a?j(a,b):m(a)}function g(a){if("number"!=typeof a)throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('"size" argument must not be negative')}function h(a,b,c){return g(a),a<=0?d(a):void 0!==b?"string"==typeof c?d(a).fill(b,c):d(a).fill(b):d(a)}function i(a){return g(a),d(a<0?0:0|n(a))}function j(a,b){if("string"==typeof b&&""!==b||(b="utf8"),!e.isEncoding(b))throw new TypeError("Unknown encoding: "+b);var c=0|p(a,b),f=d(c),g=f.write(a,b);return g!==c&&(f=f.slice(0,g)),f}function k(a){for(var b=a.length<0?0:0|n(a.length),c=d(b),e=0;e=X)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+X.toString(16)+" bytes");return 0|a}function o(a){return+a!=a&&(a=0),e.alloc(+a)}function p(a,b){if(e.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||T(a))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return O(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return R(a).length;default:if(d)return O(a).length;b=(""+b).toLowerCase(),d=!0}}function q(a,b,c){var d=!1;if((void 0===b||b<0)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,b>>>=0,c<=b)return"";for(a||(a="utf8");;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"latin1":case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function r(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function s(a,b,c,d,f){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,U(c)&&(c=f?0:a.length-1),c<0&&(c=a.length+c),c>=a.length){if(f)return-1;c=a.length-1}else if(c<0){if(!f)return-1;c=0}if("string"==typeof b&&(b=e.from(b,d)),e.isBuffer(b))return 0===b.length?-1:t(a,b,c,d,f);if("number"==typeof b)return b&=255,"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):t(a,[b],c,d,f);throw new TypeError("val must be string, number or Buffer")}function t(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,i=b.length;if(void 0!==d&&("ucs2"===(d=String(d).toLowerCase())||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;g=2,h/=2,i/=2,c/=2}var j;if(e){var k=-1;for(j=c;jh&&(c=h-i),j=c;j>=0;j--){for(var l=!0,m=0;me&&(d=e):d=e;var f=b.length;d>f/2&&(d=f/2);for(var g=0;g239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128==(192&i)&&(l=(31&f)<<6|63&i)>127&&(g=l);break;case 3:i=a[e+1],j=a[e+2],128==(192&i)&&128==(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j)>2047&&(l<55296||l>57343)&&(g=l);break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128==(192&i)&&128==(192&j)&&128==(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k)>65535&&l<1114112&&(g=l)}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(b<=Y)return String.fromCharCode.apply(String,a);for(var c="",d=0;dd)&&(c=d);for(var e="",f=b;fc)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,f,g){if(!e.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>f||ba.length)throw new RangeError("Index out of range")}function J(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function K(a,b,c,d,e){return b=+b,c>>>=0,e||J(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(a,b,c,d,23,4),c+4}function L(a,b,c,d,e){return b=+b,c>>>=0,e||J(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(a,b,c,d,52,8),c+8}function M(a){if(a=a.split("=")[0],a=a.trim().replace(Z,""),a.length<2)return"";for(;a.length%4!=0;)a+="=";return a}function N(a){return a<16?"0"+a.toString(16):a.toString(16)}function O(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=65536+(e-55296<<10|c-56320)}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function P(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function R(a){return V.toByteArray(M(a))}function S(a,b,c,d){for(var e=0;e=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function T(a){return a instanceof ArrayBuffer||null!=a&&null!=a.constructor&&"ArrayBuffer"===a.constructor.name&&"number"==typeof a.byteLength}function U(a){return a!==a}var V=a("base64-js"),W=a("ieee754");c.Buffer=e,c.SlowBuffer=o,c.INSPECT_MAX_BYTES=50;var X=2147483647;c.kMaxLength=X,e.TYPED_ARRAY_SUPPORT=function(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===a.foo()}catch(a){return!1}}(),e.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(e.prototype,"parent",{get:function(){if(this instanceof e)return this.buffer}}),Object.defineProperty(e.prototype,"offset",{get:function(){if(this instanceof e)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),e.poolSize=8192,e.from=function(a,b,c){return f(a,b,c)},e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,e.alloc=function(a,b,c){return h(a,b,c)},e.allocUnsafe=function(a){return i(a)},e.allocUnsafeSlow=function(a){return i(a)},e.isBuffer=function(a){return null!=a&&!0===a._isBuffer},e.compare=function(a,b){if(!e.isBuffer(a)||!e.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,f=0,g=Math.min(c,d);f0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},e.prototype.compare=function(a,b,c,d,f){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");if(void 0===b&&(b=0),void 0===c&&(c=a?a.length:0),void 0===d&&(d=0),void 0===f&&(f=this.length),b<0||c>a.length||d<0||f>this.length)throw new RangeError("out of range index");if(d>=f&&b>=c)return 0;if(d>=f)return-1;if(b>=c)return 1;if(b>>>=0,c>>>=0,d>>>=0,f>>>=0,this===a)return 0;for(var g=f-d,h=c-b,i=Math.min(g,h),j=this.slice(d,f),k=a.slice(b,c),l=0;l>>=0,isFinite(c)?(c>>>=0,void 0===d&&(d="utf8")):(d=c,c=void 0)}var e=this.length-b;if((void 0===c||c>e)&&(c=e),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(var f=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"latin1":case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(f)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),f=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;e.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c)<0&&(a=0):a>c&&(a=c),b<0?(b+=c)<0&&(b=0):b>c&&(b=c),b>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},e.prototype.readUInt8=function(a,b){return a>>>=0,b||H(a,1,this.length),this[a]},e.prototype.readUInt16LE=function(a,b){return a>>>=0,b||H(a,2,this.length),this[a]|this[a+1]<<8},e.prototype.readUInt16BE=function(a,b){return a>>>=0,b||H(a,2,this.length),this[a]<<8|this[a+1]},e.prototype.readUInt32LE=function(a,b){return a>>>=0,b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},e.prototype.readUInt32BE=function(a,b){return a>>>=0,b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},e.prototype.readIntLE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},e.prototype.readIntBE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},e.prototype.readInt8=function(a,b){return a>>>=0,b||H(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},e.prototype.readInt16LE=function(a,b){a>>>=0,b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},e.prototype.readInt16BE=function(a,b){a>>>=0,b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},e.prototype.readInt32LE=function(a,b){return a>>>=0,b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},e.prototype.readInt32BE=function(a,b){return a>>>=0,b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},e.prototype.readFloatLE=function(a,b){return a>>>=0,b||H(a,4,this.length),W.read(this,a,!0,23,4)},e.prototype.readFloatBE=function(a,b){return a>>>=0,b||H(a,4,this.length),W.read(this,a,!1,23,4)},e.prototype.readDoubleLE=function(a,b){return a>>>=0,b||H(a,8,this.length),W.read(this,a,!0,52,8)},e.prototype.readDoubleBE=function(a,b){return a>>>=0,b||H(a,8,this.length),W.read(this,a,!1,52,8)},e.prototype.writeUIntLE=function(a,b,c,d){if(a=+a,b>>>=0,c>>>=0,!d){I(this,a,b,c,Math.pow(2,8*c)-1,0)}var e=1,f=0;for(this[b]=255&a;++f>>=0,c>>>=0,!d){I(this,a,b,c,Math.pow(2,8*c)-1,0)}var e=c-1,f=1;for(this[b+e]=255&a;--e>=0&&(f*=256);)this[b+e]=a/f&255;return b+c},e.prototype.writeUInt8=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,1,255,0),this[b]=255&a,b+1},e.prototype.writeUInt16LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,65535,0),this[b]=255&a,this[b+1]=a>>>8,b+2},e.prototype.writeUInt16BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,65535,0),this[b]=a>>>8,this[b+1]=255&a,b+2},e.prototype.writeUInt32LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,4294967295,0),this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a,b+4},e.prototype.writeUInt32BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,4294967295,0),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},e.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=0;for(this[b]=255&a;++f>0)-h&255;return b+c},e.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0;for(this[b+f]=255&a;--f>=0&&(g*=256);)a<0&&0===h&&0!==this[b+f+1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},e.prototype.writeInt8=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,1,127,-128),a<0&&(a=255+a+1),this[b]=255&a,b+1},e.prototype.writeInt16LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,32767,-32768),this[b]=255&a,this[b+1]=a>>>8,b+2},e.prototype.writeInt16BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,32767,-32768),this[b]=a>>>8,this[b+1]=255&a,b+2},e.prototype.writeInt32LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,2147483647,-2147483648),this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24,b+4},e.prototype.writeInt32BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},e.prototype.writeFloatLE=function(a,b,c){return K(this,a,b,!0,c)},e.prototype.writeFloatBE=function(a,b,c){return K(this,a,b,!1,c)},e.prototype.writeDoubleLE=function(a,b,c){return L(this,a,b,!0,c)},e.prototype.writeDoubleBE=function(a,b,c){return L(this,a,b,!1,c)},e.prototype.copy=function(a,b,c,d){if(!e.isBuffer(a))throw new TypeError("argument should be a Buffer");if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d=this.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b=0;--g)a[g+b]=this[g+c];else Uint8Array.prototype.set.call(a,this.subarray(c,d),b);return f},e.prototype.fill=function(a,b,c,d){if("string"==typeof a){if("string"==typeof b?(d=b,b=0,c=this.length):"string"==typeof c&&(d=c,c=this.length),void 0!==d&&"string"!=typeof d)throw new TypeError("encoding must be a string");if("string"==typeof d&&!e.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(1===a.length){var f=a.charCodeAt(0);("utf8"===d&&f<128||"latin1"===d)&&(a=f)}}else"number"==typeof a&&(a&=255);if(b<0||this.length>>=0,c=void 0===c?this.length:c>>>0,a||(a=0);var g;if("number"==typeof a)for(g=b;g=0?(f>=y?10:f>=z?5:f>=A?2:1)*Math.pow(10,e):-Math.pow(10,-e)/(f>=y?10:f>=z?5:f>=A?2:1)}function e(a,b,c){var d=Math.abs(b-a)/Math.max(0,c),e=Math.pow(10,Math.floor(Math.log(d)/Math.LN10)),f=d/e;return f>=y?e*=10:f>=z?e*=5:f>=A&&(e*=2),bb?1:a>=b?0:NaN},h=function(a){return 1===a.length&&(a=b(a)),{left:function(b,c,d,e){for(null==d&&(d=0),null==e&&(e=b.length);d>>1;a(b[f],c)<0?d=f+1:e=f}return d},right:function(b,c,d,e){for(null==d&&(d=0),null==e&&(e=b.length);d>>1;a(b[f],c)>0?e=f:d=f+1}return d}}},i=h(g),j=i.right,k=i.left,l=function(a,b){null==b&&(b=c);for(var d=0,e=a.length-1,f=a[0],g=new Array(e<0?0:e);da?1:b>=a?0:NaN},o=function(a){return null===a?NaN:+a},p=function(a,b){var c,d,e=a.length,f=0,g=-1,h=0,i=0;if(null==b)for(;++g1)return i/(f-1)},q=function(a,b){var c=p(a,b);return c?Math.sqrt(c):c},r=function(a,b){var c,d,e,f=a.length,g=-1;if(null==b){for(;++g=c)for(d=e=c;++gc&&(d=c),e=c)for(d=e=c;++gc&&(d=c),e0)return[a];if((e=b0)for(a=Math.ceil(a/h),b=Math.floor(b/h),g=new Array(f=Math.ceil(b-a+1));++im;)n.pop(),--o;var p,q=new Array(o+1);for(f=0;f<=o;++f)p=q[f]=[],p.x0=f>0?n[f-1]:l,p.x1=f=1)return+c(a[d-1],d-1,a);var d,e=(d-1)*b,f=Math.floor(e),g=+c(a[f],f,a);return g+(+c(a[f+1],f+1,a)-g)*(e-f)}},F=function(a,b,c){return a=u.call(a,o).sort(g),Math.ceil((c-b)/(2*(E(a,.75)-E(a,.25))*Math.pow(a.length,-1/3)))},G=function(a,b,c){return Math.ceil((c-b)/(3.5*q(a)*Math.pow(a.length,-1/3)))},H=function(a,b){var c,d,e=a.length,f=-1;if(null==b){for(;++f=c)for(d=c;++fd&&(d=c)}else for(;++f=c)for(d=c;++fd&&(d=c);return d},I=function(a,b){var c,d=a.length,e=d,f=-1,g=0;if(null==b)for(;++f=0;)for(d=a[e],b=d.length;--b>=0;)c[--g]=d[b];return c},L=function(a,b){var c,d,e=a.length,f=-1;if(null==b){for(;++f=c)for(d=c;++fc&&(d=c)}else for(;++f=c)for(d=c;++fc&&(d=c);return d},M=function(a,b){for(var c=b.length,d=new Array(c);c--;)d[c]=a[b[c]];return d},N=function(a,b){if(c=a.length){var c,d,e=0,f=0,h=a[f];for(null==b&&(b=g);++eMath.abs(a[1]-ba[1])?O=!0:N=!0),ba=a,M=!0,s(),d()}function d(){var a;switch(K=ba[0]-aa[0],L=ba[1]-aa[1],R){case u:case t:S&&(K=Math.max(X-m,Math.min(Z-z,K)),p=m+K,F=z+K),T&&(L=Math.max(Y-q,Math.min($-H,L)),r=q+L,J=H+L);break;case v:S<0?(K=Math.max(X-m,Math.min(Z-m,K)),p=m+K,F=z):S>0&&(K=Math.max(X-z,Math.min(Z-z,K)),p=m,F=z+K),T<0?(L=Math.max(Y-q,Math.min($-q,L)),r=q+L,J=H):T>0&&(L=Math.max(Y-H,Math.min($-H,L)),r=q,J=H+L);break;case w:S&&(p=Math.max(X,Math.min(Z,m-K*S)),F=Math.max(X,Math.min(Z,z+K*S))),T&&(r=Math.max(Y,Math.min($,q-L*T)),J=Math.max(Y,Math.min($,H+L*T)))}F0&&(m=p-K),T<0?H=J-L:T>0&&(q=r-L),R=u,ea.attr("cursor",A.selection),d());break;default:return}s()}function j(){switch(e.event.keyCode){case 16:_&&(N=O=_=!1,d());break;case 18:R===w&&(S<0?z=F:S>0&&(m=p),T<0?H=J:T>0&&(q=r),R=v,d());break;case 32:R===u&&(e.event.altKey?(S&&(z=F-K*S,m=p+K*S),T&&(H=J-L*T,q=r+L*T),R=w):(S<0?z=F:S>0&&(m=p),T<0?H=J:T>0&&(q=r),R=v),ea.attr("cursor",A[Q]),d());break;default:return}s()}if(e.event.touches){if(e.event.changedTouches.length=k.length)return null!=h&&b.sort(h),null!=i?i(b):b;for(var g,j,l,m=-1,n=b.length,o=k[d++],p=c(),q=e();++mk.length)return a;var d,e=l[c-1];return null!=i&&c>=k.length?d=a.entries():(d=[],a.each(function(a,e){d.push({key:e,values:b(a,c)})})),null!=e?d.sort(function(a,b){return e(a.key,b.key)}):d}var h,i,j,k=[],l=[];return j={object:function(b){return a(b,0,d,e)},map:function(b){return a(b,0,f,g)},entries:function(c){return b(a(c,0,f,g),0)},key:function(a){return k.push(a),j},sortKeys:function(a){return l[k.length-1]=a,j},sortValues:function(a){return h=a,j},rollup:function(a){return i=a,j}}},k=c.prototype;h.prototype=i.prototype={constructor:h,has:k.has,add:function(a){return a+="",this["$"+a]=a,this},remove:k.remove,clear:k.clear,values:k.keys,size:k.size,empty:k.empty,each:k.each};var l=function(a){var b=[];for(var c in a)b.push(c);return b},m=function(a){var b=[];for(var c in a)b.push(a[c]);return b},n=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b};a.nest=j,a.set=i,a.map=c,a.keys=l,a.values=m,a.entries=n,Object.defineProperty(a,"__esModule",{value:!0})})},{}],15:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(a,b){var c=Object.create(a.prototype);for(var d in b)c[d]=b[d];return c}function c(){}function d(a){var b;return a=(a+"").trim().toLowerCase(),(b=F.exec(a))?(b=parseInt(b[1],16),new i(b>>8&15|b>>4&240,b>>4&15|240&b,(15&b)<<4|15&b,1)):(b=G.exec(a))?e(parseInt(b[1],16)):(b=H.exec(a))?new i(b[1],b[2],b[3],1):(b=I.exec(a))?new i(255*b[1]/100,255*b[2]/100,255*b[3]/100,1):(b=J.exec(a))?f(b[1],b[2],b[3],b[4]):(b=K.exec(a))?f(255*b[1]/100,255*b[2]/100,255*b[3]/100,b[4]):(b=L.exec(a))?j(b[1],b[2]/100,b[3]/100,1):(b=M.exec(a))?j(b[1],b[2]/100,b[3]/100,b[4]):N.hasOwnProperty(a)?e(N[a]):"transparent"===a?new i(NaN,NaN,NaN,0):null}function e(a){return new i(a>>16&255,a>>8&255,255&a,1)}function f(a,b,c,d){return d<=0&&(a=b=c=NaN),new i(a,b,c,d)}function g(a){return a instanceof c||(a=d(a)),a?(a=a.rgb(),new i(a.r,a.g,a.b,a.opacity)):new i}function h(a,b,c,d){return 1===arguments.length?g(a):new i(a,b,c,null==d?1:d)}function i(a,b,c,d){this.r=+a,this.g=+b,this.b=+c,this.opacity=+d}function j(a,b,c,d){return d<=0?a=b=c=NaN:c<=0||c>=1?a=b=NaN:b<=0&&(a=NaN),new m(a,b,c,d)}function k(a){if(a instanceof m)return new m(a.h,a.s,a.l,a.opacity);if(a instanceof c||(a=d(a)),!a)return new m;if(a instanceof m)return a;a=a.rgb();var b=a.r/255,e=a.g/255,f=a.b/255,g=Math.min(b,e,f),h=Math.max(b,e,f),i=NaN,j=h-g,k=(h+g)/2;return j?(i=b===h?(e-f)/j+6*(e0&&k<1?0:i,new m(i,j,k,a.opacity)}function l(a,b,c,d){return 1===arguments.length?k(a):new m(a,b,c,null==d?1:d)}function m(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}function n(a,b,c){return 255*(a<60?b+(c-b)*a/60:a<180?c:a<240?b+(c-b)*(240-a)/60:b)}function o(a){if(a instanceof q)return new q(a.l,a.a,a.b,a.opacity);if(a instanceof x){var b=a.h*O;return new q(a.l,Math.cos(b)*a.c,Math.sin(b)*a.c,a.opacity)}a instanceof i||(a=g(a));var c=u(a.r),d=u(a.g),e=u(a.b),f=r((.4124564*c+.3575761*d+.1804375*e)/Q),h=r((.2126729*c+.7151522*d+.072175*e)/R);return new q(116*h-16,500*(f-h),200*(h-r((.0193339*c+.119192*d+.9503041*e)/S)),a.opacity)}function p(a,b,c,d){return 1===arguments.length?o(a):new q(a,b,c,null==d?1:d)}function q(a,b,c,d){this.l=+a,this.a=+b,this.b=+c,this.opacity=+d}function r(a){return a>W?Math.pow(a,1/3):a/V+T}function s(a){return a>U?a*a*a:V*(a-T)}function t(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function u(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function v(a){if(a instanceof x)return new x(a.h,a.c,a.l,a.opacity);a instanceof q||(a=o(a));var b=Math.atan2(a.b,a.a)*P;return new x(b<0?b+360:b,Math.sqrt(a.a*a.a+a.b*a.b),a.l,a.opacity)}function w(a,b,c,d){return 1===arguments.length?v(a):new x(a,b,c,null==d?1:d)}function x(a,b,c,d){this.h=+a,this.c=+b,this.l=+c,this.opacity=+d}function y(a){if(a instanceof A)return new A(a.h,a.s,a.l,a.opacity);a instanceof i||(a=g(a));var b=a.r/255,c=a.g/255,d=a.b/255,e=(ca*d+aa*b-ba*c)/(ca+aa-ba),f=d-e,h=(_*(c-e)-Z*f)/$,j=Math.sqrt(h*h+f*f)/(_*e*(1-e)),k=j?Math.atan2(h,f)*P-120:NaN;return new A(k<0?k+360:k,j,e,a.opacity)}function z(a,b,c,d){return 1===arguments.length?y(a):new A(a,b,c,null==d?1:d)}function A(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}var B=function(a,b,c){a.prototype=b.prototype=c,c.constructor=a},C="\\s*([+-]?\\d+)\\s*",D="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",E="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",F=/^#([0-9a-f]{3})$/,G=/^#([0-9a-f]{6})$/,H=new RegExp("^rgb\\("+[C,C,C]+"\\)$"),I=new RegExp("^rgb\\("+[E,E,E]+"\\)$"),J=new RegExp("^rgba\\("+[C,C,C,D]+"\\)$"),K=new RegExp("^rgba\\("+[E,E,E,D]+"\\)$"),L=new RegExp("^hsl\\("+[D,E,E]+"\\)$"),M=new RegExp("^hsla\\("+[D,E,E,D]+"\\)$"),N={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};B(c,d,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),B(i,h,b(c,{brighter:function(a){return a=null==a?1/.7:Math.pow(1/.7,a),new i(this.r*a,this.g*a,this.b*a,this.opacity)},darker:function(a){return a=null==a?.7:Math.pow(.7,a),new i(this.r*a,this.g*a,this.b*a,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var a=this.opacity;return a=isNaN(a)?1:Math.max(0,Math.min(1,a)),(1===a?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===a?")":", "+a+")")}})),B(m,l,b(c,{brighter:function(a){return a=null==a?1/.7:Math.pow(1/.7,a),new m(this.h,this.s,this.l*a,this.opacity)},darker:function(a){return a=null==a?.7:Math.pow(.7,a),new m(this.h,this.s,this.l*a,this.opacity)},rgb:function(){var a=this.h%360+360*(this.h<0),b=isNaN(a)||isNaN(this.s)?0:this.s,c=this.l,d=c+(c<.5?c:1-c)*b,e=2*c-d;return new i(n(a>=240?a-240:a+120,e,d),n(a,e,d),n(a<120?a+240:a-120,e,d),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var O=Math.PI/180,P=180/Math.PI,Q=.95047,R=1,S=1.08883,T=4/29,U=6/29,V=3*U*U,W=U*U*U;B(q,p,b(c,{brighter:function(a){return new q(this.l+18*(null==a?1:a),this.a,this.b,this.opacity)},darker:function(a){return new q(this.l-18*(null==a?1:a),this.a,this.b,this.opacity)},rgb:function(){var a=(this.l+16)/116,b=isNaN(this.a)?a:a+this.a/500,c=isNaN(this.b)?a:a-this.b/200;return a=R*s(a),b=Q*s(b),c=S*s(c),new i(t(3.2404542*b-1.5371385*a-.4985314*c),t(-.969266*b+1.8760108*a+.041556*c),t(.0556434*b-.2040259*a+1.0572252*c),this.opacity)}})),B(x,w,b(c,{brighter:function(a){return new x(this.h,this.c,this.l+18*(null==a?1:a),this.opacity)},darker:function(a){return new x(this.h,this.c,this.l-18*(null==a?1:a),this.opacity)},rgb:function(){return o(this).rgb()}}));var X=-.14861,Y=1.78277,Z=-.29227,$=-.90649,_=1.97294,aa=_*$,ba=_*Y,ca=Y*Z-$*X;B(A,z,b(c,{brighter:function(a){return a=null==a?1/.7:Math.pow(1/.7,a),new A(this.h,this.s,this.l*a,this.opacity)},darker:function(a){return a=null==a?.7:Math.pow(.7,a),new A(this.h,this.s,this.l*a,this.opacity)},rgb:function(){var a=isNaN(this.h)?0:(this.h+120)*O,b=+this.l,c=isNaN(this.s)?0:this.s*b*(1-b),d=Math.cos(a),e=Math.sin(a);return new i(255*(b+c*(X*d+Y*e)),255*(b+c*(Z*d+$*e)),255*(b+c*(_*d)),this.opacity)}})),a.color=d,a.rgb=h,a.hsl=l,a.lab=p,a.hcl=w,a.cubehelix=z,Object.defineProperty(a,"__esModule",{value:!0})})},{}],16:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(){for(var a,b=0,d=arguments.length,e={};b=0&&(c=a.slice(d+1),a=a.slice(0,d)),a&&!b.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:c}})}function e(a,b){for(var c,d=0,e=a.length;d0)for(var c,d,e=new Array(c),f=0;fF}C.mouse("drag")}function p(){c.select(c.event.view).on("mousemove.drag mouseup.drag",null),e(c.event.view,w),k(),C.mouse("end")}function q(){if(y.apply(this,arguments)){var a,b,e=c.event.changedTouches,f=z.apply(this,arguments),g=e.length;for(a=0;a=k?n=!0:(c=a.charCodeAt(l++))===h?o=!0:c===i&&(o=!0,a.charCodeAt(l)===h&&++l),a.slice(d+1,b-1).replace(/""/g,'"')}for(;lm+h||do+h||el.index){var i=m-f.x-f.vx,k=o-f.y-f.vy,r=i*i+k*k;ra.r&&(a.r=a[b].r)}function e(){if(h){var b,c,d=h.length;for(i=new Array(d),b=0;b1?(null==b?o.remove(a):o.set(a,h(b)),i):o.get(a)},find:function(b,c,d){var e,f,g,h,i,j=0,k=a.length;for(null==d?d=1/0:d*=d,j=0;j1?(s.on(a,b),i):s.on(a)}}},t=function(){function a(a){var c,i=f.length,l=b.quadtree(f,j,k).visitAfter(d);for(h=a,c=0;c=p)){(a.data!==g||a.next)&&(0===e&&(e=n(),k+=e*e),0===f&&(f=n(),k+=f*f),k",e=b[3]||"-",f=b[4]||"",g=!!b[5],h=b[6]&&+b[6],i=!!b[7],j=b[8]&&+b[8].slice(1),k=b[9]||"";"n"===k?(i=!0,k="g"):m[k]||(k=""),(g||"0"===c&&"="===d)&&(g=!0,c="0",d="="),this.fill=c,this.align=d,this.sign=e,this.symbol=f,this.zero=g,this.width=h,this.comma=i,this.precision=j,this.type=k}function d(b){return o=r(b),a.format=o.format,a.formatPrefix=o.formatPrefix,o}var e,f=function(a,b){if((c=(a=b?a.toExponential(b-1):a.toExponential()).indexOf("e"))<0)return null;var c,d=a.slice(0,c);return[d.length>1?d[0]+d.slice(2):d,+a.slice(c+1)]},g=function(a){return a=f(Math.abs(a)),a?a[1]:NaN},h=function(a,b){return function(c,d){for(var e=c.length,f=[],g=0,h=a[0],i=0;e>0&&h>0&&(i+h+1>d&&(h=Math.max(1,d-i)),f.push(c.substring(e-=h,e+h)),!((i+=h+1)>d));)h=a[g=(g+1)%a.length];return f.reverse().join(b)}},i=function(a){return function(b){return b.replace(/[0-9]/g,function(b){return a[+b]})}},j=function(a,b){a=a.toPrecision(b);a:for(var c,d=a.length,e=1,f=-1;e0&&(f=0)}return f>0?a.slice(0,f)+a.slice(c+1):a},k=function(a,b){var c=f(a,b);if(!c)return a+"";var d=c[0],g=c[1],h=g-(e=3*Math.max(-8,Math.min(8,Math.floor(g/3))))+1,i=d.length;return h===i?d:h>i?d+new Array(h-i+1).join("0"):h>0?d.slice(0,h)+"."+d.slice(h):"0."+new Array(1-h).join("0")+f(a,Math.max(0,b+h-1))[0]},l=function(a,b){var c=f(a,b);if(!c)return a+"";var d=c[0],e=c[1];return e<0?"0."+new Array(-e).join("0")+d:d.length>e+1?d.slice(0,e+1)+"."+d.slice(e+1):d+new Array(e-d.length+2).join("0")},m={"":j,"%":function(a,b){return(100*a).toFixed(b)},b:function(a){return Math.round(a).toString(2)},c:function(a){return a+""},d:function(a){return Math.round(a).toString(10)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},g:function(a,b){return a.toPrecision(b)},o:function(a){return Math.round(a).toString(8)},p:function(a,b){return l(100*a,b)},r:l,s:k,X:function(a){return Math.round(a).toString(16).toUpperCase()},x:function(a){return Math.round(a).toString(16)}},n=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;b.prototype=c.prototype,c.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var o,p=function(a){return a},q=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],r=function(a){function c(a){function c(a){var b,c,i,j=u,m=v;if("c"===t)m=w(a)+m,a="";else{a=+a;var n=a<0;if(a=w(Math.abs(a),s),n&&0==+a&&(n=!1),j=(n?"("===h?h:"-":"-"===h||"("===h?"":h)+j,m=("s"===t?q[8+e/3]:"")+m+(n&&"("===h?")":""),x)for(b=-1,c=a.length;++b(i=a.charCodeAt(b))||i>57){m=(46===i?k+a.slice(b+1):a.slice(b))+m,a=a.slice(0,b);break}}r&&!o&&(a=f(a,1/0));var y=j.length+a.length+m.length,z=y>1)+j+a+m+z.slice(y);break;default:a=z+j+a+m}return l(a)}a=b(a);var d=a.fill,g=a.align,h=a.sign,i=a.symbol,o=a.zero,p=a.width,r=a.comma,s=a.precision,t=a.type,u="$"===i?j[0]:"#"===i&&/[boxX]/.test(t)?"0"+t.toLowerCase():"",v="$"===i?j[1]:/[%p]/.test(t)?n:"",w=m[t],x=!t||/[defgprs%]/.test(t);return s=null==s?t?6:12:/[gprs]/.test(t)?Math.max(1,Math.min(21,s)):Math.max(0,Math.min(20,s)),c.toString=function(){return a+""},c}function d(a,d){var e=c((a=b(a),a.type="f",a)),f=3*Math.max(-8,Math.min(8,Math.floor(g(d)/3))),h=Math.pow(10,-f),i=q[8+f/3];return function(a){return e(h*a)+i}}var f=a.grouping&&a.thousands?h(a.grouping,a.thousands):p,j=a.currency,k=a.decimal,l=a.numerals?i(a.numerals):p,n=a.percent||"%";return{format:c,formatPrefix:d}};d({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var s=function(a){return Math.max(0,-g(Math.abs(a)))},t=function(a,b){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(g(b)/3)))-g(Math.abs(a)))},u=function(a,b){return a=Math.abs(a),b=Math.abs(b)-a,Math.max(0,g(b)-g(a))+1};a.formatDefaultLocale=d,a.formatLocale=r,a.formatSpecifier=b,a.precisionFixed=s,a.precisionPrefix=t,a.precisionRound=u,Object.defineProperty(a,"__esModule",{value:!0})})},{}],22:[function(a,b,c){!function(d,e){"object"==typeof c&&void 0!==b?e(c,a("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],e):e(d.d3=d.d3||{},d.d3)}(this,function(a,b){"use strict";function c(){this.reset()}function d(a,b,c){var d=a.s=b+c,e=d-b,f=d-e;a.t=b-f+(c-e)}function e(a){return a>1?0:a<-1?Ub:Math.acos(a)}function f(a){return a>1?Vb:a<-1?-Vb:Math.asin(a)}function g(a){return(a=gc(a/2))*a}function h(){}function i(a,b){a&&lc.hasOwnProperty(a.type)&&lc[a.type](a,b)}function j(a,b,c){var d,e=-1,f=a.length-c;for(b.lineStart();++e=0?1:-1,e=d*c,f=bc(b),g=gc(b),h=rb*g,i=qb*f+h*bc(e),j=h*d*gc(e);nc.add(ac(j,i)),pb=a,qb=f,rb=g}function p(a){return[ac(a[1],a[0]),f(a[2])]}function q(a){var b=a[0],c=a[1],d=bc(c);return[d*bc(b),d*gc(b),gc(c)]}function r(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function s(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]}function t(a,b){a[0]+=b[0],a[1]+=b[1],a[2]+=b[2]}function u(a,b){return[a[0]*b,a[1]*b,a[2]*b]}function v(a){var b=ic(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);a[0]/=b,a[1]/=b,a[2]/=b}function w(a,b){Ab.push(Bb=[sb=a,ub=a]),bvb&&(vb=b)}function x(a,b){var c=q([a*Zb,b*Zb]);if(zb){var d=s(zb,c),e=[d[1],-d[0],0],f=s(e,d);v(f),f=p(f);var g,h=a-wb,i=h>0?1:-1,j=f[0]*Yb*i,k=$b(h)>180;k^(i*wbvb&&(vb=g):(j=(j+360)%360-180,k^(i*wbvb&&(vb=b))),k?aD(sb,ub)&&(ub=a):D(a,ub)>D(sb,ub)&&(sb=a):ub>=sb?(aub&&(ub=a)):a>wb?D(sb,a)>D(sb,ub)&&(ub=a):D(a,ub)>D(sb,ub)&&(sb=a)}else Ab.push(Bb=[sb=a,ub=a]);bvb&&(vb=b),zb=c,wb=a}function y(){sc.point=x}function z(){Bb[0]=sb,Bb[1]=ub,sc.point=w,zb=null}function A(a,b){if(zb){var c=a-wb;rc.add($b(c)>180?c+(c>0?360:-360):c)}else xb=a,yb=b;pc.point(a,b),x(a,b)}function B(){pc.lineStart()}function C(){A(xb,yb),pc.lineEnd(),$b(rc)>Tb&&(sb=-(ub=180)),Bb[0]=sb,Bb[1]=ub,zb=null}function D(a,b){return(b-=a)<0?b+360:b}function E(a,b){return a[0]-b[0]}function F(a,b){return a[0]<=a[1]?a[0]<=b&&b<=a[1]:bUb?a-Xb:a<-Ub?a+Xb:a,b]}function R(a,b,c){return(a%=Xb)?b||c?xc(T(a),U(b,c)):T(a):b||c?U(b,c):Q}function S(a){return function(b,c){return b+=a,[b>Ub?b-Xb:b<-Ub?b+Xb:b,c]}}function T(a){var b=S(a);return b.invert=S(-a),b}function U(a,b){function c(a,b){var c=bc(b),i=bc(a)*c,j=gc(a)*c,k=gc(b),l=k*d+i*e;return[ac(j*g-l*h,i*d-k*e),f(l*g+j*h)]}var d=bc(a),e=gc(a),g=bc(b),h=gc(b);return c.invert=function(a,b){var c=bc(b),i=bc(a)*c,j=gc(a)*c,k=gc(b),l=k*g-j*h;return[ac(j*g+k*h,i*d+l*e),f(l*d-i*e)]},c}function V(a,b,c,d,e,f){if(c){var g=bc(b),h=gc(b),i=d*c;null==e?(e=b+d*Xb,f=b-i/2):(e=W(g,e),f=W(g,f),(d>0?ef)&&(e+=d*Xb));for(var j,k=e;d>0?k>f:k1}function $(a,b){return((a=a.x)[0]<0?a[1]-Vb-Tb:Vb-a[1])-((b=b.x)[0]<0?b[1]-Vb-Tb:Vb-b[1])}function _(a){var b,c=NaN,d=NaN,e=NaN;return{lineStart:function(){a.lineStart(),b=1},point:function(f,g){var h=f>0?Ub:-Ub,i=$b(f-c);$b(i-Ub)0?Vb:-Vb),a.point(e,d),a.lineEnd(),a.lineStart(),a.point(h,d),a.point(f,d),b=0):e!==h&&i>=Ub&&($b(c-e)Tb?_b((gc(b)*(f=bc(d))*gc(c)-gc(d)*(e=bc(b))*gc(a))/(e*f*g)):(b+d)/2}function ba(a,b,c,d){var e;if(null==a)e=c*Vb,d.point(-Ub,e),d.point(0,e),d.point(Ub,e),d.point(Ub,0),d.point(Ub,-e),d.point(0,-e),d.point(-Ub,-e),d.point(-Ub,0),d.point(-Ub,e);else if($b(a[0]-b[0])>Tb){var f=a[0]0)do{i.point(0===k||3===k?a:d,k>1?e:c)}while((k=(k+g+4)%4)!==l);else i.point(f[0],f[1])}function h(b,e){return $b(b[0]-a)0?0:3:$b(b[0]-d)0?2:1:$b(b[1]-c)0?1:0:e>0?3:2}function i(a,b){return j(a.x,b.x)}function j(a,b){var c=h(a,1),d=h(b,1);return c!==d?c-d:0===c?b[1]-a[1]:1===c?a[0]-b[0]:2===c?a[1]-b[1]:b[0]-a[0]}return function(h){function j(a,b){f(a,b)&&B.point(a,b)}function k(){for(var b=0,c=0,d=r.length;ce&&(l-f)*(e-g)>(m-g)*(a-f)&&++b:m<=e&&(l-f)*(e-g)<(m-g)*(a-f)&&--b;return b}function l(){B=C,q=[],r=[],A=!0}function m(){var a=k(),c=A&&a,d=(q=b.merge(q)).length;(c||d)&&(h.polygonStart(),c&&(h.lineStart(),g(null,null,1,h),h.lineEnd()),d&&Nc(q,i,a,g,h),h.polygonEnd()),B=h,q=r=s=null}function n(){D.point=p,r&&r.push(s=[]),z=!0,y=!1,w=x=NaN}function o(){q&&(p(t,u),v&&y&&C.rejoin(),q.push(C.result())),D.point=j,y&&B.lineEnd()}function p(b,g){var h=f(b,g);if(r&&s.push([b,g]),z)t=b,u=g,v=h,z=!1,h&&(B.lineStart(),B.point(b,g));else if(h&&y)B.point(b,g);else{var i=[w=Math.max(Vc,Math.min(Uc,w)),x=Math.max(Vc,Math.min(Uc,x))],j=[b=Math.max(Vc,Math.min(Uc,b)),g=Math.max(Vc,Math.min(Uc,g))];Tc(i,j,a,c,d,e)?(y||(B.lineStart(),B.point(i[0],i[1])),B.point(j[0],j[1]),h||B.lineEnd(),A=!1):h&&(B.lineStart(),B.point(b,g),A=!1)}w=b,x=g,y=h}var q,r,s,t,u,v,w,x,y,z,A,B=h,C=Lc(),D={point:j,lineStart:n,lineEnd:o,polygonStart:l,polygonEnd:m};return D}}function da(){Yc.point=fa,Yc.lineEnd=ea}function ea(){Yc.point=Yc.lineEnd=h}function fa(a,b){a*=Zb,b*=Zb,yc=a,zc=gc(b),Ac=bc(b),Yc.point=ga}function ga(a,b){a*=Zb,b*=Zb;var c=gc(b),d=bc(b),e=$b(a-yc),f=bc(e),g=gc(e),h=d*g,i=Ac*c-zc*d*f,j=zc*c+Ac*d*f;Xc.add(ac(ic(h*h+i*i),j)),yc=a,zc=c,Ac=d}function ha(a,b){return!(!a||!cd.hasOwnProperty(a.type))&&cd[a.type](a,b)}function ia(a,b){return 0===ad(a,b)}function ja(a,b){var c=ad(a[0],a[1]);return ad(a[0],b)+ad(b,a[1])<=c+Tb}function ka(a,b){return!!Pc(a.map(la),ma(b))}function la(a){return a=a.map(ma),a.pop(),a}function ma(a){return[a[0]*Zb,a[1]*Zb]}function na(a,c,d){var e=b.range(a,c-Tb,d).concat(c);return function(a){return e.map(function(b){return[a,b]})}}function oa(a,c,d){var e=b.range(a,c-Tb,d).concat(c);return function(a){return e.map(function(b){return[b,a]})}}function pa(){function a(){return{type:"MultiLineString",coordinates:c()}}function c(){return b.range(cc(g/r)*r,f,r).map(n).concat(b.range(cc(k/s)*s,j,s).map(o)).concat(b.range(cc(e/p)*p,d,p).filter(function(a){return $b(a%r)>Tb}).map(l)).concat(b.range(cc(i/q)*q,h,q).filter(function(a){return $b(a%s)>Tb}).map(m))}var d,e,f,g,h,i,j,k,l,m,n,o,p=10,q=p,r=90,s=360,t=2.5;return a.lines=function(){return c().map(function(a){return{type:"LineString",coordinates:a}})},a.outline=function(){return{type:"Polygon",coordinates:[n(g).concat(o(j).slice(1),n(f).reverse().slice(1),o(k).reverse().slice(1))]}},a.extent=function(b){return arguments.length?a.extentMajor(b).extentMinor(b):a.extentMinor()},a.extentMajor=function(b){return arguments.length?(g=+b[0][0],f=+b[1][0],k=+b[0][1],j=+b[1][1],g>f&&(b=g,g=f,f=b),k>j&&(b=k,k=j,j=b),a.precision(t)):[[g,k],[f,j]]},a.extentMinor=function(b){return arguments.length?(e=+b[0][0],d=+b[1][0],i=+b[0][1],h=+b[1][1],e>d&&(b=e,e=d,d=b),i>h&&(b=i,i=h,h=b),a.precision(t)):[[e,i],[d,h]]},a.step=function(b){return arguments.length?a.stepMajor(b).stepMinor(b):a.stepMinor()},a.stepMajor=function(b){return arguments.length?(r=+b[0],s=+b[1],a):[r,s]},a.stepMinor=function(b){return arguments.length?(p=+b[0],q=+b[1],a):[p,q]},a.precision=function(b){return arguments.length?(t=+b,l=na(i,h,90),m=oa(e,d,t),n=na(k,j,90),o=oa(g,f,t),a):t},a.extentMajor([[-180,-90+Tb],[180,90-Tb]]).extentMinor([[-180,-80-Tb],[180,80+Tb]])}function qa(){return pa()()}function ra(){id.point=sa}function sa(a,b){id.point=ta,Bc=Dc=a,Cc=Ec=b}function ta(a,b){hd.add(Ec*a-Dc*b),Dc=a,Ec=b}function ua(){ta(Bc,Cc)}function va(a,b){ald&&(ld=a),bmd&&(md=b)}function wa(a,b){od+=a,pd+=b,++qd}function xa(){xd.point=ya}function ya(a,b){xd.point=za,wa(Hc=a,Ic=b)}function za(a,b){var c=a-Hc,d=b-Ic,e=ic(c*c+d*d);rd+=e*(Hc+a)/2,sd+=e*(Ic+b)/2,td+=e,wa(Hc=a,Ic=b)}function Aa(){xd.point=wa}function Ba(){xd.point=Da}function Ca(){Ea(Fc,Gc)}function Da(a,b){xd.point=Ea,wa(Fc=Hc=a,Gc=Ic=b)}function Ea(a,b){var c=a-Hc,d=b-Ic,e=ic(c*c+d*d);rd+=e*(Hc+a)/2,sd+=e*(Ic+b)/2,td+=e,e=Ic*a-Hc*b,ud+=e*(Hc+a),vd+=e*(Ic+b),wd+=3*e,wa(Hc=a,Ic=b)}function Fa(a){this._context=a}function Ga(a,b){Ed.point=Ha,zd=Bd=a,Ad=Cd=b}function Ha(a,b){Bd-=a,Cd-=b,Dd.add(ic(Bd*Bd+Cd*Cd)),Bd=a,Cd=b}function Ia(){this._string=[]}function Ja(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+-2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function Ka(a){return function(b){var c=new La;for(var d in a)c[d]=a[d];return c.stream=b,c}}function La(){}function Ma(a,b,c){var d=a.clipExtent&&a.clipExtent();return a.scale(150).translate([0,0]),null!=d&&a.clipExtent(null),mc(c,a.stream(nd)),b(nd.result()),null!=d&&a.clipExtent(d),a}function Na(a,b,c){return Ma(a,function(c){var d=b[1][0]-b[0][0],e=b[1][1]-b[0][1],f=Math.min(d/(c[1][0]-c[0][0]),e/(c[1][1]-c[0][1])),g=+b[0][0]+(d-f*(c[1][0]+c[0][0]))/2,h=+b[0][1]+(e-f*(c[1][1]+c[0][1]))/2;a.scale(150*f).translate([g,h])},c)}function Oa(a,b,c){return Na(a,[[0,0],b],c)}function Pa(a,b,c){return Ma(a,function(c){var d=+b,e=d/(c[1][0]-c[0][0]),f=(d-e*(c[1][0]+c[0][0]))/2,g=-e*c[0][1];a.scale(150*e).translate([f,g])},c)}function Qa(a,b,c){return Ma(a,function(c){var d=+b,e=d/(c[1][1]-c[0][1]),f=-e*c[0][0],g=(d-e*(c[1][1]+c[0][1]))/2;a.scale(150*e).translate([f,g])},c)}function Ra(a){return Ka({point:function(b,c){b=a(b,c),this.stream.point(b[0],b[1])}})}function Sa(a,b){function c(d,e,g,h,i,j,k,l,m,n,o,p,q,r){var s=k-d,t=l-e,u=s*s+t*t;if(u>4*b&&q--){var v=h+n,w=i+o,x=j+p,y=ic(v*v+w*w+x*x),z=f(x/=y),A=$b($b(x)-1)b||$b((s*E+t*F)/u-.5)>.3||h*n+i*o+j*p2?a[2]%360*Zb:0,e()):[v*Yb,w*Yb,x*Yb]},b.precision=function(a){return arguments.length?(D=Jd(d,C=a*a),f()):ic(C)},b.fitExtent=function(a,c){return Na(b,a,c)},b.fitSize=function(a,c){return Oa(b,a,c)},b.fitWidth=function(a,c){return Pa(b,a,c)},b.fitHeight=function(a,c){return Qa(b,a,c)},function(){return g=a.apply(this,arguments),b.invert=g.invert&&c,e()}}function Wa(a){var b=0,c=Ub/3,d=Va(a),e=d(b,c);return e.parallels=function(a){return arguments.length?d(b=a[0]*Zb,c=a[1]*Zb):[b*Yb,c*Yb]},e}function Xa(a){function b(a,b){return[a*c,gc(b)/c]}var c=bc(a);return b.invert=function(a,b){return[a/c,f(b*c)]},b}function Ya(a,b){function c(a,b){var c=ic(g-2*e*gc(b))/e;return[c*gc(a*=e),h-c*bc(a)]}var d=gc(a),e=(d+gc(b))/2;if($b(e)0?b<-Vb+Tb&&(b=-Vb+Tb):b>Vb-Tb&&(b=Vb-Tb);var c=f/fc(cb(b),e);return[c*gc(e*a),f-c*bc(e*a)]}var d=bc(a),e=a===b?gc(a):ec(d/bc(b))/ec(cb(b)/cb(a)),f=d*fc(cb(a),e)/e;return e?(c.invert=function(a,b){var c=f-b,d=hc(e)*ic(a*a+c*c);return[ac(a,$b(c))/e*hc(c),2*_b(fc(f/d,1/e))-Vb]},c):ab}function eb(a,b){return[a,b]}function fb(a,b){function c(a,b){var c=f-b,d=e*a;return[c*gc(d),f-c*bc(d)]}var d=bc(a),e=a===b?gc(a):(d-bc(b))/(b-a),f=d/e+a;return $b(e)0?1:a<0?-1:0},ic=Math.sqrt,jc=Math.tan,kc={Feature:function(a,b){i(a.geometry,b)},FeatureCollection:function(a,b){for(var c=a.features,d=-1,e=c.length;++dTb?vb=90:rc<-Tb&&(tb=-90),Bb[0]=sb,Bb[1]=ub}},tc=function(a){var b,c,d,e,f,g,h;if(vb=ub=-(sb=tb=1/0),Ab=[],mc(a,sc),c=Ab.length){for(Ab.sort(E),b=1,d=Ab[0],f=[d];bD(d[0],d[1])&&(d[1]=e[1]),D(e[0],d[1])>D(d[0],d[1])&&(d[0]=e[0])):f.push(d=e);for(g=-1/0,c=f.length-1,b=0,d=f[c];b<=c;d=e,++b)e=f[b],(h=D(d[1],e[0]))>g&&(g=h,sb=e[0],ub=d[1])}return Ab=Bb=null,sb===1/0||tb===1/0?[[NaN,NaN],[NaN,NaN]]:[[sb,tb],[ub,vb]]},uc={sphere:h,point:G,lineStart:I,lineEnd:L,polygonStart:function(){uc.lineStart=M,uc.lineEnd=N},polygonEnd:function(){uc.lineStart=I,uc.lineEnd=L}},vc=function(a){Cb=Db=Eb=Fb=Gb=Hb=Ib=Jb=Kb=Lb=Mb=0,mc(a,uc);var b=Kb,c=Lb,d=Mb,e=b*b+c*c+d*d;return e<1e-12&&(b=Hb,c=Ib,d=Jb,Db2?a[2]*Zb:0),b.invert=function(b){return b=a.invert(b[0]*Zb,b[1]*Zb),b[0]*=Yb,b[1]*=Yb,b},b},Kc=function(){function a(a,b){c.push(a=d(a,b)),a[0]*=Yb,a[1]*=Yb}function b(){var a=e.apply(this,arguments),b=f.apply(this,arguments)*Zb,i=g.apply(this,arguments)*Zb;return c=[],d=R(-a[0]*Zb,-a[1]*Zb,0).invert,V(h,b,i,1),a={type:"Polygon",coordinates:[c]},c=d=null,a}var c,d,e=wc([0,0]),f=wc(90),g=wc(6),h={point:a};return b.center=function(a){return arguments.length?(e="function"==typeof a?a:wc([+a[0],+a[1]]),b):e},b.radius=function(a){return arguments.length?(f="function"==typeof a?a:wc(+a),b):f},b.precision=function(a){return arguments.length?(g="function"==typeof a?a:wc(+a),b):g},b},Lc=function(){var a,b=[];return{point:function(b,c){a.push([b,c])},lineStart:function(){b.push(a=[])},lineEnd:h,rejoin:function(){b.length>1&&b.push(b.pop().concat(b.shift()))},result:function(){var c=b;return b=[],a=null,c}}},Mc=function(a,b){return $b(a[0]-b[0])=0;--f)e.point((k=j[f])[0],k[1]);else d(m.x,m.p.x,-1,e);m=m.p}m=m.o,j=m.z,n=!n}while(!m.v);e.lineEnd()}}},Oc=mb(),Pc=function(a,b){var c=b[0],d=b[1],e=[gc(c),-bc(c),0],g=0,h=0;Oc.reset();for(var i=0,j=a.length;i=0?1:-1,C=B*A,D=C>Ub,E=p*y;if(Oc.add(ac(E*B*gc(C),r*z+E*bc(C))),g+=D?A+B*Xb:A,D^n>=c^w>=c){var F=s(q(m),q(u));v(F);var G=s(e,F);v(G);var H=(D^A>=0?-1:1)*f(G[2]);(d>H||d===H&&(F[0]||F[1]))&&(h+=D^A>=0?1:-1)}}return(g<-Tb||g0){for(t||(f.polygonStart(),t=!0),f.lineStart(),a=0;a1&&2&e&&g.push(g.pop().concat(g.shift())),o.push(g.filter(Z))}var n,o,p,q=c(f),r=Lc(),s=c(r),t=!1,u={point:g,lineStart:i,lineEnd:j,polygonStart:function(){u.point=k,u.lineStart=l,u.lineEnd=m,o=[],n=[]},polygonEnd:function(){u.point=g,u.lineStart=i,u.lineEnd=j,o=b.merge(o);var a=Pc(n,e);o.length?(t||(f.polygonStart(),t=!0),Nc(o,$,a,d,f)):a&&(t||(f.polygonStart(),t=!0),f.lineStart(),d(null,null,1,f),f.lineEnd()),t&&(f.polygonEnd(),t=!1),o=n=null},sphere:function(){f.polygonStart(),f.lineStart(),d(null,null,1,f),f.lineEnd(),f.polygonEnd()}};return u}},Rc=Qc(function(){return!0},_,ba,[-Ub,-Vb]),Sc=function(a){function b(b,c,d,e){V(e,a,h,d,b,c)}function c(a,b){return bc(a)*bc(b)>g}function d(a){var b,d,g,h,k;return{lineStart:function(){h=g=!1,k=1},point:function(l,m){var n,o=[l,m],p=c(l,m),q=i?p?0:f(l,m):p?f(l+(l<0?Ub:-Ub),m):0;if(!b&&(h=g=p)&&a.lineStart(),p!==g&&(!(n=e(b,o))||Mc(b,n)||Mc(o,n))&&(o[0]+=Tb,o[1]+=Tb,p=c(o[0],o[1])),p!==g)k=0,p?(a.lineStart(),n=e(o,b),a.point(n[0],n[1])):(n=e(b,o),a.point(n[0],n[1]),a.lineEnd()),b=n;else if(j&&b&&i^p){var r;q&d||!(r=e(o,b,!0))||(k=0,i?(a.lineStart(),a.point(r[0][0],r[0][1]),a.point(r[1][0],r[1][1]),a.lineEnd()):(a.point(r[1][0],r[1][1]),a.lineEnd(),a.lineStart(),a.point(r[0][0],r[0][1])))}!p||b&&Mc(b,o)||a.point(o[0],o[1]),b=o,g=p,d=q},lineEnd:function(){g&&a.lineEnd(),b=null},clean:function(){return k|(h&&g)<<1}}}function e(a,b,c){var d=q(a),e=q(b),f=[1,0,0],h=s(d,e),i=r(h,h),j=h[0],k=i-j*j;if(!k)return!c&&a;var l=g*i/k,m=-g*j/k,n=s(f,h),o=u(f,l);t(o,u(h,m));var v=n,w=r(o,v),x=r(v,v),y=w*w-x*(r(o,o)-1);if(!(y<0)){var z=ic(y),A=u(v,(-w-z)/x);if(t(A,o),A=p(A),!c)return A;var B,C=a[0],D=b[0],E=a[1],F=b[1];D0^A[1]<($b(A[0]-C)Ub^(C<=A[0]&&A[0]<=D)){var J=u(v,(-w+z)/x);return t(J,o),[A,p(J)]}}}function f(b,c){var d=i?a:Ub-a,e=0;return b<-d?e|=1:b>d&&(e|=2),c<-d?e|=4:c>d&&(e|=8),e}var g=bc(a),h=6*Zb,i=g>0,j=$b(g)>Tb;return Qc(c,d,b,i?[0,-a]:[-Ub,a-Ub])},Tc=function(a,b,c,d,e,f){var g,h=a[0],i=a[1],j=b[0],k=b[1],l=0,m=1,n=j-h,o=k-i;if(g=c-h,n||!(g>0)){if(g/=n,n<0){if(g0){if(g>m)return;g>l&&(l=g)}if(g=e-h,n||!(g<0)){if(g/=n,n<0){if(g>m)return;g>l&&(l=g)}else if(n>0){if(g0)){if(g/=o,o<0){if(g0){if(g>m)return;g>l&&(l=g)}if(g=f-i,o||!(g<0)){if(g/=o,o<0){if(g>m)return;g>l&&(l=g)}else if(o>0){if(g0&&(a[0]=h+l*n,a[1]=i+l*o),m<1&&(b[0]=h+m*n,b[1]=i+m*o),!0}}}}},Uc=1e9,Vc=-Uc,Wc=function(){var a,b,c,d=0,e=0,f=960,g=500;return c={stream:function(c){return a&&b===c?a:a=ca(d,e,f,g)(b=c)},extent:function(h){return arguments.length?(d=+h[0][0],e=+h[0][1],f=+h[1][0],g=+h[1][1],a=b=null,c):[[d,e],[f,g]]}}},Xc=mb(),Yc={sphere:h,point:h,lineStart:da,lineEnd:h,polygonStart:h,polygonEnd:h},Zc=function(a){return Xc.reset(),mc(a,Yc),+Xc},$c=[null,null],_c={type:"LineString",coordinates:$c},ad=function(a,b){return $c[0]=a,$c[1]=b,Zc(_c)},bd={Feature:function(a,b){return ha(a.geometry,b)},FeatureCollection:function(a,b){for(var c=a.features,d=-1,e=c.length;++d=.12&&e<.234&&d>=-.425&&d<-.214?j:e>=.166&&e<.234&&d>=-.214&&d<-.115?k:i).invert(a)},a.stream=function(a){return c&&d===a?c:c=Za([i.stream(d=a),j.stream(a),k.stream(a)])},a.precision=function(a){return arguments.length?(i.precision(a),j.precision(a),k.precision(a),b()):i.precision()},a.scale=function(b){return arguments.length?(i.scale(b),j.scale(.35*b),k.scale(b),a.translate(i.translate())):i.scale()},a.translate=function(a){if(!arguments.length)return i.translate();var c=i.scale(),d=+a[0],h=+a[1];return e=i.translate(a).clipExtent([[d-.455*c,h-.238*c],[d+.455*c,h+.238*c]]).stream(l),f=j.translate([d-.307*c,h+.201*c]).clipExtent([[d-.425*c+Tb,h+.12*c+Tb],[d-.214*c-Tb,h+.234*c-Tb]]).stream(l),g=k.translate([d-.205*c,h+.212*c]).clipExtent([[d-.214*c+Tb,h+.166*c+Tb],[d-.115*c-Tb,h+.234*c-Tb]]).stream(l),b()},a.fitExtent=function(b,c){return Na(a,b,c)},a.fitSize=function(b,c){return Oa(a,b,c)},a.fitWidth=function(b,c){return Pa(a,b,c)},a.fitHeight=function(b,c){return Qa(a,b,c)},a.scale(1070)},Od=$a(function(a){return ic(2/(1+a))});Od.invert=_a(function(a){return 2*f(a/2)});var Pd=function(){return Ua(Od).scale(124.75).clipAngle(179.999)},Qd=$a(function(a){return(a=e(a))&&a/gc(a)});Qd.invert=_a(function(a){return a});var Rd=function(){return Ua(Qd).scale(79.4188).clipAngle(179.999)};ab.invert=function(a,b){return[a,2*_b(dc(b))-Vb]};var Sd=function(){return bb(ab).scale(961/Xb)},Td=function(){return Wa(db).scale(109.5).parallels([30,30])};eb.invert=eb;var Ud=function(){return Ua(eb).scale(152.63)},Vd=function(){return Wa(fb).scale(131.154).center([0,13.9389])};gb.invert=_a(_b);var Wd=function(){return Ua(gb).scale(144.049).clipAngle(60)},Xd=function(){function a(){return e=f=null,g}var b,c,d,e,f,g,h=1,i=0,j=0,k=1,l=1,m=fd,n=null,o=fd;return g={stream:function(a){return e&&f===a?e:e=m(o(f=a))},postclip:function(e){return arguments.length?(o=e,n=b=c=d=null,a()):o},clipExtent:function(e){return arguments.length?(o=null==e?(n=b=c=d=null,fd):ca(n=+e[0][0],b=+e[0][1],c=+e[1][0],d=+e[1][1]),a()):null==n?null:[[n,b],[c,d]]},scale:function(b){return arguments.length?(m=hb((h=+b)*k,h*l,i,j),a()):h},translate:function(b){return arguments.length?(m=hb(h*k,h*l,i=+b[0],j=+b[1]),a()):[i,j]},reflectX:function(b){return arguments.length?(m=hb(h*(k=b?-1:1),h*l,i,j),a()):k<0},reflectY:function(b){return arguments.length?(m=hb(h*k,h*(l=b?-1:1),i,j),a()):l<0},fitExtent:function(a,b){return Na(g,a,b)},fitSize:function(a,b){return Oa(g,a,b)},fitWidth:function(a,b){return Pa(g,a,b)},fitHeight:function(a,b){return Qa(g,a,b)}}};ib.invert=function(a,b){var c,d=b,e=25;do{var f=d*d,g=f*f;d-=c=(d*(1.007226+f*(.015085+g*(.028874*f-.044475-.005916*g)))-b)/(1.007226+f*(.045255+g*(.259866*f-.311325-.005916*11*g)))}while($b(c)>Tb&&--e>0);return[a/(.8707+(f=d*d)*(f*(f*f*f*(.003971-.001529*f)-.013791)-.131979)),d]};var Yd=function(){return Ua(ib).scale(175.295)};jb.invert=_a(f);var Zd=function(){return Ua(jb).scale(249.5).clipAngle(90+Tb)};kb.invert=_a(function(a){return 2*_b(a)});var $d=function(){return Ua(kb).scale(250).clipAngle(142)};lb.invert=function(a,b){return[-b,2*_b(dc(a))-Vb]};var _d=function(){var a=bb(lb),b=a.center,c=a.rotate;return a.center=function(a){return arguments.length?b([-a[1],a[0]]):(a=b(),[a[1],-a[0]])},a.rotate=function(a){return arguments.length?c([a[0],a[1],a.length>2?a[2]+90:90]):(a=c(),[a[0],a[1],a[2]-90])},c([0,0,90]).scale(159.155)};a.geoArea=qc,a.geoBounds=tc,a.geoCentroid=vc,a.geoCircle=Kc,a.geoClipAntimeridian=Rc,a.geoClipCircle=Sc,a.geoClipExtent=Wc,a.geoClipRectangle=ca,a.geoContains=dd,a.geoDistance=ad,a.geoGraticule=pa,a.geoGraticule10=qa,a.geoInterpolate=ed,a.geoLength=Zc,a.geoPath=Fd,a.geoAlbers=Md,a.geoAlbersUsa=Nd,a.geoAzimuthalEqualArea=Pd,a.geoAzimuthalEqualAreaRaw=Od,a.geoAzimuthalEquidistant=Rd,a.geoAzimuthalEquidistantRaw=Qd,a.geoConicConformal=Td,a.geoConicConformalRaw=db,a.geoConicEqualArea=Ld,a.geoConicEqualAreaRaw=Ya,a.geoConicEquidistant=Vd,a.geoConicEquidistantRaw=fb,a.geoEquirectangular=Ud,a.geoEquirectangularRaw=eb,a.geoGnomonic=Wd,a.geoGnomonicRaw=gb,a.geoIdentity=Xd,a.geoProjection=Ua,a.geoProjectionMutator=Va,a.geoMercator=Sd,a.geoMercatorRaw=ab,a.geoNaturalEarth1=Yd,a.geoNaturalEarth1Raw=ib,a.geoOrthographic=Zd,a.geoOrthographicRaw=jb,a.geoStereographic=$d,a.geoStereographicRaw=kb,a.geoTransverseMercator=_d,a.geoTransverseMercatorRaw=lb,a.geoRotation=Jc,a.geoStream=mc,a.geoTransform=Gd,Object.defineProperty(a,"__esModule",{value:!0})})},{"d3-array":10}],23:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(a,b){return a.parent===b.parent?1:2}function c(a){return a.reduce(d,0)/a.length}function d(a,b){return a+b.x}function e(a){return 1+a.reduce(f,0)}function f(a,b){return Math.max(a,b.y)}function g(a){for(var b;b=a.children;)a=b[0];return a}function h(a){for(var b;b=a.children;)a=b[b.length-1];return a}function i(a){var b=0,c=a.children,d=c&&c.length;if(d)for(;--d>=0;)b+=c[d].value;else b=1;a.value=b}function j(a,b){if(a===b)return a;var c=a.ancestors(),d=b.ancestors(),e=null;for(a=c.pop(),b=d.pop();a===b;)e=a,a=c.pop(),b=d.pop();return e}function k(a,b){var c,d,e,f,g,h=new p(a),i=+a.value&&(h.value=a.value),j=[h];for(null==b&&(b=m);c=j.pop();)if(i&&(c.value=+c.data.value),(e=b(c.data))&&(g=e.length))for(c.children=new Array(g),f=g-1;f>=0;--f)j.push(d=c.children[f]=new p(e[f])),d.parent=c,d.depth=c.depth+1;return h.eachBefore(o)}function l(){return k(this).eachBefore(n)}function m(a){return a.children}function n(a){a.data=a.data.data}function o(a){var b=0;do{a.height=b}while((a=a.parent)&&a.height<++b)}function p(a){this.data=a,this.depth=this.height=0,this.parent=null}function q(a){for(var b,c,d=a.length;d;)c=Math.random()*d--|0,b=a[d],a[d]=a[c],a[c]=b;return a}function r(a,b){var c,d;if(u(b,a))return[b];for(c=0;c0&&c*c>d*d+e*e}function u(a,b){for(var c=0;cc*c+d*d}function B(a){var b=a._,c=a.next._,d=b.r+c.r,e=(b.x*c.r+c.x*b.r)/d,f=(b.y*c.r+c.y*b.r)/d;return e*e+f*f}function C(a){this._=a,this.next=null,this.previous=null}function D(a){if(!(e=a.length))return 0;var b,c,d,e,f,g,h,i,j,k,l;if(b=a[0],b.x=0,b.y=0,!(e>1))return b.r;if(c=a[1],b.x=-c.r,c.x=b.r,c.y=0,!(e>2))return b.r+c.r;z(c,b,d=a[2]),b=new C(b),c=new C(c),d=new C(d),b.next=d.previous=c,c.next=b.previous=d,d.next=c.previous=b;a:for(h=3;h=0;)b=e[f],b.z+=c,b.m+=c,c+=b.s+(d+=b.c)}function S(a,b,c){return a.a.parent===b.parent?a.a:c}function T(a,b){this._=a,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=b}function U(a){for(var b,c,d,e,f,g=new T(a,0),h=[g];b=h.pop();)if(d=b._.children)for(b.children=new Array(f=d.length),e=f-1;e>=0;--e)h.push(c=b.children[e]=new T(d[e],e)),c.parent=b;return(g.parent=new T(null,0)).children=[g],g}function V(a,b,c,d,e,f){for(var g,h,i,j,k,l,m,n,o,p,q,r=[],s=b.children,t=0,u=0,v=s.length,w=b.value;tm&&(m=h),q=k*k*p,(n=Math.max(m/q,q/l))>o){k-=h;break}o=n}r.push(g={value:k,dice:i=0;--c)e.push(b[c]);return this},$=function(a){for(var b,c,d,e=this,f=[e],g=[];e=f.pop();)if(g.push(e),b=e.children)for(c=0,d=b.length;c=0;)c+=d[e].value;b.value=c})},aa=function(a){return this.eachBefore(function(b){b.children&&b.children.sort(a)})},ba=function(a){for(var b=this,c=j(b,a),d=[b];b!==c;)b=b.parent,d.push(b);for(var e=d.length;a!==c;)d.splice(e,0,a),a=a.parent;return d},ca=function(){for(var a=this,b=[a];a=a.parent;)b.push(a);return b},da=function(){var a=[];return this.each(function(b){a.push(b)}),a},ea=function(){var a=[];return this.eachBefore(function(b){b.children||a.push(b)}),a},fa=function(){var a=this,b=[];return a.each(function(c){c!==a&&b.push({source:c.parent,target:c})}),b};p.prototype=k.prototype={constructor:p,count:X,each:Y,eachAfter:$,eachBefore:Z,sum:_,sort:aa,path:ba,ancestors:ca,descendants:da,leaves:ea,links:fa,copy:l};var ga=Array.prototype.slice,ha=function(a){for(var b,c,d=0,e=(a=q(ga.call(a))).length,f=[];d0)throw new Error("cycle");return f}var b=L,c=M;return a.id=function(c){return arguments.length?(b=F(c),a):b},a.parentId=function(b){return arguments.length?(c=F(b),a):c},a};T.prototype=Object.create(p.prototype);var sa=function(){function a(a){var d=U(a);if(d.eachAfter(b),d.parent.m=-d.z,d.eachBefore(c),i)a.eachBefore(e);else{var j=a,k=a,l=a;a.eachBefore(function(a){a.xk.x&&(k=a),a.depth>l.depth&&(l=a)});var m=j===k?1:f(j,k)/2,n=m-j.x,o=g/(k.x+m+n),p=h/(l.depth||1);a.eachBefore(function(a){a.x=(a.x+n)*o,a.y=a.depth*p})}return a}function b(a){var b=a.children,c=a.parent.children,e=a.i?c[a.i-1]:null;if(b){R(a);var g=(b[0].z+b[b.length-1].z)/2;e?(a.z=e.z+f(a._,e._),a.m=a.z-g):a.z=g}else e&&(a.z=e.z+f(a._,e._)) +;a.parent.A=d(a,e,a.parent.A||c[0])}function c(a){a._.x=a.z+a.parent.m,a.m+=a.parent.m}function d(a,b,c){if(b){for(var d,e=a,g=a,h=b,i=e.parent.children[0],j=e.m,k=g.m,l=h.m,m=i.m;h=P(h),e=O(e),h&&e;)i=O(i),g=P(g),g.a=a,d=h.z+l-e.z-j+f(h._,e._),d>0&&(Q(S(h,a,c),a,d),j+=d,k+=d),l+=h.m,j+=e.m,m+=i.m,k+=g.m;h&&!P(g)&&(g.t=h,g.m+=l-k),e&&!O(i)&&(i.t=e,i.m+=j-m,c=a)}return c}function e(a){a.x*=g,a.y=a.depth*h}var f=N,g=1,h=1,i=null;return a.separation=function(b){return arguments.length?(f=b,a):f},a.size=function(b){return arguments.length?(i=!1,g=+b[0],h=+b[1],a):i?null:[g,h]},a.nodeSize=function(b){return arguments.length?(i=!0,g=+b[0],h=+b[1],a):i?[g,h]:null},a},ta=function(a,b,c,d,e){for(var f,g=a.children,h=-1,i=g.length,j=a.value&&(e-c)/a.value;++h1?b:1)},c}(ua),wa=function(){function a(a){return a.x0=a.y0=0,a.x1=e,a.y1=f,a.eachBefore(b),g=[0],d&&a.eachBefore(la),a}function b(a){var b=g[a.depth],d=a.x0+b,e=a.y0+b,f=a.x1-b,m=a.y1-b;f=b-1){var j=i[a];return j.x0=d,j.y0=e,j.x1=g,j.y1=h,void 0}for(var l=k[a],m=c/2+l,n=a+1,o=b-1;n>>1;k[p]h-e){var s=(d*r+g*q)/c;f(a,n,q,d,e,s,h),f(n,b,r,s,e,g,h)}else{var t=(e*r+h*q)/c;f(a,n,q,d,e,g,t),f(n,b,r,d,t,g,h)}}var g,h,i=a.children,j=i.length,k=new Array(j+1);for(k[0]=h=g=0;g1?b:1)},c}(ua);a.cluster=W,a.hierarchy=k,a.pack=ka,a.packSiblings=ia,a.packEnclose=ha,a.partition=na,a.stratify=ra,a.tree=sa,a.treemap=wa,a.treemapBinary=xa,a.treemapDice=ma,a.treemapSlice=ta,a.treemapSliceDice=ya,a.treemapSquarify=va,a.treemapResquarify=za,Object.defineProperty(a,"__esModule",{value:!0})})},{}],24:[function(a,b,c){!function(d,e){"object"==typeof c&&void 0!==b?e(c,a("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-color"],e):e(d.d3=d.d3||{},d.d3)}(this,function(a,b){"use strict";function c(a,b,c,d,e){var f=a*a,g=f*a;return((1-3*a+3*f-g)*b+(4-6*f+3*g)*c+(1+3*a+3*f-3*g)*d+g*e)/6}function d(a,b){return function(c){return a+c*b}}function e(a,b,c){return a=Math.pow(a,c),b=Math.pow(b,c)-a,c=1/c,function(d){return Math.pow(a+d*b,c)}}function f(a,b){var c=b-a;return c?d(a,c>180||c<-180?c-360*Math.round(c/360):c):B(isNaN(a)?b:a)}function g(a){return 1==(a=+a)?h:function(b,c){return c-b?e(b,c,a):B(isNaN(b)?c:b)}}function h(a,b){var c=b-a;return c?d(a,c):B(isNaN(a)?b:a)}function i(a){return function(c){var d,e,f=c.length,g=new Array(f),h=new Array(f),i=new Array(f);for(d=0;d180?b+=360:b-a>180&&(a+=360),f.push({i:c.push(e(c)+"rotate(",null,d)-2,x:H(a,b)})):b&&c.push(e(c)+"rotate("+b+d)}function h(a,b,c,f){a!==b?f.push({i:c.push(e(c)+"skewX(",null,d)-2,x:H(a,b)}):b&&c.push(e(c)+"skewX("+b+d)}function i(a,b,c,d,f,g){if(a!==c||b!==d){var h=f.push(e(f)+"scale(",null,",",null,")");g.push({i:h-4,x:H(a,c)},{i:h-2,x:H(b,d)})}else 1===c&&1===d||f.push(e(f)+"scale("+c+","+d+")")}return function(b,c){var d=[],e=[];return b=a(b),c=a(c),f(b.translateX,b.translateY,c.translateX,c.translateY,d,e),g(b.rotate,c.rotate,d,e),h(b.skewX,c.skewX,d,e),i(b.scaleX,b.scaleY,c.scaleX,c.scaleY,d,e),b=c=null,function(a){for(var b,c=-1,f=e.length;++c=1?(d=1,b-1):Math.floor(d*b),f=a[e],g=a[e+1],h=e>0?a[e-1]:2*f-g,i=ef&&(e=b.slice(f,e),h[g]?h[g]+=e:h[++g]=e),(c=c[0])===(d=d[0])?h[g]?h[g]+=d:h[++g]=d:(h[++g]=null,i.push({i:g,x:H(c,d)})),f=K.lastIndex;return f1e-6)if(Math.abs(l*i-j*k)>1e-6&&f){var n=c-g,o=e-h,p=i*i+j*j,q=n*n+o*o,r=Math.sqrt(p),s=Math.sqrt(m),t=f*Math.tan((d-Math.acos((p+m-q)/(2*r*s)))/2),u=t/s,v=t/r;Math.abs(u-1)>1e-6&&(this._+="L"+(a+u*k)+","+(b+u*l)),this._+="A"+f+","+f+",0,0,"+ +(l*n>k*o)+","+(this._x1=a+v*i)+","+(this._y1=b+v*j)}else this._+="L"+(this._x1=a)+","+(this._y1=b);else;},arc:function(a,b,c,g,h,i){a=+a,b=+b,c=+c;var j=c*Math.cos(g),k=c*Math.sin(g),l=a+j,m=b+k,n=1^i,o=i?g-h:h-g;if(c<0)throw new Error("negative radius: "+c);null===this._x1?this._+="M"+l+","+m:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-m)>1e-6)&&(this._+="L"+l+","+m),c&&(o<0&&(o=o%e+e),o>f?this._+="A"+c+","+c+",0,1,"+n+","+(a-j)+","+(b-k)+"A"+c+","+c+",0,1,"+n+","+(this._x1=l)+","+(this._y1=m):o>1e-6&&(this._+="A"+c+","+c+",0,"+ +(o>=d)+","+n+","+(this._x1=a+c*Math.cos(h))+","+(this._y1=b+c*Math.sin(h))))},rect:function(a,b,c,d){this._+="M"+(this._x0=this._x1=+a)+","+(this._y0=this._y1=+b)+"h"+ +c+"v"+ +d+"h"+-c+"Z"},toString:function(){return this._}},a.path=c,Object.defineProperty(a,"__esModule",{value:!0})})},{}],26:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(a,b){return a[0]-b[0]||a[1]-b[1]}function c(a){for(var b=a.length,c=[0,1],d=2,e=2;e1&&f(a[c[d-2]],a[c[d-1]],a[e])<=0;)--d;c[d++]=e}return c.slice(0,d)}var d=function(a){for(var b,c=-1,d=a.length,e=a[d-1],f=0;++c=0;--d)l.push(a[f[h[d]][2]]);for(d=+j;dh!=j>h&&g<(i-c)*(h-d)/(j-d)+c&&(k=!k),i=c,j=d;return k},i=function(a){for(var b,c,d=-1,e=a.length,f=a[e-1],g=f[0],h=f[1],i=0;++d=(f=(p+r)/2))?p=f:r=f,(k=c>=(g=(q+s)/2))?q=g:s=g,e=n,!(n=n[l=k<<1|j]))return e[l]=o,a;if(h=+a._x.call(null,n.data),i=+a._y.call(null,n.data),b===h&&c===i)return o.next=n,e?e[l]=o:a._root=o,a;do{e=e?e[l]=new Array(4):a._root=new Array(4),(j=b>=(f=(p+r)/2))?p=f:r=f,(k=c>=(g=(q+s)/2))?q=g:s=g}while((l=k<<1|j)==(m=(i>=g)<<1|h>=f));return e[m]=n,e[l]=o,a}function c(a){var c,d,e,f,g=a.length,h=new Array(g),i=new Array(g),j=1/0,k=1/0,l=-1/0,m=-1/0;for(d=0;dl&&(l=e),fm&&(m=f));for(la||a>e||d>b||b>f))return this;var g,h,i=e-c,j=this._root;switch(h=(b<(d+f)/2)<<1|a<(c+e)/2){case 0:do{g=new Array(4),g[h]=j,j=g}while(i*=2,e=c+i,f=d+i,a>e||b>f);break;case 1:do{g=new Array(4),g[h]=j,j=g}while(i*=2,c=e-i,f=d+i,c>a||b>f);break;case 2:do{g=new Array(4),g[h]=j,j=g}while(i*=2,e=c+i,d=f-i,a>e||d>b);break;case 3:do{g=new Array(4),g[h]=j,j=g}while(i*=2,c=e-i,d=f-i,c>a||d>b)}this._root&&this._root.length&&(this._root=j)}return this._x0=c,this._y0=d,this._x1=e,this._y1=f,this},l=function(){var a=[];return this.visit(function(b){if(!b.length)do{a.push(b.data)}while(b=b.next)}),a},m=function(a){return arguments.length?this.cover(+a[0][0],+a[0][1]).cover(+a[1][0],+a[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},n=function(a,b,c,d,e){this.node=a,this.x0=b,this.y0=c,this.x1=d,this.y1=e},o=function(a,b,c){var d,e,f,g,h,i,j,k=this._x0,l=this._y0,m=this._x1,o=this._y1,p=[],q=this._root;for(q&&p.push(new n(q,k,l,m,o)),null==c?c=1/0:(k=a-c,l=b-c,m=a+c,o=b+c,c*=c);i=p.pop();)if(!(!(q=i.node)||(e=i.x0)>m||(f=i.y0)>o||(g=i.x1)=s)<<1|a>=r)&&(i=p[p.length-1],p[p.length-1]=p[p.length-1-j],p[p.length-1-j]=i)}else{var t=a-+this._x.call(null,q.data),u=b-+this._y.call(null,q.data),v=t*t+u*u;if(v=(h=(o+q)/2))?o=h:q=h,(k=g>=(i=(p+r)/2))?p=i:r=i,b=n,!(n=n[l=k<<1|j]))return this;if(!n.length)break;(b[l+1&3]||b[l+2&3]||b[l+3&3])&&(c=b,m=l)}for(;n.data!==a;)if(d=n,!(n=n.next))return this;return(e=n.next)&&delete n.next,d?(e?d.next=e:delete d.next,this):b?(e?b[l]=e:delete b[l],(n=b[0]||b[1]||b[2]||b[3])&&n===(b[3]||b[2]||b[1]||b[0])&&!n.length&&(c?c[m]=n:this._root=n),this):(this._root=e,this)},q=function(){return this._root},r=function(){var a=0;return this.visit(function(b){if(!b.length)do{++a}while(b=b.next)}),a},s=function(a){var b,c,d,e,f,g,h=[],i=this._root;for(i&&h.push(new n(i,this._x0,this._y0,this._x1,this._y1));b=h.pop();)if(!a(i=b.node,d=b.x0,e=b.y0,f=b.x1,g=b.y1)&&i.length){var j=(d+f)/2,k=(e+g)/2;(c=i[3])&&h.push(new n(c,j,k,f,g)),(c=i[2])&&h.push(new n(c,d,k,j,g)),(c=i[1])&&h.push(new n(c,j,e,f,k)),(c=i[0])&&h.push(new n(c,d,e,j,k))}return this},t=function(a){var b,c=[],d=[];for(this._root&&c.push(new n(this._root,this._x0,this._y0,this._x1,this._y1));b=c.pop();){var e=b.node;if(e.length){var f,g=b.x0,h=b.y0,i=b.x1,j=b.y1,k=(g+i)/2,l=(h+j)/2;(f=e[0])&&c.push(new n(f,g,h,k,l)),(f=e[1])&&c.push(new n(f,k,h,i,l)),(f=e[2])&&c.push(new n(f,g,l,k,j)),(f=e[3])&&c.push(new n(f,k,l,i,j))}d.push(b)}for(;b=d.pop();)a(b.node,b.x0,b.y0,b.x1,b.y1);return this},u=function(a){return arguments.length?(this._x=a,this):this._x},v=function(a){return arguments.length?(this._y=a,this):this._y},w=g.prototype=h.prototype;w.copy=function(){var a,b,c=new h(this._x,this._y,this._x0,this._y0,this._x1,this._y1),d=this._root;if(!d)return c;if(!d.length)return c._root=i(d),c;for(a=[{source:d,target:c._root=new Array(4)}];d=a.pop();)for(var e=0;e<4;++e)(b=d.source[e])&&(b.length?a.push({source:b,target:d.target[e]=new Array(4)}):d.target[e]=i(b));return c},w.add=j,w.addAll=c,w.cover=k,w.data=l,w.extent=m,w.find=o,w.remove=p,w.removeAll=d,w.root=q,w.size=r,w.visit=s,w.visitAfter=t,w.x=u,w.y=v,a.quadtree=g,Object.defineProperty(a,"__esModule",{value:!0})})},{}],28:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(a){this._size=a,this._call=this._error=null,this._tasks=[],this._data=[],this._waiting=this._active=this._ended=this._start=0}function c(a){if(!a._start)try{d(a)}catch(b){if(a._tasks[a._ended+a._active-1])f(a,b);else if(!a._data)throw b}}function d(a){for(;a._start=a._waiting&&a._active=0;)if((c=a._tasks[d])&&(a._tasks[d]=null,c.abort))try{c.abort()}catch(b){}a._active=NaN,g(a)}function g(a){if(!a._active&&a._call){var b=a._data;a._data=void 0,a._call(a._error,b)}}function h(a){if(null==a)a=1/0;else if(!((a=+a)>=1))throw new Error("invalid concurrency");return new b(a)}var i=[].slice,j={};b.prototype=h.prototype={constructor:b,defer:function(a){if("function"!=typeof a)throw new Error("invalid callback");if(this._call)throw new Error("defer after await");if(null!=this._error)return this;var b=i.call(arguments,1);return b.push(a),++this._waiting,this._tasks.push(b),c(this),this},abort:function(){return null==this._error&&f(this,new Error("abort")),this},await:function(a){if("function"!=typeof a)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(b,c){a.apply(null,[b].concat(c))},g(this),this},awaitAll:function(a){if("function"!=typeof a)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=a,g(this),this}},a.queue=h,Object.defineProperty(a,"__esModule",{value:!0})})},{}],29:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";var b=function(){return Math.random()},c=function a(b){function c(a,c){return a=null==a?0:+a,c=null==c?1:+c,1===arguments.length?(c=a,a=0):c-=a,function(){return b()*c+a}}return c.source=a,c}(b),d=function a(b){function c(a,c){var d,e;return a=null==a?0:+a,c=null==c?1:+c,function(){var f;if(null!=d)f=d,d=null;else do{d=2*b()-1,f=2*b()-1,e=d*d+f*f}while(!e||e>1);return a+c*f*Math.sqrt(-2*Math.log(e)/e)}}return c.source=a,c}(b),e=function a(b){function c(){var a=d.source(b).apply(this,arguments);return function(){return Math.exp(a())}}return c.source=a,c}(b),f=function a(b){function c(a){return function(){for(var c=0,d=0;d=200&&c<300||304===c){if(k)try{b=k.call(f,o)}catch(a){return void m.call("error",f,a)}else b=o;m.call("load",f,b)}else m.call("error",f,a)}var f,j,k,l,m=i.dispatch("beforesend","progress","load","error"),n=h.map(),o=new g,p=null,q=null,r=0;if("undefined"==typeof XDomainRequest||"withCredentials"in o||!/^(http(s)?:)?\/\//.test(a)||(o=new XDomainRequest),"onload"in o?o.onload=o.onerror=o.ontimeout=c:o.onreadystatechange=function(a){o.readyState>3&&c(a)},o.onprogress=function(a){m.call("progress",f,a)},f={header:function(a,b){return a=(a+"").toLowerCase(),arguments.length<2?n.get(a):(null==b?n.remove(a):n.set(a,b+""),f)},mimeType:function(a){return arguments.length?(j=null==a?null:a+"",f):j},responseType:function(a){return arguments.length?(l=a,f):l},timeout:function(a){return arguments.length?(r=+a,f):r},user:function(a){return arguments.length<1?p:(p=null==a?null:a+"",f)},password:function(a){return arguments.length<1?q:(q=null==a?null:a+"",f)},response:function(a){return k=a,f},get:function(a,b){return f.send("GET",a,b)},post:function(a,b){return f.send("POST",a,b)},send:function(b,c,e){return o.open(b,a,!0,p,q),null==j||n.has("accept")||n.set("accept",j+",*/*"),o.setRequestHeader&&n.each(function(a,b){o.setRequestHeader(b,a)}),null!=j&&o.overrideMimeType&&o.overrideMimeType(j),null!=l&&(o.responseType=l),r>0&&(o.timeout=r),null==e&&"function"==typeof c&&(e=c,c=null),null!=e&&1===e.length&&(e=d(e)),null!=e&&f.on("error",e).on("load",function(a){e(null,a)}),m.call("beforesend",f,o),o.send(null==c?null:c),f},abort:function(){return o.abort(),f},on:function(){var a=m.on.apply(m,arguments);return a===m?f:a}},null!=b){if("function"!=typeof b)throw new Error("invalid callback: "+b);return f.get(b)}return f},l=function(a,b){return function(c,d){var e=k(c).mimeType(a).response(b);if(null!=d){if("function"!=typeof d)throw new Error("invalid callback: "+d);return e.get(d)}return e}},m=l("text/html",function(a){return document.createRange().createContextualFragment(a.responseText)}),n=l("application/json",function(a){return JSON.parse(a.responseText)}),o=l("text/plain",function(a){return a.responseText}),p=l("application/xml",function(a){var b=a.responseXML;if(!b)throw new Error("parse error");return b}),q=function(a,b){return function(c,d,e){arguments.length<3&&(e=d,d=null);var g=k(c).mimeType(a);return g.row=function(a){return arguments.length?g.response(f(b,d=a)):d},g.row(d),e?g.get(e):g}},r=q("text/csv",j.csvParse),s=q("text/tab-separated-values",j.tsvParse);c.request=k,c.html=m,c.json=n,c.text=o,c.xml=p,c.csv=r,c.tsv=s},{"d3-collection":14,"d3-dispatch":16,"d3-dsv":18,xmlhttprequest:84}],31:[function(a,b,c){!function(d,e){"object"==typeof c&&void 0!==b?e(c,a("d3-array"),a("d3-collection"),a("d3-interpolate"),a("d3-format"),a("d3-time"),a("d3-time-format"),a("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-interpolate","d3-format","d3-time","d3-time-format","d3-color"],e):e(d.d3=d.d3||{},d.d3,d.d3,d.d3,d.d3,d.d3,d.d3,d.d3)}(this,function(a,b,c,d,e,f,g,h){"use strict";function i(a){function b(b){var c=b+"",g=d.get(c);if(!g){if(f!==R)return f;d.set(c,g=e.push(b))}return a[(g-1)%a.length]}var d=c.map(),e=[],f=R;return a=null==a?[]:Q.call(a),b.domain=function(a){if(!arguments.length)return e.slice();e=[],d=c.map();for(var f,g,h=-1,i=a.length;++h=c?1:d(a)}}}function o(a){return function(b,c){var d=a(b=+b,c=+c);return function(a){return a<=0?b:a>=1?c:d(a)}}}function p(a,b,c,d){var e=a[0],f=a[1],g=b[0],h=b[1];return f2?q:p,g=h=null,e}function e(b){return(g||(g=f(i,j,l?n(a):a,k)))(+b)}var f,g,h,i=U,j=U,k=d.interpolate,l=!1;return e.invert=function(a){return(h||(h=f(j,i,m,l?o(b):b)))(+a)},e.domain=function(a){return arguments.length?(i=P.call(a,T),c()):i.slice()},e.range=function(a){return arguments.length?(j=Q.call(a),c()):j.slice()},e.rangeRound=function(a){return j=Q.call(a),k=d.interpolateRound,c()},e.clamp=function(a){return arguments.length?(l=!!a,c()):l},e.interpolate=function(a){return arguments.length?(k=a,c()):k},c()}function t(a){var c=a.domain;return a.ticks=function(a){var d=c();return b.ticks(d[0],d[d.length-1],null==a?10:a)},a.tickFormat=function(a,b){return V(c(),a,b)},a.nice=function(d){null==d&&(d=10);var e,f=c(),g=0,h=f.length-1,i=f[g],j=f[h];return j0?(i=Math.floor(i/e)*e,j=Math.ceil(j/e)*e,e=b.tickIncrement(i,j,d)):e<0&&(i=Math.ceil(i*e)/e,j=Math.floor(j*e)/e,e=b.tickIncrement(i,j,d)),e>0?(f[g]=Math.floor(i/e)*e,f[h]=Math.ceil(j/e)*e,c(f)):e<0&&(f[g]=Math.ceil(i*e)/e,f[h]=Math.floor(j*e)/e,c(f)),a},a}function u(){var a=s(m,d.interpolateNumber);return a.copy=function(){return r(a,u())},t(a)}function v(){function a(a){return+a}var b=[0,1];return a.invert=a,a.domain=a.range=function(c){return arguments.length?(b=P.call(c,T),a):b.slice()},a.copy=function(){return v().domain(b)},t(a)}function w(a,b){return(b=Math.log(b/a))?function(c){return Math.log(c/a)/b}:S(b)}function x(a,b){return a<0?function(c){return-Math.pow(-b,c)*Math.pow(-a,1-c)}:function(c){return Math.pow(b,c)*Math.pow(a,1-c)}}function y(a){return isFinite(a)?+("1e"+a):a<0?0:a}function z(a){return 10===a?y:a===Math.E?Math.exp:function(b){return Math.pow(a,b)}}function A(a){return a===Math.E?Math.log:10===a&&Math.log10||2===a&&Math.log2||(a=Math.log(a),function(b){return Math.log(b)/a})}function B(a){return function(b){return-a(-b)}}function C(){function a(){return g=A(f),h=z(f),d()[0]<0&&(g=B(g),h=B(h)),c}var c=s(w,x).domain([1,10]),d=c.domain,f=10,g=A(10),h=z(10);return c.base=function(b){return arguments.length?(f=+b,a()):f},c.domain=function(b){return arguments.length?(d(b),a()):d()},c.ticks=function(a){var c,e=d(),i=e[0],j=e[e.length-1];(c=j0){for(;nj)break;q.push(m)}}else for(;n=1;--l)if(!((m=k*l)j)break;q.push(m)}}else q=b.ticks(n,o,Math.min(o-n,p)).map(h);return c?q.reverse():q},c.tickFormat=function(a,b){if(null==b&&(b=10===f?".0e":","),"function"!=typeof b&&(b=e.format(b)),a===1/0)return b;null==a&&(a=10);var d=Math.max(1,f*a/c.ticks().length);return function(a){var c=a/h(Math.round(g(a)));return c*f0?f[b-1]:d[0],b=f?[g[f-1],e]:[g[b-1],g[b]]},a.copy=function(){return H().domain([d,e]).range(h)},t(a)}function I(){function a(a){if(a<=a)return d[b.bisect(c,a,0,e)]}var c=[.5],d=[0,1],e=1;return a.domain=function(b){return arguments.length?(c=Q.call(b),e=Math.min(c.length,d.length-1),a):c.slice()},a.range=function(b){return arguments.length?(d=Q.call(b),e=Math.min(c.length,d.length-1),a):d.slice()},a.invertExtent=function(a){var b=d.indexOf(a);return[c[b-1],c[b]]},a.copy=function(){return I().domain(c).range(d)},a}function J(a){return new Date(a)}function K(a){return a instanceof Date?+a:+new Date(+a)}function L(a,c,e,f,g,h,i,j,k){function l(b){return(i(b)1)&&(a-=Math.floor(a));var b=Math.abs(a-.5);return ma.h=360*a-100,ma.s=1.5-1.5*b,ma.l=.8-.9*b,ma+""},oa=M(ea("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),pa=M(ea("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),qa=M(ea("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),ra=M(ea("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));a.scaleBand=j,a.scalePoint=l,a.scaleIdentity=v,a.scaleLinear=u,a.scaleLog=C,a.scaleOrdinal=i,a.scaleImplicit=R,a.scalePow=E,a.scaleSqrt=F,a.scaleQuantile=G,a.scaleQuantize=H,a.scaleThreshold=I,a.scaleTime=ca,a.scaleUtc=da,a.schemeCategory10=fa,a.schemeCategory20b=ga,a.schemeCategory20c=ha,a.schemeCategory20=ia,a.interpolateCubehelixDefault=ja,a.interpolateRainbow=na,a.interpolateWarm=ka,a.interpolateCool=la,a.interpolateViridis=oa,a.interpolateMagma=pa,a.interpolateInferno=qa,a.interpolatePlasma=ra,a.scaleSequential=N,Object.defineProperty(a,"__esModule",{value:!0})})},{"d3-array":10,"d3-collection":14,"d3-color":15,"d3-format":21,"d3-interpolate":24,"d3-time":35,"d3-time-format":34}],32:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(a){var b=a+="",c=b.indexOf(":");return c>=0&&"xmlns"!==(b=a.slice(0,c))&&(a=a.slice(c+1)),Va.hasOwnProperty(b)?{space:Va[b],local:a}:a}function c(a){return function(){var b=this.ownerDocument,c=this.namespaceURI;return c===Ua&&b.documentElement.namespaceURI===Ua?b.createElement(a):b.createElementNS(c,a)}}function d(a){return function(){return this.ownerDocument.createElementNS(a.space,a.local)}}function e(a){var e=b(a);return(e.local?d:c)(e)}function f(){}function g(a){return null==a?f:function(){return this.querySelector(a)}}function h(a){"function"!=typeof a&&(a=g(a));for(var b=this._groups,c=b.length,d=new Array(c),e=0;e=x&&(x=w+1);!(v=t[x])&&++x=0;)(d=e[f])&&(g&&g!==d.nextSibling&&g.parentNode.insertBefore(d,g),g=d);return this}function w(a){function b(b,c){return b&&c?a(b.__data__,c.__data__):!b-!c}a||(a=x);for(var c=this._groups,d=c.length,e=new Array(d),f=0;fb?1:a>=b?0:NaN}function y(){var a=arguments[0];return arguments[0]=this,a.apply(null,arguments),this}function z(){var a=new Array(this.size()),b=-1;return this.each(function(){a[++b]=this}),a}function A(){for(var a=this._groups,b=0,c=a.length;b1?this.each((null==b?M:"function"==typeof b?O:N)(a,b,null==c?"":c)):Q(this.node(),a)}function Q(a,b){return a.style.getPropertyValue(b)||L(a).getComputedStyle(a,null).getPropertyValue(b)}function R(a){return function(){delete this[a]}}function S(a,b){return function(){this[a]=b}}function T(a,b){return function(){var c=b.apply(this,arguments);null==c?delete this[a]:this[a]=c}}function U(a,b){return arguments.length>1?this.each((null==b?R:"function"==typeof b?T:S)(a,b)):this.node()[a]}function V(a){return a.trim().split(/^|\s+/)}function W(a){return a.classList||new X(a)}function X(a){this._node=a,this._names=V(a.getAttribute("class")||"")}function Y(a,b){for(var c=W(a),d=-1,e=b.length;++d=0&&(b=a.slice(c+1),a=a.slice(0,c)),{type:a,name:b}})}function Aa(a){return function(){var b=this.__on;if(b){for(var c,d=0,e=-1,f=b.length;d=0&&(this._names.splice(b,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(a){return this._names.indexOf(a)>=0}};var _a={};if(a.event=null,"undefined"!=typeof document){"onmouseenter"in document.documentElement||(_a={mouseenter:"mouseover",mouseleave:"mouseout"})}var ab=[null];Ia.prototype=Ja.prototype={constructor:Ia,select:h,selectAll:k,filter:l,data:s,enter:n,exit:t,merge:u,order:v,sort:w,call:y,nodes:z,node:A,size:B,empty:C,each:D,attr:K,style:P,property:U,classed:ba,text:fa,html:ja,raise:la,lower:na,append:oa,insert:qa,remove:sa,clone:va,datum:wa,on:Ca,dispatch:Ha};var bb=0;Na.prototype=Ma.prototype={constructor:Na,get:function(a){for(var b=this._;!(b in a);)if(!(a=a.parentNode))return;return a[b]},set:function(a,b){return a[this._]=b},remove:function(a){return this._ in a&&delete a[this._]},toString:function(){return this._}},a.create=La,a.creator=e,a.local=Ma,a.matcher=Za,a.mouse=Qa,a.namespace=b,a.namespaces=Va,a.clientPoint=Pa,a.select=Ka,a.selectAll=Ra,a.selection=Ja,a.selector=g,a.selectorAll=j,a.style=Q,a.touch=Sa,a.touches=Ta,a.window=L,a.customEvent=Da,Object.defineProperty(a,"__esModule",{value:!0})})},{}],33:[function(a,b,c){!function(d,e){"object"==typeof c&&void 0!==b?e(c,a("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-path"],e):e(d.d3=d.d3||{},d.d3)}(this,function(a,b){"use strict";function c(a){return a>1?0:a<-1?la:Math.acos(a)}function d(a){return a>=1?ma:a<=-1?-ma:Math.asin(a)}function e(a){return a.innerRadius}function f(a){return a.outerRadius}function g(a){return a.startAngle}function h(a){return a.endAngle}function i(a){return a&&a.padAngle}function j(a,b,c,d,e,f,g,h){var i=c-a,j=d-b,k=g-e,l=h-f,m=(k*(b-f)-l*(a-e))/(l*i-k*j);return[a+m*i,b+m*j]}function k(a,b,c,d,e,f,g){var h=a-c,i=b-d,j=(g?f:-f)/ja(h*h+i*i),k=j*i,l=-j*h,m=a+k,n=b+l,o=c+k,p=d+l,q=(m+o)/2,r=(n+p)/2,s=o-m,t=p-n,u=s*s+t*t,v=e-f,w=m*p-o*n,x=(t<0?-1:1)*ja(ga(0,v*v*u-w*w)),y=(w*t-s*x)/u,z=(-w*s-t*x)/u,A=(w*t+s*x)/u,B=(-w*s+t*x)/u,C=y-q,D=z-r,E=A-q,F=B-r;return C*C+D*D>E*E+F*F&&(y=A,z=B),{cx:y,cy:z,x01:-k,y01:-l,x11:y*(e/v-1),y11:z*(e/v-1)}}function l(a){this._context=a}function m(a){return a[0]}function n(a){return a[1]}function o(a){this._curve=a}function p(a){function b(b){return new o(a(b))}return b._curve=a,b}function q(a){var b=a.curve;return a.angle=a.x,delete a.x,a.radius=a.y,delete a.y,a.curve=function(a){return arguments.length?b(p(a)):b()._curve},a}function r(a){return a.source}function s(a){return a.target}function t(a){function c(){var c,i=za.call(arguments),j=d.apply(this,i),k=e.apply(this,i);if(h||(h=c=b.path()),a(h,+f.apply(this,(i[0]=j,i)),+g.apply(this,i),+f.apply(this,(i[0]=k,i)),+g.apply(this,i)),c)return h=null,c+""||null}var d=r,e=s,f=m,g=n,h=null;return c.source=function(a){return arguments.length?(d=a,c):d},c.target=function(a){return arguments.length?(e=a,c):e},c.x=function(a){return arguments.length?(f="function"==typeof a?a:ca(+a),c):f},c.y=function(a){return arguments.length?(g="function"==typeof a?a:ca(+a),c):g},c.context=function(a){return arguments.length?(h=null==a?null:a,c):h},c}function u(a,b,c,d,e){a.moveTo(b,c),a.bezierCurveTo(b=(b+d)/2,c,b,e,d,e)}function v(a,b,c,d,e){a.moveTo(b,c),a.bezierCurveTo(b,c=(c+e)/2,d,c,d,e)}function w(a,b,c,d,e){var f=ya(b,c),g=ya(b,c=(c+e)/2),h=ya(d,c),i=ya(d,e);a.moveTo(f[0],f[1]),a.bezierCurveTo(g[0],g[1],h[0],h[1],i[0],i[1])}function x(){return t(u)}function y(){return t(v)}function z(){var a=t(w);return a.angle=a.x,delete a.x,a.radius=a.y,delete a.y,a}function A(a,b,c){a._context.bezierCurveTo((2*a._x0+a._x1)/3,(2*a._y0+a._y1)/3,(a._x0+2*a._x1)/3,(a._y0+2*a._y1)/3,(a._x0+4*a._x1+b)/6,(a._y0+4*a._y1+c)/6)}function B(a){this._context=a}function C(a){this._context=a}function D(a){this._context=a}function E(a,b){this._basis=new B(a),this._beta=b}function F(a,b,c){a._context.bezierCurveTo(a._x1+a._k*(a._x2-a._x0),a._y1+a._k*(a._y2-a._y0),a._x2+a._k*(a._x1-b),a._y2+a._k*(a._y1-c),a._x2,a._y2)}function G(a,b){this._context=a,this._k=(1-b)/6}function H(a,b){this._context=a,this._k=(1-b)/6}function I(a,b){this._context=a,this._k=(1-b)/6}function J(a,b,c){var d=a._x1,e=a._y1,f=a._x2,g=a._y2;if(a._l01_a>ka){var h=2*a._l01_2a+3*a._l01_a*a._l12_a+a._l12_2a,i=3*a._l01_a*(a._l01_a+a._l12_a);d=(d*h-a._x0*a._l12_2a+a._x2*a._l01_2a)/i,e=(e*h-a._y0*a._l12_2a+a._y2*a._l01_2a)/i}if(a._l23_a>ka){var j=2*a._l23_2a+3*a._l23_a*a._l12_a+a._l12_2a,k=3*a._l23_a*(a._l23_a+a._l12_a);f=(f*j+a._x1*a._l23_2a-b*a._l12_2a)/k,g=(g*j+a._y1*a._l23_2a-c*a._l12_2a)/k}a._context.bezierCurveTo(d,e,f,g,a._x2,a._y2)}function K(a,b){this._context=a,this._alpha=b}function L(a,b){this._context=a,this._alpha=b}function M(a,b){this._context=a,this._alpha=b}function N(a){this._context=a}function O(a){return a<0?-1:1}function P(a,b,c){var d=a._x1-a._x0,e=b-a._x1,f=(a._y1-a._y0)/(d||e<0&&-0),g=(c-a._y1)/(e||d<0&&-0),h=(f*e+g*d)/(d+e);return(O(f)+O(g))*Math.min(Math.abs(f),Math.abs(g),.5*Math.abs(h))||0}function Q(a,b){var c=a._x1-a._x0;return c?(3*(a._y1-a._y0)/c-b)/2:b}function R(a,b,c){var d=a._x0,e=a._y0,f=a._x1,g=a._y1,h=(f-d)/3;a._context.bezierCurveTo(d+h,e+h*b,f-h,g-h*c,f,g)}function S(a){this._context=a}function T(a){this._context=new U(a)}function U(a){this._context=a}function V(a){return new S(a)}function W(a){return new T(a)}function X(a){this._context=a}function Y(a){var b,c,d=a.length-1,e=new Array(d),f=new Array(d),g=new Array(d);for(e[0]=0,f[0]=2,g[0]=a[0]+2*a[1],b=1;b=0;--b)e[b]=(g[b]-e[b+1])/f[b];for(f[d-1]=(a[d]+e[d-1])/2,b=0;bh;if(s||(s=a=b.path()),gka)if(t>na-ka)s.moveTo(g*fa(h),g*ia(h)),s.arc(0,0,g,h,i,!u),f>ka&&(s.moveTo(f*fa(i),f*ia(i)),s.arc(0,0,f,i,h,u));else{var v,w,x=h,y=i,z=h,A=i,B=t,C=t,D=r.apply(this,arguments)/2,E=D>ka&&(o?+o.apply(this,arguments):ja(f*f+g*g)),F=ha(da(g-f)/2,+n.apply(this,arguments)),G=F,H=F;if(E>ka){var I=d(E/f*ia(D)),J=d(E/g*ia(D));(B-=2*I)>ka?(I*=u?1:-1,z+=I,A-=I):(B=0,z=A=(h+i)/2),(C-=2*J)>ka?(J*=u?1:-1,x+=J,y-=J):(C=0,x=y=(h+i)/2)}var K=g*fa(x),L=g*ia(x),M=f*fa(A),N=f*ia(A);if(F>ka){var O=g*fa(y),P=g*ia(y),Q=f*fa(z),R=f*ia(z);if(tka?j(K,L,Q,R,O,P,M,N):[M,N],T=K-S[0],U=L-S[1],V=O-S[0],W=P-S[1],X=1/ia(c((T*V+U*W)/(ja(T*T+U*U)*ja(V*V+W*W)))/2),Y=ja(S[0]*S[0]+S[1]*S[1]);G=ha(F,(f-Y)/(X-1)),H=ha(F,(g-Y)/(X+1))}} +C>ka?H>ka?(v=k(Q,R,K,L,g,H,u),w=k(O,P,M,N,g,H,u),s.moveTo(v.cx+v.x01,v.cy+v.y01),Hka&&B>ka?G>ka?(v=k(M,N,O,P,f,-G,u),w=k(K,L,Q,R,f,-G,u),s.lineTo(v.cx+v.x01,v.cy+v.y01),G=l;--m)k.point(r[m],s[m]);k.lineEnd(),k.areaEnd()}q&&(r[c]=+d(n,c,a),s[c]=+f(n,c,a),k.point(e?+e(n,c,a):r[c],g?+g(n,c,a):s[c]))}if(o)return k=null,o+""||null}function c(){return qa().defined(h).curve(j).context(i)}var d=m,e=null,f=ca(0),g=n,h=ca(!0),i=null,j=pa,k=null;return a.x=function(b){return arguments.length?(d="function"==typeof b?b:ca(+b),e=null,a):d},a.x0=function(b){return arguments.length?(d="function"==typeof b?b:ca(+b),a):d},a.x1=function(b){return arguments.length?(e=null==b?null:"function"==typeof b?b:ca(+b),a):e},a.y=function(b){return arguments.length?(f="function"==typeof b?b:ca(+b),g=null,a):f},a.y0=function(b){return arguments.length?(f="function"==typeof b?b:ca(+b),a):f},a.y1=function(b){return arguments.length?(g=null==b?null:"function"==typeof b?b:ca(+b),a):g},a.lineX0=a.lineY0=function(){return c().x(d).y(f)},a.lineY1=function(){return c().x(d).y(g)},a.lineX1=function(){return c().x(e).y(f)},a.defined=function(b){return arguments.length?(h="function"==typeof b?b:ca(!!b),a):h},a.curve=function(b){return arguments.length?(j=b,null!=i&&(k=j(i)),a):j},a.context=function(b){return arguments.length?(null==b?i=k=null:k=j(i=b),a):i},a},sa=function(a,b){return ba?1:b>=a?0:NaN},ta=function(a){return a},ua=function(){function a(a){var h,i,j,k,l,m=a.length,n=0,o=new Array(m),p=new Array(m),q=+e.apply(this,arguments),r=Math.min(na,Math.max(-na,f.apply(this,arguments)-q)),s=Math.min(Math.abs(r)/m,g.apply(this,arguments)),t=s*(r<0?-1:1);for(h=0;h0&&(n+=l);for(null!=c?o.sort(function(a,b){return c(p[a],p[b])}):null!=d&&o.sort(function(b,c){return d(a[b],a[c])}),h=0,j=n?(r-m*t)/n:0;h0?l*j:0)+t,p[i]={data:a[i],index:h,value:l,startAngle:q,endAngle:k,padAngle:s};return p}var b=ta,c=sa,d=null,e=ca(0),f=ca(na),g=ca(0);return a.value=function(c){return arguments.length?(b="function"==typeof c?c:ca(+c),a):b},a.sortValues=function(b){return arguments.length?(c=b,d=null,a):c},a.sort=function(b){return arguments.length?(d=b,c=null,a):d},a.startAngle=function(b){return arguments.length?(e="function"==typeof b?b:ca(+b),a):e},a.endAngle=function(b){return arguments.length?(f="function"==typeof b?b:ca(+b),a):f},a.padAngle=function(b){return arguments.length?(g="function"==typeof b?b:ca(+b),a):g},a},va=p(pa);o.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(a,b){this._curve.point(b*Math.sin(a),b*-Math.cos(a))}};var wa=function(){return q(qa().curve(va))},xa=function(){var a=ra().curve(va),b=a.curve,c=a.lineX0,d=a.lineX1,e=a.lineY0,f=a.lineY1;return a.angle=a.x,delete a.x,a.startAngle=a.x0,delete a.x0,a.endAngle=a.x1,delete a.x1,a.radius=a.y,delete a.y,a.innerRadius=a.y0,delete a.y0,a.outerRadius=a.y1,delete a.y1,a.lineStartAngle=function(){return q(c())},delete a.lineX0,a.lineEndAngle=function(){return q(d())},delete a.lineX1,a.lineInnerRadius=function(){return q(e())},delete a.lineY0,a.lineOuterRadius=function(){return q(f())},delete a.lineY1,a.curve=function(a){return arguments.length?b(p(a)):b()._curve},a},ya=function(a,b){return[(b=+b)*Math.cos(a-=Math.PI/2),b*Math.sin(a)]},za=Array.prototype.slice,Aa={draw:function(a,b){var c=Math.sqrt(b/la);a.moveTo(c,0),a.arc(0,0,c,0,na)}},Ba={draw:function(a,b){var c=Math.sqrt(b/5)/2;a.moveTo(-3*c,-c),a.lineTo(-c,-c),a.lineTo(-c,-3*c),a.lineTo(c,-3*c),a.lineTo(c,-c),a.lineTo(3*c,-c),a.lineTo(3*c,c),a.lineTo(c,c),a.lineTo(c,3*c),a.lineTo(-c,3*c),a.lineTo(-c,c),a.lineTo(-3*c,c),a.closePath()}},Ca=Math.sqrt(1/3),Da=2*Ca,Ea={draw:function(a,b){var c=Math.sqrt(b/Da),d=c*Ca;a.moveTo(0,-c),a.lineTo(d,0),a.lineTo(0,c),a.lineTo(-d,0),a.closePath()}},Fa=Math.sin(la/10)/Math.sin(7*la/10),Ga=Math.sin(na/10)*Fa,Ha=-Math.cos(na/10)*Fa,Ia={draw:function(a,b){var c=Math.sqrt(.8908130915292852*b),d=Ga*c,e=Ha*c;a.moveTo(0,-c),a.lineTo(d,e);for(var f=1;f<5;++f){var g=na*f/5,h=Math.cos(g),i=Math.sin(g);a.lineTo(i*c,-h*c),a.lineTo(h*d-i*e,i*d+h*e)}a.closePath()}},Ja={draw:function(a,b){var c=Math.sqrt(b),d=-c/2;a.rect(d,d,c,c)}},Ka=Math.sqrt(3),La={draw:function(a,b){var c=-Math.sqrt(b/(3*Ka));a.moveTo(0,2*c),a.lineTo(-Ka*c,-c),a.lineTo(Ka*c,-c),a.closePath()}},Ma=-.5,Na=Math.sqrt(3)/2,Oa=1/Math.sqrt(12),Pa=3*(Oa/2+1),Qa={draw:function(a,b){var c=Math.sqrt(b/Pa),d=c/2,e=c*Oa,f=d,g=c*Oa+c,h=-f,i=g;a.moveTo(d,e),a.lineTo(f,g),a.lineTo(h,i),a.lineTo(Ma*d-Na*e,Na*d+Ma*e),a.lineTo(Ma*f-Na*g,Na*f+Ma*g),a.lineTo(Ma*h-Na*i,Na*h+Ma*i),a.lineTo(Ma*d+Na*e,Ma*e-Na*d),a.lineTo(Ma*f+Na*g,Ma*g-Na*f),a.lineTo(Ma*h+Na*i,Ma*i-Na*h),a.closePath()}},Ra=[Aa,Ba,Ea,Ja,Ia,La,Qa],Sa=function(){function a(){var a;if(e||(e=a=b.path()),c.apply(this,arguments).draw(e,+d.apply(this,arguments)),a)return e=null,a+""||null}var c=ca(Aa),d=ca(64),e=null;return a.type=function(b){return arguments.length?(c="function"==typeof b?b:ca(b),a):c},a.size=function(b){return arguments.length?(d="function"==typeof b?b:ca(+b),a):d},a.context=function(b){return arguments.length?(e=null==b?null:b,a):e},a},Ta=function(){};B.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:A(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(a,b){switch(a=+a,b=+b,this._point){case 0:this._point=1,this._line?this._context.lineTo(a,b):this._context.moveTo(a,b);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:A(this,a,b)}this._x0=this._x1,this._x1=a,this._y0=this._y1,this._y1=b}};var Ua=function(a){return new B(a)};C.prototype={areaStart:Ta,areaEnd:Ta,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(a,b){switch(a=+a,b=+b,this._point){case 0:this._point=1,this._x2=a,this._y2=b;break;case 1:this._point=2,this._x3=a,this._y3=b;break;case 2:this._point=3,this._x4=a,this._y4=b,this._context.moveTo((this._x0+4*this._x1+a)/6,(this._y0+4*this._y1+b)/6);break;default:A(this,a,b)}this._x0=this._x1,this._x1=a,this._y0=this._y1,this._y1=b}};var Va=function(a){return new C(a)};D.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(a,b){switch(a=+a,b=+b,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var c=(this._x0+4*this._x1+a)/6,d=(this._y0+4*this._y1+b)/6;this._line?this._context.lineTo(c,d):this._context.moveTo(c,d);break;case 3:this._point=4;default:A(this,a,b)}this._x0=this._x1,this._x1=a,this._y0=this._y1,this._y1=b}};var Wa=function(a){return new D(a)};E.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var a=this._x,b=this._y,c=a.length-1;if(c>0)for(var d,e=a[0],f=b[0],g=a[c]-e,h=b[c]-f,i=-1;++i<=c;)d=i/c,this._basis.point(this._beta*a[i]+(1-this._beta)*(e+d*g),this._beta*b[i]+(1-this._beta)*(f+d*h));this._x=this._y=null,this._basis.lineEnd()},point:function(a,b){this._x.push(+a),this._y.push(+b)}};var Xa=function a(b){function c(a){return 1===b?new B(a):new E(a,b)}return c.beta=function(b){return a(+b)},c}(.85);G.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:F(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(a,b){switch(a=+a,b=+b,this._point){case 0:this._point=1,this._line?this._context.lineTo(a,b):this._context.moveTo(a,b);break;case 1:this._point=2,this._x1=a,this._y1=b;break;case 2:this._point=3;default:F(this,a,b)}this._x0=this._x1,this._x1=this._x2,this._x2=a,this._y0=this._y1,this._y1=this._y2,this._y2=b}};var Ya=function a(b){function c(a){return new G(a,b)}return c.tension=function(b){return a(+b)},c}(0);H.prototype={areaStart:Ta,areaEnd:Ta,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(a,b){switch(a=+a,b=+b,this._point){case 0:this._point=1,this._x3=a,this._y3=b;break;case 1:this._point=2,this._context.moveTo(this._x4=a,this._y4=b);break;case 2:this._point=3,this._x5=a,this._y5=b;break;default:F(this,a,b)}this._x0=this._x1,this._x1=this._x2,this._x2=a,this._y0=this._y1,this._y1=this._y2,this._y2=b}};var Za=function a(b){function c(a){return new H(a,b)}return c.tension=function(b){return a(+b)},c}(0);I.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(a,b){switch(a=+a,b=+b,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:F(this,a,b)}this._x0=this._x1,this._x1=this._x2,this._x2=a,this._y0=this._y1,this._y1=this._y2,this._y2=b}};var $a=function a(b){function c(a){return new I(a,b)}return c.tension=function(b){return a(+b)},c}(0);K.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(a,b){if(a=+a,b=+b,this._point){var c=this._x2-a,d=this._y2-b;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(c*c+d*d,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(a,b):this._context.moveTo(a,b);break;case 1:this._point=2;break;case 2:this._point=3;default:J(this,a,b)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=a,this._y0=this._y1,this._y1=this._y2,this._y2=b}};var _a=function a(b){function c(a){return b?new K(a,b):new G(a,0)}return c.alpha=function(b){return a(+b)},c}(.5);L.prototype={areaStart:Ta,areaEnd:Ta,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(a,b){if(a=+a,b=+b,this._point){var c=this._x2-a,d=this._y2-b;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(c*c+d*d,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=a,this._y3=b;break;case 1:this._point=2,this._context.moveTo(this._x4=a,this._y4=b);break;case 2:this._point=3,this._x5=a,this._y5=b;break;default:J(this,a,b)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=a,this._y0=this._y1,this._y1=this._y2,this._y2=b}};var ab=function a(b){function c(a){return b?new L(a,b):new H(a,0)}return c.alpha=function(b){return a(+b)},c}(.5);M.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(a,b){if(a=+a,b=+b,this._point){var c=this._x2-a,d=this._y2-b;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(c*c+d*d,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:J(this,a,b)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=a,this._y0=this._y1,this._y1=this._y2,this._y2=b}};var bb=function a(b){function c(a){return b?new M(a,b):new I(a,0)}return c.alpha=function(b){return a(+b)},c}(.5);N.prototype={areaStart:Ta,areaEnd:Ta,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(a,b){a=+a,b=+b,this._point?this._context.lineTo(a,b):(this._point=1,this._context.moveTo(a,b))}};var cb=function(a){return new N(a)};S.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:R(this,this._t0,Q(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(a,b){var c=NaN;if(a=+a,b=+b,a!==this._x1||b!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(a,b):this._context.moveTo(a,b);break;case 1:this._point=2;break;case 2:this._point=3,R(this,Q(this,c=P(this,a,b)),c);break;default:R(this,this._t0,c=P(this,a,b))}this._x0=this._x1,this._x1=a,this._y0=this._y1,this._y1=b,this._t0=c}}},(T.prototype=Object.create(S.prototype)).point=function(a,b){S.prototype.point.call(this,b,a)},U.prototype={moveTo:function(a,b){this._context.moveTo(b,a)},closePath:function(){this._context.closePath()},lineTo:function(a,b){this._context.lineTo(b,a)},bezierCurveTo:function(a,b,c,d,e,f){this._context.bezierCurveTo(b,a,d,c,f,e)}},X.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var a=this._x,b=this._y,c=a.length;if(c)if(this._line?this._context.lineTo(a[0],b[0]):this._context.moveTo(a[0],b[0]),2===c)this._context.lineTo(a[1],b[1]);else for(var d=Y(a),e=Y(b),f=0,g=1;g=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(a,b){switch(a=+a,b=+b,this._point){case 0:this._point=1,this._line?this._context.lineTo(a,b):this._context.moveTo(a,b);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,b),this._context.lineTo(a,b);else{var c=this._x*(1-this._t)+a*this._t;this._context.lineTo(c,this._y),this._context.lineTo(c,b)}}this._x=a,this._y=b}};var eb=function(a){return new Z(a,.5)},fb=function(a,b){if((e=a.length)>1)for(var c,d,e,f=1,g=a[b[0]],h=g.length;f=0;)c[b]=b;return c},hb=function(){function a(a){var f,g,h=b.apply(this,arguments),i=a.length,j=h.length,k=new Array(j);for(f=0;f0){for(var c,d,e,f=0,g=a[0].length;f1)for(var c,d,e,f,g,h,i=0,j=a[b[0]].length;i=0?(d[0]=f,d[1]=f+=e):e<0?(d[1]=g,d[0]=g+=e):d[0]=f},kb=function(a,b){if((c=a.length)>0){for(var c,d=0,e=a[b[0]],f=e.length;d0&&(d=(c=a[b[0]]).length)>0){for(var c,d,e,f=0,g=1;g53)return null;"w"in j||(j.w=1),"Z"in j?(g=d(e(j.y)),i=g.getUTCDay(),g=i>4||0===i?b.utcMonday.ceil(g):b.utcMonday(g),g=b.utcDay.offset(g,7*(j.V-1)),j.y=g.getUTCFullYear(),j.m=g.getUTCMonth(),j.d=g.getUTCDate()+(j.w+6)%7):(g=c(e(j.y)),i=g.getDay(),g=i>4||0===i?b.timeMonday.ceil(g):b.timeMonday(g),g=b.timeDay.offset(g,7*(j.V-1)),j.y=g.getFullYear(),j.m=g.getMonth(),j.d=g.getDate()+(j.w+6)%7)}else("W"in j||"U"in j)&&("w"in j||(j.w="u"in j?j.u%7:"W"in j?1:0),i="Z"in j?d(e(j.y)).getUTCDay():c(e(j.y)).getDay(),j.m=0,j.d="W"in j?(j.w+6)%7+7*j.W-(i+5)%7:j.w+7*j.U-(i+6)%7);return"Z"in j?(j.H+=j.Z/100|0,j.M+=j.Z%100,d(j)):c(j)}}function h(a,b,c,d){for(var e,f,g=0,h=b.length,i=c.length;g=i)return-1;if(37===(e=b.charCodeAt(g++))){if(e=b.charAt(g++),!(f=Za[e in qa?b.charAt(g++):e])||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function ma(a,b,c){var d=Na.exec(b.slice(c));return d?(a.p=Oa[d[0].toLowerCase()],c+d[0].length):-1}function na(a,b,c){var d=Ra.exec(b.slice(c));return d?(a.w=Sa[d[0].toLowerCase()],c+d[0].length):-1}function oa(a,b,c){var d=Pa.exec(b.slice(c));return d?(a.w=Qa[d[0].toLowerCase()],c+d[0].length):-1}function pa(a,b,c){var d=Va.exec(b.slice(c));return d?(a.m=Wa[d[0].toLowerCase()],c+d[0].length):-1}function ra(a,b,c){var d=Ta.exec(b.slice(c));return d?(a.m=Ua[d[0].toLowerCase()],c+d[0].length):-1}function sa(a,b,c){return h(a,Fa,b,c)}function ta(a,b,c){return h(a,Ga,b,c)}function ua(a,b,c){return h(a,Ha,b,c)}function va(a){return Ka[a.getDay()]}function wa(a){return Ja[a.getDay()]}function xa(a){return Ma[a.getMonth()]}function ya(a){return La[a.getMonth()]}function za(a){return Ia[+(a.getHours()>=12)]}function Aa(a){return Ka[a.getUTCDay()]}function Ba(a){return Ja[a.getUTCDay()]}function Ca(a){return Ma[a.getUTCMonth()]}function Da(a){return La[a.getUTCMonth()]}function Ea(a){return Ia[+(a.getUTCHours()>=12)]}var Fa=a.dateTime,Ga=a.date,Ha=a.time,Ia=a.periods,Ja=a.days,Ka=a.shortDays,La=a.months,Ma=a.shortMonths,Na=i(Ia),Oa=j(Ia),Pa=i(Ja),Qa=j(Ja),Ra=i(Ka),Sa=j(Ka),Ta=i(La),Ua=j(La),Va=i(Ma),Wa=j(Ma),Xa={a:va,A:wa,b:xa,B:ya,c:null,d:D,e:D,f:I,H:E,I:F,j:G,L:H,m:J,M:K,p:za,Q:ka,s:la,S:L,u:M,U:N,V:O,w:P,W:Q,x:null,X:null,y:R,Y:S,Z:T,"%":ja},Ya={a:Aa,A:Ba,b:Ca,B:Da,c:null,d:U,e:U,f:Z,H:V,I:W,j:X,L:Y,m:$,M:_,p:Ea,Q:ka,s:la,S:aa,u:ba,U:ca,V:da,w:ea,W:fa,x:null,X:null,y:ga,Y:ha,Z:ia,"%":ja},Za={a:na,A:oa,b:pa,B:ra,c:sa,d:t,e:t,f:z,H:v,I:v,j:u,L:y,m:s,M:w,p:ma,Q:B,s:C,S:x,u:l,U:m,V:n,w:k,W:o,x:ta,X:ua,y:q,Y:p,Z:r,"%":A};return Xa.x=f(Ga,Xa),Xa.X=f(Ha,Xa),Xa.c=f(Fa,Xa),Ya.x=f(Ga,Ya),Ya.X=f(Ha,Ya),Ya.c=f(Fa,Ya),{format:function(a){var b=f(a+="",Xa);return b.toString=function(){return a},b},parse:function(a){var b=g(a+="",c);return b.toString=function(){return a},b},utcFormat:function(a){var b=f(a+="",Ya);return b.toString=function(){return a},b},utcParse:function(a){var b=g(a,d);return b.toString=function(){return a},b}}}function g(a,b,c){var d=a<0?"-":"",e=(d?-a:a)+"",f=e.length;return d+(f68?1900:2e3),c+d[0].length):-1}function r(a,b,c){var d=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(b.slice(c,c+6));return d?(a.Z=d[1]?0:-(d[2]+(d[3]||"00")),c+d[0].length):-1}function s(a,b,c){var d=ra.exec(b.slice(c,c+2));return d?(a.m=d[0]-1,c+d[0].length):-1}function t(a,b,c){var d=ra.exec(b.slice(c,c+2));return d?(a.d=+d[0],c+d[0].length):-1}function u(a,b,c){var d=ra.exec(b.slice(c,c+3));return d?(a.m=0,a.d=+d[0],c+d[0].length):-1}function v(a,b,c){var d=ra.exec(b.slice(c,c+2));return d?(a.H=+d[0],c+d[0].length):-1}function w(a,b,c){var d=ra.exec(b.slice(c,c+2));return d?(a.M=+d[0],c+d[0].length):-1}function x(a,b,c){var d=ra.exec(b.slice(c,c+2));return d?(a.S=+d[0],c+d[0].length):-1}function y(a,b,c){var d=ra.exec(b.slice(c,c+3));return d?(a.L=+d[0],c+d[0].length):-1}function z(a,b,c){var d=ra.exec(b.slice(c,c+6));return d?(a.L=Math.floor(d[0]/1e3),c+d[0].length):-1}function A(a,b,c){var d=sa.exec(b.slice(c,c+1));return d?c+d[0].length:-1}function B(a,b,c){var d=ra.exec(b.slice(c));return d?(a.Q=+d[0],c+d[0].length):-1}function C(a,b,c){var d=ra.exec(b.slice(c));return d?(a.Q=1e3*+d[0],c+d[0].length):-1}function D(a,b){return g(a.getDate(),b,2)}function E(a,b){return g(a.getHours(),b,2)}function F(a,b){return g(a.getHours()%12||12,b,2)}function G(a,c){return g(1+b.timeDay.count(b.timeYear(a),a),c,3)}function H(a,b){return g(a.getMilliseconds(),b,3)}function I(a,b){return H(a,b)+"000"}function J(a,b){return g(a.getMonth()+1,b,2)}function K(a,b){return g(a.getMinutes(),b,2)}function L(a,b){return g(a.getSeconds(),b,2)}function M(a){var b=a.getDay();return 0===b?7:b}function N(a,c){return g(b.timeSunday.count(b.timeYear(a),a),c,2)}function O(a,c){var d=a.getDay();return a=d>=4||0===d?b.timeThursday(a):b.timeThursday.ceil(a),g(b.timeThursday.count(b.timeYear(a),a)+(4===b.timeYear(a).getDay()),c,2)}function P(a){return a.getDay()}function Q(a,c){return g(b.timeMonday.count(b.timeYear(a),a),c,2)}function R(a,b){return g(a.getFullYear()%100,b,2)}function S(a,b){return g(a.getFullYear()%1e4,b,4)}function T(a){var b=a.getTimezoneOffset();return(b>0?"-":(b*=-1,"+"))+g(b/60|0,"0",2)+g(b%60,"0",2)}function U(a,b){return g(a.getUTCDate(),b,2)}function V(a,b){return g(a.getUTCHours(),b,2)}function W(a,b){return g(a.getUTCHours()%12||12,b,2)}function X(a,c){return g(1+b.utcDay.count(b.utcYear(a),a),c,3)}function Y(a,b){return g(a.getUTCMilliseconds(),b,3)}function Z(a,b){return Y(a,b)+"000"}function $(a,b){return g(a.getUTCMonth()+1,b,2)}function _(a,b){return g(a.getUTCMinutes(),b,2)}function aa(a,b){return g(a.getUTCSeconds(),b,2)}function ba(a){var b=a.getUTCDay();return 0===b?7:b}function ca(a,c){return g(b.utcSunday.count(b.utcYear(a),a),c,2)}function da(a,c){var d=a.getUTCDay();return a=d>=4||0===d?b.utcThursday(a):b.utcThursday.ceil(a),g(b.utcThursday.count(b.utcYear(a),a)+(4===b.utcYear(a).getUTCDay()),c,2)}function ea(a){return a.getUTCDay()}function fa(a,c){return g(b.utcMonday.count(b.utcYear(a),a),c,2)}function ga(a,b){return g(a.getUTCFullYear()%100,b,2)}function ha(a,b){return g(a.getUTCFullYear()%1e4,b,4)}function ia(){return"+0000"}function ja(){return"%"}function ka(a){return+a}function la(a){return Math.floor(+a/1e3)}function ma(b){return pa=f(b),a.timeFormat=pa.format,a.timeParse=pa.parse,a.utcFormat=pa.utcFormat,a.utcParse=pa.utcParse,pa}function na(a){return a.toISOString()}function oa(a){var b=new Date(a);return isNaN(b)?null:b}var pa,qa={"-":"",_:" ",0:"0"},ra=/^\s*\d+/,sa=/^%/,ta=/[\\^$*+?|[\]().{}]/g;ma({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var ua=Date.prototype.toISOString?na:a.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ"),va=+new Date("2000-01-01T00:00:00.000Z")?oa:a.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");a.timeFormatDefaultLocale=ma,a.timeFormatLocale=f,a.isoFormat=ua,a.isoParse=va,Object.defineProperty(a,"__esModule",{value:!0})})},{"d3-time":35}],35:[function(a,b,c){!function(a,d){ +"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(a,c,d,g){function h(b){return a(b=new Date(+b)),b}return h.floor=h,h.ceil=function(b){return a(b=new Date(b-1)),c(b,1),a(b),b},h.round=function(a){var b=h(a),c=h.ceil(a);return a-b0))return g;do{g.push(f=new Date(+b)),c(b,e),a(b)}while(f=b)for(;a(b),!d(b);)b.setTime(b-1)},function(a,b){if(a>=a)if(b<0)for(;++b<=0;)for(;c(a,-1),!d(a););else for(;--b>=0;)for(;c(a,1),!d(a););})},d&&(h.count=function(b,c){return e.setTime(+b),f.setTime(+c),a(e),a(f),Math.floor(d(e,f))},h.every=function(a){return a=Math.floor(a),isFinite(a)&&a>0?a>1?h.filter(g?function(b){return g(b)%a==0}:function(b){return h.count(0,b)%a==0}):h:null}),h}function c(a){return b(function(b){b.setDate(b.getDate()-(b.getDay()+7-a)%7),b.setHours(0,0,0,0)},function(a,b){a.setDate(a.getDate()+7*b)},function(a,b){return(b-a-(b.getTimezoneOffset()-a.getTimezoneOffset())*i)/j})}function d(a){return b(function(b){b.setUTCDate(b.getUTCDate()-(b.getUTCDay()+7-a)%7),b.setUTCHours(0,0,0,0)},function(a,b){a.setUTCDate(a.getUTCDate()+7*b)},function(a,b){return(b-a)/j})}var e=new Date,f=new Date,g=b(function(){},function(a,b){a.setTime(+a+b)},function(a,b){return b-a});g.every=function(a){return a=Math.floor(a),isFinite(a)&&a>0?a>1?b(function(b){b.setTime(Math.floor(b/a)*a)},function(b,c){b.setTime(+b+c*a)},function(b,c){return(c-b)/a}):g:null};var h=g.range,i=6e4,j=6048e5,k=b(function(a){a.setTime(1e3*Math.floor(a/1e3))},function(a,b){a.setTime(+a+1e3*b)},function(a,b){return(b-a)/1e3},function(a){return a.getUTCSeconds()}),l=k.range,m=b(function(a){a.setTime(Math.floor(a/i)*i)},function(a,b){a.setTime(+a+b*i)},function(a,b){return(b-a)/i},function(a){return a.getMinutes()}),n=m.range,o=b(function(a){var b=a.getTimezoneOffset()*i%36e5;b<0&&(b+=36e5),a.setTime(36e5*Math.floor((+a-b)/36e5)+b)},function(a,b){a.setTime(+a+36e5*b)},function(a,b){return(b-a)/36e5},function(a){return a.getHours()}),p=o.range,q=b(function(a){a.setHours(0,0,0,0)},function(a,b){a.setDate(a.getDate()+b)},function(a,b){return(b-a-(b.getTimezoneOffset()-a.getTimezoneOffset())*i)/864e5},function(a){return a.getDate()-1}),r=q.range,s=c(0),t=c(1),u=c(2),v=c(3),w=c(4),x=c(5),y=c(6),z=s.range,A=t.range,B=u.range,C=v.range,D=w.range,E=x.range,F=y.range,G=b(function(a){a.setDate(1),a.setHours(0,0,0,0)},function(a,b){a.setMonth(a.getMonth()+b)},function(a,b){return b.getMonth()-a.getMonth()+12*(b.getFullYear()-a.getFullYear())},function(a){return a.getMonth()}),H=G.range,I=b(function(a){a.setMonth(0,1),a.setHours(0,0,0,0)},function(a,b){a.setFullYear(a.getFullYear()+b)},function(a,b){return b.getFullYear()-a.getFullYear()},function(a){return a.getFullYear()});I.every=function(a){return isFinite(a=Math.floor(a))&&a>0?b(function(b){b.setFullYear(Math.floor(b.getFullYear()/a)*a),b.setMonth(0,1),b.setHours(0,0,0,0)},function(b,c){b.setFullYear(b.getFullYear()+c*a)}):null};var J=I.range,K=b(function(a){a.setUTCSeconds(0,0)},function(a,b){a.setTime(+a+b*i)},function(a,b){return(b-a)/i},function(a){return a.getUTCMinutes()}),L=K.range,M=b(function(a){a.setUTCMinutes(0,0,0)},function(a,b){a.setTime(+a+36e5*b)},function(a,b){return(b-a)/36e5},function(a){return a.getUTCHours()}),N=M.range,O=b(function(a){a.setUTCHours(0,0,0,0)},function(a,b){a.setUTCDate(a.getUTCDate()+b)},function(a,b){return(b-a)/864e5},function(a){return a.getUTCDate()-1}),P=O.range,Q=d(0),R=d(1),S=d(2),T=d(3),U=d(4),V=d(5),W=d(6),X=Q.range,Y=R.range,Z=S.range,$=T.range,_=U.range,aa=V.range,ba=W.range,ca=b(function(a){a.setUTCDate(1),a.setUTCHours(0,0,0,0)},function(a,b){a.setUTCMonth(a.getUTCMonth()+b)},function(a,b){return b.getUTCMonth()-a.getUTCMonth()+12*(b.getUTCFullYear()-a.getUTCFullYear())},function(a){return a.getUTCMonth()}),da=ca.range,ea=b(function(a){a.setUTCMonth(0,1),a.setUTCHours(0,0,0,0)},function(a,b){a.setUTCFullYear(a.getUTCFullYear()+b)},function(a,b){return b.getUTCFullYear()-a.getUTCFullYear()},function(a){return a.getUTCFullYear()});ea.every=function(a){return isFinite(a=Math.floor(a))&&a>0?b(function(b){b.setUTCFullYear(Math.floor(b.getUTCFullYear()/a)*a),b.setUTCMonth(0,1),b.setUTCHours(0,0,0,0)},function(b,c){b.setUTCFullYear(b.getUTCFullYear()+c*a)}):null};var fa=ea.range;a.timeInterval=b,a.timeMillisecond=g,a.timeMilliseconds=h,a.utcMillisecond=g,a.utcMilliseconds=h,a.timeSecond=k,a.timeSeconds=l,a.utcSecond=k,a.utcSeconds=l,a.timeMinute=m,a.timeMinutes=n,a.timeHour=o,a.timeHours=p,a.timeDay=q,a.timeDays=r,a.timeWeek=s,a.timeWeeks=z,a.timeSunday=s,a.timeSundays=z,a.timeMonday=t,a.timeMondays=A,a.timeTuesday=u,a.timeTuesdays=B,a.timeWednesday=v,a.timeWednesdays=C,a.timeThursday=w,a.timeThursdays=D,a.timeFriday=x,a.timeFridays=E,a.timeSaturday=y,a.timeSaturdays=F,a.timeMonth=G,a.timeMonths=H,a.timeYear=I,a.timeYears=J,a.utcMinute=K,a.utcMinutes=L,a.utcHour=M,a.utcHours=N,a.utcDay=O,a.utcDays=P,a.utcWeek=Q,a.utcWeeks=X,a.utcSunday=Q,a.utcSundays=X,a.utcMonday=R,a.utcMondays=Y,a.utcTuesday=S,a.utcTuesdays=Z,a.utcWednesday=T,a.utcWednesdays=$,a.utcThursday=U,a.utcThursdays=_,a.utcFriday=V,a.utcFridays=aa,a.utcSaturday=W,a.utcSaturdays=ba,a.utcMonth=ca,a.utcMonths=da,a.utcYear=ea,a.utcYears=fa,Object.defineProperty(a,"__esModule",{value:!0})})},{}],36:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(){return r||(u(c),r=t.now()+s)}function c(){r=0}function d(){this._call=this._time=this._next=null}function e(a,b,c){var e=new d;return e.restart(a,b,c),e}function f(){b(),++m;for(var a,c=k;c;)(a=r-c._time)>=0&&c._call.call(null,a),c=c._next;--m}function g(){r=(q=t.now())+s,m=n=0;try{f()}finally{m=0,i(),r=0}}function h(){var a=t.now(),b=a-q;b>p&&(s-=b,q=a)}function i(){for(var a,b,c=k,d=1/0;c;)c._call?(d>c._time&&(d=c._time),a=c,c=c._next):(b=c._next,c._next=null,c=a?a._next=b:k=b);l=a,j(d)}function j(a){if(!m){n&&(n=clearTimeout(n));a-r>24?(a<1/0&&(n=setTimeout(g,a-t.now()-s)),o&&(o=clearInterval(o))):(o||(q=t.now(),o=setInterval(h,p)),m=1,u(g))}}var k,l,m=0,n=0,o=0,p=1e3,q=0,r=0,s=0,t="object"==typeof performance&&performance.now?performance:Date,u="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(a){setTimeout(a,17)};d.prototype=e.prototype={constructor:d,restart:function(a,c,d){if("function"!=typeof a)throw new TypeError("callback is not a function");d=(null==d?b():+d)+(null==c?0:+c),this._next||l===this||(l?l._next=this:k=this,l=this),this._call=a,this._time=d,j()},stop:function(){this._call&&(this._call=null,this._time=1/0,j())}};var v=function(a,b,c){var e=new d;return b=null==b?0:+b,e.restart(function(c){e.stop(),a(c+b)},b,c),e},w=function(a,c,e){var f=new d,g=c;return null==c?(f.restart(a,c,e),f):(c=+c,e=null==e?b():+e,f.restart(function b(d){d+=g,f.restart(b,g+=c,e),a(d)},c,e),f)};a.now=b,a.timer=e,a.timerFlush=f,a.timeout=v,a.interval=w,Object.defineProperty(a,"__esModule",{value:!0})})},{}],37:[function(a,b,c){!function(d,e){"object"==typeof c&&void 0!==b?e(c,a("d3-selection"),a("d3-dispatch"),a("d3-timer"),a("d3-interpolate"),a("d3-color"),a("d3-ease")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch","d3-timer","d3-interpolate","d3-color","d3-ease"],e):e(d.d3=d.d3||{},d.d3,d.d3,d.d3,d.d3,d.d3,d.d3)}(this,function(a,b,c,d,e,f,g){"use strict";function h(a,b){var c=j(a,b);if(c.state>R)throw new Error("too late; already scheduled");return c}function i(a,b){var c=j(a,b);if(c.state>T)throw new Error("too late; already started");return c}function j(a,b){var c=a.__transition;if(!c||!(c=c[b]))throw new Error("transition not found");return c}function k(a,b,c){function e(a){c.state=S,c.timer.restart(f,c.delay,c.time),c.delay<=a&&f(a-c.delay)}function f(e){var k,l,m,n;if(c.state!==S)return h();for(k in j)if(n=j[k],n.name===c.name){if(n.state===U)return d.timeout(f);n.state===V?(n.state=X,n.timer.stop(),n.on.call("interrupt",a,a.__data__,n.index,n.group),delete j[k]):+k=0&&(a=a.slice(0,b)),!a||"start"===a})}function C(a,b,c){var d,e,f=B(b)?h:i;return function(){var g=f(this,a),h=g.on;h!==d&&(e=(d=h).copy()).on(b,c),g.on=e}}function D(a){return function(){var b=this.parentNode;for(var c in this.__transition)if(+c!==a)return;b&&b.removeChild(this)}}function E(a,c){var d,e,f;return function(){var g=b.style(this,a),h=(this.style.removeProperty(a),b.style(this,a));return g===h?null:g===d&&h===e?f:f=c(d=g,e=h)}}function F(a){return function(){this.style.removeProperty(a)}}function G(a,c,d){var e,f;return function(){var g=b.style(this,a);return g===d?null:g===e?f:f=c(e=g,d)}}function H(a,c,d){var e,f,g;return function(){var h=b.style(this,a),i=d(this);return null==i&&(this.style.removeProperty(a),i=b.style(this,a)),h===i?null:h===e&&i===f?g:g=c(e=h,f=i)}}function I(a,b,c){function d(){var d=this,e=b.apply(d,arguments);return e&&function(b){d.style.setProperty(a,e(b),c)}}return d._value=b,d}function J(a){return function(){this.textContent=a}}function K(a){return function(){var b=a(this);this.textContent=null==b?"":b}}function L(a,b,c,d){this._groups=a,this._parents=b,this._name=c,this._id=d}function M(a){return b.selection().transition(a)}function N(){return++sa}function O(a,b){for(var c;!(c=a.__transition)||!(c=c[b]);)if(!(a=a.parentNode))return ua.time=d.now(),ua;return c}var P=c.dispatch("start","end","interrupt"),Q=[],R=0,S=1,T=2,U=3,V=4,W=5,X=6,Y=function(a,b,c,d,e,f){var g=a.__transition;if(g){if(c in g)return}else a.__transition={};k(a,c,{name:b,index:d,group:e,on:P,tween:Q,time:f.time,delay:f.delay,duration:f.duration,ease:f.ease,timer:null,state:R})},Z=function(a,b){var c,d,e,f=a.__transition,g=!0;if(f){b=null==b?null:b+"";for(e in f)(c=f[e]).name===b?(d=c.state>T&&c.stateS&&c.name===b)return new L([[a]],wa,b,+d)}return null};a.transition=M,a.active=xa,a.interrupt=Z,Object.defineProperty(a,"__esModule",{value:!0})})},{"d3-color":15,"d3-dispatch":16,"d3-ease":19,"d3-interpolate":24,"d3-selection":32,"d3-timer":36}],38:[function(a,b,c){!function(a,d){"object"==typeof c&&void 0!==b?d(c):"function"==typeof define&&define.amd?define(["exports"],d):d(a.d3=a.d3||{})}(this,function(a){"use strict";function b(a){return a[0]}function c(a){return a[1]}function d(){this._=null}function e(a){a.U=a.C=a.L=a.R=a.P=a.N=null}function f(a,b){var c=b,d=b.R,e=c.U;e?e.L===c?e.L=d:e.R=d:a._=d,d.U=e,c.U=d,c.R=d.L,c.R&&(c.R.U=c),d.L=c}function g(a,b){var c=b,d=b.L,e=c.U;e?e.L===c?e.L=d:e.R=d:a._=d,d.U=e,c.U=d,c.L=d.R,c.L&&(c.L.U=c),d.R=c}function h(a){for(;a.L;)a=a.L;return a}function i(a,b,c,d){var e=[null,null],f=M.push(e)-1;return e.left=a,e.right=b,c&&k(e,a,b,c),d&&k(e,b,a,d),K[a.index].halfedges.push(f),K[b.index].halfedges.push(f),e}function j(a,b,c){var d=[b,c];return d.left=a,d}function k(a,b,c,d){a[0]||a[1]?a.left===c?a[1]=d:a[0]=d:(a[0]=d,a.left=b,a.right=c)}function l(a,b,c,d,e){var f,g=a[0],h=a[1],i=g[0],j=g[1],k=h[0],l=h[1],m=0,n=1,o=k-i,p=l-j;if(f=b-i,o||!(f>0)){if(f/=o,o<0){if(f0){if(f>n)return;f>m&&(m=f)}if(f=d-i,o||!(f<0)){if(f/=o,o<0){if(f>n)return;f>m&&(m=f)}else if(o>0){if(f0)){if(f/=p,p<0){if(f0){if(f>n)return;f>m&&(m=f)}if(f=e-j,p||!(f<0)){if(f/=p,p<0){if(f>n)return;f>m&&(m=f)}else if(p>0){if(f0||n<1)||(m>0&&(a[0]=[i+m*o,j+m*p]),n<1&&(a[1]=[i+n*o,j+n*p]),!0)}}}}}function m(a,b,c,d,e){var f=a[1];if(f)return!0;var g,h,i=a[0],j=a.left,k=a.right,l=j[0],m=j[1],n=k[0],o=k[1],p=(l+n)/2,q=(m+o)/2;if(o===m){if(p=d)return;if(l>n){if(i){if(i[1]>=e)return}else i=[p,c];f=[p,e]}else{if(i){if(i[1]1)if(l>n){if(i){if(i[1]>=e)return}else i=[(c-h)/g,c];f=[(e-h)/g,e]}else{if(i){if(i[1]=d)return}else i=[b,g*b+h];f=[d,g*d+h]}else{if(i){if(i[0]P||Math.abs(e[0][1]-e[1][1])>P)||delete M[f]}function o(a){return K[a.index]={site:a,halfedges:[]}}function p(a,b){var c=a.site,d=b.left,e=b.right;return c===e&&(e=d,d=c),e?Math.atan2(e[1]-d[1],e[0]-d[0]):(c===d?(d=b[1],e=b[0]):(d=b[0],e=b[1]),Math.atan2(d[0]-e[0],e[1]-d[1]))}function q(a,b){return b[+(b.left!==a.site)]}function r(a,b){return b[+(b.left===a.site)]}function s(){for(var a,b,c,d,e=0,f=K.length;eP||Math.abs(s-n)>P)&&(i.splice(h,0,M.push(j(g,o,Math.abs(p-a)P?[a,Math.abs(m-a)P?[Math.abs(n-d)P?[c,Math.abs(m-c)P?[Math.abs(n-b)=-Q)){var n=i*i+j*j,o=k*k+l*l,p=(l*n-j*o)/m,q=(i*o-k*n)/m,r=N.pop()||new u;r.arc=a,r.site=e,r.x=p+g,r.y=(r.cy=q+h)+Math.sqrt(p*p+q*q),a.circle=r;for(var s=null,t=L._;t;)if(r.yP)h=h.L;else{if(!((e=f-D(h,g))>P)){d>-P?(b=h.P,c=h):e>-P?(b=h,c=h.N):b=c=h;break}if(!h.R){b=h;break}h=h.R}o(a);var j=y(a);if(J.insert(b,j),b||c){if(b===c)return w(b),c=y(b.site),J.insert(j,c),j.edge=c.edge=i(b.site,j.site),v(b),void v(c);if(!c)return void(j.edge=i(b.site,j.site));w(b),w(c);var l=b.site,m=l[0],n=l[1],p=a[0]-m,q=a[1]-n,r=c.site,s=r[0]-m,t=r[1]-n,u=2*(p*t-q*s),x=p*p+q*q,z=s*s+t*t,A=[(t*x-q*z)/u+m,(p*z-s*x)/u+n];k(c.edge,l,r,A),j.edge=i(l,a,null,A),c.edge=i(a,r,null,A),v(b),v(c)}}function C(a,b){var c=a.site,d=c[0],e=c[1],f=e-b;if(!f)return d;var g=a.P;if(!g)return-1/0;c=g.site;var h=c[0],i=c[1],j=i-b;if(!j)return h;var k=h-d,l=1/f-1/j,m=k/j;return l?(-m+Math.sqrt(m*m-2*l*(k*k/(-2*j)-i+j/2+e-f/2)))/l+d:(d+h)/2}function D(a,b){var c=a.N;if(c)return C(c,b);var d=a.site;return d[1]===b?d[0]:1/0}function E(a,b,c){return(a[0]-c[0])*(b[1]-a[1])-(a[0]-b[0])*(c[1]-a[1])}function F(a,b){return b[1]-a[1]||b[0]-a[0]}function G(a,b){var c,e,f,g=a.sort(F).pop();for(M=[],K=new Array(a.length),J=new d,L=new d;;)if(f=I,g&&(!f||g[1]=h)return null;var i=a-e.site[0],j=b-e.site[1],k=i*i+j*j;do{e=f.cells[d=g],g=null,e.halfedges.forEach(function(c){var d=f.edges[c],h=d.left;if(h!==e.site&&h||(h=d.right)){var i=a-h[0],j=b-h[1],l=i*i+j*j;ld?(d+e)/2:Math.min(0,d)||Math.max(0,e),g>f?(f+g)/2:Math.min(0,f)||Math.max(0,g))}var q=function(a){return function(){return a}};h.prototype={constructor:h,scale:function(a){return 1===a?this:new h(this.k*a,this.x,this.y)},translate:function(a,b){return 0===a&0===b?this:new h(this.k,this.x+this.k*a,this.y+this.k*b)},apply:function(a){return[a[0]*this.k+this.x,a[1]*this.k+this.y]},applyX:function(a){return a*this.k+this.x},applyY:function(a){return a*this.k+this.y},invert:function(a){return[(a[0]-this.x)/this.k,(a[1]-this.y)/this.k]},invertX:function(a){return(a-this.x)/this.k},invertY:function(a){return(a-this.y)/this.k},rescaleX:function(a){return a.copy().domain(a.range().map(this.invertX,this).map(a.invert,a))},rescaleY:function(a){return a.copy().domain(a.range().map(this.invertY,this).map(a.invert,a))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var r=new h(1,0,0);i.prototype=h.prototype;var s=function(){e.event.preventDefault(),e.event.stopImmediatePropagation()},t=function(){function a(a){a.property("__zoom",m).on("wheel.zoom",y).on("mousedown.zoom",z).on("dblclick.zoom",A).filter(K).on("touchstart.zoom",B).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function i(a,b){return b=Math.max(L[0],Math.min(L[1],b)),b===a.k?a:new h(b,a.x,a.y)}function t(a,b,c){var d=b[0]-c[0]*a.k,e=b[1]-c[1]*a.k;return d===a.x&&e===a.y?a:new h(a.k,d,e)}function u(a){return[(+a[0][0]+ +a[1][0])/2,(+a[0][1]+ +a[1][1])/2]}function v(a,b,c){a.on("start.zoom",function(){w(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).end()}).tween("zoom",function(){var a=this,d=arguments,e=w(a,d),f=H.apply(a,d),g=c||u(f),i=Math.max(f[1][0]-f[0][0],f[1][1]-f[0][1]),j=a.__zoom,k="function"==typeof b?b.apply(a,d):b,l=O(j.invert(g).concat(i/j.k),k.invert(g).concat(i/k.k));return function(a){if(1===a)a=k;else{var b=l(a),c=i/b[2];a=new h(c,g[0]-b[0]*c,g[1]-b[1]*c)}e.zoom(null,a)}})}function w(a,b){for(var c,d=0,e=P.length;dT}d.zoom("mouse",I(t(d.that.__zoom,d.mouse[0]=e.mouse(d.that),d.mouse[1]),d.extent,M))}function b(){g.on("mousemove.zoom mouseup.zoom",null),c.dragEnable(e.event.view,d.moved),s(),d.end()}if(!F&&G.apply(this,arguments)){var d=w(this,arguments),g=e.select(e.event.view).on("mousemove.zoom",a,!0).on("mouseup.zoom",b,!0),h=e.mouse(this),i=e.event.clientX,k=e.event.clientY;c.dragDisable(e.event.view),j(),d.mouse=[h,this.__zoom.invert(h)],f.interrupt(this),d.start()}}function A(){if(G.apply(this,arguments)){var b=this.__zoom,c=e.mouse(this),d=b.invert(c),f=b.k*(e.event.shiftKey?.5:2),g=I(t(i(b,f),c,d),H.apply(this,arguments),M);s(),N>0?e.select(this).transition().duration(N).call(v,g,c):e.select(this).call(a.transform,g)}}function B(){if(G.apply(this,arguments)){var a,b,c,d,g=w(this,arguments),h=e.event.changedTouches,i=h.length;for(j(),b=0;b0&&h.length>f){h.warned=!0;var i=new Error("Possible EventEmitter memory leak detected. "+h.length+' "'+String(b)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');i.name="MaxListenersExceededWarning",i.emitter=a,i.type=b,i.count=h.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",i.name,i.message)}}else h=g[b]=c,++a._eventsCount;return a}function l(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var a=new Array(arguments.length),b=0;b1&&(b=arguments[1]),b instanceof Error)throw b;var n=new Error('Unhandled "error" event. ('+b+")");throw n.context=b,n}if(!(c=l[a]))return!1;var o="function"==typeof c;switch(d=arguments.length){case 1:f(c,o,this);break;case 2:g(c,o,this,arguments[1]);break;case 3:h(c,o,this,arguments[1],arguments[2]);break;case 4:i(c,o,this,arguments[1],arguments[2],arguments[3]);break;default:for(e=new Array(d-1),k=1;k=0;f--)if(c[f]===b||c[f].listener===b){g=c[f].listener,e=f;break}if(e<0)return this;0===e?c.shift():o(c,e),1===c.length&&(d[a]=c[0]),d.removeListener&&this.emit("removeListener",a,g||b)}return this},d.prototype.removeAllListeners=function(a){var b,c,d;if(!(c=this._events))return this;if(!c.removeListener)return 0===arguments.length?(this._events=u(null),this._eventsCount=0):c[a]&&(0==--this._eventsCount?this._events=u(null):delete c[a]),this;if(0===arguments.length){var e,f=v(c);for(d=0;d=0;d--)this.removeListener(a,b[d]);return this},d.prototype.listeners=function(a){var b,c,d=this._events;return d?(b=d[a],c=b?"function"==typeof b?[b.listener||b]:q(b):[]):c=[],c},d.listenerCount=function(a,b){return"function"==typeof a.listenerCount?a.listenerCount(b):n.call(a,b)},d.prototype.listenerCount=n,d.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],42:[function(a,b,c){function d(a){if("string"==typeof a&&(a=f.parse(a)),a.protocol||(a.protocol="https:"),"https:"!==a.protocol)throw new Error('Protocol "'+a.protocol+'" not supported. Expected "https:"');return a}var e=a("http"),f=a("url"),g=b.exports;for(var h in e)e.hasOwnProperty(h)&&(g[h]=e[h]);g.request=function(a,b){return a=d(a),e.request.call(this,a,b)},g.get=function(a,b){return a=d(a),e.get.call(this,a,b)}},{http:75,url:81}],43:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],44:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],45:[function(a,b,c){function d(a){return!!a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}function e(a){return"function"==typeof a.readFloatLE&&"function"==typeof a.slice&&d(a.slice(0,0))}b.exports=function(a){return null!=a&&(d(a)||e(a)||!!a._isBuffer)}},{}],46:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],47:[function(a,b,c){!function(){"use strict";var b=a("d3");L.Flow=L.Polyline.extend({options:{color:"blue",value:.2,maxValue:1,minThickness:1,maxThickness:20,opacity:1,dir:"auto",transitionTime:750},initialize:function(a,b,c){this._start=a,this._end=b,L.Polyline.prototype.initialize.call(this,[a,b],c)},onAdd:function(a){L.Polyline.prototype.onAdd.call(this,a);var c=this._container||this._renderer._rootGroup;c.setAttribute("class","leaflet-zoom-hide"),this._arrowContainer=b.select(c).append("g"),L.version>="1.0"&&this.addInteractiveTarget(this._arrowContainer.node()),this._arrow=this._arrowContainer.append("path").attr("d","M -10,-10 -10,10 10,0 Z").attr("class","leaflet-clickable leaflet-interactive"),a.on("viewreset",this._reset,this),this._reset(0)},onRemove:function(a){L.Polyline.prototype.onRemove.call(this,a),this._arrowContainer.selectAll("*").remove(),a.off("viewreset",this._reset,this)},_reset:function(a){var c=this;L.Polyline.prototype._reset&&L.Polyline.prototype._reset.call(this),"number"!=typeof a&&(a=this.options.transitionTime);var d=this._map.latLngToLayerPoint(this._start),e=this._map.latLngToLayerPoint(this._end),f={x:(d.x+e.x)/2,y:(d.y+e.y)/2},g=Math.atan((e.y-d.y)/(e.x-d.x));g=g/Math.PI*180,e.x-d.x<0&&(g=180+g),isNaN(g)&&(g=0);var h=this.options.minThickness+Math.abs(this.options.value)/this.options.maxValue*(this.options.maxThickness-this.options.minThickness);isNaN(h)&&(h=0);var i;i="auto"==this.options.dir?this.options.value<0?-1:this.options.value>0?1:0:this.options.dir;var j=L.Util.template("rotate({a}) scale({sx},{sy})",{a:g,sx:.35*Math.pow(h,2/3)*i,sy:.35*Math.pow(h,2/3)});this._arrowContainer&&this._arrowContainer.attr("transform","translate("+f.x+","+f.y+")"),this._arrow&&this._arrow.transition().duration(a).attr("transform",j).attr("fill",c.options.color).attr("fill-opacity",c.options.opacity),b.select(c._path).transition().duration(a).attr("stroke-width",h).attr("stroke",c.options.color).attr("stroke-opacity",c.options.opacity)},_update:function(a){L.Polyline.prototype._update&&L.Polyline.prototype._update.call(this);var c=this;"number"!=typeof a&&(a=this.options.transitionTime);var d=this._map.latLngToLayerPoint(this._start),e=this._map.latLngToLayerPoint(this._end),f={x:(d.x+e.x)/2,y:(d.y+e.y)/2},g=Math.atan((e.y-d.y)/(e.x-d.x));g=g/Math.PI*180,e.x-d.x<0&&(g=180+g),isNaN(g)&&(g=0);var h=this.options.minThickness+Math.abs(this.options.value)/this.options.maxValue*(this.options.maxThickness-this.options.minThickness);isNaN(h)&&(h=0);var i;i="auto"==this.options.dir?this.options.value<0?-1:this.options.value>0?1:0:this.options.dir;var j=L.Util.template("rotate({a}) scale({sx},{sy})",{a:g,sx:.35*Math.pow(h,2/3)*i,sy:.35*Math.pow(h,2/3)});this._arrowContainer&&this._arrowContainer.attr("transform","translate("+f.x+","+f.y+")"),this._arrow&&this._arrow.transition().duration(a).attr("transform",j).attr("fill",c.options.color).attr("fill-opacity",c.options.opacity),b.select(c._path).transition().duration(a).attr("stroke-width",h).attr("stroke",c.options.color).attr("stroke-opacity",c.options.opacity)},setStyle:function(a){L.Util.setOptions(this,a),this._reset()}}),L.flow=function(a,b,c){return new L.Flow(a,b,c)}}()},{d3:40}],48:[function(a,b,c){!function(){var b=a("d3"),c=a("minicharts"),d=a("./utils.js");L.Minichart=L.CircleMarker.extend({options:{type:"bar",data:[1],maxValues:"auto",colors:b.schemeCategory10,width:60,height:60,opacity:1,labels:"none",labelMinSize:8,labelMaxSize:24,labelPadding:2,labelColor:"auto",labelStyle:"font-family:sans-serif",transitionTime:750},initialize:function(a,b){this._center=a,this._zoom=0,this.options=d.mergeOptions(b,this.options),this._setMaxValue(),L.CircleMarker.prototype.initialize.call(this,a,{radius:this.options.width/2,stroke:!1,fill:!1})},onAdd:function(a){L.CircleMarker.prototype.onAdd.call(this,a);var c=this._container||this._renderer._rootGroup;c.setAttribute("class","leaflet-zoom-hide"),this._chart=b.select(c).append("g"),L.version>="1.0"&&this.addInteractiveTarget(this._chart.node()),a.on("moveend",this._onMoveend,this),this._redraw(!0)},onRemove:function(a){L.CircleMarker.prototype.onRemove.call(this,a),this._chart.selectAll("*").remove(),a.off("moveend",this._onMoveend,this)},_onMoveend:function(){var a=this._zoom;this._zoom=this._map.getZoom(),a!=this._zoom&&this._redraw()},setOptions:function(a){var b=a.type&&a.type!=this.options.type;this.options=d.mergeOptions(a,this.options),this._setMaxValue(),this._redraw(b)},_setMaxValue:function(){var a=this.options.maxValues,c=d.toArray(this.options.data);if("auto"===a&&0==(a=Math.max(b.max(c),Math.abs(b.min(c))))&&(a=1),a=d.toArray(a),1!==a.length&&a.length!=c.length)throw new Error("'maxValues' should be a single number or have same length as 'data'");for(var e=0;ea[e%a.length]){console.warn("Some data values are greater than 'maxValues'. Chart will be truncated. You should set option 'maxValues' to avoid this problem.");break}this.options.maxValues=a},_redraw:function(a){var b,e=this._map.latLngToLayerPoint(this._center);b="bar"==this.options.type?2*this.options.height:this.options.width,this._chart.attr("transform","translate("+(e.x-this.options.width/2)+","+(e.y-b/2)+")").transition().duration(this.options.transitionTime).attr("opacity",this.options.opacity);var f=this.options.data;f=d.toArray(f);for(var g=0;g10?f(c):c>1?f(c,10,!0):f(c,100,!0),d+c+b}function f(a,b,c){return b=b||1,c?Math.round(a*b)/b:Math.round(a/b)*b}b.exports.mergeOptions=a,b.exports.toArray=c,b.exports.toFunction=d,b.exports.prettyNumbers=function(a){return a.map(e)}}()},{}],50:[function(a,b,c){!function(){"use strict";function c(a,b,c){var f={minValue:"auto",maxValue:"auto",zeroLineStyle:"stroke:#333;stroke-width:1;"};e.call(this,a,b,c,f);var g=d.scaleLinear().domain([this._options.minValue,this._options.maxValue]).range([this._options.height,0]);this._zeroLine=this._container.append("line").attr("x1",0).attr("y1",g(0)).attr("x2",this._options.width).attr("y2",g(0)).attr("style",this._options.zeroLineStyle),this._draw()}var d=a("d3"),e=a("./chart.js");b.exports=c,c.prototype=Object.create(e.prototype),c.prototype.constructor=c,c.prototype._processOptions=function(a){if(a=e.prototype._processOptions.call(this,a,this._options),"auto"===a.minValue){var b=d.min(this._data),c="auto"===a.maxValue?d.max(this._data):a.maxValue;a.minValue=c>0&&b>0?0:b}if("auto"===a.maxValue){var c="auto"===a.minValue?d.min(this._data):a.minValue,c=d.max(this._data);a.maxValue=c<0&&b<0?0:c}return a},c.prototype._draw=function(){function a(a,b,c,d){return"M"+a+" "+b+"l"+c+" 0l0 "+d+"l"+-c+" 0Z"}function b(a,b,c){a.fillRect(c*g+3,h(0),g,0,f._options.labelPadding,"center",b>=0?"top":"bottom",0)}function c(a,b,c){a.fillRect(c*g+3,h(b>=0?b:0),g,Math.abs(h(b)-h(0)),f._options.labelPadding,"center",b>=0?"top":"bottom",f._options.transitionTime)}var f=this;e.prototype._draw.call(this);var g=(f._options.width-6)/f._data.length,h=d.scaleLinear().domain([f._options.minValue,f._options.maxValue]).range([f._options.height,0]);f._zeroLine.transition().duration(f._options.transitionTime).attr("x1",0).attr("y1",h(0)).attr("x2",f._options.width).attr("y2",h(0)).attr("style",f._options.zeroLineStyle);var i=f._chart.selectAll("path").data(f._data);i.enter().append("path").attr("d",function(b,c){return a((c+1)*g+3,h(0),0,0)}).merge(i).attr("class",f._options.shapeClass).transition().duration(f._options.transitionTime).attr("d",function(b,c){return a(c*g+3,h(0),g,h(b)-h(0))}).attr("fill",f._options.colorFun),i.exit().transition().duration(f._options.transitionTime).attr("x",function(a,b){return b*g+3}).attr("y",0).attr("width",0).attr("height",0).remove(),this._drawLabels(b,c)}}()},{"./chart.js":51,d3:40}],51:[function(a,b,c){!function(){"use strict";function c(a,b,c,e){this._data=b,this._options={width:60,height:60,transitionTime:750,colors:d.schemeCategory10,labels:"none",labelColors:"auto",labelMinSize:8,labelMaxSize:24,labelPadding:2,labelClass:"",shapeClass:""},this._options=f.mergeOptions(this._options,e||{}),this._options=this._processOptions(c),d.select(a).select("*").remove(),this._container=d.select(a).append("svg").attr("width",this._options.width).attr("height",this._options.height),this._chart=this._container.append("g")}var d=a("d3"),e=a("tinycolor2"),f=a("./utils.js"),g=a("./label.js");b.exports=c,c.prototype.update=function(a,b){this._data=a,this._options=this._processOptions(b),this._draw()},c.prototype.setOptions=function(a){this._options=this._processOptions(a),this._draw()},c.prototype.setData=function(a){this._data=a,this._draw()},c.prototype._draw=function(){var a=this;a._container.transition().duration(a._options.transitionTime).attr("width",a._options.width).attr("height",a._options.height)},c.prototype._processOptions=function(a){return a=f.mergeOptions(a,this._options),a.colorFun=f.toFunction(a.colors),a.labelClass=f.toFunction(a.labelClass),a.shapeClass=f.toFunction(a.shapeClass),"none"===a.labels?a.labelText=null:"auto"===a.labels?a.labelText=f.prettyNumber:a.labelText=f.toFunction(a.labels),"auto"===a.labelColors?a.labelColorFun=function(b,c){return e.mostReadable(a.colorFun(b,c),["white","black"])._originalInput}:a.labelColorFun=f.toFunction(a.labelColorFun),a},c.prototype._drawLabels=function(a,b){var c=this;if("none"===c._options.labels)return void c._chart.selectAll(".labels-container").remove();c._labels=c._chart.selectAll(".labels-container").data(c._data),c._labels.enter().append("g").attr("class","labels-container").each(function(b,d){this._label=new g(this,c._options.labelStyle,c._options.labelColorFun(b,d),c._options.labelMinSize,c._options.labelMaxSize),this._label.updateText(c._options.labelText(b,d)),a(this._label,b,d)}).merge(c._labels).each(function(a,d){this._label.updateText(c._options.labelText(a,d)),this._label._text.attr("fill",c._options.labelColorFun(a,d)).attr("class",c._options.labelClass(a,d)),b(this._label,a,d)}),c._labels.exit().remove()}}()},{"./label.js":53,"./utils.js":57,d3:40,tinycolor2:79}],52:[function(a,b,c){!function(){"use strict";function a(a,b){this.x=a,this.y=b}function c(a,b){this.a=a,this.b=b}function d(b,c){return b.b==c.b?[]:[new a((c.a-b.a)/(b.b-c.b),(b.b*c.a-b.a*c.b)/(b.b-c.b))]}function e(b,e,f){var h=new c(0,Math.tan(e)),i=d(b,h),j=new a(0,0),k=new a(f*Math.cos(e),f*Math.sin(e));return 0!=i.length&&g(i[0],j,k)?i:[]}function f(b,c){return j(b.b*b.b+1,2*b.a*b.b,b.a*b.a-c*c).map(function(c){return new a(c,b.getY(c))})}function g(a,b,c){var d=i(h(c,b),h(a,b)),e=i(h(c,b),h(c,b));return d>=0&&d<=e}function h(b,c){return new a(b.x-c.x,b.y-c.y)}function i(a,b){return a.x*b.x+a.y*b.y}function j(a,b,c){var d=b*b-4*a*c;return d<0?[]:0==d?[-b/(2*a)]:[(-b-Math.sqrt(d))/(2*a),(-b+Math.sqrt(d))/(2*a)]}function k(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2))}b.exports.Point=a,b.exports.Line=c,b.exports.intersectionOfTwoLines=d,b.exports.intersectionLineAndCircle=f,b.exports.pointInSegment=g,b.exports.intersectionLineRadius=e,b.exports.distance=k,c.prototype.getY=function(a){return this.a+this.b*a}}()},{}],53:[function(a,b,c){!function(){"use strict";function c(a,b,c,e,f){this._el=a,this._minSize=e,this._maxSize=f,this._container=d.select(a),this._label=this._container.append("g").attr("class","label"),this._text=this._label.append("text").attr("dy","0.35em").attr("text-anchor","middle").attr("style",b||"").attr("fill",c||"black")}var d=a("d3"),e=a("./geometry.js");b.exports=c,c.prototype.innerSize=function(){return this._text.node().getBBox()},c.prototype.size=function(){var a=this.innerSize();return{width:a.width*this._scale,height:a.height*this._scale}},c.prototype.updateText=function(a){var b=this.size();this._text.text(a);var c=this.size(),d=Math.min(b.width/c.width,b.height/c.height);return this.updateScale(this._scale*d,0),this},c.prototype.updatePosition=function(a,b,c){return this._container.transition().duration(c||0).attr("transform","translate("+a+","+b+")"),this},c.prototype.updateScale=function(a,b){a&&!isNaN(a)&&isFinite(a)||(a=0);var c=this.innerSize().height*a;return this._minSize&&cthis._maxSize&&(a=this._maxSize/this.innerSize().height),this._label.transition().duration(b||0).attr("transform","scale("+a+")"),this._scale=a,this},c.prototype.fillRect=function(a,b,c,d,e,f,g,h){var i=this.innerSize();this.updateScale(Math.min((c-2*e)/i.width,Math.abs(d)/i.height),h);var j,k,l=this.size();switch(g){case"top":k=b+l.height/2;break;case"center":k=b+d/2;break;case"bottom":k=b+d-l.height/2}switch(f){case"left":j=a+e+l.width/2;break;case"center":j=a+c/2;break;case"right":j=a+c-e-l.width/2}return this.updatePosition(j,k,h),this},c.prototype.fillCircle=function(a,b){this.updatePosition(0,0,b);var c=this.innerSize(),d=c.height/c.width,e=2*a*Math.cos(Math.PI/2-Math.atan(d));this.updateScale(e/c.height,b)},c.prototype.fillSlice=function(a,b,c,f){var g=a.centroid(c);this.updatePosition(g[0],g[1],f);var h=this.innerSize(),i=h.height/h.width,j=new e.Line(g[1]-i*g[0],i),k=new e.Line(g[1]+i*g[0],-i),l=(new e.Line(0,Math.tan(c.startAngle+Math.PI/2)),new e.Line(0,Math.tan(c.endAngle+Math.PI/2)),[]);l=l.concat(e.intersectionLineRadius(j,c.startAngle-Math.PI/2,b)),l=l.concat(e.intersectionLineRadius(j,c.endAngle-Math.PI/2,b)),l=l.concat(e.intersectionLineAndCircle(j,b)),l=l.concat(e.intersectionLineRadius(k,c.startAngle-Math.PI/2,b)),l=l.concat(e.intersectionLineRadius(k,c.endAngle-Math.PI/2,b)),l=l.concat(e.intersectionLineAndCircle(k,b));var m=new e.Point(g[0],g[1]),n=l.map(function(a){return e.distance(m,a)}),o=d.min(n),p=Math.sqrt(Math.pow(h.height/2,2)+Math.pow(h.width/2,2));this.updateScale(o/p,f)}}()},{"./geometry.js":52,d3:40}],54:[function(a,b,c){!function(){"use strict";b.exports.Barchart=a("./barchart.js"),b.exports.Polarchart=a("./polarchart.js"),b.exports.Piechart=a("./piechart.js"),window&&(window.minicharts=b.exports)}()},{"./barchart.js":50,"./piechart.js":55,"./polarchart.js":56}],55:[function(a,b,c){!function(){"use strict";function c(a,b,c){d.call(this,a,b,c)}var d=a("./polarchart.js");b.exports=c,c.prototype=Object.create(d.prototype),c.prototype.constructor=c,c.prototype._processOptions=function(a){return a=a||{},a.type="angle",d.prototype._processOptions.call(this,a)}}()},{"./polarchart.js":56}],56:[function(a,b,c){!function(){"use strict";function c(a,b,c){var d={type:"area",maxValue:"auto"};e.call(this,a,b,c,d),this._chart.attr("transform","translate("+this._options.width/2+","+this._options.width/2+")"),this._draw()}var d=a("d3"),e=a("./chart.js");b.exports=c,c.prototype=Object.create(e.prototype),c.prototype.constructor=c,c.prototype._processOptions=function(a){a=e.prototype._processOptions.call(this,a,this._options),a.height=a.width,"auto"===a.maxValue&&(a.maxValue=d.max(this._data));var b,c=a.width/2,f=d.pie().sort(null),g=d.arc().innerRadius(0);return"angle"===a.type?(b=function(a){return c},f.value(function(a){return a})):(b="radius"==a.type?d.scaleLinear():d.scalePow().exponent(.5),b.range([0,c]).domain([0,a.maxValue]),f.value(function(a){return 1})),g.outerRadius(function(a,c){return b(a.data)}),a.radius=b,a.pie=f,a.arc=g,a},c.prototype._draw=function(){function a(a){var c=d.interpolate(this._current,a);return this._current=c(0),function(a){return b._options.arc(c(a))}}var b=this;e.prototype._draw.call(this),this._chart.transition().duration(b._options.transitionTime).attr("transform","translate("+b._options.width/2+","+b._options.width/2+")");var c=this._chart.selectAll("path").data(this._options.pie(this._data));c.enter().append("path").attr("class","leaflet-clickable").attr("d",this._options.arc).attr("fill",function(a,c){return b._options.colorFun(a,c)}).each(function(a,c){1==b._data.length?this._current={startAngle:a.startAngle,endAngle:a.endAngle,data:0}:this._current={startAngle:a.endAngle,endAngle:a.endAngle}}).merge(c).attr("class",function(a,c){return b._options.shapeClass(a.data,c) +}).transition().duration(b._options.transitionTime).attrTween("d",a).attr("fill",function(a,c){return b._options.colorFun(a,c)}),c.exit().remove();var f,g;if(this._data.length>1){var h=this._options.pie(this._data);f=function(a,c,d){a.fillSlice(b._options.arc,b._options.radius(c),h[d],0)},g=function(a,c,d){a.fillSlice(b._options.arc,b._options.radius(c),h[d],b._options.transitionTime)}}else f=function(a,c,d){a.fillCircle(b._options.radius(c),0)},g=function(a,c,d){a.fillCircle(b._options.radius(c),b._options.transitionTime)};this._drawLabels(f,g)}}()},{"./chart.js":51,d3:40}],57:[function(a,b,c){!function(){"use strict";function a(a,b){a=a?JSON.parse(JSON.stringify(a)):{},b=b||{};for(var c in b)b.hasOwnProperty(c)&&!a.hasOwnProperty(c)&&(a[c]=b[c]);return a}function c(a){return a.constructor!==Array&&(a=[a]),a}function d(a){return"function"==typeof a?a:(a=c(a),function(b,c){return a[c%a.length]})}function e(a){if(isNaN(a)||!isFinite(a))return"";var b,c=Math.abs(a),d=a<0?"-":"";return c<1e3?b="":c<1e6?(b="K",c/=1e3):c<1e9?(b="M",c/=1e6):c<1e12?(b="B",c/=1e9):c<1e15&&(b="T",c/=1e12),c=c>10?f(c):c>1?f(c,10,!0):f(c,100,!0),d+c+b}function f(a,b,c){return b=b||1,c?Math.round(a*b)/b:Math.round(a/b)*b}b.exports.mergeOptions=a,b.exports.toArray=c,b.exports.toFunction=d,b.exports.prettyNumber=e}()},{}],58:[function(a,b,c){(function(a){"use strict";function c(b,c,d,e){if("function"!=typeof b)throw new TypeError('"callback" argument must be a function');var f,g,h=arguments.length;switch(h){case 0:case 1:return a.nextTick(b);case 2:return a.nextTick(function(){b.call(null,c)});case 3:return a.nextTick(function(){b.call(null,c,d)});case 4:return a.nextTick(function(){b.call(null,c,d,e)});default:for(f=new Array(h-1),g=0;g1)for(var c=1;c1&&(d=c[0]+"@",a=c[1]),a=a.replace(G,"."),d+f(a.split("."),b).join(".")}function h(a){for(var b,c,d=[],e=0,f=a.length;e=55296&&b<=56319&&e65535&&(a-=65536,b+=K(a>>>10&1023|55296),a=56320|1023&a),b+=K(a)}).join("")}function j(a){return a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:w}function k(a,b){return a+22+75*(a<26)-((0!=b)<<5)}function l(a,b,c){var d=0;for(a=c?J(a/A):a>>1,a+=J(a/b);a>I*y>>1;d+=w)a=J(a/I);return J(d+(I+1)*a/(a+z))}function m(a){var b,c,d,f,g,h,k,m,n,o,p=[],q=a.length,r=0,s=C,t=B;for(c=a.lastIndexOf(D),c<0&&(c=0),d=0;d=128&&e("not-basic"),p.push(a.charCodeAt(d));for(f=c>0?c+1:0;f=q&&e("invalid-input"),m=j(a.charCodeAt(f++)),(m>=w||m>J((v-r)/h))&&e("overflow"),r+=m*h,n=k<=t?x:k>=t+y?y:k-t,!(mJ(v/o)&&e("overflow"),h*=o;b=p.length+1,t=l(r-g,b,0==g),J(r/b)>v-s&&e("overflow"),s+=J(r/b),r%=b,p.splice(r++,0,s)}return i(p)}function n(a){var b,c,d,f,g,i,j,m,n,o,p,q,r,s,t,u=[];for(a=h(a),q=a.length,b=C,c=0,g=B,i=0;i=b&&pJ((v-c)/r)&&e("overflow"),c+=(j-b)*r,b=j,i=0;iv&&e("overflow"),p==b){for(m=c,n=w;o=n<=g?x:n>=g+y?y:n-g,!(m= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=w-x,J=Math.floor,K=String.fromCharCode;if(t={version:"1.4.1",ucs2:{decode:h,encode:i},decode:m,encode:n,toASCII:p,toUnicode:o},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return t});else if(q&&r)if(b.exports==q)r.exports=t;else for(u in t)t.hasOwnProperty(u)&&(q[u]=t[u]);else d.punycode=t}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],61:[function(a,b,c){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;k=0?(l=p.substr(0,q),m=p.substr(q+1)):(l=p,m=""),n=decodeURIComponent(l),o=decodeURIComponent(m),d(g,n)?e(g[n])?g[n].push(o):g[n]=[g[n],o]:g[n]=o}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],62:[function(a,b,c){"use strict";function d(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d0?("string"==typeof b||g.objectMode||Object.getPrototypeOf(b)===L.prototype||(b=e(b)),d?g.endEmitted?a.emit("error",new Error("stream.unshift() after end event")):k(a,g,b,!0):g.ended?a.emit("error",new Error("stream.push() after EOF")):(g.reading=!1,g.decoder&&!c?(b=g.decoder.write(b),g.objectMode||0!==b.length?k(a,g,b,!1):s(a,g)):k(a,g,b,!1))):d||(g.reading=!1)}return m(g)}function k(a,b,c,d){b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,d?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&q(a)),s(a,b)}function l(a,b){var c;return f(b)||"string"==typeof b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function m(a){return!a.ended&&(a.needReadable||a.length=U?a=U:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function o(a,b){return a<=0||0===b.length&&b.ended?0:b.objectMode?1:a!==a?b.flowing&&b.length?b.buffer.head.data.length:b.length:(a>b.highWaterMark&&(b.highWaterMark=n(a)),a<=b.length?a:b.ended?b.length:(b.needReadable=!0,0))}function p(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,q(a)}}function q(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(P("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?G.nextTick(r,a):r(a))}function r(a){P("emit readable"),a.emit("readable"),y(a)}function s(a,b){b.readingMore||(b.readingMore=!0,G.nextTick(t,a,b))}function t(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length=b.length?(c=b.decoder?b.buffer.join(""):1===b.buffer.length?b.buffer.head.data:b.buffer.concat(b.length),b.buffer.clear()):c=A(a,b.buffer,b.decoder),c}function A(a,b,c){var d;return af.length?f.length:a;if(g===f.length?e+=f:e+=f.slice(0,a),0===(a-=g)){g===f.length?(++d,c.next?b.head=c.next:b.head=b.tail=null):(b.head=c,c.data=f.slice(g));break}++d}return b.length-=d,e}function C(a,b){var c=L.allocUnsafe(a),d=b.head,e=1;for(d.data.copy(c),a-=d.data.length;d=d.next;){var f=d.data,g=a>f.length?f.length:a;if(f.copy(c,c.length-a,0,g),0===(a-=g)){g===f.length?(++e,d.next?b.head=d.next:b.head=b.tail=null):(b.head=d,d.data=f.slice(g));break}++e}return b.length-=e,c}function D(a){var b=a._readableState;if(b.length>0)throw new Error('"endReadable()" called on non-empty stream');b.endEmitted||(b.ended=!0,G.nextTick(E,b,a))}function E(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function F(a,b){for(var c=0,d=a.length;c=b.highWaterMark||b.ended))return P("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?D(this):q(this),null;if(0===(a=o(a,b))&&b.ended)return 0===b.length&&D(this),null;var d=b.needReadable;P("need readable",d),(0===b.length||b.length-a0?z(a,b):null,null===e?(b.needReadable=!0,a=0):b.length-=a,0===b.length&&(b.ended||(b.needReadable=!0),c!==a&&b.ended&&D(this)),null!==e&&this.emit("data",e),e},i.prototype._read=function(a){this.emit("error",new Error("_read() is not implemented"))},i.prototype.pipe=function(a,b){function d(a,b){P("onunpipe"),a===m&&b&&!1===b.hasUnpiped&&(b.hasUnpiped=!0,f())}function e(){P("onend"),a.end()}function f(){P("cleanup"),a.removeListener("close",j),a.removeListener("finish",k),a.removeListener("drain",q),a.removeListener("error",i),a.removeListener("unpipe",d),m.removeListener("end",e),m.removeListener("end",l),m.removeListener("data",h),r=!0,!n.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function h(b){P("ondata"),s=!1,!1!==a.write(b)||s||((1===n.pipesCount&&n.pipes===a||n.pipesCount>1&&-1!==F(n.pipes,a))&&!r&&(P("false write response, pause",m._readableState.awaitDrain),m._readableState.awaitDrain++,s=!0),m.pause())}function i(b){P("onerror",b),l(),a.removeListener("error",i),0===J(a,"error")&&a.emit("error",b)}function j(){a.removeListener("finish",k),l()}function k(){P("onfinish"),a.removeListener("close",j),l()}function l(){P("unpipe"),m.unpipe(a)}var m=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=a;break;case 1:n.pipes=[n.pipes,a];break;default:n.pipes.push(a)}n.pipesCount+=1,P("pipe count=%d opts=%j",n.pipesCount,b);var o=(!b||!1!==b.end)&&a!==c.stdout&&a!==c.stderr,p=o?e:l;n.endEmitted?G.nextTick(p):m.once("end",p),a.on("unpipe",d);var q=u(m);a.on("drain",q);var r=!1,s=!1;return m.on("data",h),g(a,"error",i),a.once("close",j),a.once("finish",k),a.emit("pipe",m),n.flowing||(P("pipe resume"),m.resume()),a},i.prototype.unpipe=function(a){var b=this._readableState,c={hasUnpiped:!1};if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this,c),this);if(!a){var d=b.pipes,e=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var f=0;f-1?setImmediate:B.nextTick;j.WritableState=i;var E=a("core-util-is");E.inherits=a("inherits");var F={deprecate:a("util-deprecate")},G=a("./internal/streams/stream"),H=a("safe-buffer").Buffer,I=d.Uint8Array||function(){},J=a("./internal/streams/destroy");E.inherits(j,G),i.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(i.prototype,"buffer",{get:F.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(a){}}();var K;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(K=Function.prototype[Symbol.hasInstance],Object.defineProperty(j,Symbol.hasInstance,{value:function(a){return!!K.call(this,a)||this===j&&(a&&a._writableState instanceof i)}})):K=function(a){return a instanceof this},j.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},j.prototype.write=function(a,b,c){var d=this._writableState,e=!1,i=!d.objectMode&&g(a);return i&&!H.isBuffer(a)&&(a=f(a)),"function"==typeof b&&(c=b,b=null),i?b="buffer":b||(b=d.defaultEncoding),"function"!=typeof c&&(c=h),d.ended?k(this,c):(i||l(this,d,a,c))&&(d.pendingcb++,e=n(this,d,i,a,b,c)),e},j.prototype.cork=function(){this._writableState.corked++},j.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||u(this,a))},j.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);return this._writableState.defaultEncoding=a,this},Object.defineProperty(j.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),j.prototype._write=function(a,b,c){c(new Error("_write() is not implemented"))},j.prototype._writev=null,j.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||z(this,d,c)},Object.defineProperty(j.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(a){this._writableState&&(this._writableState.destroyed=a)}}),j.prototype.destroy=J.destroy,j.prototype._undestroy=J.undestroy,j.prototype._destroy=function(a,b){this.end(),b(a)}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":64,"./internal/streams/destroy":70,"./internal/streams/stream":71,_process:59,"core-util-is":9,inherits:44,"process-nextick-args":58,"safe-buffer":74,"util-deprecate":83}],69:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b,c){a.copy(b,c)}var f=a("safe-buffer").Buffer,g=a("util");b.exports=function(){function a(){d(this,a),this.head=null,this.tail=null,this.length=0}return a.prototype.push=function(a){var b={data:a,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length},a.prototype.unshift=function(a){var b={data:a,next:this.head};0===this.length&&(this.tail=b),this.head=b,++this.length},a.prototype.shift=function(){if(0!==this.length){var a=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,a}},a.prototype.clear=function(){this.head=this.tail=null,this.length=0},a.prototype.join=function(a){if(0===this.length)return"";for(var b=this.head,c=""+b.data;b=b.next;)c+=a+b.data;return c},a.prototype.concat=function(a){if(0===this.length)return f.alloc(0);if(1===this.length)return this.head.data;for(var b=f.allocUnsafe(a>>>0),c=this.head,d=0;c;)e(c.data,b,d),d+=c.data.length,c=c.next;return b},a}(),g&&g.inspect&&g.inspect.custom&&(b.exports.prototype[g.inspect.custom]=function(){var a=g.inspect({length:this.length});return this.constructor.name+" "+a})},{"safe-buffer":74,util:5}],70:[function(a,b,c){"use strict";function d(a,b){var c=this,d=this._readableState&&this._readableState.destroyed,e=this._writableState&&this._writableState.destroyed +;return d||e?(b?b(a):!a||this._writableState&&this._writableState.errorEmitted||g.nextTick(f,this,a),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(a){!b&&a?(g.nextTick(f,c,a),c._writableState&&(c._writableState.errorEmitted=!0)):b&&b(a)}),this)}function e(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function f(a,b){a.emit("error",b)}var g=a("process-nextick-args");b.exports={destroy:d,undestroy:e}},{"process-nextick-args":58}],71:[function(a,b,c){b.exports=a("events").EventEmitter},{events:41}],72:[function(a,b,c){"use strict";function d(a){if(!a)return"utf8";for(var b;;)switch(a){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return a;default:if(b)return;a=(""+a).toLowerCase(),b=!0}}function e(a){var b=d(a);if("string"!=typeof b&&(s.isEncoding===t||!t(a)))throw new Error("Unknown encoding: "+a);return b||a}function f(a){this.encoding=e(a);var b;switch(this.encoding){case"utf16le":this.text=m,this.end=n,b=4;break;case"utf8":this.fillLast=j,b=4;break;case"base64":this.text=o,this.end=p,b=3;break;default:return this.write=q,void(this.end=r)}this.lastNeed=0,this.lastTotal=0,this.lastChar=s.allocUnsafe(b)}function g(a){return a<=127?0:a>>5==6?2:a>>4==14?3:a>>3==30?4:a>>6==2?-1:-2}function h(a,b,c){var d=b.length-1;if(d=0?(e>0&&(a.lastNeed=e-1),e):--d=0?(e>0&&(a.lastNeed=e-2),e):--d=0?(e>0&&(2===e?e=0:a.lastNeed=e-3),e):0)}function i(a,b,c){if(128!=(192&b[0]))return a.lastNeed=0,"�";if(a.lastNeed>1&&b.length>1){if(128!=(192&b[1]))return a.lastNeed=1,"�";if(a.lastNeed>2&&b.length>2&&128!=(192&b[2]))return a.lastNeed=2,"�"}}function j(a){var b=this.lastTotal-this.lastNeed,c=i(this,a,b);return void 0!==c?c:this.lastNeed<=a.length?(a.copy(this.lastChar,b,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(a.copy(this.lastChar,b,0,a.length),void(this.lastNeed-=a.length))}function k(a,b){var c=h(this,a,b);if(!this.lastNeed)return a.toString("utf8",b);this.lastTotal=c;var d=a.length-(c-this.lastNeed);return a.copy(this.lastChar,0,d),a.toString("utf8",b,d)}function l(a){var b=a&&a.length?this.write(a):"";return this.lastNeed?b+"�":b}function m(a,b){if((a.length-b)%2==0){var c=a.toString("utf16le",b);if(c){var d=c.charCodeAt(c.length-1);if(d>=55296&&d<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=a[a.length-2],this.lastChar[1]=a[a.length-1],c.slice(0,-1)}return c}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=a[a.length-1],a.toString("utf16le",b,a.length-1)}function n(a){var b=a&&a.length?this.write(a):"";if(this.lastNeed){var c=this.lastTotal-this.lastNeed;return b+this.lastChar.toString("utf16le",0,c)}return b}function o(a,b){var c=(a.length-b)%3;return 0===c?a.toString("base64",b):(this.lastNeed=3-c,this.lastTotal=3,1===c?this.lastChar[0]=a[a.length-1]:(this.lastChar[0]=a[a.length-2],this.lastChar[1]=a[a.length-1]),a.toString("base64",b,a.length-c))}function p(a){var b=a&&a.length?this.write(a):"";return this.lastNeed?b+this.lastChar.toString("base64",0,3-this.lastNeed):b}function q(a){return a.toString(this.encoding)}function r(a){return a&&a.length?this.write(a):""}var s=a("safe-buffer").Buffer,t=s.isEncoding||function(a){switch((a=""+a)&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};c.StringDecoder=f,f.prototype.write=function(a){if(0===a.length)return"";var b,c;if(this.lastNeed){if(void 0===(b=this.fillLast(a)))return"";c=this.lastNeed,this.lastNeed=0}else c=0;return ca._pos){var f=c.substr(a._pos);if("x-user-defined"===a._charset){for(var g=new e(f.length),h=0;ha._pos&&(a.push(new e(new Uint8Array(j.result.slice(a._pos)))),a._pos=j.result.byteLength)},j.onload=function(){a.push(null)},j.readAsArrayBuffer(c)}a._xhr.readyState===i.DONE&&"ms-stream"!==a._mode&&a.push(null)}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{"./capability":76,_process:59,buffer:7,inherits:44,"readable-stream":73}],79:[function(a,b,c){!function(a){function c(a,b){if(a=a||"",b=b||{},a instanceof c)return a;if(!(this instanceof c))return new c(a,b);var e=d(a);this._originalInput=a,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=P(100*this._a)/100,this._format=b.format||e.format,this._gradientType=b.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=e.ok,this._tc_id=O++}function d(a){var b={r:0,g:0,b:0},c=1,d=null,f=null,h=null,j=!1,k=!1;return"string"==typeof a&&(a=K(a)),"object"==typeof a&&(J(a.r)&&J(a.g)&&J(a.b)?(b=e(a.r,a.g,a.b),j=!0,k="%"===String(a.r).substr(-1)?"prgb":"rgb"):J(a.h)&&J(a.s)&&J(a.v)?(d=G(a.s),f=G(a.v),b=i(a.h,d,f),j=!0,k="hsv"):J(a.h)&&J(a.s)&&J(a.l)&&(d=G(a.s),h=G(a.l),b=g(a.h,d,h),j=!0,k="hsl"),a.hasOwnProperty("a")&&(c=a.a)),c=z(c),{ok:j,format:a.format||k,r:Q(255,R(b.r,0)),g:Q(255,R(b.g,0)),b:Q(255,R(b.b,0)),a:c}}function e(a,b,c){return{r:255*A(a,255),g:255*A(b,255),b:255*A(c,255)}}function f(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(b1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(a=A(a,360),b=A(b,100),c=A(c,100),0===b)e=f=g=c;else{var h=c<.5?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return{r:255*e,g:255*f,b:255*g}}function h(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=f,i=f-g;if(e=0===f?0:i/f,f==g)d=0;else{switch(f){case a:d=(b-c)/i+(b>1)+720)%360;--b;)e.h=(e.h+f)%360,g.push(c(e));return g}function y(a,b){b=b||6;for(var d=c(a).toHsv(),e=d.h,f=d.s,g=d.v,h=[],i=1/b;b--;)h.push(c({h:e,s:f,v:g})),g=(g+i)%1;return h}function z(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function A(b,c){D(b)&&(b="100%");var d=E(b);return b=Q(c,R(0,parseFloat(b))),d&&(b=parseInt(b*c,10)/100),a.abs(b-c)<1e-6?1:b%c/parseFloat(c)}function B(a){return Q(1,R(0,a))}function C(a){return parseInt(a,16)}function D(a){return"string"==typeof a&&-1!=a.indexOf(".")&&1===parseFloat(a)}function E(a){return"string"==typeof a&&-1!=a.indexOf("%")}function F(a){return 1==a.length?"0"+a:""+a}function G(a){return a<=1&&(a=100*a+"%"),a}function H(b){return a.round(255*parseFloat(b)).toString(16)}function I(a){return C(a)/255}function J(a){return!!V.CSS_UNIT.exec(a)}function K(a){a=a.replace(M,"").replace(N,"").toLowerCase();var b=!1;if(T[a])a=T[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=V.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=V.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=V.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=V.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=V.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=V.hsva.exec(a))?{h:c[1],s:c[2],v:c[3],a:c[4]}:(c=V.hex8.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),a:I(c[4]),format:b?"name":"hex8"}:(c=V.hex6.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),format:b?"name":"hex"}:(c=V.hex4.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),a:I(c[4]+""+c[4]),format:b?"name":"hex8"}:!!(c=V.hex3.exec(a))&&{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),format:b?"name":"hex"}}function L(a){var b,c;return a=a||{level:"AA",size:"small"},b=(a.level||"AA").toUpperCase(),c=(a.size||"small").toLowerCase(),"AA"!==b&&"AAA"!==b&&(b="AA"),"small"!==c&&"large"!==c&&(c="small"),{level:b,size:c}}var M=/^\s+/,N=/\s+$/,O=0,P=a.round,Q=a.min,R=a.max,S=a.random;c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var a=this.toRgb();return(299*a.r+587*a.g+114*a.b)/1e3},getLuminance:function(){var b,c,d,e,f,g,h=this.toRgb();return b=h.r/255,c=h.g/255,d=h.b/255,e=b<=.03928?b/12.92:a.pow((b+.055)/1.055,2.4),f=c<=.03928?c/12.92:a.pow((c+.055)/1.055,2.4),g=d<=.03928?d/12.92:a.pow((d+.055)/1.055,2.4),.2126*e+.7152*f+.0722*g},setAlpha:function(a){return this._a=z(a),this._roundA=P(100*this._a)/100,this},toHsv:function(){var a=h(this._r,this._g,this._b);return{h:360*a.h,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=h(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.v);return 1==this._a?"hsv("+b+", "+c+"%, "+d+"%)":"hsva("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHsl:function(){var a=f(this._r,this._g,this._b);return{h:360*a.h,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=f(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.l);return 1==this._a?"hsl("+b+", "+c+"%, "+d+"%)":"hsla("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHex:function(a){return j(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(a){return k(this._r,this._g,this._b,this._a,a)},toHex8String:function(a){return"#"+this.toHex8(a)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(100*A(this._r,255))+"%",g:P(100*A(this._g,255))+"%",b:P(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%)":"rgba("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(U[j(this._r,this._g,this._b,!0)]||!1)},toFilter:function(a){var b="#"+l(this._r,this._g,this._b,this._a),d=b,e=this._gradientType?"GradientType = 1, ":"";if(a){var f=c(a);d="#"+l(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+e+"startColorstr="+b+",endColorstr="+d+")"},toString:function(a){var b=!!a;a=a||this._format;var c=!1,d=this._a<1&&this._a>=0;return b||!d||"hex"!==a&&"hex6"!==a&&"hex3"!==a&&"hex4"!==a&&"hex8"!==a&&"name"!==a?("rgb"===a&&(c=this.toRgbString()),"prgb"===a&&(c=this.toPercentageRgbString()),"hex"!==a&&"hex6"!==a||(c=this.toHexString()),"hex3"===a&&(c=this.toHexString(!0)),"hex4"===a&&(c=this.toHex8String(!0)),"hex8"===a&&(c=this.toHex8String()),"name"===a&&(c=this.toName()),"hsl"===a&&(c=this.toHslString()),"hsv"===a&&(c=this.toHsvString()),c||this.toHexString()):"name"===a&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(a,b){var c=a.apply(null,[this].concat([].slice.call(b)));return this._r=c._r,this._g=c._g,this._b=c._b,this.setAlpha(c._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(q,arguments)},darken:function(){return this._applyModification(r,arguments)},desaturate:function(){return this._applyModification(m,arguments)},saturate:function(){return this._applyModification(n,arguments)},greyscale:function(){return this._applyModification(o,arguments)},spin:function(){return this._applyModification(s,arguments)},_applyCombination:function(a,b){return a.apply(null,[this].concat([].slice.call(b)))},analogous:function(){return this._applyCombination(x,arguments)},complement:function(){return this._applyCombination(t,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(w,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(v,arguments)}},c.fromRatio=function(a,b){if("object"==typeof a){var d={};for(var e in a)a.hasOwnProperty(e)&&(d[e]="a"===e?a[e]:G(a[e]));a=d}return c(a,b)},c.equals=function(a,b){return!(!a||!b)&&c(a).toRgbString()==c(b).toRgbString()},c.random=function(){return c.fromRatio({r:S(),g:S(),b:S()})},c.mix=function(a,b,d){d=0===d?0:d||50;var e=c(a).toRgb(),f=c(b).toRgb(),g=d/100;return c({r:(f.r-e.r)*g+e.r,g:(f.g-e.g)*g+e.g,b:(f.b-e.b)*g+e.b,a:(f.a-e.a)*g+e.a})},c.readability=function(b,d){var e=c(b),f=c(d);return(a.max(e.getLuminance(),f.getLuminance())+.05)/(a.min(e.getLuminance(),f.getLuminance())+.05)},c.isReadable=function(a,b,d){var e,f,g=c.readability(a,b);switch(f=!1,e=L(d),e.level+e.size){case"AAsmall":case"AAAlarge":f=g>=4.5;break;case"AAlarge":f=g>=3;break;case"AAAsmall":f=g>=7}return f},c.mostReadable=function(a,b,d){var e,f,g,h,i=null,j=0;d=d||{},f=d.includeFallbackColors,g=d.level,h=d.size;for(var k=0;kj&&(j=e,i=c(b[k]));return c.isReadable(a,i,{level:g,size:h})||!f?i:(d.includeFallbackColors=!1,c.mostReadable(a,["#fff","#000"],d))};var T=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=c.hexNames=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}(T),V=function(){var a="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",b="[\\s|\\(]+("+a+")[,|\\s]+("+a+")[,|\\s]+("+a+")\\s*\\)?",c="[\\s|\\(]+("+a+")[,|\\s]+("+a+")[,|\\s]+("+a+")[,|\\s]+("+a+")\\s*\\)?";return{CSS_UNIT:new RegExp(a),rgb:new RegExp("rgb"+b),rgba:new RegExp("rgba"+c),hsl:new RegExp("hsl"+b),hsla:new RegExp("hsla"+c),hsv:new RegExp("hsv"+b),hsva:new RegExp("hsva"+c),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==b&&b.exports?b.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):window.tinycolor=c}(Math)},{}],80:[function(a,b,c){var d=a("buffer").Buffer;b.exports=function(a){if(a instanceof Uint8Array){if(0===a.byteOffset&&a.byteLength===a.buffer.byteLength)return a.buffer;if("function"==typeof a.buffer.slice)return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}if(d.isBuffer(a)){for(var b=new Uint8Array(a.length),c=a.length,e=0;e",'"',"`"," ","\r","\n","\t"],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=/^[+a-z0-9A-Z_-]{0,63}$/,t=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,u={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a.indexOf("?"),e=-1!==d&&d127?I+="x":I+=H[J];if(!I.match(s)){var L=F.slice(0,A),M=F.slice(A+1),N=H.match(t);N&&(L.push(N[1]),M.unshift(N[2])),M.length&&(h="/"+M.join(".")+h),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=i.toASCII(this.hostname));var O=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+O,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!u[o])for(var A=0,G=p.length;A0)&&c.host.split("@");z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!x.length)return c.pathname=null,c.search?c.path="/"+c.search:c.path=null,c.href=c.format(),c;for(var A=x.slice(-1)[0],B=(c.host||a.host||x.length>1)&&("."===A||".."===A)||""===A,C=0,D=x.length;D>=0;D--)A=x[D],"."===A?x.splice(D,1):".."===A?(x.splice(D,1),C++):C&&(x.splice(D,1),C--);if(!t&&!u)for(;C--;C)x.unshift("..");!t||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),B&&"/"!==x.join("/").substr(-1)&&x.push("");var E=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(y){c.hostname=c.host=E?"":x.length?x.shift():"";var z=!!(c.host&&c.host.indexOf("@")>0)&&c.host.split("@");z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return t=t||c.host&&x.length,t&&!E&&x.unshift(""),x.length?c.pathname=x.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=l.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{"./util":82,punycode:60,querystring:63}],82:[function(a,b,c){"use strict";b.exports={isString:function(a){return"string"==typeof a},isObject:function(a){return"object"==typeof a&&null!==a},isNull:function(a){return null===a},isNullOrUndefined:function(a){return null==a}}},{}],83:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){try{if(!a.localStorage)return!1}catch(a){return!1}var c=a.localStorage[b];return null!=c&&"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],84:[function(a,b,c){(function(b,d){var e=a("url"),f=a("child_process").spawn,g=a("fs");c.XMLHttpRequest=function(){"use strict";var c,h,i=this,j=a("http"),k=a("https"),l={},m=!1,n={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},o={},p={},q=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],r=["TRACE","TRACK","CONNECT"],s=!1,t=!1,u={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null,this.withCredentials=!1;var v=function(a){return m||a&&-1===q.indexOf(a.toLowerCase())},w=function(a){return a&&-1===r.indexOf(a)};this.open=function(a,b,c,d,e){if(this.abort(),t=!1,!w(a))throw new Error("SecurityError: Request method not allowed");l={method:a,url:b.toString(),async:"boolean"!=typeof c||c,user:d||null,password:e||null},x(this.OPENED)},this.setDisableHeaderCheck=function(a){m=a},this.setRequestHeader=function(a,b){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!v(a))return void console.warn('Refused to set unsafe header "'+a+'"');if(s)throw new Error("INVALID_STATE_ERR: send flag is true");a=p[a.toLowerCase()]||a,p[a.toLowerCase()]=a,o[a]=o[a]?o[a]+", "+b:b},this.getResponseHeader=function(a){return"string"==typeof a&&this.readyState>this.OPENED&&h&&h.headers&&h.headers[a.toLowerCase()]&&!t?h.headers[a.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState1)for(var e=0;e"+a.layerId+"":"",d="",a.opts[b].data){var f,g;if(a.popupArgs.showValues?(f=a.opts[b].data,g=a.popupArgs.labels.concat(a.popupArgs.supLabels)):(f=[],g=a.popupArgs.supLabels),a.opts[b].popupData&&(f=f.concat(a.opts[b].popupData)),0==g.length)d=f.join(", ");else{for(var h=[],i=0;i"+g[i]+"",k+=""+f[i]+"",k=""+k+"",h.push(k)}d=h.join(""),d=""+d+"
    "}}return e='",!1===a.isPopupOpen()?a.bindPopup(e,a.popupOptions):a.setPopupContent(e),e}}function j(a){return!isNaN(parseFloat(a))&&isFinite(a)}var k=a("d3");b.exports.initTimeSlider=c,b.exports.processOptions=d,b.exports.addSetTimeIdMethod=g,b.exports.addRemoveMethods=h,b.exports.getInitOptions=f,b.exports.setPopup=i}()},{d3:40}]},{},[2]); \ No newline at end of file diff --git a/docs/reference/libs/minichart-0.2.2/minicharts.css b/docs/reference/libs/minichart-0.2.2/minicharts.css new file mode 100644 index 00000000..8344c7e5 --- /dev/null +++ b/docs/reference/libs/minichart-0.2.2/minicharts.css @@ -0,0 +1,152 @@ +/* popups */ + +.popup > h2 { + color: #555; + font-size: 16px; + margin: 5px 0 0 0; +} + +.popup table { + border: none 1px; + border-collapse: collapse; +} + +.popup table td { + border: none; + padding: 2px 5px; + border: solid 1px #DDDDDD; + border-left-style: none; + border-right-style: none; +} + +.popup .key { + font-weight:bold; + color: #1f77b4; + text-align: right; + padding-right: 5px; +} + +.popup .key::after { + content:" :"; +} + +.popup .value { + text-align: right; +} + +.popup hr { + margin: 3px 0 6px 0; +} + +/* time slider */ + +.leaflet-control-slider { + font-size: 16px; + height:16px; + line-height:16px; + position:relative; + width: 120px; +} + +p.time-slider-label { + margin: 0; + font-size: 16px; + text-align: center; + color: #333; +} + +input[type=range].time-slider { + -webkit-appearance: none; + width: 100px; + height:16px; + margin: 0; + padding: 0; + margin-right: 5px; + vertical-align: middle; + position:absolute; +} + +input[type=range].time-slider:focus { + outline: none; +} + +input[type=range].time-slider::-ms-track { + width: 100%; + cursor: pointer; + background: transparent; + border-color: transparent; + color: transparent; + margin:5px 0; +} + +/* Special styling for WebKit/Blink */ +input[type=range].time-slider::-webkit-slider-thumb { + -webkit-appearance: none; + border: 1px solid #777; + height: 16px; + width: 16px; + border-radius: 8px; + background: #ffffff; + cursor: pointer; + margin-top: -6px; + box-sizing: border-box; +} + +input[type=range].time-slider::-moz-range-thumb { + border: 1px solid #777; + height: 14px; + width: 14px; + border-radius: 7px; + background: #ffffff; + cursor: pointer; +} + +input[type=range].time-slider::-ms-thumb { + border: 1px solid #777777; + height: 14px; + width: 14px; + border-radius: 7px; + background: #ffffff; + cursor: pointer; +} + +input[type=range].time-slider::-webkit-slider-runnable-track { + width: 100%; + height: 6px; + cursor: pointer; + background: #ddd; + border-radius: 3px; + border: 1px solid #bbb; + box-sizing: border-box; + margin: 5px 0; +} + +input[type=range].time-slider:focus::-webkit-slider-runnable-track { +} + +input[type=range].time-slider::-moz-range-track { + width: 100%; + height: 6px; + cursor: pointer; + background: #ddd; + border-radius: 3px; + border: 1px solid #bbb; + box-sizing: border-box; +} + +input[type=range].time-slider::-ms-track { + width: 100%; + height: 6px; + cursor: pointer; + background: #ddd; + border-radius: 3px; + border: 1px solid #bbb; + box-sizing: border-box; +} + +.playpause { + cursor: pointer; + color: #999; + position: absolute; + right: 0; +} diff --git a/docs/reference/libs/proj4-2.6.2/proj4.min.js b/docs/reference/libs/proj4-2.6.2/proj4.min.js new file mode 100644 index 00000000..99865a52 --- /dev/null +++ b/docs/reference/libs/proj4-2.6.2/proj4.min.js @@ -0,0 +1 @@ +!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):t.proj4=s()}(this,function(){"use strict";function k(t,s){if(t[s])return t[s];for(var i,a=Object.keys(t),h=s.toLowerCase().replace(H,""),e=-1;++eMath.PI&&(r-=2*Math.PI),h=Math.sin(o),n=Math.cos(o),e=h*h,{x:((a=i/Math.sqrt(1-s*e))+l)*n*Math.cos(r),y:(a+l)*n*Math.sin(r),z:(a*(1-s)+l)*h}}function c(t,s,i,a){var h,e,n,r,o,l,M,c,u,f,m,p,d,y=t.x,_=t.y,x=t.z?t.z:0,g=Math.sqrt(y*y+_*_),b=Math.sqrt(y*y+_*_+x*x);if(g/i<1e-12){if(p=0,b/i<1e-12)return d=-a,{x:t.x,y:t.y,z:t.z}}else p=Math.atan2(_,y);for(h=x/b,l=(e=g/b)*(1-s)*(n=1/Math.sqrt(1-s*(2-s)*e*e)),M=h*n,m=0;m++,r=s*(o=i/Math.sqrt(1-s*M*M))/(o+(d=g*l+x*M-o*(1-s*M*M))),f=(u=h*(n=1/Math.sqrt(1-r*(2-r)*e*e)))*l-(c=e*(1-r)*n)*M,l=c,M=u,1e-24=this.text.length)return;t=this.text[this.place++]}switch(this.state){case K:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},e.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if($.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},e.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=K)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=K,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},e.prototype.number=function(t){if(!tt.test(t)){if($.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},e.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},e.prototype.keyword=function(t){if(Y.test(t))this.word+=t;else{if("["===t){var s=[];return s.push(this.word),this.level++,null===this.root?this.root=s:this.currentObject.push(s),this.stack.push(this.currentObject),this.currentObject=s,void(this.state=K)}if(!$.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},e.prototype.neutral=function(t){if(Z.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(tt.test(t))return this.word=t,void(this.state=3);if(!$.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},e.prototype.output=function(){for(;this.placeD?Math.tan(i):0,c=Math.pow(M,2),u=Math.pow(c,2),f=1-this.es*Math.pow(h,2);n/=Math.sqrt(f);var m=Gt(i,h,e,this.en),p=this.a*(this.k0*n*(1+r/6*(1-c+o+r/20*(5-18*c+u+14*o-58*c*o+r/42*(61+179*u-u*c-479*c)))))+this.x0,d=this.a*(this.k0*(m-this.ml0+h*a*n/2*(1+r/12*(5-c+9*o+4*l+r/30*(61+u-58*c+270*o-330*c*o+r/56*(1385+543*u-u*c-3111*c))))))+this.y0}else{var y=e*Math.sin(a);if(Math.abs(Math.abs(y)-1)D?Math.tan(s):0,e=this.ep2*Math.pow(a,2),n=Math.pow(e,2),r=Math.pow(h,2),o=Math.pow(r,2),l=1-this.es*Math.pow(i,2),M=_*Math.sqrt(l)/this.k0,u=s-(l*=h)*(c=Math.pow(M,2))/(1-this.es)*.5*(1-c/12*(5+3*r-9*e*r+e-4*n-c/30*(61+90*r-252*e*r+45*o+46*e-c/56*(1385+3633*r+4095*o+1574*o*r)))),nt(this.long0+M*(1-c/6*(1+2*r+e-c/20*(5+28*r+24*o+8*e*r+6*e-c/42*(61+662*r+1320*o+720*o*r))))/a)):(u=z*et(x),0)):(p=.5*((m=Math.exp(_/this.k0))-1/m),d=this.lat0+x/this.k0,y=Math.cos(d),l=Math.sqrt((1-Math.pow(y,2))/(1+Math.pow(p,2))),u=Math.asin(l),x<0&&(u=-u),0==p&&0===y?0:nt(Math.atan2(p,y)+this.long0)),t.x=f,t.y=u,t},names:["Transverse_Mercator","Transverse Mercator","tmerc"]},is={init:function(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),s=t/(2-t),i=s;this.cgb[0]=s*(2+s*(-2/3+s*(s*(116/45+s*(26/45+-2854/675*s))-2))),this.cbg[0]=s*(s*(2/3+s*(4/3+s*(-82/45+s*(32/45+4642/4725*s))))-2),i*=s,this.cgb[1]=i*(7/3+s*(s*(-227/45+s*(2704/315+2323/945*s))-1.6)),this.cbg[1]=i*(5/3+s*(-16/15+s*(-13/9+s*(904/315+-1522/945*s)))),i*=s,this.cgb[2]=i*(56/15+s*(-136/35+s*(-1262/105+73814/2835*s))),this.cbg[2]=i*(-26/15+s*(34/21+s*(1.6+-12686/2835*s))),i*=s,this.cgb[3]=i*(4279/630+s*(-332/35+-399572/14175*s)),this.cbg[3]=i*(1237/630+s*(-24832/14175*s-2.4)),i*=s,this.cgb[4]=i*(4174/315+-144838/6237*s),this.cbg[4]=i*(-734/315+109598/31185*s),i*=s,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(s,2),this.Qn=this.k0/(1+s)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=s*(s*(2/3+s*(-37/96+s*(1/360+s*(81/512+-96199/604800*s))))-.5),this.gtu[0]=s*(.5+s*(-2/3+s*(5/16+s*(41/180+s*(-127/288+7891/37800*s))))),this.utg[1]=i*(-1/48+s*(-1/15+s*(437/1440+s*(-46/105+1118711/3870720*s)))),this.gtu[1]=i*(13/48+s*(s*(557/1440+s*(281/630+-1983433/1935360*s))-.6)),i*=s,this.utg[2]=i*(-17/480+s*(37/840+s*(209/4480+-5569/90720*s))),this.gtu[2]=i*(61/240+s*(-103/140+s*(15061/26880+167603/181440*s))),i*=s,this.utg[3]=i*(-4397/161280+s*(11/504+830251/7257600*s)),this.gtu[3]=i*(49561/161280+s*(-179/168+6601661/7257600*s)),i*=s,this.utg[4]=i*(-4583/161280+108847/3991680*s),this.gtu[4]=i*(34729/80640+-3418889/1995840*s),i*=s,this.utg[5]=-.03233083094085698*i,this.gtu[5]=.6650675310896665*i;var a=Tt(this.cbg,this.lat0);this.Zb=-this.Qn*(a+function(t,s){for(var i,a=2*Math.cos(s),h=t.length-1,e=t[h],n=0;0<=--h;)i=a*e-n+t[h],n=e,e=i;return Math.sin(s)*i}(this.gtu,2*a))},forward:function(t){var s=nt(t.x-this.long0),i=t.y,i=Tt(this.cbg,i),a=Math.sin(i),h=Math.cos(i),e=Math.sin(s),n=Math.cos(s);i=Math.atan2(a,n*h),s=Math.atan2(e*h,Rt(a,h*n)),s=Lt(Math.tan(s));var r,o,l=Dt(this.gtu,2*i,2*s);return i+=l[0],s+=l[1],o=Math.abs(s)<=2.623395162778?(r=this.a*(this.Qn*s)+this.x0,this.a*(this.Qn*i+this.Zb)+this.y0):r=1/0,t.x=r,t.y=o,t},inverse:function(t){var s,i,a,h,e,n,r,o=(t.x-this.x0)*(1/this.a),l=(t.y-this.y0)*(1/this.a);return l=(l-this.Zb)/this.Qn,o/=this.Qn,r=Math.abs(o)<=2.623395162778?(l+=(s=Dt(this.utg,2*l,2*o))[0],o+=s[1],o=Math.atan(zt(o)),i=Math.sin(l),a=Math.cos(l),h=Math.sin(o),e=Math.cos(o),l=Math.atan2(i*e,Rt(h,e*a)),o=Math.atan2(h,e*a),n=nt(o+this.long0),Tt(this.cgb,l)):n=1/0,t.x=n,t.y=r,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"]},as={init:function(){var t=function(t,s){if(void 0===t){if((t=Math.floor(30*(nt(s)+Math.PI)/Math.PI)+1)<0)return 0;if(60D?this.ns=Math.log(a/r)/Math.log(h/o):this.ns=s,isNaN(this.ns)&&(this.ns=s),this.f0=a/(this.ns*Math.pow(h,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic"))},forward:function(t){var s=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=D&&(i=et(i)*(z-2*D));var a,h,e=Math.abs(Math.abs(i)-z);if(DD?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var s=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var a=Vt(this.e3,this.sin_phi,this.cos_phi),h=this.a*Math.sqrt(this.c-this.ns0*a)/this.ns0,e=this.ns0*nt(s-this.long0),n=h*Math.sin(e)+this.x0,r=this.rh-h*Math.cos(e)+this.y0;return t.x=n,t.y=r,t},inverse:function(t){var s,i,a,h,e,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,a=0<=this.ns0?(s=Math.sqrt(t.x*t.x+t.y*t.y),1):(s=-Math.sqrt(t.x*t.x+t.y*t.y),-1),(h=0)!==s&&(h=Math.atan2(a*t.x,a*t.y)),a=s*this.ns0/this.a,n=this.sphere?Math.asin((this.c-a*a)/(2*this.ns0)):(i=(this.c-a*a)/this.ns0,this.phi1z(this.e3,i)),e=nt(h/this.ns0+this.long0),t.x=e,t.y=n,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,s){var i,a,h,e,n=Zt(.5*s);if(tMath.PI&&(a=Math.PI),i=(2*s+Math.sin(2*s))/Math.PI,12*z*this.a)return;return i=s/this.a,a=Math.sin(i),h=Math.cos(i),e=this.long0,Math.abs(s)<=D?n=this.lat0:(n=Zt(h*this.sin_p12+t.y*a*this.cos_p12/s),r=Math.abs(this.lat0)-z,e=nt(Math.abs(r)<=D?0<=this.lat0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*a,s*this.cos_p12*h-t.y*this.sin_p12*a))),t.x=e,t.y=n,t}return o=Ft(this.es),l=Qt(this.es),M=Wt(this.es),c=Xt(this.es),Math.abs(this.sin_p12-1)<=D?(u=this.a*Ut(o,l,M,c,z),s=Math.sqrt(t.x*t.x+t.y*t.y),n=Kt((u-s)/this.a,o,l,M,c),e=nt(this.long0+Math.atan2(t.x,-1*t.y))):Math.abs(this.sin_p12+1)<=D?(u=this.a*Ut(o,l,M,c,z),s=Math.sqrt(t.x*t.x+t.y*t.y),n=Kt((s-u)/this.a,o,l,M,c),e=nt(this.long0+Math.atan2(t.x,t.y))):(s=Math.sqrt(t.x*t.x+t.y*t.y),p=Math.atan2(t.x,t.y),f=Ht(this.a,this.e,this.sin_p12),d=Math.cos(p),_=-(y=this.e*this.cos_p12*d)*y/(1-this.es),x=3*this.es*(1-_)*this.sin_p12*this.cos_p12*d/(1-this.es),v=1-_*(b=(g=s/f)-_*(1+_)*Math.pow(g,3)/6-x*(1+3*_)*Math.pow(g,4)/24)*b/2-g*b*b*b/6,m=Math.asin(this.sin_p12*Math.cos(b)+this.cos_p12*Math.sin(b)*d),e=nt(this.long0+Math.asin(Math.sin(p)*Math.sin(b)/Math.cos(m))),w=Math.sin(m),n=Math.atan2((w-this.es*v*this.sin_p12)*Math.tan(m),w*(1-this.es))),t.x=e,t.y=n,t},names:["Azimuthal_Equidistant","aeqd"]},Ps={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var s,i,a,h=t.x,e=t.y,n=nt(h-this.long0),r=Math.sin(e),o=Math.cos(e),l=Math.cos(n);return(0<(s=this.sin_p14*r+this.cos_p14*o*l)||Math.abs(s)<=D)&&(i=this.a*o*Math.sin(n),a=this.y0+this.a*(this.cos_p14*r-this.sin_p14*o*l)),t.x=i,t.y=a,t},inverse:function(t){var s,i,a,h,e,n,r;return t.x-=this.x0,t.y-=this.y0,s=Math.sqrt(t.x*t.x+t.y*t.y),i=Zt(s/this.a),a=Math.sin(i),h=Math.cos(i),n=this.long0,Math.abs(s)<=D?r=this.lat0:(r=Zt(h*this.sin_p14+t.y*a*this.cos_p14/s),e=Math.abs(this.lat0)-z,n=Math.abs(e)<=D?nt(0<=this.lat0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y)):nt(this.long0+Math.atan2(t.x*a,s*this.cos_p14*h-t.y*this.sin_p14*a))),t.x=n,t.y=r,t},names:["ortho"]},Ss=1,Ns=2,ks=3,Es=4,qs=5,Is=6,Os=1,As=2,Gs=3,js=4,zs={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=z-U/2?this.face=qs:this.lat0<=-(z-U/2)?this.face=Is:Math.abs(this.long0)<=U?this.face=Ss:Math.abs(this.long0)<=z+U?this.face=0=Math.abs(t.y)?y.value=Os:0<=t.y&&t.y>=Math.abs(t.x)?(y.value=As,s-=z):t.x<0&&-t.x>=Math.abs(t.y)?(y.value=Gs,s=s<0?s+Q:s-Q):(y.value=js,s+=z),c=Q/12*Math.tan(s),e=Math.sin(c)/(Math.cos(c)-1/Math.sqrt(2)),n=Math.atan(e),(r=1-(a=Math.cos(s))*a*(h=Math.tan(i))*h*(1-Math.cos(Math.atan(1/Math.cos(n)))))<-1?r=-1:1a.y)--s;else{if(!(Ls[s+1][0]<=a.y))break;++s}var h=Ls[s],i=function(t,s,i,a){for(var h=s;a;--a){var e=t(h);if(h-=e,Math.abs(e) h2 { + color: #555; + margin: 5px 0 0 0; + font-size: 16px; +} + +.legend-section { + padding-left: 14px; + float: left; +} + +.legend-section > h3 { + margin:0; + color: #999; + font-size: 12px; + font-weight: normal; +} + +.legend-colors, .legend-colors-cat, .legend-labels, .legend-symbols { + float:left; +} + +.legend-colors { + margin-top:6px; + border:solid 1px #ccc; +} + +.legend-color { + width:14px; + height:14px; +} + +.legend-color-cat { + width:14px; + height:10px; + margin: 2px 0 4px 0; +} + +.legend-label { + color: #999; + padding-left:5px; + font-size: 9px; + height: 14px; +} + +.legend svg .legend-label { + fill: #999; + font-size: 9px; +} + +.legend svg line { + stroke: #ccc; +} + +.legend-symbols > svg { + display:block; + margin: 2px 0; +} + +.btn-link { + background-image: none; + border: 1px solid transparent; + background-color:transparent; + cursor: pointer; + color: #337ab7; + float:right; +} + +.btn-link:hover { + text-decoration: underline; +} + +button:active { + outline: none; + border: none; +} + +button:focus { + outline: none; +} + +.leaflet-container { + background: #fff; + border: solid 1px #ccc; +} diff --git a/docs/reference/libs/shadows-1.0/antaresLegend.js b/docs/reference/libs/shadows-1.0/antaresLegend.js new file mode 100644 index 00000000..1ca241ab --- /dev/null +++ b/docs/reference/libs/shadows-1.0/antaresLegend.js @@ -0,0 +1,145 @@ +/* Copyright © 2016 RTE Réseau de transport d’électricité */ +L.AntaresLegend = L.Control.extend({ + options: { + position: "topright", + htmlAreaColor: null, + htmlAreaSize: null, + htmlLinkColor: null, + htmlLinkSize: null, + onComplete:null, + display: "choose", + collapsed: true, + areas_name: "Areas", + links_names: "Links", + show_legend: "Show legend", + hide_legend: "Hide legend" + }, + + initialize: function(options) { + var createEl = L.DomUtil.create; + var container = createEl('div'); + container.style.padding = "5px"; + + var areas_name, links_names; + areas_name = options.areas_name; + links_names = options.links_names; + + var btn = createEl("button", "btn btn-link btn-xs pull-left", container); + + var content = createEl("div", "", container); + content.innerHTML = '\ +
    \ +

    ' + areas_name + '

    \ +
    \ +
    \ +
    \ +
    \ + \ + '; + + this._content = content; + this._btn = btn; + this._container = container; + + L.Control.prototype.initialize.call(this, options); + }, + + onAdd: function() { + var self = this; + + this._btn.onclick = function() { + self.options.collapsed = !self.options.collapsed; + self.showHide(); + }; + + this._reset(); + + return this._container; + }, + + onRemove: function() { + this._container.parentNode.removeChild(this._container); + }, + + _reset: function() { + if (this.options.display == "hidden") { + this._container.className = ""; + this._container.style.display = "none"; + this._content.style.display = "none"; + this._btn.style.display = "none"; + } else { + this._container.className = 'leaflet-bar leaflet-control leaflet-control-custom'; + this._container.style.display = "block"; + this._container.style.backgroundColor = 'white'; + this._content.style.display = "block"; + this._btn.style.display = "block"; + } + + if (this.options.display == "visible") { + this.options.collapsed = false; + this._btn.style.display = "none"; + } + + var legAreas = this._content.querySelector("#legend-area"); + var legLinks = this._content.querySelector("#legend-link"); + var o = this.options; + + // If the legend is empty, do not display it + if (o.htmlAreaSize || o.htmlAreaColor || o.htmlLinkSize || o.htmlLinkColor) { + this._container.style.display = "block"; + this.showHide(); + } else { + this._container.style.display = "none"; + return; + } + + // If one section is empty do not show this section + legAreas.style.display = (!o.htmlAreaColor && !o.htmlAreaSize)?"none":"block"; + legLinks.style.display = (!o.htmlLinkColor && !o.htmlLinkSize)?"none":"block"; + + // Update html of each section + this._content.querySelector("#area-size").innerHTML = o.htmlAreaSize; + this._content.querySelector("#area-color").innerHTML = o.htmlAreaColor; + this._content.querySelector("#link-size").innerHTML = o.htmlLinkSize; + this._content.querySelector("#link-color").innerHTML = o.htmlLinkColor; + eval(this.options.onComplete); + }, + + showHide: function() { + var show_legend, hide_legend; + show_legend = this.options.show_legend; + hide_legend = this.options.hide_legend; + + if (this.options.collapsed) { + this._content.style.display = "none"; + this._btn.textContent = show_legend; + } else { + this._content.style.display = "block"; + this._btn.textContent = hide_legend; + } + }, + + setOptions: function(options) { + L.Util.setOptions(this, options); + this._reset(); + } +}); + +L.antaresLegend = function (options) { + return new L.AntaresLegend(options); +}; + +window.LeafletWidget.methods.addAntaresLegend = function(options) { + var l = L.antaresLegend(options); + this.controls.add(l, "antaresLegend"); +}; + +window.LeafletWidget.methods.updateAntaresLegend = function(options) { + var l = this.controls._controlsById.antaresLegend; + l.setOptions(options); +}; \ No newline at end of file diff --git a/docs/reference/libs/shadows-1.0/svgShadows.js b/docs/reference/libs/shadows-1.0/svgShadows.js new file mode 100644 index 00000000..fa7d136f --- /dev/null +++ b/docs/reference/libs/shadows-1.0/svgShadows.js @@ -0,0 +1,28 @@ +// Copyright © 2016 RTE Réseau de transport d’électricité +window.LeafletWidget.methods.addShadows = function() { + var svg = this._panes.overlayPane.children[0]; + var els = svg.childNodes; + + var filter = new DOMParser().parseFromString('\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + ', 'image/svg+xml'); + + svg.appendChild(svg.ownerDocument.importNode(filter.documentElement, true)); + + for (var i = 0; i < els.length - 1; i++) { + var cl = els[i].getAttribute("class"); + if (!cl || cl.indexOf("no-shadow") == -1) { + els[i].setAttribute("filter", "url(#dropShadow)"); + } + } +}; \ No newline at end of file diff --git a/docs/reference/limitSizeGraph.html b/docs/reference/limitSizeGraph.html index 1a7575e5..6879e0a9 100644 --- a/docs/reference/limitSizeGraph.html +++ b/docs/reference/limitSizeGraph.html @@ -1,67 +1,12 @@ - - - - - - - -Use to change limit size of graph (in Mb) — limitSizeGraph • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Use to change limit size of graph (in Mb) — limitSizeGraph • antaresViz - - - - + + -
    -
    - -
    - -
    +
    @@ -135,49 +65,46 @@

    Use to change limit size of graph (in Mb)

    Use to change limit size of graph (in Mb)

    -
    limitSizeGraph(size)
    - -

    Arguments

    - - - - - - -
    size

    numeric widget size autorized in modules (default 200)

    +
    +
    limitSizeGraph(size)
    +
    +
    +

    Arguments

    +
    size
    +

    numeric widget size autorized in modules (default 200)

    -

    Examples

    -
    if (FALSE) { -limitSizeGraph(500) -} +
    -
    +
    +

    Examples

    +
    if (FALSE) {
    +limitSizeGraph(500)
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/mapLayout.html b/docs/reference/mapLayout.html index d6c0a6b8..ca435779 100644 --- a/docs/reference/mapLayout.html +++ b/docs/reference/mapLayout.html @@ -1,70 +1,15 @@ - - - - - - - -Place areas of a study on a map — mapLayout • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Place areas of a study on a map — mapLayout • antaresViz - - - - - - - - - + + - - - - -
    -
    - -
    - -
    +
    @@ -141,97 +71,96 @@

    Place areas of a study on a map

    study. The result should then be saved in an external file and be reused.

    -
    mapLayout(
    -  layout,
    -  what = c("areas", "districts"),
    -  map = getSpMaps(),
    -  map_builder = TRUE
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - -
    layout

    object returned by function readLayout

    what

    Either "areas" or "districts". Indicates what type of object to place -on the map.

    map

    An optional SpatialPolygons or -SpatialPolygonsDataFrame object. See getSpMaps

    map_builder

    logical Add inputs for build custom map ? Defaut to TRUE.

    - -

    Value

    - -

    An object of class mapLayout.

    -

    Details

    +
    +
    mapLayout(
    +  layout,
    +  what = c("areas", "districts"),
    +  map = getSpMaps(),
    +  map_builder = TRUE
    +)
    +
    + +
    +

    Arguments

    +
    layout
    +

    object returned by function [antaresRead::readLayout()]

    -

    With map_builder option, you can build a quiet custom map using spMaps package. -This package help you to build SpatialPolygonsDataFrame on Europe. -Moreover, you can use two options in the module :

    -
      -
    • "Merge countries" : Some countries like UK or Belgium are firstly rendered in multiple and diffrent area. - You can so choose to finally use this countries as one single area on the map

    • -
    • "Merge states" : If you need states details but not having one area per state, the map will be incomplete - for some countries, plotting only states with area. So you can choose to aggregate the states of the countries. - This is done using a nearest states algorithm. The result is available only after layout validation.

    • -
    -

    See also

    +
    what
    +

    Either "areas" or "districts". Indicates what type of object to place +on the map.

    - -

    Examples

    -
    if (FALSE) { -# Read the coordinates of the areas in the Antares interface, then convert it -# in a map layout. -layout <- readLayout() -ml <- mapLayout(layout) +
    map
    +

    An optional [sp::SpatialPolygons()] or +[sp::SpatialPolygonsDataFrame()] object. See [spMaps::getSpMaps()]

    -# visualize mapLayout -plotMapLayout(ml) -# Save the result for future use -save(ml, file = "ml.rda") +
    map_builder
    +

    logical Add inputs for build custom map ? Defaut to TRUE.

    -} +
    +
    +

    Value

    + -
    +

    An object of class mapLayout.

    +
    +
    +

    Details

    +

    With map_builder option, you can build a quiet custom map using spMaps package. +This package help you to build [sp::SpatialPolygons()] on Europe. +Moreover, you can use two options in the module :

    +
    • "Merge countries" : Some countries like UK or Belgium are firstly rendered in multiple and diffrent area. + You can so choose to finally use this countries as one single area on the map

    • +
    • "Merge states" : If you need states details but not having one area per state, the map will be incomplete + for some countries, plotting only states with area. So you can choose to aggregate the states of the countries. + This is done using a nearest states algorithm. The result is available only after layout validation.

    • +
    +
    +

    See also

    +

    [plotMapLayout()]

    +
    + +
    +

    Examples

    +
    if (FALSE) {
    +# Read the coordinates of the areas in the Antares interface, then convert it
    +# in a map layout.
    +layout <- readLayout()
    +ml <- mapLayout(layout)
    +
    +# visualize mapLayout
    +plotMapLayout(ml)
    +
    +# Save the result for future use
    +save(ml, file = "ml.rda")
    +
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/modRpart.html b/docs/reference/modRpart.html index ebd17de5..1dc177b5 100644 --- a/docs/reference/modRpart.html +++ b/docs/reference/modRpart.html @@ -1,67 +1,12 @@ - - - - - - - -Make rpart from antares data — modRpart • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Make rpart from antares data — modRpart • antaresViz - - + + - - -
    -
    - -
    - -
    +
    @@ -135,52 +65,49 @@

    Make rpart from antares data

    Make rpart from antares data

    -
    modRpart(data)
    - -

    Arguments

    - - - - - - -
    data

    an antaresData after use of mergeAllAntaresData

    - - -

    Examples

    -
    if (FALSE) { -setSimulationPath("Mystud", 1) -mydata <- readAntares(areas = "all", select = "OIL") -mydata <- mergeAllAntaresData(mydata) -modRpart(mydata) -} +
    +
    modRpart(data)
    +
    -
    +
    +

    Arguments

    +
    data
    +

    an antaresData after use of [antaresProcessing::mergeAllAntaresData]

    + +
    + +
    +

    Examples

    +
    if (FALSE) {
    +setSimulationPath("Mystud", 1)
    +mydata <- readAntares(areas = "all", select = "OIL")
    +mydata <- mergeAllAntaresData(mydata)
    +modRpart(mydata)
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/modXY.html b/docs/reference/modXY.html index c80812ad..29a26349 100644 --- a/docs/reference/modXY.html +++ b/docs/reference/modXY.html @@ -1,67 +1,12 @@ - - - - - - - -Make X-Y bockey plot, interactive version — modXY • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Make X-Y bockey plot, interactive version — modXY • antaresViz - - + + - - -
    -
    - -
    - -
    +
    @@ -135,58 +65,55 @@

    Make X-Y bockey plot, interactive version

    Make X-Y bockey plot, interactive version

    -
    modXY(x, xyCompare = c("union", "intersect"))
    - -

    Arguments

    - - - - - - - - - - -
    x

    optsH5 or list of optsH5

    xyCompare

    Use when you compare studies, can be "union" or "intersect". If union, all -of mcYears in one of studies will be selectable. If intersect, only mcYears in all -studies will be selectable.

    - +
    +
    modXY(x, xyCompare = c("union", "intersect"))
    +
    -

    Examples

    -
    if (FALSE) { -opts <- setSimulationPath("h5File") -modXY(opts) -modXY(list(opts, opts)) +
    +

    Arguments

    +
    x
    +

    optsH5 or list of optsH5

    -} -
    +
    xyCompare
    +

    Use when you compare studies, can be "union" or "intersect". If union, all +of mcYears in one of studies will be selectable. If intersect, only mcYears in all +studies will be selectable.

    + +
    + +
    +

    Examples

    +
    if (FALSE) {
    +opts <- setSimulationPath("h5File")
    +modXY(opts)
    +modXY(list(opts, opts))
    +
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/placeGeoPoints-shiny.html b/docs/reference/placeGeoPoints-shiny.html index a693eb8b..5b247fce 100644 --- a/docs/reference/placeGeoPoints-shiny.html +++ b/docs/reference/placeGeoPoints-shiny.html @@ -1,68 +1,13 @@ - - - - - - - -Shiny bindings for placeGeoPoints — placeGeoPoints-shiny • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Shiny bindings for placeGeoPoints — placeGeoPoints-shiny • antaresViz - + + - - - -
    -
    - -
    - -
    +
    @@ -137,64 +67,59 @@

    Shiny bindings for placeGeoPoints

    applications and interactive Rmd documents.

    -
    leafletDragPointsOutput(outputId, width = "100%", height = "400px")
    +    
    +
    leafletDragPointsOutput(outputId, width = "100%", height = "400px")
    +
    +renderLeafletDragPoints(expr, env = parent.frame(), quoted = FALSE)
    +
    -renderLeafletDragPoints(expr, env = parent.frame(), quoted = FALSE)
    +
    +

    Arguments

    +
    outputId
    +

    output variable to read from

    -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - -
    outputId

    output variable to read from

    width, height

    Must be a valid CSS unit (like '100%', + +

    width, height
    +

    Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a -string and have 'px' appended.

    expr

    An expression that generates a placeGeoPoints

    env

    The environment in which to evaluate expr.

    quoted

    Is expr a quoted expression (with quote())? This -is useful if you want to save an expression in a variable.

    +string and have 'px' appended.

    + + +
    expr
    +

    An expression that generates a placeGeoPoints

    + + +
    env
    +

    The environment in which to evaluate expr.

    +
    quoted
    +

    Is expr a quoted expression (with quote())? This +is useful if you want to save an expression in a variable.

    + +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/plot.mapLayout.html b/docs/reference/plot.mapLayout.html index f8252dd8..e581290a 100644 --- a/docs/reference/plot.mapLayout.html +++ b/docs/reference/plot.mapLayout.html @@ -1,69 +1,14 @@ - - - - - - - -Plot method for map layout — plot.mapLayout • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot method for map layout — plot.mapLayout • antaresViz - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +

    This method can be used to visualize the network of an antares study. It generates an interactive map with a visual representaiton of a -map layout created with function mapLayout.

    +map layout created with function [mapLayout()].

    -
    # S3 method for mapLayout
    -plot(
    -  x,
    -  colAreas = x$coords$color,
    -  dataAreas = 1,
    -  opacityArea = 1,
    -  areaMaxSize = 30,
    -  areaMaxHeight = 50,
    -  areaChartType = c("auto", "bar", "pie", "polar-area", "polar-radius"),
    -  labelArea = NULL,
    -  labelMinSize = 8,
    -  labelMaxSize = 8,
    -  colLinks = "#CCCCCC",
    -  sizeLinks = 3,
    -  opacityLinks = 1,
    -  dirLinks = 0,
    -  links = TRUE,
    -  areas = TRUE,
    -  tilesURL = defaultTilesURL(),
    -  preprocess = function(map) {     map },
    -  width = NULL,
    -  height = NULL,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    x

    Object created with function mapLayout

    colAreas

    Vector of colors for areas. By default, the colors used in the Antares -software are used.

    dataAreas

    A numeric vector or a numeric matrix that is passed to function +

    +
    # S3 method for mapLayout
    +plot(
    +  x,
    +  colAreas = x$coords$color,
    +  dataAreas = 1,
    +  opacityArea = 1,
    +  areaMaxSize = 30,
    +  areaMaxHeight = 50,
    +  areaChartType = c("auto", "bar", "pie", "polar-area", "polar-radius"),
    +  labelArea = NULL,
    +  labelMinSize = 8,
    +  labelMaxSize = 8,
    +  colLinks = "#CCCCCC",
    +  sizeLinks = 3,
    +  opacityLinks = 1,
    +  dirLinks = 0,
    +  links = TRUE,
    +  areas = TRUE,
    +  tilesURL = defaultTilesURL(),
    +  preprocess = function(map) {
    +     map
    + },
    +  width = NULL,
    +  height = NULL,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    x
    +

    Object created with function [mapLayout()]

    + + +
    colAreas
    +

    Vector of colors for areas. By default, the colors used in the Antares +software are used.

    + + +
    dataAreas
    +

    A numeric vector or a numeric matrix that is passed to function link[addMinicharts]. A single vector will produce circles with different radius. A matrix will produce bar charts or pie charts or -polar charts, depending on the value of areaChartType

    opacityArea

    Opacity of areas. It has to be a numeric vector with values -between 0 and 1.

    areaMaxSize

    Maximal width in pixels of the symbols that represent -areas on the map.

    areaMaxHeight

    Maximal height of bars. Used only if a barchart representation is used.

    areaChartType

    Type of chart to use to represent areas.

    labelArea

    Character vector containing labels to display inside areas.

    labelMinSize

    minimal height of labels.

    labelMaxSize

    maximal height of labels.

    colLinks

    Vector of colors for links.

    sizeLinks

    Line width of the links, in pixels.

    opacityLinks

    Opacity of the links. It has to be a numeric vector with values -between 0 and 1.

    dirLinks

    Single value or vector indicating the direction of the link. Possible values +polar charts, depending on the value of areaChartType

    + + +
    opacityArea
    +

    Opacity of areas. It has to be a numeric vector with values +between 0 and 1.

    + + +
    areaMaxSize
    +

    Maximal width in pixels of the symbols that represent +areas on the map.

    + + +
    areaMaxHeight
    +

    Maximal height of bars. Used only if a barchart representation is used.

    + + +
    areaChartType
    +

    Type of chart to use to represent areas.

    + + +
    labelArea
    +

    Character vector containing labels to display inside areas.

    + + +
    labelMinSize
    +

    minimal height of labels.

    + + +
    labelMaxSize
    +

    maximal height of labels.

    + + +
    colLinks
    +

    Vector of colors for links.

    + + +
    sizeLinks
    +

    Line width of the links, in pixels.

    + + +
    opacityLinks
    +

    Opacity of the links. It has to be a numeric vector with values +between 0 and 1.

    + + +
    dirLinks
    +

    Single value or vector indicating the direction of the link. Possible values are 0, -1 and 1. If it equals 0, then links are repsented by a simple line. If it is equal to 1 or -1 it is represented by a line with an arrow pointing -respectively the destination and the origin of the link.

    links

    Should links be drawn on the map ?

    areas

    Should areas be drawn on the map ?

    tilesURL

    URL template used to get map tiles. The followign site +respectively the destination and the origin of the link.

    + + +
    links
    +

    Should links be drawn on the map ?

    + + +
    areas
    +

    Should areas be drawn on the map ?

    + + +
    tilesURL
    +

    URL template used to get map tiles. The followign site provides some URLs; -https://leaflet-extras.github.io/leaflet-providers/preview/

    preprocess

    A function that takes as argument a map and that returns a +https://leaflet-extras.github.io/leaflet-providers/preview/

    + + +
    preprocess
    +

    A function that takes as argument a map and that returns a modified version of this map. This parameter can be used to add extra -information on a map.

    width

    Width of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    height

    Height of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    ...

    Currently unused.

    - -

    Value

    - -

    The function generates an htmlwidget of class leaflet. It can - be stored in a variable and modified with package - leaflet

    +information on a map.

    -

    Examples

    -
    if (FALSE) { -# Read the coordinates of the areas in the Antares interface, then convert it -# in a map layout. -layout <- readLayout() -ml <- mapLayout(layout) -# Save the result for future use -save(ml, file = "ml.rda") +
    width
    +

    Width of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    -# Plot the network on an interactive map -plot(ml) -# change style -plot(ml, colAreas = gray(0.5), colLinks = "orange") +
    height
    +

    Height of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    -# Use polar area charts to represent multiple values for each area. -nareas <- nrow(ml$coords) -fakeData <- matrix(runif(nareas * 3), ncol = 3) -plot(ml, sizeAreas = fakeData) -# Store the result in a variable to change it with functions from leaflet -# package -library(leaflet) +
    ...
    +

    Currently unused.

    -center <- c(mean(ml$coords$x), mean(ml$coords$y)) +
    +
    +

    Value

    + -p <- plot(ml) -p %>% - addCircleMarker(center[1], center[2], color = "red", - popup = "I'm the center !") -} +

    The function generates an htmlwidget of class leaflet. It can + be stored in a variable and modified with package + [leaflet::leaflet()]

    +
    -
    +
    +

    Examples

    +
    if (FALSE) {
    +# Read the coordinates of the areas in the Antares interface, then convert it
    +# in a map layout.
    +layout <- readLayout()
    +ml <- mapLayout(layout)
    +
    +# Save the result for future use
    +save(ml, file = "ml.rda")
    +
    +# Plot the network on an interactive map
    +plot(ml)
    +
    +# change style
    +plot(ml, colAreas = gray(0.5), colLinks = "orange")
    +
    +# Use polar area charts to represent multiple values for each area.
    +nareas <- nrow(ml$coords)
    +fakeData <- matrix(runif(nareas * 3), ncol = 3)
    +plot(ml, sizeAreas = fakeData)
    +
    +# Store the result in a variable to change it with functions from leaflet 
    +# package
    +library(leaflet)
    +
    +center <- c(mean(ml$coords$x), mean(ml$coords$y))
    +
    +p <- plot(ml)
    +p %>% 
    +  addCircleMarker(center[1], center[2], color = "red", 
    +                  popup = "I'm the center !")
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/plotMap.html b/docs/reference/plotMap.html index 033b3858..cbbd8f61 100644 --- a/docs/reference/plotMap.html +++ b/docs/reference/plotMap.html @@ -1,69 +1,14 @@ - - - - - - - -Display results of a simulation on a map — plotMap • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Display results of a simulation on a map — plotMap • antaresViz - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    @@ -139,346 +69,344 @@

    Display results of a simulation on a map

    gadget that let the user which variables to represent.

    -
    plotMap(
    -  x,
    -  refStudy = NULL,
    -  mapLayout,
    -  colAreaVar = "none",
    -  sizeAreaVars = c(),
    -  areaChartType = c("bar", "pie", "polar-area", "polar-radius"),
    -  uniqueScale = FALSE,
    -  showLabels = FALSE,
    -  popupAreaVars = c(),
    -  labelAreaVar = "none",
    -  colLinkVar = "none",
    -  sizeLinkVar = "none",
    -  popupLinkVars = c(),
    -  closePopupOnClick = TRUE,
    -  type = c("detail", "avg"),
    -  timeId = NULL,
    -  mcYear = "average",
    -  main = "",
    -  typeSizeAreaVars = FALSE,
    -  aliasSizeAreaVars = c(),
    -  compare = NULL,
    -  compareOpts = list(),
    -  interactive = getInteractivity(),
    -  options = plotMapOptions(),
    -  width = NULL,
    -  height = NULL,
    -  dateRange = NULL,
    -  xyCompare = c("union", "intersect"),
    -  h5requestFiltering = list(),
    -  timeSteph5 = "hourly",
    -  mcYearh5 = NULL,
    -  tablesh5 = c("areas", "links"),
    -  sizeMiniPlot = FALSE,
    -  language = "en",
    -  hidden = NULL,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    x

    Object of class antaresDataList created with -readAntares and containing areas and links data. +

    +
    plotMap(
    +  x,
    +  refStudy = NULL,
    +  mapLayout,
    +  colAreaVar = "none",
    +  sizeAreaVars = c(),
    +  areaChartType = c("bar", "pie", "polar-area", "polar-radius"),
    +  uniqueScale = FALSE,
    +  showLabels = FALSE,
    +  popupAreaVars = c(),
    +  labelAreaVar = "none",
    +  colLinkVar = "none",
    +  sizeLinkVar = "none",
    +  popupLinkVars = c(),
    +  closePopupOnClick = TRUE,
    +  type = c("detail", "avg"),
    +  timeId = NULL,
    +  mcYear = "average",
    +  main = "",
    +  typeSizeAreaVars = FALSE,
    +  aliasSizeAreaVars = c(),
    +  compare = NULL,
    +  compareOpts = list(),
    +  interactive = getInteractivity(),
    +  options = plotMapOptions(),
    +  width = NULL,
    +  height = NULL,
    +  dateRange = NULL,
    +  xyCompare = c("union", "intersect"),
    +  h5requestFiltering = deprecated(),
    +  timeSteph5 = deprecated(),
    +  mcYearh5 = deprecated(),
    +  tablesh5 = deprecated(),
    +  sizeMiniPlot = FALSE,
    +  language = "en",
    +  hidden = NULL,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    x
    +

    Object of class antaresDataList created with +[antaresRead::readAntares()] and containing areas and links data. It can be a list of antaresData objects. - In this case, one chart is created for each object.

    refStudy

    An object of class antaresData created with function -readAntares containing data for areas and or -districts. Can also contains an opts who refer to a h5 file.

    mapLayout

    Object created with function mapLayout

    colAreaVar

    Name of a variable present in x$areas. The values of this variable + In this case, one chart is created for each object.

    + + +
    refStudy
    +

    An object of class antaresData created with function +[antaresRead::readAntares()] containing data for areas and or +districts. Can also contains an opts who refer to a h5 file.

    + + +
    mapLayout
    +

    Object created with function [antaresViz::mapLayout()]

    + + +
    colAreaVar
    +

    Name of a variable present in x$areas. The values of this variable are represented by the color of the areas on the map. If "none", then -the default color is used for all areas.

    sizeAreaVars

    Vector of variables present in x$areas to associate with the size of +the default color is used for all areas.

    + + +
    sizeAreaVars
    +

    Vector of variables present in x$areas to associate with the size of areas on the map. If this parameter has length equal to 0, all areas have the same size. If it has length equal to one, then the radius of the areas change depending on the values of the variable choosen. If it has length greater than 1 then areas are represented by a polar area chart where the size of each section -depends on the values of each variable.

    areaChartType

    If parameter sizeAreaVars contains multiple variables, this parameter +depends on the values of each variable.

    + + +
    areaChartType
    +

    If parameter sizeAreaVars contains multiple variables, this parameter determines the type of representation. Possible values are "bar" for bar charts, "pie" for pie charts, "polar-area" and "polar-radius" for polar area charts where the values are represented -respectively by the area or the radius of the slices.

    uniqueScale

    If the map contains polar or bar charts, should the different variables +respectively by the area or the radius of the slices.

    + + +
    uniqueScale
    +

    If the map contains polar or bar charts, should the different variables represented use the same scale or should each variable have its own scale ? This parameter should be TRUE only if the variables have the same unit and -are comparable : for instance production variables.

    showLabels

    Used only when sizeAreaVars contains multiple variables. If it is -TRUE, then values of each variable are displayed.

    popupAreaVars

    Vector of variables to display when user clicks on an area.

    labelAreaVar

    Variable to display inside the areas. This parameter is used only if -parameter sizeAreaVars contains zero or one variable.

    colLinkVar

    Name of a variable present in x$links. The values of this variable +are comparable : for instance production variables.

    + + +
    showLabels
    +

    Used only when sizeAreaVars contains multiple variables. If it is +TRUE, then values of each variable are displayed.

    + + +
    popupAreaVars
    +

    Vector of variables to display when user clicks on an area.

    + + +
    labelAreaVar
    +

    Variable to display inside the areas. This parameter is used only if +parameter sizeAreaVars contains zero or one variable.

    + + +
    colLinkVar
    +

    Name of a variable present in x$links. The values of this variable are represented by the color of the links on the map. If "none", then -the default color is used for all links

    sizeLinkVar

    Name of a variable present in x$links. Its values are represented by -the line width of the links on the map.

    popupLinkVars

    Vector of variables to display when user clicks on a link

    closePopupOnClick

    LogicalValue, if TRUE the popups will automatically be closed with each click. If FALSE, the popups will stay open.

    type

    If type="avg", the data is averaged by area/and or link and +the default color is used for all links

    + + +
    sizeLinkVar
    +

    Name of a variable present in x$links. Its values are represented by +the line width of the links on the map.

    + + +
    popupLinkVars
    +

    Vector of variables to display when user clicks on a link

    + + +
    closePopupOnClick
    +

    LogicalValue, if TRUE the popups will automatically be closed with each click. If FALSE, the popups will stay open.

    + + +
    type
    +

    If type="avg", the data is averaged by area/and or link and represented on the map. If it is equal to "detail", only one time step at a time. In interactive mode, an input control permits to choose the -time step shown.

    timeId

    time id present in the data.

    mcYear

    If x, contains multiple Monte-Carlo scenarios, this parameter +time step shown.

    + + +
    timeId
    +

    time id present in the data.

    + + +
    mcYear
    +

    If x, contains multiple Monte-Carlo scenarios, this parameter determine which scenario is displayed. Must be an integer representing the index of the scenario or the word "average". In this case data are -averaged.

    main

    Title of the map.

    typeSizeAreaVars

    logical. Select sizeAreaVars using alias ? Default to FALSE

    aliasSizeAreaVars

    If typeSizeAreaVars is set to TRUE, name of alias. You can find the list -of alias with the function showAliases

    compare

    An optional character vector containing names of parameters. When it is set, +averaged.

    + + +
    main
    +

    Title of the map.

    + + +
    typeSizeAreaVars
    +

    logical. Select sizeAreaVars using alias ? Default to FALSE

    + + +
    aliasSizeAreaVars
    +

    If typeSizeAreaVars is set to TRUE, name of alias. You can find the list +of alias with the function [antaresRead::showAliases()]

    + + +
    compare
    +

    An optional character vector containing names of parameters. When it is set, two charts are outputed with their own input controls. Alternatively, it can be a named list with names corresponding to parameter names and values being list with the initial values of the given parameter for each chart. See details - if you are drawing a map.

    compareOpts

    List of options that indicates the number of charts to create and their + if you are drawing a map.

    + + +
    compareOpts
    +

    List of options that indicates the number of charts to create and their position. Check out the documentation of -compareOptions to see available options.

    interactive

    LogicalValue. If TRUE, then a shiny gadget is launched that lets -the user interactively choose the areas or districts to display.

    options

    List of parameters that override some default visual settings. See the -help of plotMapOptions.

    width

    Width of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    height

    Height of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    dateRange

    A vector of two dates. Only data points between these two dates are -displayed. If NULL, then all data is displayed.

    xyCompare

    Use when you compare studies, can be "union" or "intersect". If union, all +[manipulateWidget::compareOptions] to see available options.

    + + +
    interactive
    +

    LogicalValue. If TRUE, then a shiny gadget is launched that lets +the user interactively choose the areas or districts to display.

    + + +
    options
    +

    List of parameters that override some default visual settings. See the +help of [antaresViz::plotMapOptions()].

    + + +
    width
    +

    Width of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    height
    +

    Height of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    dateRange
    +

    A vector of two dates. Only data points between these two dates are +displayed. If NULL, then all data is displayed.

    + + +
    xyCompare
    +

    Use when you compare studies, can be "union" or "intersect". If union, all of mcYears in one of studies will be selectable. If intersect, only mcYears in all -studies will be selectable.

    h5requestFiltering

    Contains arguments used by default for h5 request, -typically h5requestFiltering = list(mcYears = 3)

    timeSteph5

    character timeStep to read in h5 file. Only for Non interactive mode.

    mcYearh5

    numeric mcYear to read for h5. Only for Non interactive mode.

    tablesh5

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    sizeMiniPlot

    boolean variable size for miniplot

    language

    character language use for label. Defaut to 'en'. Can be 'fr'.

    hidden

    logical Names of input to hide. Defaut to NULL

    ...

    Other arguments for manipulateWidget

    - -

    Value

    - -

    An htmlwidget of class "leaflet". It can be modified with package -leaflet. By default the function starts a shiny gadget that lets the -user play with most of the parameters of the function. The function returns -a leaflet map when the user clicks on the button "OK".

    -

    Details

    +studies will be selectable.

    -

    compare argument can take following values :

      -
    • "mcYear"

    • -
    • "type"

    • -
    • "colAreaVar"

    • -
    • "sizeAreaVars"

    • -
    • "areaChartType"

    • -
    • "showLabels"

    • -
    • "popupAreaVars"

    • -
    • "labelAreaVar"

    • -
    • "colLinkVar"

    • -
    • "sizeLinkVar"

    • -
    • "popupLinkVars"

    • -
    • "typeSizeAreaVars"

    • -
    • "aliasSizeAreaVars"

    • -
    +
    h5requestFiltering
    +

    Contains arguments used by default for h5 request, +typically h5requestFiltering = list(mcYears = 3)

    -

    Examples

    -
    if (FALSE) { -mydata <- readAntares(areas = "all", links = "all", timeStep = "daily", - select = "nostat") -# Place areas on a map. Ths has to be done once for a given study. Then the -# object returned by "mapLayout" may be saved and reloaded with -# functions save and load +
    timeSteph5
    +

    character timeStep to read in h5 file. Only for Non interactive mode.

    -layout <- readLayout() -ml <- mapLayout(layout = layout) -save("ml", file = "ml.rda") -plotMap(x = mydata, mapLayout = ml) +
    mcYearh5
    +

    numeric mcYear to read for h5. Only for Non interactive mode.

    -# Specify the variables to use to control the color or size of elements. -plotMap(mydata, mapLayout = ml, - sizeAreaVars = c("WIND", "SOLAR", "H. ROR"), - sizeLinkVar = "FLOW LIN.") -# Change default graphical properties -plotMap(x = mydata, mapLayout = ml, options = list(colArea="red", colLink = "orange")) -plotMap(x = list(mydata, mydata), mapLayout = ml) +
    tablesh5
    +

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    -# Use custom alias -setAlias("custom_alias", "short description", c("OIL", "GAS", "COAL")) -plotMap(x = mydata, mapLayout = ml, typeSizeAreaVars = TRUE, - aliasSizeAreaVars = "custom_alias") - -plotMap(x = mydata, mapLayout = ml, interactive = FALSE, - language = "fr", aliasSizeAreaVars = "Renouvelable", typeSizeAreaVars = TRUE) -# Use h5 for dynamic request / exploration in a study -# Set path of simulaiton -setSimulationPath(path = path1) +
    sizeMiniPlot
    +

    boolean variable size for miniplot

    + -# Convert your study in h5 format -writeAntaresH5(path = myNewPath) +
    language
    +

    character language use for label. Defaut to 'en'. Can be 'fr'.

    -# Redefine sim path with h5 file -opts <- setSimulationPath(path = myNewPath) -plotMap(x = opts, mapLayout = ml) -# Compare elements in a single study -plotMap(x = opts, mapLayout = ml, .compare = "mcYear") +
    hidden
    +

    logical Names of input to hide. Defaut to NULL

    -# Compare 2 studies -plotMap(x = list(opts, opts2), mapLayout = ml) -# Compare 2 studies with argument refStudies -plotMap(x = opts, refStudy = opts2, mapLayout = ml) -plotMap(x = opts, refStudy = opts2, mapLayout = ml, interactive = FALSE, mcYearh5 = 2) -plotMap(x = opts, refStudy = opts2, mapLayout = ml, h5requestFiltering = -list(mcYears = myMcYear)) -} +
    ...
    +

    Other arguments for manipulateWidget

    + +
    +
    +

    Value

    + -
    +

    An htmlwidget of class "leaflet". It can be modified with package +leaflet. By default the function starts a shiny gadget that lets the +user play with most of the parameters of the function. The function returns +a leaflet map when the user clicks on the button "OK".

    +
    +
    +

    Details

    +

    compare argument can take following values :

    • "mcYear"

    • +
    • "type"

    • +
    • "colAreaVar"

    • +
    • "sizeAreaVars"

    • +
    • "areaChartType"

    • +
    • "showLabels"

    • +
    • "popupAreaVars"

    • +
    • "labelAreaVar"

    • +
    • "colLinkVar"

    • +
    • "sizeLinkVar"

    • +
    • "popupLinkVars"

    • +
    • "typeSizeAreaVars"

    • +
    • "aliasSizeAreaVars"

    • +
    + +
    +

    Examples

    +
    if (FALSE) {
    +mydata <- readAntares(areas = "all", links = "all", timeStep = "daily",
    +                      select = "nostat")
    +
    +# Place areas on a map. Ths has to be done once for a given study. Then the
    +# object returned by "mapLayout" may be saved and reloaded with
    +# functions save and load
    +
    +layout <- readLayout()
    +ml <- mapLayout(layout = layout)
    +save("ml", file = "ml.rda")
    +
    +plotMap(x = mydata, mapLayout = ml)
    +
    +# Specify the variables to use to control the color or size of elements.
    +plotMap(mydata, mapLayout =  ml, 
    +        sizeAreaVars = c("WIND", "SOLAR", "H. ROR"),
    +        sizeLinkVar = "FLOW LIN.")
    +
    +# Change default graphical properties
    +plotMap(x = mydata, mapLayout = ml, options = list(colArea="red", colLink = "orange"))
    +plotMap(x = list(mydata, mydata), mapLayout =  ml)
    +
    +# Use custom alias
    +setAlias("custom_alias", "short description", c("OIL", "GAS", "COAL")) 
    +plotMap(x = mydata, mapLayout = ml, typeSizeAreaVars = TRUE, 
    +    aliasSizeAreaVars = "custom_alias")
    +    
    +plotMap(x = mydata, mapLayout = ml, interactive = FALSE, 
    +    language = "fr", aliasSizeAreaVars = "Renouvelable", typeSizeAreaVars = TRUE)
    +
    +# Use h5 for dynamic request / exploration in a study
    +# Set path of simulaiton
    +setSimulationPath(path = path1)
    +
    +# Convert your study in h5 format
    +writeAntaresH5(path = myNewPath)
    +
    +# Redefine sim path with h5 file
    +opts <- setSimulationPath(path = myNewPath)
    +plotMap(x = opts, mapLayout = ml)
    +
    +# Compare elements in a single study
    +plotMap(x = opts, mapLayout = ml,  .compare = "mcYear")
    +
    +# Compare 2 studies
    +plotMap(x = list(opts, opts2), mapLayout = ml)
    +
    +# Compare 2 studies with argument refStudies 
    +plotMap(x = opts, refStudy = opts2, mapLayout = ml)
    +plotMap(x = opts, refStudy = opts2, mapLayout = ml, interactive = FALSE, mcYearh5 = 2) 
    +plotMap(x = opts, refStudy = opts2, mapLayout = ml, h5requestFiltering = 
    +list(mcYears = myMcYear))
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/plotMapLayout.html b/docs/reference/plotMapLayout.html index a6599869..2403abf1 100644 --- a/docs/reference/plotMapLayout.html +++ b/docs/reference/plotMapLayout.html @@ -1,67 +1,12 @@ - - - - - - - -Visualize mapLayout output. — plotMapLayout • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Visualize mapLayout output. — plotMapLayout • antaresViz + + - - - - -
    -
    - -
    - -
    +
    @@ -135,60 +65,58 @@

    Visualize mapLayout output.

    Visualize mapLayout output.

    -
    plotMapLayout(mapLayout)
    - -

    Arguments

    - - - - - - -
    mapLayout

    object returned by function mapLayout

    - -

    See also

    - - - -

    Examples

    -
    -if (FALSE) { -# Read the coordinates of the areas in the Antares interface, then convert it -# in a map layout. -layout <- readLayout() -ml <- mapLayout(layout) +
    +
    plotMapLayout(mapLayout)
    +
    -# visualize mapLayout -plotMapLayout(ml) +
    +

    Arguments

    +
    mapLayout
    +

    object returned by function [mapLayout()]

    -} +
    +
    +

    See also

    +

    [mapLayout()]

    +
    -
    +
    +

    Examples

    +
    
    +if (FALSE) {
    +# Read the coordinates of the areas in the Antares interface, then convert it
    +# in a map layout.
    +layout <- readLayout()
    +ml <- mapLayout(layout)
    +
    +# visualize mapLayout
    +plotMapLayout(ml)
    +
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/plotMapOptions.html b/docs/reference/plotMapOptions.html index 646c7d87..fede9695 100644 --- a/docs/reference/plotMapOptions.html +++ b/docs/reference/plotMapOptions.html @@ -1,68 +1,13 @@ - - - - - - - -Graphical options for plotMap — plotMapOptions • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Graphical options for plotMap — plotMapOptions • antaresViz - - + + - - -
    -
    - -
    - -
    +

    These functions get and set options that control some graphical aspects -of maps created with plotMap.

    +of maps created with [plotMap()].

    -
    plotMapOptions(
    -  areaDefaultCol = "#DDDDE5",
    -  areaDefaultSize = 30,
    -  areaMaxSize = 50,
    -  areaMaxHeight = 50,
    -  areaChartColors = NULL,
    -  areaColorScaleOpts = colorScaleOptions(),
    -  labelMinSize = 8,
    -  labelMaxSize = 24,
    -  linkDefaultCol = "#BEBECE",
    -  linkDefaultSize = 3,
    -  linkMaxSize = 15,
    -  linkColorScaleOpts = colorScaleOptions(),
    -  legend = c("choose", "visible", "hidden"),
    -  tilesURL = defaultTilesURL(),
    -  preprocess = function(map) {     map }
    -)
    -
    -defaultTilesURL()
    -
    -colorScaleOptions(
    -  breaks = 5,
    -  domain = NULL,
    -  negCol = "#FF0000",
    -  zeroCol = "#FAFAFA",
    -  posCol = "#0000FF",
    -  naCol = "#EEEEEE",
    -  zeroTol = NULL,
    -  colors = NULL,
    -  levels = NULL
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    areaDefaultCol

    default color of areas.

    areaDefaultSize

    default size of areas.

    areaMaxSize

    maximal size of an area when it represents the value of some variable.

    areaMaxHeight

    Maximal height of bars. Used only if a barchart representation is used.

    areaChartColors

    Vector of colors to use in polar area charts and bar charts

    areaColorScaleOpts

    List of options used to construct a continuous color scale. This list should -be generated with function colorScaleOptions.

    labelMinSize

    minimal height of labels.

    labelMaxSize

    maximal height of labels.

    linkDefaultCol

    Default color of links.

    linkDefaultSize

    Default line width of links.

    linkMaxSize

    Maximal line width of a link when it represents the value of some variable.

    linkColorScaleOpts

    List of options used to construct a continuous color scale. This list should -be generated with function colorScaleOptions.

    legend

    Should the legend be displayed or not ? Default is to mask the legend but +

    +
    plotMapOptions(
    +  areaDefaultCol = "#DDDDE5",
    +  areaDefaultSize = 30,
    +  areaMaxSize = 50,
    +  areaMaxHeight = 50,
    +  areaChartColors = NULL,
    +  areaColorScaleOpts = colorScaleOptions(),
    +  labelMinSize = 8,
    +  labelMaxSize = 24,
    +  linkDefaultCol = "#BEBECE",
    +  linkDefaultSize = 3,
    +  linkMaxSize = 15,
    +  linkColorScaleOpts = colorScaleOptions(),
    +  legend = c("choose", "visible", "hidden"),
    +  tilesURL = defaultTilesURL(),
    +  preprocess = function(map) {
    +     map
    + }
    +)
    +
    +defaultTilesURL()
    +
    +colorScaleOptions(
    +  breaks = 5,
    +  domain = NULL,
    +  negCol = "#FF0000",
    +  zeroCol = "#FAFAFA",
    +  posCol = "#0000FF",
    +  naCol = "#EEEEEE",
    +  zeroTol = NULL,
    +  colors = NULL,
    +  levels = NULL
    +)
    +
    + +
    +

    Arguments

    +
    areaDefaultCol
    +

    default color of areas.

    + + +
    areaDefaultSize
    +

    default size of areas.

    + + +
    areaMaxSize
    +

    maximal size of an area when it represents the value of some variable.

    + + +
    areaMaxHeight
    +

    Maximal height of bars. Used only if a barchart representation is used.

    + + +
    areaChartColors
    +

    Vector of colors to use in polar area charts and bar charts

    + + +
    areaColorScaleOpts
    +

    List of options used to construct a continuous color scale. This list should +be generated with function colorScaleOptions.

    + + +
    labelMinSize
    +

    minimal height of labels.

    + + +
    labelMaxSize
    +

    maximal height of labels.

    + + +
    linkDefaultCol
    +

    Default color of links.

    + + +
    linkDefaultSize
    +

    Default line width of links.

    + + +
    linkMaxSize
    +

    Maximal line width of a link when it represents the value of some variable.

    + + +
    linkColorScaleOpts
    +

    List of options used to construct a continuous color scale. This list should +be generated with function colorScaleOptions.

    + + +
    legend
    +

    Should the legend be displayed or not ? Default is to mask the legend but add a button to display it. Other values are "visible" to make the legend -always visible and "hidden" to mask it.

    tilesURL

    URL template used to get map tiles. The followign site +always visible and "hidden" to mask it.

    + + +
    tilesURL
    +

    URL template used to get map tiles. The followign site provides some URLs; -https://leaflet-extras.github.io/leaflet-providers/preview/

    preprocess

    A function that takes as argument a map and that returns a +https://leaflet-extras.github.io/leaflet-providers/preview/

    + + +
    preprocess
    +

    A function that takes as argument a map and that returns a modified version of this map. This parameter can be used to add extra -information on a map.

    breaks

    Either a single number indicating the approximate number of colors to use, or +information on a map.

    + + +
    breaks
    +

    Either a single number indicating the approximate number of colors to use, or a vector of values at which values to change color. In the first case, the function tries to cut the data nicely, so the real -number of colors used may vary.

    domain

    Range of the data, ie. the range of possible values. If NULL, the -the range of the data is used

    negCol

    color of the extreme negative value.

    zeroCol

    color of the 0 value.

    posCol

    Color of the extreme positive value.

    naCol

    Color for missing values

    zeroTol

    All values in the interval \[-zeroTol, +zeroTol\] are mapped to the +number of colors used may vary.

    + + +
    domain
    +

    Range of the data, ie. the range of possible values. If NULL, the +the range of the data is used

    + + +
    negCol
    +

    color of the extreme negative value.

    + + +
    zeroCol
    +

    color of the 0 value.

    + + +
    posCol
    +

    Color of the extreme positive value.

    + + +
    naCol
    +

    Color for missing values

    + + +
    zeroTol
    +

    All values in the interval \[-zeroTol, +zeroTol\] are mapped to the zeroCol color. If NULL, the function tries to pick a nice -value that is approximately equal to 1% of the maximal value.

    colors

    Vector of colors. If it is set and if user manually sets break points, then +value that is approximately equal to 1% of the maximal value.

    + + +
    colors
    +

    Vector of colors. If it is set and if user manually sets break points, then these colors are used instead of the colors defined by parameters negCol, -zeroCol and posCol.

    levels

    Vector of the distinct values a variable can take. Only used when the -variable to represent is a categorical variable.

    - -

    Value

    - -

    A list with the values of the different graphical parameters.

    - -

    Examples

    -
    if (FALSE) { - -# Example : Change color for area variables - -library(antaresViz) - -studyPath <- "path/to/study" -setSimulationPath(path = studyPath, simulation = -1) -myData<-readAntares(areas = "all", links = "all") - -ml<-readRDS(file = "path/to/mapLayout.rds") - -myOption<-plotMapOptions(areaChartColors = c("yellow", "violetred")) - -plotMap(myData, - ml, - sizeAreaVars = c("SOLAR", "WIND"), - type="avg", - interactive = FALSE, - options = myOption -) - -# for pie chart -plotMap(myData, - ml, - sizeAreaVars = c("SOLAR", "WIND"), - type="avg", - interactive = FALSE, - options = myOption, - areaChartType = "pie", - sizeMiniPlot = TRUE -) - -# Example : Change color for link and area variables -myOption <- plotMapOptions(areaChartColors = c("yellow", "violetred"), linkDefaultCol = "green") -plotMap(myData, - ml, - type="avg", - sizeAreaVars = c("SOLAR", "WIND"), - interactive = FALSE, - options = myOption -) - -# Change default area color -myOption <- plotMapOptions(areaDefaultCol = "green") -plotMap(myData, - ml, - interactive = FALSE, - options = myOption -) - -# Change the scale -plotMap(myData, - ml, - colAreaVar = "MRG. PRICE", - options = plotMapOptions( - areaColorScaleOpts = colorScaleOptions( - breaks = c(-1000, 100, 200, 20000), - colors = c("green", "orange", "red") - ) - ), - interactive = FALSE -) -} - -
    +zeroCol and posCol.

    + + +
    levels
    +

    Vector of the distinct values a variable can take. Only used when the +variable to represent is a categorical variable.

    + +
    +
    +

    Value

    + + +

    A list with the values of the different graphical parameters.

    +
    + +
    +

    Examples

    +
    if (FALSE) {
    +
    +# Example : Change color for area variables 
    +
    +library(antaresViz)
    +
    +studyPath <- "path/to/study"
    +setSimulationPath(path = studyPath, simulation = -1)
    +myData<-readAntares(areas = "all", links = "all")
    +
    +ml<-readRDS(file = "path/to/mapLayout.rds")
    +
    +myOption<-plotMapOptions(areaChartColors = c("yellow", "violetred"))
    +
    +plotMap(myData, 
    +        ml, 
    +        sizeAreaVars = c("SOLAR", "WIND"), 
    +        type="avg", 
    +        interactive = FALSE, 
    +       options = myOption
    +)
    +
    +# for pie chart 
    +plotMap(myData, 
    +        ml, 
    +        sizeAreaVars = c("SOLAR", "WIND"), 
    +        type="avg", 
    +        interactive = FALSE, 
    +        options = myOption,
    +        areaChartType = "pie",
    +        sizeMiniPlot = TRUE
    +)
    +
    +# Example : Change color for link and area variables 
    +myOption <- plotMapOptions(areaChartColors = c("yellow", "violetred"), linkDefaultCol = "green")
    +plotMap(myData, 
    +        ml, 
    +        type="avg", 
    +        sizeAreaVars = c("SOLAR", "WIND"), 
    +        interactive = FALSE, 
    +        options = myOption
    +)
    +
    +# Change default area color 
    +myOption <- plotMapOptions(areaDefaultCol = "green")
    +plotMap(myData, 
    +        ml, 
    +        interactive = FALSE, 
    +        options = myOption
    +)
    +
    +# Change the scale 
    +plotMap(myData, 
    +        ml, 
    +        colAreaVar = "MRG. PRICE",
    +        options = plotMapOptions(
    +          areaColorScaleOpts = colorScaleOptions(
    +            breaks = c(-1000, 100, 200, 20000),
    +            colors = c("green", "orange", "red")
    +          )
    +        ),
    +        interactive = FALSE
    +)
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/plotThermalGroupCapacities.html b/docs/reference/plotThermalGroupCapacities.html index 6d19418b..d52f64ab 100644 --- a/docs/reference/plotThermalGroupCapacities.html +++ b/docs/reference/plotThermalGroupCapacities.html @@ -1,67 +1,12 @@ - - - - - - - -Plot for Thermal Group Capacities — plotThermalGroupCapacities • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot for Thermal Group Capacities — plotThermalGroupCapacities • antaresViz - + + - - - -
    -
    - -
    - -
    +
    @@ -135,62 +65,59 @@

    Plot for Thermal Group Capacities

    Plot for Thermal Group Capacities

    -
    plotThermalGroupCapacities(
    -  data,
    -  area = "all",
    -  main = "Thermal group capacities"
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - -
    data

    data.table of Thermal Group capacities

    area

    areas to select, default all

    main

    title

    - - -

    Examples

    -
    if (FALSE) { -opts <- setSimulationPath(getwd()) -plotThermalGroupCapacities( thermalGroupCapacities(opts)) -} - -
    +
    +
    plotThermalGroupCapacities(
    +  data,
    +  area = "all",
    +  main = "Thermal group capacities"
    +)
    +
    + +
    +

    Arguments

    +
    data
    +

    data.table of Thermal Group capacities

    + + +
    area
    +

    areas to select, default all

    + + +
    main
    +

    title

    + +
    + +
    +

    Examples

    +
    if (FALSE) {
    +opts <- setSimulationPath(getwd())
    +plotThermalGroupCapacities( thermalGroupCapacities(opts))
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/plotXY.html b/docs/reference/plotXY.html index 164d6a56..a80065c6 100644 --- a/docs/reference/plotXY.html +++ b/docs/reference/plotXY.html @@ -1,67 +1,12 @@ - - - - - - - -Plot density between X et Y with ggplot2 and plotly — plotXY • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot density between X et Y with ggplot2 and plotly — plotXY • antaresViz - - + + - - -
    -
    - -
    - -
    +
    @@ -135,93 +65,90 @@

    Plot density between X et Y with ggplot2 and plotly

    Plot density between X et Y with ggplot2 and plotly

    -
    plotXY(
    -  data,
    -  x,
    -  y,
    -  precision = 30,
    -  sizeOnCount = FALSE,
    -  outLine = TRUE,
    -  transform = NULL
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    data

    data.frame can be antaresData object

    x

    character, x variable

    y

    character, y variable

    precision

    Deprecated.

    sizeOnCount

    Deprecated.

    outLine

    Deprecated.

    transform

    Deprecated.

    - - -

    Examples

    -
    if (FALSE) { - -setSimulationPath("myStudy") -myData <- readAntares() - -plotXY(myData, "NODU", "LOAD", precision = 50, - sizeOnCount = FALSE) - -myData <- readAntares(areas = "all", links = "all") -myData <- mergeAllAntaresData(myData) -plotXY(myData, "OP. COST_max_b", "OP. COST_max_c", precision = 50, - sizeOnCount = FALSE) - - -} - -
    +
    +
    plotXY(
    +  data,
    +  x,
    +  y,
    +  precision = 30,
    +  sizeOnCount = FALSE,
    +  outLine = TRUE,
    +  transform = NULL
    +)
    +
    + +
    +

    Arguments

    +
    data
    +

    data.frame can be antaresData object

    + + +
    x
    +

    character, x variable

    + + +
    y
    +

    character, y variable

    + + +
    precision
    +

    Deprecated.

    + + +
    sizeOnCount
    +

    Deprecated.

    + + +
    outLine
    +

    Deprecated.

    + + +
    transform
    +

    Deprecated.

    + +
    + +
    +

    Examples

    +
    if (FALSE) {
    +
    +setSimulationPath("myStudy")
    +myData <- readAntares()
    +
    +plotXY(myData, "NODU", "LOAD", precision = 50,
    +         sizeOnCount = FALSE)
    +         
    +myData <- readAntares(areas = "all", links = "all")    
    +myData <- mergeAllAntaresData(myData)  
    +plotXY(myData, "OP. COST_max_b", "OP. COST_max_c", precision = 50,
    +         sizeOnCount = FALSE)
    +         
    +         
    +}
    +   
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/prodStack.html b/docs/reference/prodStack.html index a3071ea2..5aad2f58 100644 --- a/docs/reference/prodStack.html +++ b/docs/reference/prodStack.html @@ -1,69 +1,14 @@ - - - - - - - -Visualize the production stack of an area — prodStackAliases • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Visualize the production stack of an area — prodStackAliases • antaresViz - - - - - - - - - + + - - - - -
    -
    - -
    - -
    +
    @@ -139,262 +69,267 @@

    Visualize the production stack of an area

    with setProdStackAlias.

    -
    prodStackAliases()
    -
    -setProdStackAlias(
    -  name,
    -  variables,
    -  colors,
    -  lines = NULL,
    -  lineColors = NULL,
    -  lineWidth = 3,
    -  description = NULL
    -)
    -
    -prodStack(
    -  x,
    -  stack = "eco2mix",
    -  areas = NULL,
    -  mcYear = "average",
    -  dateRange = NULL,
    -  yMin = NULL,
    -  yMax = NULL,
    -  customTicks = NULL,
    -  main = .getLabelLanguage("Production stack", language),
    -  unit = c("MWh", "GWh", "TWh"),
    -  compare = NULL,
    -  compareOpts = list(),
    -  interactive = getInteractivity(),
    -  legend = TRUE,
    -  legendId = sample(1e+09, 1),
    -  groupId = legendId,
    -  updateLegendOnMouseOver = TRUE,
    -  legendItemsPerRow = 5,
    -  width = NULL,
    -  height = NULL,
    -  xyCompare = c("union", "intersect"),
    -  h5requestFiltering = list(),
    -  stepPlot = FALSE,
    -  drawPoints = FALSE,
    -  timeSteph5 = "hourly",
    -  mcYearh5 = NULL,
    -  tablesh5 = c("areas", "links"),
    -  language = "en",
    -  hidden = NULL,
    -  refStudy = NULL,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    name

    name of the stack to create or update

    variables

    A named list of expressions created with alist. The +

    +
    prodStackAliases()
    +
    +setProdStackAlias(
    +  name,
    +  variables,
    +  colors,
    +  lines = NULL,
    +  lineColors = NULL,
    +  lineWidth = 3,
    +  description = NULL
    +)
    +
    +prodStack(
    +  x,
    +  stack = "eco2mix",
    +  areas = NULL,
    +  mcYear = "average",
    +  dateRange = NULL,
    +  yMin = NULL,
    +  yMax = NULL,
    +  customTicks = NULL,
    +  main = .getLabelLanguage("Production stack", language),
    +  unit = c("MWh", "GWh", "TWh"),
    +  compare = NULL,
    +  compareOpts = list(),
    +  interactive = getInteractivity(),
    +  legend = TRUE,
    +  legendId = sample(1e+09, 1),
    +  groupId = legendId,
    +  updateLegendOnMouseOver = TRUE,
    +  legendItemsPerRow = 5,
    +  width = NULL,
    +  height = NULL,
    +  xyCompare = c("union", "intersect"),
    +  h5requestFiltering = deprecated(),
    +  stepPlot = FALSE,
    +  drawPoints = FALSE,
    +  timeSteph5 = deprecated(),
    +  mcYearh5 = deprecated(),
    +  tablesh5 = deprecated(),
    +  language = "en",
    +  hidden = NULL,
    +  refStudy = NULL,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    name
    +

    name of the stack to create or update

    + + +
    variables
    +

    A named list of expressions created with [base::alist]. The name of each element is the name of the variable to draw in the stacked graph. The element itself is an expression explaining how to compute the -variable (see examples).

    colors

    Vector of colors with same length as parameter variables. If +variable (see examples).

    + + +
    colors
    +

    Vector of colors with same length as parameter variables. If variables is an alias, then this argument should be NULL in -order to use default colors.

    lines

    A named list of expressions created with alist +order to use default colors.

    + + +
    lines
    +

    A named list of expressions created with [base::alist] indicating how to compute the curves to display on top of the stacked graph. It should be NULL if there is no curve to trace or if parameter -variables is an alias.

    lineColors

    Vector of colors with same length as parameter lines. This argument +variables is an alias.

    + + +
    lineColors
    +

    Vector of colors with same length as parameter lines. This argument should be NULL if there is no curve to trace or if parameter -variables is an alias.

    lineWidth

    Optionnal. Defaut to 3. Vector of width with same length as parameter lines (or only one value).

    description

    Description of the stack. It is displayed by function -prodStackAliases.

    x

    An object of class antaresData created with function -readAntares containing data for areas and or +variables is an alias.

    + + +
    lineWidth
    +

    Optionnal. Defaut to 3. Vector of width with same length as parameter lines (or only one value).

    + + +
    description
    +

    Description of the stack. It is displayed by function +prodStackAliases.

    + + +
    x
    +

    An object of class antaresData created with function +[antaresRead::readAntares()] containing data for areas and or districts. it can be a list of antaresData objects. In this case, one chart is created for each object. -Can also contains opts who refer to a h5 file or list of opts.

    stack

    Name of the stack to use. One can visualize available stacks with -prodStackAliases

    areas

    Vector of area or district names. The data of these areas or districts is -aggregated by the function to construct the production stack.

    mcYear

    If x, contains multiple Monte-Carlo scenarios, this parameter +Can also contains opts who refer to a h5 file or list of opts.

    + + +
    stack
    +

    Name of the stack to use. One can visualize available stacks with +prodStackAliases

    + + +
    areas
    +

    Vector of area or district names. The data of these areas or districts is +aggregated by the function to construct the production stack.

    + + +
    mcYear
    +

    If x, contains multiple Monte-Carlo scenarios, this parameter determine which scenario is displayed. Must be an integer representing the index of the scenario or the word "average". In this case data are -averaged.

    dateRange

    A vector of two dates. Only data points between these two dates are -displayed. If NULL, then all data is displayed.

    yMin

    numeric, the minimum value to be displayed on all y Axis. If NULL, the min value is automatically set

    yMax

    numeric, the maximum value to be displayed on all y Axis. If NULL, the max value is automatically set

    customTicks

    numeric vector of the custom ticks values to be displayed on the y Axis. If NULL, the ticks are automatically generated

    main

    Title of the graph.

    unit

    Unit used in the graph. Possible values are "MWh", "GWh" or "TWh".

    compare

    An optional character vector containing names of parameters. When it is set, +averaged.

    + + +
    dateRange
    +

    A vector of two dates. Only data points between these two dates are +displayed. If NULL, then all data is displayed.

    + + +
    yMin
    +

    numeric, the minimum value to be displayed on all y Axis. If NULL, the min value is automatically set

    + + +
    yMax
    +

    numeric, the maximum value to be displayed on all y Axis. If NULL, the max value is automatically set

    + + +
    customTicks
    +

    numeric vector of the custom ticks values to be displayed on the y Axis. If NULL, the ticks are automatically generated

    + + +
    main
    +

    Title of the graph.

    + + +
    unit
    +

    Unit used in the graph. Possible values are "MWh", "GWh" or "TWh".

    + + +
    compare
    +

    An optional character vector containing names of parameters. When it is set, two charts are outputed with their own input controls. Alternatively, it can be a named list with names corresponding to parameter names and values being list with the initial values of the given parameter for each chart. See details - if you are drawing a map.

    compareOpts

    List of options that indicates the number of charts to create and their + if you are drawing a map.

    + + +
    compareOpts
    +

    List of options that indicates the number of charts to create and their position. Check out the documentation of -compareOptions to see available options.

    interactive

    LogicalValue. If TRUE, then a shiny gadget is launched that lets -the user interactively choose the areas or districts to display.

    legend

    Logical value indicating if a legend should be drawn. This argument is +[manipulateWidget::compareOptions] to see available options.

    + + +
    interactive
    +

    LogicalValue. If TRUE, then a shiny gadget is launched that lets +the user interactively choose the areas or districts to display.

    + + +
    legend
    +

    Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with -prodStackLegend

    legendId

    Id of the legend linked to the graph. This argument is +[prodStackLegend()]

    + + +
    legendId
    +

    Id of the legend linked to the graph. This argument is usefull when one wants to create a shared legend with -prodStackLegend

    groupId

    Parameter that can be used to synchronize the horizontal +[prodStackLegend()]

    + + +
    groupId
    +

    Parameter that can be used to synchronize the horizontal zoom of multiple charts. All charts that need to be synchronized must -have the same group.

    updateLegendOnMouseOver

    LogicalValue. If TRUE the legend will be updated when the mouse is over a stack. If FALSE the legend will be updated on a click

    legendItemsPerRow

    Number of elements to put in each row of the legend.

    width

    Width of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    height

    Height of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    xyCompare

    Use when you compare studies, can be "union" or "intersect". If union, all +have the same group.

    + + +
    updateLegendOnMouseOver
    +

    LogicalValue. If TRUE the legend will be updated when the mouse is over a stack. If FALSE the legend will be updated on a click

    + + +
    legendItemsPerRow
    +

    Number of elements to put in each row of the legend.

    + + +
    width
    +

    Width of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    height
    +

    Height of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    xyCompare
    +

    Use when you compare studies, can be "union" or "intersect". If union, all of mcYears in one of studies will be selectable. If intersect, only mcYears in all -studies will be selectable.

    h5requestFiltering

    Contains arguments used by default for h5 request, -typically h5requestFiltering = list(areas = "a", mcYears = 2)

    stepPlot

    boolean, step style for curves.

    drawPoints

    boolean, add points on graph

    timeSteph5

    character timeStep to read in h5 file. Only for Non interactive mode.

    mcYearh5

    numeric mcYear to read for h5. Only for Non interactive mode.

    tablesh5

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    language

    character language use for label. Defaut to 'en'. Can be 'fr'.

    hidden

    logical Names of input to hide. Defaut to NULL

    refStudy

    An object of class antaresData created with function -readAntares containing data for areas and or -districts. Can also contains an opts who refer to a h5 file.

    ...

    Other arguments for manipulateWidget

    - -

    Value

    - -

    prodStack returns an interactive html graphic. If argument +studies will be selectable.

    + + +
    h5requestFiltering
    +

    Contains arguments used by default for h5 request, +typically h5requestFiltering = list(areas = "a", mcYears = 2)

    + + +
    stepPlot
    +

    boolean, step style for curves.

    + + +
    drawPoints
    +

    boolean, add points on graph

    + + +
    timeSteph5
    +

    character timeStep to read in h5 file. Only for Non interactive mode.

    + + +
    mcYearh5
    +

    numeric mcYear to read for h5. Only for Non interactive mode.

    + + +
    tablesh5
    +

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    + + +
    language
    +

    character language use for label. Defaut to 'en'. Can be 'fr'.

    + + +
    hidden
    +

    logical Names of input to hide. Defaut to NULL

    + + +
    refStudy
    +

    An object of class antaresData created with function +[antaresRead::readAntares()] containing data for areas and or +districts. Can also contains an opts who refer to a h5 file.

    + + +
    ...
    +

    Other arguments for manipulateWidget

    + +
    +
    +

    Value

    + + +

    prodStack returns an interactive html graphic. If argument interactive is TRUE, then a shiny gadget is started and the function returns an interactive html graphic when the user clicks on button "Done".

    + +

    prodStackAliases displays the list of available aliases.

    -

    setProdStackAlias creates or updates a stack alias.

    -

    Details

    -

    compare argument can take following values :

      -
    • "mcYear"

    • + +

      setProdStackAlias creates or updates a stack alias.

      +
    +
    +

    Details

    +

    compare argument can take following values :

    • "mcYear"

    • "main"

    • "unit"

    • "areas"

    • @@ -402,117 +337,115 @@

      Details
    • "stack"

    • "stepPlot"

    • "drawPoints"

    • -

    - -

    See also

    - - - -

    Examples

    -
    if (FALSE) { -mydata <- readAntares(areas = "all", timeStep = "daily") - -# Start a shiny gadget that permits to choose areas to display. -prodStack(x = mydata, unit = "GWh") - -# Use in a non-interactive way -prodStack(x = mydata, unit = "GWh", areas = "fr", interactive = FALSE) - -# Define a custom stack -setProdStackAlias( - name = "Wind and solar", - variables = alist(wind = WIND, solar = SOLAR), - colors = c("green", "orange") -) - -prodStack(x = mydata, unit = "GWh", stack = "Wind and solar") - -# In a custom stack it is possible to use computed values -setProdStackAlias( - name = "Renewable", - variables = alist( - renewable = WIND + SOLAR + `H. ROR` + `H. STOR` + `MISC. NDG`, - thermal = NUCLEAR + LIGNITE + COAL + GAS + OIL + `MIX. FUEL` + `MISC. DTG` - ), - colors = c("green", gray(0.3)), - lines = alist(goalRenewable = LOAD * 0.23), - lineColors = "#42EB09" -) - -prodStack(x = mydata, unit = "GWh", stack = "renewable") - -# Use compare -prodStack(x = mydata, compare = "areas") -prodStack(x = mydata, unit = "GWh", compare = "mcYear") -prodStack(x = mydata, unit = "GWh", compare = "main") -prodStack(x = mydata, unit = "GWh", compare = "unit") -prodStack(x = mydata, unit = "GWh", compare = "areas") -prodStack(x = mydata, unit = "GWh", compare = "legend") -prodStack(x = mydata, unit = "GWh", compare = "stack") -prodStack(x = mydata, unit = "GWh", compare = c("mcYear", "areas")) - - -# Compare studies -prodStack(list(mydata, mydata)) -# Compare studies with refStudy argument -prodStack(x = myData1, refStudy = myData2) -prodStack(x = myData1, refStudy = myData2, interactive = FALSE) -prodStack(x = list(myData2, myData3, myData4), refStudy = myData1) -prodStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) - - -# Use h5 opts -# Set path of simulaiton -setSimulationPath(path = path1) - -# Convert your study in h5 format -writeAntaresH5(path = mynewpath) - -# Redefine sim path with h5 file -opts <- setSimulationPath(path = mynewpath) -prodStack(x = opts) - -# Compare elements in a single study -prodStack(x = opts, .compare = "mcYear") - -# Compare 2 studies -prodStack(x = list(opts, opts2)) - -# Compare 2 studies with argument refStudies -prodStack(x = opts, refStudy = opts2) -prodStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea) -prodStack(x = opts, refStudy = opts2, h5requestFiltering = list(areas = myArea, -mcYears = 2)) - - -} - -
    +
    +
    +

    See also

    +

    [prodStackLegend()]

    +
    + +
    +

    Examples

    +
    if (FALSE) {
    +mydata <- readAntares(areas = "all", timeStep = "daily")
    +
    +# Start a shiny gadget that permits to choose areas to display.
    +prodStack(x = mydata, unit = "GWh")
    +
    +# Use in a non-interactive way
    +prodStack(x = mydata, unit = "GWh", areas = "fr", interactive = FALSE)
    +
    +# Define a custom stack
    +setProdStackAlias(
    +  name = "Wind and solar",
    +  variables = alist(wind = WIND, solar = SOLAR),
    +  colors = c("green", "orange")
    +)
    +
    +prodStack(x = mydata, unit = "GWh", stack = "Wind and solar")
    +                
    +# In a custom stack it is possible to use computed values
    +setProdStackAlias(
    +  name = "Renewable",
    +  variables = alist(
    +    renewable = WIND + SOLAR + `H. ROR` + `H. STOR` + `MISC. NDG`, 
    +    thermal = NUCLEAR + LIGNITE + COAL + GAS + OIL + `MIX. FUEL` + `MISC. DTG`
    +  ),
    +  colors = c("green", gray(0.3)),
    +  lines = alist(goalRenewable = LOAD * 0.23),
    +  lineColors = "#42EB09"
    +)
    +
    +prodStack(x = mydata, unit = "GWh", stack = "renewable")
    +
    +# Use compare
    +prodStack(x = mydata, compare = "areas")
    +prodStack(x = mydata, unit = "GWh", compare = "mcYear")
    +prodStack(x = mydata, unit = "GWh", compare = "main")
    +prodStack(x = mydata, unit = "GWh", compare = "unit")
    +prodStack(x = mydata, unit = "GWh", compare = "areas")
    +prodStack(x = mydata, unit = "GWh", compare = "legend")
    +prodStack(x = mydata, unit = "GWh", compare = "stack")
    +prodStack(x = mydata, unit = "GWh", compare = c("mcYear", "areas"))
    +
    +
    +# Compare studies
    +prodStack(list(mydata, mydata))
    +# Compare studies with refStudy argument 
    +prodStack(x = myData1, refStudy = myData2)
    +prodStack(x = myData1, refStudy = myData2, interactive = FALSE)
    +prodStack(x = list(myData2, myData3, myData4), refStudy = myData1)
    +prodStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE)
    +
    +
    +# Use h5 opts
    +# Set path of simulaiton
    +setSimulationPath(path = path1)
    +
    +# Convert your study in h5 format
    +writeAntaresH5(path = mynewpath)
    +
    +# Redefine sim path with h5 file
    +opts <- setSimulationPath(path = mynewpath)
    +prodStack(x = opts)
    +
    +# Compare elements in a single study
    +prodStack(x = opts, .compare = "mcYear")
    +
    +# Compare 2 studies
    +prodStack(x = list(opts, opts2))
    +
    +# Compare 2 studies with argument refStudies 
    +prodStack(x = opts, refStudy = opts2)
    +prodStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea) 
    +prodStack(x = opts, refStudy = opts2, h5requestFiltering = list(areas = myArea, 
    +mcYears = 2))
    +
    +               
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/runAppAntaresViz.html b/docs/reference/runAppAntaresViz.html index 3a41437d..56d85690 100644 --- a/docs/reference/runAppAntaresViz.html +++ b/docs/reference/runAppAntaresViz.html @@ -1,67 +1,12 @@ - - - - - - - -Run app antaresViz — runAppAntaresViz • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Run app antaresViz — runAppAntaresViz • antaresViz - - - - + + -
    -
    - -
    - -
    +
    @@ -135,38 +65,38 @@

    Run app antaresViz

    runAppAntaresViz run antaresViz App.

    -
    runAppAntaresViz()
    - +
    +
    runAppAntaresViz()
    +
    -

    Value

    +
    +

    Value

    + -

    an App Shiny.

    +

    an App Shiny.

    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/savePlotAsPng.html b/docs/reference/savePlotAsPng.html index 4d1cb35a..85242ec9 100644 --- a/docs/reference/savePlotAsPng.html +++ b/docs/reference/savePlotAsPng.html @@ -1,69 +1,14 @@ - - - - - - - -Save interactive plot as a png image — savePlotAsPng • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Save interactive plot as a png image — savePlotAsPng • antaresViz - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +
    @@ -139,70 +69,70 @@

    Save interactive plot as a png image

    presentations.

    -
    savePlotAsPng(plot, file = "Rplot.png", width = 600, height = 480, ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - -
    plot

    A plot generated with one of the functions of this package.

    file

    The name of the output file

    width

    Width of the output file

    height

    height of the output file

    ...

    Other parameters passed to function webshot

    - -

    Value

    - -

    The function only creates the required file. Nothing is returned

    - -

    Examples

    -
    if (FALSE) { - mydata <- readAntares() - myplot <- plot(mydata, variable = "MRG. PRICE", type = "density") - savePlotAsPng(myplot, file = "myplot.png") -} - -
    +
    +
    savePlotAsPng(plot, file = "Rplot.png", width = 600, height = 480, ...)
    +
    + +
    +

    Arguments

    +
    plot
    +

    A plot generated with one of the functions of this package.

    + + +
    file
    +

    The name of the output file

    + + +
    width
    +

    Width of the output file

    + + +
    height
    +

    height of the output file

    + + +
    ...
    +

    Other parameters passed to function [webshot::webshot]

    + +
    +
    +

    Value

    + + +

    The function only creates the required file. Nothing is returned

    +
    + +
    +

    Examples

    +
    if (FALSE) {
    +  mydata <- readAntares()
    +  myplot <- plot(mydata, variable = "MRG. PRICE", type = "density")
    +  savePlotAsPng(myplot, file = "myplot.png")
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/setInteractivity.html b/docs/reference/setInteractivity.html index 8b01a522..45638222 100644 --- a/docs/reference/setInteractivity.html +++ b/docs/reference/setInteractivity.html @@ -1,70 +1,15 @@ - - - - - - - -Get and set interactivity mode — setInteractivity • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Get and set interactivity mode — setInteractivity • antaresViz - - - - - - - - - - - - - + + -
    -
    - -
    - -
    +
    @@ -141,52 +71,50 @@

    Get and set interactivity mode

    interactivity mode.

    -
    setInteractivity(interactive = "auto")
    -
    -getInteractivity()
    +
    +
    setInteractivity(interactive = "auto")
    +
    +getInteractivity()
    +
    -

    Arguments

    - - - - - - -
    interactive

    Should plot functions generate a UI that lets users to +

    +

    Arguments

    +
    interactive
    +

    Should plot functions generate a UI that lets users to interactively modify input data and graphical parameters of a chart? It should be TRUE or FALSE. The default behavior is to set it to TRUE if the R session -is interactive and to FALSE otherwise (for instance in Rmarkdown document).

    +is interactive and to FALSE otherwise (for instance in Rmarkdown document).

    -

    Value

    +
    +
    +

    Value

    + -

    getInteractivity returns a boolean indicating the interactivity mode of +

    getInteractivity returns a boolean indicating the interactivity mode of plot functions. setInteractivity is only used for its side effects.

    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/stackMap.html b/docs/reference/stackMap.html index 3df14509..f4e16a74 100644 --- a/docs/reference/stackMap.html +++ b/docs/reference/stackMap.html @@ -1,67 +1,12 @@ - - - - - - - -plot stack and map — stackMap • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -plot stack and map — stackMap • antaresViz + + - - - - -
    -
    - -
    - -
    +
    @@ -135,58 +65,55 @@

    plot stack and map

    plot stack and map

    -
    stackMap(x, mapLayout)
    - -

    Arguments

    - - - - - - - - - - -
    x

    antaresDataList antaresDataList contian areas ans links.

    mapLayout

    Object created with function mapLayout

    - - -

    Examples

    -
    if (FALSE) { -mydata <- readAntares(areas = "all", links = "all") - -layout <- readLayout() -ml <- mapLayout(layout = layout) - -stackMap(x = mydata, mapLayout = ml) -} +
    +
    stackMap(x, mapLayout)
    +
    -
    +
    +

    Arguments

    +
    x
    +

    antaresDataList antaresDataList contian areas ans links.

    + + +
    mapLayout
    +

    Object created with function [mapLayout()]

    + +
    + +
    +

    Examples

    +
    if (FALSE) {
    +mydata <- readAntares(areas = "all", links = "all")
    +
    +layout <- readLayout()
    +ml <- mapLayout(layout = layout)
    +
    +stackMap(x = mydata, mapLayout = ml)
    +}
    +
    +
    +
    +
    -
    - +
    - - + + diff --git a/docs/reference/tsLegend.html b/docs/reference/tsLegend.html index 9bfe0efe..681a3be1 100644 --- a/docs/reference/tsLegend.html +++ b/docs/reference/tsLegend.html @@ -1,70 +1,15 @@ - - - - - - - -Plot an interactive legend for time series plots — prodStackExchangesLegend • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot an interactive legend for time series plots — prodStackExchangesLegend • antaresViz - - - - - - - - - - - + + - - -
    -
    - -
    - -
    +
    @@ -141,68 +71,67 @@

    Plot an interactive legend for time series plots

    is mostly useful to share a unique legend between two or more time series plots.

    -
    prodStackExchangesLegend(
    -  stack = "default",
    -  legendItemsPerRow = 5,
    -  legendId = "",
    -  language = "en"
    -)
    -
    -prodStackLegend(
    -  stack = "eco2mix",
    -  legendItemsPerRow = 5,
    -  legendId = "",
    -  language = "en"
    -)
    -
    -tsLegend(labels, colors, types = "line", legendItemsPerRow = 5, legendId = "")
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    stack

    Name of the stack to use. One can visualize available stacks with -prodStackAliases

    legendItemsPerRow

    Number of elements to put in each row of the legend.

    legendId

    Id of the legend linked to the graph. This argument is +

    +
    prodStackExchangesLegend(
    +  stack = "default",
    +  legendItemsPerRow = 5,
    +  legendId = "",
    +  language = "en"
    +)
    +
    +prodStackLegend(
    +  stack = "eco2mix",
    +  legendItemsPerRow = 5,
    +  legendId = "",
    +  language = "en"
    +)
    +
    +tsLegend(labels, colors, types = "line", legendItemsPerRow = 5, legendId = "")
    +
    + +
    +

    Arguments

    +
    stack
    +

    Name of the stack to use. One can visualize available stacks with +prodStackAliases

    + + +
    legendItemsPerRow
    +

    Number of elements to put in each row of the legend.

    + + +
    legendId
    +

    Id of the legend linked to the graph. This argument is usefull when one wants to create a shared legend with -prodStackLegend

    language

    character language use for label. Defaut to 'en'. Can be 'fr'.

    labels

    vector containing the names of the times series

    colors

    vector of colors. It must have the same length as parameter -labels.

    types

    "line" or "area" or a vector with same length as labels -containing these two values.

    - -

    Details

    +[prodStackLegend()]

    + +
    language
    +

    character language use for label. Defaut to 'en'. Can be 'fr'.

    + + +
    labels
    +

    vector containing the names of the times series

    + + +
    colors
    +

    vector of colors. It must have the same length as parameter +labels.

    + + +
    types
    +

    "line" or "area" or a vector with same length as labels +containing these two values.

    + +
    +
    +

    Details

    Thes functions can be used to create a legend shared by multiple plots in a Shiny application or an interactive document created with Rmarkdown. For instance, let assume one wants to display four productions stacks in a 2x2 layout and have a unique legend below them in a Rmarkdown document. To do so, one can use the following chunck code:

    -
    +
    
     ```{R, echo = FALSE}
     library(manipulateWidget)
     
    @@ -222,34 +151,31 @@ 

    Details footer = prodStackLegend(legendId = 1) ) ``` -

    +
    +
    + -
    - +
    - - + + diff --git a/docs/reference/tsPlot.html b/docs/reference/tsPlot.html index dd4cc403..a29c5daf 100644 --- a/docs/reference/tsPlot.html +++ b/docs/reference/tsPlot.html @@ -1,67 +1,12 @@ - - - - - - - -plot time series contained in an antaresData object — tsPlot • antaresViz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -plot time series contained in an antaresData object — tsPlot • antaresViz - - + + - - -
    -
    - -
    - -
    +
    @@ -135,387 +65,388 @@

    plot time series contained in an antaresData object

    This function generates an interactive plot of an antares time series.

    -
    tsPlot(
    -  x,
    -  refStudy = NULL,
    -  table = NULL,
    -  variable = NULL,
    -  elements = NULL,
    -  variable2Axe = NULL,
    -  mcYear = "average",
    -  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    -  dateRange = NULL,
    -  typeConfInt = FALSE,
    -  confInt = 0,
    -  minValue = NULL,
    -  maxValue = NULL,
    -  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
    -  compare = NULL,
    -  compareOpts = list(),
    -  interactive = getInteractivity(),
    -  colors = NULL,
    -  main = NULL,
    -  ylab = NULL,
    -  legend = TRUE,
    -  legendItemsPerRow = 5,
    -  colorScaleOpts = colorScaleOptions(20),
    -  width = NULL,
    -  height = NULL,
    -  xyCompare = c("union", "intersect"),
    -  h5requestFiltering = list(),
    -  highlight = FALSE,
    -  stepPlot = FALSE,
    -  drawPoints = FALSE,
    -  secondAxis = FALSE,
    -  timeSteph5 = "hourly",
    -  mcYearh5 = NULL,
    -  tablesh5 = c("areas", "links"),
    -  language = "en",
    -  hidden = NULL,
    -  ...
    -)
    -
    -# S3 method for antaresData
    -plot(
    -  x,
    -  refStudy = NULL,
    -  table = NULL,
    -  variable = NULL,
    -  elements = NULL,
    -  variable2Axe = NULL,
    -  mcYear = "average",
    -  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    -  dateRange = NULL,
    -  typeConfInt = FALSE,
    -  confInt = 0,
    -  minValue = NULL,
    -  maxValue = NULL,
    -  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
    -  compare = NULL,
    -  compareOpts = list(),
    -  interactive = getInteractivity(),
    -  colors = NULL,
    -  main = NULL,
    -  ylab = NULL,
    -  legend = TRUE,
    -  legendItemsPerRow = 5,
    -  colorScaleOpts = colorScaleOptions(20),
    -  width = NULL,
    -  height = NULL,
    -  xyCompare = c("union", "intersect"),
    -  h5requestFiltering = list(),
    -  highlight = FALSE,
    -  stepPlot = FALSE,
    -  drawPoints = FALSE,
    -  secondAxis = FALSE,
    -  timeSteph5 = "hourly",
    -  mcYearh5 = NULL,
    -  tablesh5 = c("areas", "links"),
    -  language = "en",
    -  hidden = NULL,
    -  ...
    -)
    -
    -# S3 method for simOptions
    -plot(
    -  x,
    -  refStudy = NULL,
    -  table = NULL,
    -  variable = NULL,
    -  elements = NULL,
    -  variable2Axe = NULL,
    -  mcYear = "average",
    -  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    -  dateRange = NULL,
    -  typeConfInt = FALSE,
    -  confInt = 0,
    -  minValue = NULL,
    -  maxValue = NULL,
    -  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
    -  compare = NULL,
    -  compareOpts = list(),
    -  interactive = getInteractivity(),
    -  colors = NULL,
    -  main = NULL,
    -  ylab = NULL,
    -  legend = TRUE,
    -  legendItemsPerRow = 5,
    -  colorScaleOpts = colorScaleOptions(20),
    -  width = NULL,
    -  height = NULL,
    -  xyCompare = c("union", "intersect"),
    -  h5requestFiltering = list(),
    -  highlight = FALSE,
    -  stepPlot = FALSE,
    -  drawPoints = FALSE,
    -  secondAxis = FALSE,
    -  timeSteph5 = "hourly",
    -  mcYearh5 = NULL,
    -  tablesh5 = c("areas", "links"),
    -  language = "en",
    -  hidden = NULL,
    -  ...
    -)
    -
    -# S3 method for list
    -plot(
    -  x,
    -  refStudy = NULL,
    -  table = NULL,
    -  variable = NULL,
    -  elements = NULL,
    -  variable2Axe = NULL,
    -  mcYear = "average",
    -  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    -  dateRange = NULL,
    -  typeConfInt = FALSE,
    -  confInt = 0,
    -  minValue = NULL,
    -  maxValue = NULL,
    -  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
    -  compare = NULL,
    -  compareOpts = list(),
    -  interactive = getInteractivity(),
    -  colors = NULL,
    -  main = NULL,
    -  ylab = NULL,
    -  legend = TRUE,
    -  legendItemsPerRow = 5,
    -  colorScaleOpts = colorScaleOptions(20),
    -  width = NULL,
    -  height = NULL,
    -  xyCompare = c("union", "intersect"),
    -  h5requestFiltering = list(),
    -  highlight = FALSE,
    -  stepPlot = FALSE,
    -  drawPoints = FALSE,
    -  secondAxis = FALSE,
    -  timeSteph5 = "hourly",
    -  mcYearh5 = NULL,
    -  tablesh5 = c("areas", "links"),
    -  language = "en",
    -  hidden = NULL,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    x

    Object of class antaresData. Alternatively, it can be a list of +

    +
    tsPlot(
    +  x,
    +  refStudy = NULL,
    +  table = NULL,
    +  variable = NULL,
    +  elements = NULL,
    +  variable2Axe = NULL,
    +  mcYear = "average",
    +  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    +  dateRange = NULL,
    +  typeConfInt = FALSE,
    +  confInt = 0,
    +  minValue = NULL,
    +  maxValue = NULL,
    +  aggregate = c("none", "mean", "sum", "mean by variable", "sum by variable"),
    +  compare = NULL,
    +  compareOpts = list(),
    +  interactive = getInteractivity(),
    +  colors = NULL,
    +  main = NULL,
    +  ylab = NULL,
    +  legend = TRUE,
    +  legendItemsPerRow = 5,
    +  colorScaleOpts = colorScaleOptions(20),
    +  width = NULL,
    +  height = NULL,
    +  xyCompare = c("union", "intersect"),
    +  h5requestFiltering = deprecated(),
    +  highlight = FALSE,
    +  stepPlot = FALSE,
    +  drawPoints = FALSE,
    +  secondAxis = FALSE,
    +  timeSteph5 = deprecated(),
    +  mcYearh5 = deprecated(),
    +  tablesh5 = deprecated(),
    +  language = "en",
    +  hidden = NULL,
    +  ...
    +)
    +
    +# S3 method for antaresData
    +plot(
    +  x,
    +  refStudy = NULL,
    +  table = NULL,
    +  variable = NULL,
    +  elements = NULL,
    +  variable2Axe = NULL,
    +  mcYear = "average",
    +  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    +  dateRange = NULL,
    +  typeConfInt = FALSE,
    +  confInt = 0,
    +  minValue = NULL,
    +  maxValue = NULL,
    +  aggregate = c("none", "mean", "sum", "mean by variable", "sum by variable"),
    +  compare = NULL,
    +  compareOpts = list(),
    +  interactive = getInteractivity(),
    +  colors = NULL,
    +  main = NULL,
    +  ylab = NULL,
    +  legend = TRUE,
    +  legendItemsPerRow = 5,
    +  colorScaleOpts = colorScaleOptions(20),
    +  width = NULL,
    +  height = NULL,
    +  xyCompare = c("union", "intersect"),
    +  h5requestFiltering = deprecated(),
    +  highlight = FALSE,
    +  stepPlot = FALSE,
    +  drawPoints = FALSE,
    +  secondAxis = FALSE,
    +  timeSteph5 = deprecated(),
    +  mcYearh5 = deprecated(),
    +  tablesh5 = deprecated(),
    +  language = "en",
    +  hidden = NULL,
    +  ...
    +)
    +
    +# S3 method for simOptions
    +plot(
    +  x,
    +  refStudy = NULL,
    +  table = NULL,
    +  variable = NULL,
    +  elements = NULL,
    +  variable2Axe = NULL,
    +  mcYear = "average",
    +  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    +  dateRange = NULL,
    +  typeConfInt = FALSE,
    +  confInt = 0,
    +  minValue = NULL,
    +  maxValue = NULL,
    +  aggregate = c("none", "mean", "sum", "mean by variable", "sum by variable"),
    +  compare = NULL,
    +  compareOpts = list(),
    +  interactive = getInteractivity(),
    +  colors = NULL,
    +  main = NULL,
    +  ylab = NULL,
    +  legend = TRUE,
    +  legendItemsPerRow = 5,
    +  colorScaleOpts = colorScaleOptions(20),
    +  width = NULL,
    +  height = NULL,
    +  xyCompare = c("union", "intersect"),
    +  h5requestFiltering = deprecated(),
    +  highlight = FALSE,
    +  stepPlot = FALSE,
    +  drawPoints = FALSE,
    +  secondAxis = FALSE,
    +  timeSteph5 = deprecated(),
    +  mcYearh5 = deprecated(),
    +  tablesh5 = deprecated(),
    +  language = "en",
    +  hidden = NULL,
    +  ...
    +)
    +
    +# S3 method for list
    +plot(
    +  x,
    +  refStudy = NULL,
    +  table = NULL,
    +  variable = NULL,
    +  elements = NULL,
    +  variable2Axe = NULL,
    +  mcYear = "average",
    +  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
    +  dateRange = NULL,
    +  typeConfInt = FALSE,
    +  confInt = 0,
    +  minValue = NULL,
    +  maxValue = NULL,
    +  aggregate = c("none", "mean", "sum", "mean by variable", "sum by variable"),
    +  compare = NULL,
    +  compareOpts = list(),
    +  interactive = getInteractivity(),
    +  colors = NULL,
    +  main = NULL,
    +  ylab = NULL,
    +  legend = TRUE,
    +  legendItemsPerRow = 5,
    +  colorScaleOpts = colorScaleOptions(20),
    +  width = NULL,
    +  height = NULL,
    +  xyCompare = c("union", "intersect"),
    +  h5requestFiltering = deprecated(),
    +  highlight = FALSE,
    +  stepPlot = FALSE,
    +  drawPoints = FALSE,
    +  secondAxis = FALSE,
    +  timeSteph5 = deprecated(),
    +  mcYearh5 = deprecated(),
    +  tablesh5 = deprecated(),
    +  language = "en",
    +  hidden = NULL,
    +  ...
    +)
    +
    + +
    +

    Arguments

    +
    x
    +

    Object of class antaresData. Alternatively, it can be a list of antaresData objects. In this case, one chart is created for each -object. Can also be opts object from h5 file or list of opts object from h5 file.

    refStudy

    An object of class antaresData created with function -readAntares containing data for areas and or -districts. Can also contains an opts who refer to a h5 file.

    table

    Name of the table to display when x is an antaresDataList -object.

    variable

    Name of the variable to plot. If this argument is missing, then the +object. Can also be opts object from h5 file or list of opts object from h5 file.

    + + +
    refStudy
    +

    An object of class antaresData created with function +[antaresRead::readAntares()] containing data for areas and or +districts. Can also contains an opts who refer to a h5 file.

    + + +
    table
    +

    Name of the table to display when x is an antaresDataList +object.

    + + +
    variable
    +

    Name of the variable to plot. If this argument is missing, then the function starts a shiny gadget that let the user choose the variable to represent. When the user clicks on the "Done" button", the graphic is -returned by the function.

    elements

    Vector of "element" names indicating for which elements of 'x' should the +returned by the function.

    + + +
    elements
    +

    Vector of "element" names indicating for which elements of 'x' should the variable be plotted. For instance if the input data contains areas, then this parameter should be a vector of area names. If data contains clusters data, this parameter has to be the concatenation of the area name and the cluster name, separated by " > ". This is to prevent confusion -when two clusters from different areas have the same name.

    variable2Axe

    character, variables on second axis.

    mcYear

    If x, contains multiple Monte-Carlo scenarios, this parameter +when two clusters from different areas have the same name.

    + + +
    variable2Axe
    +

    character, variables on second axis.

    + + +
    mcYear
    +

    If x, contains multiple Monte-Carlo scenarios, this parameter determine which scenario is displayed. Must be an integer representing the index of the scenario or the word "average". In this case data are -averaged.

    type

    Type of plot to draw. "ts" creates a time series plot, "barplot" creates +averaged.

    + + +
    type
    +

    Type of plot to draw. "ts" creates a time series plot, "barplot" creates a barplot with one bar per element representing the average value of the variable for this element. "monotone" draws the monotone curve of the -variable for each element.

    dateRange

    A vector of two dates. Only data points between these two dates are -displayed. If NULL, then all data is displayed.

    typeConfInt

    logical. If multiple Monte Carlo scenarios are present in -the input data, see all curves (FALSE, Default), or mean and confidence interval (TRUE)

    confInt

    Number between 0 and 1 indicating the size of the confidence interval to +variable for each element.

    + + +
    dateRange
    +

    A vector of two dates. Only data points between these two dates are +displayed. If NULL, then all data is displayed.

    + + +
    typeConfInt
    +

    logical. If multiple Monte Carlo scenarios are present in +the input data, see all curves (FALSE, Default), or mean and confidence interval (TRUE)

    + + +
    confInt
    +

    Number between 0 and 1 indicating the size of the confidence interval to display. If it equals to 0, then confidence interval is not computed nor displayed. Used only when multiple Monte Carlo scenarios are present in -the input data.

    minValue

    Only used if parameter type is "density" or "cdf". If this parameter +the input data.

    + + +
    minValue
    +

    Only used if parameter type is "density" or "cdf". If this parameter is set, all values that are less than minValue are removed from the graphic. This is useful to deal with variables containing a few extreme values (generally cost and price variables). If minValue is unset, -all values are displayed.

    maxValue

    Only used if parameter type is "density" or "cdf". If this parameter +all values are displayed.

    + + +
    maxValue
    +

    Only used if parameter type is "density" or "cdf". If this parameter is set, all values not in [-minValue, maxValue] are removed from the graphic. This is useful to deal with variables containing a few extreme values (generally cost and price variables). If maxValue is 0 or unset, all -values are displayed.

    aggregate

    When multiple elements are selected, should the data be aggregated. If +values are displayed.

    + + +
    aggregate
    +

    When multiple elements are selected, should the data be aggregated. If "none", each element is represented separetly. If "mean" values are -averaged and if "sum" they are added. You can also compute mean ans sum by areas.

    compare

    An optional character vector containing names of parameters. When it is set, +averaged and if "sum" they are added. You can also compute mean and sum by variable.

    + + +
    compare
    +

    An optional character vector containing names of parameters. When it is set, two charts are outputed with their own input controls. Alternatively, it can be a named list with names corresponding to parameter names and values being list with the initial values of the given parameter for each chart. See details - if you are drawing a map.

    compareOpts

    List of options that indicates the number of charts to create and their + if you are drawing a map.

    + + +
    compareOpts
    +

    List of options that indicates the number of charts to create and their position. Check out the documentation of -compareOptions to see available options.

    interactive

    LogicalValue. If TRUE, then a shiny gadget is launched that lets -the user interactively choose the areas or districts to display.

    colors

    Vector of colors

    main

    Title of the graph.

    ylab

    Label of the Y axis.

    legend

    Logical value indicating if a legend should be drawn. This argument is +[manipulateWidget::compareOptions] to see available options.

    + + +
    interactive
    +

    LogicalValue. If TRUE, then a shiny gadget is launched that lets +the user interactively choose the areas or districts to display.

    + + +
    colors
    +

    Vector of colors

    + + +
    main
    +

    Title of the graph.

    + + +
    ylab
    +

    Label of the Y axis.

    + + +
    legend
    +

    Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with -prodStackLegend

    legendItemsPerRow

    Number of elements to put in each row of the legend.

    colorScaleOpts

    A list of parameters that control the creation of color scales. It is used -only for heatmaps. See colorScaleOptions() for available -parameters.

    width

    Width of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    height

    Height of the graph expressed in pixels or in percentage of -the parent element. For instance "500px" and "100%" are valid values.

    xyCompare

    Use when you compare studies, can be "union" or "intersect". If union, all +[prodStackLegend()]

    + + +
    legendItemsPerRow
    +

    Number of elements to put in each row of the legend.

    + + +
    colorScaleOpts
    +

    A list of parameters that control the creation of color scales. It is used +only for heatmaps. See [colorScaleOptions()] for available +parameters.

    + + +
    width
    +

    Width of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    height
    +

    Height of the graph expressed in pixels or in percentage of +the parent element. For instance "500px" and "100%" are valid values.

    + + +
    xyCompare
    +

    Use when you compare studies, can be "union" or "intersect". If union, all of mcYears in one of studies will be selectable. If intersect, only mcYears in all -studies will be selectable.

    h5requestFiltering

    Contains arguments used by default for h5 request, -typically h5requestFiltering = list(mcYears = 2)

    highlight

    highlight curve when mouse over

    stepPlot

    boolean, step style for curves.

    drawPoints

    boolean, add points on graph

    secondAxis

    add second axis to graph

    timeSteph5

    character timeStep to read in h5 file. Only for Non interactive mode.

    mcYearh5

    numeric mcYear to read for h5. Only for Non interactive mode.

    tablesh5

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    language

    character language use for label. Defaut to 'en'. Can be 'fr'.

    hidden

    logical Names of input to hide. Defaut to NULL

    ...

    Other arguments for manipulateWidget

    - -

    Value

    - -

    The function returns an object of class "htmlwidget". It is generated by +studies will be selectable.

    + + +
    h5requestFiltering
    +

    Contains arguments used by default for h5 request, +typically h5requestFiltering = list(mcYears = 2)

    + + +
    highlight
    +

    highlight curve when mouse over

    + + +
    stepPlot
    +

    boolean, step style for curves.

    + + +
    drawPoints
    +

    boolean, add points on graph

    + + +
    secondAxis
    +

    add second axis to graph

    + + +
    timeSteph5
    +

    character timeStep to read in h5 file. Only for Non interactive mode.

    + + +
    mcYearh5
    +

    numeric mcYear to read for h5. Only for Non interactive mode.

    + + +
    tablesh5
    +

    character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

    + + +
    language
    +

    character language use for label. Defaut to 'en'. Can be 'fr'.

    + + +
    hidden
    +

    logical Names of input to hide. Defaut to NULL

    + + +
    ...
    +

    Other arguments for manipulateWidget

    + +
    +
    +

    Value

    + + +

    The function returns an object of class "htmlwidget". It is generated by package highcharter if time step is annual or by dygraphs for any other time step.It can be directly displayed in the viewer or be stored in a variable for later use.

    -

    Details

    - +
    +
    +

    Details

    If the input data contains several Monte-Carlo scenarios, the function will display the evolution of the average value. Moreover it will represent a 95

    If the input data has a annual time step, the function creates a barplot instead of a line chart.

    -

    compare argument can take following values :

      -
    • "mcYear"

    • +

      compare argument can take following values :

      • "mcYear"

      • "main"

      • "variable"

      • "type"

      • @@ -528,36 +459,33 @@

        Details
      • "stepPlot"

      • "drawPoints"

      • "secondAxis"

      • -

      - +
    -

    Examples

    -
    
    +    
    +

    Examples

    + +
    +
    -
    - +
    - - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 00000000..b20874d9 --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,99 @@ + + + + /404.html + + + /articles/antaresViz.html + + + /articles/article/creating_new_layouts.html + + + /articles/index.html + + + /authors.html + + + /index.html + + + /LICENSE-text.html + + + /news/index.html + + + /reference/addShadows.html + + + /reference/exchangesStack.html + + + /reference/index.html + + + /reference/libs/minichart-0.2.2/doc/index.html + + + /reference/libs/minichart-0.2.2/doc/introduction.html + + + /reference/libs/minichart-0.2.2/html/00Index.html + + + /reference/limitSizeGraph.html + + + /reference/mapLayout.html + + + /reference/modRpart.html + + + /reference/modXY.html + + + /reference/placeGeoPoints-shiny.html + + + /reference/plot.mapLayout.html + + + /reference/plotMap.html + + + /reference/plotMapLayout.html + + + /reference/plotMapOptions.html + + + /reference/plotThermalGroupCapacities.html + + + /reference/plotXY.html + + + /reference/prodStack.html + + + /reference/runAppAntaresViz.html + + + /reference/savePlotAsPng.html + + + /reference/setInteractivity.html + + + /reference/stackMap.html + + + /reference/tsLegend.html + + + /reference/tsPlot.html + + diff --git a/man/exchangesStack.Rd b/man/exchangesStack.Rd index 33eb6494..43969f96 100644 --- a/man/exchangesStack.Rd +++ b/man/exchangesStack.Rd @@ -30,12 +30,12 @@ exchangesStack( width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), + h5requestFiltering = deprecated(), stepPlot = FALSE, drawPoints = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, refStudy = NULL, @@ -56,7 +56,7 @@ setExchangesStackAlias( } \arguments{ \item{x}{Object of class \code{antaresData} created with function -\code{\link[antaresRead]{readAntares}}. It is required to contain link data. +[antaresRead::readAntares]. It is required to contain link data. If it also contains area data with column `ROW BAL.`, then exchanges with the rest of the world are also displayed on the chart.} @@ -98,18 +98,18 @@ list with the initial values of the given parameter for each chart. See details \item{compareOpts}{List of options that indicates the number of charts to create and their position. Check out the documentation of -\code{\link[manipulateWidget]{compareOptions}} to see available options.} +[manipulateWidget::compareOptions] to see available options.} \item{interactive}{LogicalValue. If \code{TRUE}, then a shiny gadget is launched that lets the user interactively choose the areas or districts to display.} \item{legend}{Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with -\code{\link{prodStackLegend}}} +[prodStackLegend()]} \item{legendId}{Id of the legend linked to the graph. This argument is usefull when one wants to create a shared legend with -\code{\link{prodStackLegend}}} +[prodStackLegend()]} \item{groupId}{Parameter that can be used to synchronize the horizontal zoom of multiple charts. All charts that need to be synchronized must @@ -147,19 +147,19 @@ typically h5requestFiltering = list(links = getLinks(areas = myArea), mcYears = \item{hidden}{\code{logical} Names of input to hide. Defaut to NULL} \item{refStudy}{An object of class \code{antaresData} created with function -\code{\link[antaresRead]{readAntares}} containing data for areas and or +[antaresRead::readAntares()] containing data for areas and or districts. Can also contains an opts who refer to a h5 file.} -\item{...}{Other arguments for \code{\link{manipulateWidget}}} +\item{...}{Other arguments for [manipulateWidget::manipulateWidget]} \item{name}{name of the stack to create or update} -\item{variables}{A named list of expressions created with \code{\link[base:list]{alist}}. The +\item{variables}{A named list of expressions created with [base::alist]. The name of each element is the name of the variable to draw in the stacked graph. The element itself is an expression explaining how to compute the variable (see examples).} -\item{lines}{A named list of expressions created with \code{\link[base:list]{alist}} +\item{lines}{A named list of expressions created with [base::alist] indicating how to compute the curves to display on top of the stacked graph. It should be \code{NULL} if there is no curve to trace or if parameter \code{variables} is an alias.} @@ -198,50 +198,46 @@ Compare argument can take following values : } } \examples{ -\dontrun{ -mydata <- readAntares(links = "all", timeStep = "daily") -exchangesStack(mydata) - -# Also display exchanges with the rest of the world -mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") -exchangesStack(mydata) - -# Use compare : -exchangesStack(mydata, compare = "mcYear") -exchangesStack(mydata, compare = "area") -exchangesStack(mydata, compare = "unit") -exchangesStack(mydata, compare = "legend") -# Compare studies with refStudy argument -exchangesStack(x = myData1, refStudy = myData2) -exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) -exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) -exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) - -# Use h5 opts -# Set path of simulaiton -setSimulationPath(path = path1) - -# Convert your study in h5 format -writeAntaresH5(path = mynewpath) - -# Redefine sim path with h5 file -opts <- setSimulationPath(path = mynewpath) -exchangesStack(x = opts) - -# Compare elements in a single study -exchangesStack(x = opts, .compare = "mcYear") - -# Compare 2 studies -exchangesStack(x = list(opts, opts2)) - -# Compare 2 studies with argument refStudy -exchangesStack(x = opts, refStudy = opts2) -exchangesStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea) -exchangesStack(x = opts, refStudy = opts2, h5requestFiltering = list( -areas = getAreas(select = "a"), -links = getLinks(areas = myArea), -mcYears = myMcYear)) - +\donttest{ +library(antaresRead) +# with study test for example (study is in package antaresRead) +sourcedir <- system.file("testdata", package = "antaresRead") + +# untar study in temp dir +path_latest <- file.path(tempdir(), "latest") +untar(file.path(sourcedir, "antares-test-study.tar.gz"), exdir = path_latest) + +study_path <- file.path(path_latest, "test_case") + +# set path to your Antares simulation +opts <- setSimulationPath(study_path) + +if(interactive()){ + mydata <- readAntares(links = "all", timeStep = "daily") + exchangesStack(mydata) + + # Also display exchanges with the rest of the world + mydata <- readAntares(areas = "all", links = "all", timeStep = "daily") + exchangesStack(mydata) + + # Use compare : + exchangesStack(mydata, compare = "mcYear") + exchangesStack(mydata, compare = "area") + exchangesStack(mydata, compare = "unit") + exchangesStack(mydata, compare = "legend") + # Compare studies with refStudy argument + exchangesStack(x = myData1, refStudy = myData2) + exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE) + exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1) + exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE) + + + # Compare 2 studies + exchangesStack(x = list(opts, opts)) + + # Compare 2 studies with argument refStudy + exchangesStack(x = opts, refStudy = opts) +} } } diff --git a/man/mapLayout.Rd b/man/mapLayout.Rd index f7cb68ef..19fac233 100644 --- a/man/mapLayout.Rd +++ b/man/mapLayout.Rd @@ -12,13 +12,13 @@ mapLayout( ) } \arguments{ -\item{layout}{object returned by function \code{\link[antaresRead]{readLayout}}} +\item{layout}{object returned by function [antaresRead::readLayout()]} \item{what}{Either "areas" or "districts". Indicates what type of object to place on the map.} -\item{map}{An optional \code{\link[sp]{SpatialPolygons}} or -\code{\link[sp:SpatialPolygons]{SpatialPolygonsDataFrame}} object. See \code{\link[spMaps:spMaps]{getSpMaps}}} +\item{map}{An optional [sp::SpatialPolygons()] or +[sp::SpatialPolygonsDataFrame()] object. See [spMaps::getSpMaps()]} \item{map_builder}{\code{logical} Add inputs for build custom map ? Defaut to TRUE.} } @@ -33,7 +33,7 @@ study. The result should then be saved in an external file and be reused. } \details{ With \code{map_builder} option, you can build a quiet custom map using \code{spMaps} package. -This package help you to build \code{\link[sp:SpatialPolygons]{SpatialPolygonsDataFrame}} on Europe. +This package help you to build [sp::SpatialPolygons()] on Europe. Moreover, you can use two options in the module : \itemize{ @@ -61,5 +61,5 @@ save(ml, file = "ml.rda") } \seealso{ -\code{\link{plotMapLayout}} +[plotMapLayout()] } diff --git a/man/modRpart.Rd b/man/modRpart.Rd index efd6325a..c6ec5684 100644 --- a/man/modRpart.Rd +++ b/man/modRpart.Rd @@ -7,7 +7,7 @@ modRpart(data) } \arguments{ -\item{data}{an antaresData after use of \code{\link[antaresProcessing]{mergeAllAntaresData}}} +\item{data}{an antaresData after use of [antaresProcessing::mergeAllAntaresData]} } \description{ Make rpart from antares data diff --git a/man/plot.mapLayout.Rd b/man/plot.mapLayout.Rd index b1584d02..bc5d02d4 100644 --- a/man/plot.mapLayout.Rd +++ b/man/plot.mapLayout.Rd @@ -31,7 +31,7 @@ ) } \arguments{ -\item{x}{Object created with function \code{\link{mapLayout}}} +\item{x}{Object created with function [mapLayout()]} \item{colAreas}{Vector of colors for areas. By default, the colors used in the Antares software are used.} @@ -92,12 +92,12 @@ the parent element. For instance "500px" and "100\%" are valid values.} \value{ The function generates an \code{htmlwidget} of class \code{leaflet}. It can be stored in a variable and modified with package - \code{\link[leaflet]{leaflet}} + [leaflet::leaflet()] } \description{ This method can be used to visualize the network of an antares study. It generates an interactive map with a visual representaiton of a -map layout created with function \code{\link{mapLayout}}. +map layout created with function [mapLayout()]. } \examples{ \dontrun{ diff --git a/man/plotMap.Rd b/man/plotMap.Rd index f31c3b6d..b671b0b7 100644 --- a/man/plotMap.Rd +++ b/man/plotMap.Rd @@ -33,10 +33,10 @@ plotMap( height = NULL, dateRange = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + h5requestFiltering = deprecated(), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), sizeMiniPlot = FALSE, language = "en", hidden = NULL, @@ -45,15 +45,15 @@ plotMap( } \arguments{ \item{x}{Object of class \code{antaresDataList} created with -\code{\link[antaresRead]{readAntares}} and containing areas and links data. +[antaresRead::readAntares()] and containing areas and links data. It can be a list of \code{antaresData} objects. In this case, one chart is created for each object.} \item{refStudy}{An object of class \code{antaresData} created with function -\code{\link[antaresRead]{readAntares}} containing data for areas and or +[antaresRead::readAntares()] containing data for areas and or districts. Can also contains an opts who refer to a h5 file.} -\item{mapLayout}{Object created with function \code{\link{mapLayout}}} +\item{mapLayout}{Object created with function [antaresViz::mapLayout()]} \item{colAreaVar}{Name of a variable present in \code{x$areas}. The values of this variable are represented by the color of the areas on the map. If \code{"none"}, then @@ -113,7 +113,7 @@ averaged.} \item{typeSizeAreaVars}{\code{logical}. Select \code{sizeAreaVars} using alias ? Default to \code{FALSE}} \item{aliasSizeAreaVars}{If \code{typeSizeAreaVars} is set to TRUE, name of alias. You can find the list -of alias with the function \code{\link[antaresRead]{showAliases}}} +of alias with the function [antaresRead::showAliases()]} \item{compare}{An optional character vector containing names of parameters. When it is set, two charts are outputed with their own input controls. Alternatively, it can @@ -123,13 +123,13 @@ list with the initial values of the given parameter for each chart. See details \item{compareOpts}{List of options that indicates the number of charts to create and their position. Check out the documentation of -\code{\link[manipulateWidget]{compareOptions}} to see available options.} +[manipulateWidget::compareOptions] to see available options.} \item{interactive}{LogicalValue. If \code{TRUE}, then a shiny gadget is launched that lets the user interactively choose the areas or districts to display.} \item{options}{List of parameters that override some default visual settings. See the -help of \code{\link{plotMapOptions}}.} +help of [antaresViz::plotMapOptions()].} \item{width}{Width of the graph expressed in pixels or in percentage of the parent element. For instance "500px" and "100\%" are valid values.} @@ -159,7 +159,7 @@ typically h5requestFiltering = list(mcYears = 3)} \item{hidden}{\code{logical} Names of input to hide. Defaut to NULL} -\item{...}{Other arguments for \code{\link{manipulateWidget}}} +\item{...}{Other arguments for [manipulateWidget::manipulateWidget]} } \value{ An htmlwidget of class "leaflet". It can be modified with package diff --git a/man/plotMapLayout.Rd b/man/plotMapLayout.Rd index 44faf3e8..013c0b56 100644 --- a/man/plotMapLayout.Rd +++ b/man/plotMapLayout.Rd @@ -7,7 +7,7 @@ plotMapLayout(mapLayout) } \arguments{ -\item{mapLayout}{object returned by function \code{\link{mapLayout}}} +\item{mapLayout}{object returned by function [mapLayout()]} } \description{ Visualize mapLayout output. @@ -27,5 +27,5 @@ plotMapLayout(ml) } \seealso{ -\code{\link{mapLayout}} +[mapLayout()] } diff --git a/man/plotMapOptions.Rd b/man/plotMapOptions.Rd index e02d1c96..0b26da09 100644 --- a/man/plotMapOptions.Rd +++ b/man/plotMapOptions.Rd @@ -111,7 +111,7 @@ A list with the values of the different graphical parameters. } \description{ These functions get and set options that control some graphical aspects -of maps created with \code{\link{plotMap}}. +of maps created with [plotMap()]. } \examples{ \dontrun{ diff --git a/man/prodStack.Rd b/man/prodStack.Rd index deb3afd9..7e548cbc 100644 --- a/man/prodStack.Rd +++ b/man/prodStack.Rd @@ -40,12 +40,12 @@ prodStack( width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), + h5requestFiltering = deprecated(), stepPlot = FALSE, drawPoints = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, refStudy = NULL, @@ -55,7 +55,7 @@ prodStack( \arguments{ \item{name}{name of the stack to create or update} -\item{variables}{A named list of expressions created with \code{\link[base:list]{alist}}. The +\item{variables}{A named list of expressions created with [base::alist]. The name of each element is the name of the variable to draw in the stacked graph. The element itself is an expression explaining how to compute the variable (see examples).} @@ -64,7 +64,7 @@ variable (see examples).} \code{variables} is an alias, then this argument should be \code{NULL} in order to use default colors.} -\item{lines}{A named list of expressions created with \code{\link[base:list]{alist}} +\item{lines}{A named list of expressions created with [base::alist] indicating how to compute the curves to display on top of the stacked graph. It should be \code{NULL} if there is no curve to trace or if parameter \code{variables} is an alias.} @@ -79,7 +79,7 @@ should be \code{NULL} if there is no curve to trace or if parameter \code{prodStackAliases}.} \item{x}{An object of class \code{antaresData} created with function -\code{\link[antaresRead]{readAntares}} containing data for areas and or +[antaresRead::readAntares()] containing data for areas and or districts. it can be a list of \code{antaresData} objects. In this case, one chart is created for each object. Can also contains opts who refer to a h5 file or list of opts.} @@ -116,18 +116,18 @@ list with the initial values of the given parameter for each chart. See details \item{compareOpts}{List of options that indicates the number of charts to create and their position. Check out the documentation of -\code{\link[manipulateWidget]{compareOptions}} to see available options.} +[manipulateWidget::compareOptions] to see available options.} \item{interactive}{LogicalValue. If \code{TRUE}, then a shiny gadget is launched that lets the user interactively choose the areas or districts to display.} \item{legend}{Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with -\code{\link{prodStackLegend}}} +[prodStackLegend()]} \item{legendId}{Id of the legend linked to the graph. This argument is usefull when one wants to create a shared legend with -\code{\link{prodStackLegend}}} +[prodStackLegend()]} \item{groupId}{Parameter that can be used to synchronize the horizontal zoom of multiple charts. All charts that need to be synchronized must @@ -165,10 +165,10 @@ typically h5requestFiltering = list(areas = "a", mcYears = 2)} \item{hidden}{\code{logical} Names of input to hide. Defaut to NULL} \item{refStudy}{An object of class \code{antaresData} created with function -\code{\link[antaresRead]{readAntares}} containing data for areas and or +[antaresRead::readAntares()] containing data for areas and or districts. Can also contains an opts who refer to a h5 file.} -\item{...}{Other arguments for \code{\link{manipulateWidget}}} +\item{...}{Other arguments for [manipulateWidget::manipulateWidget]} } \value{ \code{prodStack} returns an interactive html graphic. If argument @@ -279,5 +279,5 @@ mcYears = 2)) } \seealso{ -\code{\link{prodStackLegend}} +[prodStackLegend()] } diff --git a/man/savePlotAsPng.Rd b/man/savePlotAsPng.Rd index 734076ba..2a647bf3 100644 --- a/man/savePlotAsPng.Rd +++ b/man/savePlotAsPng.Rd @@ -15,7 +15,7 @@ savePlotAsPng(plot, file = "Rplot.png", width = 600, height = 480, ...) \item{height}{height of the output file} -\item{...}{Other parameters passed to function \code{\link[webshot]{webshot}}} +\item{...}{Other parameters passed to function [webshot::webshot]} } \value{ The function only creates the required file. Nothing is returned diff --git a/man/stackMap.Rd b/man/stackMap.Rd index 4a26f650..824e2665 100644 --- a/man/stackMap.Rd +++ b/man/stackMap.Rd @@ -9,7 +9,7 @@ stackMap(x, mapLayout) \arguments{ \item{x}{\code{antaresDataList} antaresDataList contian areas ans links.} -\item{mapLayout}{Object created with function \code{\link{mapLayout}}} +\item{mapLayout}{Object created with function [mapLayout()]} } \description{ plot stack and map diff --git a/man/tsLegend.Rd b/man/tsLegend.Rd index bb6365f2..ac241f04 100644 --- a/man/tsLegend.Rd +++ b/man/tsLegend.Rd @@ -30,7 +30,7 @@ tsLegend(labels, colors, types = "line", legendItemsPerRow = 5, legendId = "") \item{legendId}{Id of the legend linked to the graph. This argument is usefull when one wants to create a shared legend with -\code{\link{prodStackLegend}}} +[prodStackLegend()]} \item{language}{\code{character} language use for label. Defaut to 'en'. Can be 'fr'.} diff --git a/man/tsPlot.Rd b/man/tsPlot.Rd index 03755d84..87fc3f33 100644 --- a/man/tsPlot.Rd +++ b/man/tsPlot.Rd @@ -34,14 +34,14 @@ tsPlot( width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), + h5requestFiltering = deprecated(), highlight = FALSE, stepPlot = FALSE, drawPoints = FALSE, secondAxis = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, ... @@ -74,14 +74,14 @@ tsPlot( width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), + h5requestFiltering = deprecated(), highlight = FALSE, stepPlot = FALSE, drawPoints = FALSE, secondAxis = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, ... @@ -114,14 +114,14 @@ tsPlot( width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), + h5requestFiltering = deprecated(), highlight = FALSE, stepPlot = FALSE, drawPoints = FALSE, secondAxis = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, ... @@ -154,14 +154,14 @@ tsPlot( width = NULL, height = NULL, xyCompare = c("union", "intersect"), - h5requestFiltering = list(), + h5requestFiltering = deprecated(), highlight = FALSE, stepPlot = FALSE, drawPoints = FALSE, secondAxis = FALSE, - timeSteph5 = "hourly", - mcYearh5 = NULL, - tablesh5 = c("areas", "links"), + timeSteph5 = deprecated(), + mcYearh5 = deprecated(), + tablesh5 = deprecated(), language = "en", hidden = NULL, ... @@ -173,7 +173,7 @@ tsPlot( object. Can also be opts object from h5 file or list of opts object from h5 file.} \item{refStudy}{An object of class \code{antaresData} created with function -\code{\link[antaresRead]{readAntares}} containing data for areas and or +[antaresRead::readAntares()] containing data for areas and or districts. Can also contains an opts who refer to a h5 file.} \item{table}{Name of the table to display when \code{x} is an \code{antaresDataList} @@ -238,7 +238,7 @@ list with the initial values of the given parameter for each chart. See details \item{compareOpts}{List of options that indicates the number of charts to create and their position. Check out the documentation of -\code{\link[manipulateWidget]{compareOptions}} to see available options.} +[manipulateWidget::compareOptions] to see available options.} \item{interactive}{LogicalValue. If \code{TRUE}, then a shiny gadget is launched that lets the user interactively choose the areas or districts to display.} @@ -251,12 +251,12 @@ the user interactively choose the areas or districts to display.} \item{legend}{Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with -\code{\link{prodStackLegend}}} +[prodStackLegend()]} \item{legendItemsPerRow}{Number of elements to put in each row of the legend.} \item{colorScaleOpts}{A list of parameters that control the creation of color scales. It is used -only for heatmaps. See \code{\link{colorScaleOptions}}() for available +only for heatmaps. See [colorScaleOptions()] for available parameters.} \item{width}{Width of the graph expressed in pixels or in percentage of @@ -290,7 +290,7 @@ typically h5requestFiltering = list(mcYears = 2)} \item{hidden}{\code{logical} Names of input to hide. Defaut to NULL} -\item{...}{Other arguments for \code{\link{manipulateWidget}}} +\item{...}{Other arguments for [manipulateWidget::manipulateWidget]} } \value{ The function returns an object of class "htmlwidget". It is generated by @@ -328,7 +328,6 @@ compare argument can take following values : } \examples{ \dontrun{ -setSimulationPath(path = path1) mydata <- readAntares(areas = "all", timeStep = "hourly") plot(x = mydata) @@ -392,8 +391,9 @@ plot(x = list(opts, opts2)) # Compare 2 studies with argument refStudy plot(x = opts, refStudy = opts2) plot(x = opts, refStudy = opts2, type = "ts", interactive = FALSE, mcYearh5 = 2) -plot(x = opts, refStudy = opts2, type = "ts", dateRange = DR, h5requestFiltering = list( -mcYears = mcYears = mcYearToTest)) +plot(x = opts, refStudy = opts2, type = "ts", + dateRange = DR, + h5requestFiltering = list(mcYears = mcYears = mcYearToTest)) } diff --git a/revdep/README.md b/revdep/README.md index e376c917..0f767ded 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -1,105 +1,73 @@ # Platform -|field |value | -|:--------|:------------------------------| -|version |R version 4.1.0 (2021-05-18) | -|os |Windows 10 x64 (build 19044) | -|system |x86_64, mingw32 | -|ui |RStudio | -|language |(EN) | -|collate |French_France.1252 | -|ctype |French_France.1252 | -|tz |Europe/Paris | -|date |2023-08-31 | -|rstudio |1.4.1103 Wax Begonia (desktop) | -|pandoc |NA | +|field |value | +|:--------|:-----------------------------------| +|version |R version 4.2.2 (2022-10-31 ucrt) | +|os |Windows 10 x64 (build 19045) | +|system |x86_64, mingw32 | +|ui |RStudio | +|language |(EN) | +|collate |French_France.utf8 | +|ctype |French_France.utf8 | +|tz |Europe/Paris | +|date |2024-11-29 | +|rstudio |2023.12.0+369 Ocean Storm (desktop) | +|pandoc |NA | # Dependencies -|package |old |new | | -|:-----------------|:------|:-------|:--| -|antaresViz |0.17.1 |0.17.1 | | -|bit |NA |4.0.5 |* | -|bslib |NA |0.5.1 |* | -|cachem |NA |1.0.7 |* | -|classInt |NA |0.4-9 |* | -|cli |NA |3.6.1 |* | -|colorspace |NA |2.1-0 |* | -|commonmark |NA |1.9.0 |* | -|cpp11 |NA |0.4.6 |* | -|crul |NA |1.4.0 |* | -|curl |NA |5.0.0 |* | -|data.table |NA |1.14.8 |* | -|digest |NA |0.6.31 |* | -|dplyr |NA |1.1.2 |* | -|e1071 |NA |1.7-13 |* | -|evaluate |NA |0.21 |* | -|fansi |NA |1.0.4 |* | -|fastmap |NA |1.1.1 |* | -|fontawesome |NA |0.5.2 |* | -|fs |NA |1.5.2 |* | -|geojson |NA |0.3.5 |* | -|geojsonio |NA |0.11.2 |* | -|geometries |NA |0.2.2 |* | -|ggplot2 |NA |3.4.3 |* | -|gtable |NA |0.3.4 |* | -|highr |NA |0.10 |* | -|hms |NA |1.1.3 |* | -|htmltools |NA |0.5.5 |* | -|htmlwidgets |NA |1.6.2 |* | -|httpuv |NA |1.6.9 |* | -|isoband |NA |0.2.7 |* | -|jsonlite |NA |1.8.4 |* | -|knitr |NA |1.43 |* | -|labeling |NA |0.4.3 |* | -|later |NA |1.3.0 |* | -|leaflet |NA |2.2.0 |* | -|leaflet.providers |NA |1.13.0 |* | -|lubridate |NA |1.9.2 |* | -|openssl |NA |2.0.6 |* | -|pbapply |NA |1.7-2 |* | -|pillar |NA |1.9.0 |* | -|plotly |NA |4.10.2 |* | -|plyr |NA |1.8.8 |* | -|png |NA |0.1-8 |* | -|processx |NA |3.8.1 |* | -|promises |NA |1.2.0.1 |* | -|protolite |NA |2.2.0 |* | -|ps |NA |1.7.5 |* | -|purrr |NA |1.0.1 |* | -|raster |NA |3.6-20 |* | -|Rcpp |NA |1.0.10 |* | -|readr |NA |2.1.4 |* | -|rmarkdown |NA |2.24 |* | -|s2 |NA |1.1.2 |* | -|sass |NA |0.4.5 |* | -|sf |NA |1.0-12 |* | -|sfheaders |NA |0.4.2 |* | -|shiny |NA |1.7.5 |* | -|sourcetools |NA |0.1.7-1 |* | -|stringi |NA |1.7.12 |* | -|stringr |NA |1.5.0 |* | -|sys |NA |3.4.1 |* | -|terra |NA |1.7-23 |* | -|tibble |NA |3.2.1 |* | -|tidyr |NA |1.3.0 |* | -|timechange |NA |0.2.0 |* | -|tinytex |NA |0.46 |* | -|triebeard |NA |0.4.1 |* | -|tzdb |NA |0.3.0 |* | -|units |NA |0.8-1 |* | -|utf8 |NA |1.2.3 |* | -|V8 |NA |4.3.0 |* | -|vctrs |NA |0.6.1 |* | -|viridis |NA |0.6.4 |* | -|viridisLite |NA |0.4.2 |* | -|vroom |NA |1.6.1 |* | -|webshot |NA |0.5.5 |* | -|wk |NA |0.7.2 |* | -|xfun |NA |0.39 |* | -|xts |NA |0.13.1 |* | -|yaml |NA |2.3.7 |* | -|zoo |NA |1.8-12 |* | +|package |old |new |Δ | +|:-----------|:------|:--------|:--| +|antaresViz |0.18.0 |0.18.3 |* | +|askpass |NA |1.2.1 |* | +|bit |NA |4.5.0 |* | +|bit64 |NA |4.5.2 |* | +|bslib |NA |0.8.0 |* | +|cachem |NA |1.1.0 |* | +|cli |NA |3.6.3 |* | +|colorspace |NA |2.1-1 |* | +|commonmark |NA |1.9.2 |* | +|cpp11 |NA |0.5.0 |* | +|crayon |NA |1.5.3 |* | +|crul |NA |1.5.0 |* | +|curl |NA |6.0.1 |* | +|data.table |NA |1.16.2 |* | +|DBI |NA |1.2.3 |* | +|digest |NA |0.6.37 |* | +|e1071 |NA |1.7-16 |* | +|evaluate |NA |1.0.1 |* | +|farver |NA |2.1.2 |* | +|fastmap |NA |1.2.0 |* | +|fontawesome |NA |0.5.3 |* | +|fs |NA |1.6.5 |* | +|glue |NA |1.8.0 |* | +|gtable |NA |0.3.6 |* | +|highr |NA |0.11 |* | +|jqr |NA |1.3.5 |* | +|jsonlite |NA |1.8.9 |* | +|knitr |NA |1.49 |* | +|later |NA |1.4.1 |* | +|openssl |NA |2.2.2 |* | +|promises |NA |1.3.2 |* | +|protolite |NA |2.3.1 |* | +|ps |NA |1.8.1 |* | +|raster |NA |3.6-30 |* | +|Rcpp |NA |1.0.13-1 |* | +|rmarkdown |NA |2.29 |* | +|s2 |NA |1.1.7 |* | +|sf |NA |1.0-19 |* | +|shiny |NA |1.9.1 |* | +|sp |NA |2.1-4 |* | +|stringi |NA |1.8.4 |* | +|sys |NA |3.4.3 |* | +|terra |NA |1.7-83 |* | +|tinytex |NA |0.54 |* | +|V8 |NA |6.0.0 |* | +|withr |NA |3.0.2 |* | +|wk |NA |0.9.4 |* | +|xfun |NA |0.49 |* | +|xts |NA |0.14.1 |* | +|yaml |NA |2.3.10 |* | # Revdeps diff --git a/tests/testthat/test-exchangesStack.R b/tests/testthat/test-exchangesStack.R index 95c8ad85..67284fec 100644 --- a/tests/testthat/test-exchangesStack.R +++ b/tests/testthat/test-exchangesStack.R @@ -524,430 +524,430 @@ test_that("exchangesStack, interactive, x is a list of antaresDataList and refSt expect_equal(dataExListV3g2$negROW[indexHour], 1000) }) -test_that("exchangesStack, no interactive, x and refStudy are optsH5 ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runExchangesStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - myArea <- "a" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - ES1 <- exchangesStack(x = optsH5, interactive = FALSE, area = myArea, dateRange = DR) - dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ES1) - timeEditValue <- "2018-04-25T00:00:00.000Z" - indexHour <- grep(timeEditValue, dataHtmlWidgetES1$hour) - expect_gt(indexHour, 2) - expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 9) - # with refStudy - ESRef <- exchangesStack(x = optsH5, refStudy = optsH5, interactive = FALSE, area = myArea, dateRange = DR) - dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESRef) - expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 0) - # with a new Study H5 test if compare prodStack works - ## create a new folder h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - pathNewH5 <- file.path(pathInitial, "testH5") - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, - overwrite = TRUE, supressMessages = TRUE)) - - - pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) - myLink <- getLinks()[1] - .h5Antares_edit_variable( - pathH5 = pathNewH5File, - link = myLink, - timeId = 1:40, - antVar = "FLOW LIN.", - newValue = 15000 - ) - - optsH5New <- setSimulationPath(path = pathNewH5File) - ES1New <- exchangesStack(x = optsH5New, interactive = FALSE, area = myArea, dateRange = DR) - dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ES1New) - expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 9) - expect_equal(dataHtmlWidgetES1$a_offshore[2], 15000) - ES1NewRef <- exchangesStack(x = optsH5New, refStudy = optsH5, interactive = FALSE, area = myArea, dateRange = DR) - dataHtmlWidgetES1Ref <- .get_data_from_htmlwidget(ES1NewRef) - expect_equal(dataHtmlWidgetES1Ref$nega_offshore[indexHour], 0) - expect_gt(dataHtmlWidgetES1Ref$a_offshore[2], 15000) - } -}) - -test_that("exchangesStack, no interactive, x is a list of optH5 and refStudy are optsH5 ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runExchangesStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - - # with new Studies H5 test if compare prodStack works - ## create new folders h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - - listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") - for (folder in listFolderToCreate){ - pathNewH5 <- file.path(pathInitial, folder) - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings( - writeAntaresH5( - path = pathNewH5, - opts = optsData, - overwrite = TRUE, - supressMessages = TRUE) - ) - } - idWidgetToEdit <- 2 - pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[idWidgetToEdit]]) - pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) - newValueFlow <- 15000 - myLink <- getLinks()[1] - .h5Antares_edit_variable( - pathH5 = pathH5FileToEdit, - link = myLink, - timeId = 1:40, - antVar = "FLOW LIN.", - newValue = newValueFlow - ) - - optsList <- list() - antaresDataListH5 <- list() - for (i in 1:length(listFolderToCreate)){ - pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) - optsList[[i]] <- setSimulationPath(path = pathOptsI) - antaresDataListH5[[i]] <- readAntares(links = myLink) - } - #test the data from h5 - #get the data from the h5 file - antaresDataRef <- readAntares(opts = optsH5, links = myLink) - expect_equal(max(antaresDataListH5[[idWidgetToEdit]]$`FLOW LIN.`), newValueFlow) - expect_equal(max(antaresDataListH5[[1]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) - expect_equal(max(antaresDataListH5[[3]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) - # get the data from htmlwidget - myArea <- "a" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - ESList <- exchangesStack(x = optsList, interactive = FALSE, area = myArea, dateRange = DR) - dataHtmlWidgetES2 <- .get_data_from_htmlwidget(ESList, widgetsNumber = idWidgetToEdit) - expect_equal(dataHtmlWidgetES2$a_offshore[3], newValueFlow) - dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESList, widgetsNumber = 1) - expect_equal(dataHtmlWidgetES1$a_offshore[3], 0) - expect_equal(dataHtmlWidgetES1$nega_offshore[3], 6) - # with refStudy - ESListRef <- exchangesStack(x = optsList, refStudy = optsH5, interactive = FALSE, area = myArea, dateRange = DR) - dataHtmlWidgetES2Ref <- .get_data_from_htmlwidget(ESListRef, widgetsNumber = idWidgetToEdit) - expect_equal(dataHtmlWidgetES2Ref$a_offshore[3] - dataHtmlWidgetES1$nega_offshore[3], newValueFlow) - dataHtmlWidgetES1Ref <- .get_data_from_htmlwidget(ESListRef, widgetsNumber = 1) - expect_equal(dataHtmlWidgetES1Ref$a_offshore[3], 0) - expect_equal(dataHtmlWidgetES1Ref$nega_offshore[3], 0) - } -}) - -test_that("exchangesStack, interactive, x and refStudy are optsH5 ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runExchangesStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - myArea <- "a" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - # no interactive - ES1 <- exchangesStack(x = optsH5, - interactive = FALSE, - area = myArea, - dateRange = DR, - mcYearh5 = 1) - dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ES1) - timeEditValue <- "2018-04-24T23:00:00.000Z" - indexHour <- grep(timeEditValue, dataHtmlWidgetES1$hour) - expect_gt(indexHour, 2) - expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 10) - # with interactive - #FOR DEBUG - #ES1I <- exchangesStack(x = optsH5, - # interactive = TRUE) - - ES1I <- exchangesStack(x = optsH5, - .runApp = FALSE, - interactive = TRUE, - dateRange = DR) - ES1I <- ES1I$init() - expect_true(is(ES1I, "MWController")) - expect_equal(ES1I$ncharts, 1) - expect_equal(ES1I$ncol, 1) - expect_equal(ES1I$nrow, 1) - dataHtmlWidgetES1I <- .get_data_from_htmlwidget(ES1I) - expect_equal(dataHtmlWidgetES1I$nega_offshore[indexHour], 10) - # with refStudy no interactive - ESRef <- exchangesStack(x = optsH5, - refStudy = optsH5, - interactive = FALSE, - area = myArea, - dateRange = DR, - mcYearh5 = 1) - dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESRef) - expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 0) - # refStudy with interactive - ESRefI <- exchangesStack(x = optsH5, - refStudy = optsH5, - interactive = TRUE, - .runApp = FALSE, - area = myArea, - dateRange = DR) - ESRefI <- ESRefI$init() - expect_true(is(ESRefI, "MWController")) - expect_equal(ESRefI$ncharts, 1) - expect_equal(ESRefI$ncol, 1) - expect_equal(ESRefI$nrow, 1) - dataHtmlWidgetESRefI <- .get_data_from_htmlwidget(ESRefI) - expect_equal(dataHtmlWidgetESRefI$nega_offshore[indexHour], 0) - # with a new Study H5 test if compare prodStack works - ## create a new folder h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - pathNewH5 <- file.path(pathInitial, "testH5") - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, - overwrite = TRUE, supressMessages = TRUE)) - - - pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) - myLink <- getLinks()[1] - .h5Antares_edit_variable( - pathH5 = pathNewH5File, - link = myLink, - timeId = 1:40, - antVar = "FLOW LIN.", - newValue = 15000, - mcYear = 1 - ) - - optsH5New <- setSimulationPath(path = pathNewH5File) - #no interactive - ES1New <- exchangesStack(x = optsH5New, - interactive = FALSE, - area = myArea, - dateRange = DR, - mcYearh5 = 1) - dataHtmlWidgetES1New <- .get_data_from_htmlwidget(ES1New) - expect_equal(dataHtmlWidgetES1New$nega_offshore[indexHour], 10) - expect_equal(dataHtmlWidgetES1New$a_offshore[2], 15000) - # with interactive - ES1NewI <- exchangesStack(x = optsH5New, - interactive = TRUE, - .runApp = FALSE, - area = myArea, - dateRange = DR) - ES1NewI <- ES1NewI$init() - expect_true(is(ES1NewI, "MWController")) - expect_equal(ES1NewI$ncharts, 1) - expect_equal(ES1NewI$ncol, 1) - expect_equal(ES1NewI$nrow, 1) - dataHtmlWidgetES1New <- .get_data_from_htmlwidget(ES1NewI) - expect_equal(dataHtmlWidgetES1New$nega_offshore[indexHour], 10) - expect_equal(dataHtmlWidgetES1New$a_offshore[2], 15000) - # no interactive, refStudy, - ES1NewRef <- exchangesStack(x = optsH5New, - refStudy = optsH5, - interactive = FALSE, - area = myArea, - dateRange = DR, - mcYearh5 = 1) - dataHtmlWidgetES1Ref <- .get_data_from_htmlwidget(ES1NewRef) - expect_equal(dataHtmlWidgetES1Ref$nega_offshore[indexHour], 0) - expect_gt(dataHtmlWidgetES1Ref$a_offshore[2], 15000) - # interactive, refStudy, - ES1NewRefI <- exchangesStack(x = optsH5New, - refStudy = optsH5, - interactive = TRUE, - .runApp = FALSE, - area = myArea, - dateRange = DR, - mcYearh5 = 1) - ES1NewRefI <- ES1NewRefI$init() - expect_true(is(ES1NewRefI, "MWController")) - expect_equal(ES1NewRefI$ncharts, 1) - expect_equal(ES1NewRefI$ncol, 1) - expect_equal(ES1NewRefI$nrow, 1) - dataHtmlWidgetES1RefI <- .get_data_from_htmlwidget(ES1NewRefI) - expect_equal(dataHtmlWidgetES1RefI$nega_offshore[indexHour], 0) - expect_gt(dataHtmlWidgetES1RefI$a_offshore[2], 15000) - } -}) - -test_that("exchangesStack, interactive, x is a list of optsH5 and refStudy optsH5 , ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runExchangesStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - - # with new Studies H5 test if compare prodStack works - ## create new folders h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - - listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") - for (folder in listFolderToCreate){ - pathNewH5 <- file.path(pathInitial, folder) - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings( - writeAntaresH5( - path = pathNewH5, - opts = optsData, - overwrite = TRUE, - supressMessages = TRUE) - ) - } - pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[2]]) - pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) - myLink <- getLinks()[1] - newValueFlow <- 50000 - mcYearToTestList <- c(2, NULL) - for (mcYearToTest in mcYearToTestList){ - .h5Antares_edit_variable( - pathH5 = pathH5FileToEdit, - link = myLink, - timeId = 1:40, - antVar = "FLOW LIN.", - newValue = newValueFlow, - mcYear = mcYearToTest - ) - - optsList <- list() - antaresDataListH5 <- list() - for (i in 1:length(listFolderToCreate)){ - pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) - optsList[[i]] <- setSimulationPath(path = pathOptsI) - antaresDataListH5[[i]] <- readAntares(links = myLink, mcYear = mcYearToTest) - } - - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - #try without refStudy and interactive == FALSE - myArea <- "a" - ESListNoInt <- exchangesStack(x = optsList, - dateRange = DR, - area = myArea, - interactive = FALSE, - mcYearh5 = mcYearToTest) - dataHtmlWidgetESNoInt <- .get_data_from_htmlwidget(ESListNoInt, widgetsNumber = 2) - expect_equal(max(dataHtmlWidgetESNoInt$a_offshore, na.rm = TRUE), 50000) - - # try with refStudy - ESListNoInt <- exchangesStack(x = optsList, - refStudy = optsH5, - interactive = FALSE, - areas = myArea, - dateRange = DR, - mcYearh5 = mcYearToTest) - ## get the data from htmlwidget - dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESListNoInt, widgetsNumber = 1) - dataHtmlWidgetES2 <- .get_data_from_htmlwidget(ESListNoInt, widgetsNumber = 2) - - ## get the data from the h5 file - antaresDataRef <- readAntares(opts = optsH5, links = myLink, mcYears = mcYearToTest) - expect_equal(max(antaresDataListH5[[2]]$`FLOW LIN.`), newValueFlow) - expect_equal(max(antaresDataListH5[[1]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) - expect_equal(max(antaresDataListH5[[3]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) - expect_equal(antaresDataListH5[[2]]$`OV. COST`, antaresDataRef$`OV. COST`) - - ## compare data - resCompareData1_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[1]]) - resCompareData2_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[2]]) - expect_equal(resCompareData1_ref[timeId == timeId[40], `FLOW LIN.`], -dataHtmlWidgetES1$nega_offshore[[2]]) - expect_gt(resCompareData2_ref[timeId == timeId[40], `FLOW LIN.`], newValueFlow) - - # interactive == TRUE - ## DEBUG - # PSWORef <- prodStack(x = optsList, - # dateRange = DR, - # h5requestFiltering = list(areas = myArea, - # mcYears = mcYearToTest), - # .runApp = FALSE, - # interactive = TRUE) - # PSWORef <- PSWORef$init() - # ESWORef <- exchangesStack(x = antaresDataListH5[[2]]) - # ESWORef <- exchangesStack(x = optsList) - # ESWORef <- exchangesStack(x = antaresDataListH5[[2]], - # dateRange = DR) - # ESWORef <- exchangesStack(x = optsList, - # dateRange = DR) - - ESWORef <- exchangesStack( - x = optsList, - dateRange = DR, - .runApp = FALSE, - interactive = TRUE, - h5requestFiltering = list( - areas = getAreas(select = "a"), - links = getLinks(areas = myArea), - mcYears = mcYearToTest)) - ESWORef <- ESWORef$init() - expect_true(is(ESWORef, "MWController")) - expect_equal(ESWORef$ncharts, 3) - expect_equal(ESWORef$ncol, 2) - expect_equal(ESWORef$nrow, 2) - ## get the data from htmlwidget - dataHtmlWidgetESWORef <- .get_data_from_htmlwidget(ESWORef, widgetsNumber = 2) - expect_equal(dataHtmlWidgetESWORef$a_offshore[[2]], 50000) - expect_equal(dataHtmlWidgetESWORef$nega_offshore[[2]], 0) - dataHtmlWidgetESWORef1 <- .get_data_from_htmlwidget(ESWORef, widgetsNumber = 1) - expect_equal(dataHtmlWidgetESWORef1$a_offshore[[2]], 0) - expect_gt(dataHtmlWidgetESWORef1$nega_offshore[[2]], 0) - - # fourth, MWController with refStudy and interactive == TRUE - ESWORefListI <- exchangesStack( - x = optsList, - refStudy = optsH5, - dateRange = DR, - .runApp = FALSE, - interactive = TRUE, - h5requestFiltering = list( - areas = getAreas(select = "a"), - links = getLinks(areas = myArea), - mcYears = mcYearToTest)) - ESWORefListI <- ESWORefListI$init() - expect_true(is(ESWORefListI, "MWController")) - expect_equal(ESWORefListI$ncharts, 3) - expect_equal(ESWORefListI$ncol, 2) - expect_equal(ESWORefListI$nrow, 2) - #check data from htmlwidgets - dataHtmlWidgetES31 <- .get_data_from_htmlwidget(ESWORefListI, widgetsNumber = 2) - expect_gt(dataHtmlWidgetES31$a_offshore[[2]], 50000) - expect_equal(dataHtmlWidgetES31$nega_offshore[[2]], 0) - dataHtmlWidgetES21 <- .get_data_from_htmlwidget(ESWORefListI, widgetsNumber = 1) - expect_equal(dataHtmlWidgetES21$a_offshore[[2]], 0) - expect_equal(dataHtmlWidgetES21$nega_offshore[[2]], 0) - - resOptsH5Old <- readAntares(opts = optsH5, links = myLink, showProgress = FALSE, mcYears = mcYearToTest) - resOptsH5New <- readAntares(opts = optsList[[2]], links = myLink, showProgress = FALSE, mcYears = mcYearToTest) - #timeId for time = "2018-04-24 00:00:00 UTC" ? timeId = 2713 - timeIdVal <- 2713 - expect_equal(resOptsH5New[timeId == timeIdVal, `FLOW LIN.`], newValueFlow) - expect_lt(resOptsH5Old[timeId == timeIdVal, `FLOW LIN.`], 0) - - resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) - expect_gt(resCompareData[timeId == timeIdVal, `FLOW LIN.`], newValueFlow) - expect_equal(resCompareData[timeId == timeIdVal, `FLOW LIN.`], dataHtmlWidgetES31$a_offshore[[1]]) - #no change after timeID > 40 - expect_equal(resCompareData[timeId == (timeIdVal + 90), `FLOW LIN.`], dataHtmlWidgetES31$a_offshore[[50]]) - expect_equal(dataHtmlWidgetES21$a_offshore[[1]], 0) - expect_equal(dataHtmlWidgetES21$nega_offshore[[1]], 0) - } - } - -}) +# test_that("exchangesStack, no interactive, x and refStudy are optsH5 ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runExchangesStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# myArea <- "a" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# ES1 <- exchangesStack(x = optsH5, interactive = FALSE, area = myArea, dateRange = DR) +# dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ES1) +# timeEditValue <- "2018-04-25T00:00:00.000Z" +# indexHour <- grep(timeEditValue, dataHtmlWidgetES1$hour) +# expect_gt(indexHour, 2) +# expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 9) +# # with refStudy +# ESRef <- exchangesStack(x = optsH5, refStudy = optsH5, interactive = FALSE, area = myArea, dateRange = DR) +# dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESRef) +# expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 0) +# # with a new Study H5 test if compare prodStack works +# ## create a new folder h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# pathNewH5 <- file.path(pathInitial, "testH5") +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, +# overwrite = TRUE, supressMessages = TRUE)) +# +# +# pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) +# myLink <- getLinks()[1] +# .h5Antares_edit_variable( +# pathH5 = pathNewH5File, +# link = myLink, +# timeId = 1:40, +# antVar = "FLOW LIN.", +# newValue = 15000 +# ) +# +# optsH5New <- setSimulationPath(path = pathNewH5File) +# ES1New <- exchangesStack(x = optsH5New, interactive = FALSE, area = myArea, dateRange = DR) +# dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ES1New) +# expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 9) +# expect_equal(dataHtmlWidgetES1$a_offshore[2], 15000) +# ES1NewRef <- exchangesStack(x = optsH5New, refStudy = optsH5, interactive = FALSE, area = myArea, dateRange = DR) +# dataHtmlWidgetES1Ref <- .get_data_from_htmlwidget(ES1NewRef) +# expect_equal(dataHtmlWidgetES1Ref$nega_offshore[indexHour], 0) +# expect_gt(dataHtmlWidgetES1Ref$a_offshore[2], 15000) +# } +# }) + +# test_that("exchangesStack, no interactive, x is a list of optH5 and refStudy are optsH5 ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runExchangesStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# +# # with new Studies H5 test if compare prodStack works +# ## create new folders h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# +# listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") +# for (folder in listFolderToCreate){ +# pathNewH5 <- file.path(pathInitial, folder) +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings( +# writeAntaresH5( +# path = pathNewH5, +# opts = optsData, +# overwrite = TRUE, +# supressMessages = TRUE) +# ) +# } +# idWidgetToEdit <- 2 +# pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[idWidgetToEdit]]) +# pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) +# newValueFlow <- 15000 +# myLink <- getLinks()[1] +# .h5Antares_edit_variable( +# pathH5 = pathH5FileToEdit, +# link = myLink, +# timeId = 1:40, +# antVar = "FLOW LIN.", +# newValue = newValueFlow +# ) +# +# optsList <- list() +# antaresDataListH5 <- list() +# for (i in 1:length(listFolderToCreate)){ +# pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) +# optsList[[i]] <- setSimulationPath(path = pathOptsI) +# antaresDataListH5[[i]] <- readAntares(links = myLink) +# } +# #test the data from h5 +# #get the data from the h5 file +# antaresDataRef <- readAntares(opts = optsH5, links = myLink) +# expect_equal(max(antaresDataListH5[[idWidgetToEdit]]$`FLOW LIN.`), newValueFlow) +# expect_equal(max(antaresDataListH5[[1]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) +# expect_equal(max(antaresDataListH5[[3]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) +# # get the data from htmlwidget +# myArea <- "a" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# ESList <- exchangesStack(x = optsList, interactive = FALSE, area = myArea, dateRange = DR) +# dataHtmlWidgetES2 <- .get_data_from_htmlwidget(ESList, widgetsNumber = idWidgetToEdit) +# expect_equal(dataHtmlWidgetES2$a_offshore[3], newValueFlow) +# dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESList, widgetsNumber = 1) +# expect_equal(dataHtmlWidgetES1$a_offshore[3], 0) +# expect_equal(dataHtmlWidgetES1$nega_offshore[3], 6) +# # with refStudy +# ESListRef <- exchangesStack(x = optsList, refStudy = optsH5, interactive = FALSE, area = myArea, dateRange = DR) +# dataHtmlWidgetES2Ref <- .get_data_from_htmlwidget(ESListRef, widgetsNumber = idWidgetToEdit) +# expect_equal(dataHtmlWidgetES2Ref$a_offshore[3] - dataHtmlWidgetES1$nega_offshore[3], newValueFlow) +# dataHtmlWidgetES1Ref <- .get_data_from_htmlwidget(ESListRef, widgetsNumber = 1) +# expect_equal(dataHtmlWidgetES1Ref$a_offshore[3], 0) +# expect_equal(dataHtmlWidgetES1Ref$nega_offshore[3], 0) +# } +# }) + +# test_that("exchangesStack, interactive, x and refStudy are optsH5 ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runExchangesStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# myArea <- "a" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# # no interactive +# ES1 <- exchangesStack(x = optsH5, +# interactive = FALSE, +# area = myArea, +# dateRange = DR, +# mcYearh5 = 1) +# dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ES1) +# timeEditValue <- "2018-04-24T23:00:00.000Z" +# indexHour <- grep(timeEditValue, dataHtmlWidgetES1$hour) +# expect_gt(indexHour, 2) +# expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 10) +# # with interactive +# #FOR DEBUG +# #ES1I <- exchangesStack(x = optsH5, +# # interactive = TRUE) +# +# ES1I <- exchangesStack(x = optsH5, +# .runApp = FALSE, +# interactive = TRUE, +# dateRange = DR) +# ES1I <- ES1I$init() +# expect_true(is(ES1I, "MWController")) +# expect_equal(ES1I$ncharts, 1) +# expect_equal(ES1I$ncol, 1) +# expect_equal(ES1I$nrow, 1) +# dataHtmlWidgetES1I <- .get_data_from_htmlwidget(ES1I) +# expect_equal(dataHtmlWidgetES1I$nega_offshore[indexHour], 10) +# # with refStudy no interactive +# ESRef <- exchangesStack(x = optsH5, +# refStudy = optsH5, +# interactive = FALSE, +# area = myArea, +# dateRange = DR, +# mcYearh5 = 1) +# dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESRef) +# expect_equal(dataHtmlWidgetES1$nega_offshore[indexHour], 0) +# # refStudy with interactive +# ESRefI <- exchangesStack(x = optsH5, +# refStudy = optsH5, +# interactive = TRUE, +# .runApp = FALSE, +# area = myArea, +# dateRange = DR) +# ESRefI <- ESRefI$init() +# expect_true(is(ESRefI, "MWController")) +# expect_equal(ESRefI$ncharts, 1) +# expect_equal(ESRefI$ncol, 1) +# expect_equal(ESRefI$nrow, 1) +# dataHtmlWidgetESRefI <- .get_data_from_htmlwidget(ESRefI) +# expect_equal(dataHtmlWidgetESRefI$nega_offshore[indexHour], 0) +# # with a new Study H5 test if compare prodStack works +# ## create a new folder h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# pathNewH5 <- file.path(pathInitial, "testH5") +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, +# overwrite = TRUE, supressMessages = TRUE)) +# +# +# pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) +# myLink <- getLinks()[1] +# .h5Antares_edit_variable( +# pathH5 = pathNewH5File, +# link = myLink, +# timeId = 1:40, +# antVar = "FLOW LIN.", +# newValue = 15000, +# mcYear = 1 +# ) +# +# optsH5New <- setSimulationPath(path = pathNewH5File) +# #no interactive +# ES1New <- exchangesStack(x = optsH5New, +# interactive = FALSE, +# area = myArea, +# dateRange = DR, +# mcYearh5 = 1) +# dataHtmlWidgetES1New <- .get_data_from_htmlwidget(ES1New) +# expect_equal(dataHtmlWidgetES1New$nega_offshore[indexHour], 10) +# expect_equal(dataHtmlWidgetES1New$a_offshore[2], 15000) +# # with interactive +# ES1NewI <- exchangesStack(x = optsH5New, +# interactive = TRUE, +# .runApp = FALSE, +# area = myArea, +# dateRange = DR) +# ES1NewI <- ES1NewI$init() +# expect_true(is(ES1NewI, "MWController")) +# expect_equal(ES1NewI$ncharts, 1) +# expect_equal(ES1NewI$ncol, 1) +# expect_equal(ES1NewI$nrow, 1) +# dataHtmlWidgetES1New <- .get_data_from_htmlwidget(ES1NewI) +# expect_equal(dataHtmlWidgetES1New$nega_offshore[indexHour], 10) +# expect_equal(dataHtmlWidgetES1New$a_offshore[2], 15000) +# # no interactive, refStudy, +# ES1NewRef <- exchangesStack(x = optsH5New, +# refStudy = optsH5, +# interactive = FALSE, +# area = myArea, +# dateRange = DR, +# mcYearh5 = 1) +# dataHtmlWidgetES1Ref <- .get_data_from_htmlwidget(ES1NewRef) +# expect_equal(dataHtmlWidgetES1Ref$nega_offshore[indexHour], 0) +# expect_gt(dataHtmlWidgetES1Ref$a_offshore[2], 15000) +# # interactive, refStudy, +# ES1NewRefI <- exchangesStack(x = optsH5New, +# refStudy = optsH5, +# interactive = TRUE, +# .runApp = FALSE, +# area = myArea, +# dateRange = DR, +# mcYearh5 = 1) +# ES1NewRefI <- ES1NewRefI$init() +# expect_true(is(ES1NewRefI, "MWController")) +# expect_equal(ES1NewRefI$ncharts, 1) +# expect_equal(ES1NewRefI$ncol, 1) +# expect_equal(ES1NewRefI$nrow, 1) +# dataHtmlWidgetES1RefI <- .get_data_from_htmlwidget(ES1NewRefI) +# expect_equal(dataHtmlWidgetES1RefI$nega_offshore[indexHour], 0) +# expect_gt(dataHtmlWidgetES1RefI$a_offshore[2], 15000) +# } +# }) + +# test_that("exchangesStack, interactive, x is a list of optsH5 and refStudy optsH5 , ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runExchangesStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# +# # with new Studies H5 test if compare prodStack works +# ## create new folders h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# +# listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") +# for (folder in listFolderToCreate){ +# pathNewH5 <- file.path(pathInitial, folder) +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings( +# writeAntaresH5( +# path = pathNewH5, +# opts = optsData, +# overwrite = TRUE, +# supressMessages = TRUE) +# ) +# } +# pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[2]]) +# pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) +# myLink <- getLinks()[1] +# newValueFlow <- 50000 +# mcYearToTestList <- c(2, NULL) +# for (mcYearToTest in mcYearToTestList){ +# .h5Antares_edit_variable( +# pathH5 = pathH5FileToEdit, +# link = myLink, +# timeId = 1:40, +# antVar = "FLOW LIN.", +# newValue = newValueFlow, +# mcYear = mcYearToTest +# ) +# +# optsList <- list() +# antaresDataListH5 <- list() +# for (i in 1:length(listFolderToCreate)){ +# pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) +# optsList[[i]] <- setSimulationPath(path = pathOptsI) +# antaresDataListH5[[i]] <- readAntares(links = myLink, mcYear = mcYearToTest) +# } +# +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# #try without refStudy and interactive == FALSE +# myArea <- "a" +# ESListNoInt <- exchangesStack(x = optsList, +# dateRange = DR, +# area = myArea, +# interactive = FALSE, +# mcYearh5 = mcYearToTest) +# dataHtmlWidgetESNoInt <- .get_data_from_htmlwidget(ESListNoInt, widgetsNumber = 2) +# expect_equal(max(dataHtmlWidgetESNoInt$a_offshore, na.rm = TRUE), 50000) +# +# # try with refStudy +# ESListNoInt <- exchangesStack(x = optsList, +# refStudy = optsH5, +# interactive = FALSE, +# areas = myArea, +# dateRange = DR, +# mcYearh5 = mcYearToTest) +# ## get the data from htmlwidget +# dataHtmlWidgetES1 <- .get_data_from_htmlwidget(ESListNoInt, widgetsNumber = 1) +# dataHtmlWidgetES2 <- .get_data_from_htmlwidget(ESListNoInt, widgetsNumber = 2) +# +# ## get the data from the h5 file +# antaresDataRef <- readAntares(opts = optsH5, links = myLink, mcYears = mcYearToTest) +# expect_equal(max(antaresDataListH5[[2]]$`FLOW LIN.`), newValueFlow) +# expect_equal(max(antaresDataListH5[[1]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) +# expect_equal(max(antaresDataListH5[[3]]$`FLOW LIN.`), max(antaresDataRef$`FLOW LIN.`)) +# expect_equal(antaresDataListH5[[2]]$`OV. COST`, antaresDataRef$`OV. COST`) +# +# ## compare data +# resCompareData1_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[1]]) +# resCompareData2_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[2]]) +# expect_equal(resCompareData1_ref[timeId == timeId[40], `FLOW LIN.`], -dataHtmlWidgetES1$nega_offshore[[2]]) +# expect_gt(resCompareData2_ref[timeId == timeId[40], `FLOW LIN.`], newValueFlow) +# +# # interactive == TRUE +# ## DEBUG +# # PSWORef <- prodStack(x = optsList, +# # dateRange = DR, +# # h5requestFiltering = list(areas = myArea, +# # mcYears = mcYearToTest), +# # .runApp = FALSE, +# # interactive = TRUE) +# # PSWORef <- PSWORef$init() +# # ESWORef <- exchangesStack(x = antaresDataListH5[[2]]) +# # ESWORef <- exchangesStack(x = optsList) +# # ESWORef <- exchangesStack(x = antaresDataListH5[[2]], +# # dateRange = DR) +# # ESWORef <- exchangesStack(x = optsList, +# # dateRange = DR) +# +# ESWORef <- exchangesStack( +# x = optsList, +# dateRange = DR, +# .runApp = FALSE, +# interactive = TRUE, +# h5requestFiltering = list( +# areas = getAreas(select = "a"), +# links = getLinks(areas = myArea), +# mcYears = mcYearToTest)) +# ESWORef <- ESWORef$init() +# expect_true(is(ESWORef, "MWController")) +# expect_equal(ESWORef$ncharts, 3) +# expect_equal(ESWORef$ncol, 2) +# expect_equal(ESWORef$nrow, 2) +# ## get the data from htmlwidget +# dataHtmlWidgetESWORef <- .get_data_from_htmlwidget(ESWORef, widgetsNumber = 2) +# expect_equal(dataHtmlWidgetESWORef$a_offshore[[2]], 50000) +# expect_equal(dataHtmlWidgetESWORef$nega_offshore[[2]], 0) +# dataHtmlWidgetESWORef1 <- .get_data_from_htmlwidget(ESWORef, widgetsNumber = 1) +# expect_equal(dataHtmlWidgetESWORef1$a_offshore[[2]], 0) +# expect_gt(dataHtmlWidgetESWORef1$nega_offshore[[2]], 0) +# +# # fourth, MWController with refStudy and interactive == TRUE +# ESWORefListI <- exchangesStack( +# x = optsList, +# refStudy = optsH5, +# dateRange = DR, +# .runApp = FALSE, +# interactive = TRUE, +# h5requestFiltering = list( +# areas = getAreas(select = "a"), +# links = getLinks(areas = myArea), +# mcYears = mcYearToTest)) +# ESWORefListI <- ESWORefListI$init() +# expect_true(is(ESWORefListI, "MWController")) +# expect_equal(ESWORefListI$ncharts, 3) +# expect_equal(ESWORefListI$ncol, 2) +# expect_equal(ESWORefListI$nrow, 2) +# #check data from htmlwidgets +# dataHtmlWidgetES31 <- .get_data_from_htmlwidget(ESWORefListI, widgetsNumber = 2) +# expect_gt(dataHtmlWidgetES31$a_offshore[[2]], 50000) +# expect_equal(dataHtmlWidgetES31$nega_offshore[[2]], 0) +# dataHtmlWidgetES21 <- .get_data_from_htmlwidget(ESWORefListI, widgetsNumber = 1) +# expect_equal(dataHtmlWidgetES21$a_offshore[[2]], 0) +# expect_equal(dataHtmlWidgetES21$nega_offshore[[2]], 0) +# +# resOptsH5Old <- readAntares(opts = optsH5, links = myLink, showProgress = FALSE, mcYears = mcYearToTest) +# resOptsH5New <- readAntares(opts = optsList[[2]], links = myLink, showProgress = FALSE, mcYears = mcYearToTest) +# #timeId for time = "2018-04-24 00:00:00 UTC" ? timeId = 2713 +# timeIdVal <- 2713 +# expect_equal(resOptsH5New[timeId == timeIdVal, `FLOW LIN.`], newValueFlow) +# expect_lt(resOptsH5Old[timeId == timeIdVal, `FLOW LIN.`], 0) +# +# resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) +# expect_gt(resCompareData[timeId == timeIdVal, `FLOW LIN.`], newValueFlow) +# expect_equal(resCompareData[timeId == timeIdVal, `FLOW LIN.`], dataHtmlWidgetES31$a_offshore[[1]]) +# #no change after timeID > 40 +# expect_equal(resCompareData[timeId == (timeIdVal + 90), `FLOW LIN.`], dataHtmlWidgetES31$a_offshore[[50]]) +# expect_equal(dataHtmlWidgetES21$a_offshore[[1]], 0) +# expect_equal(dataHtmlWidgetES21$nega_offshore[[1]], 0) +# } +# } +# +# }) diff --git a/tests/testthat/test-graphUtils.R b/tests/testthat/test-graphUtils.R index b4cdc467..e9fedab0 100644 --- a/tests/testthat/test-graphUtils.R +++ b/tests/testthat/test-graphUtils.R @@ -8,40 +8,40 @@ test_that(".compOpts", { expect_true(.compOpts(list(), NULL)$ncharts == 1) }) -if(.requireRhdf5_Antares(stopP = FALSE)){ - context(".dateRangeJoin") - test_that(".dateRangeJoin", { - dt <- list() - dt$x <- list(list(dateRange = as.Date(c("2010-01-01", "2010-01-10"))), - list(dateRange = as.Date(c("2010-01-02", "2010-01-09")))) - - - - - expect_true(.dateRangeJoin(dt, "union", "min") == as.Date("2010-01-01")) - expect_true(.dateRangeJoin(dt, "union", "max") == as.Date("2010-01-10")) - expect_true(.dateRangeJoin(dt, "intersect", "max") == as.Date("2010-01-09")) - expect_true(.dateRangeJoin(dt, "intersect", "min") == as.Date("2010-01-02")) - - dt2 <- list() - dt2$x <- list(list(ar = list(dateRange = as.Date(c("2010-01-01", "2010-01-10")))), - list(ar = list(dateRange = as.Date(c("2010-01-02", "2010-01-09"))))) - - expect_true(.dateRangeJoin(dt2, "union", "min", "ar") == as.Date("2010-01-01")) - expect_true(.dateRangeJoin(dt2, "union", "max", "ar") == as.Date("2010-01-10")) - expect_true(.dateRangeJoin(dt2, "intersect", "max", "ar") == as.Date("2010-01-09")) - expect_true(.dateRangeJoin(dt2, "intersect", "min", "ar") == as.Date("2010-01-02")) - - }) - - context(".loadH5Data") - test_that(".loadH5Data", { - opts <- setSimulationPath(studyPath) - sharerequest <- list() - sharerequest$mcYearh_l <- "all" - sharerequest$tables_l <- c("areas", "links", "clusters", "districts") - sharerequest$timeSteph5_l <- "hourly" - expect_true("antaresDataList" %in% class(.loadH5Data(sharerequest, opts))) - - }) -} +# if(.requireRhdf5_Antares(stopP = FALSE)){ +# context(".dateRangeJoin") +# test_that(".dateRangeJoin", { +# dt <- list() +# dt$x <- list(list(dateRange = as.Date(c("2010-01-01", "2010-01-10"))), +# list(dateRange = as.Date(c("2010-01-02", "2010-01-09")))) +# +# +# +# +# expect_true(.dateRangeJoin(dt, "union", "min") == as.Date("2010-01-01")) +# expect_true(.dateRangeJoin(dt, "union", "max") == as.Date("2010-01-10")) +# expect_true(.dateRangeJoin(dt, "intersect", "max") == as.Date("2010-01-09")) +# expect_true(.dateRangeJoin(dt, "intersect", "min") == as.Date("2010-01-02")) +# +# dt2 <- list() +# dt2$x <- list(list(ar = list(dateRange = as.Date(c("2010-01-01", "2010-01-10")))), +# list(ar = list(dateRange = as.Date(c("2010-01-02", "2010-01-09"))))) +# +# expect_true(.dateRangeJoin(dt2, "union", "min", "ar") == as.Date("2010-01-01")) +# expect_true(.dateRangeJoin(dt2, "union", "max", "ar") == as.Date("2010-01-10")) +# expect_true(.dateRangeJoin(dt2, "intersect", "max", "ar") == as.Date("2010-01-09")) +# expect_true(.dateRangeJoin(dt2, "intersect", "min", "ar") == as.Date("2010-01-02")) +# +# }) +# +# context(".loadH5Data") +# test_that(".loadH5Data", { +# opts <- setSimulationPath(studyPath) +# sharerequest <- list() +# sharerequest$mcYearh_l <- "all" +# sharerequest$tables_l <- c("areas", "links", "clusters", "districts") +# sharerequest$timeSteph5_l <- "hourly" +# expect_true("antaresDataList" %in% class(.loadH5Data(sharerequest, opts))) +# +# }) +# } diff --git a/tests/testthat/test-plotXY.R b/tests/testthat/test-plotXY.R index ccd91517..537fcab7 100644 --- a/tests/testthat/test-plotXY.R +++ b/tests/testthat/test-plotXY.R @@ -1,10 +1,10 @@ -context("prodStack no interactive") - -test_that("prodStack, no interactive", { - skip_if_not_installed("hexbin") - if(.requireRhdf5_Antares(stopP = FALSE)){ - dta <- readAntares(areas = "all", showProgress = FALSE) - g <- plotXY(dta, "NODU", "LOAD", precision = 50, sizeOnCount = FALSE) - expect_true("htmlwidget" %in% class(g)) - } -}) +# context("prodStack no interactive") +# +# test_that("prodStack, no interactive", { +# skip_if_not_installed("hexbin") +# if(.requireRhdf5_Antares(stopP = FALSE)){ +# dta <- readAntares(areas = "all", showProgress = FALSE) +# g <- plotXY(dta, "NODU", "LOAD", precision = 50, sizeOnCount = FALSE) +# expect_true("htmlwidget" %in% class(g)) +# } +# }) diff --git a/tests/testthat/test-prodStack.R b/tests/testthat/test-prodStack.R index 1f77b71f..855cf8f6 100644 --- a/tests/testthat/test-prodStack.R +++ b/tests/testthat/test-prodStack.R @@ -107,211 +107,211 @@ test_that("prodStack must work with refStudy, if x is a list of antaresDataList }) -test_that("prodStack must work with refStudy, if x and refStudy are optsH5, ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runProdStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - - myArea <- "b" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - PS3 <- prodStack(x = optsH5, - refStudy = optsH5, - interactive = FALSE, - areas = myArea, - dateRange = DR) - - #check that PS1 == PS2 or PS3 == 0 - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) - expect_equal(0, max(dataHtmlWidgetPS$totalProduction, na.rm = TRUE)) - expect_equal(0, max(dataHtmlWidgetPS$gas, na.rm = TRUE)) - - # with a new Study H5 test if compare prodStack works - ## create a new folder h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - pathNewH5 <- file.path(pathInitial, "testH5") - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, - overwrite = TRUE, supressMessages = TRUE)) - - - pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) - .h5Antares_edit_variable( - pathH5 = pathNewH5File, - area = myArea, - timeId = 1:40, - antVar = "LIGNITE", - newValue = 15000 - ) - - optsH5New <- setSimulationPath(path = pathNewH5) - PS3 <- prodStack(x = optsH5New, refStudy = optsH5, interactive = FALSE, areas = myArea, dateRange = DR) - - resOptsH5Old <- readAntares(opts = optsH5, areas = myArea, showProgress = FALSE) - resOptsH5New <- readAntares(opts = optsH5New, areas = myArea, showProgress = FALSE) - expect_equal(resOptsH5New[time == as.Date(DR)[1], LIGNITE], 15000) - - resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) - expect_equal(resCompareData[timeId == timeId[40], LIGNITE], -24000) - - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) - expect_equal(resCompareData[timeId == timeId[40], LIGNITE], -dataHtmlWidgetPS$neglignite[[2]]) - #no change after timeID > 40 - expect_equal(resCompareData[timeId == timeId[90], LIGNITE], -dataHtmlWidgetPS$neglignite[[50]]) - } - -}) - -test_that("prodStack must work with refStudy, if x is a list of optsH5 and refStudy an optsH5, ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runProdStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - - # with new Studies H5 test if compare prodStack works - ## create new folders h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - - listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") - for (folder in listFolderToCreate){ - pathNewH5 <- file.path(pathInitial, folder) - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings( - writeAntaresH5( - path = pathNewH5, - opts = optsData, - overwrite = TRUE, - supressMessages = TRUE) - ) - } - myArea <- "b" - pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[2]]) - pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) - newValueLignite <- 100000 - .h5Antares_edit_variable( - pathH5 = pathH5FileToEdit, - area = myArea, - timeId = 1:40, - antVar = "LIGNITE", - newValue = newValueLignite - ) - - optsList <- list() - antaresDataListH5 <- list() - for (i in 1:length(listFolderToCreate)){ - pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) - optsList[[i]] <- setSimulationPath(path = pathOptsI) - antaresDataListH5[[i]] <- readAntares(areas = myArea) - } - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - PS1 <- prodStack(x = optsH5, interactive = FALSE, areas = myArea, dateRange = DR) - PS2 <- prodStack(x = optsList, interactive = FALSE, areas = myArea, dateRange = DR) - PS_List <- prodStack(x = optsList, refStudy = optsH5, interactive = FALSE, areas = myArea, dateRange = DR) - #get the data from the h5 file - antaresDataRef <- readAntares(opts = optsH5, areas = myArea) - expect_equal(max(antaresDataListH5[[2]]$LIGNITE), newValueLignite) - expect_equal(max(antaresDataListH5[[1]]$LIGNITE), max(antaresDataRef$LIGNITE)) - expect_equal(max(antaresDataListH5[[3]]$LIGNITE), max(antaresDataRef$LIGNITE)) - #get the data from htmlwidget - dataHtmlWidgetPS1 <- .get_data_from_htmlwidget(PS_List, widgetsNumber = 1) - dataHtmlWidgetPS2 <- .get_data_from_htmlwidget(PS_List, widgetsNumber = 2) - #compare data - resCompareData1_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[1]]) - resCompareData2_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[2]]) - expect_equal(resCompareData1_ref[timeId == timeId[40], LIGNITE], -dataHtmlWidgetPS1$lignite[[2]]) - expect_equal(resCompareData2_ref[timeId == timeId[40], LIGNITE], dataHtmlWidgetPS2$lignite[[2]]) - #no change after timeID > 40 - expect_equal(resCompareData1_ref[timeId == timeId[90], LIGNITE], -dataHtmlWidgetPS1$lignite[[50]]) - expect_equal(resCompareData2_ref[timeId == timeId[90], LIGNITE], -dataHtmlWidgetPS2$lignite[[50]]) - - } -}) - -test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x and refStudy are antaresData, ", { - myData1 <- readAntares(areas = "all", showProgress = FALSE) - myData2 <- readAntares(areas = "all", showProgress = FALSE) - - myArea <- "a" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - - #for debug, dont compare - # PS3 <- prodStack( - # x = myData2, - # dateRange = DR, - # .runApp = FALSE, - # interactive = TRUE, - # h5requestFiltering = list(areas = myArea)) - # res <- PS3$init() - # PS3 - # #for debug, refStudy but not interactive - # PS3 <- prodStack( - # x = myData2, - # refStudy = myData1, - # dateRange = DR, - # .runApp = FALSE, - # interactive = FALSE, - # areas = myArea) - # PS3 - - #MWController - PS3 <- prodStack( - x = myData2, - refStudy = myData1, - dateRange = DR, - .runApp = FALSE, - interactive = TRUE, - h5requestFiltering = list(areas = myArea)) - res <- PS3$init() - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 1) - expect_equal(PS3$ncol, 1) - expect_equal(PS3$nrow, 1) - - #get the data from antaresData - resCompare <- antaresProcessing::compare(myData2, myData1, method = "diff") - - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) - expect_true(isTRUE(max(resCompare$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) - - #pb timeZine local (PC, Travis, etc) - for (i in 0:5){ - timeEditShift <- lubridate::hours(i) - timeEditMinus <- as.Date(DR[1]) - timeEditShift - timeEditPlus <- as.Date(DR[1]) + timeEditShift - myData1[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] - } - #check console - #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS - #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS - - expect_true(isTRUE(all.equal(myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500, myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS))) - - PS3 <- prodStack(x = myData2, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 1) - expect_equal(PS3$ncol, 1) - expect_equal(PS3$nrow, 1) - - resCompare <- antaresProcessing::compare(myData1, myData2, method = "diff") - - PS3$init() - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) - expect_true(all.equal(resCompare[ time == as.Date(DR)[1] & area == myArea, GAS ], - (dataHtmlWidgetPS$neggas[[2]]))) - #after DR + 5 hours (no change) - expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) - -}) +# test_that("prodStack must work with refStudy, if x and refStudy are optsH5, ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runProdStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# +# myArea <- "b" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# PS3 <- prodStack(x = optsH5, +# refStudy = optsH5, +# interactive = FALSE, +# areas = myArea, +# dateRange = DR) +# +# #check that PS1 == PS2 or PS3 == 0 +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) +# expect_equal(0, max(dataHtmlWidgetPS$totalProduction, na.rm = TRUE)) +# expect_equal(0, max(dataHtmlWidgetPS$gas, na.rm = TRUE)) +# +# # with a new Study H5 test if compare prodStack works +# ## create a new folder h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# pathNewH5 <- file.path(pathInitial, "testH5") +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, +# overwrite = TRUE, supressMessages = TRUE)) +# +# +# pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) +# .h5Antares_edit_variable( +# pathH5 = pathNewH5File, +# area = myArea, +# timeId = 1:40, +# antVar = "LIGNITE", +# newValue = 15000 +# ) +# +# optsH5New <- setSimulationPath(path = pathNewH5) +# PS3 <- prodStack(x = optsH5New, refStudy = optsH5, interactive = FALSE, areas = myArea, dateRange = DR) +# +# resOptsH5Old <- readAntares(opts = optsH5, areas = myArea, showProgress = FALSE) +# resOptsH5New <- readAntares(opts = optsH5New, areas = myArea, showProgress = FALSE) +# expect_equal(resOptsH5New[time == as.Date(DR)[1], LIGNITE], 15000) +# +# resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) +# expect_equal(resCompareData[timeId == timeId[40], LIGNITE], -24000) +# +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) +# expect_equal(resCompareData[timeId == timeId[40], LIGNITE], -dataHtmlWidgetPS$neglignite[[2]]) +# #no change after timeID > 40 +# expect_equal(resCompareData[timeId == timeId[90], LIGNITE], -dataHtmlWidgetPS$neglignite[[50]]) +# } +# +# }) + +# test_that("prodStack must work with refStudy, if x is a list of optsH5 and refStudy an optsH5, ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runProdStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# +# # with new Studies H5 test if compare prodStack works +# ## create new folders h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# +# listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") +# for (folder in listFolderToCreate){ +# pathNewH5 <- file.path(pathInitial, folder) +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings( +# writeAntaresH5( +# path = pathNewH5, +# opts = optsData, +# overwrite = TRUE, +# supressMessages = TRUE) +# ) +# } +# myArea <- "b" +# pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[2]]) +# pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) +# newValueLignite <- 100000 +# .h5Antares_edit_variable( +# pathH5 = pathH5FileToEdit, +# area = myArea, +# timeId = 1:40, +# antVar = "LIGNITE", +# newValue = newValueLignite +# ) +# +# optsList <- list() +# antaresDataListH5 <- list() +# for (i in 1:length(listFolderToCreate)){ +# pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) +# optsList[[i]] <- setSimulationPath(path = pathOptsI) +# antaresDataListH5[[i]] <- readAntares(areas = myArea) +# } +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# PS1 <- prodStack(x = optsH5, interactive = FALSE, areas = myArea, dateRange = DR) +# PS2 <- prodStack(x = optsList, interactive = FALSE, areas = myArea, dateRange = DR) +# PS_List <- prodStack(x = optsList, refStudy = optsH5, interactive = FALSE, areas = myArea, dateRange = DR) +# #get the data from the h5 file +# antaresDataRef <- readAntares(opts = optsH5, areas = myArea) +# expect_equal(max(antaresDataListH5[[2]]$LIGNITE), newValueLignite) +# expect_equal(max(antaresDataListH5[[1]]$LIGNITE), max(antaresDataRef$LIGNITE)) +# expect_equal(max(antaresDataListH5[[3]]$LIGNITE), max(antaresDataRef$LIGNITE)) +# #get the data from htmlwidget +# dataHtmlWidgetPS1 <- .get_data_from_htmlwidget(PS_List, widgetsNumber = 1) +# dataHtmlWidgetPS2 <- .get_data_from_htmlwidget(PS_List, widgetsNumber = 2) +# #compare data +# resCompareData1_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[1]]) +# resCompareData2_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[2]]) +# expect_equal(resCompareData1_ref[timeId == timeId[40], LIGNITE], -dataHtmlWidgetPS1$lignite[[2]]) +# expect_equal(resCompareData2_ref[timeId == timeId[40], LIGNITE], dataHtmlWidgetPS2$lignite[[2]]) +# #no change after timeID > 40 +# expect_equal(resCompareData1_ref[timeId == timeId[90], LIGNITE], -dataHtmlWidgetPS1$lignite[[50]]) +# expect_equal(resCompareData2_ref[timeId == timeId[90], LIGNITE], -dataHtmlWidgetPS2$lignite[[50]]) +# +# } +# }) + +# test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x and refStudy are antaresData, ", { +# myData1 <- readAntares(areas = "all", showProgress = FALSE) +# myData2 <- readAntares(areas = "all", showProgress = FALSE) +# +# myArea <- "a" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# +# #for debug, dont compare +# # PS3 <- prodStack( +# # x = myData2, +# # dateRange = DR, +# # .runApp = FALSE, +# # interactive = TRUE, +# # h5requestFiltering = list(areas = myArea)) +# # res <- PS3$init() +# # PS3 +# # #for debug, refStudy but not interactive +# # PS3 <- prodStack( +# # x = myData2, +# # refStudy = myData1, +# # dateRange = DR, +# # .runApp = FALSE, +# # interactive = FALSE, +# # areas = myArea) +# # PS3 +# +# #MWController +# PS3 <- prodStack( +# x = myData2, +# refStudy = myData1, +# dateRange = DR, +# .runApp = FALSE, +# interactive = TRUE, +# h5requestFiltering = list(areas = myArea)) +# res <- PS3$init() +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 1) +# expect_equal(PS3$ncol, 1) +# expect_equal(PS3$nrow, 1) +# +# #get the data from antaresData +# resCompare <- antaresProcessing::compare(myData2, myData1, method = "diff") +# +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) +# expect_true(isTRUE(max(resCompare$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) +# +# #pb timeZine local (PC, Travis, etc) +# for (i in 0:5){ +# timeEditShift <- lubridate::hours(i) +# timeEditMinus <- as.Date(DR[1]) - timeEditShift +# timeEditPlus <- as.Date(DR[1]) + timeEditShift +# myData1[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] +# } +# #check console +# #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS +# #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS +# +# expect_true(isTRUE(all.equal(myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500, myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS))) +# +# PS3 <- prodStack(x = myData2, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 1) +# expect_equal(PS3$ncol, 1) +# expect_equal(PS3$nrow, 1) +# +# resCompare <- antaresProcessing::compare(myData1, myData2, method = "diff") +# +# PS3$init() +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) +# expect_true(all.equal(resCompare[ time == as.Date(DR)[1] & area == myArea, GAS ], - (dataHtmlWidgetPS$neggas[[2]]))) +# #after DR + 5 hours (no change) +# expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) +# +# }) test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x a list of antaresData and refStudy an antaresData, ", { myData1 <- readAntares(areas = "all", showProgress = FALSE) @@ -332,393 +332,393 @@ test_that("prodStack must work with refStudy, if interactive is set to TRUE and expect_equal(PS3$ncol, 2) expect_equal(PS3$nrow, 2) - #get the data from antaresData - resCompare3_1 <- antaresProcessing::compare(myDataList[[2]], myData1, method = "diff") - - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 2) - expect_true(isTRUE(max(resCompare3_1$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) - - #pb timeZine local (PC, Travis, etc) - for (i in 0:5){ - timeEditShift <- lubridate::hours(i) - timeEditMinus <- as.Date(DR[1]) - timeEditShift - timeEditPlus <- as.Date(DR[1]) + timeEditShift - myData3[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] - } - #check console - #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS - #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS - - expect_true(isTRUE(all.equal(myData3[ time == as.Date(DR)[1] & area == myArea, ]$GAS, myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500))) - - PS3 <- prodStack(x = myDataList, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) - - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 3) - expect_equal(PS3$ncol, 2) - expect_equal(PS3$nrow, 2) - - resCompare3_1 <- antaresProcessing::compare(myDataList[[2]], myData2, method = "diff") - - PS3$init() - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 2) - expect_true(all.equal(resCompare3_1[ time == as.Date(DR)[1] & area == myArea, GAS ], - (dataHtmlWidgetPS$gas[[2]]))) - #after DR + 5 hours (no change) - expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) - -}) - -test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x is an antaresDataList and refStudy an antaresDataList, ", { - myData1 <- readAntares(areas = "all", links = "all", showProgress = FALSE) - myData2 <- readAntares(areas = "all", links = "all", showProgress = FALSE) - - myArea <- "a" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - #MWController - PS3 <- prodStack(x = myData2, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) - res <- PS3$init() - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 1) - expect_equal(PS3$ncol, 1) - expect_equal(PS3$nrow, 1) - - #get the data from antaresData - resCompare2_1 <- antaresProcessing::compare(myData2, myData1, method = "diff") - - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 1) - expect_true(isTRUE(max(resCompare2_1$areas$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) - - #pb timeZine local (PC, Travis, etc) - for (i in 0:5){ - timeEditShift <- lubridate::hours(i) - timeEditMinus <- as.Date(DR[1]) - timeEditShift - timeEditPlus <- as.Date(DR[1]) + timeEditShift - myData2$areas[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] - } - #check console - #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS - #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS - - expect_true(isTRUE(all.equal(myData2$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS, myData1$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500))) - - PS3 <- prodStack(x = myData2, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) - - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 1) - expect_equal(PS3$ncol, 1) - expect_equal(PS3$nrow, 1) - - resCompare2_1 <- antaresProcessing::compare(myData1, myData2, method = "diff") - - PS3$init() - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 1) - expect_true(all.equal(resCompare2_1$areas[ time == as.Date(DR)[1] & area == myArea, GAS ], (dataHtmlWidgetPS$gas[[2]]))) - #after DR + 5 hours (no change) - expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) - -}) - -test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x is a list of antaresDataList and refStudy an antaresDataList , ", { - myData1 <- readAntares(areas = "all", links = "all", showProgress = FALSE) - myData2 <- readAntares(areas = "all", links = "all", showProgress = FALSE) - myData3 <- readAntares(areas = "all", links = "all", showProgress = FALSE) - myData4 <- readAntares(areas = "all", links = "all", showProgress = FALSE) - - myDataList <- list(myData4, myData3, myData2) - - myArea <- "a" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - #MWController - PS3 <- prodStack(x = myDataList, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) - res <- PS3$init() - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 3) - expect_equal(PS3$ncol, 2) - expect_equal(PS3$nrow, 2) - - #get the data from antaresData - resCompare2_1 <- antaresProcessing::compare(myDataList[[3]], myData1, method = "diff") - - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 3) - expect_true(isTRUE(max(resCompare2_1$areas$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) - - #pb timeZine local (PC, Travis, etc) - for (i in 0:5){ - timeEditShift <- lubridate::hours(i) - timeEditMinus <- as.Date(DR[1]) - timeEditShift - timeEditPlus <- as.Date(DR[1]) + timeEditShift - myData2$areas[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] - } - #check console - #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS - #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS - - expect_true(isTRUE(all.equal(myData2$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS, myData1$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500))) - - PS3 <- prodStack(x = myDataList, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) - - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 3) - expect_equal(PS3$ncol, 2) - expect_equal(PS3$nrow, 2) - - resCompare2_1 <- antaresProcessing::compare(myData1, myData2, method = "diff") - resCompare3_1 <- antaresProcessing::compare(myData1, myData3, method = "diff") - - PS3$init() - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 3) - expect_true(all.equal(resCompare2_1$areas[ time == as.Date(DR)[1] & area == myArea, GAS ], (dataHtmlWidgetPS$gas[[2]]))) - #no change for myData3 - dataHtmlWidgetPS3 <- .get_data_from_htmlwidget(PS3, widgetsNumber = 2) - expect_true(all.equal(resCompare3_1$areas[ time == as.Date(DR)[1] & area == myArea, GAS ], (dataHtmlWidgetPS3$gas[[2]]))) - #after DR + 5 hours (no change) - expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) - -}) - -test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x, refStudy are optsH5 , ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runProdStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - - myArea <- "b" - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - #MWController - # test debug prodStack(x = optsH5, refStudy = optsH5, dateRange = DR, h5requestFiltering = list(areas = myArea, mcYears = 2)) - PS3 <- prodStack(x = optsH5, - refStudy = optsH5, - dateRange = DR, - h5requestFiltering = list(areas = myArea, mcYears = 2), - .runApp = FALSE, - interactive = TRUE) - - res <- PS3$init() - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 1) - expect_equal(PS3$ncol, 1) - expect_equal(PS3$nrow, 1) - - #check that PS1 == PS2 or PS3 == 0 - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) - expect_equal(0, max(dataHtmlWidgetPS$totalProduction, na.rm = TRUE)) - expect_equal(0, max(dataHtmlWidgetPS$gas, na.rm = TRUE)) - - # with a new Study H5 test if compare prodStack works - ## create a new folder h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - - pathNewH5 <- file.path(pathInitial, "testH5") - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, - overwrite = TRUE, supressMessages = TRUE)) - - - pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) - .h5Antares_edit_variable( - pathH5 = pathNewH5File, - area = myArea, - timeId = 1:40, - antVar = "LIGNITE", - newValue = 15000, - mcYear = 2 - ) - - optsH5New <- setSimulationPath(path = pathNewH5File) - PS3 <- prodStack(x = optsH5New, - refStudy = optsH5, - dateRange = DR, - h5requestFiltering = list(areas = myArea, mcYears = 2), - .runApp = FALSE, - interactive = TRUE) - res <- PS3$init() - - #TEST non interactive for debug - PS_FInt <- prodStack(x = optsH5New, - refStudy = optsH5, - mcYearh5 = 2, - interactive = FALSE, - areas = myArea, - dateRange = DR) - dataHtmlWidgetPSFint <- .get_data_from_htmlwidget(PS_FInt) - expect_equal(-23000, min(dataHtmlWidgetPSFint$totalProduction, na.rm = TRUE)) - expect_equal(0, max(dataHtmlWidgetPSFint$neggas, na.rm = TRUE)) - expect_equal(23000, max(dataHtmlWidgetPSFint$neglignite, na.rm = TRUE)) - - res <- PS3$init() - expect_true(is(PS3, "MWController")) - expect_equal(PS3$ncharts, 1) - expect_equal(PS3$ncol, 1) - expect_equal(PS3$nrow, 1) - - resOptsH5Old <- readAntares(opts = optsH5, areas = myArea, showProgress = FALSE, mcYears = 2) - resOptsH5New <- readAntares(opts = optsH5New, areas = myArea, showProgress = FALSE, mcYears = 2) - #timeId for time = "2018-04-24 00:00:00 UTC" ? timeId = 2713 - timeIdVal <- 2713 - expect_equal(resOptsH5New[timeId == timeIdVal, LIGNITE], 15000) - expect_equal(resOptsH5Old[timeId == timeIdVal, LIGNITE], 38000) - - resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) - expect_equal(resCompareData[timeId == timeIdVal, LIGNITE], -23000) - - dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) - expect_equal(resCompareData[timeId == timeIdVal, LIGNITE], -dataHtmlWidgetPS$neglignite[[1]]) - #no change after timeID > 40 - expect_equal(resCompareData[timeId == (timeIdVal + 90), LIGNITE], -dataHtmlWidgetPS$neglignite[[50]]) - } + # #get the data from antaresData + # resCompare3_1 <- antaresProcessing::compare(myDataList[[2]], myData1, method = "diff") + # + # dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 2) + # expect_true(isTRUE(max(resCompare3_1$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) + # + # #pb timeZine local (PC, Travis, etc) + # for (i in 0:5){ + # timeEditShift <- lubridate::hours(i) + # timeEditMinus <- as.Date(DR[1]) - timeEditShift + # timeEditPlus <- as.Date(DR[1]) + timeEditShift + # myData3[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] + # } + # #check console + # #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS + # #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS + # + # expect_true(isTRUE(all.equal(myData3[ time == as.Date(DR)[1] & area == myArea, ]$GAS, myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500))) + # + # PS3 <- prodStack(x = myDataList, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) + # + # expect_true(is(PS3, "MWController")) + # expect_equal(PS3$ncharts, 3) + # expect_equal(PS3$ncol, 2) + # expect_equal(PS3$nrow, 2) + # + # resCompare3_1 <- antaresProcessing::compare(myDataList[[2]], myData2, method = "diff") + # + # PS3$init() + # dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 2) + # expect_true(all.equal(resCompare3_1[ time == as.Date(DR)[1] & area == myArea, GAS ], - (dataHtmlWidgetPS$gas[[2]]))) + # #after DR + 5 hours (no change) + # expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) }) -test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x is a list of optsH5 and refStudy optsH5 , ", { - if (.requireRhdf5_Antares(stopP = FALSE)){ - skip_if_not(.runProdStackTest) - suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) - optsH5 <- setSimulationPath(pathtemp) - - # with new Studies H5 test if compare prodStack works - ## create new folders h5 - pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) - - listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") - for (folder in listFolderToCreate){ - pathNewH5 <- file.path(pathInitial, folder) - if (!dir.exists(pathNewH5)){ - dir.create(pathNewH5) - } - - #write the study - #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) - optsData <- antaresRead::setSimulationPath(path = studyPath) - suppressWarnings( - writeAntaresH5( - path = pathNewH5, - opts = optsData, - overwrite = TRUE, - supressMessages = TRUE) - ) - } - myArea <- "b" - pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[2]]) - pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) - newValueGAS <- 50000 - mcYearToTestList <- c(2, NULL) - for (mcYearToTest in mcYearToTestList){ - .h5Antares_edit_variable( - pathH5 = pathH5FileToEdit, - area = myArea, - timeId = 1:40, - antVar = "GAS", - newValue = newValueGAS, - mcYear = mcYearToTest - ) - - optsList <- list() - antaresDataListH5 <- list() - for (i in 1:length(listFolderToCreate)){ - pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) - optsList[[i]] <- setSimulationPath(path = pathOptsI) - antaresDataListH5[[i]] <- readAntares(areas = myArea, mcYear = mcYearToTest) - } - - DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") - #first, try with interactive == FALSE - PSListNoInt <- prodStack(x = optsList, - refStudy = optsH5, - interactive = FALSE, - areas = myArea, - dateRange = DR, - mcYearh5 = mcYearToTest) - - #get the data from the h5 file - antaresDataRef <- readAntares(opts = optsH5, areas = myArea, mcYears = mcYearToTest) - expect_equal(max(antaresDataListH5[[2]]$GAS), newValueGAS) - expect_equal(max(antaresDataListH5[[1]]$GAS), max(antaresDataRef$GAS)) - expect_equal(max(antaresDataListH5[[3]]$GAS), max(antaresDataRef$GAS)) - expect_equal(antaresDataListH5[[2]]$`OV. COST`, antaresDataRef$`OV. COST`) - - #get the data from htmlwidget - dataHtmlWidgetPS1 <- .get_data_from_htmlwidget(PSListNoInt, widgetsNumber = 1) - dataHtmlWidgetPS2 <- .get_data_from_htmlwidget(PSListNoInt, widgetsNumber = 2) - #compare data - resCompareData1_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[1]]) - resCompareData2_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[2]]) - expect_equal(resCompareData1_ref[timeId == timeId[40], GAS], -dataHtmlWidgetPS1$gas[[2]]) - expect_equal(resCompareData2_ref[timeId == timeId[40], GAS], dataHtmlWidgetPS2$gas[[2]]) - - #second, try without refStudy and interactive == FALSE - PSListNoInt <- prodStack(x = optsList, - dateRange = DR, - areas = myArea, - interactive = FALSE, - mcYearh5 = mcYearToTest) - - dataHtmlWidgetPSNoInt <- .get_data_from_htmlwidget(PSListNoInt, widgetsNumber = 2) - expect_gt(max(dataHtmlWidgetPSNoInt$totalProduction, na.rm = TRUE), 100000) - expect_equal(max(dataHtmlWidgetPSNoInt$gas, na.rm = TRUE), 50000) - - #thirdly, try without refStudy and interactive == TRUE - PSWORef <- prodStack(x = optsList, - dateRange = DR, - h5requestFiltering = list(areas = myArea, - mcYears = mcYearToTest), - .runApp = FALSE, - interactive = TRUE) - - res <- PSWORef$init() - expect_true(is(PSWORef, "MWController")) - expect_equal(PSWORef$ncharts, 3) - expect_equal(PSWORef$ncol, 2) - expect_equal(PSWORef$nrow, 2) - - #fourth, MWController with refStudy and interactive == TRUE - # test debug prodStack(x = optsH5, refStudy = optsH5, dateRange = DR, h5requestFiltering = list(areas = myArea, mcYears = 2)) - PSWRefI <- prodStack(x = optsList, - refStudy = optsH5, - dateRange = DR, - h5requestFiltering = list(areas = myArea, - mcYears = mcYearToTest), - .runApp = FALSE, - interactive = TRUE) - - res <- PSWRefI$init() - expect_true(is(PSWRefI, "MWController")) - expect_equal(PSWRefI$ncharts, 3) - expect_equal(PSWRefI$ncol, 2) - expect_equal(PSWRefI$nrow, 2) - - #check that PS1 == PS2 or PSWRefI == 0 - dataHtmlWidgetPS31 <- .get_data_from_htmlwidget(PSWRefI, widgetsNumber = 2) - expect_equal(newValueGAS, max(dataHtmlWidgetPS31$totalProduction, na.rm = TRUE)) - expect_equal(newValueGAS, max(dataHtmlWidgetPS31$gas, na.rm = TRUE)) - - dataHtmlWidgetPS21 <- .get_data_from_htmlwidget(PSWRefI, widgetsNumber = 1) - expect_equal(0, max(dataHtmlWidgetPS21$totalProduction, na.rm = TRUE)) - expect_equal(0, max(dataHtmlWidgetPS21$gas, na.rm = TRUE)) - - resOptsH5Old <- readAntares(opts = optsH5, areas = myArea, showProgress = FALSE, mcYears = mcYearToTest) - resOptsH5New <- readAntares(opts = optsList[[2]], areas = myArea, showProgress = FALSE, mcYears = mcYearToTest) - #timeId for time = "2018-04-24 00:00:00 UTC" ? timeId = 2713 - timeIdVal <- 2713 - expect_equal(resOptsH5New[timeId == timeIdVal, GAS], newValueGAS) - expect_equal(resOptsH5Old[timeId == timeIdVal, GAS], 0) - - resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) - expect_equal(resCompareData[timeId == timeIdVal, GAS], newValueGAS) - - expect_equal(resCompareData[timeId == timeIdVal, GAS], dataHtmlWidgetPS31$gas[[1]]) - #no change after timeID > 40 - expect_equal(resCompareData[timeId == (timeIdVal + 90), GAS], dataHtmlWidgetPS31$gas[[50]]) - expect_equal(0, dataHtmlWidgetPS21$gas[[1]]) - expect_equal(0, dataHtmlWidgetPS21$gas[[50]]) - } - } - -}) +# test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x is an antaresDataList and refStudy an antaresDataList, ", { +# myData1 <- readAntares(areas = "all", links = "all", showProgress = FALSE) +# myData2 <- readAntares(areas = "all", links = "all", showProgress = FALSE) +# +# myArea <- "a" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# #MWController +# PS3 <- prodStack(x = myData2, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) +# res <- PS3$init() +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 1) +# expect_equal(PS3$ncol, 1) +# expect_equal(PS3$nrow, 1) +# +# #get the data from antaresData +# resCompare2_1 <- antaresProcessing::compare(myData2, myData1, method = "diff") +# +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 1) +# expect_true(isTRUE(max(resCompare2_1$areas$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) +# +# #pb timeZine local (PC, Travis, etc) +# for (i in 0:5){ +# timeEditShift <- lubridate::hours(i) +# timeEditMinus <- as.Date(DR[1]) - timeEditShift +# timeEditPlus <- as.Date(DR[1]) + timeEditShift +# myData2$areas[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] +# } +# #check console +# #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS +# #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS +# +# expect_true(isTRUE(all.equal(myData2$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS, myData1$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500))) +# +# PS3 <- prodStack(x = myData2, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) +# +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 1) +# expect_equal(PS3$ncol, 1) +# expect_equal(PS3$nrow, 1) +# +# resCompare2_1 <- antaresProcessing::compare(myData1, myData2, method = "diff") +# +# PS3$init() +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 1) +# expect_true(all.equal(resCompare2_1$areas[ time == as.Date(DR)[1] & area == myArea, GAS ], (dataHtmlWidgetPS$gas[[2]]))) +# #after DR + 5 hours (no change) +# expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) +# +# }) + +# test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x is a list of antaresDataList and refStudy an antaresDataList , ", { +# myData1 <- readAntares(areas = "all", links = "all", showProgress = FALSE) +# myData2 <- readAntares(areas = "all", links = "all", showProgress = FALSE) +# myData3 <- readAntares(areas = "all", links = "all", showProgress = FALSE) +# myData4 <- readAntares(areas = "all", links = "all", showProgress = FALSE) +# +# myDataList <- list(myData4, myData3, myData2) +# +# myArea <- "a" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# #MWController +# PS3 <- prodStack(x = myDataList, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) +# res <- PS3$init() +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 3) +# expect_equal(PS3$ncol, 2) +# expect_equal(PS3$nrow, 2) +# +# #get the data from antaresData +# resCompare2_1 <- antaresProcessing::compare(myDataList[[3]], myData1, method = "diff") +# +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 3) +# expect_true(isTRUE(max(resCompare2_1$areas$GAS) == max(dataHtmlWidgetPS$neggas, na.rm = TRUE))) +# +# #pb timeZine local (PC, Travis, etc) +# for (i in 0:5){ +# timeEditShift <- lubridate::hours(i) +# timeEditMinus <- as.Date(DR[1]) - timeEditShift +# timeEditPlus <- as.Date(DR[1]) + timeEditShift +# myData2$areas[ (time == timeEditMinus | time == timeEditPlus) & area == myArea, GAS := as.integer(GAS + 2500)] +# } +# #check console +# #myData1[ time == as.Date(DR)[1] & area == myArea, ]$GAS +# #myData2[ time == as.Date(DR)[1] & area == myArea, ]$GAS +# +# expect_true(isTRUE(all.equal(myData2$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS, myData1$areas[ time == as.Date(DR)[1] & area == myArea, ]$GAS + 2500))) +# +# PS3 <- prodStack(x = myDataList, refStudy = myData1, areas = myArea, dateRange = DR, .runApp = FALSE, interactive = TRUE) +# +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 3) +# expect_equal(PS3$ncol, 2) +# expect_equal(PS3$nrow, 2) +# +# resCompare2_1 <- antaresProcessing::compare(myData1, myData2, method = "diff") +# resCompare3_1 <- antaresProcessing::compare(myData1, myData3, method = "diff") +# +# PS3$init() +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3, widgetsNumber = 3) +# expect_true(all.equal(resCompare2_1$areas[ time == as.Date(DR)[1] & area == myArea, GAS ], (dataHtmlWidgetPS$gas[[2]]))) +# #no change for myData3 +# dataHtmlWidgetPS3 <- .get_data_from_htmlwidget(PS3, widgetsNumber = 2) +# expect_true(all.equal(resCompare3_1$areas[ time == as.Date(DR)[1] & area == myArea, GAS ], (dataHtmlWidgetPS3$gas[[2]]))) +# #after DR + 5 hours (no change) +# expect_true(all.equal(0, dataHtmlWidgetPS$neggas[[20]])) +# +# }) + +# test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x, refStudy are optsH5 , ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runProdStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# +# myArea <- "b" +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# #MWController +# # test debug prodStack(x = optsH5, refStudy = optsH5, dateRange = DR, h5requestFiltering = list(areas = myArea, mcYears = 2)) +# PS3 <- prodStack(x = optsH5, +# refStudy = optsH5, +# dateRange = DR, +# h5requestFiltering = list(areas = myArea, mcYears = 2), +# .runApp = FALSE, +# interactive = TRUE) +# +# res <- PS3$init() +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 1) +# expect_equal(PS3$ncol, 1) +# expect_equal(PS3$nrow, 1) +# +# #check that PS1 == PS2 or PS3 == 0 +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) +# expect_equal(0, max(dataHtmlWidgetPS$totalProduction, na.rm = TRUE)) +# expect_equal(0, max(dataHtmlWidgetPS$gas, na.rm = TRUE)) +# +# # with a new Study H5 test if compare prodStack works +# ## create a new folder h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# +# pathNewH5 <- file.path(pathInitial, "testH5") +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings(writeAntaresH5(path = pathNewH5, opts = optsData, +# overwrite = TRUE, supressMessages = TRUE)) +# +# +# pathNewH5File <- file.path(pathNewH5, list.files(pathNewH5)) +# .h5Antares_edit_variable( +# pathH5 = pathNewH5File, +# area = myArea, +# timeId = 1:40, +# antVar = "LIGNITE", +# newValue = 15000, +# mcYear = 2 +# ) +# +# optsH5New <- setSimulationPath(path = pathNewH5File) +# PS3 <- prodStack(x = optsH5New, +# refStudy = optsH5, +# dateRange = DR, +# h5requestFiltering = list(areas = myArea, mcYears = 2), +# .runApp = FALSE, +# interactive = TRUE) +# res <- PS3$init() +# +# #TEST non interactive for debug +# PS_FInt <- prodStack(x = optsH5New, +# refStudy = optsH5, +# mcYearh5 = 2, +# interactive = FALSE, +# areas = myArea, +# dateRange = DR) +# dataHtmlWidgetPSFint <- .get_data_from_htmlwidget(PS_FInt) +# expect_equal(-23000, min(dataHtmlWidgetPSFint$totalProduction, na.rm = TRUE)) +# expect_equal(0, max(dataHtmlWidgetPSFint$neggas, na.rm = TRUE)) +# expect_equal(23000, max(dataHtmlWidgetPSFint$neglignite, na.rm = TRUE)) +# +# res <- PS3$init() +# expect_true(is(PS3, "MWController")) +# expect_equal(PS3$ncharts, 1) +# expect_equal(PS3$ncol, 1) +# expect_equal(PS3$nrow, 1) +# +# resOptsH5Old <- readAntares(opts = optsH5, areas = myArea, showProgress = FALSE, mcYears = 2) +# resOptsH5New <- readAntares(opts = optsH5New, areas = myArea, showProgress = FALSE, mcYears = 2) +# #timeId for time = "2018-04-24 00:00:00 UTC" ? timeId = 2713 +# timeIdVal <- 2713 +# expect_equal(resOptsH5New[timeId == timeIdVal, LIGNITE], 15000) +# expect_equal(resOptsH5Old[timeId == timeIdVal, LIGNITE], 38000) +# +# resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) +# expect_equal(resCompareData[timeId == timeIdVal, LIGNITE], -23000) +# +# dataHtmlWidgetPS <- .get_data_from_htmlwidget(PS3) +# expect_equal(resCompareData[timeId == timeIdVal, LIGNITE], -dataHtmlWidgetPS$neglignite[[1]]) +# #no change after timeID > 40 +# expect_equal(resCompareData[timeId == (timeIdVal + 90), LIGNITE], -dataHtmlWidgetPS$neglignite[[50]]) +# } +# +# }) + +# test_that("prodStack must work with refStudy, if interactive is set to TRUE and if x is a list of optsH5 and refStudy optsH5 , ", { +# if (.requireRhdf5_Antares(stopP = FALSE)){ +# skip_if_not(.runProdStackTest) +# suppressMessages(writeAntaresH5(pathtemp, opts = opts, overwrite = TRUE)) +# optsH5 <- setSimulationPath(pathtemp) +# +# # with new Studies H5 test if compare prodStack works +# ## create new folders h5 +# pathInitial <- file.path(dirname(pathtemp), basename(pathtemp)) +# +# listFolderToCreate <- c("testH5v2", "testH5v3", "testH5v4") +# for (folder in listFolderToCreate){ +# pathNewH5 <- file.path(pathInitial, folder) +# if (!dir.exists(pathNewH5)){ +# dir.create(pathNewH5) +# } +# +# #write the study +# #windows pb ? pathNewH5 <- gsub("/", "\\", pathNewH5, fixed = TRUE) +# optsData <- antaresRead::setSimulationPath(path = studyPath) +# suppressWarnings( +# writeAntaresH5( +# path = pathNewH5, +# opts = optsData, +# overwrite = TRUE, +# supressMessages = TRUE) +# ) +# } +# myArea <- "b" +# pathH5FolderToEdit <- file.path(pathInitial, listFolderToCreate[[2]]) +# pathH5FileToEdit <- file.path(pathH5FolderToEdit, list.files(pathH5FolderToEdit)) +# newValueGAS <- 50000 +# mcYearToTestList <- c(2, NULL) +# for (mcYearToTest in mcYearToTestList){ +# .h5Antares_edit_variable( +# pathH5 = pathH5FileToEdit, +# area = myArea, +# timeId = 1:40, +# antVar = "GAS", +# newValue = newValueGAS, +# mcYear = mcYearToTest +# ) +# +# optsList <- list() +# antaresDataListH5 <- list() +# for (i in 1:length(listFolderToCreate)){ +# pathOptsI <- file.path(pathInitial, listFolderToCreate[[i]]) +# optsList[[i]] <- setSimulationPath(path = pathOptsI) +# antaresDataListH5[[i]] <- readAntares(areas = myArea, mcYear = mcYearToTest) +# } +# +# DR <- c("2018-04-24 00:00:00 UTC", "2018-04-26 00:00:00 UTC") +# #first, try with interactive == FALSE +# PSListNoInt <- prodStack(x = optsList, +# refStudy = optsH5, +# interactive = FALSE, +# areas = myArea, +# dateRange = DR, +# mcYearh5 = mcYearToTest) +# +# #get the data from the h5 file +# antaresDataRef <- readAntares(opts = optsH5, areas = myArea, mcYears = mcYearToTest) +# expect_equal(max(antaresDataListH5[[2]]$GAS), newValueGAS) +# expect_equal(max(antaresDataListH5[[1]]$GAS), max(antaresDataRef$GAS)) +# expect_equal(max(antaresDataListH5[[3]]$GAS), max(antaresDataRef$GAS)) +# expect_equal(antaresDataListH5[[2]]$`OV. COST`, antaresDataRef$`OV. COST`) +# +# #get the data from htmlwidget +# dataHtmlWidgetPS1 <- .get_data_from_htmlwidget(PSListNoInt, widgetsNumber = 1) +# dataHtmlWidgetPS2 <- .get_data_from_htmlwidget(PSListNoInt, widgetsNumber = 2) +# #compare data +# resCompareData1_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[1]]) +# resCompareData2_ref <- antaresProcessing::compare(x = antaresDataRef, y = antaresDataListH5[[2]]) +# expect_equal(resCompareData1_ref[timeId == timeId[40], GAS], -dataHtmlWidgetPS1$gas[[2]]) +# expect_equal(resCompareData2_ref[timeId == timeId[40], GAS], dataHtmlWidgetPS2$gas[[2]]) +# +# #second, try without refStudy and interactive == FALSE +# PSListNoInt <- prodStack(x = optsList, +# dateRange = DR, +# areas = myArea, +# interactive = FALSE, +# mcYearh5 = mcYearToTest) +# +# dataHtmlWidgetPSNoInt <- .get_data_from_htmlwidget(PSListNoInt, widgetsNumber = 2) +# expect_gt(max(dataHtmlWidgetPSNoInt$totalProduction, na.rm = TRUE), 100000) +# expect_equal(max(dataHtmlWidgetPSNoInt$gas, na.rm = TRUE), 50000) +# +# #thirdly, try without refStudy and interactive == TRUE +# PSWORef <- prodStack(x = optsList, +# dateRange = DR, +# h5requestFiltering = list(areas = myArea, +# mcYears = mcYearToTest), +# .runApp = FALSE, +# interactive = TRUE) +# +# res <- PSWORef$init() +# expect_true(is(PSWORef, "MWController")) +# expect_equal(PSWORef$ncharts, 3) +# expect_equal(PSWORef$ncol, 2) +# expect_equal(PSWORef$nrow, 2) +# +# #fourth, MWController with refStudy and interactive == TRUE +# # test debug prodStack(x = optsH5, refStudy = optsH5, dateRange = DR, h5requestFiltering = list(areas = myArea, mcYears = 2)) +# PSWRefI <- prodStack(x = optsList, +# refStudy = optsH5, +# dateRange = DR, +# h5requestFiltering = list(areas = myArea, +# mcYears = mcYearToTest), +# .runApp = FALSE, +# interactive = TRUE) +# +# res <- PSWRefI$init() +# expect_true(is(PSWRefI, "MWController")) +# expect_equal(PSWRefI$ncharts, 3) +# expect_equal(PSWRefI$ncol, 2) +# expect_equal(PSWRefI$nrow, 2) +# +# #check that PS1 == PS2 or PSWRefI == 0 +# dataHtmlWidgetPS31 <- .get_data_from_htmlwidget(PSWRefI, widgetsNumber = 2) +# expect_equal(newValueGAS, max(dataHtmlWidgetPS31$totalProduction, na.rm = TRUE)) +# expect_equal(newValueGAS, max(dataHtmlWidgetPS31$gas, na.rm = TRUE)) +# +# dataHtmlWidgetPS21 <- .get_data_from_htmlwidget(PSWRefI, widgetsNumber = 1) +# expect_equal(0, max(dataHtmlWidgetPS21$totalProduction, na.rm = TRUE)) +# expect_equal(0, max(dataHtmlWidgetPS21$gas, na.rm = TRUE)) +# +# resOptsH5Old <- readAntares(opts = optsH5, areas = myArea, showProgress = FALSE, mcYears = mcYearToTest) +# resOptsH5New <- readAntares(opts = optsList[[2]], areas = myArea, showProgress = FALSE, mcYears = mcYearToTest) +# #timeId for time = "2018-04-24 00:00:00 UTC" ? timeId = 2713 +# timeIdVal <- 2713 +# expect_equal(resOptsH5New[timeId == timeIdVal, GAS], newValueGAS) +# expect_equal(resOptsH5Old[timeId == timeIdVal, GAS], 0) +# +# resCompareData <- antaresProcessing::compare(x = resOptsH5Old, y = resOptsH5New) +# expect_equal(resCompareData[timeId == timeIdVal, GAS], newValueGAS) +# +# expect_equal(resCompareData[timeId == timeIdVal, GAS], dataHtmlWidgetPS31$gas[[1]]) +# #no change after timeID > 40 +# expect_equal(resCompareData[timeId == (timeIdVal + 90), GAS], dataHtmlWidgetPS31$gas[[50]]) +# expect_equal(0, dataHtmlWidgetPS21$gas[[1]]) +# expect_equal(0, dataHtmlWidgetPS21$gas[[50]]) +# } +# } +# +# }) test_that("prodStack, no interactive, ne error with compare main", { myData <- readAntares(areas = "all", links = "all", showProgress = FALSE) diff --git a/tests/testthat/test-zzCleanTests.R b/tests/testthat/test-zzCleanTests.R deleted file mode 100644 index 2e236893..00000000 --- a/tests/testthat/test-zzCleanTests.R +++ /dev/null @@ -1,8 +0,0 @@ -### AFTER ALL TESTS, CLOSE H5 FILES AND REMOVE TEMP FOLDER -### DONT WRITE TEST AFTER THIS -if (.requireRhdf5_Antares(stopP = FALSE)){ - rhdf5::H5close() -} -if (dir.exists(pathtemp)){ - unlink(pathtemp, recursive = TRUE) -} \ No newline at end of file