@kitware/vtk.js 33.0.0-beta.2 → 33.0.0-beta.3

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 (61) hide show
  1. package/Common/Core/DataArray.d.ts +4 -0
  2. package/Common/Core/DataArray.js +3 -0
  3. package/Common/Core/Math/index.js +1 -1
  4. package/Common/Core/Math.js +1 -1
  5. package/Common/Core/URLExtract.js +2 -6
  6. package/Common/DataModel/Line.js +1 -0
  7. package/Common/DataModel/PolyLine.js +4 -0
  8. package/Filters/Core/ThresholdPoints.d.ts +72 -0
  9. package/Filters/Core/ThresholdPoints.js +219 -0
  10. package/Filters/General/ContourTriangulator/helper.js +1 -1
  11. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +1 -1
  12. package/IO/Geometry/DracoReader.d.ts +4 -4
  13. package/IO/Geometry/DracoReader.js +154 -105
  14. package/IO/Geometry/GLTFImporter/Animations.js +239 -0
  15. package/IO/Geometry/GLTFImporter/Constants.js +87 -0
  16. package/IO/Geometry/GLTFImporter/Decoder.js +69 -0
  17. package/IO/Geometry/GLTFImporter/Extensions.js +110 -0
  18. package/IO/Geometry/GLTFImporter/ORMTexture.worker.js +42 -0
  19. package/IO/Geometry/GLTFImporter/Parser.js +359 -0
  20. package/IO/Geometry/GLTFImporter/Reader.js +518 -0
  21. package/IO/Geometry/GLTFImporter/Utils.js +165 -0
  22. package/IO/Geometry/GLTFImporter.d.ts +266 -0
  23. package/IO/Geometry/GLTFImporter.js +245 -0
  24. package/IO/Geometry/IFCImporter.d.ts +163 -0
  25. package/IO/Geometry/IFCImporter.js +270 -0
  26. package/IO/Geometry/STLReader.d.ts +14 -0
  27. package/IO/Geometry/STLReader.js +57 -1
  28. package/IO/Geometry.js +5 -1
  29. package/IO/Image/HDRReader/Utils.js +1 -1
  30. package/IO/Image/HDRReader.js +1 -1
  31. package/IO/Image/TGAReader/Constants.js +28 -0
  32. package/IO/Image/TGAReader.d.ts +121 -0
  33. package/IO/Image/TGAReader.js +418 -0
  34. package/IO/Image/TIFFReader.d.ts +133 -0
  35. package/IO/Image/TIFFReader.js +144 -0
  36. package/IO/Image.js +5 -1
  37. package/IO/XML/XMLPolyDataWriter.js +1 -0
  38. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
  39. package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -1
  40. package/Rendering/Core/Glyph3DMapper.d.ts +45 -29
  41. package/Rendering/Core/ImageCPRMapper.js +1 -1
  42. package/Rendering/Core/ImageProperty.d.ts +22 -0
  43. package/Rendering/Core/PointPicker.js +10 -1
  44. package/Rendering/Core/Prop3D.js +1 -1
  45. package/Rendering/Core/RenderWindowInteractor.d.ts +1 -1
  46. package/Rendering/Core/RenderWindowInteractor.js +1 -1
  47. package/Rendering/Misc/CanvasView.js +4 -2
  48. package/Rendering/Misc/RemoteView.d.ts +9 -3
  49. package/Rendering/Misc/RemoteView.js +7 -3
  50. package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +1 -1
  51. package/Rendering/OpenGL/ImageMapper.js +14 -7
  52. package/Rendering/OpenGL/Texture/supportsNorm16Linear.js +97 -0
  53. package/Rendering/OpenGL/Texture.js +18 -11
  54. package/Widgets/Widgets3D/AngleWidget/behavior.js +2 -0
  55. package/Widgets/Widgets3D/InteractiveOrientationWidget.js +1 -1
  56. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +17 -0
  57. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -0
  58. package/Widgets/Widgets3D/ShapeWidget/behavior.js +3 -0
  59. package/_virtual/rollup-plugin-worker-loader__module_Sources/IO/Geometry/GLTFImporter/ORMTexture.worker.js +296 -0
  60. package/index.d.ts +5 -0
  61. package/package.json +12 -10
