@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.
Files changed (197) hide show
  1. package/Common/Core/CellArray.d.ts +0 -6
  2. package/Common/Core/CellArray.js +21 -12
  3. package/Common/Core/ClassHierarchy.js +11 -6
  4. package/Common/Core/DataArray.d.ts +20 -0
  5. package/Common/Core/DataArray.js +21 -4
  6. package/Proxy/Core/ViewProxy.js +17 -9
  7. package/Rendering/Core/ColorTransferFunction.d.ts +0 -20
  8. package/Rendering/Core/ColorTransferFunction.js +0 -63
  9. package/Rendering/Core/Prop3D.js +1 -6
  10. package/Rendering/Core/RenderWindow.js +9 -6
  11. package/Rendering/Core/VolumeProperty.js +2 -3
  12. package/Rendering/Misc/CanvasView.js +6 -5
  13. package/Rendering/Misc/GenericRenderWindow.js +12 -7
  14. package/Rendering/OpenGL/Actor.js +4 -4
  15. package/Rendering/OpenGL/Actor2D.js +4 -4
  16. package/Rendering/OpenGL/Camera.js +7 -4
  17. package/Rendering/OpenGL/CubeAxesActor.js +7 -5
  18. package/Rendering/OpenGL/ForwardPass.js +1 -1
  19. package/Rendering/OpenGL/Glyph3DMapper.js +4 -4
  20. package/Rendering/OpenGL/ImageMapper.js +9 -5
  21. package/Rendering/OpenGL/ImageSlice.js +3 -3
  22. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +9 -5
  23. package/Rendering/OpenGL/PolyDataMapper.js +27 -21
  24. package/Rendering/OpenGL/PolyDataMapper2D.js +17 -10
  25. package/Rendering/OpenGL/ScalarBarActor.js +6 -4
  26. package/Rendering/OpenGL/Skybox.js +10 -6
  27. package/Rendering/OpenGL/Texture.js +6 -5
  28. package/Rendering/OpenGL/Volume.js +2 -2
  29. package/Rendering/OpenGL/VolumeMapper.js +11 -11
  30. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  31. package/Rendering/SceneGraph/RenderPass.js +3 -2
  32. package/Rendering/WebGPU/ForwardPass.js +1 -1
  33. package/Rendering/WebGPU/HardwareSelectionPass.js +1 -1
  34. package/Rendering/WebGPU/HardwareSelector.js +14 -13
  35. package/Rendering/WebGPU/OpaquePass.js +1 -1
  36. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +1 -1
  37. package/Rendering/WebGPU/VolumePass.js +1 -1
  38. package/Utilities/config/rules-tests.js +28 -0
  39. package/Widgets/Core/AbstractWidgetFactory.js +1 -0
  40. package/Widgets/Core/StateBuilder/color3Mixin.js +22 -0
  41. package/Widgets/Core/StateBuilder/colorMixin.js +7 -0
  42. package/Widgets/Core/StateBuilder.js +2 -0
  43. package/Widgets/Core/WidgetManager.js +21 -256
  44. package/Widgets/Representations/ArrowHandleRepresentation.js +28 -110
  45. package/Widgets/Representations/CircleContextRepresentation.js +43 -165
  46. package/Widgets/Representations/ContextRepresentation.js +0 -3
  47. package/Widgets/Representations/ConvexFaceContextRepresentation.js +11 -11
  48. package/Widgets/Representations/CroppingOutlineRepresentation.js +5 -12
  49. package/Widgets/Representations/CubeHandleRepresentation.js +15 -104
  50. package/Widgets/Representations/GlyphRepresentation.js +320 -0
  51. package/Widgets/Representations/HandleRepresentation.js +0 -5
  52. package/Widgets/Representations/ImplicitPlaneRepresentation.js +68 -49
  53. package/Widgets/Representations/LineHandleRepresentation.js +116 -0
  54. package/Widgets/Representations/PolyLineRepresentation.js +52 -49
  55. package/Widgets/Representations/RectangleContextRepresentation.js +16 -21
  56. package/Widgets/Representations/SphereContextRepresentation.js +30 -109
  57. package/Widgets/Representations/SphereHandleRepresentation.js +13 -110
  58. package/Widgets/Representations/SplineContextRepresentation.js +53 -36
  59. package/Widgets/Representations/WidgetRepresentation.d.ts +52 -1
  60. package/Widgets/Representations/WidgetRepresentation.js +140 -78
  61. package/Widgets/Representations.js +6 -0
  62. package/Widgets/Widgets3D/AngleWidget.js +1 -4
  63. package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
  64. package/Widgets/Widgets3D/EllipseWidget.js +0 -7
  65. package/Widgets/Widgets3D/LabelWidget/behavior.js +0 -7
  66. package/Widgets/Widgets3D/LabelWidget.js +1 -18
  67. package/Widgets/Widgets3D/LineWidget/behavior.js +0 -44
  68. package/Widgets/Widgets3D/LineWidget.js +0 -11
  69. package/Widgets/Widgets3D/PolyLineWidget.js +0 -10
  70. package/Widgets/Widgets3D/RectangleWidget.js +0 -7
  71. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +15 -3
  72. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +93 -36
  73. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +75 -82
  74. package/Widgets/Widgets3D/ResliceCursorWidget/state.js +49 -170
  75. package/Widgets/Widgets3D/ResliceCursorWidget.js +61 -23
  76. package/Widgets/Widgets3D/ShapeWidget.js +1 -1
  77. package/index.d.ts +0 -1
  78. package/macros.d.ts +3 -5
  79. package/macros.js +4 -35
  80. package/package.json +3 -2
  81. package/Widgets/Core/WidgetManager/vdom.js +0 -172
  82. package/Widgets/Representations/ResliceCursorContextRepresentation/Constants.js +0 -12
  83. package/Widgets/Representations/ResliceCursorContextRepresentation.d.ts +0 -54
  84. package/Widgets/Representations/ResliceCursorContextRepresentation.js +0 -357
  85. package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +0 -28
  86. package/Widgets/SVG/SVGLandmarkRepresentation.js +0 -179
  87. package/Widgets/SVG/SVGRepresentation.js +0 -163
  88. package/_vendor/available-typed-arrays/index.js_commonjs-proxy.js +0 -1
  89. package/_vendor/call-bind/callBound.js_commonjs-proxy.js +0 -1
  90. package/_vendor/call-bind/index.js_commonjs-module.js +0 -3
  91. package/_vendor/call-bind/index.js_commonjs-proxy.js +0 -1
  92. package/_vendor/deep-equal/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
  93. package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
  94. package/_vendor/es-abstract/helpers/getOwnPropertyDescriptor.js_commonjs-proxy.js +0 -1
  95. package/_vendor/es-get-iterator/index.js_commonjs-module.js +0 -3
  96. package/_vendor/es-get-iterator/index.js_commonjs-proxy.js +0 -1
  97. package/_vendor/es-get-iterator/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
  98. package/_vendor/foreach/index.js_commonjs-proxy.js +0 -1
  99. package/_vendor/function-bind/implementation.js_commonjs-proxy.js +0 -1
  100. package/_vendor/function-bind/index.js_commonjs-proxy.js +0 -1
  101. package/_vendor/get-intrinsic/index.js_commonjs-proxy.js +0 -1
  102. package/_vendor/has/src/index.js_commonjs-proxy.js +0 -1
  103. package/_vendor/has-bigints/index.js_commonjs-proxy.js +0 -1
  104. package/_vendor/has-symbols/index.js_commonjs-proxy.js +0 -1
  105. package/_vendor/has-symbols/shams.js_commonjs-proxy.js +0 -1
  106. package/_vendor/has-tostringtag/shams.js_commonjs-proxy.js +0 -1
  107. package/_vendor/is-arguments/index.js_commonjs-proxy.js +0 -1
  108. package/_vendor/is-bigint/index.js_commonjs-module.js +0 -3
  109. package/_vendor/is-bigint/index.js_commonjs-proxy.js +0 -1
  110. package/_vendor/is-boolean-object/index.js_commonjs-proxy.js +0 -1
  111. package/_vendor/is-date-object/index.js_commonjs-proxy.js +0 -1
  112. package/_vendor/is-map/index.js_commonjs-proxy.js +0 -1
  113. package/_vendor/is-number-object/index.js_commonjs-proxy.js +0 -1
  114. package/_vendor/is-regex/index.js_commonjs-proxy.js +0 -1
  115. package/_vendor/is-set/index.js_commonjs-proxy.js +0 -1
  116. package/_vendor/is-string/index.js_commonjs-proxy.js +0 -1
  117. package/_vendor/is-symbol/index.js_commonjs-module.js +0 -3
  118. package/_vendor/is-symbol/index.js_commonjs-proxy.js +0 -1
  119. package/_vendor/is-typed-array/index.js_commonjs-proxy.js +0 -1
  120. package/_vendor/is-weakmap/index.js_commonjs-proxy.js +0 -1
  121. package/_vendor/is-weakset/index.js_commonjs-proxy.js +0 -1
  122. package/_vendor/object-inspect/index.js_commonjs-proxy.js +0 -1
  123. package/_vendor/object-is/implementation.js_commonjs-proxy.js +0 -1
  124. package/_vendor/object-is/index.js_commonjs-proxy.js +0 -1
  125. package/_vendor/object-is/polyfill.js_commonjs-proxy.js +0 -1
  126. package/_vendor/object-is/shim.js_commonjs-proxy.js +0 -1
  127. package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
  128. package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
  129. package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
  130. package/_vendor/object.assign/implementation.js_commonjs-proxy.js +0 -1
  131. package/_vendor/object.assign/index.js_commonjs-proxy.js +0 -1
  132. package/_vendor/object.assign/polyfill.js_commonjs-proxy.js +0 -1
  133. package/_vendor/object.assign/shim.js_commonjs-proxy.js +0 -2
  134. package/_vendor/regexp.prototype.flags/implementation.js_commonjs-proxy.js +0 -1
  135. package/_vendor/regexp.prototype.flags/index.js_commonjs-proxy.js +0 -1
  136. package/_vendor/regexp.prototype.flags/polyfill.js_commonjs-proxy.js +0 -1
  137. package/_vendor/regexp.prototype.flags/shim.js_commonjs-proxy.js +0 -1
  138. package/_vendor/side-channel/index.js_commonjs-proxy.js +0 -1
  139. package/_vendor/which-boxed-primitive/index.js_commonjs-proxy.js +0 -5
  140. package/_vendor/which-collection/index.js_commonjs-proxy.js +0 -4
  141. package/_vendor/which-typed-array/index.js_commonjs-proxy.js +0 -1
  142. package/_virtual/_node-resolve_empty.js_commonjs-proxy.js +0 -6
  143. package/_virtual/commonjsHelpers.js +0 -18
  144. package/_virtual/node-resolve_empty.js +0 -8
  145. package/_virtual/polyfill-node.global.js +0 -5
  146. package/_virtual/polyfill-node.process.js +0 -225
  147. package/vendor/available-typed-arrays/index.js +0 -29
  148. package/vendor/call-bind/callBound.js +0 -19
  149. package/vendor/call-bind/index.js +0 -52
  150. package/vendor/deep-equal/index.js +0 -379
  151. package/vendor/deep-equal/node_modules/isarray/index.js +0 -7
  152. package/vendor/define-properties/index.js +0 -60
  153. package/vendor/es-abstract/helpers/getOwnPropertyDescriptor.js +0 -17
  154. package/vendor/es-get-iterator/index.js +0 -217
  155. package/vendor/es-get-iterator/node_modules/isarray/index.js +0 -7
  156. package/vendor/foreach/index.js +0 -22
  157. package/vendor/function-bind/implementation.js +0 -52
  158. package/vendor/function-bind/index.js +0 -7
  159. package/vendor/get-intrinsic/index.js +0 -334
  160. package/vendor/has/src/index.js +0 -7
  161. package/vendor/has-bigints/index.js +0 -12
  162. package/vendor/has-symbols/index.js +0 -15
  163. package/vendor/has-symbols/shams.js +0 -42
  164. package/vendor/has-tostringtag/shams.js +0 -9
  165. package/vendor/is-arguments/index.js +0 -36
  166. package/vendor/is-bigint/index.js +0 -39
  167. package/vendor/is-boolean-object/index.js +0 -29
  168. package/vendor/is-date-object/index.js +0 -22
  169. package/vendor/is-map/index.js +0 -42
  170. package/vendor/is-number-object/index.js +0 -26
  171. package/vendor/is-regex/index.js +0 -61
  172. package/vendor/is-set/index.js +0 -42
  173. package/vendor/is-string/index.js +0 -26
  174. package/vendor/is-symbol/index.js +0 -36
  175. package/vendor/is-typed-array/index.js +0 -67
  176. package/vendor/is-weakmap/index.js +0 -42
  177. package/vendor/is-weakset/index.js +0 -42
  178. package/vendor/object-inspect/index.js +0 -515
  179. package/vendor/object-is/implementation.js +0 -18
  180. package/vendor/object-is/index.js +0 -25
  181. package/vendor/object-is/polyfill.js +0 -9
  182. package/vendor/object-is/shim.js +0 -17
  183. package/vendor/object-keys/implementation.js +0 -124
  184. package/vendor/object-keys/index.js +0 -35
  185. package/vendor/object-keys/isArguments.js +0 -17
  186. package/vendor/object.assign/implementation.js +0 -46
  187. package/vendor/object.assign/index.js +0 -29
  188. package/vendor/object.assign/polyfill.js +0 -57
  189. package/vendor/object.assign/shim.js +0 -17
  190. package/vendor/regexp.prototype.flags/implementation.js +0 -30
  191. package/vendor/regexp.prototype.flags/index.js +0 -25
  192. package/vendor/regexp.prototype.flags/polyfill.js +0 -23
  193. package/vendor/regexp.prototype.flags/shim.js +0 -29
  194. package/vendor/side-channel/index.js +0 -128
  195. package/vendor/which-boxed-primitive/index.js +0 -38
  196. package/vendor/which-collection/index.js +0 -29
  197. package/vendor/which-typed-array/index.js +0 -63
@@ -0,0 +1,320 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import macro from '../../macros.js';
3
+ import vtkActor from '../../Rendering/Core/Actor.js';
4
+ import vtkGlyph3DMapper from '../../Rendering/Core/Glyph3DMapper.js';
5
+ import vtkHandleRepresentation from './HandleRepresentation.js';
6
+ import vtkContextRepresentation from './ContextRepresentation.js';
7
+ import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
8
+ import vtkPolyData from '../../Common/DataModel/PolyData.js';
9
+ import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
10
+ import vtkWidgetRepresentation, { allocateArray, getPixelWorldHeightAtCoord } from './WidgetRepresentation.js';
11
+ import { Behavior } from './WidgetRepresentation/Constants.js';
12
+ import { OrientationModes } from '../../Rendering/Core/Glyph3DMapper/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
+ // vtkGlyphRepresentation methods
18
+ // ----------------------------------------------------------------------------
19
+
20
+ function origin(publicAPI, model) {
21
+ return function (polyData, states) {
22
+ var points = allocateArray(polyData, 'points', states.length).getData();
23
+ var j = 0;
24
+
25
+ for (var i = 0; i < states.length; ++i) {
26
+ var coord = states[i].getOrigin();
27
+ points[j++] = coord[0];
28
+ points[j++] = coord[1];
29
+ points[j++] = coord[2];
30
+ }
31
+ };
32
+ }
33
+ function noPosition(publicAPI, model) {
34
+ return function (polyData, states) {
35
+ allocateArray(polyData, 'points', 0);
36
+ };
37
+ }
38
+ function color3(publicAPI, model) {
39
+ return function (polyData, states) {
40
+ model._pipeline.mapper.setColorByArrayName('color');
41
+
42
+ var colors = allocateArray(polyData, 'color', states.length, 'Uint8Array', // RGB
43
+ 3).getData();
44
+ var j = 0;
45
+
46
+ for (var i = 0; i < states.length; ++i) {
47
+ var c3 = states[i].getColor3();
48
+
49
+ if (states[i].getActive() && model.useActiveColor) {
50
+ c3 = model.activeColor;
51
+ }
52
+
53
+ colors[j++] = c3[0];
54
+ colors[j++] = c3[1];
55
+ colors[j++] = c3[2];
56
+ }
57
+ };
58
+ }
59
+ function color(publicAPI, model) {
60
+ return function (polyData, states) {
61
+ model._pipeline.mapper.setColorByArrayName('color');
62
+
63
+ var colors = allocateArray(polyData, 'color', states.length).getData();
64
+
65
+ for (var i = 0; i < states.length; ++i) {
66
+ var c = states[i].getColor();
67
+
68
+ if (states[i].getActive() && model.useActiveColor) {
69
+ c = model.activeColor;
70
+ }
71
+
72
+ colors[i] = c;
73
+ }
74
+ };
75
+ }
76
+ function noColor(publicAPI, model) {
77
+ return function (polyData, states) {
78
+ model._pipeline.mapper.setColorByArrayName(null);
79
+ };
80
+ }
81
+ function scale3(publicAPI, model) {
82
+ return function (polyData, states) {
83
+ model._pipeline.mapper.setScaleArray('scale');
84
+
85
+ model._pipeline.mapper.setScaleFactor(1);
86
+
87
+ model._pipeline.mapper.setScaling(true);
88
+
89
+ model._pipeline.mapper.setScaleMode(vtkGlyph3DMapper.ScaleModes.SCALE_BY_COMPONENTS);
90
+
91
+ var scales = allocateArray(polyData, 'scale', states.length, 'Float32Array', 3).getData();
92
+ var j = 0;
93
+
94
+ for (var i = 0; i < states.length; ++i) {
95
+ var _state$getScale, _state$getScale2;
96
+
97
+ var state = states[i];
98
+ var scaleFactor = state.getActive() ? model.activeScaleFactor : 1;
99
+
100
+ if (publicAPI.getScaleInPixels()) {
101
+ scaleFactor *= getPixelWorldHeightAtCoord(state.getOrigin(), model.displayScaleParams);
102
+ }
103
+
104
+ var scale = (_state$getScale = (_state$getScale2 = state.getScale3) === null || _state$getScale2 === void 0 ? void 0 : _state$getScale2.call(state)) !== null && _state$getScale !== void 0 ? _state$getScale : model.defaultScale;
105
+ scales[j++] = scaleFactor * scale[0];
106
+ scales[j++] = scaleFactor * scale[1];
107
+ scales[j++] = scaleFactor * scale[2];
108
+ }
109
+ };
110
+ }
111
+ function scale1(publicAPI, model) {
112
+ return function (polyData, states) {
113
+ model._pipeline.mapper.setScaleArray('scale');
114
+
115
+ model._pipeline.mapper.setScaleFactor(1);
116
+
117
+ model._pipeline.mapper.setScaling(true);
118
+
119
+ var scales = allocateArray(polyData, 'scale', states.length).getData();
120
+
121
+ for (var i = 0; i < states.length; ++i) {
122
+ var _state$getScale3, _state$getScale4;
123
+
124
+ var state = states[i];
125
+ var scaleFactor = state.getActive() ? model.activeScaleFactor : 1;
126
+
127
+ if (publicAPI.getScaleInPixels()) {
128
+ scaleFactor *= getPixelWorldHeightAtCoord(state.getOrigin(), model.displayScaleParams);
129
+ }
130
+
131
+ var scale = (_state$getScale3 = (_state$getScale4 = state.getScale1) === null || _state$getScale4 === void 0 ? void 0 : _state$getScale4.call(state)) !== null && _state$getScale3 !== void 0 ? _state$getScale3 : model.defaultScale;
132
+ scales[i] = scaleFactor * scale;
133
+ }
134
+ };
135
+ }
136
+ function noScale(publicAPI, model) {
137
+ return function (polyData, states) {
138
+ model._pipeline.mapper.setScaleArray(null);
139
+
140
+ model._pipeline.mapper.setScaleFactor(model.defaultScale);
141
+
142
+ model._pipeline.mapper.setScaling(model.defaultScale !== 1);
143
+ };
144
+ }
145
+ function direction(publicAPI, model) {
146
+ return function (polyData, states) {
147
+ model._pipeline.mapper.setOrientationArray('orientation');
148
+
149
+ model._pipeline.mapper.setOrientationMode(OrientationModes.MATRIX);
150
+
151
+ var orientation = allocateArray(polyData, 'orientation', states.length, 'Float32Array', 9).getData();
152
+
153
+ for (var i = 0; i < states.length; ++i) {
154
+ var state = states[i];
155
+ var right = state.getRight ? state.getRight() : [1, 0, 0];
156
+ var up = state.getUp ? state.getUp() : [0, 1, 0];
157
+ var dir = state.getDirection ? state.getDirection() : [0, 0, 1];
158
+ orientation.set(right, 9 * i);
159
+ orientation.set(up, 9 * i + 3);
160
+ orientation.set(dir, 9 * i + 6);
161
+ }
162
+ };
163
+ }
164
+ function noOrientation(publicAPI, model) {
165
+ return function (polyData, states) {
166
+ model._pipeline.mapper.setOrientationArray(null);
167
+ };
168
+ }
169
+
170
+ function vtkGlyphRepresentation(publicAPI, model) {
171
+ // Set our className
172
+ model.classHierarchy.push('vtkGlyphRepresentation');
173
+
174
+ var superClass = _objectSpread({}, publicAPI);
175
+
176
+ var internalPolyData = vtkPolyData.newInstance({
177
+ mtime: 0
178
+ });
179
+
180
+ function hasMixin(states) {
181
+ for (var _len = arguments.length, requiredMixins = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
182
+ requiredMixins[_key - 1] = arguments[_key];
183
+ }
184
+
185
+ return requiredMixins.every(function (requiredMixin) {
186
+ var _states$, _states$$;
187
+
188
+ return ((_states$ = states[0]) === null || _states$ === void 0 ? void 0 : (_states$$ = _states$["get".concat(macro.capitalize(requiredMixin))]) === null || _states$$ === void 0 ? void 0 : _states$$.call(_states$)) != null;
189
+ });
190
+ } // --------------------------------------------------------------------------
191
+ // Generic rendering pipeline
192
+ // --------------------------------------------------------------------------
193
+ // --------------------------------------------------------------------------
194
+
195
+
196
+ publicAPI.getRepresentationStates = function () {
197
+ var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : model.inputData[0];
198
+ return superClass.getRepresentationStates(input).filter(function (state) {
199
+ var _state$getOrigin, _state$isVisible;
200
+
201
+ 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));
202
+ });
203
+ }; // --------------------------------------------------------------------------
204
+
205
+
206
+ publicAPI.getMixins = function (states) {
207
+ var glyphProperties = {};
208
+
209
+ if (hasMixin(states, 'origin')) {
210
+ glyphProperties.position = model.applyMixin.origin;
211
+ } else {
212
+ glyphProperties.position = model.applyMixin.noPosition;
213
+ }
214
+
215
+ if (hasMixin(states, 'color3')) {
216
+ glyphProperties.color = model.applyMixin.color3;
217
+ } else if (hasMixin(states, 'color')) {
218
+ glyphProperties.color = model.applyMixin.color;
219
+ } else {
220
+ glyphProperties.color = model.applyMixin.noColor;
221
+ }
222
+
223
+ if (hasMixin(states, 'scale3')) {
224
+ glyphProperties.scale = model.applyMixin.scale3;
225
+ } else if (hasMixin(states, 'scale1')) {
226
+ glyphProperties.scale = model.applyMixin.scale1;
227
+ } else {
228
+ glyphProperties.scale = model.applyMixin.noScale;
229
+ }
230
+
231
+ if (hasMixin(states, 'direction')) {
232
+ glyphProperties.orientation = model.applyMixin.direction;
233
+ } else {
234
+ glyphProperties.orientation = model.applyMixin.noOrientation;
235
+ }
236
+
237
+ return glyphProperties;
238
+ };
239
+
240
+ publicAPI.requestData = function (inData, outData) {
241
+ var states = publicAPI.getRepresentationStates(inData[0]);
242
+ outData[0] = internalPolyData;
243
+ var glyphProperties = publicAPI.getMixins(states);
244
+ Object.values(glyphProperties).forEach(function (property) {
245
+ return property(internalPolyData, states);
246
+ });
247
+ internalPolyData.getPoints().modified();
248
+ internalPolyData.modified();
249
+ };
250
+
251
+ vtkWidgetRepresentation.connectPipeline(model._pipeline);
252
+ publicAPI.addActor(model._pipeline.actor);
253
+ } // ----------------------------------------------------------------------------
254
+ // Object factory
255
+ // ----------------------------------------------------------------------------
256
+
257
+
258
+ function defaultValues(publicAPI, model, initialValues) {
259
+ var _initialValues$pipeli, _initialValues$pipeli2, _initialValues$pipeli3, _initialValues$pipeli4, _initialValues$pipeli5, _initialValues$pipeli6, _initialValues$pipeli7, _initialValues$pipeli8, _initialValues$applyM, _initialValues$applyM2, _initialValues$applyM3, _initialValues$applyM4, _initialValues$applyM5, _initialValues$applyM6, _initialValues$applyM7, _initialValues$applyM8, _initialValues$applyM9, _initialValues$applyM10, _initialValues$applyM11, _initialValues$applyM12, _initialValues$applyM13, _initialValues$applyM14, _initialValues$applyM15, _initialValues$applyM16, _initialValues$applyM17, _initialValues$applyM18, _initialValues$applyM19, _initialValues$applyM20;
260
+
261
+ return _objectSpread(_objectSpread({
262
+ defaultScale: 1
263
+ }, initialValues), {}, {
264
+ _pipeline: _objectSpread({
265
+ source: (_initialValues$pipeli = (_initialValues$pipeli2 = initialValues.pipeline) === null || _initialValues$pipeli2 === void 0 ? void 0 : _initialValues$pipeli2.source) !== null && _initialValues$pipeli !== void 0 ? _initialValues$pipeli : publicAPI,
266
+ glyph: (_initialValues$pipeli3 = (_initialValues$pipeli4 = initialValues.pipeline) === null || _initialValues$pipeli4 === void 0 ? void 0 : _initialValues$pipeli4.glyph) !== null && _initialValues$pipeli3 !== void 0 ? _initialValues$pipeli3 : // in case glyph was provided
267
+ vtkSphereSource.newInstance({
268
+ phiResolution: 8,
269
+ thetaResolution: 8
270
+ }),
271
+ mapper: (_initialValues$pipeli5 = (_initialValues$pipeli6 = initialValues.pipeline) === null || _initialValues$pipeli6 === void 0 ? void 0 : _initialValues$pipeli6.mapper) !== null && _initialValues$pipeli5 !== void 0 ? _initialValues$pipeli5 : // in case mapper was provided
272
+ vtkGlyph3DMapper.newInstance({
273
+ scalarMode: ScalarMode.USE_POINT_FIELD_DATA
274
+ }),
275
+ actor: (_initialValues$pipeli7 = (_initialValues$pipeli8 = initialValues.pipeline) === null || _initialValues$pipeli8 === void 0 ? void 0 : _initialValues$pipeli8.actor) !== null && _initialValues$pipeli7 !== void 0 ? _initialValues$pipeli7 : // in case actor was provided
276
+ vtkActor.newInstance({
277
+ parentProp: publicAPI
278
+ })
279
+ }, initialValues.pipeline),
280
+ applyMixin: _objectSpread({
281
+ origin: (_initialValues$applyM = (_initialValues$applyM2 = initialValues.applyMixin) === null || _initialValues$applyM2 === void 0 ? void 0 : _initialValues$applyM2.origin) !== null && _initialValues$applyM !== void 0 ? _initialValues$applyM : origin(),
282
+ noPosition: (_initialValues$applyM3 = (_initialValues$applyM4 = initialValues.applyMixin) === null || _initialValues$applyM4 === void 0 ? void 0 : _initialValues$applyM4.noPosition) !== null && _initialValues$applyM3 !== void 0 ? _initialValues$applyM3 : noPosition(),
283
+ color3: (_initialValues$applyM5 = (_initialValues$applyM6 = initialValues.applyMixin) === null || _initialValues$applyM6 === void 0 ? void 0 : _initialValues$applyM6.color3) !== null && _initialValues$applyM5 !== void 0 ? _initialValues$applyM5 : color3(publicAPI, model),
284
+ color: (_initialValues$applyM7 = (_initialValues$applyM8 = initialValues.applyMixin) === null || _initialValues$applyM8 === void 0 ? void 0 : _initialValues$applyM8.color) !== null && _initialValues$applyM7 !== void 0 ? _initialValues$applyM7 : color(publicAPI, model),
285
+ noColor: (_initialValues$applyM9 = (_initialValues$applyM10 = initialValues.applyMixin) === null || _initialValues$applyM10 === void 0 ? void 0 : _initialValues$applyM10.noColor) !== null && _initialValues$applyM9 !== void 0 ? _initialValues$applyM9 : noColor(publicAPI, model),
286
+ scale3: (_initialValues$applyM11 = (_initialValues$applyM12 = initialValues.applyMixin) === null || _initialValues$applyM12 === void 0 ? void 0 : _initialValues$applyM12.scale3) !== null && _initialValues$applyM11 !== void 0 ? _initialValues$applyM11 : scale3(publicAPI, model),
287
+ scale1: (_initialValues$applyM13 = (_initialValues$applyM14 = initialValues.applyMixin) === null || _initialValues$applyM14 === void 0 ? void 0 : _initialValues$applyM14.scale1) !== null && _initialValues$applyM13 !== void 0 ? _initialValues$applyM13 : scale1(publicAPI, model),
288
+ noScale: (_initialValues$applyM15 = (_initialValues$applyM16 = initialValues.applyMixin) === null || _initialValues$applyM16 === void 0 ? void 0 : _initialValues$applyM16.noScale) !== null && _initialValues$applyM15 !== void 0 ? _initialValues$applyM15 : noScale(publicAPI, model),
289
+ direction: (_initialValues$applyM17 = (_initialValues$applyM18 = initialValues.applyMixin) === null || _initialValues$applyM18 === void 0 ? void 0 : _initialValues$applyM18.direction) !== null && _initialValues$applyM17 !== void 0 ? _initialValues$applyM17 : direction(publicAPI, model),
290
+ noOrientation: (_initialValues$applyM19 = (_initialValues$applyM20 = initialValues.applyMixin) === null || _initialValues$applyM20 === void 0 ? void 0 : _initialValues$applyM20.noOrientation) !== null && _initialValues$applyM19 !== void 0 ? _initialValues$applyM19 : noOrientation(publicAPI, model)
291
+ }, initialValues.applyMixin)
292
+ });
293
+ } // ----------------------------------------------------------------------------
294
+
295
+
296
+ function extend(publicAPI, model) {
297
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
298
+
299
+ if (initialValues.behavior === Behavior.CONTEXT) {
300
+ vtkContextRepresentation.extend(publicAPI, model, defaultValues(publicAPI, model, initialValues));
301
+ } else {
302
+ vtkHandleRepresentation.extend(publicAPI, model, defaultValues(publicAPI, model, initialValues));
303
+ }
304
+
305
+ macro.setGet(publicAPI, model._pipeline, ['defaultScale']);
306
+ macro.get(publicAPI, model._pipeline, ['glyph', 'mapper', 'actor']); // Expose the mixin functions to allow overwriting
307
+
308
+ macro.setGet(publicAPI, model.applyMixin, Object.keys(model.applyMixin)); // Object specific methods
309
+
310
+ vtkGlyphRepresentation(publicAPI, model);
311
+ } // ----------------------------------------------------------------------------
312
+
313
+ var newInstance = macro.newInstance(extend, 'vtkGlyphRepresentation'); // ----------------------------------------------------------------------------
314
+
315
+ var vtkGlyphRepresentation$1 = {
316
+ newInstance: newInstance,
317
+ extend: extend
318
+ };
319
+
320
+ export { color, color3, vtkGlyphRepresentation$1 as default, direction, extend, newInstance, noColor, noOrientation, noPosition, noScale, origin, scale1, scale3 };
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import macro from '../../macros.js';
3
2
  import vtkWidgetRepresentation from './WidgetRepresentation.js';
