Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Sources/Common/Core/ScalarsToColors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,16 @@ function vtkScalarsToColors(publicAPI, model) {
break;
}

default:
case VectorMode.MAGNITUDE: {
case VectorMode.RGBCOLORS: {
// publicAPI.mapColorsToColors(
// input, output, inComponents, vectorSize,
// outputFormat);
break;
}

// MAGNITUDE is considered default
case VectorMode.MAGNITUDE:
default: {
const magValues = vtkDataArray.newInstance({
numberOfComponents: 1,
values: new Float32Array(input.getNumberOfTuples()),
Expand All @@ -362,13 +370,6 @@ function vtkScalarsToColors(publicAPI, model) {
publicAPI.mapScalarsThroughTable(magValues, output, outputFormat, 0);
break;
}

case VectorMode.RGBCOLORS: {
// publicAPI.mapColorsToColors(
// input, output, inComponents, vectorSize,
// outputFormat);
break;
}
}
};

Expand Down
6 changes: 3 additions & 3 deletions Sources/Common/DataModel/PiecewiseFunction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function vtkPiecewiseFunction(publicAPI, model) {
case 1:
functionType = 1; // NonDecreasing
break;
default:
case 2:
default:
functionType = 3; // Varied
break;
}
Expand All @@ -53,8 +53,8 @@ function vtkPiecewiseFunction(publicAPI, model) {
case 2:
functionType = 2; // NonIncreasing
break;
default:
case 1:
default:
functionType = 3; // Varied
break;
}
Expand All @@ -76,8 +76,8 @@ function vtkPiecewiseFunction(publicAPI, model) {
return 'NonDecreasing';
case 2:
return 'NonIncreasing';
default:
case 3:
default:
return 'Varied';
}
};
Expand Down
12 changes: 6 additions & 6 deletions Sources/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function removeLeadingSlash(str) {
return str[0] === '/' ? str.substr(1) : str;
}

function fetchText(instance = {}, url, options = {}) {
function fetchText(instance, url, options = {}) {
return new Promise((resolve, reject) => {
const txt = getContent(url);
if (txt === null) {
Expand All @@ -34,7 +34,7 @@ function fetchText(instance = {}, url, options = {}) {
});
}

function fetchJSON(instance = {}, url, options = {}) {
function fetchJSON(instance, url, options = {}) {
return new Promise((resolve, reject) => {
const txt = getContent(removeLeadingSlash(url));
if (txt === null) {
Expand All @@ -45,7 +45,7 @@ function fetchJSON(instance = {}, url, options = {}) {
});
}

function fetchArray(instance = {}, baseURL, array, options = {}) {
function fetchArray(instance, baseURL, array, options = {}) {
return new Promise((resolve, reject) => {
const url = removeLeadingSlash(
[
Expand Down Expand Up @@ -105,10 +105,10 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {

// Done with the ref and work
delete array.ref;
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (instance.modified) {
if (instance?.modified) {
instance.modified();
}

Expand All @@ -119,7 +119,7 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {

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

function fetchImage(instance = {}, url, options = {}) {
function fetchImage(instance, url, options = {}) {
return new Promise((resolve, reject) => {
const img = getElement(url);
if (img) {
Expand Down
22 changes: 11 additions & 11 deletions Sources/IO/Core/DataAccessHelper/HttpDataAccessHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function fetchBinary(url, options = {}) {
});
}

function fetchArray(instance = {}, baseURL, array, options = {}) {
function fetchArray(instance, baseURL, array, options = {}) {
if (array.ref && !array.ref.pending) {
return new Promise((resolve, reject) => {
const url = [
Expand All @@ -73,7 +73,7 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {
xhr.onreadystatechange = (e) => {
if (xhr.readyState === 1) {
array.ref.pending = true;
if (++requestCount === 1 && instance.invokeBusy) {
if (++requestCount === 1 && instance?.invokeBusy) {
instance.invokeBusy(true);
}
}
Expand Down Expand Up @@ -117,10 +117,10 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {

// Done with the ref and work
delete array.ref;
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (instance.modified) {
if (instance?.modified) {
instance.modified();
}
resolve(array);
Expand All @@ -144,18 +144,18 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {

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

function fetchJSON(instance = {}, url, options = {}) {
function fetchJSON(instance, url, options = {}) {
return new Promise((resolve, reject) => {
const xhr = openAsyncXHR('GET', url, options);

xhr.onreadystatechange = (e) => {
if (xhr.readyState === 1) {
if (++requestCount === 1 && instance.invokeBusy) {
if (++requestCount === 1 && instance?.invokeBusy) {
instance.invokeBusy(true);
}
}
if (xhr.readyState === 4) {
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (xhr.status === 200 || xhr.status === 0) {
Expand All @@ -182,7 +182,7 @@ function fetchJSON(instance = {}, url, options = {}) {

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

function fetchText(instance = {}, url, options = {}) {
function fetchText(instance, url, options = {}) {
if (options && options.compression && options.compression !== 'gz') {
vtkErrorMacro('Supported algorithms are: [gz]');
vtkErrorMacro(`Unkown compression algorithm: ${options.compression}`);
Expand All @@ -193,12 +193,12 @@ function fetchText(instance = {}, url, options = {}) {

xhr.onreadystatechange = (e) => {
if (xhr.readyState === 1) {
if (++requestCount === 1 && instance.invokeBusy) {
if (++requestCount === 1 && instance?.invokeBusy) {
instance.invokeBusy(true);
}
}
if (xhr.readyState === 4) {
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (xhr.status === 200 || xhr.status === 0) {
Expand All @@ -223,7 +223,7 @@ function fetchText(instance = {}, url, options = {}) {

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

function fetchImage(instance = {}, url, options = {}) {
function fetchImage(instance, url, options = {}) {
return new Promise((resolve, reject) => {
const img = new Image();
if (options.crossOrigin) {
Expand Down
16 changes: 8 additions & 8 deletions Sources/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function create(createOptions) {
}
});
return {
fetchArray(instance = {}, baseURL, array, options = {}) {
fetchArray(instance, baseURL, array, options = {}) {
return new Promise((resolve, reject) => {
if (!ready) {
vtkErrorMacro('ERROR!!! zip not ready...');
Expand All @@ -124,17 +124,17 @@ function create(createOptions) {
].join('/')
);

if (++requestCount === 1 && instance.invokeBusy) {
if (++requestCount === 1 && instance?.invokeBusy) {
instance.invokeBusy(true);
}

function doneCleanUp() {
// Done with the ref and work
delete array.ref;
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (instance.modified) {
if (instance?.modified) {
instance.modified();
}
resolve(array);
Expand All @@ -153,7 +153,7 @@ function create(createOptions) {
});
},

fetchJSON(instance = {}, url, options = {}) {
fetchJSON(instance, url, options = {}) {
const path = cleanUpPath(url);
if (!ready) {
vtkErrorMacro('ERROR!!! zip not ready...');
Expand All @@ -177,7 +177,7 @@ function create(createOptions) {
.then((str) => Promise.resolve(JSON.parse(str)));
},

fetchText(instance = {}, url, options = {}) {
fetchText(instance, url, options = {}) {
const path = cleanUpPath(url);
if (!ready) {
vtkErrorMacro('ERROR!!! zip not ready...');
Expand All @@ -202,7 +202,7 @@ function create(createOptions) {
.then((str) => Promise.resolve(str));
},

fetchImage(instance = {}, url, options = {}) {
fetchImage(instance, url, options = {}) {
const path = cleanUpPath(url);
if (!ready) {
vtkErrorMacro('ERROR!!! zip not ready...');
Expand All @@ -222,7 +222,7 @@ function create(createOptions) {
});
},

fetchBinary(instance = {}, url, options = {}) {
fetchBinary(instance, url, options = {}) {
const path = cleanUpPath(url);
if (!ready) {
vtkErrorMacro('ERROR!!! zip not ready...');
Expand Down
22 changes: 11 additions & 11 deletions Sources/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function fetchBinary(url, options = {}) {
});
}

function fetchArray(instance = {}, baseURL, array, options = {}) {
function fetchArray(instance, baseURL, array, options = {}) {
if (options && options.compression) {
return REJECT_COMPRESSION();
}
Expand All @@ -69,7 +69,7 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {
xhr.onreadystatechange = (e) => {
if (xhr.readyState === 1) {
array.ref.pending = true;
if (++requestCount === 1 && instance.invokeBusy) {
if (++requestCount === 1 && instance?.invokeBusy) {
instance.invokeBusy(true);
}
}
Expand Down Expand Up @@ -101,10 +101,10 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {

// Done with the ref and work
delete array.ref;
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (instance.modified) {
if (instance?.modified) {
instance.modified();
}
resolve(array);
Expand All @@ -125,7 +125,7 @@ function fetchArray(instance = {}, baseURL, array, options = {}) {

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

function fetchJSON(instance = {}, url, options = {}) {
function fetchJSON(instance, url, options = {}) {
if (options && options.compression) {
return REJECT_COMPRESSION();
}
Expand All @@ -135,12 +135,12 @@ function fetchJSON(instance = {}, url, options = {}) {

xhr.onreadystatechange = (e) => {
if (xhr.readyState === 1) {
if (++requestCount === 1 && instance.invokeBusy) {
if (++requestCount === 1 && instance?.invokeBusy) {
instance.invokeBusy(true);
}
}
if (xhr.readyState === 4) {
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (xhr.status === 200 || xhr.status === 0) {
Expand All @@ -159,7 +159,7 @@ function fetchJSON(instance = {}, url, options = {}) {

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

function fetchText(instance = {}, url, options = {}) {
function fetchText(instance, url, options = {}) {
if (options && options.compression) {
return REJECT_COMPRESSION();
}
Expand All @@ -169,12 +169,12 @@ function fetchText(instance = {}, url, options = {}) {

xhr.onreadystatechange = (e) => {
if (xhr.readyState === 1) {
if (++requestCount === 1 && instance.invokeBusy) {
if (++requestCount === 1 && instance?.invokeBusy) {
instance.invokeBusy(true);
}
}
if (xhr.readyState === 4) {
if (--requestCount === 0 && instance.invokeBusy) {
if (--requestCount === 0 && instance?.invokeBusy) {
instance.invokeBusy(false);
}
if (xhr.status === 200 || xhr.status === 0) {
Expand All @@ -193,7 +193,7 @@ function fetchText(instance = {}, url, options = {}) {

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

function fetchImage(instance = {}, url, options = {}) {
function fetchImage(instance, url, options = {}) {
return new Promise((resolve, reject) => {
const img = new Image();
if (options.crossOrigin) {
Expand Down
10 changes: 2 additions & 8 deletions Sources/IO/Core/ImageStream/DefaultProtocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ export default function createMethods(session) {
session.call('viewport.image.animation.start', [viewId]),
stopAnimation: (viewId = -1) =>
session.call('viewport.image.animation.stop', [viewId]),
updateCamera: (
viewId = -1,
focalPoint,
viewUp,
position,
forceUpdate = true
) =>
updateCamera: (viewId, focalPoint, viewUp, position, forceUpdate = true) =>
session.call('viewport.camera.update', [
viewId,
viewId ?? -1,
focalPoint,
viewUp,
position,
Expand Down
Loading