Source Code Cross Referenced for StyledLayerDescriptorImpl.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 java.util.ArrayList;
020:        import java.util.List;
021:        import java.util.logging.Logger;
022:
023:        import org.geotools.event.AbstractGTRoot;
024:        import org.geotools.event.GTDelta;
025:        import org.geotools.event.GTDeltaImpl;
026:        import org.geotools.event.GTEvent;
027:        import org.geotools.event.GTEventImpl;
028:        import org.geotools.event.GTNoteImpl;
029:        import org.geotools.resources.Utilities;
030:
031:        /**
032:         * Holds styling information (from a StyleLayerDescriptor document).
033:         * 
034:         * <p>
035:         * This class is based on version 1.0 of the SLD specification.
036:         * </p>
037:         * 
038:         * <p>
039:         * For many of us in geotools this is the reason we came along for the ride - a
040:         * pretty picture. For documentation on the use of this class please consult
041:         * the SLD 1.0 specification.
042:         * </p>
043:         * 
044:         * <p>
045:         * We may experiment with our own (or SLD 1.1) ideas but will mark such
046:         * experiments for you. This is only an issue of you are considering writing
047:         * out these objects for interoptability with other systems.
048:         * </p>
049:         * 
050:         * <p>
051:         * General strategy for supporting multiple SLD versions (and experiments):
052:         * 
053:         * <ul>
054:         * <li>
055:         * These classes will be <b>BIGGER</b> and more capabile then any one
056:         * specification
057:         * </li>
058:         * <li>
059:         * We can define (and support) explicit interfaces tracking each version
060:         * (preferably GeoAPI would hold these)
061:         * </li>
062:         * <li>
063:         * We can use Factories (aka SLD1Factory and SLD1_1Factory and SEFactory) to
064:         * support the creation of conformant datastructures. Code (such as user
065:         * interfaces) can be parameratized with these factories when they need to
066:         * confirm to an exact version supported by an individual service. We hope
067:         * that specifications are always adaptive, and will be forced to throw
068:         * unsupported exceptions when functionality is removed from a specification.
069:         * </li>
070:         * </ul>
071:         * </p>
072:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/styling/StyledLayerDescriptorImpl.java $
073:         */
074:        public class StyledLayerDescriptorImpl extends AbstractGTRoot implements 
075:                StyledLayerDescriptor {
076:            /** The logger for the default core module. */
077:            private static final Logger LOGGER = org.geotools.util.logging.Logging
078:                    .getLogger("org.geotools.styling");
079:
080:            /** Holds value of property name. */
081:            private String name;
082:
083:            /** Holds value of property title. */
084:            private String title;
085:
086:            /** Holds value of property abstract. */
087:            private String abstractStr;
088:            private List layers = new ArrayList();
089:
090:            /**
091:             * Convenience method for grabbing the default style from the
092:             * StyledLayerDescriptor.
093:             *
094:             * @return first Style (in SLD-->UserLayers-->UserStyles) that claims to be
095:             *         the default
096:             */
097:            public Style getDefaultStyle() {
098:                //descend into the layers
099:                for (int i = 0; i < layers.size(); i++) {
100:                    StyledLayer layer = (StyledLayer) layers.get(i);
101:
102:                    if (layer instanceof  UserLayer) {
103:                        UserLayer userLayer = (UserLayer) layer;
104:
105:                        //descend into the styles
106:                        Style[] styles = userLayer.getUserStyles();
107:
108:                        for (int j = 0; j < styles.length; j++) {
109:                            //return the first style that claims to be the default
110:                            if (styles[j].isDefault()) {
111:                                return styles[j];
112:                            }
113:                        }
114:                    }
115:                }
116:
117:                return null;
118:            }
119:
120:            public StyledLayer[] getStyledLayers() {
121:                return (StyledLayerImpl[]) layers
122:                        .toArray(new StyledLayerImpl[layers.size()]);
123:            }
124:
125:            public void setStyledLayers(StyledLayer[] layers) {
126:                this .layers.clear();
127:
128:                for (int i = 0; i < layers.length; i++) {
129:                    addStyledLayer(layers[i]);
130:                }
131:
132:                LOGGER.fine("StyleLayerDescriptorImpl added "
133:                        + this .layers.size() + " styled layers");
134:                fireChanged(); // TODO Handle StyledLayer List
135:            }
136:
137:            public void addStyledLayer(StyledLayer layer) {
138:                layer.getNote().setParent(this );
139:                layers.add(layer);
140:            }
141:
142:            /**
143:             * Getter for property name.
144:             *
145:             * @return Value of property name.
146:             */
147:            public String getName() {
148:                return this .name;
149:            }
150:
151:            /**
152:             * Setter for property name.
153:             *
154:             * @param name New value of property name.
155:             */
156:            public void setName(String name) {
157:                this .name = name;
158:                fireChanged();
159:            }
160:
161:            /**
162:             * Getter for property title.
163:             *
164:             * @return Value of property title.
165:             */
166:            public String getTitle() {
167:                return this .title;
168:            }
169:
170:            /**
171:             * Setter for property title.
172:             *
173:             * @param title New value of property title.
174:             */
175:            public void setTitle(String title) {
176:                this .title = title;
177:                fireChanged();
178:            }
179:
180:            /**
181:             * Getter for property abstractStr.
182:             *
183:             * @return Value of property abstractStr.
184:             */
185:            public java.lang.String getAbstract() {
186:                return abstractStr;
187:            }
188:
189:            /**
190:             * Setter for property abstractStr.
191:             *
192:             * @param abstractStr New value of property abstractStr.
193:             */
194:            public void setAbstract(java.lang.String abstractStr) {
195:                this .abstractStr = abstractStr;
196:                fireChanged();
197:            }
198:
199:            /**
200:             * Issue a change event w/ PRE_DELETE
201:             *
202:             * @param childDelta Delta describing change
203:             */
204:            public void removed(GTDelta childDelta) {
205:                if (!hasListeners()) {
206:                    return;
207:                }
208:
209:                GTDelta delta = new GTDeltaImpl(new GTNoteImpl("",
210:                        GTDelta.NO_INDEX), GTDelta.Kind.NO_CHANGE, this ,
211:                        childDelta);
212:                GTEventImpl event = new GTEventImpl(this ,
213:                        GTEvent.Type.PRE_DELETE, delta);
214:                fire(event);
215:            }
216:
217:            /**
218:             * Used to pass on "We changed" notification from children.
219:             *
220:             * @param delta Describes change
221:             */
222:            public void changed(GTDelta delta) {
223:                if (!hasListeners()) {
224:                    return;
225:                }
226:
227:                fire(new GTDeltaImpl(new GTNoteImpl("", GTDelta.NO_INDEX),
228:                        GTDelta.Kind.NO_CHANGE, this , delta));
229:            }
230:
231:            public void accept(StyleVisitor visitor) {
232:                visitor.visit(this );
233:            }
234:
235:            public boolean equals(Object oth) {
236:                if (this  == oth) {
237:                    return true;
238:                }
239:
240:                if (oth instanceof  StyledLayerDescriptorImpl) {
241:                    StyledLayerDescriptorImpl other = (StyledLayerDescriptorImpl) oth;
242:
243:                    return (Utilities.equals(abstractStr, other.abstractStr)
244:                            && Utilities.equals(layers, other.layers)
245:                            && Utilities.equals(name, other.name) && Utilities
246:                            .equals(title, other.title));
247:                }
248:
249:                return false;
250:            }
251:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.