01: package net.refractions.udig.render.internal.gridcoverage.basic;
02:
03: import net.refractions.udig.project.ILayer;
04: import net.refractions.udig.project.internal.render.Renderer;
05: import net.refractions.udig.project.render.AbstractRenderMetrics;
06: import net.refractions.udig.project.render.IRenderContext;
07: import net.refractions.udig.project.render.IRenderMetricsFactory;
08: import net.refractions.udig.ui.graphics.SLDs;
09:
10: import org.geotools.styling.Style;
11:
12: /**
13: * Creates a Metrics object for the basic gridcoverage renderer
14: *
15: * @author jeichar
16: * @since 0.3
17: */
18: public class BasicGridCoverageMetrics extends AbstractRenderMetrics {
19:
20: /**
21: * Construct <code>BasicGridCoverageMetrics</code>.
22: *
23: * @param context2
24: * @param factory
25: */
26: public BasicGridCoverageMetrics(IRenderContext context2,
27: BasicGridCoverageMetricsFactory factory) {
28: super (context2, factory);
29: }
30:
31: public Renderer createRenderer() {
32: Renderer r = new BasicGridCoverageRenderer();
33: r.setContext(context);
34: return r;
35: }
36:
37: /**
38: * @see net.refractions.udig.project.render.RenderMetrics#getRenderContext()
39: */
40: public IRenderContext getRenderContext() {
41: return context;
42: }
43:
44: /**
45: * @see net.refractions.udig.project.render.IRenderMetrics#getRenderMetricsFactory()
46: */
47: public IRenderMetricsFactory getRenderMetricsFactory() {
48: return factory;
49: }
50:
51: public boolean canAddLayer(ILayer layer) {
52: return false;
53: }
54:
55: public boolean canStyle(String SyleID, Object value) {
56: if (value == null || !(value instanceof Style))
57: return false;
58:
59: return !Double.isNaN(SLDs.rasterOpacity((Style) value));
60: }
61:
62: public boolean isOptimized() {
63: return false;
64: }
65:
66: }
|