mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 17:08:57 +00:00
[Code Style] Continue refactor of Plot bundle
Continue refactoring Plot bundle to use prototypes, WTD-1482
This commit is contained in:
@ -49,8 +49,7 @@ define(
|
||||
min = [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY],
|
||||
x,
|
||||
y,
|
||||
domainOffset = Number.POSITIVE_INFINITY,
|
||||
buffers;
|
||||
domainOffset = Number.POSITIVE_INFINITY;
|
||||
|
||||
// Remove any undefined data sets
|
||||
datas = (datas || []).filter(identity);
|
||||
@ -85,65 +84,69 @@ define(
|
||||
}
|
||||
|
||||
// Convert to Float32Array
|
||||
buffers = vertices.map(function (v) { return new Float32Array(v); });
|
||||
this.buffers = vertices.map(function (v) {
|
||||
return new Float32Array(v);
|
||||
});
|
||||
|
||||
return {
|
||||
/**
|
||||
* Get the dimensions which bound all data in the provided
|
||||
* data sets. This is given as a two-element array where the
|
||||
* first element is domain, and second is range.
|
||||
* @returns {number[]} the dimensions which bound this data set
|
||||
* @memberof platform/features/plot.PlotPreparer#
|
||||
*/
|
||||
getDimensions: function () {
|
||||
return [max[0] - min[0], max[1] - min[1]];
|
||||
},
|
||||
/**
|
||||
* Get the origin of this data set's boundary.
|
||||
* This is given as a two-element array where the
|
||||
* first element is domain, and second is range.
|
||||
* The domain value here is not adjusted by the domain offset.
|
||||
* @returns {number[]} the origin of this data set's boundary
|
||||
* @memberof platform/features/plot.PlotPreparer#
|
||||
*/
|
||||
getOrigin: function () {
|
||||
return min;
|
||||
},
|
||||
/**
|
||||
* Get the domain offset; this offset will have been subtracted
|
||||
* from all domain values in all buffers returned by this
|
||||
* preparer, in order to minimize loss-of-precision due to
|
||||
* conversion to the 32-bit float format needed by WebGL.
|
||||
* @returns {number} the domain offset
|
||||
* @memberof platform/features/plot.PlotPreparer#
|
||||
*/
|
||||
getDomainOffset: function () {
|
||||
return domainOffset;
|
||||
},
|
||||
/**
|
||||
* Get all renderable buffers for this data set. This will
|
||||
* be returned as an array which can be correlated back to
|
||||
* the provided telemetry data objects (from the constructor
|
||||
* call) by index.
|
||||
*
|
||||
* Internally, these are flattened; each buffer contains a
|
||||
* sequence of alternating domain and range values.
|
||||
*
|
||||
* All domain values in all buffers will have been adjusted
|
||||
* from their original values by subtraction of the domain
|
||||
* offset; this minimizes loss-of-precision resulting from
|
||||
* the conversion to 32-bit floats, which may otherwise
|
||||
* cause aliasing artifacts (particularly for timestamps)
|
||||
*
|
||||
* @returns {Float32Array[]} the buffers for these traces
|
||||
* @memberof platform/features/plot.PlotPreparer#
|
||||
*/
|
||||
getBuffers: function () {
|
||||
return buffers;
|
||||
}
|
||||
};
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.domainOffset = domainOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dimensions which bound all data in the provided
|
||||
* data sets. This is given as a two-element array where the
|
||||
* first element is domain, and second is range.
|
||||
* @returns {number[]} the dimensions which bound this data set
|
||||
*/
|
||||
PlotPreparer.prototype.getDimensions = function () {
|
||||
var max = this.max, min = this.min;
|
||||
return [max[0] - min[0], max[1] - min[1]];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the origin of this data set's boundary.
|
||||
* This is given as a two-element array where the
|
||||
* first element is domain, and second is range.
|
||||
* The domain value here is not adjusted by the domain offset.
|
||||
* @returns {number[]} the origin of this data set's boundary
|
||||
*/
|
||||
PlotPreparer.prototype.getOrigin = function () {
|
||||
return this.min;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the domain offset; this offset will have been subtracted
|
||||
* from all domain values in all buffers returned by this
|
||||
* preparer, in order to minimize loss-of-precision due to
|
||||
* conversion to the 32-bit float format needed by WebGL.
|
||||
* @returns {number} the domain offset
|
||||
*/
|
||||
PlotPreparer.prototype.getDomainOffset = function () {
|
||||
return this.domainOffset;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get all renderable buffers for this data set. This will
|
||||
* be returned as an array which can be correlated back to
|
||||
* the provided telemetry data objects (from the constructor
|
||||
* call) by index.
|
||||
*
|
||||
* Internally, these are flattened; each buffer contains a
|
||||
* sequence of alternating domain and range values.
|
||||
*
|
||||
* All domain values in all buffers will have been adjusted
|
||||
* from their original values by subtraction of the domain
|
||||
* offset; this minimizes loss-of-precision resulting from
|
||||
* the conversion to 32-bit floats, which may otherwise
|
||||
* cause aliasing artifacts (particularly for timestamps)
|
||||
*
|
||||
* @returns {Float32Array[]} the buffers for these traces
|
||||
*/
|
||||
PlotPreparer.prototype.getBuffers = function () {
|
||||
return this.buffers;
|
||||
};
|
||||
|
||||
return PlotPreparer;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user