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



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

    Use MapSource module to set map source

 src/Makefile-js.am |    1 +
 src/mapView.js     |   14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index 233db98..484da9c 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -5,6 +5,7 @@ dist_js_DATA = \
     mainWindow.js \
     mapLocation.js \
     mapView.js \
+    mapSource.js \
     path.js \
     sidebar.js \
     utils.js \
diff --git a/src/mapView.js b/src/mapView.js
index 4e33358..bbf5931 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -39,15 +39,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 MapView = new Lang.Class({
@@ -78,7 +77,6 @@ const MapView = new Lang.Class({
         this._userLocationLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
         this.view.add_layer(this._userLocationLayer);
 
-        this._factory = Champlain.MapSourceFactory.dup_default();
         this.setMapType(MapType.STREET);
 
         this._zoomControl = new ZoomControl.ZoomControl(this);
@@ -91,8 +89,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]