Display interpolated time in igc example

This commit is contained in:
Tom Payne
2014-01-20 11:22:14 +01:00
parent 3e95df495e
commit 6171ed7cdf

View File

@@ -85,7 +85,6 @@ var displaySnap = function(coordinate) {
line = null;
info.innerHTML = ' ';
} else {
info.innerHTML = closestFeature.get('PLT');
var geometry = closestFeature.getGeometry();
var closestPoint = geometry.getClosestPoint(coordinate);
if (point === null) {
@@ -93,10 +92,14 @@ var displaySnap = function(coordinate) {
} else {
point.setCoordinates(closestPoint);
}
var date = new Date(closestPoint[2] * 1000);
info.innerHTML =
closestFeature.get('PLT') + ' (' + date.toUTCString() + ')';
var coordinates = [coordinate, [closestPoint[0], closestPoint[1]]];
if (line === null) {
line = new ol.geom.LineString([coordinate, closestPoint]);
line = new ol.geom.LineString(coordinates);
} else {
line.setCoordinates([coordinate, closestPoint]);
line.setCoordinates(coordinates);
}
}
map.requestRenderFrame();