Skip to content

Commit 47d8ca9

Browse files
David Bergerjoannacirillo
authored andcommitted
feat(vtkClipClosedSurface): Add vtkClipClosedSurface
1 parent c4cd8cc commit 47d8ca9

File tree

20 files changed

+1011
-725
lines changed

20 files changed

+1011
-725
lines changed
Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import { vtkObject } from "../../../interfaces";
2-
import { Bounds } from "../../../types";
3-
import { ILocatorInitialValues } from "../Locator";
1+
import { vtkObject } from '../../../interfaces';
2+
import { Bounds } from '../../../types';
3+
import { ILocatorInitialValues } from '../Locator';
44

55
/**
66
*
77
*/
88
export interface IAbstractPointLocatorInitialValues
9-
extends ILocatorInitialValues {
10-
bounds?: Bounds;
11-
numberOfBuckets: number;
9+
extends ILocatorInitialValues {
10+
bounds?: Number[];
11+
numberOfBuckets: Number;
1212
}
1313

1414
export interface vtkAbstractPointLocator extends vtkObject {
15-
/**
16-
* Set the bounds of this object.
17-
* @param {Bounds} input
18-
*/
19-
setBounds(input: Bounds): void;
20-
21-
/**
22-
* Get the bounds of this object.
23-
* @returns {Bounds}
24-
*/
25-
getBounds(): Bounds;
15+
/**
16+
* Set the bounds of this object.
17+
* @param {Bounds} input
18+
*/
19+
setBounds(input: Bounds): void;
20+
21+
/**
22+
* Get the bounds of this object.
23+
* @param {Bounds} output
24+
*/
25+
getBounds(output: Bounds): void;
2626
}
2727

2828
// ----------------------------------------------------------------------------
@@ -34,21 +34,30 @@ export interface vtkAbstractPointLocator extends vtkObject {
3434
*
3535
* @param publicAPI object on which methods will be bounds (public)
3636
* @param model object on which data structure will be bounds (protected)
37-
* @param {IAbstractPointLocatorInitialValues} [initialValues] (default: {})
37+
* @param {object} [initialValues] (default: {})
3838
*/
3939
export function extend(
40-
publicAPI: object,
41-
model: object,
42-
initialValues?: IAbstractPointLocatorInitialValues
40+
publicAPI: object,
41+
model: object,
42+
initialValues?: IAbstractPointLocatorInitialValues
4343
): void;
4444

4545
// ----------------------------------------------------------------------------
4646

47+
/**
48+
* Method use to create a new instance of vtkAbstractPointLocator
49+
* @param {object} [initialValues] for pre-setting some of its content
50+
*/
51+
export function newInstance(
52+
initialValues?: IAbstractPointLocatorInitialValues
53+
): vtkAbstractPointLocator;
54+
4755
/**
4856
* vtkAbstractPointLocator
4957
*/
5058
export declare const vtkAbstractPointLocator: {
51-
extend: typeof extend;
59+
newInstance: typeof newInstance;
60+
extend: typeof extend;
5261
};
5362

5463
export default vtkAbstractPointLocator;

Sources/Common/DataModel/AbstractPointLocator/index.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ import vtkLocator from 'vtk.js/Sources/Common/DataModel/Locator';
44
function vtkAbstractPointLocator(publicAPI, model) {
55
// Set our className
66
model.classHierarchy.push('vtkAbstractPointLocator');
7+
8+
publicAPI.setBounds = (input) => {
9+
model.bounds[0] = input[0];
10+
model.bounds[1] = input[1];
11+
model.bounds[2] = input[2];
12+
model.bounds[3] = input[3];
13+
model.bounds[4] = input[4];
14+
model.bounds[5] = input[5];
15+
};
16+
17+
publicAPI.getBounds = (output) => {
18+
output[0] = model.bounds[0];
19+
output[1] = model.bounds[1];
20+
output[2] = model.bounds[2];
21+
output[3] = model.bounds[3];
22+
output[4] = model.bounds[4];
23+
output[5] = model.bounds[5];
24+
};
725
}
826

927
// ----------------------------------------------------------------------------
@@ -12,7 +30,7 @@ function vtkAbstractPointLocator(publicAPI, model) {
1230

1331
function defaultValues(initialValues) {
1432
return {
15-
bounds: null,
33+
bounds: [],
1634
numberOfBuckets: 0,
1735
...initialValues,
1836
};
@@ -28,12 +46,14 @@ export function extend(publicAPI, model, initialValues = {}) {
2846

2947
macro.get(publicAPI, model, ['numberOfBuckets']);
3048

31-
macro.setGetArray(publicAPI, model, ['bounds'], 6);
32-
3349
// Object specific methods
3450
vtkAbstractPointLocator(publicAPI, model);
3551
}
3652

3753
// ----------------------------------------------------------------------------
3854

39-
export default { extend };
55+
export const newInstance = macro.newInstance(extend, 'vtkAbstractPointLocator');
56+
57+
// ----------------------------------------------------------------------------
58+
59+
export default { newInstance, extend };

Sources/Common/DataModel/AbstractPointLocator/test/testLocator.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import vtkAbstractPointLocator from 'vtk.js/Sources/Common/DataModel/AbstractPoi
33

44
test('Test vtkAbstractPointLocator instance', (t) => {
55
t.ok(vtkAbstractPointLocator, 'Make sure the class definition exists');
6-
t.ok(
7-
vtkAbstractPointLocator.newInstance === undefined,
8-
'Make sure class is abstract'
9-
);
6+
const instance = vtkAbstractPointLocator.newInstance();
7+
t.ok(instance);
108
t.end();
119
});

0 commit comments

Comments
 (0)