SphereMapper

Introduction

vtkSphereMapper inherits from vtkMapper.

Methods

extend

Method use to decorate a given object (publicAPI+model) with vtkSphereMapper 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 ISphereInitialValues No (default: {})

getRadius

getScaleArray

getScaleFactor

newInstance

Method use to create a new instance of vtkSphereMapper

setRadius

Argument Type Required Description
radius Number Yes

setScaleArray

Argument Type Required Description
scaleArray Yes

setScaleFactor

Factor multiplied with scale array elements. Radius is used when no scale array is given.

Argument Type Required Description
scaleFactor Yes number to multiply with when a scale array is provided. 1 by default.

Source

index.d.ts
import vtkMapper, { IMapperInitialValues } from '../Mapper';

export interface ISphereInitialValues extends IMapperInitialValues {
radius?: number;
}

export interface vtkSphereMapper extends vtkMapper {
/**
*
*/
getRadius(): number;

/**
*
*/
getScaleArray(): any;

/**
*
*/
getScaleFactor(): number;

/**
*
* @param {Number} radius
*/
setRadius(radius: number): boolean;

/**
*
* @param scaleArray
*/
setScaleArray(scaleArray: any): boolean;

/**
* Factor multiplied with scale array elements. Radius is used when no scale array is given.
* @param scaleFactor number to multiply with when a scale array is provided. 1 by default.
* @see getScaleFactor(), setScaleArray(), setRadius()
*/
setScaleFactor(scaleFactor: number): boolean;
}

/**
* Method use to decorate a given object (publicAPI+model) with vtkSphereMapper characteristics.
*
* @param publicAPI object on which methods will be bounds (public)
* @param model object on which data structure will be bounds (protected)
* @param {ISphereInitialValues} [initialValues] (default: {})
*/
export function extend(
publicAPI: object,
model: object,
initialValues?: ISphereInitialValues
): void;

/**
* Method use to create a new instance of vtkSphereMapper
*/
export function newInstance(
initialValues?: ISphereInitialValues
): vtkSphereMapper;

/**
* vtkSphereMapper inherits from vtkMapper.
*/
export declare const vtkSphereMapper: {
newInstance: typeof newInstance;
extend: typeof extend;
};
export default vtkSphereMapper;
index.js
import macro from 'vtk.js/Sources/macros';
import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper';

// ----------------------------------------------------------------------------
// vtkSphereMapper methods
// ----------------------------------------------------------------------------

function vtkSphereMapper(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkSphereMapper');
}

// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------

const DEFAULT_VALUES = {
scaleArray: null,
radius: 0.05,
scaleFactor: 1.0,
};

// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Inheritance
vtkMapper.extend(publicAPI, model, initialValues);

macro.setGet(publicAPI, model, ['radius', 'scaleArray', 'scaleFactor']);

// Object methods
vtkSphereMapper(publicAPI, model);
}

// ----------------------------------------------------------------------------

export const newInstance = macro.newInstance(extend, 'vtkSphereMapper');

// ----------------------------------------------------------------------------

export default { newInstance, extend };