Revision: 5514 http://sourceforge.net/p/jump-pilot/code/5514 Author: ma15569 Date: 2017-10-21 17:08:39 +0000 (Sat, 21 Oct 2017) Log Message: ----------- Add ColorChooser plugin to repository with newer version of the plugin (ver. 0.9)
Added Paths: ----------- plug-ins/.classpath plug-ins/.project plug-ins/.settings/ plug-ins/.settings/org.eclipse.jdt.core.prefs plug-ins/Color_chooser/ plug-ins/Color_chooser/dist/ plug-ins/Color_chooser/dist/ColorChooser-0.8.jar plug-ins/Color_chooser/dist/ColorChooser-0.9.jar plug-ins/Color_chooser/trunk/ plug-ins/Color_chooser/trunk/src/ plug-ins/Color_chooser/trunk/src/famfamfam_icon_licence.txt plug-ins/Color_chooser/trunk/src/gimp_icon_license.txt plug-ins/Color_chooser/trunk/src/gpl.txt plug-ins/Color_chooser/trunk/src/language/ plug-ins/Color_chooser/trunk/src/language/I18NPlug.java plug-ins/Color_chooser/trunk/src/language/featurecolor.properties plug-ins/Color_chooser/trunk/src/language/featurecolor_de.properties plug-ins/Color_chooser/trunk/src/language/featurecolor_en.properties plug-ins/Color_chooser/trunk/src/language/featurecolor_es.properties plug-ins/Color_chooser/trunk/src/language/featurecolor_fi.properties plug-ins/Color_chooser/trunk/src/language/featurecolor_fr.properties plug-ins/Color_chooser/trunk/src/language/featurecolor_it.properties plug-ins/Color_chooser/trunk/src/org/ plug-ins/Color_chooser/trunk/src/org/openjump/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/FeatureColorChooserPlugIn.java plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickPlugIn.java plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickTool.java plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/color-swatch.png plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ColorMenu.java plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ComboButton.java plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color-cursor.gif plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color.png plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/ColorUtils.java plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/color.txt plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/extension/ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/extension/FeatureColorChooserExtension.java plug-ins/Color_chooser/trunk/src/readme.txt plug-ins/Color_chooser/trunk/src/workbench-properties.xml Added: plug-ins/.classpath =================================================================== --- plug-ins/.classpath (rev 0) +++ plug-ins/.classpath 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> + <classpathentry kind="output" path="bin"/> +</classpath> Property changes on: plug-ins/.classpath ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/.project =================================================================== --- plug-ins/.project (rev 0) +++ plug-ins/.project 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Source_plugIns</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Property changes on: plug-ins/.project ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/.settings/org.eclipse.jdt.core.prefs =================================================================== --- plug-ins/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ plug-ins/.settings/org.eclipse.jdt.core.prefs 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 Property changes on: plug-ins/.settings/org.eclipse.jdt.core.prefs ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/dist/ColorChooser-0.8.jar =================================================================== (Binary files differ) Index: plug-ins/Color_chooser/dist/ColorChooser-0.8.jar =================================================================== --- plug-ins/Color_chooser/dist/ColorChooser-0.8.jar 2017-10-18 21:53:21 UTC (rev 5513) +++ plug-ins/Color_chooser/dist/ColorChooser-0.8.jar 2017-10-21 17:08:39 UTC (rev 5514) Property changes on: plug-ins/Color_chooser/dist/ColorChooser-0.8.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/Color_chooser/dist/ColorChooser-0.9.jar =================================================================== (Binary files differ) Index: plug-ins/Color_chooser/dist/ColorChooser-0.9.jar =================================================================== --- plug-ins/Color_chooser/dist/ColorChooser-0.9.jar 2017-10-18 21:53:21 UTC (rev 5513) +++ plug-ins/Color_chooser/dist/ColorChooser-0.9.jar 2017-10-21 17:08:39 UTC (rev 5514) Property changes on: plug-ins/Color_chooser/dist/ColorChooser-0.9.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/famfamfam_icon_licence.txt =================================================================== --- plug-ins/Color_chooser/trunk/src/famfamfam_icon_licence.txt (rev 0) +++ plug-ins/Color_chooser/trunk/src/famfamfam_icon_licence.txt 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,22 @@ +Silk icon set 1.3 + +_________________________________________ +Mark James +http://www.famfamfam.com/lab/icons/silk/ +_________________________________________ + +This work is licensed under a +Creative Commons Attribution 2.5 License. +[ http://creativecommons.org/licenses/by/2.5/ ] + +This means you may use it for any purpose, +and make any changes you like. +All I ask is that you include a link back +to this page in your credits. + +Are you using this icon set? Send me an email +(including a link or picture if available) to +mja...@gmail.com + +Any other questions about this icon set please +contact mja...@gmail.com \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/famfamfam_icon_licence.txt ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/gimp_icon_license.txt =================================================================== --- plug-ins/Color_chooser/trunk/src/gimp_icon_license.txt (rev 0) +++ plug-ins/Color_chooser/trunk/src/gimp_icon_license.txt 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,31 @@ +pick-color.png and pick-color-cursor.gif derive from GIMP (https://www.gimp.org/) icon stock-color-picker-white-18.png + +Following GIMP License: + +* The GIMP application core, and other portions of the official GIMP + distribution not explicitly licensed otherwise, are licensed under + the GNU GENERAL PUBLIC LICENSE -- see the 'COPYING' file in this + directory for details. + +[ The below explicit exemption, we hope, clears up the GIMP + developers' position concerning an ambiguity with the GNU General + Public License concerning what constitutes a 'mere aggregation' + versus a combined or derived work. The intention is to make it + clear that arbitrarily-licensed programs such as GIMP plug-ins do + not automatically assume the GNU General Public License (GPL) + themselves simply because of their invokation of (or by) procedures + implemented in GPL-licensed code, via libgimp or a similar interface + to methods provided by the pdb: ] + +* If you create a program which invokes (or provides) methods within + (or for) the GPL GIMP application core through the medium of libgimp + or another implementation of the 'procedural database' (pdb) serial + protocol, then the GIMP developers' position is that this is a 'mere + aggregation' of the program invoking the method and the program + implementing the method as per section 2 of the GNU General Public + License. + +* 'libgimp' and the other GIMP libraries are licensed under the + GNU LESSER GENERAL PUBLIC LICENSE -- see the 'COPYING' file in the + libgimp directory for details. + Property changes on: plug-ins/Color_chooser/trunk/src/gimp_icon_license.txt ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/gpl.txt =================================================================== --- plug-ins/Color_chooser/trunk/src/gpl.txt (rev 0) +++ plug-ins/Color_chooser/trunk/src/gpl.txt 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) 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 +this service 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 make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. 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. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. + + 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 +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision 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, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This 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 Library General +Public License instead of this License. Property changes on: plug-ins/Color_chooser/trunk/src/gpl.txt ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/I18NPlug.java =================================================================== --- plug-ins/Color_chooser/trunk/src/language/I18NPlug.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/I18NPlug.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,24 @@ +package language; + +import com.vividsolutions.jump.I18N; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class I18NPlug +{ + private static final ResourceBundle I18N_RESOURCE = ResourceBundle.getBundle("language/featurecolor", new Locale(I18N.getLocale())); + + public static String getI18N(String key) { + try { + return I18N_RESOURCE.getString(key); + } catch (MissingResourceException ex) { + String[] labelpath = key.split("\\."); + ex.printStackTrace(); + return labelpath[(labelpath.length - 1)]; + } + catch (Exception ex) { + ex.printStackTrace(); + }return ""; + } +} \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/language/I18NPlug.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/featurecolor.properties =================================================================== --- plug-ins/Color_chooser/trunk/src/language/featurecolor.properties (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/featurecolor.properties 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,10 @@ +#featurecolor.properties +color= Colour +color-by-attribute = Colour by Attribute +choose-color = Choose Colour +msg1=No R_G_B attribute value found +msg2=Click on a feature to get the colour +picker-color = Colour Picker Tool +pick-color-tools=Colour Tools +set-color-Tool=Set Colour +selected-items-layers-must-be-editable=Selected items must be editable \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/language/featurecolor.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/featurecolor_de.properties =================================================================== --- plug-ins/Color_chooser/trunk/src/language/featurecolor_de.properties (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/featurecolor_de.properties 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,10 @@ +#featurecolor_de.properties +color= Farbe +color-by-attribute = Farbe durch Attribute +choose-color = W\u00E4hlen Sie Farbe +msg1=\#T\:No R_G_B attribute value found +msg2=\#T\:Click on a feature to get the colour +picker-color =\#T\:Colour Picker Tool +pick-color-tools=\#T\:Colour Tools +set-color-Tool=\#T\:Set Colour +selected-items-layers-must-be-editable=Ausgew\u00E4hlte Objekte m\u00FCssen bearbeitet werden \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/language/featurecolor_de.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/featurecolor_en.properties =================================================================== --- plug-ins/Color_chooser/trunk/src/language/featurecolor_en.properties (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/featurecolor_en.properties 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,10 @@ +#featurecolor.properties +color= Color +color-by-attribute = Color by Attribute +choose-color = Choose Color +msg1=No R_G_B attribute value found +msg2=Click on a feature to get the color +picker-color = Color Picker Tool +pick-color-tools=Color Tools +set-color-Tool=Set Color +selected-items-layers-must-be-editable=Selected items must be editable Property changes on: plug-ins/Color_chooser/trunk/src/language/featurecolor_en.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/featurecolor_es.properties =================================================================== --- plug-ins/Color_chooser/trunk/src/language/featurecolor_es.properties (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/featurecolor_es.properties 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,10 @@ +#featurecolor_es.properties +color= Color +color-by-attribute = Color por atributo +choose-color = Elija Color +msg1=No se encuenta ningun valor de atributo R_G_B +msg2=Haga clic en un elemento para campionar su color +picker-color = Herramineta para campionar color +pick-color-tools=Herraminetas colores +set-color-Tool=Aplicar color +selected-items-layers-must-be-editable=Los elementos seleccionados deben ser editables \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/language/featurecolor_es.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/featurecolor_fi.properties =================================================================== --- plug-ins/Color_chooser/trunk/src/language/featurecolor_fi.properties (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/featurecolor_fi.properties 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,10 @@ +#featurecolor_fi.properties +color= V\u00E4ri +color-by-attribute = V\u00E4ri ominaisuustiedoista +choose-color = Valitse v\u00e4ri +msg1=No R_G_B attribute value found +msg2=Click on a feature to get the color +picker-color = Color Picker Tool +pick-color-tools=Color Tools +set-color-Tool=V\u00E4rity\u00F6kalu +selected-items-layers-must-be-editable=Valittujen kohteiden t\u00E4ytyy olla muokattavissa \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/language/featurecolor_fi.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/featurecolor_fr.properties =================================================================== --- plug-ins/Color_chooser/trunk/src/language/featurecolor_fr.properties (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/featurecolor_fr.properties 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,10 @@ +#featurecolor_fr.properties +color= Couleur +color-by-attribute = Couleur par Attribut +choose-color = Choisir la couleur +msg1=Aucune valeur d'attribut R_G_B trouv\xE9e +msg2=Cliquez sur une \u00e9l\u00e9ment pour obtenir la couleur +picker-color = Outil pour s\xE9lectionner la couleur +pick-color-tools=Outils couleur +set-color-Tool=Couleur +selected-items-layers-must-be-editable=Les \u00E9l\u00E9ments s\u00E9lectionn\u00E9s doivent \u00EAtre modifiables \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/language/featurecolor_fr.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/language/featurecolor_it.properties =================================================================== --- plug-ins/Color_chooser/trunk/src/language/featurecolor_it.properties (rev 0) +++ plug-ins/Color_chooser/trunk/src/language/featurecolor_it.properties 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,10 @@ +#featurecolor_it.properties +color= Colore +color-by-attribute = Colore per attributo +choose-color = Scegli colore +msg1=Nessun valore attributo R_G_B trovato +msg2=Clicca su un elemento per campionare il colore +picker-color = Strumento campiona colore +pick-color-tools=Strumenti colore +set-color-Tool=Imposta colore +selected-items-layers-must-be-editable=Gli elementi selezionati devono essere modificabili Property changes on: plug-ins/Color_chooser/trunk/src/language/featurecolor_it.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/FeatureColorChooserPlugIn.java =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/FeatureColorChooserPlugIn.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/FeatureColorChooserPlugIn.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,414 @@ +package org.openjump.core.ui.plugin.colorchooser; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; + +import language.I18NPlug; + +import org.openjump.core.ui.plugin.colorchooser.gui.ColorMenu; +import org.openjump.core.ui.plugin.colorchooser.gui.ComboButton; +import org.openjump.core.ui.plugin.colorchooser.utils.ColorUtils; + +import com.vividsolutions.jump.feature.AttributeType; +import com.vividsolutions.jump.feature.Feature; +import com.vividsolutions.jump.feature.FeatureCollectionWrapper; +import com.vividsolutions.jump.feature.FeatureSchema; +import com.vividsolutions.jump.workbench.WorkbenchContext; +import com.vividsolutions.jump.workbench.model.FeatureEventType; +import com.vividsolutions.jump.workbench.model.Layer; +import com.vividsolutions.jump.workbench.model.LayerManager; +import com.vividsolutions.jump.workbench.model.UndoableCommand; +import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn; +import com.vividsolutions.jump.workbench.plugin.EnableCheck; +import com.vividsolutions.jump.workbench.plugin.EnableCheckFactory; +import com.vividsolutions.jump.workbench.plugin.MultiEnableCheck; +import com.vividsolutions.jump.workbench.plugin.PlugInContext; +import com.vividsolutions.jump.workbench.ui.GUIUtil; +import com.vividsolutions.jump.workbench.ui.LayerViewPanel; +import com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle; +import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager; + +public class FeatureColorChooserPlugIn extends AbstractPlugIn { + private int buttonWidth = 25; + private PlugInContext context; + public static ComboButton colorChooserButton; + public static ComboButton colorSetbutton; + private JPopupMenu colorPickerPopup = new JPopupMenu(); + + public static JMenuItem mi; + public static final String COLOR = "COLOR"; + public static final String R_G_B = BasicStyle.RGB_ATTRIBUTE_NAME; + private TaskMonitorManager taskMonitorManager; + + @Override + public void initialize(final PlugInContext context) throws Exception { + this.context = context; + this.colorSetbutton = new ComboButton(1) { + private static final long serialVersionUID = 1L; + + @Override + public void setBounds(int x, int y, int width, int height) { + super.setBounds(x, y, + FeatureColorChooserPlugIn.this.buttonWidth, height); + } + }; + this.colorChooserButton = new ComboButton(0) { + private static final long serialVersionUID = 1L; + + @Override + public void setBounds(int x, int y, int width, int height) { + super.setBounds(colorSetbutton.getX() + buttonWidth, y, + buttonWidth, height); + } + }; + colorSetbutton.addMouseListener(new MouseListener() { + @Override + public void mouseClicked(MouseEvent e) { + FeatureColorChooserPlugIn.this.setFeatureColor(colorSetbutton + .getColor()); + } + + @Override + public void mousePressed(MouseEvent e) { + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + }); + + colorChooserButton.addMouseListener(new MouseListener() { + @Override + public void mousePressed(MouseEvent e) { + int x = colorSetbutton.getLocation().x; + int y = colorSetbutton.getLocation().y + + colorSetbutton.getHeight(); + FeatureColorChooserPlugIn.this.colorPickerPopup.show( + colorSetbutton.getParent(), x, y); + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + }); + + JPopupMenu popup = new JPopupMenu(); + popup.setLayout(new GridLayout(0, 1)); + mi = new JMenuItem(I18NPlug.getI18N("color-by-attribute"), + new ColorIcon(null)); + mi.addActionListener(new ColorPickerActionListener(null)); + popup.add(mi); + final ColorMenu cm = new ColorMenu(I18NPlug.getI18N("choose-color")); + cm.setIcon(getColorIcon()); + + cm.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Color color = cm.getColor(); + if (color != null) { + colorSetbutton.setColor(color); + setFeatureColor(color); + cm.addActionListener(new ColorPickerActionListener(color)); + } + } + }); + + popup.add(cm); + + mi = new JMenuItem(I18NPlug.getI18N("picker-color"), getPickColorIcon()); + PickPlugIn pick = new PickPlugIn(); + mi.setToolTipText(I18NPlug.getI18N("msg2")); + final ActionListener listener = AbstractPlugIn.toActionListener(pick, + context.getWorkbenchContext(), taskMonitorManager); + mi.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + listener.actionPerformed(e); + } + }); + popup.add(mi); + + this.colorPickerPopup = popup; + colorSetbutton.setToolTipText(I18NPlug.getI18N("set-color-Tool")); + colorChooserButton.setToolTipText(I18NPlug.getI18N("pick-color-tools")); + context.getWorkbenchContext().getWorkbench().getFrame().getToolBar() + .addSeparator(); + context.getWorkbenchContext().getWorkbench().getFrame().getToolBar() + .add(colorSetbutton); + context.getWorkbenchContext().getWorkbench().getFrame().getToolBar() + .add(colorChooserButton); + context.getWorkbenchContext().getWorkbench().getFrame().getToolBar() + .addSeparator(); + + } + + public Icon getColorIcon() { + ImageIcon icon = new ImageIcon(getClass().getResource( + "color-swatch.png")); + return GUIUtil.toSmallIcon(icon); + } + + public Icon getPickColorIcon() { + ImageIcon icon2 = new ImageIcon(getClass() + .getResource("pick-color.png")); + return GUIUtil.toSmallIcon(icon2); + } + + private void setFeatureColor(Color color) { + LayerViewPanel layerViewPanel = this.context.getWorkbenchContext() + .getLayerViewPanel(); + if (layerViewPanel == null) + return; + Collection<Layer> layers = layerViewPanel.getSelectionManager() + .getLayersWithSelectedItems(); + + for (Iterator<Layer> i = layers.iterator(); i.hasNext();) { + Layer layer = i.next(); + if (layer.isEditable()) + continue; + layerViewPanel.getContext().warnUser( + I18NPlug.getI18N("selected-items-layers-must-be-editable") + + " (" + layer.getName() + ")"); + return; + } + + for (Iterator<Layer> i = layers.iterator(); i.hasNext();) { + Layer layer = i.next(); + layer.setFeatureCollectionModified(true); + FeatureCollectionWrapper fcw = layer.getFeatureCollectionWrapper(); + FeatureSchema schema = fcw.getFeatureSchema(); + + if (schema.hasAttribute(R_G_B)) + continue; + schema.addAttribute(R_G_B, AttributeType.STRING); + + for (Iterator j = fcw.iterator(); j.hasNext();) { + Feature feature = (Feature) j.next(); + Object[] attributes = new Object[schema.getAttributeCount()]; + + for (int k = 0; k < attributes.length - 1; k++) { + attributes[k] = feature.getAttribute(k); + } + feature.setAttributes(attributes); + } + + if (schema.hasAttribute(COLOR)) + continue; + schema.addAttribute(COLOR, AttributeType.STRING); // .INTEGER); + for (Iterator j = fcw.iterator(); j.hasNext();) { + Feature feature = (Feature) j.next(); + Object[] attributes = new Object[schema.getAttributeCount()]; + + for (int k = 0; k < attributes.length - 1; k++) { + attributes[k] = feature.getAttribute(k); + } + feature.setAttributes(attributes); + } + } + + Collection features = layerViewPanel.getSelectionManager() + .getFeaturesWithSelectedItems(); + setRGB(layers, features, ColorUtils.colorRGBToHex(color)); + } + + public static FeatureSchema createFeatureSchema() { + return new FeatureSchema() { + + private static final long serialVersionUID = 1L; + }; + } + + protected void setRGB(final Collection layers, final Collection features, + String RGB) { + if (layers.isEmpty()) + return; + final String newRGB = RGB; + final ArrayList RGBs = new ArrayList(); + final ArrayList Colors = new ArrayList(); + + for (Iterator f = features.iterator(); f.hasNext();) { + Feature feature = (Feature) f.next(); + RGBs.add(feature.getAttribute(R_G_B)); + Colors.add(feature.getAttribute(COLOR)); + } + + final LayerManager layerManager = ((Layer) layers.iterator().next()) + .getLayerManager(); + layerManager.getUndoableEditReceiver().startReceiving(); + + try { + UndoableCommand command = new UndoableCommand("Edit R_G_B") { + @Override + public void execute() { + for (Iterator f = features.iterator(); f.hasNext();) { + Feature feature = (Feature) f.next(); + feature.setAttribute(R_G_B, newRGB); + feature.setAttribute(COLOR, + ColorUtils.getColorIndexRegistry(newRGB)); + } + + for (Iterator i = layers.iterator(); i.hasNext();) { + Layer layer = (Layer) i.next(); + layer.fireAppearanceChanged(); + layerManager.fireFeaturesChanged( + Arrays.asList(features.toArray()), + FeatureEventType.ATTRIBUTES_MODIFIED, layer); + } + + } + + @Override + public void unexecute() { + int i = 0; + for (Iterator f = features.iterator(); f.hasNext();) { + Feature feature = (Feature) f.next(); + Object ob = RGBs.get(i++); + feature.setAttribute(R_G_B, ob); + String oldRGB = ob.toString(); + feature.setAttribute(COLOR, + ColorUtils.getColorIndexRegistry(oldRGB)); + } + + for (Iterator j = layers.iterator(); j.hasNext();) { + Layer layer = (Layer) j.next(); + layer.fireAppearanceChanged(); + layerManager.fireFeaturesChanged( + Arrays.asList(features.toArray()), + FeatureEventType.ATTRIBUTES_MODIFIED, layer); + } + } + }; + command.execute(); + layerManager.getUndoableEditReceiver().receive( + command.toUndoableEdit()); + } finally { + layerManager.getUndoableEditReceiver().stopReceiving(); + } + } + + /* + * public static FeatureSchema getSchema(FeatureSchema featureSchema) { + * featureSchema.addAttribute(R_G_B, AttributeType.STRING); + * featureSchema.addAttribute(COLOR, AttributeType.INTEGER); return + * featureSchema; } + */ + + @Override + public boolean execute(PlugInContext context) throws Exception { + return true; + } + + public static EnableCheck createEnableCheck( + WorkbenchContext workbenchContext, boolean b) { + EnableCheckFactory checkFactory = new EnableCheckFactory( + workbenchContext); + + return new MultiEnableCheck().add( + checkFactory.createWindowWithLayerViewPanelMustBeActiveCheck()) + .add(checkFactory.createAtLeastNLayersMustBeEditableCheck(1)); + } + + private class ColorIcon implements Icon { + private Color color = null; + + public ColorIcon(Color color) { + this.color = color; + } + + @Override + public int getIconHeight() { + return 10; + } + + @Override + public int getIconWidth() { + return 10; + } + + @Override + public void paintIcon(Component comp, Graphics g, int x, int y) { + Color oldColor = g.getColor(); + + int j = 0; + int size = Math.max(getIconHeight(), 2); + g.translate(x, y); + + if (this.color == null) + g.setColor(new Color(0, 0, 0)); + else { + g.setColor(this.color); + } + j = 0; + + if (this.color == null) { + g.drawLine(0, 8, 5, 8); + g.drawLine(5, 8, 5, 7); + g.drawLine(1, 8, 1, 1); + g.drawLine(0, 1, 2, 1); + } else { + for (int i = size - 1; i >= 0; i--) { + g.drawLine(0, j, 7, j); + j++; + } + } + g.translate(-x, -y); + g.setColor(oldColor); + } + } + + public class ColorPickerActionListener implements ActionListener { + Color color = null; + + ColorPickerActionListener(Color color) { + this.color = color; + } + + @Override + public void actionPerformed(ActionEvent e) { + colorSetbutton.setColor(this.color); + String hex = ColorUtils.colorRGBToHex(this.color); + String acad = ColorUtils.getColorIndexRegistry(hex); + colorSetbutton.setToolTipText("Index color: " + acad + " Hex:" + + hex + " RGB: " + this.color.getRed() + "," + + this.color.getGreen() + "," + this.color.getBlue()); + FeatureColorChooserPlugIn.this.setFeatureColor(this.color); + } + } + +} \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/FeatureColorChooserPlugIn.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickPlugIn.java =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickPlugIn.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickPlugIn.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,87 @@ +/* + * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI + * for visualizing and manipulating spatial features with geometry and attributes. + * + * JUMP is Copyright (C) 2003 Vivid Solutions + * + * This program implements extensions to JUMP and is + * Copyright (C) 2004 Integrated Systems Analysts, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For more information, contact: + * + * Integrated Systems Analysts, Inc. + * 630C Anchors St., Suite 101 + * Fort Walton Beach, Florida + * USA + * + * (850)862-7321 + * www.ashs.isa.com + */ + +package org.openjump.core.ui.plugin.colorchooser; + +import javax.swing.Icon; + +import com.vividsolutions.jump.I18N; +import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn; +import com.vividsolutions.jump.workbench.plugin.PlugInContext; +import com.vividsolutions.jump.workbench.ui.MenuNames; +import com.vividsolutions.jump.workbench.ui.images.IconLoader; + +public class PickPlugIn extends AbstractPlugIn { + + private final static String sErrorSeeOutputWindow = I18N + .get("org.openjump.core.ui.plugin.tools.MeasureM_FPlugIn.Error-see-output-window"); + + public void initialize(PlugInContext context) throws Exception { + + context.getFeatureInstaller() + .addMainMenuPlugin( + this, + new String[] { MenuNames.RASTER }, + // new String[] {MenuNames.PLUGINS, + // I18NPlug.getI18N("RasterInfo_Extension")}, + I18N.get("org.openjump.core.ui.plugin.raster.RasterQueryPlugIn"), + false, getIcon(), null); + + } + + public boolean execute(PlugInContext context) throws Exception { + try { + + context.getLayerViewPanel().setCurrentCursorTool(new PickTool()); + return true; + } catch (Exception e) { + e.printStackTrace(); + context.getWorkbenchFrame().warnUser(sErrorSeeOutputWindow); + context.getWorkbenchFrame().getOutputFrame().createNewDocument(); + context.getWorkbenchFrame().getOutputFrame() + .addText("MeasureM_FPlugIn Exception:" + e.toString()); + return false; + } + } + + /* + * private Icon getIcon() { + * + * return IconLoader.icon("Raster_Info.png"); } + */ + public Icon getIcon() { + return IconLoader.icon("grid_info.png"); + } + +} Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickPlugIn.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickTool.java =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickTool.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickTool.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,123 @@ +package org.openjump.core.ui.plugin.colorchooser; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.geom.NoninvertibleTransformException; +import java.awt.geom.Point2D; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +import javax.swing.Icon; +import javax.swing.ImageIcon; + +import language.I18NPlug; + +import org.openjump.core.ui.plugin.colorchooser.utils.ColorUtils; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jump.feature.Feature; +import com.vividsolutions.jump.feature.FeatureCollectionWrapper; +import com.vividsolutions.jump.feature.FeatureSchema; +import com.vividsolutions.jump.geom.EnvelopeUtil; +import com.vividsolutions.jump.workbench.WorkbenchContext; +import com.vividsolutions.jump.workbench.model.Layer; +import com.vividsolutions.jump.workbench.ui.cursortool.NClickTool; +import com.vividsolutions.jump.workbench.ui.cursortool.SpecifyFeaturesTool; +import com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle; + +/* + * [Giuseppe Aruta 2016_12_4] Pick tool allows to get RGB value (if exist) + * by clicking on a feature of a selected layer + * This tool is distributed under GNU license + */ +public class PickTool extends NClickTool { + public PickTool() { + super(1); + + } + + public static final String R_G_B = BasicStyle.RGB_ATTRIBUTE_NAME; + + protected Point getPoint() throws NoninvertibleTransformException { + return new GeometryFactory().createPoint((Coordinate) getCoordinates() + .get(0)); + } + + protected void gestureFinished() throws Exception { + reportNothingToUndoYet(); + try { + final WorkbenchContext wbcontext = this.getWorkbench().getContext(); + Layer layer = wbcontext.createPlugInContext().getSelectedLayer(0); + FeatureCollectionWrapper fcw = layer.getFeatureCollectionWrapper(); + FeatureSchema schema = fcw.getFeatureSchema(); + Coordinate coord = (Coordinate) getCoordinates().get(0); + Point2D point = getPanel().getViewport().toViewPoint(coord); + int PIXEL_BUFFER = 2; + // if (schema.hasAttribute(R_G_B)) { + Map map = SpecifyFeaturesTool.layerToSpecifiedFeaturesMap(panel + .getLayerManager().iterator(), EnvelopeUtil.expand( + new Envelope(panel.getViewport().toModelCoordinate(point)), + PIXEL_BUFFER / panel.getViewport().getScale())); + + String hex = findValue(R_G_B, map); + Color color = ColorUtils.hexToColorRGB(hex); + FeatureColorChooserPlugIn.colorSetbutton.setColor(color); + + String acad = ColorUtils.getColorIndexRegistry(hex); + this.getWorkbench() + .getContext() + .getWorkbench() + .getFrame() + .setStatusMessage( + I18NPlug.getI18N("color") + " - " + "Index color: " + + acad + " Hex: " + hex + " RGB: " + + color.getRed() + "," + color.getGreen() + + "," + color.getBlue(), 5000); + + } catch (Exception e) { + this.getWorkbench().getContext().getWorkbench().getFrame() + .setStatusMessage(I18NPlug.getI18N("msg1"), 5000); + } + } + + @Override + public Icon getIcon() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Cursor getCursor() { + return createCursor(new ImageIcon(getClass().getResource( + "pick-color-cursor.gif")).getImage()); //$NON-NLS-1$ + } + + private String findValue(String attributeName, + Map layerToSpecifiedFeaturesMap) { + for (Iterator i = layerToSpecifiedFeaturesMap.keySet().iterator(); i + .hasNext();) { + Layer layer = (Layer) i.next(); + for (int j = 0; j < layer.getFeatureCollectionWrapper() + .getFeatureSchema().getAttributeCount(); j++) { + if ("fid".equalsIgnoreCase(attributeName)) { + return "" + + ((Feature) ((Collection) layerToSpecifiedFeaturesMap + .get(layer)).iterator().next()).getID(); + } + if (layer.getFeatureCollectionWrapper().getFeatureSchema() + .getAttributeName(j).equalsIgnoreCase(attributeName)) { + return "" + + ((Feature) ((Collection) layerToSpecifiedFeaturesMap + .get(layer)).iterator().next()) + .getAttribute(j); + } + } + } + return ""; + } + +} Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/PickTool.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/color-swatch.png =================================================================== (Binary files differ) Index: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/color-swatch.png =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/color-swatch.png 2017-10-18 21:53:21 UTC (rev 5513) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/color-swatch.png 2017-10-21 17:08:39 UTC (rev 5514) Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/color-swatch.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ColorMenu.java =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ColorMenu.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ColorMenu.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,272 @@ +package org.openjump.core.ui.plugin.colorchooser.gui; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Hashtable; + +import javax.swing.BorderFactory; +import javax.swing.JMenu; +import javax.swing.JPanel; +import javax.swing.MenuSelectionManager; +import javax.swing.border.BevelBorder; +import javax.swing.border.Border; +import javax.swing.border.CompoundBorder; +import javax.swing.border.EmptyBorder; +import javax.swing.border.MatteBorder; + +import org.openjump.core.ui.plugin.colorchooser.utils.ColorUtils; + +public class ColorMenu extends JMenu { + /* + * Modified from: Swing, Second Edition 2nd Edition by James Gosling + * (Foreword), Matthew Robinson (Author), Pavel Vorobiev (Author), Pavel A + * Vorobiev PhD (Author), David Anderson (Author), David Karr (Author) + * https://www.grandt.com/sbe/files/swing2e/Chapter12.zip + * https://www.grandt.com/sbe/files/uts2/Chapter12html/Chapter12.htm + */ + private static final long serialVersionUID = 1L; + protected Border m_unselectedBorder; + protected Border m_selectedBorder; + protected Border m_activeBorder; + + protected Hashtable<Color, ColorPane> m_panes; + protected ColorPane m_selected; + + public ColorMenu(String name) { + super(name); + m_unselectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, + getBackground()), new BevelBorder(BevelBorder.LOWERED, + Color.white, Color.gray)); + m_selectedBorder = new CompoundBorder(new MatteBorder(2, 2, 2, 2, + Color.red), new MatteBorder(1, 1, 1, 1, getBackground())); + m_activeBorder = new CompoundBorder(new MatteBorder(2, 2, 2, 2, + Color.blue), new MatteBorder(1, 1, 1, 1, getBackground())); + + m_panes = new Hashtable<Color, ColorPane>(); + ColorPane pn = null; + + /* + * First the darkest colors palette. + */ + JPanel p = new JPanel(); + p.setBorder(new EmptyBorder(1, 1, 1, 1)); + p.setLayout(new GridLayout(5, 24)); + for (int r = 18; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + p.add(pn); + m_panes.put(c, pn); + } + for (int r = 16; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + p.add(pn); + m_panes.put(c, pn); + } + for (int r = 14; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + p.add(pn); + m_panes.put(c, pn); + } + for (int r = 12; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + p.add(pn); + m_panes.put(c, pn); + } + for (int r = 10; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + p.add(pn); + m_panes.put(c, pn); + } + /* + * Then the brighter colors palette + */ + + JPanel pb = new JPanel(); + pb.setBorder(new EmptyBorder(1, 1, 1, 1)); + pb.setLayout(new GridLayout(5, 24)); + for (int r = 11; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + pb.add(pn); + m_panes.put(c, pn); + } + for (int r = 13; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + pb.add(pn); + m_panes.put(c, pn); + } + for (int r = 15; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + pb.add(pn); + m_panes.put(c, pn); + } + for (int r = 17; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + pb.add(pn); + m_panes.put(c, pn); + } + for (int r = 19; r < 250; r += 10) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + pb.add(pn); + m_panes.put(c, pn); + } + + JPanel pmain = new JPanel(); + pmain.setBorder(BorderFactory.createTitledBorder("Full color palette")); + pmain.add(p); + pmain.add(pb); + + /* + * Than the main 11 colors + */ + JPanel p2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + p2.setBorder(new EmptyBorder(1, 1, 1, 1)); + p2.setAlignmentX(Component.RIGHT_ALIGNMENT); + // p2.setLayout(new GridLayout(1, 10)); + for (int r = 0; r < 10; r++) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + p2.add(pn); + m_panes.put(c, pn); + } + + /* + * The last line with the greys + */ + JPanel p3 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + p3.setBorder(new EmptyBorder(1, 1, 1, 1)); + p3.setAlignmentX(Component.RIGHT_ALIGNMENT); + // p2.setLayout(new GridLayout(1, 10)); + for (int r = 250; r < 256; r++) { + String hex = ColorUtils.getColorIndexRegistry(String.valueOf(r)); + Color c = Color.decode("0x" + hex); + pn = new ColorPane(c); + p3.add(pn); + m_panes.put(c, pn); + } + + add(p); + add(pb); + add(p2); + add(p3); + } + + public void setColor(Color c) { + Object obj = m_panes.get(c); + if (obj == null) + return; + if (m_selected != null) + m_selected.setSelected(false); + m_selected = (ColorPane) obj; + m_selected.setSelected(true); + } + + public Color getColor() { + if (m_selected == null) + return null; + return m_selected.getColor(); + } + + public void doSelection() { + fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, + getActionCommand())); + } + + class ColorPane extends JPanel implements MouseListener { + protected Color m_c; + protected boolean m_selected; + + public ColorPane(Color c) { + m_c = c; + setBackground(c); + setBorder(m_unselectedBorder); + String hex = ColorUtils.colorRGBToHex(c); + String acad = ColorUtils.getColorIndexRegistry(hex); + String msg = "Index color: " + acad + " Hex: " + hex + " RGB: " + + c.getRed() + "," + c.getGreen() + "," + c.getBlue(); + setToolTipText(msg); + addMouseListener(this); + } + + public Color getColor() { + return m_c; + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(20, 20); + } + + @Override + public Dimension getMaximumSize() { + return getPreferredSize(); + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public void setSelected(boolean selected) { + m_selected = selected; + if (m_selected) + setBorder(m_selectedBorder); + else + setBorder(m_unselectedBorder); + } + + public boolean isSelected() { + return m_selected; + } + + @Override + public void mousePressed(MouseEvent e) { + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mouseReleased(MouseEvent e) { + setColor(m_c); + MenuSelectionManager.defaultManager().clearSelectedPath(); + doSelection(); + } + + @Override + public void mouseEntered(MouseEvent e) { + setBorder(m_activeBorder); + } + + @Override + public void mouseExited(MouseEvent e) { + setBorder(m_selected ? m_selectedBorder : m_unselectedBorder); + } + } +} \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ColorMenu.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ComboButton.java =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ComboButton.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ComboButton.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,183 @@ +package org.openjump.core.ui.plugin.colorchooser.gui; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +import javax.swing.JButton; +import javax.swing.UIManager; +import javax.swing.border.Border; + +public class ComboButton extends JButton { + /** + * + */ + private static final long serialVersionUID = 1L; + static final int TRIANGLE = 0; + static final int RECTANGLE = 1; + private Color color = null; + private int symbol = 0; + protected Border m_unselectedBorder; + + public ComboButton(int symbol) { + if ((symbol >= 0) && (symbol <= 1)) + this.symbol = symbol; + setRequestFocusEnabled(false); + + } + + public void setColor(Color color) { + this.color = color; + repaint(); + } + + public Color getColor() { + return this.color; + } + + @Override + public void paint(Graphics g) { + int w = getSize().width; + int h = getSize().height; + Color origColor = g.getColor(); + boolean isPressed = getModel().isPressed(); + boolean isEnabled = isEnabled(); + + if ((h < 5) || (w < 5)) { + g.setColor(origColor); + return; + } + + if (isPressed) { + g.translate(1, 1); + } + + super.paint(g); + + int size = Math.min((h - 4) / 3, (w - 4) / 3); + size = Math.max(size, 2); + if (this.symbol == 0) + paintTriangle(g, (w - size) / 2, (h - size) / 2, size, isEnabled); + else { + paintRectangle(g, (w - size) / 2, (h - size) / 2, size, isEnabled); + } + + if (isPressed) { + g.translate(-1, -1); + } + + g.setColor(origColor); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(25, 25); + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + @Override + public Dimension getMaximumSize() { + return getPreferredSize(); + } + + @Override + public boolean isFocusTraversable() { + return false; + } + + private void paintTriangle(Graphics g, int x, int y, int size, + boolean isEnabled) { + Color oldColor = g.getColor(); + + int j = 0; + size = Math.max(size, 2); + int mid = size / 2; + g.translate(x, y); + + if (isEnabled) + g.setColor(UIManager.getColor("controlDkShadow")); + else { + g.setColor(UIManager.getColor("controlShadow")); + } + if (!isEnabled) { + g.translate(1, 1); + g.setColor(UIManager.getColor("controlLtHighlight")); + + for (int i = size - 1; i >= 0; i--) { + g.drawLine(mid - i, j, mid + i, j); + j++; + } + + g.translate(-1, -1); + g.setColor(UIManager.getColor("controlShadow")); + } + + j = 0; + + for (int i = size - 1; i >= 0; i--) { + g.drawLine(mid - i, j, mid + i, j); + j++; + } + + g.translate(-x, -y); + g.setColor(oldColor); + } + + private void paintRectangle(Graphics g, int x, int y, int size, + boolean isEnabled) { + Color oldColor = g.getColor(); + + int j = 0; + size = Math.max(size, 2); + g.translate(x, y); + + if (isEnabled) { + if (this.color == null) + g.setColor(new Color(0, 0, 0)); + else + g.setColor(this.color); + } else + g.setColor(UIManager.getColor("controlShadow")); + + if (!isEnabled) { + g.translate(1, 1); + g.setColor(UIManager.getColor("controlLtHighlight")); + + if (this.color == null) { + g.drawLine(0, 7, 5, 7); + g.drawLine(5, 7, 5, 6); + g.drawLine(1, 7, 1, 0); + g.drawLine(0, 0, 2, 0); + } else { + for (int i = size - 1; i >= 0; i--) { + g.drawLine(0, j, 7, j); + j++; + } + } + + g.translate(-1, -1); + g.setColor(UIManager.getColor("controlShadow")); + } + + j = 0; + + if (this.color == null) { + g.drawLine(0, 7, 5, 7); + g.drawLine(5, 7, 5, 6); + g.drawLine(1, 7, 1, 0); + g.drawLine(0, 0, 2, 0); + } else { + for (int i = size - 1; i >= 0; i--) { + g.drawLine(0, j, 7, j); + j++; + } + } + + g.translate(-x, -y); + g.setColor(oldColor); + } +} \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/gui/ComboButton.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color-cursor.gif =================================================================== (Binary files differ) Index: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color-cursor.gif =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color-cursor.gif 2017-10-18 21:53:21 UTC (rev 5513) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color-cursor.gif 2017-10-21 17:08:39 UTC (rev 5514) Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color-cursor.gif ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color.png =================================================================== (Binary files differ) Index: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color.png =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color.png 2017-10-18 21:53:21 UTC (rev 5513) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color.png 2017-10-21 17:08:39 UTC (rev 5514) Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/pick-color.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/ColorUtils.java =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/ColorUtils.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/ColorUtils.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,121 @@ +package org.openjump.core.ui.plugin.colorchooser.utils; + +import java.awt.Color; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Scanner; + +public class ColorUtils { + + public static String getColorIndexRegistry(String searchQuery) { + + InputStream is = ColorUtils.class.getResourceAsStream("color.txt"); + InputStreamReader isr = new InputStreamReader(is); + String ColorDef = ""; + Scanner scanner = null; + String line2 = ""; + try { + scanner = new Scanner(isr); + while (scanner.hasNextLine()) { + scanner.useDelimiter("\\n"); + String line = scanner.nextLine(); + if (line.toLowerCase().contains( + "<" + searchQuery.toLowerCase() + ">")) + + { + line2 = line.replaceAll("<" + searchQuery.toLowerCase() + + ">", ""); + int start = line2.indexOf('<'); + int end = line2.indexOf('>', start); + String def = line2.substring(start + 1, end); + try { + + // EPSG code between 0 and 32767 + ColorDef = def.replaceAll("[<\\>]", "").replaceAll(";", + ""); + + // Non numeral SRID like INGF + } catch (NumberFormatException e) { + ColorDef = ""; + } + break; + } else { + + ColorDef = ""; + } + } + } finally { + try { + if (scanner != null) + scanner.close(); + } catch (Exception e) { + System.err.println("Exception while closing scanner " + + e.toString()); + } + } + return ColorDef; + } + + /** + * get hexadecimal color value (es FFFFFF) from color.java class (in this + * case Color.black) + * + * @param Color + * @return String + */ + + public static String colorRGBToHex(Color color) { + if (color == null) { + return ""; + } + int r = color.getRed(); + int g = color.getGreen(); + int b = color.getBlue(); + String rHex = Integer.toHexString(r).toUpperCase(); + String gHex = Integer.toHexString(g).toUpperCase(); + String bHex = Integer.toHexString(b).toUpperCase(); + if (rHex.length() < 2) + rHex = "0" + rHex; + if (gHex.length() < 2) + gHex = "0" + gHex; + if (bHex.length() < 2) + bHex = "0" + bHex; + return rHex + gHex + bHex; + } + + /** + * get Color.java (ex. color.black) from hexadecimal value (es. FFFFFF) + * + * @param String + * @return Color + */ + public static Color hexToColorRGB(String hex) { + hex = "#" + hex; + return new Color(Integer.valueOf(hex.substring(1, 3), 16), + Integer.valueOf(hex.substring(3, 5), 16), Integer.valueOf( + hex.substring(5, 7), 16)); + } + + /** + * Convert hexadecimal String (ex. "FFFFFF") color to RGB String (ex. + * "0,0,0") + * + * @param String + * @return String + */ + public static String hex2Rgb(String hex) { + hex = "#" + hex; + Color c = new Color(Integer.valueOf(hex.substring(1, 3), 16), + Integer.valueOf(hex.substring(3, 5), 16), Integer.valueOf( + hex.substring(5, 7), 16)); + + StringBuffer sb = new StringBuffer(); + sb.append(c.getRed()); + sb.append(","); + sb.append(c.getGreen()); + sb.append(","); + sb.append(c.getBlue()); + return sb.toString(); + } + +} Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/ColorUtils.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/color.txt =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/color.txt (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/color.txt 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,262 @@ +#This is a list of AutoCAD Color Index (ACI) RGB equivalents (Hexadecimal) +# Hexadecimal RGB color index is internally used by OpenJUMP +# to define feature color. +# 256 is +#The list derives from http://www.isctex.com/acadcolors.php +<0>;<000000> +<1>;<FF0000> +<2>;<FFFF00> +<3>;<00FF00> +<4>;<00E1E1> +<5>;<0000FF> +<6>;<FF00FF> +<7>;<FFFFFF> +<8>;<414141> +<9>;<808080> +<10>;<FF0000> +<11>;<FFAAAA> +<12>;<BD0000> +<13>;<BD7E7E> +<14>;<810000> +<15>;<815656> +<16>;<680000> +<17>;<684545> +<18>;<4F0000> +<19>;<4F3535> +<20>;<FF3F00> +<21>;<FFBFAA> +<22>;<BD2E00> +<23>;<BD8D7E> +<24>;<811F00> +<25>;<816056> +<26>;<681900> +<27>;<684E45> +<28>;<4F1300> +<29>;<4F3B35> +<30>;<FF7F00> +<31>;<FFD4AA> +<32>;<BD5E00> +<33>;<BD9D7E> +<34>;<814000> +<35>;<816B56> +<36>;<683400> +<37>;<685645> +<38>;<4F2700> +<39>;<4F4235> +<40>;<FFBF00> +<41>;<FFEAAA> +<42>;<BD8D00> +<43>;<BDAD7E> +<44>;<816000> +<45>;<817656> +<46>;<684E00> +<47>;<685F45> +<48>;<4F3B00> +<49>;<4F4935> +<50>;<FFFF00> +<51>;<FFFFAA> +<52>;<BDBD00> +<53>;<BDBD7E> +<54>;<818100> +<55>;<818156> +<56>;<686800> +<57>;<686845> +<58>;<4F4F00> +<59>;<4F4F35> +<60>;<BFFF00> +<61>;<EAFFAA> +<62>;<8DBD00> +<63>;<ADBD7E> +<64>;<06810> +<65>;<768156> +<66>;<4E6800> +<67>;<5F6845> +<68>;<3B4F00> +<69>;<494F35> +<70>;<7FFF00> +<71>;<D4FFAA> +<72>;<5EBD00> +<73>;<9DBD7E> +<74>;<408100> +<75>;<6B8156> +<76>;<346800> +<77>;<566845> +<78>;<274F00> +<79>;<424F35> +<80>;<3FFF00> +<81>;<BFFFAA> +<82>;<2EBD00> +<83>;<8DBD7E> +<84>;<1F8100> +<85>;<608156> +<86>;<196800> +<87>;<4E6845> +<88>;<134F00> +<89>;<3B4F35> +<90>;<00FF00> +<91>;<AAFFAA> +<92>;<00BD00> +<93>;<7EBD7E> +<94>;<008100> +<95>;<568156> +<96>;<006800> +<97>;<456845> +<98>;<004F00> +<99>;<354F35> +<100>;<00FF3F> +<101>;<AAFFBF> +<102>;<00BD2E> +<103>;<7EBD8D> +<104>;<00811F> +<105>;<568160> +<106>;<006819> +<107>;<45684E> +<108>;<004F13> +<109>;<354F3B> +<110>;<00FF7F> +<111>;<AAFFD4> +<112>;<00BD5E> +<113>;<7EBD9D> +<114>;<008140> +<115>;<56816B> +<116>;<006834> +<117>;<456856> +<118>;<004F27> +<119>;<354F42> +<120>;<00FFBF> +<121>;<AAFFEA> +<122>;<00BD8D> +<123>;<7EBDAD> +<124>;<008160> +<125>;<568176> +<126>;<00684E> +<127>;<45685F> +<128>;<004F3B> +<129>;<354F49> +<130>;<00FFFF> +<131>;<AAFFFF> +<132>;<00BDBD> +<133>;<7EBDBD> +<134>;<008181> +<135>;<568181> +<136>;<006868> +<137>;<456868> +<138>;<004F4F> +<139>;<354F4F> +<140>;<00BFFF> +<141>;<AAEAFF> +<142>;<008DBD> +<143>;<7EADBD> +<144>;<006081> +<145>;<567681> +<146>;<004E68> +<147>;<455F68> +<148>;<003B4F> +<149>;<35494F> +<150>;<007FFF> +<151>;<AAD4FF> +<152>;<005EBD> +<153>;<7E9DBD> +<154>;<004081> +<155>;<566B81> +<156>;<003468> +<157>;<455668> +<158>;<00274F> +<159>;<35424F> +<160>;<003FFF> +<161>;<AABFFF> +<162>;<002EBD> +<163>;<7E8DBD> +<164>;<001F81> +<165>;<566081> +<166>;<001968> +<167>;<444E68> +<168>;<00134F> +<169>;<353B4F> +<170>;<0000FF> +<171>;<AAAAFF> +<172>;<0000BD> +<173>;<7E7EBD> +<174>;<000081> +<175>;<565681> +<176>;<000068> +<177>;<454568> +<178>;<00004F> +<179>;<35354F> +<180>;<3F00FF> +<181>;<BFAAFF> +<182>;<2E00BD> +<183>;<8D7EBD> +<184>;<1F0081> +<185>;<605681> +<186>;<190068> +<187>;<4E4568> +<188>;<13004F> +<189>;<3B354F> +<190>;<7F00FF> +<191>;<D4AAFF> +<192>;<5E00BD> +<193>;<9D7EBD> +<194>;<400081> +<195>;<6B5681> +<196>;<340068> +<197>;<564568> +<198>;<27004F> +<199>;<42354F> +<200>;<BF00FF> +<201>;<EAAAFF> +<202>;<8D00BD> +<203>;<AD7EBD> +<204>;<600081> +<205>;<765681> +<206>;<4E0068> +<207>;<5F4568> +<208>;<3B004F> +<209>;<49354F> +<210>;<FF00FF> +<211>;<FFAAFF> +<212>;<BD00BD> +<213>;<BD7EBD> +<214>;<810081> +<215>;<815681> +<216>;<680068> +<217>;<684568> +<218>;<4F004F> +<219>;<4F354F> +<220>;<FF00BF> +<221>;<FFAAEA> +<222>;<BD008D> +<223>;<BD7EAD> +<224>;<810060> +<225>;<815676> +<226>;<68004E> +<227>;<68455F> +<228>;<4F003B> +<229>;<4F3549> +<230>;<FF007F> +<231>;<FFAAD4> +<232>;<BD005E> +<233>;<BD7E9D> +<234>;<810040> +<235>;<81566B> +<236>;<680034> +<237>;<684556> +<238>;<4F0027> +<239>;<4F3542> +<240>;<FF003F> +<241>;<FFAABF> +<242>;<BD002E> +<243>;<BD7E8D> +<244>;<81001F> +<245>;<815660> +<246>;<680019> +<247>;<68454E> +<248>;<4F0013> +<249>;<4F353B> +<250>;<333333> +<251>;<505050> +<252>;<696969> +<253>;<828282> +<254>;<BEBEBE> +<255>;<FFFFFF> +<256>;<BEBEBE> \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/colorchooser/utils/color.txt ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/extension/FeatureColorChooserExtension.java =================================================================== --- plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/extension/FeatureColorChooserExtension.java (rev 0) +++ plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/extension/FeatureColorChooserExtension.java 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,26 @@ +package org.openjump.core.ui.plugin.extension; + +import org.openjump.core.ui.plugin.colorchooser.FeatureColorChooserPlugIn; + +import com.vividsolutions.jump.workbench.plugin.Extension; +import com.vividsolutions.jump.workbench.plugin.PlugInContext; + +public class FeatureColorChooserExtension extends Extension { + + private static final String NAME = "Feature Color Chooser PlugIn (Giuseppe Aruta - adapted from SkyJUMP sourceforge.net/projects/skyjump/)"; + private static final String VERSION = "0.8 (2016-12-04)"; + + public String getName() { + return NAME; + } + + public String getVersion() { + return VERSION; + } + + public void configure(PlugInContext context) throws Exception { + + new FeatureColorChooserPlugIn().initialize(context); + + } +} \ No newline at end of file Property changes on: plug-ins/Color_chooser/trunk/src/org/openjump/core/ui/plugin/extension/FeatureColorChooserExtension.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/readme.txt =================================================================== --- plug-ins/Color_chooser/trunk/src/readme.txt (rev 0) +++ plug-ins/Color_chooser/trunk/src/readme.txt 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,45 @@ +Color Chooser Plugin 0.8 (December 2014) +-------------------------------------- +Added Color picker tool +Rewrite color panel to extend to 255 Autocad Index colors +Tooltips now show correct color in 3 ways: Index color, hexadecimal and decimal RGB + +Color Chooser Plugin 0.7 (November 2014) +-------------------------------------- +The plugin adds an extra attribute ("COLOR") with index color for Autocad compatibility + +Color Chooser Plugin 0.6 (April 2013) +-------------------------------------- +Rearrange color menus + +Color Chooser Plugin 0.5 (June 2012) +-------------------------------------- +Translate Color Chooser in Finnish. +Thanks to Jukka Rahkonen + +Color Chooser Plugin 0.4 (June 2012) +------------------------------------- +Complete Translation of Color Chooser in German, English, Spanish, French and Italian. +Thanks to OpenJUMP Developers and Users Comunity members + +Color Chooser Plugin 0.3 (June 2011) +-------------------------------------- +Color Chooser plugin for OpenJUMp allows to change color of features in a CAD style way. +This means that users have not to set attributes for features and define a style according to them. +This version of Color Chooser Plugin derives from SkyJUMP (https://sourceforge.net/projects/skyjump/) and was internationalized +Currenty only Italian and English are full internationalized. German, Frenche and Spanish are only partially translated. + +NOTES & COPYRIGHT +-------------------------------------- +Note that this plugin is developed only to test new features for OpenJUMP. +It is NOT recomanded to use it for work or other productive activities as it is still at the first developing stage. +All copyright are reserved to (https://sourceforge.net/projects/skyjump/) under the terms of GNU General Public License +Sourcecode of ColorChooser PlugIn is embedded into the JAR file + +OpenJUMP User Mailing List: http://groups.google.com/group/openjump-users +OpenJUMP Development Mailing List: https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel +OpenJUMP WIKI page: https://sourceforge.net/apps/mediawiki/jump-pilot/index.php?title=Main_Page +-------------------------------------- + +Giuseppe Aruta - GeoArbores Project (https://sourceforge.net/projects/opensit) +Geo Arbores is a project for developing tools and extensions for GIS software and spatial opensource libraries (Kosmo, OpenJUMP and GDAL / OGR). Property changes on: plug-ins/Color_chooser/trunk/src/readme.txt ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: plug-ins/Color_chooser/trunk/src/workbench-properties.xml =================================================================== --- plug-ins/Color_chooser/trunk/src/workbench-properties.xml (rev 0) +++ plug-ins/Color_chooser/trunk/src/workbench-properties.xml 2017-10-21 17:08:39 UTC (rev 5514) @@ -0,0 +1,4 @@ +<workbench> + <!--plug-in> ====== CADTOOLS ===== </plug-in--> + <extension> org.openjump.core.ui.plugin.extension.FeatureColorChooserExtension</extension> +</workbench> Property changes on: plug-ins/Color_chooser/trunk/src/workbench-properties.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel