From 948b3910981a3c7c62dbea73fc92f11cc0d5d95f Mon Sep 17 00:00:00 2001 From: Flajt Date: Mon, 26 Aug 2024 19:39:22 +0200 Subject: [PATCH 1/4] Feat: Add Lat & Long get / set Create getter & setter for latitude and longitude --- lib/src/exif/ifd_directory.dart | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/src/exif/ifd_directory.dart b/lib/src/exif/ifd_directory.dart index 164a1a33..82399568 100644 --- a/lib/src/exif/ifd_directory.dart +++ b/lib/src/exif/ifd_directory.dart @@ -321,4 +321,25 @@ class IfdDirectory { data[0x8298] = 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 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); + } + } + } From e0ce2a03bd1850098155bba8f73fb2cb81997b5e Mon Sep 17 00:00:00 2001 From: Flajt Date: Mon, 26 Aug 2024 19:40:51 +0200 Subject: [PATCH 2/4] Chore: Update version Update version after build adding gps setter and getter --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 451c5836..9ade18cf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: image -version: 4.2.0 +version: 4.2.1 description: >- Dart Image Library provides server and web apps the ability to load, manipulate, and save images with various image file formats. From eebc4b1723afefa71ed3131da33cff1108f7a56c Mon Sep 17 00:00:00 2001 From: spin7ion Date: Thu, 3 Oct 2024 05:40:56 +0300 Subject: [PATCH 3/4] added gps date modification --- lib/src/exif/ifd_directory.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/src/exif/ifd_directory.dart b/lib/src/exif/ifd_directory.dart index 82399568..7364fa57 100644 --- a/lib/src/exif/ifd_directory.dart +++ b/lib/src/exif/ifd_directory.dart @@ -342,4 +342,14 @@ class IfdDirectory { } } + 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); + } + } + } From db98deeb9a89809c169b518d570eea6bab5fbf7c Mon Sep 17 00:00:00 2001 From: Flajt Date: Fri, 22 Nov 2024 19:22:51 +0100 Subject: [PATCH 4/4] Add GPS Latitude & Longitude Ref and option to set both at the same time Add changes requested by @Joshua-RF in original issue --- lib/src/exif/ifd_directory.dart | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/src/exif/ifd_directory.dart b/lib/src/exif/ifd_directory.dart index 7364fa57..24c3a6c5 100644 --- a/lib/src/exif/ifd_directory.dart +++ b/lib/src/exif/ifd_directory.dart @@ -321,6 +321,16 @@ 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(); @@ -331,7 +341,17 @@ class IfdDirectory { 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) { @@ -342,6 +362,17 @@ class IfdDirectory { } } + 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) {