@kitware/vtk.js 28.12.2 → 28.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Filters/General/Calculator.js +7 -3
- package/macros2.js +5 -0
- package/package.json +1 -1
|
@@ -41,8 +41,12 @@ function vtkCalculator(publicAPI, model) {
|
|
|
41
41
|
publicAPI.createSimpleFormulaObject = function (locn, arrNames, resultName, singleValueFormula) {
|
|
42
42
|
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
43
43
|
return {
|
|
44
|
-
getArrays:
|
|
45
|
-
input
|
|
44
|
+
getArrays: inData => ({
|
|
45
|
+
// don't augment input data array in case of structured input dataset
|
|
46
|
+
input: inData[0].isA('vtkImageData') ? arrNames.map(x => ({
|
|
47
|
+
location: locn,
|
|
48
|
+
name: x
|
|
49
|
+
})) : publicAPI.augmentInputArrays(locn, arrNames.map(x => ({
|
|
46
50
|
location: locn,
|
|
47
51
|
name: x
|
|
48
52
|
}))),
|
|
@@ -128,7 +132,7 @@ function vtkCalculator(publicAPI, model) {
|
|
|
128
132
|
outData.setPoints(pts);
|
|
129
133
|
arraysOut.push(pts);
|
|
130
134
|
} else {
|
|
131
|
-
const fetchArrayContainer = [[FieldDataTypes.UNIFORM, x => x.getFieldData(), (x, y) => 'tuples' in y ? y.tuples : 0], [FieldDataTypes.POINT, x => x.getPointData(), x => x.
|
|
135
|
+
const fetchArrayContainer = [[FieldDataTypes.UNIFORM, x => x.getFieldData(), (x, y) => 'tuples' in y ? y.tuples : 0], [FieldDataTypes.POINT, x => x.getPointData(), x => x.getNumberOfPoints()], [FieldDataTypes.CELL, x => x.getCellData(), x => x.getNumberOfCells()], [FieldDataTypes.VERTEX, x => x.getVertexData(), x => x.getNumberOfVertices()], [FieldDataTypes.EDGE, x => x.getEdgeData(), x => x.getNumberOfEdges()], [FieldDataTypes.ROW, x => x.getRowData(), x => x.getNumberOfRows()]].reduce((result, value) => {
|
|
132
136
|
result[value[0]] = {
|
|
133
137
|
getData: value[1],
|
|
134
138
|
getSize: value[2]
|
package/macros2.js
CHANGED
|
@@ -154,6 +154,9 @@ function safeArrays(model) {
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
+
function isTypedArray(value) {
|
|
158
|
+
return Object.values(TYPED_ARRAYS).some(ctor => value instanceof ctor);
|
|
159
|
+
}
|
|
157
160
|
|
|
158
161
|
// ----------------------------------------------------------------------------
|
|
159
162
|
// shallow equals
|
|
@@ -346,6 +349,8 @@ function obj() {
|
|
|
346
349
|
jsonArchive[keyName] = jsonArchive[keyName].getState();
|
|
347
350
|
} else if (Array.isArray(jsonArchive[keyName])) {
|
|
348
351
|
jsonArchive[keyName] = jsonArchive[keyName].map(getStateArrayMapFunc);
|
|
352
|
+
} else if (isTypedArray(jsonArchive[keyName])) {
|
|
353
|
+
jsonArchive[keyName] = Array.from(jsonArchive[keyName]);
|
|
349
354
|
}
|
|
350
355
|
});
|
|
351
356
|
|