-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
86 lines (79 loc) · 3.65 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:50%; float:left;}
#app-container { float:right;}
</style>
<body>
<div style="width: 100%; display: table;">
<div style="display: table-row">
<div id="map" style="display: table-cell;"> </div>
<div id="app-container" style="width: 50%; display: table-cell;">
<div style="width: 100%; display: table;">
<div style="display: table-row" style="width: 100%;">
<div style="display: table-cell; float:left;"></div>
<div style="display: table-cell; float:right;">
<img src="static/WIMB_Logo.png"
style="height: 10%;">
</div>
</div>
<div id="app" style="display: table-row" style="width: 100%;"></div>
<div style="display: table-row" style="width: 100%;">
<center><img src="static/Bottom_eles.png" style="height: 150%;"></center>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="http://fb.me/react-0.9.0.js"></script>
<script src="out/goog/base.js" type="text/javascript"></script>
<script src="hackakl_where_is_my_bus.js" type="text/javascript"></script>
<script type="text/javascript">goog.require("hackakl_where_is_my_bus.core");</script>
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.3/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.3/mapbox.css' rel='stylesheet' />
<script type="text/javascript">
var map = L.mapbox.map('map', 'stuartmitchell.ia0n7ckk');
var busIcon = L.icon({
iconUrl: 'static/bus-marker2.png',
shadowUrl: 'static/marker-shadow.png',
iconSize: [50, 50],
iconAnchor: [15, 45],
});
var myIcon = L.icon({
iconUrl: 'static/marker-icon.png',
shadowUrl: 'static/marker-shadow.png',
});
var bus_group = L.featureGroup().addTo(map);
function set_marker(lat, lon, vehicle_id) {
var marker = L.marker([lat, lon], {icon: busIcon}).addTo(bus_group);
marker.bindPopup(vehicle_id);
};
function set_my_location(lat_lon) {
var marker = L.marker(lat_lon, {icon: myIcon}).addTo(map);
marker.bindPopup("My Location");
marker.openPopup();
};
function set_my_destination(lat_lon) {
var marker = L.marker(lat_lon, {icon: myIcon}).addTo(map);
marker.bindPopup("My Destination");
marker.openPopup();
};
function fitBounds() {
map.fitBounds(route_group, { padding: [50, 50] });
}
function delete_markers() {
bus_group.clearLayers()
};
var route_group = L.featureGroup().addTo(map);
function draw_route(lat_longs) {
route_group.clearLayers()
var polyline = L.polyline([], {color: 'blue'}).addTo(route_group);
for (var i = 0; i < lat_longs.length; i++) {
var p = new L.latLng(lat_longs[i]);
polyline.addLatLng(p);
};
};
</script>
</body>
</html>