[gnome-maps/wip/routing: 63/65] MapView: add support for showing routes
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing: 63/65] MapView: add support for showing routes
- Date: Sun, 2 Feb 2014 20:12:44 +0000 (UTC)
commit ccff0b8c39deac02de8c09f1568ce886763c49df
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Fri Aug 30 03:02:30 2013 +0200
MapView: add support for showing routes
WIP! Add:
* clearing of routes
src/mapView.js | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index aae8d7b..fc8e3b6 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -73,6 +73,10 @@ const MapView = new Lang.Class({
// Don't show sidebar until it has something in it
//this.view.add_child(this._sidebar.actor);
+ this._routeLayer = new Champlain.PathLayer();
+ this._routeLayer.set_stroke_width(2.0);
+ this.view.add_layer(this._routeLayer);
+
this._markerLayer = new Champlain.MarkerLayer();
this._markerLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
this.view.add_layer(this._markerLayer);
@@ -181,6 +185,13 @@ const MapView = new Lang.Class({
mapLocation.goTo(true);
},
+ showRoute: function(route) {
+ route.coordinates.forEach(function(coordinate) {
+ this._routeLayer.add_node(coordinate);
+ }, this);
+ this.view.ensure_visible(route.bbox, true);
+ },
+
_onViewMoved: function() {
this.emit('view-moved');
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]