Locator

Introduction

vtkLocator

Methods

extend

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

Source

index.d.ts
import { vtkObject } from '../../../interfaces';

/**
*
*/
export interface ILocatorInitialValues {
dataSet?: number[];
maxLevel?: number;
level?: number;
automatic?: boolean;
tolerance?: number;
useExistingSearchStructure?: boolean;
}

export interface vtkLocator extends vtkObject {}

// ----------------------------------------------------------------------------
// Static API
// ----------------------------------------------------------------------------

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

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

/**
* vtkLocator
*/
export declare const vtkLocator: {
extend: typeof extend;
};

export default vtkLocator;
index.js
import macro from 'vtk.js/Sources/macros';

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

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

const DEFAULT_VALUES = {
dataSet: null,
maxLevel: 8, // TODO: clamp 0, Number.MAX_VALUE
level: 8,
automatic: false,
tolerance: 0.0, // TODO: clamp 0.0, Number.MAX_VALUE
useExistingSearchStructure: false,
};

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

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

// Make this a VTK object
macro.obj(publicAPI, model);

macro.get(publicAPI, model, ['level']);

macro.setGet(publicAPI, model, [
'dataSet',
'maxLevel',
'automatic',
'tolerance',
'useExistingSearchStructure',
]);

// Object specific methods
vtkLocator(publicAPI, model);
}

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

export default { extend };