@kitware/vtk.js 24.9.0 → 24.12.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.
Files changed (68) hide show
  1. package/Common/Core/LookupTable.d.ts +6 -6
  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/Core/ScalarsToColors.d.ts +6 -16
  6. package/Common/DataModel/Box.d.ts +4 -4
  7. package/Common/DataModel/CardinalSpline1D.d.ts +8 -4
  8. package/Common/DataModel/CardinalSpline1D.js +133 -4
  9. package/Common/DataModel/Cell.js +3 -1
  10. package/Common/DataModel/CellTypes.js +6 -1
  11. package/Common/DataModel/ITKHelper.d.ts +3 -3
  12. package/Common/DataModel/KochanekSpline1D.d.ts +8 -4
  13. package/Common/DataModel/KochanekSpline1D.js +103 -2
  14. package/Common/DataModel/Line.d.ts +8 -3
  15. package/Common/DataModel/Line.js +16 -11
  16. package/Common/DataModel/PiecewiseFunction.js +8 -8
  17. package/Common/DataModel/Plane.js +1 -1
  18. package/Common/DataModel/PolyData/Constants.d.ts +6 -0
  19. package/Common/DataModel/PolyLine.d.ts +63 -0
  20. package/Common/DataModel/PolyLine.js +77 -0
  21. package/Common/DataModel/Polygon.js +1 -1
  22. package/Common/DataModel/Spline1D/Constants.js +17 -0
  23. package/Common/DataModel/Spline1D.d.ts +20 -2
  24. package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
  25. package/Common/DataModel/Spline3D.d.ts +4 -9
  26. package/Common/DataModel/Spline3D.js +20 -15
  27. package/Filters/General/ImageCropFilter.d.ts +9 -6
  28. package/Filters/Sources/LineSource.js +1 -1
  29. package/Filters/Sources/PlaneSource.js +1 -1
  30. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
  31. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
  32. package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
  33. package/Interaction/Widgets/OrientationMarkerWidget.d.ts +2 -6
  34. package/Rendering/Core/CellPicker.js +53 -32
  35. package/Rendering/Core/Mapper/Constants.d.ts +26 -0
  36. package/Rendering/Core/Mapper.d.ts +5 -21
  37. package/Rendering/Core/Property/Constants.d.ts +24 -0
  38. package/Rendering/Core/Property.d.ts +6 -20
  39. package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
  40. package/Rendering/Core/RenderWindowInteractor.d.ts +223 -121
  41. package/Rendering/Core/ScalarBarActor.d.ts +37 -15
  42. package/Rendering/Core/ScalarBarActor.js +39 -14
  43. package/Rendering/Core/Viewport.d.ts +2 -4
  44. package/Rendering/Core/VolumeMapper/Constants.d.ts +19 -0
  45. package/Rendering/Core/VolumeMapper.d.ts +5 -9
  46. package/Rendering/Core/VolumeProperty.d.ts +5 -13
  47. package/Rendering/Misc/FullScreenRenderWindow.d.ts +3 -2
  48. package/Rendering/OpenGL/RenderWindow.d.ts +28 -10
  49. package/Widgets/Core/StateBuilder.js +6 -2
  50. package/Widgets/Manipulators/LineManipulator.js +1 -1
  51. package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
  52. package/Widgets/Representations/SplineContextRepresentation.js +27 -9
  53. package/Widgets/Representations/WidgetRepresentation.js +1 -1
  54. package/Widgets/Widgets3D/AngleWidget/behavior.js +10 -5
  55. package/Widgets/Widgets3D/AngleWidget.js +1 -1
  56. package/Widgets/Widgets3D/DistanceWidget/behavior.js +11 -5
  57. package/Widgets/Widgets3D/LabelWidget/behavior.js +10 -4
  58. package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
  59. package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
  60. package/Widgets/Widgets3D/PolyLineWidget/behavior.js +7 -5
  61. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  62. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
  63. package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
  64. package/Widgets/Widgets3D/ShapeWidget/behavior.js +9 -1
  65. package/Widgets/Widgets3D/SplineWidget/state.js +10 -0
  66. package/Widgets/Widgets3D/SplineWidget.js +1 -1
  67. package/index.d.ts +16 -7
  68. package/package.json +43 -43
