@kitware/vtk.js 23.4.2 → 23.4.4

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.
Files changed (180) hide show
  1. package/Common/Core/Math/Constants.js +12 -0
  2. package/Common/Core/Math/index.js +1 -1
  3. package/Common/Core/Math.js +1 -1
  4. package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
  5. package/Common/DataModel/AbstractPointLocator.d.ts +54 -0
  6. package/Common/DataModel/AbstractPointLocator.js +40 -0
  7. package/Common/DataModel/BoundingBox.d.ts +659 -0
  8. package/Common/DataModel/Collection.d.ts +118 -0
  9. package/Common/DataModel/Collection.js +113 -0
  10. package/Common/DataModel/DataSet/Constants.d.ts +27 -0
  11. package/Common/DataModel/EdgeLocator.d.ts +79 -0
  12. package/Common/DataModel/EdgeLocator.js +85 -0
  13. package/Common/DataModel/ITKHelper.d.ts +54 -0
  14. package/Common/DataModel/IncrementalOctreeNode.d.ts +297 -0
  15. package/Common/DataModel/IncrementalOctreeNode.js +640 -0
  16. package/Common/DataModel/IncrementalOctreePointLocator.d.ts +61 -0
  17. package/Common/DataModel/IncrementalOctreePointLocator.js +398 -0
  18. package/Common/DataModel/Locator.d.ts +43 -0
  19. package/Common/DataModel/Locator.js +37 -0
  20. package/Common/DataModel/Plane.js +1 -1
  21. package/Common/DataModel/PolyData/Constants.d.ts +6 -0
  22. package/Common/DataModel/PolyLine.d.ts +63 -0
  23. package/Common/DataModel/PolyLine.js +77 -0
  24. package/Common/DataModel/Polygon/Constants.js +12 -0
  25. package/Common/DataModel/Polygon.js +1 -1
  26. package/Common/DataModel/Quad/Constants.js +9 -0
  27. package/Common/DataModel/Quad.d.ts +91 -0
  28. package/Common/DataModel/Quad.js +235 -0
  29. package/Common/DataModel/SelectionNode/Constants.d.ts +27 -0
  30. package/Common/DataModel/Spline1D/Constants.js +17 -0
  31. package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
  32. package/Common/Transform/Transform.js +51 -0
  33. package/Filters/Core/PolyDataNormals.js +124 -0
  34. package/Filters/General/ClipClosedSurface/Constants.js +10 -0
  35. package/Filters/General/ClipClosedSurface.d.ts +95 -0
  36. package/Filters/General/ClipClosedSurface.js +972 -0
  37. package/Filters/General/ContourTriangulator/Constants.js +6 -0
  38. package/Filters/General/ContourTriangulator/helper.js +1951 -0
  39. package/Filters/General/ContourTriangulator.d.ts +136 -0
  40. package/Filters/General/ContourTriangulator.js +202 -0
  41. package/Filters/General/ImageMarchingCubes.js +1 -1
  42. package/Filters/General/MoleculeToRepresentation.js +1 -1
  43. package/Filters/General/OBBTree/OBBNode.js +82 -0
  44. package/Filters/General/OBBTree/helper.js +92 -0
  45. package/Filters/General/OBBTree.js +1243 -0
  46. package/Filters/General/TubeFilter.js +1 -1
  47. package/Filters/Sources/LineSource.js +1 -1
  48. package/Filters/Sources/PlaneSource.js +1 -1
  49. package/Filters/Texture/TextureMapToPlane.js +1 -1
  50. package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
  51. package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
  52. package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
  53. package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
  54. package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
  55. package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
  56. package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
  57. package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
  58. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
  59. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
  60. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
  61. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
  62. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
  63. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
  64. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
  65. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
  66. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
  67. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
  68. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
  69. package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
  70. package/Interaction/Style/InteractorStyleImage.d.ts +107 -0
  71. package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
  72. package/Interaction/Style/InteractorStyleManipulator.d.ts +348 -0
  73. package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +170 -0
  74. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +1 -1
  75. package/Interaction/Widgets/LabelRepresentation.js +1 -1
  76. package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
  77. package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +1 -1
  78. package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -1
  79. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -1
  80. package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
  81. package/Proxy/Core/LookupTableProxy.d.ts +45 -0
  82. package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
  83. package/Proxy/Core/ProxyManager.d.ts +115 -0
  84. package/Proxy/Core/SourceProxy.d.ts +22 -0
  85. package/Proxy/Core/View2DProxy.d.ts +7 -0
  86. package/Proxy/Core/View2DProxy.js +1 -1
  87. package/Proxy/Core/ViewProxy.d.ts +86 -0
  88. package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
  89. package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
  90. package/README.md +2 -2
  91. package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
  92. package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
  93. package/Rendering/Core/AbstractImageMapper.js +44 -0
  94. package/Rendering/Core/Camera.js +1 -1
  95. package/Rendering/Core/CellPicker.js +1 -1
  96. package/Rendering/Core/ColorTransferFunction/ColorMaps.d.ts +24 -0
  97. package/Rendering/Core/ColorTransferFunction/Constants.d.ts +17 -0
  98. package/Rendering/Core/ColorTransferFunction.js +1 -1
  99. package/Rendering/Core/Coordinate/Constants.d.ts +14 -0
  100. package/Rendering/Core/Coordinate.js +1 -1
  101. package/Rendering/Core/Glyph3DMapper/Constants.d.ts +17 -0
  102. package/Rendering/Core/Glyph3DMapper.js +1 -1
  103. package/Rendering/Core/HardwareSelector.d.ts +84 -0
  104. package/Rendering/Core/ImageArrayMapper.d.ts +253 -0
  105. package/Rendering/Core/ImageArrayMapper.js +242 -0
  106. package/Rendering/Core/ImageMapper/Constants.d.ts +14 -0
  107. package/Rendering/Core/ImageMapper.js +1 -1
  108. package/Rendering/Core/ImageProperty/Constants.d.ts +9 -0
  109. package/Rendering/Core/ImageResliceMapper/Constants.d.ts +11 -0
  110. package/Rendering/Core/ImageResliceMapper/Constants.js +11 -0
  111. package/Rendering/Core/ImageResliceMapper.d.ts +245 -0
  112. package/Rendering/Core/ImageResliceMapper.js +70 -0
  113. package/Rendering/Core/InteractorObserver.d.ts +132 -0
  114. package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
  115. package/Rendering/Core/InteractorStyle.d.ts +229 -0
  116. package/Rendering/Core/Light.js +1 -1
  117. package/Rendering/Core/Mapper/Constants.d.ts +26 -0
  118. package/Rendering/Core/Mapper.js +1 -1
  119. package/Rendering/Core/Picker.js +1 -1
  120. package/Rendering/Core/Prop/Constants.d.ts +9 -0
  121. package/Rendering/Core/Prop/Constants.js +9 -0
  122. package/Rendering/Core/Property/Constants.d.ts +24 -0
  123. package/Rendering/Core/Property2D/Constants.d.ts +9 -0
  124. package/Rendering/Core/RenderWindow.js +1 -1
  125. package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
  126. package/Rendering/Core/Renderer.js +1 -1
  127. package/Rendering/Core/VolumeMapper/Constants.d.ts +20 -0
  128. package/Rendering/Core/VolumeMapper.js +1 -1
  129. package/Rendering/Core/VolumeProperty/Constants.d.ts +16 -0
  130. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +129 -0
  131. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +131 -0
  132. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
  133. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +763 -0
  134. package/Rendering/OpenGL/HardwareSelector/Constants.d.ts +8 -0
  135. package/Rendering/OpenGL/HardwareSelector.d.ts +339 -0
  136. package/Rendering/OpenGL/ImageResliceMapper.js +996 -0
  137. package/Rendering/OpenGL/PolyDataMapper.js +1 -1
  138. package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
  139. package/Rendering/OpenGL/RenderWindow/Constants.d.ts +10 -0
  140. package/Rendering/OpenGL/RenderWindow/Constants.js +13 -0
  141. package/Rendering/OpenGL/RenderWindow/ContextProxy.js +70 -0
  142. package/Rendering/OpenGL/RenderWindow.d.ts +9 -2
  143. package/Rendering/OpenGL/RenderWindow.js +2 -1
  144. package/Rendering/OpenGL/glsl/vtkImageResliceMapperFS.glsl.js +3 -0
  145. package/Rendering/OpenGL/glsl/vtkImageResliceMapperVS.glsl.js +3 -0
  146. package/Rendering/WebGPU/Actor2D.js +151 -0
  147. package/Rendering/WebGPU/BufferManager.js +1 -1
  148. package/Rendering/WebGPU/CellArrayMapper.js +853 -0
  149. package/Rendering/WebGPU/IndexBuffer.js +397 -0
  150. package/Rendering/WebGPU/PolyDataMapper2D.js +99 -0
  151. package/Rendering/WebGPU/RenderWindow.js +3 -1
  152. package/Rendering/WebGPU/SimpleMapper.js +290 -0
  153. package/Widgets/Core/AbstractWidget.d.ts +187 -0
  154. package/Widgets/Core/AbstractWidgetFactory.d.ts +131 -0
  155. package/Widgets/Core/StateBuilder/color3Mixin.js +24 -0
  156. package/Widgets/Core/StateBuilder/orientationMixin.js +1 -1
  157. package/Widgets/Core/StateBuilder.d.ts +29 -0
  158. package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
  159. package/Widgets/Core/WidgetManager.d.ts +231 -0
  160. package/Widgets/Core/WidgetState.d.ts +81 -0
  161. package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
  162. package/Widgets/Manipulators/AbstractManipulator.js +57 -0
  163. package/Widgets/Manipulators/LineManipulator.js +1 -1
  164. package/Widgets/Manipulators/TrackballManipulator.js +1 -1
  165. package/Widgets/Representations/GlyphRepresentation.js +325 -0
  166. package/Widgets/Representations/LineHandleRepresentation.js +116 -0
  167. package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
  168. package/Widgets/Representations/WidgetRepresentation.js +1 -1
  169. package/Widgets/Widgets3D/AngleWidget.js +1 -1
  170. package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
  171. package/Widgets/Widgets3D/LabelWidget/behavior.js +157 -0
  172. package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
  173. package/Widgets/Widgets3D/LabelWidget.js +78 -0
  174. package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
  175. package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
  176. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  177. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
  178. package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
  179. package/index.d.ts +133 -74
  180. package/package.json +1 -1
