@kitware/vtk.js 26.9.12 → 26.9.14
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/DataModel/DataSetAttributes/FieldData.js +16 -13
- package/Common/DataModel/DataSetAttributes.js +16 -27
- package/Filters/Core/PolyDataNormals.js +3 -3
- package/Interaction/Style/InteractorStyleImage.d.ts +107 -0
- package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +170 -0
- package/Interaction/Widgets/OrientationMarkerWidget.js +4 -10
- package/Rendering/OpenGL/Texture.js +18 -33
- package/Widgets/Manipulators/AbstractManipulator.d.ts +1 -1
- package/Widgets/Representations/GlyphRepresentation.js +2 -2
- package/Widgets/Representations/WidgetRepresentation.js +28 -33
- package/Widgets/Widgets3D/AngleWidget.js +8 -12
- package/index.d.ts +2 -0
- package/macros.js +21 -0
- package/package.json +1 -1
|
@@ -78,15 +78,20 @@ function vtkFieldData(publicAPI, model) {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
publicAPI.removeArray = function (arrayName) {
|
|
81
|
-
|
|
82
|
-
return
|
|
81
|
+
var index = model.arrays.findIndex(function (array) {
|
|
82
|
+
return array.getName() === arrayName;
|
|
83
83
|
});
|
|
84
|
+
return publicAPI.removeArrayByIndex(index);
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
publicAPI.removeArrayByIndex = function (arrayIdx) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (arrayIdx !== -1 && arrayIdx < model.arrays.length) {
|
|
89
|
+
model.arrays.splice(arrayIdx, 1); // TBD modified() ?
|
|
90
|
+
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return false;
|
|
90
95
|
};
|
|
91
96
|
|
|
92
97
|
publicAPI.getArrays = function () {
|
|
@@ -106,15 +111,13 @@ function vtkFieldData(publicAPI, model) {
|
|
|
106
111
|
};
|
|
107
112
|
|
|
108
113
|
publicAPI.getArrayWithIndex = function (arrayName) {
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
-
array: b.data,
|
|
112
|
-
index: i
|
|
113
|
-
} : a;
|
|
114
|
-
}, {
|
|
115
|
-
array: null,
|
|
116
|
-
index: -1
|
|
114
|
+
var index = model.arrays.findIndex(function (array) {
|
|
115
|
+
return array.data.getName() === arrayName;
|
|
117
116
|
});
|
|
117
|
+
return {
|
|
118
|
+
array: index !== -1 ? model.arrays[index].data : null,
|
|
119
|
+
index: index
|
|
120
|
+
};
|
|
118
121
|
};
|
|
119
122
|
|
|
120
123
|
publicAPI.getArrayByIndex = function (idx) {
|
|
@@ -34,6 +34,8 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
34
34
|
|
|
35
35
|
model.classHierarchy.push('vtkDataSetAttributes');
|
|
36
36
|
|
|
37
|
+
var superClass = _objectSpread({}, publicAPI);
|
|
38
|
+
|
|
37
39
|
publicAPI.checkNumberOfComponents = function (x) {
|
|
38
40
|
return true;
|
|
39
41
|
}; // TODO
|
|
@@ -57,7 +59,8 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
57
59
|
if (currentAttribute >= 0 && currentAttribute < model.arrays.length) {
|
|
58
60
|
if (model.arrays[currentAttribute] === arr) {
|
|
59
61
|
return currentAttribute;
|
|
60
|
-
}
|
|
62
|
+
} // FIXME setting an array actually changes its index
|
|
63
|
+
|
|
61
64
|
|
|
62
65
|
publicAPI.removeArrayByIndex(currentAttribute);
|
|
63
66
|
}
|
|
@@ -123,39 +126,25 @@ function vtkDataSetAttributes(publicAPI, model) {
|
|
|
123
126
|
|
|
124
127
|
|
|
125
128
|
publicAPI.removeAllArrays = function () {
|
|
126
|
-
model.arrays = [];
|
|
127
129
|
attrTypes.forEach(function (attType) {
|
|
128
130
|
model["active".concat(attType)] = -1;
|
|
129
131
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
publicAPI.removeArray = function (arrayName) {
|
|
134
|
-
model.arrays = model.arrays.filter(function (entry, idx) {
|
|
135
|
-
if (arrayName === entry.data.getName()) {
|
|
136
|
-
// Found the array to remove, but is it an active attribute?
|
|
137
|
-
attrTypes.forEach(function (attType) {
|
|
138
|
-
if (idx === model["active".concat(attType)]) {
|
|
139
|
-
model["active".concat(attType)] = -1;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return true;
|
|
146
|
-
});
|
|
132
|
+
superClass.removeAllArrays();
|
|
147
133
|
}; // Override to allow proper handling of active attributes
|
|
148
134
|
|
|
149
135
|
|
|
150
136
|
publicAPI.removeArrayByIndex = function (arrayIdx) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
137
|
+
if (arrayIdx !== -1) {
|
|
138
|
+
attrTypes.forEach(function (attType) {
|
|
139
|
+
if (arrayIdx === model["active".concat(attType)]) {
|
|
140
|
+
model["active".concat(attType)] = -1;
|
|
141
|
+
} else if (arrayIdx < model["active".concat(attType)]) {
|
|
142
|
+
model["active".concat(attType)] -= 1;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return superClass.removeArrayByIndex(arrayIdx);
|
|
159
148
|
};
|
|
160
149
|
|
|
161
150
|
attrTypes.forEach(function (value) {
|
|
@@ -79,14 +79,14 @@ function vtkPolyDataNormals(publicAPI, model) {
|
|
|
79
79
|
numberOfComponents: 3,
|
|
80
80
|
values: outputNormalsData
|
|
81
81
|
});
|
|
82
|
-
output.setPointData(input.getPointData());
|
|
83
|
-
output.setCellData(input.getCellData());
|
|
84
|
-
output.setFieldData(input.getFieldData());
|
|
85
82
|
output.setPoints(input.getPoints());
|
|
86
83
|
output.setVerts(input.getVerts());
|
|
87
84
|
output.setLines(input.getLines());
|
|
88
85
|
output.setPolys(input.getPolys());
|
|
89
86
|
output.setStrips(input.getStrips());
|
|
87
|
+
output.getPointData().passData(input.getPointData());
|
|
88
|
+
output.getCellData().passData(input.getCellData());
|
|
89
|
+
output.getFieldData().passData(input.getFieldData());
|
|
90
90
|
output.getPointData().setNormals(outputNormals);
|
|
91
91
|
outData[0] = output;
|
|
92
92
|
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from './../../types';
|
|
2
|
+
import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
3
|
+
import vtkImageProperty from './../../Rendering/Core/ImageProperty';
|
|
4
|
+
import vtkInteractorStyleTrackballCamera from './InteractorStyleTrackballCamera';
|
|
5
|
+
|
|
6
|
+
export interface vtkInteractorStyleImage extends vtkInteractorStyleTrackballCamera {
|
|
7
|
+
/**
|
|
8
|
+
* Handles a mouse move.
|
|
9
|
+
* @param callData event data
|
|
10
|
+
*/
|
|
11
|
+
handleMouseMove(callData: unknown): void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Handles a left button press event.
|
|
15
|
+
* @param callData event data
|
|
16
|
+
*/
|
|
17
|
+
handleLeftButtonPress(callData: unknown): void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Handles a left button release event.
|
|
21
|
+
* @param callData event data
|
|
22
|
+
*/
|
|
23
|
+
handleLeftButtonRelease(callData: unknown): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Handles the start of a wheel event.
|
|
27
|
+
* @param callData event data
|
|
28
|
+
*/
|
|
29
|
+
handleStartMouseWheel(callData: unknown): void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Handles the end of a wheel event.
|
|
33
|
+
* @param callData event data
|
|
34
|
+
*/
|
|
35
|
+
handleEndMouseWheel(callData: unknown): void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Handles a wheel event.
|
|
39
|
+
* @param callData event data
|
|
40
|
+
*/
|
|
41
|
+
handleMouseWheel(callData: unknown): void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Set window level from position.
|
|
45
|
+
* @param renderer the renderer
|
|
46
|
+
* @param position the display position
|
|
47
|
+
*/
|
|
48
|
+
windowLevel(renderer: vtkRenderer, position: { x: number, y: number }): void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Set slice from position.
|
|
52
|
+
* @param renderer the renderer
|
|
53
|
+
* @param position the display position
|
|
54
|
+
*/
|
|
55
|
+
slice(renderer: vtkRenderer, position: { x: number, y: number }): void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Sets the current image property.
|
|
59
|
+
*
|
|
60
|
+
* This is a way of dealing with images as if they were layers.
|
|
61
|
+
* It looks through the renderer's list of props and sets the
|
|
62
|
+
* interactor ivars from the Nth image that it finds. You can
|
|
63
|
+
* also use negative numbers, i.e. -1 will return the last image,
|
|
64
|
+
* -2 will return the second-to-last image, etc.
|
|
65
|
+
* @param i image number
|
|
66
|
+
*/
|
|
67
|
+
setCurrentImageNumber(i: number): boolean;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Sets the current image property.
|
|
71
|
+
* @param imageProperty image property
|
|
72
|
+
*/
|
|
73
|
+
setCurrentImageProperty(imageProperty: vtkImageProperty): boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface IInteractorStyleImageInitialValues {
|
|
77
|
+
windowLevelStartPosition: Vector2;
|
|
78
|
+
windowLevelCurrentPosition: Vector2;
|
|
79
|
+
lastSlicePosition: number;
|
|
80
|
+
windowLevelInitial: Vector2;
|
|
81
|
+
// currentImageProperty: null;
|
|
82
|
+
currentImageNumber: number;
|
|
83
|
+
interactionMode: 'IMAGE2D' | 'IMAGE3D' | 'IMAGE_SLICING';
|
|
84
|
+
xViewRightVector: Vector3;
|
|
85
|
+
xViewUpVector: Vector3;
|
|
86
|
+
yViewRightVector: Vector3;
|
|
87
|
+
yViewUpVector: Vector3;
|
|
88
|
+
zViewRightVector: Vector3;
|
|
89
|
+
zViewUpVector: Vector3;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function newInstance(
|
|
93
|
+
initialValues?: IInteractorStyleImageInitialValues
|
|
94
|
+
): vtkInteractorStyleImage;
|
|
95
|
+
|
|
96
|
+
export function extend(
|
|
97
|
+
publicAPI: object,
|
|
98
|
+
model: object,
|
|
99
|
+
initialValues?: IInteractorStyleImageInitialValues
|
|
100
|
+
): void;
|
|
101
|
+
|
|
102
|
+
export const vtkInteractorStyleImage: {
|
|
103
|
+
newInstance: typeof newInstance;
|
|
104
|
+
extend: typeof extend;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default vtkInteractorStyleImage;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import vtkInteractorStyle from './../../Rendering/Core/InteractorStyle';
|
|
2
|
+
import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
3
|
+
|
|
4
|
+
export interface vtkInteractorStyleTrackballCamera extends vtkInteractorStyle {
|
|
5
|
+
/**
|
|
6
|
+
* Handles a mouse move.
|
|
7
|
+
* @param callData event data
|
|
8
|
+
*/
|
|
9
|
+
handleMouseMove(callData: unknown): void;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handles a 3D button event.
|
|
13
|
+
* @param callData event data
|
|
14
|
+
*/
|
|
15
|
+
handleButton3D(ed: unknown): void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Handles a 3D move event.
|
|
19
|
+
* @param ed event data
|
|
20
|
+
*/
|
|
21
|
+
handleMove3D(ed: unknown): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Update camera pose
|
|
25
|
+
* @param ed event data
|
|
26
|
+
*/
|
|
27
|
+
updateCameraPose(ed: unknown): void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Handles a left button press event.
|
|
31
|
+
* @param callData event data
|
|
32
|
+
*/
|
|
33
|
+
handleLeftButtonPress(callData: unknown): void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Handles a left button release event.
|
|
37
|
+
* @param callData event data
|
|
38
|
+
*/
|
|
39
|
+
handleLeftButtonRelease(callData: unknown): void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Handles the start of a wheel event.
|
|
43
|
+
* @param callData event data
|
|
44
|
+
*/
|
|
45
|
+
handleStartMouseWheel(callData: unknown): void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Handles the end of a wheel event.
|
|
49
|
+
* @param callData event data
|
|
50
|
+
*/
|
|
51
|
+
handleEndMouseWheel(callData: unknown): void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Handles the start of a pinch gesture.
|
|
55
|
+
* @param callData event data
|
|
56
|
+
*/
|
|
57
|
+
handleStartPinch(callData: unknown): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Handles the end of a pinch gesture.
|
|
61
|
+
* @param callData event data
|
|
62
|
+
*/
|
|
63
|
+
handleEndPinch(callData: unknown): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Handles the start of a rotate gesture.
|
|
67
|
+
* @param callData event data
|
|
68
|
+
*/
|
|
69
|
+
handleStartRotate(callData: unknown): void;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Handles the end of a rotate gesture.
|
|
73
|
+
* @param callData event data
|
|
74
|
+
*/
|
|
75
|
+
handleEndRotate(callData: unknown): void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Handles the start of a pan gesture.
|
|
79
|
+
* @param callData event data
|
|
80
|
+
*/
|
|
81
|
+
handleStartPan(callData: unknown): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Handles the end of a pan gesture.
|
|
85
|
+
* @param callData event data
|
|
86
|
+
*/
|
|
87
|
+
handleEndPan(callData: unknown): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Handles a pinch gesture.
|
|
91
|
+
* @param callData event data
|
|
92
|
+
*/
|
|
93
|
+
handlePinch(callData: unknown): void;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Handles a pan gesture.
|
|
97
|
+
* @param callData event data
|
|
98
|
+
*/
|
|
99
|
+
handlePan(callData: unknown): void;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Handles a rotate gesture.
|
|
103
|
+
* @param callData event data
|
|
104
|
+
*/
|
|
105
|
+
handleRotate(callData: unknown): void;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Handles rotate with a mouse.
|
|
109
|
+
* @param renderer the renderer
|
|
110
|
+
* @param position the display position
|
|
111
|
+
*/
|
|
112
|
+
handleMouseRotate(renderer: vtkRenderer, position: { x: number, y: number }): void;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Handles spin with a mouse.
|
|
116
|
+
* @param renderer the renderer
|
|
117
|
+
* @param position the display position
|
|
118
|
+
*/
|
|
119
|
+
handleMouseSpin(renderer: vtkRenderer, position: { x: number, y: number }): void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Handles pan with a mouse.
|
|
123
|
+
* @param renderer the renderer
|
|
124
|
+
* @param position the display position
|
|
125
|
+
*/
|
|
126
|
+
handleMousePan(renderer: vtkRenderer, position: { x: number, y: number }): void;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Handles dolly with a mouse.
|
|
130
|
+
* @param renderer the renderer
|
|
131
|
+
* @param position the display position
|
|
132
|
+
*/
|
|
133
|
+
handleMouseDolly(renderer: vtkRenderer, position: { x: number, y: number }): void;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Handles a wheel event.
|
|
137
|
+
* @param callData event data
|
|
138
|
+
*/
|
|
139
|
+
handleMouseWheel(callData: unknown): void;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Dolly by factor.
|
|
143
|
+
* @param renderer the renderer
|
|
144
|
+
* @param factor factor
|
|
145
|
+
*/
|
|
146
|
+
dollyByFactor(renderer: vtkRenderer, factor: number): void;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface IInteractorStyleTrackballCameraInitialValues {
|
|
150
|
+
motionFactor: number;
|
|
151
|
+
zoomFactor: number;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function newInstance(
|
|
155
|
+
initialValues?: IInteractorStyleTrackballCameraInitialValues
|
|
156
|
+
): vtkInteractorStyleTrackballCamera;
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
export function extend(
|
|
160
|
+
publicAPI: object,
|
|
161
|
+
model: object,
|
|
162
|
+
initialValues?: IInteractorStyleTrackballCameraInitialValues
|
|
163
|
+
): void;
|
|
164
|
+
|
|
165
|
+
export const vtkInteractorStyleTrackballCamera: {
|
|
166
|
+
newInstance: typeof newInstance;
|
|
167
|
+
extend: typeof extend;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export default vtkInteractorStyleTrackballCamera;
|
|
@@ -38,6 +38,10 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
model._onParentRendererChanged = function () {
|
|
42
|
+
return publicAPI.updateViewport();
|
|
43
|
+
};
|
|
44
|
+
|
|
41
45
|
publicAPI.computeViewport = function () {
|
|
42
46
|
var parentRen = model.parentRenderer || model._interactor.getCurrentRenderer();
|
|
43
47
|
|
|
@@ -237,16 +241,6 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
237
241
|
publicAPI.setEnabled(previousState);
|
|
238
242
|
};
|
|
239
243
|
|
|
240
|
-
publicAPI.setParentRenderer = function (ren) {
|
|
241
|
-
var changed = superClass.setParentRenderer(ren);
|
|
242
|
-
|
|
243
|
-
if (changed) {
|
|
244
|
-
publicAPI.updateViewport();
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return changed;
|
|
248
|
-
};
|
|
249
|
-
|
|
250
244
|
publicAPI.getRenderer = function () {
|
|
251
245
|
return selfRenderer;
|
|
252
246
|
};
|
|
@@ -2,7 +2,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import Constants from './Texture/Constants.js';
|
|
3
3
|
import HalfFloat from '../../Common/Core/HalfFloat.js';
|
|
4
4
|
import { newInstance as newInstance$1, obj, set, setGet, get, moveToProtected, newTypedArray, vtkDebugMacro as vtkDebugMacro$1, vtkErrorMacro as vtkErrorMacro$1, vtkWarningMacro as vtkWarningMacro$1 } from '../../macros.js';
|
|
5
|
-
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
5
|
+
import vtkDataArray, { STATIC } from '../../Common/Core/DataArray.js';
|
|
6
6
|
import { Q as isPowerOfTwo, M as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
|
|
7
7
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
8
8
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
@@ -1013,36 +1013,21 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1013
1013
|
var max = [];
|
|
1014
1014
|
|
|
1015
1015
|
for (var c = 0; c < numComps; ++c) {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
var count = 0;
|
|
1021
|
-
|
|
1022
|
-
for (var i = 0; i < numPixelsIn; ++i) {
|
|
1023
|
-
for (var _c = 0; _c < numComps; ++_c) {
|
|
1024
|
-
if (data[count] < min[_c]) {
|
|
1025
|
-
min[_c] = data[count];
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
if (data[count] > max[_c]) {
|
|
1029
|
-
max[_c] = data[count];
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
count++;
|
|
1033
|
-
}
|
|
1016
|
+
var range = STATIC.fastComputeRange(data, c, numComps);
|
|
1017
|
+
min[c] = range.min;
|
|
1018
|
+
max[c] = range.max;
|
|
1034
1019
|
}
|
|
1035
1020
|
|
|
1036
1021
|
var offset = [];
|
|
1037
1022
|
var scale = [];
|
|
1038
1023
|
|
|
1039
|
-
for (var
|
|
1040
|
-
if (min[
|
|
1041
|
-
max[
|
|
1024
|
+
for (var _c = 0; _c < numComps; ++_c) {
|
|
1025
|
+
if (min[_c] === max[_c]) {
|
|
1026
|
+
max[_c] = min[_c] + 1.0;
|
|
1042
1027
|
}
|
|
1043
1028
|
|
|
1044
|
-
offset[
|
|
1045
|
-
scale[
|
|
1029
|
+
offset[_c] = min[_c];
|
|
1030
|
+
scale[_c] = max[_c] - min[_c];
|
|
1046
1031
|
}
|
|
1047
1032
|
|
|
1048
1033
|
return {
|
|
@@ -1188,16 +1173,16 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1188
1173
|
|
|
1189
1174
|
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1190
1175
|
if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.SHORT) {
|
|
1191
|
-
for (var
|
|
1192
|
-
model.volumeInfo.scale[
|
|
1176
|
+
for (var _c2 = 0; _c2 < numComps; ++_c2) {
|
|
1177
|
+
model.volumeInfo.scale[_c2] = 32767.0;
|
|
1193
1178
|
}
|
|
1194
1179
|
|
|
1195
1180
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1196
1181
|
}
|
|
1197
1182
|
|
|
1198
1183
|
if (model.oglNorm16Ext && !model.useHalfFloat && dataType === VtkDataTypes.UNSIGNED_SHORT) {
|
|
1199
|
-
for (var
|
|
1200
|
-
model.volumeInfo.scale[
|
|
1184
|
+
for (var _c3 = 0; _c3 < numComps; ++_c3) {
|
|
1185
|
+
model.volumeInfo.scale[_c3] = 65535.0;
|
|
1201
1186
|
}
|
|
1202
1187
|
|
|
1203
1188
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
@@ -1208,8 +1193,8 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1208
1193
|
}
|
|
1209
1194
|
|
|
1210
1195
|
if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
|
|
1211
|
-
for (var
|
|
1212
|
-
model.volumeInfo.scale[
|
|
1196
|
+
for (var _c4 = 0; _c4 < numComps; ++_c4) {
|
|
1197
|
+
model.volumeInfo.scale[_c4] = 255.0;
|
|
1213
1198
|
}
|
|
1214
1199
|
|
|
1215
1200
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
@@ -1248,9 +1233,9 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1248
1233
|
var dataTypeToUse = VtkDataTypes.UNSIGNED_CHAR; // unsigned char gets used as is
|
|
1249
1234
|
|
|
1250
1235
|
if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
|
|
1251
|
-
for (var
|
|
1252
|
-
res.offset[
|
|
1253
|
-
res.scale[
|
|
1236
|
+
for (var _c5 = 0; _c5 < numComps; ++_c5) {
|
|
1237
|
+
res.offset[_c5] = 0.0;
|
|
1238
|
+
res.scale[_c5] = 255.0;
|
|
1254
1239
|
}
|
|
1255
1240
|
} else if (model.context.getExtension('OES_texture_float') && model.context.getExtension('OES_texture_float_linear')) {
|
|
1256
1241
|
// use float textures scaled to 0.0 to 1.0
|
|
@@ -58,7 +58,7 @@ export interface vtkAbstractManipulator extends vtkObject {
|
|
|
58
58
|
/* ------------------------------------------------------------------- */
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* Set the user normal.
|
|
61
|
+
* Set the user normal.
|
|
62
62
|
* This normal take precedence on the handleNormal and the widgetNormal.
|
|
63
63
|
* This normal should not be set within the widget internal code.
|
|
64
64
|
* @param {Vector3} normal The normal coordinate.
|
|
@@ -201,9 +201,9 @@ function vtkGlyphRepresentation(publicAPI, model) {
|
|
|
201
201
|
publicAPI.getRepresentationStates = function () {
|
|
202
202
|
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
|
|
203
203
|
return superClass.getRepresentationStates(input).filter(function (state) {
|
|
204
|
-
var _state$getOrigin, _state$isVisible;
|
|
204
|
+
var _state$getOrigin, _state$isVisible, _state$isVisible2;
|
|
205
205
|
|
|
206
|
-
return ((_state$getOrigin = state.getOrigin) === null || _state$getOrigin === void 0 ? void 0 : _state$getOrigin.call(state)) && ((_state$isVisible = state.isVisible) === null || _state$
|
|
206
|
+
return ((_state$getOrigin = state.getOrigin) === null || _state$getOrigin === void 0 ? void 0 : _state$getOrigin.call(state)) && ((_state$isVisible = (_state$isVisible2 = state.isVisible) === null || _state$isVisible2 === void 0 ? void 0 : _state$isVisible2.call(state)) !== null && _state$isVisible !== void 0 ? _state$isVisible : true);
|
|
207
207
|
});
|
|
208
208
|
}; // --------------------------------------------------------------------------
|
|
209
209
|
|
|
@@ -16,6 +16,25 @@ var vtkErrorMacro = macro.vtkErrorMacro,
|
|
|
16
16
|
vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
|
|
17
17
|
|
|
18
18
|
var STYLE_CATEGORIES = ['active', 'inactive', 'static'];
|
|
19
|
+
|
|
20
|
+
function applyCoincidentTopologyParametersToMapper(mapper, parameters) {
|
|
21
|
+
if (mapper && mapper.setResolveCoincidentTopologyToPolygonOffset) {
|
|
22
|
+
mapper.setResolveCoincidentTopologyToPolygonOffset();
|
|
23
|
+
CATEGORIES.forEach(function (category) {
|
|
24
|
+
if (parameters[category]) {
|
|
25
|
+
var methodName = "setRelativeCoincidentTopology".concat(category, "OffsetParameters");
|
|
26
|
+
|
|
27
|
+
if (mapper[methodName]) {
|
|
28
|
+
var _parameters$category = parameters[category],
|
|
29
|
+
factor = _parameters$category.factor,
|
|
30
|
+
offset = _parameters$category.offset;
|
|
31
|
+
mapper[methodName](factor, offset);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
19
38
|
function mergeStyles(elementNames) {
|
|
20
39
|
for (var _len = arguments.length, stylesToMerge = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
21
40
|
stylesToMerge[_key - 1] = arguments[_key];
|
|
@@ -151,16 +170,20 @@ function allocateArray(polyData, name, numberOfTuples, dataType, numberOfCompone
|
|
|
151
170
|
|
|
152
171
|
function vtkWidgetRepresentation(publicAPI, model) {
|
|
153
172
|
// Set our className
|
|
154
|
-
model.classHierarchy.push('vtkWidgetRepresentation');
|
|
155
|
-
|
|
156
|
-
var superclass = _objectSpread({}, publicAPI); // Internal cache
|
|
157
|
-
|
|
173
|
+
model.classHierarchy.push('vtkWidgetRepresentation'); // Internal cache
|
|
158
174
|
|
|
159
175
|
var cache = {
|
|
160
176
|
mtimes: {},
|
|
161
177
|
states: []
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
model._onCoincidentTopologyParametersChanged = function () {
|
|
181
|
+
publicAPI.getActors().forEach(function (actor) {
|
|
182
|
+
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
183
|
+
});
|
|
162
184
|
}; // --------------------------------------------------------------------------
|
|
163
185
|
|
|
186
|
+
|
|
164
187
|
publicAPI.getActors = function () {
|
|
165
188
|
return model.actors;
|
|
166
189
|
};
|
|
@@ -245,25 +268,7 @@ function vtkWidgetRepresentation(publicAPI, model) {
|
|
|
245
268
|
model.alwaysVisibleActors[_i].setVisibility(true);
|
|
246
269
|
}
|
|
247
270
|
}
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
function applyCoincidentTopologyParametersToMapper(mapper, parameters) {
|
|
251
|
-
if (mapper && mapper.setResolveCoincidentTopologyToPolygonOffset) {
|
|
252
|
-
mapper.setResolveCoincidentTopologyToPolygonOffset();
|
|
253
|
-
CATEGORIES.forEach(function (category) {
|
|
254
|
-
if (parameters[category]) {
|
|
255
|
-
var methodName = "setRelativeCoincidentTopology".concat(category, "OffsetParameters");
|
|
256
|
-
|
|
257
|
-
if (mapper[methodName]) {
|
|
258
|
-
var _parameters$category = parameters[category],
|
|
259
|
-
factor = _parameters$category.factor,
|
|
260
|
-
offset = _parameters$category.offset;
|
|
261
|
-
mapper[methodName](factor, offset);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
} // Add warning to model.actors.push
|
|
271
|
+
}; // Add warning to model.actors.push
|
|
267
272
|
|
|
268
273
|
|
|
269
274
|
model.actors.push = function () {
|
|
@@ -281,16 +286,6 @@ function vtkWidgetRepresentation(publicAPI, model) {
|
|
|
281
286
|
publicAPI.addActor = function (actor) {
|
|
282
287
|
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
283
288
|
Array.prototype.push.apply(model.actors, [actor]);
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
publicAPI.setCoincidentTopologyParameters = function (parameters) {
|
|
287
|
-
var modified = superclass.setCoincidentTopologyParameters(parameters);
|
|
288
|
-
|
|
289
|
-
if (modified) {
|
|
290
|
-
publicAPI.getActors().forEach(function (actor) {
|
|
291
|
-
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
289
|
}; // Make sure setting the labels at build time works with string/array...
|
|
295
290
|
|
|
296
291
|
|
|
@@ -16,13 +16,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
// ----------------------------------------------------------------------------
|
|
17
17
|
|
|
18
18
|
function vtkAngleWidget(publicAPI, model) {
|
|
19
|
-
model.classHierarchy.push('vtkAngleWidget');
|
|
20
|
-
|
|
21
|
-
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
22
|
-
|
|
19
|
+
model.classHierarchy.push('vtkAngleWidget'); // --- Widget Requirement ---------------------------------------------------
|
|
23
20
|
|
|
24
21
|
model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
|
|
25
22
|
|
|
23
|
+
model._onManipulatorChanged = function () {
|
|
24
|
+
model.widgetState.getMoveHandle().setManipulator(model.manipulator);
|
|
25
|
+
model.widgetState.getHandleList().forEach(function (handle) {
|
|
26
|
+
handle.setManipulator(model.manipulator);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
27
31
|
switch (viewType) {
|
|
28
32
|
case ViewTypes.DEFAULT:
|
|
@@ -58,14 +62,6 @@ function vtkAngleWidget(publicAPI, model) {
|
|
|
58
62
|
subtract(handles[0].getOrigin(), handles[1].getOrigin(), vec1);
|
|
59
63
|
subtract(handles[2].getOrigin(), handles[1].getOrigin(), vec2);
|
|
60
64
|
return angleBetweenVectors(vec1, vec2);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
publicAPI.setManipulator = function (manipulator) {
|
|
64
|
-
superClass.setManipulator(manipulator);
|
|
65
|
-
model.widgetState.getMoveHandle().setManipulator(manipulator);
|
|
66
|
-
model.widgetState.getHandleList().forEach(function (handle) {
|
|
67
|
-
handle.setManipulator(manipulator);
|
|
68
|
-
});
|
|
69
65
|
}; // --------------------------------------------------------------------------
|
|
70
66
|
// initialization
|
|
71
67
|
// --------------------------------------------------------------------------
|
package/index.d.ts
CHANGED
|
@@ -117,7 +117,9 @@
|
|
|
117
117
|
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts" />
|
|
118
118
|
/// <reference path="./Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts" />
|
|
119
119
|
/// <reference path="./Interaction/Manipulators/MouseRangeManipulator.d.ts" />
|
|
120
|
+
/// <reference path="./Interaction/Style/InteractorStyleImage.d.ts" />
|
|
120
121
|
/// <reference path="./Interaction/Style/InteractorStyleManipulator.d.ts" />
|
|
122
|
+
/// <reference path="./Interaction/Style/InteractorStyleTrackballCamera.d.ts" />
|
|
121
123
|
/// <reference path="./Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts" />
|
|
122
124
|
/// <reference path="./Interaction/Widgets/OrientationMarkerWidget.d.ts" />
|
|
123
125
|
/// <reference path="./Proxy/Core/AbstractRepresentationProxy.d.ts" />
|
package/macros.js
CHANGED
|
@@ -480,6 +480,7 @@ function get(publicAPI, model, fieldNames) {
|
|
|
480
480
|
|
|
481
481
|
var objectSetterMap = {
|
|
482
482
|
enum: function _enum(publicAPI, model, field) {
|
|
483
|
+
var onChanged = "_on".concat(_capitalize(field.name), "Changed");
|
|
483
484
|
return function (value) {
|
|
484
485
|
if (typeof value === 'string') {
|
|
485
486
|
if (field.enum[value] !== undefined) {
|
|
@@ -501,7 +502,11 @@ var objectSetterMap = {
|
|
|
501
502
|
if (Object.keys(field.enum).map(function (key) {
|
|
502
503
|
return field.enum[key];
|
|
503
504
|
}).indexOf(value) !== -1) {
|
|
505
|
+
var _model$onChanged;
|
|
506
|
+
|
|
507
|
+
var previousValue = model[field.name];
|
|
504
508
|
model[field.name] = value;
|
|
509
|
+
(_model$onChanged = model[onChanged]) === null || _model$onChanged === void 0 ? void 0 : _model$onChanged.call(model, publicAPI, model, value, previousValue);
|
|
505
510
|
publicAPI.modified();
|
|
506
511
|
return true;
|
|
507
512
|
}
|
|
@@ -518,9 +523,14 @@ var objectSetterMap = {
|
|
|
518
523
|
};
|
|
519
524
|
},
|
|
520
525
|
object: function object(publicAPI, model, field) {
|
|
526
|
+
var onChanged = "_on".concat(_capitalize(field.name), "Changed");
|
|
521
527
|
return function (value) {
|
|
522
528
|
if (!DeepEqual(model[field.name], value)) {
|
|
529
|
+
var _model$onChanged2;
|
|
530
|
+
|
|
531
|
+
var previousValue = model[field.name];
|
|
523
532
|
model[field.name] = value;
|
|
533
|
+
(_model$onChanged2 = model[onChanged]) === null || _model$onChanged2 === void 0 ? void 0 : _model$onChanged2.call(model, publicAPI, model, value, previousValue);
|
|
524
534
|
publicAPI.modified();
|
|
525
535
|
return true;
|
|
526
536
|
}
|
|
@@ -545,6 +555,7 @@ function findSetter(field) {
|
|
|
545
555
|
}
|
|
546
556
|
|
|
547
557
|
return function getSetter(publicAPI, model) {
|
|
558
|
+
var onChanged = "_on".concat(_capitalize(field), "Changed");
|
|
548
559
|
return function setter(value) {
|
|
549
560
|
if (model.deleted) {
|
|
550
561
|
vtkErrorMacro('instance deleted - cannot call any method');
|
|
@@ -552,7 +563,11 @@ function findSetter(field) {
|
|
|
552
563
|
}
|
|
553
564
|
|
|
554
565
|
if (model[field] !== value) {
|
|
566
|
+
var _model$onChanged3;
|
|
567
|
+
|
|
568
|
+
var previousValue = model[field.name];
|
|
555
569
|
model[field] = value;
|
|
570
|
+
(_model$onChanged3 = model[onChanged]) === null || _model$onChanged3 === void 0 ? void 0 : _model$onChanged3.call(model, publicAPI, model, value, previousValue);
|
|
556
571
|
publicAPI.modified();
|
|
557
572
|
return true;
|
|
558
573
|
}
|
|
@@ -605,6 +620,8 @@ function setArray(publicAPI, model, fieldNames, size) {
|
|
|
605
620
|
throw new RangeError("Invalid initial number of values for array (".concat(field, ")"));
|
|
606
621
|
}
|
|
607
622
|
|
|
623
|
+
var onChanged = "_on".concat(_capitalize(field), "Changed");
|
|
624
|
+
|
|
608
625
|
publicAPI["set".concat(_capitalize(field))] = function () {
|
|
609
626
|
if (model.deleted) {
|
|
610
627
|
vtkErrorMacro('instance deleted - cannot call any method');
|
|
@@ -655,7 +672,11 @@ function setArray(publicAPI, model, fieldNames, size) {
|
|
|
655
672
|
}
|
|
656
673
|
|
|
657
674
|
if (changeDetected) {
|
|
675
|
+
var _model$onChanged4;
|
|
676
|
+
|
|
677
|
+
var previousValue = model[field.name];
|
|
658
678
|
model[field] = array;
|
|
679
|
+
(_model$onChanged4 = model[onChanged]) === null || _model$onChanged4 === void 0 ? void 0 : _model$onChanged4.call(model, publicAPI, model, array, previousValue);
|
|
659
680
|
publicAPI.modified();
|
|
660
681
|
}
|
|
661
682
|
|