Source Code Cross Referenced for Geometry.java in  » GIS » GeoTools-2.4.1 » org » geotools » geometry » 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.geometry 
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;
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:        package org.geotools.geometry;
017:
018:        // J2SE dependencies
019:        import java.io.Serializable;
020:        import java.util.NoSuchElementException;
021:
022:        // OpenGIS dependencies
023:        import org.opengis.referencing.FactoryException;
024:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
025:        import org.opengis.referencing.operation.CoordinateOperationFactory;
026:        import org.opengis.referencing.operation.TransformException;
027:        import org.opengis.util.Cloneable;
028:
029:        // Geotools dependencies
030:        import org.geotools.referencing.ReferencingFactoryFinder;
031:        import org.geotools.referencing.operation.TransformPathNotFoundException;
032:
033:        /**
034:         * Root class of the Geotools default implementation of geometric object. {@code Geometry}
035:         * instances are sets of direct positions in a particular coordinate reference system.
036:         *
037:         * @since 2.0
038:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/geometry/Geometry.java $
039:         * @deprecated Will be recreated in the ISO geometry module.
040:         * @version $Id: Geometry.java 28965 2008-01-27 16:46:58Z acuster $
041:         * @author Martin Desruisseaux
042:         */
043:        public abstract class Geometry implements 
044:                org.opengis.geometry.Geometry, Serializable {
045:            /**
046:             * Serial number for interoperability with different versions.
047:             */
048:            private static final long serialVersionUID = -601532429079649232L;
049:
050:            /**
051:             * The default {@link CoordinateOperationFactory} to uses for {@link #mathTransform}.
052:             * Will be constructed only when first requested.
053:             */
054:            private static CoordinateOperationFactory coordinateOperationFactory;
055:
056:            /**
057:             * The coordinate reference system used in {@linkplain GeneralDirectPosition direct position}
058:             * coordinates.
059:             */
060:            protected final CoordinateReferenceSystem crs;
061:
062:            /**
063:             * Constructs a geometry with the specified coordinate reference system.
064:             *
065:             * @param crs The coordinate reference system used in
066:             *            {@linkplain GeneralDirectPosition direct position} coordinates.
067:             */
068:            public Geometry(final CoordinateReferenceSystem crs) {
069:                this .crs = crs;
070:            }
071:
072:            /**
073:             * Returns the coordinate reference system used in {@linkplain GeneralDirectPosition
074:             * direct position} coordinates.
075:             *
076:             * @return The coordinate reference system used in {@linkplain GeneralDirectPosition
077:             *         direct position} coordinates.
078:             *
079:             * @see #getCoordinateDimension
080:             */
081:            public CoordinateReferenceSystem getCoordinateReferenceSystem() {
082:                return crs;
083:            }
084:
085:            /**
086:             * Returns the dimension of the coordinates that define this {@code Geometry}, which must
087:             * be the same as the coordinate dimension of the coordinate reference system for this
088:             * {@code Geometry}.
089:             *
090:             * @return The coordinate dimension.
091:             *
092:             * @see #getDimension
093:             * @see #getCoordinateReferenceSystem
094:             */
095:            public int getCoordinateDimension() {
096:                return crs.getCoordinateSystem().getDimension();
097:            }
098:
099:            /**
100:             * Returns a new {@code Geometry} that is the coordinate transformation of this
101:             * {@code Geometry} into the passed coordinate reference system within the accuracy
102:             * of the transformation.
103:             *
104:             * @param  newCRS The new coordinate reference system.
105:             * @return The transformed {@code Geometry}.
106:             * @throws TransformException if the transformation failed.
107:             */
108:            public org.opengis.geometry.Geometry transform(
109:                    CoordinateReferenceSystem newCRS) throws TransformException {
110:                if (coordinateOperationFactory == null) {
111:                    // No need to synchronize: this is not a problem if this method is invoked
112:                    // twice in two different threads.
113:                    try {
114:                        coordinateOperationFactory = ReferencingFactoryFinder
115:                                .getCoordinateOperationFactory(null);
116:                    } catch (NoSuchElementException exception) {
117:                        // TODO: localize the message
118:                        throw new TransformException(
119:                                "Can't transform the geometry", exception);
120:                    }
121:                }
122:                try {
123:                    return transform(newCRS, coordinateOperationFactory
124:                            .createOperation(crs, newCRS).getMathTransform());
125:                } catch (FactoryException exception) {
126:                    // TODO: localize the message
127:                    throw new TransformPathNotFoundException(
128:                            "Can't transform the geometry", exception);
129:                }
130:            }
131:
132:            /**
133:             * Returns a clone of this geometry with <em>deep</em> copy semantic. Any change on this object
134:             * will have no impact on the returned clone, and conversely. For big geometries, implementations
135:             * are encouraged to share as much internal data as possible (as opposed to performing a real
136:             * copy of the data), while preserving the deep copy semantic.
137:             * <P>
138:             * The default implementation throws {@link CloneNotSupportedException}. If subclasses
139:             * implements {@link Cloneable}, then they should overrides this method.
140:             *
141:             * @throws CloneNotSupportedException if this object do not support clone. This exception is
142:             *         never throws if this object implements {@link Cloneable}.
143:             */
144:            public Object clone() throws CloneNotSupportedException {
145:                return super.clone();
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.