Skip to content

Commit 17e04bf

Browse files
author
hackermd
committed
Update unit tests
1 parent 20240dd commit 17e04bf

File tree

4 files changed

+2271
-37
lines changed

4 files changed

+2271
-37
lines changed

build/dicom-microscopy-viewer.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50172,6 +50172,7 @@
5017250172

5017350173
var DICOMwebClient = unwrapExports(dicomwebClient);
5017450174

50175+
const _usewebgl = Symbol('usewebgl');
5017550176
const _map = Symbol('map');
5017650177
const _features = Symbol('features');
5017750178
const _drawingSource = Symbol('drawingSource');
@@ -50189,6 +50190,7 @@
5018950190
* options:
5019050191
* - client (instance of DICOMwebClient)
5019150192
* - metadata (array of DICOM JSON metadata for each image instance)
50193+
* - useWebGL (whether WebGL renderer should be used; default: true)
5019250194
* - onClickHandler (on-event handler function)
5019350195
* - onSingleClickHandler (on-event handler function)
5019450196
* - onDoubleClickHandler (on-event handler function)
@@ -50207,6 +50209,11 @@
5020750209
* - pixel
5020850210
*/
5020950211
constructor(options) {
50212+
if ('useWebGL' in options) {
50213+
this[_usewebgl] = options.useWebGL;
50214+
} else {
50215+
this[_usewebgl] = true;
50216+
}
5021050217
this[_client] = options.client;
5021150218

5021250219
// Collection of Openlayers "VectorLayer" instances indexable by
@@ -50266,7 +50273,6 @@
5026650273
return 0;
5026750274
}
5026850275
});
50269-
console.log(this[_pyramid]);
5027050276

5027150277
/*
5027250278
* Collect relevant information from DICOM metadata for each pyramid
@@ -50563,14 +50569,25 @@
5056350569
* Creates the map with the defined layers and view and renders it via
5056450570
* WebGL.
5056550571
*/
50566-
this[_map] = new WebGLMap({
50567-
layers: [imageLayer, this[_drawingLayer]],
50568-
view: view,
50569-
controls: [],
50570-
loadTilesWhileAnimating: true,
50571-
loadTilesWhileInteracting: true,
50572-
logo: false
50573-
});
50572+
if (this[_usewebgl]) {
50573+
this[_map] = new WebGLMap({
50574+
layers: [imageLayer, this[_drawingLayer]],
50575+
view: view,
50576+
controls: [],
50577+
loadTilesWhileAnimating: true,
50578+
loadTilesWhileInteracting: true,
50579+
logo: false
50580+
});
50581+
} else {
50582+
this[_map] = new Map({
50583+
layers: [imageLayer, this[_drawingLayer]],
50584+
view: view,
50585+
controls: [],
50586+
loadTilesWhileAnimating: true,
50587+
loadTilesWhileInteracting: true,
50588+
logo: false
50589+
});
50590+
}
5057450591
for (let control in this[_controls]) {
5057550592
// options.controls
5057650593
// TODO: enable user to select controls and style them

src/api.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function _scoordCoordinates2geometryCoordinates(coordinates) {
109109
}
110110

111111

112+
const _usewebgl = Symbol('usewebgl');
112113
const _map = Symbol('map');
113114
const _features = Symbol('features');
114115
const _drawingSource = Symbol('drawingSource');
@@ -126,6 +127,7 @@ class VLWholeSlideMicroscopyImageViewer {
126127
* options:
127128
* - client (instance of DICOMwebClient)
128129
* - metadata (array of DICOM JSON metadata for each image instance)
130+
* - useWebGL (whether WebGL renderer should be used; default: true)
129131
* - onClickHandler (on-event handler function)
130132
* - onSingleClickHandler (on-event handler function)
131133
* - onDoubleClickHandler (on-event handler function)
@@ -144,6 +146,11 @@ class VLWholeSlideMicroscopyImageViewer {
144146
* - pixel
145147
*/
146148
constructor(options) {
149+
if ('useWebGL' in options) {
150+
this[_usewebgl] = options.useWebGL;
151+
} else {
152+
this[_usewebgl] = true;
153+
}
147154
this[_client] = options.client;
148155

149156
// Collection of Openlayers "VectorLayer" instances indexable by
@@ -509,14 +516,25 @@ class VLWholeSlideMicroscopyImageViewer {
509516
* Creates the map with the defined layers and view and renders it via
510517
* WebGL.
511518
*/
512-
this[_map] = new WebGLMap({
513-
layers: [imageLayer, this[_drawingLayer]],
514-
view: view,
515-
controls: [],
516-
loadTilesWhileAnimating: true,
517-
loadTilesWhileInteracting: true,
518-
logo: false
519-
});
519+
if (this[_usewebgl]) {
520+
this[_map] = new WebGLMap({
521+
layers: [imageLayer, this[_drawingLayer]],
522+
view: view,
523+
controls: [],
524+
loadTilesWhileAnimating: true,
525+
loadTilesWhileInteracting: true,
526+
logo: false
527+
});
528+
} else {
529+
this[_map] = new Map({
530+
layers: [imageLayer, this[_drawingLayer]],
531+
view: view,
532+
controls: [],
533+
loadTilesWhileAnimating: true,
534+
loadTilesWhileInteracting: true,
535+
logo: false
536+
});
537+
}
520538
for (let control in this[_controls]) {
521539
// options.controls
522540
// TODO: enable user to select controls and style them

0 commit comments

Comments
 (0)