Source Code Cross Referenced for FeatureTypeStyleImpl.java in  » GIS » GeoTools-2.4.1 » org » geotools » styling » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.styling 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005:         *    (C) 2002, Centre for Computational Geography
006:         *    
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation;
010:         *    version 2.1 of the License.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.styling;
018:
019:        import org.geotools.event.AbstractGTComponent;
020:        import org.geotools.event.GTList;
021:        import org.geotools.resources.Utilities;
022:        import org.opengis.util.Cloneable;
023:
024:        // OpenGIS dependencies
025:        import java.util.Arrays;
026:        import java.util.List;
027:        import java.util.logging.Logger;
028:
029:        /**
030:         * DOCUMENT ME!
031:         *
032:         * @author James Macgill
033:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/styling/FeatureTypeStyleImpl.java $
034:         * @version $Id: FeatureTypeStyleImpl.java 27862 2007-11-12 19:51:19Z desruisseaux $
035:         */
036:        public class FeatureTypeStyleImpl extends AbstractGTComponent implements 
037:                FeatureTypeStyle, Cloneable {
038:            private static final Logger LOGGER = org.geotools.util.logging.Logging
039:                    .getLogger("org.geotools.styling");
040:            private java.util.List ruleList;
041:            private String featureTypeName = "Feature";
042:            private String name = "name";
043:            private String title = "title";
044:            private String abstractStr = "abstract";
045:            private String[] semanticTypeIdentifiers;
046:
047:            /**
048:             * Creates a new instance of FeatureTypeStyleImpl
049:             *
050:             * @param rules DOCUMENT ME!
051:             */
052:            protected FeatureTypeStyleImpl(Rule[] rules) {
053:                this (Arrays.asList(rules));
054:            }
055:
056:            protected FeatureTypeStyleImpl(List rules) {
057:                ruleList = new GTList(this , "rules");
058:                ruleList.addAll(rules);
059:            }
060:
061:            /**
062:             * Creates a new instance of FeatureTypeStyleImpl
063:             */
064:            protected FeatureTypeStyleImpl() {
065:                ruleList = new GTList(this , "rules");
066:            }
067:
068:            public String getFeatureTypeName() {
069:                return featureTypeName;
070:            }
071:
072:            public Rule[] getRules() {
073:                return (Rule[]) ruleList.toArray(new Rule[0]);
074:            }
075:
076:            public List rules() {
077:                return ruleList;
078:            }
079:
080:            public String[] getSemanticTypeIdentifiers() {
081:                if (semanticTypeIdentifiers == null) {
082:                    return new String[] { "generic:geometry" }; //HACK: - generic catch all identifier	
083:                } else {
084:                    return semanticTypeIdentifiers;
085:                }
086:            }
087:
088:            public void setSemanticTypeIdentifiers(String[] types) {
089:                semanticTypeIdentifiers = types;
090:            }
091:
092:            public void setRules(Rule[] rules) {
093:                ruleList.clear();
094:                ruleList.addAll(Arrays.asList(rules));
095:
096:                // fireChanged();
097:            }
098:
099:            public void addRule(Rule rule) {
100:                ruleList.add(rule);
101:
102:                // fireChildAdded(rule);
103:            }
104:
105:            public void setFeatureTypeName(String name) {
106:                if (name.equals("feature")) {
107:                    LOGGER
108:                            .warning("FeatureTypeStyle with typename 'feature' - you probably meant to say 'Feature' (capital F) for the 'generic' FeatureType");
109:                }
110:
111:                featureTypeName = name;
112:                fireChanged();
113:            }
114:
115:            /**
116:             * Getter for property abstractStr.
117:             *
118:             * @return Value of property abstractStr.
119:             */
120:            public java.lang.String getAbstract() {
121:                return abstractStr;
122:            }
123:
124:            /**
125:             * Setter for property abstractStr.
126:             *
127:             * @param abstractStr New value of property abstractStr.
128:             */
129:            public void setAbstract(java.lang.String abstractStr) {
130:                this .abstractStr = abstractStr;
131:                fireChanged();
132:            }
133:
134:            /**
135:             * Getter for property name.
136:             *
137:             * @return Value of property name.
138:             */
139:            public java.lang.String getName() {
140:                return name;
141:            }
142:
143:            /**
144:             * Setter for property name.
145:             *
146:             * @param name New value of property name.
147:             */
148:            public void setName(java.lang.String name) {
149:                this .name = name;
150:                fireChanged();
151:            }
152:
153:            /**
154:             * Getter for property title.
155:             *
156:             * @return Value of property title.
157:             */
158:            public java.lang.String getTitle() {
159:                return title;
160:            }
161:
162:            /**
163:             * Setter for property title.
164:             *
165:             * @param title New value of property title.
166:             */
167:            public void setTitle(java.lang.String title) {
168:                this .title = title;
169:                fireChanged();
170:            }
171:
172:            public void accept(StyleVisitor visitor) {
173:                visitor.visit(this );
174:            }
175:
176:            /**
177:             * Creates a deep copy clone of the FeatureTypeStyle.
178:             *
179:             * @see org.geotools.styling.FeatureTypeStyle#clone()
180:             */
181:            public Object clone() {
182:                FeatureTypeStyle clone;
183:
184:                try {
185:                    clone = (FeatureTypeStyle) super .clone();
186:                } catch (CloneNotSupportedException e) {
187:                    throw new AssertionError(e); // this should never happen.
188:                }
189:
190:                Rule[] ruleArray = new Rule[ruleList.size()];
191:
192:                for (int i = 0; i < ruleArray.length; i++) {
193:                    Rule rule = (Rule) ruleList.get(i);
194:                    ruleArray[i] = (Rule) ((Cloneable) rule).clone();
195:                }
196:
197:                clone.setRules(ruleArray);
198:
199:                return clone;
200:            }
201:
202:            /**
203:             * Overrides hashCode.
204:             *
205:             * @return The hashcode.
206:             */
207:            public int hashCode() {
208:                final int PRIME = 1000003;
209:                int result = 0;
210:
211:                if (ruleList != null) {
212:                    result = (PRIME * result) + ruleList.hashCode();
213:                }
214:
215:                if (featureTypeName != null) {
216:                    result = (PRIME * result) + featureTypeName.hashCode();
217:                }
218:
219:                if (name != null) {
220:                    result = (PRIME * result) + name.hashCode();
221:                }
222:
223:                if (title != null) {
224:                    result = (PRIME * result) + title.hashCode();
225:                }
226:
227:                if (abstractStr != null) {
228:                    result = (PRIME * result) + abstractStr.hashCode();
229:                }
230:
231:                return result;
232:            }
233:
234:            /**
235:             * Compares this FeatureTypeStyleImpl with another.
236:             * 
237:             * <p>
238:             * Two FeatureTypeStyles are equal if they contain equal properties and an
239:             * equal list of Rules.
240:             * </p>
241:             *
242:             * @param oth The other FeatureTypeStyleImpl to compare with.
243:             *
244:             * @return True if this and oth are equal.
245:             */
246:            public boolean equals(Object oth) {
247:                if (this  == oth) {
248:                    return true;
249:                }
250:
251:                if (oth instanceof  FeatureTypeStyleImpl) {
252:                    FeatureTypeStyleImpl other = (FeatureTypeStyleImpl) oth;
253:
254:                    return Utilities.equals(name, other.name)
255:                            && Utilities.equals(title, other.title)
256:                            && Utilities.equals(abstractStr, other.abstractStr)
257:                            && Utilities.equals(featureTypeName,
258:                                    other.featureTypeName)
259:                            && Utilities.equals(ruleList, other.ruleList);
260:                }
261:
262:                return false;
263:            }
264:
265:            public String toString() {
266:                StringBuffer buf = new StringBuffer();
267:                buf.append("FeatureTypeStyleImpl<");
268:                buf.append(notification);
269:                buf.append(">");
270:                buf.append("[");
271:                if (name != null) {
272:                    buf.append(" name=");
273:                    buf.append(name);
274:                } else {
275:                    buf.append(" UNNAMED");
276:                }
277:                buf.append(", ");
278:                buf.append(featureTypeName);
279:                buf.append(", rules=<");
280:                buf.append(ruleList.size());
281:                buf.append(">");
282:                if (ruleList.size() > 0) {
283:                    buf.append("(");
284:                    buf.append(ruleList.get(0));
285:                    if (ruleList.size() > 1) {
286:                        buf.append(",...");
287:                    }
288:                    buf.append(")");
289:                }
290:                buf.append("]");
291:                return buf.toString();
292:            }
293:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.