01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
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: package org.geotools.styling;
17:
18: import org.geotools.event.AbstractGTComponent;
19: import org.geotools.factory.CommonFactoryFinder;
20: import org.geotools.factory.GeoTools;
21: import org.opengis.filter.FilterFactory;
22: import org.opengis.filter.expression.Expression;
23:
24: /**
25: * DOCUMENT ME!
26: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/styling/SelectedChannelTypeImpl.java $
27: */
28: public class SelectedChannelTypeImpl extends AbstractGTComponent
29: implements SelectedChannelType {
30: private FilterFactory filterFactory;
31:
32: //private Expression contrastEnhancement;
33: private ContrastEnhancement contrastEnhancement;
34: private String name = "channel";
35:
36: public SelectedChannelTypeImpl() {
37: this (CommonFactoryFinder.getFilterFactory(GeoTools
38: .getDefaultHints()));
39: }
40:
41: public SelectedChannelTypeImpl(FilterFactory factory) {
42: filterFactory = factory;
43: contrastEnhancement = contrastEnhancement(filterFactory
44: .literal(1.0));
45: }
46:
47: public String getChannelName() {
48: return name;
49: }
50:
51: public ContrastEnhancement getContrastEnhancement() {
52: return contrastEnhancement;
53: }
54:
55: public void setChannelName(String name) {
56: this .name = name;
57: fireChanged();
58: }
59:
60: public void setContrastEnhancement(ContrastEnhancement enhancement) {
61: ContrastEnhancement old = this .contrastEnhancement;
62: this .contrastEnhancement = enhancement;
63:
64: fireChildChanged("contrastEnhancement", contrastEnhancement,
65: old);
66: }
67:
68: public void setContrastEnhancement(Expression gammaValue) {
69: contrastEnhancement.setGammaValue(gammaValue);
70: }
71:
72: protected ContrastEnhancement contrastEnhancement(Expression expr) {
73: ContrastEnhancement enhancement = new ContrastEnhancementImpl();
74: enhancement.setGammaValue(filterFactory.literal(1.0));
75:
76: return enhancement;
77: }
78: }
|