Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: ui/file_manager/file_manager/foreground/elements/files_metadata_box.js

Issue 2536423002: Quick View: Show geography metadata. (Closed)
Patch Set: Removed unneeded i18n entry. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/foreground/elements/files_metadata_box.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/elements/files_metadata_box.js
diff --git a/ui/file_manager/file_manager/foreground/elements/files_metadata_box.js b/ui/file_manager/file_manager/foreground/elements/files_metadata_box.js
index 8428ffdf542afc0081dd4207efd32ea4a15b9834..834def10ccd5080a4d92b4397dc83f84cf0da608 100644
--- a/ui/file_manager/file_manager/foreground/elements/files_metadata_box.js
+++ b/ui/file_manager/file_manager/foreground/elements/files_metadata_box.js
@@ -165,4 +165,36 @@ var FilesMetadataBox = Polymer({
return (ifd && ifd.image && ifd.image[id] && ifd.image[id].value) || '';
},
+ /**
+ * Returns geolocation as a string in the form of 'latitude, longitude',
+ * where the values have 3 decimal precision. Negative latitude indicates
+ * south latitude and negative longitude indicates west longitude.
+ * @param {?Object} ifd
+ * @return {string}
+ *
+ * @private
+ */
+ geography_: function(ifd) {
+ var gps = ifd && ifd.gps;
+ if (!gps || !gps[1] || !gps[2] || !gps[3] || !gps[4])
+ return '';
+
+ var parseRationale = function(r) {
+ var num = parseInt(r[0], 10);
+ var den = parseInt(r[1], 10);
+ return num / den;
+ };
+
+ var computeCorrdinate = function(value) {
+ return parseRationale(value[0]) + parseRationale(value[1]) / 60 +
+ parseRationale(value[2]) / 3600;
+ };
+
+ var latitude =
+ computeCorrdinate(gps[2].value) * (gps[1].value === 'N\0' ? 1 : -1);
+ var longitude =
+ computeCorrdinate(gps[4].value) * (gps[3].value === 'E\0' ? 1 : -1);
+
+ return Number(latitude).toFixed(3) + ', ' + Number(longitude).toFixed(3);
+ },
});
« no previous file with comments | « ui/file_manager/file_manager/foreground/elements/files_metadata_box.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698