[gnome-maps/wip/mlundblad/transit-routing: 3/28] transitOptions: Add class holding options for transit routing



commit 2b19140a0683cd34886e07c16798bbff242df094
Author: Marcus Lundblad <ml update uu se>
Date:   Sun May 29 22:27:12 2016 +0200

    transitOptions: Add class holding options for transit routing
    
    Currently has options to show all route types (modes of transportation) or
    restrict to a selected set of modes.

 src/org.gnome.Maps.src.gresource.xml |    1 +
 src/transitOptions.js                |   49 ++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 4e29dfa..66a12c8 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -72,6 +72,7 @@
     <file>socialPlaceMatcher.js</file>
     <file>storedRoute.js</file>
     <file>togeojson/togeojson.js</file>
+    <file>transitOptions.js</file>
     <file>translations.js</file>
     <file>turnPointMarker.js</file>
     <file>userLocationBubble.js</file>
diff --git a/src/transitOptions.js b/src/transitOptions.js
new file mode 100644
index 0000000..f02756d
--- /dev/null
+++ b/src/transitOptions.js
@@ -0,0 +1,49 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2016 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>
+ */
+
+const Lang = imports.lang;
+
+const TransitOptions = new Lang.Class({
+    Name: 'TransitOptions',
+
+    _init: function() {
+        this._showAllRouteTypes = true;
+        this._showRouteTypes = [];
+    },
+
+    get showAllRouteTypes() {
+        return this._showAllRouteTypes;
+    },
+
+    set showAllRouteTypes(showAllRouteTypes) {
+        this._showAllRouteTypes = showAllRouteTypes;
+        this._showRouteTypes = [];
+    },
+
+    addRouteTypeToShow: function(routeType) {
+        this._showAllRouteTypes = false;
+        this._showRouteTypes.push(routeType);
+    },
+
+    get showRouteTypes() {
+        return this._showRouteTypes;
+    }
+});


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