[gnome-maps] mapView: Add ways to set different map types
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] mapView: Add ways to set different map types
- Date: Fri, 5 Apr 2013 10:44:44 +0000 (UTC)
commit 8fa04d874111c04c7e87bb3ed76f01ad651a3514
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Apr 5 05:31:24 2013 +0300
mapView: Add ways to set different map types
This also implies that we now use 'mapquest' rather than the default
'mapnik' as the street view.
src/mapView.js | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index f68ef19..3513583 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -32,6 +32,14 @@ const Application = imports.application;
const Utils = imports.utils;
const _ = imports.gettext.gettext;
+const MapType = {
+ STREET: Champlain.MAP_SOURCE_OSM_MAPQUEST,
+ /* This should be CHAMPLAIN_MAP_SOURCE_OAM but that currently causes a crash: bug#697304 */
+ TERRAIN: Champlain.MAP_SOURCE_MFF_RELIEF,
+ CYCLING: Champlain.MAP_SOURCE_OSM_CYCLE_MAP,
+ TRANSIT: Champlain.MAP_SOURCE_OSM_TRANSPORT_MAP
+}
+
const MapView = new Lang.Class({
Name: 'MapView',
@@ -45,9 +53,17 @@ const MapView = new Lang.Class({
this._markerLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
this._view.add_layer(this._markerLayer);
+ this._factory = Champlain.MapSourceFactory.dup_default();
+ this.setMapType(MapType.STREET);
+
this._gotoUserLocation();
},
+ setMapType: function(mapType) {
+ let source = this._factory.create_cached_source(mapType);
+ this._view.set_map_source(source);
+ },
+
geocodeSearch: function(string) {
let forward = Geocode.Forward.new_for_string(string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]