01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-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.resources.Utilities;
20:
21: public class ImageOutlineImpl extends AbstractGTComponent implements
22: ImageOutline {
23:
24: Symbolizer symbolizer;
25:
26: public Symbolizer getSymbolizer() {
27: return symbolizer;
28: }
29:
30: public void setSymbolizer(Symbolizer symbolizer) {
31: if (symbolizer instanceof LineSymbolizer
32: || symbolizer instanceof PolygonSymbolizer) {
33: Symbolizer old = this .symbolizer;
34: this .symbolizer = symbolizer;
35:
36: fireChildChanged("symbolizer", this .symbolizer, old);
37: } else {
38: throw new IllegalArgumentException(
39: "Symbolizer must be Line or Polygon.");
40: }
41: }
42:
43: public boolean equals(Object obj) {
44: if (this == obj) {
45: return true;
46: }
47:
48: if (obj instanceof ImageOutlineImpl) {
49: ImageOutlineImpl other = (ImageOutlineImpl) obj;
50: return Utilities.equals(symbolizer, other.symbolizer);
51: }
52:
53: return false;
54: }
55:
56: public int hashCode() {
57: final int PRIME = 1000003;
58: int result = 0;
59:
60: if (symbolizer != null) {
61: result = PRIME * result + symbolizer.hashCode();
62: }
63:
64: return result;
65: }
66:
67: }
|