Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Should have been updating this all along

  • Loading branch information...
commit 9e8d2345fe7d01314a769a4823d072617392d088 1 parent e2f6da8
Brad Luyster Zuph authored
2  css/main.css
View
@@ -8,6 +8,8 @@ body {
padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */
}
+
+
.tweets {
border-width: 1px;
border-color: black;
BIN  img/powered-by-pubnub-200.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 index.html
View
@@ -21,6 +21,8 @@
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
+ <link rel="stylesheet" href="theme/default/style.css">
+ <link rel="stylesheet" href="theme/default/google.css">
<!-- Rather use `less.js` to dynamically compile your `stylesheet/less` files? -->
<!--<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/1.1.3/less-1.1.3.min.js"></script>
@@ -39,6 +41,10 @@
<script type="text/javascript" src="http://white-star-static-public.s3-website-us-east-1.amazonaws.com/js/jquery.livetwitter.min.js"></script>
<script type="text/javascript" src="http://white-star-static-public.s3-website-us-east-1.amazonaws.com/js/jquery.gauge.min.js"></script>
+ <script type="text/javascript"
+ src="http://maps.googleapis.com/maps/api/js?v=3.5&key=AIzaSyCrWMQXnVwudyYmxneViNjC43UehwMrXEU&sensor=false">
+ </script>
+
<script type="text/javascript" src="js/jquery.doomTweaks.js"></script>
<script type="text/javascript" src="js/wsbdata.js"></script>
@@ -50,7 +56,15 @@
$(document).ready(function () {
WSBOUT.init();
-
+
+ $("#panTo").change(function () {
+ if ($(this).is(':checked')) {
+ WSBOUT.panTo = true;
+ } else {
+ WSBOUT.panTo = false;
+ }
+ });
+
$("#tweets").liveTwitter('lvl1whitestar',
{mode: 'user_timeline', limit: 1, rate: 60000});
@@ -83,6 +97,11 @@
<div class="container">
<div class="content">
+ <div class="row">
+ <div class="span14">
+ <h1>Test Data! Check back later for the real stuff!</h1>
+ </div>
+ </div>
<div class="row tweets" style="margin-bottom: 10px">
<div class="span1">
<p style="margin-bottom: 0px">Tweets:</p>
@@ -97,19 +116,40 @@
</div>
<div class="span4">
<div class="row">
- <div class="span2">
+ <div class="span2" style="text-align: center;">
<canvas id="altitudeGauge" width="100" height="100"></canvas>
+ Altitude
</div>
- <div class="span2">
+ <div class="span2" style="text-align: center;">
<canvas id="externalTempGauge" width="100" height="100"></canvas>
+ External Temp
</div>
</div>
<div class="row">
- <div class="span2">
+ <div class="span2" style="text-align: center;">
<canvas id="groundSpeedGauge" width="100" height="100"></canvas>
+ Speed
</div>
<div class="span2">
-
+ <a href="http://www.pubnub.com"><img src="img/powered-by-pubnub-200.png" width="100" height="41"></a>
+ <p style="font-size: 8px; line-height: normal; text-align: center;">Real Time Push Data Generously Provided by <a href="http://www.pubnub.com">PubNub</a></p>
+ </div>
+ </div>
+ <div class="row">
+ <div class="span4">
+ <h2>Tracker Options</h2>
+ </div>
+ <div class="span2">
+ <label class="checkbox">
+ <input type="checkbox" id="panTo" name="panTo" value="1" checked>
+ Pan to balloon?
+ </label>
+ </div>
+ <div class="span2">
+ <label class="checkbox">
+ <input type="checkbox" id="cake" name="cake" value="1">
+ Delicious cake?
+ </label>
</div>
</div>
</div>
@@ -142,6 +182,14 @@
<div class="span8">
<div id="vspeedChart"></div>
</div>
+ <div class="span8">
+ <div id="voltageChart"></div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="span8">
+ <div id="ballastChart"></div>
+ </div>
<div class="span8"></div>
</div>
17 js/sensors.json
View
@@ -157,6 +157,23 @@
]
}
},
+ {
+ "type": "voltage",
+ "name": "volts",
+ "graphDiv": "voltageChart",
+ "onPopup": true,
+ "units": "Volts",
+ "niceName": "Battery Voltage"
+
+ },
+ {
+ "type": "ballast",
+ "name": "ballast",
+ "graphDiv": "ballastChart",
+ "onPopup": true,
+ "units": "Grams",
+ "niceName": "Ballast Remaining"
+ },
{
"type": "cloud",
20 js/settings.json
View
@@ -1,5 +1,5 @@
{
- "initialData" : "http://test3.whitestarballoon.com/data/init.gpx",
+ "initialData" : "http://track.whitestarballoon.com/data/init.gpx",
"hysplitData" : "",
"mapSettings" : {
"mapOptions" : {
@@ -15,11 +15,27 @@
"strokeWidth": 4,
"strokeDashstyle": "solid"
},
+ "hysplitStyle" : {
+ "strokeColor": "#FF00FF",
+ "strokeWidth": 3,
+ "strokeDashstyle": "longdash"
+ },
+ "hysplitPointStyleMap": {
+ "default": {
+ "strokeColor": "#0000FF",
+ "fillColor": "#0080FF",
+ "pointRadius": 2
+ },
+ "select": {
+ "strokeColor": "#FF00F0",
+ "fillColor": "#FF0000"
+ }
+ },
"pointStyleMap" : {
"default": {
"strokeColor": "#0080FF",
"fillColor": "#0080FF",
- "pointRadius": 5
+ "pointRadius": 3
},
"select": {
"strokeColor": "#FF0000",
15 js/wsbdata.js
View
@@ -30,6 +30,9 @@ var WSBOUT = (function (my) {
my.sensors.addData(displayData);
my.maps.add_from_gpx(data);
});
+ $.getJSON('/data/hysplit.json', function (data) {
+ WSBOUT.maps.update_hysplit(data);
+ });
});
});
@@ -101,6 +104,10 @@ var WSBOUT = (function (my) {
dataType: "xml",
mimeType: "application/xml",
success: function (data, code) {
+ var displayData, testGraph;
+ displayData = my.parseForDisplay(data);
+ my.sensors.addData(displayData);
+ my.maps.add_from_gpx(data);
},
error: function () { $.l('failed ajax'); }
@@ -109,6 +116,14 @@ var WSBOUT = (function (my) {
case "test":
$.l(data);
break;
+ case "hysplit":
+ $.getJSON('/data/hysplit.json', function (data) {
+ WSBOUT.maps.update_hysplit(data);
+ });
+ break;
+ case "reload":
+ window.location.reload(true);
+ break;
}
};
my.commandHandler = commandHandler;
117 js/wsbmaps.js
View
@@ -6,7 +6,8 @@ WSBOUT.maps = (function (my) {
var points, layers, initLayers, create_map, map, init, set_center,
add_from_gpx, parseForMap, redrawTrack, redrawPoints,
lastPointStyle, pointStyleMap, mapControls, onPointSelect,
- onPointUnselect, onPointBubbleClose, selectedFeature;
+ onPointUnselect, onPointBubbleClose, selectedFeature, update_hysplit,
+ parseForHysplit;
points = [];
@@ -30,12 +31,14 @@ WSBOUT.maps = (function (my) {
};
create_map(mapSettings.mapOptions);
- initLayers(mapSettings.predictionStyle, mapSettings.trackStyle, pointStyleMap);
+ initLayers(mapSettings.predictionStyle, mapSettings.trackStyle, pointStyleMap, mapSettings.hysplitStyle, mapSettings.hysplitPointStyleMap);
map.addLayer(layers.prediction);
map.addLayer(layers.track);
map.addLayer(layers.points);
+ map.addLayer(layers.hysplit);
+ map.addLayer(layers.hysplitPoints);
- mapControls = new OpenLayers.Control.SelectFeature(layers.points,
+ mapControls = new OpenLayers.Control.SelectFeature([layers.points, layers.hysplitPoints],
{onSelect: onPointSelect, onUnselect: onPointUnselect});
map.addControl(mapControls);
mapControls.activate();
@@ -56,7 +59,7 @@ WSBOUT.maps = (function (my) {
if (attribute[i].hasOwnProperty('round')) {
data += parseFloat(attribute[i].value).toFixed(2);
} else {
- data += attribute[i].value
+ data += attribute[i].value;
}
if (attribute[i].units) {
data += " (";
@@ -84,7 +87,7 @@ WSBOUT.maps = (function (my) {
mapControls.unselect(selectedFeature);
};
- initLayers = function (predictionStyle, trackStyle, pointStyleMap) {
+ initLayers = function (predictionStyle, trackStyle, pointStyleMap, hysplitStyle, hysplitPointStyleMap) {
layers = {
prediction: (function () {
return new OpenLayers.Layer.Vector("Prediction", {
@@ -98,12 +101,27 @@ WSBOUT.maps = (function (my) {
style: trackStyle
});
}()),
+ hysplit: (function () {
+ return new OpenLayers.Layer.Vector("Track", {
+ 'sphericalMercator': true,
+ style: hysplitStyle
+ });
+ }()),
+ hysplitPoints: (function () {
+ return new OpenLayers.Layer.Vector("HysplitPoints", {
+ 'sphericalMercator': true,
+ numZoomLevels: 16,
+ minResolution: 0,
+ maxResolution: 3000,
+ styleMap: new OpenLayers.StyleMap(hysplitPointStyleMap)
+ });
+ }()),
points: (function () {
return new OpenLayers.Layer.Vector("Points", {
'sphericalMercator': true,
numZoomLevels: 16,
minResolution: 0,
- maxResolution: 2000,
+ maxResolution: 200000,
styleMap: new OpenLayers.StyleMap(pointStyleMap)
});
}())
@@ -112,7 +130,7 @@ WSBOUT.maps = (function (my) {
create_map = function (mapOptions) {
map = new OpenLayers.Map('map', mapOptions);
- map.addLayer(new OpenLayers.Layer.OSM("Simple OSM Map"));
+ map.addLayer(new OpenLayers.Layer.Google("Simple Google Map"));
};
set_center = function (coords, zoom) {
@@ -127,7 +145,7 @@ WSBOUT.maps = (function (my) {
my.set_center = set_center;
parseForMap = function (xmlElems) {
- var bubbles, i, j, time, ele, sensorXml, sensor, sensors, wsbsensor;
+ var bubbles, i, j, time, ele, sensorXml, sensor, sensors, wsbsensor, sensorData;
bubbles = [];
// Iterate through XML Elemets.
@@ -137,14 +155,23 @@ WSBOUT.maps = (function (my) {
time = new Date($(xmlElems[i]).parent().find('time').text()).getTime();
ele = $(xmlElems[i]).parent().find('ele').text();
sensor = [];
- sensors = xmlElems[i].getElementsByTagNameNS("*", "sensor");
+ if (xmlElems[i].getElementsByTagNameNS !== undefined) {
+ sensors = xmlElems[i].getElementsByTagNameNS("*", "sensor");
+ } else {
+ sensors = xmlElems[i].getElementsByTagName("wsbml:sensor");
+ }
sensor.push({ niceName: 'Time', value: new Date(time).toString()});
sensor.push({ niceName: 'Altitude', value: ele, units: 'M'});
for (j = 0; j < sensors.length; j += 1) {
//There is no reason we couldn't associate readible names here.
wsbsensor = WSBOUT.sensors.getSensor(sensors[j].getAttribute('type'), sensors[j].getAttribute('name'));
+ if (sensors[j].textContent !== undefined) {
+ sensorData = sensors[j].textContent;
+ } else {
+ sensorData = sensors[j].text;
+ }
if (wsbsensor) {
- sensor.push({ niceName: wsbsensor.niceName, value: sensors[j].textContent, units: wsbsensor.units, round: true });
+ sensor.push({ niceName: wsbsensor.niceName, value: sensorData, units: wsbsensor.units, round: true });
}
}
bubbles[i] = sensor;
@@ -153,16 +180,82 @@ WSBOUT.maps = (function (my) {
return bubbles;
};
+ parseForHysplit = function (incomingJson) {
+ var i, rawPoints, sensor, time, ele, output;
+ output = [];
+
+ rawPoints = incomingJson.points;
+
+ for (i = 0; i < rawPoints.length; i += 1) {
+ sensor = [];
+ time = new Date(parseInt(rawPoints[i].time)*1000).getTime();
+ ele = rawPoints[i].alt;
+ sensor.push({niceName: 'Time', value: new Date(time).toString()});
+ sensor.push({niceName: 'Altitude', value: ele, units: 'M'});
+ sensor.push({niceName: 'Latitude', value: rawPoints[i].lat, units: 'Degrees'});
+ sensor.push({niceName: 'Longitude', value: rawPoints[i].lon, units: 'Degrees'});
+ output.push(sensor);
+ }
+
+ return output;
+ };
+
+ update_hysplit = function (incomingJson) {
+ var points, newLineString, newFeature, newVector, i, rawPoints, dataPoints;
+ rawPoints = incomingJson.points;
+ points = [];
+
+ dataPoints = parseForHysplit(incomingJson);
+
+ if (rawPoints.length !== dataPoints.length) {
+ throw {
+ name: "lengthError",
+ message: "rawPoints and dataPoints must have same number of elements!"
+ };
+ }
+
+ for (i = 0; i < rawPoints.length; i += 1) {
+ points[i] = new OpenLayers.Geometry.Point(rawPoints[i].lon, rawPoints[i].lat);
+ points[i].transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
+ points[i].data = dataPoints[i];
+ }
+ newLineString = new OpenLayers.Geometry.LineString(points);
+ newFeature = new OpenLayers.Feature.Vector(newLineString);
+ layers.hysplit.removeAllFeatures();
+ layers.hysplit.addFeatures(newFeature);
+
+ layers.hysplitPoints.removeAllFeatures();
+
+ layers.hysplitPoints.addFeatures((function () {
+ var featArray = [], i;
+ for (i = 0; i < points.length; i += 1) {
+ featArray.push(new OpenLayers.Feature.Vector(points[i]));
+ }
+ return featArray;
+ }()));
+
+ layers.hysplitPoints.redraw();
+
+ $.l(incomingJson);
+ $.l(newLineString);
+ $.l(newFeature);
+ };
+ my.update_hysplit = update_hysplit;
+
add_from_gpx = function (GPXDom) {
var xmlElems, bubbleData, features, format, i;
- xmlElems = GPXDom.getElementsByTagNameNS("*", "data");
+ if (GPXDom.getElementsByTagNameNS !== undefined) {
+ xmlElems = GPXDom.getElementsByTagNameNS("*", "data");
+ } else {
+ xmlElems = GPXDom.getElementsByTagName("wsbml:data");
+ }
bubbleData = parseForMap(xmlElems);
format = new OpenLayers.Format.GPX();
features = format.read(GPXDom)[0].geometry.getVertices();
if (features.length !== bubbleData.length) {
throw {
- name: 'lengthError',
+ name: "lengthError",
message: "Features and Data must have same number of elements!"
};
}
21 js/wsbparse.js
View
@@ -4,9 +4,13 @@ var WSBOUT = (function (my) {
var parseForDisplay;
parseForDisplay = function (GPXDom) {
- var sensors, xmlElems, i, j, time, ele, sensorXml;
+ var sensors, xmlElems, i, j, time, ele, sensorXml, sensorData;
sensors = {};
- xmlElems = GPXDom.getElementsByTagNameNS("*", "data");
+ if ( GPXDom.getElementsByTagNameNS !== undefined ) {
+ xmlElems = GPXDom.getElementsByTagNameNS("*", "data");
+ } else {
+ xmlElems = GPXDom.getElementsByTagName("wsbml:data");
+ }
for (i = 0; i < xmlElems.length; i += 1) {
time = new Date($(xmlElems[i]).parent().find('time').text()).getTime();
@@ -19,7 +23,11 @@ var WSBOUT = (function (my) {
sensors.altitude.altitude = [];
}
sensors.altitude.altitude.push([ time, parseFloat(ele) ]);
- sensorXml = xmlElems[i].getElementsByTagNameNS("*", "sensor");
+ if ( xmlElems[i].getElementsByTagNameNS !== undefined ) {
+ sensorXml = xmlElems[i].getElementsByTagNameNS("*", "sensor");
+ } else {
+ sensorXml = xmlElems[i].getElementsByTagName("wsbml:sensor");
+ }
for (j = 0; j < sensorXml.length; j += 1) {
sensorXml[j].getAttribute('name');
if (typeof sensors[sensorXml[j].getAttribute('type')] === "undefined") {
@@ -28,7 +36,12 @@ var WSBOUT = (function (my) {
if (typeof sensors[sensorXml[j].getAttribute('type')][sensorXml[j].getAttribute('name')] === "undefined") {
sensors[sensorXml[j].getAttribute('type')][sensorXml[j].getAttribute('name')] = [];
}
- sensors[sensorXml[j].getAttribute('type')][sensorXml[j].getAttribute('name')].push([ time, parseFloat(sensorXml[j].textContent) ]);
+ if(sensorXml[j].textContent !== undefined) {
+ sensorData = sensorXml[j].textContent;
+ } else {
+ sensorData = sensorXml[j].text;
+ }
+ sensors[sensorXml[j].getAttribute('type')][sensorXml[j].getAttribute('name')].push([ time, parseFloat(sensorData) ]);
}
}
1  js/wsbsensors.js
View
@@ -37,6 +37,7 @@ WSBOUT.sensors = (function (my) {
//create new graph
} else {
mySeries = myGraph.addSeries({id: "series" + that.name, name: that.name, data: []}, false);
+ mySeries.points = [];
}
//create new trace
Please sign in to comment.
Something went wrong with that request. Please try again.