Permalink
Browse files

Draw FAKE route lines for bus services that has no route lines

  • Loading branch information...
cheeaun committed Oct 30, 2016
1 parent 95cbc06 commit a16a4f151ab3c43573b640e9ba97e4da65969963
Showing with 12 additions and 10 deletions.
  1. +12 −10 assets/js/app.js
@@ -503,20 +503,22 @@
var one = data[route];
var routes = one.route;
var stops = one.stops;
var latlngs = [];
var locations = [];

if (routes && routes.length){
for (var i=0, l=routes.length; i<l; i++){
var coord = routes[i];
var latlng = coord.split(',');
var position = new google.maps.LatLng(parseFloat(latlng[0], 10), parseFloat(latlng[1], 10));
latlngs.push(position);
}
polyline.setPath(latlngs);
polyline.setMap(map);
if (!routes || !routes.length){
routes = stops.map(function(stop){
var info = busStopsMap[stop];
return info.lat + ',' + info.lng;
});
}

var latlngs = routes.map(function(route){
var latlng = route.split(',');
return new google.maps.LatLng(parseFloat(latlng[0], 10), parseFloat(latlng[1], 10));
});
polyline.setPath(latlngs);
polyline.setMap(map);

var html = '<div class="tab-bar">';
if (data[2] && data[2].route && data[2].route.length){
html += '<a href="#/services/' + no + '" class="tab ' + (route == 1 ? 'selected' : '') + '">Route 1</a>'

0 comments on commit a16a4f1

Please sign in to comment.