-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
47 lines (40 loc) · 1.71 KB
/
test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Smart Traffic Simulator</title>
</head>
<body style="width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden">
<h1 style="text-align: center">Smart Traffic Simulator</h1>
<div id="trackPath" style="padding-left: 20px; font: 20px Arial, sans-serif;"></div>
<div id="lengthOnlyPath" style="padding-left: 20px; font: 20px Arial, sans-serif;"></div>
<canvas id="canvas"
style="position: absolute; padding-bottom: 0; margin-bottom: 0; width: 100%; height: 100%;"></canvas>
<div id="gui" style="position: absolute; top: 0; right: 0;"></div>
<script src="./public/coffee-main.js"></script>
<script id="test"> // ID is for checking if I'm running the test.html file
let trackPathElement = document.getElementById('trackPath');
let trackPath = window.world.trackPath;
let lengthOnlyTrackPathElement = document.getElementById('lengthOnlyPath');
let lengthOnlyPath = window.world.lengthOnlyPath
setInterval(function () {
trackPath = window.world.trackPath;
lengthOnlyPath = window.world.lengthOnlyPath;
if (trackPath.length > 0) {
let text = 'Track Path: ';
for (let i = 0; i < trackPath.length; i++) {
text += trackPath[i]['intersection']['id'] + ', ';
}
trackPathElement.innerHTML = text;
}
if (lengthOnlyPath.length > 0) {
let text = 'Length Only Track Path: ';
for (let i = 0; i < lengthOnlyPath.length; i++) {
text += lengthOnlyPath[i]['intersection']['id'] + ', ';
}
lengthOnlyTrackPathElement.innerHTML = text;
}
}, 1500);
</script>
</body>
</html>