zincjs 1.18.0 → 1.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/zinc.frontend.js +1 -1
- package/build/zinc.js +27 -23
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/loaders/primitivesLoader.js +7 -4
- package/src/scene.js +109 -86
- package/src/sceneLoader.js +0 -1
package/package.json
CHANGED
|
@@ -136,11 +136,12 @@ const IndexedSourcesHandler = function(urlIn, crossOrigin, onDownloadedCallback)
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
const MultiSourcesHandler = function(numberIn, onLoadCallback) {
|
|
139
|
+
const MultiSourcesHandler = function(numberIn, onLoadCallback, options) {
|
|
140
140
|
const allData = [];
|
|
141
141
|
const number = numberIn;
|
|
142
142
|
const onLoad = onLoadCallback;
|
|
143
143
|
let totalDownloaded = 0;
|
|
144
|
+
const isGlyphData = options.isGlyphsets;
|
|
144
145
|
|
|
145
146
|
this.itemDownloaded = (order, args) => {
|
|
146
147
|
allData[order]= args;
|
|
@@ -148,7 +149,7 @@ const MultiSourcesHandler = function(numberIn, onLoadCallback) {
|
|
|
148
149
|
if (totalDownloaded == number) {
|
|
149
150
|
if (allData.length > 0) {
|
|
150
151
|
//Assume when item length is one then it is a glyphset otherwise geometry
|
|
151
|
-
if (
|
|
152
|
+
if (!isGlyphData) {
|
|
152
153
|
const materials = allData[0][1];
|
|
153
154
|
const geometries = allData.map((data) => data[0]);
|
|
154
155
|
//All geometries will be merged into the first one
|
|
@@ -159,7 +160,9 @@ const MultiSourcesHandler = function(numberIn, onLoadCallback) {
|
|
|
159
160
|
}
|
|
160
161
|
onLoad(geometry, materials);
|
|
161
162
|
} else {
|
|
162
|
-
const glyphData = allData.map((item) =>
|
|
163
|
+
const glyphData = allData.map((item) => {
|
|
164
|
+
return JSON.parse(item[0])
|
|
165
|
+
});
|
|
163
166
|
mergeGlyphData(glyphData);
|
|
164
167
|
onLoad(glyphData[0]);
|
|
165
168
|
}
|
|
@@ -182,7 +185,7 @@ exports.PrimitivesLoader = function () {
|
|
|
182
185
|
//Load the first file then the rest will be handled separately
|
|
183
186
|
const loadFromMultipleSources = (urls, onLoad, onProgress, onError, options) => {
|
|
184
187
|
const number = urls.length;
|
|
185
|
-
const msHandler = new MultiSourcesHandler(number, onLoad);
|
|
188
|
+
const msHandler = new MultiSourcesHandler(number, onLoad, options);
|
|
186
189
|
//The order here will give us hint on the sequence on merging the primitives
|
|
187
190
|
let order = 0;
|
|
188
191
|
urls.forEach((url) => {
|
package/src/scene.js
CHANGED
|
@@ -13,7 +13,7 @@ const getUniqueId = function () {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const defaultMetadata = function() {
|
|
16
|
-
return {
|
|
16
|
+
return {
|
|
17
17
|
Duration: "6 secs",
|
|
18
18
|
OriginalDuration: "-",
|
|
19
19
|
TimeStamps: {}
|
|
@@ -23,11 +23,11 @@ const defaultMetadata = function() {
|
|
|
23
23
|
const defaultDuration = 6000;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* A Scene contains {@link Region},and
|
|
26
|
+
* A Scene contains {@link Region},and
|
|
27
27
|
* {@link CameraControls} which controls the viewport and additional features.
|
|
28
28
|
* It is the main object used for controlling what is and what is not displayed
|
|
29
29
|
* on the renderer.
|
|
30
|
-
*
|
|
30
|
+
*
|
|
31
31
|
* @class
|
|
32
32
|
* @param {Object} containerIn - Container to create the renderer on.
|
|
33
33
|
* @author Alan Wu
|
|
@@ -35,6 +35,7 @@ const defaultDuration = 6000;
|
|
|
35
35
|
*/
|
|
36
36
|
exports.Scene = function (containerIn, rendererIn) {
|
|
37
37
|
const container = containerIn;
|
|
38
|
+
let cameraHelper = undefined;
|
|
38
39
|
let videoHandler = undefined;
|
|
39
40
|
let sceneLoader = new SceneLoader(this);
|
|
40
41
|
let minimap = undefined;
|
|
@@ -97,7 +98,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
97
98
|
return container.width;
|
|
98
99
|
return 0;
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
+
|
|
101
102
|
const getDrawingHeight = () => {
|
|
102
103
|
if (container)
|
|
103
104
|
if (typeof container.clientHeight !== "undefined")
|
|
@@ -111,7 +112,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
111
112
|
* This function returns a three component array, which contains
|
|
112
113
|
* [totalsize, totalLoaded and errorDownload] of all the downloads happening
|
|
113
114
|
* in this scene.
|
|
114
|
-
* @returns {Array}
|
|
115
|
+
* @returns {Array}
|
|
115
116
|
*/
|
|
116
117
|
this.getDownloadProgress = () => {
|
|
117
118
|
return sceneLoader.getDownloadProgress();
|
|
@@ -128,7 +129,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
/**
|
|
131
|
-
* Reset the viewport of this scene to its original state.
|
|
132
|
+
* Reset the viewport of this scene to its original state.
|
|
132
133
|
*/
|
|
133
134
|
this.resetView = () => {
|
|
134
135
|
this.onWindowResize();
|
|
@@ -161,10 +162,10 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
161
162
|
setupCamera();
|
|
162
163
|
|
|
163
164
|
/**
|
|
164
|
-
* Load the viewport Data from the argument {@link Zinc.Viewport} and set it as
|
|
165
|
+
* Load the viewport Data from the argument {@link Zinc.Viewport} and set it as
|
|
165
166
|
* the default viewport of this scene.
|
|
166
|
-
*
|
|
167
|
-
* @param {Zinc.Viewport} viewData - Viewport data to be loaded.
|
|
167
|
+
*
|
|
168
|
+
* @param {Zinc.Viewport} viewData - Viewport data to be loaded.
|
|
168
169
|
*/
|
|
169
170
|
this.loadView = settings => {
|
|
170
171
|
const viewPort = new Viewport();
|
|
@@ -175,8 +176,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
175
176
|
|
|
176
177
|
/**
|
|
177
178
|
* Set up multiple views.
|
|
178
|
-
*
|
|
179
|
-
* @param {Zinc.Viewport} viewData - Viewport data to be loaded.
|
|
179
|
+
*
|
|
180
|
+
* @param {Zinc.Viewport} viewData - Viewport data to be loaded.
|
|
180
181
|
*/
|
|
181
182
|
this.setupMultipleViews = (defaultView, entries) => {
|
|
182
183
|
for (const [name, settings] of Object.entries(entries)) {
|
|
@@ -189,8 +190,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
189
190
|
|
|
190
191
|
/**
|
|
191
192
|
* Get the bounding box of all the object in this scene only.
|
|
192
|
-
*
|
|
193
|
-
* @returns {THREE.Box3}
|
|
193
|
+
*
|
|
194
|
+
* @returns {THREE.Box3}
|
|
194
195
|
*/
|
|
195
196
|
this.getBoundingBox = () => {
|
|
196
197
|
return rootRegion.getBoundingBox(true);
|
|
@@ -198,7 +199,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
198
199
|
|
|
199
200
|
/**
|
|
200
201
|
* Adjust the viewport to display the desired volume provided by the bounding box.
|
|
201
|
-
*
|
|
202
|
+
*
|
|
202
203
|
* @param {THREE.Box3} boundingBox - The bounding box which describes the volume of
|
|
203
204
|
* which we the viewport should be displaying.
|
|
204
205
|
*/
|
|
@@ -260,9 +261,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
260
261
|
rootRegion.forEachLine(callbackFunction, true);
|
|
261
262
|
}
|
|
262
263
|
|
|
263
|
-
/**
|
|
264
|
+
/**
|
|
264
265
|
* Find and return all geometries in this scene with the matching GroupName.
|
|
265
|
-
*
|
|
266
|
+
*
|
|
266
267
|
* @param {String} GroupName - Groupname to match with.
|
|
267
268
|
* @returns {Array}
|
|
268
269
|
*/
|
|
@@ -270,18 +271,18 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
270
271
|
return rootRegion.findGeometriesWithGroupName(GroupName, true);
|
|
271
272
|
}
|
|
272
273
|
|
|
273
|
-
/**
|
|
274
|
+
/**
|
|
274
275
|
* Find and return all pointsets in this scene with the matching GroupName.
|
|
275
|
-
*
|
|
276
|
+
*
|
|
276
277
|
* @param {String} GroupName - Groupname to match with.
|
|
277
278
|
* @returns {Array}
|
|
278
279
|
*/
|
|
279
280
|
this.findPointsetsWithGroupName = GroupName => {
|
|
280
281
|
return rootRegion.findPointsetsWithGroupName(GroupName, true);
|
|
281
282
|
}
|
|
282
|
-
/**
|
|
283
|
+
/**
|
|
283
284
|
* Find and return all glyphsets in this scene with the matching GroupName.
|
|
284
|
-
*
|
|
285
|
+
*
|
|
285
286
|
* @param {String} GroupName - Groupname to match with.
|
|
286
287
|
* @returns {Array}
|
|
287
288
|
*/
|
|
@@ -289,9 +290,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
289
290
|
return rootRegion.findGlyphsetsWithGroupName(GroupName, true);
|
|
290
291
|
}
|
|
291
292
|
|
|
292
|
-
/**
|
|
293
|
+
/**
|
|
293
294
|
* Find and return all lines in this scene with the matching GroupName.
|
|
294
|
-
*
|
|
295
|
+
*
|
|
295
296
|
* @param {String} GroupName - Groupname to match with.
|
|
296
297
|
* @returns {Array}
|
|
297
298
|
*/
|
|
@@ -299,11 +300,11 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
299
300
|
return rootRegion.findLinesWithGroupName(GroupName, true);
|
|
300
301
|
}
|
|
301
302
|
|
|
302
|
-
/**
|
|
303
|
+
/**
|
|
303
304
|
* Find a list of objects with the specified name, this will
|
|
304
305
|
* tranverse through the region tree to find all child objects
|
|
305
306
|
* with matching name.
|
|
306
|
-
*
|
|
307
|
+
*
|
|
307
308
|
* @param {String} GroupName - Groupname to match with.
|
|
308
309
|
* @returns {Array}
|
|
309
310
|
*/
|
|
@@ -315,9 +316,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
315
316
|
return rootRegion.findObjectsWithAnatomicalId(anatomicalId, true);
|
|
316
317
|
}
|
|
317
318
|
|
|
318
|
-
/**
|
|
319
|
+
/**
|
|
319
320
|
* Get the bounding box of all zinc objects in list.
|
|
320
|
-
*
|
|
321
|
+
*
|
|
321
322
|
* @param {Array} objectsArray - Groupname to match with.
|
|
322
323
|
* @returns {THREE.Box3}
|
|
323
324
|
*/
|
|
@@ -335,9 +336,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
335
336
|
return boundingBox;
|
|
336
337
|
}
|
|
337
338
|
|
|
338
|
-
/**
|
|
339
|
+
/**
|
|
339
340
|
* Convert the vector3 into screen coordinates.
|
|
340
|
-
*
|
|
341
|
+
*
|
|
341
342
|
* @param {THREE.Vector3} point - Vector 3 containing the point to convert,
|
|
342
343
|
* this vector will be overwritten with the returned value.
|
|
343
344
|
* @param {Array} objectsArray - Groupname to match with.
|
|
@@ -354,9 +355,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
354
355
|
return point;
|
|
355
356
|
}
|
|
356
357
|
|
|
357
|
-
/**
|
|
358
|
+
/**
|
|
358
359
|
* Get the screen coordinate of the centroid of provided list of objects.
|
|
359
|
-
*
|
|
360
|
+
*
|
|
360
361
|
* @param {Array} zincObjects - List of {@link ZincObject}.
|
|
361
362
|
* @returns {THREE.Vector3}
|
|
362
363
|
*/
|
|
@@ -370,10 +371,10 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
370
371
|
return undefined;
|
|
371
372
|
}
|
|
372
373
|
|
|
373
|
-
/**
|
|
374
|
-
* Get the screen coordinate of the centroid of all objects
|
|
374
|
+
/**
|
|
375
|
+
* Get the screen coordinate of the centroid of all objects
|
|
375
376
|
* in scene with the provided name.
|
|
376
|
-
*
|
|
377
|
+
*
|
|
377
378
|
* @param {String} name - List of {@link ZincObject}.
|
|
378
379
|
* @returns {THREE.Vector3}
|
|
379
380
|
*/
|
|
@@ -382,9 +383,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
382
383
|
return this.getObjectsScreenXY(zincObjects);
|
|
383
384
|
};
|
|
384
385
|
|
|
385
|
-
/**
|
|
386
|
+
/**
|
|
386
387
|
* Add zinc object into the root {@link Region} of sfcene.
|
|
387
|
-
*
|
|
388
|
+
*
|
|
388
389
|
* @param {ZincObject} - zinc object ot be added.
|
|
389
390
|
* @returns {THREE.Vector3}
|
|
390
391
|
*/
|
|
@@ -398,8 +399,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
398
399
|
|
|
399
400
|
/**
|
|
400
401
|
* Load a glyphset into this scene object.
|
|
401
|
-
*
|
|
402
|
-
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
402
|
+
*
|
|
403
|
+
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
403
404
|
* and others for each of the glyph in the glyphsset.
|
|
404
405
|
* @param {String} glyphurl - regular json model file providing geometry of the glyph.
|
|
405
406
|
* @param {String} groupName - name to assign the glyphset's groupname to.
|
|
@@ -412,8 +413,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
412
413
|
|
|
413
414
|
/**
|
|
414
415
|
* Load a pointset into this scene object.
|
|
415
|
-
*
|
|
416
|
-
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
416
|
+
*
|
|
417
|
+
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
417
418
|
* and others for each of the glyph in the glyphsset.
|
|
418
419
|
* @param {Boolean} timeEnabled - Indicate if morphing is enabled.
|
|
419
420
|
* @param {Boolean} morphColour - Indicate if color morphing is enabled.
|
|
@@ -427,8 +428,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
427
428
|
|
|
428
429
|
/**
|
|
429
430
|
* Load lines into this scene object.
|
|
430
|
-
*
|
|
431
|
-
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
431
|
+
*
|
|
432
|
+
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
432
433
|
* and others for each of the glyph in the glyphsset.
|
|
433
434
|
* @param {Boolean} timeEnabled - Indicate if morphing is enabled.
|
|
434
435
|
* @param {Boolean} morphColour - Indicate if color morphing is enabled.
|
|
@@ -442,8 +443,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
442
443
|
|
|
443
444
|
/**
|
|
444
445
|
* Read a STL file into this scene, the geometry will be presented as
|
|
445
|
-
* {@link Zinc.Geometry}.
|
|
446
|
-
*
|
|
446
|
+
* {@link Zinc.Geometry}.
|
|
447
|
+
*
|
|
447
448
|
* @param {STRING} url - location to the STL file.
|
|
448
449
|
* @param {STRING} groupName - name to assign the geometry's groupname to.
|
|
449
450
|
* @param {Function} finishCallback - Callback function which will be called
|
|
@@ -455,8 +456,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
455
456
|
|
|
456
457
|
/**
|
|
457
458
|
* Read a OBJ file into this scene, the geometry will be presented as
|
|
458
|
-
* {@link Zinc.Geometry}.
|
|
459
|
-
*
|
|
459
|
+
* {@link Zinc.Geometry}.
|
|
460
|
+
*
|
|
460
461
|
* @param {STRING} url - location to the STL file.
|
|
461
462
|
* @param {STRING} groupName - name to assign the geometry's groupname to.
|
|
462
463
|
* @param {Function} finishCallback - Callback function which will be called
|
|
@@ -469,7 +470,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
469
470
|
/**
|
|
470
471
|
* Load a metadata file from the provided URL into this scene. Once
|
|
471
472
|
* succssful scene proceeds to read each items into scene for visualisations.
|
|
472
|
-
*
|
|
473
|
+
*
|
|
473
474
|
* @param {String} url - Location of the metafile
|
|
474
475
|
* @param {Function} finishCallback - Callback function which will be called
|
|
475
476
|
* for each glyphset and geometry that has been written in.
|
|
@@ -483,7 +484,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
483
484
|
/**
|
|
484
485
|
* Load a legacy model(s) format with the provided URLs and parameters. This only loads the geometry
|
|
485
486
|
* without any of the metadata. Therefore, extra parameters should be provided.
|
|
486
|
-
*
|
|
487
|
+
*
|
|
487
488
|
* @deprecated
|
|
488
489
|
*/
|
|
489
490
|
this.loadModelsURL = (urls, colours, opacities, timeEnabled, morphColour, finishCallback) => {
|
|
@@ -499,10 +500,10 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
499
500
|
}
|
|
500
501
|
|
|
501
502
|
/**
|
|
502
|
-
* Load a legacy file format containing the viewport and its meta file from an external
|
|
503
|
+
* Load a legacy file format containing the viewport and its meta file from an external
|
|
503
504
|
* location provided by the url. Use the new metadata format with
|
|
504
505
|
* {@link Zinc.Scene#loadMetadataURL} instead.
|
|
505
|
-
*
|
|
506
|
+
*
|
|
506
507
|
* @param {String} URL - address to the file containing viewport and model information.
|
|
507
508
|
* @deprecated
|
|
508
509
|
*/
|
|
@@ -547,9 +548,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
547
548
|
return videoHandler.getCurrentTime(duration);
|
|
548
549
|
}
|
|
549
550
|
const time = rootRegion.getCurrentTime();
|
|
550
|
-
if (time !== -1)
|
|
551
|
+
if (time !== -1)
|
|
551
552
|
return time;
|
|
552
|
-
|
|
553
|
+
|
|
553
554
|
return 0;
|
|
554
555
|
}
|
|
555
556
|
|
|
@@ -566,7 +567,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
566
567
|
|
|
567
568
|
/**
|
|
568
569
|
* Check if any object in this scene is time varying.
|
|
569
|
-
*
|
|
570
|
+
*
|
|
570
571
|
* @return {Boolean}
|
|
571
572
|
*/
|
|
572
573
|
this.isTimeVarying = () => {
|
|
@@ -681,8 +682,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
681
682
|
renderer.getSize(_markerTarget);
|
|
682
683
|
if (this.minimapScissor.updateRequired) {
|
|
683
684
|
scissor = getWindowsPosition(this.minimapScissor.align,
|
|
684
|
-
this.minimapScissor.x_offset,
|
|
685
|
-
this.minimapScissor.y_offset,
|
|
685
|
+
this.minimapScissor.x_offset,
|
|
686
|
+
this.minimapScissor.y_offset,
|
|
686
687
|
this.minimapScissor.width,
|
|
687
688
|
this.minimapScissor.height,
|
|
688
689
|
_markerTarget.x, _markerTarget.y);
|
|
@@ -697,7 +698,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
697
698
|
scissor.x,
|
|
698
699
|
scissor.y,
|
|
699
700
|
this.minimapScissor.width,
|
|
700
|
-
this.minimapScissor.height);
|
|
701
|
+
this.minimapScissor.height);
|
|
701
702
|
minimap.updateCamera();
|
|
702
703
|
if (this.displayMiniAxes) {
|
|
703
704
|
renderer.render(miniAxesScene, minimap.camera);
|
|
@@ -728,8 +729,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
728
729
|
|
|
729
730
|
/**
|
|
730
731
|
* Enable or disable interactive control, this is on by default.
|
|
731
|
-
*
|
|
732
|
-
* @param {Boolean} flag - Indicate either interactive control
|
|
732
|
+
*
|
|
733
|
+
* @param {Boolean} flag - Indicate either interactive control
|
|
733
734
|
* should be enabled or disabled.
|
|
734
735
|
*/
|
|
735
736
|
this.setInteractiveControlEnable = flag => {
|
|
@@ -777,7 +778,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
777
778
|
|
|
778
779
|
/**
|
|
779
780
|
* Enable or disable stereo effect of this scene.
|
|
780
|
-
* @param {Boolean} stereoFlag - Indicate either stereo effect control
|
|
781
|
+
* @param {Boolean} stereoFlag - Indicate either stereo effect control
|
|
781
782
|
* should be enabled or disabled.
|
|
782
783
|
*/
|
|
783
784
|
this.setStereoEffectEnable = stereoFlag => {
|
|
@@ -794,7 +795,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
794
795
|
|
|
795
796
|
/**
|
|
796
797
|
* Check rather object is in scene.
|
|
797
|
-
*
|
|
798
|
+
*
|
|
798
799
|
* @return {Boolean}
|
|
799
800
|
*/
|
|
800
801
|
this.objectIsInScene = zincObject => {
|
|
@@ -802,10 +803,10 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
802
803
|
}
|
|
803
804
|
|
|
804
805
|
/**
|
|
805
|
-
* Rotate the camera view to view the entirety of the
|
|
806
|
+
* Rotate the camera view to view the entirety of the
|
|
806
807
|
* bounding box with a smooth transition within the providied
|
|
807
808
|
* transitionTime.
|
|
808
|
-
*
|
|
809
|
+
*
|
|
809
810
|
* @param {THREE.Box3} boundingBox - the bounding box to target
|
|
810
811
|
* @param {Number} transitionTime - Duration to perform the transition.
|
|
811
812
|
*/
|
|
@@ -837,10 +838,10 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
837
838
|
|
|
838
839
|
|
|
839
840
|
/**
|
|
840
|
-
* Translate the camera view to the center of the
|
|
841
|
+
* Translate the camera view to the center of the
|
|
841
842
|
* bounding box with a smooth transition within the providied
|
|
842
843
|
* transitionTime.
|
|
843
|
-
*
|
|
844
|
+
*
|
|
844
845
|
* @param {THREE.Box3} boundingBox - the bounding box to target
|
|
845
846
|
* @param {Number} transitionTime - Duration to perform the transition.
|
|
846
847
|
*/
|
|
@@ -858,9 +859,9 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
858
859
|
}
|
|
859
860
|
|
|
860
861
|
/**
|
|
861
|
-
* Transition the camera into viewing the zinc object wiexports.Scene.alignBoundingBoxToCameraViewth a
|
|
862
|
+
* Transition the camera into viewing the zinc object wiexports.Scene.alignBoundingBoxToCameraViewth a
|
|
862
863
|
* smooth transition within the providied transitionTime.
|
|
863
|
-
*
|
|
864
|
+
*
|
|
864
865
|
* @param {ZincObject} zincObject - the bounding box to target
|
|
865
866
|
* @param {Number} transitionTime - Duration to perform the transition.
|
|
866
867
|
*/
|
|
@@ -873,7 +874,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
873
874
|
|
|
874
875
|
/**
|
|
875
876
|
* Set the camera to point to the centroid of the zinc object.
|
|
876
|
-
*
|
|
877
|
+
*
|
|
877
878
|
* @param {ZincObject} zincObject - the bounding box to target
|
|
878
879
|
*/
|
|
879
880
|
this.setCameraTargetToObject = zincObject => {
|
|
@@ -939,7 +940,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
939
940
|
this.getPickableThreeJSObjects = () => {
|
|
940
941
|
//The list will only be updated if changes have been made
|
|
941
942
|
//in region or a flag has been raise
|
|
942
|
-
if (this.forcePickableObjectsUpdate ||
|
|
943
|
+
if (this.forcePickableObjectsUpdate ||
|
|
943
944
|
rootRegion.checkPickableUpdateRequred(true)) {
|
|
944
945
|
this.updatePickableThreeJSObjects();
|
|
945
946
|
}
|
|
@@ -948,7 +949,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
948
949
|
|
|
949
950
|
/**
|
|
950
951
|
* Get the Normalised coordinates on minimap if mouse event is
|
|
951
|
-
* inside the minimap
|
|
952
|
+
* inside the minimap
|
|
952
953
|
*/
|
|
953
954
|
this.getNormalisedMinimapCoordinates = (renderer, event) => {
|
|
954
955
|
if (this.displayMinimap) {
|
|
@@ -956,7 +957,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
956
957
|
renderer.getSize(target);
|
|
957
958
|
let offsetY = target.y - event.clientY;
|
|
958
959
|
if (((scissor.x + this.minimapScissor.width) > event.clientX) &&
|
|
959
|
-
(event.clientX > scissor.x) &&
|
|
960
|
+
(event.clientX > scissor.x) &&
|
|
960
961
|
((scissor.y + this.minimapScissor.height) > offsetY) &&
|
|
961
962
|
(offsetY > scissor.y)) {
|
|
962
963
|
let x = ((event.clientX - scissor.x) /
|
|
@@ -1005,7 +1006,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1005
1006
|
this.addMetadataTimeStamp = (key, time) => {
|
|
1006
1007
|
metadata["TimeStamps"][key] = convertDurationObjectTomSec(time);
|
|
1007
1008
|
}
|
|
1008
|
-
|
|
1009
|
+
|
|
1009
1010
|
/**
|
|
1010
1011
|
* Get a specific metadata field.
|
|
1011
1012
|
*/
|
|
@@ -1048,8 +1049,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1048
1049
|
this.setDuration(defaultDuration);
|
|
1049
1050
|
}
|
|
1050
1051
|
|
|
1051
|
-
// Turn the object into a readable string {years: years,months: months,
|
|
1052
|
-
// weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
|
|
1052
|
+
// Turn the object into a readable string {years: years,months: months,
|
|
1053
|
+
// weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
|
|
1053
1054
|
const convertDurationObjectToString = duration => {
|
|
1054
1055
|
return [
|
|
1055
1056
|
...(duration.years ? [`${duration.years}years`] : []),
|
|
@@ -1062,8 +1063,8 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1062
1063
|
].join(' ');
|
|
1063
1064
|
}
|
|
1064
1065
|
|
|
1065
|
-
// Turn the object into a number representing milliesecond {years: years,months: months,
|
|
1066
|
-
// weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
|
|
1066
|
+
// Turn the object into a number representing milliesecond {years: years,months: months,
|
|
1067
|
+
// weeks: weeks, days: days, hours: hours, mins: mins, secs: secs }
|
|
1067
1068
|
const convertDurationObjectTomSec = duration => {
|
|
1068
1069
|
return duration.years ? duration.years * 31536000000 : 0 +
|
|
1069
1070
|
duration.months ? duration.months * 2592000000 : 0 +
|
|
@@ -1076,7 +1077,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1076
1077
|
|
|
1077
1078
|
// Set the readable duration and timer using an object
|
|
1078
1079
|
// with the following format {years: years,months: months, weeks: weeks, days: days,
|
|
1079
|
-
// hours: hours, mins: mins, secs: secs }
|
|
1080
|
+
// hours: hours, mins: mins, secs: secs }
|
|
1080
1081
|
this.setDurationFromObject = duration => {
|
|
1081
1082
|
const string = convertDurationObjectToString(duration);
|
|
1082
1083
|
const millisec = convertDurationObjectTomSec(duration);
|
|
@@ -1086,7 +1087,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1086
1087
|
|
|
1087
1088
|
// Set the readable original duration using an object
|
|
1088
1089
|
// with the following format {years: years,months: months, weeks: weeks, days: days,
|
|
1089
|
-
// hours: hours, mins: mins, secs: secs }
|
|
1090
|
+
// hours: hours, mins: mins, secs: secs }
|
|
1090
1091
|
this.setOriginalDurationFromObject = duration => {
|
|
1091
1092
|
const string = convertDurationObjectToString(duration);
|
|
1092
1093
|
this.setMetadataTag("OriginalDuration", string);
|
|
@@ -1095,10 +1096,10 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1095
1096
|
/**
|
|
1096
1097
|
* Export the scene in GLTF format, it can either return it in
|
|
1097
1098
|
* string or binary form.
|
|
1098
|
-
*
|
|
1099
|
+
*
|
|
1099
1100
|
* @param {Boolean} binary - Indicate it should be exported as binary or
|
|
1100
1101
|
* text.
|
|
1101
|
-
*
|
|
1102
|
+
*
|
|
1102
1103
|
* @return {Promise} The exported data if the promise resolve successfully
|
|
1103
1104
|
*/
|
|
1104
1105
|
this.exportGLTF = (binary) => {
|
|
@@ -1108,7 +1109,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1108
1109
|
|
|
1109
1110
|
/**
|
|
1110
1111
|
* Get the root region of the scene.
|
|
1111
|
-
*
|
|
1112
|
+
*
|
|
1112
1113
|
* @return {Region} Return the root region of the scene
|
|
1113
1114
|
*/
|
|
1114
1115
|
this.getRootRegion = () => {
|
|
@@ -1116,7 +1117,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1116
1117
|
}
|
|
1117
1118
|
|
|
1118
1119
|
/**
|
|
1119
|
-
* Create points in region specified in the path
|
|
1120
|
+
* Create points in region specified in the path
|
|
1120
1121
|
*
|
|
1121
1122
|
*/
|
|
1122
1123
|
this.createLines = ( regionPath, groupName, coords, colour ) => {
|
|
@@ -1128,7 +1129,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1128
1129
|
}
|
|
1129
1130
|
|
|
1130
1131
|
/**
|
|
1131
|
-
* Create points in region specified in the path
|
|
1132
|
+
* Create points in region specified in the path
|
|
1132
1133
|
*
|
|
1133
1134
|
*/
|
|
1134
1135
|
this.createPoints = ( regionPath, groupName, coords, labels, colour ) => {
|
|
@@ -1142,7 +1143,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1142
1143
|
/**
|
|
1143
1144
|
* Add a callback function which will be called everytime zinc object is added.
|
|
1144
1145
|
* @param {Function} callbackFunction - callbackFunction to be added.
|
|
1145
|
-
*
|
|
1146
|
+
*
|
|
1146
1147
|
* @return {Number}
|
|
1147
1148
|
*/
|
|
1148
1149
|
this.addZincObjectAddedCallbacks = callbackFunction => {
|
|
@@ -1154,7 +1155,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1154
1155
|
/**
|
|
1155
1156
|
* Add a callback function which will be called everytime zinc object is removed.
|
|
1156
1157
|
* @param {Function} callbackFunction - callbackFunction to be added.
|
|
1157
|
-
*
|
|
1158
|
+
*
|
|
1158
1159
|
* @return {Number}
|
|
1159
1160
|
*/
|
|
1160
1161
|
this.addZincObjectRemovedCallbacks = callbackFunction => {
|
|
@@ -1162,7 +1163,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1162
1163
|
zincObjectRemovedCallbacks[zincObjectRemovedCallbacks_id] = callbackFunction;
|
|
1163
1164
|
return zincObjectRemovedCallbacks_id;
|
|
1164
1165
|
}
|
|
1165
|
-
|
|
1166
|
+
|
|
1166
1167
|
/**
|
|
1167
1168
|
* Remove a callback function that is previously added to the scene.
|
|
1168
1169
|
* @param {Number} id - identifier of the previously added callback function.
|
|
@@ -1248,6 +1249,28 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1248
1249
|
return line;
|
|
1249
1250
|
}
|
|
1250
1251
|
|
|
1252
|
+
|
|
1253
|
+
/*
|
|
1254
|
+
* Display frustum
|
|
1255
|
+
*/
|
|
1256
|
+
this.enableFrustumDisplay = () => {
|
|
1257
|
+
if (this.camera && !cameraHelper) {
|
|
1258
|
+
cameraHelper = new THREE.CameraHelper(this.camera);
|
|
1259
|
+
scene.add(cameraHelper);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/*
|
|
1264
|
+
* Hide frustum
|
|
1265
|
+
*/
|
|
1266
|
+
this.disableFrustumDisplay = () => {
|
|
1267
|
+
if (cameraHelper) {
|
|
1268
|
+
scene.remove(cameraHelper);
|
|
1269
|
+
cameraHelper.dispose();
|
|
1270
|
+
cameraHelper = undefined;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1251
1274
|
/*
|
|
1252
1275
|
* Remove object from temporary objects list
|
|
1253
1276
|
*/
|
|
@@ -1371,7 +1394,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1371
1394
|
if (axisDisplay.main) {
|
|
1372
1395
|
this.enableAxisDisplay(false, false);
|
|
1373
1396
|
axisDisplay.main.forEach(axis => {
|
|
1374
|
-
if (axis.dispose) {
|
|
1397
|
+
if (axis.dispose) {
|
|
1375
1398
|
axis.dispose();
|
|
1376
1399
|
}
|
|
1377
1400
|
});
|
|
@@ -1379,7 +1402,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1379
1402
|
if (axisDisplay.mini) {
|
|
1380
1403
|
this.enableAxisDisplay(false, true);
|
|
1381
1404
|
axisDisplay.mini.forEach(axis => {
|
|
1382
|
-
if (axis.dispose) {
|
|
1405
|
+
if (axis.dispose) {
|
|
1383
1406
|
axis.dispose();
|
|
1384
1407
|
}
|
|
1385
1408
|
});
|
package/src/sceneLoader.js
CHANGED
|
@@ -263,7 +263,6 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
263
263
|
if (typeof glyphsetData === 'string' || glyphsetData instanceof String) {
|
|
264
264
|
glyphsetData = JSON.parse(data);
|
|
265
265
|
}
|
|
266
|
-
console.log("glyphsetData", glyphsetData)
|
|
267
266
|
let isInline = (options && options.isInline) ? options.isInline : undefined;
|
|
268
267
|
let anatomicalId = (options && options.anatomicalId) ? options.anatomicalId : undefined;
|
|
269
268
|
let displayLabels = (options && options.displayLabels) ? options.displayLabels : undefined;
|