[gnome-maps/gnome-3-12] Use MapSource module to set map source



commit 37fcd9cfd56eecbd0c506a41a627866670698a4d
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Sat Jul 30 14:54:32 2016 +0200

    Use MapSource module to set map source

 src/gnome-maps.js.gresource.xml |    1 +
 src/mapView.js                  |   14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-maps.js.gresource.xml b/src/gnome-maps.js.gresource.xml
index cb9a57c..ed1dc78 100644
--- a/src/gnome-maps.js.gresource.xml
+++ b/src/gnome-maps.js.gresource.xml
@@ -8,6 +8,7 @@
     <file>main.js</file>
     <file>mainWindow.js</file>
     <file>mapLocation.js</file>
+    <file>mapSource.js</file>
     <file>mapView.js</file>
     <file>path.js</file>
     <file>placeStore.js</file>
diff --git a/src/mapView.js b/src/mapView.js
index 0651182..ac4e8b1 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -38,15 +38,14 @@ const Sidebar = imports.sidebar;
 const Utils = imports.utils;
 const Path = imports.path;
 const MapLocation = imports.mapLocation;
+const MapSource = imports.mapSource;
 const UserLocation = imports.userLocation;
 const Geoclue = imports.geoclue;
 const _ = imports.gettext.gettext;
 
 const MapType = {
-    STREET:  Champlain.MAP_SOURCE_OSM_MAPQUEST,
-    AERIAL:  Champlain.MAP_SOURCE_OSM_AERIAL_MAP,
-    CYCLING: Champlain.MAP_SOURCE_OSM_CYCLE_MAP,
-    TRANSIT: Champlain.MAP_SOURCE_OSM_TRANSPORT_MAP
+    STREET: 'MapsStreetSource',
+    AERIAL: 'MapsAerialSource'
 };
 
 const MapMinZoom = 2;
@@ -87,7 +86,6 @@ const MapView = new Lang.Class({
             }
         }).bind(this));
 
-        this._factory = Champlain.MapSourceFactory.dup_default();
         this.setMapType(MapType.STREET);
 
 
@@ -98,8 +96,10 @@ const MapView = new Lang.Class({
     },
 
     setMapType: function(mapType) {
-        let source = this._factory.create_cached_source(mapType);
-        this.view.set_map_source(source);
+        if (mapType === MapType.AERIAL)
+            this.view.map_source = MapSource.createAerialSource();
+        else
+            this.view.map_source = MapSource.createStreetSource();
     },
 
     geocodeSearch: function(searchString, searchCompleteCallback) {


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