Skip to content

Commit e47ea64

Browse files
committed
fix(vtkpolydata): vtkPolyData MTime consists of point and cell MTimes
Similar to VTK C++, vtkPolyData GetMTime() should consider the MTime of its point and cell data, points and cells arrays
1 parent 6e39ec5 commit e47ea64

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Sources/Common/DataModel/DataSet/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ function vtkDataSet(publicAPI, model) {
6565
model[fieldName].shallowCopy(other.getReferenceByName(fieldName));
6666
});
6767
};
68+
69+
const superGetMTime = publicAPI.getMTime;
70+
publicAPI.getMTime = () =>
71+
DATASET_FIELDS.reduce(
72+
(mTime, fieldName) =>
73+
Math.max(mTime, model[fieldName]?.getMTime() ?? mTime),
74+
superGetMTime()
75+
);
6876
}
6977

7078
// ----------------------------------------------------------------------------

Sources/Common/DataModel/PointSet/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ function vtkPointSet(publicAPI, model) {
3636
model.points = vtkPoints.newInstance();
3737
model.points.shallowCopy(other.getPoints());
3838
};
39+
40+
const superGetMTime = publicAPI.getMTime;
41+
publicAPI.getMTime = () => {
42+
const mTime = superGetMTime();
43+
return Math.max(mTime, model.points?.getMTime() ?? mTime);
44+
};
3945
}
4046

4147
// ----------------------------------------------------------------------------

Sources/Common/DataModel/PolyData/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ function vtkPolyData(publicAPI, model) {
5858
});
5959
};
6060

61+
const superGetMTime = publicAPI.getMTime;
62+
publicAPI.getMTime = () =>
63+
POLYDATA_FIELDS.reduce(
64+
(mTime, type) => Math.max(mTime, model[type]?.getMTime() ?? mTime),
65+
superGetMTime()
66+
);
67+
6168
publicAPI.buildCells = () => {
6269
// here are the number of cells we have
6370
const nVerts = publicAPI.getNumberOfVerts();

0 commit comments

Comments
 (0)