Keeps track of keyed values of type V (eg Point). It stores occurences in type T, which must extend from TrackerBase<V>, eg PointTracker.
V
T
TrackerBase<V>
PointTracker
The creator function passed in to the constructor is responsible for instantiating the appropriate TrackerBase sub-class.
creator
TrackerBase
export class TrackedPointMap extends TrackedValueMap<Points.Point> { constructor(opts:TrackOpts = {}) { super((key, start) => { if (start === undefined) throw new Error(`Requires start point`); const p = new PointTracker(key, opts); p.seen(start); return p; }); }} Copy
export class TrackedPointMap extends TrackedValueMap<Points.Point> { constructor(opts:TrackOpts = {}) { super((key, start) => { if (start === undefined) throw new Error(`Requires start point`); const p = new PointTracker(key, opts); p.seen(start); return p; }); }}
Number of named values being tracked
Remove a tracked value by id. Use reset to clear them all.
Returns a tracked value by id, or undefined if not found
Protected
Creates or returns a TrackedValue instance for id.
id
Rest
Returns true if id is stored
Enumerate ids
Enumerate starting values
Enumerate last received values
const pointers = pointTracker();const c = Points.centroid(...Array.from(pointers.lastPoints())); Copy
const pointers = pointTracker();const c = Points.centroid(...Array.from(pointers.lastPoints()));
Remove all tracked values. Use delete to remove a single value by id.
For a given id, note that we have seen one or more values.
Id
Values(s)
Information about start to last value
Enumerate tracked values
Iterates TrackedValues ordered with oldest first
Iterates underlying values, ordered by age (oldest first) First the named values are sorted by their elapsed value, and then we return the last value for that group.
elapsed
Keeps track of keyed values of type
V
(eg Point). It stores occurences in typeT
, which must extend fromTrackerBase<V>
, egPointTracker
.The
creator
function passed in to the constructor is responsible for instantiating the appropriateTrackerBase
sub-class.Example: Sub-class