    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.imaging.formats.tiff.constants;
    018
    019import java.util.Arrays;
    020import java.util.Collections;
    021import java.util.List;
    022
    023import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
    024import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoAscii;
    025import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoByte;
    026import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoBytes;
    027import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoGpsText;
    028import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoRational;
    029import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoRationals;
    030import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShort;
    031
    032public final class GpsTagConstants {
    033
    034    public static final TagInfoBytes GPS_TAG_GPS_VERSION_ID = new TagInfoBytes("GPSVersionID", 0x0000, 4, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    035
    036    private static final byte[] GPS_VERSION = { (byte) 2, (byte) 3, (byte) 0, (byte) 0 };
    037
    038    public static final TagInfoAscii GPS_TAG_GPS_LATITUDE_REF = new TagInfoAscii("GPSLatitudeRef", 0x0001, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    039
    040    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH = "N";
    041
    042    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH = "S";
    043
    044    public static final TagInfoRationals GPS_TAG_GPS_LATITUDE = new TagInfoRationals("GPSLatitude", 0x0002, 3, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    045
    046    public static final TagInfoAscii GPS_TAG_GPS_LONGITUDE_REF = new TagInfoAscii("GPSLongitudeRef", 0x0003, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    047
    048    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_EAST = "E";
    049
    050    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST = "W";
    051
    052    public static final TagInfoRationals GPS_TAG_GPS_LONGITUDE = new TagInfoRationals("GPSLongitude", 0x0004, 3, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    053
    054    public static final TagInfoByte GPS_TAG_GPS_ALTITUDE_REF = new TagInfoByte("GPSAltitudeRef", 0x0005, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    055
    056    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL = 0;
    057
    058    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL = 1;
    059
    060    public static final TagInfoRational GPS_TAG_GPS_ALTITUDE = new TagInfoRational("GPSAltitude", 0x0006, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    061
    062    public static final TagInfoRationals GPS_TAG_GPS_TIME_STAMP = new TagInfoRationals("GPSTimeStamp", 0x0007, 3, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    063
    064    public static final TagInfoAscii GPS_TAG_GPS_SATELLITES = new TagInfoAscii("GPSSatellites", 0x0008, -1, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    065
    066    public static final TagInfoAscii GPS_TAG_GPS_STATUS = new TagInfoAscii("GPSStatus", 0x0009, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    067
    068    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS = "A";
    069
    070    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY = "V";
    071
    072    public static final TagInfoAscii GPS_TAG_GPS_MEASURE_MODE = new TagInfoAscii("GPSMeasureMode", 0x000a, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    073    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT = 2;
    074
    075    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT = 3;
    076
    077    public static final TagInfoRational GPS_TAG_GPS_DOP = new TagInfoRational("GPSDOP", 0x000b, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    078
    079    public static final TagInfoAscii GPS_TAG_GPS_SPEED_REF = new TagInfoAscii("GPSSpeedRef", 0x000c, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    080
    081    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KMPH = "K";
    082
    083    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_MPH = "M";
    084    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KNOTS = "N";
    085
    086    public static final TagInfoRational GPS_TAG_GPS_SPEED = new TagInfoRational("GPSSpeed", 0x000d, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    087
    088    public static final TagInfoAscii GPS_TAG_GPS_TRACK_REF = new TagInfoAscii("GPSTrackRef", 0x000e, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    089
    090    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_MAGNETIC_NORTH = "M";
    091
    092    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_TRUE_NORTH = "T";
    093
    094    public static final TagInfoRational GPS_TAG_GPS_TRACK = new TagInfoRational("GPSTrack", 0x000f, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    095
    096    public static final TagInfoAscii GPS_TAG_GPS_IMG_DIRECTION_REF = new TagInfoAscii("GPSImgDirectionRef", 0x0010, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    097
    098    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH = "M";
    099
    100    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH = "T";
    101
    102    public static final TagInfoRational GPS_TAG_GPS_IMG_DIRECTION = new TagInfoRational("GPSImgDirection", 0x0011, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    103
    104    public static final TagInfoAscii GPS_TAG_GPS_MAP_DATUM = new TagInfoAscii("GPSMapDatum", 0x0012, -1, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    105
    106    public static final TagInfoAscii GPS_TAG_GPS_DEST_LATITUDE_REF = new TagInfoAscii("GPSDestLatitudeRef", 0x0013, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    107
    108    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_NORTH = "N";
    109
    110    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_SOUTH = "S";
    111
    112    public static final TagInfoRationals GPS_TAG_GPS_DEST_LATITUDE = new TagInfoRationals("GPSDestLatitude", 0x0014, 3, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    113
    114    public static final TagInfoAscii GPS_TAG_GPS_DEST_LONGITUDE_REF = new TagInfoAscii("GPSDestLongitudeRef", 0x0015, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    115
    116    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_EAST = "E";
    117
    118    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_WEST = "W";
    119
    120    public static final TagInfoRationals GPS_TAG_GPS_DEST_LONGITUDE = new TagInfoRationals("GPSDestLongitude", 0x0016, 3, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    121
    122    public static final TagInfoAscii GPS_TAG_GPS_DEST_BEARING_REF = new TagInfoAscii("GPSDestBearingRef", 0x0017, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    123
    124    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH = "M";
    125
    126    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH = "T";
    127
    128    public static final TagInfoRational GPS_TAG_GPS_DEST_BEARING = new TagInfoRational("GPSDestBearing", 0x0018, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    129
    130    public static final TagInfoAscii GPS_TAG_GPS_DEST_DISTANCE_REF = new TagInfoAscii("GPSDestDistanceRef", 0x0019, 2, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    131
    132    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_KILOMETERS = "K";
    133
    134    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_MILES = "M";
    135    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_NAUTICAL_MILES = "N";
    136
    137    public static final TagInfoRational GPS_TAG_GPS_DEST_DISTANCE = new TagInfoRational("GPSDestDistance", 0x001a, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    138
    139    public static final TagInfoGpsText GPS_TAG_GPS_PROCESSING_METHOD = new TagInfoGpsText("GPSProcessingMethod", 0x001b, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    140
    141    public static final TagInfoGpsText GPS_TAG_GPS_AREA_INFORMATION = new TagInfoGpsText("GPSAreaInformation", 0x001c, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    142
    143    public static final TagInfoAscii GPS_TAG_GPS_DATE_STAMP = new TagInfoAscii("GPSDateStamp", 0x001d, 11, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    144
    145    public static final TagInfoShort GPS_TAG_GPS_DIFFERENTIAL = new TagInfoShort("GPSDifferential", 0x001e, TiffDirectoryType.EXIF_DIRECTORY_GPS);
    146
    147    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_NO_CORRECTION = 0;
    148
    149    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED = 1;
    150
    151    /**
    152     * Horizontal positioning errors in meters.
    153     *
    154     * @since 1.0.0-alpha6
    155     */
    156    public static final TagInfoRational GPS_TAG_GPS_HOR_POSITIONING_ERROR = new TagInfoRational("GPSHPositioningError", 0x001f,
    157            TiffDirectoryType.EXIF_DIRECTORY_GPS);
    158
    159    public static final List<TagInfo> ALL_GPS_TAGS = Collections.unmodifiableList(Arrays.asList(GPS_TAG_GPS_VERSION_ID, GPS_TAG_GPS_LATITUDE_REF,
    160            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,
    161            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,
    162            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,
    163            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,
    164            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,
    165            GPS_TAG_GPS_DATE_STAMP, GPS_TAG_GPS_DIFFERENTIAL, GPS_TAG_GPS_HOR_POSITIONING_ERROR));
    166
    167    public static byte[] gpsVersion() {
    168        return GPS_VERSION.clone();
    169    }
    170
    171    private GpsTagConstants() {
    172    }
    173}