Source Code Cross Referenced for MapLayerInfo.java in  » GIS » GeoServer » org » vfny » geoserver » global » 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 » GeoServer » org.vfny.geoserver.global 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
002:         * This code is licensed under the GPL 2.0 license, availible at the root
003:         * application directory.
004:         */
005:        package org.vfny.geoserver.global;
006:
007:        import com.vividsolutions.jts.geom.Envelope;
008:        import org.geotools.data.FeatureSource;
009:        import org.geotools.geometry.jts.ReferencedEnvelope;
010:        import org.geotools.styling.Style;
011:        import org.vfny.geoserver.global.dto.CoverageInfoDTO;
012:        import org.vfny.geoserver.global.dto.FeatureTypeInfoDTO;
013:        import org.vfny.geoserver.util.DataStoreUtils;
014:        import java.io.IOException;
015:        import java.util.List;
016:
017:        /**
018:         * DOCUMENT ME!
019:         *
020:         * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last
021:         *         modification)
022:         * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last
023:         *         modification)
024:         */
025:        public final class MapLayerInfo extends GlobalLayerSupertype {
026:            public static int TYPE_VECTOR = Data.TYPE_VECTOR.intValue();
027:            public static int TYPE_RASTER = Data.TYPE_RASTER.intValue();
028:            public static int TYPE_BASEMAP = Data.TYPE_RASTER.intValue() + 1;
029:            public static int TYPE_REMOTE_VECTOR = Data.TYPE_RASTER.intValue() + 2;
030:
031:            /**
032:             *
033:             * @uml.property name="feature"
034:             * @uml.associationEnd multiplicity="(0 1)"
035:             */
036:            private FeatureTypeInfo feature;
037:
038:            /**
039:             * The feature source for the remote WFS layer (see REMOVE_OWS_TYPE/URL in the SLD spec)
040:             */
041:            private FeatureSource remoteFeatureSource;
042:
043:            /**
044:             *
045:             * @uml.property name="coverage"
046:             * @uml.associationEnd multiplicity="(0 1)"
047:             */
048:            private CoverageInfo coverage;
049:
050:            /**
051:             *
052:             * @uml.property name="type" multiplicity="(0 1)"
053:             */
054:            private int type;
055:
056:            /**
057:             *
058:             * @uml.property name="name" multiplicity="(0 1)"
059:             */
060:            private String name;
061:
062:            /**
063:             *
064:             * @uml.property name="label" multiplicity="(0 1)"
065:             */
066:            private String label;
067:
068:            /**
069:             *
070:             * @uml.property name="description" multiplicity="(0 1)"
071:             */
072:            private String description;
073:
074:            /**
075:             *
076:             * @uml.property name="dirName" multiplicity="(0 1)"
077:             */
078:            private String dirName;
079:
080:            /**
081:             * List of sublayer for a grouped layer
082:             */
083:            private List subLayerInfo;
084:
085:            /**
086:             * List of styles for a grouped layer
087:             */
088:            private List styles;
089:
090:            public MapLayerInfo() {
091:                name = "";
092:                label = "";
093:                description = "";
094:                dirName = "";
095:
096:                coverage = null;
097:                feature = null;
098:                type = -1;
099:            }
100:
101:            public MapLayerInfo(CoverageInfo info) {
102:                name = info.getName();
103:                label = info.getLabel();
104:                description = info.getDescription();
105:                dirName = info.getDirName();
106:
107:                coverage = info;
108:                feature = null;
109:                type = TYPE_RASTER;
110:            }
111:
112:            public MapLayerInfo(FeatureTypeInfo info) {
113:                name = info.getName();
114:                label = info.getTitle();
115:                description = info.getAbstract();
116:                dirName = info.getDirName();
117:
118:                feature = info;
119:                coverage = null;
120:                type = TYPE_VECTOR;
121:            }
122:
123:            public MapLayerInfo(FeatureSource remoteSource) {
124:                name = remoteSource.getSchema().getTypeName();
125:                label = name;
126:                description = "Remote WFS";
127:                dirName = null;
128:                this .remoteFeatureSource = remoteSource;
129:
130:                type = TYPE_REMOTE_VECTOR;
131:            }
132:
133:            /*
134:             * (non-Javadoc)
135:             *
136:             * @see org.vfny.geoserver.global.GlobalLayerSupertype#toDTO()
137:             */
138:            Object toDTO() {
139:                return null;
140:            }
141:
142:            /**
143:             * getBoundingBox purpose.
144:             *
145:             * <p>
146:             * The feature source bounds.
147:             * </p>
148:             *
149:             * @return Envelope the feature source bounds.
150:             *
151:             * @throws IOException
152:             *             when an error occurs
153:             */
154:            public Envelope getBoundingBox() throws IOException {
155:                if (this .type == TYPE_VECTOR) {
156:                    try {
157:                        return feature.getBoundingBox();
158:                    } catch (IllegalArgumentException e) {
159:                        FeatureSource realSource = feature.getFeatureSource();
160:
161:                        return DataStoreUtils
162:                                .getBoundingBoxEnvelope(realSource);
163:                    }
164:                } else {
165:                    // using referenced envelope (experiment)
166:                    return new ReferencedEnvelope(coverage.getEnvelope()
167:                            .getMinimum(0), coverage.getEnvelope()
168:                            .getMaximum(0), coverage.getEnvelope()
169:                            .getMinimum(1), coverage.getEnvelope()
170:                            .getMaximum(1), coverage.getCrs());
171:                }
172:            }
173:
174:            /**
175:             * Get the bounding box in latitude and longitude for this layer.
176:             *
177:             * @return Envelope the feature source bounds.
178:             *
179:             * @throws IOException
180:             *             when an error occurs
181:             */
182:            public Envelope getLatLongBoundingBox() throws IOException {
183:                if (this .type == TYPE_VECTOR) {
184:                    try {
185:                        return feature.getLatLongBoundingBox();
186:                    } catch (IllegalArgumentException e) {
187:                        FeatureSource realSource = feature.getFeatureSource();
188:
189:                        return DataStoreUtils
190:                                .getBoundingBoxEnvelope(realSource);
191:                    }
192:                } else {
193:                    // using referenced envelope (experiment)
194:                    org.geotools.geometry.GeneralEnvelope ge = coverage
195:                            .getWGS84LonLatEnvelope();
196:                    return new Envelope(ge.getMinimum(0), ge.getMaximum(0), ge
197:                            .getMinimum(1), ge.getMaximum(1));
198:                }
199:            }
200:
201:            /**
202:             *
203:             * @uml.property name="coverage"
204:             */
205:            public CoverageInfo getCoverage() {
206:                return coverage;
207:            }
208:
209:            /**
210:             *
211:             * @uml.property name="coverage"
212:             */
213:            public void setCoverage(CoverageInfo coverage) {
214:                this .name = coverage.getName();
215:                this .label = coverage.getLabel();
216:                this .description = coverage.getDescription();
217:                this .dirName = coverage.getDirName();
218:                this .coverage = coverage;
219:                this .feature = null;
220:                this .type = TYPE_RASTER;
221:            }
222:
223:            /**
224:             * Sets this up as a base layer
225:             * @param baseLayerName
226:             * @param subLayerInfo
227:             * @param styles
228:             */
229:            public void setBase(String baseLayerName, List subLayerInfo,
230:                    List styles) {
231:                this .name = baseLayerName;
232:                this .type = TYPE_BASEMAP;
233:                this .subLayerInfo = subLayerInfo;
234:                this .styles = styles;
235:            }
236:
237:            /**
238:             * Returns the sub layers of a base layer, as a list of MapLayerInfo objects
239:             * @return
240:             */
241:            public List getSubLayers() {
242:                return subLayerInfo;
243:            }
244:
245:            /**
246:             * Returns the styles of a base layer
247:             * @return
248:             */
249:            public List getStyles() {
250:                return styles;
251:            }
252:
253:            /**
254:             *
255:             * @uml.property name="description"
256:             */
257:            public String getDescription() {
258:                return description;
259:            }
260:
261:            /**
262:             *
263:             * @uml.property name="description"
264:             */
265:            public void setDescription(String description) {
266:                this .description = description;
267:            }
268:
269:            /**
270:             *
271:             * @uml.property name="dirName"
272:             */
273:            public String getDirName() {
274:                return dirName;
275:            }
276:
277:            /**
278:             *
279:             * @uml.property name="dirName"
280:             */
281:            public void setDirName(String dirName) {
282:                this .dirName = dirName;
283:            }
284:
285:            /**
286:             *
287:             * @uml.property name="feature"
288:             */
289:            public FeatureTypeInfo getFeature() {
290:                return feature;
291:            }
292:
293:            /**
294:             *
295:             * @uml.property name="feature"
296:             */
297:            public void setFeature(FeatureTypeInfo feature) {
298:                // handle InlineFeatureStuff
299:                try {
300:                    this .name = feature.getName();
301:                    this .label = feature.getTitle();
302:                    this .description = feature.getAbstract();
303:                    this .dirName = feature.getDirName();
304:                } catch (IllegalArgumentException e) {
305:                    this .name = "";
306:                    this .label = "";
307:                    this .description = "";
308:                    this .dirName = "";
309:                }
310:
311:                this .feature = feature;
312:                this .coverage = null;
313:                this .type = TYPE_VECTOR;
314:            }
315:
316:            /**
317:             *
318:             * @uml.property name="label"
319:             */
320:            public String getLabel() {
321:                return label;
322:            }
323:
324:            /**
325:             *
326:             * @uml.property name="label"
327:             */
328:            public void setLabel(String label) {
329:                this .label = label;
330:            }
331:
332:            /**
333:             *
334:             * @uml.property name="name"
335:             */
336:            public String getName() {
337:                return name;
338:            }
339:
340:            /**
341:             *
342:             * @uml.property name="name"
343:             */
344:            public void setName(String name) {
345:                this .name = name;
346:            }
347:
348:            /**
349:             *
350:             * @uml.property name="type"
351:             */
352:            public int getType() {
353:                return type;
354:            }
355:
356:            /**
357:             *
358:             * @uml.property name="type"
359:             */
360:            public void setType(int type) {
361:                this .type = type;
362:            }
363:
364:            public Style getDefaultStyle() {
365:                if (this .type == TYPE_VECTOR) {
366:                    return this .feature.getDefaultStyle();
367:                } else if (this .type == TYPE_RASTER) {
368:                    return this .coverage.getDefaultStyle();
369:                }
370:
371:                return null;
372:            }
373:
374:            /**
375:             * Returns the remote feature source in case this layer is a remote WFS layer
376:             * @return
377:             */
378:            public FeatureSource getRemoteFeatureSource() {
379:                return remoteFeatureSource;
380:            }
381:
382:            public void setRemoteFeatureSource(FeatureSource remoteFeatureSource) {
383:                this.remoteFeatureSource = remoteFeatureSource;
384:            }
385:
386:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.