SelectionNode

Introduction

vtkSelectionNode represents a 2D n-sided polygon.

The polygons cannot have any internal holes, and cannot self-intersect.
Define the polygon with n-points ordered in the counter-clockwise direction.
Do not repeat the last point.

Methods

extend

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

getBounds

Get the bounds of the selection points.

getContentType

Returns -1 if not initialized.

getFieldType

Returns -1 if not initialized.

getProperties

Get the selection properties.

getSelectionList

Get the list of the underlying selected attribute IDs.

newInstance

Method used to create a new instance of vtkSelectionNode.

Argument Type Required Description
initialValues ISelectionNodeInitialValues No for pre-setting some of its content

setContentType

This functions is called internally by VTK.js and is not intended for public use.

setFieldType

This functions is called internally by VTK.js and is not intended for public use.

setProperties

This functions is called internally by VTK.js and is not intended for public use.

setSelectionList

This functions is called internally by VTK.js and is not intended for public use.

Source

Constants.d.ts
export declare enum SelectionContent {
GLOBALIDS = 0,
PEDIGREEIDS = 1,
VALUES = 2,
INDICES = 3,
FRUSTUM = 4,
LOCATIONS = 5,
THRESHOLDS = 6,
BLOCKS = 7,
QUERY = 8,
}

export declare enum SelectionField {
CELL = 0,
POINT = 1,
FIELD = 2,
VERTEX = 3,
EDGE = 4,
ROW = 5,
}

declare const _default: {
SelectionContent: typeof SelectionContent;
SelectionField: typeof SelectionField;
};

export default _default;
Constants.js
/**
* The (primary) property that describes the content of a selection
* node's data. Other auxiliary description properties follow.
* GLOBALIDS means that the selection list contains values from the
* vtkDataSetAttribute array of the same name.
* PEDIGREEIDS means that the selection list contains values from the
* vtkDataSetAttribute array of the same name.
* VALUES means the the selection list contains values from an
* arbitrary attribute array (ignores any globalids attribute)
* INDICES means that the selection list contains indexes into the
* cell or point arrays.
* FRUSTUM means the set of points and cells inside a frustum
* LOCATIONS means the set of points and cells near a set of positions
* THRESHOLDS means the points and cells with values within a set of ranges
* getContentType() returns -1 if the content type is not set.
*/

// Specify how data arrays can be used by data objects
export const SelectionContent = {
GLOBALIDS: 0,
PEDIGREEIDS: 1,
VALUES: 2,
INDICES: 3,
FRUSTUM: 4,
LOCATIONS: 5,
THRESHOLDS: 6,
BLOCKS: 7,
QUERY: 8,
};

export const SelectionField = {
CELL: 0,
POINT: 1,
FIELD: 2,
VERTEX: 3,
EDGE: 4,
ROW: 5,
};

export default {
SelectionContent,
SelectionField,
};
index.d.ts
import { vtkObject } from '../../../interfaces';
import { Bounds } from '../../../types';
import { SelectionContent, SelectionField } from './Constants';
import vtkProp from '../../../Rendering/Core/Prop';

export interface ISelectionNodeInitialValues {
contentType?: SelectionContent;
fieldType?: SelectionField;
properties?: ISelectionNodeProperties;
selectionList?: number[];
}

export interface ISelectionNodeProperties {
propID?: number;
prop?: vtkProp;
compositeID?: number;
attributeID?: number;
pixelCount?: number;
displayPosition?: [number, number, number];
worldPosition?: [number, number, number];
}

export interface vtkSelectionNode extends vtkObject {
/**
* Get the bounds of the selection points.
*/
getBounds(): Bounds;

/**
* Returns -1 if not initialized.
*/
getContentType(): SelectionContent | -1;

/**
* This functions is called internally by VTK.js and is not intended for public use.
*/
setContentType(contentType: SelectionContent): void;

/**
* Returns -1 if not initialized.
*/
getFieldType(): SelectionField | -1;

/**
* This functions is called internally by VTK.js and is not intended for public use.
*/
setFieldType(fieldType: SelectionField): void;

/**
* Get the selection properties.
*/
getProperties(): ISelectionNodeProperties;

/**
* This functions is called internally by VTK.js and is not intended for public use.
*/
setProperties(properties: ISelectionNodeProperties): boolean;

/**
* Get the list of the underlying selected attribute IDs.
*/
getSelectionList(): number[];

/**
* This functions is called internally by VTK.js and is not intended for public use.
*/
setSelectionList(selectionAttributeIDs: ISelectionNodeProperties): boolean;
}

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

/**
* Method used to create a new instance of vtkSelectionNode.
* @param {ISelectionNodeInitialValues} [initialValues] for pre-setting some of its content
*/
export function newInstance(
initialValues?: ISelectionNodeInitialValues
): vtkSelectionNode;

/**
* vtkSelectionNode represents a 2D n-sided polygon.
*
* The polygons cannot have any internal holes, and cannot self-intersect.
* Define the polygon with n-points ordered in the counter-clockwise direction.
* Do not repeat the last point.
*/
export declare const vtkSelectionNode: {
newInstance: typeof newInstance;
extend: typeof extend;
SelectionContent: typeof SelectionContent;
SelectionField: typeof SelectionField;
};
export default vtkSelectionNode;
index.js
import macro from 'vtk.js/Sources/macros';
import Constants from 'vtk.js/Sources/Common/DataModel/SelectionNode/Constants';

// ----------------------------------------------------------------------------
// vtkSelectionNode methods
// ----------------------------------------------------------------------------

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

publicAPI.getBounds = () => model.points.getBounds();
}

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

const DEFAULT_VALUES = {
contentType: -1,
fieldType: -1,
properties: null,
selectionList: [],
};

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

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

// Inheritance
macro.obj(publicAPI, model);
model.properties = {};
macro.setGet(publicAPI, model, [
'contentType',
'fieldType',
'properties',
'selectionList',
]);

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

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

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

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

export default { newInstance, extend, ...Constants };