@@ -0,0 +1,270 @@
1
+ import { m as macro } from '../../macros2.js';
2
+ import '../Core/DataAccessHelper/LiteHttpDataAccessHelper.js';
3
+ import DataAccessHelper from '../Core/DataAccessHelper.js';
4
+ import vtkActor from '../../Rendering/Core/Actor.js';
5
+ import vtkMapper from '../../Rendering/Core/Mapper.js';
6
+ import vtkDataArray from '../../Common/Core/DataArray.js';
7
+ import vtkPolyData from '../../Common/DataModel/PolyData.js';
8
+ import vtkCellArray from '../../Common/Core/CellArray.js';
9
+ import vtkAppendPolyData from '../../Filters/General/AppendPolyData.js';
10
+ import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
11
+ import { mat3 } from 'gl-matrix';
12
+
13
+ const {
14
+ vtkErrorMacro
15
+ } = macro;
16
+ let WebIFC;
17
+
18
+ /**
19
+ * Set WebIFC api to be used by vtkIFCImporter
20
+ * @param {object} ifcApi
21
+ */
22
+ function setIFCAPI(ifcApi) {
23
+ WebIFC = ifcApi;
24
+ }
25
+ function vtkIFCImporter(publicAPI, model) {
26
+ model.classHierarchy.push('vtkIFCImporter');
27
+ const meshes = [];
28
+
29
+ /**
30
+ * Create a vtkPolyData from an IFC mesh object
31
+ * @param {object} mesh the IFC web mesh object
32
+ * @returns vtkPolyData
33
+ */
34
+ function createPolyDataFromIFCMesh(mesh) {
35
+ const {
36
+ vertices,
37
+ indices
38
+ } = mesh;
39
+ const pd = vtkPolyData.newInstance();
40
+ const cells = vtkCellArray.newInstance();
41
+ const pointValues = new Float32Array(vertices.length / 2);
42
+ const normalsArray = new Float32Array(vertices.length / 2);
43
+ for (let i = 0; i < vertices.length; i += 6) {
44
+ pointValues[i / 2] = vertices[i];
45
+ pointValues[i / 2 + 1] = vertices[i + 1];
46
+ pointValues[i / 2 + 2] = vertices[i + 2];
47
+ normalsArray[i / 2] = vertices[i + 3];
48
+ normalsArray[i / 2 + 1] = vertices[i + 4];
49
+ normalsArray[i / 2 + 2] = vertices[i + 5];
50
+ }
51
+ const nCells = indices.length;
52
+ cells.resize(3 * nCells / 3);
53
+ for (let cellId = 0; cellId < nCells; cellId += 3) {
54
+ const cell = indices.slice(cellId, cellId + 3);
55
+ cells.insertNextCell(cell);
56
+ }
57
+ pd.getPoints().setData(pointValues, 3);
58
+ pd.setStrips(cells);
59
+ pd.getPointData().setNormals(vtkDataArray.newInstance({
60
+ name: 'Normals',
61
+ values: normalsArray,
62
+ numberOfComponents: 3
63
+ }));
64
+ return pd;
65
+ }
66
+
67
+ /**
68
+ * Create a colored vtkPolyData from an IFC mesh object
69
+ * @param {object} mesh the IFC mesh object
70
+ * @returns vtkPolyData
71
+ */
72
+ function createColoredPolyDataFromIFCMesh(mesh) {
73
+ const {
74
+ vertices,
75
+ indices,
76
+ color,
77
+ userMatrix
78
+ } = mesh;
79
+ const pd = vtkPolyData.newInstance();
80
+ const cells = vtkCellArray.newInstance();
81
+ const pointValues = new Float32Array(vertices.length / 2);
82
+ const normalsArray = new Float32Array(vertices.length / 2);
83
+ const colorArray = new Float32Array(vertices.length / 2);
84
+ if (userMatrix) {
85
+ const transformMatrix = vtkMatrixBuilder.buildFromRadian().setMatrix(userMatrix);
86
+ const normalMatrix = vtkMatrixBuilder.buildFromRadian().multiply3x3(mat3.fromMat4(mat3.create(), userMatrix));
87
+ for (let i = 0; i < vertices.length; i += 6) {
88
+ const point = [vertices[i], vertices[i + 1], vertices[i + 2]];
89
+ const normal = [vertices[i + 3], vertices[i + 4], vertices[i + 5]];
90
+ transformMatrix.apply(point);
91
+ normalMatrix.apply(normal);
92
+ pointValues[i / 2] = point[0];
93
+ pointValues[i / 2 + 1] = point[1];
94
+ pointValues[i / 2 + 2] = point[2];
95
+ normalsArray[i / 2] = normal[0];
96
+ normalsArray[i / 2 + 1] = normal[1];
97
+ normalsArray[i / 2 + 2] = normal[2];
98
+ const colorIndex = i / 2;
99
+ colorArray[colorIndex] = color.x;
100
+ colorArray[colorIndex + 1] = color.y;
101
+ colorArray[colorIndex + 2] = color.z;
102
+ }
103
+ } else {
104
+ for (let i = 0; i < vertices.length; i += 6) {
105
+ pointValues[i / 2] = vertices[i];
106
+ pointValues[i / 2 + 1] = vertices[i + 1];
107
+ pointValues[i / 2 + 2] = vertices[i + 2];
108
+ normalsArray[i / 2] = vertices[i + 3];
109
+ normalsArray[i / 2 + 1] = vertices[i + 4];
110
+ normalsArray[i / 2 + 2] = vertices[i + 5];
111
+ const colorIndex = i / 2;
112
+ colorArray[colorIndex] = color.x;
113
+ colorArray[colorIndex + 1] = color.y;
114
+ colorArray[colorIndex + 2] = color.z;
115
+ }
116
+ }
117
+ const nCells = indices.length;
118
+ cells.resize(3 * nCells / 3);
119
+ for (let cellId = 0; cellId < nCells; cellId += 3) {
120
+ const cell = indices.slice(cellId, cellId + 3);
121
+ cells.insertNextCell(cell);
122
+ }
123
+ pd.getPoints().setData(pointValues, 3);
124
+ pd.setPolys(cells);
125
+ pd.getPointData().setNormals(vtkDataArray.newInstance({
126
+ name: 'Normals',
127
+ values: normalsArray,
128
+ numberOfComponents: 3
129
+ }));
130
+ pd.getPointData().setScalars(vtkDataArray.newInstance({
131
+ name: 'Colors',
132
+ values: colorArray,
133
+ numberOfComponents: 3
134
+ }));
135
+ return pd;
136
+ }
137
+ function parseIfc(content) {
138
+ const modelID = model._ifcApi.OpenModel(new Uint8Array(content), {
139
+ COORDINATE_TO_ORIGIN: true,
140
+ USE_FAST_BOOLS: true
141
+ });
142
+ model._ifcApi.StreamAllMeshes(modelID, mesh => {
143
+ const placedGeometries = mesh.geometries;
144
+ for (let i = 0; i < placedGeometries.size(); i++) {
145
+ const placedGeometry = placedGeometries.get(i);
146
+ const ifcGeometryData = model._ifcApi.GetGeometry(modelID, placedGeometry.geometryExpressID);
147
+ const ifcVertices = model._ifcApi.GetVertexArray(ifcGeometryData.GetVertexData(), ifcGeometryData.GetVertexDataSize());
148
+ const ifcIndices = model._ifcApi.GetIndexArray(ifcGeometryData.GetIndexData(), ifcGeometryData.GetIndexDataSize());
149
+ meshes.push({
150
+ vertices: ifcVertices,
151
+ indices: ifcIndices,
152
+ color: placedGeometry.color,
153
+ userMatrix: placedGeometry.flatTransformation
154
+ });
155
+ }
156
+ });
157
+ model._ifcApi.CloseModel(modelID);
158
+ }
159
+ if (!model.dataAccessHelper) {
160
+ model.dataAccessHelper = DataAccessHelper.get('http');
161
+ }
162
+ function fetchData(url) {
163
+ const {
164
+ compression,
165
+ progressCallback
166
+ } = model;
167
+ return model.dataAccessHelper.fetchBinary(url, {
168
+ compression,
169
+ progressCallback
170
+ });
171
+ }
172
+ publicAPI.setUrl = function (url) {
173
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
174
+ binary: true
175
+ };
176
+ model.url = url;
177
+ model.baseURL = url.split('/').slice(0, -1).join('/');
178
+ model.compression = options.compression;
179
+ return publicAPI.loadData(options);
180
+ };
181
+ publicAPI.loadData = function () {
182
+ return fetchData(model.url).then(publicAPI.parse);
183
+ };
184
+ publicAPI.parse = content => {
185
+ publicAPI.parseAsArrayBuffer(content);
186
+ };
187
+ publicAPI.parseAsArrayBuffer = content => {
188
+ if (!content) {
189
+ vtkErrorMacro('No content to parse.');
190
+ return;
191
+ }
192
+ if (!WebIFC) {
193
+ vtkErrorMacro('vtkIFCImporter requires WebIFC API to be set.');
194
+ return;
195
+ }
196
+ model._ifcApi = new WebIFC.IfcAPI();
197
+ model._ifcApi.Init().then(() => {
198
+ parseIfc(content);
199
+ publicAPI.invokeReady();
200
+ });
201
+ };
202
+ publicAPI.importActors = renderer => {
203
+ if (model.mergeGeometries) {
204
+ const opaqueMeshes = meshes.filter(mesh => mesh.color.w === 1);
205
+ const oapd = vtkAppendPolyData.newInstance();
206
+ opaqueMeshes.forEach(mesh => {
207
+ const pd = createColoredPolyDataFromIFCMesh(mesh);
208
+ oapd.addInputData(pd);
209
+ });
210
+ let mapper = vtkMapper.newInstance();
211
+ mapper.setColorModeToDirectScalars();
212
+ mapper.setInputConnection(oapd.getOutputPort());
213
+ let actor = vtkActor.newInstance();
214
+ actor.setMapper(mapper);
215
+ renderer.addActor(actor);
216
+ const transparentMeshes = meshes.filter(mesh => mesh.color.w < 1);
217
+ const tapd = vtkAppendPolyData.newInstance();
218
+ transparentMeshes.forEach(mesh => {
219
+ const pd = createColoredPolyDataFromIFCMesh(mesh);
220
+ tapd.addInputData(pd);
221
+ });
222
+ mapper = vtkMapper.newInstance();
223
+ mapper.setColorModeToDirectScalars();
224
+ mapper.setInputConnection(tapd.getOutputPort());
225
+ actor = vtkActor.newInstance();
226
+ actor.setMapper(mapper);
227
+ actor.getProperty().setOpacity(0.5);
228
+ renderer.addActor(actor);
229
+ } else {
230
+ meshes.forEach(mesh => {
231
+ const pd = createPolyDataFromIFCMesh(mesh);
232
+ const mapper = vtkMapper.newInstance();
233
+ mapper.setInputData(pd);
234
+ const actor = vtkActor.newInstance();
235
+ actor.setMapper(mapper);
236
+ const {
237
+ x,
238
+ y,
239
+ z,
240
+ w
241
+ } = mesh.color;
242
+ actor.getProperty().setColor(x, y, z);
243
+ actor.getProperty().setOpacity(w);
244
+ actor.setUserMatrix(mesh.userMatrix);
245
+ renderer.addActor(actor);
246
+ });
247
+ }
248
+ };
249
+ }
250
+ const DEFAULT_VALUES = {
251
+ mergeGeometries: false
252
+ };
253
+ function extend(publicAPI, model) {
254
+ let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
255
+ Object.assign(model, DEFAULT_VALUES, initialValues);
256
+ macro.obj(publicAPI, model);
257
+ macro.get(publicAPI, model, ['url', 'baseURL']);
258
+ macro.setGet(publicAPI, model, ['dataAccessHelper', 'mergeGeometries']);
259
+ macro.event(publicAPI, model, 'ready');
260
+ macro.algo(publicAPI, model, 0, 1);
261
+ vtkIFCImporter(publicAPI, model);
262
+ }
263
+ const newInstance = macro.newInstance(extend, 'vtkIFCImporter');
264
+ var vtkIFCImporter$1 = {
265
+ newInstance,
266
+ extend,
267
+ setIFCAPI
268
+ };
269
+
270
+ export { vtkIFCImporter$1 as default, extend, newInstance };
@@ -46,6 +46,11 @@ export interface vtkSTLReader extends vtkSTLReaderBase {
46
46
  */
47
47
  getUrl(): string;
48
48
 
49
+ /**
50
+ * Get tolerance when removeDuplicateVertices is set
51
+ */
52
+ getRemoveDuplicateVertices(): number;
53
+
49
54
  /**
50
55
  * Load the object data.
51
56
  * @param {ISTLReaderOptions} [options]
@@ -94,6 +99,15 @@ export interface vtkSTLReader extends vtkSTLReaderBase {
94
99
  * @param {ISTLReaderOptions} [option] The STL reader options.
95
100
  */
96
101
  setUrl(url: string, option?: ISTLReaderOptions): Promise<string | any>;
102
+
103
+ /**
104
+ * Turn on/off automatic removeDuplicateVertices
105
+ * After reading the STL file, if `tolerance` is >= 0, then points with the same coordinates at 10 power tolerance are merged.
106
+ * For a smooth rendering, you might want to compute normals with vtkPolyDataNormals.
107
+ *
108
+ * @param {Number} tolerance
109
+ */
110
+ setRemoveDuplicateVertices(tolerance: number): boolean;
97
111
  }
