using System; using System.Collections; using System.Text; using System.IO; using com.drew.metadata; using com.drew.lang; using com.utils; using System.Globalization; /// /// This class was first written by Drew Noakes in Java. /// /// This is public domain software - that is, you can do whatever you want /// with it, and include it software that is licensed under the GNU or the /// BSD license, or whatever other licence you choose, including proprietary /// closed source licenses. I do ask that you leave this header in tact. /// /// If you make modifications to this code that you think would benefit the /// wider community, please send me a copy and I'll post it on my site. /// /// If you make use of this code, Drew Noakes will appreciate hearing /// about it: drew@drewnoakes.com /// /// Latest Java version of this software kept at /// http://drewnoakes.com/ /// /// The C# class was made by Ferret Renaud: /// renaud91@free.fr /// If you find a bug in the C# code, feel free to mail me. /// namespace com.drew.metadata.exif { /// /// The GPS Directory class /// public class GpsDirectory : Directory { /// /// GPS tag version GPSVersionID 0 0 BYTE 4 /// public const int TAG_GPS_VERSION_ID = 0x0000; /// /// North or South Latitude GPSLatitudeRef 1 1 ASCII 2 /// public const int TAG_GPS_LATITUDE_REF = 0x0001; /// /// Latitude GPSLatitude 2 2 RATIONAL 3 /// public const int TAG_GPS_LATITUDE = 0x0002; /// /// East or West Longitude GPSLongitudeRef 3 3 ASCII 2 /// public const int TAG_GPS_LONGITUDE_REF = 0x0003; /// /// Longitude GPSLongitude 4 4 RATIONAL 3 /// public const int TAG_GPS_LONGITUDE = 0x0004; /// /// Altitude reference GPSAltitudeRef 5 5 BYTE 1 /// public const int TAG_GPS_ALTITUDE_REF = 0x0005; /// /// Altitude GPSAltitude 6 6 RATIONAL 1 /// public const int TAG_GPS_ALTITUDE = 0x0006; /// /// GPS time (atomic clock) GPSTimeStamp 7 7 RATIONAL 3 /// public const int TAG_GPS_TIME_STAMP = 0x0007; /// /// GPS satellites used for measurement GPSSatellites 8 8 ASCII Any /// public const int TAG_GPS_SATELLITES = 0x0008; /// /// GPS receiver status GPSStatus 9 9 ASCII 2 /// public const int TAG_GPS_STATUS = 0x0009; /// /// GPS measurement mode GPSMeasureMode 10 A ASCII 2 /// public const int TAG_GPS_MEASURE_MODE = 0x000A; /// /// Measurement precision GPSDOP 11 B RATIONAL 1 /// public const int TAG_GPS_DOP = 0x000B; /// /// Speed unit GPSSpeedRef 12 C ASCII 2 /// public const int TAG_GPS_SPEED_REF = 0x000C; /// /// Speed of GPS receiver GPSSpeed 13 D RATIONAL 1 /// public const int TAG_GPS_SPEED = 0x000D; /// /// Reference for direction of movement GPSTrackRef 14 E ASCII 2 /// public const int TAG_GPS_TRACK_REF = 0x000E; /// /// Direction of movement GPSTrack 15 F RATIONAL 1 /// public const int TAG_GPS_TRACK = 0x000F; /// /// Reference for direction of image GPSImgDirectionRef 16 10 ASCII 2 /// public const int TAG_GPS_IMG_DIRECTION_REF = 0x0010; /// /// Direction of image GPSImgDirection 17 11 RATIONAL 1 /// public const int TAG_GPS_IMG_DIRECTION = 0x0011; /// /// Geodetic survey data used GPSMapDatum 18 12 ASCII Any /// public const int TAG_GPS_MAP_DATUM = 0x0012; /// /// Reference for latitude of destination GPSDestLatitudeRef 19 13 ASCII 2 /// public const int TAG_GPS_DEST_LATITUDE_REF = 0x0013; /// /// Latitude of destination GPSDestLatitude 20 14 RATIONAL 3 /// public const int TAG_GPS_DEST_LATITUDE = 0x0014; /// /// Reference for longitude of destination GPSDestLongitudeRef 21 15 ASCII 2 /// public const int TAG_GPS_DEST_LONGITUDE_REF = 0x0015; /// /// Longitude of destination GPSDestLongitude 22 16 RATIONAL 3 /// public const int TAG_GPS_DEST_LONGITUDE = 0x0016; /// /// Reference for bearing of destination GPSDestBearingRef 23 17 ASCII 2 /// public const int TAG_GPS_DEST_BEARING_REF = 0x0017; /// /// Bearing of destination GPSDestBearing 24 18 RATIONAL 1 /// public const int TAG_GPS_DEST_BEARING = 0x0018; /// /// Reference for distance to destination GPSDestDistanceRef 25 19 ASCII 2 /// public const int TAG_GPS_DEST_DISTANCE_REF = 0x0019; /// /// Distance to destination GPSDestDistance 26 1A RATIONAL 1 /// public const int TAG_GPS_DEST_DISTANCE = 0x001A; protected static readonly ResourceBundle BUNDLE = new ResourceBundle("GpsMarkernote"); protected static readonly IDictionary tagNameMap = GpsDirectory.InitTagMap(); /// /// Initialize the tag map. /// /// the tag map private static IDictionary InitTagMap() { // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, // based on the Spanish culture (es-AR), where "I" is not the uppercase version of "i". CultureInfo myCul = new CultureInfo( "es-AR" ); IDictionary resu = new Hashtable( new CaseInsensitiveHashCodeProvider( myCul ), new CaseInsensitiveComparer( myCul )); //IDictionary resu = new Hashtable(); resu.Add(TAG_GPS_VERSION_ID, BUNDLE["TAG_GPS_VERSION_ID"]); resu.Add(TAG_GPS_LATITUDE_REF, BUNDLE["TAG_GPS_LATITUDE_REF"]); resu.Add(TAG_GPS_LATITUDE, BUNDLE["TAG_GPS_LATITUDE"]); resu.Add(TAG_GPS_LONGITUDE_REF, BUNDLE["TAG_GPS_LONGITUDE_REF"]); resu.Add(TAG_GPS_LONGITUDE, BUNDLE["TAG_GPS_LONGITUDE"]); resu.Add(TAG_GPS_ALTITUDE_REF, BUNDLE["TAG_GPS_ALTITUDE_REF"]); resu.Add(TAG_GPS_ALTITUDE, BUNDLE["TAG_GPS_ALTITUDE"]); resu.Add(TAG_GPS_TIME_STAMP, BUNDLE["TAG_GPS_TIME_STAMP"]); resu.Add(TAG_GPS_SATELLITES, BUNDLE["TAG_GPS_SATELLITES"]); resu.Add(TAG_GPS_STATUS, BUNDLE["TAG_GPS_STATUS"]); resu.Add(TAG_GPS_MEASURE_MODE, BUNDLE["TAG_GPS_MEASURE_MODE"]); resu.Add(TAG_GPS_DOP, BUNDLE["TAG_GPS_DOP"]); resu.Add(TAG_GPS_SPEED_REF, BUNDLE["TAG_GPS_SPEED_REF"]); resu.Add(TAG_GPS_SPEED, BUNDLE["TAG_GPS_SPEED"]); resu.Add(TAG_GPS_TRACK_REF, BUNDLE["TAG_GPS_TRACK_REF"]); resu.Add(TAG_GPS_TRACK, BUNDLE["TAG_GPS_TRACK"]); resu.Add(TAG_GPS_IMG_DIRECTION_REF, BUNDLE["TAG_GPS_IMG_DIRECTION_REF"]); resu.Add(TAG_GPS_IMG_DIRECTION, BUNDLE["TAG_GPS_IMG_DIRECTION"]); resu.Add(TAG_GPS_MAP_DATUM, BUNDLE["TAG_GPS_MAP_DATUM"]); resu.Add(TAG_GPS_DEST_LATITUDE_REF, BUNDLE["TAG_GPS_DEST_LATITUDE_REF"]); resu.Add(TAG_GPS_DEST_LATITUDE, BUNDLE["TAG_GPS_DEST_LATITUDE"]); resu.Add(TAG_GPS_DEST_LONGITUDE_REF, BUNDLE["TAG_GPS_DEST_LONGITUDE_REF"]); resu.Add(TAG_GPS_DEST_LONGITUDE, BUNDLE["TAG_GPS_DEST_LONGITUDE"]); resu.Add(TAG_GPS_DEST_BEARING_REF, BUNDLE["TAG_GPS_DEST_BEARING_REF"]); resu.Add(TAG_GPS_DEST_BEARING, BUNDLE["TAG_GPS_DEST_BEARING"]); resu.Add(TAG_GPS_DEST_DISTANCE_REF, BUNDLE["TAG_GPS_DEST_DISTANCE_REF"]); resu.Add(TAG_GPS_DEST_DISTANCE, BUNDLE["TAG_GPS_DEST_DISTANCE"]); return resu; } /// /// Constructor of the object. /// public GpsDirectory() : base() { this.SetDescriptor(new GpsDescriptor(this)); } /// /// Provides the name of the directory, for display purposes. E.g. Exif /// /// the name of the directory public override string GetName() { return BUNDLE["MARKER_NOTE_NAME"]; } /// /// Provides the map of tag names, hashed by tag type identifier. /// /// the map of tag names protected override IDictionary GetTagNameMap() { return tagNameMap; } } }