zincjs 1.14.2 → 1.14.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 +9 -5
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/zincObject.js +14 -2
- package/src/region.js +1 -1
package/build/zinc.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = require("url-polyfill");
|
|
|
32
32
|
/***/ ((module) => {
|
|
33
33
|
|
|
34
34
|
"use strict";
|
|
35
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.14.
|
|
35
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"zincjs","version":"1.14.3","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
|
|
36
36
|
|
|
37
37
|
/***/ }),
|
|
38
38
|
/* 3 */
|
|
@@ -256,7 +256,7 @@ var THREE=__webpack_require__(4),createBufferGeometry=(__webpack_require__(5).cr
|
|
|
256
256
|
*/ //Draw range is only used by primitives added
|
|
257
257
|
//programatically with addVertices function
|
|
258
258
|
//Default value of colour
|
|
259
|
-
this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE.Group,this._lod=new((__webpack_require__(11).LOD))(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new THREE.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=getUniqueId(),this._v1=new THREE.Vector3,this._v2=new THREE.Vector3,this._b1=new THREE.Box3,this.center=new THREE.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1};/**
|
|
259
|
+
this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE.Group,this._lod=new((__webpack_require__(11).LOD))(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new THREE.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid=getUniqueId(),this._v1=new THREE.Vector3,this._v2=new THREE.Vector3,this._b1=new THREE.Box3,this.center=new THREE.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};/**
|
|
260
260
|
* Provides the base object for other primitive types.
|
|
261
261
|
* This class contains multiple base methods.
|
|
262
262
|
*
|
|
@@ -301,7 +301,11 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
|
|
|
301
301
|
* @param {Boolean} localMorphColour - A flag to indicate either the colour is
|
|
302
302
|
* time dependent.
|
|
303
303
|
*/ /**
|
|
304
|
-
* Set
|
|
304
|
+
* Set isPickable for this ZincObject.
|
|
305
|
+
*
|
|
306
|
+
* @param {String} isPickable - Boolean to enable object pick.
|
|
307
|
+
*/ /**
|
|
308
|
+
* Set the anatomicalId for this ZincObject.
|
|
305
309
|
*
|
|
306
310
|
* @param {String} anatomicalId - Id to be set.
|
|
307
311
|
*/ /**
|
|
@@ -419,7 +423,7 @@ this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new THREE
|
|
|
419
423
|
*/ /**
|
|
420
424
|
* Set the objects scale.
|
|
421
425
|
*/ZincObject.prototype.setDuration=function(durationIn){this.duration=durationIn,this.clipAction&&this.clipAction.setDuration(this.duration)},ZincObject.prototype.getDuration=function(){return this.duration},ZincObject.prototype.setRegion=function(region){this.region=region},ZincObject.prototype.getRegion=function(){return this.region},ZincObject.prototype.getMorph=function(){var morph=this._lod.getCurrentMorph();return morph?morph:this.morph},ZincObject.prototype.getGroup=function(){return this.group},ZincObject.prototype.setMorph=function(mesh){this.morph=mesh,this.group.add(this.morph);//this is the base level object
|
|
422
|
-
var distance=this._lod.calculateDistance("far");this._lod.addLevel(mesh,distance),this._lod.setMaterial(mesh.material)},ZincObject.prototype.checkTransparentMesh=function(){},ZincObject.prototype.setMesh=function(mesh,localTimeEnabled,localMorphColour){this.animationGroup=new THREE.AnimationObjectGroup(mesh),this.mixer=new THREE.AnimationMixer(this.animationGroup);var geometry=mesh.geometry;if(this.geometry=mesh.geometry,this.clipAction=void 0,geometry&&geometry.morphAttributes){var morphAttribute=geometry.morphAttributes.position;morphAttribute||(morphAttribute=geometry.morphAttributes.color?geometry.morphAttributes.color:geometry.morphAttributes.normal),morphAttribute&&(this.animationClip=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(morphAttribute,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=THREE.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=localTimeEnabled,this.morphColour=localMorphColour,mesh.userData=this,mesh.matrixAutoUpdate=!1,this.setMorph(mesh),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(geometry.setAttribute("morphTarget0",geometry.getAttribute("position")),geometry.setAttribute("morphTarget1",geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},ZincObject.prototype.setAnatomicalId=function(anatomicalId){this.anatomicalId=anatomicalId},ZincObject.prototype.setName=function(groupNameIn){this.groupName=groupNameIn,this._lod.setName(groupNameIn)},ZincObject.prototype.getCurrentTime=function(){if(this.clipAction){var ratio=this.clipAction.time/this.clipAction._clip.duration;return this.duration*ratio}return this.inbuildTime},ZincObject.prototype.setMorphTime=function(time){var timeChanged=!1;if(this.clipAction){var ratio=time/this.duration,actualDuration=this.clipAction._clip.duration,newTime=ratio*actualDuration;newTime!=this.clipAction.time&&(this.clipAction.time=newTime,timeChanged=!0),timeChanged&&this.isTimeVarying()&&this.mixer.update(0)}else{var _newTime=time;_newTime=time>this.duration?this.duration:0>time?0:time,_newTime!=this.inbuildTime&&(this.inbuildTime=_newTime,timeChanged=!0)}timeChanged&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return this.visible},ZincObject.prototype.setVisibility=function(visible){visible!==this.visible&&(this.visible=visible,this.group.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this._lod._material,isTransparent=!1;1>alpha&&(isTransparent=!0),material.opacity=alpha,material.transparent=isTransparent,this.checkTransparentMesh()},ZincObject.prototype.setFrustumCulled=function(flag){//multilayers - set for all layers
|
|
426
|
+
var distance=this._lod.calculateDistance("far");this._lod.addLevel(mesh,distance),this._lod.setMaterial(mesh.material)},ZincObject.prototype.checkTransparentMesh=function(){},ZincObject.prototype.setMesh=function(mesh,localTimeEnabled,localMorphColour){this.animationGroup=new THREE.AnimationObjectGroup(mesh),this.mixer=new THREE.AnimationMixer(this.animationGroup);var geometry=mesh.geometry;if(this.geometry=mesh.geometry,this.clipAction=void 0,geometry&&geometry.morphAttributes){var morphAttribute=geometry.morphAttributes.position;morphAttribute||(morphAttribute=geometry.morphAttributes.color?geometry.morphAttributes.color:geometry.morphAttributes.normal),morphAttribute&&(this.animationClip=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(morphAttribute,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=THREE.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=localTimeEnabled,this.morphColour=localMorphColour,mesh.userData=this,mesh.matrixAutoUpdate=!1,this.setMorph(mesh),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(geometry.setAttribute("morphTarget0",geometry.getAttribute("position")),geometry.setAttribute("morphTarget1",geometry.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},ZincObject.prototype.setIsPickable=function(isPickable){this.isPickable!==isPickable&&(this.isPickable=isPickable,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAnatomicalId=function(anatomicalId){this.anatomicalId=anatomicalId},ZincObject.prototype.setName=function(groupNameIn){this.groupName=groupNameIn,this._lod.setName(groupNameIn)},ZincObject.prototype.getCurrentTime=function(){if(this.clipAction){var ratio=this.clipAction.time/this.clipAction._clip.duration;return this.duration*ratio}return this.inbuildTime},ZincObject.prototype.setMorphTime=function(time){var timeChanged=!1;if(this.clipAction){var ratio=time/this.duration,actualDuration=this.clipAction._clip.duration,newTime=ratio*actualDuration;newTime!=this.clipAction.time&&(this.clipAction.time=newTime,timeChanged=!0),timeChanged&&this.isTimeVarying()&&this.mixer.update(0)}else{var _newTime=time;_newTime=time>this.duration?this.duration:0>time?0:time,_newTime!=this.inbuildTime&&(this.inbuildTime=_newTime,timeChanged=!0)}timeChanged&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},ZincObject.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},ZincObject.prototype.getVisibility=function(){return this.visible},ZincObject.prototype.setVisibility=function(visible){visible!==this.visible&&(this.visible=visible,this.group.visible=visible,this.region&&(this.region.pickableUpdateRequired=!0))},ZincObject.prototype.setAlpha=function(alpha){var material=this._lod._material,isTransparent=!1;1>alpha&&(isTransparent=!0),material.opacity=alpha,material.transparent=isTransparent,this.checkTransparentMesh()},ZincObject.prototype.setFrustumCulled=function(flag){//multilayers - set for all layers
|
|
423
427
|
this._lod.setFrustumCulled(flag)},ZincObject.prototype.setVertexColors=function(vertexColors){//multilayers - set for all
|
|
424
428
|
this._lod.setVertexColors(vertexColors)},ZincObject.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},ZincObject.prototype.setColour=function(colour){this._lod.setColour(colour)},ZincObject.prototype.setGreyScale=function(flag){if(flag){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new THREE.Color().setHex(12303291)),!0;}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},ZincObject.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},ZincObject.prototype.setColourHex=function(hex){this._lod._material.color.setHex(hex),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(hex)},ZincObject.prototype.setEmissiveRGB=function(colour){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...colour),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...colour)},ZincObject.prototype.setMaterial=function(material){this._lod.setMaterial(material)},ZincObject.prototype.getClosestVertexIndex=function(){var closestIndex=-1,morph=this.getMorph();if(morph&&morph.geoemtry){var position=morph.geometry.attributes.position;if(this._b1.setFromBufferAttribute(position),this._b1.getCenter(this._v1),position)for(var distance=-1,currentDistance=0,i=0;i<position.count;i++)this._v2.fromArray(position.array,3*i),currentDistance=this._v2.distanceTo(this._v1),-1==distance?distance=currentDistance:distance>currentDistance&&(distance=currentDistance,closestIndex=i)}return closestIndex},ZincObject.prototype.getClosestVertex=function(applyMatrixWorld){var position=new THREE.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var morph=this.getMorph();if(morph&&morph.geometry&&0<=this.closestVertexIndex){var influences=morph.morphTargetInfluences,attributes=morph.geometry.morphAttributes;if(influences&&attributes&&attributes.position){for(var found=!1,i=0;i<influences.length;i++)0<influences[i]&&(found=!0,this._v1.fromArray(attributes.position[i].array,3*this.closestVertexIndex),position.add(this._v1.multiplyScalar(influences[i])));if(found)return applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}else return position.fromArray(morph.geometry.attributes.position.array,3*this.closestVertexIndex),applyMatrixWorld?position.applyMatrix4(morph.matrixWorld):position}return this.getBoundingBox(),position.copy(this.center),applyMatrixWorld?position.applyMatrix4(this.morph.matrixWorld):position},ZincObject.prototype.getBoundingBox=function(){if(this.visible){var morph=this._lod.getCurrentMorph();if(morph&&morph.visible)return this.boundingBoxUpdateRequired&&((__webpack_require__(5).getBoundingBox)(morph,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},ZincObject.prototype.dispose=function(){//multilayyers
|
|
425
429
|
this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},ZincObject.prototype.markerIsRequired=function(options){return!!(this.visible&&("on"===this.markerMode||options&&options.displayMarkers&&"inherited"===this.markerMode))},ZincObject.prototype.updateMarker=function(playAnimation,options){if(!1==playAnimation&&this.markerIsRequired(options)){var ndcToBeUpdated=options.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new((__webpack_require__(14).Marker))(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var position=this.getClosestVertex(!1);position&&(this.marker.setPosition(position.x,position.y,position.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(options.markersList&&!(this.marker.uuid in options.markersList)&&(ndcToBeUpdated=!0,options.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),options&&options.camera&&(ndcToBeUpdated||options.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(options.camera.cameraObject),options.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),options.markersList&&this.marker.uuid in options.markersList&&(options.markerCluster.markerUpdateRequired=!0,delete options.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},ZincObject.prototype.processMarkerVisual=function(min,max){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(min,max)},ZincObject.prototype.initiateMorphColor=function(){1==this.morphColour&&this._lod.updateMorphColorAttribute(!1)},ZincObject.prototype.setRenderOrder=function(renderOrder){//multiilayers
|
|
@@ -2223,7 +2227,7 @@ var{Group,Matrix4}=__webpack_require__(4),Pointset=(__webpack_require__(22).Poin
|
|
|
2223
2227
|
* Update geometries and glyphsets based on the calculated time.
|
|
2224
2228
|
*/ /**
|
|
2225
2229
|
* Add a new geometry
|
|
2226
|
-
*/tMatrix.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=getUniqueId(),this.hideAllPrimitives=()=>{children.forEach(child=>child.hideAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!1))},this.showAllPrimitives=()=>{children.forEach(child=>child.showAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!0))},this.setVisibility=flag=>{flag!=group.visible&&(group.visible=flag,this.pickableUpdateRequired=!0)},this.getVisibility=()=>group.visible,this.getGroup=()=>group,this.setTransformation=transformation=>{tMatrix.set(...transformation),group.matrix.copy(tMatrix),group.updateMatrixWorld()},this.setName=nameIn=>{nameIn&&""!==nameIn&&(name=nameIn)},this.getName=()=>name,this.getParent=()=>parent,this.getFullSeparatedPath=()=>{var paths=[];if(""!==name){paths.push(name);for(var parentName,p=parent;p!==void 0;)parentName=p.getName(),""!==parentName&&paths.unshift(parentName),p=p.getParent()}return paths},this.getFullPath=()=>{var paths=this.getFullSeparatedPath();if(0<paths.length){var fullPath=paths.shift();return paths.forEach(path=>{fullPath=fullPath.concat("/",path)}),fullPath}return""},this.createChild=nameIn=>{var childRegion=new Region(this,scene);return childRegion.setName(nameIn),children.push(childRegion),group.add(childRegion.getGroup()),childRegion},this.getChildWithName=childName=>{if(childName)for(var lowerChildName=childName.toLowerCase(),i=0;i<children.length;i++)if(children[i].getName().toLowerCase()===lowerChildName)return children[i]},this.findChildFromSeparatedPath=pathArray=>{if(pathArray&&0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),pathArray&&0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion?(pathArray.shift(),childRegion.findChildFromSeparatedPath(pathArray)):void 0}return this},this.findChildFromPath=path=>{var pathArray=path.split("/");return this.findChildFromSeparatedPath(pathArray)},this.createChildFromSeparatedPath=pathArray=>{if(0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion||(childRegion=this.createChild(pathArray[0])),pathArray.shift(),childRegion.createChildFromSeparatedPath(pathArray)}return this},this.createChildFromPath=path=>{var pathArray=path.split("/");return this.createChildFromSeparatedPath(pathArray)},this.findOrCreateChildFromPath=path=>{var childRegion=this.findChildFromPath(path);return childRegion||(childRegion=this.createChildFromPath(path)),childRegion},this.addZincObject=zincObject=>{zincObject&&(zincObject.setRegion(this),group.add(zincObject.getGroup()),zincObjects.push(zincObject),this.pickableUpdateRequired=!0,scene&&scene.triggerObjectAddedCallback(zincObject))},this.removeZincObject=zincObject=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return group.remove(zincObject.getGroup()),zincObjects.splice(i,1),scene&&scene.triggerObjectRemovedCallback(zincObject),zincObject.dispose(),void(this.pickableUpdateRequired=!0)},this.checkPickableUpdateRequred=transverse=>{if(this.pickableUpdateRequired)return!0;if(transverse)for(var flag=!1,i=0;i<children.length;i++)if(flag=children[i].checkPickableUpdateRequred(transverse),flag)return!0;return!1},this.getPickableThreeJSObjects=(objectsList,transverse)=>(group.visible&&(zincObjects.forEach(zincObject=>{if(zincObject.getGroup()&&zincObject.getGroup().visible){var marker=zincObject.marker;marker&&marker.isEnabled()&&objectsList.push(marker.getMorph()),objectsList.push(zincObject.getGroup())}}),transverse&&children.forEach(childRegion=>{childRegion.getPickableThreeJSObjects(objectsList,transverse)}),this.pickableUpdateRequired=!1),objectsList),this.setDuration=durationIn=>{duration=durationIn,zincObjects.forEach(zincObject=>zincObject.setDuration(durationIn)),children.forEach(childRegion=>childRegion.setDuration(durationIn))},this.getDuration=()=>duration,this.getBoundingBox=transverse=>{var boundingBox1,boundingBox2;return zincObjects.forEach(zincObject=>{boundingBox2=zincObject.getBoundingBox(),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),transverse&&children.forEach(childRegion=>{boundingBox2=childRegion.getBoundingBox(transverse),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),boundingBox1},this.clear=transverse=>{transverse&&children.forEach(childRegion=>childRegion.clear(transverse)),zincObjects.forEach(zincObject=>{group.remove(zincObject.getGroup()),zincObject.dispose()}),children=[],zincObjects=[]},this.objectIsInRegion=(zincObject,transverse)=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return!0;if(transverse)for(var _i=0;_i<children.length;_i++)if(children[_i].objectIsInRegion(zincObject,transverse))return!0;return!1},this.forEachGeometry=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGeometry&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGeometry(callbackFunction,transverse))},this.forEachGlyphset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGlyphset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGlyphset(callbackFunction,transverse))},this.forEachPointset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isPointset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachPointset(callbackFunction,transverse))},this.forEachLine=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isLines&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachLine(callbackFunction,transverse))},this.findObjectsWithAnatomicalId=(anatomicalId,transverse)=>{var objectsArray=[];return zincObjects.forEach(zincObject=>{zincObject.anatomicalId===anatomicalId&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithAnatomicalId(anatomicalId,transverse);objectsArray.push(...childObjects)}),objectsArray},this.findObjectsWithGroupName=(groupName,transverse)=>{var objectsArray=[];return zincObjects.forEach(zincObject=>{var lowerObjectName=zincObject.groupName?zincObject.groupName.toLowerCase():zincObject.groupName,lowerGroupName=groupName?groupName.toLowerCase():groupName;lowerObjectName===lowerGroupName&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithGroupName(groupName,transverse);objectsArray.push(...childObjects)}),objectsArray},this.findGeometriesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),geometriesArray=primitivesArray.filter(primitive=>primitive.isGeometry);return geometriesArray},this.findPointsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),pointsetsArray=primitivesArray.filter(primitive=>primitive.isPointset);return pointsetsArray},this.findGlyphsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),glyphsetsArray=primitivesArray.filter(primitive=>primitive.isGlyphset);return glyphsetsArray},this.findLinesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),linesArray=primitivesArray.filter(primitive=>primitive.isLines);return linesArray},this.getAllObjects=transverse=>{var objectsArray=[...zincObjects];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getAllObjects(transverse);objectsArray.push(...childObjects)}),objectsArray},this.getChildRegions=transverse=>{var objectsArray=[...children];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getChildRegions(transverse);objectsArray.push(...childObjects)}),objectsArray},this.getCurrentTime=()=>{if(zincObjects[0]!=null)return zincObjects[0].getCurrentTime();for(var time,i=0;i<children.length;i++)if(time=children[i].getCurrentTime(),-1!==time)return time;return-1},this.setMorphTime=(time,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.setMorphTime(time)}),transverse&&children.forEach(childRegion=>{childRegion.setMorphTime(time)})},this.isTimeVarying=()=>{for(var i=0;i<zincObjects.length;i++)if(zincObjects[i].isTimeVarying())return!0;for(var _i2=0;_i2<children.length;_i2++)if(children[_i2].isTimeVarying())return!0;return!1},this.renderGeometries=(playRate,delta,playAnimation,cameraControls,options,transverse)=>{var _options$markerCluste,allObjects=this.getAllObjects(transverse);// Let video dictates the progress if one is present
|
|
2230
|
+
*/tMatrix.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid=getUniqueId(),this.hideAllPrimitives=()=>{children.forEach(child=>child.hideAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!1))},this.showAllPrimitives=()=>{children.forEach(child=>child.showAllPrimitives()),zincObjects.forEach(zincObject=>zincObject.setVisibility(!0))},this.setVisibility=flag=>{flag!=group.visible&&(group.visible=flag,this.pickableUpdateRequired=!0)},this.getVisibility=()=>group.visible,this.getGroup=()=>group,this.setTransformation=transformation=>{tMatrix.set(...transformation),group.matrix.copy(tMatrix),group.updateMatrixWorld()},this.setName=nameIn=>{nameIn&&""!==nameIn&&(name=nameIn)},this.getName=()=>name,this.getParent=()=>parent,this.getFullSeparatedPath=()=>{var paths=[];if(""!==name){paths.push(name);for(var parentName,p=parent;p!==void 0;)parentName=p.getName(),""!==parentName&&paths.unshift(parentName),p=p.getParent()}return paths},this.getFullPath=()=>{var paths=this.getFullSeparatedPath();if(0<paths.length){var fullPath=paths.shift();return paths.forEach(path=>{fullPath=fullPath.concat("/",path)}),fullPath}return""},this.createChild=nameIn=>{var childRegion=new Region(this,scene);return childRegion.setName(nameIn),children.push(childRegion),group.add(childRegion.getGroup()),childRegion},this.getChildWithName=childName=>{if(childName)for(var lowerChildName=childName.toLowerCase(),i=0;i<children.length;i++)if(children[i].getName().toLowerCase()===lowerChildName)return children[i]},this.findChildFromSeparatedPath=pathArray=>{if(pathArray&&0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),pathArray&&0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion?(pathArray.shift(),childRegion.findChildFromSeparatedPath(pathArray)):void 0}return this},this.findChildFromPath=path=>{var pathArray=path.split("/");return this.findChildFromSeparatedPath(pathArray)},this.createChildFromSeparatedPath=pathArray=>{if(0<pathArray.length&&""===pathArray[0]&&pathArray.shift(),0<pathArray.length){var childRegion=this.getChildWithName(pathArray[0]);return childRegion||(childRegion=this.createChild(pathArray[0])),pathArray.shift(),childRegion.createChildFromSeparatedPath(pathArray)}return this},this.createChildFromPath=path=>{var pathArray=path.split("/");return this.createChildFromSeparatedPath(pathArray)},this.findOrCreateChildFromPath=path=>{var childRegion=this.findChildFromPath(path);return childRegion||(childRegion=this.createChildFromPath(path)),childRegion},this.addZincObject=zincObject=>{zincObject&&(zincObject.setRegion(this),group.add(zincObject.getGroup()),zincObjects.push(zincObject),this.pickableUpdateRequired=!0,scene&&scene.triggerObjectAddedCallback(zincObject))},this.removeZincObject=zincObject=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return group.remove(zincObject.getGroup()),zincObjects.splice(i,1),scene&&scene.triggerObjectRemovedCallback(zincObject),zincObject.dispose(),void(this.pickableUpdateRequired=!0)},this.checkPickableUpdateRequred=transverse=>{if(this.pickableUpdateRequired)return!0;if(transverse)for(var flag=!1,i=0;i<children.length;i++)if(flag=children[i].checkPickableUpdateRequred(transverse),flag)return!0;return!1},this.getPickableThreeJSObjects=(objectsList,transverse)=>(group.visible&&(zincObjects.forEach(zincObject=>{if(zincObject.isPickable&&zincObject.getGroup()&&zincObject.getGroup().visible){var marker=zincObject.marker;marker&&marker.isEnabled()&&objectsList.push(marker.getMorph()),objectsList.push(zincObject.getGroup())}}),transverse&&children.forEach(childRegion=>{childRegion.getPickableThreeJSObjects(objectsList,transverse)}),this.pickableUpdateRequired=!1),objectsList),this.setDuration=durationIn=>{duration=durationIn,zincObjects.forEach(zincObject=>zincObject.setDuration(durationIn)),children.forEach(childRegion=>childRegion.setDuration(durationIn))},this.getDuration=()=>duration,this.getBoundingBox=transverse=>{var boundingBox1,boundingBox2;return zincObjects.forEach(zincObject=>{boundingBox2=zincObject.getBoundingBox(),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),transverse&&children.forEach(childRegion=>{boundingBox2=childRegion.getBoundingBox(transverse),boundingBox2&&(null==boundingBox1?boundingBox1=boundingBox2.clone():boundingBox1.union(boundingBox2))}),boundingBox1},this.clear=transverse=>{transverse&&children.forEach(childRegion=>childRegion.clear(transverse)),zincObjects.forEach(zincObject=>{group.remove(zincObject.getGroup()),zincObject.dispose()}),children=[],zincObjects=[]},this.objectIsInRegion=(zincObject,transverse)=>{for(var i=0;i<zincObjects.length;i++)if(zincObject===zincObjects[i])return!0;if(transverse)for(var _i=0;_i<children.length;_i++)if(children[_i].objectIsInRegion(zincObject,transverse))return!0;return!1},this.forEachGeometry=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGeometry&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGeometry(callbackFunction,transverse))},this.forEachGlyphset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isGlyphset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachGlyphset(callbackFunction,transverse))},this.forEachPointset=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isPointset&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachPointset(callbackFunction,transverse))},this.forEachLine=(callbackFunction,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.isLines&&callbackFunction(zincObject)}),transverse&&children.forEach(childRegion=>childRegion.forEachLine(callbackFunction,transverse))},this.findObjectsWithAnatomicalId=(anatomicalId,transverse)=>{var objectsArray=[];return zincObjects.forEach(zincObject=>{zincObject.anatomicalId===anatomicalId&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithAnatomicalId(anatomicalId,transverse);objectsArray.push(...childObjects)}),objectsArray},this.findObjectsWithGroupName=(groupName,transverse)=>{var objectsArray=[];return zincObjects.forEach(zincObject=>{var lowerObjectName=zincObject.groupName?zincObject.groupName.toLowerCase():zincObject.groupName,lowerGroupName=groupName?groupName.toLowerCase():groupName;lowerObjectName===lowerGroupName&&objectsArray.push(zincObject)}),transverse&&children.forEach(childRegion=>{var childObjects=childRegion.findObjectsWithGroupName(groupName,transverse);objectsArray.push(...childObjects)}),objectsArray},this.findGeometriesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),geometriesArray=primitivesArray.filter(primitive=>primitive.isGeometry);return geometriesArray},this.findPointsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),pointsetsArray=primitivesArray.filter(primitive=>primitive.isPointset);return pointsetsArray},this.findGlyphsetsWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),glyphsetsArray=primitivesArray.filter(primitive=>primitive.isGlyphset);return glyphsetsArray},this.findLinesWithGroupName=(groupName,transverse)=>{var primitivesArray=this.findObjectsWithGroupName(groupName,transverse),linesArray=primitivesArray.filter(primitive=>primitive.isLines);return linesArray},this.getAllObjects=transverse=>{var objectsArray=[...zincObjects];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getAllObjects(transverse);objectsArray.push(...childObjects)}),objectsArray},this.getChildRegions=transverse=>{var objectsArray=[...children];return transverse&&children.forEach(childRegion=>{var childObjects=childRegion.getChildRegions(transverse);objectsArray.push(...childObjects)}),objectsArray},this.getCurrentTime=()=>{if(zincObjects[0]!=null)return zincObjects[0].getCurrentTime();for(var time,i=0;i<children.length;i++)if(time=children[i].getCurrentTime(),-1!==time)return time;return-1},this.setMorphTime=(time,transverse)=>{zincObjects.forEach(zincObject=>{zincObject.setMorphTime(time)}),transverse&&children.forEach(childRegion=>{childRegion.setMorphTime(time)})},this.isTimeVarying=()=>{for(var i=0;i<zincObjects.length;i++)if(zincObjects[i].isTimeVarying())return!0;for(var _i2=0;_i2<children.length;_i2++)if(children[_i2].isTimeVarying())return!0;return!1},this.renderGeometries=(playRate,delta,playAnimation,cameraControls,options,transverse)=>{var _options$markerCluste,allObjects=this.getAllObjects(transverse);// Let video dictates the progress if one is present
|
|
2227
2231
|
allObjects.forEach(zincObject=>{zincObject.render(playRate*delta,playAnimation,cameraControls,options)}),options&&!1===playAnimation&&null!==(_options$markerCluste=options.markerCluster)&&void 0!==_options$markerCluste&&_options$markerCluste.markerUpdateRequired&&options.markerCluster.calculate()},this.createPoints=(groupName,coords,labels,colour)=>{var isNew=!1,zincObjects=this.findObjectsWithGroupName(groupName,!1),index=zincObjects.findIndex(zincObject=>zincObject.isPointset),pointset=-1<index?zincObjects[index]:new Pointset;return pointset.addPoints(coords,labels,colour),-1===index?(pointset.setName(groupName),this.addZincObject(pointset),isNew=!0):this.pickableUpdateRequired=!0,{zincObject:pointset,isNew}},this.createLines=(groupName,coords,colour)=>{var isNew=!1,zincObjects=this.findObjectsWithGroupName(groupName,!1),index=zincObjects.findIndex(zincObject=>zincObject.isLines),lines=-1<index?zincObjects[index]:new Lines2;return lines.addLines(coords,colour),-1===index?(lines.setName(groupName),this.addZincObject(lines),isNew=!0):this.pickableUpdateRequired=!0,{zincObject:lines,isNew}},this.createGeometryFromThreeJSGeometry=(groupName,geometry,colour,opacity,visibility,renderOrder)=>{var zincGeometry=new Geometry,material=new THREE.MeshPhongMaterial({color:colour,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:opacity,side:THREE.DoubleSide});return zincGeometry.createMesh(geometry,material,{localTimeEnabled:!1,localMorphColour:!1}),zincGeometry.getMorph()?(zincGeometry.setVisibility(!1),zincGeometry.setName(groupName),zincGeometry.setRenderOrder(renderOrder),this.addZincObject(zincGeometry),zincGeometry):void 0}};/**
|
|
2228
2232
|
* Provides a hierachical structure to objects, Each region
|
|
2229
2233
|
* may contain multiple child regions and {@link ZincObject}.
|