[gnome-maps] utils: Add function to create description for accuracy
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] utils: Add function to create description for accuracy
- Date: Sun, 14 Apr 2013 18:20:00 +0000 (UTC)
commit 9922369a2cc0ed65a99cae59b0f8ac7f2eedc924
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sun Apr 14 17:53:48 2013 +0300
utils: Add function to create description for accuracy
https://bugzilla.gnome.org/show_bug.cgi?id=697736
src/utils.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/src/utils.js b/src/utils.js
index 76cdd6b..7e1721c 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -30,6 +30,8 @@ const GdkPixbuf = imports.gi.GdkPixbuf;
const Clutter = imports.gi.Clutter;
const Cogl = imports.gi.Cogl;
+const _ = imports.gettext.gettext;
+
let debugInit = false;
let debugEnabled = false;
@@ -99,6 +101,18 @@ function getZoomLevelForAccuracy(accuracy) {
return 3;
}
+function getDescriptionForAccuracy(accuracy) {
+ if (accuracy == Geocode.LOCATION_ACCURACY_UNKNOWN)
+ return "Unknown";
+ else if (accuracy == 0)
+ return "Exact";
+ else {
+ let area = Math.PI * Math.pow(accuracy / 1000, 2);
+ area = Math.floor(area);
+ return area.toString() + _(" kmĀ²");
+ }
+}
+
function CreateActorFromImageFile(path) {
try {
let pixbuf = GdkPixbuf.Pixbuf.new_from_file(path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]