Source Code Cross Referenced for DefaultTimeCS.java in  » GIS » GeoTools-2.4.1 » org » geotools » referencing » cs » 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.cs 
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.cs;
021:
022:        // J2SE dependencies and extensions
023:        import java.util.Map;
024:        import javax.units.SI;
025:        import javax.units.Unit;
026:
027:        // OpenGIS dependencies
028:        import org.opengis.referencing.cs.TimeCS;
029:        import org.opengis.referencing.cs.AxisDirection;
030:        import org.opengis.referencing.cs.CoordinateSystemAxis;
031:        import org.opengis.geometry.MismatchedDimensionException;
032:
033:        // Geotools dependencies
034:        import org.geotools.measure.Measure;
035:        import org.geotools.resources.i18n.VocabularyKeys;
036:
037:        /**
038:         * A one-dimensional coordinate system containing a single time axis, used to describe the
039:         * temporal position of a point in the specified time units from a specified time origin.
040:         * A {@code TimeCS} shall have one {@linkplain #getAxis axis}.
041:         *
042:         * <TABLE CELLPADDING='6' BORDER='1'>
043:         * <TR BGCOLOR="#EEEEFF"><TH NOWRAP>Used with CRS type(s)</TH></TR>
044:         * <TR><TD>
045:         *   {@link org.geotools.referencing.crs.DefaultTemporalCRS Temporal}
046:         * </TD></TR></TABLE>
047:         *
048:         * @since 2.1
049:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/cs/DefaultTimeCS.java $
050:         * @version $Id: DefaultTimeCS.java 24925 2007-03-27 20:12:08Z jgarnett $
051:         * @author Martin Desruisseaux
052:         */
053:        public class DefaultTimeCS extends AbstractCS implements  TimeCS {
054:            /**
055:             * Serial number for interoperability with different versions.
056:             */
057:            private static final long serialVersionUID = 5222911412381303989L;
058:
059:            /**
060:             * A one-dimensional temporal CS with
061:             * <var>{@linkplain DefaultCoordinateSystemAxis#TIME time}</var>,
062:             * axis in days.
063:             */
064:            public static DefaultTimeCS DAYS = new DefaultTimeCS(
065:                    name(VocabularyKeys.TEMPORAL),
066:                    DefaultCoordinateSystemAxis.TIME);
067:
068:            /**
069:             * Constructs a new coordinate system with the same values than the specified one.
070:             * This copy constructor provides a way to wrap an arbitrary implementation into a
071:             * Geotools one or a user-defined one (as a subclass), usually in order to leverage
072:             * some implementation-specific API. This constructor performs a shallow copy,
073:             * i.e. the properties are not cloned.
074:             *
075:             * @since 2.2
076:             */
077:            public DefaultTimeCS(final TimeCS cs) {
078:                super (cs);
079:            }
080:
081:            /**
082:             * Constructs a coordinate system from a name.
083:             *
084:             * @param name  The coordinate system name.
085:             * @param axis  The axis.
086:             */
087:            public DefaultTimeCS(final String name,
088:                    final CoordinateSystemAxis axis) {
089:                super (name, new CoordinateSystemAxis[] { axis });
090:                ensureTimeUnit(getAxis(0).getUnit());
091:            }
092:
093:            /**
094:             * Constructs a coordinate system from a set of properties.
095:             * The properties map is given unchanged to the
096:             * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
097:             *
098:             * @param properties   Set of properties. Should contains at least <code>"name"</code>.
099:             * @param axis         The axis.
100:             */
101:            public DefaultTimeCS(final Map properties,
102:                    final CoordinateSystemAxis axis) {
103:                super (properties, new CoordinateSystemAxis[] { axis });
104:                ensureTimeUnit(getAxis(0).getUnit());
105:            }
106:
107:            /**
108:             * Returns {@code true} if the specified axis direction is allowed for this coordinate
109:             * system. The default implementation accepts only temporal directions (i.e.
110:             * {@link AxisDirection#FUTURE FUTURE} and {@link AxisDirection#PAST PAST}).
111:             */
112:            protected boolean isCompatibleDirection(
113:                    final AxisDirection direction) {
114:                return AxisDirection.FUTURE.equals(direction.absolute());
115:            }
116:
117:            /**
118:             * Returns {@code true} if the specified unit is compatible with {@linkplain SI#SECOND seconds}.
119:             * This method is invoked at construction time for checking units compatibility.
120:             *
121:             * @since 2.2
122:             */
123:            protected boolean isCompatibleUnit(final AxisDirection direction,
124:                    final Unit unit) {
125:                return SI.SECOND.isCompatible(unit);
126:            }
127:
128:            /**
129:             * Computes the time difference between two points.
130:             *
131:             * @param  coord1 Coordinates of the first point.
132:             * @param  coord2 Coordinates of the second point.
133:             * @return The time difference between {@code coord1} and {@code coord2}.
134:             * @throws MismatchedDimensionException if a coordinate doesn't have the expected dimension.
135:             */
136:            public Measure distance(final double[] coord1, final double[] coord2)
137:                    throws MismatchedDimensionException {
138:                ensureDimensionMatch("coord1", coord1);
139:                ensureDimensionMatch("coord2", coord2);
140:                return new Measure(Math.abs(coord1[0] - coord2[0]),
141:                        getDistanceUnit());
142:            }
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.