[gimp/gimp-2-10] plug-ins: add functions for formatting gps metadata.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: add functions for formatting gps metadata.
- Date: Wed, 2 Dec 2020 00:10:48 +0000 (UTC)
commit 5a68e24ca0137f3c237ca096bc536d9fcebcb7aa
Author: Jacob Boerema <jgboerema gmail com>
Date: Wed Nov 25 22:43:13 2020 -0500
plug-ins: add functions for formatting gps metadata.
(cherry picked from commit 8db155583804ac966971c1b6c199e0ad39b693d3)
plug-ins/metadata/metadata-tags.c | 40 +++++++++++++++++++++++++++++++++++++++
plug-ins/metadata/metadata-tags.h | 6 ++++++
2 files changed, 46 insertions(+)
---
diff --git a/plug-ins/metadata/metadata-tags.c b/plug-ins/metadata/metadata-tags.c
index a65b8d7388..8f1d73a7a2 100644
--- a/plug-ins/metadata/metadata-tags.c
+++ b/plug-ins/metadata/metadata-tags.c
@@ -412,3 +412,43 @@ const gchar *locationcreated[] =
};
const gint n_locationcreated = G_N_ELEMENTS (locationcreated);
#endif
+
+
+gchar *
+metadata_format_gps_longitude_latitude (const gdouble value)
+{
+ gint deg, min;
+ gdouble sec;
+ gdouble gps_value = value;
+
+ if (gps_value < 0.f)
+ gps_value *= -1.f;
+
+ deg = (gint) gps_value;
+ min = (gint) ((gps_value - (gdouble) deg) * 60.f);
+ sec = ((gps_value - (gdouble) deg - (gdouble) (min / 60.f)) * 60.f * 60.f);
+
+ return g_strdup_printf ("%ddeg %d' %.3f\"", deg, min, sec);
+}
+
+/*
+ * use_meter: True return meters, False return feet
+ * measurement_symbol: Should be "m", "ft", or empty string (not NULL)
+ */
+gchar *
+metadata_format_gps_altitude (const gdouble value,
+ gboolean use_meter,
+ gchar *measurement_symbol)
+{
+ gdouble gps_value = value;
+
+ if (gps_value < 0.f)
+ gps_value *= -1.f;
+
+ if (! use_meter)
+ {
+ gps_value *= 3.28;
+ }
+
+ return g_strdup_printf ("%.2f%s", gps_value, measurement_symbol);
+}
diff --git a/plug-ins/metadata/metadata-tags.h b/plug-ins/metadata/metadata-tags.h
index 38e3280bed..1cd4cd39b5 100644
--- a/plug-ins/metadata/metadata-tags.h
+++ b/plug-ins/metadata/metadata-tags.h
@@ -233,4 +233,10 @@ extern const gchar *locationcreated[];
extern const gint n_locationcreated;
#endif
+
+gchar * metadata_format_gps_longitude_latitude (const gdouble value);
+gchar * metadata_format_gps_altitude (const gdouble value,
+ gboolean use_meter,
+ gchar *measurement_symbol);
+
#endif /* __METADATA_TAGS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]