Hi Jody,
+1 for centralizing.
Two hesitations about using a pluggable Converter implementation:
- Would they convert from String to Color (a converter from String to
String does not make much sense now does it?) and then eventually going
back to hex in all implementations?
- Once plugged in the conversion will be available for all other code
paths doing conversions... probably not a bit deal, but there is always the
risk of it end up interacting in some other existing code paths in a random
way. Normally as long as the conversion is unique there are no big problems
(also check the Wicket UI in GeoServer, that also falls back on GeoTools
converters)
Cheers
Andrea
On Tue, Feb 7, 2017 at 12:21 AM, Jody Garnett <jody.garn...@gmail.com>
wrote:
> In looking at gt-mbstyle ran into a common need to convert from "red" to
> Color.RED.
>
> Checking our code base ( using put yellow language:java
> <https://github.com/geotools/geotools/search?utf8=%E2%9C%93&q=put+yellow+language%3Ajava&type=Code>)
> we have:
>
> - css Value.java
> <https://github.com/geotools/geotools/blob/0e6fc022f395194e7670b63d2de785123a178cdf/modules/unsupported/css/src/main/java/org/geotools/styling/css/Value.java>
> - has a map of names to hex strings
> - ysld Colors.java
> <https://github.com/geotools/geotools/blob/3f99a4c6fb34e0de153432fc2a2d5c5256e7ce49/modules/extension/ysld/src/main/java/org/geotools/ysld/Colors.java>
> - has a map of X11 colors (why x11 Kevin/Torben/Justin is that a mistake?)
>
> I would like to capture this information in one spot (rather than
> duplicate).
>
> What would you say to creating a couple of ColorConverters and would
> engage based on the following hint:
>
> /**
> * The color names definition to use when converting from String to
> Color.
> *
> * @see CommonFactoryFinder#getStyleFactory
> *
> * @since 17
> */
> public static final OptionKey COLOR_NAMES = new
> OptionKey("WEB","CSS","X11","JAVA","*");
>
> I kind of assume SLD should respect CSS colors (as per GEOT-5633
> <https://osgeo-org.atlassian.net/browse/GEOT-5633>)?
> --
> Jody Garnett
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
-------------------------------------------------------
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel