Source Code Cross Referenced for AbstractGridCoverageReader.java in  » GIS » deegree » org » deegree » model » coverage » grid » 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 » deegree » org.deegree.model.coverage.grid 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // $HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/model/coverage/grid/AbstractGridCoverageReader.java $
002:        /*----------------    FILE HEADER  ------------------------------------------
003:
004:         This file is part of deegree.
005:         Copyright (C) 2001-2008 by:
006:         EXSE, Department of Geography, University of Bonn
007:         http://www.giub.uni-bonn.de/deegree/
008:         lat/lon GmbH
009:         http://www.lat-lon.de
010:
011:         This library is free software; you can redistribute it and/or
012:         modify it under the terms of the GNU Lesser General Public
013:         License as published by the Free Software Foundation; either
014:         version 2.1 of the License, or (at your option) any later version.
015:
016:         This library is distributed in the hope that it will be useful,
017:         but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019:         Lesser General Public License for more details.
020:
021:         You should have received a copy of the GNU Lesser General Public
022:         License along with this library; if not, write to the Free Software
023:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:
025:         Contact:
026:
027:         Andreas Poth
028:         lat/lon GmbH
029:         Aennchenstr. 19
030:         53115 Bonn
031:         Germany
032:         E-Mail: poth@lat-lon.de
033:
034:         Prof. Dr. Klaus Greve
035:         Department of Geography
036:         University of Bonn
037:         Meckenheimer Allee 166
038:         53115 Bonn
039:         Germany
040:         E-Mail: greve@giub.uni-bonn.de
041:
042:        
043:         ---------------------------------------------------------------------------*/
044:        package org.deegree.model.coverage.grid;
045:
046:        import java.io.IOException;
047:        import java.util.HashMap;
048:        import java.util.Map;
049:
050:        import org.deegree.model.crs.GeoTransformer;
051:        import org.deegree.model.spatialschema.Envelope;
052:        import org.deegree.ogcwebservices.LonLatEnvelope;
053:        import org.deegree.ogcwebservices.wcs.describecoverage.CoverageOffering;
054:
055:        /**
056:         * @version $Revision: 9437 $
057:         * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
058:         * @author last edited by: $Author: rbezema $
059:         * 
060:         * @version $Revision: 9437 $, $Date: 2008-01-08 02:50:52 -0800 (Tue, 08 Jan 2008) $
061:         */
062:
063:        public abstract class AbstractGridCoverageReader implements 
064:                GridCoverageReader {
065:
066:            protected CoverageOffering description = null;
067:
068:            protected Object source = null;
069:
070:            protected Envelope envelope = null;
071:
072:            private Map<String, String> metadata = new HashMap<String, String>();
073:
074:            private String[] subNames = null;
075:
076:            private String currentSubname = null;
077:
078:            protected Format format = null;
079:
080:            /**
081:             * @param source
082:             * @param description
083:             * @param envelope
084:             * @param format
085:             */
086:            public AbstractGridCoverageReader(Object source,
087:                    CoverageOffering description, Envelope envelope,
088:                    Format format) {
089:                this .description = description;
090:                this .source = source;
091:                this .envelope = envelope;
092:                this .format = format;
093:            }
094:
095:            /**
096:             * Returns the input source. This is the object passed to the
097:             * {@link "org.opengis.coverage.grid.GridCoverageExchange#getReader(Object)"} method. It can be
098:             * a {@link java.lang.String}, an {@link java.io.InputStream}, a
099:             * {@link java.nio.channels.FileChannel}, whatever.
100:             * 
101:             * @return the input source.
102:             */
103:            public Object getSource() {
104:                return source;
105:            }
106:
107:            /**
108:             * Returns the list of metadata keywords associated with the {@linkplain #getSource input
109:             * source} as a whole (not associated with any particular grid coverage). If no metadata is
110:             * available, the array will be empty.
111:             * 
112:             * @return The list of metadata keywords for the input source.
113:             * @throws IOException
114:             *             if an error occurs during reading.
115:             * 
116:             * @revisit This javadoc may not apply thats well in the iterator scheme.
117:             */
118:            public String[] getMetadataNames() throws IOException {
119:                return metadata.keySet().toArray(new String[metadata.size()]);
120:            }
121:
122:            /**
123:             * Retrieve the metadata value for a given metadata name.
124:             * 
125:             * @param name
126:             *            Metadata keyword for which to retrieve metadata.
127:             * @return The metadata value for the given metadata name. Should be one of the name returned by
128:             *         {@link #getMetadataNames}.
129:             * @throws IOException
130:             *             if an error occurs during reading.
131:             * @throws MetadataNameNotFoundException
132:             *             if there is no value for the specified metadata name.
133:             * 
134:             * @revisit This javadoc may not apply thats well in the iterator scheme.
135:             */
136:            public String getMetadataValue(String name) throws IOException,
137:                    MetadataNameNotFoundException {
138:                return metadata.get(name);
139:            }
140:
141:            /**
142:             * Sets the metadata value for a given metadata name.
143:             * 
144:             * @param name
145:             *            Metadata keyword for which to set the metadata.
146:             * @param value
147:             *            The metadata value for the given metadata name.
148:             * @throws IOException
149:             *             if an error occurs during writing.
150:             * @throws MetadataNameNotFoundException
151:             *             if the specified metadata name is not handled for this format.
152:             * 
153:             * @revisit This javadoc may not apply thats well in the iterator scheme.
154:             */
155:            public void setMetadataValue(String name, String value)
156:                    throws IOException, MetadataNameNotFoundException {
157:                metadata.put(name, value);
158:            }
159:
160:            /**
161:             * Set the name for the next grid coverage to GridCoverageWriter#write within the{@linkplain #getSource() input}.
162:             * The subname can been fetch later at reading time.
163:             * 
164:             * @param name
165:             * 
166:             * @throws IOException
167:             *             if an error occurs during writing.
168:             * @revisit Do we need a special method for that, or should it be a metadata?
169:             * 
170:             */
171:            public void setCurrentSubname(String name) throws IOException {
172:                currentSubname = name;
173:            }
174:
175:            /**
176:             * Retrieve the list of grid coverages contained within the {@linkplain #getSource input
177:             * source}. Each grid can have a different coordinate system, number of dimensions and grid
178:             * geometry. For example, a HDF-EOS file (GRID.HDF) contains 6 grid coverages each having a
179:             * different projection. An empty array will be returned if no sub names exist.
180:             * 
181:             * @return The list of grid coverages contained within the input source.
182:             * @throws IOException
183:             *             if an error occurs during reading.
184:             * 
185:             * @revisit The javadoc should also be more explicit about hierarchical format. Should the names
186:             *          be returned as paths? Explain what to return if the GridCoverage are accessible by
187:             *          index only. A proposal is to name them "grid1", "grid2", etc.
188:             */
189:            public String[] listSubNames() throws IOException {
190:                return subNames;
191:            }
192:
193:            /**
194:             * Returns the name for the next grid coverage to be read from the
195:             * {@linkplain #getSource input source}.
196:             * 
197:             * @return the name for the next grid coverage to be read from the input source.
198:             * 
199:             * @throws IOException
200:             *             if an error occurs during reading.
201:             * @revisit Do we need a special method for that, or should it be a metadata?
202:             * 
203:             */
204:            public String getCurrentSubname() throws IOException {
205:                return currentSubname;
206:            }
207:
208:            /**
209:             * Returns the format handled by this <code>GridCoverageReader</code>.
210:             * 
211:             * @return the format handled by this <code>GridCoverageReader</code>.
212:             * 
213:             */
214:            public Format getFormat() {
215:                return format;
216:            }
217:
218:            /**
219:             * transforms the passed <tt>Envelope</tt> to a <tt>LonLatEnvelope</tt> If the passed source
220:             * CRS isn't equal to "EPSG:4326" the <tt>Envelope</tt> will be transformed to "EPSG:4326"
221:             * first.
222:             * 
223:             * @param env
224:             * @param sourceCRS
225:             * @return LatLonEnvelope in "EPSG:4326"
226:             */
227:            protected LonLatEnvelope calcLonLatEnvelope(Envelope env,
228:                    String sourceCRS) {
229:                LonLatEnvelope lle = null;
230:                if (sourceCRS.equalsIgnoreCase("EPSG:4326")) {
231:                    lle = new LonLatEnvelope(env);
232:                } else {
233:                    try {
234:                        GeoTransformer tr = new GeoTransformer("EPSG:4326");
235:                        env = tr.transform(env, sourceCRS);
236:                    } catch (Exception e) {
237:                        e.printStackTrace();
238:                    }
239:                    lle = new LonLatEnvelope(env);
240:                }
241:                return lle;
242:            }
243:
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.