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


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) Copyright IBM Corporation, 2005. All rights reserved.
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;
009:         *    version 2.1 of the License.
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:         */
017:        package org.geotools.data.db2;
018:
019:        import org.geotools.factory.FactoryRegistryException;
020:        import org.geotools.referencing.ReferencingFactoryFinder;
021:        import org.opengis.referencing.FactoryException;
022:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
023:        import java.sql.Connection;
024:        import java.sql.ResultSet;
025:        import java.sql.SQLException;
026:        import java.sql.Statement;
027:
028:        /**
029:         * Represent the coordinate system information maintained in the DB2 Spatial
030:         * Extender catalog tables.
031:         *
032:         * @author David Adler - IBM Corporation
033:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/db2/src/main/java/org/geotools/data/db2/DB2CoordinateSystem.java $
034:         */
035:        public class DB2CoordinateSystem {
036:            private int srsId;
037:            private String coordsysName;
038:            private CoordinateReferenceSystem crs = null;
039:            private String organization;
040:            private int coordsysId;
041:            private String definition;
042:
043:            /**
044:             * Constructs a DB2CoordinateSystem.
045:             *
046:             * @param conn an open database connection.
047:             * @param srsId the DB2 spatial reference system identifier.
048:             *
049:             * @throws SQLException if there was a database error attempting to load
050:             *         the coordinate system information.
051:             */
052:            public DB2CoordinateSystem(Connection conn, int srsId)
053:                    throws SQLException {
054:                super ();
055:                this .srsId = srsId;
056:                this .loadFromDB(conn);
057:            }
058:
059:            /**
060:             * Selects the coordinate system information from the DB2 spatial catalog
061:             * table db2gse.ST_Spatial_Reference_Systems.
062:             * 
063:             * <p></p>
064:             *
065:             * @param conn an open database connection
066:             *
067:             * @throws SQLException if there was a database error attempting to load
068:             *         the coordinate system information.
069:             */
070:            private void loadFromDB(Connection conn) throws SQLException {
071:                String querySRS = "SELECT coordsys_name, organization, organization_coordsys_id, "
072:                        + " definition"
073:                        + " FROM db2gse.st_spatial_reference_systems"
074:                        + " WHERE srs_id = " + this .srsId;
075:                Statement stmt = conn.createStatement();
076:                ResultSet rs = stmt.executeQuery(querySRS);
077:
078:                if (rs.next()) {
079:                    this .coordsysName = rs.getString(1);
080:                    this .organization = rs.getString(2);
081:                    this .coordsysId = rs.getInt(3);
082:                    this .definition = rs.getString(4);
083:                } else {
084:                    throw new SQLException("Unrecognized srid '" + this .srsId
085:                            + "'");
086:                }
087:
088:                rs.close();
089:                stmt.close();
090:            }
091:
092:            /**
093:             * Returns the coordinate system name, organization and coordinate system
094:             * identifier.
095:             *
096:             * @return the coordinate system name, organization and coordinate system
097:             *         identifier  as a String.
098:             */
099:            public String toString() {
100:                return this .coordsysName + "=" + this .organization + ":"
101:                        + this .coordsysId;
102:            }
103:
104:            /**
105:             * Gets the coordinate system identifier, usually an EPSG or similar value.
106:             *
107:             * @return coordinate system identifier.
108:             */
109:            int getCsId() {
110:                return this .coordsysId;
111:            }
112:
113:            /**
114:             * Gets the OpenGIS CoordinateReferenceSystem for this DB2CoordinateSystem.
115:             *
116:             * @return a CoordinateReferenceSystem
117:             *
118:             * @throws FactoryRegistryException
119:             * @throws FactoryException
120:             */
121:            CoordinateReferenceSystem getCRS() throws FactoryRegistryException,
122:                    FactoryException {
123:                if (this.crs == null) {
124:                    this.crs = ReferencingFactoryFinder.getCRSFactory(null)
125:                            .createFromWKT(this.definition);
126:                }
127:
128:                return this.crs;
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.