@kitware/vtk.js 24.7.1 → 24.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
- package/Common/Core/ScalarsToColors.d.ts +6 -16
- package/Common/DataModel/Box.d.ts +4 -4
- package/Common/DataModel/CardinalSpline1D.d.ts +8 -4
- package/Common/DataModel/CardinalSpline1D.js +133 -4
- package/Common/DataModel/Cell.js +3 -1
- package/Common/DataModel/CellTypes.js +6 -1
- package/Common/DataModel/ITKHelper.d.ts +54 -0
- package/Common/DataModel/KochanekSpline1D.d.ts +8 -4
- package/Common/DataModel/KochanekSpline1D.js +103 -2
- package/Common/DataModel/Line.d.ts +8 -3
- package/Common/DataModel/Line.js +16 -11
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/PolyData/Constants.d.ts +6 -0
- package/Common/DataModel/PolyLine.d.ts +63 -0
- package/Common/DataModel/PolyLine.js +84 -0
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Spline1D/Constants.js +17 -0
- package/Common/DataModel/Spline1D.d.ts +20 -2
- package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
- package/Common/DataModel/Spline3D.d.ts +4 -9
- package/Common/DataModel/Spline3D.js +20 -15
- package/Filters/General/ImageCropFilter.d.ts +9 -6
- package/Filters/Sources/LineSource.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseRangeManipulator.js +23 -6
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
- package/Interaction/Widgets/OrientationMarkerWidget.d.ts +2 -6
- package/Rendering/Core/CellPicker.js +53 -32
- package/Rendering/Core/Mapper/Constants.d.ts +26 -0
- package/Rendering/Core/Mapper.d.ts +5 -21
- package/Rendering/Core/Property/Constants.d.ts +24 -0
- package/Rendering/Core/Property.d.ts +6 -20
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
- package/Rendering/Core/RenderWindowInteractor.d.ts +223 -121
- package/Rendering/Core/Viewport.d.ts +2 -4
- package/Rendering/Core/VolumeMapper/Constants.d.ts +19 -0
- package/Rendering/Core/VolumeMapper.d.ts +5 -9
- package/Rendering/Core/VolumeProperty.d.ts +5 -13
- package/Rendering/Misc/FullScreenRenderWindow.d.ts +3 -2
- package/Rendering/OpenGL/RenderWindow.d.ts +28 -10
- package/Widgets/Core/StateBuilder/manipulatorMixin.js +15 -15
- package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
- package/Widgets/Manipulators/AbstractManipulator.js +57 -0
- package/Widgets/Manipulators/LineManipulator.d.ts +8 -74
- package/Widgets/Manipulators/LineManipulator.js +14 -11
- package/Widgets/Manipulators/PlaneManipulator.d.ts +8 -74
- package/Widgets/Manipulators/PlaneManipulator.js +12 -9
- package/Widgets/Manipulators/TrackballManipulator.d.ts +8 -44
- package/Widgets/Manipulators/TrackballManipulator.js +13 -10
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Representations/SplineContextRepresentation.js +28 -9
- package/Widgets/Representations/WidgetRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget/behavior.js +7 -4
- package/Widgets/Widgets3D/AngleWidget/state.js +2 -2
- package/Widgets/Widgets3D/AngleWidget.js +20 -3
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +7 -2
- package/Widgets/Widgets3D/DistanceWidget/state.js +2 -2
- package/Widgets/Widgets3D/DistanceWidget.js +19 -2
- package/Widgets/Widgets3D/EllipseWidget.js +4 -3
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +3 -4
- package/Widgets/Widgets3D/ImageCroppingWidget.js +42 -13
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +5 -5
- package/Widgets/Widgets3D/LabelWidget/behavior.js +6 -2
- package/Widgets/Widgets3D/LabelWidget/state.js +2 -2
- package/Widgets/Widgets3D/LabelWidget.js +18 -3
- package/Widgets/Widgets3D/LineWidget/behavior.js +11 -4
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/LineWidget/state.js +1 -1
- package/Widgets/Widgets3D/LineWidget.js +18 -1
- package/Widgets/Widgets3D/PaintWidget/behavior.js +12 -9
- package/Widgets/Widgets3D/PaintWidget.js +24 -8
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +11 -4
- package/Widgets/Widgets3D/PolyLineWidget/state.js +2 -2
- package/Widgets/Widgets3D/PolyLineWidget.js +21 -2
- package/Widgets/Widgets3D/RectangleWidget.js +6 -5
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +5 -5
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +9 -5
- package/Widgets/Widgets3D/ShapeWidget.js +12 -2
- package/Widgets/Widgets3D/SphereWidget/behavior.js +4 -3
- package/Widgets/Widgets3D/SphereWidget.js +23 -2
- package/Widgets/Widgets3D/SplineWidget/behavior.js +7 -3
- package/Widgets/Widgets3D/SplineWidget/state.js +12 -2
- package/Widgets/Widgets3D/SplineWidget.js +22 -3
- package/index.d.ts +12 -1
- package/package.json +1 -1
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { Bounds, Range } from './../../types';
|
|
2
2
|
import vtkAbstractMapper, { IAbstractMapperInitialValues } from './AbstractMapper';
|
|
3
|
-
|
|
4
|
-
export enum BlendMode {
|
|
5
|
-
COMPOSITE_BLEND,
|
|
6
|
-
MAXIMUM_INTENSITY_BLEND,
|
|
7
|
-
MINIMUM_INTENSITY_BLEND,
|
|
8
|
-
AVERAGE_INTENSITY_BLEND,
|
|
9
|
-
}
|
|
3
|
+
import { BlendMode, FilterMode } from './VolumeMapper/Constants';
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
6
|
*
|
|
@@ -165,7 +159,9 @@ export function newInstance(initialValues?: IVolumeMapperInitialValues): vtkVolu
|
|
|
165
159
|
* A volume mapper that performs ray casting on the GPU using fragment programs.
|
|
166
160
|
*/
|
|
167
161
|
export declare const vtkVolumeMapper: {
|
|
168
|
-
newInstance: typeof newInstance
|
|
169
|
-
extend: typeof extend
|
|
162
|
+
newInstance: typeof newInstance;
|
|
163
|
+
extend: typeof extend;
|
|
164
|
+
BlendMode: typeof BlendMode;
|
|
165
|
+
FilterMode: typeof FilterMode;
|
|
170
166
|
};
|
|
171
167
|
export default vtkVolumeMapper;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
|
-
|
|
3
|
-
export enum InterpolationType {
|
|
4
|
-
NEAREST,
|
|
5
|
-
LINEAR,
|
|
6
|
-
FAST_LINEAR,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum OpacityMode {
|
|
10
|
-
FRACTIONAL,
|
|
11
|
-
PROPORTIONAL,
|
|
12
|
-
}
|
|
2
|
+
import { InterpolationType, OpacityMode } from './VolumeProperty/Constants';
|
|
13
3
|
|
|
14
4
|
interface IVolumePropertyInitialValues {
|
|
15
5
|
independentComponents?: boolean;
|
|
@@ -412,7 +402,9 @@ export function newInstance(initialValues?: IVolumePropertyInitialValues): vtkVo
|
|
|
412
402
|
* ```
|
|
413
403
|
*/
|
|
414
404
|
export declare const vtkVolumeProperty: {
|
|
415
|
-
newInstance: typeof newInstance
|
|
416
|
-
extend: typeof extend
|
|
405
|
+
newInstance: typeof newInstance;
|
|
406
|
+
extend: typeof extend;
|
|
407
|
+
InterpolationType: typeof InterpolationType;
|
|
408
|
+
OpacityMode: typeof OpacityMode;
|
|
417
409
|
};
|
|
418
410
|
export default vtkVolumeProperty;
|
|
@@ -13,10 +13,11 @@ import vtkRenderWindowInteractor from './../Core/RenderWindowInteractor';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface IFullScreenRenderWindowInitialValues {
|
|
15
15
|
background?: RGBColor;
|
|
16
|
+
container?: HTMLElement
|
|
16
17
|
containerStyle?: object;
|
|
17
|
-
controlPanelStyle?: object
|
|
18
|
-
listenWindowResize?: boolean;
|
|
18
|
+
controlPanelStyle?: object;
|
|
19
19
|
controllerVisibility?: boolean;
|
|
20
|
+
listenWindowResize?: boolean;
|
|
20
21
|
resizeCallback?: any;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { vtkAlgorithm, vtkObject } from './../../interfaces';
|
|
2
2
|
import { Nullable, Size, Vector2, Vector3 } from './../../types';
|
|
3
|
-
import { vtkRenderer } from './../Core/Renderer';
|
|
4
3
|
import { VtkDataTypes } from './../../Common/Core/DataArray';
|
|
4
|
+
import vtkRenderer from './../Core/Renderer';
|
|
5
5
|
import vtkTexture from './../Core/Texture';
|
|
6
6
|
import vtkViewStream from './../../IO/Core/ImageStream/ViewStream';
|
|
7
7
|
|
|
@@ -9,15 +9,33 @@ import vtkViewStream from './../../IO/Core/ImageStream/ViewStream';
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
export interface IOpenGLRenderWindowInitialValues {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
cullFaceEnabled?: boolean;
|
|
13
|
+
shaderCache?: null;
|
|
14
|
+
initialized?: boolean;
|
|
15
|
+
context?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
16
|
+
canvas?: HTMLCanvasElement;
|
|
17
|
+
cursorVisibility?: boolean;
|
|
18
|
+
cursor?: string;
|
|
19
|
+
textureUnitManager?: null;
|
|
20
|
+
textureResourceIds?: null;
|
|
21
|
+
containerSize?: Size;
|
|
22
|
+
renderPasses?: any[];
|
|
23
|
+
notifyStartCaptureImage?: boolean;
|
|
24
|
+
webgl2?: boolean;
|
|
25
|
+
defaultToWebgl2?: boolean;
|
|
26
|
+
activeFramebuffer?: any;
|
|
27
|
+
xrSession?: any;
|
|
28
|
+
xrSessionIsAR?: boolean;
|
|
29
|
+
xrReferenceSpace?: any;
|
|
30
|
+
xrSupported?: boolean;
|
|
31
|
+
imageFormat?: 'image/png';
|
|
32
|
+
useOffScreen?: boolean;
|
|
33
|
+
useBackgroundImage?: boolean;
|
|
16
34
|
}
|
|
17
35
|
|
|
18
|
-
export interface
|
|
19
|
-
resetCamera: boolean
|
|
20
|
-
size: Size
|
|
36
|
+
export interface ICaptureOptions {
|
|
37
|
+
resetCamera: boolean;
|
|
38
|
+
size: Size;
|
|
21
39
|
scale: number
|
|
22
40
|
}
|
|
23
41
|
|
|
@@ -278,9 +296,9 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
|
|
|
278
296
|
* size is assumed. The default format is "image/png". Returns a promise
|
|
279
297
|
* that resolves to the captured screenshot.
|
|
280
298
|
* @param {String} format
|
|
281
|
-
* @param {
|
|
299
|
+
* @param {ICaptureOptions} options
|
|
282
300
|
*/
|
|
283
|
-
captureNextImage(format: string, options:
|
|
301
|
+
captureNextImage(format: string, options: ICaptureOptions): Nullable<Promise<string>>;
|
|
284
302
|
|
|
285
303
|
/**
|
|
286
304
|
*
|
|
@@ -7,23 +7,23 @@ function vtkManipulatorMixin(publicAPI, model) {
|
|
|
7
7
|
normal = model.normal,
|
|
8
8
|
direction = model.direction;
|
|
9
9
|
var _model$manipulator = model.manipulator,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (origin &&
|
|
16
|
-
|
|
17
|
-
} else if (origin &&
|
|
18
|
-
|
|
10
|
+
setHandleOrigin = _model$manipulator.setHandleOrigin,
|
|
11
|
+
setHandleCenter = _model$manipulator.setHandleCenter,
|
|
12
|
+
setHandleNormal = _model$manipulator.setHandleNormal,
|
|
13
|
+
setHandleDirection = _model$manipulator.setHandleDirection;
|
|
14
|
+
|
|
15
|
+
if (origin && setHandleOrigin) {
|
|
16
|
+
setHandleOrigin(origin);
|
|
17
|
+
} else if (origin && setHandleCenter) {
|
|
18
|
+
setHandleCenter(origin);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
if (direction &&
|
|
22
|
-
|
|
23
|
-
} else if (direction && !normal &&
|
|
24
|
-
|
|
25
|
-
} else if (normal &&
|
|
26
|
-
|
|
21
|
+
if (direction && setHandleDirection) {
|
|
22
|
+
setHandleDirection(direction);
|
|
23
|
+
} else if (direction && !normal && setHandleNormal) {
|
|
24
|
+
setHandleNormal(direction);
|
|
25
|
+
} else if (normal && setHandleDirection) {
|
|
26
|
+
setHandleDirection(normal);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -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,81 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAbstractManipulatorInitialValues, vtkAbstractManipulator } from './AbstractManipulator';
|
|
2
|
+
import { Vector3 } from './../../types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
*
|
|
5
6
|
*/
|
|
6
|
-
export interface ILineManipulatorInitialValues {
|
|
7
|
-
origin?: number[];
|
|
8
|
-
normal?: number[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface vtkLineManipulator extends vtkObject {
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Set the normal of the line
|
|
15
|
-
*/
|
|
16
|
-
getNormal(): number[];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Set the normal of the line
|
|
20
|
-
*/
|
|
21
|
-
getNormalByReference(): number[];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Set the origin of the line
|
|
25
|
-
*/
|
|
26
|
-
getOrigin(): number[];
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Set the origin of the line
|
|
30
|
-
*/
|
|
31
|
-
getOriginByReference(): number[];
|
|
7
|
+
export interface ILineManipulatorInitialValues extends IAbstractManipulatorInitialValues {
|
|
32
8
|
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
* @param callData
|
|
36
|
-
* @param glRenderWindow
|
|
37
|
-
*/
|
|
38
|
-
handleEvent(callData: any, glRenderWindow: any): number[];
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Set the normal of the line
|
|
42
|
-
* @param {Number[]} normal The normal coordinate.
|
|
43
|
-
*/
|
|
44
|
-
setNormal(normal: number[]): boolean;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Set the normal of the line
|
|
48
|
-
* @param {Number} x The x coordinate.
|
|
49
|
-
* @param {Number} y The y coordinate.
|
|
50
|
-
* @param {Number} z The z coordinate.
|
|
51
|
-
*/
|
|
52
|
-
setNormal(x: number, y: number, z: number): boolean;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Set the normal of the line
|
|
56
|
-
* @param {Number[]} normal The normal coordinate.
|
|
57
|
-
*/
|
|
58
|
-
setNormalFrom(normal: number[]): boolean;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Set the origin of the line.
|
|
62
|
-
* @param {Number[]} origin The coordinate of the origin point.
|
|
63
|
-
*/
|
|
64
|
-
setOrigin(origin: number[]): boolean;
|
|
9
|
+
}
|
|
65
10
|
|
|
66
|
-
|
|
67
|
-
* Set the origin of the line
|
|
68
|
-
* @param {Number} x The x coordinate of the origin point.
|
|
69
|
-
* @param {Number} y The y coordinate of the origin point.
|
|
70
|
-
* @param {Number} z The z coordinate of the origin point.
|
|
71
|
-
*/
|
|
72
|
-
setOrigin(x: number, y: number, z: number): boolean;
|
|
11
|
+
export interface vtkLineManipulator extends vtkAbstractManipulator {
|
|
73
12
|
|
|
74
|
-
/**
|
|
75
|
-
* Set the origin of the line
|
|
76
|
-
* @param {Number[]} origin The coordinate of the origin point.
|
|
77
|
-
*/
|
|
78
|
-
setOriginFrom(origin: number[]): boolean;
|
|
79
13
|
}
|
|
80
14
|
|
|
81
15
|
|
|
@@ -97,12 +31,12 @@ export function newInstance(initialValues?: ILineManipulatorInitialValues): vtkL
|
|
|
97
31
|
*
|
|
98
32
|
* @param {Number} x
|
|
99
33
|
* @param {Number} y
|
|
100
|
-
* @param {
|
|
101
|
-
* @param {
|
|
34
|
+
* @param {Vector3} lineOrigin
|
|
35
|
+
* @param {Vector3} lineDirection
|
|
102
36
|
* @param renderer
|
|
103
37
|
* @param glRenderWindow
|
|
104
38
|
*/
|
|
105
|
-
export function projectDisplayToLine(x: number, y: number, lineOrigin:
|
|
39
|
+
export function projectDisplayToLine(x: number, y: number, lineOrigin: Vector3, lineDirection: Vector3, renderer: any, glRenderWindow: any): Vector3;
|
|
106
40
|
|
|
107
41
|
/**
|
|
108
42
|
* vtkLineManipulator.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
|
-
import {
|
|
3
|
+
import { s as subtract, j as cross, d as dot, x as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
|
|
4
|
+
import vtkAbstractManipulator from './AbstractManipulator.js';
|
|
3
5
|
|
|
6
|
+
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; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
9
|
function projectDisplayToLine(x, y, lineOrigin, lineDirection, renderer, glRenderWindow) {
|
|
5
10
|
var near = glRenderWindow.displayToWorld(x, y, 0, renderer);
|
|
6
11
|
var far = glRenderWindow.displayToWorld(x, y, 1, renderer);
|
|
@@ -20,27 +25,25 @@ function projectDisplayToLine(x, y, lineOrigin, lineDirection, renderer, glRende
|
|
|
20
25
|
// ----------------------------------------------------------------------------
|
|
21
26
|
|
|
22
27
|
function vtkLineManipulator(publicAPI, model) {
|
|
23
|
-
// Set our
|
|
24
|
-
model.classHierarchy.push('vtkLineManipulator');
|
|
28
|
+
// Set our className
|
|
29
|
+
model.classHierarchy.push('vtkLineManipulator');
|
|
25
30
|
|
|
26
31
|
publicAPI.handleEvent = function (callData, glRenderWindow) {
|
|
27
|
-
return projectDisplayToLine(callData.position.x, callData.position.y,
|
|
32
|
+
return projectDisplayToLine(callData.position.x, callData.position.y, publicAPI.getOrigin(callData), publicAPI.getNormal(callData), callData.pokedRenderer, glRenderWindow);
|
|
28
33
|
};
|
|
29
34
|
} // ----------------------------------------------------------------------------
|
|
30
35
|
// Object factory
|
|
31
36
|
// ----------------------------------------------------------------------------
|
|
32
37
|
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
function defaultValues(initialValues) {
|
|
40
|
+
return _objectSpread({}, initialValues);
|
|
41
|
+
} // ----------------------------------------------------------------------------
|
|
42
|
+
|
|
38
43
|
|
|
39
44
|
function extend(publicAPI, model) {
|
|
40
45
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
41
|
-
|
|
42
|
-
macro.obj(publicAPI, model);
|
|
43
|
-
macro.setGetArray(publicAPI, model, ['origin', 'normal'], 3);
|
|
46
|
+
vtkAbstractManipulator.extend(publicAPI, model, defaultValues(initialValues));
|
|
44
47
|
vtkLineManipulator(publicAPI, model);
|
|
45
48
|
} // ----------------------------------------------------------------------------
|
|
46
49
|
|