Source Code Cross Referenced for DefaultConversion.java in  » GIS » GeoTools-2.4.1 » org » geotools » referencing » operation » 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.referencing.operation 
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:         *    (C) 2004, Institut de Recherche pour le Développement
006:         *   
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation;
010:         *    version 2.1 of the License.
011:         *
012:         *    This library 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 GNU
015:         *    Lesser General Public License for more details.
016:         *
017:         *    This package contains documentation from OpenGIS specifications.
018:         *    OpenGIS consortium's work is fully acknowledged here.
019:         */
020:        package org.geotools.referencing.operation;
021:
022:        // J2SE dependencies
023:        import java.util.Map;
024:
025:        // OpenGIS dependencies
026:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
027:        import org.opengis.referencing.operation.MathTransform;
028:        import org.opengis.referencing.operation.OperationMethod;
029:        import org.opengis.referencing.operation.MathTransform;
030:        import org.opengis.referencing.operation.Conversion;
031:        import org.opengis.referencing.operation.Projection;
032:        import org.opengis.referencing.operation.PlanarProjection;
033:        import org.opengis.referencing.operation.CylindricalProjection;
034:        import org.opengis.referencing.operation.ConicProjection;
035:
036:        /**
037:         * An operation on coordinates that does not include any change of Datum. The best-known
038:         * example of a coordinate conversion is a map projection. The parameters describing
039:         * coordinate conversions are defined rather than empirically derived. Note that some
040:         * conversions have no parameters. 
041:         *  
042:         * @since 2.1
043:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/operation/DefaultConversion.java $
044:         * @version $Id: DefaultConversion.java 24384 2007-02-14 00:23:05Z desruisseaux $
045:         * @author Martin Desruisseaux
046:         *
047:         * @see DefaultTransformation
048:         */
049:        public class DefaultConversion extends DefaultOperation implements 
050:                Conversion {
051:            /**
052:             * Serial number for interoperability with different versions.
053:             */
054:            private static final long serialVersionUID = -2148164324805562793L;
055:
056:            /**
057:             * Constructs a new conversion with the same values than the specified one, together with the
058:             * specified source and target CRS. While the source conversion can be an arbitrary one, it is
059:             * typically a {@linkplain DefiningConversion defining conversion}.
060:             *
061:             * @param definition The defining conversion.
062:             * @param sourceCRS The source CRS.
063:             * @param targetCRS The target CRS.
064:             * @param transform Transform from positions in the {@linkplain #getSourceCRS source CRS}
065:             *                  to positions in the {@linkplain #getTargetCRS target CRS}.
066:             */
067:            public DefaultConversion(final Conversion definition,
068:                    final CoordinateReferenceSystem sourceCRS,
069:                    final CoordinateReferenceSystem targetCRS,
070:                    final MathTransform transform) {
071:                super (definition, sourceCRS, targetCRS, transform);
072:            }
073:
074:            /**
075:             * Constructs a conversion from a set of properties. The properties given in argument
076:             * follow the same rules than for the {@link AbstractCoordinateOperation} constructor.
077:             *
078:             * @param properties Set of properties. Should contains at least <code>"name"</code>.
079:             * @param sourceCRS The source CRS.
080:             * @param targetCRS The target CRS.
081:             * @param transform Transform from positions in the {@linkplain #getSourceCRS source CRS}
082:             *                  to positions in the {@linkplain #getTargetCRS target CRS}.
083:             * @param method    The operation method.
084:             */
085:            public DefaultConversion(final Map properties,
086:                    final CoordinateReferenceSystem sourceCRS,
087:                    final CoordinateReferenceSystem targetCRS,
088:                    final MathTransform transform, final OperationMethod method) {
089:                super (properties, sourceCRS, targetCRS, transform, method);
090:            }
091:
092:            /**
093:             * Returns a conversion from the specified {@linkplain DefiningConversion defining conversion}.
094:             * This method may constructs instance of {@link DefaultPlanarProjection} or
095:             * {@link DefaultCylindricalProjection} among others.
096:             *
097:             * @param definition The defining conversion.
098:             * @param sourceCRS The source CRS.
099:             * @param targetCRS The target CRS.
100:             * @param transform Transform from positions in the {@linkplain #getSourceCRS source CRS}
101:             *                  to positions in the {@linkplain #getTargetCRS target CRS}.
102:             *
103:             * @see DefaultOperation#create
104:             *
105:             * @deprecated Replaced by {@link #create(Conversion, CoordinateReferenceSystem,
106:             *             CoordinateReferenceSystem, MathTransform, Class)}.
107:             */
108:            public static Conversion create(final Conversion definition,
109:                    final CoordinateReferenceSystem sourceCRS,
110:                    final CoordinateReferenceSystem targetCRS,
111:                    final MathTransform transform) {
112:                return create(definition, sourceCRS, targetCRS, transform, null);
113:            }
114:
115:            /**
116:             * Returns a conversion from the specified {@linkplain DefiningConversion defining conversion}.
117:             * The new conversion will be a more specific type like a {@linkplain PlanarProjection planar},
118:             * {@linkplain CylindricalProjection cylindrical} or {@linkplain ConicProjection conic
119:             * projection}. This type is inferred from the {@code conversion} argument when possible.
120:             * However the inferred type is not always the most accurate one, so an optional
121:             * {@code typeHint} argument may be specified in order to get a more specific subclass.
122:             * This later argument is just a hint: it may be {@code null} and will be ignored if it
123:             * conflict with the automatically inferred type.
124:             *
125:             * @param definition The defining conversion.
126:             * @param sourceCRS  The source CRS.
127:             * @param targetCRS  The target CRS.
128:             * @param transform  Transform from positions in the {@linkplain #getSourceCRS source CRS}
129:             *                   to positions in the {@linkplain #getTargetCRS target CRS}.
130:             * @param typeHint   One of <code>{@linkplain PlanarProjection}.class</code>,
131:             *                   <code>{@linkplain CylindricalProjection}.class</code> or
132:             *                   <code>{@linkplain ConicProjection}.class</code>, or {@code null}.
133:             *
134:             * @see DefaultOperation#create
135:             *
136:             * @since 2.4
137:             */
138:            public static Conversion create(final Conversion definition,
139:                    final CoordinateReferenceSystem sourceCRS,
140:                    final CoordinateReferenceSystem targetCRS,
141:                    final MathTransform transform,
142:                    final Class/*<? extends Conversion>*/typeHint) {
143:                Class type = getType(definition);
144:                final OperationMethod method = definition.getMethod();
145:                if (method instanceof  MathTransformProvider) {
146:                    final Class candidate = ((MathTransformProvider) method)
147:                            .getOperationType();
148:                    if (candidate != null) {
149:                        if (type.isAssignableFrom(candidate)) {
150:                            type = candidate;
151:                        }
152:                    }
153:                }
154:                if (typeHint != null && type.isAssignableFrom(typeHint)) {
155:                    type = typeHint;
156:                }
157:                if (ConicProjection.class.isAssignableFrom(type)) {
158:                    return new DefaultConicProjection(definition, sourceCRS,
159:                            targetCRS, transform);
160:                }
161:                if (CylindricalProjection.class.isAssignableFrom(type)) {
162:                    return new DefaultCylindricalProjection(definition,
163:                            sourceCRS, targetCRS, transform);
164:                }
165:                if (PlanarProjection.class.isAssignableFrom(type)) {
166:                    return new DefaultPlanarProjection(definition, sourceCRS,
167:                            targetCRS, transform);
168:                }
169:                if (Projection.class.isAssignableFrom(type)) {
170:                    return new DefaultProjection(definition, sourceCRS,
171:                            targetCRS, transform);
172:                }
173:                return new DefaultConversion(definition, sourceCRS, targetCRS,
174:                        transform);
175:            }
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.