[gnome-maps/wip/mlundblad/transit-routing: 8/13] turnPointMarker: Add support for showing markers for transit stops
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-routing: 8/13] turnPointMarker: Add support for showing markers for transit stops
- Date: Sun, 12 Feb 2017 22:07:24 +0000 (UTC)
commit 7b4176739690e8a34c55c304197e7a08150af064
Author: Marcus Lundblad <ml update uu se>
Date: Fri Jul 15 23:46:57 2016 +0200
turnPointMarker: Add support for showing markers for transit stops
https://bugzilla.gnome.org/show_bug.cgi?id=755808
src/turnPointMarker.js | 44 ++++++++++++++++++++++++++++++++++----------
1 files changed, 34 insertions(+), 10 deletions(-)
---
diff --git a/src/turnPointMarker.js b/src/turnPointMarker.js
index 9bc9036..f903441 100644
--- a/src/turnPointMarker.js
+++ b/src/turnPointMarker.js
@@ -25,6 +25,7 @@ const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Application = imports.application;
+const Color = imports.color;
const Location = imports.location;
const MapMarker = imports.mapMarker;
const Place = imports.place;
@@ -41,12 +42,26 @@ const TurnPointMarker = new Lang.Class({
this._turnPoint = params.turnPoint;
delete params.turnPoint;
+ this._transitStop = params.transitStop;
+ delete params.transitStop;
+
+ this._transitLeg = params.transitLeg;
+ delete params.transitLeg;
+
+ let latitude;
+ let longitude;
+
+ if (this._turnPoint) {
+ latitude = this._turnPoint.coordinate.get_latitude();
+ longitude = this._turnPoint.coordinate.get_longitude();
+ } else {
+ latitude = this._transitStop.coordinate[0];
+ longitude = this._transitStop.coordinate[1];
+ }
+
params.place = new Place.Place({
- location: new Location.Location({
- latitude: this._turnPoint.coordinate.get_latitude(),
- longitude: this._turnPoint.coordinate.get_longitude()
- })
- });
+ location: new Location.Location({ latitude: latitude,
+ longitude: longitude }) });
this.parent(params);
let actor;
@@ -57,11 +72,7 @@ const TurnPointMarker = new Lang.Class({
}).bind(this));
actor = this._actorFromIconName(this._turnPoint.iconName, 0);
} else {
- // A GNOMEish blue color
- let color = new Gdk.RGBA({ red: 33 / 255,
- green: 93 / 255,
- blue: 156 / 255,
- alpha: 255 });
+ let color = this._getColor();
actor = this._actorFromIconName('maps-point-end-symbolic',
0,
color);
@@ -69,6 +80,19 @@ const TurnPointMarker = new Lang.Class({
this.add_actor(actor);
},
+ _getColor: function() {
+ /* Use the route color from the transit leg when representing part of
+ * a transit trip, otherwise let the fallback functionallity of the
+ * utility function use a GNOMEish blue color for turn-by-turn routing.
+ */
+ let color = this._transitLeg ? this._transitLeg.color : null;
+
+ return new Gdk.RGBA({ red: Color.parseColor(color, 0, 33 / 255),
+ green: Color.parseColor(color, 1, 93 / 255),
+ blue: Color.parseColor(color, 2, 155 / 255),
+ alpha: 255 });
+ },
+
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]