Class tells VTK which specific vtkViewNode subclass to make when it is asked to make a vtkViewNode for a particular renderable. modules for different rendering backends are expected to use this to customize the set of instances for their own purposes
Methods
createNode
Creates and returns a vtkViewNode for the provided renderable.
Argument
Type
Required
Description
dataObject
Yes
extend
Method used to decorate a given object (publicAPI+model) with vtkViewNodeFactory characteristics.
Argument
Type
Required
Description
publicAPI
Yes
object on which methods will be bounds (public)
model
Yes
object on which data structure will be bounds (protected)
initialValues
IViewNodeFactoryInitialValues
No
(default: {})
newInstance
Method used to create a new instance of vtkViewNodeFactory.
export interface vtkViewNodeFactory extends vtkObject { /** * Creates and returns a vtkViewNode for the provided renderable. * @paramdataObject */ createNode(dataObject: any): void; }
/** * Method used to decorate a given object (publicAPI+model) with vtkViewNodeFactory characteristics. * * @param publicAPI object on which methods will be bounds (public) * @param model object on which data structure will be bounds (protected) * @param {IViewNodeFactoryInitialValues} [initialValues] (default: {}) */ exportfunctionextend( publicAPI: object, model: object, initialValues?: IViewNodeFactoryInitialValues ): void;
/** * Method used to create a new instance of vtkViewNodeFactory. * @param {IViewNodeFactoryInitialValues} [initialValues] for pre-setting some of its content */ exportfunctionnewInstance( initialValues?: IViewNodeFactoryInitialValues ): vtkViewNodeFactory;
/** * factory that chooses vtkViewNodes to create * * Class tells VTK which specific vtkViewNode subclass to make when it is asked * to make a vtkViewNode for a particular renderable. modules for different * rendering backends are expected to use this to customize the set of instances * for their own purposes */ export declare constvtkViewNodeFactory: { newInstance: typeof newInstance; extend: typeof extend; }; exportdefault vtkViewNodeFactory;
functionvtkViewNodeFactory(publicAPI, model) { // Make sure our overrides is just for our instance not shared with everyone... if (!model.overrides) { model.overrides = {}; }
// Set our className model.classHierarchy.push('vtkViewNodeFactory');
publicAPI.createNode = (dataObject) => { if (dataObject.isDeleted()) { returnnull; }
let cpt = 0; let className = dataObject.getClassName(cpt++); let isObject = false; const keys = Object.keys(model.overrides); while (className && !isObject) { if (keys.indexOf(className) !== -1) { isObject = true; } else { className = dataObject.getClassName(cpt++); } }