001: /*
002: * Geotools2 - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2006, Geotools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: */
017: package org.geotools.gce.geotiff.IIOMetadataAdpaters;
018:
019: /**
020: * Quoting the geotiff spec:
021: *
022: * <pre>
023: * ModelTiepointTag:
024: * Tag = 33922 (8482.H)
025: * Type = DOUBLE (IEEE Double precision)
026: * N = 6*K, K = number of tiepoints
027: * Alias: GeoreferenceTag
028: * Owner: Intergraph
029: * </pre>
030: *
031: * This tag stores raster->model tiepoint pairs in the order
032: *
033: *
034: * <pre>
035: * ModelTiepointTag = (...,I,J,K, X,Y,Z...),
036: * </pre>
037: *
038: * where (I,J,K) is the point at location (I,J) in raster space with pixel-value
039: * K, and (X,Y,Z) is a vector in model space. In most cases the model space is
040: * only two-dimensional, in which case both K and Z should be set to zero; this
041: * third dimension is provided in anticipation of future support for 3D digital
042: * elevation models and vertical coordinate systems.
043: *
044: * <p>
045: * A raster image may be georeferenced simply by specifying its location, size
046: * and orientation in the model coordinate space M. This may be done by
047: * specifying the location of three of the four bounding corner points. However,
048: * tiepoints are only to be considered exact at the points specified; thus
049: * defining such a set of bounding tiepoints does not imply that the model space
050: * locations of the interior of the image may be exactly computed by a linear
051: * interpolation of these tiepoints.
052: *
053: * <p>
054: * However, since the relationship between the Raster space and the model space
055: * will often be an exact, affine transformation, this relationship can be
056: * defined using one set of tiepoints and the "ModelPixelScaleTag", described
057: * below, which gives the vertical and horizontal raster grid cell size,
058: * specified in model units.
059: *
060: * <p>
061: * If possible, the first tiepoint placed in this tag shall be the one
062: * establishing the location of the point (0,0) in raster space. However, if
063: * this is not possible (for example, if (0,0) is goes to a part of model space
064: * in which the projection is ill-defined), then there is no particular order in
065: * which the tiepoints need be listed.
066: *
067: * <p>
068: * For orthorectification or mosaicking applications a large number of tiepoints
069: * may be specified on a mesh over the raster image. However, the definition of
070: * associated grid interpolation methods is not in the scope of the current
071: * GeoTIFF spec.
072: *
073: *
074: * @author Simone Giannecchini
075: * @since 2.3
076: */
077: public final class TiePoint {
078: private double[] values = null;
079:
080: public TiePoint(double i, double j, double k, double x, double y,
081: double z) {
082: values = new double[6];
083: set(i, j, k, x, y, z);
084: }
085:
086: public void set(double i, double j, double k, double x, double y,
087: double z) {
088: values[0] = i;
089: values[1] = j;
090: values[2] = k;
091: values[3] = x;
092: values[4] = y;
093: values[5] = z;
094: }
095:
096: public double getValueAt(int index) {
097: if (index < 0 || index > 5)
098: throw new IllegalArgumentException(
099: "Provided index should be between 0 and 5");
100: return values[index];
101: }
102:
103: public double[] getData() {
104: return values;
105: }
106:
107: public boolean isSet() {
108: return values != null;
109: }
110:
111: }
|