diff --git a/fonts/fujicons.css b/fonts/fujicons.css
index 1f0cf7f..3a5918f 100644
--- a/fonts/fujicons.css
+++ b/fonts/fujicons.css
@@ -15,6 +15,14 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
+
+.fa-xs {
+ font-size: .75em; }
+
+.fa-sm {
+ font-size: .875em; }
+
+
/* makes the font 33% larger relative to the icon container */
.fa-lg {
font-size: 1.33333333em;
@@ -203,3 +211,23 @@
.fa-home:before {
content: "\EA1E"
}
+
+.fa-location-arrow:before {
+ content: "\EA76"
+}
+
+.fa-map-marker:before {
+ content: "\EA3D"
+}
+
+.fa-map-marker-hollow:before {
+ content: "\EA3E"
+}
+
+.fa-direction-filled:before {
+ content: "\E9D6"
+}
+
+.fa-direction-hollow:before {
+ content: "\E9D7"
+}
\ No newline at end of file
diff --git a/fonts/test.html b/fonts/test.html
new file mode 100644
index 0000000..c61fef8
--- /dev/null
+++ b/fonts/test.html
@@ -0,0 +1,31 @@
+
+
+
+
+ Title
+
+
+
+
+fa-back
+
+.fa-forward
+
+.fa-globe
+
+.fa-up
+
+.fa-down
+
+.fa-work
+
+.fa-home
+
+.fa-location-arrow
+
+.fa-map-marker
+
+
+
+
+
diff --git a/server/reducers/directions.js b/server/reducers/directions.js
index b56505e..010d601 100644
--- a/server/reducers/directions.js
+++ b/server/reducers/directions.js
@@ -15,6 +15,7 @@ function reduceEstDirections(body = '') {
const obj = {};
const { ResultSet } = jBody;
const streets = [];
+ const steps = [];
if (has(ResultSet, 'Result')) {
const directions = get(ResultSet, 'Result.yahoo_driving_directions');
@@ -44,13 +45,16 @@ function reduceEstDirections(body = '') {
}
for (const item of route) {
- logger.debug(item);
if (item.hasOwnProperty('street')) {
const street = item.street.split(',');
if (street[0] !== '') streets.push(street[0]);
}
+
+ if (has(item, 'description')) {
+ steps.push(item.description);
+ }
}
-
+ obj.directions = steps;
obj.streets = uniq(streets);
}
diff --git a/src/css/custom.scss b/src/css/custom.scss
index ec25b16..4c48c03 100644
--- a/src/css/custom.scss
+++ b/src/css/custom.scss
@@ -478,4 +478,9 @@ li {
margin-bottom: 3px;
}
+.separate {
+ border-bottom: 1px solid mui-color('grey', '200');
+ margin-bottom: 5px;
+}
+
@import "./src/css/weather";
diff --git a/src/service-worker.js b/src/service-worker.js
index 0d19301..8b6547c 100644
--- a/src/service-worker.js
+++ b/src/service-worker.js
@@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-const CACHE_VERSION = { 'version': '0.0.812' };
+const CACHE_VERSION = { 'version': '0.0.884' };
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
const RUNTIME = 'runtime';
diff --git a/src/v1/js/Goto.js b/src/v1/js/Goto.js
new file mode 100644
index 0000000..2bafdfd
--- /dev/null
+++ b/src/v1/js/Goto.js
@@ -0,0 +1,137 @@
+const $ = require('jquery');
+const _ = require('underscore');
+const Backbone = require('backbone');
+const request = require('request');
+const { get, has, isEmpty } = require('lodash');
+const { createPanel, addPanel } = require('./libs/panel');
+
+const templates = require('./libs/templates');
+
+const GotoCardModel = Backbone.Model.extend({
+ 'initialize': function() {
+ this.listenTo(this, 'change:detail', this.getDirections);
+ },
+ 'getDirections': function() {
+ const { from, to } = this.get('detail');
+ console.log('goto from', from);
+ console.log('goto to', to);
+
+ const qs = {
+ 'olat':to.lat, 'olon': to.long, 'dlat': from.lat, 'dlon': from.long
+ };
+
+ console.log('qs', qs);
+
+ request({
+ 'url': `${window.loc}/traffic`,
+ 'method': 'GET',
+ 'qs': qs
+ }, function(err, res, body) {
+ if (err)
+ console.error(err);
+ else {
+ console.log('statusCode', res.statusCode);
+ const now = new Date().getTime();
+ const gotoJSON = JSON.parse(body);
+
+ console.log('>> gotoJSON', gotoJSON);
+
+ this.set('directions', gotoJSON.directions);
+ console.log(this.attributes);
+ // this.logUpdate();
+ }
+ }.bind(this));
+ }
+
+});
+
+const GotoCardView = Backbone.View.extend({
+ 'initialize': function(options) {
+ this.eventBus = options.eventBus;
+ this.location = options.location;
+
+ this.location.bind('change', this.updateMyLocation, this);
+
+ /* this.model.on('all', function(eventName) {
+ console.log(`${eventName } was triggered!`);
+ });*/
+
+ this.model.bind('change:directions', this.doUpdateRender, this);
+ this.eventBus.on('showDirections', this.showDirectionsPanel, this);
+ },
+
+ 'updateMyLocation': function(l) {
+ console.log('Goto:My location Changed', l);
+ },
+ 'template': _.template(`
+
+
+ `),
+ 'showDirectionsPanel': function(toDest, cb = null) {
+ console.log('Showing directions', toDest);
+
+ const detail = { 'from':{}, 'to':{} };
+
+ this.$newPanel = createPanel({ 'title':'Directions', 'divId':'directionsP' }, cb);
+
+ this.$el = addPanel(this.$newPanel);
+
+ // this.$el.empty();
+ this.$newPanel.show();
+
+ const l = this.location.toJSON();
+
+ console.log('l', l);
+
+ if (l.hasOwnProperty('latitude')) {
+ detail.from.lat = l.latitude;
+ detail.from.long = l.longitude;
+ }
+ else
+ console.log('>> No location yet');
+
+ detail.to.lat = toDest.latitude;
+ detail.to.long = toDest.longitude;
+
+ console.log('detail', detail);
+
+ this.model.set('detail', detail);
+ // if (prevGuid === guid)
+ this.doRender();
+ },
+ 'events': {
+ 'click .closebutton': 'doClick'
+ },
+ 'doClick': function(d) {
+ console.log('Do click', d);
+ const id = get(d, 'currentTarget', '');
+ console.log(id);
+ // this.eventBus.trigger('showNews', id);
+ },
+ 'doClose': function(d) {
+ this.model.clear({ 'silent':true });
+ console.log('close??');
+ },
+ 'doRender': function() {
+ this.$el.empty();
+ // this.$el.html(this.template(this.model.get('article')));
+ this.$el.html(this.template());
+ },
+ 'doUpdateRender': function() {
+ // this.$el.empty();
+ // this.$el.html(this.template(this.model.get('article')));
+
+
+ const html = templates.templateDirections({ 'directions':this.model.get('directions') });
+ console.log(html);
+ const $el = this.$el;
+
+ $el.find('#gotoDetailsText').html(html);
+ }
+
+});
+
+module.exports = { GotoCardModel, GotoCardView };
diff --git a/src/v1/js/VenueDetail.js b/src/v1/js/VenueDetail.js
index 8d89b39..c86d343 100644
--- a/src/v1/js/VenueDetail.js
+++ b/src/v1/js/VenueDetail.js
@@ -67,7 +67,10 @@ const VenueDetailView = Backbone.View.extend({
this.doRender();
},
'events': {
- 'click .closebutton': 'doClick'
+ 'click .closebutton': 'doClick',
+ 'click #getDirections': (d) => {
+ console.log('Clicked', d);
+ }
},
'doClick': function(d) {
console.log('Do click', d);
@@ -75,6 +78,17 @@ const VenueDetailView = Backbone.View.extend({
console.log(id);
// this.eventBus.trigger('showNews', id);
},
+ 'doNavigate': function(d) {
+ // console.log('Do click', d);
+ console.log('>> this.model', this);
+ const details = this.model.get('details');
+ console.log(details);
+ this.eventBus.trigger('showDirections', details, () => {
+ console.log('Navigate panel closed');
+ this.$newPanel.show();
+ });
+ this.$newPanel.hide();
+ },
'doClose': function(d) {
console.log('close??');
},
@@ -93,6 +107,7 @@ const VenueDetailView = Backbone.View.extend({
contents.push(templates.map());
+ contents.push(templates.venueDirections());
if (!isEmpty(m.yelp))
contents.push(templates.yelpTemplate(m));
@@ -144,6 +159,9 @@ const VenueDetailView = Backbone.View.extend({
'radius': 30
}).addTo(this.map);
+ this.$el.find('#getDirections').on('click', () => {
+ this.doNavigate();
+ });
// console.log(this.location.attributes);
}
diff --git a/src/v1/js/app.js b/src/v1/js/app.js
index 3237b00..2b13a63 100644
--- a/src/v1/js/app.js
+++ b/src/v1/js/app.js
@@ -19,6 +19,9 @@ const { AgendaModel, AgendaView } = require('./Agenda');
const { TrafficModel, TrafficView } = require('./Traffic');
const { NearbyListModel, NearbyListView } = require('./NearbyList');
const { NearbyPlacesView } = require('./NearbyPlaces');
+
+const { GotoCardModel, GotoCardView } = require('./Goto');
+
var app = app || {};
const live = true;
@@ -101,23 +104,23 @@ function main() {
app.traffic = new TrafficView({ 'model': new TrafficModel(), 'eventBus': app.eventBus, 'location': app.locationModel, 'el':'#traffic' });
- app.newsCard = new VenueDetailView({ 'model': new VenueDetailModel(), 'eventBus': app.eventBus, 'location': app.locationModel });
+ app.venueCard = new VenueDetailView({ 'model': new VenueDetailModel(), 'eventBus': app.eventBus, 'location': app.locationModel });
app.nearbyList = new NearbyListView({ 'model': new NearbyListModel(), 'eventBus' : app.eventBus });
app.nearbyPlacesView = new NearbyPlacesView({ 'eventBus': app.eventBus, 'location': app.locationModel, 'el':'#nearbyPlaces' });
+ app.gotoCard = new GotoCardView({ 'model': new GotoCardModel(), 'eventBus': app.eventBus, 'location': app.locationModel });
+
app.updateOnlineStatus = function(event) {
- if (navigator.onLine)
- // handle online status
- {
+ if (navigator.onLine) {
+ // handle online status
console.log('online');
$('#connectionStatus').hide(500);
}
- else
- // handle offline status
- {
+ else {
+ // handle offline status
console.log('offline');
$('#connectionStatus').show(500);
}
diff --git a/src/v1/js/libs/templates.js b/src/v1/js/libs/templates.js
index 516b75b..ad6681a 100644
--- a/src/v1/js/libs/templates.js
+++ b/src/v1/js/libs/templates.js
@@ -59,6 +59,9 @@ const templates = {
'venueTitle' : _.template(`
<%=name %>
`),
+ 'venueDirections' : _.template(`
+
+ `),
'openInFS' : _.template(`
`),
@@ -137,7 +140,14 @@ const templates = {
- `)
+ `),
+ 'templateDirections': _.template(`
+ <%_.forEach(directions, function(i) {%>
+
+ <%}) %>
+ `)
};
module.exports = templates;
diff --git a/test/directions.spec.js b/test/directions.spec.js
index 7fea3ad..d7a23e3 100644
--- a/test/directions.spec.js
+++ b/test/directions.spec.js
@@ -16,8 +16,8 @@ const requestData = {
'address': [
{
'type': 'Origin',
- 'lat': '55.942592',
- 'lon': '-4.556346',
+ 'lat': '51.508577',
+ 'lon': '-0.067628',
'line1': '',
'line2': '',
'line3': '',
@@ -26,8 +26,8 @@ const requestData = {
},
{
'type': 'Destination',
- 'lat': '55.872443',
- 'lon': '-3.548992',
+ 'lat': '51.490002',
+ 'lon': '-0.140245',
'line1': '',
'line2': '',
'line3': '',
@@ -35,286 +35,193 @@ const requestData = {
'country': ''
}
],
- 'total_distance': '83339',
- 'total_time': '65.0',
- 'total_time_with_traffic': '70.0',
+ 'total_distance': '7189',
+ 'total_time': '42.0',
+ 'total_time_with_traffic': '0.0',
'boundingbox': {
- 'north': '55.942587',
- 'south': '55.832605',
- 'east': '-3.541074',
- 'west': '-4.556462'
+ 'north': '51.512259',
+ 'south': '51.490066',
+ 'east': '-0.06742',
+ 'west': '-0.143531'
},
- 'route_id': 'AIUACAAAAB4AAABRAAAAlgAAAKAAAAB42mNYwMDAxMQABI+6DtXs5zyRzgAFBvE1Yi4Mi6wY/v+HCDywZ0ACXEBs/kYnl4nhz5vK2okuu+Ea4+ZXi61gXmSDR2PShr4NjECL4YJs6Qcz5wJpB4aEhgeMQClGrglVHA4OTAw+/ADTGiAC9jefAA==',
'directions': {
'route_leg': [
{
'@type': 'PrivateRouteLeg',
'number': '1',
- 'lat': '55.942587',
- 'lon': '-4.556462',
- 'distance': '2060',
- 'description': 'Head toward Bruce Street on Glasgow Road (A814). Go for 2.1 km.',
- 'time': '3',
- 'time_with_traffic': '3',
+ 'lat': '51.508648',
+ 'lon': '-0.06742',
+ 'distance': '49',
+ 'description': 'Head northwest on Vaughan Way. Go for 49 m.',
+ 'time': '2018-10-11T17:14:37+01:00',
+ 'time_with_traffic': '1',
'turn_angle': '0',
'exit_num': '',
'man_type': '0',
- 'street': 'A814, GLASGOW ROAD'
+ 'street': ', VAUGHAN WAY'
},
{
'@type': 'PrivateRouteLeg',
'number': '2',
- 'lat': '55.935098',
- 'lon': '-4.526989',
- 'distance': '1616',
- 'description': 'Continue on Dumbarton Road (A82). Go for 1.6 km.',
- 'time': '2',
- 'time_with_traffic': '2',
- 'turn_angle': '0',
+ 'lat': '51.509045',
+ 'lon': '-0.06772',
+ 'distance': '340',
+ 'description': 'Turn left onto East Smithfield. Go for 340 m.',
+ 'time': '2018-10-11T17:15:36+01:00',
+ 'time_with_traffic': '6',
+ 'turn_angle': '-90',
'exit_num': '',
- 'man_type': '11',
- 'street': 'A82, DUMBARTON ROAD'
+ 'man_type': '9',
+ 'street': 'A1203, EAST SMITHFIELD'
},
{
'@type': 'PrivateRouteLeg',
'number': '3',
- 'lat': '55.931944',
- 'lon': '-4.503633',
- 'distance': '3334',
- 'description': 'Take the 2nd exit from Dunglass Roundabout roundabout onto Great Western Road (A82) toward Glasgow/Erskine Bridge/(A898). Go for 3.3 km.',
- 'time': '3',
- 'time_with_traffic': '3',
+ 'lat': '51.508584',
+ 'lon': '-0.072323',
+ 'distance': '281',
+ 'description': 'Turn left. Go for 281 m.',
+ 'time': '2018-10-11T17:21:17+01:00',
+ 'time_with_traffic': '5',
'turn_angle': '-90',
'exit_num': '',
- 'man_type': '29',
- 'street': 'A82, GREAT WESTERN ROAD',
- 'sign': '(A898), Erskine Bridge, Glasgow'
+ 'man_type': '9',
+ 'street': ', '
},
{
'@type': 'PrivateRouteLeg',
'number': '4',
- 'lat': '55.926161',
- 'lon': '-4.452403',
- 'distance': '2919',
- 'description': 'Take ramp onto A898 toward Erskine Bridge/Paisley/(M898). Go for 2.9 km.',
- 'time': '2',
- 'time_with_traffic': '2',
- 'turn_angle': '-30',
+ 'lat': '51.509378',
+ 'lon': '-0.076046',
+ 'distance': '40',
+ 'description': 'Turn right. Go for 40 m.',
+ 'time': '2018-10-11T17:25:58+01:00',
+ 'time_with_traffic': '1',
+ 'turn_angle': '90',
'exit_num': '',
- 'man_type': '19',
- 'street': 'A898, ',
- 'sign': '(M898), Erskine Bridge, Paisley'
+ 'man_type': '13',
+ 'street': ', '
},
{
'@type': 'PrivateRouteLeg',
'number': '5',
- 'lat': '55.910207',
- 'lon': '-4.472519',
- 'distance': '1152',
- 'description': 'Keep right onto M898 toward Paisley/Glasgow Airport/Greenock/(M8). Go for 1.2 km.',
- 'time': '1',
- 'time_with_traffic': '1',
- 'turn_angle': '30',
- 'exit_num': '',
- 'man_type': '23',
- 'street': 'M898, ',
- 'sign': '(M8), Glasgow Airport, Greenock, Paisley'
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '6',
- 'lat': '55.901495',
- 'lon': '-4.481091',
- 'distance': '396',
- 'description': 'Keep left onto M898 toward Paisley/Airports. Go for 396 m.',
- 'time': '0',
+ 'lat': '51.509732',
+ 'lon': '-0.076164',
+ 'distance': '22',
+ 'description': 'Turn left. Go for 22 m.',
+ 'time': '2018-10-11T17:26:38+01:00',
'time_with_traffic': '0',
- 'turn_angle': '-30',
+ 'turn_angle': '-90',
'exit_num': '',
- 'man_type': '21',
- 'street': 'M898, ',
- 'sign': 'Airports, Paisley'
+ 'man_type': '9',
+ 'street': ', '
},
{
- '@type': 'PrivateRouteLeg',
+ '@type': 'PublicRouteLeg',
+ 'number': '6',
+ 'lat': '51.509834',
+ 'lon': '-0.076454',
+ 'distance': '5670',
+ 'description': 'Go to the Train station Tower Hill and take the rail District toward Ealing Broadway. Follow for 9 stations.',
+ 'time': '2018-10-11T17:27:00+01:00',
+ 'time_with_traffic': '16',
+ 'stop_name': 'Tower Hill',
+ 'platform_name': {
+ '@nil': 'true'
+ },
+ 'platform_level': {
+ '@nil': 'true'
+ },
+ 'line': {
+ '@nil': 'true'
+ },
+ 'wait_time': '1'
+ },
+ {
+ '@type': 'PublicRouteLeg',
'number': '7',
- 'lat': '55.898287',
- 'lon': '-4.483226',
- 'distance': '64579',
- 'description': 'Keep left onto M8. Go for 64.6 km.',
- 'time': '42',
- 'time_with_traffic': '42',
- 'turn_angle': '-30',
- 'exit_num': '',
- 'man_type': '21',
- 'street': 'M8, '
+ 'lat': '51.495981',
+ 'lon': '-0.143475',
+ 'distance': '0',
+ 'description': 'Get off at Victoria.',
+ 'time': '2018-10-11T17:43:00+01:00',
+ 'time_with_traffic': '0',
+ 'stop_name': 'Victoria',
+ 'platform_name': {
+ '@nil': 'true'
+ },
+ 'platform_level': {
+ '@nil': 'true'
+ },
+ 'line': {
+ '@nil': 'true'
+ },
+ 'wait_time': '0'
},
{
'@type': 'PrivateRouteLeg',
'number': '8',
- 'lat': '55.895294',
- 'lon': '-3.596402',
- 'distance': '240',
- 'description': 'Take exit 3A toward Bathgate/(A89)/Broxburn/Livingston West/(A779). Go for 240 m.',
- 'time': '0',
- 'time_with_traffic': '0',
- 'turn_angle': '-30',
- 'exit_num': '',
- 'man_type': '17',
- 'street': ', ',
- 'sign': '(A779), (A89), Bathgate, Broxburn, Livingston West'
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '9',
- 'lat': '55.897204',
- 'lon': '-3.595244',
- 'distance': '420',
- 'description': 'Take the 1st exit from roundabout onto Carnegie Road (A779) toward Glasgow/(M8)/Livingston/Bathgate/(A89)/Broxburn. Go for 420 m.',
- 'time': '1',
- 'time_with_traffic': '1',
- 'turn_angle': '-90',
- 'exit_num': '',
- 'man_type': '29',
- 'street': 'A779, CARNEGIE ROAD',
- 'sign': '(A89), (M8), A779, Bathgate, Broxburn, Glasgow, Livingston'
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '10',
- 'lat': '55.897193',
- 'lon': '-3.601885',
- 'distance': '840',
- 'description': 'Take the 1st exit from Boghall Roundabout roundabout onto A779 toward Glasgow/(M8)/Livingston. Go for 840 m.',
- 'time': '1',
- 'time_with_traffic': '1',
- 'turn_angle': '-90',
- 'exit_num': '',
- 'man_type': '29',
- 'street': 'A779, ',
- 'sign': '(M8), A779, Glasgow, Livingston'
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '11',
- 'lat': '55.890466',
- 'lon': '-3.596713',
- 'distance': '1622',
- 'description': 'Take the 1st exit from Starlaw West Roundabout roundabout onto Starlaw Road (A779) toward Livingston/Kirkton Campus/Alba Centre/Starlaw Park. Go for 1.6 km.',
- 'time': '2',
- 'time_with_traffic': '2',
- 'turn_angle': '-90',
- 'exit_num': '',
- 'man_type': '29',
- 'street': 'A779, STARLAW ROAD',
- 'sign': 'Alba Centre, Kirkton Campus, Livingston, Starlaw Park'
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '12',
- 'lat': '55.89009',
- 'lon': '-3.570975',
- 'distance': '657',
- 'description': 'Take the 3rd exit from Tailend Roundabout roundabout onto Starlaw Road (A779). Go for 657 m.',
- 'time': '1',
- 'time_with_traffic': '1',
- 'turn_angle': '-90',
- 'exit_num': '',
- 'man_type': '29',
- 'street': 'A779, STARLAW ROAD'
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '13',
- 'lat': '55.886743',
- 'lon': '-3.563787',
- 'distance': '486',
- 'description': 'Take the 2nd exit from Toll Roundabout roundabout onto A705. Go for 486 m.',
- 'time': '1',
- 'time_with_traffic': '1',
- 'turn_angle': '-90',
- 'exit_num': '',
- 'man_type': '29',
- 'street': 'A705, '
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '14',
- 'lat': '55.885638',
- 'lon': '-3.557596',
- 'distance': '2131',
- 'description': 'Turn right onto Simpson Parkway (B7015). Go for 2.1 km.',
- 'time': '3',
- 'time_with_traffic': '3',
- 'turn_angle': '90',
- 'exit_num': '',
- 'man_type': '13',
- 'street': 'B7015, SIMPSON PARKWAY'
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '15',
- 'lat': '55.876765',
- 'lon': '-3.542415',
- 'distance': '345',
- 'description': 'Continue on Simpson Parkway. Go for 345 m.',
- 'time': '0',
+ 'lat': '51.495981',
+ 'lon': '-0.143475',
+ 'distance': '21',
+ 'description': 'Head northeast on Terminus Place. Go for 21 m.',
+ 'time': '2018-10-11T17:43:00+01:00',
'time_with_traffic': '0',
'turn_angle': '0',
'exit_num': '',
'man_type': '11',
- 'street': ', SIMPSON PARKWAY'
+ 'street': ', TERMINUS PLACE'
},
{
'@type': 'PrivateRouteLeg',
- 'number': '16',
- 'lat': '55.873793',
- 'lon': '-3.541074',
- 'distance': '197',
- 'description': 'Take the 3rd exit from Rosebank Roundabout roundabout. Go for 197 m.',
- 'time': '1',
+ 'number': '9',
+ 'lat': '51.496063',
+ 'lon': '-0.143208',
+ 'distance': '624',
+ 'description': 'Turn right onto Wilton Road. Go for 624 m.',
+ 'time': '2018-10-11T17:43:21+01:00',
+ 'time_with_traffic': '11',
+ 'turn_angle': '90',
+ 'exit_num': '',
+ 'man_type': '13',
+ 'street': 'A202, WILTON ROAD'
+ },
+ {
+ '@type': 'PrivateRouteLeg',
+ 'number': '10',
+ 'lat': '51.491032',
+ 'lon': '-0.139561',
+ 'distance': '22',
+ 'description': 'Turn left onto Belgrave Road. Go for 22 m.',
+ 'time': '2018-10-11T17:53:51+01:00',
'time_with_traffic': '1',
'turn_angle': '-90',
'exit_num': '',
- 'man_type': '29',
- 'street': ', '
+ 'man_type': '9',
+ 'street': 'A3213, BELGRAVE ROAD'
},
{
'@type': 'PrivateRouteLeg',
- 'number': '17',
- 'lat': '55.872957',
- 'lon': '-3.542737',
- 'distance': '222',
- 'description': 'Take the 2nd exit from Brotherton Roundabout roundabout. Go for 222 m.',
- 'time': '1',
- 'time_with_traffic': '1',
- 'turn_angle': '-90',
+ 'number': '11',
+ 'lat': '51.490914',
+ 'lon': '-0.139314',
+ 'distance': '120',
+ 'description': 'Turn right onto Denbigh Street. Go for 120 m.',
+ 'time': '2018-10-11T17:54:23+01:00',
+ 'time_with_traffic': '2',
+ 'turn_angle': '90',
'exit_num': '',
- 'man_type': '29',
- 'street': ', '
+ 'man_type': '13',
+ 'street': ', DENBIGH STREET'
},
{
'@type': 'PrivateRouteLeg',
- 'number': '18',
- 'lat': '55.873075',
- 'lon': '-3.546073',
- 'distance': '123',
- 'description': 'Take the 1st exit from roundabout. Go for 123 m.',
- 'time': '0',
- 'time_with_traffic': '0',
- 'turn_angle': '-90',
- 'exit_num': '',
- 'man_type': '29',
- 'street': ', '
- },
- {
- '@type': 'PrivateRouteLeg',
- 'number': '19',
- 'lat': '55.872313',
- 'lon': '-3.547393',
+ 'number': '12',
+ 'lat': '51.490066',
+ 'lon': '-0.140383',
'distance': '0',
- 'description': 'Arrive at your destination.',
- 'time': '0',
+ 'description': 'Arrive at Gloucester Street. Your destination is on the left.',
+ 'time': '2018-10-11T17:56:26+01:00',
'time_with_traffic': '0',
'turn_angle': '0',
'exit_num': '',
@@ -323,19 +230,72 @@ const requestData = {
}
]
},
+ 'maneuverGroups': {
+ 'maneuverGroup': [
+ {
+ 'arrivalDescription': 'Arrive at Tower Hill.',
+ 'firstManeuver': 'M1',
+ 'lastManeuver': 'M5',
+ 'summaryDescription': 'Walk to Train Tower Hill.',
+ 'transportMode': 'pedestrian',
+ 'transportModeNum': '6'
+ },
+ {
+ 'arrivalDescription': 'Get off at Victoria.',
+ 'firstManeuver': 'M6',
+ 'lastManeuver': 'M7',
+ 'publicTransportType': 'railMetro',
+ 'publicTransportTypeNum': '5',
+ 'summaryDescription': 'Take the rail District toward Ealing Broadway.',
+ 'transportMode': 'pubTimeTable',
+ 'transportModeNum': '11',
+ 'waitDescription': '1 minutes to connect.'
+ },
+ {
+ 'arrivalDescription': 'Arrive at Gloucester Street.',
+ 'firstManeuver': 'M8',
+ 'lastManeuver': 'M12',
+ 'summaryDescription': '',
+ 'transportMode': 'pedestrian',
+ 'transportModeNum': '6'
+ }
+ ]
+ },
'copy_right': 'Copyright © 2018 Yahoo! Inc. All rights reserved. © Navteq'
},
- 'geocode_results': null
+ 'geocode_results': null,
+ 'source_attribution': {
+ 'attribution': 'With the support of London Underground (TfL). All information is provided without warranty of any kind. London Underground (TfL) Contains public sector information licensed under the Open Government Licence v3.0. Contains OS data © Crown copyright and database rights 2016. Powered by TfL Open Data. Contains Information of Network Rail Infrastructure Limited licensed under the linked licence.',
+ 'sourceSuppliers': {
+ 'href': 'https://transit.api.here.com/r?appId=eAdkWGYRoc4RfxVo0Z4B&u=https://www.networkrail.co.uk/who-we-are/transparency-and-ethics/transparency/open-data-feeds/network-rail-infrastructure-limited-data-feeds-licence/',
+ 'title': 'London Underground (TfL) Contains public sector information licensed under the Open Government Licence v3.0. Contains OS data © Crown copyright and database rights 2016. Powered by TfL Open Data. Contains Information of Network Rail Infrastructure Limited licensed under the linked licence.'
+ }
+ }
}
}
-};
+}
+;
-const goodOutput = { 'totalTime': 65,
- 'totalTimeWithTraffic': 70,
- 'readable': '1 hour, 10 minutes',
- 'timePercentage': 10.5,
+const goodOutput = { 'totalTime': 42,
+ 'totalTimeWithTraffic': 0,
+ 'readable': '42 minutes',
+ 'timePercentage': -58,
'traffic': 'no traffic',
- 'className': 'trafficNone' };
+ 'className': 'trafficNone',
+ 'directions':
+ [ 'Head northwest on Vaughan Way. Go for 49 m.',
+ 'Turn left onto East Smithfield. Go for 340 m.',
+ 'Turn left. Go for 281 m.',
+ 'Turn right. Go for 40 m.',
+ 'Turn left. Go for 22 m.',
+ 'Go to the Train station Tower Hill and take the rail District toward Ealing Broadway. Follow for 9 stations.',
+ 'Get off at Victoria.',
+ 'Head northeast on Terminus Place. Go for 21 m.',
+ 'Turn right onto Wilton Road. Go for 624 m.',
+ 'Turn left onto Belgrave Road. Go for 22 m.',
+ 'Turn right onto Denbigh Street. Go for 120 m.',
+ 'Arrive at Gloucester Street. Your destination is on the left.' ],
+ 'streets': [ 'A1203', 'A202', 'A3213' ] };
describe('Directions', () => {
it('should gracefully handle no data', done => {