@@ -0,0 +1,63 @@
1
+ import { Vector2, Vector3 } from './../../types';
2
+ import vtkCell, { ICellInitialValues } from './Cell';
3
+ import { IIntersectWithLine } from './Line';
4
+
5
+ export interface IPolyLineInitialValues extends ICellInitialValues { }
6
+
7
+ export interface vtkPolyLine extends vtkCell {
8
+
9
+ /**
10
+ * Get the topological dimensional of the cell (0, 1, 2 or 3).
11
+ */
12
+ getCellDimension(): number;
13
+
14
+ /**
15
+ * @param {number} t1
16
+ * @param {number} t2
17
+ * @param {Vector3} p1 The first point coordinate.
18
+ * @param {Vector3} p2 The second point coordinate.
19
+ * @param {Number} tol The tolerance to use.
20
+ * @param {Vector3} x The point which intersect the line.
21
+ * @param {Vector3} pcoords The parametric coordinates.
22
+ */
23
+ intersectWithLine(t1: number, t2: number, p1: Vector3, p2: Vector3, tol: number, x: Vector3, pcoords: Vector3): IIntersectWithLine;
24
+
25
+ /**
26
+ * Determine global coordinate (x[3]) from subId and parametric coordinates.
27
+ * Also returns interpolation weights. (The number of weights is equal to
28
+ * the number of points in the cell.)
29
+ *
30
+ * @param {number} subId
31
+ * @param {Vector3} pcoords The parametric coordinates
32
+ * @param {Vector3} x The global coordinate
33
+ * @param {Vector2} weights The interpolation weights
34
+ */
35
+ evaluateLocation(subId: number, pcoords: Vector3, x: Vector3, weights: Vector2): void
36
+ }
37
+
38
+ /**
39
+ * Method used to decorate a given object (publicAPI+model) with vtkPolyLine characteristics.
40
+ *
41
+ * @param publicAPI object on which methods will be bounds (public)
42
+ * @param model object on which data structure will be bounds (protected)
43
+ * @param {IPolyLineInitialValues} [initialValues] (default: {})
44
+ */
45
+ export function extend(publicAPI: object, model: object, initialValues?: IPolyLineInitialValues): void;
46
+
47
+ /**
48
+ * Method used to create a new instance of vtkPolyLine.
49
+ * @param {IPolyLineInitialValues} [initialValues] for pre-setting some of its content
50
+ */
51
+ export function newInstance(initialValues?: IPolyLineInitialValues): vtkPolyLine;
52
+
53
+ /**
54
+ * vtkPolyLine is a cell which representant a poly line.
55
+ *
56
+ * @see vtkCell
57
+ */
58
+ export declare const vtkPolyLine: {
59
+ newInstance: typeof newInstance,
60
+ extend: typeof extend;
61
+ };
62
+
63
+ export default vtkPolyLine;
@@ -0,0 +1,77 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import macro from '../../macros.js';
3
+ import vtkCell from './Cell.js';
4
+ import vtkLine from './Line.js';
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; }
9
+
10
+ function vtkPolyLine(publicAPI, model) {
11
+ model.classHierarchy.push('vtkPolyLine');
12
+
13
+ var superClass = _objectSpread({}, publicAPI);
14
+
15
+ var line = vtkLine.newInstance();
16
+ line.getPoints().setNumberOfPoints(2);
17
+
18
+ publicAPI.getCellDimension = function () {
19
+ return 1;
20
+ };
21
+
22
+ publicAPI.intersectWithLine = function (t1, t2, p1, p2, tol, x, pcoords) {
23
+ var outObj = {
24
+ intersect: 0,
25
+ t: Number.MAX_VALUE,
26
+ subId: 0,
27
+ betweenPoints: null
28
+ };
29
+ var numLines = superClass.getPoints().getNumberOfPoints() - 1;
30
+ var pDistMin = Number.MAX_VALUE;
31
+
32
+ for (var subId = 0; subId < numLines; subId++) {
33
+ var pCoords = [0, 0, 0];
34
+ line.getPoints().getData().set(model.points.getData().subarray(3 * subId, 3 * (subId + 2)));
35
+ var lineIntersected = line.intersectWithLine(p1, p2, tol, x, pcoords);
36
+
37
+ if (lineIntersected.intersect === 1 && lineIntersected.t <= outObj.t + tol && lineIntersected.t >= t1 && lineIntersected.t <= t2) {
38
+ outObj.intersect = 1;
39
+ var pDist = line.getParametricDistance(pCoords);
40
+
41
+ if (pDist < pDistMin || pDist === pDistMin && lineIntersected.t < outObj.t) {
42
+ outObj.subId = subId;
43
+ outObj.t = lineIntersected.t;
44
+ pDistMin = pDist;
45
+ }
46
+ }
47
+ }
48
+
49
+ return outObj;
50
+ };
51
+
52
+ publicAPI.evaluateLocation = function (subId, pcoords, x, weights) {
53
+ line.getPoints().getData().set(model.points.getData().subarray(3 * subId, 3 * (subId + 2)));
54
+ return line.evaluateLocation(pcoords, x, weights);
55
+ };
56
+ } // ----------------------------------------------------------------------------
57
+ // Object factory
58
+ // ----------------------------------------------------------------------------
59
+
60
+
61
+ var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
62
+
63
+ function extend(publicAPI, model) {
64
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
65
+ Object.assign(model, DEFAULT_VALUES, initialValues);
66
+ vtkCell.extend(publicAPI, model, initialValues);
67
+ vtkPolyLine(publicAPI, model);
68
+ } // ----------------------------------------------------------------------------
69
+
70
+ var newInstance = macro.newInstance(extend, 'vtkPolyLine'); // ----------------------------------------------------------------------------
71
+
72
+ var vtkPolyLine$1 = {
73
+ newInstance: newInstance,
74
+ extend: extend
75
+ };
76
+
77
+ export { vtkPolyLine$1 as default, extend, newInstance };
@@ -1,6 +1,6 @@
1
1
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
2
  import macro from '../../macros.js';
