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(
035            "GPSVersionID", 0x0000, 4,
036            TiffDirectoryType.EXIF_DIRECTORY_GPS);
037
038    private static final byte[] GPS_VERSION = new byte[] { (byte)2, (byte)3, (byte)0, (byte)0 };
039
040    public static byte[] gpsVersion() {
041        return GPS_VERSION.clone();
042    }
043
044    // ************************************************************
045    public static final TagInfoAscii GPS_TAG_GPS_LATITUDE_REF = new TagInfoAscii(
046            "GPSLatitudeRef", 0x0001, 2,
047            TiffDirectoryType.EXIF_DIRECTORY_GPS);
048
049    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH = "N";
050    public static final String GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH = "S";
051    // ************************************************************
052    public static final TagInfoRationals GPS_TAG_GPS_LATITUDE = new TagInfoRationals(
053            "GPSLatitude", 0x0002, 3,
054            TiffDirectoryType.EXIF_DIRECTORY_GPS);
055
056    // ************************************************************
057    public static final TagInfoAscii GPS_TAG_GPS_LONGITUDE_REF = new TagInfoAscii(
058            "GPSLongitudeRef", 0x0003, 2,
059            TiffDirectoryType.EXIF_DIRECTORY_GPS);
060
061    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_EAST = "E";
062    public static final String GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST = "W";
063    // ************************************************************
064    public static final TagInfoRationals GPS_TAG_GPS_LONGITUDE = new TagInfoRationals(
065            "GPSLongitude", 0x0004, 3,
066            TiffDirectoryType.EXIF_DIRECTORY_GPS);
067
068    // ************************************************************
069    public static final TagInfoByte GPS_TAG_GPS_ALTITUDE_REF = new TagInfoByte(
070            "GPSAltitudeRef", 0x0005,
071            TiffDirectoryType.EXIF_DIRECTORY_GPS);
072
073    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL = 0;
074    public static final int GPS_TAG_GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL = 1;
075    // ************************************************************
076    public static final TagInfoRational GPS_TAG_GPS_ALTITUDE = new TagInfoRational(
077            "GPSAltitude", 0x0006,
078            TiffDirectoryType.EXIF_DIRECTORY_GPS);
079
080    // ************************************************************
081    public static final TagInfoRationals GPS_TAG_GPS_TIME_STAMP = new TagInfoRationals(
082            "GPSTimeStamp", 0x0007, 3,
083            TiffDirectoryType.EXIF_DIRECTORY_GPS);
084
085    // ************************************************************
086    public static final TagInfoAscii GPS_TAG_GPS_SATELLITES = new TagInfoAscii(
087            "GPSSatellites", 0x0008, -1,
088            TiffDirectoryType.EXIF_DIRECTORY_GPS);
089
090    // ************************************************************
091    public static final TagInfoAscii GPS_TAG_GPS_STATUS = new TagInfoAscii(
092            "GPSStatus", 0x0009, 2,
093            TiffDirectoryType.EXIF_DIRECTORY_GPS);
094
095    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS = "A";
096    public static final String GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY = "V";
097    // ************************************************************
098    public static final TagInfoAscii GPS_TAG_GPS_MEASURE_MODE = new TagInfoAscii(
099            "GPSMeasureMode", 0x000a, 2,
100            TiffDirectoryType.EXIF_DIRECTORY_GPS);
101
102    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT = 2;
103    public static final int GPS_TAG_GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT = 3;
104    // ************************************************************
105    public static final TagInfoRational GPS_TAG_GPS_DOP = new TagInfoRational(
106            "GPSDOP", 0x000b,
107            TiffDirectoryType.EXIF_DIRECTORY_GPS);
108
109    // ************************************************************
110    public static final TagInfoAscii GPS_TAG_GPS_SPEED_REF = new TagInfoAscii(
111            "GPSSpeedRef", 0x000c, 2,
112            TiffDirectoryType.EXIF_DIRECTORY_GPS);
113
114    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KMPH = "K";
115    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_MPH = "M";
116    public static final String GPS_TAG_GPS_SPEED_REF_VALUE_KNOTS = "N";
117    // ************************************************************
118    public static final TagInfoRational GPS_TAG_GPS_SPEED = new TagInfoRational(
119            "GPSSpeed", 0x000d,
120            TiffDirectoryType.EXIF_DIRECTORY_GPS);
121
122    // ************************************************************
123    public static final TagInfoAscii GPS_TAG_GPS_TRACK_REF = new TagInfoAscii(
124            "GPSTrackRef", 0x000e, 2,
125            TiffDirectoryType.EXIF_DIRECTORY_GPS);
126
127    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_MAGNETIC_NORTH = "M";
128    public static final String GPS_TAG_GPS_TRACK_REF_VALUE_TRUE_NORTH = "T";
129    // ************************************************************
130    public static final TagInfoRational GPS_TAG_GPS_TRACK = new TagInfoRational(
131            "GPSTrack", 0x000f,
132            TiffDirectoryType.EXIF_DIRECTORY_GPS);
133
134    // ************************************************************
135    public static final TagInfoAscii GPS_TAG_GPS_IMG_DIRECTION_REF = new TagInfoAscii(
136            "GPSImgDirectionRef", 0x0010, 2,
137            TiffDirectoryType.EXIF_DIRECTORY_GPS);
138
139    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH = "M";
140    public static final String GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH = "T";
141    // ************************************************************
142    public static final TagInfoRational GPS_TAG_GPS_IMG_DIRECTION = new TagInfoRational(
143            "GPSImgDirection", 0x0011,
144            TiffDirectoryType.EXIF_DIRECTORY_GPS);
145
146    // ************************************************************
147    public static final TagInfoAscii GPS_TAG_GPS_MAP_DATUM = new TagInfoAscii(
148            "GPSMapDatum", 0x0012, -1,
149            TiffDirectoryType.EXIF_DIRECTORY_GPS);
150
151    // ************************************************************
152    public static final TagInfoAscii GPS_TAG_GPS_DEST_LATITUDE_REF = new TagInfoAscii(
153            "GPSDestLatitudeRef", 0x0013, 2,
154            TiffDirectoryType.EXIF_DIRECTORY_GPS);
155
156    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_NORTH = "N";
157    public static final String GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_SOUTH = "S";
158    // ************************************************************
159    public static final TagInfoRationals GPS_TAG_GPS_DEST_LATITUDE = new TagInfoRationals(
160            "GPSDestLatitude", 0x0014, 3,
161            TiffDirectoryType.EXIF_DIRECTORY_GPS);
162
163    // ************************************************************
164    public static final TagInfoAscii GPS_TAG_GPS_DEST_LONGITUDE_REF = new TagInfoAscii(
165            "GPSDestLongitudeRef", 0x0015, 2,
166            TiffDirectoryType.EXIF_DIRECTORY_GPS);
167
168    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_EAST = "E";
169    public static final String GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_WEST = "W";
170    // ************************************************************
171    public static final TagInfoRationals GPS_TAG_GPS_DEST_LONGITUDE = new TagInfoRationals(
172            "GPSDestLongitude", 0x0016, 3,
173            TiffDirectoryType.EXIF_DIRECTORY_GPS);
174
175    // ************************************************************
176    public static final TagInfoAscii GPS_TAG_GPS_DEST_BEARING_REF = new TagInfoAscii(
177            "GPSDestBearingRef", 0x0017, 2,
178            TiffDirectoryType.EXIF_DIRECTORY_GPS);
179
180    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH = "M";
181    public static final String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH = "T";
182    // ************************************************************
183    public static final TagInfoRational GPS_TAG_GPS_DEST_BEARING = new TagInfoRational(
184            "GPSDestBearing", 0x0018,
185            TiffDirectoryType.EXIF_DIRECTORY_GPS);
186
187    // ************************************************************
188    public static final TagInfoAscii GPS_TAG_GPS_DEST_DISTANCE_REF = new TagInfoAscii(
189            "GPSDestDistanceRef", 0x0019, 2,
190            TiffDirectoryType.EXIF_DIRECTORY_GPS);
191
192    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_KILOMETERS = "K";
193    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_MILES = "M";
194    public static final String GPS_TAG_GPS_DEST_DISTANCE_REF_VALUE_NAUTICAL_MILES = "N";
195    // ************************************************************
196    public static final TagInfoRational GPS_TAG_GPS_DEST_DISTANCE = new TagInfoRational(
197            "GPSDestDistance", 0x001a,
198            TiffDirectoryType.EXIF_DIRECTORY_GPS);
199
200    // ************************************************************
201    public static final TagInfoGpsText GPS_TAG_GPS_PROCESSING_METHOD = new TagInfoGpsText(
202            "GPSProcessingMethod", 0x001b,
203            TiffDirectoryType.EXIF_DIRECTORY_GPS);
204
205    // ************************************************************
206    public static final TagInfoGpsText GPS_TAG_GPS_AREA_INFORMATION = new TagInfoGpsText(
207            "GPSAreaInformation", 0x001c,
208            TiffDirectoryType.EXIF_DIRECTORY_GPS);
209
210    // ************************************************************
211    public static final TagInfoAscii GPS_TAG_GPS_DATE_STAMP = new TagInfoAscii(
212            "GPSDateStamp", 0x001d, 11,
213            TiffDirectoryType.EXIF_DIRECTORY_GPS);
214
215    // ************************************************************
216    public static final TagInfoShort GPS_TAG_GPS_DIFFERENTIAL = new TagInfoShort(
217            "GPSDifferential", 0x001e,
218            TiffDirectoryType.EXIF_DIRECTORY_GPS);
219
220    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_NO_CORRECTION = 0;
221    public static final int GPS_TAG_GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED = 1;
222    // ************************************************************
223
224    public static final List<TagInfo> ALL_GPS_TAGS =
225            Collections.unmodifiableList(Arrays.asList(
226                    GPS_TAG_GPS_VERSION_ID, GPS_TAG_GPS_LATITUDE_REF,
227                    GPS_TAG_GPS_LATITUDE, GPS_TAG_GPS_LONGITUDE_REF,
228                    GPS_TAG_GPS_LONGITUDE, GPS_TAG_GPS_ALTITUDE_REF,
229                    GPS_TAG_GPS_ALTITUDE, GPS_TAG_GPS_TIME_STAMP,
230                    GPS_TAG_GPS_SATELLITES, GPS_TAG_GPS_STATUS,
231                    GPS_TAG_GPS_MEASURE_MODE, GPS_TAG_GPS_DOP, GPS_TAG_GPS_SPEED_REF,
232                    GPS_TAG_GPS_SPEED, GPS_TAG_GPS_TRACK_REF, GPS_TAG_GPS_TRACK,
233                    GPS_TAG_GPS_IMG_DIRECTION_REF, GPS_TAG_GPS_IMG_DIRECTION,
234                    GPS_TAG_GPS_MAP_DATUM, GPS_TAG_GPS_DEST_LATITUDE_REF,
235                    GPS_TAG_GPS_DEST_LATITUDE, GPS_TAG_GPS_DEST_LONGITUDE_REF,
236                    GPS_TAG_GPS_DEST_LONGITUDE, GPS_TAG_GPS_DEST_BEARING_REF,
237                    GPS_TAG_GPS_DEST_BEARING, GPS_TAG_GPS_DEST_DISTANCE_REF,
238                    GPS_TAG_GPS_DEST_DISTANCE, GPS_TAG_GPS_PROCESSING_METHOD,
239                    GPS_TAG_GPS_AREA_INFORMATION, GPS_TAG_GPS_DATE_STAMP,
240                    GPS_TAG_GPS_DIFFERENTIAL));
241
242    private GpsTagConstants() {
243    }
244}