@kitware/vtk.js 25.9.1 → 26.0.0-beta.1
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/CellArray.d.ts +0 -6
- package/Common/Core/CellArray.js +21 -12
- package/Common/Core/ClassHierarchy.js +11 -6
- package/Common/Core/DataArray.d.ts +20 -0
- package/Common/Core/DataArray.js +21 -4
- package/Proxy/Core/ViewProxy.js +17 -9
- package/Rendering/Core/Prop3D.js +1 -6
- package/Rendering/Core/RenderWindow.js +9 -6
- package/Rendering/Core/VolumeProperty.js +2 -3
- package/Rendering/Misc/CanvasView.js +6 -5
- package/Rendering/Misc/GenericRenderWindow.js +12 -7
- package/Rendering/OpenGL/Actor.js +4 -4
- package/Rendering/OpenGL/Actor2D.js +4 -4
- package/Rendering/OpenGL/Camera.js +7 -4
- package/Rendering/OpenGL/CubeAxesActor.js +7 -5
- package/Rendering/OpenGL/ForwardPass.js +1 -1
- package/Rendering/OpenGL/Glyph3DMapper.js +4 -4
- package/Rendering/OpenGL/ImageMapper.js +9 -5
- package/Rendering/OpenGL/ImageSlice.js +3 -3
- package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +9 -5
- package/Rendering/OpenGL/PolyDataMapper.js +22 -14
- package/Rendering/OpenGL/PolyDataMapper2D.js +17 -10
- package/Rendering/OpenGL/ScalarBarActor.js +6 -4
- package/Rendering/OpenGL/Skybox.js +10 -6
- package/Rendering/OpenGL/Texture.js +6 -5
- package/Rendering/OpenGL/Volume.js +2 -2
- package/Rendering/OpenGL/VolumeMapper.js +11 -11
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/SceneGraph/RenderPass.js +3 -2
- package/Rendering/WebGPU/ForwardPass.js +1 -1
- package/Rendering/WebGPU/HardwareSelectionPass.js +1 -1
- package/Rendering/WebGPU/HardwareSelector.js +14 -13
- package/Rendering/WebGPU/OpaquePass.js +1 -1
- package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +1 -1
- package/Rendering/WebGPU/VolumePass.js +1 -1
- package/Utilities/config/rules-tests.js +28 -0
- package/Widgets/Core/AbstractWidgetFactory.js +1 -0
- package/Widgets/Core/StateBuilder/color3Mixin.js +22 -0
- package/Widgets/Core/StateBuilder/colorMixin.js +7 -0
- package/Widgets/Core/StateBuilder.js +2 -0
- package/Widgets/Representations/ArrowHandleRepresentation.js +28 -110
- package/Widgets/Representations/CircleContextRepresentation.js +43 -165
- package/Widgets/Representations/ContextRepresentation.js +0 -3
- package/Widgets/Representations/ConvexFaceContextRepresentation.js +11 -11
- package/Widgets/Representations/CroppingOutlineRepresentation.js +5 -12
- package/Widgets/Representations/CubeHandleRepresentation.js +15 -104
- package/Widgets/Representations/GlyphRepresentation.js +320 -0
- package/Widgets/Representations/HandleRepresentation.js +0 -5
- package/Widgets/Representations/ImplicitPlaneRepresentation.js +68 -49
- package/Widgets/Representations/LineHandleRepresentation.js +116 -0
- package/Widgets/Representations/PolyLineRepresentation.js +52 -49
- package/Widgets/Representations/RectangleContextRepresentation.js +16 -21
- package/Widgets/Representations/SphereContextRepresentation.js +30 -109
- package/Widgets/Representations/SphereHandleRepresentation.js +13 -110
- package/Widgets/Representations/SplineContextRepresentation.js +53 -36
- package/Widgets/Representations/WidgetRepresentation.d.ts +52 -1
- package/Widgets/Representations/WidgetRepresentation.js +140 -78
- package/Widgets/Representations.js +6 -0
- package/Widgets/SVG/SVGLandmarkRepresentation.js +1 -13
- package/Widgets/Widgets3D/AngleWidget.js +1 -4
- package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +15 -3
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +93 -36
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +75 -82
- package/Widgets/Widgets3D/ResliceCursorWidget/state.js +49 -170
- package/Widgets/Widgets3D/ResliceCursorWidget.js +61 -23
- package/index.d.ts +0 -1
- package/macros.d.ts +3 -5
- package/macros.js +4 -35
- package/package.json +2 -2
- package/Widgets/Representations/ResliceCursorContextRepresentation/Constants.js +0 -12
- package/Widgets/Representations/ResliceCursorContextRepresentation.d.ts +0 -54
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +0 -357
- package/_vendor/available-typed-arrays/index.js_commonjs-proxy.js +0 -1
- package/_vendor/call-bind/callBound.js_commonjs-proxy.js +0 -1
- package/_vendor/call-bind/index.js_commonjs-module.js +0 -3
- package/_vendor/call-bind/index.js_commonjs-proxy.js +0 -1
- package/_vendor/deep-equal/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
- package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
- package/_vendor/es-abstract/helpers/getOwnPropertyDescriptor.js_commonjs-proxy.js +0 -1
- package/_vendor/es-get-iterator/index.js_commonjs-module.js +0 -3
- package/_vendor/es-get-iterator/index.js_commonjs-proxy.js +0 -1
- package/_vendor/es-get-iterator/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
- package/_vendor/foreach/index.js_commonjs-proxy.js +0 -1
- package/_vendor/function-bind/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/function-bind/index.js_commonjs-proxy.js +0 -1
- package/_vendor/get-intrinsic/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has/src/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has-bigints/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has-symbols/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has-symbols/shams.js_commonjs-proxy.js +0 -1
- package/_vendor/has-tostringtag/shams.js_commonjs-proxy.js +0 -1
- package/_vendor/is-arguments/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-bigint/index.js_commonjs-module.js +0 -3
- package/_vendor/is-bigint/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-boolean-object/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-date-object/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-map/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-number-object/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-regex/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-set/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-string/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-symbol/index.js_commonjs-module.js +0 -3
- package/_vendor/is-symbol/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-typed-array/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-weakmap/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-weakset/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-inspect/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/shim.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/shim.js_commonjs-proxy.js +0 -2
- package/_vendor/regexp.prototype.flags/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/regexp.prototype.flags/index.js_commonjs-proxy.js +0 -1
- package/_vendor/regexp.prototype.flags/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/regexp.prototype.flags/shim.js_commonjs-proxy.js +0 -1
- package/_vendor/side-channel/index.js_commonjs-proxy.js +0 -1
- package/_vendor/which-boxed-primitive/index.js_commonjs-proxy.js +0 -5
- package/_vendor/which-collection/index.js_commonjs-proxy.js +0 -4
- package/_vendor/which-typed-array/index.js_commonjs-proxy.js +0 -1
- package/_virtual/_node-resolve_empty.js_commonjs-proxy.js +0 -6
- package/_virtual/commonjsHelpers.js +0 -18
- package/_virtual/node-resolve_empty.js +0 -8
- package/_virtual/polyfill-node.global.js +0 -5
- package/_virtual/polyfill-node.process.js +0 -225
- package/vendor/available-typed-arrays/index.js +0 -29
- package/vendor/call-bind/callBound.js +0 -19
- package/vendor/call-bind/index.js +0 -52
- package/vendor/deep-equal/index.js +0 -379
- package/vendor/deep-equal/node_modules/isarray/index.js +0 -7
- package/vendor/define-properties/index.js +0 -60
- package/vendor/es-abstract/helpers/getOwnPropertyDescriptor.js +0 -17
- package/vendor/es-get-iterator/index.js +0 -217
- package/vendor/es-get-iterator/node_modules/isarray/index.js +0 -7
- package/vendor/foreach/index.js +0 -22
- package/vendor/function-bind/implementation.js +0 -52
- package/vendor/function-bind/index.js +0 -7
- package/vendor/get-intrinsic/index.js +0 -334
- package/vendor/has/src/index.js +0 -7
- package/vendor/has-bigints/index.js +0 -12
- package/vendor/has-symbols/index.js +0 -15
- package/vendor/has-symbols/shams.js +0 -42
- package/vendor/has-tostringtag/shams.js +0 -9
- package/vendor/is-arguments/index.js +0 -36
- package/vendor/is-bigint/index.js +0 -39
- package/vendor/is-boolean-object/index.js +0 -29
- package/vendor/is-date-object/index.js +0 -22
- package/vendor/is-map/index.js +0 -42
- package/vendor/is-number-object/index.js +0 -26
- package/vendor/is-regex/index.js +0 -61
- package/vendor/is-set/index.js +0 -42
- package/vendor/is-string/index.js +0 -26
- package/vendor/is-symbol/index.js +0 -36
- package/vendor/is-typed-array/index.js +0 -67
- package/vendor/is-weakmap/index.js +0 -42
- package/vendor/is-weakset/index.js +0 -42
- package/vendor/object-inspect/index.js +0 -515
- package/vendor/object-is/implementation.js +0 -18
- package/vendor/object-is/index.js +0 -25
- package/vendor/object-is/polyfill.js +0 -9
- package/vendor/object-is/shim.js +0 -17
- package/vendor/object-keys/implementation.js +0 -124
- package/vendor/object-keys/index.js +0 -35
- package/vendor/object-keys/isArguments.js +0 -17
- package/vendor/object.assign/implementation.js +0 -46
- package/vendor/object.assign/index.js +0 -29
- package/vendor/object.assign/polyfill.js +0 -57
- package/vendor/object.assign/shim.js +0 -17
- package/vendor/regexp.prototype.flags/implementation.js +0 -30
- package/vendor/regexp.prototype.flags/index.js +0 -25
- package/vendor/regexp.prototype.flags/polyfill.js +0 -23
- package/vendor/regexp.prototype.flags/shim.js +0 -29
- package/vendor/side-channel/index.js +0 -128
- package/vendor/which-boxed-primitive/index.js +0 -38
- package/vendor/which-collection/index.js +0 -29
- package/vendor/which-typed-array/index.js +0 -63
package/macros.js
CHANGED
|
@@ -3,7 +3,6 @@ import _typeof from '@babel/runtime/helpers/typeof';
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
5
|
import _construct from '@babel/runtime/helpers/construct';
|
|
6
|
-
import { d as deepEqual } from './vendor/deep-equal/index.js';
|
|
7
6
|
import vtk, { vtkGlobal } from './vtk.js';
|
|
8
7
|
import ClassHierarchy from './Common/Core/ClassHierarchy.js';
|
|
9
8
|
|
|
@@ -234,13 +233,7 @@ function obj() {
|
|
|
234
233
|
if (!('classHierarchy' in model)) {
|
|
235
234
|
model.classHierarchy = new ClassHierarchy('vtkObject');
|
|
236
235
|
} else if (!(model.classHierarchy instanceof ClassHierarchy)) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
for (var i = 0; i < model.classHierarchy.length; i++) {
|
|
240
|
-
hierarchy.push(model.classHierarchy[i]);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
model.classHierarchy = hierarchy;
|
|
236
|
+
model.classHierarchy = ClassHierarchy.from(model.classHierarchy);
|
|
244
237
|
}
|
|
245
238
|
|
|
246
239
|
function off(index) {
|
|
@@ -444,25 +437,12 @@ function obj() {
|
|
|
444
437
|
// getXXX: add getters
|
|
445
438
|
// ----------------------------------------------------------------------------
|
|
446
439
|
|
|
447
|
-
var objectGetterMap = {
|
|
448
|
-
object: function object(publicAPI, model, field) {
|
|
449
|
-
return function getter() {
|
|
450
|
-
return _objectSpread({}, model[field.name]);
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
440
|
function get(publicAPI, model, fieldNames) {
|
|
455
441
|
fieldNames.forEach(function (field) {
|
|
456
442
|
if (_typeof(field) === 'object') {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
publicAPI["get".concat(_capitalize(field.name))] = getter(publicAPI, model, field);
|
|
461
|
-
} else {
|
|
462
|
-
publicAPI["get".concat(_capitalize(field.name))] = function () {
|
|
463
|
-
return model[field.name];
|
|
464
|
-
};
|
|
465
|
-
}
|
|
443
|
+
publicAPI["get".concat(_capitalize(field.name))] = function () {
|
|
444
|
+
return model[field.name];
|
|
445
|
+
};
|
|
466
446
|
} else {
|
|
467
447
|
publicAPI["get".concat(_capitalize(field))] = function () {
|
|
468
448
|
return model[field];
|
|
@@ -511,17 +491,6 @@ var objectSetterMap = {
|
|
|
511
491
|
vtkErrorMacro("Set Enum with invalid argument (String/Number) ".concat(field, ", ").concat(value));
|
|
512
492
|
throw new TypeError('Set Enum with invalid argument (String/Number)');
|
|
513
493
|
};
|
|
514
|
-
},
|
|
515
|
-
object: function object(publicAPI, model, field) {
|
|
516
|
-
return function (value) {
|
|
517
|
-
if (!deepEqual(model[field.name], value)) {
|
|
518
|
-
model[field.name] = value;
|
|
519
|
-
publicAPI.modified();
|
|
520
|
-
return true;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
return false;
|
|
524
|
-
};
|
|
525
494
|
}
|
|
526
495
|
};
|
|
527
496
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitware/vtk.js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0-beta.1",
|
|
4
4
|
"description": "Visualization Toolkit for the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"release:create-packages": "node ./Utilities/ci/build-npm-package.js",
|
|
150
150
|
"test": "karma start ./karma.conf.js",
|
|
151
151
|
"test:headless": "karma start ./karma.conf.js --browsers ChromeHeadlessNoSandbox --single-run",
|
|
152
|
-
"test:debug": "karma start ./karma.conf.js --no-single-run",
|
|
152
|
+
"test:debug": "karma start ./karma.conf.js --log-level debug --no-single-run",
|
|
153
153
|
"test:firefox": "karma start ./karma.conf.js --browsers Firefox",
|
|
154
154
|
"test:webgpu": "cross-env WEBGPU=1 NO_WEBGL=1 karma start ./karma.conf.js --browsers ChromeWebGPU --no-single-run",
|
|
155
155
|
"test:firefox-debug": "karma start ./karma.conf.js --browsers Firefox --no-single-run",
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {vtkWidgetRepresentation, IWidgetRepresentationInitialValues} from './WidgetRepresentation';
|
|
2
|
-
|
|
3
|
-
export interface IResliceCursorContextRepresentationInitialValues extends IWidgetRepresentationInitialValues {
|
|
4
|
-
axis1Name?: string,
|
|
5
|
-
axis2Name?: string,
|
|
6
|
-
rotationEnabled?: boolean,
|
|
7
|
-
rotationHandlePosition?: number,
|
|
8
|
-
scaleInPixels?: boolean,
|
|
9
|
-
viewType: any,
|
|
10
|
-
coincidentTopologyParameters: object,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface vtkResliceCursorContextRepresentation extends vtkWidgetRepresentation {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Returns the ratio applied on the smallest view side (width or height)
|
|
17
|
-
* used to compute the position of the rotation handles.
|
|
18
|
-
* 1 to place the handles on the edge of the smallest view side, 0.5 to
|
|
19
|
-
* place the handles half way between the center of the reslice cursor
|
|
20
|
-
* and the edge of the smallest view side.
|
|
21
|
-
* 0.5 by default
|
|
22
|
-
*/
|
|
23
|
-
getRotationHandlePosition(): number;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Sets the ratio applied on the smallest view side (width or height) used to
|
|
27
|
-
* compute the position of the rotation handles
|
|
28
|
-
* @param {number} ratio a positive floating percent of the smallest view side
|
|
29
|
-
* @returns true if modified, false otherwise
|
|
30
|
-
* @see getRotationHandlePosition()
|
|
31
|
-
*/
|
|
32
|
-
setRotationHandlePosition(ratio: number): boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Method use to decorate a given object (publicAPI+model) with vtkResliceCursorContextRepresentation characteristics.
|
|
37
|
-
*
|
|
38
|
-
* @param publicAPI object on which methods will be bounds (public)
|
|
39
|
-
* @param model object on which data structure will be bounds (protected)
|
|
40
|
-
* @param {IResliceCursorContextRepresentationInitialValues} [initialValues] (default: {})
|
|
41
|
-
*/
|
|
42
|
-
export function extend(publicAPI: object, model: object, initialValues?: IResliceCursorContextRepresentationInitialValues): void;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Method use to create a new instance of vtkResliceCursorContextRepresentation
|
|
46
|
-
* @param {IResliceCursorContextRepresentationInitialValues} [initialValues] for pre-setting some of its content
|
|
47
|
-
*/
|
|
48
|
-
export function newInstance(initialValues?: IResliceCursorContextRepresentationInitialValues): vtkResliceCursorContextRepresentation;
|
|
49
|
-
|
|
50
|
-
export declare const vtkResliceCursorContextRepresentation: {
|
|
51
|
-
newInstance: typeof newInstance;
|
|
52
|
-
extend: typeof extend;
|
|
53
|
-
}
|
|
54
|
-
export default vtkResliceCursorContextRepresentation;
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
-
import macro from '../../macros.js';
|
|
4
|
-
import { s as subtract, o as multiplyAccumulate, m as normalize, k as cross } from '../../Common/Core/Math/index.js';
|
|
5
|
-
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
6
|
-
import vtkCylinderSource from '../../Filters/Sources/CylinderSource.js';
|
|
7
|
-
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
8
|
-
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
9
|
-
import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
|
|
10
|
-
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
11
|
-
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
12
|
-
import { InteractionMethodsName } from '../Widgets3D/ResliceCursorWidget/Constants.js';
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
// vtkResliceCursorContextRepresentation methods
|
|
18
|
-
// ----------------------------------------------------------------------------
|
|
19
|
-
|
|
20
|
-
function vtkResliceCursorContextRepresentation(publicAPI, model) {
|
|
21
|
-
// Set our className
|
|
22
|
-
model.classHierarchy.push('vtkResliceCursorContextRepresentation'); // --------------------------------------------------------------------------
|
|
23
|
-
// Generic rendering pipeline
|
|
24
|
-
// --------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
model.mapper = vtkMapper.newInstance();
|
|
27
|
-
model.actor = vtkActor.newInstance({
|
|
28
|
-
parentProp: publicAPI
|
|
29
|
-
});
|
|
30
|
-
model.mapper.setInputConnection(publicAPI.getOutputPort());
|
|
31
|
-
model.actor.setMapper(model.mapper);
|
|
32
|
-
publicAPI.addActor(model.actor);
|
|
33
|
-
model.pipelines = {};
|
|
34
|
-
model.pipelines.center = {
|
|
35
|
-
source: vtkSphereSource.newInstance(),
|
|
36
|
-
mapper: vtkMapper.newInstance(),
|
|
37
|
-
actor: vtkActor.newInstance({
|
|
38
|
-
parentProp: publicAPI
|
|
39
|
-
})
|
|
40
|
-
};
|
|
41
|
-
model.pipelines.axes = [];
|
|
42
|
-
var squarishCylinderProperties = {
|
|
43
|
-
initAngle: Math.PI / 4,
|
|
44
|
-
otherRadius: 0,
|
|
45
|
-
resolution: 4
|
|
46
|
-
}; // Create axis 1
|
|
47
|
-
|
|
48
|
-
var axis1 = {};
|
|
49
|
-
axis1.line = {
|
|
50
|
-
source: vtkCylinderSource.newInstance(squarishCylinderProperties),
|
|
51
|
-
mapper: vtkMapper.newInstance(),
|
|
52
|
-
actor: vtkActor.newInstance({
|
|
53
|
-
pickable: true,
|
|
54
|
-
_parentProp: publicAPI
|
|
55
|
-
})
|
|
56
|
-
};
|
|
57
|
-
axis1.rotation1 = {
|
|
58
|
-
source: vtkSphereSource.newInstance(),
|
|
59
|
-
mapper: vtkMapper.newInstance(),
|
|
60
|
-
actor: vtkActor.newInstance({
|
|
61
|
-
pickable: true,
|
|
62
|
-
_parentProp: publicAPI
|
|
63
|
-
})
|
|
64
|
-
};
|
|
65
|
-
axis1.rotation2 = {
|
|
66
|
-
source: vtkSphereSource.newInstance(),
|
|
67
|
-
mapper: vtkMapper.newInstance(),
|
|
68
|
-
actor: vtkActor.newInstance({
|
|
69
|
-
pickable: true,
|
|
70
|
-
_parentProp: publicAPI
|
|
71
|
-
})
|
|
72
|
-
}; // Create axis 2
|
|
73
|
-
|
|
74
|
-
var axis2 = {};
|
|
75
|
-
axis2.line = {
|
|
76
|
-
source: vtkCylinderSource.newInstance(squarishCylinderProperties),
|
|
77
|
-
mapper: vtkMapper.newInstance(),
|
|
78
|
-
actor: vtkActor.newInstance({
|
|
79
|
-
pickable: true,
|
|
80
|
-
_parentProp: publicAPI
|
|
81
|
-
})
|
|
82
|
-
};
|
|
83
|
-
axis2.rotation1 = {
|
|
84
|
-
source: vtkSphereSource.newInstance(),
|
|
85
|
-
mapper: vtkMapper.newInstance(),
|
|
86
|
-
actor: vtkActor.newInstance({
|
|
87
|
-
pickable: true,
|
|
88
|
-
_parentProp: publicAPI
|
|
89
|
-
})
|
|
90
|
-
};
|
|
91
|
-
axis2.rotation2 = {
|
|
92
|
-
source: vtkSphereSource.newInstance(),
|
|
93
|
-
mapper: vtkMapper.newInstance(),
|
|
94
|
-
actor: vtkActor.newInstance({
|
|
95
|
-
pickable: true,
|
|
96
|
-
_parentProp: publicAPI
|
|
97
|
-
})
|
|
98
|
-
};
|
|
99
|
-
model.pipelines.axes.push(axis1);
|
|
100
|
-
model.pipelines.axes.push(axis2); // Improve actors rendering
|
|
101
|
-
|
|
102
|
-
model.pipelines.center.actor.getProperty().setAmbient(1, 1, 1);
|
|
103
|
-
model.pipelines.center.actor.getProperty().setDiffuse(0, 0, 0);
|
|
104
|
-
model.pipelines.center.actor.getProperty().setBackfaceCulling(true);
|
|
105
|
-
model.pipelines.axes.forEach(function (axis) {
|
|
106
|
-
Object.values(axis).forEach(function (lineOrRotationHandle) {
|
|
107
|
-
vtkWidgetRepresentation.connectPipeline(lineOrRotationHandle);
|
|
108
|
-
var actor = lineOrRotationHandle.actor;
|
|
109
|
-
actor.getProperty().setAmbient(1, 1, 1);
|
|
110
|
-
actor.getProperty().setDiffuse(0, 0, 0);
|
|
111
|
-
actor.getProperty().setBackfaceCulling(true);
|
|
112
|
-
publicAPI.addActor(actor);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
vtkWidgetRepresentation.connectPipeline(model.pipelines.center);
|
|
116
|
-
publicAPI.addActor(model.pipelines.center.actor);
|
|
117
|
-
|
|
118
|
-
publicAPI.setLineThickness = function (lineThickness) {
|
|
119
|
-
var scaledLineThickness = lineThickness;
|
|
120
|
-
|
|
121
|
-
if (publicAPI.getScaleInPixels()) {
|
|
122
|
-
var centerCoords = model.pipelines.center.source.getCenter();
|
|
123
|
-
scaledLineThickness *= publicAPI.getPixelWorldHeightAtCoord(centerCoords);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
model.pipelines.axes[0].line.source.setRadius(scaledLineThickness);
|
|
127
|
-
model.pipelines.axes[1].line.source.setRadius(scaledLineThickness);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
publicAPI.setSphereRadius = function (radius) {
|
|
131
|
-
publicAPI.setSphereRadiusOnSphere(radius, model.pipelines.center.source);
|
|
132
|
-
publicAPI.setSphereRadiusOnSphere(radius, model.pipelines.axes[0].rotation1.source);
|
|
133
|
-
publicAPI.setSphereRadiusOnSphere(radius, model.pipelines.axes[0].rotation2.source);
|
|
134
|
-
publicAPI.setSphereRadiusOnSphere(radius, model.pipelines.axes[1].rotation1.source);
|
|
135
|
-
publicAPI.setSphereRadiusOnSphere(radius, model.pipelines.axes[1].rotation2.source);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
publicAPI.setSphereRadiusOnSphere = function (radius, source) {
|
|
139
|
-
var scaledRadius = radius;
|
|
140
|
-
|
|
141
|
-
if (publicAPI.getScaleInPixels()) {
|
|
142
|
-
var centerCoords = source.getCenter();
|
|
143
|
-
scaledRadius *= publicAPI.getPixelWorldHeightAtCoord(centerCoords);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
source.setRadius(scaledRadius);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
publicAPI.setSphereRadius(7);
|
|
150
|
-
|
|
151
|
-
function updateRender(state, axis) {
|
|
152
|
-
var color = state.getColor();
|
|
153
|
-
axis.line.actor.getProperty().setColor(color);
|
|
154
|
-
axis.rotation1.actor.getProperty().setColor(color);
|
|
155
|
-
axis.rotation2.actor.getProperty().setColor(color);
|
|
156
|
-
var vector = [0, 0, 0];
|
|
157
|
-
subtract(state.getPoint2(), state.getPoint1(), vector);
|
|
158
|
-
var center = [0, 0, 0];
|
|
159
|
-
multiplyAccumulate(state.getPoint1(), vector, 0.5, center);
|
|
160
|
-
var length = normalize(vector);
|
|
161
|
-
axis.line.source.setHeight(20 * length); // make it an infinite line
|
|
162
|
-
// Rotate the cylinder to be along vector
|
|
163
|
-
|
|
164
|
-
var viewNormal = model.inputData[0].getPlanes()[state.getInViewType()].normal;
|
|
165
|
-
var x = cross(vector, viewNormal, []);
|
|
166
|
-
var mat = [].concat(_toConsumableArray(x), [0], vector, [0], _toConsumableArray(viewNormal), [0], center, [1]);
|
|
167
|
-
axis.line.actor.setUserMatrix(mat); // Rotation handles
|
|
168
|
-
|
|
169
|
-
var distance = 0;
|
|
170
|
-
|
|
171
|
-
if (publicAPI.getScaleInPixels()) {
|
|
172
|
-
var pixelWorldHeight = publicAPI.getPixelWorldHeightAtCoord(center);
|
|
173
|
-
var rendererPixelDims = model.displayScaleParams.rendererPixelDims;
|
|
174
|
-
var totalSize = Math.min(rendererPixelDims[0], rendererPixelDims[1]) / 2;
|
|
175
|
-
distance = publicAPI.getRotationHandlePosition() * pixelWorldHeight * totalSize;
|
|
176
|
-
} else {
|
|
177
|
-
distance = publicAPI.getRotationHandlePosition() * length / 2;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
var rotationHandlePosition = [];
|
|
181
|
-
multiplyAccumulate(center, vector, distance, rotationHandlePosition);
|
|
182
|
-
axis.rotation1.source.setCenter(rotationHandlePosition);
|
|
183
|
-
multiplyAccumulate(center, vector, -distance, rotationHandlePosition);
|
|
184
|
-
axis.rotation2.source.setCenter(rotationHandlePosition);
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Returns the line actors in charge of translating the views.
|
|
188
|
-
*/
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
publicAPI.getTranslationActors = function () {
|
|
192
|
-
return [model.pipelines.axes[0].line.actor, model.pipelines.axes[1].line.actor];
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
publicAPI.getRotationActors = function () {
|
|
196
|
-
return [model.pipelines.axes[0].rotation1.actor, model.pipelines.axes[0].rotation2.actor, model.pipelines.axes[1].rotation1.actor, model.pipelines.axes[1].rotation2.actor];
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
publicAPI.requestData = function (inData, outData) {
|
|
200
|
-
var state = inData[0];
|
|
201
|
-
var origin = state.getCenter();
|
|
202
|
-
model.pipelines.center.source.setCenter(origin);
|
|
203
|
-
var getAxis1 = "get".concat(model.axis1Name);
|
|
204
|
-
var getAxis2 = "get".concat(model.axis2Name);
|
|
205
|
-
var axis1State = state[getAxis1]();
|
|
206
|
-
var axis2State = state[getAxis2]();
|
|
207
|
-
updateRender(axis1State, model.pipelines.axes[0]);
|
|
208
|
-
updateRender(axis2State, model.pipelines.axes[1]);
|
|
209
|
-
publicAPI.setLineThickness(state.getLineThickness());
|
|
210
|
-
publicAPI.setSphereRadius(state.getSphereRadius()); // TODO: return meaningful polydata (e.g. appended lines)
|
|
211
|
-
|
|
212
|
-
outData[0] = vtkPolyData.newInstance();
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
publicAPI.updateActorVisibility = function (renderingType, ctxVisible, hVisible) {
|
|
216
|
-
var state = model.inputData[0];
|
|
217
|
-
var visibility = hVisible || renderingType === RenderingTypes.PICKING_BUFFER;
|
|
218
|
-
publicAPI.getActors().forEach(function (actor) {
|
|
219
|
-
actor.getProperty().setOpacity(state.getOpacity());
|
|
220
|
-
var actorVisibility = visibility; // Conditionally display rotation handles
|
|
221
|
-
|
|
222
|
-
if (publicAPI.getRotationActors().includes(actor)) {
|
|
223
|
-
actorVisibility = actorVisibility && state.getEnableRotation();
|
|
224
|
-
} // Conditionally display center handle but always show it for picking
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (!state.getShowCenter() && actor === model.pipelines.center.actor) {
|
|
228
|
-
actorVisibility = actorVisibility && renderingType === RenderingTypes.PICKING_BUFFER;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
actor.setVisibility(actorVisibility); // Conditionally pick lines
|
|
232
|
-
|
|
233
|
-
if (publicAPI.getTranslationActors().includes(actor)) {
|
|
234
|
-
actor.setPickable(state.getEnableTranslation());
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
var lineThickness = state.getLineThickness();
|
|
238
|
-
|
|
239
|
-
if (renderingType === RenderingTypes.PICKING_BUFFER) {
|
|
240
|
-
lineThickness = Math.max(3, lineThickness);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
publicAPI.setLineThickness(lineThickness);
|
|
244
|
-
var radius = state.getSphereRadius();
|
|
245
|
-
|
|
246
|
-
if (renderingType === RenderingTypes.PICKING_BUFFER) {
|
|
247
|
-
radius += 1;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
publicAPI.setSphereRadius(radius);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
publicAPI.getSelectedState = function (prop, compositeID) {
|
|
254
|
-
var state = model.inputData[0];
|
|
255
|
-
state.setActiveViewType(model.viewType);
|
|
256
|
-
var getAxis1 = "get".concat(model.axis1Name);
|
|
257
|
-
var getAxis2 = "get".concat(model.axis2Name);
|
|
258
|
-
var axis1State = state[getAxis1]();
|
|
259
|
-
var axis2State = state[getAxis2]();
|
|
260
|
-
var activeLineState = null;
|
|
261
|
-
var activeRotationPointName = '';
|
|
262
|
-
var methodName = '';
|
|
263
|
-
|
|
264
|
-
switch (prop) {
|
|
265
|
-
case model.pipelines.axes[0].line.actor:
|
|
266
|
-
activeLineState = axis1State;
|
|
267
|
-
methodName = InteractionMethodsName.TranslateAxis;
|
|
268
|
-
break;
|
|
269
|
-
|
|
270
|
-
case model.pipelines.axes[1].line.actor:
|
|
271
|
-
activeLineState = axis2State;
|
|
272
|
-
methodName = InteractionMethodsName.TranslateAxis;
|
|
273
|
-
break;
|
|
274
|
-
|
|
275
|
-
case model.pipelines.axes[0].rotation1.actor:
|
|
276
|
-
activeLineState = axis1State;
|
|
277
|
-
activeRotationPointName = 'point1';
|
|
278
|
-
methodName = InteractionMethodsName.RotateLine;
|
|
279
|
-
break;
|
|
280
|
-
|
|
281
|
-
case model.pipelines.axes[0].rotation2.actor:
|
|
282
|
-
activeLineState = axis1State;
|
|
283
|
-
activeRotationPointName = 'point2';
|
|
284
|
-
methodName = InteractionMethodsName.RotateLine;
|
|
285
|
-
break;
|
|
286
|
-
|
|
287
|
-
case model.pipelines.axes[1].rotation1.actor:
|
|
288
|
-
activeLineState = axis2State;
|
|
289
|
-
activeRotationPointName = 'point1';
|
|
290
|
-
methodName = InteractionMethodsName.RotateLine;
|
|
291
|
-
break;
|
|
292
|
-
|
|
293
|
-
case model.pipelines.axes[1].rotation2.actor:
|
|
294
|
-
activeLineState = axis2State;
|
|
295
|
-
activeRotationPointName = 'point2';
|
|
296
|
-
methodName = InteractionMethodsName.RotateLine;
|
|
297
|
-
break;
|
|
298
|
-
|
|
299
|
-
default:
|
|
300
|
-
methodName = InteractionMethodsName.TranslateCenter;
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
state.setActiveLineState(activeLineState);
|
|
305
|
-
state.setActiveRotationPointName(activeRotationPointName);
|
|
306
|
-
state.setUpdateMethodName(methodName);
|
|
307
|
-
return state;
|
|
308
|
-
};
|
|
309
|
-
} // ----------------------------------------------------------------------------
|
|
310
|
-
// Object factory
|
|
311
|
-
// ----------------------------------------------------------------------------
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
function defaultValues(initialValues) {
|
|
315
|
-
return _objectSpread(_objectSpread({
|
|
316
|
-
axis1Name: '',
|
|
317
|
-
axis2Name: '',
|
|
318
|
-
rotationEnabled: true,
|
|
319
|
-
rotationHandlePosition: 0.5,
|
|
320
|
-
scaleInPixels: true,
|
|
321
|
-
viewType: null
|
|
322
|
-
}, initialValues), {}, {
|
|
323
|
-
coincidentTopologyParameters: _objectSpread({
|
|
324
|
-
Point: {
|
|
325
|
-
factor: -1.0,
|
|
326
|
-
offset: -1.0
|
|
327
|
-
},
|
|
328
|
-
Line: {
|
|
329
|
-
factor: -1.5,
|
|
330
|
-
offset: -1.5
|
|
331
|
-
},
|
|
332
|
-
Polygon: {
|
|
333
|
-
factor: -2.0,
|
|
334
|
-
offset: -2.0
|
|
335
|
-
}
|
|
336
|
-
}, initialValues.coincidentTopologyParameters)
|
|
337
|
-
});
|
|
338
|
-
} // ----------------------------------------------------------------------------
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
function extend(publicAPI, model) {
|
|
342
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
343
|
-
Object.assign(model, defaultValues(initialValues));
|
|
344
|
-
vtkWidgetRepresentation.extend(publicAPI, model, initialValues);
|
|
345
|
-
macro.setGet(publicAPI, model, ['rotationHandlePosition']); // Object specific methods
|
|
346
|
-
|
|
347
|
-
vtkResliceCursorContextRepresentation(publicAPI, model);
|
|
348
|
-
} // ----------------------------------------------------------------------------
|
|
349
|
-
|
|
350
|
-
var newInstance = macro.newInstance(extend, 'vtkResliceCursorContextRepresentation'); // ----------------------------------------------------------------------------
|
|
351
|
-
|
|
352
|
-
var vtkResliceCursorContextRepresentation$1 = {
|
|
353
|
-
newInstance: newInstance,
|
|
354
|
-
extend: extend
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
export { vtkResliceCursorContextRepresentation$1 as default, extend, newInstance };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/call-bind/callBound.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/call-bind/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/define-properties/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/es-get-iterator/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/get-intrinsic/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../../vendor/has/src/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/has-bigints/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-arguments/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-bigint/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-boolean-object/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-map/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-number-object/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-regex/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-set/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-string/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-symbol/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-typed-array/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-weakmap/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/is-weakset/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/object-is/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/define-properties/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/object-keys/implementation.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../../vendor/object-keys/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|