@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
|
@@ -1,133 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
3
|
-
import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
|
|
4
|
-
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
5
|
-
import vtkGlyph3DMapper from '../../Rendering/Core/Glyph3DMapper.js';
|
|
6
|
-
import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
7
|
-
import vtkContextRepresentation from './ContextRepresentation.js';
|
|
8
|
-
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
9
2
|
import macro from '../../macros.js';
|
|
3
|
+
import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
|
|
4
|
+
import vtkGlyphRepresentation from './GlyphRepresentation.js';
|
|
5
|
+
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
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; }
|
|
10
10
|
|
|
11
11
|
function vtkSphereContextRepresentation(publicAPI, model) {
|
|
12
12
|
model.classHierarchy.push('vtkSphereContextRepresentation');
|
|
13
|
-
|
|
14
|
-
mtime: 0
|
|
15
|
-
});
|
|
16
|
-
model.internalArrays = {
|
|
17
|
-
points: model.internalPolyData.getPoints(),
|
|
18
|
-
scale: vtkDataArray.newInstance({
|
|
19
|
-
name: 'scale',
|
|
20
|
-
numberOfComponents: 3,
|
|
21
|
-
empty: true
|
|
22
|
-
}),
|
|
23
|
-
color: vtkDataArray.newInstance({
|
|
24
|
-
name: 'color',
|
|
25
|
-
numberOfComponents: 1,
|
|
26
|
-
empty: true
|
|
27
|
-
})
|
|
28
|
-
};
|
|
29
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.scale);
|
|
30
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.color);
|
|
31
|
-
model.pipelines = {
|
|
32
|
-
circle: {
|
|
33
|
-
source: publicAPI,
|
|
34
|
-
glyph: vtkSphereSource.newInstance({
|
|
35
|
-
phiResolution: model.glyphResolution,
|
|
36
|
-
thetaResolution: model.glyphResolution
|
|
37
|
-
}),
|
|
38
|
-
mapper: vtkGlyph3DMapper.newInstance({
|
|
39
|
-
scaleArray: 'scale',
|
|
40
|
-
scaleMode: vtkGlyph3DMapper.ScaleModes.SCALE_BY_MAGNITUDE,
|
|
41
|
-
colorByArrayName: 'color',
|
|
42
|
-
scalarMode: ScalarMode.USE_POINT_FIELD_DATA
|
|
43
|
-
}),
|
|
44
|
-
actor: vtkActor.newInstance({
|
|
45
|
-
pickable: false,
|
|
46
|
-
parentProp: publicAPI
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
model.pipelines.circle.actor.getProperty().setOpacity(0.2);
|
|
51
|
-
vtkWidgetRepresentation.connectPipeline(model.pipelines.circle);
|
|
52
|
-
publicAPI.addActor(model.pipelines.circle.actor);
|
|
53
|
-
publicAPI.setGlyphResolution = macro.chain(publicAPI.setGlyphResolution, function (r) {
|
|
54
|
-
return model.pipelines.circle.glyph.setResolution(r);
|
|
55
|
-
});
|
|
13
|
+
publicAPI.setGlyphResolution = macro.chain(publicAPI.setGlyphResolution, model._pipeline.glyph.setThetaResolution, model._pipeline.glyph.setPhiResolution);
|
|
56
14
|
|
|
57
15
|
publicAPI.setDrawBorder = function (draw) {
|
|
58
|
-
model.
|
|
16
|
+
model._pipeline.glyph.setLines(draw);
|
|
59
17
|
};
|
|
60
18
|
|
|
61
19
|
publicAPI.setDrawFace = function (draw) {
|
|
62
|
-
model.
|
|
20
|
+
model._pipeline.glyph.setFace(draw);
|
|
63
21
|
};
|
|
64
22
|
|
|
65
23
|
publicAPI.setOpacity = function (opacity) {
|
|
66
|
-
model.
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
var superGetRepresentationStates = publicAPI.getRepresentationStates;
|
|
70
|
-
|
|
71
|
-
publicAPI.getRepresentationStates = function () {
|
|
72
|
-
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
|
|
73
|
-
return superGetRepresentationStates(input).filter(function (state) {
|
|
74
|
-
var _state$getOrigin, _state$isVisible;
|
|
75
|
-
|
|
76
|
-
return ((_state$getOrigin = state.getOrigin) === null || _state$getOrigin === void 0 ? void 0 : _state$getOrigin.call(state)) && ((_state$isVisible = state.isVisible) === null || _state$isVisible === void 0 ? void 0 : _state$isVisible.call(state));
|
|
77
|
-
});
|
|
24
|
+
model._pipeline.actor.getProperty().setOpacity(opacity);
|
|
78
25
|
};
|
|
79
26
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
points = _model$internalArrays.points,
|
|
83
|
-
scale = _model$internalArrays.scale,
|
|
84
|
-
color = _model$internalArrays.color;
|
|
85
|
-
var list = publicAPI.getRepresentationStates(inData[0]);
|
|
86
|
-
var totalCount = list.length;
|
|
87
|
-
|
|
88
|
-
if (color.getNumberOfValues() !== totalCount) {
|
|
89
|
-
// Need to resize dataset
|
|
90
|
-
points.setData(new Float32Array(3 * totalCount));
|
|
91
|
-
scale.setData(new Float32Array(3 * totalCount));
|
|
92
|
-
color.setData(new Float32Array(totalCount));
|
|
93
|
-
}
|
|
27
|
+
model._pipeline.actor.getProperty().setOpacity(0.2);
|
|
28
|
+
}
|
|
94
29
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
scale: scale.getData(),
|
|
98
|
-
color: color.getData()
|
|
99
|
-
};
|
|
30
|
+
function defaultValues(initialValues) {
|
|
31
|
+
var _initialValues$glyphR, _initialValues$glyphR2;
|
|
100
32
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
33
|
+
return _objectSpread({
|
|
34
|
+
glyphResolution: 32,
|
|
35
|
+
drawBorder: false,
|
|
36
|
+
drawFace: true,
|
|
37
|
+
behavior: Behavior.CONTEXT,
|
|
38
|
+
_pipeline: {
|
|
39
|
+
glyph: vtkSphereSource.newInstance({
|
|
40
|
+
phiResolution: (_initialValues$glyphR = initialValues.glyphResolution) !== null && _initialValues$glyphR !== void 0 ? _initialValues$glyphR : 32,
|
|
41
|
+
thetaResolution: (_initialValues$glyphR2 = initialValues.glyphResolution) !== null && _initialValues$glyphR2 !== void 0 ? _initialValues$glyphR2 : 32
|
|
42
|
+
})
|
|
111
43
|
}
|
|
44
|
+
}, initialValues);
|
|
45
|
+
} // ----------------------------------------------------------------------------
|
|
112
46
|
|
|
113
|
-
model.internalPolyData.modified();
|
|
114
|
-
outData[0] = model.internalPolyData;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
var DEFAULT_VALUES = {
|
|
119
|
-
glyphResolution: 32,
|
|
120
|
-
defaultScale: 1,
|
|
121
|
-
drawBorder: false,
|
|
122
|
-
drawFace: true
|
|
123
|
-
}; // ----------------------------------------------------------------------------
|
|
124
47
|
|
|
125
48
|
function extend(publicAPI, model) {
|
|
126
49
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
macro.setGet(publicAPI, model, ['glyphResolution', 'defaultScale']);
|
|
130
|
-
macro.get(publicAPI, model, ['glyph', 'mapper', 'actor']);
|
|
50
|
+
vtkGlyphRepresentation.extend(publicAPI, model, defaultValues(initialValues));
|
|
51
|
+
macro.setGet(publicAPI, model, ['glyphResolution']);
|
|
131
52
|
vtkSphereContextRepresentation(publicAPI, model);
|
|
132
53
|
} // ----------------------------------------------------------------------------
|
|
133
54
|
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
2
|
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
3
|
-
import
|
|
4
|
-
import vtkGlyph3DMapper from '../../Rendering/Core/Glyph3DMapper.js';
|
|
5
|
-
import vtkHandleRepresentation from './HandleRepresentation.js';
|
|
3
|
+
import vtkGlyphRepresentation from './GlyphRepresentation.js';
|
|
6
4
|
import vtkPixelSpaceCallbackMapper from '../../Rendering/Core/PixelSpaceCallbackMapper.js';
|
|
7
|
-
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
8
|
-
import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
|
|
9
|
-
import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
10
5
|
|
|
11
6
|
// vtkSphereHandleRepresentation methods
|
|
12
7
|
// ----------------------------------------------------------------------------
|
|
@@ -14,27 +9,6 @@ import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
|
14
9
|
function vtkSphereHandleRepresentation(publicAPI, model) {
|
|
15
10
|
// Set our className
|
|
16
11
|
model.classHierarchy.push('vtkSphereHandleRepresentation'); // --------------------------------------------------------------------------
|
|
17
|
-
// Internal polydata dataset
|
|
18
|
-
// --------------------------------------------------------------------------
|
|
19
|
-
|
|
20
|
-
model.internalPolyData = vtkPolyData.newInstance({
|
|
21
|
-
mtime: 0
|
|
22
|
-
});
|
|
23
|
-
model.internalArrays = {
|
|
24
|
-
points: model.internalPolyData.getPoints(),
|
|
25
|
-
scale: vtkDataArray.newInstance({
|
|
26
|
-
name: 'scale',
|
|
27
|
-
numberOfComponents: 1,
|
|
28
|
-
empty: true
|
|
29
|
-
}),
|
|
30
|
-
color: vtkDataArray.newInstance({
|
|
31
|
-
name: 'color',
|
|
32
|
-
numberOfComponents: 1,
|
|
33
|
-
empty: true
|
|
34
|
-
})
|
|
35
|
-
};
|
|
36
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.scale);
|
|
37
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.color); // --------------------------------------------------------------------------
|
|
38
12
|
// Generic rendering pipeline
|
|
39
13
|
// --------------------------------------------------------------------------
|
|
40
14
|
|
|
@@ -51,27 +25,16 @@ function vtkSphereHandleRepresentation(publicAPI, model) {
|
|
|
51
25
|
model.displayActor.setMapper(model.displayMapper);
|
|
52
26
|
model.displayMapper.setInputConnection(publicAPI.getOutputPort());
|
|
53
27
|
publicAPI.addActor(model.displayActor);
|
|
54
|
-
model.alwaysVisibleActors = [model.displayActor];
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
phiResolution: model.glyphResolution,
|
|
65
|
-
thetaResolution: model.glyphResolution
|
|
66
|
-
});
|
|
67
|
-
model.mapper.setInputConnection(publicAPI.getOutputPort(), 0);
|
|
68
|
-
model.mapper.setInputConnection(model.glyph.getOutputPort(), 1);
|
|
69
|
-
model.actor.setMapper(model.mapper);
|
|
70
|
-
publicAPI.addActor(model.actor); // --------------------------------------------------------------------------
|
|
71
|
-
|
|
72
|
-
publicAPI.setGlyphResolution = macro.chain(publicAPI.setGlyphResolution, function (r) {
|
|
73
|
-
return model.glyph.setPhiResolution(r) && model.glyph.setThetaResolution(r);
|
|
74
|
-
}); // --------------------------------------------------------------------------
|
|
28
|
+
model.alwaysVisibleActors = [model.displayActor]; // --------------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
publicAPI.getGlyphResolution = function () {
|
|
31
|
+
return model._pipeline.glyph.getPhiResolution();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
publicAPI.setGlyphResolution = function (resolution) {
|
|
35
|
+
return model._pipeline.glyph.setPhiResolution(resolution) || model._pipeline.glyph.setThetaResolution(resolution);
|
|
36
|
+
}; // --------------------------------------------------------------------------
|
|
37
|
+
|
|
75
38
|
|
|
76
39
|
function callbackProxy(coords) {
|
|
77
40
|
if (model.displayCallback) {
|
|
@@ -97,75 +60,15 @@ function vtkSphereHandleRepresentation(publicAPI, model) {
|
|
|
97
60
|
model.displayCallback = callback;
|
|
98
61
|
model.displayMapper.setCallback(callback ? callbackProxy : null);
|
|
99
62
|
};
|
|
100
|
-
|
|
101
|
-
var superGetRepresentationStates = publicAPI.getRepresentationStates;
|
|
102
|
-
|
|
103
|
-
publicAPI.getRepresentationStates = function () {
|
|
104
|
-
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
|
|
105
|
-
return superGetRepresentationStates(input).filter(function (state) {
|
|
106
|
-
var _state$getOrigin, _state$isVisible;
|
|
107
|
-
|
|
108
|
-
return ((_state$getOrigin = state.getOrigin) === null || _state$getOrigin === void 0 ? void 0 : _state$getOrigin.call(state)) && ((_state$isVisible = state.isVisible) === null || _state$isVisible === void 0 ? void 0 : _state$isVisible.call(state));
|
|
109
|
-
});
|
|
110
|
-
}; // --------------------------------------------------------------------------
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
publicAPI.requestData = function (inData, outData) {
|
|
114
|
-
var _model$internalArrays = model.internalArrays,
|
|
115
|
-
points = _model$internalArrays.points,
|
|
116
|
-
scale = _model$internalArrays.scale,
|
|
117
|
-
color = _model$internalArrays.color;
|
|
118
|
-
var list = publicAPI.getRepresentationStates(inData[0]);
|
|
119
|
-
var totalCount = list.length;
|
|
120
|
-
|
|
121
|
-
if (color.getNumberOfValues() !== totalCount) {
|
|
122
|
-
// Need to resize dataset
|
|
123
|
-
points.setData(new Float32Array(3 * totalCount), 3);
|
|
124
|
-
scale.setData(new Float32Array(totalCount));
|
|
125
|
-
color.setData(new Float32Array(totalCount));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
var typedArray = {
|
|
129
|
-
points: points.getData(),
|
|
130
|
-
scale: scale.getData(),
|
|
131
|
-
color: color.getData()
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
for (var i = 0; i < totalCount; i++) {
|
|
135
|
-
var state = list[i];
|
|
136
|
-
var isActive = state.getActive();
|
|
137
|
-
var scaleFactor = isActive ? model.activeScaleFactor : 1;
|
|
138
|
-
var coord = state.getOrigin();
|
|
139
|
-
typedArray.points[i * 3 + 0] = coord[0];
|
|
140
|
-
typedArray.points[i * 3 + 1] = coord[1];
|
|
141
|
-
typedArray.points[i * 3 + 2] = coord[2];
|
|
142
|
-
typedArray.scale[i] = scaleFactor * (state.getScale1 ? state.getScale1() : model.defaultScale);
|
|
143
|
-
|
|
144
|
-
if (publicAPI.getScaleInPixels()) {
|
|
145
|
-
typedArray.scale[i] *= publicAPI.getPixelWorldHeightAtCoord(coord);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
typedArray.color[i] = model.useActiveColor && isActive ? model.activeColor : state.getColor();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
model.internalPolyData.modified();
|
|
152
|
-
outData[0] = model.internalPolyData;
|
|
153
|
-
};
|
|
154
63
|
} // ----------------------------------------------------------------------------
|
|
155
64
|
// Object factory
|
|
156
65
|
// ----------------------------------------------------------------------------
|
|
66
|
+
// ----------------------------------------------------------------------------
|
|
157
67
|
|
|
158
68
|
|
|
159
|
-
var DEFAULT_VALUES = {
|
|
160
|
-
glyphResolution: 8,
|
|
161
|
-
defaultScale: 1
|
|
162
|
-
}; // ----------------------------------------------------------------------------
|
|
163
|
-
|
|
164
69
|
function extend(publicAPI, model) {
|
|
165
70
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
166
|
-
|
|
167
|
-
vtkHandleRepresentation.extend(publicAPI, model, initialValues);
|
|
168
|
-
macro.get(publicAPI, model, ['glyph', 'mapper', 'actor']); // Object specific methods
|
|
71
|
+
vtkGlyphRepresentation.extend(publicAPI, model, initialValues); // Object specific methods
|
|
169
72
|
|
|
170
73
|
vtkSphereHandleRepresentation(publicAPI, model);
|
|
171
74
|
} // ----------------------------------------------------------------------------
|
|
@@ -7,6 +7,7 @@ import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
|
7
7
|
import vtkSpline3D from '../../Common/DataModel/Spline3D.js';
|
|
8
8
|
import vtkTriangleFilter from '../../Filters/General/TriangleFilter.js';
|
|
9
9
|
import vtkLineFilter from '../../Filters/General/LineFilter.js';
|
|
10
|
+
import vtkWidgetRepresentation, { allocateArray } from './WidgetRepresentation.js';
|
|
10
11
|
|
|
11
12
|
// vtkSplineContextRepresentation methods
|
|
12
13
|
// ----------------------------------------------------------------------------
|
|
@@ -17,55 +18,71 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
17
18
|
// Generic rendering pipeline
|
|
18
19
|
// --------------------------------------------------------------------------
|
|
19
20
|
|
|
20
|
-
model.
|
|
21
|
+
model.internalPolyData = vtkPolyData.newInstance({
|
|
22
|
+
mtime: 0
|
|
23
|
+
});
|
|
24
|
+
model._pipelines = {
|
|
21
25
|
area: {
|
|
26
|
+
source: publicAPI,
|
|
27
|
+
filter: vtkTriangleFilter.newInstance(),
|
|
28
|
+
mapper: vtkMapper.newInstance(),
|
|
22
29
|
actor: vtkActor.newInstance({
|
|
23
30
|
parentProp: publicAPI
|
|
24
|
-
})
|
|
25
|
-
mapper: vtkMapper.newInstance(),
|
|
26
|
-
triangleFilter: vtkTriangleFilter.newInstance()
|
|
31
|
+
})
|
|
27
32
|
},
|
|
28
33
|
border: {
|
|
34
|
+
source: publicAPI,
|
|
35
|
+
filter: vtkLineFilter.newInstance(),
|
|
36
|
+
mapper: vtkMapper.newInstance(),
|
|
29
37
|
actor: vtkActor.newInstance({
|
|
30
38
|
parentProp: publicAPI
|
|
31
|
-
})
|
|
32
|
-
mapper: vtkMapper.newInstance(),
|
|
33
|
-
lineFilter: vtkLineFilter.newInstance()
|
|
39
|
+
})
|
|
34
40
|
}
|
|
35
41
|
};
|
|
36
|
-
model.
|
|
37
|
-
|
|
38
|
-
model.
|
|
39
|
-
|
|
40
|
-
model.
|
|
41
|
-
|
|
42
|
-
model.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
model.
|
|
46
|
-
|
|
47
|
-
model.
|
|
48
|
-
|
|
42
|
+
vtkWidgetRepresentation.connectPipeline(model._pipelines.area);
|
|
43
|
+
|
|
44
|
+
model._pipelines.area.actor.getProperty().setOpacity(0.2);
|
|
45
|
+
|
|
46
|
+
model._pipelines.area.actor.getProperty().setColor(0, 1, 0);
|
|
47
|
+
|
|
48
|
+
publicAPI.addActor(model._pipelines.area.actor);
|
|
49
|
+
vtkWidgetRepresentation.connectPipeline(model._pipelines.border);
|
|
50
|
+
|
|
51
|
+
model._pipelines.border.actor.getProperty().setOpacity(1);
|
|
52
|
+
|
|
53
|
+
model._pipelines.border.actor.getProperty().setColor(0.1, 1, 0.1);
|
|
54
|
+
|
|
55
|
+
model._pipelines.border.actor.setVisibility(model.outputBorder);
|
|
56
|
+
|
|
57
|
+
publicAPI.addActor(model._pipelines.border.actor); // --------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
var superGetRepresentationStates = publicAPI.getRepresentationStates;
|
|
60
|
+
|
|
61
|
+
publicAPI.getRepresentationStates = function () {
|
|
62
|
+
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
|
|
63
|
+
return superGetRepresentationStates(input).filter(function (state) {
|
|
64
|
+
var _state$getOrigin, _state$isVisible;
|
|
65
|
+
|
|
66
|
+
return ((_state$getOrigin = state.getOrigin) === null || _state$getOrigin === void 0 ? void 0 : _state$getOrigin.call(state)) && ((_state$isVisible = state.isVisible) === null || _state$isVisible === void 0 ? void 0 : _state$isVisible.call(state));
|
|
67
|
+
});
|
|
68
|
+
};
|
|
49
69
|
|
|
50
70
|
publicAPI.requestData = function (inData, outData) {
|
|
51
|
-
var _model$
|
|
71
|
+
var _model$_pipelines$bor;
|
|
52
72
|
|
|
53
73
|
if (model.deleted) {
|
|
54
74
|
return;
|
|
55
75
|
}
|
|
56
76
|
|
|
57
|
-
var polydata = vtkPolyData.newInstance();
|
|
58
77
|
var widgetState = inData[0];
|
|
59
78
|
var closed = widgetState.getSplineClosed();
|
|
60
|
-
var list = publicAPI.getRepresentationStates(widgetState)
|
|
61
|
-
return state.getVisible && state.getVisible() && state.getOrigin && state.getOrigin();
|
|
62
|
-
});
|
|
79
|
+
var list = publicAPI.getRepresentationStates(widgetState);
|
|
63
80
|
var inPoints = list.map(function (state) {
|
|
64
81
|
return state.getOrigin();
|
|
65
82
|
});
|
|
66
83
|
|
|
67
84
|
if (inPoints.length <= 1) {
|
|
68
|
-
outData[0] =
|
|
85
|
+
outData[0] = model.internalPolyData;
|
|
69
86
|
return;
|
|
70
87
|
}
|
|
71
88
|
|
|
@@ -87,7 +104,7 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
87
104
|
boundaryConditionValues: widgetState.getSplineBoundaryConditionValues()
|
|
88
105
|
});
|
|
89
106
|
spline.computeCoefficients(inPoints);
|
|
90
|
-
var outPoints =
|
|
107
|
+
var outPoints = allocateArray(model.internalPolyData, 'points', (numVertices + !closed) * model.resolution).getData();
|
|
91
108
|
var outCells = new Uint32Array(numVertices * model.resolution + 2);
|
|
92
109
|
outCells[0] = numVertices * model.resolution + 1;
|
|
93
110
|
outCells[numVertices * model.resolution + 1] = 0;
|
|
@@ -114,17 +131,17 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
114
131
|
outCells[numVertices * model.resolution + 1] = lastPointIndex;
|
|
115
132
|
}
|
|
116
133
|
|
|
117
|
-
polydata.getPoints().setData(outPoints);
|
|
118
|
-
|
|
119
134
|
if (model.fill) {
|
|
120
|
-
|
|
135
|
+
model.internalPolyData.getPolys().setData(outCells);
|
|
121
136
|
}
|
|
122
137
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
model.
|
|
138
|
+
model.internalPolyData.getLines().setData(model.outputBorder ? outCells : []);
|
|
139
|
+
model.internalPolyData.modified();
|
|
140
|
+
outData[0] = model.internalPolyData;
|
|
141
|
+
|
|
142
|
+
model._pipelines.area.filter.update();
|
|
126
143
|
|
|
127
|
-
(_model$
|
|
144
|
+
(_model$_pipelines$bor = model._pipelines.border.actor.getProperty()).setColor.apply(_model$_pipelines$bor, _toConsumableArray(inPoints.length <= 3 || model._pipelines.area.filter.getErrorCount() === 0 ? model.borderColor : model.errorBorderColor));
|
|
128
145
|
};
|
|
129
146
|
|
|
130
147
|
publicAPI.getSelectedState = function (prop, compositeID) {
|
|
@@ -132,12 +149,12 @@ function vtkSplineContextRepresentation(publicAPI, model) {
|
|
|
132
149
|
};
|
|
133
150
|
|
|
134
151
|
function updateAreaVisibility() {
|
|
135
|
-
model.
|
|
152
|
+
model._pipelines.area.actor.setVisibility(model.fill);
|
|
136
153
|
}
|
|
137
154
|
|
|
138
155
|
publicAPI.setFill = macro.chain(publicAPI.setFill, updateAreaVisibility);
|
|
139
156
|
publicAPI.setOutputBorder = macro.chain(publicAPI.setOutputBorder, function (v) {
|
|
140
|
-
return model.
|
|
157
|
+
return model._pipelines.border.actor.setVisibility(v);
|
|
141
158
|
});
|
|
142
159
|
} // ----------------------------------------------------------------------------
|
|
143
160
|
// Object factory
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
import vtkDataArray from './../../Common/Core/DataArray';
|
|
2
|
+
import vtkPolyData from './../../Common/DataModel/PolyData';
|
|
3
|
+
import { vtkObject } from './../../interfaces';
|
|
1
4
|
import vtkProp from './../../Rendering/Core/Prop';
|
|
5
|
+
export interface IDisplayScaleParams {
|
|
6
|
+
dispHeightFactor: number,
|
|
7
|
+
cameraPosition: number[],
|
|
8
|
+
cameraDir: number[],
|
|
9
|
+
isParallel: boolean,
|
|
10
|
+
rendererPixelDims: number[],
|
|
11
|
+
}
|
|
2
12
|
|
|
3
13
|
export interface IWidgetRepresentationInitialValues {
|
|
4
14
|
labels?: Array<any>,
|
|
5
15
|
coincidentTopologyParameters?: object,
|
|
6
|
-
displayScaleParams?:
|
|
16
|
+
displayScaleParams?: IDisplayScaleParams,
|
|
7
17
|
scaleInPixels?: boolean
|
|
8
18
|
}
|
|
9
19
|
|
|
@@ -55,6 +65,47 @@ export function extend(publicAPI: object, model: object, initialValues?: IWidget
|
|
|
55
65
|
*/
|
|
56
66
|
export function newInstance(initialValues?: IWidgetRepresentationInitialValues): vtkWidgetRepresentation;
|
|
57
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Static function to get the pixel size of a 3D point.
|
|
70
|
+
* @param {Number[]} worldCoord 3D point in world coordinates
|
|
71
|
+
* @param {IDisplayScaleParams} displayScaleParams Display and camera information
|
|
72
|
+
*/
|
|
73
|
+
export function getPixelWorldHeightAtCoord(worldCoord: number[], displayScaleParams: IDisplayScaleParams): number[];
|
|
74
|
+
|
|
75
|
+
export interface IWidgetPipeline {
|
|
76
|
+
source?: object,
|
|
77
|
+
filter?: object,
|
|
78
|
+
glyph?: object,
|
|
79
|
+
mapper: object,
|
|
80
|
+
actor: object
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* If provided, connects `source` (dataset or filter) to `filter`.
|
|
84
|
+
* If provided, connects `filter` (otherwise `source`) to mapper
|
|
85
|
+
* If provided, connects glyph as 2nd input to mapper. This is typically for the glyph mapper.
|
|
86
|
+
* Connects mapper to actor.
|
|
87
|
+
* @param {IWidgetPipeline} pipeline of source, filter, mapper and actor to connect
|
|
88
|
+
*/
|
|
89
|
+
export function connectPipeline(pipeline: IWidgetPipeline): void;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Allocate or resize a vtkPoint(name='point'), vtkCellArray (name=
|
|
93
|
+
* 'line'|'poly') or vtkDataArray (name=any) and add it to the vtkPolyData.
|
|
94
|
+
* If allocated, the array is automatically added to the polydata
|
|
95
|
+
* Connects mapper to actor.
|
|
96
|
+
* @param {vtkPolyData} polyData The polydata to add array to
|
|
97
|
+
* @param {string} name The name of the array to add (special handling for
|
|
98
|
+
* 'point', 'line, 'poly')
|
|
99
|
+
* @param {Number} numberOfTuples The number of tuples to (re)allocate.
|
|
100
|
+
* @param {String} dataType The typed array type name.
|
|
101
|
+
* @param {Number} numberOfComponents The number of components of the array.
|
|
102
|
+
*/
|
|
103
|
+
export function allocateArray(polyData: vtkPolyData,
|
|
104
|
+
name: string,
|
|
105
|
+
numberOfTuples: number,
|
|
106
|
+
dataType?: string,
|
|
107
|
+
numberOfComponents?: number): vtkDataArray|null;
|
|
108
|
+
|
|
58
109
|
export declare const vtkWidgetRepresentation: {
|
|
59
110
|
newInstance: typeof newInstance;
|
|
60
111
|
extend: typeof extend;
|