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



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

    Use MapSource module to set map source

 src/mapView.js                       |   14 +++++++-------
 src/org.gnome.Maps.src.gresource.xml |    1 +
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 185db2f..765bf4f 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -31,6 +31,7 @@ const ContactPlace = imports.contactPlace;
 const Geoclue = imports.geoclue;
 const Location = imports.location;
 const Maps = imports.gi.GnomeMaps;
+const MapSource = imports.mapSource;
 const MapWalker = imports.mapWalker;
 const Place = imports.place;
 const PlaceMarker = imports.placeMarker;
@@ -41,10 +42,8 @@ const Utils = imports.utils;
 
 const MapType = {
     LOCAL: 'MapsLocalSource',
-    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);
 
         this._updateUserLocation();
@@ -156,8 +154,10 @@ const MapView = new Lang.Class({
             return;
 
         if (mapType !== MapType.LOCAL) {
-            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();
         } else {
             let renderer = new Champlain.ImageRenderer();
             let source = new Maps.FileTileSource({
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index a15ac7e..ca7ef18 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -23,6 +23,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>


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