98
112
 
99
113
  /**
@@ -103,6 +103,55 @@ function vtkSTLReader(publicAPI, model) {
103
103
  progressCallback
104
104
  });
105
105
  }
106
+ function removeDuplicateVertices(tolerance) {
107
+ const polydata = model.output[0];
108
+ const points = polydata.getPoints().getData();
109
+ const faces = polydata.getPolys().getData();
110
+ if (!points || !faces) {
111
+ console.warn('No valid polydata.');
112
+ return;
113
+ }
114
+ const vMap = new Map();
115
+ const vIndexMap = new Map();
116
+ let vInc = 0;
117
+ let pointsChanged = false;
118
+ for (let i = 0; i < points.length; i += 3) {
119
+ const k1 = (points[i] * 10 ** tolerance).toFixed(0);
120
+ const k2 = (points[i + 1] * 10 ** tolerance).toFixed(0);
121
+ const k3 = (points[i + 2] * 10 ** tolerance).toFixed(0);
122
+ const key = `${k1},${k2},${k3}`;
123
+ if (vMap.get(key) !== undefined) {
124
+ vIndexMap.set(i / 3, vMap.get(key));
125
+ pointsChanged = true;
126
+ } else {
127
+ vIndexMap.set(i / 3, vInc);
128
+ vMap.set(key, vInc);
129
+ vInc++;
130
+ }
131
+ }
132
+ const outVerts = new Float32Array(vMap.size * 3);
133
+ const keys = Array.from(vMap.keys());
134
+ for (let i = 0; i < keys.length; i++) {
135
+ const k = keys[i];
136
+ const j = vMap.get(k) * 3;
137
+ const coords = k.split(',').map(e => +e * 10 ** -tolerance);
138
+ outVerts[j] = coords[0];
139
+ outVerts[j + 1] = coords[1];
140
+ outVerts[j + 2] = coords[2];
141
+ }
142
+ const outFaces = new Int32Array(faces);
143
+ for (let i = 0; i < faces.length; i += 4) {
144
+ outFaces[i] = 3;
145
+ outFaces[i + 1] = vIndexMap.get(faces[i + 1]);
146
+ outFaces[i + 2] = vIndexMap.get(faces[i + 2]);
147
+ outFaces[i + 3] = vIndexMap.get(faces[i + 3]);
148
+ }
149
+ polydata.getPoints().setData(outVerts);
150
+ polydata.getPolys().setData(outFaces);
151
+ if (pointsChanged) {
152
+ publicAPI.modified();
153
+ }
154
+ }
106
155
 
107
156
  // Set DataSet url
108
157
  publicAPI.setUrl = function (url) {
@@ -251,6 +300,9 @@ function vtkSTLReader(publicAPI, model) {
251
300
 
252
301
  // Add new output
253
302
  model.output[0] = polydata;
303
+ if (model.removeDuplicateVertices >= 0) {
304
+ removeDuplicateVertices(model.removeDuplicateVertices);
305
+ }
254
306
  };
255
307
  publicAPI.parseAsText = content => {
256
308
  if (!content) {
@@ -281,6 +333,9 @@ function vtkSTLReader(publicAPI, model) {
281
333
 
282
334
  // Add new output
283
335
  model.output[0] = polydata;
336
+ if (model.removeDuplicateVertices >= 0) {
337
+ removeDuplicateVertices(model.removeDuplicateVertices);
338
+ }
284
339
  };
285
340
  publicAPI.requestData = (inData, outData) => {
286
341
  publicAPI.parse(model.parseData);
@@ -295,6 +350,7 @@ const DEFAULT_VALUES = {
295
350
  // baseURL: null,
296
351
  // dataAccessHelper: null,
297
352
  // url: null,
353
+ removeDuplicateVertices: -1
298
354
  };
299
355
 
300
356
  // ----------------------------------------------------------------------------
@@ -306,7 +362,7 @@ function extend(publicAPI, model) {
306
362
  // Build VTK API
307
363
  macro.obj(publicAPI, model);
308
364
  macro.get(publicAPI, model, ['url', 'baseURL']);
309
- macro.setGet(publicAPI, model, ['dataAccessHelper']);
365
+ macro.setGet(publicAPI, model, ['dataAccessHelper', 'removeDuplicateVertices']);
310
366
  macro.algo(publicAPI, model, 0, 1);
311
367
 
312
368
  // vtkSTLReader methods
package/IO/Geometry.js CHANGED
@@ -3,13 +3,17 @@ import vtkPLYReader from './Geometry/PLYReader.js';
3
3
  import vtkDracoReader from './Geometry/DracoReader.js';
4
4
  import vtkSTLWriter from './Geometry/STLWriter.js';
5
5
  import vtkPLYWriter from './Geometry/PLYWriter.js';
6
+ import vtkGLTFImporter from './Geometry/GLTFImporter.js';
7
+ import vtkIFCImporter from './Geometry/IFCImporter.js';
6
8
 
7
9
  var Geometry = {
8
10
  vtkSTLReader,
9
11
  vtkPLYReader,
10
12
  vtkDracoReader,
11
13
  vtkSTLWriter,
12
- vtkPLYWriter
14
+ vtkPLYWriter,
15
+ vtkGLTFImporter,
16
+ vtkIFCImporter
13
17
  };
14
18
 
15
19
  export { Geometry as default };
@@ -1,4 +1,4 @@
1
- import { A as ldexp } from '../../../Common/Core/Math/index.js';
1
+ import { B as ldexp } from '../../../Common/Core/Math/index.js';
2
2
 
3
3
  /**
4
4
  * Read a line from a Uint8Array
@@ -1,7 +1,7 @@
1
1
  import '../Core/DataAccessHelper/LiteHttpDataAccessHelper.js';
2
2
  import { m as macro } from '../../macros2.js';
3
3
  import DataAccessHelper from '../Core/DataAccessHelper.js';
4
- import { B as xyz2rgb } from '../../Common/Core/Math/index.js';
4
+ import { C as xyz2rgb } from '../../Common/Core/Math/index.js';
5
5
  import vtkImageData from '../../Common/DataModel/ImageData.js';
6
6
  import vtkDataArray from '../../Common/Core/DataArray.js';
7
7
  import { readLine, rgbe2float } from './HDRReader/Utils.js';
@@ -0,0 +1,28 @@
1
+ const TYPE_INDEXED = 1;
2
+ const TYPE_RGB = 2;
3
+ const TYPE_GREY = 3;
4
+ const TYPE_RLE_INDEXED = 9;
5
+ const TYPE_RLE_RGB = 10;
6
+ const TYPE_RLE_GREY = 11;
7
+ const ORIGIN_MASK = 0x30;
8
+ const ORIGIN_SHIFT = 0x04;
9
+ const ORIGIN_BL = 0x00;
10
+ const ORIGIN_BR = 0x01;
11
+ const ORIGIN_UL = 0x02;
12
+ const ORIGIN_UR = 0x03;
13
+ var Constants = {
14
+ TYPE_INDEXED,
15
+ TYPE_RGB,
16
+ TYPE_GREY,
17
+ TYPE_RLE_INDEXED,
18
+ TYPE_RLE_RGB,
19
+ TYPE_RLE_GREY,
20
+ ORIGIN_MASK,
21
+ ORIGIN_SHIFT,
22
+ ORIGIN_BL,
23
+ ORIGIN_BR,
24
+ ORIGIN_UL,
25
+ ORIGIN_UR
26
+ };
27
+
28
+ export { Constants as default };
@@ -0,0 +1,121 @@
1
+ import { vtkAlgorithm, vtkObject } from './../../interfaces';
2
+ import HtmlDataAccessHelper from './../Core/DataAccessHelper/HtmlDataAccessHelper';
3
+ import HttpDataAccessHelper from './../Core/DataAccessHelper/HttpDataAccessHelper';
4
+ import JSZipDataAccessHelper from './../Core/DataAccessHelper/JSZipDataAccessHelper';
5
+ import LiteHttpDataAccessHelper from './../Core/DataAccessHelper/LiteHttpDataAccessHelper';
6
+
7
+ interface ITGAReaderOptions {
8
+ compression?: string;
9
+ progressCallback?: any;
10
+ }
11
+
12
+ /**
13
+ *
14
+ */
15
+ export interface ITGAReaderInitialValues {}
16
+
17
+ type vtkTGAReaderBase = vtkObject &
18
+ Omit<
19
+ vtkAlgorithm,
20
+ | 'getInputData'
21
+ | 'setInputData'
22
+ | 'setInputConnection'
23
+ | 'getInputConnection'
24
+ | 'addInputConnection'
25
+ | 'addInputData'
26
+ >;
27
+
28
+ export interface vtkTGAReader extends vtkTGAReaderBase {
29
+ /**
30
+ * Get the base url.
31
+ */
32
+ getBaseURL(): string;
33
+
34
+ /**
35
+ * Get the dataAccess helper.
36
+ */
37
+ getDataAccessHelper():
38
+ | HtmlDataAccessHelper
39
+ | HttpDataAccessHelper
40
+ | JSZipDataAccessHelper
41
+ | LiteHttpDataAccessHelper;
42
+
43
+ /**
44
+ * Get the url of the object to load.
45
+ */
46
+ getUrl(): string;
47
+
48
+ /**
49
+ * Load the object data.
50
+ * @param {ITGAReaderOptions} [options]
51
+ */
52
+ loadData(options?: ITGAReaderOptions): Promise<any>;
53
+
54
+ /**
55
+ * Parse data.
56
+ * @param {ArrayBuffer} content The content to parse.
57
+ */
58
+ parse(content: ArrayBuffer): void;
59
+
60
+ /**
61
+ * Parse data as ArrayBuffer.
62
+ * @param {ArrayBuffer} content The content to parse.
63
+ */
64
+ parseAsArrayBuffer(content: ArrayBuffer): void;
65
+
66
+ /**
67
+ *
68
+ * @param inData
69
+ * @param outData
70
+ */
71
+ requestData(inData: any, outData: any): void;
72
+
73
+ /**
74
+ *
75
+ * @param dataAccessHelper
76
+ */
77
+ setDataAccessHelper(
78
+ dataAccessHelper:
79
+ | HtmlDataAccessHelper
80
+ | HttpDataAccessHelper
81
+ | JSZipDataAccessHelper
82
+ | LiteHttpDataAccessHelper
83
+ ): boolean;
84
+
85
+ /**
86
+ * Set the url of the object to load.
87
+ * @param {String} url the url of the object to load.
88
+ * @param {ITGAReaderOptions} [option] The PLY reader options.
89
+ */
90
+ setUrl(url: string, option?: ITGAReaderOptions): Promise<string | any>;
91
+ }
92
+
93
+ /**
94
+ * Method used to decorate a given object (publicAPI+model) with vtkTGAReader characteristics.
95
+ *
96
+ * @param publicAPI object on which methods will be bounds (public)
97
+ * @param model object on which data structure will be bounds (protected)
98
+ * @param {ITGAReaderInitialValues} [initialValues] (default: {})
99
+ */
100
+ export function extend(
101
+ publicAPI: object,
102
+ model: object,
103
+ initialValues?: ITGAReaderInitialValues
104
+ ): void;
105
+
106
+ /**
107
+ * Method used to create a new instance of vtkTGAReader
108
+ * @param {ITGAReaderInitialValues} [initialValues] for pre-setting some of its content
109
+ */
110
+ export function newInstance(
111
+ initialValues?: ITGAReaderInitialValues
112
+ ): vtkTGAReader;
113
+
114
+ /**
115
+ * vtkTGAReader is a source object that reads Truevision Targa(TGA) files.
116
+ */
117
+ export declare const vtkTGAReader: {
118
+ newInstance: typeof newInstance;
119
+ extend: typeof extend;
120
+ };
121
+ export default vtkTGAReader;