[gnome-maps/wip/jonasdn/mapbox-3-22: 2/4] Use MapSource module to set map source



commit 07affa2ae6967b013c18ad0253367d69774a54f8
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Sat Jul 30 11:02:57 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 aa587da..8c2e97c 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -36,6 +36,7 @@ const KmlShapeLayer = imports.kmlShapeLayer;
 const GpxShapeLayer = imports.gpxShapeLayer;
 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;
@@ -47,10 +48,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 _LOCATION_STORE_TIMEOUT = 500;
 const MapMinZoom = 2;
@@ -105,7 +104,6 @@ const MapView = new Lang.Class({
         this.view = this._initView();
         this._initLayers();
 
-        this._factory = Champlain.MapSourceFactory.dup_default();
         this.setMapType(mapType);
 
         this.shapeLayerStore = new Gio.ListStore(GObject.TYPE_OBJECT);
@@ -209,8 +207,10 @@ const MapView = new Lang.Class({
         let overlay_sources = this.view.get_overlay_sources();
 
         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 ecd8ef4..4e29dfa 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -31,6 +31,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]