3
- import { l as normalize, g as subtract, j as cross, k as add, d as dot, n as norm } from '../Core/Math/index.js';
3
+ import { l as normalize, s as subtract, j as cross, k as add, d as dot, n as norm } from '../Core/Math/index.js';
4
4
  import vtkLine from './Line.js';
5
5
  import vtkPlane from './Plane.js';
6
6
  import vtkPriorityQueue from '../Core/PriorityQueue.js';
@@ -0,0 +1,17 @@
1
+ // Boundary conditions available to compute open splines
2
+ // DEFAULT : desired slope at boundary point is derivative from two points (boundary and second interior)
3
+ // DERIVATIVE : desired slope at boundary point is the boundary value given.
4
+ // SECOND_DERIVATIVE : second derivative at boundary point is the boundary value given.
5
+ // SECOND_DERIVATIVE_INTERIOR_POINT : desired second derivative at boundary point is the boundary value given times second derivative
6
+ // at first interior point.
7
+ var BoundaryCondition = {
8
+ DEFAULT: 0,
9
+ DERIVATIVE: 1,
10
+ SECOND_DERIVATIVE: 2,
11
+ SECOND_DERIVATIVE_INTERIOR_POINT: 3
12
+ };
13
+ var Constants = {
14
+ BoundaryCondition: BoundaryCondition
15
+ };
16
+
17
+ export { BoundaryCondition, Constants as default };
@@ -3,6 +3,19 @@ import { vtkObject } from './../../interfaces' ;
3
3
 
4
4
  export interface ISpline1DInitialValues {}
5
5
 
