On Wednesday 09 April 2008 08:27:22 am Andrea Aime wrote: > Gabriel Roldán ha scritto: > > Hi Theuns, > > > > I know this was mentioned before. Yet it keeps looking like the only > > reasonable escape route to me.. more than that, I think it could be quite > > an elegant solution. > > > > I mean the use of ExternalGraphic and a custon URL protocol, plus a > > custom protocol handler. This is the first link I found that seems like a > > good explanation: > > <http://java.sun.com/developer/onlineTraining/protocolhandlers/> > > > > So such an URL could look something like "dgi://mil2525/police-car", > > where the "dgi" protocol name is just a silly acronym I just invented > > for "DYnamically Generated Image", you can use a better name. > > Then your implementation of URLStreamHandler, as explained in the above > > link, should provide the resource, whether it generates it dynamically or > > not. > > > > I would say the easiest way to do it is by packaging the icon images in a > > jar, and they your URLStreamHandler implementation would act as a proxy > > for the URL returned by getClass().getResouce(...). > > For example, if you define icons are stored in /wellknownicons, and > > suppose the well known name matches the file name, your implementation of > > openConnection would just be something like: > > > > public class DGIHandler extends java.net.URLStreamHandler{ > > protected URLConnection openConnection(URL u){ > > String iconName = u.getResource(); //I guess this is the method to use, > > may be wrong, I'm writing off the top of my head > > URLConnection connection; > > connection = getClass().getResource("/wellknownicons/" + > > iconName); return connection; > > } > > } > > > > I hope to have understood your problem well, otherwise all the above may > > be just nonsense or too naive. > > This is not about retrieving a icon from some location, but, afaik, > about building a Icon/Shape object at runtime given a name. > The name drives what is to be drawn, that is, the thing is programmatic, > not data access related.
understood, but the approach of using a custom url scheme gives you that power too, right? like in your implementation of URLStreamHandler is free to generate the graphic programmatically or not.. or am I missing something else? Gabriel > > For a discussion comparing external graphics and mark see my other mail. > You can style a mark further, leaving the plugin system build only an > outline of it, whilst an external graphic you have to take as is (which > means the url must completely define not only its shape, but also its > size, stroke and fill). > > Having no experience with military symbols I have no idea what's > more appropriate, I just noticed that the Mark path seems to provide > more flexibility. > > In the following days I hope I'll be able to work on reading MapServer > vector symbols > (http://mapserver.gis.umn.edu/docs/reference/symbology/referencemanual-all- >pages) and I'd like to tackle this using Marks because they do seem a better > match than graphics, see also the example usage at the bottom of that page. > > Cheers > Andrea > > !DSPAM:4045,47fc61df278773668746562! ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel