@kitware/vtk.js 24.3.0 → 24.4.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.
@@ -28,6 +28,56 @@ export interface IHttpDataSetReaderArray {
28
28
  enable: boolean;
29
29
  }
30
30
 
31
+ export interface IRange {
32
+ max: number,
33
+ component: unknown,
34
+ min: number
35
+ }
36
+
37
+ export interface IPointDataArray {
38
+ data: {
39
+ numberOfComponents: number,
40
+ name: string,
41
+ vtkClass: string,
42
+ dataType: string,
43
+ ranges: Array<IRange>,
44
+ ref: {
45
+ registration: string,
46
+ encode: string,
47
+ basepath: string,
48
+ id: string
49
+ },
50
+ size: number
51
+ }
52
+ }
53
+
54
+ export interface IDatasetManifest {
55
+ origin: [number, number, number],
56
+ cellData: {
57
+ arrays: Array<unknown>,
58
+ vtkClass: string
59
+ },
60
+ FieldData: {
61
+ arrays: Array<unknown>,
62
+ vtkClass: string,
63
+ },
64
+ vtkClass: string,
65
+ pointData: {
66
+ arrays: Array<IPointDataArray>,
67
+ vtkClass: string
68
+ },
69
+ spacing: [number, number, number],
70
+ extent: [number, number, number, number, number, number],
71
+ direction: [number, number, number, number, number, number, number, number, number],
72
+ metadata?: Record<string, unknown>
73
+ }
74
+
75
+ export interface IParseObjectOptions {
76
+ loadData: boolean,
77
+ baseUrl: string,
78
+ deepCopy: boolean
79
+ }
80
+
31
81
  type vtkHttpDataSetReaderBase = vtkObject & Omit<vtkAlgorithm,
32
82
  | 'getInputData'
33
83
  | 'setInputData'
@@ -166,6 +216,14 @@ export interface vtkHttpDataSetReader extends vtkHttpDataSetReaderBase {
166
216
  */
167
217
  setUrl(url: string, option?: IHttpDataSetReaderOptions): Promise<any>;
168
218
 
219
+ /**
220
+ * Set the dataset object to use for data fetching.
221
+ *
222
+ * @param {IDatasetManifest} manifest The dataset manifest object
223
+ * @param {IParseObjectOptions} options
224
+ */
225
+ parseObject(manifest: IDatasetManifest, options: IParseObjectOptions): Promise<void>;
226
+
169
227
  /**
170
228
  *
171
229
  */
@@ -159,7 +159,10 @@ function vtkHttpDataSetReader(publicAPI, model) {
159
159
  callback: function callback(zip) {
160
160
  model.baseURL = '';
161
161
  model.dataAccessHelper.fetchJSON(publicAPI, 'index.json').then(function (dataset) {
162
- processDataSet(publicAPI, model, dataset, fetchArray, resolve, reject, loadData);
162
+ publicAPI.parseObject(dataset, {
163
+ loadData: loadData,
164
+ deepCopy: false
165
+ }).then(resolve, reject);
163
166
  }, function (error) {
164
167
  reject(error);
165
168
  });
@@ -173,7 +176,10 @@ function vtkHttpDataSetReader(publicAPI, model) {
173
176
 
174
177
  return new Promise(function (resolve, reject) {
175
178
  model.dataAccessHelper.fetchJSON(publicAPI, model.url).then(function (dataset) {
176
- processDataSet(publicAPI, model, dataset, fetchArray, resolve, reject, loadData);
179
+ publicAPI.parseObject(dataset, {
180
+ loadData: loadData,
181
+ deepCopy: false
182
+ }).then(resolve, reject);
177
183
  }, function (error) {
178
184
  reject(error);
179
185
  });
@@ -198,6 +204,22 @@ function vtkHttpDataSetReader(publicAPI, model) {
198
204
  model.compression = options.compression; // Fetch metadata
199
205
 
200
206
  return publicAPI.updateMetadata(!!options.loadData);
207
+ };
208
+
209
+ publicAPI.parseObject = function (manifest, _ref) {
210
+ var loadData = _ref.loadData,
211
+ baseUrl = _ref.baseUrl,
212
+ _ref$deepCopy = _ref.deepCopy,
213
+ deepCopy = _ref$deepCopy === void 0 ? true : _ref$deepCopy;
214
+
215
+ if (baseUrl) {
216
+ model.baseURL = baseUrl;
217
+ }
218
+
219
+ var dataset = deepCopy ? structuredClone(manifest) : manifest;
220
+ return new Promise(function (resolve, reject) {
221
+ processDataSet(publicAPI, model, dataset, fetchArray, resolve, reject, loadData);
222
+ });
201
223
  }; // Fetch the actual data arrays
202
224
 
203
225
 
@@ -223,6 +223,30 @@ export interface vtkScalarBarActor extends vtkActor {
223
223
  */
224
224
  setBoxSizeFrom(boxSize: Size): boolean;
225
225
 
226
+ /**
227
+ *
228
+ * @param {Vector2} barPosition
229
+ */
230
+ setBarPosition(barPosition: Vector2): boolean;
231
+
232
+ /**
233
+ *
234
+ * @param {Vector2} barPosition
235
+ */
236
+ setBarPositionFrom(barPosition: Vector2): boolean;
237
+
238
+ /**
239
+ *
240
+ * @param {Size} barSize
241
+ */
242
+ setBarSize(barSize: Size): boolean;
243
+
244
+ /**
245
+ *
246
+ * @param {Size} barSize
247
+ */
248
+ setBarSizeFrom(barSize: Size): boolean;
249
+
226
250
  /**
227
251
  *
228
252
  * @param {vtkScalarsToColors} scalarsToColors
@@ -787,8 +787,8 @@ function extend(publicAPI, model) {
787
787
  publicAPI.getProperty().setAmbient(1.0);
788
788
  macro.setGet(publicAPI, model, ['automated', 'autoLayout', 'axisTitlePixelOffset', 'axisLabel', 'scalarsToColors', 'tickLabelPixelOffset', 'drawNanAnnotation', 'drawBelowRangeSwatch', 'drawAboveRangeSwatch']);
789
789
  macro.get(publicAPI, model, ['axisTextStyle', 'tickTextStyle']);
790
- macro.getArray(publicAPI, model, ['boxPosition', 'boxSize']);
791
- macro.setArray(publicAPI, model, ['boxPosition', 'boxSize'], 2); // Object methods
790
+ macro.getArray(publicAPI, model, ['barPosition', 'barSize', 'boxPosition', 'boxSize']);
791
+ macro.setArray(publicAPI, model, ['barPosition', 'barSize', 'boxPosition', 'boxSize'], 2); // Object methods
792
792
 
793
793
  vtkScalarBarActor(publicAPI, model);
794
794
  } // ----------------------------------------------------------------------------
@@ -117,7 +117,7 @@ function vtkOpenGLOrderIndependentTranslucentPass(publicAPI, model) {
117
117
 
118
118
  model._supported = false;
119
119
 
120
- if (!gl || !viewNode.getWebgl2() || !gl.getExtension('EXT_color_buffer_half_float') && !gl.getExtension('EXT_color_buffer_float')) {
120
+ if (renNode.getSelector() || !gl || !viewNode.getWebgl2() || !gl.getExtension('EXT_color_buffer_half_float') && !gl.getExtension('EXT_color_buffer_float')) {
121
121
  publicAPI.setCurrentOperation('translucentPass');
122
122
  renNode.traverse(publicAPI);
123
123
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.3.0",
3
+ "version": "24.4.1",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",