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: * Created on 13 November 2002, 13:59
17: */
18: package org.geotools.styling;
19:
20: import org.geotools.event.AbstractGTComponent;
21: import org.geotools.factory.CommonFactoryFinder;
22: import org.geotools.factory.GeoTools;
23: import org.opengis.filter.FilterFactory;
24: import org.opengis.filter.expression.Expression;
25:
26: /**
27: * Application of relief shading
28: *
29: * @author iant
30: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/styling/ShadedReliefImpl.java $
31: */
32: public class ShadedReliefImpl extends AbstractGTComponent implements
33: ShadedRelief {
34: private FilterFactory filterFactory;
35: private Expression reliefFactor;
36: private boolean brightness = false;
37:
38: public ShadedReliefImpl() {
39: this (CommonFactoryFinder.getFilterFactory(GeoTools
40: .getDefaultHints()));
41: }
42:
43: public ShadedReliefImpl(FilterFactory factory) {
44: filterFactory = factory;
45: reliefFactor = filterFactory.literal(55);
46: }
47:
48: /**
49: * The ReliefFactor gives the amount of exaggeration to use for the height
50: * of the ?hills.? A value of around 55 (times) gives reasonable results
51: * for Earth-based DEMs. The default value is system-dependent.
52: *
53: * @return an expression which evaluates to a double.
54: */
55: public Expression getReliefFactor() {
56: return reliefFactor;
57: }
58:
59: /**
60: * indicates if brightnessOnly is true or false. Default is false.
61: *
62: * @return boolean brightnessOn.
63: */
64: public boolean isBrightnessOnly() {
65: return brightness;
66: }
67:
68: /**
69: * turns brightnessOnly on or off depending on value of flag.
70: *
71: * @param flag boolean
72: */
73: public void setBrightnessOnly(boolean flag) {
74: brightness = flag;
75: }
76:
77: /**
78: * The ReliefFactor gives the amount of exaggeration to use for the height
79: * of the ?hills.? A value of around 55 (times) gives reasonable results
80: * for Earth-based DEMs. The default value is system-dependent.
81: *
82: * @param reliefFactor an expression which evaluates to a double.
83: */
84: public void setReliefFactor(Expression reliefFactor) {
85: Expression old = this .reliefFactor;
86: this .reliefFactor = reliefFactor;
87: fireChildChanged("reliefFactor", reliefFactor, old);
88: }
89: }
|