diff --git a/lib/src/exif/ifd_directory.dart b/lib/src/exif/ifd_directory.dart index 164a1a33..24c3a6c5 100644 --- a/lib/src/exif/ifd_directory.dart +++ b/lib/src/exif/ifd_directory.dart @@ -321,4 +321,66 @@ class IfdDirectory { data[0x8298] = IfdValueAscii(value); } } + + bool get hasGPSLatitudeRef => data.containsKey(0x0001); + String? get gpsLatitudeRef => data[0x0001]?.toString(); + set gpsLatitudeRef(String? value) { + if (value == null) { + data.remove(0x0001); + } else { + data[0x0001] = IfdValueAscii(value); + } + } + + bool get hasGPSLatitude => data.containsKey(0x0002); + double? get gpsLatitude => data[0x0002]?.toDouble(); + set gpsLatitude(double? value) { + if (value == null) { + data.remove(0x0002); + } else { + data[0x0002] = IfdValueDouble(value); + } + } + + bool get hasGPSLongitudeRef => data.containsKey(0x0003); + String? get gpsLongitudeRef => data[0x0003]?.toString(); + set gpsLongitudeRef(String? value) { + if (value == null) { + data.remove(0x0003); + } else { + data[0x0003] = IfdValueAscii(value); + } + } + + bool get hasGPSLongitude => data.containsKey(0x0004); + double? get gpsLongitude => data[0x0004]?.toDouble(); + set gpsLongitude(double? value) { + if (value == null) { + data.remove(0x0004); + } else { + data[0x0004] = IfdValueDouble(value); + } + } + + void setGpsLocation({ + required double latitude, + required double longitude, + }) { + gpsLatitude = latitude.abs(); + gpsLongitude = longitude.abs(); + gpsLatitudeRef = latitude < 0.0 ? 'S' : 'N'; + gpsLongitudeRef = longitude < 0.0 ? 'W' : 'E'; + } + + + bool get hasGPSDate => data.containsKey(0x001D); + String? get gpsDate => data[0x001D]?.toString(); + set gpsDate(String? value) { + if (value == null) { + data.remove(0x001D); + } else { + data[0x001D] = IfdValueAscii(value); + } + } + } diff --git a/pubspec.yaml b/pubspec.yaml index a19e5001..393b6349 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: image -version: 4.3.0 +version: 4.3.1 description: >- Dart Image Library provides server and web apps the ability to load, manipulate, and save images with various image file formats.