Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import macro from 'vtk.js/Sources/macros'; // ---------------------------------------------------------------------------- // vtkJSONReader methods // ---------------------------------------------------------------------------- function vtkJSONReader(publicAPI, model) { // Set our className model.classHierarchy.push('vtkJSONReader'); // Internal method to fetch Array function fetchData(url, option = {}) { return model.dataAccessHelper.fetchText(publicAPI, url, option); } // Set DataSet url publicAPI.setUrl = (url, option = {}) => { model.url = url; // Fetch metadata return publicAPI.loadData(option); }; // Fetch the actual data arrays publicAPI.loadData = (option = {}) => fetchData(model.url, option).then(publicAPI.parseAsText); publicAPI.parseAsText = (content) => { if (!content) { return false; } model.data = JSON.parse(content); publicAPI.modified(); return true; }; publicAPI.requestData = (inData, outData) => { outData[0] = model.data; }; // return Busy state publicAPI.isBusy = () => false; publicAPI.getNumberOfOutputPorts = () => model.numberOfOutputs; } // ---------------------------------------------------------------------------- // Object factory // ---------------------------------------------------------------------------- const DEFAULT_VALUES = { // url: null, }; // ---------------------------------------------------------------------------- export function extend(publicAPI, model, initialValues = {}) { Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API macro.obj(publicAPI, model); macro.get(publicAPI, model, ['url']); macro.algo(publicAPI, model, 0, 1); macro.event(publicAPI, model, 'busy'); // Object methods vtkJSONReader(publicAPI, model); } // ---------------------------------------------------------------------------- export const newInstance = macro.newInstance(extend, 'vtkJSONReader'); // ---------------------------------------------------------------------------- export default { newInstance, extend }; |