UNPKG

@kitware/vtk.js

Version:

Visualization Toolkit for the Web

69 lines (53 loc) 1.98 kB
import { m as macro } from '../../macros2.js'; import vtkProp3D from './Prop3D.js'; import vtkVolumeProperty from './VolumeProperty.js'; // ---------------------------------------------------------------------------- // vtkVolume methods // ---------------------------------------------------------------------------- function vtkVolume(publicAPI, model) { // Set our className model.classHierarchy.push('vtkVolume'); publicAPI.getVolumes = () => [publicAPI]; publicAPI.makeProperty = vtkVolumeProperty.newInstance; publicAPI.getRedrawMTime = () => { let mt = model.mtime; if (model.mapper !== null) { let time = model.mapper.getMTime(); mt = time > mt ? time : mt; if (model.mapper.getInput() !== null) { // FIXME !!! getInputAlgorithm / getInput model.mapper.getInputAlgorithm().update(); time = model.mapper.getInput().getMTime(); mt = time > mt ? time : mt; } } return mt; }; } // ---------------------------------------------------------------------------- // Object factory // ---------------------------------------------------------------------------- const DEFAULT_VALUES = { mapper: null }; // ---------------------------------------------------------------------------- function extend(publicAPI, model, initialValues = {}) { Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance vtkProp3D.extend(publicAPI, model, initialValues); // vtkTimeStamp model.boundsMTime = {}; macro.obj(model.boundsMTime); // Build VTK API macro.setGet(publicAPI, model, ['mapper']); // Object methods vtkVolume(publicAPI, model); } // ---------------------------------------------------------------------------- const newInstance = macro.newInstance(extend, 'vtkVolume'); // ---------------------------------------------------------------------------- var vtkVolume$1 = { newInstance, extend }; export { vtkVolume$1 as default, extend, newInstance };