[gnome-maps/wip/mlundblad/transit-routing: 25/33] Add map marker to mark end of transit itineraries



commit 1be9744510d074e7a0ef942f9e269840c01bda12
Author: Marcus Lundblad <ml update uu se>
Date:   Wed Jun 15 00:00:47 2016 +0200

    Add map marker to mark end of transit itineraries
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755808

 data/ui/transit-arrival-row.ui       |    2 +
 src/org.gnome.Maps.src.gresource.xml |    1 +
 src/transitArrivalMarker.js          |   59 ++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/transit-arrival-row.ui b/data/ui/transit-arrival-row.ui
index 73f62ab..4688615 100644
--- a/data/ui/transit-arrival-row.ui
+++ b/data/ui/transit-arrival-row.ui
@@ -33,6 +33,8 @@
                 <property name="can-focus">False</property>
                 <property name="hexpand">True</property>
                 <property name="halign">GTK_ALIGN_START</property>
+                <property name="max-width-chars">25</property>
+                <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
               </object>
               <packing>
                 <property name="left-attach">1</property>
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 786a5f1..0d4bb21 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -75,6 +75,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..aae1647
--- /dev/null
+++ b/src/transitArrivalMarker.js
@@ -0,0 +1,59 @@
+/* -*- 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 lastPoint = this._leg.polyline[this._leg.polyline.length - 1];
+        let location =
+            new Location.Location({ latitude: lastPoint.get_latitude(),
+                                    longitude: lastPoint.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-end-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]