@kitware/vtk.js 24.18.6 → 24.18.7

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.
@@ -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
- export enum FieldDataTypes {
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;
@@ -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;
@@ -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/vtkObjectManager.js';
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;
@@ -0,0 +1,216 @@
1
+ import vtkAbstractWidget from './AbstractWidget';
2
+ import vtkAbstractWidgetFactory from './AbstractWidgetFactory';
3
+ import vtkCamera from './../../Rendering/Core/Camera';
4
+ import vtkProp from './../../Rendering/Core/Prop';
5
+ import vtkRenderer from './../../Rendering/Core/Renderer';
6
+ import vtkRenderWindow from './../../Rendering/Core/RenderWindow';
7
+ import vtkRenderWindowInteractor from './../../Rendering/Core/RenderWindowInteractor';
8
+ import vtkSelectionNode from './../../Common/DataModel/SelectionNode';
9
+ import vtkWidgetRepresentation from './../Representations/WidgetRepresentation';
10
+ import vtkWidgetState from './WidgetState';
11
+ import { vtkObject } from './../../interfaces';
12
+ import { CaptureOn, ViewTypes } from './WidgetManager/Constants';
13
+ import { Nullable } from './../../types';
14
+
15
+ export interface ISelectedData {
16
+ requestCount: number;
17
+ propID: number;
18
+ compositeID: number;
19
+ prop: vtkProp;
20
+ widget: vtkAbstractWidget;
21
+ representation: vtkWidgetRepresentation;
22
+ selectedState: vtkWidgetState;
23
+ }
24
+
25
+ export interface IRenderingComponents {
26
+ renderer: vtkRenderer;
27
+ renderWindow: vtkRenderWindow;
28
+ interactor: vtkRenderWindowInteractor;
29
+ apiSpecificRenderWindow: vtkRenderWindow;
30
+ camera: vtkCamera;
31
+ }
32
+
33
+ /**
34
+ * Extract the rendering components from the given renderer.
35
+ *
36
+ * @param renderer
37
+ */
38
+ export function extractRenderingComponents(renderer: vtkRenderer): IRenderingComponents;
39
+
40
+ export interface vtkWidgetManager extends vtkObject {
41
+ /**
42
+ * The the captureOn value.
43
+ * `CaptureOn.MOUSE_MOVE`: captures small region when moving mouse
44
+ * `CaptureOn.MOUSE_RELEASE`: captures entire region when mouse button is released
45
+ *
46
+ * @param {CaptureOn} captureOn
47
+ */
48
+ setCaptureOn(captureOn: CaptureOn): boolean;
49
+
50
+ /**
51
+ * Get the captureOn value.
52
+ */
53
+ getCaptureOn(): CaptureOn;
54
+
55
+ /**
56
+ * The the view type.
57
+ *
58
+ * @param {ViewTypes} type
59
+ */
60
+ setViewType(type: ViewTypes): boolean;
61
+
62
+ /**
63
+ * Get the view type.
64
+ */
65
+ getViewType(): ViewTypes;
66
+
67
+ /**
68
+ * Get the current selection.
69
+ */
70
+ getSelections(): vtkSelectionNode[];
71
+
72
+ /**
73
+ * Get all the underlying widgets.
74
+ */
75
+ getWidgets(): vtkAbstractWidget[];
76
+
77
+ /**
78
+ * Get the view id.
79
+ */
80
+ getViewId(): string;
81
+
82
+ /**
83
+ * Returns true if picking is enabled, false otherwise.
84
+ */
85
+ getPickingEnabled(): boolean;
86
+
87
+ /**
88
+ * @deprecated
89
+ */
90
+ getUseSvgLayer(): boolean;
91
+
92
+ /**
93
+ * @deprecated
94
+ */
95
+ setUseSvgLayer(use: boolean): boolean;
96
+
97
+ /**
98
+ * Enable the picking.
99
+ */
100
+ enablePicking(): void;
101
+
102
+ /**
103
+ * Renders all the widgets.
104
+ */
105
+ renderWidgets(): void;
106
+
107
+ /**
108
+ * Disable the picking.
109
+ */
110
+ disablePicking(): void;
111
+
112
+ /**
113
+ * Set the renderer.
114
+ *
115
+ * @param {vtkRenderer} renderer
116
+ */
117
+ setRenderer(renderer: vtkRenderer): void;
118
+
119
+ /**
120
+ * Register a widget on the widget manager instance.
121
+ * Please note that one should link the widget manager to a view before calling this method.
122
+ *
123
+ * @param {vtkAbstractWidgetFactory} widget The abstract widget factory.
124
+ * @param {ViewTypes} [viewType]
125
+ * @param {Object} [initialValues]
126
+ */
127
+ addWidget(
128
+ widget: vtkAbstractWidgetFactory,
129
+ viewType?: ViewTypes,
130
+ initialValues?: object
131
+ ): Nullable<vtkAbstractWidget>;
132
+
133
+ /**
134
+ * Unregister all widgets from the widget manager.
135
+ */
136
+ removeWidgets(): void;
137
+
138
+ /**
139
+ * Remove a widget from the widget manager.
140
+ *
141
+ * @param {vtkAbstractWidget | vtkAbstractWidgetFactory} widget The widget to remove
142
+ */
143
+ removeWidget(widget: vtkAbstractWidget | vtkAbstractWidgetFactory): void;
144
+
145
+ /**
146
+ * Given x and y parameter, get selected data.
147
+ *
148
+ * @param {Number} x
149
+ * @param {Number} y
150
+ */
151
+ getSelectedDataForXY(x: number, y: number): Promise<ISelectedData>;
152
+
153
+ /**
154
+ * @deprecated
155
+ */
156
+ updateSelectionFromXY(x: number, y: number): void;
157
+
158
+ /**
159
+ * @deprecated
160
+ */
161
+ updateSelectionFromMouseEvent(event: MouseEvent): void;
162
+
163
+ /**
164
+ * The all currently selected data.
165
+ */
166
+ getSelectedData(): ISelectedData | {};
167
+
168
+ /**
169
+ * Given the focus to the given widget instance.
170
+ *
171
+ * @param {vtkAbstractWidget | vtkAbstractWidgetFactory} widget The widget instance which should get the focus.
172
+ */
173
+ grabFocus(widget: vtkAbstractWidget | vtkAbstractWidgetFactory): void;
174
+
175
+ /**
176
+ * Release the focus.
177
+ */
178
+ releaseFocus(): void;
179
+ }
180
+
181
+ export interface IWidgetManagerInitialValues {
182
+ captureOn?: CaptureOn;
183
+ viewType?: ViewTypes;
184
+ pickingEnabled?: boolean;
185
+ /**
186
+ * @deprecated
187
+ */
188
+ useSvgLayer?: boolean;
189
+ }
190
+
191
+ /**
192
+ * Method used to decorate a given object (publicAPI+model) with vtkWidgetManager characteristics.
193
+ *
194
+ * @param publicAPI object on which methods will be bounds (public)
195
+ * @param model object on which data structure will be bounds (protected)
196
+ * @param initialValues (default: {})
197
+ */
198
+ export function extend(
199
+ publicAPI: object,
200
+ model: object,
201
+ initialValues?: IWidgetManagerInitialValues
202
+ ): vtkWidgetManager;
203
+
204
+ /**
205
+ * Method used to create a new instance of vtkCellArray
206
+ *
207
+ * @param initialValues for pre-setting some of its content
208
+ */
209
+ export function newInstance(initialValues?: IWidgetManagerInitialValues): vtkWidgetManager;
210
+
211
+ export declare const vtkWidgetManager: {
212
+ newInstance: typeof newInstance;
213
+ extend: typeof extend;
214
+ };
215
+
216
+ export default vtkWidgetManager;
@@ -0,0 +1,81 @@
1
+ import { vtkObject } from './../../interfaces';
2
+
3
+ export interface vtkWidgetState extends vtkObject {
4
+ /**
5
+ * Set the active flag of the widget state instance
6
+ *
7
+ * @param active The active flag
8
+ */
9
+ setActive(active: boolean): boolean;
10
+
11
+ /**
12
+ * Get the active flag of the widget state instance
13
+ */
14
+ getActive(): boolean;
15
+
16
+ /**
17
+ * Bind a state to one or more labels. If no label is provided, the default one will be used.
18
+ *
19
+ * @param {vtkWidgetState} subState The state to bound.
20
+ * @param {String | String[]} [labels] The labels to which the state should be bound.
21
+ */
22
+ bindState(subState: vtkWidgetState, labels?: string | string[]): void;
23
+
24
+ /**
25
+ * Unbind a specific state from the widget state instance
26
+ *
27
+ * @param {vtkWidgetState} subState The state to be unbound.
28
+ */
29
+ unbindState(subState: vtkWidgetState): void;
30
+
31
+ /**
32
+ * Unbind all states from the widget state instance
33
+ */
34
+ unbindAll(): void;
35
+
36
+ /**
37
+ * Activate the widget state instance. Same as calling `vtkWidgetState.setActive(true)`
38
+ */
39
+ activate(): void;
40
+
41
+ /**
42
+ * Deactivate thie widget state instance and all its sub states, except the `excludingState` argument.
43
+ *
44
+ * @param {vtkWidgetState} [excludingState] A sub-state instance that should not be deactivated.
45
+ */
46
+ deactivate(excludingState?: vtkWidgetState): void;
47
+
48
+ /**
49
+ * Activate only the passed in sub state. Every other sub states will be deactivated.
50
+ *
51
+ * @param {vtkWidgetState} subState The sub-state that should be activated.
52
+ */
53
+ activateOnly(subState: vtkWidgetState): void;
54
+
55
+ /**
56
+ * Get every states that are associated with the given label.
57
+ *
58
+ * @param {String} label The label from which to retrieve the states.
59
+ */
60
+ getStatesWithLabel(label: string): vtkWidgetState[];
61
+
62
+ /**
63
+ * Get all the nested states on the widget state instance.
64
+ */
65
+ getAllNestedStates(): vtkWidgetState[];
66
+ }
67
+
68
+ /**
69
+ * Method use to decorate a given object (publicAPI+model) with vtkWidgetState characteristics.
70
+ *
71
+ * @param publicAPI object on which methods will be bounds (public)
72
+ * @param model object on which data structure will be bounds (protected)
73
+ * @param {object} [initialValues] (default: {})
74
+ */
75
+ export function extend(publicAPI: object, model: object, initialValues?: object): vtkWidgetState;
76
+
77
+ export declare const vtkWidgetState: {
78
+ extend: typeof extend;
79
+ };
80
+
81
+ export default vtkWidgetState;
@@ -0,0 +1,40 @@
1
+ import vtkAbstractWidgetFactory from './../Core/AbstractWidgetFactory';
2
+ import { Bounds } from './../../types';
3
+ import { ViewTypes } from './../Core/WidgetManager/Constants';
4
+
5
+ export interface vtkInteractiveOrientationWidget extends vtkAbstractWidgetFactory {
6
+ /**
7
+ * Set the widget bounds
8
+ *
9
+ * @param {Bounds} bounds The widget bounds
10
+ */
11
+ setBounds(bounds: Bounds): void;
12
+
13
+ /**
14
+ * @param {ViewTypes} viewType
15
+ */
16
+ getRepresentationForViewType(viewType: ViewTypes): unknown;
17
+ }
18
+
19
+ /**
20
+ * Method use to decorate a given object (publicAPI+model) with vtkInteractiveOrientationWidget characteristics.
21
+ *
22
+ * @param publicAPI object on which methods will be bounds (public)
23
+ * @param model object on which data structure will be bounds (protected)
24
+ * @param {object} [initialValues] (default: {})
25
+ */
26
+ export function extend(publicAPI: object, model: object, initialValues? : Record<string, unknown>): void;
27
+
28
+ /**
29
+ * Creates a new instance of vtkInteractiveOrientationWidget
30
+ *
31
+ * @param {object} [initialValues] for pre-setting some of its content
32
+ */
33
+ export function newInstance(initialValues? : Record<string, unknown>): vtkInteractiveOrientationWidget;
34
+
35
+ export declare const vtkInteractiveOrientationWidget: {
36
+ newInstance: typeof newInstance,
37
+ extend: typeof extend,
38
+ };
39
+
40
+ export default vtkInteractiveOrientationWidget;
package/index.d.ts CHANGED
@@ -21,6 +21,7 @@
21
21
  /// <reference path="./Common/DataModel/Cell.d.ts" />
22
22
  /// <reference path="./Common/DataModel/Cone.d.ts" />
23
23
  /// <reference path="./Common/DataModel/Cylinder.d.ts" />
24
+ /// <reference path="./Common/DataModel/DataSet/Constants.d.ts" />
24
25
  /// <reference path="./Common/DataModel/DataSet.d.ts" />
25
26
  /// <reference path="./Common/DataModel/DataSetAttributes/FieldData.d.ts" />
26
27
  /// <reference path="./Common/DataModel/DataSetAttributes.d.ts" />
@@ -114,6 +115,7 @@
114
115
  /// <reference path="./Rendering/Core/ImageProperty/Constants.d.ts" />
115
116
  /// <reference path="./Rendering/Core/ImageProperty.d.ts" />
116
117
  /// <reference path="./Rendering/Core/ImageSlice.d.ts" />
118
+ /// <reference path="./Rendering/Core/InteractorObserver.d.ts" />
117
119
  /// <reference path="./Rendering/Core/Light.d.ts" />
118
120
  /// <reference path="./Rendering/Core/Mapper/Constants.d.ts" />
119
121
  /// <reference path="./Rendering/Core/Mapper.d.ts" />
@@ -147,18 +149,25 @@
147
149
  /// <reference path="./Rendering/Misc/GenericRenderWindow.d.ts" />
148
150
  /// <reference path="./Rendering/Misc/RemoteView.d.ts" />
149
151
  /// <reference path="./Rendering/Misc/RenderWindowWithControlBar.d.ts" />
152
+ /// <reference path="./Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts" />
150
153
  /// <reference path="./Rendering/Misc/SynchronizableRenderWindow.d.ts" />
151
154
  /// <reference path="./Rendering/Misc/TextureLODsDownloader.d.ts" />
152
155
  /// <reference path="./Rendering/OpenGL/RenderWindow.d.ts" />
153
156
  /// <reference path="./Rendering/SceneGraph/RenderPass.d.ts" />
154
157
  /// <reference path="./Rendering/SceneGraph/ViewNode.d.ts" />
155
158
  /// <reference path="./Rendering/SceneGraph/ViewNodeFactory.d.ts" />
159
+ /// <reference path="./Widgets/Core/AbstractWidget.d.ts" />
160
+ /// <reference path="./Widgets/Core/AbstractWidgetFactory.d.ts" />
161
+ /// <reference path="./Widgets/Core/WidgetManager/Constants.d.ts" />
162
+ /// <reference path="./Widgets/Core/WidgetManager.d.ts" />
163
+ /// <reference path="./Widgets/Core/WidgetState.d.ts" />
156
164
  /// <reference path="./Widgets/Manipulators/AbstractManipulator.d.ts" />
157
165
  /// <reference path="./Widgets/Manipulators/LineManipulator.d.ts" />
158
166
  /// <reference path="./Widgets/Manipulators/PlaneManipulator.d.ts" />
159
167
  /// <reference path="./Widgets/Manipulators/TrackballManipulator.d.ts" />
160
168
  /// <reference path="./Widgets/Representations/ResliceCursorContextRepresentation.d.ts" />
161
169
  /// <reference path="./Widgets/Representations/WidgetRepresentation.d.ts" />
170
+ /// <reference path="./Widgets/Widgets3D/InteractiveOrientationWidget.d.ts" />
162
171
  /// <reference path="./Widgets/Widgets3D/SphereWidget.d.ts" />
163
172
  /// <reference path="./macros.d.ts" />
164
173
  /// <reference path="./vtk.d.ts" />
package/interfaces.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import vtkDataArray from './Common/Core/DataArray';
2
2
  import { vtkPipelineConnection } from './types';
3
+ import { EVENT_ABORT, VOID } from './macros';
3
4
 
4
5
  /**
5
6
  * Object returned on any subscription call
@@ -278,3 +279,5 @@ export interface vtkProperty {
278
279
  }
279
280
 
280
281
  export interface vtkPropertyDomain {}
282
+
283
+ export type EventHandler = (...args: unknown[]) => typeof EVENT_ABORT | typeof VOID | void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.18.6",
3
+ "version": "24.18.7",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",
@@ -112,7 +112,7 @@
112
112
  "rollup-plugin-string": "3.0.0",
113
113
  "rollup-plugin-svgo": "1.1.0",
114
114
  "rollup-plugin-web-worker-loader": "1.6.1",
115
- "semantic-release": "19.0.2",
115
+ "semantic-release": "19.0.3",
116
116
  "string-replace-loader": "3.1.0",
117
117
  "style-loader": "3.3.1",
118
118
  "tape": "5.5.3",