All files / Sources/Proxy/Representations/SkyboxRepresentationProxy index.js

63.63% Statements 14/22
0% Branches 0/1
25% Functions 2/8
73.68% Lines 14/19

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                      1x 1x 1x                     1x       1x 1x 1x   1x       1x             1x         1x     1x     1x         1x                
import macro from 'vtk.js/Sources/macros';
import vtkSkybox from 'vtk.js/Sources/Rendering/Core/Skybox';
 
import vtkAbstractRepresentationProxy from 'vtk.js/Sources/Proxy/Core/AbstractRepresentationProxy';
 
// ----------------------------------------------------------------------------
// vtkSkyboxRepresentationProxy methods
// ----------------------------------------------------------------------------
 
function vtkSkyboxRepresentationProxy(publicAPI, model) {
  // Set our className
  model.classHierarchy.push('vtkSkyboxRepresentationProxy');
  model.actor = vtkSkybox.newInstance();
  model.actors.push(model.actor);
 
  function updateTexture(texture) {
    model.actor.removeAllTextures();
    model.actor.addTexture(texture);
 
    // Update domain
    const values = model.input.getAlgo().getPositions();
    publicAPI.updateProxyProperty('position', { values });
  }
 
  model.sourceDependencies.push({ setInputData: updateTexture });
 
  // API ----------------------------------------------------------------------
 
  publicAPI.setColorBy = () => {};
  publicAPI.getColorBy = () => [];
  publicAPI.listDataArrays = () => [];
 
  publicAPI.setPosition = (value) => {
    model.input.getAlgo().setPosition(value);
  };
 
  publicAPI.getPosition = () => model.input.getAlgo().getPosition();
}
 
// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------
 
const DEFAULT_VALUES = {};
 
// ----------------------------------------------------------------------------
 
export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);
 
  // Object methods
  vtkAbstractRepresentationProxy.extend(publicAPI, model, initialValues);
 
  // Object specific methods
  vtkSkyboxRepresentationProxy(publicAPI, model);
}
 
// ----------------------------------------------------------------------------
 
export const newInstance = macro.newInstance(
  extend,
  'vtkSkyboxRepresentationProxy'
);
 
// ----------------------------------------------------------------------------
 
export default { newInstance, extend };