commit ddf72f37d640e2505abd803f253593a3ac969e3a Author: JailGamer Date: Fri May 8 19:50:22 2026 +0200 Versió 2025 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e62ec04 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ +GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 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/README.md b/README.md new file mode 100644 index 0000000..1cf2a07 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# AgilityMaps2 + Enhanced Agility Maps. diff --git a/agilitymaps.ico b/agilitymaps.ico new file mode 100644 index 0000000..65672ca Binary files /dev/null and b/agilitymaps.ico differ diff --git a/app/views/app - 20231105.html b/app/views/app - 20231105.html new file mode 100644 index 0000000..234e7b9 --- /dev/null +++ b/app/views/app - 20231105.html @@ -0,0 +1,342 @@ + + + + + Agility Maps ( BETA ) + + + + + + + + + + + + + + + +
+

+ Pour télécharger l'image, effectuer un clique droit sur l'image puis "Enregistrer sous"

+
+ +
+
+ +
+ + + +
+
+ + +
+
+ +
Obstacles
+
+
+ +
Paramètres
+
+
+ +
Trajectoires
+
+
+ +
Driver
+
+
+ +
Téléchargement
+
+
+ +
Import
+
+
+ +
Langue
+
+
+ + +
+
+
Driver
+ + + + + + + + +
+
+
Outils
+ + + +
+
Couleurs
+
+
+
+ + + + + +
+ + + Show the driver +
+
+
+
+
+
Langue
+
+
+ Fr +
+
+ En +
+
+ Pt +
+
+ Es +
+
+ De +
+
+ It +
+
+ Pl +
+
+ 日本語 +
+
+ Se +
+
+ No +
+
+ Fi +
+
+ Da +
+
+ Hu +
+
+ Ru +
+
+ Ca +
+
+
+
+
+
+
Paramètres
+
+ Titre : + +
+
+ Auteur : + +
+
Dimensions
+
+ Longueur : + +
+
+ Largeur : + +
+
+ Echelle du cadrillage : + +
+ Unité de mesure : + + + + + + +
+ + + Distance totale +
+
+
+
+
+
+
Couleurs
+
Background :
+
+
+
+
Obstacles :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Números
+ + + +
+ + Ver números +
+
+ +
+
Outils
+ + + +
+
+
Trajectoires
+ + + + + +
Afficher Trajectoires
Modifier Manuellement
SPEED
2on2off
+ + + + + + +
+ +
+
+
+
Sauvegarde
+ Générer l'image pour l'export : + + + + + Télécharger data: + +
+
+
+
+
Sauts
+ + + + +
+
+
Zones
+ + + + +
+
+
Autres
+ + + + + + +
+
+
Outils
+ + + + +
+ +
+ + +
+ + Canvas not supported + +

+
+ VERSION BETA (En cours de développement), outil créé pour être utilisé avec une souris

+ + + + + + +
+
+
+ + + +
+ + + + + + + + diff --git a/app/views/app.html b/app/views/app.html new file mode 100644 index 0000000..754a94d --- /dev/null +++ b/app/views/app.html @@ -0,0 +1,407 @@ + + + + + Agility Maps ( BETA ) + + + + + + + + + + + + + + + +
+

+ Pour télécharger l'image, effectuer un clique droit sur l'image puis "Enregistrer sous"

+
+ +
+
+ +
+ + + +
+
+ + + +
+
+ +
Obstacles
+
+
+ +
Paramètres
+
+
+ +
Trajectoires
+
+
+ +
Driver
+
+
+ +
Téléchargement
+
+
+ +
Import
+
+
+ +
Langue
+
+
+ + +
+
+
Driver
+ + + + + + + + +
+
+
Outils
+ + + +
+
Couleurs
+
+
+
+ + + + + +
+ + + Show the driver +
+
+
+ +
+
+
Langue
+
+
+ Fr +
+
+ En +
+
+ Pt +
+
+ Es +
+
+ De +
+
+ It +
+
+ Pl +
+
+ 日本語 +
+
+ Se +
+
+ No +
+
+ Fi +
+
+ Da +
+
+ Hu +
+
+ Ru +
+
+ Ca +
+
+
+
+ +
+
+
Paramètres
+
+ Titre : + +
+
+ Auteur : + +
+
Dimensions
+
+ Longueur : + +
+
+ Largeur : + +
+
+ Echelle du cadrillage : + +
+ Unité de mesure : + + + + + + + + + + + + + + +
+ + + Distance totale +
+ + + Ver margen rojo +
+ + + Ver margen amarillo +
+
+
+
+
+
+
+
+
+
Couleurs
+
Background :
+
+
+
+
Obstacles :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
Números
+ + + +
+ + Ver números +
+
+ +
+
Outils
+ + + + +
+
+
Trajectoires
+ + + + + + + + + + + + + + + + + +
Afficher Trajectoires
Modifier Manuellement
SPEED
2on2off
+
+
+ +
+
+
Sauvegarde
+ Générer l'image pour l'export : + + + + + + + + + + + + + + + + +
Ver números
Afficher Trajectoires
Show the driver
+
Couleurs
+
Background :
+
+
+
+
+
+
+
Télécharger data:
+ + +
+
+ +
+
+
Sauts
+ + + + +
+
+
Zones
+ + + + +
+
+
Autres
+ + + + + + +
+
+
Outils
+ + + + + +
+
+ + +
+
+ + Canvas not supported + +

+
+ VERSION BETA (En cours de développement), outil créé pour être utilisé avec une souris

+ + + + + + +
+ +
+ Keyboard shortcuts (click on course first)
+ j: Jump
+ m: Trayectorias manuales
+ n: Number
+ t: Tunnel 6m
+ T: Tunnel 4m
+ +: Zoom +
+ -: Zoom -
+
+ Over tunnel
+ 1: Horizontal
+ 2: Vertical
+
+ +
+ +
+ + diff --git a/app/views/app.html.org b/app/views/app.html.org new file mode 100644 index 0000000..3124f83 --- /dev/null +++ b/app/views/app.html.org @@ -0,0 +1,332 @@ + + + + + Agility Maps ( BETA ) + + + + + + + + + + + + + + + +
+

+ Pour télécharger l'image, effectuer un clique droit sur l'image puis "Enregistrer sous"

+
+ +
+
+ +
+ + + +
+
+ + +
+
+ +
Obstacles
+
+
+ +
Paramètres
+
+
+ +
Trajectoires
+
+
+ +
Driver
+
+
+ +
Téléchargement
+
+
+ +
Langue
+
+
+ + +
+
+
Driver
+ + + + + + + + +
+
+
Outils
+ + + +
+
Couleurs
+
+
+
+ + + + + +
+ + + Show the driver +
+
+
+
+
+
Langue
+
+
+ Fr +
+
+ En +
+
+ Pt +
+
+ Es +
+
+ De +
+
+ It +
+
+ Pl +
+
+ 日本語 +
+
+ Se +
+
+ No +
+
+ Fi +
+
+ Da +
+
+ Hu +
+
+ Ru +
+
+ Ca +
+
+
+
+
+
+
Paramètres
+
+ Titre : + +
+
+ Auteur : + +
+
Dimensions
+
+ Longueur : + +
+
+ Largeur : + +
+
+ Echelle du cadrillage : + +
+ Unité de mesure : + + + + + + +
+ + + Distance totale +
+
+
+
+
+
+
Couleurs
+
Background :
+
+
+
+
Obstacles :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Numéros
+ + + +
+ +
+
Outils
+ + + +
+
+
Trajectoires
+ + + + + +
Afficher Trajectoires
Modifier Manuellement
SPEED
2on2off
+ + + + + + +
+ +
+
+
+
Sauvegarde
+ Générer l'image pour l'export : + + + + +
+
+
+
+
Sauts
+ + + + +
+
+
Zones
+ + + + +
+
+
Autres
+ + + + + + +
+
+
Outils
+ + + + +
+ +
+ + +
+ + Canvas not supported + +

+
+ VERSION BETA (En cours de développement), outil créé pour être utilisé avec une souris

