@abi-software/scaffoldvuer 1.13.1-beta.0 → 1.13.1-beta.1
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/dist/scaffoldvuer.js +203 -163
- package/dist/scaffoldvuer.umd.cjs +5 -5
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +2 -2
- package/src/components/ScaffoldOverlay.vue +5 -0
- package/src/components/ScaffoldVuer.vue +105 -26
- package/src/components/TextureSlidesControls.vue +1 -1
- package/src/scripts/OrgansRenderer.js +31 -31
- package/src/scripts/Utilities.js +24 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.13.1-beta.
|
|
3
|
+
"version": "1.13.1-beta.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"unplugin-vue-components": "^0.26.0",
|
|
54
54
|
"vue": "^3.4.21",
|
|
55
55
|
"vue-router": "^4.2.5",
|
|
56
|
-
"zincjs": "^1.16.
|
|
56
|
+
"zincjs": "^1.16.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/eslint-parser": "^7.28.0",
|
package/src/App.vue
CHANGED
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
id="annotations-upload"
|
|
151
151
|
type="file"
|
|
152
152
|
accept="application/json"
|
|
153
|
-
@change="importOfflineAnnotations"
|
|
153
|
+
@change="importOfflineAnnotations"
|
|
154
154
|
/>
|
|
155
155
|
</el-button>
|
|
156
156
|
</el-col>
|
|
@@ -357,7 +357,7 @@ const writeTextFile = (filename, data) => {
|
|
|
357
357
|
hrefElement.href = dataStr;
|
|
358
358
|
hrefElement.click();
|
|
359
359
|
hrefElement.remove();
|
|
360
|
-
}
|
|
360
|
+
}
|
|
361
361
|
|
|
362
362
|
export default {
|
|
363
363
|
name: "app",
|
|
@@ -440,6 +440,7 @@ import {
|
|
|
440
440
|
getClickedObjects,
|
|
441
441
|
getDeletableObjects,
|
|
442
442
|
getDrawnAnnotations,
|
|
443
|
+
getEditablePoint,
|
|
443
444
|
getEditableLines,
|
|
444
445
|
getObjectsFromAnnotations,
|
|
445
446
|
findObjectsWithNames,
|
|
@@ -1176,12 +1177,7 @@ export default {
|
|
|
1176
1177
|
}
|
|
1177
1178
|
}
|
|
1178
1179
|
//Recalculate the following if module is ready
|
|
1179
|
-
|
|
1180
|
-
const {centre, size} = this.$module.getCentreAndSize();
|
|
1181
|
-
this.boundingDims.centre = centre;
|
|
1182
|
-
this.boundingDims.size = size;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1180
|
+
this.calculateBoundingBox();
|
|
1185
1181
|
|
|
1186
1182
|
/**
|
|
1187
1183
|
* Emit when a new object is added to the scene
|
|
@@ -1306,7 +1302,17 @@ export default {
|
|
|
1306
1302
|
}
|
|
1307
1303
|
annotation.region = regionPath;
|
|
1308
1304
|
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
|
|
1309
|
-
this.offlineAnnotations.
|
|
1305
|
+
const found = this.offlineAnnotations.find((element) => {
|
|
1306
|
+
return element.group === annotation.group &&
|
|
1307
|
+
element.region === annotation.region &&
|
|
1308
|
+
element.resource === annotation.resource &&
|
|
1309
|
+
element.feature.geometry.type === annotation.feature.geometry.type;
|
|
1310
|
+
});
|
|
1311
|
+
if (found) {
|
|
1312
|
+
Object.assign(found, annotation);
|
|
1313
|
+
} else {
|
|
1314
|
+
this.offlineAnnotations.push(annotation);
|
|
1315
|
+
}
|
|
1310
1316
|
sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
|
|
1311
1317
|
}
|
|
1312
1318
|
this.$emit('userPrimitivesUpdated', {region, group, zincObject});
|
|
@@ -1349,7 +1355,15 @@ export default {
|
|
|
1349
1355
|
);
|
|
1350
1356
|
} else if (payload.editingIndex > -1) {
|
|
1351
1357
|
if (this._editingZincObject) {
|
|
1352
|
-
|
|
1358
|
+
let editedPoint = undefined;
|
|
1359
|
+
if (payload.editingIndex > -1) {
|
|
1360
|
+
if (this.createData.faceIndex > -1) {
|
|
1361
|
+
editedPoint = this.createData.points[1];
|
|
1362
|
+
} else {
|
|
1363
|
+
editedPoint = this.createData.points[0];
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
this._editingZincObject.editVertices([editedPoint],
|
|
1353
1367
|
payload.editingIndex);
|
|
1354
1368
|
const region = this._editingZincObject.region.getFullPath() + "/";
|
|
1355
1369
|
const group = this._editingZincObject.groupName;
|
|
@@ -1371,6 +1385,7 @@ export default {
|
|
|
1371
1385
|
* Cancel create workflows. Reset all relevant UIs and data.
|
|
1372
1386
|
*/
|
|
1373
1387
|
cancelCreate: function() {
|
|
1388
|
+
this.changeActiveByName(undefined);
|
|
1374
1389
|
this.createData.points.length = 0;
|
|
1375
1390
|
this.createData.toBeConfirmed = false;
|
|
1376
1391
|
this._editingZincObject = undefined;
|
|
@@ -1611,10 +1626,31 @@ export default {
|
|
|
1611
1626
|
}
|
|
1612
1627
|
}
|
|
1613
1628
|
},
|
|
1629
|
+
createEditTemporaryPoint: function(identifiers) {
|
|
1630
|
+
const worldCoords = identifiers[0].extraData.worldCoords;
|
|
1631
|
+
if (worldCoords) {
|
|
1632
|
+
if (this.createData.shape === "Point" || this.createData.editingIndex > -1) {
|
|
1633
|
+
if (this.createData.points.length === 0) {
|
|
1634
|
+
this.showRegionTooltipWithAnnotations(identifiers, true, false);
|
|
1635
|
+
this.tData.x = 50;
|
|
1636
|
+
this.tData.y = 200;
|
|
1637
|
+
if (this._tempPoint) {
|
|
1638
|
+
const positionAttribute = this._tempPoint.geometry.getAttribute( 'position' );
|
|
1639
|
+
positionAttribute.setXYZ(0, worldCoords[0], worldCoords[1], worldCoords[2]);
|
|
1640
|
+
positionAttribute.needsUpdate = true;
|
|
1641
|
+
} else {
|
|
1642
|
+
this._tempPoint = this.$module.scene.addTemporaryPoints(
|
|
1643
|
+
[worldCoords], 0x00ffff);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
},
|
|
1614
1649
|
createEditTemporaryLines: function(identifiers) {
|
|
1615
1650
|
const worldCoords = identifiers[0].extraData.worldCoords;
|
|
1616
1651
|
if (worldCoords) {
|
|
1617
|
-
if (this.createData.shape === "LineString" ||
|
|
1652
|
+
if (this.createData.shape === "LineString" ||
|
|
1653
|
+
(this.createData.editingIndex > -1 && this.createData.faceIndex > -1)) {
|
|
1618
1654
|
if (this.createData.points.length === 1) {
|
|
1619
1655
|
this.showRegionTooltipWithAnnotations(identifiers, true, false);
|
|
1620
1656
|
this.tData.x = 50;
|
|
@@ -1631,14 +1667,26 @@ export default {
|
|
|
1631
1667
|
}
|
|
1632
1668
|
}
|
|
1633
1669
|
},
|
|
1670
|
+
createEditTemporaryPrimitive: function(identifiers) {
|
|
1671
|
+
if (this.createData.shape === "LineString" ||
|
|
1672
|
+
(this.createData.editingIndex > -1 &&
|
|
1673
|
+
this.createData.faceIndex > -1)) {
|
|
1674
|
+
this.createEditTemporaryLines(identifiers);
|
|
1675
|
+
} else {
|
|
1676
|
+
if (this.createData.shape === "Point" || this.createData.editingIndex > -1) {
|
|
1677
|
+
this.createEditTemporaryPoint(identifiers);
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
},
|
|
1634
1681
|
draw: function(data) {
|
|
1635
1682
|
if (data && data.length > 0 && data[0].data.group) {
|
|
1636
1683
|
if (data[0].extraData.worldCoords) {
|
|
1637
|
-
if (this.createData.shape === "
|
|
1638
|
-
this.
|
|
1639
|
-
} else if (this.createData.shape === "LineString" ||
|
|
1640
|
-
this.createData.editingIndex > -1) {
|
|
1684
|
+
if (this.createData.shape === "LineString" ||
|
|
1685
|
+
(this.createData.editingIndex > -1 && this.createData.faceIndex > -1)) {
|
|
1641
1686
|
this.drawLine(data[0].extraData.worldCoords, data);
|
|
1687
|
+
} else if (this.createData.shape === "Point" ||
|
|
1688
|
+
(this.createData.editingIndex > -1 && this.createData.faceIndex === -1)) {
|
|
1689
|
+
this.drawPoint(data[0].extraData.worldCoords, data);
|
|
1642
1690
|
}
|
|
1643
1691
|
}
|
|
1644
1692
|
}
|
|
@@ -1651,7 +1699,9 @@ export default {
|
|
|
1651
1699
|
this.showRegionTooltipWithAnnotations(data, true, false);
|
|
1652
1700
|
this.tData.x = 50;
|
|
1653
1701
|
this.tData.y = 200;
|
|
1654
|
-
this._tempPoint
|
|
1702
|
+
if (!this._tempPoint) {
|
|
1703
|
+
this._tempPoint = this.$module.scene.addTemporaryPoints([coords], 0xffff00);
|
|
1704
|
+
}
|
|
1655
1705
|
}
|
|
1656
1706
|
},
|
|
1657
1707
|
drawLine: function(coords, data) {
|
|
@@ -1694,6 +1744,19 @@ export default {
|
|
|
1694
1744
|
setTimeout(this.stopFreeSpin, 4000);
|
|
1695
1745
|
}
|
|
1696
1746
|
},
|
|
1747
|
+
activateEditingMode: function(eventIdentifiers) {
|
|
1748
|
+
let editing = getEditablePoint(eventIdentifiers);
|
|
1749
|
+
if (editing) {
|
|
1750
|
+
this.activatePointEditingMode(editing.zincObject, editing.index,
|
|
1751
|
+
editing.point);
|
|
1752
|
+
} else {
|
|
1753
|
+
editing = getEditableLines(eventIdentifiers);
|
|
1754
|
+
if (editing) {
|
|
1755
|
+
this.activateLineEditingMode(editing.zincObject, editing.faceIndex,
|
|
1756
|
+
editing.vertexIndex, editing.point);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1697
1760
|
activateAnnotationMode: function(names, event) {
|
|
1698
1761
|
if (this.authorisedUser || this.offlineAnnotationEnabled) {
|
|
1699
1762
|
this.createData.toBeDeleted = false;
|
|
@@ -1709,11 +1772,7 @@ export default {
|
|
|
1709
1772
|
} else {
|
|
1710
1773
|
//Make sure the tooltip is displayed with annotaion mode
|
|
1711
1774
|
if (this.activeDrawMode === "Edit") {
|
|
1712
|
-
|
|
1713
|
-
if (editing) {
|
|
1714
|
-
this.activateEditingMode(editing.zincObject, editing.faceIndex,
|
|
1715
|
-
editing.vertexIndex, editing.point);
|
|
1716
|
-
}
|
|
1775
|
+
this.activateEditingMode(event.identifiers);
|
|
1717
1776
|
} else if (this.activeDrawMode === "Delete") {
|
|
1718
1777
|
const zincObject = getDeletableObjects(event);
|
|
1719
1778
|
if (zincObject) {
|
|
@@ -1731,7 +1790,13 @@ export default {
|
|
|
1731
1790
|
this.showRegionTooltipWithAnnotations(event.identifiers, true, true);
|
|
1732
1791
|
}
|
|
1733
1792
|
},
|
|
1734
|
-
|
|
1793
|
+
activatePointEditingMode: function(zincObject, index, point) {
|
|
1794
|
+
this._editingZincObject = zincObject;
|
|
1795
|
+
this.createData.faceIndex = -1;
|
|
1796
|
+
this.createData.editingIndex = index;
|
|
1797
|
+
//this.drawPoint(point, undefined);
|
|
1798
|
+
},
|
|
1799
|
+
activateLineEditingMode: function(zincObject, faceIndex, vertexIndex, point) {
|
|
1735
1800
|
this._editingZincObject = zincObject;
|
|
1736
1801
|
this.createData.faceIndex = faceIndex;
|
|
1737
1802
|
this.createData.editingIndex = vertexIndex;
|
|
@@ -1777,7 +1842,9 @@ export default {
|
|
|
1777
1842
|
this.tData.label = id;
|
|
1778
1843
|
this.tData.region = regionPath;
|
|
1779
1844
|
const zincObject = getClickedObjects(event);
|
|
1780
|
-
this.
|
|
1845
|
+
if (this.createData.editingIndex === -1 ) {
|
|
1846
|
+
this._editingZincObject = zincObject;
|
|
1847
|
+
}
|
|
1781
1848
|
if (zincObject) {
|
|
1782
1849
|
const regionPath = this._editingZincObject.region.getFullPath() + "/";
|
|
1783
1850
|
const group = this._editingZincObject.groupName;
|
|
@@ -1836,7 +1903,7 @@ export default {
|
|
|
1836
1903
|
this.tData.region = regionPath;
|
|
1837
1904
|
this.tData.x = event.identifiers[0].coords.x;
|
|
1838
1905
|
this.tData.y = event.identifiers[0].coords.y;
|
|
1839
|
-
this.
|
|
1906
|
+
this.createEditTemporaryPrimitive(event.identifiers);
|
|
1840
1907
|
}
|
|
1841
1908
|
}
|
|
1842
1909
|
/**
|
|
@@ -1853,7 +1920,7 @@ export default {
|
|
|
1853
1920
|
this.tData.x = event.identifiers[0].coords.x - offsets.left;
|
|
1854
1921
|
this.tData.y = event.identifiers[0].coords.y - offsets.top;
|
|
1855
1922
|
}
|
|
1856
|
-
this.
|
|
1923
|
+
this.createEditTemporaryPrimitive(event.identifiers);
|
|
1857
1924
|
}
|
|
1858
1925
|
}
|
|
1859
1926
|
}
|
|
@@ -2070,6 +2137,7 @@ export default {
|
|
|
2070
2137
|
this.$module.zincRenderer.removePostRenderCallbackFunction(
|
|
2071
2138
|
this.$_regionTooltipCallback
|
|
2072
2139
|
);
|
|
2140
|
+
this.$module.$_regionTooltipCallback = undefined;
|
|
2073
2141
|
}
|
|
2074
2142
|
this.$_regionTooltipCallback =
|
|
2075
2143
|
this.$module.zincRenderer.addPostRenderCallbackFunction(
|
|
@@ -2097,6 +2165,7 @@ export default {
|
|
|
2097
2165
|
this.$module.zincRenderer.removePostRenderCallbackFunction(
|
|
2098
2166
|
this.$_liveCoordinatesUpdated
|
|
2099
2167
|
);
|
|
2168
|
+
this.$_liveCoordinatesUpdated = undefined;
|
|
2100
2169
|
}
|
|
2101
2170
|
if (liveUpdates) {
|
|
2102
2171
|
this.$module.setupLiveCoordinates(objects);
|
|
@@ -2168,6 +2237,10 @@ export default {
|
|
|
2168
2237
|
showRegionTooltipWithAnnotations: function (annotations, resetView, liveUpdates) {
|
|
2169
2238
|
if (this.$module.scene) {
|
|
2170
2239
|
const result = getObjectsFromAnnotations(this.$module.scene, annotations);
|
|
2240
|
+
if (this._editingZincObject) {
|
|
2241
|
+
result.regionPath = this._editingZincObject.region.getFullPath() + "/";
|
|
2242
|
+
result.label = this._editingZincObject.groupName;
|
|
2243
|
+
}
|
|
2171
2244
|
if (result && result.objects.length > 0) {
|
|
2172
2245
|
if (!this.annotationSidebar) {
|
|
2173
2246
|
return this.showRegionTooltipWithObjects(
|
|
@@ -2308,6 +2381,7 @@ export default {
|
|
|
2308
2381
|
);
|
|
2309
2382
|
//Unset the tracking
|
|
2310
2383
|
this.$module.setupLiveCoordinates(undefined);
|
|
2384
|
+
this.$_liveCoordinatesUpdated = undefined;
|
|
2311
2385
|
}
|
|
2312
2386
|
this.tData.active = false;
|
|
2313
2387
|
this.tData.visible = false;
|
|
@@ -2568,6 +2642,13 @@ export default {
|
|
|
2568
2642
|
}
|
|
2569
2643
|
}
|
|
2570
2644
|
},
|
|
2645
|
+
calculateBoundingBox: function() {
|
|
2646
|
+
if (this.isReady) {
|
|
2647
|
+
const {centre, size} = this.$module.getCentreAndSize();
|
|
2648
|
+
this.boundingDims.centre = centre;
|
|
2649
|
+
this.boundingDims.size = size;
|
|
2650
|
+
}
|
|
2651
|
+
},
|
|
2571
2652
|
downloadErrorCallback: function() {
|
|
2572
2653
|
return (error) => {
|
|
2573
2654
|
this.$emit('on-error', error);
|
|
@@ -2592,9 +2673,7 @@ export default {
|
|
|
2592
2673
|
this._slides = this.$module.scene.addSlicesPrimitive(
|
|
2593
2674
|
"_helper", ["x-plane", "y-plane", "z-plane"], [0xFF5555, 0x55FF55, 0x5555FF],
|
|
2594
2675
|
0.5);
|
|
2595
|
-
|
|
2596
|
-
this.boundingDims.centre = centre;
|
|
2597
|
-
this.boundingDims.size = size;
|
|
2676
|
+
this.calculateBoundingBox();
|
|
2598
2677
|
//this.$module.scene.createAxisDisplay(false);
|
|
2599
2678
|
//this.$module.scene.enableAxisDisplay(true, true);
|
|
2600
2679
|
this.isReady = true;
|
|
@@ -19,7 +19,7 @@ const OrgansSceneData = function() {
|
|
|
19
19
|
/**
|
|
20
20
|
* Viewer of 3D-organs models. Users can toggle on/off different views. Data is
|
|
21
21
|
* displayed instead if models are not available.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
23
|
* @class
|
|
24
24
|
* @param {PJP.ModelsLoader}
|
|
25
25
|
* ModelsLoaderIn - defined in modelsLoade.js, providing locations of
|
|
@@ -49,7 +49,7 @@ const OrgansSceneData = function() {
|
|
|
49
49
|
this.isIgnorePicking = function() {
|
|
50
50
|
return ignorePicking;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
this.setIgnorePicking = function(value) {
|
|
54
54
|
ignorePicking = value;
|
|
55
55
|
}
|
|
@@ -74,7 +74,7 @@ const OrgansSceneData = function() {
|
|
|
74
74
|
}
|
|
75
75
|
_this.sceneData.currentTime = value;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
/**
|
|
79
79
|
* Update the time slider and other renderers/scenes when time has changed.
|
|
80
80
|
*/
|
|
@@ -89,7 +89,7 @@ const OrgansSceneData = function() {
|
|
|
89
89
|
if (!_this.sceneData.nerveMapIsActive && pickerScene)
|
|
90
90
|
pickerScene.setMorphsTime(currentTime);
|
|
91
91
|
if (_this.sceneData.nerveMap && _this.sceneData.nerveMap.additionalReader)
|
|
92
|
-
_this.sceneData.nerveMap.additionalReader.setTime(currentTime /
|
|
92
|
+
_this.sceneData.nerveMap.additionalReader.setTime(currentTime /
|
|
93
93
|
duration);
|
|
94
94
|
_this.sceneData.currentTime = currentTime / duration * 100.0;
|
|
95
95
|
}
|
|
@@ -132,7 +132,7 @@ const OrgansSceneData = function() {
|
|
|
132
132
|
this.NDCCameraControl.setCenterZoom(center, zoom);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
const postRenderSelectedCoordinatesUpdate = function() {
|
|
137
137
|
//It is animating, the coordinates may have been updated
|
|
138
138
|
if (_this.zincRenderer.playAnimation && _this.liveUpdatesObjects) {
|
|
@@ -146,19 +146,19 @@ const OrgansSceneData = function() {
|
|
|
146
146
|
_this.selectedScreenCoordinates.y = coord.y;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
const preRenderUpdateCallback = function() {
|
|
151
151
|
return function() {
|
|
152
152
|
preRenderTimeUpdate();
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
|
|
156
156
|
const postRenderUpdateCallback = function() {
|
|
157
157
|
return function() {
|
|
158
158
|
postRenderSelectedCoordinatesUpdate();
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
|
|
162
162
|
/**
|
|
163
163
|
* Add a callback which will be called when time has changed
|
|
164
164
|
*/
|
|
@@ -166,7 +166,7 @@ const OrgansSceneData = function() {
|
|
|
166
166
|
if (typeof(callback === "function"))
|
|
167
167
|
timeChangedCallbacks.push(callback);
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
|
|
170
170
|
this.setTexturePos = function(value) {
|
|
171
171
|
if (_this.sceneData.nerveMap && _this.sceneData.nerveMap.additionalReader)
|
|
172
172
|
_this.sceneData.nerveMap.additionalReader.setSliderPos(value);
|
|
@@ -177,7 +177,7 @@ const OrgansSceneData = function() {
|
|
|
177
177
|
sceneChangedCallbacks.push(callback);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
|
|
181
181
|
this.addOrganPartAddedCallback = function(callback) {
|
|
182
182
|
if (typeof(callback === "function"))
|
|
183
183
|
organPartAddedCallbacks.push(callback);
|
|
@@ -223,7 +223,7 @@ const OrgansSceneData = function() {
|
|
|
223
223
|
let intersectedObject = undefined;
|
|
224
224
|
if (intersected !== undefined) {
|
|
225
225
|
let marker = false;
|
|
226
|
-
if (intersected.object.userData &&
|
|
226
|
+
if (intersected.object.userData &&
|
|
227
227
|
intersected.object.userData.isMarker) {
|
|
228
228
|
marker = true;
|
|
229
229
|
intersectedObject = intersected.object.userData.parent.getMorph();
|
|
@@ -247,12 +247,12 @@ const OrgansSceneData = function() {
|
|
|
247
247
|
}
|
|
248
248
|
return {"id":id, "object":intersectedObject};
|
|
249
249
|
}
|
|
250
|
-
|
|
250
|
+
|
|
251
251
|
/**
|
|
252
252
|
* Callback function when a pickable object has been picked. It will then
|
|
253
253
|
* call functions in tissueViewer and cellPanel to show corresponding
|
|
254
254
|
* informations.
|
|
255
|
-
*
|
|
255
|
+
*
|
|
256
256
|
* @callback
|
|
257
257
|
*/
|
|
258
258
|
const _pickingCallback = function() {
|
|
@@ -271,7 +271,7 @@ const OrgansSceneData = function() {
|
|
|
271
271
|
const coords = { x: window_x, y: window_y };
|
|
272
272
|
if (idObject.id) {
|
|
273
273
|
extraData.threeID = idObject.object?.id;
|
|
274
|
-
if (idObject.object.userData.isGlyph) {
|
|
274
|
+
if (idObject.object.userData.isGlyph) {
|
|
275
275
|
if (idObject.object.name) {
|
|
276
276
|
_this.setSelectedByObjects([idObject.object], coords,
|
|
277
277
|
extraData, true);
|
|
@@ -289,10 +289,10 @@ const OrgansSceneData = function() {
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
-
|
|
292
|
+
|
|
293
293
|
/**
|
|
294
294
|
* Callback function when a pickable object has been hovered over.
|
|
295
|
-
*
|
|
295
|
+
*
|
|
296
296
|
* @callback
|
|
297
297
|
*/
|
|
298
298
|
const _hoverCallback = function() {
|
|
@@ -382,7 +382,7 @@ const OrgansSceneData = function() {
|
|
|
382
382
|
if (pickerScene)
|
|
383
383
|
changeOrganPartsVisibilityForScene(pickerScene, name, value, 'pointsets');
|
|
384
384
|
}
|
|
385
|
-
|
|
385
|
+
|
|
386
386
|
/**
|
|
387
387
|
* Change visibility for parts of the current scene.
|
|
388
388
|
*/
|
|
@@ -394,13 +394,13 @@ const OrgansSceneData = function() {
|
|
|
394
394
|
if (pickerScene)
|
|
395
395
|
changeOrganPartsVisibilityForScene(pickerScene, name, value, type);
|
|
396
396
|
}
|
|
397
|
-
|
|
397
|
+
|
|
398
398
|
this.changeOrganPartsVisibilityCallback = function(name) {
|
|
399
399
|
return function(value) {
|
|
400
400
|
_this.changeOrganPartsVisibility(name, value);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
|
|
404
404
|
this.changeBackgroundColour = function(backgroundColourString) {
|
|
405
405
|
const colour = new THREE.Color(backgroundColourString);
|
|
406
406
|
if (_this.zincRenderer) {
|
|
@@ -447,7 +447,7 @@ const OrgansSceneData = function() {
|
|
|
447
447
|
removeOrganPart(systemName, partName, useDefautColour, zincObject);
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
|
|
450
|
+
|
|
451
451
|
const downloadCompletedCallback = function() {
|
|
452
452
|
return function() {
|
|
453
453
|
_this.settingsChanged();
|
|
@@ -459,7 +459,7 @@ const OrgansSceneData = function() {
|
|
|
459
459
|
|
|
460
460
|
//The payload can either be a zinc object when the loading is successful or
|
|
461
461
|
//an object containg the details of error message on failure.
|
|
462
|
-
//We only use it to handle an error
|
|
462
|
+
//We only use it to handle an error
|
|
463
463
|
const singleItemFinishCallback = function() {
|
|
464
464
|
return function(payload) {
|
|
465
465
|
|
|
@@ -474,7 +474,7 @@ const OrgansSceneData = function() {
|
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
|
|
477
|
+
|
|
478
478
|
/**
|
|
479
479
|
* Toggle data field displays. Data fields displays flow/pressure and <button @click="play">Play</button>
|
|
480
480
|
* other activities of the organs.
|
|
@@ -499,11 +499,11 @@ const OrgansSceneData = function() {
|
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
|
|
502
|
+
|
|
503
503
|
/**
|
|
504
504
|
* Return an array containing name(s) of species that also contains the
|
|
505
505
|
* currently displayed organs.
|
|
506
|
-
*
|
|
506
|
+
*
|
|
507
507
|
* @returns {Array} containing species name
|
|
508
508
|
*/
|
|
509
509
|
this.getAvailableSpecies = function(currentSpecies, currentSystem, currentPart) {
|
|
@@ -534,7 +534,7 @@ const OrgansSceneData = function() {
|
|
|
534
534
|
const size = [vector.x, vector.y, vector.z];
|
|
535
535
|
return {centre, size};
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
|
|
538
538
|
const setSceneData = function(speciesName, systemName, partName, organsDetails) {
|
|
539
539
|
_this.sceneData.nerveMapIsActive = false;
|
|
540
540
|
_this.sceneData.nerveMap = undefined;
|
|
@@ -623,14 +623,14 @@ const OrgansSceneData = function() {
|
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
|
|
626
|
+
|
|
627
627
|
this.alignCameraWithSelectedObject = function(transitionTime) {
|
|
628
628
|
const objects = _this.graphicsHighlight.getSelected();
|
|
629
629
|
if (objects && objects[0] && objects[0].userData) {
|
|
630
630
|
_this.scene.alignObjectToCameraView(objects[0].userData, transitionTime);
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
|
|
633
|
+
|
|
634
634
|
this.exportSettings = function() {
|
|
635
635
|
const settings = {};
|
|
636
636
|
settings.name = _this.instanceName;
|
|
@@ -646,7 +646,7 @@ const OrgansSceneData = function() {
|
|
|
646
646
|
settings.dialog = "Organ Viewer";
|
|
647
647
|
return settings;
|
|
648
648
|
}
|
|
649
|
-
|
|
649
|
+
|
|
650
650
|
this.importSettings = function(settings) {
|
|
651
651
|
if (settings && (settings.dialog == this.typeName)) {
|
|
652
652
|
_this.setName(settings.name);
|
|
@@ -660,11 +660,11 @@ const OrgansSceneData = function() {
|
|
|
660
660
|
}
|
|
661
661
|
return false;
|
|
662
662
|
}
|
|
663
|
-
|
|
663
|
+
|
|
664
664
|
/**
|
|
665
665
|
* initialise loading of the html layout for the organs panel, this is
|
|
666
666
|
* called when the {@link PJP.OrgansViewer} is created.
|
|
667
|
-
*
|
|
667
|
+
*
|
|
668
668
|
* @async
|
|
669
669
|
*/
|
|
670
670
|
const initialise = function() {
|
|
@@ -674,7 +674,7 @@ const OrgansSceneData = function() {
|
|
|
674
674
|
_this.zincRenderer.addPostRenderCallbackFunction(postRenderUpdateCallback());
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
|
-
|
|
677
|
+
|
|
678
678
|
initialise();
|
|
679
679
|
|
|
680
680
|
}
|
package/src/scripts/Utilities.js
CHANGED
|
@@ -33,15 +33,31 @@ const getDistance = (point1, point2) => {
|
|
|
33
33
|
return Math.sqrt(dist0 * dist0 + dist1 * dist1 + dist2 * dist2);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export const
|
|
37
|
-
const zincObjects = event.zincObjects;
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export const getEditablePoint = (eventIdentifiers) => {
|
|
37
|
+
//const zincObjects = event.zincObjects;
|
|
38
|
+
const zincObject = eventIdentifiers[0].data?.zincObject;
|
|
39
|
+
if (zincObject) {
|
|
40
|
+
if (zincObject.isEditable && zincObject.isPointset) {
|
|
41
|
+
const info = eventIdentifiers[0].extraData.intersected;
|
|
42
|
+
if (info && info.index > -1) {
|
|
43
|
+
const v = zincObject.getVerticesByIndex(info.index);
|
|
44
|
+
if (v) {
|
|
45
|
+
return { zincObject, index: info.index, point: v};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const getEditableLines = (eventIdentifiers) => {
|
|
54
|
+
const zincObject = eventIdentifiers[0].data?.zincObject;
|
|
55
|
+
if (zincObject) {
|
|
40
56
|
if (zincObject.isEditable && zincObject.isLines2) {
|
|
41
|
-
const info =
|
|
57
|
+
const info = eventIdentifiers[0].extraData.intersected;
|
|
42
58
|
if (info && info.faceIndex > -1) {
|
|
43
59
|
const v = zincObject.getVerticesByFaceIndex(info.faceIndex);
|
|
44
|
-
const p =
|
|
60
|
+
const p = eventIdentifiers[0].extraData.intersected.pointOnLine;
|
|
45
61
|
if (v.length > 1) {
|
|
46
62
|
const dist0 = getDistance(v[0], [p.x, p.y, p.z]);
|
|
47
63
|
const dist1 = getDistance(v[1], [p.x, p.y, p.z]);
|
|
@@ -111,7 +127,7 @@ export const getLineDistance = (zincObject, faceIndex) => {
|
|
|
111
127
|
}
|
|
112
128
|
return 0;
|
|
113
129
|
}
|
|
114
|
-
|
|
130
|
+
|
|
115
131
|
//Move or extend a line
|
|
116
132
|
export const moveAndExtendLine = (zincObject, faceIndex, unit, extendOnly) => {
|
|
117
133
|
if (zincObject && unit !== 0.0) {
|
|
@@ -218,7 +234,7 @@ export const convertUUIDsToFullPaths = (rootRegion, IDs) => {
|
|
|
218
234
|
let region = undefined;
|
|
219
235
|
let primitive = undefined;
|
|
220
236
|
let regionID = undefined;
|
|
221
|
-
|
|
237
|
+
|
|
222
238
|
IDs.forEach(id => {
|
|
223
239
|
const uuids = id.split("/");
|
|
224
240
|
regionID = uuids[0];
|