forked from StianF/ecomarathon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eco.html
executable file
·218 lines (199 loc) · 6.56 KB
/
eco.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>DNV Fuel Fighter 2.0</title>
<!-- Use Compatibility mode in IE -->
<!--[if IE]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]-->
<!--<link rel="stylesheet" type="text/css" href="jquery.jqplot.css" /> -->
<link rel="stylesheet" type="text/css" href="style.css" />
<!-- BEGIN: load jquery -->
<script language="javascript" type="text/javascript" src="jquery-1.4.2.js"></script>
<!-- END: load jquery -->
<!--Gauges (Fucker opp jqBarGraph)-->
<script type="text/javascript" src="bindows_gauges.js"></script>
<!-- BEGIN: highcharts -->
<script language="javascript" type="text/javascript" src="highcharts.js"></script>
<!-- END: highcharts -->
<!--Google maps-->
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAYaog4dzwxoybW9_peuyRMBSz_w1ruw6ENA68gLhXIho5vEdS3BRNfc7XAwpRRJ-YyizO_obSYWjUAw" type="text/javascript"></script>
<script type="text/javascript">
var map;
var baseIcon;
var marker;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
<?PHP
echo 'map.setCenter(new GLatLng('. $track_latitude . ','. $track_longitude . '), 15);'
?>
map.setMapType(G_SATELLITE_MAP);
map.setUIToDefault();
// Create a base icon for all of our markers that specifies the
// shadow, icon dimensions, etc.
baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
}
}
function setCarPos(latitude, longitude){
if(marker != undefined){
map.removeOverlay(marker);
}
//var bounds = map.getBounds();
//var southWest = bounds.getSouthWest();
//var northEast = bounds.getNorthEast();
//var lngSpan = northEast.lng() - southWest.lng();
//var latSpan = northEast.lat() - southWest.lat();
//var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(), southWest.lng() + lngSpan * Math.random());
var latlng = new GLatLng(latitude, longitude);
var icon = new GIcon(baseIcon);
icon.image = "car.png";
// Set up our GMarkerOptions object
markerOptions = { icon:icon };
marker = new GMarker(latlng, markerOptions);
map.addOverlay(marker);
}
</script>
<script language="javascript" type="text/javascript" src="values2.php"></script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div style="width:1000px;center; margin-left: auto ;margin-right: auto ;">
<div style="text-align:center;">
<img src="DNV.jpg" height="100px"><h1>Shell Eco Marathon 2011</h1>
</div>
<hr>
<div id="content">
<div id="gauges" style="float:left;">
<div>
<div style="float:left;">
<div style="text-align:center;">Speed:</div>
<div id="speed" style="width:150px;height:150px;"></div>
</div>
<div style="float:right;">
<div style="text-align:center;">Avg Speed:</div>
<div id="avgspeed" style="width: 150px; height: 150px"></div>
</div>
</div>
<br />
<div>
<div style="float:left;">
<div style="text-align:center;">Calculated Avg speed:</div>
<div id="calcavgspeed" style="width: 150px; height: 150px"></div>
</div>
<div style="float:right;">
<div style="text-align:center;">Hydrogen pressure:</div>
<div id="hydrogenpress" style="width: 150px; height: 150px"></div>
</div>
</div>
</div>
<div style="float:right;">
<div id="map_canvas" style="width: 500px; height: 400px"></div>
<br />
<div id="chart1" style="margin-top:20px; margin-left:20px; width:500px; height:300px;"></div>
</div>
</div>
</div>
<script type="text/javascript">
var chart;
var speed = bindows.loadGaugeIntoDiv("gauge.xml", "speed");
var avgspeed = bindows.loadGaugeIntoDiv("gauge.xml", "avgspeed");
var calcavgspeed = bindows.loadGaugeIntoDiv("gauge.xml", "calcavgspeed");
var hydrogenpress = bindows.loadGaugeIntoDiv("gauge.xml", "hydrogenpress");
var series = [{ name: 'Cell',data: [0]}];
$(document).ready(
function(){
chart = new Highcharts.Chart({
chart: {
renderTo: 'chart1',
defaultSeriesType: 'column'
},
title: {
text: 'Voltage'
},
xAxis: {
categories: ['1', '2', '3', '4', '5', '6', '7', '8','9','10'],
title: {
text: null
}
},
legend: {
enabled: false
},
yAxis: {
min: 0,
title: {
text: 'V',
align: 'high'
}
},
tooltip: {
formatter: function() {
return ''+
this.series.name +' ' + this.x + ': '+ this.y +' V';
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
credits: {
enabled: false
},
series: series
});
}
);
//<!--Get values-->
$(function () {
updateValues();
});
function updateValues() {
$.getScript('values2.php', function(){updateUI();});
}
function updateUI(){
avgspeed.needle.setValue(values[0]);
avgspeed.label.setText(values[0]);
calcavgspeed.needle.setValue(values[1]);
calcavgspeed.label.setText(values[1]);
hydrogenpress.needle.setValue(values[2]);
hydrogenpress.label.setText(values[2]);
speed.needle.setValue(values[2]);
speed.label.setText(values[2]);
chart.series[0].setData(series, true);
//$('#chart1').jqBarGraph({
// data: arrayOfData,
// animate: false
//});
/*Eats a lot of memory
delete plot1;
delete plot2;
plot1 = $.jqplot('chart1', [s1], {
seriesDefaults:{
renderer:$.jqplot.BarRenderer
},
axes: {
xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks }
}
});
$.jqplot.config.enablePlugins = true;
plot2 = $.jqplot('speed',[s2],{
title: 'Speed',
seriesDefaults: {
renderer: $.jqplot.MeterGaugeRenderer,
rendererOptions: { label: 'km/h' }
}
});*/
setCarPos(pos[index][0], pos[index][1]);
setTimeout(updateValues, 2000);
}
</script>
</body>
</html>