mirror of
https://github.com/nasa/openmct.git
synced 2025-05-11 21:13:02 +00:00
[Plot] Handle changes to telemetry objects
Handle changes to the set of visible telemetry objects in a plot; addresses WTD-619, which is related to WTD-1329.
This commit is contained in:
parent
f2df0bfdbb
commit
bcfe80fbdc
@ -50,6 +50,7 @@ define(
|
|||||||
origin = [0, 0],
|
origin = [0, 0],
|
||||||
domainExtrema,
|
domainExtrema,
|
||||||
rangeExtrema,
|
rangeExtrema,
|
||||||
|
buffers = {},
|
||||||
bufferArray = [],
|
bufferArray = [],
|
||||||
domainOffset;
|
domainOffset;
|
||||||
|
|
||||||
@ -61,11 +62,10 @@ define(
|
|||||||
// Check if this set of ids matches the current set of ids
|
// Check if this set of ids matches the current set of ids
|
||||||
// (used to detect if line preparation can be skipped)
|
// (used to detect if line preparation can be skipped)
|
||||||
function idsMatch(nextIds) {
|
function idsMatch(nextIds) {
|
||||||
return nextIds.map(function (id, index) {
|
return ids.length === nextIds.length &&
|
||||||
return ids[index] === id;
|
nextIds.every(function (id, index) {
|
||||||
}).reduce(function (a, b) {
|
return ids[index] === id;
|
||||||
return a && b;
|
});
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare plot lines for this group of telemetry objects
|
// Prepare plot lines for this group of telemetry objects
|
||||||
@ -74,7 +74,7 @@ define(
|
|||||||
next = {};
|
next = {};
|
||||||
|
|
||||||
// Detect if we already have everything we need prepared
|
// Detect if we already have everything we need prepared
|
||||||
if (ids.length === nextIds.length && idsMatch(nextIds)) {
|
if (idsMatch(nextIds)) {
|
||||||
// Nothing to prepare, move on
|
// Nothing to prepare, move on
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -88,13 +88,13 @@ define(
|
|||||||
|
|
||||||
// Create buffers for these objects
|
// Create buffers for these objects
|
||||||
bufferArray = ids.map(function (id) {
|
bufferArray = ids.map(function (id) {
|
||||||
var buffer = new PlotLineBuffer(
|
buffers[id] = buffers[id] || new PlotLineBuffer(
|
||||||
domainOffset,
|
domainOffset,
|
||||||
INITIAL_SIZE,
|
INITIAL_SIZE,
|
||||||
maxPoints
|
maxPoints
|
||||||
);
|
);
|
||||||
next[id] = lines[id] || new PlotLine(buffer);
|
next[id] = lines[id] || new PlotLine(buffers[id]);
|
||||||
return buffer;
|
return buffers[id];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,4 +290,4 @@ define(
|
|||||||
return PlotUpdater;
|
return PlotUpdater;
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -147,7 +147,8 @@ define(
|
|||||||
telemetryObjects = objects;
|
telemetryObjects = objects;
|
||||||
metadatas = objects.map(lookupMetadata);
|
metadatas = objects.map(lookupMetadata);
|
||||||
// Fire callback, as this will be the first time that
|
// Fire callback, as this will be the first time that
|
||||||
// telemetry objects are available
|
// telemetry objects are available, or these objects
|
||||||
|
// will have changed.
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
@ -176,9 +177,10 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function idsMatch(ids) {
|
function idsMatch(ids) {
|
||||||
return ids.every(function (id, index) {
|
return ids.length === telemetryObjects.length &&
|
||||||
return telemetryObjects[index].getId() === id;
|
ids.every(function (id, index) {
|
||||||
});
|
return telemetryObjects[index].getId() === id;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function modelChange(model) {
|
function modelChange(model) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user