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
023: import java.util.Map;
024:
025: // OpenGIS dependencies
026: import org.opengis.referencing.cs.SphericalCS;
027: import org.opengis.referencing.cs.AxisDirection;
028: import org.opengis.referencing.cs.CoordinateSystemAxis;
029:
030: // Geotools dependencies
031: import org.geotools.resources.i18n.VocabularyKeys;
032:
033: /**
034: * A three-dimensional coordinate system with one distance measured from the origin and two angular
035: * coordinates. Not to be confused with an {@linkplain DefaultEllipsoidalCS ellipsoidal coordinate
036: * system} based on an ellipsoid "degenerated" into a sphere. A {@code SphericalCS} shall have
037: * three {@linkplain #getAxis axis}.
038: *
039: * <TABLE CELLPADDING='6' BORDER='1'>
040: * <TR BGCOLOR="#EEEEFF"><TH NOWRAP>Used with CRS type(s)</TH></TR>
041: * <TR><TD>
042: * {@link org.geotools.referencing.crs.DefaultGeocentricCRS Geocentric},
043: * {@link org.geotools.referencing.crs.DefaultEngineeringCRS Engineering}
044: * </TD></TR></TABLE>
045: *
046: * @since 2.1
047: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/cs/DefaultSphericalCS.java $
048: * @version $Id: DefaultSphericalCS.java 20874 2006-08-07 10:00:01Z jgarnett $
049: * @author Martin Desruisseaux
050: */
051: public class DefaultSphericalCS extends AbstractCS implements
052: SphericalCS {
053: /**
054: * Serial number for interoperability with different versions.
055: */
056: private static final long serialVersionUID = 196295996465774477L;
057:
058: /**
059: * A three-dimensional spherical CS with
060: * <var>{@linkplain DefaultCoordinateSystemAxis#SPHERICAL_LONGITUDE longitude}</var>,
061: * <var>{@linkplain DefaultCoordinateSystemAxis#SPHERICAL_LATITUDE latitude}</var>,
062: * <var>{@linkplain DefaultCoordinateSystemAxis#GEOCENTRIC_RADIUS radius}</var>
063: * axis.
064: *
065: * @see DefaultCartesianCS#GEOCENTRIC
066: */
067: public static DefaultSphericalCS GEOCENTRIC = new DefaultSphericalCS(
068: name(VocabularyKeys.GEOCENTRIC),
069: DefaultCoordinateSystemAxis.SPHERICAL_LONGITUDE,
070: DefaultCoordinateSystemAxis.SPHERICAL_LATITUDE,
071: DefaultCoordinateSystemAxis.GEOCENTRIC_RADIUS);
072:
073: /**
074: * Constructs a three-dimensional coordinate system from a name.
075: *
076: * @param name The coordinate system name.
077: * @param axis0 The first axis.
078: * @param axis1 The second axis.
079: * @param axis2 The third axis.
080: */
081: public DefaultSphericalCS(final String name,
082: final CoordinateSystemAxis axis0,
083: final CoordinateSystemAxis axis1,
084: final CoordinateSystemAxis axis2) {
085: super (name, new CoordinateSystemAxis[] { axis0, axis1, axis2 });
086: }
087:
088: /**
089: * Constructs a new coordinate system with the same values than the specified one.
090: * This copy constructor provides a way to wrap an arbitrary implementation into a
091: * Geotools one or a user-defined one (as a subclass), usually in order to leverage
092: * some implementation-specific API. This constructor performs a shallow copy,
093: * i.e. the properties are not cloned.
094: *
095: * @since 2.2
096: */
097: public DefaultSphericalCS(final SphericalCS cs) {
098: super (cs);
099: }
100:
101: /**
102: * Constructs a three-dimensional coordinate system from a set of properties.
103: * The properties map is given unchanged to the
104: * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
105: *
106: * @param properties Set of properties. Should contains at least <code>"name"</code>.
107: * @param axis0 The first axis.
108: * @param axis1 The second axis.
109: * @param axis2 The third axis.
110: */
111: public DefaultSphericalCS(final Map properties,
112: final CoordinateSystemAxis axis0,
113: final CoordinateSystemAxis axis1,
114: final CoordinateSystemAxis axis2) {
115: super (properties, new CoordinateSystemAxis[] { axis0, axis1,
116: axis2 });
117: }
118:
119: /**
120: * Returns {@code true} if the specified axis direction is allowed for this coordinate
121: * system. The default implementation accepts all directions except temporal ones (i.e.
122: * {@link AxisDirection#FUTURE FUTURE} and {@link AxisDirection#PAST PAST}).
123: */
124: protected boolean isCompatibleDirection(
125: final AxisDirection direction) {
126: return !AxisDirection.FUTURE.equals(direction.absolute());
127: }
128: }
|