[gnome-maps/wip/mlundblad/transit-routing: 1/2] Add map marker for marking end of transit itineraries
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-routing: 1/2] Add map marker for marking end of transit itineraries
- Date: Tue, 14 Jun 2016 20:51:14 +0000 (UTC)
commit 69e0534a8bc30da96679afd2b8587960da5d809a
Author: Marcus Lundblad <ml update uu se>
Date: Tue Jun 14 22:49:45 2016 +0200
Add map marker for marking end of transit itineraries
src/org.gnome.Maps.src.gresource.xml | 1 +
src/transitArrivalMarker.js | 64 ++++++++++++++++++++++++++++++++++
src/transitWalkMarker.js | 3 +-
3 files changed, 66 insertions(+), 2 deletions(-)
---
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index dd6842f..9594a67 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -73,6 +73,7 @@
<file>socialPlaceMatcher.js</file>
<file>storedRoute.js</file>
<file>togeojson/togeojson.js</file>
+ <file>transitArrivalMarker.js</file>
<file>transitArrivalRow.js</file>
<file>transitItineraryRow.js</file>
<file>transitLegRow.js</file>
diff --git a/src/transitArrivalMarker.js b/src/transitArrivalMarker.js
new file mode 100644
index 0000000..cbdb4d8
--- /dev/null
+++ b/src/transitArrivalMarker.js
@@ -0,0 +1,64 @@
+/* -*- 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * 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 TransitArrivalMarker = new Lang.Class({
+ Name: 'TransitArrivalMarker',
+ Extends: MapMarker.MapMarker,
+
+ _init: function(params) {
+ this._leg = params.leg;
+ delete params.leg;
+
+ let location =
+ new Location.Location({ latitude: this._leg.toCoordinate[0],
+ longitude: this._leg.toCoordinate[1] });
+
+ params.place = new Place.Place({ location: location });
+
+ this.parent(params);
+
+ let color;
+
+ if (this._leg.color) {
+ let red = parseInt(this._leg.color.substring(0, 2), 16);
+ let green = parseInt(this._leg.color.substring(2, 4), 16);
+ let blue = parseInt(this._leg.color.substring(4, 6), 16);
+
+ color = new Gdk.RGBA({ red: red, green: green, blue: blue,
+ alpha: 255 });
+ } else {
+ color = new Gdk.RGBA({ red: 0, green: 0, blue: 0, alpha: 255 });
+ }
+ let actor =
+ this._actorFromIconName('maps-point-end-symbolic', 0, color);
+
+ this.add_actor(actor);
+ }
+});
diff --git a/src/transitWalkMarker.js b/src/transitWalkMarker.js
index 3a30891..b4d7c52 100644
--- a/src/transitWalkMarker.js
+++ b/src/transitWalkMarker.js
@@ -38,8 +38,7 @@ const TransitWalkMarker = new Lang.Class({
let location =
new Location.Location({ latitude: this._leg.fromCoordinate[0],
- longitude: this._leg.fromCoordinate[1],
- accuracy: 0 });
+ longitude: this._leg.fromCoordinate[1] });
params.place = new Place.Place({ location: location });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]