Source Code Cross Referenced for MapLayer.java in  » GIS » openjump » com » vividsolutions » wms » 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 » openjump » com.vividsolutions.wms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI 
003:         * for visualizing and manipulating spatial features with geometry and attributes.
004:         *
005:         * Copyright (C) 2003 Vivid Solutions
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License
009:         * as published by the Free Software Foundation; either version 2
010:         * of the License, or (at your option) any later version.
011:         * 
012:         * This program 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
015:         * GNU General Public License for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020:         * 
021:         * For more information, contact:
022:         *
023:         * Vivid Solutions
024:         * Suite #1A
025:         * 2328 Government Street
026:         * Victoria BC  V8T 5G5
027:         * Canada
028:         *
029:         * (250)385-6040
030:         * www.vividsolutions.com
031:         */
032:
033:        // Changed by Uwe Dalluege, uwe.dalluege@rzcn.haw-hamburg.de
034:        // to differ between LatLonBoundingBox and BoundingBox
035:        // 2005-07-29
036:        package com.vividsolutions.wms;
037:
038:        import java.util.*;
039:
040:        import com.vividsolutions.jump.util.CollectionUtil;
041:
042:        /**
043:         * Represents a WMS Layer.
044:         *
045:         * @author Chris Hodgson chodgson@refractions.net
046:         */
047:        public class MapLayer {
048:
049:            // immutable members
050:            private MapLayer parent;
051:            private String name;
052:            private String title;
053:            private ArrayList srsList;
054:            private ArrayList subLayers;
055:            private BoundingBox bbox;
056:
057:            // I think, bbox contains the information about LatLonBoundingBox
058:            // (see Parser.java)
059:            // I need a new list for <BoundingBox> [uwe dalluege]
060:            private ArrayList boundingBoxList;
061:
062:            // user modifiable members
063:            private boolean enabled = false;
064:
065:            /**
066:             * Creates a new instance of MapLayer 
067:             */
068:            public MapLayer(String name, String title, Collection srsList,
069:                    Collection subLayers, BoundingBox bbox) {
070:                this .parent = null;
071:                this .name = name;
072:                this .title = title;
073:                this .srsList = new ArrayList(srsList);
074:                this .subLayers = new ArrayList(subLayers);
075:                Iterator it = subLayers.iterator();
076:                while (it.hasNext()) {
077:                    ((MapLayer) it.next()).parent = this ;
078:                }
079:                this .bbox = bbox;
080:            }
081:
082:            // ----------------------------------------------------- MapLayer MapLayer ( )
083:            /**
084:             * Creates a new instance of MapLayer with boundingBoxList [uwe dalluege]
085:             */
086:            public MapLayer(String name, String title, Collection srsList,
087:                    Collection subLayers, BoundingBox bbox,
088:                    ArrayList boundingBoxList) {
089:                this (name, title, srsList, subLayers, bbox);
090:                this .boundingBoxList = boundingBoxList;
091:            }
092:
093:            // ----------------------------------------------------- MapLayer MapLayer ( )
094:            // ---------------------------------------- MapLayer getAllBoundingBoxList ( )
095:            /**
096:             * @return All BoundingBoxes
097:             * If there is no BoundingBox for this MapLayer the parent-BoundingBox
098:             * will be taken.
099:             * @author uwe dalluege
100:             */
101:            public ArrayList getAllBoundingBoxList() {
102:                ArrayList allBoundingBoxList = new ArrayList();
103:                MapLayer mapLayer = this ;
104:                allBoundingBoxList = this .getBoundingBoxList();
105:
106:                if (allBoundingBoxList.size() > 0)
107:                    return allBoundingBoxList;
108:                // ---------------------------------------- MapLayer getAllBoundingBoxList ( )  	
109:                while (mapLayer != null) {
110:                    mapLayer = mapLayer.getParent();
111:                    if (mapLayer == null)
112:                        return allBoundingBoxList;
113:                    allBoundingBoxList = mapLayer.getBoundingBoxList();
114:                    if (allBoundingBoxList.size() > 0)
115:                        return allBoundingBoxList;
116:                }
117:                // ---------------------------------------- MapLayer getAllBoundingBoxList ( )  	
118:                return allBoundingBoxList;
119:            }
120:
121:            // ---------------------------------------- MapLayer getAllBoundingBoxList ( )  
122:
123:            /**
124:             * Returns the number of sub-layers that this MapLayer has.
125:             * @return the number of sub-layers that this MapLayer has
126:             */
127:            public int numSubLayers() {
128:                return subLayers.size();
129:            }
130:
131:            /**
132:             * Returns the sub-layer at the specified index.
133:             * @param n the index of the sub-layer to return
134:             * @return the MapLayer sub-layer at the specified index
135:             */
136:            public MapLayer getSubLayer(int n) {
137:                return (MapLayer) subLayers.get(n);
138:            }
139:
140:            /**
141:             * Gets a copy of the list of the sublayers of this layer.
142:             * @return a copy of the Arraylist containing all the sub-layers of this layer
143:             */
144:            public ArrayList getSubLayerList() {
145:                return (ArrayList) subLayers.clone();
146:            }
147:
148:            /**
149:             * Returns a list of all the layers in order of a root-left-right traversal of
150:             * the layer tree.
151:             * @return a list of all the layers in order of a root-left-right traversal of
152:             * the layer tree.
153:             */
154:            public ArrayList getLayerList() {
155:                ArrayList list = new ArrayList();
156:                list.add(this );
157:                Iterator it = subLayers.iterator();
158:                while (it.hasNext()) {
159:                    list.addAll(((MapLayer) it.next()).getLayerList());
160:                }
161:                return list;
162:            }
163:
164:            /**
165:             * Gets the title of this MapLayer.
166:             * The title of a layer should be used for display purposes.
167:             * @return the title of this Layer
168:             */
169:            public String getTitle() {
170:                return title;
171:            }
172:
173:            /**
174:             * Gets the name of this Layer.
175:             * The name of a layer is its 'back-end', ugly name, which generally 
176:             * shouldn't need to be used by others but is available anyway.
177:             * Layers which do not have any data associated with them, such as container
178:             * or grouping layers, might not have a name, in which case null will be
179:             * returned.
180:             * @return the name of the layer, or null if it doesn't have a name
181:             */
182:            public String getName() {
183:                return name;
184:            }
185:
186:            /**
187:             * Gets the parent MapLayer of this MapLayer. 
188:             * @return the parent layer of this MapLayer, or null if the layer has no parent.
189:             */
190:            public MapLayer getParent() {
191:                return parent;
192:            }
193:
194:            /**
195:             * Gets the LatLonBoundingBox for this layer.
196:             * If this layer doesn't have a LatLonBoundingBox specified, we recursively
197:             * ask the parent layer for its bounding box. The WMS spec says that each
198:             * layer should either have its own LatLonBoundingBox, or inherit one from
199:             * its parent, so this recursive call should be successful. If not, null is
200:             * returned. However, if a bounding box is returned, it will have the 
201:             * SRS string "LatLon". 
202:             * Note that the BoundingBox is not necessarily "tight".
203:             * @return the BoundingBox for this layer, or null if the BBox is unknown
204:             */
205:            public BoundingBox getBoundingBox() {
206:
207:                if (bbox != null) {
208:                    return bbox;
209:                }
210:                if (parent != null) {
211:                    return parent.getBoundingBox();
212:                }
213:                return null;
214:            }
215:
216:            //----------------------------------------- MapLayer getLatLonBoundingBox ( )   
217:            /**
218:             * I think this name is better [uwe dalluege]
219:             * Gets the LatLonBoundingBox for this layer.
220:             * If this layer doesn't have a LatLonBoundingBox specified, we recursively
221:             * ask the parent layer for its bounding box. The WMS spec says that each
222:             * layer should either have its own LatLonBoundingBox, or inherit one from
223:             * its parent, so this recursive call should be successful. If not, null is
224:             * returned. However, if a bounding box is returned, it will have the 
225:             * SRS string "LatLon". 
226:             * Note that the BoundingBox is not necessarily "tight".
227:             * @return the BoundingBox for this layer, or null if the BBox is unknown
228:             */
229:            public BoundingBox getLatLonBoundingBox() {
230:
231:                if (bbox != null) {
232:                    return bbox;
233:                }
234:                if (parent != null) {
235:                    return parent.getBoundingBox();
236:                }
237:                return null;
238:            }
239:
240:            // ----------------------------------------- MapLayer getLatLonBoundingBox ( )  
241:            //-------------------------------------------- MapLayer getBoundingBoxList ( )  
242:            /**
243:             * Gets the BoundingBoxList for this Layer
244:             * @return the BoundingBoxList containing the BoundingBoxes
245:             */
246:            // ------------------------------------------- MapLayer getBoundingBoxList ( )
247:            public ArrayList getBoundingBoxList() {// [uwe dalluege]
248:                return (ArrayList) boundingBoxList.clone();
249:            }
250:
251:            //--------------------------------------------- MapLayer getBoundingBoxList ( )  
252:
253:            /**
254:             * Returns a copy of the list of supported SRS's. Each SRS is a string in the
255:             * format described by the WMS specification, such as "EPSG:1234".
256:             * @return a copy of the list of supported SRS's
257:             */
258:            public ArrayList getSRSList() {
259:                return (ArrayList) srsList.clone();
260:            }
261:
262:            //<<TODO>>I'd like to return generic Lists, rather than concrete ArrayLists.
263:            //Or even better, Collections, since order is not significant (I think) [Jon Aquino]
264:            /**
265:             * @return a list of the SRS list of this MapLayer and its ancestors
266:             */
267:            public Collection getFullSRSList() {
268:                ArrayList fullSRSList = new ArrayList(getSRSList());
269:                if (parent != null)
270:                    fullSRSList.addAll(parent.getFullSRSList());
271:                return CollectionUtil.removeDuplicates(fullSRSList);
272:            }
273:
274:            /**
275:             * Returns a somewhat nicely-formatted string representing all of the details of
276:             * this layer and its sub-layers (recursively).
277:             * @return a somewhat nicely-formatted string representing all of the details of
278:             * this layer and its sub-layers (recursively).
279:             */
280:            public String toString() {
281:                StringBuffer s = new StringBuffer("WMSLayer {\n" + "  name: \""
282:                        + name + "\"\n" + "  title: \"" + title + "\"\n"
283:                        + "  srsList: " + srsList.toString() + "\n"
284:                        + "  subLayers: [\n");
285:                for (int i = 0; i < subLayers.size(); i++) {
286:                    s.append(subLayers.get(i).toString() + ", ");
287:                }
288:                s.append("  ]\n  bbox: ");
289:                if (bbox != null) {
290:                    s.append(bbox.toString());
291:                } else {
292:                    s.append("null");
293:                }
294:                s.append("\n}\n");
295:                return s.toString();
296:            }
297:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.