+ + + + + + +
+
+
+ + + +
+ + + + + + + + diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..fe0dabc Binary files /dev/null and b/favicon.ico differ diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..2a3aa7b --- /dev/null +++ b/poetry.lock @@ -0,0 +1,153 @@ +# This file is automatically @generated by Poetry and should not be changed by hand. + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "flask" +version = "2.2.2" +description = "A simple framework for building complex web applications." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "Flask-2.2.2-py3-none-any.whl", hash = "sha256:b9c46cc36662a7949f34b52d8ec7bb59c0d74ba08ba6cb9ce9adc1d8676d9526"}, + {file = "Flask-2.2.2.tar.gz", hash = "sha256:642c450d19c4ad482f96729bd2a8f6d32554aa1e231f4f6b4e7e5264b16cca2b"}, +] + +[package.dependencies] +click = ">=8.0" +itsdangerous = ">=2.0" +Jinja2 = ">=3.0" +Werkzeug = ">=2.2.2" + +[package.extras] +async = ["asgiref (>=3.2)"] +dotenv = ["python-dotenv"] + +[[package]] +name = "itsdangerous" +version = "2.1.2" +description = "Safely pass data to untrusted environments and back." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "itsdangerous-2.1.2-py3-none-any.whl", hash = "sha256:2c2349112351b88699d8d4b6b075022c0808887cb7ad10069318a8b0bc88db44"}, + {file = "itsdangerous-2.1.2.tar.gz", hash = "sha256:5dbbc68b317e5e42f327f9021763545dc3fc3bfe22e6deb96aaf1fc38874156a"}, +] + +[[package]] +name = "jinja2" +version = "3.1.2" +description = "A very fast and expressive template engine." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, + {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, +] + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + +[[package]] +name = "markupsafe" +version = "2.1.1" +description = "Safely add untrusted strings to HTML/XML markup." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-win32.whl", hash = "sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-win32.whl", hash = "sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-win32.whl", hash = "sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-win32.whl", hash = "sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247"}, + {file = "MarkupSafe-2.1.1.tar.gz", hash = "sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"}, +] + +[[package]] +name = "werkzeug" +version = "2.2.2" +description = "The comprehensive WSGI web application library." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "Werkzeug-2.2.2-py3-none-any.whl", hash = "sha256:f979ab81f58d7318e064e99c4506445d60135ac5cd2e177a2de0089bfd4c9bd5"}, + {file = "Werkzeug-2.2.2.tar.gz", hash = "sha256:7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f"}, +] + +[package.dependencies] +MarkupSafe = ">=2.1.1" + +[package.extras] +watchdog = ["watchdog"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.11" +content-hash = "9c6bcf7ac13c16980dde603c14adf3d6aa019987d77029284cf305989a1dd394" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f0ffe0d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,50 @@ +[tool.poetry] +name = "agilitymaps2" +version = "0.1" +description = "Agility Maps v2." +authors = ["Virinas-code "] +maintainers = [] +license = "GPL-3.0" +readme = "README.md" + +# Links +homepage = "https://github.com/AgilityTeamsManager/AgilityMaps2" +repository = "https://github.com/AgilityTeamsManager/AgilityMaps2" +documentation = "https://github.com/AgilityTeamsManager/AgilityMaps2/wiki" + +# Tags +keywords = ["agility"] +classifiers = [ + "Development Status :: 1 - Planning", + "Environment :: Web Environment", + "Framework :: Flask", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Natural Language :: English", + "Natural Language :: French", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: JavaScript", + "Topic :: Utilities", + "Typing :: Typed" +] + +# Setup +packages = [ + { include = "src" } +] +include = ["README.md", "LICENSE"] + + +[tool.poetry.dependencies] +python = "^3.11" +Flask = "^2.2.2" + + +[tool.poetry.scripts] +start-debug = "src.__main__:start" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e269aff --- /dev/null +++ b/src/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +""" +Agility Maps v2. + +Main server file. +""" +import flask + +from .modules.path import set_path +from .modules.router import route + +set_path() + +server: flask.Flask = flask.Flask("agilitymaps2", template_folder="app/views") +route(server) diff --git a/src/__main__.py b/src/__main__.py new file mode 100644 index 0000000..88bdfba --- /dev/null +++ b/src/__main__.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Agility Maps v2. + +Start debug server. +""" +from . import server + + +def start() -> None: + """ + Start developement server. + + Server is started on http://localhost:8080/ + """ + server.run( + host="localhost", + port=8080, + debug=True, + ) + + +if __name__ == "__main__": + start() diff --git a/src/app/controllers/app.py b/src/app/controllers/app.py new file mode 100644 index 0000000..ad6c9c4 --- /dev/null +++ b/src/app/controllers/app.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +""" +Agility Maps v2. + +/app controller. +""" +import flask + + +def route_app() -> flask.Response: + """ + Route /app. + + :return flask.Response: App response. + """ + return flask.make_response(flask.render_template("app.html")) diff --git a/src/modules/path.py b/src/modules/path.py new file mode 100644 index 0000000..f85e8c9 --- /dev/null +++ b/src/modules/path.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +""" +Agility Maps v2. + +Path module. +""" +import os + + +def set_path() -> None: + """ + Set path. + + Moves to root. + """ + os.chdir(".") + print(os.getcwd()) diff --git a/src/modules/router.py b/src/modules/router.py new file mode 100644 index 0000000..6da9248 --- /dev/null +++ b/src/modules/router.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +""" +Agility Maps v2. + +Routing module. +""" +# pylint: disable=relative-beyond-top-level +import flask + +from ..app.controllers.app import route_app # type: ignore +from .static import route_static_public, route_static_ui + + +def route(app: flask.Flask) -> None: + """ + Route app. + + :param flask.Flask app: App to route. + """ + app.add_url_rule("/app", view_func=route_app) + app.add_url_rule( + "/static/public/", view_func=route_static_public + ) + app.add_url_rule("/static/ui/", view_func=route_static_ui) diff --git a/src/modules/static.py b/src/modules/static.py new file mode 100644 index 0000000..f2c1e70 --- /dev/null +++ b/src/modules/static.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +""" +Agility Maps v2. + +Static files routes module. +""" +import flask + + +def route_static_public(path: str) -> flask.Response: + """ + Route /static/public/ + + :param str path: Path of file to get. + :return flask.Response: Public file. + """ + return flask.send_from_directory("public", path) + + +def route_static_ui(path: str) -> flask.Response: + """ + Route /static/ui/ + + :param str path: Path of file to get. + :return flask.Response: Static file. + """ + return flask.send_from_directory("ui", path) diff --git a/start.bat b/start.bat new file mode 100644 index 0000000..f20d3bc --- /dev/null +++ b/start.bat @@ -0,0 +1,5 @@ +@echo off +cd C:\Users\Joup\Apps\xampp\ +start /MIN xampp-control.exe +timeout 5 +start /MAX http://agilitymaps.lan/ \ No newline at end of file diff --git a/static/README.md b/static/README.md new file mode 100644 index 0000000..91c8bff --- /dev/null +++ b/static/README.md @@ -0,0 +1,12 @@ +# Agility Maps v2 + +## `/static/` Virtual static files directory + +### About + +This is a virtual directory of the /static path. + +### Contents + +- `public/`*` -> /public`* +- `ui/`*` -> /ui/`* diff --git a/static/public.ln b/static/public.ln new file mode 100644 index 0000000..27f8dec --- /dev/null +++ b/static/public.ln @@ -0,0 +1 @@ +../public \ No newline at end of file diff --git a/static/public/flags/ct.png b/static/public/flags/ct.png new file mode 100644 index 0000000..5041e30 Binary files /dev/null and b/static/public/flags/ct.png differ diff --git a/static/public/flags/da.png b/static/public/flags/da.png new file mode 100644 index 0000000..e2993d3 Binary files /dev/null and b/static/public/flags/da.png differ diff --git a/static/public/flags/de.png b/static/public/flags/de.png new file mode 100644 index 0000000..ac4a977 Binary files /dev/null and b/static/public/flags/de.png differ diff --git a/static/public/flags/es.png b/static/public/flags/es.png new file mode 100644 index 0000000..c2de2d7 Binary files /dev/null and b/static/public/flags/es.png differ diff --git a/static/public/flags/fi.png b/static/public/flags/fi.png new file mode 100644 index 0000000..14ec091 Binary files /dev/null and b/static/public/flags/fi.png differ diff --git a/static/public/flags/fr.png b/static/public/flags/fr.png new file mode 100644 index 0000000..8332c4e Binary files /dev/null and b/static/public/flags/fr.png differ diff --git a/static/public/flags/gb.png b/static/public/flags/gb.png new file mode 100644 index 0000000..ff701e1 Binary files /dev/null and b/static/public/flags/gb.png differ diff --git a/static/public/flags/hu.png b/static/public/flags/hu.png new file mode 100644 index 0000000..7baafe4 Binary files /dev/null and b/static/public/flags/hu.png differ diff --git a/static/public/flags/it.png b/static/public/flags/it.png new file mode 100644 index 0000000..89692f7 Binary files /dev/null and b/static/public/flags/it.png differ diff --git a/static/public/flags/jp.png b/static/public/flags/jp.png new file mode 100644 index 0000000..325fbad Binary files /dev/null and b/static/public/flags/jp.png differ diff --git a/static/public/flags/no.png b/static/public/flags/no.png new file mode 100644 index 0000000..160b6b5 Binary files /dev/null and b/static/public/flags/no.png differ diff --git a/static/public/flags/pl.png b/static/public/flags/pl.png new file mode 100644 index 0000000..d413d01 Binary files /dev/null and b/static/public/flags/pl.png differ diff --git a/static/public/flags/pt.png b/static/public/flags/pt.png new file mode 100644 index 0000000..ece7980 Binary files /dev/null and b/static/public/flags/pt.png differ diff --git a/static/public/flags/ru.png b/static/public/flags/ru.png new file mode 100644 index 0000000..59b6ff6 Binary files /dev/null and b/static/public/flags/ru.png differ diff --git a/static/public/flags/se.png b/static/public/flags/se.png new file mode 100644 index 0000000..1994653 Binary files /dev/null and b/static/public/flags/se.png differ diff --git a/static/public/fondu.png b/static/public/fondu.png new file mode 100644 index 0000000..fc726fd Binary files /dev/null and b/static/public/fondu.png differ diff --git a/static/public/icons/driver/dog.png b/static/public/icons/driver/dog.png new file mode 100644 index 0000000..529e09f Binary files /dev/null and b/static/public/icons/driver/dog.png differ diff --git a/static/public/icons/driver/fl.png b/static/public/icons/driver/fl.png new file mode 100644 index 0000000..bc85578 Binary files /dev/null and b/static/public/icons/driver/fl.png differ diff --git a/static/public/icons/driver/fr.png b/static/public/icons/driver/fr.png new file mode 100644 index 0000000..3736fba Binary files /dev/null and b/static/public/icons/driver/fr.png differ diff --git a/static/public/icons/driver/ll.png b/static/public/icons/driver/ll.png new file mode 100644 index 0000000..2691de5 Binary files /dev/null and b/static/public/icons/driver/ll.png differ diff --git a/static/public/icons/driver/lr.png b/static/public/icons/driver/lr.png new file mode 100644 index 0000000..9d6f281 Binary files /dev/null and b/static/public/icons/driver/lr.png differ diff --git a/static/public/icons/driver/ml.png b/static/public/icons/driver/ml.png new file mode 100644 index 0000000..9473955 Binary files /dev/null and b/static/public/icons/driver/ml.png differ diff --git a/static/public/icons/driver/mr.png b/static/public/icons/driver/mr.png new file mode 100644 index 0000000..b114967 Binary files /dev/null and b/static/public/icons/driver/mr.png differ diff --git a/static/public/icons/driver/neutral.png b/static/public/icons/driver/neutral.png new file mode 100644 index 0000000..f23be17 Binary files /dev/null and b/static/public/icons/driver/neutral.png differ diff --git a/static/public/icons/newtrj.png b/static/public/icons/newtrj.png new file mode 100644 index 0000000..ff92b71 Binary files /dev/null and b/static/public/icons/newtrj.png differ diff --git a/static/public/icons/numbers/num1.png b/static/public/icons/numbers/num1.png new file mode 100644 index 0000000..1236821 Binary files /dev/null and b/static/public/icons/numbers/num1.png differ diff --git a/static/public/icons/numbers/num2.png b/static/public/icons/numbers/num2.png new file mode 100644 index 0000000..5a182f1 Binary files /dev/null and b/static/public/icons/numbers/num2.png differ diff --git a/static/public/icons/numbers/num3.png b/static/public/icons/numbers/num3.png new file mode 100644 index 0000000..5297d32 Binary files /dev/null and b/static/public/icons/numbers/num3.png differ diff --git a/static/public/icons/obstacles/A.png b/static/public/icons/obstacles/A.png new file mode 100644 index 0000000..f6b1a14 Binary files /dev/null and b/static/public/icons/obstacles/A.png differ diff --git a/static/public/icons/obstacles/balance.png b/static/public/icons/obstacles/balance.png new file mode 100644 index 0000000..4c0de0f Binary files /dev/null and b/static/public/icons/obstacles/balance.png differ diff --git a/static/public/icons/obstacles/double-jump.png b/static/public/icons/obstacles/double-jump.png new file mode 100644 index 0000000..ca3fd96 Binary files /dev/null and b/static/public/icons/obstacles/double-jump.png differ diff --git a/static/public/icons/obstacles/jump.png b/static/public/icons/obstacles/jump.png new file mode 100644 index 0000000..82e0cbb Binary files /dev/null and b/static/public/icons/obstacles/jump.png differ diff --git a/static/public/icons/obstacles/long-jump.png b/static/public/icons/obstacles/long-jump.png new file mode 100644 index 0000000..714a7f0 Binary files /dev/null and b/static/public/icons/obstacles/long-jump.png differ diff --git a/static/public/icons/obstacles/run.png b/static/public/icons/obstacles/run.png new file mode 100644 index 0000000..dba2721 Binary files /dev/null and b/static/public/icons/obstacles/run.png differ diff --git a/static/public/icons/obstacles/slalom.png b/static/public/icons/obstacles/slalom.png new file mode 100644 index 0000000..b7b6a7e Binary files /dev/null and b/static/public/icons/obstacles/slalom.png differ diff --git a/static/public/icons/obstacles/slalom6.png b/static/public/icons/obstacles/slalom6.png new file mode 100644 index 0000000..e7e7b97 Binary files /dev/null and b/static/public/icons/obstacles/slalom6.png differ diff --git a/static/public/icons/obstacles/sock.png b/static/public/icons/obstacles/sock.png new file mode 100644 index 0000000..22da093 Binary files /dev/null and b/static/public/icons/obstacles/sock.png differ diff --git a/static/public/icons/obstacles/table.png b/static/public/icons/obstacles/table.png new file mode 100644 index 0000000..987a871 Binary files /dev/null and b/static/public/icons/obstacles/table.png differ diff --git a/static/public/icons/obstacles/tire.png b/static/public/icons/obstacles/tire.png new file mode 100644 index 0000000..548bde5 Binary files /dev/null and b/static/public/icons/obstacles/tire.png differ diff --git a/static/public/icons/obstacles/tunnel.png b/static/public/icons/obstacles/tunnel.png new file mode 100644 index 0000000..97260c9 Binary files /dev/null and b/static/public/icons/obstacles/tunnel.png differ diff --git a/static/public/icons/obstacles/tunnel3.png b/static/public/icons/obstacles/tunnel3.png new file mode 100644 index 0000000..dc1fe35 Binary files /dev/null and b/static/public/icons/obstacles/tunnel3.png differ diff --git a/static/public/icons/obstacles/wall.png b/static/public/icons/obstacles/wall.png new file mode 100644 index 0000000..8e89f4c Binary files /dev/null and b/static/public/icons/obstacles/wall.png differ diff --git a/static/public/icons/trash.png b/static/public/icons/trash.png new file mode 100644 index 0000000..cbbc8f9 Binary files /dev/null and b/static/public/icons/trash.png differ diff --git a/static/public/icons/zoom/minus.png b/static/public/icons/zoom/minus.png new file mode 100644 index 0000000..ebf304b Binary files /dev/null and b/static/public/icons/zoom/minus.png differ diff --git a/static/public/icons/zoom/plus.png b/static/public/icons/zoom/plus.png new file mode 100644 index 0000000..3a52a88 Binary files /dev/null and b/static/public/icons/zoom/plus.png differ diff --git a/static/public/tabs/flags/ct.png b/static/public/tabs/flags/ct.png new file mode 100644 index 0000000..22e9ba8 Binary files /dev/null and b/static/public/tabs/flags/ct.png differ diff --git a/static/public/tabs/flags/da.png b/static/public/tabs/flags/da.png new file mode 100644 index 0000000..3f4dac3 Binary files /dev/null and b/static/public/tabs/flags/da.png differ diff --git a/static/public/tabs/flags/de.png b/static/public/tabs/flags/de.png new file mode 100644 index 0000000..77e9338 Binary files /dev/null and b/static/public/tabs/flags/de.png differ diff --git a/static/public/tabs/flags/es.png b/static/public/tabs/flags/es.png new file mode 100644 index 0000000..38b66bc Binary files /dev/null and b/static/public/tabs/flags/es.png differ diff --git a/static/public/tabs/flags/fi.png b/static/public/tabs/flags/fi.png new file mode 100644 index 0000000..97d47a9 Binary files /dev/null and b/static/public/tabs/flags/fi.png differ diff --git a/static/public/tabs/flags/fr.png b/static/public/tabs/flags/fr.png new file mode 100644 index 0000000..12318d4 Binary files /dev/null and b/static/public/tabs/flags/fr.png differ diff --git a/static/public/tabs/flags/gb.png b/static/public/tabs/flags/gb.png new file mode 100644 index 0000000..3853f5e Binary files /dev/null and b/static/public/tabs/flags/gb.png differ diff --git a/static/public/tabs/flags/hu.png b/static/public/tabs/flags/hu.png new file mode 100644 index 0000000..af757c6 Binary files /dev/null and b/static/public/tabs/flags/hu.png differ diff --git a/static/public/tabs/flags/it.png b/static/public/tabs/flags/it.png new file mode 100644 index 0000000..c31017e Binary files /dev/null and b/static/public/tabs/flags/it.png differ diff --git a/static/public/tabs/flags/jp.png b/static/public/tabs/flags/jp.png new file mode 100644 index 0000000..29c45d5 Binary files /dev/null and b/static/public/tabs/flags/jp.png differ diff --git a/static/public/tabs/flags/no.png b/static/public/tabs/flags/no.png new file mode 100644 index 0000000..2b03236 Binary files /dev/null and b/static/public/tabs/flags/no.png differ diff --git a/static/public/tabs/flags/nt.png b/static/public/tabs/flags/nt.png new file mode 100644 index 0000000..d5ea768 Binary files /dev/null and b/static/public/tabs/flags/nt.png differ diff --git a/static/public/tabs/flags/pl.png b/static/public/tabs/flags/pl.png new file mode 100644 index 0000000..7a71804 Binary files /dev/null and b/static/public/tabs/flags/pl.png differ diff --git a/static/public/tabs/flags/pt.png b/static/public/tabs/flags/pt.png new file mode 100644 index 0000000..5b39073 Binary files /dev/null and b/static/public/tabs/flags/pt.png differ diff --git a/static/public/tabs/flags/ru.png b/static/public/tabs/flags/ru.png new file mode 100644 index 0000000..f7be413 Binary files /dev/null and b/static/public/tabs/flags/ru.png differ diff --git a/static/public/tabs/flags/se.png b/static/public/tabs/flags/se.png new file mode 100644 index 0000000..2c9bd9d Binary files /dev/null and b/static/public/tabs/flags/se.png differ diff --git a/static/public/tabs/focused/conducteur.png b/static/public/tabs/focused/conducteur.png new file mode 100644 index 0000000..a4b9ea2 Binary files /dev/null and b/static/public/tabs/focused/conducteur.png differ diff --git a/static/public/tabs/focused/import.png b/static/public/tabs/focused/import.png new file mode 100644 index 0000000..e1ae036 Binary files /dev/null and b/static/public/tabs/focused/import.png differ diff --git a/static/public/tabs/focused/obstacles.png b/static/public/tabs/focused/obstacles.png new file mode 100644 index 0000000..fe96976 Binary files /dev/null and b/static/public/tabs/focused/obstacles.png differ diff --git a/static/public/tabs/focused/param.png b/static/public/tabs/focused/param.png new file mode 100644 index 0000000..3417691 Binary files /dev/null and b/static/public/tabs/focused/param.png differ diff --git a/static/public/tabs/focused/sav.png b/static/public/tabs/focused/sav.png new file mode 100644 index 0000000..11692ff Binary files /dev/null and b/static/public/tabs/focused/sav.png differ diff --git a/static/public/tabs/focused/trj.png b/static/public/tabs/focused/trj.png new file mode 100644 index 0000000..11ff972 Binary files /dev/null and b/static/public/tabs/focused/trj.png differ diff --git a/static/public/tabs/unfocused/conducteur.png b/static/public/tabs/unfocused/conducteur.png new file mode 100644 index 0000000..9d93159 Binary files /dev/null and b/static/public/tabs/unfocused/conducteur.png differ diff --git a/static/public/tabs/unfocused/import.png b/static/public/tabs/unfocused/import.png new file mode 100644 index 0000000..1ad05f3 Binary files /dev/null and b/static/public/tabs/unfocused/import.png differ diff --git a/static/public/tabs/unfocused/obstacles.png b/static/public/tabs/unfocused/obstacles.png new file mode 100644 index 0000000..221dbb4 Binary files /dev/null and b/static/public/tabs/unfocused/obstacles.png differ diff --git a/static/public/tabs/unfocused/param.png b/static/public/tabs/unfocused/param.png new file mode 100644 index 0000000..f116c03 Binary files /dev/null and b/static/public/tabs/unfocused/param.png differ diff --git a/static/public/tabs/unfocused/sav.png b/static/public/tabs/unfocused/sav.png new file mode 100644 index 0000000..357c438 Binary files /dev/null and b/static/public/tabs/unfocused/sav.png differ diff --git a/static/public/tabs/unfocused/trj.png b/static/public/tabs/unfocused/trj.png new file mode 100644 index 0000000..a717438 Binary files /dev/null and b/static/public/tabs/unfocused/trj.png differ diff --git a/static/public/title/flag-icons/ct.png b/static/public/title/flag-icons/ct.png new file mode 100644 index 0000000..100bcc3 Binary files /dev/null and b/static/public/title/flag-icons/ct.png differ diff --git a/static/public/title/flag-icons/da.png b/static/public/title/flag-icons/da.png new file mode 100644 index 0000000..dce1a15 Binary files /dev/null and b/static/public/title/flag-icons/da.png differ diff --git a/static/public/title/flag-icons/de.png b/static/public/title/flag-icons/de.png new file mode 100644 index 0000000..e733fad Binary files /dev/null and b/static/public/title/flag-icons/de.png differ diff --git a/static/public/title/flag-icons/es.png b/static/public/title/flag-icons/es.png new file mode 100644 index 0000000..7cd0d00 Binary files /dev/null and b/static/public/title/flag-icons/es.png differ diff --git a/static/public/title/flag-icons/fi.png b/static/public/title/flag-icons/fi.png new file mode 100644 index 0000000..6a52741 Binary files /dev/null and b/static/public/title/flag-icons/fi.png differ diff --git a/static/public/title/flag-icons/fr.png b/static/public/title/flag-icons/fr.png new file mode 100644 index 0000000..a2380a7 Binary files /dev/null and b/static/public/title/flag-icons/fr.png differ diff --git a/static/public/title/flag-icons/gb.png b/static/public/title/flag-icons/gb.png new file mode 100644 index 0000000..4728d07 Binary files /dev/null and b/static/public/title/flag-icons/gb.png differ diff --git a/static/public/title/flag-icons/hu.png b/static/public/title/flag-icons/hu.png new file mode 100644 index 0000000..59c1ad4 Binary files /dev/null and b/static/public/title/flag-icons/hu.png differ diff --git a/static/public/title/flag-icons/it.png b/static/public/title/flag-icons/it.png new file mode 100644 index 0000000..106ef3f Binary files /dev/null and b/static/public/title/flag-icons/it.png differ diff --git a/static/public/title/flag-icons/jp.png b/static/public/title/flag-icons/jp.png new file mode 100644 index 0000000..4e1f51d Binary files /dev/null and b/static/public/title/flag-icons/jp.png differ diff --git a/static/public/title/flag-icons/no.png b/static/public/title/flag-icons/no.png new file mode 100644 index 0000000..186adcd Binary files /dev/null and b/static/public/title/flag-icons/no.png differ diff --git a/static/public/title/flag-icons/pl.png b/static/public/title/flag-icons/pl.png new file mode 100644 index 0000000..8e2c9a7 Binary files /dev/null and b/static/public/title/flag-icons/pl.png differ diff --git a/static/public/title/flag-icons/pt.png b/static/public/title/flag-icons/pt.png new file mode 100644 index 0000000..e71ff4a Binary files /dev/null and b/static/public/title/flag-icons/pt.png differ diff --git a/static/public/title/flag-icons/ru.png b/static/public/title/flag-icons/ru.png new file mode 100644 index 0000000..c85c6d3 Binary files /dev/null and b/static/public/title/flag-icons/ru.png differ diff --git a/static/public/title/flag-icons/se.png b/static/public/title/flag-icons/se.png new file mode 100644 index 0000000..3b13273 Binary files /dev/null and b/static/public/title/flag-icons/se.png differ diff --git a/static/public/title/logo150.png b/static/public/title/logo150.png new file mode 100644 index 0000000..53af2dc Binary files /dev/null and b/static/public/title/logo150.png differ diff --git a/static/public/title/title.png b/static/public/title/title.png new file mode 100644 index 0000000..b106d16 Binary files /dev/null and b/static/public/title/title.png differ diff --git a/static/ui.ln b/static/ui.ln new file mode 100644 index 0000000..3d1a7bc --- /dev/null +++ b/static/ui.ln @@ -0,0 +1 @@ +../ui \ No newline at end of file diff --git a/static/ui/app/css/interface.css b/static/ui/app/css/interface.css new file mode 100644 index 0000000..4d06e87 --- /dev/null +++ b/static/ui/app/css/interface.css @@ -0,0 +1,664 @@ +body { + background: #555555; + margin: 0; + padding: 0; + font-size: 10px; + font-family: Tahoma; + color: #dddddd; + background-image: url("/static/public/fondu.png"); + background-repeat: repeat-x; +} +#logo { + position: absolute; + top: 0px; + left: 16px; + z-index: 100; +} +#titreLogo { + position: absolute; + top: 7px; + left: 700px; + z-index: 100; +} +#medaille { + position: absolute; + top: 55px; + left: 53px; + z-index: 100; +} +.barreTitre { + font-family: Georgia; + height: 5px; + width: 100%; + + position: absolute; + color: #99ddff; + padding-left: 80px; + font-size: 20px; + z-index: 10; +} +.titleText { + float: left; + font-size: 20px; +} +.subtitle { + float: left; + font-size: 10px; +} +.barreOptions { + height: 61px; + /*width: 900px;*/ + width: 830px; + position: absolute; + float: left; + left: 0px; + padding-left: 120px; + top: 26px; + font-size: 11px; + z-index: 10; +} + +#blocOParam { + text-align: center; +} +#contentBlocOParam { + margin-top: -3px; + text-align: center; +} +#blocOObst { + text-align: center; +} +#contentBlocOObst { + margin-top: -3px; + text-align: center; +} +#blocOTrj { + text-align: center; +} +#contentBlocOTrj { + margin-top: -3px; + text-align: center; +} +#blocOCon { + text-align: center; +} +#contentBlocOCon { + margin-top: -3px; + text-align: center; +} +#blocOCou { + text-align: center; +} +#contentBlocOColor { + margin-top: -3px; + text-align: center; +} +#blocOSav { + text-align: center; +} +#contentBlocOSav { + margin-top: -3px; + text-align: center; +} +#blocOImp { + text-align: center; +} +#contentBlocOImp { + margin-top: -3px; + text-align: center; +} +#blocOLangue { + text-align: center; +} +#contentBlocOLangue { + margin-top: -3px; + text-align: center; +} +.blocOptions:hover, +.blocOptionsSel { + color: #99ddff; + border-left: solid #444444 1px; + border-right: solid #444444 1px; + border-top: solid #444444 1px; + float: left; + position: relative; + height: 55px; + margin-top: -5px; + padding-top: 5px; + width: 85px; + background-image: -webkit-linear-gradient(top, #aaaaaa 0%, #727272 100%); + background-image: -moz-linear-gradient(top, #aaaaaa 0%, #727272 100%); + background-image: -ms-linear-gradient(top, #aaaaaa 0%, #727272 100%); + background-image: -o-linear-gradient(top, #aaaaaa 0%, #727272 100%); + background-image: linear-gradient(top, #aaaaaa 0%, #727272 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#AAAAAA',endColorstr='#777777', GradientType=0); +} +.blocOptions { + border-left: solid #444444 1px; + border-right: solid #444444 1px; + border-top: solid #444444 1px; + float: left; + position: relative; + height: 55px; + width: 85px; + padding-top: 5px; + background-image: -webkit-linear-gradient(top, #888888 0%, #555555 100%); + background-image: -moz-linear-gradient(top, #888888 0%, #555555 100%); + background-image: -ms-linear-gradient(top, #888888 0%, #555555 100%); + background-image: -o-linear-gradient(top, #888888 0%, #555555 100%); + background-image: linear-gradient(top, #888888 0%, #555555 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#555555',endColorstr='#888888', GradientType=0); +} +.barreInfo { + height: 30px; + width: 900px; + background: #777777; + position: absolute; + float: left; + left: 0px; + top: 58px; + z-index: 12; + padding-left: 120px; + background-image: -webkit-linear-gradient(top, #777777 0%, #555555 100%); + background-image: -moz-linear-gradient(top, #777777 0%, #555555 100%); + background-image: -ms-linear-gradient(top, #777777 0%, #555555 100%); + background-image: -o-linear-gradient(top, #777777 0%, #555555 100%); + background-image: linear-gradient(top, #777777 0%, #555555 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#555555',endColorstr='#727272', GradientType=0); +} +.barreOutil { + position: absolute; + bottom: 0px; + top: 88px; + width: 120px; + left: 0px; + background: #777777; + height: 600px; + z-index: 8; + + background-image: -webkit-linear-gradient( + right top, + #555555 0%, + #727272 100% + ); + background-image: -moz-linear-gradient(right top, #555555 0%, #727272 100%); + background-image: -ms-linear-gradient(right top, #555555 0%, #727272 100%); + background-image: -o-linear-gradient(right top, #555555 0%, #727272 100%); + background-image: linear-gradient(right top, #555555 0%, #727272 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#727272',endColorstr='#555555', GradientType=1); +} + +#barreOutilCache { + position: absolute; + bottom: 0px; + top: 88px; + width: 15px; + left: 95px; + background: #777777; + + z-index: 8; + + color: white; + background-image: -webkit-linear-gradient( + right top, + #555555 0%, + #727272 100% + ); + background-image: -moz-linear-gradient(right top, #555555 0%, #727272 100%); + background-image: -ms-linear-gradient(right top, #555555 0%, #727272 100%); + background-image: -o-linear-gradient(right top, #555555 0%, #727272 100%); + background-image: linear-gradient(right top, #555555 0%, #727272 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#727272',endColorstr='#555555', GradientType=1); +} + +#barreTitreCache { + height: 15px; + width: 100%; + background: #777777; + position: absolute; + float: left; + left: 0px; + top: 88px; + z-index: 1000; + background-image: -webkit-linear-gradient(top, #777777 0%, #555555 100%); + background-image: -moz-linear-gradient(top, #777777 0%, #555555 100%); + background-image: -ms-linear-gradient(top, #777777 0%, #555555 100%); + background-image: -o-linear-gradient(top, #777777 0%, #555555 100%); + background-image: linear-gradient(top, #777777 0%, #555555 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#555555',endColorstr='#727272', GradientType=0); +} + +.blocOutil { + margin: 5px; +} + +.blocInfo { + padding-left: 10px; + padding-right: 10px; + padding-top: 5px; + padding-bottom: 5px; + border-bottom: solid #444444 1px; + float: top; + position: relative; +} + +.blocInfo:hover { + background: #999999; +} +.titreBloc { + width: 100%; + float: top; + text-align: center; + border-top: solid #444444 1px; +} +.contenu { + position: relative; + float: left; +} + +.boutonOutil { + -webkit-border-radius: 4; + -moz-border-radius: 4; + border-radius: 4px; + color: white; + font-size: 10px; + background: #999999; + border: solid #444444 1px; + /*text-decoration: none;*/ + margin: 1px; + height: 50px; + width: 50px; +} +.ligneBarreOutil { + width: 100%; +} +.checkboxTable { + float: left; + text-align: left; +} +.boutonOutil:hover { + border: solid #99ddff 1px; +} +.haie { + background-image: url("/static/public/icons/obstacles/jump.png"); +} +.poubelle { + background-image: url("/static/public/icons/trash.png"); + background-repeat: no-repeat; +} +.num { + background-image: url("/static/public/icons/numbers/num1.png"); + background-repeat: no-repeat; +} +.num2 { + background-image: url("/static/public/icons/numbers/num2.png"); + background-repeat: no-repeat; +} +.num3 { + background-image: url("/static/public/icons/numbers/num3.png"); + background-repeat: no-repeat; +} + +.oxer { + background-image: url("/static/public/icons/obstacles/double-jump.png"); +} + +.mur { + background-image: url("/static/public/icons/obstacles/wall.png"); +} + +.longueur { + background-image: url("/static/public/icons/obstacles/long-jump.png"); +} +.table { + background-image: url("/static/public/icons/obstacles/table.png"); +} +.tunnel { + background-image: url("/static/public/icons/obstacles/tunnel.png"); +} +.tunnel3 { + background-image: url("/static/public/icons/obstacles/tunnel3.png"); +} +.cho { + background-image: url("/static/public/icons/obstacles/sock.png"); +} +.slalom { + background-image: url("/static/public/icons/obstacles/slalom.png"); +} +.slalom6 { + background-image: url("/static/public/icons/obstacles/slalom6.png"); +} +.pne { + background-image: url("/static/public/icons/obstacles/tire.png"); +} +.pal { + background-image: url("/static/public/icons/obstacles/A.png"); +} +.bal { + background-image: url("/static/public/icons/obstacles/balance.png"); +} +.pas { + background-image: url("/static/public/icons/obstacles/run.png"); +} + +.zoomP { + background-image: url("/static/public/icons/zoom/plus.png"); + background-repeat: no-repeat; + background-position: center; +} +.zoomM { + background-image: url("/static/public/icons/zoom/minus.png"); + background-repeat: no-repeat; + background-position: center; +} +.newTrj { + background-image: url("/static/public/icons/newtrj.png"); + background-repeat: no-repeat; + background-position: center; +} +.dMilieu { + background-image: url("/static/public/icons/driver/mr.png"); + background-repeat: no-repeat; +} +.gMilieu { + background-image: url("/static/public/icons/driver/ml.png"); + background-repeat: no-repeat; +} +.dLong { + background-image: url("/static/public/icons/driver/lr.png"); + background-repeat: no-repeat; +} +.gLong { + background-image: url("/static/public/icons/driver/ll.png"); + background-repeat: no-repeat; +} +.dAvant { + background-image: url("/static/public/icons/driver/fr.png"); + background-repeat: no-repeat; +} +.gAvant { + background-image: url("/static/public/icons/driver/fl.png"); + background-repeat: no-repeat; +} +.neutre { + background-image: url("/static/public/icons/driver/neutral.png"); + background-repeat: no-repeat; +} +.chien { + background-image: url("/static/public/icons/driver/dog.png"); + background-repeat: no-repeat; +} + +option { + font-size: 12px; + font-family: Tahoma; + background-color: #666666; + border: solid #444444 1px; + color: #dddddd; +} +select { + font-size: 12px; + font-family: Tahoma; + background-color: #666666; + border: solid #444444 1px; + color: #dddddd; + width: 105px; +} +input { + font-size: 12px; + font-family: Tahoma; +} + +input[type="text"] { + background-color: #666666; + border: solid #111111 1px; + color: #dddddd; + float: left; + position: relative; + width: 100px; + margin-bottom: 3px; +} +.ligneCheckboxTable:hover { + background-color: grey; +} +.txtOption { + font-size: 10px; + font-family: Tahoma; + float: top; + position: relative; + padding-left: 4px; + padding-right: 4px; +} +.txtCheckbox { + float: left; + text-align: left; +} +.boutonImage { + font-size: 10px; + font-family: Tahoma; + float: top; + position: relative; + width: 100%; + padding: 4px; + margin-top: 4px; +} +.txtFb { + background-color: #ccc; + padding: 5px; + margin: 5px; + border: solid #444444 1px; + color: #dddddd; +} +#blocInfoLangueFr { + display: none; +} +#blocInfoLanguePt { + display: none; + } +#blocInfoLangueEn { + display: none; +} +#blocInfoLangueEs { + display: none; +} +#blocInfoLangueDe { + display: none; +} +#blocInfoLangueIt { + display: none; +} +#blocInfoLanguePl { + display: none; +} +#blocInfoLangueCt { + display: none; +} +#blocInfoLangueJp { + display: none; +} +#blocInfoLangueSe { + display: none; +} +#blocInfoLangueFi { + display: none; +} +#blocInfoLangueDa { + display: none; +} +#blocInfoLangueNo { + display: none; +} + +#blocInfoLangueHu { + display: none; +} +#blocInfoLangueRu { + display: none; +} +#blocInfoColor { + display: none; +} + +#blocInfoColorPerso { + display: none; +} + +#blocInfoTraj { + display: none; +} + +#blocInfoParam { + display: none; +} + +#blocInfoDim2 { + display: none; +} + +#blocInfoDim1 { + display: none; +} +#blocInfoSauvegarde { + display: none; +} +#blocInfoCon { + display: none; +} + +.noStyle { + margin: 0; + padding: 0; + float: left; + display: block; +} + +#contentCanvas { + position: absolute; + top: 90px; + left: 120px; + z-index: 340; + /*padding-top: 90px; + padding-left: 120px;*/ +} + +#canvas { + background: #ffffff; + z-index: 350; +} +.imageExport { + position: absolute; + left: 0px; + top: 0px; + + visibility: visible; + z-index: 200; +} +#canvasimg { + visibility: hidden; + position: absolute; + left: 0px; + top: 40px; + z-index: 1000; +} +.imageNotExport { + display: none; +} +.fondExport { + color: white; + text-align: center; + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + visibility: visible; + /* z-index: 400; */ + z-index: 150; +} +.fondNoExport { + visibility: hidden; +} + +.exempleCouleur { + width: 20px; + height: 15px; + background-color: white; + float: left; + display: block; + position: relative; + margin-left: 6px; + margin-right: 6px; +} + +#texte { + position: relative; + float: left; +} + +.colorSample { + width: 20px; + height: 15px; + float: left; + margin-right: 5px; + margin-left: 5px; + border: solid black 1px; +} +.miniColorSample { + width: 10px; + height: 15px; + float: left; +} +#color-white, #color-white-2 { + background-color: rgba(255, 255, 255, 1); +} +#color-blue, #color-blue-2 { + background-color: rgba(211, 228, 240, 1); +} +#color-green, #color-green-2 { + background-color: rgba(204, 255, 204, 1); +} + +#color-blueObst { + background-color: rgba(34, 170, 255, 1); +} +#color-redObst { + background-color: rgba(204, 51, 0, 1); +} +#color-greyObst { + background-color: rgba(221, 221, 221, 1); +} +#color-black { + background-color: rgba(30, 30, 30, 1); +} +#color-pink { + background-color: rgba(249, 141, 228, 1); +} +#color-grey-con { + background-color: rgba(221, 221, 221, 1); +} +#color-red-con { + background-color: rgba(204, 51, 0, 1); +} +#color-blue-con { + background-color: rgba(34, 170, 255, 1); +} + +#outils { + display: block; +} + +#contentCanvas-col1 { + float:left; +} + +#contentCanvas-col2 { + /* position: absolute; */ + /* top: 0px; */ + /* left: 870px; */ + /* z-index: 340; */ + width: 150px; + /*border: 1px solid white;*/ + padding-left:10px; + overflow: hidden; +} \ No newline at end of file diff --git a/static/ui/app/css/print.css b/static/ui/app/css/print.css new file mode 100644 index 0000000..573bc61 --- /dev/null +++ b/static/ui/app/css/print.css @@ -0,0 +1,36 @@ +body { + background: #fff; + margin: 0; + padding: 0; +} + +div { + display: none; +} + +#canvasTxt { + display: none; +} +#canvasimg { + position: absolute; + left: 0px; + top: 0px; + display: block; +} +.imageExport { + position: absolute; + left: 0px; + top: 0px; + display: block; +} + +.imageNotExport { + display: none; +} +.fondExport { + color: white; + display: block; +} +.fondNoExport { + display: none; +} diff --git a/static/ui/app/src/add-obstacles.js b/static/ui/app/src/add-obstacles.js new file mode 100644 index 0000000..988b0ea --- /dev/null +++ b/static/ui/app/src/add-obstacles.js @@ -0,0 +1,459 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////AJOUT DES OBSTACLES//////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function createItem(id) { + if (suppression) { + supprimerObstacle(); + } + decalX = 0; + decalY = 0; + if (overTunnelId != -1) { + decalX = canvas_x - tbTunnels[id][nbArticulationTunnel * 2 + 1]; + decalY = canvas_y - tbTunnels[id][nbArticulationTunnel * 2 + 2]; + document.body.style.cursor = "pointer"; + + selTunnel = overTunnelId; + selPointTunnel = overPointTunnel; + } else if (overObject != -1) { + document.body.style.cursor = "move"; + selObst = overObject; + + decalX = getXCliquable(selObst) / 2; + decalY = getYCliquable(selObst) / 2; + setCanvasX(selObst, canvas_x - decalX); + setCanvasY(selObst, canvas_y - decalY); + genererParcours(); + } +} +function ajouterHaie() { + var obstacle = new Array(); + obstacle[0] = id; // id + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = (144 + 50 + 50) / pixel; //largeur X cliquable + obstacle[5] = 1; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "haie"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 90; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[5]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterPasserelle() { + var obstacle = new Array(); + obstacle[0] = id; + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = 1140 / pixel; //largeur X cliquable + obstacle[5] = 30 / pixel; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "passerelle"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 0; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[4]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterBalancoire() { + var obstacle = new Array(); + obstacle[0] = id; + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = 380 / pixel; //largeur X cliquable + obstacle[5] = 30 / pixel; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "balancoire"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 0; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[4]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterSlalom() { + var obstacle = new Array(); + obstacle[0] = id; + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = (11 * 60) / pixel; //largeur X cliquable + obstacle[5] = 1; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "slalom"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 0; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[4]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} + +function ajouterSlalom6() { + var obstacle = new Array(); + obstacle[0] = id; + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = (11 * 28) / pixel; //largeur X cliquable + obstacle[5] = 1; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "slalom6"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 0; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[4]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} + +function ajouterPalissade() { + var obstacle = new Array(); + obstacle[0] = id; + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = 390 / pixel; //largeur X cliquable + obstacle[5] = 102 / pixel; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "palissade"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 0; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[4]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterChaussette() { + var obstacle = new Array(); + obstacle[0] = id; + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = 73; //largeur X cliquable + obstacle[5] = 10; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "chaussette"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 0; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[4]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterLongueur() { + var obstacle = new Array(); + obstacle[0] = id; + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = 150 / pixel; //largeur X cliquable + obstacle[5] = 150 / pixel; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "longueur"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 90; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[5]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterMur() { + var obstacle = new Array(); + obstacle[0] = id; // id + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = (144 + LARGEUR_MUR_TOUR + LARGEUR_MUR_TOUR) / pixel; //largeur X cliquable + obstacle[5] = 4; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "mur"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 90; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[5]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterTable() { + var obstacle = new Array(); + obstacle[0] = id; // id + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = DIM_TABLE; //largeur X cliquable + obstacle[5] = DIM_TABLE; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "table"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[4]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[4]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 0; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[4]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterOxer() { + var obstacle = new Array(); + obstacle[0] = id; // id + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = (144 + 50 + 50) / pixel; //largeur X cliquable + obstacle[5] = 55 / pixel; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "oxer"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = -90; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[5]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} +function ajouterPneu() { + var obstacle = new Array(); + obstacle[0] = id; // id + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[3] = "IMG"; // Image affiché à l'écran + obstacle[4] = 150 / pixel; //largeur X cliquable + obstacle[5] = 150 / pixel; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "pneu"; //type + obstacle[8] = obstacle[4]; // modif sur X pour trajectoires d'entrée + obstacle[9] = obstacle[5]; // modif sur Y pour trajectoires d'entrée + obstacle[10] = obstacle[4]; // modif sur X pour trajectoires de sortie + obstacle[11] = obstacle[5]; // modif sur Y pour trajectoires de sortie + obstacle[12] = 90; // modif sur angle pour trajectoires de sortie + obstacle[13] = obstacle[5]; // longueur pour trajectoires (X ou Y selon obstacle) + obstacle[14] = distObstTrajectoire; // distance de la trajectoire + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} + +function ajouterConducteur(sens) { + var obstacle = new Array(); + obstacle[0] = id; // id + obstacle[3] = sens; // sens + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[4] = 30; //largeur X cliquable + obstacle[5] = 30; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "conducteur"; //type + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} + +function ajouterChien() { + var obstacle = new Array(); + obstacle[0] = id; // id + obstacle[3] = 0; // sens + overObject = id; + obstacle[1] = canvas_x; // position X + obstacle[2] = canvas_y; // position Y + obstacle[4] = 30; //largeur X cliquable + obstacle[5] = 25; //hauteur Y cliquable + obstacle[6] = 0; //angle en degré + obstacle[7] = "chien"; //type + tbObst[id] = obstacle; + createItem(id); + id++; + genererParcours(); +} + +function ajouterTunnel(type) { + if (type == 3) { + var distMax = distMaxTunnel3; + } else { + var distMax = distMaxTunnel; + } + var tunnel = new Array(); + tunnel[0] = idTunnel; + tunnel[nbArticulationTunnel * 2 + 3] = type; + overPointTunnel = nbArticulationTunnel; + overTunnelId = idTunnel; + + for (var art = 0; art < nbArticulationTunnel; art++) { + tunnel[art * 2 + 1] = canvas_x + art * distMax; // position X premier point + tunnel[art * 2 + 2] = canvas_y; // position Y premier point + } + + tbTunnels[idTunnel] = tunnel; + createItem(idTunnel); + idTunnel++; + genererParcours(); +} +function ajouterNumero(type) { + if (suppression) { + supprimerObstacle(); + } + var numero = new Array(); + + if (type == 1) { + if (id == 0 && idTunnel == 0) { + return; + } + var newNumber = nextNumber; + } else if (type == 2) { + var newNumber = nextNumber2; + } else if (type == 3) { + var newNumber = nextNumber3; + } + + if (type == 1) { + for (var i = 1; i < nextNumber && newNumber != i - 1; i++) { + if (listeNumero[i] == "") { + newNumber = i; + } + } + } else if (type == 2) { + for (var i = 1; i < nextNumber2 && newNumber != i - 1; i++) { + if (listeNumero2[i] == "") { + newNumber = i; + } + } + } else if (type == 3) { + for (var i = 1; i < nextNumber3 && newNumber != i - 1; i++) { + if (listeNumero3[i] == "") { + newNumber = i; + } + } + } + + decalX = LARGEUR_NUMERO / 2; + decalY = HAUTEUR_NUMERO / 2; + document.body.style.cursor = "move"; + numero[0] = newNumber; + + //if(canvas_x==null || canvas_x<0){ + numero[1] = MARGE; //X + numero[2] = MARGE; //Y + //} + //numero[1]=canvas_x;//X + //numero[2]=canvas_y;//Y + if (type == 1) { + listeNumero[newNumber] = numero; + selNumeroId = newNumber; + if (newNumber == nextNumber) { + nextNumber++; + } + } else if (type == 2) { + listeNumero2[newNumber] = numero; + selNumeroId2 = newNumber; + if (newNumber == nextNumber2) { + nextNumber2++; + } + } else if (type == 3) { + listeNumero3[newNumber] = numero; + selNumeroId3 = newNumber; + if (newNumber == nextNumber3) { + nextNumber3++; + } + } + + doMove(); + genererParcours(); +} +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////SUPPRESSION DES OBSTACLES////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function supprimerObstacle() { + suppression = !suppression; + if (suppression) { + document.body.style.cursor = "no-drop"; + } else { + document.body.style.cursor = "default"; + } +} diff --git a/static/ui/app/src/color.js b/static/ui/app/src/color.js new file mode 100644 index 0000000..a176887 --- /dev/null +++ b/static/ui/app/src/color.js @@ -0,0 +1,340 @@ +function changeColor(e, couleur) { + if (!color) { + document.getElementById(couleur).style.width = "256px"; + document.getElementById(couleur).style.backgroundImage = + "url('palette.jpg')"; + } else { + myFunction(e, couleur); + changeCouleurObstacle(couleur); + document.getElementById(couleur).style.width = "20px"; + document.getElementById(couleur).style.backgroundImage = ""; + } + color = !color; +} + +function colorOut(couleur) { + document.getElementById(couleur).style.width = "20px"; + document.getElementById(couleur).style.backgroundImage = ""; + color = false; +} + +var DECALX0 = 170; +var DECALY0 = 65; + +var DECALX1 = 259; +var DECALY1 = 65; + +var DECALX2 = 348; +var DECALY2 = 65; + +var DECALX3 = 437; +var DECALY3 = 65; + +var TAILLE_X = 256; // couleurs +var TAILLE_Y = 15; // luminosité + +var rouge = 0; +var vert = TAILLE_X / 3; +var jaune = TAILLE_X / 6; +var bleu = TAILLE_X / 3 + TAILLE_X / 3; +var cyan = TAILLE_X / 6 + TAILLE_X / 3; +var majenta = TAILLE_X - TAILLE_X / 6; +var rouge2 = TAILLE_X; + +var MaxColor = 255; +var r = 0; +var v = 0; +var b = 0; +function myFunction(e, couleur) { + if (couleur == "Couleur1") { + x = e.clientX - DECALX1; + y = e.clientY - DECALY1; + } else if (couleur == "Couleur2") { + x = e.clientX - DECALX2; + y = e.clientY - DECALY2; + } else if (couleur == "Couleur3") { + x = e.clientX - DECALX3; + y = e.clientY - DECALY3; + } else if (couleur == "Couleur0") { + x = e.clientX - DECALX0; + y = e.clientY - DECALY0; + } + + r = 0; + v = 0; + b = 0; + + if (x < jaune) { + r = MaxColor; + v = (x / jaune) * MaxColor; + b = 0; + } else if (x > jaune && x < vert) { + r = MaxColor - ((x - jaune) / jaune) * MaxColor; + v = MaxColor; + b = 0; + } else if (x > vert && x < cyan) { + r = 0; + b = ((x - jaune * 2) / jaune) * MaxColor; + v = MaxColor; + } else if (x > cyan && x < bleu) { + r = 0; + v = MaxColor - ((x - jaune * 3) / jaune) * MaxColor; + b = MaxColor; + } else if (x > bleu && x < majenta) { + r = ((x - jaune * 4) / jaune) * MaxColor; + v = 0; + b = MaxColor; + } else if (x > majenta && x < rouge2) { + r = MaxColor; + v = 0; + b = MaxColor - ((x - jaune * 5) / jaune) * MaxColor; + } + + r = Math.round(r, 0); + v = Math.round(v, 0); + b = Math.round(b, 0); + + r = r + 70; + v = v + 70; + b = b + 70; + if (r > MaxColor) { + r = MaxColor; + } + if (v > MaxColor) { + v = MaxColor; + } + if (b > MaxColor) { + b = MaxColor; + } + + if (r > MaxColor) { + r = MaxColor; + } + if (v > MaxColor) { + v = MaxColor; + } + if (b > MaxColor) { + b = MaxColor; + } + document.getElementById(couleur).style.backgroundColor = + "rgba(" + r + ", " + v + ", " + b + ", 1)"; +} + +function changeCouleurObstacle(couleur) { + var r2 = r - 32; + var v2 = v - 32; + var b2 = b - 32; + if (r2 < 0) { + r2 = 0; + } + if (v2 < 0) { + v2 = 0; + } + if (b2 < 0) { + b2 = 0; + } + + //var colorb= color + color = "#" + toHexa(r) + "" + toHexa(v) + "" + toHexa(b); + colorb = "#" + toHexa(r2) + "" + toHexa(v2) + "" + toHexa(b2); + if (couleur == "Couleur1") { + COLOR_1 = color; + COLOR_1b = colorb; + } else if (couleur == "Couleur2") { + COLOR_2 = color; + COLOR_2b = colorb; + } else if (couleur == "Couleur3") { + COLOR_3 = color; + } else if (couleur == "Couleur0") { + //fond + r = r + 140; + v = v + 140; + b = b + 140; + if (r > MaxColor) { + r = MaxColor; + } + if (v > MaxColor) { + v = MaxColor; + } + if (b > MaxColor) { + b = MaxColor; + } + color = "#" + toHexa(r) + "" + toHexa(v) + "" + toHexa(b); + colorb = "#" + toHexa(r2) + "" + toHexa(v2) + "" + toHexa(b2); + COLOR_TERRAIN = color; + COLOR_TEXT_UNDER = + "rgba(" + + toDec("r") + + ", " + + toDec("v") + + ", " + + toDec("b") + + ", 0.7)"; // grilles + } + genererParcours(); +} + +function toHexa(initial) { + var regDec = /^\d+$/; + var converti = (converti = parseInt(initial, 10) + .toString(16) + .toUpperCase()); + if (converti.length < 2) { + converti = "0" + converti; + } + return converti; +} +function toDec(initial) { + var regHexa = /^[a-f\d]+$/i; + var converti = parseInt(initial, 16); + return converti; +} + +function setColorPredef(id) { + if (id == 1) { + //standard + COLOR_1 = "#22AAFF"; // principale + COLOR_1b = "#028ADF"; // principale sombre + COLOR_2 = "#CC3300"; // zones + COLOR_2b = "#AC1300"; // zones sombre + COLOR_3 = "#EEEEEE"; // couleur barre 2 + COLOR_TEXT_UNDER = "rgba(211, 228, 240, 0.7)"; // grilles + COLOR_TERRAIN = "#d3e4f0"; // terrain CCFFCC + } else if (id == 2) { + //noir & blanc + COLOR_1 = "#555555"; // principale + COLOR_1b = "#353535"; // principale sombre + COLOR_2 = "#aaaaaa"; // zones + COLOR_2b = "#8a8a8a"; // zones sombre + COLOR_3 = "#ffffff"; // couleur barre 2 + COLOR_TEXT_UNDER = + "rgba(" + + toDec("ee") + + ", " + + toDec("ee") + + ", " + + toDec("ee") + + ", 0.7)"; // grilles + COLOR_TERRAIN = "#eeeeee"; // terrain CCFFCC + } else if (id == 3) { + //noir & rouge + COLOR_1 = "#555555"; // principale + COLOR_1b = "#353535"; // principale sombre + COLOR_2 = "#CC3300"; // zones + COLOR_2b = "#AC1300"; // zones sombre + COLOR_3 = "#ffffff"; // couleur barre 2 + COLOR_TEXT_UNDER = "rgba(211, 228, 240, 0.7)"; // grilles + COLOR_TERRAIN = "#d3e4f0"; // terrain CCFFCC + } else if (id == 4) { + //eco color + COLOR_1 = "#99DDFF"; // principale + COLOR_1b = "#79BDDF"; // principale sombre + COLOR_2 = "#ff6666"; // zones + COLOR_2b = "#DF4646"; // zones sombre + COLOR_3 = "#EEEEEE"; // couleur barre 2 + COLOR_TEXT_UNDER = "rgba(255, 255, 255, 0.7)"; // grilles + COLOR_TERRAIN = "#ffffff"; // terrain CCFFCC + } else if (id == 5) { + //eco noir & blanc + COLOR_1 = "#dddddd"; // principale + COLOR_1b = "#bdbdbd"; // principale sombre + COLOR_2 = "#bbbbbb"; // zones + COLOR_2b = "#9b9b9b"; // zones sombre + COLOR_3 = "#ffffff"; // couleur barre 2 + COLOR_TEXT_UNDER = + "rgba(" + + toDec("ff") + + ", " + + toDec("ff") + + ", " + + toDec("ff") + + ", 0.7)"; // grilles + COLOR_TERRAIN = "#ffffff"; // terrain CCFFCC + } else if (id == 6) { + //standard + COLOR_1 = "#dddddd"; // principale + COLOR_1b = "#bdbdbd"; // principale sombre + COLOR_2 = "#CC3300"; // zones + COLOR_2b = "#AC1300"; // zones sombre + COLOR_3 = "#EEEEEE"; // couleur barre 2 + COLOR_TEXT_UNDER = "rgba(211, 228, 240, 0.7)"; // grilles + COLOR_TERRAIN = "#CCFFCC"; // terrain CCFFCC + } + genererParcours(); +} + +function setBackgroundColor(id) { + if (id == 1) { + COLOR_TEXT_UNDER = "rgba(255, 255,255, 0.7)"; + COLOR_TERRAIN = "#ffffff"; + COLOR_GRILLE = "#cccccc"; // grilles + } else if (id == 2) { + COLOR_TEXT_UNDER = "rgba(211, 228, 240, 0.7)"; + COLOR_TERRAIN = "rgba(211, 228, 240, 1)"; + COLOR_GRILLE = "#bdcdd8"; // grilles + } else if (id == 3) { + COLOR_TEXT_UNDER = "rgba(211, 228, 240, 0.7)"; + COLOR_TERRAIN = "rgba(204, 255, 204, 1)"; + COLOR_GRILLE = "#b2e0b2"; // grilles + } + genererParcours(); +} + +function setDriverColor(id) { + if (id == 1) { + COLOR_VETEMENTS = "#bbbbbb"; + } else if (id == 2) { + COLOR_VETEMENTS = "#CC3300"; + } else if (id == 3) { + COLOR_VETEMENTS = "#22AAFF"; + } + genererParcours(); +} + +function setObstacleColor(id) { + if (id == 1) { + //eco noir & blanc + COLOR_1 = "#dddddd"; // principale + COLOR_1b = "#bdbdbd"; // principale sombre + COLOR_2 = "#bbbbbb"; // zones + COLOR_2b = "#9b9b9b"; // zones sombre + COLOR_3 = "#ffffff"; // couleur barre 2 + } else if (id == 2) { + //standard + COLOR_1 = "#22AAFF"; // principale + COLOR_1b = "#028ADF"; // principale sombre + COLOR_2 = "#CC3300"; // zones + COLOR_2b = "#AC1300"; // zones sombre + COLOR_3 = "#EEEEEE"; // couleur barre 2 + } else if (id == 3) { + //noir & rouge + COLOR_1 = "#555555"; // principale + COLOR_1b = "#353535"; // principale sombre + COLOR_2 = "#CC3300"; // zones + COLOR_2b = "#AC1300"; // zones sombre + COLOR_3 = "#ffffff"; // couleur barre 2 + } else if (id == 4) { + //blanc rouge + COLOR_1 = "#dddddd"; // principale + COLOR_1b = "#bdbdbd"; // principale sombre + COLOR_2 = "#CC3300"; // zones + COLOR_2b = "#AC1300"; // zones sombre + COLOR_3 = "#EEEEEE"; // couleur barre 2 + } else if (id == 5) { + //noir & rouge + COLOR_1 = "#555555"; // principale + COLOR_1b = "#353535"; // principale sombre + COLOR_2 = "#e07ecd "; // zones + COLOR_2b = "#ae629f"; // zones sombre + COLOR_3 = "#ffffff"; // couleur barre 2 + } + genererParcours(); +} + +/* +var COLOR_1="#22AAFF";// principale +var COLOR_1b="#0088DD";// principale sombre +var COLOR_2="#CC3300";// zones +var COLOR_2b="#AA1100";// zones sombre +var COLOR_3="#EEEEEE";// couleur barre 2 +*/ diff --git a/static/ui/app/src/events.js b/static/ui/app/src/events.js new file mode 100644 index 0000000..5ef66b9 --- /dev/null +++ b/static/ui/app/src/events.js @@ -0,0 +1,746 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////LISTENER D EVENEMENTS///////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +function doTouchStart(event) { + isTactil = true; + setMargeSelect(); + + //document.getElementById('outils').style.overflow="scroll"; + //document.getElementById('trajMaitre').style.overflow="scroll"; + window.removeEventListener("mousemove", doMouseMove, false); + window.removeEventListener("mouseup", doMouseUp, false); + canvas.removeEventListener("mousedown", doMouseDown, false); + canvas.addEventListener("touchmove", doTouchMove, false); + canvas.addEventListener("touchend", doTouchEnd, false); + canvas.addEventListener("touchleave", doTouchEnd, false); + canvas.addEventListener("touchcancel", doTouchEnd, false); + + //event.preventDefault(); + + doTouchMove(event); + + doMouseDown(event); +} +function doTouchEnd(event) { + //event.preventDefault(); + doMouseUp(event); + doTouchMove(event); +} +function doTouchMove(event) { + var touches = event.changedTouches; + oldx = canvas_x; + canvas_x = touches[0].pageX - DECAL_X_INTERFACE; + canvas_x = canvas_x / scale; + + diffx = oldx - canvas_x; + if (canvas_x > canvasSizeX - MARGE) { + canvas_x = canvasSizeX - MARGE; + } else if (canvas_x < MARGE) { + canvas_x = MARGE; + } + oldy = canvas_y; + canvas_y = touches[0].pageY - DECAL_Y_INTERFACE; + canvas_y = canvas_y / scale; + diffy = oldy - canvas_y; + if (canvas_y > canvasSizeY - MARGE * 2) { + canvas_y = canvasSizeY - MARGE * 2; + } else if (canvas_y < MARGE) { + canvas_y = MARGE; + } + doMove(); + + if (isOverObstacle()) { + log("over obstacle"); + event.preventDefault(); + } else { + log("not over obstacle"); + } +} +function isOverObstacle() { + if ( + overObject == -1 && + overTunnelId == -1 && + overPointTunnel == -1 && + overTunnelComplet == -1 && + overModifTrajId == -1 && + overModifTrajDepArr == -1 && + overNumeroId == -1 && + overNumeroId2 == -1 && + overNumeroId3 == -1 && + overObject == -1 + ) { + return false; + } + return true; +} +function doMouseDown(event) { + window.addEventListener("mouseup", doMouseUp, false); + canvas.removeEventListener("mousedown", doMouseDown, false); + if (suppression == true) { + if (overNumeroId != -1) { + listeNumero[overNumeroId] = ""; + // fix path when last number is deleted + if (overNumeroId+1==nextNumber) { + nextNumber--; + listeNumero.pop(); + } + } else if (overNumeroId2 != -1) { + listeNumero2[overNumeroId2] = ""; + } else if (overNumeroId3 != -1) { + listeNumero3[overNumeroId3] = ""; + } else if (overTunnelId != -1) { + tbTunnels[overTunnelId] = ""; + } else if (overTunnelComplet != -1) { + tbTunnels[overTunnelComplet] = ""; + } else if (overObject != -1) { + tbObst[overObject] = ""; + } + } else if (overNumeroId != -1) { + selNumeroId = overNumeroId; + } else if (overNumeroId2 != -1) { + selNumeroId2 = overNumeroId2; + } else if (overNumeroId3 != -1) { + selNumeroId3 = overNumeroId3; + } else if (overModifTrajId != -1) { + modifTrajId = overModifTrajId; + modifTrajDepArr = overModifTrajDepArr; + } else if (overTunnelId != -1) { + selTunnel = overTunnelId; + selPointTunnel = overPointTunnel; + } else if (overTunnelComplet != -1) { + selTunnelComplet = overTunnelComplet; + } else if (overObject != -1) { + selObst = overObject; + setCanvasX(selObst, canvas_x - decalX); + setCanvasY(selObst, canvas_y - decalY); + genererParcours(); + } +} +function doMouseUp(event) { + //window.removeEventListener("mousemove", doMouseMove, false); + window.removeEventListener("mouseup", doMouseUp, false); + canvas.addEventListener("mousedown", doMouseDown, false); + selObst = -1; + selTunnel = -1; + selPointTunnel = -1; + selTunnelComplet = -1; + rotate = false; + moveTunnelComplet = -1; + selNumeroId = -1; + selNumeroId2 = -1; + selNumeroId3 = -1; + modifTrajId = -1; + modifTrajDepArr = -1; + genererParcours(); +} +function doMouseMove(event) { + oldx = canvas_x; + canvas_x = event.pageX - DECAL_X_INTERFACE; + canvas_x = canvas_x / scale; + + diffx = oldx - canvas_x; + if (canvas_x > canvasSizeX - MARGE) { + canvas_x = canvasSizeX - MARGE; + } else if (canvas_x < MARGE) { + canvas_x = MARGE; + } + oldy = canvas_y; + canvas_y = event.pageY - DECAL_Y_INTERFACE; + canvas_y = canvas_y / scale; + diffy = oldy - canvas_y; + if (canvas_y > canvasSizeY - MARGE * 2) { + canvas_y = canvasSizeY - MARGE * 2; + } else if (canvas_y < MARGE) { + canvas_y = MARGE; + } + doMove(); +} +///////////////////////////////////////////////////////////////////////MOUVEMENT/////////////////////////////////////////////////////////// +function rchObstacleProche(xProche, yProche, numero) { + var idPlusProche = 0; + var xPlusProche = 1000; + var yPlusProche = 1000; + var distanceHypoPlusProche = 1000; + var sens = 1; + var type = "classique"; + for (var i = 0; i < id; i++) { + var x = getCanvasX(i); + var y = getCanvasY(i); + var nom = getSens(i); + var largx = getXCliquable(i); + var hauty = getYCliquable(i); + var angle = getAngle(i); + var type = "classique"; + var modifXDep = getModXTrajEntree(i); + var modifYDep = getModYTrajEntree(i); + var modifXArr = getModXTrajSortie(i); + var modifYArr = getModYTrajSortie(i); + var angleSens2 = getAngleTrajSortie(i); + var longTraj = getDistTrajCentre(i); + var distanceSup = 3; + var departX = + x + + modifXDep / 2 + + Math.cos(((angle + angleSens2) / 180) * Math.PI) * + (longTraj / 2 + distanceSup); + var departY = + y + + modifYDep / 2 + + Math.sin(((angle + angleSens2) / 180) * Math.PI) * + (longTraj / 2 + distanceSup); + + var xDist = Math.abs(departX - xProche); + var yDist = Math.abs(departY - yProche); + var distanceHypo = Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2)); + + if (distanceHypo < distanceHypoPlusProche) { + idPlusProche = i; + xPlusProche = xDist; + yPlusProche = yDist; + distanceHypoPlusProche = distanceHypo; + sens = 1; + xpp = departX; + ypp = departY; + type = "classique"; + } + + var arriveX = + x + + modifXArr / 2 + + Math.cos(((angle + angleSens2) / 180) * Math.PI) * + (-longTraj / 2 - distanceSup); + var arriveY = + y + + modifYArr / 2 + + Math.sin(((angle + angleSens2) / 180) * Math.PI) * + (-longTraj / 2 - distanceSup); + + var xDistArr = Math.abs(arriveX - xProche); + var yDistArr = Math.abs(arriveY - yProche); + var distanceHypoFin = Math.sqrt( + Math.pow(xDistArr, 2) + Math.pow(yDistArr, 2) + ); + + if (distanceHypoFin < distanceHypoPlusProche) { + idPlusProche = i; + xPlusProche = xDistArr; + yPlusProche = yDistArr; + distanceHypoPlusProche = distanceHypoFin; + sens = 0; + xpp = arriveX; + ypp = arriveY; + type = "classique"; + } + } + for (var j = 0; j < idTunnel; j++) { + var xTun = tbTunnels[j][1]; + var yTun = tbTunnels[j][2]; + var xTunFin = tbTunnels[j][(nbArticulationTunnel - 1) * 2 + 1]; + var yTunFin = tbTunnels[j][(nbArticulationTunnel - 1) * 2 + 2]; + //var x2Tun=tbTunnels[j][3];// pour le premier angle + //var y2Tun=tbTunnels[j][4];// pour le premier angle + + var largXTun = 0; + var largYTun = 0; + var angleTun = 90; + var modifXDepTun = 0; + var modifYDepTun = 0; + var modifXArrTun = 0; + var modifYArrTun = 0; + + //var distXTun = xTun - x2Tun; + //var distYTun = yTun - y2Tun; + //var modifAngleArrTun = Math.atan2(distYTun,distXTun)/Math.PI*180-90; + var longTrajTun = 0; + + var xDist = Math.abs(xProche - xTun); + var yDist = Math.abs(yProche - yTun); + var distanceHypo = Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2)); + if (distanceHypo < distanceHypoPlusProche) { + idPlusProche = j; + xPlusProche = xDist; + yPlusProche = yDist; + distanceHypoPlusProche = distanceHypo; + sens = 1; + xpp = xTun; + ypp = yTun; + type = "tunnel"; + } + var xDistFin = Math.abs(xProche - xTunFin); + var yDistFin = Math.abs(yProche - yTunFin); + var distanceHypoFin = Math.sqrt( + Math.pow(xDistFin, 2) + Math.pow(yDistFin, 2) + ); + + if (distanceHypoFin < distanceHypoPlusProche) { + idPlusProche = j; + xPlusProche = xDistFin; + yPlusProche = yDistFin; + distanceHypoPlusProche = distanceHypoFin; + sens = 0; + xpp = xTunFin; + ypp = yTunFin; + type = "tunnel"; + } + } + xp = xProche; + yp = yProche; + var ordreObstacle = new Array(); + ordreObstacle[0] = idPlusProche; + ordreObstacle[1] = type; //type + var xNumProche; + var yNumProche; + var angleProche; + var modXProche; + var modYProche; + if (ordreObst[numero] != null && ordreObst[numero][0] == idPlusProche) { + if (type == "tunnel") { + ordreObstacle[7] = 90; + ordreObstacle[8] = 50; + ordreObstacle[9] = 90; + ordreObstacle[10] = 50; + xNumProche = 0; + yNumProche = 0; + modXProche = 0; + modYProche = 0; + angleProche = 0; + } else if (ordreObst[numero][1] == "tunnel") { + xNumProche = getCanvasX(idPlusProche); + yNumProche = getCanvasY(idPlusProche); + ordreObstacle[7] = getAngleTrajSortie(idPlusProche); + ordreObstacle[8] = getLongTraj(idPlusProche); + ordreObstacle[9] = getAngleTrajSortie(idPlusProche); + ordreObstacle[10] = getLongTraj(idPlusProche); + modXProche = getModXTrajSortie(idPlusProche); + modYProche = getModYTrajSortie(idPlusProche); + angleProche = getAngle(idPlusProche); + } else { + if (ordreObst[numero][2] != sens) { + xNumProche = getCanvasX(idPlusProche); + yNumProche = getCanvasY(idPlusProche); + ordreObstacle[7] = getAngleTrajSortie(idPlusProche); + ordreObstacle[8] = getLongTraj(idPlusProche); + ordreObstacle[9] = getAngleTrajSortie(idPlusProche); + ordreObstacle[10] = getLongTraj(idPlusProche); + modXProche = getModXTrajSortie(idPlusProche); + modYProche = getModYTrajSortie(idPlusProche); + angleProche = getAngle(idPlusProche); + } else { + xNumProche = getCanvasX(idPlusProche); + yNumProche = getCanvasY(idPlusProche); + ordreObstacle[7] = ordreObst[numero][7]; + ordreObstacle[8] = ordreObst[numero][8]; + ordreObstacle[9] = ordreObst[numero][9]; + ordreObstacle[10] = ordreObst[numero][10]; + modXProche = getModXTrajSortie(idPlusProche); + modYProche = getModYTrajSortie(idPlusProche); + angleProche = getAngle(idPlusProche); + //log(ordreObstacle[7]+"_"+ordreObstacle[8]+"_"+ordreObstacle[9]+"_"+ordreObstacle[10]); + } + } + } else { + if (type == "tunnel") { + ordreObstacle[7] = 90; + ordreObstacle[8] = 50; + ordreObstacle[9] = 90; + ordreObstacle[10] = 50; + xNumProche = 0; + yNumProche = 0; + modXProche = 0; + modYProche = 0; + angleProche = 0; + } else { + ordreObstacle[7] = getAngleTrajSortie(idPlusProche); + ordreObstacle[8] = getLongTraj(idPlusProche); + ordreObstacle[9] = getAngleTrajSortie(idPlusProche); + ordreObstacle[10] = getLongTraj(idPlusProche); + xNumProche = getCanvasX(idPlusProche); + yNumProche = getCanvasY(idPlusProche); + modXProche = getModXTrajSortie(idPlusProche); + modYProche = getModYTrajSortie(idPlusProche); + angleProche = getAngle(idPlusProche); + } + } + + ordreObstacle[2] = sens; //sens + var xComp = listeNumero[numero][1] - xNumProche - modXProche / 2; + var yComp = listeNumero[numero][2] - yNumProche - modYProche / 2; + // calcul de l'angle par rapport au centre. + + var dist = Math.sqrt(Math.pow(xComp, 2) + Math.pow(yComp, 2)); + + var angleNumero = (Math.atan2(yComp, xComp) / Math.PI) * 180 - angleProche; + + listeNumero[numero][3] = angleNumero; + listeNumero[numero][4] = dist; + + // calcul de l'angle avec le centre de l'obstacle qui lui est lié + + ordreObst[numero] = ordreObstacle; +} +var xp = 0; +var yp = 0; +var xpp = 0; +var ypp = 0; + +var xTst = 0; +var yTst = 0; +var xTst2 = 0; +var yTst2 = 0; +var xTst3 = 0; +var yTst3 = 0; +/* +function afficherTest(){ + context.fillStyle="#ff0000"; + rect(xTst,yTst,1,1); + //jaune + context.fillStyle="#ffFF00"; + rect(xTst2,yTst2,1,1); + context.fillStyle="#00FF00"; + rect(xTst3,yTst3,1,1); +}*/ +function recupereListeNumero(id, type) { + // récupère la liste des numéros qui sont liés à un obstacle. + for (var i = 1; i < nextNumber; i++) { + if (ordreObst[i][0] == id && ordreObst[i][1] == type) { + listeNumero[i][1] = listeNumero[i][1] - diffx; + listeNumero[i][2] = listeNumero[i][2] - diffy; + } + } +} +function recupereListeNumeroAngle(id, type, angle) { + // déplace le numéro lors d'une rotation + // récupère la liste des numéros qui sont liés à un obstacle. + for (var i = 1; i < nextNumber; i++) { + if (ordreObst[i][0] == id && ordreObst[i][1] == type) { + if (type == "tunnel") { + } else { + // calcul de l'angle par rapport au centre. + + var distance = listeNumero[i][4]; + var newAngle = getAngle(id) + listeNumero[i][3]; + var newX = + getCanvasX(id) + + getModXTrajSortie(id) / 2 + + Math.cos((newAngle / 180) * Math.PI) * distance; + var newY = + getCanvasY(id) + + getModYTrajSortie(id) / 2 + + Math.sin((newAngle / 180) * Math.PI) * distance; + listeNumero[i][1] = newX; + listeNumero[i][2] = newY; + } + } + } +} +function doMove() { + movingJump = false; + if ( + overObject == -1 && + selTunnel == -1 && + selTunnelComplet == -1 && + !suppression && + !color && + overModifTrajId == -1 + ) { + document.body.style.cursor = "default"; + } else if (color) { + document.body.style.cursor = "crosshair"; + } + if ( + selNumeroId == -1 && + selObst == -1 && + selTunnel == -1 && + selTunnelComplet == -1 && + modifTrajId == -1 && + selNumeroId2 == -1 && + selNumeroId3 == -1 + ) { + overObject = -1; + overTunnelId = -1; + overPointTunnel = -1; + overTunnelComplet = -1; + overModifTrajId = -1; + overModifTrajDepArr = -1; + + overNumero(canvas_x, canvas_y); + overNumero2(canvas_x, canvas_y); + overNumero3(canvas_x, canvas_y); + overObstacle(canvas_x, canvas_y); + overRotate(canvas_x, canvas_y); + overTunnel(canvas_x, canvas_y); + if (document.getElementById("ModifierTrajectoires").checked) { + overModifTraj(canvas_x, canvas_y); + } + genererParcours(); + } else { + movingJump = true; + if (modifTrajId != -1) { + var idObst = ordreObst[modifTrajId][0]; + } else if (selNumeroId != -1) { + listeNumero[selNumeroId][1] = canvas_x - decalX; + listeNumero[selNumeroId][2] = canvas_y - decalY; + if (listeNumero[selNumeroId][1] - LARGEUR_NUMERO / 2 < MARGE) { + listeNumero[selNumeroId][1] = MARGE + LARGEUR_NUMERO / 2; + } else if ( + listeNumero[selNumeroId][1] + LARGEUR_NUMERO / 2 > + canvasSizeX - MARGE + ) { + listeNumero[selNumeroId][1] = + canvasSizeX - MARGE - LARGEUR_NUMERO / 2; + } + if (listeNumero[selNumeroId][2] - HAUTEUR_NUMERO / 2 < MARGE) { + listeNumero[selNumeroId][2] = MARGE + HAUTEUR_NUMERO / 2; + } else if ( + listeNumero[selNumeroId][2] + HAUTEUR_NUMERO / 2 > + canvasSizeY - MARGE * 2 + ) { + listeNumero[selNumeroId][2] = + canvasSizeY - MARGE * 2 - HAUTEUR_NUMERO / 2; + } + rchObstacleProche( + listeNumero[selNumeroId][1], + listeNumero[selNumeroId][2], + selNumeroId + ); + // calcul de l'angle + } else if (selNumeroId2 != -1) { + listeNumero2[selNumeroId2][1] = canvas_x - decalX; + listeNumero2[selNumeroId2][2] = canvas_y - decalY; + + if (listeNumero2[selNumeroId2][1] - LARGEUR_NUMERO / 2 < MARGE) { + listeNumero2[selNumeroId2][1] = MARGE + LARGEUR_NUMERO / 2; + } else if ( + listeNumero2[selNumeroId2][1] + LARGEUR_NUMERO / 2 > + canvasSizeX - MARGE + ) { + listeNumero2[selNumeroId2][1] = + canvasSizeX - MARGE - LARGEUR_NUMERO / 2; + } + if (listeNumero2[selNumeroId2][2] - HAUTEUR_NUMERO / 2 < MARGE) { + listeNumero2[selNumeroId2][2] = MARGE + HAUTEUR_NUMERO / 2; + } else if ( + listeNumero2[selNumeroId2][2] + HAUTEUR_NUMERO / 2 > + canvasSizeY - MARGE * 2 + ) { + listeNumero2[selNumeroId2][2] = + canvasSizeY - MARGE * 2 - HAUTEUR_NUMERO / 2; + } + } else if (selNumeroId3 != -1) { + listeNumero3[selNumeroId3][1] = canvas_x - decalX; + listeNumero3[selNumeroId3][2] = canvas_y - decalY; + if (listeNumero3[selNumeroId3][1] - LARGEUR_NUMERO / 2 < MARGE) { + listeNumero3[selNumeroId3][1] = MARGE + LARGEUR_NUMERO / 2; + } else if ( + listeNumero3[selNumeroId3][1] + LARGEUR_NUMERO / 2 > + canvasSizeX - MARGE + ) { + listeNumero3[selNumeroId3][1] = + canvasSizeX - MARGE - LARGEUR_NUMERO / 2; + } + if (listeNumero3[selNumeroId3][2] - HAUTEUR_NUMERO / 2 < MARGE) { + listeNumero3[selNumeroId3][2] = MARGE + HAUTEUR_NUMERO / 2; + } else if ( + listeNumero3[selNumeroId3][2] + HAUTEUR_NUMERO / 2 > + canvasSizeY - MARGE * 2 + ) { + listeNumero3[selNumeroId3][2] = + canvasSizeY - MARGE * 2 - HAUTEUR_NUMERO / 2; + } + } else if (selTunnelComplet != -1) { + //déplace le tunnel complet + var decallageReelX = + tbTunnels[selTunnelComplet][1] - canvas_x + decalX; + var decallageReelY = + tbTunnels[selTunnelComplet][2] - canvas_y + decalY; + for (var art = 0; art < nbArticulationTunnel; art++) { + tbTunnels[selTunnelComplet][art * 2 + 1] = + tbTunnels[selTunnelComplet][art * 2 + 1] - decallageReelX; + tbTunnels[selTunnelComplet][art * 2 + 2] = + tbTunnels[selTunnelComplet][art * 2 + 2] - decallageReelY; + } + recupereListeNumero(selTunnelComplet, "tunnel"); + } else if (selTunnel != -1) { + // déplace une articulation + moveTunnel(selTunnel, selPointTunnel, canvas_x, canvas_y, -1); + recupereListeNumero(selTunnel, "tunnel"); + } else if (moveTunnelComplet != -1) { + for (var art = 0; art < nbArticulationTunnel; art++) { + if (art == 1 || art == 3 || art == 5 || art == 6) { + tbObst[selObst][art] = tbObst[selObst][art] + moveTunnelX; + } else { + tbObst[selObst][art] = tbObst[selObst][art] + moveTunnelY; + } + } + recupereListeNumero(moveTunnelComplet, "tunnel"); + } else if (!rotate) { + setCanvasX(selObst, canvas_x - decalX); + setCanvasY(selObst, canvas_y - decalY); + recupereListeNumero(selObst, "classique"); + } else { + // calcul de l'angle par rapport au centre. + var distX = + canvas_x - getCanvasX(selObst) - getXCliquable(selObst) / 2; + var distY = + canvas_y - getCanvasY(selObst) - getYCliquable(selObst) / 2; + var angle = (Math.atan2(distY, distX) / Math.PI) * 180; + if (rotateCote == "gauche") { + setAngle(selObst, angle); + } else { + if (angle > 0) { + setAngle(selObst, angle - 180); + } else { + setAngle(selObst, angle + 180); + } + } + recupereListeNumeroAngle(selObst, "classique", getAngle(selObst)); + } + genererParcours(); + } +} +function moveTunnel(idTunnel, idPointTunnel, X, Y, idPointTunnelPrecedent) { + var newX; + var newY; + var oldX = tbTunnels[idTunnel][idPointTunnel * 2 + 1]; + var oldY = tbTunnels[idTunnel][idPointTunnel * 2 + 2]; + var type = tbTunnels[idTunnel][nbArticulationTunnel * 2 + 3]; + var dist; + var angle; + + newX = X; + newY = Y; + if (idPointTunnel - 1 >= 0) { + var xPre = tbTunnels[idTunnel][(idPointTunnel - 1) * 2 + 1]; + var yPre = tbTunnels[idTunnel][(idPointTunnel - 1) * 2 + 2]; + var anglePrecedent = + 180 + (Math.atan2(yPre - newY, xPre - newX) / Math.PI) * 180; + } + + if (idPointTunnel + 1 < nbArticulationTunnel) { + var xSui = tbTunnels[idTunnel][(idPointTunnel + 1) * 2 + 1]; + var ySui = tbTunnels[idTunnel][(idPointTunnel + 1) * 2 + 2]; + var angleSuivant = + 180 + (Math.atan2(ySui - newY, xSui - newX) / Math.PI) * 180; + } + + if (idPointTunnel - 1 >= 0 && idPointTunnel + 1 < nbArticulationTunnel) { + angleSurplus = 0; + if ( + !( + Math.abs(anglePrecedent - angleSuivant) > ANGLE_MIN && + Math.abs(anglePrecedent - angleSuivant) < 360 - ANGLE_MIN + ) + ) { + angleSurplus = diffAngle(angleSuivant, anglePrecedent); + } + } + + // si aucun point n'a été bougé précédement on bouge l point actuel + if (idPointTunnelPrecedent == -1) { + tbTunnels[idTunnel][idPointTunnel * 2 + 1] = newX; + tbTunnels[idTunnel][idPointTunnel * 2 + 2] = newY; + } + + // Effectuer le déplacement des point dans les cotés + //if(idPointTunnelPrecedent!=-1){ + // point suivant + if (idPointTunnel - 1 >= 0 && idPointTunnel - 1 != idPointTunnelPrecedent) { + var distPre = Math.sqrt( + Math.pow(xPre - newX, 2) + Math.pow(yPre - newY, 2) + ); + var anglePreced = + (Math.atan2(yPre - newY, xPre - newX) / Math.PI) * 180; + anglePreced = anglePreced - angleSurplus; + + //anglePreced=anglePreced-angleSurplus; + + var newXPre = 0; + var newYPre = 0; + if (type == 3) { + var distMax = distMaxTunnel3; + var distMin = distMinTunnel3; + } else { + var distMax = distMaxTunnel; + var distMin = distMinTunnel; + } + if (distPre > distMax) { + newXPre = Math.cos((anglePreced / 180) * Math.PI) * distMax + X; + newYPre = Math.sin((anglePreced / 180) * Math.PI) * distMax + Y; + } else if (distPre < distMin) { + newXPre = Math.cos((anglePreced / 180) * Math.PI) * distMin + X; + newYPre = Math.sin((anglePreced / 180) * Math.PI) * distMin + Y; + } else { + // pas de transmission de mouvement si les écarts sont respectés. + newXPre = Math.cos((anglePreced / 180) * Math.PI) * distPre + X; + newYPre = Math.sin((anglePreced / 180) * Math.PI) * distPre + Y; + + //return; + } + tbTunnels[idTunnel][(idPointTunnel - 1) * 2 + 1] = newXPre; + tbTunnels[idTunnel][(idPointTunnel - 1) * 2 + 2] = newYPre; + //moveTunnel(idTunnel,idPointTunnel-1, newX, newY, idPointTunnel) + } + // transmission du mouvement vers suivants + if ( + idPointTunnel + 1 < nbArticulationTunnel && + idPointTunnel + 1 != idPointTunnelPrecedent + ) { + var distSui = Math.sqrt( + Math.pow(xSui - newX, 2) + Math.pow(ySui - newY, 2) + ); + var angleSuiv = (Math.atan2(ySui - newY, xSui - newX) / Math.PI) * 180; + angleSuiv = angleSuiv + angleSurplus; + var newXSui = 0; + var newYSui = 0; + if (type == 3) { + var distMax = distMaxTunnel3; + var distMin = distMinTunnel3; + } else { + var distMax = distMaxTunnel; + var distMin = distMinTunnel; + } + if (distSui > distMax) { + newXSui = Math.cos((angleSuiv / 180) * Math.PI) * distMax + X; + newYSui = Math.sin((angleSuiv / 180) * Math.PI) * distMax + Y; + } else if (distSui < distMin) { + newXSui = Math.cos((angleSuiv / 180) * Math.PI) * distMin + X; + newYSui = Math.sin((angleSuiv / 180) * Math.PI) * distMin + Y; + } else { + newXSui = Math.cos((angleSuiv / 180) * Math.PI) * distSui + X; + newYSui = Math.sin((angleSuiv / 180) * Math.PI) * distSui + Y; + } + tbTunnels[idTunnel][(idPointTunnel + 1) * 2 + 1] = newXSui; + tbTunnels[idTunnel][(idPointTunnel + 1) * 2 + 2] = newYSui; + } + + // on transmet le mouvement aux autres points + + // transmission du mouvement vers précédents + if (idPointTunnel - 1 >= 0 && idPointTunnel - 1 != idPointTunnelPrecedent) { + moveTunnel( + idTunnel, + idPointTunnel - 1, + newXPre, + newYPre, + idPointTunnel + ); + } + // transmission du mouvement vers suivants + if ( + idPointTunnel + 1 < nbArticulationTunnel && + idPointTunnel + 1 != idPointTunnelPrecedent + ) { + moveTunnel( + idTunnel, + idPointTunnel + 1, + newXSui, + newYSui, + idPointTunnel + ); + } +} diff --git a/static/ui/app/src/functions-obstacle.js b/static/ui/app/src/functions-obstacle.js new file mode 100644 index 0000000..a73e025 --- /dev/null +++ b/static/ui/app/src/functions-obstacle.js @@ -0,0 +1,166 @@ +// GETTERS + +function getId(idObstacle){ + return tbObst[idObstacle][0]; +} +function getCanvasX(idObstacle){ + return tbObst[idObstacle][1]; +} +function getCanvasY(idObstacle){ + return tbObst[idObstacle][2]; +} +function getSens(idObstacle){// aussi le nom et l'image + return tbObst[idObstacle][3];; +} +function getXCliquable(idObstacle){ + return tbObst[idObstacle][4]; +} +function getYCliquable(idObstacle){ + return tbObst[idObstacle][5]; +} +function getAngle(idObstacle){ + return tbObst[idObstacle][6]; +} +function getType(idObstacle){ + return tbObst[idObstacle][7]; +} +function getModXTrajEntree(idObstacle){ + return tbObst[idObstacle][8]; +} +function getModYTrajEntree(idObstacle){ + return tbObst[idObstacle][9]; +} +function getModXTrajSortie(idObstacle){ + return tbObst[idObstacle][10]; +} +function getModYTrajSortie(idObstacle){ + return tbObst[idObstacle][11]; +} +function getAngleTrajSortie(idObstacle){ + return tbObst[idObstacle][12]; +} +function getDistTrajCentre(idObstacle){ + return tbObst[idObstacle][13]; +} +function getLongTraj(idObstacle){ + return tbObst[idObstacle][14]; +} + +// SETTERS + +function setId(idObstacle,valeur){ + tbObst[idObstacle][0] = valeur; +} +function setCanvasX(idObstacle,valeur){ + tbObst[idObstacle][1] = valeur; +} +function setCanvasY(idObstacle,valeur){ + tbObst[idObstacle][2] = valeur; +} +function setImg(idObstacle,valeur){ + tbObst[idObstacle][3] = valeur; +} +function setXCliquable(idObstacle,valeur){ + tbObst[idObstacle][4] = valeur; +} +function setYCliquable(idObstacle,valeur){ + tbObst[idObstacle][5] = valeur; +} +function setAngle(idObstacle,valeur){ + tbObst[idObstacle][6] = valeur; +} +function setType(idObstacle,valeur){ + tbObst[idObstacle][7] = valeur; +} +function setModXTrajEntree(idObstacle,valeur){ + tbObst[idObstacle][8] = valeur; +} +function setModYTrajEntree(idObstacle,valeur){ + tbObst[idObstacle][9] = valeur; +} +function setModXTrajSortie(idObstacle,valeur){ + tbObst[idObstacle][10] = valeur; +} +function setModYTrajSortie(idObstacle,valeur){ + tbObst[idObstacle][11] = valeur; +} +function setAngleTrajSortie(idObstacle,valeur){ + tbObst[idObstacle][12] = valeur; +} +function setDistTrajCentre(idObstacle,valeur){ + tbObst[idObstacle][13] = valeur; +} +function setLongTraj(idObstacle,valeur){ + tbObst[idObstacle][14] = valeur; +} + +// TUNNELS + + + +function getIdTunnel(idTunnel){ + return tbTunnels[idTunnel][0]; +} + +function setIdTunnel(idTunnel,valeur){ + tbTunnels[idTunnel][0] = valeur; +} + +//NUMEROS + +function getIdNumero(idNum, numListe){ +switch(numListe){ + case 1: + return listeNumero[idNum][0]; + case 2: + return listeNumero2[idNum][0]; + case 3: + return listeNumero3[idNum][0]; + } +} +function getXNumero(idNum, numListe){ + return listeNumero[idNum][1]; +} +function getYNumero(idNum, numListe){ + return listeNumero[idNum][2]; +} + +function setIdNumero(idNum,valeur, numListe){ + switch(numListe){ + case 1: + listeNumero[idNum][0]=valeur; + break; + case 2: + listeNumero2[idNum][0]=valeur; + break; + case 3: + listeNumero3[idNum][0]=valeur; + break; + } +} +function setXNumero(idNum,valeur, numListe){ + switch(numListe){ + case 1: + listeNumero[idNum][1]=valeur; + break; + case 2: + listeNumero2[idNum][1]=valeur; + break; + case 3: + listeNumero3[idNum][1]=valeur; + break; + } +} +function setYNumero(idNum,valeur, numListe){ + switch(numListe){ + case 1: + listeNumero[idNum][2]=valeur; + break; + case 2: + listeNumero2[idNum][2]=valeur; + break; + case 3: + listeNumero3[idNum][2]=valeur; + break; + } +} diff --git a/static/ui/app/src/functions.js b/static/ui/app/src/functions.js new file mode 100644 index 0000000..d6ea166 --- /dev/null +++ b/static/ui/app/src/functions.js @@ -0,0 +1,519 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////FONCTIONS////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +var isOpenBarreOutil = true; +var isOpenBarreTitre = true; +function switchBarreOutil() { + if (isOpenBarreOutil) { + //fermeture + DECAL_X_INTERFACE = 15; + document.getElementById("barreOutilCache").style.left = "0px"; + document.getElementById("contentCanvas").style.left = "15px"; + document.getElementById("outils").style.visibility = "hidden"; + document.getElementById("trajMaitre").style.visibility = "hidden"; + } else { + //ouverture + DECAL_X_INTERFACE = 110; + document.getElementById("barreOutilCache").style.left = "95px"; + document.getElementById("contentCanvas").style.left = "110px"; + document.getElementById("outils").style.visibility = "visible"; + document.getElementById("trajMaitre").style.visibility = "visible"; + } + isOpenBarreOutil = !isOpenBarreOutil; +} + +function switchBarreTitre() { + if (isOpenBarreTitre) { + //fermeture + DECAL_Y_INTERFACE = 15; + document.getElementById("barreOutilCache").style.top = "15px"; + document.getElementById("outils").style.top = "15px"; + document.getElementById("trajMaitre").style.top = "15px"; + + document.getElementById("barreTitreCache").style.top = "0px"; + document.getElementById("contentCanvas").style.top = "15px"; + document.getElementById("titre").style.visibility = "hidden"; + document.getElementById("options").style.visibility = "hidden"; + document.getElementById("logo").style.visibility = "hidden"; + document.getElementById("medaille").style.visibility = "hidden"; + document.getElementById("barreInfo").style.visibility = "hidden"; + document.getElementById("titreLogo").style.visibility = "hidden"; + } else { + //ouverture + DECAL_Y_INTERFACE = 88; + document.getElementById("barreOutilCache").style.top = "103px"; + document.getElementById("outils").style.top = "103px"; + document.getElementById("trajMaitre").style.top = "103px"; + document.getElementById("barreTitreCache").style.top = "88px"; + document.getElementById("contentCanvas").style.top = "103px"; + document.getElementById("titre").style.visibility = "visible"; + document.getElementById("options").style.visibility = "visible"; + document.getElementById("logo").style.visibility = "visible"; + document.getElementById("medaille").style.visibility = "visible"; + document.getElementById("barreInfo").style.visibility = "visible"; + document.getElementById("titreLogo").style.visibility = "visible"; + } + isOpenBarreTitre = !isOpenBarreTitre; +} +function toDegrees(angle) { + return (angle * Math.PI) / 180; +} +function ajouterSupprimerTrajectoires() { + trajectoire = !trajectoire; + updateDuplicatedElements(); + genererParcours(); +} +function toggleConducteur() { + showconducteur = !showconducteur; + updateDuplicatedElements(); + genererParcours(); +} +function updateDuplicatedElements() { + document.getElementById("Traj").checked = trajectoire; + document.getElementById("Traj-2").checked = trajectoire; + document.getElementById("AfficherConducteur").checked = showconducteur; + document.getElementById("AfficherConducteur-2").checked = showconducteur; + document.getElementById("showNumero").checked = shownumbers; + document.getElementById("showNumero-2").checked = shownumbers; +} +function changeLargeur() { + var largeurP = document.getElementById("largeurParcours").value; + // Enlever tous les charactères sauf les chiffres + largeurP = largeurP.replace(/[^0-9]/g, ""); + if (largeurP != 0) { + canvas.width = ((largeurP * 100) / pixel / unite + MARGE * 2) * scale; + canvasSizeX = canvas.width / scale; + context.scale(scale, scale); + genererParcours(); + } +} +function changeLongueur() { + var longueurP = document.getElementById("longueurParcours").value; + // Enlever tous les charactères sauf les chiffres + longueurP = longueurP.replace(/[^0-9]/g, ""); + if (longueurP != 0) { + canvas.height = ((longueurP * 100) / pixel / unite + MARGE * 3) * scale; + canvasSizeY = canvas.height / scale; + context.scale(scale, scale); + genererParcours(); + } +} + +function changeEchelle() { + var echelle = document.getElementById("echelle").value; + if (echelle > 0) { + TAILLE_GRILLAGE = ((100 / pixel) * echelle) / unite; + genererParcours(); + } +} +function changeInfos() { + titre = document.getElementById("titreParcours").value; + auteur = document.getElementById("auteurParcours").value; + genererParcours(); +} +function log(valeur) { + document.getElementById("texte").innerHTML = valeur; +} +function exportToPNG2() { + //window.open(canvas.toDataURL('image/png')); + var d = canvas.toDataURL("image/png"); + var w = window.open("about:blank", "image from canvas"); + w.document.write("from canvas"); +} +function exportToPNG(qualite) { + document.getElementById("globalContent").style.display = "none"; + + var oldScale = scale; + if (qualite == 0) { + // on ne fait rien car on utilise les paramètres par defaut + } else if (qualite == 4) { + zoom(4); + } else if (qualite == 8) { + zoom(8); + } + + var canvasimg = document.getElementById("canvasimg"); + + var fond = document.getElementById("fondImage"); + canvasimg.src = canvas.toDataURL("img/png"); + + canvasimg.style.visibility = "visible"; + var conteneurImg = document.getElementById("conteneurImgExport"); + conteneurImg.className = "imageExport"; + + fond.className = "fondExport"; + zoom(oldScale); +} +function fermerExport() { + document.getElementById("globalContent").style.display = "block"; + //var fond = document.getElementById('fondImage'); + var conteneurImg = document.getElementById("conteneurImgExport"); + conteneurImg.className = "imageNotExport"; + //fond.className ="fondNotExport"; + var canvasimg = document.getElementById("canvasimg"); + canvasimg.style.visibility = "hidden"; + // zoom(1); + zoom(scale); + //canvasimg.style.display='none'; + var fond = document.getElementById("fondImage"); + fond.className = "fondNoExport"; +} + +function zoom(niveau) { + if (niveau == "p") { + scale = scale + 0.2; + } else if (niveau == "m") { + scale = scale - 0.2; + } else { + scale = niveau; + } + + changeLongueur(); + changeLargeur(); + genererParcours(); +} + +function changeUniteMesure() { + var oldUnit = unite; + + unite = document.getElementById("uniteMesure").value; + var convertion = unite / oldUnit; + // convertion des longueurs/largeurs + var longueurP = + document.getElementById("longueurParcours").value * convertion; + document.getElementById("longueurParcours").value = Math.round(longueurP); + var largeurP = + document.getElementById("largeurParcours").value * convertion; + document.getElementById("largeurParcours").value = Math.round(largeurP); + changeEchelle(); +} + +var xBz; +var yBz; +var vitesseTraj = 20; +var vitMax = 100; +function customBez(t, x0, y0, x1, y1, x2, y2, x3, y3) { + var cX = 3 * (x1 - x0), + bX = 3 * (x2 - x1) - cX, + aX = x3 - x0 - cX - bX; + + var cY = 3 * (y1 - y0), + bY = 3 * (y2 - y1) - cY, + aY = y3 - y0 - cY - bY; + + xBz = aX * Math.pow(t, 3) + bX * Math.pow(t, 2) + cX * t + x0; + yBz = aY * Math.pow(t, 3) + bY * Math.pow(t, 2) + cY * t + y0; +} + +function customBezier(x1, y1, x1b, y1b, x2b, y2b, x2, y2) { + var accuracy = 0.01; + + context.strokeStyle = "rgba(255, 0, 0, 1)"; // grilles + + var newX = x1; + var newY = y1; + var i = 0; + var avance = ((longueurMetre / 100) * accuracy * vitMax) / 13; + var oldX; + var oldY; + var oldX2; + var oldY2; + var oldAngle; + for (i = 0; i <= 1 + accuracy; i += accuracy) { + context.beginPath(); + context.moveTo(newX, newY); + + if (document.getElementById("VitesseTrajectoires").checked) { + context.lineWidth = 1.5; + context.strokeStyle = getColor(vitesseTraj); // grilles + } else { + context.lineWidth = 1; + context.strokeStyle = "black"; // grilles + } + customBez(i, x1, y1, x1b, y1b, x2b, y2b, x2, y2); + context.lineTo(xBz, yBz); + context.stroke(); + if (document.getElementById("VitesseTrajectoires").checked) { + if (i > 0) { + //calcul de l'angle actuel + newAngle = (Math.atan2(newY - yBz, newX - xBz) / Math.PI) * 180; + var diffAngle = oldAngle - newAngle; + if (diffAngle >= 0) { + if (diffAngle > 6) { + vitesseTraj -= avance * 5; // cas d'un virage séré + } else if (diffAngle > 5) { + vitesseTraj -= avance * 3; // cas d'un virage séré + } else if (diffAngle > 4) { + vitesseTraj -= avance * 2; // cas d'un virage séré + } else if (diffAngle > 3) { + vitesseTraj -= avance * 1; // cas d'un virage séré + } else if (diffAngle > 2) { + //vitesseTraj+=avance*0.2;// cas d'un virage séré + } else if (diffAngle > 1.5) { + vitesseTraj += avance * 0.4; // cas d'un virage séré + } else if (diffAngle > 1) { + vitesseTraj += avance * 0.6; // cas d'un virage séré + } else if (diffAngle > 0.5) { + vitesseTraj += avance * 0.8; // cas d'un virage peu séré + } else { + vitesseTraj += avance; // cas d'une ligne a peu pres droite + } + } + if (diffAngle < 0) { + if (diffAngle < -6) { + vitesseTraj -= avance * 5; // cas d'un virage séré + } else if (diffAngle < -5) { + vitesseTraj -= avance * 3; // cas d'un virage séré + } else if (diffAngle < -4) { + vitesseTraj -= avance * 2; // cas d'un virage séré + } else if (diffAngle < -3) { + vitesseTraj -= avance * 1; // cas d'un virage séré + } else if (diffAngle < -2) { + //vitesseTraj+=avance*0.2;// cas d'un virage séré + } else if (diffAngle < -1.5) { + vitesseTraj += avance * 0.4; // cas d'un virage peu séré + } else if (diffAngle < -1) { + vitesseTraj += avance * 0.6; // cas d'un virage peu séré + } else if (diffAngle < -0.5) { + vitesseTraj += avance * 0.8; // cas d'un virage peu séré + } else { + vitesseTraj += avance; // cas d'une ligne a peu pres droite + } + } + oldAngle = newAngle; + } else { + vitesseTraj += avance; // cas d'une ligne droite + } + if (vitesseTraj > vitMax) { + vitesseTraj = vitMax; + } + if (vitesseTraj < 0) { + vitesseTraj = 0; + } + } + + newX = xBz; + newY = yBz; + } + + context.lineWidth = 1; +} + +function getColor(vitesseTraj) { + var colorV = 0; + var colorR = 255; + if (vitesseTraj <= vitMax / 2) { + colorR = 255; + } else { + colorR = 255 - ((vitesseTraj - vitMax / 2) / vitMax) * 255; + } + if (vitesseTraj >= vitMax / 2) { + colorV = 255; + } else { + colorV = (vitesseTraj / vitMax) * 2 * 255; + } + + if (colorV > 255) { + colorV = 255; + } else if (colorV < 0) { + colorV = 0; + } + if (colorR > 255) { + colorR = 255; + } else if (colorR < 0) { + colorR = 0; + } + return "rgba(" + Math.round(colorR) + ", " + Math.round(colorV) + ", 0, 1)"; +} +function toggleShowNumbers() { + // Function don't get the value from check button, only uses it to change variable value calling this function + shownumbers = !shownumbers; + updateDuplicatedElements(); + genererParcours(); +} +function exportData(){ + var data = saveFileVersion+"\n"; + data += JSON.stringify(document.getElementById("titreParcours").value); + data += "\n"; + data += JSON.stringify(document.getElementById("auteurParcours").value); + data += "\n"; + data += JSON.stringify(nextNumber); + data += "\n"; + data += JSON.stringify(listeNumero); + data += "\n"; + data += JSON.stringify(nextNumber2); + data += "\n"; + data += JSON.stringify(listeNumero2); + data += "\n"; + data += JSON.stringify(nextNumber3); + data += "\n"; + data += JSON.stringify(listeNumero3); + data += "\n"; + data += JSON.stringify(idTunnel); + data += "\n"; + data += JSON.stringify(tbTunnels); + data += "\n"; + data += JSON.stringify(id); + data += "\n"; + data += JSON.stringify(tbObst); + data += "\n"; + data += JSON.stringify(idOrdre); + data += "\n"; + data += JSON.stringify(ordreObst); + data += "\n"; + data += JSON.stringify(document.getElementById("longueurParcours").value); + data += "\n"; + data += JSON.stringify(document.getElementById("largeurParcours").value); + data += "\n"; + data += JSON.stringify(document.getElementById("echelle").value); + var t = new Blob([data], {type: "text/plain"}); + var c = document.createElement("a"); + var title = document.getElementById("titreParcours").value; + var author = document.getElementById("auteurParcours").value; + var fname = "course" + if ( title!="" ) { + fname = title; + } else { + var now = new Date(); + fname += "_"+now.getFullYear()+(now.getMonth()+1)+now.getDate()+now.getHours()+now.getMinutes()+now.getSeconds(); + } + if ( author!="" ) { fname += " ("+author+")"; } + c.download = fname+".amc"; + c.href = window.URL.createObjectURL(t); + c.click(); +} + +function importFile(){ + var input = document.createElement('input'); + input.type = 'file'; + input.accept = '.amc,*'; + + input.onchange = e => { + // getting a hold of the file reference + var file = e.target.files[0]; + var file = e.target.files[0]; + + // setting up the reader + var reader = new FileReader(); + reader.readAsText(file,'UTF-8'); + + // here we tell the reader what to do when it's done reading... + reader.onload = readerEvent => { + var content = readerEvent.target.result; // this is the content! + const myArray = content.split("\n"); + var fileVersion = JSON.parse(myArray[0]); + + if (fileVersion=="1") { + title = JSON.parse(myArray[1]); + author = JSON.parse(myArray[2]); + nextNumber = JSON.parse(myArray[3]); + listeNumero = JSON.parse(myArray[4]); + nextNumber2 = JSON.parse(myArray[5]); + listeNumero2 = JSON.parse(myArray[6]); + nextNumber3 = JSON.parse(myArray[7]); + listeNumero3 = JSON.parse(myArray[8]); + idTunnel = JSON.parse(myArray[9]); + tbTunnels = JSON.parse(myArray[10]); + id = JSON.parse(myArray[11]); + tbObst = JSON.parse(myArray[12]); + idOrdre = JSON.parse(myArray[13]); + ordreObst = JSON.parse(myArray[14]); + width = JSON.parse(myArray[15]); + height = JSON.parse(myArray[16]); + grid = JSON.parse(myArray[17]); + } + + // Update content + document.getElementById("titreParcours").value = title; + document.getElementById("auteurParcours").value = author; + document.getElementById("longueurParcours").value = width; + document.getElementById("largeurParcours").value = height; + document.getElementById("echelle").value = grid; + changeInfos(); + changeLargeur(); + changeLongueur(); + changeEchelle(); + genererParcours(); + } + } + + input.click(); +} + +function shortcutAction( event ) { + if (lastDownTarget!=canvas) return; + + switch (event.key) { + case "m": + document.getElementById("ModifierTrajectoires").checked = !document.getElementById("ModifierTrajectoires").checked; + break; + } + + // formas de tunel + if (overTunnelComplet>=0 || overTunnelId>=0) { + var tunnelid = overTunnelComplet; + if ( tunnelid<0 ) { tunnelid = overTunnelId; } + switch (event.key) { + case "1": + // suponemos y comprobamos que el indice del vector coincide con el id del tunel + if ( tbTunnels[tunnelid][0] == tunnelid ) { + tbTunnels[tunnelid][4] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][6] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][8] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][10] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][12] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][14] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][16] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][18] = tbTunnels[tunnelid][2]; + tbTunnels[tunnelid][20] = tbTunnels[tunnelid][2]; + } + break; + case "2": + // suponemos y comprobamos que el indice del vector coincide con el id del tunel + if ( tbTunnels[tunnelid][0] == tunnelid ) { + tbTunnels[tunnelid][3] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][5] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][7] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][9] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][11] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][13] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][15] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][17] = tbTunnels[tunnelid][1]; + tbTunnels[tunnelid][19] = tbTunnels[tunnelid][1]; + } + break; + } + genererParcours(); + } + + // temporalmente, si se está encima de un obstaculo no se permite el atajo porque si no se mueven el nuevo elemento y + // sobre el que se encuentra el ratón al definir la posición del nuevo elemento + if (isOverObstacle()) return; + + switch (event.key) { + case "j": + ajouterHaie(); + break; + case "n": + ajouterNumero(1); + break; + case "t": + ajouterTunnel(6); + break; + case "T": + ajouterTunnel(3); + break; + case "+": + zoom('p') + break; + case "-": + zoom('m') + break; + } + // console.log(event.key); +} \ No newline at end of file diff --git a/static/ui/app/src/init.js b/static/ui/app/src/init.js new file mode 100644 index 0000000..b40cc8a --- /dev/null +++ b/static/ui/app/src/init.js @@ -0,0 +1,169 @@ +var canvas; +var pixel = 6; //taille en centimetre d'un pixel +var TPS = 0; +var distObstTrajectoire = 40; +var tbObst = new Array(); +var tbTunnels = new Array(); +var id = 0; +var idTunnel = 0; +var selObst = -1; +var rotate = false; +var rotateCote = ""; +var decalX = 0; +var decalY = 0; +var afficheCercle = false; +var DIAM_ROND_SELECTION = 7; +var DIAM_BARRE_SLALOM = 1.5; +var DIAM_ROND_SELECTION_TUNNEL = 3; +var overNumeroId = -1; +var overNumeroId2 = -1; +var overNumeroId3 = -1; +var overObject = -1; +var canvas_x; +var canvas_y; + +var longueurMetre; + +//COULEURS +var COLOR_1 = "#22AAFF"; // principale +var COLOR_1b = "#0088DD"; // principale sombre + +var COLOR_2 = "#CC3300"; // zones +var COLOR_2b = "#AA1100"; // zones sombre + +var COLOR_3 = "#EEEEEE"; // couleur barre 2 + +var color = false; + +var COLOR_CONTOURS = "#000000"; // contours +var COLOR_JOINTURES = "#444444"; // jointures entre éléments +var COLOR_TERRAIN = "#d3e4f0"; // terrain CCFFCC + +var COLOR_GRILLE = "#bbbbbb"; // grilles +var COLOR_METAL = "#999999"; // grilles +var COLOR_BLANC = "#ffffff"; // grilles + +var COLOR_TEXT = "#000000"; // grilles +var COLOR_TEXT_UNDER = "rgba(211, 228, 240, 0.7)"; // grilles +var COLOR_SPECIAL = "rgba(255, 255, 255, 1)"; // grilles +var COLOR_TRACE_MAUVAIS = "#DD0000"; +var COLOR_TRACE_OK = "#555555"; +var COLOR_JAUNE = "#ffff00"; +var COLOR_TRACE_TRANSPARENT = "rgba(44, 44, 44, 0.3)"; // grilles +var COLOR_PEAU = "#ffff88"; +var COLOR_CHEVEUX = "black"; +var COLOR_VETEMENTS = "#CC3300"; + +//////////////////////////////////////////////// +var LARGEUR_MUR_TOUR = 40; +var unite = 1; +var TAILLE_GRILLAGE = ((100 / pixel) * 2) / unite; +var MARGE = 25; +var ANGLE_MIN = 145; +var DIAM_BARRE = 1.5; +var nbArticulationTunnel = 9; +var distMaxTunnel = 600 / (nbArticulationTunnel - 1) / pixel; +var distMinTunnel = 400 / (nbArticulationTunnel - 1) / pixel; +var distMinTunnel3 = 300 / (nbArticulationTunnel - 1) / pixel; +var distMaxTunnel3 = 400 / (nbArticulationTunnel - 1) / pixel; +var largeurTunnel = 63 / pixel; +var selTunnel = -1; +var selPointTunnel = -1; +var overTunnelId = -1; +var overPointTunnel = -1; +var overTunnelComplet = -1; +var selTunnelComplet = -1; +var angleSurplus = 0; +var trajectoire = true; +// dimension des obstacles +var moveTunnelComplet = -1; +var suppression = false; +var DIM_TABLE = 120 / pixel; +var ordreObst = new Array(); +var idOrdre = 0; +var longueurTotal = 0; + +var auteur = ""; +var titre = ""; +var shownumbers = true; +var listeNumero = new Array(); +var listeNumero2 = new Array(); +var listeNumero3 = new Array(); +var nextNumber = 1; +var nextNumber2 = 1; +var nextNumber3 = 1; +var selNumeroId = -1; +var selNumeroId2 = -1; +var selNumeroId3 = -1; +var idLg = 0; +var LARGEUR_NUMERO = 13; +var HAUTEUR_NUMERO = 9; +var oldx = 0; +var oldy = 0; +var diffx = 0; +var diffy = 0; +var DECAL_X_INTERFACE = 120; +var DECAL_Y_INTERFACE = 90; + +var modifTrajId = -1; +var modifTrajDepArr = -1; + +var overModifTrajId = -1; +var overModifTrajDepArr = -1; + +var langues = new Array(); +var scale = 1.2; +//var scale=3;//PROVISOIRE + +var canvasSizeX = 0; +var canvasSizeY = 0; + +var isTactil = false; +var RECT_MARGE_SELECTION = 0; +var movingJump = false; +var saveFileVersion = 1; +var DIAM_ROND_SELECTION_TUNNEL_MOVE; +var LARGEUR_NUMERO_SELECT; +var HAUTEUR_NUMERO_SELECT; +var ROTATE_MARGE_SELECTION; +var showconducteur = true; +var lastDownTarget = ""; +function init() { + document.getElementById("longueurParcours").value = "22"; + document.getElementById("largeurParcours").value = "40"; + document.getElementById("echelle").value = "2"; + canvas = document.getElementById("canvas"); + unite = document.getElementById("uniteMesure").value; + context = canvas.getContext("2d"); + context.scale(scale, scale); + changeUniteMesure(); + changeLargeur(); + changeLongueur(); + setMargeSelect(); + /* + COLOR_TERRAIN=context.createLinearGradient(0,0,canvasSizeX,0); + COLOR_TERRAIN.addColorStop(0,"#d3e4f0"); + COLOR_TERRAIN.addColorStop(1,"#c3d4e0"); + COLOR_BLANC=context.createLinearGradient(0,0,canvasSizeX,0); + COLOR_BLANC.addColorStop(0,"#eeeeff"); + COLOR_BLANC.addColorStop(1,"white");*/ + //canvasSizeX= canvas.width; + //canvasSizeY= canvas.height; + // Attach the mousemove event handler + context.font = "8pt Calibri"; + genererParcours(); + window.addEventListener("mousemove", doMouseMove, false); + canvas.addEventListener("mousedown", doMouseDown, false); + + canvas.addEventListener("touchstart", doTouchStart, false); + + // listener para que se procesen los atajos de teclado solo si se está en el canvas + document.addEventListener('mousedown', function(event) { lastDownTarget = event.target; }, false); + // Added keyboard shortcuts + document.addEventListener("keyup", shortcutAction, false); + + initLangue(); + + updateDuplicatedElements(); + genererParcours(); +} diff --git a/static/ui/app/src/interface.js b/static/ui/app/src/interface.js new file mode 100644 index 0000000..fc55108 --- /dev/null +++ b/static/ui/app/src/interface.js @@ -0,0 +1,67 @@ +function masquerTout() { + document.getElementById("blocOSav").className = "blocOptions"; + document.getElementById("blocOObst").className = "blocOptions"; + document.getElementById("blocOTrj").className = "blocOptions"; + document.getElementById("blocOParam").className = "blocOptions"; + document.getElementById("blocOLangue").className = "blocOptions"; + document.getElementById("blocOCon").className = "blocOptions"; + document.getElementById("imgParam").src = + "/static/public/tabs/unfocused/param.png"; + document.getElementById("imgTrj").src = + "/static/public/tabs/unfocused/trj.png"; + document.getElementById("imgSav").src = + "/static/public/tabs/unfocused/sav.png"; + document.getElementById("imgObs").src = + "/static/public/tabs/unfocused/obstacles.png"; + document.getElementById("imgCon").src = + "/static/public/tabs/unfocused/conducteur.png"; + + // barre d'outils + document.getElementById("outils").style.display = "none"; + document.getElementById("barreOConduct").style.display = "none"; + document.getElementById("barreOParam").style.display = "none"; + document.getElementById("barreOTraj").style.display = "none"; + document.getElementById("barreOSav").style.display = "none"; + document.getElementById("barreOLangue").style.display = "none"; + + document.getElementById("blocInfoDim2").style.display = "none"; + masquerLangue(); +} +function setInfoSauvegarde() { + masquerTout(); + document.getElementById("barreOSav").style.display = "block"; + //document.getElementById("blocOSav").className="blocOptionsSel"; + document.getElementById("imgSav").src = + "/static/public/tabs/focused/sav.png"; +} + +function setInfoTrajectoires() { + masquerTout(); + //document.getElementById("blocOTrj").className="blocOptionsSel"; + document.getElementById("imgTrj").src = + "/static/public/tabs/focused/trj.png"; + document.getElementById("barreOTraj").style.display = "block"; +} + +function setInfoConducteur() { + masquerTout(); + document.getElementById("barreOConduct").style.display = "block"; + document.getElementById("imgCon").src = + "/static/public/tabs/focused/conducteur.png"; + //document.getElementById("blocOCon").className="blocOptionsSel"; +} +function setInfoObstacles() { + masquerTout(); + //document.getElementById("outils").className="blocOptionsSel"; + document.getElementById("outils").style.display = "block"; + document.getElementById("imgObs").src = + "/static/public/tabs/focused/obstacles.png"; +} +function setInfoParam() { + masquerTout(); + //document.getElementById("blocOParam").className="blocOptionsSel"; + document.getElementById("imgParam").src = + "/static/public/tabs/focused/param.png"; + document.getElementById("barreOParam").style.display = "block"; + document.getElementById("blocInfoDim2").style.display = "block"; +} diff --git a/static/ui/app/src/language.js b/static/ui/app/src/language.js new file mode 100644 index 0000000..c789da6 --- /dev/null +++ b/static/ui/app/src/language.js @@ -0,0 +1,1003 @@ +var Francais = new Array(); +var English = new Array(); +var Portugues = new Array(); +var Espanol = new Array(); +var Italiano = new Array(); +var Polski = new Array(); +var Catalan = new Array(); +var Svenska = new Array(); +var Norsk = new Array(); +var Japanese = new Array(); +var Dansk = new Array(); +var German = new Array(); +var suomi = new Array(); +var Hungarian = new Array(); +var Russian = new Array(); +/****FR****/ +Francais[1] = "Paramètres"; +Francais[2] = "Dimensions"; +Francais[3] = "Trajectoires"; +Francais[4] = "Couleurs"; +Francais[5] = "Couleurs perso"; +Francais[6] = "Télechargement"; +Francais[7] = "Langue"; +Francais[8] = "Distance théorique"; +Francais[9] = "Auteur"; +Francais[10] = "Sauts"; +Francais[11] = "Zones"; +Francais[12] = "Autres"; +Francais[13] = "Outils"; +Francais[14] = "Titre : "; +Francais[15] = "Longueur : "; +Francais[16] = "Largeur : "; +Francais[17] = "Echelle du cadrillage : "; +Francais[18] = "Mètre"; +Francais[19] = "Afficher les trajectoires"; +Francais[20] = "Modifier manuellement"; +Francais[21] = "Couleur du fond"; +Francais[22] = "Couleur 1"; +Francais[23] = "Couleur 2"; +Francais[24] = "Couleur 3"; +Francais[25] = "Générer l'image pour l'export"; +Francais[26] = "Auteur : "; +Francais[27] = + "VERSION BETA (En cours de développement), outil créé pour être utilisé avec une souris"; +Francais[28] = ""; +Francais[29] = + "Pour télécharger l'image, effectuer un clique droit sur l'image puis \"Enregistrer sous\""; +Francais[30] = "images/partager.png"; +Francais[31] = "Web"; +Francais[32] = "Imprimante"; +Francais[33] = "Imprimante Haute Qualité"; +Francais[34] = "Mètre(s)"; +Francais[35] = "Yard"; +Francais[36] = "Pied"; +Francais[37] = "Unité de mesure : "; + +Francais[38] = "Obstacles"; +Francais[39] = "Personnages"; +Francais[40] = "Sauvegarde"; +Francais[41] = "Numéros"; +Francais[42] = "Vitesse du chien"; +Francais[43] = "Afficher personnages"; + +Francais[44] = "Télécharger la course"; +Francais[45] = "Importer le course"; +Francais[46] = "Télécharger data"; +Francais[47] = "Afficher numeros"; + +/****DE****/ +German[1] = "Parameter"; +German[2] = "Dimensionen"; +German[3] = "Laufweg des Hundes"; +German[4] = "Farben"; +German[5] = "Individuelle Farben"; +German[6] = "Download"; +German[7] = "Sprache"; +German[8] = "Länge"; +German[9] = "Autor"; +German[10] = "Sprünge"; +German[11] = "Kontaktzonengeräte"; +German[12] = "Andere"; +German[13] = "Werkzeug"; +German[14] = "Titel : "; +German[15] = "Länge : "; +German[16] = "Breite : "; +German[17] = "Gittergröße : "; +German[18] = "Meter"; +German[19] = " Zeige Laufweg "; +German[20] = " manueller Laufweg "; +German[21] = "Hintergrundfarbe"; +German[22] = "Farbe 1"; +German[23] = "Farbe 2"; +German[24] = "Farbe 3"; +German[25] = "Erzeuge Abbildung"; +German[26] = "Autor : "; +German[27] = + "BETA VERSION (in der Entwicklung), erstellt zur Nutzung mit der Maus"; +German[28] = ""; +German[29] = + 'Um die Abbildung zu downloaden, machen Sie einen Rechtsklick auf die Abbildung und wählen "Speichern unter" oder eine ähnliche Option'; +German[30] = "images/share.png"; +German[31] = "Web"; +German[32] = "Druckversion"; +German[33] = "Druckversion Hohe Qualität"; +German[34] = "Meter"; +German[35] = "Schritt"; +German[36] = "Fuß"; +German[37] = "Längeneinheit : "; + +/****EN****/ +English[1] = "Parameters"; +English[2] = "Dimensions"; +English[3] = "Dogs path"; +English[4] = "Colors"; +English[5] = "Custom colors"; +English[6] = "Download"; +English[7] = "Language"; +English[8] = "Length"; +English[9] = "Author"; +English[10] = "Jumps"; +English[11] = "Contact"; +English[12] = "Miscellaneous"; +English[13] = "Tools"; +English[14] = "Title : "; +English[15] = "Length : "; +English[16] = "Width : "; +English[17] = "Scale of the grid : "; +English[18] = "Meter"; +English[19] = " Show path "; +English[20] = " Manual path "; +English[21] = "Background color"; +English[22] = "Color 1"; +English[23] = "Color 2"; +English[24] = "Color 3"; +English[25] = "Generate the image"; +English[26] = "Author : "; +English[27] = + "BETA VERSION (Under development), created to be used with a mouse"; + +English[28] = ""; +English[29] = + 'To download the picture, right click on it and select "Save Image as" or a similar option'; +English[30] = "images/share.png"; + +English[31] = "Web"; +English[32] = "Printable"; +English[33] = "Printable High Quality"; +English[34] = "Meter(s)"; +English[35] = "Yard"; +English[36] = "Feet"; +English[37] = "Unit of length : "; + +English[38] = "Obstacles"; +English[39] = "Characters"; +English[40] = "Save"; +English[41] = "Numbers"; +English[42] = "dog's speed"; +English[43] = "Show characters"; + +/****HU****/ +Hungarian[1] = "Adatok"; +Hungarian[2] = "Méretek"; +Hungarian[3] = "Kutya útvonala"; +Hungarian[4] = "Színek"; +Hungarian[5] = "Egyedi színek"; +Hungarian[6] = "Letöltés"; +Hungarian[7] = "Nyelv"; +Hungarian[8] = "Hosszúság"; +Hungarian[9] = "Készítő"; +Hungarian[10] = "Ugró akadályok"; +Hungarian[11] = "Zónás akadályok"; +Hungarian[12] = "Egyéb akadályok"; +Hungarian[13] = "Eszközök"; +Hungarian[14] = "Cím : "; +Hungarian[15] = "Hosszúság : "; +Hungarian[16] = "Szélesség : "; +Hungarian[17] = "Rácsbeosztás : "; +Hungarian[18] = "Méret"; +Hungarian[19] = " Útvonal mutatása "; +Hungarian[20] = " Egyéni útvonal "; +Hungarian[21] = "Háttér színe"; +Hungarian[22] = "Első szín"; +Hungarian[23] = "Második szín"; +Hungarian[24] = "Harmadik szín"; +Hungarian[25] = "Képformátum"; +Hungarian[26] = "Készítő : "; +Hungarian[27] = + "BETA VERZIÓ (Fejlesztés alatt) A program használata egérrel lehetséges."; + +Hungarian[28] = ""; +Hungarian[29] = + 'A pálya letöltéséhez kattints jobb gombbal, és válaszd a "Kép mentése más néven" menüpontot.'; +Hungarian[30] = "images/share.png"; + +Hungarian[31] = "Webre"; +Hungarian[32] = "Nyomtatóra"; +Hungarian[33] = "Nyomtatóra (Nagy felbontás)"; +Hungarian[34] = "Méter"; +Hungarian[35] = "Yard"; +Hungarian[36] = "Láb"; +Hungarian[37] = "Hosszmérték : "; +/****NO****/ +Norsk[1] = "Parameterer"; +Norsk[2] = "Dimensjoner"; +Norsk[3] = "Hundens vei"; +Norsk[4] = "Farger"; +Norsk[5] = "Tilpassede farger"; +Norsk[6] = "Laste ned"; +Norsk[7] = "Språk"; +Norsk[8] = "Lengde"; +Norsk[9] = "Forfatter"; +Norsk[10] = "Hopphindre"; +Norsk[11] = "Kontakthindre"; +Norsk[12] = "Diverse"; +Norsk[13] = "Verktøy"; +Norsk[14] = "Tittel : "; +Norsk[15] = "Lengde : "; +Norsk[16] = "Bredde : "; +Norsk[17] = "Målestokk på rutenett : "; +Norsk[18] = " Meter(e)"; +Norsk[19] = " Vis banens strekning "; +Norsk[20] = " Manuell strekning "; +Norsk[21] = "Bakgrunnsfarge"; +Norsk[22] = "Farge 1"; +Norsk[23] = "Farge 2"; +Norsk[24] = "Farge 3"; +Norsk[25] = "Generere bildet"; +Norsk[26] = "Forfatter : "; +Norsk[27] = "BETA VERSION (Under utvikling), laget for bruk av datamuse"; + +Norsk[28] = ""; +Norsk[29] = + ' For å laste ned bildet, høyreklikk på den og velg "Lagre bilde som" eller et lignende alternativ'; +Norsk[30] = "images/share.png"; + +Norsk[31] = "Nett"; +Norsk[32] = "Utskriftsvennlig"; +Norsk[33] = "Utskriftsvennlig med høy kvalitet "; +Norsk[34] = "Meter"; +Norsk[35] = "Yard"; +Norsk[36] = "Fot"; +Norsk[37] = " Lengdeenhet: "; + +/****JP****/ +Japanese[1] = "パラメータ"; +Japanese[2] = "リンクサイズ"; +Japanese[3] = "犬の経路"; +Japanese[4] = "配色"; +Japanese[5] = "カスタム色"; +Japanese[6] = "ダウンロード"; +Japanese[7] = "言語"; +Japanese[8] = "コース全長"; +Japanese[9] = "作者"; +Japanese[10] = "ジャンプ障害"; +Japanese[11] = "コンタクト障害"; +Japanese[12] = "その他"; +Japanese[13] = "ツール"; +Japanese[14] = "タイトル : "; +Japanese[15] = "長さ : "; +Japanese[16] = "幅 : "; +Japanese[17] = "グリッド間隔 : "; +Japanese[18] = "Meter(s)"; +Japanese[19] = " 経路を自動表示する "; +Japanese[20] = " 経路を手動で設定する "; +Japanese[21] = "背景色"; +Japanese[22] = "カラー 1"; +Japanese[23] = "カラー 2"; +Japanese[24] = "カラー 3"; +Japanese[25] = "イメージの生成"; +Japanese[26] = "作者 : "; +Japanese[27] = "ベータ版 (開発中), 作成にはマウスが必要です"; + +Japanese[28] = ""; +Japanese[29] = + "コース図をダウンロードするには、マウスを右クリック「名前を付けて画像を保存(V)」、又は同じようなオプションをを選択してください。"; +Japanese[30] = ""; + +Japanese[31] = "Web"; +Japanese[32] = "印刷"; +Japanese[33] = "高品質印刷"; +Japanese[34] = "m"; +Japanese[35] = "yd"; +Japanese[36] = "ft"; +Japanese[37] = "長さの単位 : "; + +/****SE****/ +Svenska[1] = "Parametrar"; +Svenska[2] = "Dimensioner"; +Svenska[3] = "Hundens löpväg"; +Svenska[4] = "Färg"; +Svenska[5] = "Standard färg"; +Svenska[6] = "Ladda ner"; +Svenska[7] = "Språk"; +Svenska[8] = "Längd"; +Svenska[9] = "Författare"; +Svenska[10] = "Hopphinder"; +Svenska[11] = "Balanshinder"; +Svenska[12] = "Övrigt"; +Svenska[13] = "Verktyg"; +Svenska[14] = "Titel : "; +Svenska[15] = "Bredd: "; +Svenska[16] = "Höjd: "; +Svenska[17] = "Rutmönster skala : "; +Svenska[18] = "Meter"; +Svenska[19] = " Visa Hundens löpväg "; +Svenska[20] = " Manuell Hundens löpväg "; +Svenska[21] = "Bakgrundsfärg"; +Svenska[22] = "Färg 1"; +Svenska[23] = "Färg 2"; +Svenska[24] = "Färg 3"; +Svenska[25] = "Skapa bild"; +Svenska[26] = "Författare : "; +Svenska[27] = + "BETA VERSION (Under utveckling), skapad för att användas med muspekare"; +Svenska[28] = ""; +Svenska[29] = + 'För att ladda ner bilden, högerklicka och välj "Spara bild som" eller liknande alternativ'; +Svenska[30] = ""; +Svenska[31] = "Web"; +Svenska[32] = "För utskrift"; +Svenska[33] = "För utskrift med hög kvalitet"; +Svenska[34] = "Meter"; +Svenska[35] = "Yard"; +Svenska[36] = "Feet"; +Svenska[37] = "Längdenhet : "; +/* +Vit&Svart +Blå&Röd +Svart&Röd +Röd&Vit +eco Blå&Röd +eco Svart&Vit +*/ + +/****PT****/ +Portugues[1] = "Parameteros"; +Portugues[2] = "Dimensões"; +Portugues[3] = "Trajectórias"; +Portugues[4] = "Cores"; +Portugues[5] = "Cores Personalizadas"; +Portugues[6] = "Download"; +Portugues[7] = "Idioma"; +Portugues[8] = "Comprimento"; +Portugues[9] = "Autor"; +Portugues[10] = "Saltos"; +Portugues[11] = "Contactos"; +Portugues[12] = "Diversos"; +Portugues[13] = "Ferramentas"; +Portugues[14] = "Titulo : "; +Portugues[15] = "Comprimento : "; +Portugues[16] = "Largura : "; +Portugues[17] = "Escala da grelha : "; +Portugues[18] = "Metro(s)"; +Portugues[19] = " Mostrar Trajectorias "; +Portugues[20] = " Trajectorias Manuais "; +Portugues[21] = "Cor de Fundo"; +Portugues[22] = "Cor 1"; +Portugues[23] = "Cor 2"; +Portugues[24] = "Cor 3"; +Portugues[25] = "Gerar Imagem"; +Portugues[26] = "Autor : "; +Portugues[27] = + "VERSÃO (Em desenvolvimento), Criado para ser utilizado com recurso ao rato(mouse)"; +Portugues[28] = ""; +Portugues[29] = + 'Para fazer o Download da Imagem, clicka com botão do lado direito do rato e seleccione "Guardar imagem como" ou uma opção equivalente'; +Portugues[30] = "images/partilhar.png"; +Portugues[31] = "Web"; +Portugues[32] = "Imprimir"; +Portugues[33] = "Imprimir em Alta Qualidade"; +Portugues[34] = "Metro"; +Portugues[35] = "Jarda"; +Portugues[36] = "Pés"; +Portugues[37] = "Unidade de comprimento : "; + +/*----------------ESPAÑOL-----------------*/ +Espanol[1] = "Parámetros"; +Espanol[2] = "Dimensiones"; +Espanol[3] = "Trayectorias"; +Espanol[4] = "Colores"; +Espanol[5] = "Colores Personalizados"; +Espanol[6] = "Descargar"; +Espanol[7] = "Idioma"; +Espanol[8] = "Longitud"; +Espanol[9] = "Autor"; +Espanol[10] = "Saltos"; +Espanol[11] = "Contactos"; +Espanol[12] = "Otros"; +Espanol[13] = "Herramientas"; +Espanol[14] = "Titulo : "; +Espanol[15] = "Longitud : "; +Espanol[16] = "Amplitud : "; +Espanol[17] = "Escala la rejilla : "; +Espanol[18] = "Metro(s)"; +Espanol[19] = " Mostrar Trayectorias "; +Espanol[20] = " Trayectorias Manuales "; +Espanol[21] = "Color de fondo"; +Espanol[22] = "Color 1"; +Espanol[23] = "Color 2"; +Espanol[24] = "Color 3"; +Espanol[25] = "Generar imagen"; +Espanol[26] = "Autor : "; +Espanol[27] = + "VERSIÓN BETA(En desarrollo) , diseñado para su uso con la función del ratón(mouse)"; +Espanol[28] = ""; +Espanol[29] = + 'Para descargar la imagen, clicka con el botón derecho del ratón y seleccione "Guarda la imagen como" o una opción equivalente'; +Espanol[30] = "images/comparte.jpg"; +Espanol[31] = "Web"; +Espanol[32] = "Imprimir"; +Espanol[33] = "Impresión de alta calidad"; +Espanol[34] = "Metro"; +Espanol[35] = "Yarda"; +Espanol[36] = "Pie"; +Espanol[37] = "Unidad de longitud : "; + +Italiano[1] = "Parametri"; +Italiano[2] = "Dimensioni"; +Italiano[3] = "Traiettorie"; +Italiano[4] = "Colori"; +Italiano[5] = "Colori personali"; +Italiano[6] = "Download"; +Italiano[7] = "Lingua"; +Italiano[8] = "Distanza teorica"; +Italiano[9] = "Autore"; +Italiano[10] = "Salti"; +Italiano[11] = "Zone"; +Italiano[12] = "Altri"; +Italiano[13] = "Strumenti"; +Italiano[14] = "Titolo : "; +Italiano[15] = "Lunghezza : "; +Italiano[16] = "Larghezza : "; +Italiano[17] = "Scala della griglia : "; +Italiano[18] = "Metro(i)"; +Italiano[19] = " Mostra le traiettorie "; +Italiano[20] = " Modifica manualmente "; +Italiano[21] = "Colore dello sfondo"; +Italiano[22] = "Colore 1"; +Italiano[23] = "Colore 2"; +Italiano[24] = "Colore 3"; +Italiano[25] = "Esporta immagine per"; +Italiano[26] = "Autore : "; +Italiano[27] = + "VERSIONE BETA (In corso di sviluppo), software creato per essere utilizzato con un mouse"; +Italiano[28] = ""; +Italiano[29] = + 'Per scaricare l’immagine, click destro sull’immagine poi "Salva immagine con nome"'; +Italiano[30] = "immagine/condividi.png"; +Italiano[31] = "Web"; +Italiano[32] = "Stampante"; +Italiano[33] = "Stampante alta qualità"; +Italiano[34] = "Metro"; +Italiano[35] = "Iarda"; +Italiano[36] = "Piede"; +Italiano[37] = "Unità di misura : "; + +Polski[1] = "Ustawienia"; +Polski[2] = "Wielkość"; +Polski[3] = "Trasa"; +Polski[4] = "Kolory"; +Polski[5] = "Kolory skonfigurowane"; +Polski[6] = "Pobieranie"; +Polski[7] = "Język"; +Polski[8] = "Odległość teoretyczna"; +Polski[9] = "Autor"; +Polski[10] = "Skoki"; +Polski[11] = "Strefy"; +Polski[12] = "Inne"; +Polski[13] = "Narzędzia"; +Polski[14] = "Tytuł: "; +Polski[15] = "Długość : "; +Polski[16] = "Szerokość : "; +Polski[17] = "Skala : "; +Polski[18] = "Metr"; +Polski[19] = " Wyświetl trasy "; +Polski[20] = " Dostosowanie trasy "; +Polski[21] = "Kolor tła"; +Polski[22] = "Kolor 1"; +Polski[23] = "Kolor 2"; +Polski[24] = "Kolor 3"; +Polski[25] = "Wygenerowac obrazek na eksport"; +Polski[26] = "Autor : "; +Polski[27] = + "Wersja BETA (W realizacji), aplikacja stworzona do użuzytku z myszka"; +Polski[28] = ""; +Polski[29] = + "Aby ściągnąć obrazek,należy nacisnąć na prawy przycisk myszki i wybrać Zapisz jako"; +Polski[30] = "images/partager.png"; +Polski[31] = "Wersja Web"; +Polski[32] = "Wersja do druku"; +Polski[33] = "Wersja do druku w wysokiej Jakości"; +Polski[34] = "Metr"; +Polski[35] = "Jard"; +Polski[36] = "Cal"; +Polski[37] = "Jednostka miary "; + +/*----------------ESPAÑOL-----------------*/ +Catalan[1] = "Paràmetres"; +Catalan[2] = "Dimensions"; +Catalan[3] = "Trajectories"; +Catalan[4] = "Colors"; +Catalan[5] = "Colors Personalitzats"; +Catalan[6] = "Descàrrega"; +Catalan[7] = "Idioma"; +Catalan[8] = "Longitut"; +Catalan[9] = "Autor"; +Catalan[10] = "Salts"; +Catalan[11] = "Contactes"; +Catalan[12] = "Altres"; +Catalan[13] = "Eines"; +Catalan[14] = "Títol : "; +Catalan[15] = "Longitut : "; +Catalan[16] = "Amplitut : "; +Catalan[17] = "Escala de la reixa : "; +Catalan[18] = "Metre(s)"; +Catalan[19] = " Mostrar Trajectories "; +Catalan[20] = " Trayectories Manuals "; +Catalan[21] = "Color de fons"; +Catalan[22] = "Color 1"; +Catalan[23] = "Color 2"; +Catalan[24] = "Color 3"; +Catalan[25] = "Generar imatge"; +Catalan[26] = "Autor : "; +Catalan[27] = + "VERSIÓ BETA(En desenvolupament) , disenyat pel seu ús amb el ratolí(mouse)"; +Catalan[28] = ""; +Catalan[29] = + 'Per descarregar la imatge, clicka amb el botó dret del ratolí i selecciona "Guarda la imatge com" o una opció equivalent'; +Catalan[30] = "imatges/comparteix.jpg"; +Catalan[31] = "Web"; +Catalan[32] = "Imprimir"; +Catalan[33] = "Impresió d'alta qualitat"; +Catalan[34] = "Metre"; +Catalan[35] = "Yarda"; +Catalan[36] = "Peu"; +Catalan[37] = "Unitat de longitut : "; + +/****EN****/ +suomi[1] = "Parametrit"; +suomi[2] = "Mitat"; +suomi[3] = "Reitti"; +suomi[4] = "Värit"; +suomi[5] = "Omat värit"; +suomi[6] = "Lataa"; +suomi[7] = "Kieli"; +suomi[8] = "Pituus"; +suomi[9] = "Tekijä"; +suomi[10] = "Hypyt"; +suomi[11] = "Kontaktit"; +suomi[12] = "Muut"; +suomi[13] = "Työkalut"; +suomi[14] = "Otsikko : "; +suomi[15] = "Pituus : "; +suomi[16] = "Leveys : "; +suomi[17] = "Ruudukon mitat : "; +suomi[18] = "Metri"; // this means tools for measuring, if you mean unit of lenght, it sould be ”Metri (t)” +suomi[19] = " Näytä reitti "; +suomi[20] = " Manuaalinen reitti "; +suomi[21] = "Taustaväri"; +suomi[22] = "Väri 1"; +suomi[23] = "Väri 2"; +suomi[24] = "Väri 3"; +suomi[25] = "Luo kuva"; +suomi[26] = "Tekijä : "; +suomi[27] = "BETA VERSIO (kehitys jatkuu), luotu käytettäväksi hiirellä"; + +suomi[28] = ""; +suomi[29] = + 'Lataa kuva, paina oikeaa ja valitse "Save Image as" tai vastaava vaihtoehto'; +suomi[30] = "images/share.png"; // or maybe this way, depending context... "kuva/jaa.png" + +suomi[31] = "Web"; +suomi[32] = "Tulostettava"; +suomi[33] = "Tulostettava High Quality"; +suomi[34] = "Metriä"; +suomi[35] = "Jaardi"; +suomi[36] = "Jalka"; +suomi[37] = "Pituuden yksikkö : "; + +/****EN****/ +Dansk[1] = "Parametre"; +Dansk[2] = "Dimensioner"; +Dansk[3] = "Hundens løbebane"; +Dansk[4] = "Farver"; +Dansk[5] = "Forskellige farver"; +Dansk[6] = "Download"; +Dansk[7] = "Sprog"; +Dansk[8] = "Længde"; +Dansk[9] = "Forfatter"; +Dansk[10] = "Spring"; +Dansk[11] = "Feltforhindringer"; +Dansk[12] = "Diverse"; +Dansk[13] = "Værktøjer"; +Dansk[14] = "Titel : "; +Dansk[15] = "Længde : "; +Dansk[16] = "Bredde : "; +Dansk[17] = "Mål på net : "; +Dansk[18] = "Meter(s)"; +Dansk[19] = " Vis rute "; +Dansk[20] = " Manuel rute "; +Dansk[21] = "Baggrundsfarve"; +Dansk[22] = "Farve 1"; +Dansk[23] = "Farve 2"; +Dansk[24] = "Farve 3"; +Dansk[25] = "Generer billede"; +Dansk[26] = "Forfatter : "; +Dansk[27] = "BETA VERSION (under udvikling). Designet til brug med mus."; + +Dansk[28] = ""; +Dansk[29] = + "For at downloade billedet, højre klik på de tog vælg “gem billed som” eller anden mulighed"; +Dansk[30] = "images/share.png"; + +Dansk[31] = "Web"; +Dansk[32] = "Print"; +Dansk[33] = "Printi høj kvalitet"; +Dansk[34] = "Meter"; +Dansk[35] = "Yard"; +Dansk[36] = "Feet"; +Dansk[37] = "Længde enhed : "; + +/* Ajouts */ +English[38] = "Obstacles"; +English[39] = "Characters"; +English[40] = "Save"; +English[41] = "Numbers"; +English[42] = "dog's speed"; +English[43] = "Show characters"; +English[44] = "Download course"; +English[45] = "Import course"; +English[46] = "Download data"; +English[47] = "Show numbers"; + +German[38] = "Hindernisse"; +German[39] = "Zeichen"; +German[40] = "Sparen"; +German[41] = "Zahlen"; +German[42] = "Geschwindigkeit"; +German[43] = "Zeichen anzeigen"; +German[44] = "Download course"; +German[45] = "Import course"; +German[46] = "Download data"; +German[47] = "Show numbers"; + +Hungarian[38] = "Akadályok"; +Hungarian[39] = "Karakter"; +Hungarian[40] = "Save"; +Hungarian[41] = "Számok"; +Hungarian[42] = "Sebesség"; +Hungarian[43] = "Mutasd karakter"; +Hungarian[44] = "Download course"; +Hungarian[45] = "Import course"; +Hungarian[46] = "Download data"; +Hungarian[47] = "Show numbers"; + +Norsk[38] = "Hindringer"; +Norsk[39] = "Tegn"; +Norsk[40] = "Lagre"; +Norsk[41] = "Tall"; +Norsk[42] = "Fart"; +Norsk[43] = "Show characters"; +Norsk[44] = "Download course"; +Norsk[45] = "Import course"; +Norsk[46] = "Download data"; +Norsk[47] = "Show numbers"; + +Japanese[38] = "障害物"; +Japanese[39] = "文字"; +Japanese[40] = "保存"; +Japanese[41] = "数字"; +Japanese[42] = "スピード"; +Japanese[43] = "表示文字"; +Japanese[44] = "Download course"; +Japanese[45] = "Import course"; +Japanese[46] = "Download data"; +Japanese[47] = "Show numbers"; + +Svenska[38] = "Hinder"; +Svenska[39] = "Tecken"; +Svenska[40] = "Spara"; +Svenska[41] = "Numbers"; +Svenska[42] = "Hastighet"; +Svenska[43] = "Visa tecken"; +Svenska[44] = "Download course"; +Svenska[45] = "Import course"; +Svenska[46] = "Download data"; +Svenska[47] = "Show numbers"; + +Portugues[38] = "Obstáculos"; +Portugues[39] = "Personagem"; +Portugues[40] = "Salvar"; +Portugues[41] = "Números"; +Portugues[42] = "Velocidad do cão"; +Portugues[43] = "Monstrat os personagems"; +Portugues[44] = "Download course"; +Portugues[45] = "Import course"; +Portugues[46] = "Download data"; +Portugues[47] = "Show numbers"; + +Espanol[38] = "Obstáculos"; +Espanol[39] = "Personajes"; +Espanol[40] = "Salvaguardar"; +Espanol[41] = "Números"; +Espanol[42] = "Velocidad"; +Espanol[43] = "Ver Personajes"; +Espanol[44] = "Descargar pista"; +Espanol[45] = "Importar pista"; +Espanol[46] = "Descargar datos"; +Espanol[47] = "Ver números"; + +Italiano[38] = "Ostacoli"; +Italiano[39] = "Personaggi"; +Italiano[40] = "Salva"; +Italiano[41] = "Numeri"; +Italiano[42] = "Velocità del caned"; +Italiano[43] = "Mostra caratteri"; +Italiano[44] = "Download course"; +Italiano[45] = "Import course"; +Italiano[46] = "Download data"; +Italiano[47] = "Show numbers"; + +Polski[38] = "Przeszkody"; +Polski[39] = "Figura"; +Polski[40] = "Zaoszczędzić"; +Polski[41] = "Liczba"; +Polski[42] = "Prędkość psa"; +Polski[43] = "Pokaż znaków"; +Polski[44] = "Download course"; +Polski[45] = "Import course"; +Polski[46] = "Download data"; +Polski[47] = "Show numbers"; + +Catalan[38] = "Obstacles"; +Catalan[39] = "Personatges"; +Catalan[40] = "Guardar"; +Catalan[41] = "Nombres"; +Catalan[42] = "Velocitat del gos"; +Catalan[43] = "Mostrar caràcters"; +Catalan[44] = "Descarregar pista"; +Catalan[45] = "Importar pista"; +Catalan[46] = "Download data"; +Catalan[47] = "Show numbers"; + +suomi[38] = "Esteet"; +suomi[39] = "Hahmot"; +suomi[40] = "Tallenna"; +suomi[41] = "Numbers"; +suomi[42] = "Koiran nopeus"; +suomi[43] = "Näyttämään merkkejä"; +suomi[44] = "Download course"; +suomi[45] = "Import course"; +suomi[46] = "Download data"; +suomi[47] = "Show numbers"; + +Dansk[38] = "Forhindringer"; +Dansk[39] = "Tegn"; +Dansk[40] = "Gem"; +Dansk[41] = "Numbers"; +Dansk[42] = "Hundens hastighed"; +Dansk[43] = "Vis tegn"; +Dansk[44] = "Download course"; +Dansk[45] = "Import course"; +Dansk[46] = "Download data"; +Dansk[47] = "Show numbers"; + +Russian[1] = "Параметры"; +Russian[2] = "Размеры"; +Russian[3] = "Путь собаки"; +Russian[4] = "Цвета"; +Russian[5] = "Свои цвета"; +Russian[6] = "Скачать"; +Russian[7] = "Язык"; +Russian[8] = "Длина"; +Russian[9] = "Автор"; +Russian[10] = "Прыжковые"; +Russian[11] = "Зоновые"; +Russian[12] = "Разные"; +Russian[13] = "Инструменты"; +Russian[14] = "Название : "; +Russian[15] = "Длина : "; +Russian[16] = "Ширина : "; +Russian[17] = "Размер сетки : "; +Russian[18] = "Метр"; +Russian[19] = " Показать путь "; +Russian[20] = " Задать путь "; +Russian[21] = "Цвет фона"; +Russian[22] = "Цвет 1"; +Russian[23] = "Цвет 2"; +Russian[24] = "Цвет 3"; +Russian[25] = "Создать изображение"; +Russian[26] = "Автор : "; +Russian[27] = "БЕТА ВЕРСИЯ (В разработке), рекомендуется использовать мышь"; +Russian[28] = ""; +Russian[29] = + 'Чтобы сохранить изображение, нажмите на нем правой кнопкой мыши и выберите "Сохранить изображение как".'; +Russian[30] = "images/share.png"; +Russian[31] = "Для веб"; +Russian[32] = "Для печати"; +Russian[33] = "Для высококачественной печати"; +Russian[34] = "Метр(ы)"; +Russian[35] = "Ярды"; +Russian[36] = "Футы"; +Russian[37] = "Единица измерения : "; +Russian[38] = "Препятствия"; +Russian[39] = "Участники"; +Russian[40] = "Сохранить"; +Russian[41] = "Номера"; +Russian[42] = "скорость собаки"; +Russian[43] = "Показывать участников"; +Russian[44] = "Download course"; +Russian[45] = "Import course"; +Russian[46] = "Download data"; +Russian[47] = "Show numbers"; +Russian[50] = "Логин"; +Russian[51] = "Пожалуйста выберите..."; +Russian[52] = "Новый"; +Russian[53] = "Сохранить как..."; +Russian[54] = "Сохранить"; +Russian[55] = "Название Вашей трассы"; +Russian[56] = "Ошибка входа!"; +Russian[57] = "Вы действительно хотите сбросить текущую трассу?"; +Russian[58] = "Выход"; +Russian[59] = "Ошибка при сохранении трассы!"; +Russian[60] = "Вы действительно хотите удалить препятствия?"; + +langues[0] = Francais; +langues[1] = English; +langues[2] = Portugues; +langues[3] = Espanol; +langues[4] = Italiano; +langues[5] = Polski; +langues[6] = Catalan; +langues[7] = Svenska; +langues[8] = Japanese; +langues[9] = Norsk; +langues[10] = Dansk; +langues[11] = suomi; +langues[12] = German; +langues[13] = Hungarian; +langues[14] = Russian; + +function setInfoLangue() { + masquerTout(); + document.getElementById("blocInfoLangueEn").style.display = "block"; + document.getElementById("blocInfoLangueFr").style.display = "block"; + document.getElementById("blocInfoLanguePt").style.display = "block"; + document.getElementById("blocInfoLangueEs").style.display = "block"; + document.getElementById("blocInfoLangueIt").style.display = "block"; + document.getElementById("blocInfoLanguePl").style.display = "block"; + document.getElementById("blocInfoLangueSe").style.display = "block"; + document.getElementById("blocInfoLangueJp").style.display = "block"; + document.getElementById("blocInfoLangueDe").style.display = "block"; + document.getElementById("blocInfoLangueCt").style.display = "block"; + document.getElementById("blocInfoLangueNo").style.display = "block"; + document.getElementById("blocInfoLangueDa").style.display = "block"; + document.getElementById("blocInfoLangueFi").style.display = "block"; + document.getElementById("blocInfoLangueHu").style.display = "block"; + document.getElementById("blocInfoLangueRu").style.display = "block"; + document.getElementById("barreOLangue").style.display = "block"; +} + +function masquerLangue() { + document.getElementById("blocInfoLangueEn").style.display = "none"; + document.getElementById("blocInfoLangueFr").style.display = "none"; + document.getElementById("blocInfoLanguePt").style.display = "none"; + document.getElementById("blocInfoLangueSe").style.display = "none"; + document.getElementById("blocInfoLangueEs").style.display = "none"; + document.getElementById("blocInfoLangueCt").style.display = "none"; + document.getElementById("blocInfoLangueJp").style.display = "none"; + document.getElementById("blocInfoLangueIt").style.display = "none"; + document.getElementById("blocInfoLanguePl").style.display = "none"; + document.getElementById("blocInfoLangueNo").style.display = "none"; + document.getElementById("blocInfoLangueDa").style.display = "none"; + document.getElementById("blocInfoLangueFi").style.display = "none"; + document.getElementById("blocInfoLangueDe").style.display = "none"; + document.getElementById("blocInfoLangueHu").style.display = "none"; + document.getElementById("blocInfoLangueRu").style.display = "none"; +} +function initLangue() { + var languageNav = + window.navigator.userLanguage || window.navigator.language; + if ( + languageNav.substr(0, 2) == "pt" || + languageNav.substr(0, 2) == "fr" || + languageNav.substr(0, 2) == "es" || + languageNav.substr(0, 2) == "it" || + languageNav.substr(0, 2) == "se" || + languageNav.substr(0, 2) == "jp" || + languageNav.substr(0, 2) == "no" || + languageNav.substr(0, 2) == "fi" || + languageNav.substr(0, 2) == "da" || + languageNav.substr(0, 2) == "jp" || + languageNav.substr(0, 2) == "de" || + languageNav.substr(0, 2) == "pl" || + languageNav.substr(0, 2) == "hu" || + languageNav.substr(0, 2) == "ru" + ) { + setLangue(languageNav.substr(0, 2)); + } else { + setLangue("gb"); + } +} +function setLangue(langue) { + document.getElementById("langueOptions").src = + "/static/public/tabs/flags/" + langue + ".png"; + document.getElementById("medaille").src = + "/static/public/title/flag-icons/" + langue + ".png"; + if (langue == "fr") { + idLg = 0; + } else if (langue == "gb") { + idLg = 1; + } else if (langue == "pt") { + idLg = 2; + } else if (langue == "es") { + idLg = 3; + } else if (langue == "it") { + idLg = 4; + } else if (langue == "pl") { + idLg = 5; + } else if (langue == "ct") { + idLg = 6; + } else if (langue == "se") { + idLg = 7; + } else if (langue == "jp") { + idLg = 8; + } else if (langue == "no") { + idLg = 9; + } else if (langue == "da") { + idLg = 10; + } else if (langue == "fi") { + idLg = 11; + } else if (langue == "de") { + idLg = 12; + } else if (langue == "hu") { + idLg = 13; + } else if (langue == "ru") { + idLg = 14; + } + document.getElementById("contentBlocOParam").innerHTML = langues[idLg][1]; + //document.getElementById('contentBlocODim').innerHTML=langues[idLg][2]; + document.getElementById("contentBlocOTrj").innerHTML = langues[idLg][3]; + //document.getElementById('contentBlocOColor').innerHTML=langues[idLg][4]; + document.getElementById("contentBlocOSav").innerHTML = langues[idLg][6]; + document.getElementById("contentBlocOImp").innerHTML = langues[idLg][45]; + document.getElementById("contentBlocOLangue").innerHTML = langues[idLg][7]; + //document.getElementById('blocOCouP').innerHTML=langues[idLg][5]; + //document.getElementById('txtLangue').innerHTML=langues[idLg][7]; + document.getElementById("outilsSauts").innerHTML = langues[idLg][10]; + document.getElementById("outilsZones").innerHTML = langues[idLg][11]; + document.getElementById("outilsAutres").innerHTML = langues[idLg][12]; + document.getElementById("outilsOutils").innerHTML = langues[idLg][13]; + document.getElementById("txtTitre").innerHTML = langues[idLg][14]; + document.getElementById("txtLongueur").innerHTML = langues[idLg][15]; + document.getElementById("txtLargeur").innerHTML = langues[idLg][16]; + document.getElementById("txtEchelle").innerHTML = langues[idLg][17]; + //document.getElementById('txtMetre').innerHTML=langues[idLg][18]; + document.getElementById("txtTraj").innerHTML = langues[idLg][19]; + document.getElementById("txtTraj-2").innerHTML = langues[idLg][19]; + document.getElementById("txtManualTraj").innerHTML = langues[idLg][20]; + //document.getElementById('txtCouleurF').innerHTML=langues[idLg][21]; + //document.getElementById('txtCouleur1').innerHTML=langues[idLg][22]; + //document.getElementById('txtCouleur2').innerHTML=langues[idLg][23]; + //document.getElementById('txtCouleur3').innerHTML=langues[idLg][24]; + document.getElementById("generateImg").innerHTML = langues[idLg][25]; + document.getElementById("exportData").innerHTML = langues[idLg][46]; + document.getElementById("txtAuteur").innerHTML = langues[idLg][26]; + document.getElementById("txtMessage").innerHTML = langues[idLg][27]; + document.getElementById("txtMessageObst").innerHTML = langues[idLg][28]; + document.getElementById("txtInfoDl").innerHTML = langues[idLg][29]; + //document.getElementById('shareIcon').src=langues[idLg][30]; + document.getElementById("btnGenererWeb").value = langues[idLg][31]; + document.getElementById("btnGenererImpr").value = langues[idLg][32]; + document.getElementById("btnGenererHQ").value = langues[idLg][33]; + document.getElementById("btnGenererData").value = langues[idLg][44]; + document.getElementById("txtMetre").innerHTML = langues[idLg][34]; + document.getElementById("txtYard").innerHTML = langues[idLg][35]; + document.getElementById("txtPied").innerHTML = langues[idLg][36]; + document.getElementById("txtUnite").innerHTML = langues[idLg][37]; + document.getElementById("txtDistance").innerHTML = langues[idLg][8]; + + document.getElementById("contentBlocOObst").innerHTML = langues[idLg][38]; + document.getElementById("contentBlocOCon").innerHTML = langues[idLg][39]; + document.getElementById("outilsSauvegarde").innerHTML = langues[idLg][40]; + document.getElementById("outilsNumero").innerHTML = langues[idLg][41]; + document.getElementById("txtNumero").innerHTML = langues[idLg][47]; + document.getElementById("txtNumero-2").innerHTML = langues[idLg][47]; + + document.getElementById("txtVitesseTraj").innerHTML = langues[idLg][42]; + document.getElementById("txtShowDrive").innerHTML = langues[idLg][43]; + document.getElementById("txtShowDrive-2").innerHTML = langues[idLg][43]; + document.getElementById("outilsConducteur").innerHTML = langues[idLg][39]; + + document.getElementById("outilsLangue").innerHTML = langues[idLg][7]; + document.getElementById("outilsCouleurs").innerHTML = langues[idLg][4]; + document.getElementById("outilsCouleurs-bg").innerHTML = langues[idLg][4]; + document.getElementById("outilsCouleurs-bg-2").innerHTML = langues[idLg][4]; + + document.getElementById("outilsOutilsNum").innerHTML = langues[idLg][13]; + document.getElementById("outilsOutils2").innerHTML = langues[idLg][13]; + document.getElementById("outilsParam").innerHTML = langues[idLg][1]; + document.getElementById("outilsDimension").innerHTML = langues[idLg][2]; + document.getElementById("outilsTraj").innerHTML = langues[idLg][3]; +} diff --git a/static/ui/app/src/over-obstacle.js b/static/ui/app/src/over-obstacle.js new file mode 100644 index 0000000..96baf4d --- /dev/null +++ b/static/ui/app/src/over-obstacle.js @@ -0,0 +1,320 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////PASSAGE AU DESSUS DES OBSTACLES//////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/* +retourne la marge de tolérence pour la séléction d'un objet +*/ +function setMargeSelect() { + if (isTactil) { + DIAM_ROND_SELECTION = 14; + DIAM_ROND_SELECTION_TUNNEL = 6; + DIAM_ROND_SELECTION_TUNNEL_MOVE = DIAM_ROND_SELECTION_TUNNEL + 15; + RECT_MARGE_SELECTION = 25; + ROTATE_MARGE_SELECTION = 25; + LARGEUR_NUMERO_SELECT = LARGEUR_NUMERO + RECT_MARGE_SELECTION; + HAUTEUR_NUMERO_SELECT = HAUTEUR_NUMERO + RECT_MARGE_SELECTION; + } else { + DIAM_ROND_SELECTION = 7; + DIAM_ROND_SELECTION_TUNNEL = 3; + DIAM_ROND_SELECTION_TUNNEL_MOVE = DIAM_ROND_SELECTION_TUNNEL + 10; + RECT_MARGE_SELECTION = 15; + ROTATE_MARGE_SELECTION = 0; + LARGEUR_NUMERO_SELECT = LARGEUR_NUMERO; + HAUTEUR_NUMERO_SELECT = HAUTEUR_NUMERO; + } +} + +function overObstacle(posX, posY) { + var x; + var y; + var xlarg; + var ylarg; + var angle; + var xRotateGauche; + var xRotateDroit; + var yRotateGauche; + var yRotateDroit; + for (var i = 0; i < id; i++) { + x = getCanvasX(i); + y = getCanvasY(i); + xlarg = getXCliquable(i) + RECT_MARGE_SELECTION; + ylarg = getYCliquable(i) + RECT_MARGE_SELECTION; + angle = getAngle(i); + if ( + checkPointInRect( + x + xlarg / 2, + y + ylarg / 2 - RECT_MARGE_SELECTION / 2, + xlarg, + ylarg, + angle, + posX, + posY + ) + ) { + overObject = i; + decalX = posX - x; + decalY = posY - y; + if (!suppression) { + document.body.style.cursor = "move"; + } + } + } +} +function overTunnel(posX, posY) { + moveTunnelComplet = -1; + for (var j = 0; j < idTunnel; j++) { + //Déplacement d'un point du tunnel + for (var art = 0; art < nbArticulationTunnel; art++) { + if ( + posX > tbTunnels[j][art * 2 + 1] - DIAM_ROND_SELECTION_TUNNEL && + posX < tbTunnels[j][art * 2 + 1] + DIAM_ROND_SELECTION_TUNNEL && + posY > tbTunnels[j][art * 2 + 2] - DIAM_ROND_SELECTION_TUNNEL && + posY < tbTunnels[j][art * 2 + 2] + DIAM_ROND_SELECTION_TUNNEL + ) { + decalX = posX - tbTunnels[j][art * 2 + 1]; + decalY = posY - tbTunnels[j][art * 2 + 2]; + overTunnelId = j; + overPointTunnel = art; + if (!suppression) { + document.body.style.cursor = "pointer"; + } + } + } + // déplacement du tunnel complet + if (overPointTunnel == -1) { + for (var art = 0; art < nbArticulationTunnel; art++) { + if ( + posX > + tbTunnels[j][art * 2 + 1] - + DIAM_ROND_SELECTION_TUNNEL_MOVE && + posX < + tbTunnels[j][art * 2 + 1] + + DIAM_ROND_SELECTION_TUNNEL_MOVE && + posY > + tbTunnels[j][art * 2 + 2] - + DIAM_ROND_SELECTION_TUNNEL_MOVE && + posY < + tbTunnels[j][art * 2 + 2] + + DIAM_ROND_SELECTION_TUNNEL_MOVE + ) { + decalX = posX - tbTunnels[j][1]; + decalY = posY - tbTunnels[j][2]; + overTunnelComplet = j; + if (!suppression) { + document.body.style.cursor = "move"; + } + } + } + } + } +} +// permet de définir quel objet est sous la souris +function overRotate(posX, posY) { + var x; + var y; + var xlarg; + var ylarg; + var angle; + var xRotateGauche; + var xRotateDroit; + var yRotateGauche; + var yRotateDroit; + rotate = false; + for (var i = 0; i < id; i++) { + x = getCanvasX(i); + y = getCanvasY(i); + xlarg = getXCliquable(i); + ylarg = getYCliquable(i); + angle = getAngle(i); + + // bouton des cotés pour rotation + + xRotateGauche = + (Math.round(Math.cos(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2) + + x + + xlarg / 2; + yRotateGauche = + (Math.round(Math.sin(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2) + + y + + ylarg / 2; + if ( + posX > xRotateGauche - DIAM_ROND_SELECTION && + posX < xRotateGauche + DIAM_ROND_SELECTION && + posY > yRotateGauche - DIAM_ROND_SELECTION && + posY < yRotateGauche + DIAM_ROND_SELECTION + ) { + //selObst=i; + overObject = i; + decalX = posX - x; + decalY = posY - y; + rotate = true; + rotateCote = "gauche"; + } + xRotateDroit = + x + + xlarg / 2 - + (Math.round(Math.cos(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2); + yRotateDroit = + y + + ylarg / 2 - + (Math.round(Math.sin(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2); + if ( + posX > xRotateDroit - DIAM_ROND_SELECTION && + posX < xRotateDroit + DIAM_ROND_SELECTION && + posY > yRotateDroit - DIAM_ROND_SELECTION && + posY < yRotateDroit + DIAM_ROND_SELECTION + ) { + //selObst=i; + overObject = i; + decalX = posX - x; + decalY = posY - y; + rotate = true; + rotateCote = "droit"; + } + + if (rotate) { + if (!suppression) { + document.body.style.cursor = "pointer"; + } + } + } +} +function checkPointInRect( + rectCentreX, + rectCentreY, + rectWidth, + rectHeight, + rot, + px, + py +) { + // rotation in radians, because flash likes to be a pain and use them instead. + var rotRad = (Math.PI * rot) / 180; + var dx = px - rectCentreX; + var dy = py - rectCentreY; + // distance between point and centre of rectangle. + var h1 = Math.sqrt(dx * dx + dy * dy); + var currA = Math.atan2(dy, dx); + // angle of point rotated by the rectangle amount around the centre of rectangle. + var newA = currA - rotRad; + // x2 and y2 are the new positions of the point when rotated to offset the rectangles orientation. + var x2 = Math.cos(newA) * h1; + var y2 = Math.sin(newA) * h1; + // the above points are relative to the centre of the rectangle, so the check is simple. + + if ( + x2 > -0.5 * rectWidth && + x2 < 0.5 * rectWidth && + y2 > -0.5 * rectHeight && + y2 < 0.5 * rectHeight + ) { + return true; + } + + return false; +} + +function overNumero(x, y) { + overNumeroId = -1; + for (var i = 1; i < nextNumber; i++) { + if ( + checkPointInRect( + listeNumero[i][1] + 7 - LARGEUR_NUMERO / 2, + listeNumero[i][2] + 6 - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO_SELECT, + HAUTEUR_NUMERO_SELECT, + 0, + x, + y + ) + ) { + overNumeroId = i; + if (!suppression) { + document.body.style.cursor = "move"; + } + decalX = x - listeNumero[i][1]; + decalY = y - listeNumero[i][2]; + } + } +} +function overNumero2(x, y) { + overNumeroId2 = -1; + for (var i = 1; i < nextNumber2; i++) { + if ( + checkPointInRect( + listeNumero2[i][1] + 7 - LARGEUR_NUMERO / 2, + listeNumero2[i][2] + 6 - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO_SELECT, + HAUTEUR_NUMERO_SELECT, + 0, + x, + y + ) + ) { + overNumeroId2 = i; + if (!suppression) { + document.body.style.cursor = "move"; + } + decalX = x - listeNumero2[i][1]; + decalY = y - listeNumero2[i][2]; + } + } +} +function overNumero3(x, y) { + overNumeroId3 = -1; + for (var i = 1; i < nextNumber3; i++) { + if ( + checkPointInRect( + listeNumero3[i][1] + 7 - LARGEUR_NUMERO / 2, + listeNumero3[i][2] + 6 - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO_SELECT, + HAUTEUR_NUMERO_SELECT, + 0, + x, + y + ) + ) { + overNumeroId3 = i; + if (!suppression) { + document.body.style.cursor = "move"; + } + decalX = x - listeNumero3[i][1]; + decalY = y - listeNumero3[i][2]; + } + } +} +function overModifTraj(x, y) { + for (var i = 1; i < nextNumber; i++) { + var xDep = ordreObst[i][3]; + var yDep = ordreObst[i][4]; + var xArr = ordreObst[i][5]; + var yArr = ordreObst[i][6]; + if (checkPointInRect(xDep, yDep, 8, 8, 0, x, y)) { + if (!suppression) { + document.body.style.cursor = "pointer"; + overModifTrajId = i; + overModifTrajDepArr = "dep"; + decalX = x - xDep; + decalY = y - yDep; + } + } + if (checkPointInRect(xArr, yArr, 8, 8, 0, x, y)) { + if (!suppression) { + document.body.style.cursor = "pointer"; + overModifTrajId = i; + overModifTrajDepArr = "arr"; + decalX = x - xArr; + decalY = y - yArr; + } + } + } +} diff --git a/static/ui/app/src/over-obstacle.js.bak b/static/ui/app/src/over-obstacle.js.bak new file mode 100644 index 0000000..8880891 --- /dev/null +++ b/static/ui/app/src/over-obstacle.js.bak @@ -0,0 +1,320 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////PASSAGE AU DESSUS DES OBSTACLES//////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/* +retourne la marge de tol�rence pour la s�l�ction d'un objet +*/ +function setMargeSelect() { + if (isTactil) { + DIAM_ROND_SELECTION = 14; + DIAM_ROND_SELECTION_TUNNEL = 6; + DIAM_ROND_SELECTION_TUNNEL_MOVE = DIAM_ROND_SELECTION_TUNNEL + 15; + RECT_MARGE_SELECTION = 25; + ROTATE_MARGE_SELECTION = 25; + LARGEUR_NUMERO_SELECT = LARGEUR_NUMERO + RECT_MARGE_SELECTION; + HAUTEUR_NUMERO_SELECT = HAUTEUR_NUMERO + RECT_MARGE_SELECTION; + } else { + DIAM_ROND_SELECTION = 7; + DIAM_ROND_SELECTION_TUNNEL = 3; + DIAM_ROND_SELECTION_TUNNEL_MOVE = DIAM_ROND_SELECTION_TUNNEL + 10; + RECT_MARGE_SELECTION = 15; + ROTATE_MARGE_SELECTION = 0; + LARGEUR_NUMERO_SELECT = LARGEUR_NUMERO; + HAUTEUR_NUMERO_SELECT = HAUTEUR_NUMERO; + } +} + +function overObstacle(posX, posY) { + var x; + var y; + var xlarg; + var ylarg; + var angle; + var xRotateGauche; + var xRotateDroit; + var yRotateGauche; + var yRotateDroit; + for (var i = 0; i < id; i++) { + x = getCanvasX(i); + y = getCanvasY(i); + xlarg = getXCliquable(i) + RECT_MARGE_SELECTION; + ylarg = getYCliquable(i) + RECT_MARGE_SELECTION; + angle = getAngle(i); + if ( + checkPointInRect( + x + xlarg / 2, + y + ylarg / 2 - RECT_MARGE_SELECTION / 2, + xlarg, + ylarg, + angle, + posX, + posY + ) + ) { + overObject = i; + decalX = posX - x; + decalY = posY - y; + if (!suppression) { + document.body.style.cursor = "move"; + } + } + } +} +function overTunnel(posX, posY) { + moveTunnelComplet = -1; + for (var j = 0; j < idTunnel; j++) { + //D�placement d'un point du tunnel + for (var art = 0; art < nbArticulationTunnel; art++) { + if ( + posX > tbTunnels[j][art * 2 + 1] - DIAM_ROND_SELECTION_TUNNEL && + posX < tbTunnels[j][art * 2 + 1] + DIAM_ROND_SELECTION_TUNNEL && + posY > tbTunnels[j][art * 2 + 2] - DIAM_ROND_SELECTION_TUNNEL && + posY < tbTunnels[j][art * 2 + 2] + DIAM_ROND_SELECTION_TUNNEL + ) { + decalX = posX - tbTunnels[j][art * 2 + 1]; + decalY = posY - tbTunnels[j][art * 2 + 2]; + overTunnelId = j; + overPointTunnel = art; + if (!suppression) { + document.body.style.cursor = "pointer"; + } + } + } + // d�placement du tunnel complet + if (overPointTunnel == -1) { + for (var art = 0; art < nbArticulationTunnel; art++) { + if ( + posX > + tbTunnels[j][art * 2 + 1] - + DIAM_ROND_SELECTION_TUNNEL_MOVE && + posX < + tbTunnels[j][art * 2 + 1] + + DIAM_ROND_SELECTION_TUNNEL_MOVE && + posY > + tbTunnels[j][art * 2 + 2] - + DIAM_ROND_SELECTION_TUNNEL_MOVE && + posY < + tbTunnels[j][art * 2 + 2] + + DIAM_ROND_SELECTION_TUNNEL_MOVE + ) { + decalX = posX - tbTunnels[j][1]; + decalY = posY - tbTunnels[j][2]; + overTunnelComplet = j; + if (!suppression) { + document.body.style.cursor = "move"; + } + } + } + } + } +} +// permet de d�finir quel objet est sous la souris +function overRotate(posX, posY) { + var x; + var y; + var xlarg; + var ylarg; + var angle; + var xRotateGauche; + var xRotateDroit; + var yRotateGauche; + var yRotateDroit; + rotate = false; + for (var i = 0; i < id; i++) { + x = getCanvasX(i); + y = getCanvasY(i); + xlarg = getXCliquable(i); + ylarg = getYCliquable(i); + angle = getAngle(i); + + // bouton des cot�s pour rotation + + xRotateGauche = + (Math.round(Math.cos(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2) + + x + + xlarg / 2; + yRotateGauche = + (Math.round(Math.sin(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2) + + y + + ylarg / 2; + if ( + posX > xRotateGauche - DIAM_ROND_SELECTION && + posX < xRotateGauche + DIAM_ROND_SELECTION && + posY > yRotateGauche - DIAM_ROND_SELECTION && + posY < yRotateGauche + DIAM_ROND_SELECTION + ) { + //selObst=i; + overObject = i; + decalX = posX - x; + decalY = posY - y; + rotate = true; + rotateCote = "gauche"; + } + xRotateDroit = + x + + xlarg / 2 - + (Math.round(Math.cos(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2); + yRotateDroit = + y + + ylarg / 2 - + (Math.round(Math.sin(toDegrees(angle)) * 100) / 100) * + ((xlarg + ROTATE_MARGE_SELECTION) / 2); + if ( + posX > xRotateDroit - DIAM_ROND_SELECTION && + posX < xRotateDroit + DIAM_ROND_SELECTION && + posY > yRotateDroit - DIAM_ROND_SELECTION && + posY < yRotateDroit + DIAM_ROND_SELECTION + ) { + //selObst=i; + overObject = i; + decalX = posX - x; + decalY = posY - y; + rotate = true; + rotateCote = "droit"; + } + + if (rotate) { + if (!suppression) { + document.body.style.cursor = "pointer"; + } + } + } +} +function checkPointInRect( + rectCentreX, + rectCentreY, + rectWidth, + rectHeight, + rot, + px, + py +) { + // rotation in radians, because flash likes to be a pain and use them instead. + var rotRad = (Math.PI * rot) / 180; + var dx = px - rectCentreX; + var dy = py - rectCentreY; + // distance between point and centre of rectangle. + var h1 = Math.sqrt(dx * dx + dy * dy); + var currA = Math.atan2(dy, dx); + // angle of point rotated by the rectangle amount around the centre of rectangle. + var newA = currA - rotRad; + // x2 and y2 are the new positions of the point when rotated to offset the rectangles orientation. + var x2 = Math.cos(newA) * h1; + var y2 = Math.sin(newA) * h1; + // the above points are relative to the centre of the rectangle, so the check is simple. + + if ( + x2 > -0.5 * rectWidth && + x2 < 0.5 * rectWidth && + y2 > -0.5 * rectHeight && + y2 < 0.5 * rectHeight + ) { + return true; + } + + return false; +} + +function overNumero(x, y) { + overNumeroId = -1; + for (var i = 1; i < nextNumber; i++) { + if ( + checkPointInRect( + listeNumero[i][1] + 7 - LARGEUR_NUMERO / 2, + listeNumero[i][2] + 6 - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO_SELECT, + HAUTEUR_NUMERO_SELECT, + 0, + x, + y + ) + ) { + overNumeroId = i; + if (!suppression) { + document.body.style.cursor = "move"; + } + decalX = x - listeNumero[i][1]; + decalY = y - listeNumero[i][2]; + } + } +} +function overNumero2(x, y) { + overNumeroId2 = -1; + for (var i = 1; i < nextNumber2; i++) { + if ( + checkPointInRect( + listeNumero2[i][1] + 7 - LARGEUR_NUMERO / 2, + listeNumero2[i][2] + 6 - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO_SELECT, + HAUTEUR_NUMERO_SELECT, + 0, + x, + y + ) + ) { + overNumeroId2 = i; + if (!suppression) { + document.body.style.cursor = "move"; + } + decalX = x - listeNumero2[i][1]; + decalY = y - listeNumero2[i][2]; + } + } +} +function overNumero3(x, y) { + overNumeroId3 = -1; + for (var i = 1; i < nextNumber3; i++) { + if ( + checkPointInRect( + listeNumero3[i][1] + 7 - LARGEUR_NUMERO / 2, + listeNumero3[i][2] + 6 - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO_SELECT, + HAUTEUR_NUMERO_SELECT, + 0, + x, + y + ) + ) { + overNumeroId3 = i; + if (!suppression) { + document.body.style.cursor = "move"; + } + decalX = x - listeNumero3[i][1]; + decalY = y - listeNumero3[i][2]; + } + } +} +function overModifTraj(x, y) { + for (var i = 1; i < nextNumber; i++) { + var xDep = ordreObst[i][3]; + var yDep = ordreObst[i][4]; + var xArr = ordreObst[i][5]; + var yArr = ordreObst[i][6]; + if (checkPointInRect(xDep, yDep, 8, 8, 0, x, y)) { + if (!suppression) { + document.body.style.cursor = "pointer"; + overModifTrajId = i; + overModifTrajDepArr = "dep"; + decalX = x - xDep; + decalY = y - yDep; + } + } + if (checkPointInRect(xArr, yArr, 8, 8, 0, x, y)) { + if (!suppression) { + document.body.style.cursor = "pointer"; + overModifTrajId = i; + overModifTrajDepArr = "arr"; + decalX = x - xArr; + decalY = y - yArr; + } + } + } +} diff --git a/static/ui/app/src/trajectories.js b/static/ui/app/src/trajectories.js new file mode 100644 index 0000000..d8a72ef --- /dev/null +++ b/static/ui/app/src/trajectories.js @@ -0,0 +1,576 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////CALCUL DES TRAJECTOIRES/////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function longueurTunnel(idTunnel) { + var longueurTunnel = 0; + for (var art = 0; art < nbArticulationTunnel - 1; art++) { + var x = art * 2 + 1; + var y = art * 2 + 2; + var x2 = art * 2 + 3; + var y2 = art * 2 + 4; + dist = Math.sqrt( + Math.pow(tbTunnels[idTunnel][x] - tbTunnels[idTunnel][x2], 2) + + Math.pow(tbTunnels[idTunnel][y] - tbTunnels[idTunnel][y2], 2) + ); + longueurTunnel = longueurTunnel + dist; + } + return longueurTunnel; +} +function genererTrajectoires() { + vitesseTraj = 0; + var angleModSui = 0; + var angleMod = 0; + + if (!trajectoire) { + return; + } + longueurTotal = 0; + + context.lineWidth = 1; + var distObstTrajectoireSui = 50; + var distObstTrajectoire = 50; + for (var j = 1; j < nextNumber - 1; j++) { + var i = ordreObst[j][0]; + var iSui = ordreObst[j + 1][0]; //TODO BUG, valeur de la propriété 0 non déf + var sens = ordreObst[j][2]; + var sensSui = ordreObst[j + 1][2]; + if (sens == 0) { + var angleMod = ordreObst[j][7]; + var distMod = ordreObst[j][8]; + } else { + var angleMod = ordreObst[j][9]; + var distMod = ordreObst[j][10]; + } + if (sensSui == 0) { + var angleModSui = ordreObst[j + 1][9]; + var distModSui = ordreObst[j + 1][10]; + } else { + var angleModSui = ordreObst[j + 1][7]; + var distModSui = ordreObst[j + 1][8]; + } + + if (ordreObst[j][1] == "tunnel") { + if (sens == 0) { + var x = tbTunnels[i][1]; + var y = tbTunnels[i][2]; + var x2 = tbTunnels[i][3]; // pour le premier angle + var y2 = tbTunnels[i][4]; // pour le premier angle + var distX = x - x2; + var distY = y - y2; + var angle = -90; + var modifAngleArr = + (Math.atan2(distY, distX) / Math.PI) * 180 - 90; + } else { + var x = tbTunnels[i][(nbArticulationTunnel - 2) * 2 + 1]; + var y = tbTunnels[i][(nbArticulationTunnel - 2) * 2 + 2]; + var x2 = tbTunnels[i][(nbArticulationTunnel - 2) * 2 + 3]; // pour le premier angle + var y2 = tbTunnels[i][(nbArticulationTunnel - 2) * 2 + 4]; // pour le premier angle + var distX = x2 - x; + var distY = y2 - y; + x = x2; + y = y2; + var angle = 0; + var modifAngleArr = (Math.atan2(distY, distX) / Math.PI) * 180; + } + var largX = 0; + var hauty = 0; + var type = "tunnel"; + var modifXDep = 0; + var modifYDep = 0; + var modifXArr = 0; + var modifYArr = 0; + + //calcul de l'angle de la table + var longTraj = 0; + + if (i == 0) { + longueurTotal = longueurTotal + longueurTunnel(i) * pixel; + } + distObstTrajectoire = distMod; // distance de la trajectoire + } else { + distObstTrajectoire = distMod; // distance de la trajectoire + var x = getCanvasX(i); + var y = getCanvasY(i); + var largX = getXCliquable(i); + var hauty = getYCliquable(i); + var type = getType(i); + + // conversion en fonction du sens de départ + if (sens == 1) { + var modifXDep = getModXTrajSortie(i); + var modifYDep = getModYTrajSortie(i); + var modifAngleArr = angleMod; + var longTraj = getDistTrajCentre(i); + var angle = -180 - getAngle(i); + } else { + var modifXDep = getModXTrajEntree(i); + var modifYDep = getModYTrajEntree(i); + var modifAngleArr = angleMod; + var longTraj = getDistTrajCentre(i); + var angle = -getAngle(i); + } + } + if (ordreObst[j + 1][1] == "tunnel") { + if (sensSui == 1) { + var xSui = tbTunnels[iSui][1]; + var ySui = tbTunnels[iSui][2]; + var xSui2 = tbTunnels[iSui][3]; // pour le premier angle + var ySui2 = tbTunnels[iSui][4]; // pour le premier angle + var distX = xSui - xSui2; + var distY = ySui - ySui2; + var angleSui = -90; + var modifAngleArrSui = + (Math.atan2(distY, distX) / Math.PI) * 180 - 90; + } else { + var xSui = tbTunnels[iSui][(nbArticulationTunnel - 2) * 2 + 1]; + var ySui = tbTunnels[iSui][(nbArticulationTunnel - 2) * 2 + 2]; + var xSui2 = tbTunnels[iSui][(nbArticulationTunnel - 2) * 2 + 3]; // pour le premier angle + var ySui2 = tbTunnels[iSui][(nbArticulationTunnel - 2) * 2 + 4]; // pour le premier angle + var distX = xSui2 - xSui; + var distY = ySui2 - ySui; + xSui = xSui2; + ySui = ySui2; + var angleSui = 180; + var modifAngleArrSui = + (Math.atan2(distY, distX) / Math.PI) * 180; + } + /* + var xSui=tbTunnels[iSui][(nbArticulationTunnel-1)*2+1]; + var ySui=tbTunnels[iSui][(nbArticulationTunnel-1)*2+2]; + var xSui2=tbTunnels[iSui][(nbArticulationTunnel-2)*2+1]; + var ySui2=tbTunnels[iSui][(nbArticulationTunnel-2)*2+2];*/ + var largXSui = 0; + var largYSui = 0; + //var angleSui=90; + var typeSui = "tunnel"; + var modifXDepSui = 0; + var modifYDepSui = 0; + var modifXArrSui = 0; + var modifYArrSui = 0; + + //var modifAngleArrSui=0; + var longTrajSui = 0; + longueurTotal = longueurTotal + longueurTunnel(iSui) * pixel; + distObstTrajectoireSui = distModSui; // distance de la trajectoire + } else { + distObstTrajectoireSui = distModSui; // distance de la trajectoire + + var xSui = getCanvasX(iSui); + var ySui = getCanvasY(iSui); + var largXSui = getXCliquable(iSui); + var largYSui = getYCliquable(iSui); + var typeSui = getType(iSui); + + if (sensSui == 1) { + var modifXArrSui = getModXTrajSortie(iSui); + var modifYArrSui = getModYTrajSortie(iSui); + var modifAngleArrSui = angleModSui; + var longTrajSui = getDistTrajCentre(iSui); + var angleSui = -180 + getAngle(iSui); + } else { + var modifXArrSui = getModXTrajEntree(iSui); + var modifYArrSui = getModYTrajEntree(iSui); + var modifAngleArrSui = angleModSui; + var longTrajSui = getDistTrajCentre(iSui); + var angleSui = getAngle(iSui); + } + } + + if (j == 0) { + longueurTotal = longueurTotal + longTraj * pixel; + } + longueurTotal = longueurTotal + longTrajSui * pixel; + + angle = -angle + modifAngleArr; + angleSui = angleSui + modifAngleArrSui; + + var departX = + x + + modifXDep / 2 + + (Math.cos((angle / 180) * Math.PI) * longTraj) / 2; + var departY = + y + + modifYDep / 2 + + (Math.sin((angle / 180) * Math.PI) * longTraj) / 2; + var interDepX = + x + + modifXDep / 2 + + Math.cos((angle / 180) * Math.PI) * + (longTraj / 2 + distObstTrajectoire); + var interDepY = + y + + modifYDep / 2 + + Math.sin((angle / 180) * Math.PI) * + (longTraj / 2 + distObstTrajectoire); + + if (typeSui == "table") { + //calcul de l'angle de la table + var distX = xSui + largXSui / 2 - interDepX; + var distY = interDepY - ySui + largYSui / 2; + var angleSui = (Math.atan2(distY, distX) / Math.PI) * -180; + } + + //var arriveX = xSui+modifXArrSui/2+Math.cos(angleSui/180*Math.PI)*(-longTrajSui/2); + //var arriveY= ySui+modifYArrSui/2+Math.sin(angleSui/180*Math.PI)*(-longTrajSui/2); + + var arriveX = + xSui + + modifXArrSui / 2 + + Math.cos((angleSui / 180) * Math.PI) * (-longTrajSui / 2); + var arriveY = + ySui + + modifYArrSui / 2 + + Math.sin((angleSui / 180) * Math.PI) * (-longTrajSui / 2); + + var interArrX = + xSui + + modifXArrSui / 2 + + Math.cos((angleSui / 180) * Math.PI) * + (-longTrajSui / 2 - distObstTrajectoireSui); + var interArrY = + ySui + + modifYArrSui / 2 + + Math.sin((angleSui / 180) * Math.PI) * + (-longTrajSui / 2 - distObstTrajectoireSui); + if (type == "table") { + //calcul de l'angle de la table + var distX = interArrX - x - largX / 2; + var distY = interArrY - y - hauty / 2; + + var angle = (Math.atan2(distY, distX) / Math.PI) * +180; + departX = + x + + modifXDep / 2 + + (Math.cos((angle / 180) * Math.PI) * longTraj) / 2; + departY = + y + + modifYDep / 2 + + (Math.sin((angle / 180) * Math.PI) * longTraj) / 2; + interDepX = + x + + modifXDep / 2 + + Math.cos((angle / 180) * Math.PI) * + (longTraj / 2 + distObstTrajectoire); + interDepY = + y + + modifYDep / 2 + + Math.sin((angle / 180) * Math.PI) * + (longTraj / 2 + distObstTrajectoire); + } + var xText = Math.round((interDepX + interArrX) / 2); + var yText = Math.round((interArrY + interDepY) / 2); + + /////////////////////////// modification des trajectoires /////////////////////// + if (document.getElementById("ModifierTrajectoires").checked) { + if (modifTrajId == j && modifTrajDepArr == "dep") { + interDepY = canvas_y - decalY; + interDepX = canvas_x - decalX; + var xModif = departX - interDepX; + var yModif = departY - interDepY; + var modifAngle = (Math.atan2(yModif, xModif) / Math.PI) * 180; + var modifDist = Math.sqrt( + Math.pow(xModif, 2) + Math.pow(yModif, 2) + ); + + if ( + type == "haie" || + type == "oxer" || + type == "mur" || + type == "longueur" + ) { + var angleOrigine = getAngle(i); + var angleTrajReel = modifAngle; + var angleTrajRelatif; + + if (angleOrigine >= 0 && angleTrajReel >= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } else if (angleOrigine >= 0 && angleTrajReel <= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } else if (angleOrigine <= 0 && angleTrajReel <= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } else if (angleOrigine <= 0 && angleTrajReel >= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } + + var oldAngleMod = angleMod; + if (sens == 1) { + if (angleMod > 0) { + angleMod = angleTrajRelatif - 360; + } else { + angleMod = angleTrajRelatif + 360; + } + } else { + if (angleMod > 0) { + angleMod = angleTrajRelatif - 180; + } else { + angleMod = angleTrajRelatif + 180; + } + } + } + + distMod = modifDist; + } else if (modifTrajId == j + 1 && modifTrajDepArr == "arr") { + interArrY = canvas_y - decalY; + interArrX = canvas_x - decalX; + var xModif = arriveX - interArrX; + var yModif = arriveY - interArrY; + var modifAngle = (Math.atan2(yModif, xModif) / Math.PI) * 180; + var modifDist = Math.sqrt( + Math.pow(xModif, 2) + Math.pow(yModif, 2) + ); + + if ( + typeSui == "haie" || + typeSui == "oxer" || + typeSui == "mur" || + typeSui == "longueur" + ) { + var angleOrigine = getAngle(iSui); + var angleTrajReel = modifAngle; + var angleTrajRelatif; + + if (angleOrigine >= 0 && angleTrajReel >= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } else if (angleOrigine >= 0 && angleTrajReel <= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } else if (angleOrigine <= 0 && angleTrajReel <= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } else if (angleOrigine <= 0 && angleTrajReel >= 0) { + angleTrajRelatif = angleTrajReel - angleOrigine; + } + + angleModSui = angleTrajRelatif; + + if (sensSui == 1) { + if (angleModSui > 0) { + angleModSui = angleTrajRelatif - 180; + } else { + angleModSui = angleTrajRelatif + 180; + } + } + } + distModSui = modifDist; + } + } + + var longueurBez = bezierSize( + departX, + departY, + interDepX, + interDepY, + interArrX, + interArrY, + arriveX, + arriveY + ); + + longueurMetre = longueurBez * pixel; + longueurTotal = longueurTotal + longueurMetre; + + context.strokeStyle = COLOR_TRACE_OK; + + //ralentissement de la vitesse en fonction de l'obstacle : + + if (type == "haie") { + vitesseTraj = vitesseTraj * 0.75; + } else if (type == "oxer") { + vitesseTraj = vitesseTraj * 0.65; + } else if (type == "mur") { + vitesseTraj = vitesseTraj * 0.7; + } else if (type == "pneu") { + vitesseTraj = vitesseTraj * 0.7; + } else if (type == "table") { + vitesseTraj = 0; + } else if (type == "balancoire") { + vitesseTraj = vitesseTraj * 0.2; + } else if (type == "chaussette") { + vitesseTraj = vitesseTraj * 0.5; + } else if (type == "slalom") { + vitesseTraj = vitMax * 0.3; + } else if (type == "slalom6") { + vitesseTraj = vitMax * 0.3; + } else if (type == "passerelle") { + //running + if (document.getElementById("2on2off").checked) { + vitesseTraj = vitMax * 0.2; + } else { + vitesseTraj = vitMax * 0.9; + } + } else if (type == "palissade") { + if (document.getElementById("2on2off").checked) { + vitesseTraj = vitMax * 0.2; + } else { + vitesseTraj = vitMax * 0.7; + } + } else if (type == "longueur") { + vitesseTraj = vitesseTraj * 0.9; + } else if (type == "tunnel") { + vitesseTraj = vitesseTraj * 0.9; + } + + customBezier( + departX, + departY, + interDepX, + interDepY, + interArrX, + interArrY, + arriveX, + arriveY + ); + + // FLECHE + context.save(); + context.translate(arriveX, arriveY); //translate to center of shape + context.rotate((Math.PI / 180) * angleSui); //rotate 25 degrees + context.translate(-arriveX, -arriveY); //translate center back to 0,0 + + context.beginPath(); + context.moveTo(arriveX - 5, arriveY + 4); + context.lineTo(arriveX, arriveY); + context.lineTo(arriveX - 5, arriveY - 4); + context.closePath(); + context.fillStyle = COLOR_TRACE_OK; //blanc + context.stroke(); + context.fill(); + + context.restore(); + ////////// + context.fillStyle = COLOR_TERRAIN; + context.fillStyle = COLOR_TEXT_UNDER; + context.fillRect(xText - 15, yText - 8, 25, 12); + context.fillStyle = COLOR_TEXT; + context.fillText( + Math.round(longueurMetre * unite, 3) / 100, + xText - 14, + yText + ); + //TPS = Math.round(longueurTotal)/100/document.getElementById('vitesseEvo').value + + // modification des trajectoires + if (document.getElementById("ModifierTrajectoires").checked) { + ordreObst[j][3] = interDepX; + ordreObst[j][4] = interDepY; + ordreObst[j + 1][5] = interArrX; + ordreObst[j + 1][6] = interArrY; + if (modifTrajId == j && modifTrajDepArr == "dep") { + if (sens == 0) { + ordreObst[j][8] = distMod; + } else { + ordreObst[j][10] = distMod; + } + } else if (modifTrajId == j + 1 && modifTrajDepArr == "arr") { + if (sensSui == 0) { + ordreObst[j + 1][10] = distModSui; + } else { + ordreObst[j + 1][8] = distModSui; + } + } + /* A MODIFIER SI IL Y A DES ANGLES NON DEPENDANTS ENTRE ENTREE ET SORTIE + if(sens==0){ + + }else{ + + } + if(sensSui==0){ + + }else{ + + }*/ + ordreObst[j][7] = angleMod; + ordreObst[j][9] = angleMod; + ordreObst[j + 1][9] = angleModSui; + ordreObst[j + 1][7] = angleModSui; + + context.fillStyle = COLOR_JAUNE; + context.strokeStyle = COLOR_TRACE_TRANSPARENT; + // tracé des points jaune pour modif de trajectoires + // vérification de leur distance avec le pointeur de la souris + if ( + Math.abs(interDepX - canvas_x) + + Math.abs(interDepY - canvas_y) < + 200 + ) { + context.beginPath(); + context.arc(interDepX, interDepY, 4, 0, 2 * Math.PI); + context.stroke(); + context.fill(); + context.beginPath(); + context.moveTo(departX, departY); + context.lineTo(interDepX, interDepY); + context.stroke(); + } + if ( + Math.abs(interArrX - canvas_x) + + Math.abs(interArrY - canvas_y) < + 200 + ) { + context.beginPath(); + context.moveTo(arriveX, arriveY); + context.lineTo(interArrX, interArrY); + context.stroke(); + context.beginPath(); + context.arc(interArrX, interArrY, 4, 0, 2 * Math.PI); + context.stroke(); + context.fill(); + } + } + } + longueurTotal = longueurTotal * unite; + context.fillStyle = COLOR_TEXT_UNDER; + rect(canvasSizeX / 4, canvasSizeY - 30, canvasSizeX / 2, 30); +} +function bezierSize(x1, y1, x1B, y1B, x2, y2, x2B, y2B) { + var inc = 50; + var length = 0; + var t = 0; + var ptX = 0; + var ptY = 0; + var prevPtX = 0; + var prevPtY = 0; + var xB; + var yY; + for (var i = 0; i < inc; i++) { + t = i / inc; + var t1 = 1.0 - t; + var t1_3 = t1 * t1 * t1; + var t1_3a = 3 * t * (t1 * t1); + var t1_3b = 3 * (t * t) * t1; + var t1_3c = t * t * t; + ptX = x1 * t1_3 + t1_3a * x1B + t1_3b * x2 + t1_3c * x2B; + ptY = y1 * t1_3 + t1_3a * y1B + t1_3b * y2 + t1_3c * y2B; + if (i > 0) { + xB = ptX - prevPtX; + yY = ptY - prevPtY; + length = length + Math.sqrt(xB * xB + yY * yY); + } + prevPtX = ptX; + prevPtY = ptY; + } + return length; +} +function diffAngle(firstAngle, secondAngle) { + var difference = secondAngle - firstAngle; + if (difference < -180) { + difference += 360; + } + if (difference > 180) { + difference -= 360; + } + if (difference > 0) { + difference -= ANGLE_MIN; + } else { + difference += ANGLE_MIN; + } + return difference; +} + +function newTrajectoire() { + nextNumber = 1; + listeNumero = Array(); + genererParcours(); +} \ No newline at end of file diff --git a/static/ui/app/src/visual.js b/static/ui/app/src/visual.js new file mode 100644 index 0000000..946650a --- /dev/null +++ b/static/ui/app/src/visual.js @@ -0,0 +1,1321 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////GENERATION VISUELLE DU TERRAIN/////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function genererParcours() { + genererTerrain(); + genererTrajectoires(); + genererObstacles(); + genererNumeros(); + genererMarges(); + genererInfos(); +} +var gen = 0; +function genererTerrain() { + context.strokeStyle = COLOR_TEXT; + context.fillStyle = COLOR_TERRAIN; + context.fillRect(0, 0, canvasSizeX, canvasSizeY); + context.beginPath(); + context.strokeStyle = COLOR_GRILLE; + for ( + var i = MARGE + TAILLE_GRILLAGE; + i < canvasSizeY - MARGE * 2; + i += TAILLE_GRILLAGE + ) { + context.moveTo(0 + MARGE, i); + context.lineTo(canvasSizeX - MARGE, i); + } + for ( + var j = MARGE + TAILLE_GRILLAGE; + j < canvasSizeX - MARGE; + j += TAILLE_GRILLAGE + ) { + context.moveTo(j, 0 + MARGE); + context.lineTo(j, canvasSizeY - MARGE * 2); + } + context.stroke(); + + + var oldStroke = context.strokeStyle; + var oldFill = context.fillStyle; + + // Zonas de seguridad de montaje + // Se define un margen de seguridad de montaje de 1+1 metro + // ya que cuando uno monta no queda como en el papel y así se + // tiene margen tanto de tolerancia como para ampliar si se pudiera + var margin = ((100 / pixel) * 1) / unite; // ancho de zona = 1 metro + // Zona roja + if (document.getElementById("margen-rojo").checked) { + context.strokeStyle = 'rgba(255,0,0,0.25)'; + context.fillStyle = 'rgba(255,0,0,0.25)'; + context.fillRect(0+MARGE, 0+MARGE, canvasSizeX-2*MARGE, margin); + context.fillRect(0+MARGE, 0+MARGE+margin, margin, canvasSizeY-3*MARGE-2*margin); + context.fillRect(canvasSizeX-MARGE-margin, 0+MARGE+margin, margin, canvasSizeY-3*MARGE-2*margin); + context.fillRect(0+MARGE, canvasSizeY-2*MARGE-margin, canvasSizeX-2*MARGE, margin); + } + // Zona amarilla + if (document.getElementById("margen-amarillo").checked) { + context.strokeStyle = 'rgba(246,255,0,0.25)'; + context.fillStyle = 'rgba(246,255,0,0.25)'; + context.fillRect(0+MARGE+margin, 0+MARGE+margin, canvasSizeX-2*MARGE-2*margin, margin); + context.fillRect(0+MARGE+margin, 0+MARGE+2*margin, margin, canvasSizeY-3*MARGE-4*margin); + context.fillRect(canvasSizeX-MARGE-2*margin, 0+MARGE+2*margin, margin, canvasSizeY-3*MARGE-4*margin); + context.fillRect(0+MARGE+margin, canvasSizeY-2*MARGE-2*margin, canvasSizeX-2*MARGE-2*margin, margin); + } + + context.strokeStyle = oldStroke; + context.fillStyle = oldFill; + +} +function genererInfos() { + //context.fillText(titre,MARGE,canvasSizeY); + context.fillStyle = COLOR_TEXT; + + context.fillText(titre, MARGE, canvasSizeY - 20); + + if (unite == 1) { + idUnite = 34; + } else if (unite == 1.093613) { + idUnite = 35; + } else { + //3.28084 + idUnite = 36; + } + if (document.getElementById("AfficherDistance").checked) { + context.fillText( + langues[idLg][8] + + " : " + + Math.round(longueurTotal) / 100 + + " " + + langues[idLg][idUnite], + canvasSizeX - MARGE - 150, + canvasSizeY - 20 + ); + } + context.fillText( + "www.AgilityMaps.com ", + canvasSizeX - MARGE - 150, + canvasSizeY - 8 + ); + var idUnite; + + if (auteur != "") { + context.fillText( + langues[idLg][9] + " : " + auteur, + MARGE, + canvasSizeY - 8 + ); + } +} +function genererNumeros() { + if (!shownumbers) { + return; + } + + context.font = "7pt Calibri"; + for (var i = 1; i < nextNumber; i++) { + context.fillStyle = COLOR_BLANC; + context.strokeStyle = COLOR_TEXT; + rect( + listeNumero[i][1] - LARGEUR_NUMERO / 2, + listeNumero[i][2] - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO, + HAUTEUR_NUMERO + ); + context.fillStyle = COLOR_TEXT; + if (i < 10) { + context.fillText( + listeNumero[i][0], + listeNumero[i][1] + 4 - LARGEUR_NUMERO / 2, + listeNumero[i][2] + 7 - HAUTEUR_NUMERO / 2 + ); + } else { + context.fillText( + listeNumero[i][0], + listeNumero[i][1] + 1 - LARGEUR_NUMERO / 2, + listeNumero[i][2] + 7 - HAUTEUR_NUMERO / 2 + ); + } + } + for (var i = 1; i < nextNumber2; i++) { + context.fillStyle = COLOR_METAL; + context.strokeStyle = COLOR_TEXT; + rect( + listeNumero2[i][1] - LARGEUR_NUMERO / 2, + listeNumero2[i][2] - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO, + HAUTEUR_NUMERO + ); + context.fillStyle = COLOR_TEXT; + if (i < 10) { + context.fillText( + listeNumero2[i][0], + listeNumero2[i][1] + 4 - LARGEUR_NUMERO / 2, + listeNumero2[i][2] + 7 - HAUTEUR_NUMERO / 2 + ); + } else { + context.fillText( + listeNumero2[i][0], + listeNumero2[i][1] + 1 - LARGEUR_NUMERO / 2, + listeNumero2[i][2] + 7 - HAUTEUR_NUMERO / 2 + ); + } + } + for (var i = 1; i < nextNumber3; i++) { + context.fillStyle = COLOR_TEXT; + context.strokeStyle = COLOR_BLANC; + rect( + listeNumero3[i][1] - LARGEUR_NUMERO / 2, + listeNumero3[i][2] - HAUTEUR_NUMERO / 2, + LARGEUR_NUMERO, + HAUTEUR_NUMERO + ); + context.fillStyle = COLOR_BLANC; + if (i < 10) { + context.fillText( + listeNumero3[i][0], + listeNumero3[i][1] + 4 - LARGEUR_NUMERO / 2, + listeNumero3[i][2] + 7 - HAUTEUR_NUMERO / 2 + ); + } else { + context.fillText( + listeNumero3[i][0], + listeNumero3[i][1] + 1 - LARGEUR_NUMERO / 2, + listeNumero3[i][2] + 7 - HAUTEUR_NUMERO / 2 + ); + } + } +} +function genererMarges() { + context.strokeStyle = COLOR_CONTOURS; + + // contours + context.fillStyle = COLOR_BLANC; + context.fillRect(0, 0, canvasSizeX, MARGE); + context.fillRect(0, 0, MARGE, canvasSizeY); + + context.fillRect(canvasSizeX - MARGE, 0, MARGE, canvasSizeY); + context.fillRect(0, canvasSizeY - MARGE * 2, canvasSizeX, MARGE * 2); + + context.beginPath(); + + context.moveTo(MARGE, MARGE); + context.lineTo(canvasSizeX - MARGE, MARGE); + context.lineTo(canvasSizeX - MARGE, canvasSizeY - MARGE * 2); + context.lineTo(MARGE, canvasSizeY - MARGE * 2); + context.lineTo(MARGE, MARGE); + context.stroke(); + context.strokeStyle = COLOR_GRILLE; + + context.fillStyle = COLOR_TEXT; + context.beginPath(); + context.lineWidth = 1; + context.fillText(0, MARGE - 10, MARGE - 5); + //context.fillText(0,canvasSizeX-MARGE+5,MARGE+4); + //context.fillText(0,MARGE-6,MARGE-5); + //context.fillText(0,MARGE-6,canvasSizeY-MARGE*2+15); + + for ( + var i = MARGE + TAILLE_GRILLAGE; + i <= canvasSizeY - MARGE * 2 + 1; + i += TAILLE_GRILLAGE + ) { + context.fillText( + Math.round((((i - MARGE) * pixel) / 100) * unite), + MARGE - 15, + i + 4 + ); + context.fillText( + Math.round((((i - MARGE) * pixel) / 100) * unite), + canvasSizeX - MARGE + 5, + i + 4 + ); + } + for ( + var j = MARGE + TAILLE_GRILLAGE; + j <= canvasSizeX - MARGE + 1; + j += TAILLE_GRILLAGE + ) { + context.fillText( + Math.round((((j - MARGE) * pixel) / 100) * unite), + j - 6, + MARGE - 5 + ); + context.fillText( + Math.round((((j - MARGE) * pixel) / 100) * unite), + j - 6, + canvasSizeY - MARGE * 2 + 15 + ); + } + context.stroke(); +} +function genererObstacles() { + if (selNumeroId != -1) { + context.strokeStyle = "#ffff00"; + context.beginPath(); + context.lineWidth = 1; + context.moveTo(xp, yp); + context.lineTo(xpp, ypp); + context.stroke(); + } + context.strokeStyle = COLOR_CONTOURS; + /////////////////////////////// affichage des tunnels ////////////////////////////////////////// + for (var j = 0; j < idTunnel; j++) { + var idT = tbTunnels[j][0]; + // jonction entre les morceaux de tunels + context.save(); + for (var art = 1; art < nbArticulationTunnel - 1; art++) { + context.fillStyle = COLOR_1; + context.strokeStyle = COLOR_CONTOURS; + context.beginPath(); + context.arc( + tbTunnels[j][art * 2 + 1], + tbTunnels[j][art * 2 + 2], + largeurTunnel / 2, + 0, + 2 * Math.PI + ); //point d'encrage + context.fill(); + context.translate(0.5, 0.5); + context.stroke(); + context.translate(-0.5, -0.5); + } + context.restore(); + for (var art = 0; art < nbArticulationTunnel; art++) { + if (art + 1 < nbArticulationTunnel) { + x = art * 2 + 1; + y = art * 2 + 2; + x2 = art * 2 + 3; + y2 = art * 2 + 4; + //calcul de l'angle et de la distance avec le prochain point + dist = Math.sqrt( + Math.pow(tbTunnels[j][x] - tbTunnels[j][x2], 2) + + Math.pow(tbTunnels[j][y] - tbTunnels[j][y2], 2) + ); + angle = + (Math.atan2( + tbTunnels[j][y] - tbTunnels[j][y2], + tbTunnels[j][x] - tbTunnels[j][x2] + ) / + Math.PI) * + 180; + context.fillStyle = COLOR_1; + context.save(); + context.translate( + tbTunnels[j][art * 2 + 1], + tbTunnels[j][art * 2 + 2] + ); //translate to center of shape + context.rotate((Math.PI / 180) * angle); //rotate 25 degrees + context.translate( + -tbTunnels[j][art * 2 + 1], + -tbTunnels[j][art * 2 + 2] + ); //translate center back to 0,0 + context.strokeStyle = COLOR_CONTOURS; + context.translate(0.5, 0.5); + context.strokeRect( + tbTunnels[j][x], + tbTunnels[j][y] - largeurTunnel / 2 - 1, + -dist, + 1 + ); //tunnel + context.strokeRect( + tbTunnels[j][x], + tbTunnels[j][y] + largeurTunnel / 2 - 1, + -dist, + 1 + ); //tunnel + context.translate(-0.5, -0.5); + context.fillRect( + tbTunnels[j][x], + tbTunnels[j][y] - largeurTunnel / 2, + -dist, + largeurTunnel + ); //tunnel + context.fillStyle = COLOR_1b; + context.strokeStyle = COLOR_1b; + context.fillRect( + tbTunnels[j][x] - dist / 5, + tbTunnels[j][y] - largeurTunnel / 2, + 1, + largeurTunnel + ); //tunnel + context.fillRect( + tbTunnels[j][x] - dist / 5 - dist / 5, + tbTunnels[j][y] - largeurTunnel / 2, + 1, + largeurTunnel + ); //tunnel + context.fillRect( + tbTunnels[j][x] - dist / 5 - dist / 5 - dist / 5, + tbTunnels[j][y] - largeurTunnel / 2, + 1, + largeurTunnel + ); //tunnel + context.fillRect( + tbTunnels[j][x] - dist / 5 - dist / 5 - dist / 5 - dist / 5, + tbTunnels[j][y] - largeurTunnel / 2, + 1, + largeurTunnel + ); //tunnel + context.strokeRect( + tbTunnels[j][x], + tbTunnels[j][y] - largeurTunnel / 2, + -dist, + largeurTunnel + ); //tunnel + context.restore(); + } + if ( + overTunnelComplet != -1 || + overPointTunnel != -1 || + moveTunnelComplet != -1 || + overTunnelId != -1 + ) { + context.fillStyle = COLOR_3; + context.strokeStyle = COLOR_CONTOURS; + context.beginPath(); + context.arc( + tbTunnels[j][art * 2 + 1], + tbTunnels[j][art * 2 + 2], + 3, + 0, + 2 * Math.PI + ); //point d'encrage + context.fill(); + context.stroke(); + } + } + } + + //////////////////////////////////////////// affichage des autres éléments ////////////////////////////////////////// + for (var i = 0; i < id; i++) { + var x = getCanvasX(i); + var y = getCanvasY(i); + var largx = getXCliquable(i); + var hauty = getYCliquable(i); + var type = getType(i); + var angle = getAngle(i); + var sens = getSens(i); + + context.fillStyle = COLOR_1; + + context.save(); + context.translate(largx / 2 + x, hauty / 2 + y); //translate to center of shape + context.rotate((Math.PI / 180) * angle); //rotate 25 degrees + context.translate(-largx / 2 - x, -hauty / 2 - y); //translate center back to 0,0 + + // Draw bubbles to get visually the distance around + if ( selObst==i ) { + // console.log(type+" "+selObst); + if (type=="haie" || type=="oxer" || type=="mur" || type=="longueur" || type=="table" || type=="pneu" ) { + bubblesZone(x+largx/2,y+hauty/2); + } else if (type!="conducteur" && type!="chien") { + // bubbles from start to end + bubblesZone(x,y+hauty/2,largx); + } + } + + if (type == "haie") { + dessinerHaie(x, y, largx); + } else if (type == "oxer") { + dessinerOxer(x, y, largx); + } else if (type == "passerelle") { + dessinerPasserelle(x, y, largx, hauty); + } else if (type == "balancoire") { + dessinerBalance(x, y, largx, hauty); + } else if (type == "palissade") { + dessinerPalissade(x, y, largx, hauty); + } else if (type == "slalom") { + dessinerSlalom(x, y, largx, hauty); + } else if (type == "slalom6") { + dessinerSlalom6(x, y, largx, hauty); + } else if (type == "chaussette") { + dessinerChaussette(x, y, largx, hauty); + } else if (type == "longueur") { + dessinerLongueur(x, y, largx); + } else if (type == "mur") { + dessinerMur(x, y, largx, hauty); + } else if (type == "table") { + dessinerTable(x, y); + } else if (type == "pneu") { + dessinerPneu(x, y, largx, hauty); + } + context.fillStyle = "#FFFF00"; //jaune + context.restore(); + if (overObject == i) { + dessinerOverObstacle(x, y, largx, hauty, angle, i); + } + } + + //////////////////////////////////////////// affichage des conducteurs et chiens ////////////////////////////////////////// + for (var i = 0; i < id; i++) { + var x = getCanvasX(i); + var y = getCanvasY(i); + var largx = getXCliquable(i); + var hauty = getYCliquable(i); + var type = getType(i); + var angle = getAngle(i); + var sens = getSens(i); + + context.fillStyle = COLOR_1; + + context.save(); + context.translate(largx / 2 + x, hauty / 2 + y); //translate to center of shape + context.rotate((Math.PI / 180) * angle); //rotate 25 degrees + context.translate(-largx / 2 - x, -hauty / 2 - y); //translate center back to 0,0 + + if ( + type == "conducteur" && + document.getElementById("AfficherConducteur").checked + ) { + dessinerConducteur(x, y, largx, hauty, sens); + if ( selObst==i ) { judgeLines(x+largx/2, y+hauty/2) } + } else if ( + type == "chien" && + document.getElementById("AfficherConducteur").checked + ) { + dessinerChien(x, y, largx, hauty); + } + context.fillStyle = "#FFFF00"; //jaune + context.restore(); + if (overObject == i) { + dessinerOverObstacle(x, y, largx, hauty, angle, i); + } + } + + //afficherTest(); +} +function bubblesZone (x, y, larg = 0) { + // Draw 4 "bubbles" around and obstacle to visually get the distance from the center of this to obstacles around it + // Reference points in contact zones are the start and end of the obstacle + // Distances are 3.5 (red filled), 5 (yellow), 7 (green) and 8 (red-unfilled) meters + var first = ((100 / pixel) * 3.5) / unite; + var second = ((100 / pixel) * 5) / unite; + var third = ((100 / pixel) * 7) / unite; + var forth = ((100 / pixel) * 8) / unite; + if ( larg==0 ) { + bubble(x,y,first,'rgba(255,0,0,0.50)','rgba(255,0,0,0.10)'); + bubble(x,y,second,'rgba(246,255,0,0.50)','rgba(246,255,0,0.10)'); + bubble(x,y,third,'rgba(0,255,0,0.50)','rgba(0,255,0,0.10)'); + bubble(x,y,forth,'rgba(255,0,0,0.50)','rgba(255,255,255,0)'); + } else { + bubbleBig(x,y,larg,first,'rgba(255,0,0,0.50)','rgba(255,0,0,0.10)'); + bubbleBig(x,y,larg,second,'rgba(246,255,0,0.50)','rgba(246,255,0,0.10)'); + bubbleBig(x,y,larg,third,'rgba(0,255,0,0.50)','rgba(0,255,0,0.10)'); + bubbleBig(x,y,larg,forth,'rgba(255,0,0,0.50)','rgba(255,255,255,0)'); + } + //cross(x,y); +} + +function judgeLines (x,y) { + // Draw 3 lines 4 meters width at 2, 3 and 6 meters from "conducteur/judge" + var width = ((100 / pixel) * 2) / unite; // 2 meters + var first = ((100 / pixel) * 2) / unite; // 2 meters + var second = ((100 / pixel) * 3) / unite; // 3 meters + var third = ((100 / pixel) * 6) / unite; // 6 meters + context.save(); + context.beginPath(); + context.lineWidth = 1; + context.strokeStyle = 'rgba(255,0,0,0.75)'; + context.moveTo(x-width,y-first); + context.lineTo(x+width,y-first); + context.stroke(); + context.beginPath(); + context.moveTo(x-width,y-second); + context.lineTo(x+width,y-second); + context.stroke(); + context.beginPath(); + context.moveTo(x-width,y-third); + context.lineTo(x+width,y-third); + context.stroke(); + context.restore(); +} + + +function cross (x,y) { + context.save(); + context.beginPath(); + context.moveTo(0,y); + context.lineTo(50,y); + context.moveTo(x,0); + context.lineTo(x,50); + context.lineWidth = 3; + context.strokeStyle = 'rgba(255,0,0,0.50)'; + context.stroke(); + context.restore(); +} + +function bubble(x, y, radius, color, fill) { + context.save(); + context.beginPath(); + context.arc(x, y, radius, 0, 2 * Math.PI, false); + context.fillStyle = fill; + context.fill(); + context.lineWidth = 1; + context.strokeStyle = color; + context.stroke(); + context.restore(); +} + +function bubbleBig(x, y, larg, radius, color, fill) { + context.save(); + + context.fillStyle = fill; + context.lineWidth = 1; + context.strokeStyle = color; + // Left + context.beginPath(); + context.arc(x, y, radius, Math.PI/2, 3*Math.PI/2, false); + // context.arc(x, y, radius, 0, 2*Math.PI, false); + context.fill(); + context.stroke(); + + // Right + context.beginPath(); + context.arc(x+larg, y, radius, 3*Math.PI/2, Math.PI/2, false); + // context.arc(x+larg, y, radius, 0, 2*Math.PI, false); + context.fill(); + context.stroke(); + // Middle + context.fillRect(x, y-radius, larg, radius*2); + context.beginPath(); + context.moveTo(x, y-radius); + context.lineTo(x+larg, y-radius); + context.stroke(); + context.beginPath(); + context.moveTo(x, y+radius); + context.lineTo(x+larg, y+radius); + context.stroke(); + + // change opacity for inner limits + context.strokeStyle = color.replace(/[^,]+(?=\))/, '0.10');; + context.beginPath(); + context.arc(x, y, radius, 3*Math.PI/2, Math.PI/2, false); + context.stroke(); + context.beginPath(); + context.arc(x+larg, y, radius, Math.PI/2, 3*Math.PI/2, false); + context.stroke(); + + context.restore(); +} + +function rectBump(x, y, larg, haut) { + context.translate(-0.5, -0.5); + context.strokeRect(x, y, larg, haut); //mur + context.translate(0.5, 0.5); + context.fillRect(x, y, larg, haut); //mur +} +function rect(x, y, larg, haut) { + context.fillRect(x, y, larg, haut); //mur + context.translate(-0.5, -0.5); + context.strokeRect(x, y, larg, haut); //mur + context.translate(0.5, 0.5); +} + +function dessinerTable(x, y) { + context.fillStyle = COLOR_1; + context.strokeStyle = COLOR_CONTOURS; + rect(x, y, DIM_TABLE, DIM_TABLE); +} + +function dessinerPneu(x, y, largx, hauty) { + context.fillStyle = COLOR_1; + + context.beginPath(); + context.save(); + context.fillStyle = COLOR_2; + context.lineWidth = 2; + + context.strokeStyle = COLOR_JOINTURES; + context.arc(x + largx / 2 - 0.5, y + hauty / 2 - 0.5, 8, 0, 2 * Math.PI); + context.stroke(); + context.beginPath(); + context.strokeStyle = COLOR_JOINTURES; + context.arc(x + largx / 2 - 0.5, y + hauty / 2 - 0.5, 6, 0, 2 * Math.PI); + context.stroke(); + context.beginPath(); + context.strokeStyle = COLOR_2; + context.arc(x + largx / 2 - 0.5, y + hauty / 2 - 0.5, 7, 0, 2 * Math.PI); + //context.fill(); + context.stroke(); + context.restore(); + + rect(x + largx, y + hauty / 2, 5, 2.5); //barre + rect(x - 5, y + hauty / 2, 5, 2.5); //barre + + rect(x, y, 2.5, hauty); //barre + rect(x + largx - 2.5, y, 2.5, hauty); //barre + rect(x + 2.5, y, largx - 5, 2.5); //barre + rect(x + 2.5, y + hauty - 2.5, largx - 5, 2.5); //barre +} + +function dessinerMur(x, y, largx, hauty) { + context.fillStyle = COLOR_3; + context.strokeStyle = COLOR_CONTOURS; + rect(x, y, largx, hauty); + context.fillStyle = COLOR_1; + rect( + x, + y - (LARGEUR_MUR_TOUR / pixel / 2 - hauty / 2), + LARGEUR_MUR_TOUR / pixel, + LARGEUR_MUR_TOUR / pixel + ); + rect( + x + largx - LARGEUR_MUR_TOUR / pixel, + y - (LARGEUR_MUR_TOUR / pixel / 2 - hauty / 2), + LARGEUR_MUR_TOUR / pixel, + LARGEUR_MUR_TOUR / pixel + ); + context.fillStyle = COLOR_1b; + context.fillStyle = COLOR_1; + var largTuille = (largx - 30) / 3; + context.fillRect(x + 7, y + 0.5, 4.5, hauty - 2); //tuille + context.fillRect(x + 13, y + 0.5, 4.5, hauty - 2); //tuille + context.fillRect(x + 19, y + 0.5, 4.5, hauty - 2); //tuille + context.fillRect(x + 25, y + 0.5, 4.5, hauty - 2); //tuille +} + +function dessinerLongueur(x, y, largx) { + context.fillStyle = COLOR_2; + rect(x, y, largx, 4); + rect(x, y + 7, largx, 4); + rect(x, y + 14, largx, 4); + rect(x, y + 21, largx, 4); + context.fillStyle = COLOR_3; + + rect(x, y, largx, 4); + rect(x + 3, y + 7, largx - 6, 4); + rect(x + 6, y + 14, largx - 12, 4); + rect(x + 10, y + 21, largx - 20, 4); + + context.fillStyle = COLOR_2; + rect(x + 5, y, largx - 10, 4); + rect(x + 8, y + 7, largx - 16, 4); + rect(x + 11, y + 14, largx - 22, 4); + + context.fillStyle = COLOR_1; +} + +function dessinerChaussette(x, y, largx, hauty) { + context.fillStyle = COLOR_2; + context.strokeRect(x, y, 15, hauty); + context.fillRect(x, y, 15, hauty); + context.fillStyle = COLOR_1; + context.beginPath(); + context.moveTo(x + 15, y); + context.lineTo(x + largx, y - 5); + context.lineTo(x + largx, y + hauty + 5); + context.lineTo(x + 15, y + hauty); + context.closePath(x + 15, y + hauty + 5); + context.stroke(); + context.fill(); +} + +function dessinerSlalom(x, y, largx, hauty) { + context.fillStyle = COLOR_METAL; + context.fillRect(x, y, largx, hauty); + context.fillStyle = COLOR_2; + context.strokeStyle = COLOR_2b; + context.beginPath(); + context.arc( + x, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 20, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 40, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 60, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 80, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 100, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + + context.fillStyle = COLOR_1; + context.strokeStyle = COLOR_1b; + + context.beginPath(); + context.strokeStyle = COLOR_JOINTURES; + + context.arc( + x + 10, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 30, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 50, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 70, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 90, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 110, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); +} + +function dessinerSlalom6(x, y, largx, hauty) { + context.fillStyle = COLOR_METAL; + context.fillRect(x, y, largx, hauty); + context.fillStyle = COLOR_2; + context.strokeStyle = COLOR_2b; + context.beginPath(); + context.arc( + x, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 20, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 40, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + + context.fillStyle = COLOR_1; + context.strokeStyle = COLOR_1b; + + context.beginPath(); + context.strokeStyle = COLOR_JOINTURES; + + context.arc( + x + 10, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 30, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); + context.beginPath(); + context.arc( + x + 50, + y + DIAM_BARRE_SLALOM / 2, + DIAM_BARRE_SLALOM, + 0, + 2 * Math.PI + ); + context.fill(); + context.stroke(); +} + +function dessinerPalissade(x, y, largx, hauty) { + context.fillStyle = COLOR_2; + context.strokeRect(x, y, 15, hauty); + context.fillRect(x, y, 15, hauty); + context.fillStyle = COLOR_1; + context.strokeRect(x + 15, y, largx - 30, hauty); + context.fillRect(x + 15, y, largx - 30, hauty); + context.fillStyle = COLOR_2; + context.strokeRect(x + largx - 15, y, 15, hauty); + context.fillRect(x + largx - 15, y, 15, hauty); + context.fillStyle = COLOR_JOINTURES; + context.fillRect(x + largx / 2, y, 1, hauty); + + // ralentisseurs descente + context.fillStyle = COLOR_2b; + context.fillRect(x + 5, y, 1, hauty); + context.fillRect(x + 10, y, 1, hauty); + context.fillRect(x + largx - 5, y, 1, hauty); + context.fillRect(x + largx - 10, y, 1, hauty); + context.fillStyle = COLOR_1b; + context.fillRect(x + 20, y, 1, hauty); + context.fillRect(x + 25, y, 1, hauty); + context.fillRect(x + 30, y, 1, hauty); + context.fillRect(x + largx - 20, y, 1, hauty); + context.fillRect(x + largx - 25, y, 1, hauty); + context.fillRect(x + largx - 30, y, 1, hauty); +} + +function dessinerPasserelle(x, y, largx, hauty) { + context.fillStyle = COLOR_JOINTURES; + + context.fillRect(x + largx / 3, y - 5, 2, hauty + 10); + context.strokeRect(x + largx / 3, y - 5, 2, hauty + 10); + + context.fillStyle = COLOR_JOINTURES; + context.fillRect(x + largx / 3 + largx / 3, y - 5, 2, hauty + 10); + context.translate(-0.5, -0.5); + context.strokeRect(x + largx / 3 + largx / 3, y - 5, 2, hauty + 10); + context.translate(0.5, 0.5); + + dessinerBalPassCommun(x, y, largx, hauty); + + // tiges metal de jonction + context.fillRect(x + largx / 3, y, 1, hauty); + context.fillRect(x + largx / 3 + largx / 3, y, 1, hauty); + // ralentisseurs descente + context.fillStyle = COLOR_2b; + context.fillRect(x + 5, y, 1, hauty); + context.fillRect(x + 10, y, 1, hauty); + context.fillRect(x + largx - 5, y, 1, hauty); + context.fillRect(x + largx - 10, y, 1, hauty); + context.fillStyle = COLOR_1b; + context.fillRect(x + 20, y, 1, hauty); + context.fillRect(x + 25, y, 1, hauty); + context.fillRect(x + 30, y, 1, hauty); + context.fillRect(x + 35, y, 1, hauty); + context.fillRect(x + 40, y, 1, hauty); + context.fillRect(x + 45, y, 1, hauty); + context.fillRect(x + 50, y, 1, hauty); + context.fillRect(x + 55, y, 1, hauty); + context.fillRect(x + 60, y, 1, hauty); + context.fillRect(x + largx - 20, y, 1, hauty); + context.fillRect(x + largx - 25, y, 1, hauty); + context.fillRect(x + largx - 30, y, 1, hauty); + context.fillRect(x + largx - 35, y, 1, hauty); + context.fillRect(x + largx - 40, y, 1, hauty); + context.fillRect(x + largx - 45, y, 1, hauty); + context.fillRect(x + largx - 50, y, 1, hauty); + context.fillRect(x + largx - 55, y, 1, hauty); + context.fillRect(x + largx - 60, y, 1, hauty); +} + +function dessinerBalance(x, y, largx, hauty) { + context.fillStyle = COLOR_JOINTURES; + context.fillRect(x + largx / 2, y - 5, 2, hauty + 10); + context.fillStyle = COLOR_CONTOURS; + context.strokeRect(x + largx / 2, y - 5, 2, hauty + 10); + dessinerBalPassCommun(x, y, largx, hauty); +} + +function dessinerBalPassCommun(x, y, largx, hauty) { + // planche principale + context.fillStyle = COLOR_2; + context.strokeRect(x, y, 15, hauty); + context.fillRect(x, y, 15, hauty); + context.fillStyle = COLOR_1; + context.strokeRect(x + 15, y, largx - 30, hauty); + context.fillRect(x + 15, y, largx - 30, hauty); + context.fillStyle = COLOR_2; + context.strokeRect(x + largx - 15, y, 15, hauty); + context.fillRect(x + largx - 15, y, 15, hauty); + context.fillStyle = COLOR_JOINTURES; +} + +function dessinerHaie(x, y, largx) { + context.fillStyle = COLOR_2; + + rectBump(x + 10, y, largx - 20, DIAM_BARRE); //barre + + context.fillStyle = COLOR_3; + rectBump(x + 18, y, largx - 36, DIAM_BARRE); //barre + + context.fillStyle = COLOR_1; + rectBump(x, y, 10, DIAM_BARRE); //montants + + rectBump(x + largx - 10, y, 10, DIAM_BARRE); + rectBump(x + largx - 11, y - 3, 1, 9); + rectBump(x + 10, y - 3, 1, 9); +} + +function dessinerOxer(x, y, largx) { + dessinerHaie(x, y, largx); + + context.fillStyle = COLOR_2; + + rectBump(x + 1 + 10, y + 55 / pixel, largx - 20 - 2, DIAM_BARRE); //barre + + context.fillStyle = COLOR_3; + rectBump(x + 1 + 18 - 1, y + 55 / pixel, largx - 36, DIAM_BARRE); //barre + + context.fillStyle = COLOR_1; + rectBump(x + 1, y + 55 / pixel, 10, DIAM_BARRE); //montants + + rectBump(x + 1 + largx - 10 - 2, y + 55 / pixel, 10, DIAM_BARRE); + rectBump(x + 1 + largx - 11 - 2, y - 3 + 55 / pixel, 1, 9); + rectBump(x + 1 + 10, y - 3 + 55 / pixel, 1, 9); +} + +function dessinerConducteur(x, y, largx, hauty, sens) { + var scalePersonnage = 2; + + modifx = x + largx / 2 - 6; + modify = y + hauty / 2 - 8; + + //corps + context.fillStyle = COLOR_VETEMENTS; + context.beginPath(); + context.moveTo(modifx + 0.77, modify + 3.08); + context.lineTo(modifx + 11.54, modify + 3.08); + if (sens == "d") { + context.lineTo(modifx + 13.08, modify + 1.54); + context.lineTo(modifx + 16.15, modify - 3.08); + context.lineTo(modifx + 17.69, modify - 2.31); + context.lineTo(modifx + 16.15, modify + 1.54); + context.lineTo(modifx + 14.62, modify + 5.38); + } else if (sens == "dL") { + context.lineTo(modifx + 12.31, modify + 0.77); + context.lineTo(modifx + 12.31, modify - 3.85); + context.lineTo(modifx + 13.85, modify - 3.85); + context.lineTo(modifx + 14.62, modify + 0.77); + context.lineTo(modifx + 14.62, modify + 5.38); + } else if (sens == "dC") { + context.lineTo(modifx + 16.15, modify + 2.31); + context.lineTo(modifx + 20, modify - 0.77); + context.lineTo(modifx + 20.77, modify + 1.54); + context.lineTo(modifx + 16.92, modify + 5.38); + } else { + context.lineTo(modifx + 14.62, modify + 5.38); + } + context.lineTo(modifx + 13.85, modify + 6.92); + context.lineTo(modifx + 11.54, modify + 8.46); + context.lineTo(modifx + 0.77, modify + 8.46); + context.lineTo(modifx - 1.54, modify + 6.92); + if (sens == "g") { + context.lineTo(modifx - 2.31, modify + 5.38); + context.lineTo(modifx - 3.85, modify + 1.54); + context.lineTo(modifx - 5.38, modify - 2.31); + context.lineTo(modifx - 3.85, modify - 3.08); + context.lineTo(modifx - 0.77, modify + 1.54); + } else if (sens == "gL") { + context.lineTo(modifx - 2.31, modify + 5.38); + context.lineTo(modifx - 2.31, modify + 0.77); + context.lineTo(modifx - 1.54, modify - 3.85); + context.lineTo(modifx + 0, modify - 3.85); + context.lineTo(modifx + 0, modify + 0.77); + } else if (sens == "gC") { + context.lineTo(modifx - 4.62, modify + 5.38); + context.lineTo(modifx - 9.23, modify + 1.54); + context.lineTo(modifx - 7.69, modify - 0.77); + context.lineTo(modifx - 3.85, modify + 2.31); + } else { + context.lineTo(modifx - 2.31, modify + 5.38); + } + context.lineTo(modifx + 0.77, modify + 3.08); + context.fill(); + context.stroke(); + + // MAINS + //main droite + context.fillStyle = COLOR_PEAU; + if (sens == "d") { + //main + context.fillStyle = "#ffff88"; + context.beginPath(); + context.arc(modifx + 16.92, modify - 3.08, 1.3, 0, 2 * Math.PI); //point d'encrage + + context.fill(); + context.stroke(); + } else if (sens == "dL") { + context.fillStyle = "#ffff88"; + context.beginPath(); + context.arc(modifx + 13.08, modify - 4.62, 1.3, 0, 2 * Math.PI); //point d'encrage + + context.fill(); + context.stroke(); + } else if (sens == "dC") { + context.fillStyle = "#ffff88"; + context.beginPath(); + context.arc(modifx + 20.77, modify, 1.3, 0, 2 * Math.PI); //point d'encrage + context.fill(); + context.stroke(); + } + + // main gauche + if (sens == "g") { + //main + context.beginPath(); + context.arc(modifx - 4.62, modify - 3.08, 1.3, 0, 2 * Math.PI); //point d'encrage + context.fill(); + context.stroke(); + } else if (sens == "gL") { + context.beginPath(); + context.arc(modifx - 0.77, modify - 4.62, 1.3, 0, 2 * Math.PI); //point d'encrage + context.fill(); + context.stroke(); + } else if (sens == "gC") { + context.beginPath(); + context.arc(modifx - 9.23, modify, 1.3, 0, 2 * Math.PI); //point d'encrage + context.fill(); + context.stroke(); + } + //TETE + //cheveux + context.fillStyle = COLOR_CHEVEUX; + context.beginPath(); + context.moveTo(modifx + 3.08, modify + 4.62); + context.lineTo(modifx + 3.85, modify + 3.08); + context.lineTo(modifx + 4.62, modify + 3.85); + context.lineTo(modifx + 7.69, modify + 3.85); + context.lineTo(modifx + 8.46, modify + 3.08); + context.lineTo(modifx + 9.23, modify + 4.62); + context.lineTo(modifx + 8.46, modify + 6.92); + context.lineTo(modifx + 6.92, modify + 7.69); + context.lineTo(modifx + 5.38, modify + 7.69); + context.lineTo(modifx + 3.85, modify + 6.92); + context.lineTo(modifx + 3.08, modify + 4.62); + context.fill(); + context.stroke(); + //visage + context.fillStyle = COLOR_PEAU; + context.beginPath(); + context.moveTo(modifx + 3.85, modify + 3.08); + context.lineTo(modifx + 4.62, modify + 3.85); + context.lineTo(modifx + 7.69, modify + 3.85); + context.lineTo(modifx + 8.46, modify + 3.08); + context.lineTo(modifx + 7.69, modify + 2.31); + context.lineTo(modifx + 6.92, modify + 2.31); + context.lineTo(modifx + 6.15, modify + 1.54); + context.lineTo(modifx + 5.38, modify + 2.31); + context.lineTo(modifx + 4.62, modify + 2.31); + context.lineTo(modifx + 3.85, modify + 3.08); + context.fill(); + context.stroke(); +} + +function dessinerChien(x, y, largx, hauty, sens) { + modifx = x + largx / 2 - 3; + modify = y + hauty / 2 - 10; + + //corps + context.fillStyle = "grey"; + context.strokeStyle = "black"; + context.beginPath(); + context.moveTo(modifx + 2.8, modify + 0); + context.lineTo(modifx + 1.8, modify + 1.4); + context.lineTo(modifx + 1.4, modify + 3); + context.lineTo(modifx + 0.4, modify + 4.4); + context.lineTo(modifx + 1.6, modify + 4.4); + context.lineTo(modifx + 1.6, modify + 5.2); + context.lineTo(modifx + 0.2, modify + 6.4); + context.lineTo(modifx + 0, modify + 9); + context.lineTo(modifx + 0.2, modify + 11.2); + context.lineTo(modifx + 0.6, modify + 11.4); + context.lineTo(modifx + 0.6, modify + 14.8); + context.lineTo(modifx + 0.2, modify + 15.2); + context.lineTo(modifx + 0.2, modify + 17); + context.lineTo(modifx + 2.6, modify + 20); + context.lineTo(modifx + 2.6, modify + 22); + context.lineTo(modifx + 2.8, modify + 22.6); + context.lineTo(modifx + 3, modify + 22); + context.lineTo(modifx + 3, modify + 20); + context.lineTo(modifx + 5.4, modify + 17); + context.lineTo(modifx + 5.4, modify + 15.2); + context.lineTo(modifx + 5, modify + 14.8); + context.lineTo(modifx + 5, modify + 11.4); + context.lineTo(modifx + 5.4, modify + 11.2); + context.lineTo(modifx + 5.6, modify + 9); + context.lineTo(modifx + 5.4, modify + 6.4); + context.lineTo(modifx + 4, modify + 5.2); + context.lineTo(modifx + 4, modify + 4.4); + context.lineTo(modifx + 5.2, modify + 4.4); + context.lineTo(modifx + 4.2, modify + 3); + context.lineTo(modifx + 3.8, modify + 1.4); + context.lineTo(modifx + 2.8, modify + 0); + + context.fill(); + context.stroke(); +} + +function dessinerOverObstacle(x, y, largx, hauty, angle, i) { + xRotateGauche = + (Math.round(Math.cos(toDegrees(angle)) * 100) / 100) * + ((largx + ROTATE_MARGE_SELECTION) / 2) + + x + + largx / 2; + yRotateGauche = + (Math.round(Math.sin(toDegrees(angle)) * 100) / 100) * + ((largx + ROTATE_MARGE_SELECTION) / 2) + + y + + hauty / 2; + xRotateDroit = + x + + largx / 2 - + (Math.round(Math.cos(toDegrees(angle)) * 100) / 100) * + ((largx + ROTATE_MARGE_SELECTION) / 2); + yRotateDroit = + y + + hauty / 2 - + (Math.round(Math.sin(toDegrees(angle)) * 100) / 100) * + ((largx + ROTATE_MARGE_SELECTION) / 2); + + context.save(); + context.translate(xRotateGauche, yRotateGauche); //translate to center of shape + context.rotate((Math.PI / 180) * (getAngle(i) + 90)); //rotate 25 degrees + context.translate(-xRotateGauche, -yRotateGauche); //translate center back to 0,0 + + // CERCLE 1 + context.beginPath(); + context.arc(xRotateGauche, yRotateGauche, 6, 0, 2 * Math.PI); + context.closePath(); + context.stroke(); + context.fillStyle = "#ccc"; //jaune + context.fill(); + // FLECHE 1 + context.beginPath(); + context.moveTo(xRotateGauche + 1, yRotateGauche + 4); + context.lineTo(xRotateGauche + 5, yRotateGauche); + context.lineTo(xRotateGauche + 1, yRotateGauche - 4); + context.closePath(); + context.stroke(); + context.fillStyle = "#fff"; //jaune + context.fill(); + // FLECHE 2 + context.beginPath(); + context.moveTo(xRotateGauche - 1, yRotateGauche + 4); + context.lineTo(xRotateGauche - 5, yRotateGauche); + context.lineTo(xRotateGauche - 1, yRotateGauche - 4); + context.closePath(); + context.stroke(); + context.fillStyle = "#fff"; //jaune + context.fill(); + + context.restore(); + + context.save(); + context.translate(xRotateDroit, yRotateDroit); //translate to center of shape + context.rotate((Math.PI / 180) * (getAngle(i) - 90)); //rotate 25 degrees + context.translate(-xRotateDroit, -yRotateDroit); //translate center back to 0,0 + + // CERCLE 1 + context.beginPath(); + context.arc(xRotateDroit, yRotateDroit, 6, 0, 2 * Math.PI); + context.closePath(); + context.fillStyle = "#ccc"; //gris + + context.stroke(); + context.fill(); + // FLECHE 1 + context.beginPath(); + context.moveTo(xRotateDroit + 1, yRotateDroit + 4); + context.lineTo(xRotateDroit + 5, yRotateDroit); + context.lineTo(xRotateDroit + 1, yRotateDroit - 4); + context.closePath(); + context.fillStyle = "#fff"; //blanc + context.stroke(); + context.fill(); + // FLECHE 2 + context.beginPath(); + context.moveTo(xRotateDroit - 1, yRotateDroit + 4); + context.lineTo(xRotateDroit - 5, yRotateDroit); + context.lineTo(xRotateDroit - 1, yRotateDroit - 4); + context.closePath(); + context.stroke(); + context.fillStyle = "#fff"; //blanc + context.fill(); + + context.restore(); +}