zincjs 1.18.4 → 1.18.6
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 +24 -24
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/glyph.js +4 -4
- package/src/primitives/glyphset.js +29 -18
- package/src/sceneLoader.js +5 -5
package/package.json
CHANGED
package/src/primitives/glyph.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const THREE = require('three');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Zinc representation of glyph graphic, it contains the colours,
|
|
4
|
+
* Zinc representation of glyph graphic, it contains the colours,
|
|
5
5
|
* geometry and transformation of the glyph.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* @param {THREE.Geometry} geometry - Geometry of the glyph .
|
|
8
8
|
* @param {THREE.Material} materialIn - Material of the glyph.
|
|
9
9
|
* @param {Number} idIn - Id of the glyph.
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* @class
|
|
12
12
|
* @author Alan Wu
|
|
13
13
|
* @return {Glyph}
|
|
@@ -153,7 +153,7 @@ const Glyph = function (geometry, materialIn, idIn, glyphsetIn) {
|
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* Set the color of the glyph and its label.
|
|
156
|
-
*
|
|
156
|
+
*
|
|
157
157
|
* @param {THREE.Color} color - Colour to be set.
|
|
158
158
|
*/
|
|
159
159
|
this.setColour = (color) => {
|
|
@@ -2,11 +2,11 @@ const THREE = require('three');
|
|
|
2
2
|
const JSONLoader = require('../loaders/JSONLoader').JSONLoader;
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* This is a container of {@link Glyph} and their graphical properties
|
|
5
|
+
* This is a container of {@link Glyph} and their graphical properties
|
|
6
6
|
* including transformations, colors, number of time steps, duration of animations
|
|
7
7
|
* and group name. Please note that all glyphs in the glyphset share the same geometry
|
|
8
8
|
* however they may have different transformations.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* @class
|
|
11
11
|
* @author Alan Wu
|
|
12
12
|
* @return {Glyphset}
|
|
@@ -51,10 +51,10 @@ const Glyphset = function () {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* Copy glyphset data into this glyphset then load the glyph's geoemtry
|
|
54
|
+
* Copy glyphset data into this glyphset then load the glyph's geoemtry
|
|
55
55
|
* with the provided glyphURL. FinishCallback will be called once
|
|
56
56
|
* glyph is loaded.
|
|
57
|
-
*
|
|
57
|
+
*
|
|
58
58
|
* @param {Array} glyphsetData - contains the informations about the glyphs.
|
|
59
59
|
* @param {String} glyphURL - URL to the geometry which will be applied to all
|
|
60
60
|
* all the glyphs in the glyphset once loaded.
|
|
@@ -96,9 +96,9 @@ const Glyphset = function () {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Calculate the actual transformation value that can be applied
|
|
99
|
+
* Calculate the actual transformation value that can be applied
|
|
100
100
|
* to the transformation matrix.
|
|
101
|
-
*
|
|
101
|
+
*
|
|
102
102
|
* @returns {Array}
|
|
103
103
|
*/
|
|
104
104
|
const resolve_glyph_axes = (point, axis1, axis2, axis3, scale, return_arrays) => {
|
|
@@ -130,7 +130,7 @@ const Glyphset = function () {
|
|
|
130
130
|
mirrored_axis3[j] = -final_axis3[j];
|
|
131
131
|
mirrored_point[j] = final_point[j];
|
|
132
132
|
if (scale[0] < 0.0) {
|
|
133
|
-
// shift glyph origin to end of axis1
|
|
133
|
+
// shift glyph origin to end of axis1
|
|
134
134
|
final_point[j] -= final_axis1[j];
|
|
135
135
|
mirrored_point[j] -= mirrored_axis1[j];
|
|
136
136
|
}
|
|
@@ -395,6 +395,17 @@ const Glyphset = function () {
|
|
|
395
395
|
}
|
|
396
396
|
};
|
|
397
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Get the assigned label for instance at index
|
|
400
|
+
*/
|
|
401
|
+
this.getLabel = (index) => {
|
|
402
|
+
if (labels && labels.length > index) {
|
|
403
|
+
return labels[index];
|
|
404
|
+
}
|
|
405
|
+
return undefined;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
|
|
398
409
|
/**
|
|
399
410
|
* Display the label of the glyphs in the glyphset.
|
|
400
411
|
*/
|
|
@@ -415,7 +426,7 @@ const Glyphset = function () {
|
|
|
415
426
|
|
|
416
427
|
/**
|
|
417
428
|
* Create the glyphs in the glyphset.
|
|
418
|
-
*
|
|
429
|
+
*
|
|
419
430
|
* @param {Boolean} displayLabels -Flag to determine either the labels should be display or not.
|
|
420
431
|
*/
|
|
421
432
|
const createGlyphs = (displayLabels) => {
|
|
@@ -448,7 +459,7 @@ const Glyphset = function () {
|
|
|
448
459
|
|
|
449
460
|
/**
|
|
450
461
|
* Add a custom {@link Glyph} to this {@link Glyphset}.
|
|
451
|
-
*
|
|
462
|
+
*
|
|
452
463
|
* @param {Glyph} Glyph to be added.
|
|
453
464
|
*/
|
|
454
465
|
this.addCustomGlyph = glyph => {
|
|
@@ -460,7 +471,7 @@ const Glyphset = function () {
|
|
|
460
471
|
|
|
461
472
|
/**
|
|
462
473
|
* Add a THREE.Mesh object to be displayed as glyph in this {@link Glyphset}.
|
|
463
|
-
*
|
|
474
|
+
*
|
|
464
475
|
* @param {THREE.Mesh} Mesh to be added.
|
|
465
476
|
* @param {Number} id of the mesh.
|
|
466
477
|
*/
|
|
@@ -480,7 +491,7 @@ const Glyphset = function () {
|
|
|
480
491
|
/**
|
|
481
492
|
* A function which iterates through the list of glyphs and call the callback
|
|
482
493
|
* function with the glyph as the argument.
|
|
483
|
-
*
|
|
494
|
+
*
|
|
484
495
|
* @param {Function} callbackFunction - Callback function with the glyph
|
|
485
496
|
* as an argument.
|
|
486
497
|
*/
|
|
@@ -565,7 +576,7 @@ const Glyphset = function () {
|
|
|
565
576
|
|
|
566
577
|
/**
|
|
567
578
|
* Get the bounding box for the whole set of glyphs.
|
|
568
|
-
*
|
|
579
|
+
*
|
|
569
580
|
* @return {Three.Box3};
|
|
570
581
|
*/
|
|
571
582
|
this.getBoundingBox = () => {
|
|
@@ -597,7 +608,7 @@ const Glyphset = function () {
|
|
|
597
608
|
|
|
598
609
|
/**
|
|
599
610
|
* Set the local time of this glyphset.
|
|
600
|
-
*
|
|
611
|
+
*
|
|
601
612
|
* @param {Number} time - Can be any value between 0 to duration.
|
|
602
613
|
*/
|
|
603
614
|
this.setMorphTime = time => {
|
|
@@ -616,19 +627,19 @@ const Glyphset = function () {
|
|
|
616
627
|
|
|
617
628
|
/**
|
|
618
629
|
* Check if the glyphset is time varying.
|
|
619
|
-
*
|
|
630
|
+
*
|
|
620
631
|
* @return {Boolean}
|
|
621
632
|
*/
|
|
622
633
|
this.isTimeVarying = () => {
|
|
623
|
-
if (((this.ready === false) || (numberOfTimeSteps > 0)) &&
|
|
634
|
+
if (((this.ready === false) || (numberOfTimeSteps > 0)) &&
|
|
624
635
|
(morphColours || morphVertices))
|
|
625
636
|
return true;
|
|
626
637
|
return false;
|
|
627
638
|
}
|
|
628
639
|
|
|
629
640
|
/**
|
|
630
|
-
* Get the current inbuild time of the
|
|
631
|
-
*
|
|
641
|
+
* Get the current inbuild time of the
|
|
642
|
+
*
|
|
632
643
|
* @return {Number}
|
|
633
644
|
*/
|
|
634
645
|
this.getCurrentTime = () => {
|
|
@@ -637,7 +648,7 @@ const Glyphset = function () {
|
|
|
637
648
|
|
|
638
649
|
/**
|
|
639
650
|
* Set the objects scale.
|
|
640
|
-
*
|
|
651
|
+
*
|
|
641
652
|
* @return {THREE.Box3}.
|
|
642
653
|
*/
|
|
643
654
|
this.setScaleAll = function(scale) {
|
package/src/sceneLoader.js
CHANGED
|
@@ -239,7 +239,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
239
239
|
this.toBeDownloaded += 1;
|
|
240
240
|
let isInline = options?.isInline ? options.isInline : false;
|
|
241
241
|
let anatomicalId = options?.anatomicalId ? options.anatomicalId : undefined;
|
|
242
|
-
let renderOrder = options
|
|
242
|
+
let renderOrder = (options && "renderOrder" in options) ? options.renderOrder : undefined;
|
|
243
243
|
if (timeEnabled != undefined)
|
|
244
244
|
localTimeEnabled = timeEnabled ? true : false;
|
|
245
245
|
let localMorphColour = 0;
|
|
@@ -266,7 +266,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
266
266
|
let isInline = (options && options.isInline) ? options.isInline : undefined;
|
|
267
267
|
let anatomicalId = (options && options.anatomicalId) ? options.anatomicalId : undefined;
|
|
268
268
|
let displayLabels = (options && options.displayLabels) ? options.displayLabels : undefined;
|
|
269
|
-
let renderOrder = (options && options
|
|
269
|
+
let renderOrder = (options && "renderOrder" in options) ? options.renderOrder : undefined;
|
|
270
270
|
const newGlyphset = new (require('./primitives/glyphset').Glyphset)();
|
|
271
271
|
newGlyphset.setDuration(scene.getDuration());
|
|
272
272
|
newGlyphset.groupName = groupName;
|
|
@@ -426,7 +426,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
426
426
|
let isInline = (options && options.isInline) ? options.isInline : false;
|
|
427
427
|
let fileFormat = (options && options.fileFormat) ? options.fileFormat : undefined;
|
|
428
428
|
let anatomicalId = (options && options.anatomicalId) ? options.anatomicalId : undefined;
|
|
429
|
-
let renderOrder = (options && options
|
|
429
|
+
let renderOrder = (options && "renderOrder" in options) ? options.renderOrder : undefined;
|
|
430
430
|
if (timeEnabled != undefined)
|
|
431
431
|
localTimeEnabled = timeEnabled ? true : false;
|
|
432
432
|
let localMorphColour = 0;
|
|
@@ -499,7 +499,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
499
499
|
localMorphColour = morphColour ? true : false;
|
|
500
500
|
let isInline = (options && options.isInline) ? options.isInline : false;
|
|
501
501
|
let anatomicalId = (options && options.anatomicalId) ? options.anatomicalId : undefined;
|
|
502
|
-
let renderOrder = (options && options
|
|
502
|
+
let renderOrder = (options && "renderOrder" in options) ? options.renderOrder : undefined;
|
|
503
503
|
if (isInline) {
|
|
504
504
|
const object = primitivesLoader.parse( url );
|
|
505
505
|
(pointsetloader(region, localTimeEnabled, localMorphColour, groupName,
|
|
@@ -514,7 +514,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
514
514
|
const loadTexture = (region, referenceURL, textureData, groupName, finishCallback, options) => {
|
|
515
515
|
let isInline = (options && options.isInline) ? options.isInline : undefined;
|
|
516
516
|
let anatomicalId = (options && options.anatomicalId) ? options.anatomicalId : undefined;
|
|
517
|
-
let renderOrder = (options && options
|
|
517
|
+
let renderOrder = (options && "renderOrder" in options) ? options.renderOrder : undefined;
|
|
518
518
|
let newTexture = undefined;
|
|
519
519
|
if (textureData) {
|
|
520
520
|
if (referenceURL && textureData.images && textureData.images.source) {
|