01: /**
02: *
03: */package org.vfny.geoserver.wms.responses.map.geotiff;
04:
05: import java.util.HashSet;
06: import java.util.Map;
07: import java.util.Set;
08:
09: import org.vfny.geoserver.global.WMS;
10: import org.vfny.geoserver.wms.GetMapProducer;
11: import org.vfny.geoserver.wms.GetMapProducerFactorySpi;
12:
13: /**
14: * {@link GetMapProducerFactorySpi} for producing images in geotiff format.
15: *
16: * @author Simone Giannecchini, GeoSolutions
17: */
18: public class GeoTiffMapProducerFactory implements
19: GetMapProducerFactorySpi {
20: /** the only MIME type this map producer supports */
21: static final String MIME_TYPE = "image/tiff";
22:
23: /**
24: * convenient singleton Set to expose the output format this producer
25: * supports
26: */
27: private static final Set SUPPORTED_FORMATS;
28:
29: static {
30: SUPPORTED_FORMATS = new HashSet(2);
31: SUPPORTED_FORMATS.add("image/geotiff");
32: SUPPORTED_FORMATS.add("image/geotiff8");
33: }
34:
35: /**
36: /**
37: * Default constructor.
38: */
39: public GeoTiffMapProducerFactory() {
40: }
41:
42: public String getName() {
43: return "Geographic tagged image format";
44: }
45:
46: public Set getSupportedFormats() {
47: return SUPPORTED_FORMATS;
48: }
49:
50: public boolean isAvailable() {
51: try {
52: Class
53: .forName("com.sun.media.imageio.plugins.tiff.GeoTIFFTagSet");
54:
55: return true;
56: } catch (Exception e) {
57: }
58:
59: return false;
60: }
61:
62: public boolean canProduce(String mapFormat) {
63: return SUPPORTED_FORMATS.contains(mapFormat);
64: }
65:
66: public GetMapProducer createMapProducer(String mapFormat, WMS wms)
67: throws IllegalArgumentException {
68: if (!canProduce(mapFormat)) {
69: throw new IllegalArgumentException(mapFormat
70: + " not supported by this map producer");
71: }
72:
73: return new GeoTiffMapProducer(mapFormat, MIME_TYPE, wms);
74: }
75:
76: /*
77: * (non-Javadoc)
78: *
79: * @see org.geotools.factory.Factory#getImplementationHints() This just
80: * returns java.util.Collections.EMPTY_MAP
81: */
82: public Map getImplementationHints() {
83: return java.util.Collections.EMPTY_MAP;
84: }
85: }
|