[eog] EogMetadataDetails: Improve fractional GPS coordinates support
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] EogMetadataDetails: Improve fractional GPS coordinates support
- Date: Fri, 28 Feb 2014 22:01:50 +0000 (UTC)
commit 1b0fb6b3e06bd2cc8e8055c0847d75311685f7c9
Author: Felix Riemann <friemann gnome org>
Date: Fri Feb 28 22:52:56 2014 +0100
EogMetadataDetails: Improve fractional GPS coordinates support
Increase displayed coordinate resolution for Exif GPS coordinates that
use fractional degrees for minutes or fractional minutes for seconds.
https://bugzilla.gnome.org/show_bug.cgi?id=725416
src/eog-metadata-details.c | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/src/eog-metadata-details.c b/src/eog-metadata-details.c
index e9c619f..cc51e5f 100644
--- a/src/eog-metadata-details.c
+++ b/src/eog-metadata-details.c
@@ -39,6 +39,7 @@
#include <gtk/gtk.h>
#include <string.h>
+#include <math.h>
typedef enum {
EXIF_CATEGORY_CAMERA,
@@ -372,7 +373,7 @@ eog_exif_entry_get_value (ExifEntry *e,
{
gsize rational_size;
ExifRational r;
- gfloat h = 0., m = 0.;
+ gfloat h = 0., m = 0., s = 0.;
rational_size = exif_format_get_size (EXIF_FORMAT_RATIONAL);
@@ -385,15 +386,33 @@ eog_exif_entry_get_value (ExifEntry *e,
h = (gfloat)r.numerator / r.denominator;
r = exif_get_rational (e->data + rational_size, bo);
- if (r.denominator != 0)
- m = (gfloat)r.numerator / (gfloat)r.denominator;
+ if (r.denominator != 0) {
+ if (r.numerator != 0) {
+ m = (gfloat)r.numerator /
+ (gfloat)r.denominator;
+ } else {
+ double integ;
+
+ m = (gfloat)(modf (h, &integ) * 60.0);
+ h = (gfloat) integ;
+ }
+ }
r = exif_get_rational (e->data + (2 * rational_size),
bo);
- if (r.numerator != 0 && r.denominator != 0) {
- gfloat s;
+ if (r.denominator != 0) {
+ if (r.numerator != 0) {
+ s = (gfloat)r.numerator /
+ (gfloat)r.denominator;
+ } else {
+ double integ;
+
+ s = (gfloat)(modf (m, &integ) * 60.0);
+ m = (gfloat) integ;
+ }
+ }
- s = (gfloat)r.numerator / (gfloat)r.denominator;
+ if (s != 0.0) {
g_snprintf (buf, n_buf,
"%.0f° %.0f' %.2f\"",
h, m, s);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]