All files / Sources/Common/DataModel/Spline1D index.js

76.92% Statements 10/13
0% Branches 0/2
40% Functions 2/5
76.92% Lines 10/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 52 53 54 55 56 57 58 59 60 61 62 63 64 65    1x               12x       12x                   12x                   12x                     1x         12x     12x 12x         1x          
import macro from 'vtk.js/Sources/macros';
 
const { vtkErrorMacro } = macro;
 
// ----------------------------------------------------------------------------
// vtkSpline1D methods
// ----------------------------------------------------------------------------
 
function vtkSpline1D(publicAPI, model) {
  // Set our classname
  model.classHierarchy.push('vtkSpline1D');
 
  // --------------------------------------------------------------------------
 
  publicAPI.computeCloseCoefficients = (size, work, x, y) => {
    vtkErrorMacro(
      `${
        model.classHierarchy.slice(-1)[0]
      } should implement computeCloseCoefficients`
    );
  };
 
  // --------------------------------------------------------------------------
 
  publicAPI.computeOpenCoefficients = (size, work, x, y, options = {}) => {
    vtkErrorMacro(
      `${
        model.classHierarchy.slice(-1)[0]
      } should implement computeOpenCoefficients`
    );
  };
 
  // --------------------------------------------------------------------------
 
  publicAPI.getValue = (intervalIndex, t) => {
    vtkErrorMacro(
      `${model.classHierarchy.slice(-1)[0]} should implement getValue`
    );
  };
}
 
// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------
 
const DEFAULT_VALUES = {};
 
// ----------------------------------------------------------------------------
 
export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);
 
  // Build VTK API
  macro.obj(publicAPI, model);
  vtkSpline1D(publicAPI, model);
}
 
// ----------------------------------------------------------------------------
 
export const newInstance = macro.newInstance(extend, 'vtkSpline1D');
 
// ----------------------------------------------------------------------------
 
export default { newInstance, extend };