[gnome-maps/wip/routing2: 20/23] Update: RouteService
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing2: 20/23] Update: RouteService
- Date: Sun, 15 Jun 2014 02:14:54 +0000 (UTC)
commit d66989b702a7874ab8932c970336145e1a9dbaf8
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Wed Jun 11 01:45:14 2014 +0200
Update: RouteService
- Make fetchRoute take GeocodePlace instead of a coordinate.
- emit 'updated' instead of 'change'
- Some if() => if ()
Squash with:
876117b Add RouteService module
https://bugzilla.gnome.org/show_bug.cgi?id=728695
src/routeService.js | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/routeService.js b/src/routeService.js
index 0bcb129..ca8df97 100644
--- a/src/routeService.js
+++ b/src/routeService.js
@@ -53,9 +53,10 @@ const GraphHopper = new Lang.Class({
this._route = new Route.Route();
this._query = new RouteQuery.RouteQuery();
- this.query.connect('change', (function() {
- if(this.query.from && this.query.to) {
- this.fetchRoute([this.query.from, this.query.to],
+ this.query.connect('updated', (function() {
+ if (this.query.from && this.query.to) {
+ this.fetchRoute([this.query.from.location,
+ this.query.to.location],
this.query.transportation);
} else
this.route.reset();
@@ -72,7 +73,7 @@ const GraphHopper = new Lang.Class({
Application.application.unmark_busy();
try {
let result = this._parseMessage(message);
- if(!result) {
+ if (!result) {
Application.notificationManager.showMessage(_("No route found."));
} else {
let route = this._createRoute(result.paths[0]);
@@ -103,7 +104,7 @@ const GraphHopper = new Lang.Class({
},
_parseMessage: function({ status_code, response_body, uri }) {
- if(status_code === 500) {
+ if (status_code === 500) {
log("Internal server error.\n"
+ "This is most likely a bug in GraphHopper");
log("Please file a bug at "
@@ -116,9 +117,9 @@ const GraphHopper = new Lang.Class({
let result = JSON.parse(response_body.data);
- if(!Array.isArray(result.paths)) {
+ if (!Array.isArray(result.paths)) {
Utils.debug("No route found");
- if(result.info && Array.isArray(result.info.errors)) {
+ if (result.info && Array.isArray(result.info.errors)) {
result.info.errors.forEach(function({ message, details }) {
Utils.debug("Message: " + message);
Utils.debug("Details: " + details);
@@ -169,7 +170,7 @@ const GraphHopper = new Lang.Class({
let type = sign + 3;
let min = Route.TurnPointType.SHARP_LEFT;
let max = Route.TurnPointType.VIA;
- if(min <= type && type <= max)
+ if (min <= type && type <= max)
return type;
else
return undefined;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]