@abi-software/scaffoldvuer 1.10.0-beta.0 → 1.10.0-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.10.0-beta.0",
3
+ "version": "1.10.0-beta.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,7 @@
41
41
  "*.js"
42
42
  ],
43
43
  "dependencies": {
44
- "@abi-software/map-utilities": "^1.6.0-beta.0",
44
+ "@abi-software/map-utilities": "^1.6.0-beta.1",
45
45
  "@abi-software/sparc-annotation": "^0.3.2",
46
46
  "@abi-software/svg-sprite": "^1.0.1",
47
47
  "@element-plus/icons-vue": "^2.3.1",
@@ -54,7 +54,7 @@
54
54
  "vue": "^3.4.21",
55
55
  "vue-router": "^4.2.5",
56
56
  "vue3-component-svg-sprite": "^0.0.1",
57
- "zincjs": "^1.13.2"
57
+ "zincjs": "^1.14.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@vitejs/plugin-vue": "^4.6.2",
@@ -184,6 +184,7 @@ export default {
184
184
  regionData.children = [];
185
185
  }
186
186
  const child = {
187
+ disabled: false,
187
188
  label: zincObject.groupName,
188
189
  id: region.uuid + "/" + zincObject.uuid,
189
190
  isPrimitives: true,
@@ -225,7 +226,8 @@ export default {
225
226
  if (isPrimitives) {
226
227
  const primitives = region.findObjectsWithGroupName(node.label);
227
228
  primitives.forEach((primitive) => {
228
- primitive.setVisibility(isChecked);
229
+ const visibility = isChecked && !node.disabled;
230
+ primitive.setVisibility(visibility);
229
231
  });
230
232
  }
231
233
  },
@@ -322,6 +324,19 @@ export default {
322
324
  this.treeData[0].id = undefined;
323
325
  this.$emit("object-selected", []);
324
326
  },
327
+ forEachChildInNode: function(node, checkedList, regionPath, parentsAreVisible, callback) {
328
+ if (node.isRegion) {
329
+ if (node.children) {
330
+ const isVisible = regionPath === '' || checkedList.includes(node.id);
331
+ node.children.forEach(
332
+ child => this.forEachChildInNode(
333
+ child, checkedList, node.regionPath, parentsAreVisible && isVisible, callback)
334
+ );
335
+ }
336
+ } else if (node.isPrimitives) {
337
+ callback(node, regionPath, parentsAreVisible);
338
+ }
339
+ },
325
340
  getColour: function (nodeData) {
326
341
  //Do not need to check for primitives as this is checked on the template
327
342
  if (nodeData) {
@@ -401,6 +416,56 @@ export default {
401
416
  });
402
417
  }
403
418
  },
419
+ updateAllNodeColours: function() {
420
+ const checkedList =
421
+ this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
422
+ this.forEachChildInNode(
423
+ this.treeData[0],
424
+ checkedList,
425
+ "",
426
+ true,
427
+ (node, regionPath, parentsAreVisible) => {
428
+ if (node.isPrimitives) {
429
+ node.activeColour = this.getColour(node);
430
+ }
431
+ }
432
+ );
433
+ },
434
+ setOutlines: function(flag) {
435
+ const checkedList =
436
+ this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
437
+ this.forEachChildInNode(
438
+ this.treeData[0],
439
+ checkedList,
440
+ "",
441
+ true,
442
+ (node, regionPath, parentsAreVisible) => {
443
+ const region = this.module.scene
444
+ .getRootRegion()
445
+ .findChildFromPath(regionPath);
446
+ const primitives = region.findObjectsWithGroupName(node.label);
447
+ if (flag) {
448
+ primitives.forEach((primitive) => {
449
+ if (primitive.isLines) {
450
+ if (checkedList.includes(node.id) && parentsAreVisible) {
451
+ primitive.setVisibility(true);
452
+ }
453
+ node.disabled = false;
454
+ }
455
+ });
456
+ } else {
457
+ if (node.isPrimitives) {
458
+ primitives.forEach((primitive) => {
459
+ if (primitive.isLines) {
460
+ primitive.setVisibility(false);
461
+ node.disabled = true;
462
+ }
463
+ });
464
+ }
465
+ }
466
+ }
467
+ );
468
+ },
404
469
  visibilityToggle: function (item, event) {
405
470
  this.module.changeOrganPartsVisibility(item, event);
406
471
  if (event == false) {
@@ -100,7 +100,7 @@
100
100
  <ScaffoldTreeControls
101
101
  ref="scaffoldTreeControls"
102
102
  :isReady="isReady"
103
- :show-colour-picker="showColourPicker"
103
+ :show-colour-picker="enableColourPicker"
104
104
  @object-selected="objectSelected"
105
105
  @object-hovered="objectHovered"
106
106
  @drawer-toggled="drawerToggled"
@@ -318,6 +318,30 @@
318
318
  </el-row>
319
319
  </el-row>
320
320
  <el-row class="backgroundSpacer"></el-row>
321
+ <el-row class="backgroundText">Organs display</el-row>
322
+ <el-row class="backgroundControl">
323
+ <el-radio-group
324
+ v-model="colourRadio"
325
+ class="scaffold-radio"
326
+ @change="setColour"
327
+ >
328
+ <el-radio :value="true">Colour</el-radio>
329
+ <el-radio :value="false">Greyscale</el-radio>
330
+ </el-radio-group>
331
+ </el-row>
332
+ <el-row class="backgroundSpacer"></el-row>
333
+ <el-row class="backgroundText">Outlines display</el-row>
334
+ <el-row class="backgroundControl">
335
+ <el-radio-group
336
+ v-model="outlinesRadio"
337
+ class="scaffold-radio"
338
+ @change="setOutlines"
339
+ >
340
+ <el-radio :value="true">Show</el-radio>
341
+ <el-radio :value="false">Hide</el-radio>
342
+ </el-radio-group>
343
+ </el-row>
344
+ <el-row class="backgroundSpacer"></el-row>
321
345
  <el-row class="backgroundText"> Change background </el-row>
322
346
  <el-row class="backgroundChooser">
323
347
  <div
@@ -418,6 +442,8 @@ import {
418
442
  ElButton as Button,
419
443
  ElCol as Col,
420
444
  ElLoading as Loading,
445
+ ElRadio as Radio,
446
+ ElRadioGroup as RadioGroup,
421
447
  ElOption as Option,
422
448
  ElPopover as Popover,
423
449
  ElRow as Row,
@@ -447,6 +473,8 @@ export default {
447
473
  Loading,
448
474
  Option,
449
475
  Popover,
476
+ Radio,
477
+ RadioGroup,
450
478
  Row,
451
479
  Select,
452
480
  Slider,
@@ -643,6 +671,15 @@ export default {
643
671
  type: Boolean,
644
672
  default: false,
645
673
  },
674
+ /**
675
+ * Define what is considered as nerves.
676
+ */
677
+ isNerves: {
678
+ type: Object,
679
+ default: {
680
+ regions: ["nerves"]
681
+ },
682
+ },
646
683
  /**
647
684
  * This array populate the the openMapOptions popup.
648
685
  * Each entry contains a pair of display and key.
@@ -732,6 +769,7 @@ export default {
732
769
  data: function () {
733
770
  return {
734
771
  annotator: undefined,
772
+ colourRadio: true,
735
773
  createData: {
736
774
  drawingBox: false,
737
775
  toBeConfirmed: false,
@@ -808,6 +846,7 @@ export default {
808
846
  currentSpeed: 1,
809
847
  timeStamps: {},
810
848
  defaultCheckedKeys: [],
849
+ outlinesRadio: true,
811
850
  tData: {
812
851
  label: "",
813
852
  region: "",
@@ -979,6 +1018,9 @@ export default {
979
1018
  return this.viewingMode === 'Annotation' && this.tData.active === true &&
980
1019
  (this.activeDrawMode !== "Point" && this.activeDrawMode !== 'LineString');
981
1020
  },
1021
+ enableColourPicker: function() {
1022
+ return this.showColourPicker && this.colourRadio;
1023
+ },
982
1024
  modeDescription: function () {
983
1025
  let description = this.viewingModes[this.viewingMode];
984
1026
  if (this.viewingMode === 'Annotation') {
@@ -1023,6 +1065,18 @@ export default {
1023
1065
  if (this.timeVarying === false && zincObject.isTimeVarying()) {
1024
1066
  this.timeVarying = true;
1025
1067
  }
1068
+ //Temporary way to mark an object as nerves
1069
+ const regions = this.isNerves?.regions;
1070
+ if (regions) {
1071
+ const regionPath = zincObject.getRegion().getFullPath().toLowerCase();
1072
+ for (let i = 0; i < regions.length; i++) {
1073
+ if (regionPath.includes(regions[i].toLowerCase())) {
1074
+ zincObject.userData.isNerves = true;
1075
+ } else {
1076
+ zincObject.userData.isNerves = false;
1077
+ }
1078
+ }
1079
+ }
1026
1080
  /**
1027
1081
  * Emit when a new object is added to the scene
1028
1082
  * @arg {Object} "The object added to the sceene"
@@ -2129,6 +2183,42 @@ export default {
2129
2183
  this.tData.visible = false;
2130
2184
  this.tData.region = undefined;
2131
2185
  },
2186
+ /**
2187
+ * @public
2188
+ * Function to toggle colour/greyscale of primitives.
2189
+ * The parameter ``flag`` is a boolean, ``true`` (colour) and ``false`` (greyscale).
2190
+ * @arg {Boolean} `flag`
2191
+ */
2192
+ setColour: function (flag) {
2193
+ if (this.isReady && this.$module.scene &&
2194
+ typeof flag === "boolean" && flag !== this.colourRadio) {
2195
+ this.loading = true;
2196
+ //This can take sometime to finish , nextTick does not bring out
2197
+ //the loading screen so I opt for timeout loop here.
2198
+ setTimeout(() => {
2199
+ const objects = this.$module.scene.getRootRegion().getAllObjects(true);
2200
+ objects.forEach((zincObject) => {
2201
+ if (!zincObject.userData.isNerves) zincObject.setGreyScale(!flag);
2202
+ });
2203
+ this.$refs.scaffoldTreeControls.updateAllNodeColours();
2204
+ this.loading = false;
2205
+ this.colourRadio = flag;
2206
+ }, 100);
2207
+ }
2208
+ },
2209
+ /**
2210
+ * @public
2211
+ * Function to toggle lines graphics.
2212
+ * The parameter ``flag`` is a boolean, ``true`` to show lines, ``false`` to hide them.
2213
+ * @arg {Boolean} `flag`
2214
+ */
2215
+ setOutlines: function (flag) {
2216
+ if (this.isReady && this.$module.scene &&
2217
+ typeof flag === "boolean" && flag !== this.outlinesRadio) {
2218
+ this.outlinesRadio = flag;
2219
+ this.$nextTick(() => this.$refs.scaffoldTreeControls.setOutlines(flag));
2220
+ }
2221
+ },
2132
2222
  /**
2133
2223
  * Set the marker modes for objects with the provided name, mode can
2134
2224
  * be "on", "off" or "inherited".
@@ -2289,9 +2379,15 @@ export default {
2289
2379
  if (options.background) {
2290
2380
  this.backgroundChangeCallback(options.background);
2291
2381
  }
2382
+ if ("colour" in options) {
2383
+ this.setColour(options.colour);
2384
+ }
2292
2385
  if (options.offlineAnnotations) {
2293
2386
  sessionStorage.setItem('anonymous-annotation', options.offlineAnnotations);
2294
2387
  }
2388
+ if ("outlines" in options) {
2389
+ this.setOutlines(options.outlines);
2390
+ }
2295
2391
  if (options.viewingMode) {
2296
2392
  this.changeViewingMode(options.viewingMode);
2297
2393
  }
@@ -2321,7 +2417,6 @@ export default {
2321
2417
  /**
2322
2418
  * Emit when all objects have been loaded
2323
2419
  */
2324
- this.$emit("on-ready");
2325
2420
  this.setMarkers();
2326
2421
  //Create a bounding box.
2327
2422
  this._boundingBoxGeo = this.$module.scene.addBoundingBoxPrimitive(
@@ -2333,10 +2428,13 @@ export default {
2333
2428
  const {centre, size} = this.$module.getCentreAndSize();
2334
2429
  this.boundingDims.centre = centre;
2335
2430
  this.boundingDims.size = size;
2336
- this.$nextTick(() => this.restoreSettings(options) );
2337
2431
  //this.$module.scene.createAxisDisplay(false);
2338
2432
  //this.$module.scene.enableAxisDisplay(true, true);
2339
2433
  this.isReady = true;
2434
+ this.$nextTick(() => {
2435
+ this.restoreSettings(options);
2436
+ this.$emit("on-ready");
2437
+ });
2340
2438
  };
2341
2439
  },
2342
2440
  /**
@@ -2352,6 +2450,8 @@ export default {
2352
2450
  viewport: undefined,
2353
2451
  visibility: undefined,
2354
2452
  background: this.currentBackground,
2453
+ colour: this.colourRadio,
2454
+ outlines: this.outlinesRadio,
2355
2455
  viewingMode: this.viewingMode,
2356
2456
  };
2357
2457
  if (this.$refs.scaffoldTreeControls)
@@ -2383,23 +2483,28 @@ export default {
2383
2483
  viewport: state.viewport,
2384
2484
  visibility: state.visibility,
2385
2485
  background: state.background,
2486
+ colour: state.colour,
2487
+ outlines: state.outlines,
2386
2488
  viewingMode: state.viewingMode,
2387
2489
  search: state.search,
2388
2490
  offlineAnnotations: state.offlineAnnotations,
2389
2491
  });
2390
2492
  } else {
2391
- if (state.background || state.search || state.viewport || state.viewingMode || state.visibility) {
2493
+ if (state.background || state.colour || state.search || state.outlines ||
2494
+ state.viewport || state.viewingMode || state.visibility) {
2392
2495
  if (this.isReady && this.$module.scene) {
2393
2496
  this.restoreSettings(state);
2394
2497
  } else {
2395
2498
  this.$module.setFinishDownloadCallback(
2396
2499
  this.setURLFinishCallback({
2397
2500
  background: state.background,
2501
+ colour: state.colour,
2502
+ search: state.search,
2503
+ offlineAnnotations: state.offlineAnnotations,
2504
+ outlines: state.outlines,
2398
2505
  viewingMode: state.viewingMode,
2399
2506
  viewport: state.viewport,
2400
2507
  visibility: state.visibility,
2401
- search: state.search,
2402
- offlineAnnotations: state.offlineAnnotations,
2403
2508
  })
2404
2509
  );
2405
2510
  }
@@ -2483,6 +2588,8 @@ export default {
2483
2588
  this.$module.setFinishDownloadCallback(
2484
2589
  this.setURLFinishCallback({
2485
2590
  background: state?.background,
2591
+ colour: state?.colour,
2592
+ outlines: state?.outlines,
2486
2593
  region: this.region,
2487
2594
  search: state?.search,
2488
2595
  viewingMode: state?.viewingMode,
@@ -2919,6 +3026,30 @@ export default {
2919
3026
  }
2920
3027
  }
2921
3028
 
3029
+ .scaffold-radio {
3030
+ :deep(label) {
3031
+ margin-right: 20px;
3032
+ &:last-child {
3033
+ margin-right: 0px;
3034
+ }
3035
+ }
3036
+ :deep(.el-radio__input) {
3037
+ &.is-checked {
3038
+ & + .el-radio__label {
3039
+ color: $app-primary-color;
3040
+ }
3041
+ .el-radio__inner {
3042
+ border-color: $app-primary-color;
3043
+ background: $app-primary-color;
3044
+ }
3045
+ }
3046
+ .el-radio__inner:hover {
3047
+ border-color: $app-primary-color;
3048
+ }
3049
+ }
3050
+ }
3051
+
3052
+
2922
3053
  :deep(.scaffold-popper.el-popper.el-popper) {
2923
3054
  padding: 6px 4px;
2924
3055
  font-size: 12px;
@@ -23,6 +23,8 @@ declare module 'vue' {
23
23
  ElMain: typeof import('element-plus/es')['ElMain']
24
24
  ElOption: typeof import('element-plus/es')['ElOption']
25
25
  ElPopover: typeof import('element-plus/es')['ElPopover']
26
+ ElRadio: typeof import('element-plus/es')['ElRadio']
27
+ ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
26
28
  ElRow: typeof import('element-plus/es')['ElRow']
27
29
  ElSelect: typeof import('element-plus/es')['ElSelect']
28
30
  ElSlider: typeof import('element-plus/es')['ElSlider']