commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1241093 - in /commons/proper/sanselan/trunk/src: main/java/org/apache/commons/sanselan/formats/tiff/ main/java/org/apache/commons/sanselan/formats/tiff/constants/ main/java/org/apache/commons/sanselan/formats/tiff/write/ test/java/org/apac...
Date Mon, 06 Feb 2012 17:40:26 GMT
Author: damjan
Date: Mon Feb  6 17:40:25 2012
New Revision: 1241093

URL: http://svn.apache.org/viewvc?rev=1241093&view=rev
Log:
Converted GpsTagConstants to an enum.


Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageMetadata.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/AllTagConstants.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
    commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/examples/MetadataExample.java
    commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/exif/TextFieldTest.java

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java?rev=1241093&r1=1241092&r2=1241093&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
Mon Feb  6 17:40:25 2012
@@ -28,6 +28,7 @@ import java.util.Map;
 
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.common.bytesource.ByteSource;
+import org.apache.commons.sanselan.formats.tiff.constants.GpsTagConstants;
 import org.apache.commons.sanselan.formats.tiff.constants.TagInfo;
 import org.apache.commons.sanselan.formats.tiff.constants.TiffConstants;
 import org.apache.commons.sanselan.formats.tiff.constants.TiffTagConstants;
@@ -610,7 +611,7 @@ public class TiffField implements TiffCo
         return map;
     }
 
