[gnome-maps/wip/routing2] WIP



commit fbc02994358b6df52ab1be57fc9cba6d8cbda70a
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 |   27 +++++++++++++++++++++++++++
 2 files changed, 30 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..dc4d2c4 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,32 @@ const Transportation = {
     TRANSIT:    3
 };
 
+const Query = new Lang.Class({
+    Name: 'Query',
+    Extends: GObject.Object,
+    Properties: {
+        'via-points': GObject.ParamSpec.object('via-points',
+                                               '',
+                                               '',
+                                               GObject.ParamFlags.READABLE |
+                                               GObject.ParamFlags.WRITABLE,
+                                               GObject.TYPE_OBJECT)
+    },
+
+    _init: function(args) {
+        this.parent(args);
+    }
+});
+
+let testQuery = new Query({ viaPoints: [ new Champlain.Coordinate({ latitude: 12.95,
+                                                                    longitude: 59.7 }),
+                                         new Champlain.Coordinate({ latitude: 12.55,
+                                                                    longitude: 65.7 }),
+                                         new Champlain.Coordinate({ latitude: 12.55,
+                                                                    longitude: 65.7 })
+                                       ]
+                          });
+
 const RouteService = new Lang.Class({
     Name: 'RouteService',
     Abstract: true,


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