[gnome-maps] placeStore: store place bounding_box



commit dc867c77b87c3e36fc9845ac58552368952cea66
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed Jan 29 14:06:24 2014 +0100

    placeStore: store place bounding_box
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722865

 src/placeStore.js |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/src/placeStore.js b/src/placeStore.js
index cee5e7b..cb0a98f 100644
--- a/src/placeStore.js
+++ b/src/placeStore.js
@@ -128,7 +128,14 @@ const PlaceStore = new Lang.Class({
                 let place = Geocode.Place.new_with_location(obj.name,
                                                             obj.place_type,
                                                             location);
-
+                if (obj.bounding_box) {
+                    place.set_bounding_box(new Geocode.BoundingBox({
+                        top: obj.bounding_box.top,
+                        bottom: obj.bounding_box.bottom,
+                        left: obj.bounding_box.left,
+                        right: obj.bounding_box.right
+                    }));
+                }
                 this._addPlace(place, obj.type, obj.added);
                 if (obj.type === PlaceType.RECENT)
                     this._numRecent++;
@@ -146,15 +153,26 @@ const PlaceStore = new Lang.Class({
                 type     = model.get_value(iter, Columns.TYPE),
                 added    = model.get_value(iter, Columns.ADDED);
 
+            let bounding_box = null;
+            if (place.bounding_box !== null) {
+                bounding_box = {
+                    top: place.bounding_box.top,
+                    bottom: place.bounding_box.bottom,
+                    left: place.bounding_box.left,
+                    right: place.bounding_box.right
+                };
+            }
+
             jsonArray.push({
-                place_type: place.place_type,
-                name:       place.name,
-                latitude:   location.latitude,
-                longitude:  location.longitude,
-                altitude:   location.altitude,
-                accuracy:   location.accuracy,
-                type:       type,
-                added:      added
+                place_type:   place.place_type,
+                name:         place.name,
+                latitude:     location.latitude,
+                longitude:    location.longitude,
+                altitude:     location.altitude,
+                accuracy:     location.accuracy,
+                bounding_box: bounding_box,
+                type:         type,
+                added:        added
             });
         });
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]