[gnome-maps/wip/mlundblad/transit-service-discovery: 9/9] WIP: Add transit router



commit e7635f7452fa92f943755fc2cb478017a9bed4d4
Author: Marcus Lundblad <ml update uu se>
Date:   Tue Aug 20 22:07:58 2019 +0200

    WIP: Add transit router
    
    Dispatches routing requests to matching
    transit provider.

 src/org.gnome.Maps.src.gresource.xml |  1 +
 src/routingDelegator.js              | 16 +++++++---------
 src/transitRouter.js                 | 26 ++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 9 deletions(-)
---
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index b29e25e..264497f 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -91,6 +91,7 @@
     <file>transitOptionsPanel.js</file>
     <file>transitPlan.js</file>
     <file>transitPrintLayout.js</file>
+    <file>transitRouter.js</file>
     <file>transitRouteLabel.js</file>
     <file>transitStopRow.js</file>
     <file>transitWalkMarker.js</file>
diff --git a/src/routingDelegator.js b/src/routingDelegator.js
index 57e956f..37728c7 100644
--- a/src/routingDelegator.js
+++ b/src/routingDelegator.js
@@ -20,7 +20,7 @@
  */
 
 const GraphHopper = imports.graphHopper;
-const OpenTripPlanner = imports.transitplugins.openTripPlanner;
+const TransitRouter = imports.transitRouter;
 const RouteQuery = imports.routeQuery;
 
 const _FALLBACK_TRANSPORTATION = RouteQuery.Transportation.PEDESTRIAN;
@@ -32,16 +32,14 @@ var RoutingDelegator = class RoutingDelegator {
 
         this._transitRouting = false;
         this._graphHopper = new GraphHopper.GraphHopper({ query: this._query });
-        this._openTripPlanner =
-            new OpenTripPlanner.OpenTripPlanner({ query: this._query,
-                                                  graphHopper: this._graphHopper });
+        this._transitRouter = new TransitRouter.TransitRouter({ query: this._query });
         this._query.connect('notify::points', this._onQueryChanged.bind(this));
 
         /* if the query is set to transit mode when it's not available, revert
          * to a fallback mode
          */
         if (this._query.transportation === RouteQuery.Transportation.TRANSIT &&
-            !this._openTripPlanner.enabled) {
+            !this._transitRouter.enabled) {
             this._query.transportation = _FALLBACK_TRANSPORTATION;
         }
     }
@@ -50,8 +48,8 @@ var RoutingDelegator = class RoutingDelegator {
         return this._graphHopper;
     }
 
-    get openTripPlanner() {
-        return this._openTripPlanner;
+    get transitRouter() {
+        return this._transitRouter;
     }
 
     set useTransit(useTransit) {
@@ -60,7 +58,7 @@ var RoutingDelegator = class RoutingDelegator {
 
     reset() {
         if (this._transitRouting)
-            this._openTripPlanner.plan.reset();
+            this._transitRouter.plan.reset();
         else
             this._graphHopper.route.reset();
     }
@@ -68,7 +66,7 @@ var RoutingDelegator = class RoutingDelegator {
     _onQueryChanged() {
         if (this._query.isValid()) {
             if (this._transitRouting) {
-                this._openTripPlanner.fetchFirstResults();
+                this._transitRouter.fetchFirstResults();
             } else {
                 this._graphHopper.fetchRoute(this._query.filledPoints,
                                              this._query.transportation);
diff --git a/src/transitRouter.js b/src/transitRouter.js
new file mode 100644
index 0000000..0e2514d
--- /dev/null
+++ b/src/transitRouter.js
@@ -0,0 +1,26 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2019 Marcus Lundblad
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Marcus Lundblad <ml update uu se>
+ */
+
+var TransitRouter = class TransitRoute {
+    constructor() {
+
+    }
+}


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