Skip to content

Commit 6a1db28

Browse files
committed
feat(Dataset): initial dataset impl
1 parent f4a063e commit 6a1db28

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/core/Dataset.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { vtkObject } from '@kitware/vtk.js/interfaces';
2+
import { useEffect } from 'react';
3+
import { useDownstream, useRepresentation } from './contexts';
4+
5+
export interface DatasetProps {
6+
dataset: vtkObject | null;
7+
}
8+
9+
export default function Dataset(props: DatasetProps) {
10+
const representation = useRepresentation();
11+
const downstream = useDownstream();
12+
13+
const { dataset } = props;
14+
15+
useEffect(() => {
16+
if (!dataset) {
17+
return;
18+
}
19+
20+
downstream.setInputData(dataset);
21+
representation.dataAvailable();
22+
representation.dataChanged();
23+
}, [dataset, downstream, representation]);
24+
25+
return null;
26+
}

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export { default as CellData } from './core/CellData';
99
export * as Contexts from './core/contexts';
1010
export { default as DataArray } from './core/DataArray';
1111
export type { DataArrayProps } from './core/DataArray';
12+
export { default as Dataset } from './core/Dataset';
13+
export type { DatasetProps } from './core/Dataset';
1214
export { default as FieldData } from './core/FieldData';
1315
export { default as Geometry2DRepresentation } from './core/Geometry2DRepresentation';
1416
export type { Geometry2DRepresentationProps } from './core/Geometry2DRepresentation';

0 commit comments

Comments
 (0)