@kitware/vtk.js 32.12.1 → 32.13.0
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/Rendering/Core/Actor2D.d.ts +22 -0
- package/Rendering/Core/Actor2D.js +1 -1
- package/Rendering/Core/Viewport.js +13 -3
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +2 -2
- package/Rendering/OpenGL/Renderer.js +1 -1
- package/Rendering/SceneGraph/ViewNode.js +12 -2
- package/Widgets/Core/WidgetManager.d.ts +12 -1
- package/Widgets/Representations/WidgetRepresentation.d.ts +1 -7
- package/Widgets/Widgets3D/ResliceCursorWidget.d.ts +1 -8
- package/package.json +1 -1
|
@@ -54,6 +54,28 @@ export interface vtkActor2D extends vtkProp {
|
|
|
54
54
|
*/
|
|
55
55
|
getMapper(): vtkMapper2D;
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Set the layer number for this 2D actor.
|
|
59
|
+
* The scenegraph uses this layer number to sort actor 2D overlays/underlays on top of each other.
|
|
60
|
+
* The actor2D with the highest layer number is going to be rendered at the very front i.e. it is
|
|
61
|
+
* the top-most layer.
|
|
62
|
+
* If two actor2D instances share the same layer number, they are rendered in the order in which
|
|
63
|
+
* they were added to the renderer via `addActor` or `addActor2D`.
|
|
64
|
+
* By default, each actor2D has a layer number of 0.
|
|
65
|
+
*/
|
|
66
|
+
setLayerNumber(layer: number): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get the layer number for this 2D actor.
|
|
70
|
+
* The scenegraph uses this layer number to sort actor 2D overlays/underlays on top of each other.
|
|
71
|
+
* The actor2D with the highest layer number is going to be rendered at the very front i.e. it is
|
|
72
|
+
* the top-most layer.
|
|
73
|
+
* If two actor2D instances share the same layer number, they are rendered in the order in which
|
|
74
|
+
* they were added to the renderer via `addActor` or `addActor2D`.
|
|
75
|
+
* By default, each actor2D has a layer number of 0.
|
|
76
|
+
*/
|
|
77
|
+
getLayerNumber(): number;
|
|
78
|
+
|
|
57
79
|
/**
|
|
58
80
|
*
|
|
59
81
|
*/
|
|
@@ -145,7 +145,7 @@ function extend(publicAPI, model) {
|
|
|
145
145
|
|
|
146
146
|
// Build VTK API
|
|
147
147
|
macro.set(publicAPI, model, ['property']);
|
|
148
|
-
macro.setGet(publicAPI, model, ['mapper']);
|
|
148
|
+
macro.setGet(publicAPI, model, ['mapper', 'layerNumber']);
|
|
149
149
|
|
|
150
150
|
// Object methods
|
|
151
151
|
vtkActor2D(publicAPI, model);
|
|
@@ -46,10 +46,20 @@ function vtkViewport(publicAPI, model) {
|
|
|
46
46
|
return allProps;
|
|
47
47
|
}
|
|
48
48
|
publicAPI.getViewPropsWithNestedProps = () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
let allPropsArray = [];
|
|
50
|
+
// Handle actor2D instances separately so that they can be overlayed and layered
|
|
51
|
+
const actors2D = publicAPI.getActors2D();
|
|
52
|
+
// Sort the actor2D list using its layer number
|
|
53
|
+
actors2D.sort((a, b) => a.getLayerNumber() - b.getLayerNumber());
|
|
54
|
+
// Filter out all the actor2D instances
|
|
55
|
+
const newPropList = model.props.filter(item => !actors2D.includes(item));
|
|
56
|
+
for (let i = 0; i < newPropList.length; i++) {
|
|
57
|
+
gatherProps(newPropList[i], allPropsArray);
|
|
52
58
|
}
|
|
59
|
+
// Finally, add the actor2D props at the end of the list
|
|
60
|
+
// This works because, when traversing the render pass in vtkOpenGLRenderer, the children are
|
|
61
|
+
// traversed in the order that they are added to the list
|
|
62
|
+
allPropsArray = allPropsArray.concat(actors2D);
|
|
53
63
|
return allPropsArray;
|
|
54
64
|
};
|
|
55
65
|
publicAPI.addActor2D = publicAPI.addViewProp;
|
|
@@ -33,8 +33,8 @@ function vtkCameraSynchronizer(publicAPI, model) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// Update listeners automatically
|
|
36
|
-
model.
|
|
37
|
-
model.
|
|
36
|
+
model._onSrcRendererChanged = updateListeners;
|
|
37
|
+
model._onDstRendererChanged = updateListeners;
|
|
38
38
|
function updatePreviousValues(position, focalPoint, viewUp) {
|
|
39
39
|
if (cameraState[0] !== position[0] || cameraState[1] !== position[1] || cameraState[2] !== position[2] || cameraState[3] !== focalPoint[0] || cameraState[4] !== focalPoint[1] || cameraState[5] !== focalPoint[2] || cameraState[6] !== viewUp[0] || cameraState[7] !== viewUp[1] || cameraState[8] !== viewUp[2]) {
|
|
40
40
|
cameraState[0] = position[0];
|
|
@@ -24,7 +24,7 @@ function vtkOpenGLRenderer(publicAPI, model) {
|
|
|
24
24
|
publicAPI.updateLights();
|
|
25
25
|
publicAPI.prepareNodes();
|
|
26
26
|
publicAPI.addMissingNode(model.renderable.getActiveCamera());
|
|
27
|
-
publicAPI.addMissingNodes(model.renderable.getViewPropsWithNestedProps());
|
|
27
|
+
publicAPI.addMissingNodes(model.renderable.getViewPropsWithNestedProps(), true);
|
|
28
28
|
publicAPI.removeUnusedNodes();
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -105,13 +105,23 @@ function vtkViewNode(publicAPI, model) {
|
|
|
105
105
|
|
|
106
106
|
// add missing nodes/children for the passed in renderables. This should
|
|
107
107
|
// be called only in between prepareNodes and removeUnusedNodes
|
|
108
|
-
publicAPI.addMissingNodes = dataObjs
|
|
108
|
+
publicAPI.addMissingNodes = function (dataObjs) {
|
|
109
|
+
let enforceOrder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
109
110
|
if (!dataObjs || !dataObjs.length) {
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
113
|
for (let index = 0; index < dataObjs.length; ++index) {
|
|
113
114
|
const dobj = dataObjs[index];
|
|
114
|
-
publicAPI.addMissingNode(dobj);
|
|
115
|
+
const node = publicAPI.addMissingNode(dobj);
|
|
116
|
+
if (enforceOrder && node !== undefined && model.children[index] !== node) {
|
|
117
|
+
for (let i = index + 1; i < model.children.length; ++i) {
|
|
118
|
+
if (model.children[i] === node) {
|
|
119
|
+
model.children.splice(i, 1);
|
|
120
|
+
model.children.splice(index, 0, node);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
115
125
|
}
|
|
116
126
|
};
|
|
117
127
|
|
|
@@ -12,6 +12,14 @@ import { vtkObject } from './../../interfaces';
|
|
|
12
12
|
import { CaptureOn, ViewTypes } from './WidgetManager/Constants';
|
|
13
13
|
import { Nullable } from './../../types';
|
|
14
14
|
|
|
15
|
+
export interface IDisplayScaleParams {
|
|
16
|
+
dispHeightFactor: number;
|
|
17
|
+
cameraPosition: number[];
|
|
18
|
+
cameraDir: number[];
|
|
19
|
+
isParallel: boolean;
|
|
20
|
+
rendererPixelDims: number[];
|
|
21
|
+
}
|
|
22
|
+
|
|
15
23
|
export interface ISelectedData {
|
|
16
24
|
requestCount: number;
|
|
17
25
|
propID: number;
|
|
@@ -45,7 +53,10 @@ export function extractRenderingComponents(
|
|
|
45
53
|
* (vertical) distance that matches a display distance of 30px for a coordinate
|
|
46
54
|
* `coord`, you would compute `30 * getPixelWorldHeightAtCoord(coord)`.
|
|
47
55
|
*/
|
|
48
|
-
export function getPixelWorldHeightAtCoord(
|
|
56
|
+
export function getPixelWorldHeightAtCoord(
|
|
57
|
+
coord: [],
|
|
58
|
+
displayScaleParams: IDisplayScaleParams
|
|
59
|
+
): Number;
|
|
49
60
|
|
|
50
61
|
export interface vtkWidgetManager extends vtkObject {
|
|
51
62
|
/**
|
|
@@ -2,13 +2,7 @@ import vtkDataArray from './../../Common/Core/DataArray';
|
|
|
2
2
|
import vtkPolyData from './../../Common/DataModel/PolyData';
|
|
3
3
|
import { vtkObject } from './../../interfaces';
|
|
4
4
|
import vtkProp from './../../Rendering/Core/Prop';
|
|
5
|
-
|
|
6
|
-
dispHeightFactor: number;
|
|
7
|
-
cameraPosition: number[];
|
|
8
|
-
cameraDir: number[];
|
|
9
|
-
isParallel: boolean;
|
|
10
|
-
rendererPixelDims: number[];
|
|
11
|
-
}
|
|
5
|
+
import { IDisplayScaleParams } from './../Core/WidgetManager';
|
|
12
6
|
|
|
13
7
|
export interface IWidgetRepresentationInitialValues {
|
|
14
8
|
labels?: Array<any>;
|
|
@@ -12,14 +12,7 @@ import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
|
12
12
|
import vtkPlaneManipulator from './../Manipulators/PlaneManipulator';
|
|
13
13
|
import { ViewTypes } from './../Core/WidgetManager/Constants';
|
|
14
14
|
import { Vector2, Vector3 } from './../../types';
|
|
15
|
-
|
|
16
|
-
export interface IDisplayScaleParams {
|
|
17
|
-
dispHeightFactor: number;
|
|
18
|
-
cameraPosition: Vector3;
|
|
19
|
-
cameraDir: Vector3;
|
|
20
|
-
isParallel: false;
|
|
21
|
-
rendererPixelDims: Vector2;
|
|
22
|
-
}
|
|
15
|
+
import { IDisplayScaleParams } from './../Core/WidgetManager';
|
|
23
16
|
|
|
24
17
|
export interface vtkResliceCursorWidget<
|
|
25
18
|
WidgetInstance extends vtkAbstractWidget = vtkResliceCursorWidgetDefaultInstance
|