[gnome-maps/wip/jonasdn/mapbox-3-16: 2/5] Use MapSource module to set map source
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/jonasdn/mapbox-3-16: 2/5] Use MapSource module to set map source
- Date: Sat, 30 Jul 2016 13:37:27 +0000 (UTC)
commit 419f4dd59dddc8eddfe23dbe84aea1098d4e2b8a
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 36c2b7c..a4f3045 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -29,6 +29,7 @@ const Lang = imports.lang;
const Application = imports.application;
const ContactPlace = imports.contactPlace;
const Geoclue = imports.geoclue;
+const MapSource = imports.mapSource;
const MapWalker = imports.mapWalker;
const Place = imports.place;
const PlaceMarker = imports.placeMarker;
@@ -37,10 +38,8 @@ const UserLocationMarker = imports.userLocationMarker;
const Utils = imports.utils;
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;
@@ -75,7 +74,6 @@ const MapView = new Lang.Class({
this.view = this._initView();
this._initLayers();
- this._factory = Champlain.MapSourceFactory.dup_default();
this.setMapType(MapType.STREET);
this._updateUserLocation();
@@ -148,8 +146,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) {
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 1e6cdb9..2bd2d7a 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -22,6 +22,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]