001: /*
002: * $RCSfile: GeoTIFFTagSet.java,v $
003: *
004: *
005: * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions
009: * are met:
010: *
011: * - Redistribution of source code must retain the above copyright
012: * notice, this list of conditions and the following disclaimer.
013: *
014: * - Redistribution in binary form must reproduce the above copyright
015: * notice, this list of conditions and the following disclaimer in
016: * the documentation and/or other materials provided with the
017: * distribution.
018: *
019: * Neither the name of Sun Microsystems, Inc. or the names of
020: * contributors may be used to endorse or promote products derived
021: * from this software without specific prior written permission.
022: *
023: * This software is provided "AS IS," without a warranty of any
024: * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
025: * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
026: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
027: * EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
028: * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
029: * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
030: * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
031: * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
032: * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
033: * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
034: * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
035: * POSSIBILITY OF SUCH DAMAGES.
036: *
037: * You acknowledge that this software is not designed or intended for
038: * use in the design, construction, operation or maintenance of any
039: * nuclear facility.
040: *
041: * $Revision: 1.1 $
042: * $Date: 2005/02/11 05:01:17 $
043: * $State: Exp $
044: */
045: package com.sun.media.imageio.plugins.tiff;
046:
047: import java.util.ArrayList;
048: import java.util.List;
049:
050: /**
051: * A class representing the tags found in a GeoTIFF IFD. GeoTIFF is a
052: * standard for annotating georeferenced or geocoded raster imagery.
053: * The GeoTIFF specification may be found at <a
054: * href="http://www.remotesensing.org/geotiff/spec/geotiffhome.html">
055: * <code>http://www.remotesensing.org/geotiff/spec/geotiffhome.html</code>
056: * </a>. This class does <i>not</i> handle the <i>GeoKey</i>s referenced
057: * from a <i>GeoKeyDirectoryTag</i> as those are not TIFF tags per se.
058: *
059: * <p>The definitions of the data types referenced by the field
060: * definitions may be found in the {@link TIFFTag
061: * <code>TIFFTag</code>} class.</p>
062: */
063: public class GeoTIFFTagSet extends TIFFTagSet {
064:
065: private static GeoTIFFTagSet theInstance = null;
066:
067: /**
068: * A tag used to specify the size of raster pixel spacing in
069: * model space units.
070: */
071: public static final int TAG_MODEL_PIXEL_SCALE = 33550;
072:
073: /**
074: * A tag used to specify the transformation matrix between the raster
075: * space and the model space.
076: */
077: public static final int TAG_MODEL_TRANSFORMATION = 34264;
078:
079: /** A tag used to store raster->model tiepoint pairs. */
080: public static final int TAG_MODEL_TIE_POINT = 33922;
081:
082: /** A tag used to store the <i>GeoKey</i> directory. */
083: public static final int TAG_GEO_KEY_DIRECTORY = 34735;
084:
085: /** A tag used to store all <code>double</code>-values <i>GeoKey</i>s. */
086: public static final int TAG_GEO_DOUBLE_PARAMS = 34736;
087:
088: /** A tag used to store all ASCII-values <i>GeoKey</i>s. */
089: public static final int TAG_GEO_ASCII_PARAMS = 34737;
090:
091: // GeoTIFF tags
092:
093: static class ModelPixelScale extends TIFFTag {
094: public ModelPixelScale() {
095: super ("ModelPixelScaleTag", TAG_MODEL_PIXEL_SCALE,
096: 1 << TIFFTag.TIFF_DOUBLE);
097: }
098: }
099:
100: static class ModelTransformation extends TIFFTag {
101: public ModelTransformation() {
102: super ("ModelTransformationTag", TAG_MODEL_TRANSFORMATION,
103: 1 << TIFFTag.TIFF_DOUBLE);
104: }
105: }
106:
107: static class ModelTiePoint extends TIFFTag {
108: public ModelTiePoint() {
109: super ("ModelTiePointTag", TAG_MODEL_TIE_POINT,
110: 1 << TIFFTag.TIFF_DOUBLE);
111: }
112: }
113:
114: static class GeoKeyDirectory extends TIFFTag {
115: public GeoKeyDirectory() {
116: super ("GeoKeyDirectory", TAG_GEO_KEY_DIRECTORY,
117: 1 << TIFFTag.TIFF_SHORT);
118: }
119: }
120:
121: static class GeoDoubleParams extends TIFFTag {
122: public GeoDoubleParams() {
123: super ("GeoDoubleParams", TAG_GEO_DOUBLE_PARAMS,
124: 1 << TIFFTag.TIFF_DOUBLE);
125: }
126: }
127:
128: static class GeoAsciiParams extends TIFFTag {
129: public GeoAsciiParams() {
130: super ("GeoAsciiParams", TAG_GEO_ASCII_PARAMS,
131: 1 << TIFFTag.TIFF_ASCII);
132: }
133: }
134:
135: private static List tags;
136:
137: private static void initTags() {
138: tags = new ArrayList(42);
139:
140: tags.add(new GeoTIFFTagSet.ModelPixelScale());
141: tags.add(new GeoTIFFTagSet.ModelTransformation());
142: tags.add(new GeoTIFFTagSet.ModelTiePoint());
143: tags.add(new GeoTIFFTagSet.GeoKeyDirectory());
144: tags.add(new GeoTIFFTagSet.GeoDoubleParams());
145: tags.add(new GeoTIFFTagSet.GeoAsciiParams());
146: }
147:
148: private GeoTIFFTagSet() {
149: super (tags);
150: }
151:
152: /**
153: * Returns a shared instance of a <code>GeoTIFFTagSet</code>.
154: *
155: * @return a <code>GeoTIFFTagSet</code> instance.
156: */
157: public synchronized static GeoTIFFTagSet getInstance() {
158: if (theInstance == null) {
159: initTags();
160: theInstance = new GeoTIFFTagSet();
161: tags = null;
162: }
163: return theInstance;
164: }
165: }
|