-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-tile.html
74 lines (67 loc) · 2.33 KB
/
test-tile.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
<!DOCTYPE HTML>
<title>Test tileFor()</title>
<meta charset="UTF-8">
<script src="tzmap.js"></script>
<style>
canvas { vertical-align: middle }
</style>
<script>
window.tzmap.loadData("./", run, function() { alert("loading failed") });
function range(count, start, interval) {
var l = [];
for (var i = 0; i < count; ++i) {
l[i] = i * interval + start;
}
return l;
}
function run() {
do_tileFor(range(400, 50, -0.05), range(300, -125, 0.04),
[{color: "red",
polygons: window.tzmap.polygonsFor(["America/Los_Angeles"])}]);
setTimeout(run2, 0);
}
function run2() {
window.interesting_polygon_set = [
{ color: "red",
polygons: window.tzmap.polygonsFor(["America/Los_Angeles"]) },
{ color: "blue",
polygons: window.tzmap.polygonsFor(["America/Denver",
"America/Boise",
"America/Phoenix"]) },
{ color: "green",
polygons: window.tzmap.polygonsFor(["America/New_York",
"America/Toronto",
"America/Indianapolis"]) },
{ color: "red",
polygons: window.tzmap.polygonsFor(["Europe/Paris",
"Europe/Oslo",
"Europe/Copenhagen",
"Europe/Madrid"]) },
];
setTimeout(run3, 0);
}
function run3() {
do_tileFor(range(360, 90, -0.5), range(720, -180, 0.5),
interesting_polygon_set);
setTimeout(run4, 0);
}
function run4() {
do_tileFor(range(500, 43, -0.01), range(500, -77, 0.01),
interesting_polygon_set);
setTimeout(run5, 0);
}
function run5() {
do_tileFor(range(700, 41, -0.001), range(500, -74.3, 0.0013),
interesting_polygon_set);
}
function do_tileFor(lats, lons, polygons) {
var startTime = Date.now();
var canvas = window.tzmap.tileFor(lats, lons, polygons);
var duration = Date.now() - startTime;
canvas.style.border = "1px solid black";
document.body.appendChild(canvas);
document.body.appendChild(
document.createTextNode(" drawn in " + duration + "ms."));
document.body.appendChild(document.createElement("br"));
}
</script>