[gnome-maps/wip/mlundblad/transit-routing: 9/18] Add map marker to mark start of walking transit legs
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-routing: 9/18] Add map marker to mark start of walking transit legs
- Date: Fri, 10 Feb 2017 12:11:53 +0000 (UTC)
commit 28fa039c9d17da63c1718e40e579bf0ff0f0919c
Author: Marcus Lundblad <ml update uu se>
Date: Tue Jun 14 23:59:24 2016 +0200
Add map marker to mark start of walking transit legs
https://bugzilla.gnome.org/show_bug.cgi?id=755808
src/org.gnome.Maps.src.gresource.xml | 1 +
src/transitWalkMarker.js | 71 ++++++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+), 0 deletions(-)
---
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 5442def..7e200c9 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -84,6 +84,7 @@
<file>transitOptions.js</file>
<file>transitPlan.js</file>
<file>transitRouteLabel.js</file>
+ <file>transitWalkMarker.js</file>
<file>translations.js</file>
<file>turnPointMarker.js</file>
<file>userLocationBubble.js</file>
diff --git a/src/transitWalkMarker.js b/src/transitWalkMarker.js
new file mode 100644
index 0000000..22be11a
--- /dev/null
+++ b/src/transitWalkMarker.js
@@ -0,0 +1,71 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2017 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 Gdk = imports.gi.Gdk;
+
+const Location = imports.location;
+const MapMarker = imports.mapMarker;
+const Place = imports.place;
+
+const TransitWalkMarker = new Lang.Class({
+ Name: 'TransitWalkMarker',
+ Extends: MapMarker.MapMarker,
+
+ _init: function(params) {
+ this._leg = params.leg;
+ delete params.leg;
+
+ this._previousLeg = params.previousLeg;
+ delete params.previousLeg;
+
+ /* if there is a preceeding leg, put the marker at the end of that leg
+ * to avoid gaps, since we will "fill out" the walking leg path line
+ * since sometimes the walking route might not reach exactly to the
+ * transit stop's position
+ */
+ let point = this._previousLeg ?
+ this._previousLeg.polyline[this._previousLeg.polyline.length - 1] :
+ this._leg.polyline[0];
+ let location =
+ new Location.Location({ latitude: point.get_latitude(),
+ longitude: point.get_longitude() });
+
+ params.place = new Place.Place({ location: location });
+
+ this.parent(params);
+
+ let color = new Gdk.RGBA({ red: 0,
+ green: 0,
+ blue: 0,
+ alpha: 1.0 });
+ let actor =
+ this._actorFromIconName('maps-point-start-symbolic', 0, color);
+
+ this.add_actor(actor);
+ },
+
+ get anchor() {
+ return { x: Math.floor(this.width / 2) - 1,
+ y: Math.floor(this.height / 2) - 1 };
+ }
+});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]