[Fixed Position] Updated fixed position view to use new Telemetry API

Added TelemetryCollection to handle bounds and buffering. Avoids loss of telemetry due to timing mismatch between telemetry providers and tick sources
Fixed issues with removal and addition of objects
This commit is contained in:
Henry
2017-03-29 12:18:11 -07:00
parent 7dd5da8993
commit d4fdaf9cbc
5 changed files with 512 additions and 240 deletions

View File

@ -75,6 +75,7 @@ define(
// If collection is not sorted by a time field, we cannot respond to
// bounds events
if (this.sortField === undefined) {
this.lastBounds = bounds;
return;
}
@ -94,7 +95,7 @@ define(
if (discarded && discarded.length > 0) {
/**
* A `discarded` event is thrown when telemetry data fall out of
* A `discarded` event is emitted when telemetry data fall out of
* bounds due to a bounds change event
* @type {object[]} discarded the telemetry data
* discarded as a result of the bounds change
@ -103,7 +104,7 @@ define(
}
if (added && added.length > 0) {
/**
* An `added` event is thrown when a bounds change results in
* An `added` event is emitted when a bounds change results in
* received telemetry falling within the new bounds.
* @type {object[]} added the telemetry data that is now within bounds
*/
@ -194,11 +195,14 @@ define(
*/
TelemetryCollection.prototype.clear = function () {
this.telemetry = [];
this.highBuffer = [];
};
/**
* Sorts the telemetry collection based on the provided sort field
* specifier.
* specifier. Subsequent inserts are sorted to maintain specified sport
* order.
*
* @example
* // First build some mock telemetry for the purpose of an example
* let now = Date.now();