-    private static final Map<Object, List<TagInfo>> GPS_TAG_MAP = makeTagMap(ALL_GPS_TAGS,
false,
+    private static final Map<Object, List<TagInfo>> GPS_TAG_MAP = makeTagMap(GpsTagConstants.ALL_GPS_TAGS,
false,
             "GPS");
     private static final Map<Object, List<TagInfo>> TIFF_TAG_MAP = makeTagMap(TiffTagConstants.ALL_TIFF_TAGS,
false,
             "TIFF");

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageMetadata.java?rev=1241093&r1=1241092&r2=1241093&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageMetadata.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageMetadata.java
Mon Feb  6 17:40:25 2012
@@ -28,6 +28,7 @@ import org.apache.commons.sanselan.Image
 import org.apache.commons.sanselan.common.ImageMetadata;
 import org.apache.commons.sanselan.common.RationalNumber;
 import org.apache.commons.sanselan.formats.tiff.constants.AllTagConstants;
+import org.apache.commons.sanselan.formats.tiff.constants.GpsTagConstants;
 import org.apache.commons.sanselan.formats.tiff.constants.TagInfo;
 import org.apache.commons.sanselan.formats.tiff.constants.TiffConstants;
 import org.apache.commons.sanselan.formats.tiff.constants.TiffDirectoryConstants;
@@ -339,13 +340,13 @@ public class TiffImageMetadata extends I
 
         // more specific example of how to access GPS values.
         TiffField latitudeRefField = gpsDirectory
-                .findField(TiffConstants.GPS_TAG_GPS_LATITUDE_REF);
+                .findField(GpsTagConstants.GPS_LATITUDE_REF.tagInfo);
         TiffField latitudeField = gpsDirectory
-                .findField(TiffConstants.GPS_TAG_GPS_LATITUDE);
+                .findField(GpsTagConstants.GPS_LATITUDE.tagInfo);
         TiffField longitudeRefField = gpsDirectory
-                .findField(TiffConstants.GPS_TAG_GPS_LONGITUDE_REF);
+                .findField(GpsTagConstants.GPS_LONGITUDE_REF.tagInfo);
         TiffField longitudeField = gpsDirectory
-                .findField(TiffConstants.GPS_TAG_GPS_LONGITUDE);
+                .findField(GpsTagConstants.GPS_LONGITUDE.tagInfo);
 
         if (latitudeRefField == null || latitudeField == null
                 || longitudeRefField == null || longitudeField == null)

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/AllTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/AllTagConstants.java?rev=1241093&r1=1241092&r2=1241093&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/AllTagConstants.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/AllTagConstants.java
Mon Feb  6 17:40:25 2012
@@ -21,11 +21,10 @@ import org.apache.commons.sanselan.Sanse
 public interface AllTagConstants
         extends
             SanselanConstants,
-            ExifTagConstants,
-            GpsTagConstants
+            ExifTagConstants
 {
     public static final TagInfo ALL_TAGS[] = TagConstantsUtils.mergeTagLists(new TagInfo[][]{
-                TiffTagConstants.ALL_TIFF_TAGS, ALL_EXIF_TAGS, ALL_GPS_TAGS,
+                TiffTagConstants.ALL_TIFF_TAGS, ALL_EXIF_TAGS, GpsTagConstants.ALL_GPS_TAGS,
         });
 
 }
\ No newline at end of file

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java?rev=1241093&r1=1241092&r2=1241093&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/GpsTagConstants.java
Mon Feb  6 17:40:25 2012
@@ -16,206 +16,204 @@
  */
 package org.apache.commons.sanselan.formats.tiff.constants;
 
-public interface GpsTagConstants
-        extends
+public enum GpsTagConstants
+        implements
             TiffDirectoryConstants,
             TiffFieldTypeConstants
 {
-    public static final TagInfo GPS_TAG_GPS_VERSION_ID = new TagInfo(
+    GPS_VERSION_ID(new TagInfo(
             "GPS Version ID", 0x0000, FIELD_TYPE_DESCRIPTION_BYTE, 4,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_LATITUDE_REF = new TagInfo(
+    GPS_LATITUDE_REF(new TagInfo(
             "GPS Latitude Ref", 0x0001, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH = "N";
-    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH = "S";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_LATITUDE = new TagInfo(
+    GPS_LATITUDE(new TagInfo(
             "GPS Latitude", 0x0002, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_LONGITUDE_REF = new TagInfo(
+    GPS_LONGITUDE_REF(new TagInfo(
             "GPS Longitude Ref", 0x0003, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_EAST = "E";
-    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST = "W";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_LONGITUDE = new TagInfo(
+    GPS_LONGITUDE(new TagInfo(
             "GPS Longitude", 0x0004, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_ALTITUDE_REF = new TagInfo(
+    GPS_ALTITUDE_REF(new TagInfo(
             "GPS Altitude Ref", 0x0005, FIELD_TYPE_DESCRIPTION_BYTE, 1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL = 0;
-    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL = 1;
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_ALTITUDE = new TagInfo(
+    GPS_ALTITUDE(new TagInfo(
             "GPS Altitude", 0x0006, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_TIME_STAMP = new TagInfo(
+    GPS_TIME_STAMP(new TagInfo(
             "GPS Time Stamp", 0x0007, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_SATELLITES = new TagInfo(
+    GPS_SATELLITES(new TagInfo(
             "GPS Satellites", 0x0008, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_STATUS = new TagInfo("GPS Status",
-            0x0009, FIELD_TYPE_DESCRIPTION_ASCII, 2, EXIF_DIRECTORY_GPS);
+    GPS_STATUS(new TagInfo("GPS Status",
+            0x0009, FIELD_TYPE_DESCRIPTION_ASCII, 2, EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS = "A";
-    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY = "V";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_MEASURE_MODE = new TagInfo(
+    GPS_MEASURE_MODE(new TagInfo(
             "GPS Measure Mode", 0x000a, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT = 2;
-    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT = 3;
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DOP = new TagInfo("GPS DOP",
-            0x000b, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, EXIF_DIRECTORY_GPS);
+    GPS_DOP(new TagInfo("GPS DOP",
+            0x000b, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_SPEED_REF = new TagInfo(
+    GPS_SPEED_REF(new TagInfo(
             "GPS Speed Ref", 0x000c, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KMPH = "K";
-    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_MPH = "M";
-    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KNOTS = "N";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_SPEED = new TagInfo("GPS Speed",
-            0x000d, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, EXIF_DIRECTORY_GPS);
+    GPS_SPEED(new TagInfo("GPS Speed",
+            0x000d, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_TRACK_REF = new TagInfo(
+    GPS_TRACK_REF(new TagInfo(
             "GPS Track Ref", 0x000e, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_MAGNETIC_NORTH = "M";
-    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_TRUE_NORTH = "T";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_TRACK = new TagInfo("GPS Track",
-            0x000f, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, EXIF_DIRECTORY_GPS);
+    GPS_TRACK(new TagInfo("GPS Track",
+            0x000f, FIELD_TYPE_DESCRIPTION_RATIONAL, 1, EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_IMG_DIRECTION_REF = new TagInfo(
+    GPS_IMG_DIRECTION_REF(new TagInfo(
             "GPS Img Direction Ref", 0x0010, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH = "M";
-    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH = "T";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_IMG_DIRECTION = new TagInfo(
+    GPS_IMG_DIRECTION(new TagInfo(
             "GPS Img Direction", 0x0011, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_MAP_DATUM = new TagInfo(
+    GPS_MAP_DATUM(new TagInfo(
             "GPS Map Datum", 0x0012, FIELD_TYPE_DESCRIPTION_ASCII, -1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_LATITUDE_REF = new TagInfo(
+    GPS_DEST_LATITUDE_REF(new TagInfo(
             "GPS Dest Latitude Ref", 0x0013, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_NORTH = "N";
-    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_SOUTH = "S";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_LATITUDE = new TagInfo(
+    GPS_DEST_LATITUDE(new TagInfo(
             "GPS Dest Latitude", 0x0014, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_LONGITUDE_REF = new TagInfo(
+    GPS_DEST_LONGITUDE_REF(new TagInfo(
             "GPS Dest Longitude Ref", 0x0015, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_EAST = "E";
-    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_WEST = "W";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_LONGITUDE = new TagInfo(
+    GPS_DEST_LONGITUDE(new TagInfo(
             "GPS Dest Longitude", 0x0016, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_BEARING_REF = new TagInfo(
+    GPS_DEST_BEARING_REF(new TagInfo(
             "GPS Dest Bearing Ref", 0x0017, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH = "M";
-    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH = "T";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_BEARING = new TagInfo(
+    GPS_DEST_BEARING(new TagInfo(
             "GPS Dest Bearing", 0x0018, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_DISTANCE_REF = new TagInfo(
+    GPS_DEST_DISTANCE_REF(new TagInfo(
             "GPS Dest Distance Ref", 0x0019, FIELD_TYPE_DESCRIPTION_ASCII, 2,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
-    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_KILOMETERS = "K";
-    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_MILES = "M";
-    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_NAUTICAL_MILES = "N";
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DEST_DISTANCE = new TagInfo(
+    GPS_DEST_DISTANCE(new TagInfo(
             "GPS Dest Distance", 0x001a, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_PROCESSING_METHOD = new TagInfo.Text(
+    GPS_PROCESSING_METHOD(new TagInfo.Text(
             "GPS Processing Method", 0x001b, FIELD_TYPE_DESCRIPTION_UNKNOWN,
-            -1, EXIF_DIRECTORY_GPS);
+            -1, EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_AREA_INFORMATION = new TagInfo.Text(
+    GPS_AREA_INFORMATION(new TagInfo.Text(
             "GPS Area Information", 0x001c, FIELD_TYPE_DESCRIPTION_UNKNOWN, -1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DATE_STAMP = new TagInfo(
+    GPS_DATE_STAMP(new TagInfo(
             "GPS Date Stamp", 0x001d, FIELD_TYPE_DESCRIPTION_ASCII, 11,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS)),
 
     // ************************************************************
-    public static final TagInfo GPS_TAG_GPS_DIFFERENTIAL = new TagInfo(
+    GPS_DIFFERENTIAL(new TagInfo(
             "GPS Differential", 0x001e, FIELD_TYPE_DESCRIPTION_SHORT, 1,
-            EXIF_DIRECTORY_GPS);
+            EXIF_DIRECTORY_GPS));
+    
+    public final TagInfo tagInfo;
+    
+    GpsTagConstants(TagInfo tagInfo) {
+        this.tagInfo = tagInfo;
+    }
+
+    public static final int GPS_DIFFERENTIAL_VALUE_NO_CORRECTION = 0;
+    public static final int GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED = 1;
+    public static final String GPS_LONGITUDE_REF_VALUE_EAST = "E";
+    public static final String GPS_LONGITUDE_REF_VALUE_WEST = "W";
+    public static final String GPS_LATITUDE_REF_VALUE_NORTH = "N";
+    public static final String GPS_LATITUDE_REF_VALUE_SOUTH = "S";
+    public static final int GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL = 0;
+    public static final int GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL = 1;
+    public static final String GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS = "A";
+    public static final String GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY = "V";
+    public static final int GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT = 2;
+    public static final int GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT = 3;
+    public static final String GPS_SPEED_REF_VALUE_KMPH = "K";
+    public static final String GPS_SPEED_REF_VALUE_MPH = "M";
+    public static final String GPS_SPEED_REF_VALUE_KNOTS = "N";
+    public static final String GPS_TRACK_REF_VALUE_MAGNETIC_NORTH = "M";
+    public static final String GPS_TRACK_REF_VALUE_TRUE_NORTH = "T";
+    public static final String GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH = "M";
+    public static final String GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH = "T";
+    public static final String GPS_DEST_LATITUDE_REF_VALUE_NORTH = "N";
+    public static final String GPS_DEST_LATITUDE_REF_VALUE_SOUTH = "S";
+    public static final String GPS_DEST_LONGITUDE_REF_VALUE_EAST = "E";
+    public static final String GPS_DEST_LONGITUDE_REF_VALUE_WEST = "W";
+    public static final String GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH = "M";
+    public static final String GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH = "T";
+    public static final String GPS_DEST_DISTANCE_REF_VALUE_KILOMETERS = "K";
+    public static final String GPS_DEST_DISTANCE_REF_VALUE_MILES = "M";
+    public static final String GPS_DEST_DISTANCE_REF_VALUE_NAUTICAL_MILES = "N";
 
-    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_NO_CORRECTION = 0;
-    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED = 1;
     // ************************************************************
 
-    public static final TagInfo ALL_GPS_TAGS[] = {
-            GPS_TAG_GPS_VERSION_ID, GPS_TAG_GPS_LATITUDE_REF,
-            GPS_TAG_GPS_LATITUDE, GPS_TAG_GPS_LONGITUDE_REF,
-            GPS_TAG_GPS_LONGITUDE, GPS_TAG_GPS_ALTITUDE_REF,
-            GPS_TAG_GPS_ALTITUDE, GPS_TAG_GPS_TIME_STAMP,
-            GPS_TAG_GPS_SATELLITES, GPS_TAG_GPS_STATUS,
-            GPS_TAG_GPS_MEASURE_MODE, GPS_TAG_GPS_DOP, GPS_TAG_GPS_SPEED_REF,
-            GPS_TAG_GPS_SPEED, GPS_TAG_GPS_TRACK_REF, GPS_TAG_GPS_TRACK,
-            GPS_TAG_GPS_IMG_DIRECTION_REF, GPS_TAG_GPS_IMG_DIRECTION,
-            GPS_TAG_GPS_MAP_DATUM, GPS_TAG_GPS_DEST_LATITUDE_REF,
-            GPS_TAG_GPS_DEST_LATITUDE, GPS_TAG_GPS_DEST_LONGITUDE_REF,
-            GPS_TAG_GPS_DEST_LONGITUDE, GPS_TAG_GPS_DEST_BEARING_REF,
-            GPS_TAG_GPS_DEST_BEARING, GPS_TAG_GPS_DEST_DISTANCE_REF,
-            GPS_TAG_GPS_DEST_DISTANCE, GPS_TAG_GPS_PROCESSING_METHOD,
-            GPS_TAG_GPS_AREA_INFORMATION, GPS_TAG_GPS_DATE_STAMP,
-            GPS_TAG_GPS_DIFFERENTIAL,
-    };
+    public static final TagInfo[] ALL_GPS_TAGS;
+    static {
+        GpsTagConstants[] gpsTagConstants = values();
+        ALL_GPS_TAGS = new TagInfo[gpsTagConstants.length];
+        for (int i = 0; i < gpsTagConstants.length; i++) {
+            ALL_GPS_TAGS[i] = gpsTagConstants[i].tagInfo;
+        }
+    }
 }

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java?rev=1241093&r1=1241092&r2=1241093&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
Mon Feb  6 17:40:25 2012
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.sanselan.ImageWriteException;
+import org.apache.commons.sanselan.formats.tiff.constants.GpsTagConstants;
 import org.apache.commons.sanselan.formats.tiff.constants.TagInfo;
 import org.apache.commons.sanselan.formats.tiff.constants.TiffConstants;
 import org.apache.commons.sanselan.util.Debug;
@@ -154,17 +155,17 @@ public final class TiffOutputSet impleme
 
         {
             TiffOutputField longitudeRefField = TiffOutputField.create(
-                    TiffConstants.GPS_TAG_GPS_LONGITUDE_REF, byteOrder,
+                    GpsTagConstants.GPS_LONGITUDE_REF.tagInfo, byteOrder,
                     longitudeRef);
-            gpsDirectory.removeField(TiffConstants.GPS_TAG_GPS_LONGITUDE_REF);
+            gpsDirectory.removeField(GpsTagConstants.GPS_LONGITUDE_REF.tagInfo);
             gpsDirectory.add(longitudeRefField);
         }
 
         {
             TiffOutputField latitudeRefField = TiffOutputField.create(
-                    TiffConstants.GPS_TAG_GPS_LATITUDE_REF, byteOrder,
+                    GpsTagConstants.GPS_LATITUDE_REF.tagInfo, byteOrder,
                     latitudeRef);
-            gpsDirectory.removeField(TiffConstants.GPS_TAG_GPS_LATITUDE_REF);
+            gpsDirectory.removeField(GpsTagConstants.GPS_LATITUDE_REF.tagInfo);
             gpsDirectory.add(latitudeRefField);
         }
 
@@ -183,8 +184,8 @@ public final class TiffOutputSet impleme
             };
 
             TiffOutputField longitudeField = TiffOutputField.create(
-                    TiffConstants.GPS_TAG_GPS_LONGITUDE, byteOrder, values);
-            gpsDirectory.removeField(TiffConstants.GPS_TAG_GPS_LONGITUDE);
+                    GpsTagConstants.GPS_LONGITUDE.tagInfo, byteOrder, values);
+            gpsDirectory.removeField(GpsTagConstants.GPS_LONGITUDE.tagInfo);
             gpsDirectory.add(longitudeField);
         }
 
@@ -203,8 +204,8 @@ public final class TiffOutputSet impleme
             };
 
             TiffOutputField latitudeField = TiffOutputField.create(
-                    TiffConstants.GPS_TAG_GPS_LATITUDE, byteOrder, values);
-            gpsDirectory.removeField(TiffConstants.GPS_TAG_GPS_LATITUDE);
+                    GpsTagConstants.GPS_LATITUDE.tagInfo, byteOrder, values);
+            gpsDirectory.removeField(GpsTagConstants.GPS_LATITUDE.tagInfo);
             gpsDirectory.add(latitudeField);
         }
 

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/examples/MetadataExample.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/examples/MetadataExample.java?rev=1241093&r1=1241092&r2=1241093&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/examples/MetadataExample.java
(original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/examples/MetadataExample.java
Mon Feb  6 17:40:25 2012
@@ -27,6 +27,7 @@ import org.apache.commons.sanselan.commo
 import org.apache.commons.sanselan.formats.jpeg.JpegImageMetadata;
 import org.apache.commons.sanselan.formats.tiff.TiffField;
 import org.apache.commons.sanselan.formats.tiff.TiffImageMetadata;
+import org.apache.commons.sanselan.formats.tiff.constants.GpsTagConstants;
 import org.apache.commons.sanselan.formats.tiff.constants.TagInfo;
 import org.apache.commons.sanselan.formats.tiff.constants.TiffConstants;
 import org.apache.commons.sanselan.formats.tiff.constants.TiffTagConstants;
@@ -66,10 +67,10 @@ public class MetadataExample
                     TiffConstants.EXIF_TAG_SHUTTER_SPEED_VALUE);
             printTagValue(jpegMetadata, TiffConstants.EXIF_TAG_APERTURE_VALUE);
             printTagValue(jpegMetadata, TiffConstants.EXIF_TAG_BRIGHTNESS_VALUE);
-            printTagValue(jpegMetadata, TiffConstants.GPS_TAG_GPS_LATITUDE_REF);
-            printTagValue(jpegMetadata, TiffConstants.GPS_TAG_GPS_LATITUDE);
-            printTagValue(jpegMetadata, TiffConstants.GPS_TAG_GPS_LONGITUDE_REF);
-            printTagValue(jpegMetadata, TiffConstants.GPS_TAG_GPS_LONGITUDE);
+            printTagValue(jpegMetadata, GpsTagConstants.GPS_LATITUDE_REF.tagInfo);
+            printTagValue(jpegMetadata, GpsTagConstants.GPS_LATITUDE.tagInfo);
+            printTagValue(jpegMetadata, GpsTagConstants.GPS_LONGITUDE_REF.tagInfo);
+            printTagValue(jpegMetadata, GpsTagConstants.GPS_LONGITUDE.tagInfo);
 
             System.out.println();
 
@@ -92,13 +93,13 @@ public class MetadataExample
 
             // more specific example of how to manually access GPS values
             TiffField gpsLatitudeRefField = jpegMetadata
-                    .findEXIFValueWithExactMatch(TiffConstants.GPS_TAG_GPS_LATITUDE_REF);
+                    .findEXIFValueWithExactMatch(GpsTagConstants.GPS_LATITUDE_REF.tagInfo);
             TiffField gpsLatitudeField = jpegMetadata
-                    .findEXIFValueWithExactMatch(TiffConstants.GPS_TAG_GPS_LATITUDE);
+                    .findEXIFValueWithExactMatch(GpsTagConstants.GPS_LATITUDE.tagInfo);
             TiffField gpsLongitudeRefField = jpegMetadata
-                    .findEXIFValueWithExactMatch(TiffConstants.GPS_TAG_GPS_LONGITUDE_REF);
+                    .findEXIFValueWithExactMatch(GpsTagConstants.GPS_LONGITUDE_REF.tagInfo);
             TiffField gpsLongitudeField = jpegMetadata
-                    .findEXIFValueWithExactMatch(TiffConstants.GPS_TAG_GPS_LONGITUDE);
+                    .findEXIFValueWithExactMatch(GpsTagConstants.GPS_LONGITUDE.tagInfo);
             if (gpsLatitudeRefField != null && gpsLatitudeField != null
                     && gpsLongitudeRefField != null
                     && gpsLongitudeField != null)

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/exif/TextFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/exif/TextFieldTest.java?rev=1241093&r1=1241092&r2=1241093&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/exif/TextFieldTest.java
(original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/exif/TextFieldTest.java
Mon Feb  6 17:40:25 2012
@@ -23,6 +23,7 @@ import java.io.IOException;
 import org.apache.commons.sanselan.ImageReadException;
 import org.apache.commons.sanselan.ImageWriteException;
 import org.apache.commons.sanselan.formats.tiff.TiffField;
+import org.apache.commons.sanselan.formats.tiff.constants.GpsTagConstants;
 import org.apache.commons.sanselan.util.Debug;
 
 public class TextFieldTest extends SpecificExifTagTest
@@ -37,10 +38,10 @@ public class TextFieldTest extends Speci
     {
         if (field.tag == EXIF_TAG_USER_COMMENT.tag)
         { /* do nothing */ }
-        else if (field.tag == GPS_TAG_GPS_PROCESSING_METHOD.tag
+        else if (field.tag == GpsTagConstants.GPS_PROCESSING_METHOD.tagInfo.tag
                 && field.directoryType == EXIF_DIRECTORY_GPS.directoryType)
         { /* do nothing */ }
-        else if (field.tag == GPS_TAG_GPS_AREA_INFORMATION.tag
+        else if (field.tag == GpsTagConstants.GPS_AREA_INFORMATION.tagInfo.tag
                 && field.directoryType == EXIF_DIRECTORY_GPS.directoryType)
         { /* do nothing */ }
         else



Mime
View raw message