Skip to content

Commit

Permalink
Merge branch 'feat-gps-lat-long' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Flajt authored Nov 22, 2024
2 parents 221860c + db98dee commit a648616
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
62 changes: 62 additions & 0 deletions lib/src/exif/ifd_directory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit a648616

Please sign in to comment.