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



commit a65d0fe40be23fe37e8276132b2eb043191e9f43
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 5e8ef6d..e7af4e9 100644
--- a/src/gnome-maps.js.gresource.xml
+++ b/src/gnome-maps.js.gresource.xml
@@ -13,6 +13,7 @@
     <file>mainWindow.js</file>
     <file>mapBubble.js</file>
     <file>mapMarker.js</file>
+    <file>mapSource.js</file>
     <file>mapView.js</file>
     <file>mapWalker.js</file>
     <file>notification.js</file>
diff --git a/src/mapView.js b/src/mapView.js
index f500a37..cd9aa30 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -37,6 +37,7 @@ const Signals = imports.signals;
 const Application = imports.application;
 const Utils = imports.utils;
 const Path = imports.path;
+const MapSource = imports.mapSource;
 const MapWalker = imports.mapWalker;
 const SearchResultMarker = imports.searchResultMarker;
 const TurnPointMarker = imports.turnPointMarker;
@@ -44,10 +45,8 @@ const UserLocationMarker = imports.userLocationMarker;
 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;
@@ -82,7 +81,6 @@ const MapView = new Lang.Class({
         this.view = this._initView();
         this._initLayers();
 
-        this._factory = Champlain.MapSourceFactory.dup_default();
         this.setMapType(MapType.STREET);
 
         this._updateUserLocation();
@@ -150,8 +148,10 @@ const MapView = new Lang.Class({
         if (this.view.map_source.id === mapType)
             return;
 
-        let source = this._factory.create_cached_source(mapType);
-        this.view.map_source = source;
+        if (mapType === MapType.AERIAL)
+            this.view.map_source = MapSource.createAerialSource();
+        else
+            this.view.map_source = MapSource.createStreetSource();
     },
 
     gotoUserLocation: function(animate) {


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