6
+ // Boundary conditions available to compute open splines
7
+ // DEFAULT : desired slope at boundary point is derivative from two points (boundary and second interior)
8
+ // DERIVATIVE : desired slope at boundary point is the boundary value given.
9
+ // SECOND_DERIVATIVE : second derivative at boundary point is the boundary value given.
10
+ // SECOND_DERIVATIVE_INTERIOR_POINT : desired second derivative at boundary point is the boundary value given times second derivative
11
+ // at first interior point.
12
+ export enum BoundaryCondition {
13
+ DEFAULT,
14
+ DERIVATIVE,
15
+ SECOND_DERIVATIVE,
16
+ SECOND_DERIVATIVE_INTERIOR_POINT,
17
+ }
18
+
6
19
  export interface vtkSpline1D extends vtkObject {
7
20
 
8
21
  /**
@@ -19,9 +32,14 @@ export interface vtkSpline1D extends vtkObject {
19
32
  * @param {Number} size
20
33
  * @param {Float32Array} work
21
34
  * @param {Number[]} x
22
- * @param {Number[]} y
35
+ * @param {Number[]} y
36
+ * @param {Object} options
37
+ * @param {BoundaryCondition} options.leftConstraint
38
+ * @param {Number} options.leftValue
39
+ * @param {BoundaryCondition} options.rightConstraint
40
+ * @param {Number} options.rightValue
23
41
  */
24
- computeOpenCoefficients(size: number, work: Float32Array, x: number[], y: number[]): void;
42
+ computeOpenCoefficients(size: number, work: Float32Array, x: number[], y: number[], options: { leftConstraint: BoundaryCondition, leftValue: number, rightConstraint: BoundaryCondition, rightValue: Number }): void;
25
43
 
26
44
  /**
27
45
  *
@@ -0,0 +1,9 @@
1
+ export declare enum splineKind {
2
+ CARDINAL_SPLINE = 'CARDINAL_SPLINE',
3
+ KOCHANEK_SPLINE = 'KOCHANEK_SPLINE',
4
+ }
5
+
6
+ declare const _default: {
7
+ splineKind: typeof splineKind;
8
+ };
9
+ export default _default;
@@ -1,10 +1,5 @@
1
- import { vtkObject } from './../../interfaces' ;
2
-
3
- export enum splineKind {
4
- CARDINAL_SPLINE,
5
- KOCHANEK_SPLINE,
6
- }
7
-
1
+ import { vtkObject } from './../../interfaces';
2
+ import { splineKind } from './Spline3D/Constants';
8
3
 
9
4
  export interface ISpline3DInitialValues {
10
5
  close?: boolean;
@@ -52,7 +47,7 @@ export function newInstance(initialValues?: ISpline3DInitialValues): vtkSpline3D
52
47
  * at any given point inside the spline intervals.
53
48
  */
54
49
  export declare const vtkSpline3D: {
55
- newInstance: typeof newInstance,
56
- extend: typeof extend
50
+ newInstance: typeof newInstance;
51
+ extend: typeof extend;
57
52
  };
58
53
  export default vtkSpline3D;
@@ -11,7 +11,7 @@ function vtkSpline3D(publicAPI, model) {
11
11
  // Set our classname
12
12
  model.classHierarchy.push('vtkSpline3D'); // --------------------------------------------------------------------------
13
13
 
14
- function computeCoefficients1D(spline, points) {
14
+ function computeCoefficients1D(spline, points, boundaryConditionValue) {
15
15
  if (points.length === 0) {
16
16
  vtkErrorMacro('Splines require at least one points');
17
17
  } // If we have only one point we create a spline
@@ -25,23 +25,27 @@ function vtkSpline3D(publicAPI, model) {
25
25
  var size = points.length;
26
26
  var work = null;
27
27
  var intervals = null;
28
+ work = new Float32Array(size);
28
29
 
29
- if (model.close) {
30
- work = new Float32Array(size);
31
-
32
- if (model.intervals.length === 0) {
33
- intervals = new Float32Array(size);
30
+ if (model.intervals.length === 0) {
31
+ intervals = new Float32Array(size);
34
32
 
35
- for (var i = 0; i < intervals.length; i++) {
36
- intervals[i] = i;
37
- }
38
- } else {
39
- intervals = model.intervals;
33
+ for (var i = 0; i < intervals.length; i++) {
34
+ intervals[i] = i;
40
35
  }
36
+ } else {
37
+ intervals = model.intervals;
38
+ }
41
39
 
40
+ if (model.close) {
42
41
  spline.computeCloseCoefficients(size, work, intervals, points);
43
42
  } else {
44
- vtkErrorMacro('Open splines are not supported yet!');
43
+ spline.computeOpenCoefficients(size, work, intervals, points, {
44
+ leftConstraint: model.boundaryCondition,
45
+ leftValue: boundaryConditionValue,
46
+ rightConstraint: model.boundaryCondition,
47
+ rightValue: boundaryConditionValue
48
+ });
45
49
  }
46
50
  } // --------------------------------------------------------------------------
47
51
 
@@ -56,9 +60,9 @@ function vtkSpline3D(publicAPI, model) {
56
60
  var z = points.map(function (pt) {
57
61
  return pt[2];
58
62
  });
59
- computeCoefficients1D(model.splineX, x);
60
- computeCoefficients1D(model.splineY, y);
61
- computeCoefficients1D(model.splineZ, z);
63
+ computeCoefficients1D(model.splineX, x, model.boundaryConditionValues[0]);
64
+ computeCoefficients1D(model.splineY, y, model.boundaryConditionValues[1]);
65
+ computeCoefficients1D(model.splineZ, z, model.boundaryConditionValues[2]);
62
66
  }; // --------------------------------------------------------------------------
63
67
 
64
68
 
@@ -101,6 +105,7 @@ var DEFAULT_VALUES = {
101
105
  close: false,
102
106
  intervals: [],
103
107
  kind: splineKind.KOCHANEK_SPLINE,
108
+ boundaryConditionValues: [0, 0, 0],
104
109
  // Passed to the vtkKochanekSpline1D
105
110
  tension: 0,
106
111
  continuity: 0,
@@ -1,10 +1,12 @@
1
1
  import { vtkAlgorithm, vtkObject } from './../../interfaces';
2
2
 
3
+ type CroppingPlanes = number[];
4
+
3
5
  /**
4
6
  *
5
7
  */
6
- interface IImageCropFilterInitialValues {
7
- croppingPlanes?: any;
8
+ export interface IImageCropFilterInitialValues {
9
+ croppingPlanes?: CroppingPlanes;
8
10
  }
9
11
 
10
12
  type vtkImageCropFilterBase = vtkObject & vtkAlgorithm;
@@ -15,18 +17,19 @@ export interface vtkImageCropFilter extends vtkImageCropFilterBase {
15
17
  * Get The cropping planes, in IJK space.
16
18
  * @default [0, 0, 0, 0, 0, 0].
17
19
  */
18
- getCroppingPlanes(): number[];
20
+ getCroppingPlanes(): CroppingPlanes;
19
21
 
20
22
  /**
21
23
  * Get The cropping planes, in IJK space.
22
24
  * @default [0, 0, 0, 0, 0, 0].
23
25
  */
24
- getCroppingPlanesByReference(): number[];
26
+ getCroppingPlanesByReference(): CroppingPlanes;
25
27
 
26
28
  /**
27
29
  *
28
30
  */
29
31
  isResetAvailable(): boolean;
32
+
30
33
  /**
31
34
  *
32
35
  */
@@ -43,13 +46,13 @@ export interface vtkImageCropFilter extends vtkImageCropFilterBase {
43
46
  *
44
47
  * @param croppingPlanes
45
48
  */
46
- setCroppingPlanes(croppingPlanes: number[]): boolean;
49
+ setCroppingPlanes(croppingPlanes: CroppingPlanes): boolean;
47
50
 
48
51
  /**
49
52
  *
50
53
  * @param croppingPlanes
51
54
  */
52
- setCroppingPlanesFrom(croppingPlanes: number[]): boolean;
55
+ setCroppingPlanesFrom(croppingPlanes: CroppingPlanes): boolean;
53
56
  }
54
57
 
55
58
  /**
@@ -1,6 +1,6 @@
1
1
  import macro from '../../macros.js';
2
2
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
3
- import { g as subtract, n as norm } from '../../Common/Core/Math/index.js';
3
+ import { s as subtract, n as norm } from '../../Common/Core/Math/index.js';
4
4
 
5
5
  var vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
6
6
  // vtkLineSource methods
@@ -2,7 +2,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
2
  import { mat4, vec3 } from 'gl-matrix';
3
3
  import macro from '../../macros.js';
4
4
  import vtkDataArray from '../../Common/Core/DataArray.js';
5
- import { g as subtract, l as normalize, d as dot, j as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
5
+ import { s as subtract, l as normalize, d as dot, j as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
6
6
  import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
7
7
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
8
8
 
@@ -5,7 +5,7 @@ import vtkCompositeMouseManipulator from './CompositeMouseManipulator.js';
5
5
  import vtkInteractorStyleConstants from '../../Rendering/Core/InteractorStyle/Constants.js';
6
6
  import vtkMouseCameraUnicamRotateManipulator from './MouseCameraUnicamRotateManipulator.js';
7
7
  import macro from '../../macros.js';
8
- import { g as subtract, x as multiplyScalar, l as normalize, d as dot, r as radiansFromDegrees, j as cross } from '../../Common/Core/Math/index.js';
8
+ import { s as subtract, x as multiplyScalar, l as normalize, d as dot, r as radiansFromDegrees, j as cross } from '../../Common/Core/Math/index.js';
9
9
 
10
10
  var States = vtkInteractorStyleConstants.States; // ----------------------------------------------------------------------------
11
11
  // vtkMouseCameraUnicamManipulator methods
@@ -10,7 +10,7 @@ import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
10
10
  import { FieldAssociations } from '../../Common/DataModel/DataSet/Constants.js';
11
11
  import { mat4, vec3 } from 'gl-matrix';
12
12
  import macro from '../../macros.js';
13
- import { B as areEquals, l as normalize, d as dot, C as clampValue, g as subtract, j as cross, x as multiplyScalar, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
13
+ import { B as areEquals, l as normalize, d as dot, C as clampValue, s as subtract, j as cross, x as multiplyScalar, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
14
14
 
15
15
  var States = vtkInteractorStyleConstants.States; // ----------------------------------------------------------------------------
16
16
  // vtkMouseCameraUnicamRotateManipulator methods
@@ -0,0 +1,11 @@
1
+ export declare enum Corners {
2
+ TOP_LEFT = 'TOP_LEFT',
3
+ TOP_RIGHT = 'TOP_RIGHT',
4
+ BOTTOM_LEFT = 'BOTTOM_LEFT',
5
+ BOTTOM_RIGHT = 'BOTTOM_RIGHT',
6
+ }
7
+
8
+ declare const _default: {
9
+ Corners: typeof Corners;
10
+ };
11
+ export default _default;
@@ -4,13 +4,8 @@ import vtkAxesActor from './../../Rendering/Core/AxesActor';
4
4
  import vtkRenderer from './../../Rendering/Core/Renderer';
5
5
  import vtkRenderWindowInteractor from './../../Rendering/Core/RenderWindowInteractor';
6
6
  import { Nullable } from './../../types';
7
+ import { Corners } from './OrientationMarkerWidget/Constants';
7
8
 
8
- export enum Corners {
9
- TOP_LEFT,
10
- TOP_RIGHT,
11
- BOTTOM_LEFT,
12
- BOTTOM_RIGHT,
13
- }
14
9
 
15
10
  /**
16
11
  *
@@ -177,5 +172,6 @@ export function newInstance(initialValues?: IOrientationMarkerWidgetInitialValue
177
172
  export declare const vtkOrientationMarkerWidget: {
178
173
  newInstance: typeof newInstance;
179
174
  extend: typeof extend;
175
+ Corners: typeof Corners;
180
176
  }
181
177
  export default vtkOrientationMarkerWidget;
@@ -1,9 +1,12 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import macro from '../../macros.js';
3
- import { l as normalize } from '../../Common/Core/Math/index.js';
3
+ import vtkCellTypes from '../../Common/DataModel/CellTypes.js';
4
+ import vtkLine from '../../Common/DataModel/Line.js';
4
5
  import vtkPicker from './Picker.js';
5
- import vtkPoints from '../../Common/Core/Points.js';
6
+ import vtkPolyLine from '../../Common/DataModel/PolyLine.js';
6
7
  import vtkTriangle from '../../Common/DataModel/Triangle.js';
8
+ import { l as normalize } from '../../Common/Core/Math/index.js';
9
+ import { CellType } from '../../Common/DataModel/CellTypes/Constants.js';
7
10
  import { vec3 } from 'gl-matrix';
8
11
 
9
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; }
@@ -12,6 +15,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
15
  // Global methods
13
16
  // ----------------------------------------------------------------------------
14
17
 
18
+ function createCellMap() {
19
+ var _ref;
20
+
21
+ return _ref = {}, _defineProperty(_ref, CellType.VTK_LINE, vtkLine.newInstance()), _defineProperty(_ref, CellType.VTK_POLY_LINE, vtkPolyLine.newInstance()), _defineProperty(_ref, CellType.VTK_TRIANGLE, vtkTriangle.newInstance()), _ref;
22
+ }
23
+
15
24
  function clipLineWithPlane(mapper, matrix, p1, p2) {
16
25
  var outObj = {
17
26
  planeId: -1,
@@ -214,8 +223,10 @@ function vtkCellPicker(publicAPI, model) {
214
223
  var minXYZ = [0, 0, 0];
215
224
  var pDistMin = Number.MAX_VALUE;
216
225
  var minPCoords = [0, 0, 0];
217
- var minCellId = -1;
218
- var minCell = vtkTriangle.newInstance();
226
+ var minCellId = null;
227
+ var minCell = null;
228
+ var minCellType = null;
229
+ var subId = null;
219
230
  var x = [];
220
231
  var data = mapper.getInputData();
221
232
 
@@ -235,30 +246,35 @@ function vtkCellPicker(publicAPI, model) {
235
246
  }
236
247
  }
237
248
 
238
- if (data.getPolys) {
239
- var cellObject = data.getPolys();
240
- var points = data.getPoints();
241
- var cellData = cellObject.getData();
242
- var cellId = 0;
243
- var pointsIdList = [-1, -1, -1];
244
- var cell = vtkTriangle.newInstance();
245
- var cellPoints = vtkPoints.newInstance(); // cross all cells
249
+ if (data.getCells) {
250
+ if (!data.getCells()) {
251
+ data.buildLinks();
252
+ }
246
253
 
247
- for (var i = 0; i < cellData.length; cellId++) {
248
- var pCoords = [0, 0, 0];
249
- var nbPointsInCell = cellData[i++];
250
- cellPoints.setNumberOfPoints(nbPointsInCell); // Extract cell points
254
+ var tempCellMap = createCellMap();
255
+ var minCellMap = createCellMap();
256
+ var numberOfCells = data.getNumberOfCells();
251
257
 
252
- for (var _j = 0; _j < nbPointsInCell; _j++) {
253
- pointsIdList[_j] = cellData[i++];
254
- } // Create cell from points
258
+ for (var cellId = 0; cellId < numberOfCells; cellId++) {
259
+ var pCoords = [0, 0, 0];
260
+ minCellType = data.getCellType(cellId);
261
+ var cell = tempCellMap[minCellType];
255
262
 
263
+ if (cell == null) {
264
+ // eslint-disable-next-line no-continue
265
+ continue;
266
+ }
256
267
 
257
- cell.initialize(points, pointsIdList);
268
+ minCell = minCellMap[minCellType];
269
+ data.getCell(cellId, cell);
258
270
  var cellPicked = void 0;
259
271
 
260
272
  {
261
- cellPicked = cell.intersectWithLine(p1, p2, tol, x, pCoords);
273
+ if (vtkCellTypes.hasSubCells(minCellType)) {
274
+ cellPicked = cell.intersectWithLine(t1, t2, p1, p2, tol, x, pCoords);
275
+ } else {
276
+ cellPicked = cell.intersectWithLine(p1, p2, tol, x, pCoords);
277
+ }
262
278
  }
263
279
 
264
280
  if (cellPicked.intersect === 1 && cellPicked.t <= tMin + model.tolerance && cellPicked.t >= t1 && cellPicked.t <= t2) {
@@ -267,6 +283,7 @@ function vtkCellPicker(publicAPI, model) {
267
283
  if (pDist < pDistMin || pDist === pDistMin && cellPicked.t < tMin) {
268
284
  tMin = cellPicked.t;
269
285
  pDistMin = pDist;
286
+ subId = cellPicked.subId;
270
287
  minCellId = cellId;
271
288
  cell.deepCopy(minCell);
272
289
 
@@ -281,17 +298,21 @@ function vtkCellPicker(publicAPI, model) {
281
298
 
282
299
  if (minCellId >= 0 && tMin < model.globalTMin) {
283
300
  resetPickInfo();
301
+ var nbPointsInCell = minCell.getNumberOfPoints();
302
+ var weights = new Array(nbPointsInCell);
284
303
 
285
- var _nbPointsInCell = minCell.getNumberOfPoints();
286
-
287
- var weights = new Array(_nbPointsInCell);
288
-
289
- for (var _i = 0; _i < _nbPointsInCell; _i++) {
290
- weights[_i] = 0.0;
304
+ for (var i = 0; i < nbPointsInCell; i++) {
305
+ weights[i] = 0.0;
291
306
  }
292
307
 
293
308
  var point = [];
294
- minCell.evaluateLocation(minPCoords, point, weights); // Return the polydata to the user
309
+
310
+ if (vtkCellTypes.hasSubCells(minCellType)) {
311
+ minCell.evaluateLocation(subId, minPCoords, point, weights);
312
+ } else {
313
+ minCell.evaluateLocation(minPCoords, point, weights);
314
+ } // Return the polydata to the user
315
+
295
316
 
296
317
  model.dataSet = data;
297
318
  model.cellId = minCellId;
@@ -302,10 +323,10 @@ function vtkCellPicker(publicAPI, model) {
302
323
  var maxWeight = 0;
303
324
  var iMaxWeight = -1;
304
325
 
305
- for (var _i2 = 0; _i2 < _nbPointsInCell; _i2++) {
306
- if (weights[_i2] > maxWeight) {
307
- iMaxWeight = _i2;
308
- maxWeight = weights[_i2];
326
+ for (var _i = 0; _i < nbPointsInCell; _i++) {
327
+ if (weights[_i] > maxWeight) {
328
+ iMaxWeight = _i;
329
+ maxWeight = weights[_i];
309
330
  }
310
331
  } // If maximum weight is found, use it to get the PointId
311
332
 
@@ -0,0 +1,26 @@
1
+ export declare enum ColorMode {
2
+ DEFAULT = 0,
3
+ MAP_SCALARS = 1,
4
+ DIRECT_SCALARS = 2,
5
+ }
6
+
7
+ export declare enum ScalarMode {
8
+ DEFAULT = 0,
9
+ USE_POINT_DATA = 1,
10
+ USE_CELL_DATA = 2,
11
+ USE_POINT_FIELD_DATA = 3,
12
+ USE_CELL_FIELD_DATA = 4,
13
+ USE_FIELD_DATA = 5,
14
+ }
15
+
16
+ export declare enum GetArray {
17
+ BY_ID = 0,
18
+ BY_NAME = 1,
19
+ }
20
+
21
+ declare const _default: {
22
+ ColorMode: typeof ColorMode;
23
+ ScalarMode: typeof ScalarMode;
24
+ GetArray: typeof GetArray;
25
+ };
26
+ export default _default;
@@ -1,25 +1,6 @@
1
1
  import { Bounds, Nullable, Range } from './../../types';
2
2
  import vtkAbstractMapper3D, { IAbstractMapper3DInitialValues } from './AbstractMapper3D';
3
-
4
- export enum ColorMode {
5
- DEFAULT,
6
- MAP_SCALARS,
7
- DIRECT_SCALARS,
8
- }
9
-
10
- export enum ScalarMode {
11
- DEFAULT,
12
- USE_POINT_DATA,
13
- USE_CELL_DATA,
14
- USE_POINT_FIELD_DATA,
15
- USE_CELL_FIELD_DATA,
16
- USE_FIELD_DATA,
17
- }
18
-
19
- export enum GetArray {
20
- BY_ID,
21
- BY_NAME,
22
- }
3
+ import { ColorMode, GetArray, ScalarMode } from './Mapper/Constants';
23
4
 
24
5
  interface IPrimitiveCount {
25
6
  points: number;
@@ -166,7 +147,7 @@ export interface vtkMapper extends vtkAbstractMapper3D {
166
147
  /**
167
148
  * Return the method of coloring scalar data.
168
149
  */
169
- getColorMode(): number;
150
+ getColorMode(): ColorMode;
170
151
 
171
152
  /**
172
153
  * Return the method of coloring scalar data.
@@ -643,5 +624,8 @@ export declare const vtkMapper: {
643
624
  getResolveCoincidentTopologyLineOffsetParameters: typeof getResolveCoincidentTopologyLineOffsetParameters;
644
625
  getResolveCoincidentTopologyPointOffsetParameters: typeof getResolveCoincidentTopologyPointOffsetParameters;
645
626
  getResolveCoincidentTopologyPolygonOffsetParameters: typeof getResolveCoincidentTopologyPolygonOffsetParameters;
627
+ ColorMode: typeof ColorMode;
628
+ ScalarMode: typeof ScalarMode;
629
+ GetArray: typeof GetArray;
646
630
  }
647
631
  export default vtkMapper;