[gnome-maps/wip/accuracy-circle: 3/5] 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/wip/accuracy-circle: 3/5] utils: Add function to create description for accuracy
- Date: Sun, 14 Apr 2013 15:59:25 +0000 (UTC)
commit 3b5e5efa321d8c7b7b44ecb25fce521e6955f0fe
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sun Apr 14 17:53:48 2013 +0300
utils: Add function to create description for accuracy
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]