@kitware/vtk.js 25.6.0 → 25.7.2
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/Common/Core/CellArray.d.ts +20 -8
- package/Common/Core/CellArray.js +25 -6
- package/Common/Core/DataArray.d.ts +159 -15
- package/Common/Core/DataArray.js +181 -26
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/Points.d.ts +6 -5
- package/Common/Core/Points.js +8 -4
- package/Common/DataModel/AbstractPointLocator.d.ts +54 -0
- package/Common/DataModel/AbstractPointLocator.js +40 -0
- package/Common/DataModel/DataSetAttributes/FieldData.d.ts +33 -22
- package/Common/DataModel/DataSetAttributes/FieldData.js +91 -9
- package/Common/DataModel/DataSetAttributes.d.ts +44 -0
- package/Common/DataModel/DataSetAttributes.js +11 -0
- package/Common/DataModel/IncrementalOctreeNode.d.ts +282 -0
- package/Common/DataModel/IncrementalOctreeNode.js +621 -0
- package/Common/DataModel/IncrementalOctreePointLocator.d.ts +61 -0
- package/Common/DataModel/IncrementalOctreePointLocator.js +342 -0
- package/Common/DataModel/Line.js +1 -1
- package/Common/DataModel/Locator.d.ts +43 -0
- package/Common/DataModel/Locator.js +37 -0
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/Polygon/Constants.js +12 -0
- package/Common/DataModel/Polygon.d.ts +38 -4
- package/Common/DataModel/Polygon.js +210 -6
- package/Common/DataModel/Quad/Constants.js +9 -0
- package/Common/DataModel/Quad.d.ts +91 -0
- package/Common/DataModel/Quad.js +235 -0
- package/Common/DataModel/Triangle.d.ts +106 -81
- package/Common/DataModel/Triangle.js +1 -1
- package/Common/Transform/LandmarkTransform.js +1 -1
- package/Filters/Core/PolyDataNormals.js +1 -1
- package/Filters/General/ClipClosedSurface/Constants.js +10 -0
- package/Filters/General/ClipClosedSurface/ccsEdgeLocator.js +40 -0
- package/Filters/General/ClipClosedSurface.d.ts +95 -0
- package/Filters/General/ClipClosedSurface.js +971 -0
- package/Filters/General/ContourTriangulator/Constants.js +6 -0
- package/Filters/General/ContourTriangulator/helper.js +1951 -0
- package/Filters/General/ContourTriangulator.d.ts +122 -0
- package/Filters/General/ContourTriangulator.js +200 -0
- package/Filters/General/ImageMarchingCubes.js +1 -1
- package/Filters/General/MoleculeToRepresentation.js +1 -1
- package/Filters/General/OBBTree.js +1 -1
- package/Filters/General/TubeFilter.js +1 -1
- package/Filters/General/WindowedSincPolyDataFilter.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Rendering/Core/AbstractMapper.d.ts +7 -5
- package/Rendering/Core/AbstractMapper.js +6 -0
- package/Rendering/Core/Camera.js +1 -1
- package/Rendering/Core/CellPicker.js +3 -2
- package/Rendering/Core/Light.js +1 -1
- package/Rendering/Core/Picker.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper.js +1 -1
- package/Rendering/WebGPU/BufferManager.js +1 -1
- package/Widgets/Core/StateBuilder/orientationMixin.js +1 -1
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Manipulators/TrackballManipulator.js +1 -1
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +1 -1
- package/index.d.ts +7 -0
- package/package.json +1 -1
package/Common/Core/Math.js
CHANGED
|
@@ -2,4 +2,4 @@ import '@babel/runtime/helpers/slicedToArray';
|
|
|
2
2
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
3
3
|
import 'seedrandom';
|
|
4
4
|
import '../../macros.js';
|
|
5
|
-
export { ak as LUFactor3x3, al as LUSolve3x3, V as Pi,
|
|
5
|
+
export { ak as LUFactor3x3, al as LUSolve3x3, V as Pi, l as add, S as angleBetweenVectors, Q as areBoundsInitialized, C as areEquals, a as areMatricesEqual, _ as arrayMax, Z as arrayMin, E as arrayRange, a2 as beginCombination, a1 as binomial, aP as boundsIsWithinOtherBounds, W as ceil, $ as ceilLog2, aL as clampAndNormalizeValue, D as clampValue, e as clampVector, aj as columnsToMat3, ai as columnsToMat4, c as computeBoundsFromPoints, U as createArray, O as createUninitializedBounds, k as cross, g as default, B as degreesFromRadians, p as determinant2x2, z as determinant3x3, ay as diagonalize3x3, f as distance2BetweenPoints, d as dot, ab as dot2D, aD as estimateMatrixCondition, aO as extentIsWithinOtherExtent, a0 as factorial, aY as float2CssRGBA, aX as floatRGB2HexCode, aW as floatToHex2, K as floor, a6 as gaussian, ad as gaussianAmplitude, ae as gaussianWeight, aN as getAdjustedScalarRange, F as getMajorAxisIndex, aM as getScalarTypeFittingRange, a5 as getSeed, aG as hex2float, h as hsv2rgb, as as identity, ar as identity3x3, aS as inf, aq as invert3x3, aC as invertMatrix, aU as isFinite, G as isInf, aV as isNaN, i as isNan, R as isPowerOfTwo, w as jacobi, q as jacobiN, J as lab2rgb, aH as lab2xyz, am as linearSolve3x3, aA as luFactorLinearSystem, aB as luSolveLinearSystem, av as matrix3x3ToQuaternion, Y as max, X as min, an as multiply3x3_mat3, P as multiply3x3_vect3, o as multiplyAccumulate, a8 as multiplyAccumulate2D, ao as multiplyMatrix, aw as multiplyQuaternion, x as multiplyScalar, a7 as multiplyScalar2D, N as nearestPowerOfTwo, aT as negInf, a3 as nextCombination, n as norm, ag as norm2D, m as normalize, M as normalize2D, ax as orthogonalize3x3, a9 as outer, af as outer2D, t as perpendiculars, aQ as pointIsWithinBounds, aa as projectVector, ac as projectVector2D, at as quaternionToMatrix3x3, r as radiansFromDegrees, y as random, a4 as randomSeed, H as rgb2hsv, I as rgb2lab, aK as rgb2xyz, L as round, au as roundNumber, b as roundVector, A as rowsToMat3, ah as rowsToMat4, T as signedAngleBetweenVectors, az as singularValueDecomposition3x3, aR as solve3PointCircle, aE as solveHomogeneousLeastSquares, aF as solveLeastSquares, j as solveLinearSystem, s as subtract, ap as transpose3x3, u as uninitializeBounds, aI as xyz2lab, aJ as xyz2rgb } from './Math/index.js';
|
package/Common/Core/Points.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface vtkPoints extends vtkDataArray {
|
|
|
51
51
|
setNumberOfPoints(nbPoints: number, dimension?: number): void;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* Set the (x,y,z)
|
|
54
|
+
* Set the (x,y,z) coordinates of a point based on its index.
|
|
55
55
|
* @param {Number} idx The index of point.
|
|
56
56
|
* @param {Number} x The x coordinate.
|
|
57
57
|
* @param {Number} y The y coordinate.
|
|
@@ -60,11 +60,12 @@ export interface vtkPoints extends vtkDataArray {
|
|
|
60
60
|
setPoint(idx: number, x: number, y: number, z: number): void;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Insert point
|
|
64
|
-
* @param {Number}
|
|
65
|
-
* @param {Number
|
|
63
|
+
* Insert the (x,y,z) coordinates of a point at the next available slot.
|
|
64
|
+
* @param {Number} x The x coordinate.
|
|
65
|
+
* @param {Number} y The y coordinate.
|
|
66
|
+
* @param {Number} z The z coordinate.
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
|
+
insertNextPoint(x: number, y: number, z: number): void;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
/**
|
package/Common/Core/Points.js
CHANGED
|
@@ -25,15 +25,19 @@ function vtkPoints(publicAPI, model) {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
publicAPI.setPoint = function (idx) {
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
for (var i = 0; i < model.numberOfComponents; i++) {
|
|
31
|
-
model.values[offset + i] = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
|
|
28
|
+
for (var _len = arguments.length, xyz = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
29
|
+
xyz[_key - 1] = arguments[_key];
|
|
32
30
|
}
|
|
31
|
+
|
|
32
|
+
publicAPI.setTuple(idx, xyz);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
publicAPI.getPoint = publicAPI.getTuple;
|
|
36
36
|
|
|
37
|
+
publicAPI.insertNextPoint = function (x, y, z) {
|
|
38
|
+
return publicAPI.insertNextTuple([x, y, z]);
|
|
39
|
+
};
|
|
40
|
+
|
|
37
41
|
publicAPI.getBounds = function () {
|
|
38
42
|
if (publicAPI.getNumberOfComponents() === 3) {
|
|
39
43
|
var _xRange = publicAPI.getRange(0);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { vtkObject } from './../../interfaces';
|
|
2
|
+
import { Bounds } from './../../types';
|
|
3
|
+
import { ILocatorInitialValues } from './Locator';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export interface IAbstractPointLocatorInitialValues
|
|
9
|
+
extends ILocatorInitialValues {
|
|
10
|
+
bounds?: Bounds;
|
|
11
|
+
numberOfBuckets: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface vtkAbstractPointLocator extends vtkObject {
|
|
15
|
+
/**
|
|
16
|
+
* Set the bounds of this object.
|
|
17
|
+
* @param {Bounds} input
|
|
18
|
+
*/
|
|
19
|
+
setBounds(input: Bounds): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the bounds of this object.
|
|
23
|
+
* @returns {Bounds}
|
|
24
|
+
*/
|
|
25
|
+
getBounds(): Bounds;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ----------------------------------------------------------------------------
|
|
29
|
+
// Static API
|
|
30
|
+
// ----------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Method use to decorate a given object (publicAPI+model) with vtkAbstractPointLocator characteristics.
|
|
34
|
+
*
|
|
35
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
36
|
+
* @param model object on which data structure will be bounds (protected)
|
|
37
|
+
* @param {IAbstractPointLocatorInitialValues} [initialValues] (default: {})
|
|
38
|
+
*/
|
|
39
|
+
export function extend(
|
|
40
|
+
publicAPI: object,
|
|
41
|
+
model: object,
|
|
42
|
+
initialValues?: IAbstractPointLocatorInitialValues
|
|
43
|
+
): void;
|
|
44
|
+
|
|
45
|
+
// ----------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* vtkAbstractPointLocator
|
|
49
|
+
*/
|
|
50
|
+
export declare const vtkAbstractPointLocator: {
|
|
51
|
+
extend: typeof extend;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default vtkAbstractPointLocator;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import macro from '../../macros.js';
|
|
3
|
+
import vtkLocator from './Locator.js';
|
|
4
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
|
|
9
|
+
function vtkAbstractPointLocator(publicAPI, model) {
|
|
10
|
+
// Set our className
|
|
11
|
+
model.classHierarchy.push('vtkAbstractPointLocator');
|
|
12
|
+
} // ----------------------------------------------------------------------------
|
|
13
|
+
// Object factory
|
|
14
|
+
// ----------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function defaultValues(initialValues) {
|
|
18
|
+
return _objectSpread({
|
|
19
|
+
bounds: null,
|
|
20
|
+
numberOfBuckets: 0
|
|
21
|
+
}, initialValues);
|
|
22
|
+
} // ----------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
function extend(publicAPI, model) {
|
|
26
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
27
|
+
vtkLocator.extend(publicAPI, model, defaultValues(initialValues)); // Make this a VTK object
|
|
28
|
+
|
|
29
|
+
macro.obj(publicAPI, model);
|
|
30
|
+
macro.get(publicAPI, model, ['numberOfBuckets']);
|
|
31
|
+
macro.setGetArray(publicAPI, model, ['bounds'], 6); // Object specific methods
|
|
32
|
+
|
|
33
|
+
vtkAbstractPointLocator(publicAPI, model);
|
|
34
|
+
} // ----------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
var vtkAbstractPointLocator$1 = {
|
|
37
|
+
extend: extend
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { vtkAbstractPointLocator$1 as default, extend };
|
|
@@ -34,9 +34,9 @@ export interface vtkFieldData extends vtkObject {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
*
|
|
37
|
-
* @param other
|
|
37
|
+
* @param {vtkFieldData} other
|
|
38
38
|
*/
|
|
39
|
-
copyStructure(other:
|
|
39
|
+
copyStructure(other: vtkFieldData): void;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Get the number of arrays.
|
|
@@ -50,9 +50,10 @@ export interface vtkFieldData extends vtkObject {
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Add a new array.
|
|
53
|
-
*
|
|
53
|
+
* If an array with the same name already exists, it is replaced instead.
|
|
54
|
+
* @param {vtkDataArray} arr
|
|
54
55
|
*/
|
|
55
|
-
addArray(arr:
|
|
56
|
+
addArray(arr: vtkDataArray): number;
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* Remove all the arrays.
|
|
@@ -60,30 +61,30 @@ export interface vtkFieldData extends vtkObject {
|
|
|
60
61
|
removeAllArrays(): void;
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
|
-
*
|
|
64
|
+
* Remove an array.
|
|
64
65
|
* @param {String} arrayName The name of the array.
|
|
65
66
|
*/
|
|
66
67
|
removeArray(arrayName: string): void;
|
|
67
68
|
|
|
68
69
|
/**
|
|
69
|
-
*
|
|
70
|
+
* Remove an array by its index.
|
|
70
71
|
* @param {Number} arrayIdx The index of the array to remove.
|
|
71
72
|
*/
|
|
72
73
|
removeArrayByIndex(arrayIdx: number): void;
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
|
-
*
|
|
76
|
+
* Get all arrays.
|
|
76
77
|
*/
|
|
77
78
|
getArrays(): any;
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
81
|
*
|
|
81
|
-
* @param arraySpec
|
|
82
|
+
* @param {any} arraySpec
|
|
82
83
|
*/
|
|
83
84
|
getArray(arraySpec: any): void;
|
|
84
85
|
|
|
85
86
|
/**
|
|
86
|
-
*
|
|
87
|
+
* Get an array by its name.
|
|
87
88
|
* @param {String} arrayName The name of the array.
|
|
88
89
|
*/
|
|
89
90
|
getArrayByName(arrayName: string): Nullable<vtkDataArray>;
|
|
@@ -95,19 +96,19 @@ export interface vtkFieldData extends vtkObject {
|
|
|
95
96
|
getArrayWithIndex(arrayName: string): IArrayWithIndex;
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
|
-
*
|
|
99
|
+
* Get an array by its index.
|
|
99
100
|
* @param {Number} idx The index of the array.
|
|
100
101
|
*/
|
|
101
102
|
getArrayByIndex(idx: number): Nullable<any>;
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
|
-
*
|
|
105
|
+
* Return true if there exists an array with the given arraName. False otherwise.
|
|
105
106
|
* @param {String} arrayName The name of the array.
|
|
106
107
|
*/
|
|
107
108
|
hasArray(arrayName: string): boolean;
|
|
108
109
|
|
|
109
110
|
/**
|
|
110
|
-
*
|
|
111
|
+
* Get the name of an array at the given index.
|
|
111
112
|
* @param {Number} idx The index of the array.
|
|
112
113
|
*/
|
|
113
114
|
getArrayName(idx: number): string;
|
|
@@ -118,18 +119,28 @@ export interface vtkFieldData extends vtkObject {
|
|
|
118
119
|
getCopyFieldFlags(): object;
|
|
119
120
|
|
|
120
121
|
/**
|
|
121
|
-
*
|
|
122
|
+
* Get the flag of the array that has the given name.
|
|
122
123
|
* @param {String} arrayName The name of the array.
|
|
123
124
|
*/
|
|
124
125
|
getFlag(arrayName: string): boolean;
|
|
125
126
|
|
|
126
127
|
/**
|
|
127
|
-
*
|
|
128
|
-
* @param other
|
|
129
|
-
* @param fromId
|
|
130
|
-
* @param toId
|
|
128
|
+
* Pass data from one fieldData to another at the given index.
|
|
129
|
+
* @param {vtkFieldData} other
|
|
130
|
+
* @param {Number} [fromId] (default: -1)
|
|
131
|
+
* @param {Number} [toId] (default: -1)
|
|
132
|
+
*/
|
|
133
|
+
passData(other: vtkFieldData, fromId?: number, toId?: number): void;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Works like passData, but interpolates the values between the two given fromIds.
|
|
137
|
+
* @param {vtkFieldData} other
|
|
138
|
+
* @param {Number} [fromId1] (default: -1)
|
|
139
|
+
* @param {Number} [fromId2] (default: -1)
|
|
140
|
+
* @param {Number} [toId] (default: -1)
|
|
141
|
+
* @param {Number} [t] (default: 0.5)
|
|
131
142
|
*/
|
|
132
|
-
|
|
143
|
+
interpolateData(other: vtkFieldData, fromId1?: number, fromId2?: number, toId?: number, t?: number): void;
|
|
133
144
|
|
|
134
145
|
/**
|
|
135
146
|
*
|
|
@@ -160,15 +171,15 @@ export interface vtkFieldData extends vtkObject {
|
|
|
160
171
|
|
|
161
172
|
/**
|
|
162
173
|
*
|
|
163
|
-
* @param other
|
|
174
|
+
* @param {vtkFieldData} other
|
|
164
175
|
*/
|
|
165
|
-
deepCopy(other:
|
|
176
|
+
deepCopy(other: vtkFieldData): void;
|
|
166
177
|
|
|
167
178
|
/**
|
|
168
179
|
*
|
|
169
|
-
* @param other
|
|
180
|
+
* @param {vtkFieldData} other
|
|
170
181
|
*/
|
|
171
|
-
copyFlags(other:
|
|
182
|
+
copyFlags(other: vtkFieldData): void;
|
|
172
183
|
|
|
173
184
|
/**
|
|
174
185
|
* TODO: publicAPI.squeeze = () => model.arrays.forEach(entry => entry.data.squeeze());
|
|
@@ -2,6 +2,8 @@ import vtk from '../../../vtk.js';
|
|
|
2
2
|
import macro from '../../../macros.js';
|
|
3
3
|
import vtkDataArray from '../../Core/DataArray.js';
|
|
4
4
|
|
|
5
|
+
var vtkErrorMacro = macro.vtkErrorMacro,
|
|
6
|
+
vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
|
|
5
7
|
// vtkFieldData methods
|
|
6
8
|
// ----------------------------------------------------------------------------
|
|
7
9
|
|
|
@@ -52,6 +54,19 @@ function vtkFieldData(publicAPI, model) {
|
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
publicAPI.addArray = function (arr) {
|
|
57
|
+
var name = arr.getName();
|
|
58
|
+
|
|
59
|
+
var _publicAPI$getArrayWi = publicAPI.getArrayWithIndex(name),
|
|
60
|
+
array = _publicAPI$getArrayWi.array,
|
|
61
|
+
index = _publicAPI$getArrayWi.index;
|
|
62
|
+
|
|
63
|
+
if (array != null) {
|
|
64
|
+
model.arrays[index] = {
|
|
65
|
+
data: arr
|
|
66
|
+
};
|
|
67
|
+
return index;
|
|
68
|
+
}
|
|
69
|
+
|
|
55
70
|
model.arrays = [].concat(model.arrays, {
|
|
56
71
|
data: arr
|
|
57
72
|
});
|
|
@@ -134,37 +149,104 @@ function vtkFieldData(publicAPI, model) {
|
|
|
134
149
|
|
|
135
150
|
if (!destArr) {
|
|
136
151
|
if (fromId < 0 || fromId > arr.getNumberOfTuples()) {
|
|
152
|
+
// TBD: should this be a deep or a shallow copy?
|
|
137
153
|
publicAPI.addArray(arr);
|
|
154
|
+
other.getAttributes(arr).forEach(function (attrType) {
|
|
155
|
+
publicAPI.setAttribute(arr, attrType);
|
|
156
|
+
});
|
|
138
157
|
} else {
|
|
139
158
|
var ncomps = arr.getNumberOfComponents();
|
|
140
159
|
var newSize = arr.getNumberOfValues();
|
|
141
160
|
var tId = toId > -1 ? toId : fromId;
|
|
142
161
|
|
|
143
|
-
if (newSize
|
|
162
|
+
if (newSize <= tId * ncomps) {
|
|
144
163
|
newSize = (tId + 1) * ncomps;
|
|
145
164
|
}
|
|
146
165
|
|
|
147
166
|
destArr = vtkDataArray.newInstance({
|
|
148
167
|
name: arr.getName(),
|
|
149
168
|
dataType: arr.getDataType(),
|
|
150
|
-
numberOfComponents:
|
|
151
|
-
|
|
169
|
+
numberOfComponents: ncomps,
|
|
170
|
+
values: macro.newTypedArray(arr.getDataType(), newSize),
|
|
171
|
+
size: 0
|
|
152
172
|
});
|
|
153
|
-
destArr.
|
|
173
|
+
destArr.insertTuple(tId, arr.getTuple(fromId));
|
|
154
174
|
publicAPI.addArray(destArr);
|
|
175
|
+
other.getAttributes(arr).forEach(function (attrType) {
|
|
176
|
+
publicAPI.setAttribute(destArr, attrType);
|
|
177
|
+
});
|
|
155
178
|
}
|
|
156
179
|
} else if (arr.getNumberOfComponents() === destArr.getNumberOfComponents()) {
|
|
157
180
|
if (fromId > -1 && fromId < arr.getNumberOfTuples()) {
|
|
158
181
|
var _tId = toId > -1 ? toId : fromId;
|
|
159
182
|
|
|
160
|
-
destArr.
|
|
183
|
+
destArr.insertTuple(_tId, arr.getTuple(fromId));
|
|
184
|
+
} else {
|
|
185
|
+
// if `fromId` is not provided, just copy all (or as much possible)
|
|
186
|
+
// from `arr` to `destArr`.
|
|
187
|
+
destArr.insertTuples(0, arr.getTuples());
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
vtkErrorMacro('Unhandled case in passData');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
publicAPI.interpolateData = function (other) {
|
|
197
|
+
var fromId1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
198
|
+
var fromId2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
199
|
+
var toId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
|
|
200
|
+
var t = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.5;
|
|
201
|
+
other.getArrays().forEach(function (arr) {
|
|
202
|
+
var copyFlag = publicAPI.getFlag(arr.getName());
|
|
203
|
+
|
|
204
|
+
if (copyFlag !== false && !(model.doCopyAllOff && copyFlag !== true) && arr) {
|
|
205
|
+
var destArr = publicAPI.getArrayByName(arr.getName());
|
|
206
|
+
|
|
207
|
+
if (!destArr) {
|
|
208
|
+
if (fromId1 < 0 || fromId2 < 0 || fromId1 > arr.getNumberOfTuples()) {
|
|
209
|
+
// TBD: should this be a deep or a shallow copy?
|
|
210
|
+
publicAPI.addArray(arr);
|
|
211
|
+
other.getAttributes(arr).forEach(function (attrType) {
|
|
212
|
+
publicAPI.setAttribute(arr, attrType);
|
|
213
|
+
});
|
|
161
214
|
} else {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
215
|
+
var ncomps = arr.getNumberOfComponents();
|
|
216
|
+
var newSize = arr.getNumberOfValues(); // TODO: Is this supposed to happen?
|
|
217
|
+
|
|
218
|
+
var tId = toId > -1 ? toId : fromId1;
|
|
219
|
+
|
|
220
|
+
if (newSize <= tId * ncomps) {
|
|
221
|
+
newSize = (tId + 1) * ncomps;
|
|
166
222
|
}
|
|
223
|
+
|
|
224
|
+
destArr = vtkDataArray.newInstance({
|
|
225
|
+
name: arr.getName(),
|
|
226
|
+
dataType: arr.getDataType(),
|
|
227
|
+
numberOfComponents: ncomps,
|
|
228
|
+
values: macro.newTypedArray(arr.getDataType(), newSize),
|
|
229
|
+
size: 0
|
|
230
|
+
});
|
|
231
|
+
destArr.interpolateTuple(tId, arr, fromId1, arr, fromId2, t);
|
|
232
|
+
publicAPI.addArray(destArr);
|
|
233
|
+
other.getAttributes(arr).forEach(function (attrType) {
|
|
234
|
+
publicAPI.setAttribute(destArr, attrType);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
} else if (arr.getNumberOfComponents() === destArr.getNumberOfComponents()) {
|
|
238
|
+
if (fromId1 > -1 && fromId1 < arr.getNumberOfTuples()) {
|
|
239
|
+
var _tId2 = toId > -1 ? toId : fromId1;
|
|
240
|
+
|
|
241
|
+
destArr.interpolateTuple(_tId2, arr, fromId1, arr, fromId2, t);
|
|
242
|
+
vtkWarningMacro('Unexpected case in interpolateData');
|
|
243
|
+
} else {
|
|
244
|
+
// if `fromId` is not provided, just copy all (or as much possible)
|
|
245
|
+
// from `arr` to `destArr`.
|
|
246
|
+
destArr.insertTuples(arr.getTuples());
|
|
167
247
|
}
|
|
248
|
+
} else {
|
|
249
|
+
vtkErrorMacro('Unhandled case in interpolateData');
|
|
168
250
|
}
|
|
169
251
|
}
|
|
170
252
|
});
|
|
@@ -112,6 +112,14 @@ export interface vtkDataSetAttributes extends vtkFieldData {
|
|
|
112
112
|
*/
|
|
113
113
|
getActiveAttribute(attType: string): any;
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Get a list of attribute names that the given array
|
|
117
|
+
* is for this vtkDataSetAttributes.
|
|
118
|
+
* @param {vtkDataArray} arr
|
|
119
|
+
* @returns {String[]}
|
|
120
|
+
*/
|
|
121
|
+
getAttributes(arr: vtkDataArray): string[];
|
|
122
|
+
|
|
115
123
|
/**
|
|
116
124
|
*
|
|
117
125
|
*/
|
|
@@ -360,6 +368,41 @@ export interface vtkDataSetAttributes extends vtkFieldData {
|
|
|
360
368
|
*/
|
|
361
369
|
setPedigreeIds(pedigreeIds: vtkDataArray): boolean;
|
|
362
370
|
|
|
371
|
+
/**
|
|
372
|
+
*
|
|
373
|
+
*/
|
|
374
|
+
copyScalarsOn(): void;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
*
|
|
378
|
+
*/
|
|
379
|
+
copyVectorsOn(): void;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
*
|
|
383
|
+
*/
|
|
384
|
+
copyNormalsOn(): void;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
*
|
|
388
|
+
*/
|
|
389
|
+
copyTCoordsOn(): void;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
*
|
|
393
|
+
*/
|
|
394
|
+
copyTensorsOn(): void;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
*
|
|
398
|
+
*/
|
|
399
|
+
copyGlobalIdsOn(): void;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
*
|
|
403
|
+
*/
|
|
404
|
+
copyPedigreeIdsOn(): void;
|
|
405
|
+
|
|
363
406
|
/**
|
|
364
407
|
*
|
|
365
408
|
*/
|
|
@@ -394,6 +437,7 @@ export interface vtkDataSetAttributes extends vtkFieldData {
|
|
|
394
437
|
*
|
|
395
438
|
*/
|
|
396
439
|
copyPedigreeIdsOff(): void;
|
|
440
|
+
|
|
397
441
|
}
|
|
398
442
|
|
|
399
443
|
/**
|
|
@@ -73,6 +73,12 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
73
73
|
return model["active".concat(attType)];
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
publicAPI.getAttributes = function (arr) {
|
|
77
|
+
return attrTypes.filter(function (attrType) {
|
|
78
|
+
return publicAPI["get".concat(attrType)]() === arr;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
76
82
|
publicAPI.setActiveAttributeByName = function (arrayName, attType) {
|
|
77
83
|
return publicAPI.setActiveAttributeByIndex(publicAPI.getArrayWithIndex(arrayName).index, attType);
|
|
78
84
|
};
|
|
@@ -171,6 +177,11 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
171
177
|
var attType = value.toUpperCase();
|
|
172
178
|
model.copyAttributeFlags[AttributeCopyOperations.PASSDATA][AttributeTypes[attType]] = false;
|
|
173
179
|
};
|
|
180
|
+
|
|
181
|
+
publicAPI["copy".concat(value, "On")] = function () {
|
|
182
|
+
var attType = value.toUpperCase();
|
|
183
|
+
model.copyAttributeFlags[AttributeCopyOperations.PASSDATA][AttributeTypes[attType]] = true;
|
|
184
|
+
};
|
|
174
185
|
});
|
|
175
186
|
|
|
176
187
|
publicAPI.initializeAttributeCopyFlags = function () {
|