Source Code Cross Referenced for CoordinateReferenceSystem.java in  » Science » jscience-4.3.1 » org » jscience » geography » coordinates » crs » 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 » Science » jscience 4.3.1 » org.jscience.geography.coordinates.crs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JScience - Java(TM) Tools and Libraries for the Advancement of Sciences.
003:         * Copyright (C) 2006 - JScience (http://jscience.org/)
004:         * All rights reserved.
005:         * 
006:         * Permission to use, copy, modify, and distribute this software is
007:         * freely granted, provided that this notice is preserved.
008:         */
009:        package org.jscience.geography.coordinates.crs;
010:
011:        import java.util.Collection;
012:        import java.util.Set;
013:
014:        import javax.measure.quantity.Angle;
015:        import javax.measure.quantity.Duration;
016:        import javax.measure.quantity.Length;
017:        import javax.measure.Measurable;
018:        import javax.measure.unit.Unit;
019:
020:        import javolution.util.FastSet;
021:
022:        import org.jscience.geography.coordinates.Coordinates;
023:        import org.opengis.metadata.Identifier;
024:        import org.opengis.metadata.citation.Citation;
025:        import org.opengis.metadata.extent.Extent;
026:        import org.opengis.referencing.cs.AxisDirection;
027:        import org.opengis.referencing.cs.CoordinateSystem;
028:        import org.opengis.util.InternationalString;
029:        import org.opengis.referencing.cs.CoordinateSystemAxis;
030:
031:        /**
032:         * This class represents an arbitrary system of reference for which 
033:         * {@link Coordinates coordinates} of same significance can be stated.
034:         * 
035:         * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
036:         * @version 3.0, February 13, 2006
037:         */
038:        public abstract class CoordinateReferenceSystem<C extends Coordinates<?>>
039:                implements 
040:                org.opengis.referencing.crs.CoordinateReferenceSystem {
041:
042:            /**
043:             * This class represents an absolute position (can be be extended)
044:             */
045:            protected static class AbsolutePosition {
046:
047:                /**
048:                 * Holds the Geodetic Latitude (WGS84 Ellipsoid).
049:                 */
050:                public Measurable<Angle> latitudeWGS84;
051:
052:                /**
053:                 * Holds the Geodetic Longitude (WGS84 Ellipsoid).
054:                 */
055:                public Measurable<Angle> longitudeWGS84;
056:
057:                /**
058:                 * Holds the WGS84 Ellipsoidal Height.
059:                 */
060:                public Measurable<Length> heightWGS84;
061:
062:                /**
063:                 * Holds the Time since midnight, January 1, 1970 UTC. 
064:                 */
065:                public Measurable<Duration> timeUTC;
066:            }
067:
068:            /**
069:             * Returns the converter between this coordinate reference system 
070:             * and the one specified.
071:             * 
072:             * @param  that the coordinate reference system to convert to.
073:             * @return the corresponding coordinates converter.
074:             * @throws ConversionException if the conversion is not possible
075:             *         (e.g. geographic to temporal).
076:             */
077:            public <T extends Coordinates<?>> CoordinatesConverter<C, T> getConverterTo(
078:                    CoordinateReferenceSystem<T> that) {
079:                return new GeneralConverter<T>(that);
080:            }
081:
082:            // General implementation using absolute position as intermediary.
083:            private class GeneralConverter<T extends Coordinates<?>> implements 
084:                    CoordinatesConverter<C, T> {
085:                private final CoordinateReferenceSystem<T> _toCRS;
086:
087:                private GeneralConverter(CoordinateReferenceSystem<T> toCRS) {
088:                    _toCRS = toCRS;
089:                }
090:
091:                public T convert(C source) {
092:                    AbsolutePosition position = positionOf(source,
093:                            new AbsolutePosition());
094:                    return _toCRS.coordinatesOf(position);
095:                }
096:            }
097:
098:            /**
099:             * Returns the coordinates in this reference system of the specified 
100:             * absolute position.
101:             * 
102:             * @param position the absolute position for which the coordinates  
103:             *        in this reference system is returned.
104:             * @return the coordinates for the specified absolute position.
105:             * @throws ConversionException if a conversion error occurs.
106:             */
107:            protected abstract C coordinatesOf(AbsolutePosition position);
108:
109:            /**
110:             * Returns the absolute position from the coordinates in
111:             * this reference system. This update may require information already 
112:             * supplied by the position. For example, the height for a pressure 
113:             * altitude might depends upon the latitude/longitude and the time.
114:             * 
115:             * @param coordinates the coordinates for which the absolute position 
116:             *        is adjusted.
117:             * @param position the position object to update.
118:             * @return the corresponding absolute position. 
119:             * @throws ConversionException if a conversion error occurs.
120:             */
121:            protected abstract AbsolutePosition positionOf(C coordinates,
122:                    AbsolutePosition position);
123:
124:            /**
125:             * Returns the OpenGIS coordinate system associated to this 
126:             * coordinate reference system.
127:             * 
128:             * @return the corresponding coordinate system. 
129:             */
130:            public abstract CoordinateSystem getCoordinateSystem();
131:
132:            /////////////
133:            // OpenGIS //
134:            /////////////
135:
136:            /**
137:             * OpenGIS&reg; - Area for which the (coordinate) reference system is valid.
138:             *
139:             * @return coordinate reference system valid area, 
140:             *         or {@code null} (default) if not available.
141:             */
142:            public Extent getValidArea() {
143:                return null;
144:            }
145:
146:            /**
147:             * OpenGIS&reg; - Description of domain of usage, or limitations of usage,
148:             * for which this (coordinate) reference system object is valid.
149:             */
150:            public InternationalString getScope() {
151:                throw new UnsupportedOperationException();
152:            }
153:
154:            /**
155:             * OpenGIS&reg; - The primary name by which this object is identified.
156:             * 
157:             * @return an identifier holding the class name.
158:             */
159:            public Identifier getName() {
160:                return new Name(CoordinateReferenceSystem.this .getClass()
161:                        .getName());
162:            }
163:
164:            /**
165:             * OpenGIS&reg; - An alternative name by which this object is identified.
166:             *
167:             * @return The aliases, or an empty collection if there is none.
168:             */
169:            public Collection<String> getAlias() {
170:                return EMPTY_SET;
171:            }
172:
173:            /**
174:             * OpenGIS&reg;  - An identifier which references elsewhere the object's defining information.
175:             * Alternatively an identifier by which this object can be referenced.
176:             *
177:             * @return This object identifiers, or an empty set if there is none.
178:             */
179:            public Set<String> getIdentifiers() {
180:                return EMPTY_SET;
181:            }
182:
183:            /**
184:             * OpenGIS&reg; - Comments on or information about this object, including 
185:             * data source information.
186:             * 
187:             * @return <code>null</code> (default).
188:             */
189:            public InternationalString getRemarks() {
190:                return null;
191:            }
192:
193:            /**
194:             * OpenGIS&reg; - Returns a <cite>Well Known Text</cite> (WKT)</A> for 
195:             * this object. This operation may fails if an object is too complex for
196:             * the WKT format capability (for example an engineering CRS} with different
197:             * unit for each axis).
198:             *
199:             * @return The Well Know Text for this object.
200:             * @throws UnsupportedOperationException If this object can't be formatted 
201:             *         as WKT (default).
202:             */
203:            public String toWKT() throws UnsupportedOperationException {
204:                throw new UnsupportedOperationException();
205:            }
206:
207:            // Default coordinates axis.
208:            static class Axis implements  CoordinateSystemAxis {
209:
210:                private final Name _name;
211:
212:                private final String _abbreviation;
213:
214:                private final Unit<?> _unit;
215:
216:                private final AxisDirection _direction;
217:
218:                public Axis(final String name, String abbreviation,
219:                        Unit<?> unit, AxisDirection direction) {
220:                    _name = new Name(name);
221:                    _abbreviation = abbreviation;
222:                    _unit = unit;
223:                    _direction = direction;
224:                }
225:
226:                public final Identifier getName() {
227:                    return _name;
228:                }
229:
230:                public final String getAbbreviation() {
231:                    return _abbreviation;
232:                }
233:
234:                public final Unit<?> getUnit() {
235:                    return _unit;
236:                }
237:
238:                public final AxisDirection getDirection() {
239:                    return _direction;
240:                }
241:
242:                public Collection<String> getAlias() {
243:                    return EMPTY_SET;
244:                }
245:
246:                public Set<String> getIdentifiers() {
247:                    return EMPTY_SET;
248:                }
249:
250:                public InternationalString getRemarks() {
251:                    throw new UnsupportedOperationException();
252:                }
253:
254:                public String toWKT() throws UnsupportedOperationException {
255:                    throw new UnsupportedOperationException();
256:                }
257:
258:            }
259:
260:            // Default coordinates axis.
261:            static class Name implements  Identifier {
262:                final String _value;
263:
264:                public Name(String value) {
265:                    _value = value;
266:                }
267:
268:                public String getCode() {
269:                    return _value;
270:                }
271:
272:                public Citation getAuthority() {
273:                    throw new UnsupportedOperationException();
274:                }
275:
276:                public String getVersion() {
277:                    throw new UnsupportedOperationException();
278:                }
279:            }
280:
281:            static final FastSet<String> EMPTY_SET = new FastSet<String>();
282:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.