@kitware/vtk.js 25.10.0 → 26.0.0-beta.2
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/ColorTransferFunction.d.ts +0 -20
- package/Rendering/Core/ColorTransferFunction.js +0 -63
- 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 +27 -21
- 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/Core/WidgetManager.js +21 -256
- 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/Widgets3D/AngleWidget.js +1 -4
- package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
- package/Widgets/Widgets3D/EllipseWidget.js +0 -7
- package/Widgets/Widgets3D/LabelWidget/behavior.js +0 -7
- package/Widgets/Widgets3D/LabelWidget.js +1 -18
- package/Widgets/Widgets3D/LineWidget/behavior.js +0 -44
- package/Widgets/Widgets3D/LineWidget.js +0 -11
- package/Widgets/Widgets3D/PolyLineWidget.js +0 -10
- package/Widgets/Widgets3D/RectangleWidget.js +0 -7
- 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/Widgets/Widgets3D/ShapeWidget.js +1 -1
- package/index.d.ts +0 -1
- package/macros.d.ts +3 -5
- package/macros.js +4 -35
- package/package.json +3 -2
- package/Widgets/Core/WidgetManager/vdom.js +0 -172
- package/Widgets/Representations/ResliceCursorContextRepresentation/Constants.js +0 -12
- package/Widgets/Representations/ResliceCursorContextRepresentation.d.ts +0 -54
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +0 -357
- package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +0 -28
- package/Widgets/SVG/SVGLandmarkRepresentation.js +0 -179
- package/Widgets/SVG/SVGRepresentation.js +0 -163
- 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,195 +1,73 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
-
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
4
3
|
import vtkCircleSource from '../../Filters/Sources/CircleSource.js';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import vtkGlyph3DMapper from '../../Rendering/Core/Glyph3DMapper.js';
|
|
8
|
-
import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
|
|
9
|
-
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
10
|
-
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
11
|
-
import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
12
|
-
import { mat3, vec3 } from 'gl-matrix';
|
|
4
|
+
import vtkGlyphRepresentation from './GlyphRepresentation.js';
|
|
5
|
+
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
13
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; }
|
|
14
10
|
// vtkCircleContextRepresentation methods
|
|
15
11
|
// ----------------------------------------------------------------------------
|
|
16
12
|
|
|
17
13
|
function vtkCircleContextRepresentation(publicAPI, model) {
|
|
18
14
|
// Set our className
|
|
19
15
|
model.classHierarchy.push('vtkCircleContextRepresentation'); // --------------------------------------------------------------------------
|
|
20
|
-
// Internal polydata dataset
|
|
21
|
-
// --------------------------------------------------------------------------
|
|
22
|
-
|
|
23
|
-
model.internalPolyData = vtkPolyData.newInstance({
|
|
24
|
-
mtime: 0
|
|
25
|
-
});
|
|
26
|
-
model.internalArrays = {
|
|
27
|
-
points: model.internalPolyData.getPoints(),
|
|
28
|
-
scale: vtkDataArray.newInstance({
|
|
29
|
-
name: 'scale',
|
|
30
|
-
numberOfComponents: 3,
|
|
31
|
-
empty: true
|
|
32
|
-
}),
|
|
33
|
-
color: vtkDataArray.newInstance({
|
|
34
|
-
name: 'color',
|
|
35
|
-
numberOfComponents: 1,
|
|
36
|
-
empty: true
|
|
37
|
-
}),
|
|
38
|
-
direction: vtkDataArray.newInstance({
|
|
39
|
-
name: 'direction',
|
|
40
|
-
numberOfComponents: 9,
|
|
41
|
-
empty: true
|
|
42
|
-
})
|
|
43
|
-
};
|
|
44
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.scale);
|
|
45
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.color);
|
|
46
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.direction); // --------------------------------------------------------------------------
|
|
47
16
|
// Generic rendering pipeline
|
|
48
17
|
// --------------------------------------------------------------------------
|
|
49
18
|
|
|
50
|
-
model.
|
|
51
|
-
circle: {
|
|
52
|
-
source: publicAPI,
|
|
53
|
-
glyph: vtkCircleSource.newInstance({
|
|
54
|
-
resolution: model.glyphResolution,
|
|
55
|
-
radius: 1,
|
|
56
|
-
lines: model.drawBorder,
|
|
57
|
-
face: model.drawFace
|
|
58
|
-
}),
|
|
59
|
-
mapper: vtkGlyph3DMapper.newInstance({
|
|
60
|
-
orientationArray: 'direction',
|
|
61
|
-
scaleArray: 'scale',
|
|
62
|
-
scaleMode: vtkGlyph3DMapper.ScaleModes.SCALE_BY_COMPONENTS,
|
|
63
|
-
colorByArrayName: 'color',
|
|
64
|
-
scalarMode: ScalarMode.USE_POINT_FIELD_DATA
|
|
65
|
-
}),
|
|
66
|
-
actor: vtkActor.newInstance({
|
|
67
|
-
pickable: false,
|
|
68
|
-
_parentProp: publicAPI
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
model.pipelines.circle.actor.getProperty().setOpacity(0.2);
|
|
73
|
-
model.pipelines.circle.mapper.setOrientationModeToMatrix();
|
|
74
|
-
model.pipelines.circle.mapper.setResolveCoincidentTopology(true);
|
|
75
|
-
model.pipelines.circle.mapper.setResolveCoincidentTopologyPolygonOffsetParameters(-1, -1);
|
|
76
|
-
vtkWidgetRepresentation.connectPipeline(model.pipelines.circle);
|
|
77
|
-
publicAPI.addActor(model.pipelines.circle.actor);
|
|
78
|
-
model.transform = vtkMatrixBuilder.buildFromDegree(); // --------------------------------------------------------------------------
|
|
79
|
-
|
|
80
|
-
publicAPI.setGlyphResolution = macro.chain(publicAPI.setGlyphResolution, function (r) {
|
|
81
|
-
return model.pipelines.circle.glyph.setResolution(r);
|
|
82
|
-
}); // --------------------------------------------------------------------------
|
|
19
|
+
model._pipeline.actor.getProperty().setOpacity(0.2);
|
|
83
20
|
|
|
84
|
-
|
|
85
|
-
model.pipelines.circle.glyph.setLines(draw);
|
|
86
|
-
}; // --------------------------------------------------------------------------
|
|
21
|
+
model._pipeline.mapper.setResolveCoincidentTopology(true);
|
|
87
22
|
|
|
23
|
+
model._pipeline.mapper.setRelativeCoincidentTopologyPolygonOffsetParameters(-1, -1); // --------------------------------------------------------------------------
|
|
88
24
|
|
|
89
|
-
publicAPI.setDrawFace = function (draw) {
|
|
90
|
-
model.pipelines.circle.glyph.setFace(draw);
|
|
91
|
-
}; // --------------------------------------------------------------------------
|
|
92
25
|
|
|
26
|
+
publicAPI.setGlyphResolution = macro.chain(publicAPI.setGlyphResolution, model._pipeline.glyph.setResolution); // --------------------------------------------------------------------------
|
|
93
27
|
|
|
94
|
-
publicAPI.
|
|
95
|
-
model.
|
|
96
|
-
};
|
|
28
|
+
publicAPI.setDrawBorder = macro.chain(publicAPI.setDrawBorder, function (draw) {
|
|
29
|
+
return model._pipeline.glyph.setLines(draw);
|
|
30
|
+
}); // --------------------------------------------------------------------------
|
|
97
31
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
|
|
102
|
-
return superGetRepresentationStates(input).filter(function (state) {
|
|
103
|
-
var _state$getOrigin, _state$isVisible;
|
|
104
|
-
|
|
105
|
-
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));
|
|
106
|
-
});
|
|
107
|
-
}; // --------------------------------------------------------------------------
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
publicAPI.requestData = function (inData, outData) {
|
|
111
|
-
var _model$internalArrays = model.internalArrays,
|
|
112
|
-
points = _model$internalArrays.points,
|
|
113
|
-
scale = _model$internalArrays.scale,
|
|
114
|
-
color = _model$internalArrays.color,
|
|
115
|
-
direction = _model$internalArrays.direction;
|
|
116
|
-
var list = publicAPI.getRepresentationStates(inData[0]);
|
|
117
|
-
var totalCount = list.length;
|
|
118
|
-
|
|
119
|
-
if (color.getNumberOfValues() !== totalCount) {
|
|
120
|
-
// Need to resize dataset
|
|
121
|
-
points.setData(new Float32Array(3 * totalCount));
|
|
122
|
-
scale.setData(new Float32Array(3 * totalCount));
|
|
123
|
-
direction.setData(new Float32Array(9 * totalCount));
|
|
124
|
-
color.setData(new Float32Array(totalCount));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
var typedArray = {
|
|
128
|
-
points: points.getData(),
|
|
129
|
-
scale: scale.getData(),
|
|
130
|
-
color: color.getData(),
|
|
131
|
-
direction: direction.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
|
-
var right = state.getRight ? state.getRight() : [1, 0, 0];
|
|
143
|
-
var up = state.getUp ? state.getUp() : [0, 1, 0];
|
|
144
|
-
var dir = state.getDirection ? state.getDirection() : [0, 0, 1];
|
|
145
|
-
var rotation = [].concat(_toConsumableArray(right), _toConsumableArray(up), _toConsumableArray(dir));
|
|
146
|
-
var scale3 = state.getScale3 ? state.getScale3() : [1, 1, 1];
|
|
147
|
-
scale3 = scale3.map(function (x) {
|
|
148
|
-
return x === 0 ? 2 * model.defaultScale : 2 * x;
|
|
149
|
-
}); // Reorient rotation and scale3 since the circle source faces X instead of Z
|
|
150
|
-
|
|
151
|
-
var reorientCircleSource4 = vtkMatrixBuilder.buildFromDegree().rotateFromDirections([1, 0, 0], [0, 0, 1]) // from X to Z
|
|
152
|
-
.getMatrix();
|
|
153
|
-
var reorientCircleSource3 = [];
|
|
154
|
-
mat3.fromMat4(reorientCircleSource3, reorientCircleSource4);
|
|
155
|
-
vec3.transformMat4(scale3, scale3, reorientCircleSource4);
|
|
156
|
-
mat3.multiply(rotation, rotation, reorientCircleSource3);
|
|
157
|
-
|
|
158
|
-
for (var j = 0; j < 9; j += 1) {
|
|
159
|
-
typedArray.direction[i * 9 + j] = rotation[j];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
var scale1 = (state.getScale1 ? state.getScale1() : model.defaultScale) / 2;
|
|
163
|
-
typedArray.scale[i * 3 + 0] = scale1 * scaleFactor * scale3[0];
|
|
164
|
-
typedArray.scale[i * 3 + 1] = scale1 * scaleFactor * scale3[1];
|
|
165
|
-
typedArray.scale[i * 3 + 2] = scale1 * scaleFactor * scale3[2];
|
|
166
|
-
typedArray.color[i] = model.useActiveColor && isActive ? model.activeColor : state.getColor();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
model.internalPolyData.modified();
|
|
170
|
-
outData[0] = model.internalPolyData;
|
|
171
|
-
}; // --------------------------------------------------------------------------
|
|
172
|
-
// Initialization
|
|
173
|
-
// --------------------------------------------------------------------------
|
|
32
|
+
publicAPI.setDrawFace = macro.chain(publicAPI.setDrawFace, function (draw) {
|
|
33
|
+
return model._pipeline.glyph.setFace(draw);
|
|
34
|
+
}); // --------------------------------------------------------------------------
|
|
174
35
|
|
|
36
|
+
publicAPI.setOpacity = function (opacity) {
|
|
37
|
+
model._pipeline.actor.getProperty().setOpacity(opacity);
|
|
38
|
+
};
|
|
175
39
|
} // ----------------------------------------------------------------------------
|
|
176
40
|
// Object factory
|
|
177
41
|
// ----------------------------------------------------------------------------
|
|
178
42
|
|
|
179
43
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
44
|
+
function defaultValues(initialValues) {
|
|
45
|
+
var _initialValues$pipeli, _initialValues$pipeli2, _initialValues$glyphR, _initialValues$drawBo, _initialValues$drawFa;
|
|
46
|
+
|
|
47
|
+
return _objectSpread(_objectSpread({
|
|
48
|
+
behavior: Behavior.CONTEXT,
|
|
49
|
+
glyphResolution: 32,
|
|
50
|
+
drawBorder: false,
|
|
51
|
+
drawFace: true
|
|
52
|
+
}, initialValues), {}, {
|
|
53
|
+
_pipeline: _objectSpread({
|
|
54
|
+
glyph: (_initialValues$pipeli = initialValues === null || initialValues === void 0 ? void 0 : (_initialValues$pipeli2 = initialValues.pipeline) === null || _initialValues$pipeli2 === void 0 ? void 0 : _initialValues$pipeli2.glyph) !== null && _initialValues$pipeli !== void 0 ? _initialValues$pipeli : vtkCircleSource.newInstance({
|
|
55
|
+
resolution: (_initialValues$glyphR = initialValues.glyphResolution) !== null && _initialValues$glyphR !== void 0 ? _initialValues$glyphR : 32,
|
|
56
|
+
radius: 1,
|
|
57
|
+
lines: (_initialValues$drawBo = initialValues.drawBorder) !== null && _initialValues$drawBo !== void 0 ? _initialValues$drawBo : false,
|
|
58
|
+
face: (_initialValues$drawFa = initialValues.drawFace) !== null && _initialValues$drawFa !== void 0 ? _initialValues$drawFa : true,
|
|
59
|
+
direction: [0, 0, 1]
|
|
60
|
+
})
|
|
61
|
+
}, initialValues === null || initialValues === void 0 ? void 0 : initialValues.pipeline)
|
|
62
|
+
});
|
|
63
|
+
} // ----------------------------------------------------------------------------
|
|
64
|
+
|
|
186
65
|
|
|
187
66
|
function extend(publicAPI, model) {
|
|
188
67
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
macro.
|
|
192
|
-
macro.get(publicAPI, model, ['glyph', 'mapper', 'actor']); // Object specific methods
|
|
68
|
+
vtkGlyphRepresentation.extend(publicAPI, model, defaultValues(initialValues));
|
|
69
|
+
macro.setGet(publicAPI, model, ['glyphResolution', 'drawFace', 'drawBorder']);
|
|
70
|
+
macro.get(publicAPI, model._pipeline, ['glyph', 'mapper', 'actor']); // Object specific methods
|
|
193
71
|
|
|
194
72
|
vtkCircleContextRepresentation(publicAPI, model);
|
|
195
73
|
} // ----------------------------------------------------------------------------
|
|
@@ -3,6 +3,7 @@ import vtkActor from '../../Rendering/Core/Actor.js';
|
|
|
3
3
|
import vtkContextRepresentation from './ContextRepresentation.js';
|
|
4
4
|
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
5
5
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
6
|
+
import { allocateArray } from './WidgetRepresentation.js';
|
|
6
7
|
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
7
8
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
8
9
|
|
|
@@ -23,21 +24,20 @@ function vtkConvexFaceContextRepresentation(publicAPI, model) {
|
|
|
23
24
|
model.internalPolyData.getPoints().setData(model.points, 3);
|
|
24
25
|
model.internalPolyData.getPolys().setData(model.cells);
|
|
25
26
|
|
|
26
|
-
function allocateSize(size) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
function allocateSize(polyData, size) {
|
|
28
|
+
var points = allocateArray(polyData, 'points', size).getData();
|
|
29
|
+
var oldCellsSize = polyData.getPolys().getNumberOfValues();
|
|
30
|
+
var cells = allocateArray(polyData, 'polys', size + 1).getData();
|
|
31
|
+
|
|
32
|
+
if (oldCellsSize !== cells.length) {
|
|
33
|
+
cells[0] = size;
|
|
31
34
|
|
|
32
35
|
for (var i = 0; i < size; i++) {
|
|
33
|
-
|
|
36
|
+
cells[i + 1] = i;
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
model.internalPolyData.getPoints().setData(model.points, 3);
|
|
37
|
-
model.internalPolyData.getPolys().setData(model.cells);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return
|
|
40
|
+
return points;
|
|
41
41
|
} // --------------------------------------------------------------------------
|
|
42
42
|
// Generic rendering pipeline
|
|
43
43
|
// --------------------------------------------------------------------------
|
|
@@ -59,7 +59,7 @@ function vtkConvexFaceContextRepresentation(publicAPI, model) {
|
|
|
59
59
|
var validState = list.filter(function (state) {
|
|
60
60
|
return state.getOrigin();
|
|
61
61
|
});
|
|
62
|
-
var points = allocateSize(validState.length);
|
|
62
|
+
var points = allocateSize(allocateSize, validState.length);
|
|
63
63
|
|
|
64
64
|
for (var i = 0; i < validState.length; i++) {
|
|
65
65
|
var coords = validState[i].getOrigin();
|
|
@@ -4,6 +4,8 @@ import vtkActor from '../../Rendering/Core/Actor.js';
|
|
|
4
4
|
import vtkContextRepresentation from './ContextRepresentation.js';
|
|
5
5
|
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
6
6
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
7
|
+
import { origin } from './GlyphRepresentation.js';
|
|
8
|
+
import { allocateArray } from './WidgetRepresentation.js';
|
|
7
9
|
|
|
8
10
|
var vtkErrorMacro = macro.vtkErrorMacro; // prettier-ignore
|
|
9
11
|
|
|
@@ -25,9 +27,8 @@ function vtkCroppingOutlineRepresentation(publicAPI, model) {
|
|
|
25
27
|
model.internalPolyData = vtkPolyData.newInstance({
|
|
26
28
|
mtime: 0
|
|
27
29
|
});
|
|
28
|
-
model.
|
|
29
|
-
|
|
30
|
-
model.internalPolyData.getLines().setData(Uint16Array.from(OUTLINE_ARRAY)); // --------------------------------------------------------------------------
|
|
30
|
+
allocateArray(model.internalPolyData, 'lines', OUTLINE_ARRAY.length).getData().set(OUTLINE_ARRAY);
|
|
31
|
+
var applyOrigin = origin(); // --------------------------------------------------------------------------
|
|
31
32
|
// Generic rendering pipeline
|
|
32
33
|
// --------------------------------------------------------------------------
|
|
33
34
|
|
|
@@ -50,15 +51,7 @@ function vtkCroppingOutlineRepresentation(publicAPI, model) {
|
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
if (list.length === 8) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
for (var i = 0; i < list.length; i++) {
|
|
56
|
-
var pt = list[i].getOrigin();
|
|
57
|
-
model.points[pi++] = pt[0];
|
|
58
|
-
model.points[pi++] = pt[1];
|
|
59
|
-
model.points[pi++] = pt[2];
|
|
60
|
-
}
|
|
61
|
-
|
|
54
|
+
applyOrigin(model.internalPolyData, list);
|
|
62
55
|
model.internalPolyData.getPoints().modified();
|
|
63
56
|
model.internalPolyData.modified();
|
|
64
57
|
outData[0] = model.internalPolyData;
|
|
@@ -1,123 +1,34 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
|
-
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
3
3
|
import vtkCubeSource from '../../Filters/Sources/CubeSource.js';
|
|
4
|
-
import
|
|
5
|
-
import vtkGlyph3DMapper from '../../Rendering/Core/Glyph3DMapper.js';
|
|
6
|
-
import vtkHandleRepresentation from './HandleRepresentation.js';
|
|
7
|
-
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
8
|
-
import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
4
|
+
import vtkGlyphRepresentation from './GlyphRepresentation.js';
|
|
9
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; }
|
|
10
9
|
// vtkCubeHandleRepresentation methods
|
|
11
10
|
// ----------------------------------------------------------------------------
|
|
12
11
|
|
|
13
12
|
function vtkCubeHandleRepresentation(publicAPI, model) {
|
|
14
13
|
// Set our className
|
|
15
|
-
model.classHierarchy.push('vtkCubeHandleRepresentation');
|
|
16
|
-
// Internal polydata dataset
|
|
17
|
-
// --------------------------------------------------------------------------
|
|
18
|
-
|
|
19
|
-
model.internalPolyData = vtkPolyData.newInstance({
|
|
20
|
-
mtime: 0
|
|
21
|
-
});
|
|
22
|
-
model.internalArrays = {
|
|
23
|
-
points: model.internalPolyData.getPoints(),
|
|
24
|
-
scale: vtkDataArray.newInstance({
|
|
25
|
-
name: 'scale',
|
|
26
|
-
numberOfComponents: 3,
|
|
27
|
-
empty: true
|
|
28
|
-
}),
|
|
29
|
-
color: vtkDataArray.newInstance({
|
|
30
|
-
name: 'color',
|
|
31
|
-
numberOfComponents: 1,
|
|
32
|
-
empty: true
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.scale);
|
|
36
|
-
model.internalPolyData.getPointData().addArray(model.internalArrays.color); // --------------------------------------------------------------------------
|
|
37
|
-
// Generic rendering pipeline
|
|
38
|
-
// --------------------------------------------------------------------------
|
|
39
|
-
|
|
40
|
-
model.mapper = vtkGlyph3DMapper.newInstance({
|
|
41
|
-
scaleArray: 'scale',
|
|
42
|
-
colorByArrayName: 'color',
|
|
43
|
-
scalarMode: ScalarMode.USE_POINT_FIELD_DATA
|
|
44
|
-
});
|
|
45
|
-
model.actor = vtkActor.newInstance({
|
|
46
|
-
parentProp: publicAPI
|
|
47
|
-
});
|
|
48
|
-
model.glyph = vtkCubeSource.newInstance();
|
|
49
|
-
model.mapper.setInputConnection(publicAPI.getOutputPort(), 0);
|
|
50
|
-
model.mapper.setInputConnection(model.glyph.getOutputPort(), 1);
|
|
51
|
-
model.actor.setMapper(model.mapper);
|
|
52
|
-
publicAPI.addActor(model.actor);
|
|
53
|
-
var superGetRepresentationStates = publicAPI.getRepresentationStates;
|
|
54
|
-
|
|
55
|
-
publicAPI.getRepresentationStates = function () {
|
|
56
|
-
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
|
|
57
|
-
return superGetRepresentationStates(input).filter(function (state) {
|
|
58
|
-
var _state$getOrigin, _state$isVisible;
|
|
59
|
-
|
|
60
|
-
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));
|
|
61
|
-
});
|
|
62
|
-
}; // --------------------------------------------------------------------------
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
publicAPI.requestData = function (inData, outData) {
|
|
66
|
-
var _model$internalArrays = model.internalArrays,
|
|
67
|
-
points = _model$internalArrays.points,
|
|
68
|
-
scale = _model$internalArrays.scale,
|
|
69
|
-
color = _model$internalArrays.color;
|
|
70
|
-
var list = publicAPI.getRepresentationStates(inData[0]);
|
|
71
|
-
var totalCount = list.length;
|
|
72
|
-
|
|
73
|
-
if (color.getNumberOfValues() !== totalCount) {
|
|
74
|
-
// Need to resize dataset
|
|
75
|
-
points.setData(new Float32Array(3 * totalCount));
|
|
76
|
-
scale.setData(new Float32Array(3 * totalCount));
|
|
77
|
-
color.setData(new Float32Array(totalCount));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
var typedArray = {
|
|
81
|
-
points: points.getData(),
|
|
82
|
-
scale: scale.getData(),
|
|
83
|
-
color: color.getData()
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
for (var i = 0; i < totalCount; i++) {
|
|
87
|
-
var state = list[i];
|
|
88
|
-
var isActive = state.getActive();
|
|
89
|
-
var scaleFactor = isActive ? model.activeScaleFactor : 1;
|
|
90
|
-
var coord = state.getOrigin();
|
|
91
|
-
|
|
92
|
-
if (coord) {
|
|
93
|
-
typedArray.points[i * 3 + 0] = coord[0];
|
|
94
|
-
typedArray.points[i * 3 + 1] = coord[1];
|
|
95
|
-
typedArray.points[i * 3 + 2] = coord[2];
|
|
96
|
-
typedArray.scale[i] = scaleFactor * (state.getScale1 ? state.getScale1() : model.defaultScale);
|
|
97
|
-
|
|
98
|
-
if (publicAPI.getScaleInPixels()) {
|
|
99
|
-
typedArray.scale[i] *= publicAPI.getPixelWorldHeightAtCoord(coord);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
typedArray.color[i] = model.useActiveColor && isActive ? model.activeColor : state.getColor();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
model.internalPolyData.modified();
|
|
107
|
-
outData[0] = model.internalPolyData;
|
|
108
|
-
};
|
|
14
|
+
model.classHierarchy.push('vtkCubeHandleRepresentation');
|
|
109
15
|
} // ----------------------------------------------------------------------------
|
|
110
16
|
// Object factory
|
|
111
17
|
// ----------------------------------------------------------------------------
|
|
18
|
+
// ----------------------------------------------------------------------------
|
|
112
19
|
|
|
113
20
|
|
|
114
|
-
|
|
21
|
+
function defaultValues(initialValues) {
|
|
22
|
+
return _objectSpread({
|
|
23
|
+
_pipeline: {
|
|
24
|
+
glyph: vtkCubeSource.newInstance()
|
|
25
|
+
}
|
|
26
|
+
}, initialValues);
|
|
27
|
+
}
|
|
115
28
|
|
|
116
29
|
function extend(publicAPI, model) {
|
|
117
30
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
118
|
-
|
|
119
|
-
vtkHandleRepresentation.extend(publicAPI, model, initialValues);
|
|
120
|
-
macro.get(publicAPI, model, ['glyph', 'mapper', 'actor', 'defaultScale']); // Object specific methods
|
|
31
|
+
vtkGlyphRepresentation.extend(publicAPI, model, defaultValues(initialValues)); // Object specific methods
|
|
121
32
|
|
|
122
33
|
vtkCubeHandleRepresentation(publicAPI, model);
|
|
123
34
|
} // ----------------------------------------------------------------------------
|