@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,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 IPlaneManipulatorInitialValues {
|
|
7
|
-
origin?: number[];
|
|
8
|
-
normal?: number[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface vtkPlaneManipulator extends vtkObject {
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get the normal of the plane
|
|
15
|
-
*/
|
|
16
|
-
getNormal(): number[];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Get the normal of the plane
|
|
20
|
-
*/
|
|
21
|
-
getNormalByReference(): number[];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Get the origin of the plane
|
|
25
|
-
*/
|
|
26
|
-
getOrigin(): number[];
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Get the origin of the plane
|
|
30
|
-
*/
|
|
31
|
-
getOriginByReference(): number[];
|
|
7
|
+
export interface IPlaneManipulatorInitialValues 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 plane
|
|
42
|
-
* @param {Number[]} normal The normal coordinate.
|
|
43
|
-
*/
|
|
44
|
-
setNormal(normal: number[]): boolean;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Set the normal of the plane
|
|
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 plane
|
|
56
|
-
* @param {Number[]} normal The normal coordinate.
|
|
57
|
-
*/
|
|
58
|
-
setNormalFrom(normal: number[]): boolean;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Set the origin of the plane.
|
|
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 plane.
|
|
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 vtkPlaneManipulator extends vtkAbstractManipulator {
|
|
73
12
|
|
|
74
|
-
/**
|
|
75
|
-
* Set the origin of the plane.
|
|
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?: IPlaneManipulatorInitialValues): vtk
|
|
|
97
31
|
*
|
|
98
32
|
* @param {Number} x
|
|
99
33
|
* @param {Number} y
|
|
100
|
-
* @param {
|
|
101
|
-
* @param {
|
|
34
|
+
* @param {Vector3} planeOrigin
|
|
35
|
+
* @param {Vector3} planeNormal
|
|
102
36
|
* @param renderer
|
|
103
37
|
* @param glRenderWindow
|
|
104
38
|
*/
|
|
105
|
-
export function intersectDisplayWithPlane(x: number, y: number, planeOrigin:
|
|
39
|
+
export function intersectDisplayWithPlane(x: number, y: number, planeOrigin: Vector3, planeNormal: Vector3, renderer: any, glRenderWindow: any): Vector3;
|
|
106
40
|
|
|
107
41
|
|
|
108
42
|
/**
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkPlane from '../../Common/DataModel/Plane.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 intersectDisplayWithPlane(x, y, planeOrigin, planeNormal, renderer, glRenderWindow) {
|
|
5
10
|
var near = glRenderWindow.displayToWorld(x, y, 0, renderer);
|
|
6
11
|
var far = glRenderWindow.displayToWorld(x, y, 1, renderer);
|
|
@@ -11,26 +16,24 @@ function intersectDisplayWithPlane(x, y, planeOrigin, planeNormal, renderer, glR
|
|
|
11
16
|
|
|
12
17
|
function vtkPlaneManipulator(publicAPI, model) {
|
|
13
18
|
// Set our className
|
|
14
|
-
model.classHierarchy.push('vtkPlaneManipulator');
|
|
19
|
+
model.classHierarchy.push('vtkPlaneManipulator');
|
|
15
20
|
|
|
16
21
|
publicAPI.handleEvent = function (callData, glRenderWindow) {
|
|
17
|
-
return intersectDisplayWithPlane(callData.position.x, callData.position.y,
|
|
22
|
+
return intersectDisplayWithPlane(callData.position.x, callData.position.y, publicAPI.getOrigin(callData), publicAPI.getNormal(callData), callData.pokedRenderer, glRenderWindow);
|
|
18
23
|
};
|
|
19
24
|
} // ----------------------------------------------------------------------------
|
|
20
25
|
// Object factory
|
|
21
26
|
// ----------------------------------------------------------------------------
|
|
22
27
|
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
function defaultValues(initialValues) {
|
|
30
|
+
return _objectSpread({}, initialValues);
|
|
31
|
+
} // ----------------------------------------------------------------------------
|
|
32
|
+
|
|
28
33
|
|
|
29
34
|
function extend(publicAPI, model) {
|
|
30
35
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
31
|
-
|
|
32
|
-
macro.obj(publicAPI, model);
|
|
33
|
-
macro.setGetArray(publicAPI, model, ['normal', 'origin'], 3);
|
|
36
|
+
vtkAbstractManipulator.extend(publicAPI, model, defaultValues(initialValues));
|
|
34
37
|
vtkPlaneManipulator(publicAPI, model);
|
|
35
38
|
} // ----------------------------------------------------------------------------
|
|
36
39
|
|
|
@@ -1,50 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAbstractManipulatorInitialValues, vtkAbstractManipulator } from './AbstractManipulator';
|
|
2
|
+
import { Vector3 } from './../../types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
*
|
|
5
6
|
*/
|
|
6
|
-
export interface ITrackballManipulatorInitialValues {
|
|
7
|
-
normal?: number[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface vtkTrackballManipulator extends vtkObject {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Get normal
|
|
14
|
-
*/
|
|
15
|
-
getNormal(): number[];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Get normal
|
|
19
|
-
*/
|
|
20
|
-
getNormalByReference(): number[];
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param callData
|
|
25
|
-
* @param glRenderWindow
|
|
26
|
-
*/
|
|
27
|
-
handleEvent(callData: any, glRenderWindow: any): void;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Set the normal of the line.
|
|
31
|
-
* @param {Number[]} normal The normal coordinate.
|
|
32
|
-
*/
|
|
33
|
-
setNormal(normal: number[]): boolean;
|
|
7
|
+
export interface ITrackballManipulatorInitialValues extends IAbstractManipulatorInitialValues {
|
|
34
8
|
|
|
35
|
-
|
|
36
|
-
* Set the normal of the line.
|
|
37
|
-
* @param {Number} x The x coordinate.
|
|
38
|
-
* @param {Number} y The y coordinate.
|
|
39
|
-
* @param {Number} z The z coordinate.
|
|
40
|
-
*/
|
|
41
|
-
setNormal(x: number, y: number, z: number): boolean;
|
|
9
|
+
}
|
|
42
10
|
|
|
43
|
-
|
|
44
|
-
* Set the normal of the line.
|
|
45
|
-
* @param {Number[]} normal The normal coordinate.
|
|
46
|
-
*/
|
|
47
|
-
setNormalFrom(normal: number[]): boolean;
|
|
11
|
+
export interface vtkTrackballManipulator extends vtkAbstractManipulator {
|
|
48
12
|
|
|
49
13
|
/**
|
|
50
14
|
*
|
|
@@ -73,12 +37,12 @@ export function newInstance(initialValues?: ITrackballManipulatorInitialValues):
|
|
|
73
37
|
* @param {Number} prevY
|
|
74
38
|
* @param {Number} curX
|
|
75
39
|
* @param {Number} curY
|
|
76
|
-
* @param {
|
|
77
|
-
* @param {
|
|
40
|
+
* @param {Vector3} origin
|
|
41
|
+
* @param {Vector3} direction
|
|
78
42
|
* @param renderer
|
|
79
43
|
* @param glRenderWindow
|
|
80
44
|
*/
|
|
81
|
-
export function trackballRotate(prevX: number, prevY: number, curX: number, curY: number, origin:
|
|
45
|
+
export function trackballRotate(prevX: number, prevY: number, curX: number, curY: number, origin: Vector3, direction: Vector3, renderer: any, glRenderWindow: any): void;
|
|
82
46
|
|
|
83
47
|
|
|
84
48
|
/**
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import { mat4, vec3 } from 'gl-matrix';
|
|
2
3
|
import macro from '../../macros.js';
|
|
3
4
|
import { j as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
|
|
5
|
+
import vtkAbstractManipulator from './AbstractManipulator.js';
|
|
4
6
|
|
|
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
|
+
|
|
9
|
+
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; }
|
|
5
10
|
function trackballRotate(prevX, prevY, curX, curY, origin, direction, renderer, glRenderWindow) {
|
|
6
11
|
var dx = curX - prevX;
|
|
7
12
|
var dy = curY - prevY;
|
|
@@ -28,15 +33,14 @@ function vtkTrackballManipulator(publicAPI, model) {
|
|
|
28
33
|
// Set our className
|
|
29
34
|
model.classHierarchy.push('vtkTrackballManipulator');
|
|
30
35
|
var prevX = 0;
|
|
31
|
-
var prevY = 0;
|
|
36
|
+
var prevY = 0;
|
|
32
37
|
|
|
33
38
|
publicAPI.handleEvent = function (callData, glRenderWindow) {
|
|
34
|
-
var newDirection = trackballRotate(prevX, prevY, callData.position.x, callData.position.y,
|
|
39
|
+
var newDirection = trackballRotate(prevX, prevY, callData.position.x, callData.position.y, publicAPI.getOrigin(callData), publicAPI.getNormal(callData), callData.pokedRenderer);
|
|
35
40
|
prevX = callData.position.x;
|
|
36
41
|
prevY = callData.position.y;
|
|
37
42
|
return newDirection;
|
|
38
|
-
};
|
|
39
|
-
|
|
43
|
+
};
|
|
40
44
|
|
|
41
45
|
publicAPI.reset = function (callData) {
|
|
42
46
|
prevX = callData.position.x;
|
|
@@ -47,15 +51,14 @@ function vtkTrackballManipulator(publicAPI, model) {
|
|
|
47
51
|
// ----------------------------------------------------------------------------
|
|
48
52
|
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
54
|
+
function defaultValues(initialValues) {
|
|
55
|
+
return _objectSpread({}, initialValues);
|
|
56
|
+
} // ----------------------------------------------------------------------------
|
|
57
|
+
|
|
53
58
|
|
|
54
59
|
function extend(publicAPI, model) {
|
|
55
60
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
56
|
-
|
|
57
|
-
macro.obj(publicAPI, model);
|
|
58
|
-
macro.setGetArray(publicAPI, model, ['normal'], 3);
|
|
61
|
+
vtkAbstractManipulator.extend(publicAPI, model, defaultValues(initialValues));
|
|
59
62
|
vtkTrackballManipulator(publicAPI, model);
|
|
60
63
|
} // ----------------------------------------------------------------------------
|
|
61
64
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
|
-
import {
|
|
4
|
+
import { s as subtract, m as multiplyAccumulate, l as normalize, j as cross } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
6
6
|
import vtkCylinderSource from '../../Filters/Sources/CylinderSource.js';
|
|
7
7
|
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
@@ -70,19 +70,23 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
70
70
|
|
|
71
71
|
var numVertices = inPoints.length;
|
|
72
72
|
|
|
73
|
-
if (model.close) {
|
|
73
|
+
if (!model.close) {
|
|
74
|
+
--numVertices;
|
|
75
|
+
} else {
|
|
74
76
|
inPoints.push(inPoints[0]);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
var spline = vtkSpline3D.newInstance({
|
|
78
|
-
close:
|
|
80
|
+
close: widgetState.getSplineClose(),
|
|
79
81
|
kind: widgetState.getSplineKind(),
|
|
80
82
|
tension: widgetState.getSplineTension(),
|
|
81
83
|
bias: widgetState.getSplineBias(),
|
|
82
|
-
continuity: widgetState.getSplineContinuity()
|
|
84
|
+
continuity: widgetState.getSplineContinuity(),
|
|
85
|
+
boundaryCondition: widgetState.getSplineBoundaryCondition(),
|
|
86
|
+
boundaryConditionValues: widgetState.getSplineBoundaryConditionValues()
|
|
83
87
|
});
|
|
84
88
|
spline.computeCoefficients(inPoints);
|
|
85
|
-
var outPoints = new Float32Array(3 * numVertices * model.resolution);
|
|
89
|
+
var outPoints = new Float32Array(3 * ((numVertices + !model.close) * model.resolution));
|
|
86
90
|
var outCells = new Uint32Array(numVertices * model.resolution + 2);
|
|
87
91
|
outCells[0] = numVertices * model.resolution + 1;
|
|
88
92
|
outCells[numVertices * model.resolution + 1] = 0;
|
|
@@ -98,9 +102,20 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
if (model.close) {
|
|
106
|
+
outCells[numVertices * model.resolution + 1] = 0;
|
|
107
|
+
} else {
|
|
108
|
+
var lastPointIndex = numVertices * model.resolution + 1;
|
|
109
|
+
var lastPoint = spline.getPoint(numVertices, 0);
|
|
110
|
+
outPoints[3 * lastPointIndex + 0] = lastPoint[0];
|
|
111
|
+
outPoints[3 * lastPointIndex + 1] = lastPoint[1];
|
|
112
|
+
outPoints[3 * lastPointIndex + 2] = lastPoint[2];
|
|
113
|
+
outCells[numVertices * model.resolution + 1] = lastPointIndex;
|
|
114
|
+
}
|
|
115
|
+
|
|
101
116
|
polydata.getPoints().setData(outPoints);
|
|
102
117
|
|
|
103
|
-
if (model.fill) {
|
|
118
|
+
if (model.fill && model.close) {
|
|
104
119
|
polydata.getPolys().setData(outCells);
|
|
105
120
|
}
|
|
106
121
|
|
|
@@ -115,9 +130,12 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
115
130
|
return model.state;
|
|
116
131
|
};
|
|
117
132
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
133
|
+
function updateAreaVisibility() {
|
|
134
|
+
model.pipelines.area.actor.setVisibility(model.fill && model.close);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
publicAPI.setFill = macro.chain(publicAPI.setFill, updateAreaVisibility);
|
|
138
|
+
publicAPI.setClose = macro.chain(publicAPI.setClose, updateAreaVisibility);
|
|
121
139
|
publicAPI.setOutputBorder = macro.chain(publicAPI.setOutputBorder, function (v) {
|
|
122
140
|
return model.pipelines.border.actor.setVisibility(v);
|
|
123
141
|
});
|
|
@@ -130,6 +148,7 @@ var DEFAULT_VALUES = {
|
|
|
130
148
|
resolution: 16,
|
|
131
149
|
close: true,
|
|
132
150
|
fill: true,
|
|
151
|
+
// boundaryCondition : BoundaryCondition.DEFAULT
|
|
133
152
|
outputBorder: false,
|
|
134
153
|
borderColor: [0.1, 1, 0.1],
|
|
135
154
|
errorBorderColor: [1, 0, 0]
|
|
@@ -140,7 +159,7 @@ function extend(publicAPI, model) {
|
|
|
140
159
|
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
141
160
|
vtkContextRepresentation.extend(publicAPI, model, initialValues);
|
|
142
161
|
macro.get(publicAPI, model, ['mapper']);
|
|
143
|
-
macro.setGet(publicAPI, model, ['resolution', 'close', 'fill', 'outputBorder']);
|
|
162
|
+
macro.setGet(publicAPI, model, ['resolution', 'close', 'boundaryCondition', 'fill', 'outputBorder']);
|
|
144
163
|
macro.setGetArray(publicAPI, model, ['borderColor', 'errorBorderColor'], 3); // Object specific methods
|
|
145
164
|
|
|
146
165
|
vtkSplineContextRepresentation(publicAPI, model);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
import vtkProp from '../../Rendering/Core/Prop.js';
|
|
4
|
-
import {
|
|
4
|
+
import { s as subtract, d as dot } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
6
6
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
7
7
|
import { CATEGORIES } from '../../Rendering/Core/Mapper/CoincidentTopologyHelper.js';
|
|
@@ -40,6 +40,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
40
40
|
newHandle.setOrigin.apply(newHandle, _toConsumableArray(moveHandle.getOrigin()));
|
|
41
41
|
newHandle.setColor(moveHandle.getColor());
|
|
42
42
|
newHandle.setScale1(moveHandle.getScale1());
|
|
43
|
+
newHandle.setManipulator(model.manipulator);
|
|
43
44
|
} else {
|
|
44
45
|
isDragging = true;
|
|
45
46
|
|
|
@@ -56,10 +57,12 @@ function widgetBehavior(publicAPI, model) {
|
|
|
56
57
|
|
|
57
58
|
|
|
58
59
|
publicAPI.handleMouseMove = function (callData) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
|
|
61
|
+
|
|
62
|
+
var manipulator = (_model$activeState$ge = (_model$activeState = model.activeState) === null || _model$activeState === void 0 ? void 0 : (_model$activeState$ge2 = _model$activeState.getManipulator) === null || _model$activeState$ge2 === void 0 ? void 0 : _model$activeState$ge2.call(_model$activeState)) !== null && _model$activeState$ge !== void 0 ? _model$activeState$ge : model.manipulator;
|
|
63
|
+
|
|
64
|
+
if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
|
|
65
|
+
var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
63
66
|
|
|
64
67
|
if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || isDragging)) {
|
|
65
68
|
model.activeState.setOrigin(worldCoords);
|
|
@@ -3,7 +3,7 @@ import vtkStateBuilder from '../../Core/StateBuilder.js';
|
|
|
3
3
|
function generateState() {
|
|
4
4
|
return vtkStateBuilder.createBuilder().addStateFromMixin({
|
|
5
5
|
labels: ['moveHandle'],
|
|
6
|
-
mixins: ['origin', 'color', 'scale1', 'visible'],
|
|
6
|
+
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
|
|
7
7
|
name: 'moveHandle',
|
|
8
8
|
initialValues: {
|
|
9
9
|
scale1: 0.1,
|
|
@@ -11,7 +11,7 @@ function generateState() {
|
|
|
11
11
|
}
|
|
12
12
|
}).addDynamicMixinState({
|
|
13
13
|
labels: ['handles'],
|
|
14
|
-
mixins: ['origin', 'color', 'scale1', 'visible'],
|
|
14
|
+
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
|
|
15
15
|
name: 'handle',
|
|
16
16
|
initialValues: {
|
|
17
17
|
scale1: 0.1
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
3
4
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
4
5
|
import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
|
|
5
6
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
6
|
-
import {
|
|
7
|
+
import { s as subtract, R as angleBetweenVectors } from '../../Common/Core/Math/index.js';
|
|
7
8
|
import widgetBehavior from './AngleWidget/behavior.js';
|
|
8
9
|
import generateState from './AngleWidget/state.js';
|
|
9
10
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
10
11
|
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
11
15
|
// Factory
|
|
12
16
|
// ----------------------------------------------------------------------------
|
|
13
17
|
|
|
14
18
|
function vtkAngleWidget(publicAPI, model) {
|
|
15
|
-
model.classHierarchy.push('vtkAngleWidget');
|
|
19
|
+
model.classHierarchy.push('vtkAngleWidget');
|
|
20
|
+
|
|
21
|
+
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
22
|
+
|
|
16
23
|
|
|
17
24
|
model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale'];
|
|
18
25
|
model.behavior = widgetBehavior;
|
|
@@ -56,6 +63,14 @@ function vtkAngleWidget(publicAPI, model) {
|
|
|
56
63
|
subtract(handles[0].getOrigin(), handles[1].getOrigin(), vec1);
|
|
57
64
|
subtract(handles[2].getOrigin(), handles[1].getOrigin(), vec2);
|
|
58
65
|
return angleBetweenVectors(vec1, vec2);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
publicAPI.setManipulator = function (manipulator) {
|
|
69
|
+
superClass.setManipulator(manipulator);
|
|
70
|
+
model.widgetState.getMoveHandle().setManipulator(manipulator);
|
|
71
|
+
model.widgetState.getHandleList().forEach(function (handle) {
|
|
72
|
+
handle.setManipulator(manipulator);
|
|
73
|
+
});
|
|
59
74
|
}; // --------------------------------------------------------------------------
|
|
60
75
|
// initialization
|
|
61
76
|
// --------------------------------------------------------------------------
|
|
@@ -66,7 +81,9 @@ function vtkAngleWidget(publicAPI, model) {
|
|
|
66
81
|
model.widgetState.getMoveHandle().setOrigin(center);
|
|
67
82
|
}); // Default manipulator
|
|
68
83
|
|
|
69
|
-
model.manipulator
|
|
84
|
+
publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
|
|
85
|
+
useCameraNormal: true
|
|
86
|
+
}));
|
|
70
87
|
} // ----------------------------------------------------------------------------
|
|
71
88
|
|
|
72
89
|
|
|
@@ -34,6 +34,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
34
34
|
newHandle.setOrigin.apply(newHandle, _toConsumableArray(moveHandle.getOrigin()));
|
|
35
35
|
newHandle.setColor(moveHandle.getColor());
|
|
36
36
|
newHandle.setScale1(moveHandle.getScale1());
|
|
37
|
+
newHandle.setManipulator(model.manipulator);
|
|
37
38
|
} else {
|
|
38
39
|
isDragging = true;
|
|
39
40
|
|
|
@@ -50,13 +51,17 @@ function widgetBehavior(publicAPI, model) {
|
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
publicAPI.handleMouseMove = function (callData) {
|
|
54
|
+
var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
|
|
55
|
+
|
|
53
56
|
if (model.hasFocus && model.widgetState.getHandleList().length === MAX_POINTS) {
|
|
54
57
|
publicAPI.loseFocus();
|
|
55
58
|
return macro.VOID;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
var manipulator = (_model$activeState$ge = (_model$activeState = model.activeState) === null || _model$activeState === void 0 ? void 0 : (_model$activeState$ge2 = _model$activeState.getManipulator) === null || _model$activeState$ge2 === void 0 ? void 0 : _model$activeState$ge2.call(_model$activeState)) !== null && _model$activeState$ge !== void 0 ? _model$activeState$ge : model.manipulator;
|
|
62
|
+
|
|
63
|
+
if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
|
|
64
|
+
var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
60
65
|
|
|
61
66
|
if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || isDragging)) {
|
|
62
67
|
model.activeState.setOrigin(worldCoords);
|
|
@@ -3,7 +3,7 @@ import vtkStateBuilder from '../../Core/StateBuilder.js';
|
|
|
3
3
|
function generateState() {
|
|
4
4
|
return vtkStateBuilder.createBuilder().addStateFromMixin({
|
|
5
5
|
labels: ['moveHandle'],
|
|
6
|
-
mixins: ['origin', 'color', 'scale1', 'visible'],
|
|
6
|
+
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
|
|
7
7
|
name: 'moveHandle',
|
|
8
8
|
initialValues: {
|
|
9
9
|
scale1: 0.1,
|
|
@@ -11,7 +11,7 @@ function generateState() {
|
|
|
11
11
|
}
|
|
12
12
|
}).addDynamicMixinState({
|
|
13
13
|
labels: ['handles'],
|
|
14
|
-
mixins: ['origin', 'color', 'scale1', 'visible'],
|
|
14
|
+
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
|
|
15
15
|
name: 'handle',
|
|
16
16
|
initialValues: {
|
|
17
17
|
scale1: 0.1
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
3
4
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
@@ -8,11 +9,17 @@ import widgetBehavior from './DistanceWidget/behavior.js';
|
|
|
8
9
|
import generateState from './DistanceWidget/state.js';
|
|
9
10
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
10
11
|
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
11
15
|
// Factory
|
|
12
16
|
// ----------------------------------------------------------------------------
|
|
13
17
|
|
|
14
18
|
function vtkDistanceWidget(publicAPI, model) {
|
|
15
|
-
model.classHierarchy.push('vtkDistanceWidget');
|
|
19
|
+
model.classHierarchy.push('vtkDistanceWidget');
|
|
20
|
+
|
|
21
|
+
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
22
|
+
|
|
16
23
|
|
|
17
24
|
model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale'];
|
|
18
25
|
model.behavior = widgetBehavior;
|
|
@@ -51,6 +58,14 @@ function vtkDistanceWidget(publicAPI, model) {
|
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
return Math.sqrt(distance2BetweenPoints(handles[0].getOrigin(), handles[1].getOrigin()));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
publicAPI.setManipulator = function (manipulator) {
|
|
64
|
+
superClass.setManipulator(manipulator);
|
|
65
|
+
model.widgetState.getMoveHandle().setManipulator(manipulator);
|
|
66
|
+
model.widgetState.getHandleList().forEach(function (handle) {
|
|
67
|
+
handle.setManipulator(manipulator);
|
|
68
|
+
});
|
|
54
69
|
}; // --------------------------------------------------------------------------
|
|
55
70
|
// initialization
|
|
56
71
|
// --------------------------------------------------------------------------
|
|
@@ -61,7 +76,9 @@ function vtkDistanceWidget(publicAPI, model) {
|
|
|
61
76
|
model.widgetState.getMoveHandle().setOrigin(center);
|
|
62
77
|
}); // Default manipulator
|
|
63
78
|
|
|
64
|
-
model.manipulator
|
|
79
|
+
publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
|
|
80
|
+
useCameraNormal: true
|
|
81
|
+
}));
|
|
65
82
|
} // ----------------------------------------------------------------------------
|
|
66
83
|
|
|
67
84
|
|
|
@@ -50,11 +50,12 @@ function vtkEllipseWidget(publicAPI, model) {
|
|
|
50
50
|
}; // --------------------------------------------------------------------------
|
|
51
51
|
// initialization
|
|
52
52
|
// --------------------------------------------------------------------------
|
|
53
|
-
// Default manipulator
|
|
54
53
|
|
|
55
54
|
|
|
56
|
-
model.manipulator = vtkPlanePointManipulator.newInstance();
|
|
57
55
|
model.widgetState = generateState();
|
|
56
|
+
publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
|
|
57
|
+
useCameraNormal: true
|
|
58
|
+
}));
|
|
58
59
|
} // ----------------------------------------------------------------------------
|
|
59
60
|
|
|
60
61
|
|
|
@@ -74,7 +75,7 @@ function defaultValues(initialValues) {
|
|
|
74
75
|
function extend(publicAPI, model) {
|
|
75
76
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
76
77
|
vtkShapeWidget.extend(publicAPI, model, defaultValues(initialValues));
|
|
77
|
-
macro.setGet(publicAPI, model, ['
|
|
78
|
+
macro.setGet(publicAPI, model, ['widgetState']);
|
|
78
79
|
vtkEllipseWidget(publicAPI, model);
|
|
79
80
|
} // ----------------------------------------------------------------------------
|
|
80
81
|
|
|
@@ -55,7 +55,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
55
55
|
|
|
56
56
|
if (type === 'corners') {
|
|
57
57
|
// manipulator should be a plane manipulator
|
|
58
|
-
manipulator.setNormal(model._camera.getDirectionOfProjection());
|
|
59
58
|
worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -67,8 +66,8 @@ function widgetBehavior(publicAPI, model) {
|
|
|
67
66
|
|
|
68
67
|
var center = [(planes[0] + planes[1]) / 2, (planes[2] + planes[3]) / 2, (planes[4] + planes[5]) / 2]; // manipulator should be a line manipulator
|
|
69
68
|
|
|
70
|
-
manipulator.
|
|
71
|
-
manipulator.
|
|
69
|
+
manipulator.setHandleOrigin(transformVec3(center, indexToWorldT));
|
|
70
|
+
manipulator.setHandleNormal(rotateVec3(constraintAxis, indexToWorldT));
|
|
72
71
|
worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -77,7 +76,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
77
76
|
var edgeAxis = index.map(function (a) {
|
|
78
77
|
return a === 1 ? a : 0;
|
|
79
78
|
});
|
|
80
|
-
manipulator.
|
|
79
|
+
manipulator.setHandleNormal(rotateVec3(edgeAxis, indexToWorldT));
|
|
81
80
|
worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
82
81
|
}
|
|
83
82
|
|