An instance of this interface should exist for all legend producers which want to take advantage of the dynamic plugin system. In addition to implementing this interface GetLegendGraphic producers should have a services file:
org.vfny.geoserver.responses.wms.GetLegendGraphicProducerSpi
The file should contain a single line which gives the full name of the implementing class.
example:e.g. org.vfny.geoserver.responses.wms.GIFLegendGraphicProducerSpi
The factories are never called directly by client code, instead the GeoTools' FactoryFinder class is used.
The following example shows how a user might obtain GetLegendGraphicProducer capable of generating a legend graphic image in GIF format and send the generated legend to a file:
GetLegendGraphicProducerSpi glf = null; Iterator it = FactoryFinder.factories(GetLegendGraphicProducerSpi.class); while (it.hasNext()) { GetLegendGraphicProducerSpi tmpGlf = (GetLegendGraphicProducerSpi) it.next(); if (tmpGlf.canProduce("image/gif")) { glf = tmpGlf; break; } } GetLegendGraphicProducer producer = glf.createLegendProducer("image/gif"); GetLegendGraphicRequest request = ... producer.produceLegendGraphic(request); OutputStream out = new FileOutputStream("/legend.gif"); producer.writeTo(out);
@author Gabriel Roldan, Axios Engineering
@version $Revision: 1.1 $
|
|
|
|
|
|
|
|