@kitware/vtk.js 24.18.6 → 24.18.9
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/DataSet/Constants.d.ts +27 -0
- package/Common/DataModel/DataSet.d.ts +6 -31
- package/Interaction/Widgets/OrientationMarkerWidget.d.ts +1 -1
- package/Rendering/Core/CellPicker.js +9 -2
- package/Rendering/Core/InteractorObserver.d.ts +132 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
- package/Rendering/Misc/SynchronizableRenderWindow/{vtkObjectManager.js → ObjectManager.js} +0 -0
- package/Rendering/Misc/SynchronizableRenderWindow.js +1 -1
- package/Rendering/OpenGL/ImageMapper.js +4 -0
- package/Widgets/Core/AbstractWidget.d.ts +187 -0
- package/Widgets/Core/AbstractWidgetFactory.d.ts +126 -0
- package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
- package/Widgets/Core/WidgetManager.d.ts +216 -0
- package/Widgets/Core/WidgetState.d.ts +81 -0
- package/Widgets/Widgets3D/AngleWidget/behavior.js +18 -14
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +18 -14
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +16 -6
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +17 -7
- package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
- package/Widgets/Widgets3D/LabelWidget/behavior.js +12 -9
- package/Widgets/Widgets3D/LineWidget/behavior.js +23 -18
- package/Widgets/Widgets3D/LineWidget.js +2 -4
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +13 -9
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +12 -14
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +9 -10
- package/Widgets/Widgets3D/SphereWidget/behavior.js +7 -7
- package/Widgets/Widgets3D/SplineWidget/behavior.js +11 -12
- package/index.d.ts +9 -0
- package/interfaces.d.ts +3 -0
- package/package.json +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum FieldAssociations {
|
|
2
|
+
FIELD_ASSOCIATION_POINTS = 0,
|
|
3
|
+
FIELD_ASSOCIATION_CELLS = 1,
|
|
4
|
+
FIELD_ASSOCIATION_NONE = 2,
|
|
5
|
+
FIELD_ASSOCIATION_POINTS_THEN_CELLS = 3,
|
|
6
|
+
FIELD_ASSOCIATION_VERTICES = 4,
|
|
7
|
+
FIELD_ASSOCIATION_EDGES = 5,
|
|
8
|
+
FIELD_ASSOCIATION_ROWS = 6,
|
|
9
|
+
NUMBER_OF_ASSOCIATIONS = 7,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export declare enum FieldDataTypes {
|
|
13
|
+
UNIFORM = 0,
|
|
14
|
+
DATA_OBJECT_FIELD = 0,
|
|
15
|
+
COORDINATE = 1,
|
|
16
|
+
POINT_DATA = 1,
|
|
17
|
+
POINT = 2,
|
|
18
|
+
POINT_FIELD_DATA = 2,
|
|
19
|
+
CELL = 3,
|
|
20
|
+
CELL_FIELD_DATA = 3,
|
|
21
|
+
VERTEX = 4,
|
|
22
|
+
VERTEX_FIELD_DATA = 4,
|
|
23
|
+
EDGE = 5,
|
|
24
|
+
EDGE_FIELD_DATA = 5,
|
|
25
|
+
ROW = 6,
|
|
26
|
+
ROW_DATA = 6,
|
|
27
|
+
}
|
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
import { vtkObject } from './../../interfaces' ;
|
|
2
1
|
import vtkDataSetAttributes from './DataSetAttributes';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
UNIFORM,
|
|
6
|
-
DATA_OBJECT_FIELD,
|
|
7
|
-
COORDINATE,
|
|
8
|
-
POINT_DATA,
|
|
9
|
-
POINT,
|
|
10
|
-
POINT_FIELD_DATA,
|
|
11
|
-
CELL,
|
|
12
|
-
CELL_FIELD_DATA,
|
|
13
|
-
VERTEX,
|
|
14
|
-
VERTEX_FIELD_DATA,
|
|
15
|
-
EDGE,
|
|
16
|
-
EDGE_FIELD_DATA,
|
|
17
|
-
ROW,
|
|
18
|
-
ROW_DATA,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export enum FieldAssociations {
|
|
22
|
-
FIELD_ASSOCIATION_POINTS,
|
|
23
|
-
FIELD_ASSOCIATION_CELLS,
|
|
24
|
-
FIELD_ASSOCIATION_NONE,
|
|
25
|
-
FIELD_ASSOCIATION_POINTS_THEN_CELLS,
|
|
26
|
-
FIELD_ASSOCIATION_VERTICES,
|
|
27
|
-
FIELD_ASSOCIATION_EDGES,
|
|
28
|
-
FIELD_ASSOCIATION_ROWS,
|
|
29
|
-
NUMBER_OF_ASSOCIATIONS,
|
|
30
|
-
}
|
|
2
|
+
import { vtkObject } from './../../interfaces' ;
|
|
3
|
+
import { FieldAssociations, FieldDataTypes } from './DataSet/Constants';
|
|
31
4
|
|
|
32
5
|
/**
|
|
33
6
|
*
|
|
@@ -102,7 +75,9 @@ export function newInstance(initialValues? : IDataSetInitialValues): vtkDataSet;
|
|
|
102
75
|
* operate on cell data, both cell and point data, either one, or none.
|
|
103
76
|
*/
|
|
104
77
|
export declare const vtkDataSet: {
|
|
105
|
-
newInstance: typeof newInstance
|
|
106
|
-
extend: typeof extend
|
|
78
|
+
newInstance: typeof newInstance;
|
|
79
|
+
extend: typeof extend;
|
|
80
|
+
FieldAssociation: typeof FieldAssociations;
|
|
81
|
+
FieldDataTypes: typeof FieldDataTypes;
|
|
107
82
|
};
|
|
108
83
|
export default vtkDataSet;
|
|
@@ -165,7 +165,6 @@ export function extend(publicAPI: object, model: object, initialValues?: IOrient
|
|
|
165
165
|
*/
|
|
166
166
|
export function newInstance(initialValues?: IOrientationMarkerWidgetInitialValues): vtkOrientationMarkerWidget;
|
|
167
167
|
|
|
168
|
-
|
|
169
168
|
/**
|
|
170
169
|
* vtkOrientationMarkerWidget is a 2D widget for manipulating a marker prop
|
|
171
170
|
*/
|
|
@@ -174,4 +173,5 @@ export declare const vtkOrientationMarkerWidget: {
|
|
|
174
173
|
extend: typeof extend;
|
|
175
174
|
Corners: typeof Corners;
|
|
176
175
|
}
|
|
176
|
+
|
|
177
177
|
export default vtkOrientationMarkerWidget;
|
|
@@ -254,14 +254,19 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
254
254
|
var tempCellMap = createCellMap();
|
|
255
255
|
var minCellMap = createCellMap();
|
|
256
256
|
var numberOfCells = data.getNumberOfCells();
|
|
257
|
+
/* eslint-disable no-continue */
|
|
257
258
|
|
|
258
259
|
for (var cellId = 0; cellId < numberOfCells; cellId++) {
|
|
259
260
|
var pCoords = [0, 0, 0];
|
|
260
|
-
minCellType = data.getCellType(cellId);
|
|
261
|
+
minCellType = data.getCellType(cellId); // Skip cells that are marked as empty
|
|
262
|
+
|
|
263
|
+
if (minCellType === CellType.VTK_EMPTY_CELL) {
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
|
|
261
267
|
var cell = tempCellMap[minCellType];
|
|
262
268
|
|
|
263
269
|
if (cell == null) {
|
|
264
|
-
// eslint-disable-next-line no-continue
|
|
265
270
|
continue;
|
|
266
271
|
}
|
|
267
272
|
|
|
@@ -294,6 +299,8 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
294
299
|
}
|
|
295
300
|
}
|
|
296
301
|
}
|
|
302
|
+
/* eslint-enable no-continue */
|
|
303
|
+
|
|
297
304
|
}
|
|
298
305
|
|
|
299
306
|
if (minCellId >= 0 && tMin < model.globalTMin) {
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import vtkRenderer from './Renderer';
|
|
2
|
+
import vtkRenderWindowInteractor from './RenderWindowInteractor';
|
|
3
|
+
import { vtkObject, EventHandler, vtkSubscription } from './../../interfaces';
|
|
4
|
+
import { Vector3 } from './../../types';
|
|
5
|
+
|
|
6
|
+
export interface vtkInteractorObserver extends vtkObject {
|
|
7
|
+
/**
|
|
8
|
+
* Invoke an interaction event.
|
|
9
|
+
*
|
|
10
|
+
* @param args Event payload.
|
|
11
|
+
*/
|
|
12
|
+
invokeInteractionEvent(...args: unknown[]): void;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Registers a callback to be invoked when an interaction event occurs.
|
|
16
|
+
*
|
|
17
|
+
* @param {EventHandler} cb The callback to be called.
|
|
18
|
+
* @param {Number} [priority] The priority of the event.
|
|
19
|
+
*/
|
|
20
|
+
onInteractionEvent(cb: EventHandler, priority?: number): Readonly<vtkSubscription>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Invoke a start interaction event.
|
|
24
|
+
*
|
|
25
|
+
* @param args Event payload.
|
|
26
|
+
*/
|
|
27
|
+
invokeStartInteractionEvent(...args: unknown[]): void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Registers a callback to be invoked when a start interaction event occurs.
|
|
31
|
+
*
|
|
32
|
+
* @param {EventHandler} cb The callback to be called.
|
|
33
|
+
* @param {Number} [priority] The callback to be called
|
|
34
|
+
*/
|
|
35
|
+
onStartInteractionEvent(cb: EventHandler, priority?: number): Readonly<vtkSubscription>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Invoke an end interaction event.
|
|
39
|
+
*
|
|
40
|
+
* @param args Event payload.
|
|
41
|
+
*/
|
|
42
|
+
invokeEndInteractionEvent(...args: unknown[]): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Registers a callback to be invoked when an end interaction event occurs.
|
|
46
|
+
*
|
|
47
|
+
* @param {EventHandler} cb The callback to be called.
|
|
48
|
+
* @param {Number?} [priority] The callback to be called
|
|
49
|
+
*/
|
|
50
|
+
onEndInteractionEvent(cb: EventHandler, priority?: number): Readonly<vtkSubscription>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Retrieve the render window interactor instance.
|
|
54
|
+
*/
|
|
55
|
+
getInteractor(): vtkRenderWindowInteractor;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get wether or not this InteractorObserver instance is enabled.
|
|
59
|
+
*/
|
|
60
|
+
getEnabled(): boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Enable/disable the interactor observer. Note that if you are enabling the interactor observer, an interactor instance must exists on the model.
|
|
64
|
+
* Typically you can call `setInteractor`
|
|
65
|
+
*
|
|
66
|
+
* @param {Boolean} enable
|
|
67
|
+
*/
|
|
68
|
+
setEnabled(enable: boolean): void;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Set the priority.
|
|
72
|
+
*
|
|
73
|
+
* @param {Number} priority The priority level.
|
|
74
|
+
*/
|
|
75
|
+
setPriority(priority: number): void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get the priority.
|
|
79
|
+
*/
|
|
80
|
+
getPriority(): number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Set whether or not the interactor observer instance should process events.
|
|
84
|
+
*
|
|
85
|
+
* @param {Boolean} processEvents
|
|
86
|
+
*/
|
|
87
|
+
setProcessEvents(processEvents: boolean): boolean;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get whether or not the interactor observer instance should process events.
|
|
91
|
+
*/
|
|
92
|
+
getProcessEvents(): boolean;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Set the interactor instance.
|
|
96
|
+
*
|
|
97
|
+
* @param {vtkRenderWindowInteractor} interactor
|
|
98
|
+
*/
|
|
99
|
+
setInteractor(interactor: vtkRenderWindowInteractor): void;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Transform from world to display coordinates.
|
|
103
|
+
*
|
|
104
|
+
* @param {vtkRenderer} renderer
|
|
105
|
+
* @param {Number} x
|
|
106
|
+
* @param {Number} y
|
|
107
|
+
* @param {Number} z
|
|
108
|
+
*/
|
|
109
|
+
computeWorldToDisplay(
|
|
110
|
+
renderer: vtkRenderer,
|
|
111
|
+
x: number,
|
|
112
|
+
y: number,
|
|
113
|
+
z: number
|
|
114
|
+
): Vector3;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Transform from display to world coordinates.
|
|
118
|
+
*
|
|
119
|
+
* @param {vtkRenderer} renderer
|
|
120
|
+
* @param {Number} x
|
|
121
|
+
* @param {Number} y
|
|
122
|
+
* @param {Number} z
|
|
123
|
+
*/
|
|
124
|
+
computeDisplayToWorld(
|
|
125
|
+
renderer: vtkRenderer,
|
|
126
|
+
x: number,
|
|
127
|
+
y: number,
|
|
128
|
+
z: number
|
|
129
|
+
): Vector3;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export default vtkInteractorObserver;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { vtkObject } from './../../../interfaces' ;
|
|
2
|
+
import { Nullable } from './../../../types' ;
|
|
3
|
+
import { ISynchronizerContext, IViewState } from "..";
|
|
4
|
+
|
|
5
|
+
export type BuilderFunction = <T extends vtkObject>(type: string, initialProps?: Record<string, unknown>) => Nullable<T>;
|
|
6
|
+
export type UpdaterFunction = (instance: vtkObject, state: IViewState, context: ISynchronizerContext) => void;
|
|
7
|
+
|
|
8
|
+
export interface IObjectManager {
|
|
9
|
+
/**
|
|
10
|
+
* Build a vtkObject.
|
|
11
|
+
*/
|
|
12
|
+
build: BuilderFunction;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {String} type The type to update
|
|
16
|
+
* @param {vtkObject} instance The specific instance
|
|
17
|
+
* @param {IViewState} props
|
|
18
|
+
* @param {ISynchronizerContext} context
|
|
19
|
+
*/
|
|
20
|
+
update(type: string, instance: vtkObject, props: IViewState, context: ISynchronizerContext): Promise<Error | void>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Defines a new type handler with the specified builder and updater functions
|
|
24
|
+
*
|
|
25
|
+
* @param {String} type The type you wish to register
|
|
26
|
+
* @param {BuilderFunction} [buildFn] The builder function to associate with the type
|
|
27
|
+
* @param {UpdaterFunction} [updateFn] The updater function to associate with the type
|
|
28
|
+
*/
|
|
29
|
+
setTypeMapping(type: string, buildFn?: BuilderFunction, updateFn?: UpdaterFunction): void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Clear all type mappings
|
|
33
|
+
*/
|
|
34
|
+
clearTypeMapping(): void;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get a list of all supported types
|
|
38
|
+
*
|
|
39
|
+
* @returns {string[]}
|
|
40
|
+
*/
|
|
41
|
+
getSupportedTypes(): string[];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Clear all one time updaters
|
|
45
|
+
*/
|
|
46
|
+
clearOneTimeUpdaters(): void;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Update the associated render window
|
|
50
|
+
*/
|
|
51
|
+
updateRenderWindow(): void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Register a new type to exclude
|
|
55
|
+
*
|
|
56
|
+
* @param {string} type The type to exclude
|
|
57
|
+
* @param {string} propertyName The property name to exclude
|
|
58
|
+
* @param {unknown} propertyValue The property value to exclude
|
|
59
|
+
*/
|
|
60
|
+
excludeInstance(type: string, propertyName: string, propertyValue: unknown): void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Set the default types mapping
|
|
64
|
+
*
|
|
65
|
+
* @param {boolean} [reset] Clear all existing type mappings, defaults to true
|
|
66
|
+
*/
|
|
67
|
+
setDefaultMapping(reset?: boolean): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Apply the default aliases
|
|
71
|
+
*/
|
|
72
|
+
applyDefaultAliases(): void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Always update the camera
|
|
76
|
+
*/
|
|
77
|
+
alwaysUpdateCamera(): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default IObjectManager;
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import { newInstance as newInstance$1, event, get, chain, newTypedArray, traverseInstanceTree } from '../../macros.js';
|
|
3
3
|
import Base64 from '../../Common/Core/Base64.js';
|
|
4
4
|
import vtkRenderWindow from '../Core/RenderWindow.js';
|
|
5
|
-
import vtkObjectManager from './SynchronizableRenderWindow/
|
|
5
|
+
import vtkObjectManager from './SynchronizableRenderWindow/ObjectManager.js';
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
@@ -202,6 +202,10 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
202
202
|
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::TCoord::Impl', ['vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);', 'float intensity = tcolor.r*cscale0 + cshift0;', 'gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)).rgb, pwfscale0*tcolor.g + pwfshift0);']).result;
|
|
203
203
|
break;
|
|
204
204
|
|
|
205
|
+
case 3:
|
|
206
|
+
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::TCoord::Impl', ['vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;', 'gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,', ' texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,', ' texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, opacity);']).result;
|
|
207
|
+
break;
|
|
208
|
+
|
|
205
209
|
default:
|
|
206
210
|
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::TCoord::Impl', ['vec4 tcolor = cscale0*texture2D(texture1, tcoordVCVSOutput.st) + cshift0;', 'gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,', ' texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,', ' texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);']).result;
|
|
207
211
|
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import vtkInteractorObserver from './../../Rendering/Core/InteractorObserver';
|
|
2
|
+
import vtkProp from './../../Rendering/Core/Prop';
|
|
3
|
+
import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
4
|
+
import vtkWidgetManager from './WidgetManager';
|
|
5
|
+
import vtkWidgetRepresentation from './../Representations/WidgetRepresentation';
|
|
6
|
+
import vtkWidgetState from './WidgetState';
|
|
7
|
+
import { Bounds } from './../../types';
|
|
8
|
+
import { RenderingTypes } from './WidgetManager/Constants';
|
|
9
|
+
import { EventHandler, vtkSubscription } from './../../interfaces';
|
|
10
|
+
|
|
11
|
+
export interface vtkAbstractWidget extends vtkProp, vtkInteractorObserver {
|
|
12
|
+
/**
|
|
13
|
+
* Get the bounds of the widget
|
|
14
|
+
*/
|
|
15
|
+
getBounds(): Bounds;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get all representations of the widget.
|
|
19
|
+
*/
|
|
20
|
+
getNestedProps(): vtkWidgetRepresentation[];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Activate a handle, identified by both a state and a representation.
|
|
24
|
+
* Will also invoke appropriate events.
|
|
25
|
+
*
|
|
26
|
+
* @param locator An object describing the handle to activate.
|
|
27
|
+
*/
|
|
28
|
+
activateHandle(locator: {
|
|
29
|
+
selectedState: vtkWidgetState;
|
|
30
|
+
representation: vtkWidgetRepresentation;
|
|
31
|
+
}): void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Deactivate all the handles on the widget instance.
|
|
35
|
+
*/
|
|
36
|
+
deactivateAllHandles(): void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns true if the widget instance holds the given actor, false otherwise.
|
|
40
|
+
*
|
|
41
|
+
* @param {vtkProp} actor
|
|
42
|
+
*/
|
|
43
|
+
hasActor(actor: vtkProp): boolean;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Make the widget instance grab the focus.
|
|
47
|
+
* Should not be called directly or this will lead to unexpected behavior.
|
|
48
|
+
* To grab the focus on a widget, one should call `vtkWidgetManager.grabFocus(widgetInstanceToGiveFocusTo)`
|
|
49
|
+
*/
|
|
50
|
+
grabFocus(): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Make the widget instance release the focus.
|
|
54
|
+
*/
|
|
55
|
+
loseFocus(): void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns true if the widget instance holds the focus, false otherwise.
|
|
59
|
+
*/
|
|
60
|
+
hasFocus(): boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Place a widget at the given bounds.
|
|
64
|
+
*
|
|
65
|
+
* @param {Bounds} bounds
|
|
66
|
+
*/
|
|
67
|
+
placeWidget(bounds: Bounds): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get the place factor.
|
|
71
|
+
*/
|
|
72
|
+
getPlaceFactor(): number;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Set the place factor.
|
|
76
|
+
*
|
|
77
|
+
* @param {Number} factor The place factor.
|
|
78
|
+
*/
|
|
79
|
+
setPlaceFactor(factor: number): void;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get the `vtkWidgetRepresentation` instance associated with the given `vtkActor` instance.
|
|
83
|
+
*
|
|
84
|
+
* @param {vtkProp} actor
|
|
85
|
+
*/
|
|
86
|
+
getRepresentationFromActor(actor: vtkProp): vtkWidgetRepresentation;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Update all the widget representations for render.
|
|
90
|
+
*
|
|
91
|
+
* @param {RenderingTypes} renderingType Default value if `RenderingTypes.FRONT_BUFFER`
|
|
92
|
+
*/
|
|
93
|
+
updateRepresentationForRender(renderingType: RenderingTypes): void;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get all the underlyings view widgets.
|
|
97
|
+
*/
|
|
98
|
+
getViewWidgets(): vtkAbstractWidget[];
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Set the context visibility.
|
|
103
|
+
*
|
|
104
|
+
* @param {Boolean} visible
|
|
105
|
+
*/
|
|
106
|
+
setContextVisibility(visible: boolean): void;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get the context visibility.
|
|
110
|
+
*/
|
|
111
|
+
getContextVisibility(): boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Defines if the handles should be visible or not.
|
|
115
|
+
*
|
|
116
|
+
* @param {Boolean} visible
|
|
117
|
+
*/
|
|
118
|
+
setHandleVisibility(visible: boolean): void;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Returns true if the handles are visible, false otherwise.
|
|
122
|
+
*/
|
|
123
|
+
getHandleVisibility(): boolean;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Set the widget manager associated with the widget instance.
|
|
127
|
+
*
|
|
128
|
+
* @param {vtkWidgetManager} wm The widget manager instance
|
|
129
|
+
*/
|
|
130
|
+
setWidgetManager(wm: vtkWidgetManager): void;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Get the widget manager associated with the widget instance.
|
|
134
|
+
*/
|
|
135
|
+
getWidgetManager(): vtkWidgetManager;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get all the representations of the widget instance.
|
|
139
|
+
*/
|
|
140
|
+
getRepresentations(): vtkWidgetRepresentation[];
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get the the state of the widget instance.
|
|
144
|
+
*/
|
|
145
|
+
getWidgetState(): vtkWidgetState;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Register a callback to be invoked when the `ActivateHandle` event occurs.
|
|
149
|
+
*
|
|
150
|
+
* @param {EventHandler} cb The callback to register
|
|
151
|
+
* @param {Number} [priority] Priority of this subscription
|
|
152
|
+
*/
|
|
153
|
+
onActivateHandle(cb: EventHandler, priority?: number): Readonly<vtkSubscription>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Invoke the `ActivateHandle` event with the given payload.
|
|
157
|
+
*
|
|
158
|
+
* @param args The event payload
|
|
159
|
+
*/
|
|
160
|
+
invokeActivateHandle(...args: unknown[]): void;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Method used to decorate a given object (publicAPI+model) with vtkAbstractWidget characteristics.
|
|
165
|
+
*
|
|
166
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
167
|
+
* @param model object on which data structure will be bounds (protected)
|
|
168
|
+
* @param initialValues (default: {})
|
|
169
|
+
*/
|
|
170
|
+
export function extend(publicAPI: object, model: object, initialValues? : object): void;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Method used to create a new instance of vtkAbstractWidget
|
|
174
|
+
*
|
|
175
|
+
* @param initialValues For pre-setting some of its content
|
|
176
|
+
*/
|
|
177
|
+
export function newInstance(initialValues?: object): vtkAbstractWidget;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* vtkAbstractWidget is an abstract class to construct a widget.
|
|
181
|
+
*/
|
|
182
|
+
export declare const vtkAbstractWidget: {
|
|
183
|
+
newInstance: typeof newInstance,
|
|
184
|
+
extend: typeof extend,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export default vtkAbstractWidget;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import vtkAbstractWidget from './AbstractWidget';
|
|
2
|
+
import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
3
|
+
import vtkWidgetState from './WidgetState';
|
|
4
|
+
import { ViewTypes } from './WidgetManager/Constants';
|
|
5
|
+
import { Bounds, Nullable } from './../../types';
|
|
6
|
+
import { EventHandler, vtkSubscription } from './../../interfaces';
|
|
7
|
+
|
|
8
|
+
export interface IGetWidgetForViewParams {
|
|
9
|
+
viewId: number;
|
|
10
|
+
renderer?: vtkRenderer;
|
|
11
|
+
viewType?: ViewTypes;
|
|
12
|
+
initialValues?: object;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface vtkAbstractWidgetFactory {
|
|
16
|
+
/**
|
|
17
|
+
* Will return the widget associated with the view with Id id `locator.viewId`.
|
|
18
|
+
* If there is no widget associated with the view, a new widget will be constructed, provided
|
|
19
|
+
* that the renderer, viewType, and optionally initialValues are also provided.
|
|
20
|
+
*
|
|
21
|
+
* @param {IGetWidgetForViewParams} locator
|
|
22
|
+
*/
|
|
23
|
+
getWidgetForView(locator: IGetWidgetForViewParams): Nullable<vtkAbstractWidget>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get a list of all the view ids.
|
|
27
|
+
*/
|
|
28
|
+
getViewIds(): string[];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Set the visiblity on each underlying view widget.
|
|
32
|
+
*
|
|
33
|
+
* @param {Boolean} visible
|
|
34
|
+
*/
|
|
35
|
+
setVisibility(visible: boolean): void
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Set the pickable flag for each underlying view widget.
|
|
39
|
+
*
|
|
40
|
+
* @param {Boolean} pickable
|
|
41
|
+
*/
|
|
42
|
+
setPickable(pickable: boolean): void
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Set the dragable flag for each underlying view widget.
|
|
46
|
+
*
|
|
47
|
+
* @param {Boolean} dragable
|
|
48
|
+
*/
|
|
49
|
+
setDragable(dragable: boolean): void
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Set the context visibility for each associated view widget.
|
|
53
|
+
*
|
|
54
|
+
* @param {Boolean} visible
|
|
55
|
+
*/
|
|
56
|
+
setContextVisibility(visible: boolean): void
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Set the handles visibility for each underlying view widget.
|
|
60
|
+
*
|
|
61
|
+
* @param {Boolean} visible
|
|
62
|
+
*/
|
|
63
|
+
setHandleVisiblity(visible: boolean): void
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Place a new widget at the given bounds.
|
|
67
|
+
*
|
|
68
|
+
* @param {Bounds} bounds
|
|
69
|
+
*/
|
|
70
|
+
placeWidget(bounds: Bounds);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get the place factor.
|
|
74
|
+
*/
|
|
75
|
+
getPlaceFactor(): number;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Set the place factor.
|
|
79
|
+
*
|
|
80
|
+
* @param {Number} factor
|
|
81
|
+
*/
|
|
82
|
+
setPlaceFactor(factor: number): void;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get the `vtkWidgetState` instance
|
|
86
|
+
*/
|
|
87
|
+
getWidgetState(): vtkWidgetState;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Register a callback to be called when the WidgetChange event arise.
|
|
91
|
+
*
|
|
92
|
+
* @param {EventHandler} cb The callback to be invoked.
|
|
93
|
+
* @param {Number} [priority] The priority of this subscription
|
|
94
|
+
*/
|
|
95
|
+
onWidgetChangeEvent(cb: EventHandler, priority?: number): Readonly<vtkSubscription>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Invoke the WidgetChange event
|
|
99
|
+
*
|
|
100
|
+
* @param args The event payload
|
|
101
|
+
*/
|
|
102
|
+
invokeWidgetChangeEvent(...args: unknown[]): void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Method used to decorate a given object (publicAPI+model) with vtkAbstractWidgetFactory characteristics.
|
|
107
|
+
*
|
|
108
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
109
|
+
* @param model object on which data structure will be bounds (protected)
|
|
110
|
+
* @param initialValues (default: {})
|
|
111
|
+
*/
|
|
112
|
+
export function extend(publicAPI: object, model: object, initialValues? : object): void;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Method used to create a new instance of vtkAbstractWidgetFactory
|
|
116
|
+
*
|
|
117
|
+
* @param initialValues for pre-setting some of its content
|
|
118
|
+
*/
|
|
119
|
+
export function newInstance(initialValues?: object): vtkAbstractWidgetFactory;
|
|
120
|
+
|
|
121
|
+
export declare const vtkAbstractWidgetFactory: {
|
|
122
|
+
newInstance: typeof newInstance,
|
|
123
|
+
extend: typeof extend,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default vtkAbstractWidgetFactory;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum ViewTypes {
|
|
2
|
+
DEFAULT = 0,
|
|
3
|
+
GEOMETRY = 1,
|
|
4
|
+
SLICE = 2,
|
|
5
|
+
VOLUME = 3,
|
|
6
|
+
YZ_PLANE = 4,
|
|
7
|
+
XZ_PLANE = 5,
|
|
8
|
+
XY_PLANE = 6
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare enum RenderingTypes {
|
|
12
|
+
PICKING_BUFFER = 0,
|
|
13
|
+
FRONT_BUFFER = 1
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare enum CaptureOn {
|
|
17
|
+
MOUSE_MOVE = 0,
|
|
18
|
+
MOUSE_RELEASE = 1
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const _default: {
|
|
22
|
+
ViewTypes: typeof ViewTypes;
|
|
23
|
+
RenderingTypes: typeof RenderingTypes;
|
|
24
|
+
CaptureOn: typeof CaptureOn;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default _default;
|