Source Code Cross Referenced for VPFDataBase.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » vpf » 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.data.vpf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2004-2006, Geotools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation; either
009:         *    version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         */
016:        package org.geotools.data.vpf;
017:
018:        import java.io.File;
019:        import java.io.IOException;
020:        import java.util.Iterator;
021:        import java.util.List;
022:        import java.util.Vector;
023:
024:        import org.geotools.data.vpf.file.VPFFile;
025:        import org.geotools.data.vpf.file.VPFFileFactory;
026:        import org.geotools.data.vpf.ifc.FileConstants;
027:        import org.geotools.feature.Feature;
028:        import org.geotools.feature.SchemaException;
029:
030:        /**
031:         * This class is not completely implemented due to a decision that the 
032:         * VPFDataStore shall correspond to the VPFLibrary class, not this class
033:         *
034:         * @author <a href="mailto:kobit@users.sourceforge.net">Artur Hefczyc</a>
035:         * @author <a href="mailto:knuterik@onemap.org">Knut-Erik Johnsen</a>, Project
036:         *         OneMap
037:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/main/java/org/geotools/data/vpf/VPFDataBase.java $
038:         * @version $Id: VPFDataBase.java 22482 2006-10-31 02:58:00Z desruisseaux $
039:         */
040:        public class VPFDataBase implements  FileConstants {
041:            /**
042:             * The libraries in the database
043:             */
044:            private final List libraries = new Vector();
045:
046:            /**
047:             * Constructor
048:             * @param directory A <code>File</code> representing the base directory of the database
049:             * @throws IOException
050:             * @throws SchemaException
051:             */
052:            public VPFDataBase(File directory) throws IOException,
053:                    SchemaException {
054:                VPFFile vpfTable;
055:                String vpfTableName;
056:                Feature feature;
057:                VPFLibrary library;
058:
059:                // read libraries info
060:                vpfTableName = new File(directory, LIBRARY_ATTTIBUTE_TABLE)
061:                        .toString();
062:                vpfTable = VPFFileFactory.getInstance().getFile(vpfTableName);
063:
064:                Iterator iter = vpfTable.readAllRows().iterator();
065:
066:                while (iter.hasNext()) {
067:                    feature = (Feature) iter.next();
068:
069:                    try {
070:                        library = new VPFLibrary(feature, directory);
071:                        libraries.add(library);
072:                    } catch (java.io.FileNotFoundException ex) {
073:                        // This must be a partial data set - the library wasn't found so just ignore it
074:                    }
075:                }
076:
077:                //        // read data base header info
078:                //        //this.directory = directory;
079:                //        String vpfTableName = new File(directory, DATABASE_HEADER_TABLE).toString();
080:                //        VPFFile vpfTable = VPFFileFactory.getInstance().getFile(vpfTableName);
081:                //        vpfTable.reset();
082:                //        Feature dataBaseInfo = (Feature) vpfTable.readFeature();
083:                ////        vpfTable.close();
084:                //
085:                //        // read libraries info
086:                //        vpfTableName = new File(directory, LIBRARY_ATTTIBUTE_TABLE).toString();
087:                //        vpfTable = VPFFileFactory.getInstance().getFile(vpfTableName);
088:                //
089:                //        Iterator iter = vpfTable.readAllRows().iterator();
090:                //        while(iter.hasNext()){
091:                //            
092:                //        }
093:                ////        vpfTable.close();
094:                //
095:                //        TableRow[] libraries_tmp = (TableRow[]) list.toArray(new TableRow[list.size()]);
096:                //        libraries = new VPFLibrary[libraries_tmp.length];
097:                //
098:                //        for (int i = 0; i < libraries_tmp.length; i++) {
099:                //            libraries[i] = new VPFLibrary(libraries_tmp[i], directory, this);
100:                //        }
101:            }
102:
103:            /**
104:             * Returns the libraries that are in the database
105:             * @return a <code>List</code> containing <code>VPFLibrary</code> objects
106:             */
107:            public List getLibraries() {
108:                return libraries;
109:            }
110:
111:            /**
112:             * Returns the minimum X value of the database
113:             * @return a <code>double</code> value
114:             */
115:            public double getMinX() {
116:                double result = Double.NaN;
117:                Iterator iter = libraries.iterator();
118:                VPFLibrary library;
119:
120:                if (iter.hasNext()) {
121:                    library = (VPFLibrary) iter.next();
122:                    result = library.getXmin();
123:                }
124:
125:                while (iter.hasNext()) {
126:                    library = (VPFLibrary) iter.next();
127:                    result = Math.min(result, library.getXmin());
128:                }
129:
130:                return result;
131:            }
132:
133:            /**
134:             * Returns the minimum X value of the database
135:             * @return a <code>double</code> value
136:             */
137:            public double getMinY() {
138:                double result = Double.NaN;
139:                Iterator iter = libraries.iterator();
140:                VPFLibrary library;
141:
142:                if (iter.hasNext()) {
143:                    library = (VPFLibrary) iter.next();
144:                    result = library.getYmin();
145:                }
146:
147:                while (iter.hasNext()) {
148:                    library = (VPFLibrary) iter.next();
149:                    result = Math.min(result, library.getYmin());
150:                }
151:
152:                return result;
153:            }
154:
155:            /**
156:             * Returns the minimum X value of the database
157:             * @return a <code>double</code> value
158:             */
159:            public double getMaxX() {
160:                double result = Double.NaN;
161:                Iterator iter = libraries.iterator();
162:                VPFLibrary library;
163:
164:                if (iter.hasNext()) {
165:                    library = (VPFLibrary) iter.next();
166:                    result = library.getXmax();
167:                }
168:
169:                while (iter.hasNext()) {
170:                    library = (VPFLibrary) iter.next();
171:                    result = Math.max(result, library.getXmax());
172:                }
173:
174:                return result;
175:            }
176:
177:            /**
178:             * Returns the minimum X value of the database
179:             * @return a <code>double</code> value
180:             */
181:            public double getMaxY() {
182:                double result = Double.NaN;
183:                Iterator iter = libraries.iterator();
184:                VPFLibrary library;
185:
186:                if (iter.hasNext()) {
187:                    library = (VPFLibrary) iter.next();
188:                    result = library.getYmax();
189:                }
190:
191:                while (iter.hasNext()) {
192:                    library = (VPFLibrary) iter.next();
193:                    result = Math.max(result, library.getYmax());
194:                }
195:
196:                return result;
197:            }
198:
199:            /*
200:             *  (non-Javadoc)
201:             * @see java.lang.Object#toString()
202:             */
203:            public String toString() {
204:                return "VPF database with the following extents: \n"
205:                        + getMinX() + " " + getMinY() + " - " + getMaxX() + " "
206:                        + getMinY() + "\n";
207:            }
208:
209:            //    public VPFFeatureClass getFeatureClass(String typename) {
210:            //        VPFFeatureClass tmp = null;
211:            //
212:            //        for (int i = 0; i < libraries.length; i++) {
213:            //            tmp = libraries[i].getFeatureClass(typename);
214:            //
215:            //            if (tmp != null) {
216:            //                return tmp;
217:            //            }
218:            //        }
219:            //
220:            //        return null;
221:            //    }
222:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.