[gnome-maps/wip/routing2] WIP



commit c646c85ba3b85a9f006713f1ac319f6de7772216
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Sun Apr 6 23:02:57 2014 +0100

    WIP
    
    This commit should make the routeService a global service and add a
    query object that when changed automatically runs a new query.

 src/application.js  |    3 +++
 src/routeService.js |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index ae00dda..a78fc78 100644
--- a/src/application.js
+++ b/src/application.js
@@ -40,12 +40,14 @@ const Utils = imports.utils;
 const Path = imports.path;
 const Settings = imports.settings;
 const PlaceStore = imports.placeStore;
+const RouteService = imports.routeService;
 
 // used globally
 let application = null;
 let settings = null;
 let placeStore = null;
 let notificationManager = null;
+let routeService = null;
 
 const Application = new Lang.Class({
     Name: 'Application',
@@ -93,6 +95,7 @@ const Application = new Lang.Class({
 
         application = this;
         settings = new Settings.Settings('org.gnome.maps');
+        routeService = new RouteService.GraphHopper();
 
         Utils.initActions(this, [{
             properties: { name: 'quit' },
diff --git a/src/routeService.js b/src/routeService.js
index 7003bfc..f8491ab 100644
--- a/src/routeService.js
+++ b/src/routeService.js
@@ -22,6 +22,7 @@
 
 const Soup = imports.gi.Soup;
 const Champlain = imports.gi.Champlain;
+const GObject = imports.gi.GObject;
 
 const Lang = imports.lang;
 const Utils = imports.utils;
@@ -37,6 +38,45 @@ const Transportation = {
     TRANSIT:    3
 };
 
+const Query = new Lang.Class({
+    Name: 'Query',
+    Extends: GObject.Object,
+    Properties: {
+        'from': GObject.ParamSpec.object('from',
+                                         '',
+                                         '',
+                                         GObject.ParamFlags.READABLE |
+                                         GObject.ParamFlags.WRITABLE,
+                                         Champlain.Coordinate),
+        'to': GObject.ParamSpec.object('to',
+                                       '',
+                                       '',
+                                       GObject.ParamFlags.READABLE |
+                                       GObject.ParamFlags.WRITABLE,
+                                       Champlain.Coordinate),
+        'transportation': GObject.ParamSpec.int('transportation',
+                                                '',
+                                                '',
+                                                GObject.ParamFlags.READABLE |
+                                                GObject.ParamFlags.WRITABLE,
+                                                Transportation.CAR, Transportation.TRANSIT,
+                                                Transportation.CAR)
+    },
+    
+    _init: function(args) {
+        this.parent(args);
+        this._changeSignalId = this.connect('notify', this.emit.bind(this, 'change'));
+    },
+
+    reset: function() {
+        this.disconnect(this._changeSignalId);
+        this.from = this.to = null;
+        this.transportation = Transportation.CAR;
+        this._changeSignalId = this.connect('notify', this.emit.bind(this, 'change'));
+        this.emit('change');
+    }
+});
+
 const RouteService = new Lang.Class({
     Name: 'RouteService',
     Abstract: true,


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