01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-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 November 3, 2003, 10:10 AM
17: */
18: package org.geotools.styling;
19:
20: import java.util.ArrayList;
21: import java.util.List;
22:
23: import org.geotools.resources.Utilities;
24:
25: /**
26: * DOCUMENT ME!
27: *
28: * @author jamesm
29: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/styling/NamedLayerImpl.java $
30: */
31: public class NamedLayerImpl extends StyledLayerImpl implements
32: NamedLayer {
33: List styles = new ArrayList();
34:
35: FeatureTypeConstraint[] featureTypeConstraints = new FeatureTypeConstraint[0];
36:
37: public FeatureTypeConstraint[] getLayerFeatureConstraints() {
38: return featureTypeConstraints;
39: }
40:
41: public void setLayerFeatureConstraints(
42: FeatureTypeConstraint[] featureTypeConstraints) {
43: this .featureTypeConstraints = featureTypeConstraints;
44: fireChanged();
45: }
46:
47: public Style[] getStyles() {
48: return (Style[]) styles.toArray(new Style[0]);
49: }
50:
51: /**
52: * DOCUMENT ME!
53: *
54: * @param sl may be a StyleImpl or a NamedStyle
55: */
56: public void addStyle(Style sl) {
57: styles.add(sl);
58: fireChanged();
59: }
60:
61: public void accept(StyleVisitor visitor) {
62: visitor.visit(this );
63: }
64:
65: public boolean equals(Object oth) {
66: if (this == oth) {
67: return true;
68: }
69:
70: if (oth instanceof NamedLayerImpl) {
71: NamedLayerImpl other = (NamedLayerImpl) oth;
72:
73: if (!Utilities.equals(styles, other.styles))
74: return false;
75:
76: if (featureTypeConstraints.length != other.featureTypeConstraints.length)
77: return false;
78:
79: for (int i = 0; i < featureTypeConstraints.length; i++) {
80: if (!Utilities.equals(featureTypeConstraints[i],
81: other.featureTypeConstraints[i]))
82: return false;
83: }
84: return true;
85: }
86:
87: return false;
88: }
89: }
|