/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2001-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * This package contains documentation from OpenGIS specifications. * OpenGIS consortium's work is fully acknowledged here. */ package org.geotools.referencing.crs; import java.util.Collections; import java.util.Map; import org.opengis.referencing.cs.AffineCS; import org.opengis.referencing.cs.CartesianCS; import org.opengis.referencing.datum.ImageDatum; import org.opengis.referencing.crs.ImageCRS; import org.geotools.referencing.AbstractReferenceSystem; /** * An engineering coordinate reference system applied to locations in images. Image coordinate * reference systems are treated as a separate sub-type because a separate user community exists * for images with its own terms of reference. * * <TABLE CELLPADDING='6' BORDER='1'> * <TR BGCOLOR="#EEEEFF"><TH NOWRAP>Used with CS type(s)</TH></TR> * <TR><TD> * {@link CartesianCS Cartesian}, * {@link AffineCS Affine} * </TD></TR></TABLE> * * @since 2.1 * * @source $URL$ * @version $Id$ * @author Martin Desruisseaux (IRD) */ public class DefaultImageCRS extends AbstractSingleCRS implements ImageCRS { /** * Serial number for interoperability with different versions. */ private static final long serialVersionUID = 7312452786096397847L; /** * Constructs a new image CRS with the same values than the specified one. * This copy constructor provides a way to wrap an arbitrary implementation into a * Geotools one or a user-defined one (as a subclass), usually in order to leverage * some implementation-specific API. This constructor performs a shallow copy, * i.e. the properties are not cloned. * * @param crs The coordinate reference system to copy. * * @since 2.2 */ public DefaultImageCRS(final ImageCRS crs) { super(crs); } /** * Constructs an image CRS from a name. * * @param name The name. * @param datum The datum. * @param cs The coordinate system. */ public DefaultImageCRS(final String name, final ImageDatum datum, final AffineCS cs) { this(Collections.singletonMap(NAME_KEY, name), datum, cs); } /** * Constructs an image CRS from a set of properties. The properties are given unchanged to * the {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. * * @param properties Set of properties. Should contains at least {@code "name"}. * @param datum The datum. * @param cs The coordinate system. */ public DefaultImageCRS(final Map<String,?> properties, final ImageDatum datum, final AffineCS cs) { super(properties, datum, cs); } /** * Returns the coordinate system. */ @Override public AffineCS getCoordinateSystem() { return (AffineCS) super.getCoordinateSystem(); } /** * Returns the datum. */ @Override public ImageDatum getDatum() { return (ImageDatum) super.getDatum(); } /** * Returns a hash value for this geographic CRS. * * @return The hash code value. This value doesn't need to be the same * in past or future versions of this class. */ @Override public int hashCode() { return (int)serialVersionUID ^ super.hashCode(); } }