All files / Sources/Filters/General/LineFilter index.js

100% Statements 13/13
0% Branches 0/1
100% Functions 3/3
100% Lines 13/13

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                  7x   7x 4x   4x 4x   4x           1x         7x     7x     7x     7x     7x         1x          
import macro from 'vtk.js/Sources/macros';
import vtkPolyData from 'vtk.js/Sources/Common/DataModel/PolyData';
 
// ----------------------------------------------------------------------------
// vtkLineFilter methods
// ----------------------------------------------------------------------------
 
function vtkLineFilter(publicAPI, model) {
  // Set our classname
  model.classHierarchy.push('vtkLineFilter');
 
  publicAPI.requestData = (inData, outData) => {
    const dataset = vtkPolyData.newInstance();
 
    dataset.getPoints().setData(inData[0].getPoints().getData());
    dataset.getLines().setData(inData[0].getLines().getData());
 
    outData[0] = dataset;
  };
}
 
// ----------------------------------------------------------------------------
 
const DEFAULT_VALUES = {};
 
// ----------------------------------------------------------------------------
 
export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);
 
  // Build VTK API
  macro.setGet(publicAPI, model, []);
 
  // Make this a VTK object
  macro.obj(publicAPI, model);
 
  // Also make it an algorithm with one input and one output
  macro.algo(publicAPI, model, 1, 1);
 
  // Object specific methods
  vtkLineFilter(publicAPI, model);
}
 
// ----------------------------------------------------------------------------
 
export const newInstance = macro.newInstance(extend, 'vtkLineFilter');
 
// ----------------------------------------------------------------------------
 
export default { newInstance, extend };