4
3
  import { Behavior } from './WidgetRepresentation/Constants.js';
5
4
 
@@ -18,9 +17,6 @@ function vtkHandleRepresentation(publicAPI, model) {
18
17
 
19
18
 
20
19
  var DEFAULT_VALUES = {
21
- activeScaleFactor: 1.2,
22
- activeColor: 1,
23
- useActiveColor: true,
24
20
  behavior: Behavior.HANDLE,
25
21
  pickable: true,
26
22
  dragable: true,
@@ -33,7 +29,6 @@ function extend(publicAPI, model) {
33
29
  var newDefault = _objectSpread(_objectSpread({}, DEFAULT_VALUES), initialValues);
34
30
 
35
31
  vtkWidgetRepresentation.extend(publicAPI, model, newDefault);
36
- macro.setGet(publicAPI, model, ['activeScaleFactor', 'activeColor', 'useActiveColor']);
37
32
  vtkHandleRepresentation(publicAPI, model);
38
33
  } // ----------------------------------------------------------------------------
39
34
 
@@ -11,7 +11,7 @@ import vtkPlane from '../../Common/DataModel/Plane.js';
11
11
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
12
12
  import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
13
13
  import vtkStateBuilder from '../Core/StateBuilder.js';
14
- import vtkWidgetRepresentation from './WidgetRepresentation.js';
14
+ import vtkWidgetRepresentation, { getPixelWorldHeightAtCoord } from './WidgetRepresentation.js';
15
15
  import WidgetManagerConst from '../Core/WidgetManager/Constants.js';
16
16
  import PropertyConst from '../../Rendering/Core/Property/Constants.js';
17
17
 
@@ -92,8 +92,8 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
92
92
 
93
93
  model.plane = vtkPlane.newInstance();
94
94
  model.matrix = vtkMatrixBuilder.buildFromDegree();
95
- model.pipelines = {};
96
- model.pipelines.outline = {
95
+ model._pipelines = {};
96
+ model._pipelines.outline = {
97
97
  source: vtkCubeSource.newInstance(),
98
98
  mapper: vtkMapper.newInstance(),
99
99
  actor: vtkActor.newInstance({
@@ -101,15 +101,18 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
101
101
  _parentProp: publicAPI
102
102
  })
103
103
  };
104
- model.pipelines.plane = {
105
- source: vtkClosedPolyLineToSurfaceFilter.newInstance(),
104
+ model._pipelines.plane = {
105
+ source: vtkCutter.newInstance({
106
+ cutFunction: model.plane
107
+ }),
108
+ filter: vtkClosedPolyLineToSurfaceFilter.newInstance(),
106
109
  mapper: vtkMapper.newInstance(),
107
110
  actor: vtkActor.newInstance({
108
111
  pickable: true,
109
112
  _parentProp: publicAPI
110
113
  })
111
114
  };
112
- model.pipelines.origin = {
115
+ model._pipelines.origin = {
113
116
  source: vtkSphereSource.newInstance(),
114
117
  mapper: vtkMapper.newInstance(),
115
118
  actor: vtkActor.newInstance({
@@ -117,7 +120,7 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
117
120
  _parentProp: publicAPI
118
121
  })
119
122
  };
120
- model.pipelines.normal = {
123
+ model._pipelines.normal = {
121
124
  source: vtkCylinderSource.newInstance(),
122
125
  mapper: vtkMapper.newInstance(),
123
126
  actor: vtkActor.newInstance({
@@ -125,7 +128,7 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
125
128
  _parentProp: publicAPI
126
129
  })
127
130
  };
128
- model.pipelines.display2D = {
131
+ model._pipelines.display2D = {
129
132
  source: publicAPI,
130
133
  mapper: vtkPixelSpaceCallbackMapper.newInstance(),
131
134
  actor: vtkActor.newInstance({
@@ -134,21 +137,18 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
134
137
  })
135
138
  }; // Plane generation pipeline
136
139
 
137
- var cutter = vtkCutter.newInstance({
138
- cutFunction: model.plane
139
- });
140
- cutter.setInputConnection(model.pipelines.outline.source.getOutputPort());
141
- model.pipelines.plane.source.setInputConnection(cutter.getOutputPort());
142
- vtkWidgetRepresentation.connectPipeline(model.pipelines.outline);
143
- vtkWidgetRepresentation.connectPipeline(model.pipelines.plane);
144
- vtkWidgetRepresentation.connectPipeline(model.pipelines.origin);
145
- vtkWidgetRepresentation.connectPipeline(model.pipelines.normal);
146
- vtkWidgetRepresentation.connectPipeline(model.pipelines.display2D);
147
- publicAPI.addActor(model.pipelines.outline.actor);
148
- publicAPI.addActor(model.pipelines.plane.actor);
149
- publicAPI.addActor(model.pipelines.origin.actor);
150
- publicAPI.addActor(model.pipelines.normal.actor);
151
- publicAPI.addActor(model.pipelines.display2D.actor); // --------------------------------------------------------------------------
140
+ model._pipelines.plane.source.setInputConnection(model._pipelines.outline.source.getOutputPort());
141
+
142
+ vtkWidgetRepresentation.connectPipeline(model._pipelines.outline);
143
+ vtkWidgetRepresentation.connectPipeline(model._pipelines.plane);
144
+ vtkWidgetRepresentation.connectPipeline(model._pipelines.origin);
145
+ vtkWidgetRepresentation.connectPipeline(model._pipelines.normal);
146
+ vtkWidgetRepresentation.connectPipeline(model._pipelines.display2D);
147
+ publicAPI.addActor(model._pipelines.outline.actor);
148
+ publicAPI.addActor(model._pipelines.plane.actor);
149
+ publicAPI.addActor(model._pipelines.origin.actor);
150
+ publicAPI.addActor(model._pipelines.normal.actor);
151
+ publicAPI.addActor(model._pipelines.display2D.actor); // --------------------------------------------------------------------------
152
152
 
153
153
  publicAPI.requestData = function (inData, outData) {
154
154
  var state = inData[0];
@@ -165,46 +165,58 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
165
165
  // Update cube parameters
166
166
  // --------------------------------
167
167
 
168
- model.pipelines.outline.source.setCenter((bounds[0] + bounds[1]) * 0.5, (bounds[2] + bounds[3]) * 0.5, (bounds[4] + bounds[5]) * 0.5);
168
+ model._pipelines.outline.source.setCenter((bounds[0] + bounds[1]) * 0.5, (bounds[2] + bounds[3]) * 0.5, (bounds[4] + bounds[5]) * 0.5);
169
+
169
170
  var xRange = bounds[1] - bounds[0];
170
171
  var yRange = bounds[3] - bounds[2];
171
172
  var zRange = bounds[5] - bounds[4];
172
- model.pipelines.outline.source.setXLength(xRange);
173
- model.pipelines.outline.source.setYLength(yRange);
174
- model.pipelines.outline.source.setZLength(zRange); // --------------------------------
173
+
174
+ model._pipelines.outline.source.setXLength(xRange);
175
+
176
+ model._pipelines.outline.source.setYLength(yRange);
177
+
178
+ model._pipelines.outline.source.setZLength(zRange); // --------------------------------
175
179
  // Update normal parameters
176
180
  // --------------------------------
177
181
 
182
+
178
183
  var pixelScale = 1;
179
184
 
180
185
  if (model.scaleInPixels) {
181
- pixelScale = publicAPI.getPixelWorldHeightAtCoord(origin);
186
+ pixelScale = getPixelWorldHeightAtCoord(origin, model.displayScaleParams);
182
187
  }
183
188
 
184
- model.pipelines.normal.source.set({
189
+ model._pipelines.normal.source.set({
185
190
  height: Math.max(xRange, yRange, zRange),
186
191
  radius: model.handleSizeRatio * Math.min(xRange, yRange, zRange) * model.axisScale * pixelScale,
187
192
  resolution: model.sphereResolution
188
193
  });
189
- var yAxis = model.pipelines.normal.source.getOutputData();
194
+
195
+ var yAxis = model._pipelines.normal.source.getOutputData();
196
+
190
197
  var newAxis = vtkPolyData.newInstance();
191
198
  newAxis.shallowCopy(yAxis);
192
199
  newAxis.getPoints().setData(Float32Array.from(yAxis.getPoints().getData()), 3);
193
200
  newAxis.getPointData().removeAllArrays();
194
201
  model.matrix.identity().translate(origin[0], origin[1], origin[2]).rotateFromDirections([0, 1, 0], normal).apply(newAxis.getPoints().getData());
195
- model.pipelines.normal.mapper.setInputData(newAxis); // --------------------------------
202
+
203
+ model._pipelines.normal.mapper.setInputData(newAxis); // --------------------------------
196
204
  // Update origin parameters
197
205
  // --------------------------------
198
206
 
199
- model.pipelines.origin.actor.setPosition(origin);
207
+
208
+ model._pipelines.origin.actor.setPosition(origin);
209
+
200
210
  var handleScale = model.handleSizeRatio * Math.min(xRange, yRange, zRange) * pixelScale;
201
- model.pipelines.origin.actor.setScale(handleScale, handleScale, handleScale); // --------------------------------
211
+
212
+ model._pipelines.origin.actor.setScale(handleScale, handleScale, handleScale); // --------------------------------
202
213
  // Update style since state changed
203
214
  // --------------------------------
204
215
 
205
- vtkWidgetRepresentation.applyStyles(model.pipelines, model.representationStyle, state.getActive() && state.getActiveHandle());
216
+
217
+ vtkWidgetRepresentation.applyStyles(model._pipelines, model.representationStyle, state.getActive() && state.getActiveHandle());
206
218
  var output = vtkPolyData.newInstance();
207
- output.shallowCopy(model.pipelines.plane.source.getOutputData());
219
+ output.shallowCopy(model._pipelines.plane.filter.getOutputData());
208
220
  outData[0] = output;
209
221
  }; // --------------------------------------------------------------------------
210
222
  // Set/Get Forwarding
@@ -213,13 +225,13 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
213
225
 
214
226
  publicAPI.setSphereResolution = function (res) {
215
227
  model.sphereResolution = res;
216
- return model.pipelines.origin.source.setPhiResolution(res) && model.pipelines.origin.source.setThetaResolution(res);
228
+ return model._pipelines.origin.source.setPhiResolution(res) && model._pipelines.origin.source.setThetaResolution(res);
217
229
  };
218
230
 
219
231
  publicAPI.setRepresentationStyle = function (style) {
220
232
  model.representationStyle = vtkWidgetRepresentation.mergeStyles(STYLE_PIPELINE_NAMES, model.representationStyle, style); // Apply static and inactive
221
233
 
222
- vtkWidgetRepresentation.applyStyles(model.pipelines, model.representationStyle); // Force requestData to execute
234
+ vtkWidgetRepresentation.applyStyles(model._pipelines, model.representationStyle); // Force requestData to execute
223
235
 
224
236
  publicAPI.modified();
225
237
  }; // --------------------------------------------------------------------------
@@ -234,21 +246,28 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
234
246
  outlineVisible = model.outlineVisible;
235
247
 
236
248
  if (renderingType === RenderingTypes.PICKING_BUFFER) {
237
- model.pipelines.plane.actor.setVisibility(planeVisible);
238
- model.pipelines.origin.actor.setVisibility(originVisible);
239
- model.pipelines.normal.actor.setVisibility(normalVisible); //
249
+ model._pipelines.plane.actor.setVisibility(planeVisible);
250
+
251
+ model._pipelines.origin.actor.setVisibility(originVisible);
252
+
253
+ model._pipelines.normal.actor.setVisibility(normalVisible); //
240
254
 
241
- model.pipelines.plane.actor.getProperty().setOpacity(1);
255
+
256
+ model._pipelines.plane.actor.getProperty().setOpacity(1);
242
257
  } else {
243
- model.pipelines.outline.actor.setVisibility(outlineVisible && ctxVisible);
244
- model.pipelines.plane.actor.setVisibility(planeVisible && hVisible);
245
- model.pipelines.origin.actor.setVisibility(originVisible && hVisible);
246
- model.pipelines.normal.actor.setVisibility(normalVisible && hVisible); //
258
+ model._pipelines.outline.actor.setVisibility(outlineVisible && ctxVisible);
259
+
260
+ model._pipelines.plane.actor.setVisibility(planeVisible && hVisible);
261
+
262
+ model._pipelines.origin.actor.setVisibility(originVisible && hVisible);
263
+
264
+ model._pipelines.normal.actor.setVisibility(normalVisible && hVisible); //
265
+
247
266
 
248
267
  var state = model.inputData[0];
249
268
 
250
269
  if (state) {
251
- vtkWidgetRepresentation.applyStyles(model.pipelines, model.representationStyle, state.getActive() && state.getActiveHandle());
270
+ vtkWidgetRepresentation.applyStyles(model._pipelines, model.representationStyle, state.getActive() && state.getActiveHandle());
252
271
  }
253
272
  }
254
273
  }; // --------------------------------------------------------------------------
@@ -262,15 +281,15 @@ function vtkImplicitPlaneRepresentation(publicAPI, model) {
262
281
  state.setActiveHandle(prop);
263
282
 
264
283
  switch (prop) {
265
- case model.pipelines.plane.actor:
284
+ case model._pipelines.plane.actor:
266
285
  state.setUpdateMethodName('updateFromPlane');
267
286
  break;
268
287
 
269
- case model.pipelines.origin.actor:
288
+ case model._pipelines.origin.actor:
270
289
  state.setUpdateMethodName('updateFromOrigin');
271
290
  break;
272
291
 
273
- case model.pipelines.normal.actor:
292
+ case model._pipelines.normal.actor:
274
293
  state.setUpdateMethodName('updateFromNormal');
275
294
  break;
276
295