Skip to content

Commit d0329a4

Browse files
committed
fix(PDBReader): Apply uniform reader API
BREAKING CHANGE: PDBReader: parseText => parseAsText
1 parent a89299e commit d0329a4

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

BREAKING_CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Add more consistency in Readers
2929
- ElevationReader
3030
- MTLReader
3131
- OBJReader
32+
- PDBReader
3233

3334

3435
## From 4.x to 5

Sources/IO/Misc/PDBReader/index.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@ function vtkPDBReader(publicAPI, model) {
1818
}
1919

2020
// Internal method to fetch Array
21-
function fetchPDB(url) {
22-
const { compression, progressCallback } = model;
23-
return model.dataAccessHelper.fetchText(publicAPI, url, {
24-
compression,
25-
progressCallback,
26-
});
21+
function fetchPDB(url, option) {
22+
return model.dataAccessHelper.fetchText(publicAPI, url, option);
2723
}
2824

2925
// Set DataSet url
30-
publicAPI.setUrl = (url) => {
26+
publicAPI.setUrl = (url, option) => {
3127
if (url.indexOf('.pdb') === -1) {
3228
model.baseURL = url;
3329
model.url = `${url}`; // `${url}/index.pdb`;
@@ -41,13 +37,14 @@ function vtkPDBReader(publicAPI, model) {
4137
}
4238

4339
// Fetch metadata
44-
return publicAPI.loadData();
40+
return publicAPI.loadData(option);
4541
};
4642

4743
// Fetch the actual data arrays
48-
publicAPI.loadData = () => fetchPDB(model.url).then(publicAPI.parseText);
44+
publicAPI.loadData = (option) =>
45+
fetchPDB(model.url, option).then(publicAPI.parseAsText);
4946

50-
publicAPI.parseText = (txt) => {
47+
publicAPI.parseAsText = (txt) => {
5148
model.pdb = txt;
5249
model.molecule = [];
5350
model.molecule = model.pdb.split('\n');
@@ -183,14 +180,6 @@ export function extend(publicAPI, model, initialValues = {}) {
183180

184181
// Object methods
185182
vtkPDBReader(publicAPI, model);
186-
187-
// To support destructuring
188-
if (!model.compression) {
189-
model.compression = null;
190-
}
191-
if (!model.progressCallback) {
192-
model.progressCallback = null;
193-
}
194183
}
195184

196185
// ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)