An instance of this interface should exist for all map producers which want to take advantage of the dynamic plugin system. In addition to implementing this interface GetMap producers should have a services file:
org.vfny.geoserver.responses.wms.GetMapProducerFactorySpi
The file should contain a single line which gives the full name of the implementing class.
example:e.g. org.vfny.geoserver.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 GetMapProducer capable of generating a map image in GIF format and send the generated legend to a file:
WMSConfig config = getServletContext().getAttribute(WMSConfig.CONFIG_KEY); GetMapProducerSpi gmpf = null; Iterator it = FactoryFinder.factories(GeMapProducerFactorySpi.class); while (it.hasNext()) { GeMapProducerFactorySpi tmpGmpf = (GeMapProducerFactorySpi) it.next(); if (tmpGmpf.canProduce("image/gif")) { gmpf = tmpGmpf; break; } } ... GetMapProducer producer = gmpf.createMapProducer("image/gif"); WMSMapContext ctx = ... producer.produceMap(ctx); OutputStream out = new FileOutputStream("/map.gif"); producer.writeTo(out);
@author Gabriel Roldan, Axios Engineering
@version $Id$
|
|
|
|