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.crs;
021:
022: // J2SE dependencies
023: import java.util.Collections;
024: import java.util.Map;
025:
026: // OpenGIS dependencies
027: import org.opengis.referencing.cs.CoordinateSystem;
028: import org.opengis.referencing.crs.CoordinateReferenceSystem;
029: import org.opengis.referencing.crs.DerivedCRS;
030: import org.opengis.referencing.operation.Conversion;
031: import org.opengis.referencing.operation.MathTransform;
032: import org.opengis.referencing.operation.OperationMethod;
033: import org.opengis.geometry.MismatchedDimensionException;
034:
035: // Geotools dependencies
036: import org.geotools.referencing.AbstractReferenceSystem; // For javadoc
037: import org.geotools.referencing.operation.DefiningConversion; // For javadoc
038:
039: /**
040: * A coordinate reference system that is defined by its coordinate conversion from another
041: * coordinate reference system but is not a projected coordinate reference system. This
042: * category includes coordinate reference systems derived from a projected coordinate
043: * reference system.
044: *
045: * @since 2.1
046: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/crs/DefaultDerivedCRS.java $
047: * @version $Id: DefaultDerivedCRS.java 28031 2007-11-23 21:24:22Z desruisseaux $
048: * @author Martin Desruisseaux
049: */
050: public class DefaultDerivedCRS extends AbstractDerivedCRS implements
051: DerivedCRS {
052: /**
053: * Serial number for interoperability with different versions.
054: */
055: private static final long serialVersionUID = -8149602276542469876L;
056:
057: /**
058: * Constructs a new derived CRS with the same values than the specified one.
059: * This copy constructor provides a way to wrap an arbitrary implementation into a
060: * Geotools one or a user-defined one (as a subclass), usually in order to leverage
061: * some implementation-specific API. This constructor performs a shallow copy,
062: * i.e. the properties are not cloned.
063: *
064: * @since 2.2
065: */
066: public DefaultDerivedCRS(final DerivedCRS crs) {
067: super (crs);
068: }
069:
070: /**
071: * Constructs a derived CRS from a name.
072: *
073: * @param name The name.
074: * @param method A description of the {@linkplain Conversion#getMethod method for the
075: * conversion}.
076: * @param base Coordinate reference system to base the derived CRS on.
077: * @param baseToDerived The transform from the base CRS to returned CRS.
078: * @param derivedCS The coordinate system for the derived CRS. The number
079: * of axes must match the target dimension of the transform
080: * {@code baseToDerived}.
081: * @throws MismatchedDimensionException if the source and target dimension of
082: * {@code baseToDeviced} don't match the dimension of {@code base}
083: * and {@code derivedCS} respectively.
084: *
085: * @deprecated Create explicitly a {@link DefiningConversion} instead.
086: */
087: public DefaultDerivedCRS(final String name,
088: final OperationMethod method,
089: final CoordinateReferenceSystem base,
090: final MathTransform baseToDerived,
091: final CoordinateSystem derivedCS)
092: throws MismatchedDimensionException {
093: this (Collections.singletonMap(NAME_KEY, name), method, base,
094: baseToDerived, derivedCS);
095: }
096:
097: /**
098: * Constructs a derived CRS from a set of properties. The properties are given unchanged
099: * to the {@linkplain AbstractDerivedCRS#AbstractDerivedCRS(Map, OperationMethod,
100: * CoordinateReferenceSystem, MathTransform, CoordinateSystem) super-class constructor}.
101: *
102: * @param properties Name and other properties to give to the new derived CRS object and to
103: * the underlying {@linkplain org.geotools.referencing.operation.DefaultConversion
104: * conversion}.
105: * @param method A description of the {@linkplain Conversion#getMethod method for the
106: * conversion}.
107: * @param base Coordinate reference system to base the derived CRS on.
108: * @param baseToDerived The transform from the base CRS to returned CRS.
109: * @param derivedCS The coordinate system for the derived CRS. The number
110: * of axes must match the target dimension of the transform
111: * {@code baseToDerived}.
112: * @throws MismatchedDimensionException if the source and target dimension of
113: * {@code baseToDeviced} don't match the dimension of {@code base}
114: * and {@code derivedCS} respectively.
115: *
116: * @deprecated Create explicitly a {@link DefiningConversion} instead.
117: */
118: public DefaultDerivedCRS(final Map properties,
119: final OperationMethod method,
120: final CoordinateReferenceSystem base,
121: final MathTransform baseToDerived,
122: final CoordinateSystem derivedCS)
123: throws MismatchedDimensionException {
124: super (properties, method, base, baseToDerived, derivedCS);
125: }
126:
127: /**
128: * Constructs a derived CRS from a {@linkplain DefiningConversion defining conversion}.
129: * The properties are given unchanged to the
130: * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}.
131: *
132: * @param properties Name and other properties to give to the new derived CRS object.
133: * @param conversionFromBase The {@linkplain DefiningConversion defining conversion}.
134: * @param base Coordinate reference system to base the derived CRS on.
135: * @param baseToDerived The transform from the base CRS to returned CRS.
136: * @param derivedCS The coordinate system for the derived CRS. The number
137: * of axes must match the target dimension of the transform
138: * {@code baseToDerived}.
139: * @throws MismatchedDimensionException if the source and target dimension of
140: * {@code baseToDerived} don't match the dimension of {@code base}
141: * and {@code derivedCS} respectively.
142: */
143: public DefaultDerivedCRS(final Map properties,
144: final Conversion conversionFromBase,
145: final CoordinateReferenceSystem base,
146: final MathTransform baseToDerived,
147: final CoordinateSystem derivedCS)
148: throws MismatchedDimensionException {
149: super (properties, conversionFromBase, base, baseToDerived,
150: derivedCS);
151: }
152:
153: /**
154: * Returns a hash value for this derived CRS.
155: *
156: * @return The hash code value. This value doesn't need to be the same
157: * in past or future versions of this class.
158: */
159: public int hashCode() {
160: return (int) serialVersionUID ^ super.hashCode();
161: }
162: }
|