@@ -0,0 +1,231 @@
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 {vtkRenderer} renderer The vtkRenderer instance.
37
+ */
38
+ export function extractRenderingComponents(renderer: vtkRenderer): IRenderingComponents;
39
+
40
+ /**
41
+ * This method returns the world distance that corresponds to the height of a
42
+ * single display pixel at a given coordinate. For example, to determine the
43
+ * (vertical) distance that matches a display distance of 30px for a coordinate
44
+ * `coord`, you would compute `30 * getPixelWorldHeightAtCoord(coord)`.
45
+ */
46
+ export function getPixelWorldHeightAtCoord(coord: []): Number;
47
+
48
+ export interface vtkWidgetManager extends vtkObject {
49
+ /**
50
+ * The the captureOn value.
51
+ * `CaptureOn.MOUSE_MOVE`: captures small region when moving mouse
52
+ * `CaptureOn.MOUSE_RELEASE`: captures entire region when mouse button is released
53
+ *
54
+ * @param {CaptureOn} captureOn
55
+ */
56
+ setCaptureOn(captureOn: CaptureOn): boolean;
57
+
58
+ /**
59
+ * Get the captureOn value.
60
+ */
61
+ getCaptureOn(): CaptureOn;
62
+
63
+ /**
64
+ * The the view type.
65
+ *
66
+ * @param {ViewTypes} type
67
+ */
68
+ setViewType(type: ViewTypes): boolean;
69
+
70
+ /**
71
+ * Get the view type.
72
+ */
73
+ getViewType(): ViewTypes;
74
+
75
+ /**
76
+ * Get the current selection.
77
+ */
78
+ getSelections(): vtkSelectionNode[];
79
+
80
+ /**
81
+ * Get all the underlying widgets.
82
+ */
83
+ getWidgets(): vtkAbstractWidget[];
84
+
85
+ /**
86
+ * Get the active widget.
87
+ *
88
+ * If no widget is active, returns null.
89
+ */
90
+ getActiveWidget(): Nullable<vtkAbstractWidget>;
91
+
92
+ /**
93
+ * Get the view id.
94
+ */
95
+ getViewId(): string;
96
+
97
+ /**
98
+ * Returns true if picking is enabled, false otherwise.
99
+ */
100
+ getPickingEnabled(): boolean;
101
+
102
+ /**
103
+ * @deprecated
104
+ */
105
+ getUseSvgLayer(): boolean;
106
+
107
+ /**
108
+ * @deprecated
109
+ */
110
+ setUseSvgLayer(use: boolean): boolean;
111
+
112
+ /**
113
+ * Enable the picking.
114
+ */
115
+ enablePicking(): void;
116
+
117
+ /**
118
+ * Renders all the widgets.
119
+ */
120
+ renderWidgets(): void;
121
+
122
+ /**
123
+ * Disable the picking.
124
+ */
125
+ disablePicking(): void;
126
+
127
+ /**
128
+ * Set the renderer.
129
+ *
130
+ * @param {vtkRenderer} renderer
131
+ */
132
+ setRenderer(renderer: vtkRenderer): void;
133
+
134
+ /**
135
+ * Register a widget on the widget manager instance.
136
+ * Please note that one should link the widget manager to a view before calling this method.
137
+ *
138
+ * @param {vtkAbstractWidgetFactory} widget The abstract widget factory.
139
+ * @param {ViewTypes} [viewType]
140
+ * @param {Object} [initialValues]
141
+ */
142
+ addWidget(
143
+ widget: vtkAbstractWidgetFactory,
144
+ viewType?: ViewTypes,
145
+ initialValues?: object
146
+ ): Nullable<vtkAbstractWidget>;
147
+
148
+ /**
149
+ * Unregister all widgets from the widget manager.
150
+ */
151
+ removeWidgets(): void;
152
+
153
+ /**
154
+ * Remove a widget from the widget manager.
155
+ *
156
+ * @param {vtkAbstractWidget | vtkAbstractWidgetFactory} widget The widget to remove
157
+ */
158
+ removeWidget(widget: vtkAbstractWidget | vtkAbstractWidgetFactory): void;
159
+
160
+ /**
161
+ * Given x and y parameter, get selected data.
162
+ *
163
+ * @param {Number} x
164
+ * @param {Number} y
165
+ */
166
+ getSelectedDataForXY(x: number, y: number): Promise<ISelectedData>;
167
+
168
+ /**
169
+ * @deprecated
170
+ */
171
+ updateSelectionFromXY(x: number, y: number): void;
172
+
173
+ /**
174
+ * @deprecated
175
+ */
176
+ updateSelectionFromMouseEvent(event: MouseEvent): void;
177
+
178
+ /**
179
+ * The all currently selected data.
180
+ */
181
+ getSelectedData(): ISelectedData | {};
182
+
183
+ /**
184
+ * Given the focus to the given widget instance.
185
+ *
186
+ * @param {vtkAbstractWidget | vtkAbstractWidgetFactory} widget The widget instance which should get the focus.
187
+ */
188
+ grabFocus(widget: vtkAbstractWidget | vtkAbstractWidgetFactory): void;
189
+
190
+ /**
191
+ * Release the focus.
192
+ */
193
+ releaseFocus(): void;
194
+ }
195
+
196
+ export interface IWidgetManagerInitialValues {
197
+ captureOn?: CaptureOn;
198
+ viewType?: ViewTypes;
199
+ pickingEnabled?: boolean;
200
+ /**
201
+ * @deprecated
202
+ */
203
+ useSvgLayer?: boolean;
204
+ }
205
+
206
+ /**
207
+ * Method used to decorate a given object (publicAPI+model) with vtkWidgetManager characteristics.
208
+ *
209
+ * @param publicAPI object on which methods will be bounds (public)
210
+ * @param model object on which data structure will be bounds (protected)
211
+ * @param initialValues (default: {})
212
+ */
213
+ export function extend(
214
+ publicAPI: object,
215
+ model: object,
216
+ initialValues?: IWidgetManagerInitialValues
217
+ ): vtkWidgetManager;
218
+
219
+ /**
220
+ * Method used to create a new instance of vtkCellArray
221
+ *
222
+ * @param initialValues for pre-setting some of its content
223
+ */
224
+ export function newInstance(initialValues?: IWidgetManagerInitialValues): vtkWidgetManager;
225
+
226
+ export declare const vtkWidgetManager: {
227
+ newInstance: typeof newInstance;
228
+ extend: typeof extend;
229
+ };
230
+
231
+ 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,221 @@
1
+ import { vtkObject } from './../../interfaces';
2
+ import { vtkOpenGLRenderWindow } from './../../Rendering/OpenGL/RenderWindow'
3
+ import { Vector3 } from './../../types';
4
+
5
+ /**
6
+ *
7
+ */
8
+ export interface IAbstractManipulatorInitialValues {
9
+ userOrigin?: Vector3;
10
+ handleOrigin?: Vector3;
11
+ widgetOrigin?: Vector3;
12
+ userNormal?: Vector3;
13
+ handleNormal?: Vector3;
14
+ widgetNormal?: Vector3;
15
+ }
16
+
17
+ export interface vtkAbstractManipulator extends vtkObject {
18
+
19
+ /**
20
+ * Get the normal of the line
21
+ */
22
+ getNormal(callData: any): Vector3;
23
+
24
+ /**
25
+ * Get the origin of the line
26
+ */
27
+ getOrigin(callData: any): Vector3;
28
+
29
+ /**
30
+ * Get the value of useCameraFocalPoint
31
+ */
32
+ getUseCameraFocalPoint(): boolean;
33
+
34
+ /**
35
+ * Set the value of useCameraFocalPoint
36
+ * @param useCameraFocalPoint if true, the focal point of the camera will be used if userOrigin is not set.
37
+ */
38
+ setUseCameraFocalPoint(useCameraFocalPoint: boolean): boolean;
39
+
40
+ /**
41
+ * Get the value of useCameraNormal
42
+ */
43
+ getUseCameraNormal(): boolean;
44
+
45
+ /**
46
+ * Set the value of useCameraNormal
47
+ * @param useCameraNormal if true, the normal of the camera will be used if userNormal is not set.
48
+ */
49
+ setUseCameraNormal(useCameraNormal: boolean): boolean;
50
+
51
+ /**
52
+ *
53
+ * @param callData
54
+ * @param glRenderWindow
55
+ */
56
+ handleEvent(callData: any, glRenderWindow: vtkOpenGLRenderWindow): Vector3;
57
+
58
+ /* ------------------------------------------------------------------- */
59
+
60
+ /**
61
+ * Set the user normal.
62
+ * This normal take precedence on the handleNormal and the widgetNormal.
63
+ * This normal should not be set within the widget internal code.
64
+ * @param {Vector3} normal The normal coordinate.
65
+ */
66
+ setUserNormal(normal: Vector3): boolean;
67
+
68
+ /**
69
+ * Set the user normal (see setUserNormal).
70
+ * @param {Number} x The x coordinate.
71
+ * @param {Number} y The y coordinate.
72
+ * @param {Number} z The z coordinate.
73
+ */
74
+ setUserNormal(x: number, y: number, z: number): boolean;
75
+
76
+ /**
77
+ * Set the user normal (see setUserNormal).
78
+ * @param {Vector3} normal The normal coordinate.
79
+ */
80
+ setUserNormalFrom(normal: Vector3): boolean;
81
+
82
+ /**
83
+ * Set the user origin.
84
+ * This origin take precedence on the handleOrigin and the widgetOrigin.
85
+ * This origin should not be set within the widget internal code.
86
+ * @param {Vector3} origin The coordinate of the origin point.
87
+ */
88
+ setUserOrigin(origin: Vector3): boolean;
89
+
90
+ /**
91
+ * Set the user origin (see setUserOrigin).
92
+ * @param {Number} x The x coordinate of the origin point.
93
+ * @param {Number} y The y coordinate of the origin point.
94
+ * @param {Number} z The z coordinate of the origin point.
95
+ */
96
+ setUserOrigin(x: number, y: number, z: number): boolean;
97
+
98
+ /**
99
+ * Set the user origin (see setUserOrigin).
100
+ * @param {Vector3} origin The coordinate of the origin point.
101
+ */
102
+ setUserOriginFrom(origin: Vector3): boolean;
103
+
104
+ /* ------------------------------------------------------------------- */
105
+
106
+ /**
107
+ * Set the handle normal.
108
+ * This normal is used after the userNormal and before the widgetNormal.
109
+ * This normal is automatically set by any state having a manipulatorMixin,
110
+ * and can be overridden in the widget code.
111
+ * @param {Vector3} normal The normal coordinate.
112
+ */
113
+ setHandleNormal(normal: Vector3): boolean;
114
+
115
+ /**
116
+ * Set the handle normal (see setHandleNormal).
117
+ * @param {Number} x The x coordinate.
118
+ * @param {Number} y The y coordinate.
119
+ * @param {Number} z The z coordinate.
120
+ */
121
+ setHandleNormal(x: number, y: number, z: number): boolean;
122
+
123
+ /**
124
+ * Set the handle normal (see setHandleNormal).
125
+ * @param {Vector3} normal The normal coordinate.
126
+ */
127
+ setHandleNormalFrom(normal: Vector3): boolean;
128
+
129
+ /**
130
+ * Set the handle origin.
131
+ * This origin is used after the userOrigin and before the widgetOrigin.
132
+ * This origin is automatically set by any state having a manipulatorMixin,
133
+ * and can be overridden in the widget code.
134
+ * @param {Vector3} origin The coordinate of the origin point.
135
+ */
136
+ setHandleOrigin(origin: Vector3): boolean;
137
+
138
+ /**
139
+ * Set the handle origin (see setHandleOrigin).
140
+ * @param {Number} x The x coordinate of the origin point.
141
+ * @param {Number} y The y coordinate of the origin point.
142
+ * @param {Number} z The z coordinate of the origin point.
143
+ */
144
+ setHandleOrigin(x: number, y: number, z: number): boolean;
145
+
146
+ /**
147
+ * Set the handle origin (see setHandleOrigin).
148
+ * @param {Vector3} origin The coordinate of the origin point.
149
+ */
150
+ setHandleOriginFrom(origin: Vector3): boolean;
151
+
152
+ /* ------------------------------------------------------------------- */
153
+
154
+ /**
155
+ * Set the widget normal.
156
+ * This normal is used if no other normals are set.
157
+ * It can be used to define a normal global to the whole widget.
158
+ * @param {Vector3} normal The normal coordinate.
159
+ */
160
+ setWidgetNormal(normal: Vector3): boolean;
161
+
162
+ /**
163
+ * Set the widget normal (see setWidgetNormal).
164
+ * @param {Number} x The x coordinate.
165
+ * @param {Number} y The y coordinate.
166
+ * @param {Number} z The z coordinate.
167
+ */
168
+ setWidgetNormal(x: number, y: number, z: number): boolean;
169
+
170
+ /**
171
+ * Set the widget normal (see setWidgetNormal).
172
+ * @param {Vector3} normal The normal coordinate.
173
+ */
174
+ setWidgetNormalFrom(normal: Vector3): boolean;
175
+
176
+ /**
177
+ * Set the widget origin.
178
+ * This origin is used if no other origins are set.
179
+ * It can be used to define an origin global to the whole widget.
180
+ * @param {Vector3} origin The coordinate of the origin point.
181
+ */
182
+ setWidgetOrigin(origin: Vector3): boolean;
183
+
184
+ /**
185
+ * Set the widget origin (see setWidgetOrigin).
186
+ * @param {Number} x The x coordinate of the origin point.
187
+ * @param {Number} y The y coordinate of the origin point.
188
+ * @param {Number} z The z coordinate of the origin point.
189
+ */
190
+ setWidgetOrigin(x: number, y: number, z: number): boolean;
191
+
192
+ /**
193
+ * Set the widget origin (see setWidgetOrigin).
194
+ * @param {Vector3} origin The coordinate of the origin point.
195
+ */
196
+ setWidgetOriginFrom(origin: Vector3): boolean;
197
+ }
198
+
199
+
200
+ /**
201
+ * Method use to decorate a given object (publicAPI+model) with vtkAbstractManipulator characteristics.
202
+ *
203
+ * @param publicAPI object on which methods will be bounds (public)
204
+ * @param model object on which data structure will be bounds (protected)
205
+ * @param {IAbstractManipulatorInitialValues} [initialValues] (default: {})
206
+ */
207
+ export function extend(publicAPI: object, model: object, initialValues?: IAbstractManipulatorInitialValues): void;
208
+
209
+ /**
210
+ * Method use to create a new instance of vtkAbstractManipulator
211
+ */
212
+ export function newInstance(initialValues?: IAbstractManipulatorInitialValues): vtkAbstractManipulator;
213
+
214
+ /**
215
+ * vtkAbstractManipulator.
216
+ */
217
+ export declare const vtkAbstractManipulator: {
218
+ newInstance: typeof newInstance,
219
+ extend: typeof extend,
220
+ };
221
+ export default vtkAbstractManipulator;
@@ -0,0 +1,57 @@
1
+ import macro from '../../macros.js';
2
+
3
+ // vtkAbstractManipulator methods
4
+ // ----------------------------------------------------------------------------
5
+
6
+ function vtkAbstractManipulator(publicAPI, model) {
7
+ // Set our className
8
+ model.classHierarchy.push('vtkAbstractManipulator');
9
+
10
+ publicAPI.getOrigin = function (callData) {
11
+ if (model.userOrigin) return model.userOrigin;
12
+ if (model.useCameraFocalPoint) return callData.pokedRenderer.getActiveCamera().getFocalPoint();
13
+ if (model.handleOrigin) return model.handleOrigin;
14
+ if (model.widgetOrigin) return model.widgetOrigin;
15
+ return [0, 0, 0];
16
+ };
17
+
18
+ publicAPI.getNormal = function (callData) {
19
+ if (model.userNormal) return model.userNormal;
20
+ if (model.useCameraNormal) return callData.pokedRenderer.getActiveCamera().getDirectionOfProjection();
21
+ if (model.handleNormal) return model.handleNormal;
22
+ if (model.widgetNormal) return model.widgetNormal;
23
+ return [0, 0, 1];
24
+ };
25
+ } // ----------------------------------------------------------------------------
26
+ // Object factory
27
+ // ----------------------------------------------------------------------------
28
+
29
+
30
+ var DEFAULT_VALUES = {
31
+ // userOrigin: null,
32
+ // handleOrigin: null,
33
+ // widgetOrigin: null,
34
+ // userNormal: null,
35
+ // handleNormal: null,
36
+ // widgetNormal: null
37
+ useCameraFocalPoint: false,
38
+ useCameraNormal: false
39
+ }; // ----------------------------------------------------------------------------
40
+
41
+ function extend(publicAPI, model) {
42
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
43
+ Object.assign(model, DEFAULT_VALUES, initialValues);
44
+ macro.obj(publicAPI, model);
45
+ macro.setGet(publicAPI, model, ['useCameraFocalPoint', 'useCameraNormal']);
46
+ macro.setGetArray(publicAPI, model, ['userOrigin', 'handleOrigin', 'widgetOrigin', 'userNormal', 'handleNormal', 'widgetNormal'], 3);
47
+ vtkAbstractManipulator(publicAPI, model);
48
+ } // ----------------------------------------------------------------------------
49
+
50
+ var newInstance = macro.newInstance(extend, 'vtkAbstractManipulator'); // ----------------------------------------------------------------------------
51
+
52
+ var vtkAbstractManipulator$1 = {
53
+ extend: extend,
54
+ newInstance: newInstance
55
+ };
56
+
57
+ export { vtkAbstractManipulator$1 as default, extend, newInstance };
@@ -1,5 +1,5 @@
1
1
  import macro from '../../macros.js';
2
- import { g as subtract, j as cross, d as dot, t as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
2
+ import { j as subtract, k as cross, d as dot, t as multiplyScalar, l as add } from '../../Common/Core/Math/index.js';
3
3
 
4
4
  function projectDisplayToLine(x, y, lineOrigin, lineDirection, renderer, glRenderWindow) {
5
5
  var near = glRenderWindow.displayToWorld(x, y, 0, renderer);
@@ -1,6 +1,6 @@
1
1
  import { mat4, vec3 } from 'gl-matrix';
2
2
  import macro from '../../macros.js';
3
- import { j as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
3
+ import { k as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
4
4
 
5
5
  function trackballRotate(prevX, prevY, curX, curY, origin, direction, renderer, glRenderWindow) {
6
6
  var dx = curX - prevX;