01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.render.internal.feature.shapefile;
18:
19: import net.refractions.udig.project.ILayer;
20: import net.refractions.udig.project.internal.render.Renderer;
21: import net.refractions.udig.project.render.AbstractRenderMetrics;
22: import net.refractions.udig.project.render.IRenderContext;
23: import net.refractions.udig.project.render.IRenderMetricsFactory;
24:
25: import org.geotools.styling.Style;
26:
27: /**
28: * The metrics object for the BasicFeatureRenderer
29: *
30: * @author Jesse Eichar
31: * @version $Revision: 1.9 $
32: */
33: public class ShapefileFeatureMetrics extends AbstractRenderMetrics {
34:
35: /**
36: * Construct <code>BasicFeatureMetrics</code>.
37: *
38: * @param context2
39: * @param factory
40: */
41: public ShapefileFeatureMetrics(IRenderContext context2,
42: ShapefileFeatureMetricsFactory factory) {
43: super (context2, factory);
44: }
45:
46: /**
47: * @see net.refractions.udig.project.render.IRenderMetrics#createRenderer()
48: */
49: public Renderer createRenderer() {
50: Renderer renderer = new ShapefileFeatureRenderer();
51: renderer.setContext(context);
52: renderer.setName(context.getLayer().getName());
53: return renderer;
54: }
55:
56: /**
57: * @see net.refractions.udig.project.render.IRenderMetrics#getRenderContext()
58: */
59: public IRenderContext getRenderContext() {
60: return context;
61: }
62:
63: /**
64: * @see net.refractions.udig.project.render.IRenderMetrics#getRenderMetricsFactory()
65: */
66: public IRenderMetricsFactory getRenderMetricsFactory() {
67: return factory;
68: }
69:
70: /**
71: * @see net.refractions.udig.project.render.IRenderMetrics#canAddLayer(net.refractions.udig.project.ILayer)
72: */
73: public boolean canAddLayer(ILayer layer) {
74: return false;
75: }
76:
77: /**
78: * @see net.refractions.udig.project.render.IRenderMetrics#canStyle(java.lang.String, java.lang.Object)
79: */
80: public boolean canStyle(String SyleID, Object value) {
81: return value != null && value instanceof Style;
82: }
83:
84: public boolean isOptimized() {
85: return true;
86: }
87: }
|