[gnome-maps/wip/mlundblad/transit-routing: 4/33] transitOptions: Add class holding options for transit routing
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-routing: 4/33] transitOptions: Add class holding options for transit routing
- Date: Fri, 9 Dec 2016 21:41:54 +0000 (UTC)
commit 0e261b66586c5dc24dd1863ed23c7a0c59e36c2a
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.
https://bugzilla.gnome.org/show_bug.cgi?id=755808
src/org.gnome.Maps.src.gresource.xml | 1 +
src/transitOptions.js | 52 ++++++++++++++++++++++++++++++++++
2 files changed, 53 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..66992ab
--- /dev/null
+++ b/src/transitOptions.js
@@ -0,0 +1,52 @@
+/* -*- 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;
+ },
+
+ /* when set to true, show any mode of transportation, else only show modes
+ * added with addRouteTypeToShow() */
+ set showAllRouteTypes(showAllRouteTypes) {
+ this._showAllRouteTypes = showAllRouteTypes;
+ this._showRouteTypes = [];
+ },
+
+ /* add an explicit transport mode to show */
+ 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]