01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: *
05: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
06: * (C) 2002, Institut de Recherche pour le Développement
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation; either
11: * version 2.1 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: */
18: package org.geotools.referencing.operation.transform;
19:
20: /**
21: * A one dimensional, identity transform. Output values are identical to input values.
22: * This class is really a special case of {@link LinearTransform1D} optimized for speed.
23: *
24: * @since 2.0
25: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/operation/transform/IdentityTransform1D.java $
26: * @version $Id: IdentityTransform1D.java 20874 2006-08-07 10:00:01Z jgarnett $
27: * @author Martin Desruisseaux
28: */
29: final class IdentityTransform1D extends LinearTransform1D {
30: /**
31: * Serial number for interoperability with different versions.
32: */
33: private static final long serialVersionUID = -7378774584053573789L;
34:
35: /**
36: * The shared instance of the identity transform.
37: */
38: public static final LinearTransform1D ONE = new IdentityTransform1D();
39:
40: /**
41: * Constructs a new identity transform.
42: */
43: private IdentityTransform1D() {
44: super (1, 0);
45: }
46:
47: /**
48: * Transforms the specified value.
49: */
50: public double transform(double value) {
51: return value;
52: }
53:
54: /**
55: * Transforms a list of coordinate point ordinal values.
56: */
57: public void transform(final float[] srcPts, int srcOff,
58: final float[] dstPts, int dstOff, int numPts) {
59: System.arraycopy(srcPts, srcOff, dstPts, dstOff, numPts);
60: }
61:
62: /**
63: * Transforms a list of coordinate point ordinal values.
64: */
65: public void transform(final double[] srcPts, int srcOff,
66: final double[] dstPts, int dstOff, int numPts) {
67: System.arraycopy(srcPts, srcOff, dstPts, dstOff, numPts);
68: }
69: }
|